Salome HOME
Merge remote-tracking branch 'origin/BR_SHAPE_RECOGNITION' into BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline3D.h
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
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.
22 //
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.
27 //
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
31 //
32 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
33 //
34
35 #ifndef HYDROData_Polyline3D_HeaderFile
36 #define HYDROData_Polyline3D_HeaderFile
37
38 #include "HYDROData_Object.h"
39
40 DEFINE_STANDARD_HANDLE(HYDROData_Polyline3D, HYDROData_Object)
41
42 class Handle(HYDROData_PolylineXY);
43 class Handle(HYDROData_ProfileUZ);
44 class gp_XYZ;
45
46 /**\class HYDROData_Polyline3D
47  * \brief 
48  *
49  */
50 class HYDROData_Polyline3D : public HYDROData_Object
51 {
52 public:
53
54   typedef gp_XYZ                                Polyline3DPoint;
55   typedef NCollection_Sequence<Polyline3DPoint> Polyline3DPoints;
56
57 protected:
58   /**
59    * Enumeration of tags corresponding to the persistent object parameters.
60    */
61   enum DataTag
62   {
63     DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
64     DataTag_PolylineXY,          ///< reference hydraulic axis
65     DataTag_ProfileUZ,           ///< reference profile
66     DataTag_ChildProfileUZ,      ///< reference profile
67   };
68
69 public:
70   DEFINE_STANDARD_RTTI(HYDROData_Polyline3D);
71
72   /**
73    * Returns the kind of this object. Must be redefined in all objects of known type.
74    */
75   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
76
77   /**
78    * Dump object to Python script representation.
79    */
80   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
81
82   /**
83    * Returns the list of all reference objects of this object.
84    */
85   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
86
87   /**
88    * Returns the top shape of the object.
89    */
90   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
91
92   /**
93    * Returns the 3d shape of the object.
94    */
95   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
96
97   /**
98    * Update the shape presentations of stream.
99    * Call this method whenever you made changes for stream data.
100    */
101   HYDRODATA_EXPORT virtual void Update();
102
103   /**
104    * Returns default filling color for new 3D polyline.
105    */
106   HYDRODATA_EXPORT static QColor DefaultFillingColor();
107
108   /**
109    * Returns default border color for new 3D polyline.
110    */
111   HYDRODATA_EXPORT static QColor DefaultBorderColor();
112
113
114 public:      
115   // Public methods to work with 3D polyline
116   
117   /**
118    * Sets reference x,y polyline object for 3D polyline.
119    */
120   HYDRODATA_EXPORT virtual bool SetPolylineXY( const Handle(HYDROData_PolylineXY)& thePolyline,
121                                                const bool                          theIsUpdateProfile = true );
122
123   /**
124    * Returns reference x,y polyline object of 3D polyline.
125    */
126   HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetPolylineXY() const;
127
128   /**
129    * Remove reference x,y polyline object from 3D polyline.
130    */
131   HYDRODATA_EXPORT virtual void RemovePolylineXY();
132
133
134   /**
135    * Sets reference u,z profile object for 3D polyline.
136    */
137   HYDRODATA_EXPORT virtual bool SetProfileUZ( const Handle(HYDROData_ProfileUZ)& theProfile );
138
139   /**
140    * Returns reference u,z profile object of 3D polyline.
141    */
142   HYDRODATA_EXPORT virtual Handle(HYDROData_ProfileUZ) GetProfileUZ() const;
143
144   /**
145    * Remove reference u,z profile object from 3D polyline.
146    */
147   HYDRODATA_EXPORT virtual void RemoveProfileUZ();
148
149
150   /**
151    * Set reference bathymetry object for geometry object.
152    * Reimplemented to remove reference u,z profile.
153    */
154   HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude );
155
156   /**
157    * Clear the reference bathymetry object for geometry object.
158    * Reimplemented to remove child u,z profile.
159    */
160   HYDRODATA_EXPORT virtual void RemoveAltitudeObject();
161
162
163   /**
164    * Returns the child u,z profile which has been generated from bathymetry.
165    */
166   HYDRODATA_EXPORT Handle(HYDROData_ProfileUZ) GetChildProfileUZ( const bool theIsCreate = true ) const;
167
168   /**
169    * Sets the child u,z profile for polyline.
170    */
171   HYDRODATA_EXPORT void SetChildProfileUZ( const Handle(HYDROData_ProfileUZ)& theProfile );
172
173
174 protected:
175
176   /**
177    * Returns default filling color for new object.
178    */
179   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
180
181   /**
182    * Returns default border color for new object.
183    */
184   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
185
186   /**
187    * Checks and if necessary create child 3D object.
188    * Reimplemented to prevent creation of 3D child object.
189    */
190   HYDRODATA_EXPORT virtual void checkAndSetObject3D() {}
191
192
193 protected:
194
195
196   void updateChildProfilePoints();
197
198   void removeChildProfileUZ();
199
200
201 protected:
202
203   friend class HYDROData_Iterator;
204
205   /**
206    * Creates new object in the internal data structure. Use higher level objects 
207    * to create objects with real content.
208    */
209   HYDRODATA_EXPORT HYDROData_Polyline3D();
210
211   /**
212    * Destructs properties of the object and object itself, removes it from the document.
213    */
214   virtual HYDRODATA_EXPORT ~HYDROData_Polyline3D();
215 };
216
217 #endif