1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROData_Object_HeaderFile
24 #define HYDROData_Object_HeaderFile
26 #include <HYDROData_Entity.h>
29 DEFINE_STANDARD_HANDLE(HYDROData_Object, HYDROData_Entity)
32 class Handle(HYDROData_IAltitudeObject);
33 class Handle(HYDROData_DummyObject3D);
34 class Handle(HYDROData_ShapesGroup);
36 /**\class HYDROData_Object
37 * \brief The base class for all geometrical objects in the HYDRO module.
40 class HYDROData_Object : public HYDROData_Entity
44 * Enumeration of tags corresponding to the persistent object parameters.
48 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
51 DataTag_AltitudeObject, ///< reference altitude object
52 DataTag_FillingColor, ///< filling color of geometrical object
53 DataTag_BorderColor, ///< border color of geometrical object
54 DataTag_Object3D, ///< child 3D object
55 DataTag_EdgesGroup, ///< child group objects
56 DataTag_ChildAltitudeObject, ///< child altitude object
60 DEFINE_STANDARD_RTTI(HYDROData_Object);
63 * Updates the name of this object.
64 * Reimplemented to update the names child groups.
66 HYDRODATA_EXPORT virtual void SetName( const QString& theName );
69 * Update the geometry object.
70 * Call this method whenever you made changes for object data.
72 HYDRODATA_EXPORT virtual void Update();
75 * Returns the list of all reference objects of this object.
77 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
80 * Sets the "MustBeUpdated" flag: if object is depended on updated features.
81 * Reimplemented to update the state of child 3D object.
83 HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
87 * Sets the top(2d projection) shape of the object.
89 HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
92 * Returns the top shape of the object.
94 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
97 * Sets the 3d shape of the object.
99 HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
102 * Returns the 3d shape of the object.
104 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
108 * Returns reference object which represent the 3D shape of object.
110 HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
114 * Returns sequence of object groups.
116 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
119 * Returns group data model object by it id.
121 HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) GetGroup( const int theGroupId ) const;
124 * Returns group id by data model object.
126 HYDRODATA_EXPORT virtual int GetGroupId( const Handle(HYDROData_ShapesGroup)& theGroup ) const;
130 * Set reference altitude object for geometry object.
132 HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude );
135 * Returns reference altitude object of geometry object.
137 HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const;
140 * Clear the reference altitude object for geometry object.
142 HYDRODATA_EXPORT virtual void RemoveAltitudeObject();
146 * Sets filling color for object.
148 HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
151 * Returns filling color of object.
153 HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
156 * Sets border color for object.
158 HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
161 * Returns border color of object.
163 HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
168 * Returns default filling color for new object.
170 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
173 * Returns default border color for new object.
175 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
180 * Creates new object in the internal data structure. Use higher level objects
181 * to create objects with real content.
183 HYDRODATA_EXPORT HYDROData_Object();
186 * Destructs properties of the object and object itself, removes it from the document.
188 virtual HYDRODATA_EXPORT ~HYDROData_Object();
193 * Dump the initial object creation to a Python script.
194 * Reimplemented to dump the object colors.
196 HYDRODATA_EXPORT virtual QStringList dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const;
200 * Checks and if necessary create child 3D object.
201 * Reimplement this function in your subclass if you
202 * do not want to create child 3D object.
204 HYDRODATA_EXPORT virtual void checkAndSetObject3D();
208 * Returns the type of child altitude object.
209 * Base implementation returns KIND_UNKNOWN, it means that child altitude
210 * object will not be created inside of checkAndSetAltitudeObject() function.
211 * Reimplement this function in your subclass an return correct altitude
212 * object type if you want to create child altitude object.
214 HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
217 * Checks and if necessary create child altitude object.
219 HYDRODATA_EXPORT virtual void checkAndSetAltitudeObject();
222 * Return the child altitude object.
224 HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) getChildAltitudeObject() const;
228 * Create new one child group object.
230 HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
233 * Remove all child group objects.
235 HYDRODATA_EXPORT virtual void removeGroupObjects();
239 * Retrieve the top shape of the object from data label.
241 HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
244 * Removes the top shape from data label of the object.
246 HYDRODATA_EXPORT void removeTopShape();
250 * Retrieve the 3d shape of the object from data label.
252 HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
255 * Removes the 3d shape from data label of the object.
257 HYDRODATA_EXPORT void removeShape3D();