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