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