Salome HOME
fix Lot19, interpolation on a new bathymetry for a mesh group
[modules/hydro.git] / src / HYDROData / HYDROData_Channel.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_Channel_HeaderFile
20 #define HYDROData_Channel_HeaderFile
21
22 #include "HYDROData_ArtificialObject.h"
23
24 #include <TopoDS_Face.hxx>
25 #include <TopoDS_Wire.hxx>
26
27 class HYDROData_Polyline3D;
28 class HYDROData_Profile;
29
30 /**\class HYDROData_Channel
31  * \brief 
32  *
33  */
34 class HYDROData_Channel : public HYDROData_ArtificialObject
35 {
36 public:
37
38   struct PrsDefinition
39   {
40     TopoDS_Shape myPrs3D;
41     TopoDS_Face  myPrs2D;
42     TopoDS_Shape myLeftBank;
43     TopoDS_Shape myRightBank;
44     TopoDS_Shape myInlet;
45     TopoDS_Shape myOutlet;
46   };
47
48 protected:
49   /**
50    * Enumeration of tags corresponding to the persistent object parameters.
51    */
52   enum DataTag
53   {
54     DataTag_First = HYDROData_ArtificialObject::DataTag_First + 100, ///< first tag, to reserve
55     DataTag_GuideLine, 
56     DataTag_Profile,
57     DataTag_EquiDistance,
58     DataTag_ProfileMode,
59     DataTag_LC,
60     DataTag_DeltaZ,
61     DataTag_CoteZ
62   };
63
64 public:
65   DEFINE_STANDARD_RTTIEXT(HYDROData_Channel, HYDROData_ArtificialObject);
66
67 public:
68
69   /**
70    * Creates the presentations(2D and 3D) by given guide line and profile.
71    */
72
73   HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
74                                                     const Handle(HYDROData_Profile)&    theProfile,
75                                                     PrsDefinition&                      thePrs,
76                                                     double                              theEquiDistance,
77                                                     bool                                ReverseXCoord = false);
78
79   HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
80                                                     double                              LC,
81                                                     double                              deltaZ,
82                                                     double                              coteZ,
83                                                     PrsDefinition&                      thePrs,
84                                                     double                              theEquiDistance,
85                                                     bool                                ReverseXCoord = false);
86
87 protected:
88   static bool internalCreatePresentations( bool mode,
89                                            const Handle(HYDROData_Polyline3D)& theGuideLine,
90                                            const Handle(HYDROData_Profile)&    theProfile,
91                                            const TopoDS_Wire&                  theProfWire,
92                                            const gp_Pnt&                       theMiddlePnt,
93                                            PrsDefinition&                      thePrs,
94                                            double                              theEquiDistance,
95                                            bool                                ReverseXCoord);
96
97 public:
98
99   /**
100    * Returns the kind of this object. Must be redefined in all objects of known type.
101    */
102   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_CHANNEL;}
103
104   /**
105    * Dump object to Python script representation.
106    */
107   HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
108                                                      MapOfTreatedObjects& theTreatedObjects ) const;
109
110   /**
111    * Returns the list of all reference objects of this object.
112    */
113   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
114
115   /**
116    * Returns the left edge of the channel.
117    */
118   HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const;
119
120   /**
121    * Returns the right edge of the channel.
122    */
123   HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const;
124
125   /**
126    * Update the shape presentations of stream.
127    * Call this method whenever you made changes for channel data.
128    */
129   HYDRODATA_EXPORT virtual void Update();
130
131   /**
132    * Checks that object has 2D presentation. Reimlemented to retun true.
133    */
134   HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
135
136   /**
137    * Returns default filling color for new channel.
138    */
139   HYDRODATA_EXPORT virtual QColor DefaultFillingColor() const;
140
141   /**
142    * Returns default border color for new channel.
143    */
144   HYDRODATA_EXPORT virtual QColor DefaultBorderColor() const;
145
146
147 public:      
148   // Public methods to work with Channel
149   
150   /**
151    * Sets reference guide line object for channel.
152    */
153   HYDRODATA_EXPORT virtual bool SetGuideLine( const Handle(HYDROData_Polyline3D)& theGuideLine );
154
155   /**
156    * Returns reference guide line object of channel.
157    */
158   HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline3D) GetGuideLine() const;
159
160   /**
161    * Remove reference guide line object from channel.
162    */
163   HYDRODATA_EXPORT virtual void RemoveGuideLine();
164
165
166   /**
167    * Sets reference profile object for channel.
168    */
169   HYDRODATA_EXPORT virtual bool SetProfile( const Handle(HYDROData_Profile)& theProfile );
170
171   /**
172    * Returns reference profile object of channel.
173    */
174   HYDRODATA_EXPORT virtual Handle(HYDROData_Profile) GetProfile() const;
175
176   /**
177    * Remove reference profile object from channel.
178    */
179   HYDRODATA_EXPORT virtual void RemoveProfile();
180
181   HYDRODATA_EXPORT void SetEquiDistance( double );
182   HYDRODATA_EXPORT double GetEquiDistance() const;
183
184   
185   HYDRODATA_EXPORT void SetLCValue( double );
186   HYDRODATA_EXPORT double GetLCValue() const;
187   
188   HYDRODATA_EXPORT void SetDeltaZValue( double );
189   HYDRODATA_EXPORT double GetDeltaZValue() const;
190   
191   HYDRODATA_EXPORT void SetCoteZValue( double );
192   HYDRODATA_EXPORT double GetCoteZValue() const;
193
194   HYDRODATA_EXPORT void SetProfileMode( bool );
195   HYDRODATA_EXPORT bool GetProfileMode() const;
196
197 protected:
198   /**
199    * Returns the type of child altitude object.
200    * Reimplemented to create chanel altitude object.
201    */
202   HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
203
204 protected:
205
206   friend class HYDROData_Iterator;
207
208   /**
209    * Creates new object in the internal data structure. Use higher level objects 
210    * to create objects with real content.
211    */
212   HYDRODATA_EXPORT HYDROData_Channel();
213
214   /**
215    * Destructs properties of the object and object itself, removes it from the document.
216    */
217   virtual HYDRODATA_EXPORT ~HYDROData_Channel();
218 };
219
220 #endif