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 #ifndef HYDROData_Object_HeaderFile
20 #define HYDROData_Object_HeaderFile
22 #include <HYDROData_Entity.h>
24 DEFINE_STANDARD_HANDLE(HYDROData_Object, HYDROData_Entity)
27 class Handle(HYDROData_IAltitudeObject);
28 class Handle(HYDROData_DummyObject3D);
29 class Handle(HYDROData_ShapesGroup);
31 /**\class HYDROData_Object
32 * \brief The base class for all geometrical objects in the HYDRO module.
35 class HYDROData_Object : public HYDROData_Entity
39 * Enumeration of tags corresponding to the persistent object parameters.
43 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
46 DataTag_AltitudeObject, ///< reference altitude object
47 DataTag_FillingColor, ///< filling color of geometrical object
48 DataTag_BorderColor, ///< border color of geometrical object
49 DataTag_Object3D, ///< child 3D object
50 DataTag_EdgesGroup, ///< child group objects
51 DataTag_ChildAltitudeObject, ///< child altitude object
52 DataTag_IsSubmersible, ///< the attribute "is submersible"
56 DEFINE_STANDARD_RTTI(HYDROData_Object);
59 * Updates the name of this object.
60 * Reimplemented to update the names child groups.
62 HYDRODATA_EXPORT virtual void SetName( const QString& theName );
65 * Update the geometry object.
66 * Call this method whenever you made changes for object data.
68 HYDRODATA_EXPORT virtual void Update();
71 * Returns the list of all reference objects of this object.
73 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
76 * Sets the "MustBeUpdated" flag: if object is depended on updated features.
77 * Reimplemented to update the state of child 3D object.
79 HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
83 * Sets the top(2d projection) shape of the object.
85 HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
88 * Returns the top shape of the object.
90 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
93 * Sets the 3d shape of the object.
95 HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
98 * Returns the 3d shape of the object.
100 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
104 * Returns reference object which represent the 3D shape of object.
106 HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
110 * Returns sequence of object groups.
112 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
115 * Returns group data model object by it id.
117 HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) GetGroup( const int theGroupId ) const;
120 * Returns group id by data model object.
122 HYDRODATA_EXPORT virtual int GetGroupId( const Handle(HYDROData_ShapesGroup)& theGroup ) const;
126 * Set reference altitude object for geometry object.
128 HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude );
131 * Returns reference altitude object of geometry object.
133 HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const;
136 * Clear the reference altitude object for geometry object.
138 HYDRODATA_EXPORT virtual void RemoveAltitudeObject();
142 * Sets filling color for object.
144 HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
147 * Returns filling color of object.
149 HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
152 * Sets border color for object.
154 HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
157 * Returns border color of object.
159 HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
161 HYDRODATA_EXPORT bool IsSubmersible() const;
162 HYDRODATA_EXPORT void SetIsSubmersible( bool ) const;
167 * Returns default filling color for new object.
169 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
172 * Returns default border color for new object.
174 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
179 * Creates new object in the internal data structure. Use higher level objects
180 * to create objects with real content.
182 HYDRODATA_EXPORT HYDROData_Object();
185 * Destructs properties of the object and object itself, removes it from the document.
187 virtual HYDRODATA_EXPORT ~HYDROData_Object();
192 * Dump the initial object creation to a Python script.
193 * Reimplemented to dump the object colors.
195 HYDRODATA_EXPORT virtual QStringList dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const;
199 * Checks and if necessary create child 3D object.
200 * Reimplement this function in your subclass if you
201 * do not want to create child 3D object.
203 HYDRODATA_EXPORT virtual void checkAndSetObject3D();
207 * Returns the type of child altitude object.
208 * Base implementation returns KIND_UNKNOWN, it means that child altitude
209 * object will not be created inside of checkAndSetAltitudeObject() function.
210 * Reimplement this function in your subclass an return correct altitude
211 * object type if you want to create child altitude object.
213 HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
216 * Checks and if necessary create child altitude object.
218 HYDRODATA_EXPORT virtual void checkAndSetAltitudeObject();
221 * Return the child altitude object.
223 HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) getChildAltitudeObject() const;
227 * Create new one child group object.
229 HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
232 * Remove all child group objects.
234 HYDRODATA_EXPORT virtual void removeGroupObjects();
238 * Retrieve the top shape of the object from data label.
240 HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
243 * Removes the top shape from data label of the object.
245 HYDRODATA_EXPORT void removeTopShape();
249 * Retrieve the 3d shape of the object from data label.
251 HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
254 * Removes the 3d shape from data label of the object.
256 HYDRODATA_EXPORT void removeShape3D();