1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // modify it under the terms of the GNU Lesser General Public
20 // License as published by the Free Software Foundation; either
21 // version 2.1 of the License, or (at your option) any later version.
23 // This library is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 // Lesser General Public License for more details.
28 // You should have received a copy of the GNU Lesser General Public
29 // License along with this library; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
35 #ifndef HYDROData_Object_HeaderFile
36 #define HYDROData_Object_HeaderFile
38 #include <HYDROData_Entity.h>
41 DEFINE_STANDARD_HANDLE(HYDROData_Object, HYDROData_Entity)
44 class Handle(HYDROData_IAltitudeObject);
45 class Handle(HYDROData_DummyObject3D);
46 class Handle(HYDROData_ShapesGroup);
48 /**\class HYDROData_Object
49 * \brief The base class for all geometrical objects in the HYDRO module.
52 class HYDROData_Object : public HYDROData_Entity
56 * Enumeration of tags corresponding to the persistent object parameters.
60 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
63 DataTag_AltitudeObject, ///< reference altitude object
64 DataTag_FillingColor, ///< filling color of geometrical object
65 DataTag_BorderColor, ///< border color of geometrical object
66 DataTag_Object3D, ///< child 3D object
67 DataTag_EdgesGroup, ///< child group objects
68 DataTag_ChildAltitudeObject, ///< child altitude object
69 DataTag_IsSubmersible, ///< the attribute "is submersible"
73 DEFINE_STANDARD_RTTI(HYDROData_Object);
76 * Updates the name of this object.
77 * Reimplemented to update the names child groups.
79 HYDRODATA_EXPORT virtual void SetName( const QString& theName );
82 * Update the geometry object.
83 * Call this method whenever you made changes for object data.
85 HYDRODATA_EXPORT virtual void Update();
88 * Returns the list of all reference objects of this object.
90 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
93 * Sets the "MustBeUpdated" flag: if object is depended on updated features.
94 * Reimplemented to update the state of child 3D object.
96 HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
100 * Sets the top(2d projection) shape of the object.
102 HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
105 * Returns the top shape of the object.
107 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
110 * Sets the 3d shape of the object.
112 HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
115 * Returns the 3d shape of the object.
117 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
121 * Returns reference object which represent the 3D shape of object.
123 HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
127 * Returns sequence of object groups.
129 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
132 * Returns group data model object by it id.
134 HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) GetGroup( const int theGroupId ) const;
137 * Returns group id by data model object.
139 HYDRODATA_EXPORT virtual int GetGroupId( const Handle(HYDROData_ShapesGroup)& theGroup ) const;
143 * Set reference altitude object for geometry object.
145 HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude );
148 * Returns reference altitude object of geometry object.
150 HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const;
153 * Clear the reference altitude object for geometry object.
155 HYDRODATA_EXPORT virtual void RemoveAltitudeObject();
159 * Sets filling color for object.
161 HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
164 * Returns filling color of object.
166 HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
169 * Sets border color for object.
171 HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
174 * Returns border color of object.
176 HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
178 HYDRODATA_EXPORT bool IsSubmersible() const;
179 HYDRODATA_EXPORT void SetIsSubmersible( bool ) const;
184 * Returns default filling color for new object.
186 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
189 * Returns default border color for new object.
191 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
196 * Creates new object in the internal data structure. Use higher level objects
197 * to create objects with real content.
199 HYDRODATA_EXPORT HYDROData_Object();
202 * Destructs properties of the object and object itself, removes it from the document.
204 virtual HYDRODATA_EXPORT ~HYDROData_Object();
209 * Dump the initial object creation to a Python script.
210 * Reimplemented to dump the object colors.
212 HYDRODATA_EXPORT virtual QStringList dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const;
216 * Checks and if necessary create child 3D object.
217 * Reimplement this function in your subclass if you
218 * do not want to create child 3D object.
220 HYDRODATA_EXPORT virtual void checkAndSetObject3D();
224 * Returns the type of child altitude object.
225 * Base implementation returns KIND_UNKNOWN, it means that child altitude
226 * object will not be created inside of checkAndSetAltitudeObject() function.
227 * Reimplement this function in your subclass an return correct altitude
228 * object type if you want to create child altitude object.
230 HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
233 * Checks and if necessary create child altitude object.
235 HYDRODATA_EXPORT virtual void checkAndSetAltitudeObject();
238 * Return the child altitude object.
240 HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) getChildAltitudeObject() const;
244 * Create new one child group object.
246 HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
249 * Remove all child group objects.
251 HYDRODATA_EXPORT virtual void removeGroupObjects();
255 * Retrieve the top shape of the object from data label.
257 HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
260 * Removes the top shape from data label of the object.
262 HYDRODATA_EXPORT void removeTopShape();
266 * Retrieve the 3d shape of the object from data label.
268 HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
271 * Removes the 3d shape from data label of the object.
273 HYDRODATA_EXPORT void removeShape3D();