Salome HOME
Merge branch 'master' into BR_quadtree
[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 Handle(HYDROData_Polyline3D);
28 class Handle(HYDROData_Profile);
29 class TopTools_SequenceOfShape;
30 class TopTools_ListOfShape;
31
32 DEFINE_STANDARD_HANDLE(HYDROData_Channel, HYDROData_ArtificialObject)
33
34 /**\class HYDROData_Channel
35  * \brief 
36  *
37  */
38 class HYDROData_Channel : public HYDROData_ArtificialObject
39 {
40 public:
41
42   struct PrsDefinition
43   {
44     TopoDS_Shape myPrs3D;
45     TopoDS_Face  myPrs2D;
46     TopoDS_Wire  myLeftBank;
47     TopoDS_Wire  myRightBank;
48     TopoDS_Wire  myInlet;
49     TopoDS_Wire  myOutlet;
50   };
51
52 protected:
53   /**
54    * Enumeration of tags corresponding to the persistent object parameters.
55    */
56   enum DataTag
57   {
58     DataTag_First = HYDROData_ArtificialObject::DataTag_First + 100, ///< first tag, to reserve
59     DataTag_GuideLine, 
60     DataTag_Profile,
61     DataTag_EquiDistance,
62   };
63
64 public:
65
66   DEFINE_STANDARD_RTTI(HYDROData_Channel);
67
68 public:
69
70   /**
71    * Creates the presentations(2D and 3D) by given guide line and profile.
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
78 public:
79
80   /**
81    * Returns the kind of this object. Must be redefined in all objects of known type.
82    */
83   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_CHANNEL;}
84
85   /**
86    * Dump object to Python script representation.
87    */
88   HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
89                                                      MapOfTreatedObjects& theTreatedObjects ) const;
90
91   /**
92    * Returns the list of all reference objects of this object.
93    */
94   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
95
96   /**
97    * Returns the left edge of the channel.
98    */
99   HYDRODATA_EXPORT virtual TopoDS_Shape GetLeftShape() const;
100
101   /**
102    * Returns the right edge of the channel.
103    */
104   HYDRODATA_EXPORT virtual TopoDS_Shape GetRightShape() const;
105
106   /**
107    * Update the shape presentations of stream.
108    * Call this method whenever you made changes for channel data.
109    */
110   HYDRODATA_EXPORT virtual void Update();
111
112   /**
113    * Checks that object has 2D presentation. Reimlemented to retun true.
114    */
115   HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
116
117   /**
118    * Returns default filling color for new channel.
119    */
120   HYDRODATA_EXPORT virtual QColor DefaultFillingColor() const;
121
122   /**
123    * Returns default border color for new channel.
124    */
125   HYDRODATA_EXPORT virtual QColor DefaultBorderColor() const;
126
127
128 public:      
129   // Public methods to work with Channel
130   
131   /**
132    * Sets reference guide line object for channel.
133    */
134   HYDRODATA_EXPORT virtual bool SetGuideLine( const Handle(HYDROData_Polyline3D)& theGuideLine );
135
136   /**
137    * Returns reference guide line object of channel.
138    */
139   HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline3D) GetGuideLine() const;
140
141   /**
142    * Remove reference guide line object from channel.
143    */
144   HYDRODATA_EXPORT virtual void RemoveGuideLine();
145
146
147   /**
148    * Sets reference profile object for channel.
149    */
150   HYDRODATA_EXPORT virtual bool SetProfile( const Handle(HYDROData_Profile)& theProfile );
151
152   /**
153    * Returns reference profile object of channel.
154    */
155   HYDRODATA_EXPORT virtual Handle(HYDROData_Profile) GetProfile() const;
156
157   /**
158    * Remove reference profile object from channel.
159    */
160   HYDRODATA_EXPORT virtual void RemoveProfile();
161
162   HYDRODATA_EXPORT void SetEquiDistance( double );
163   HYDRODATA_EXPORT double GetEquiDistance() const;
164
165 protected:
166   /**
167    * Returns the type of child altitude object.
168    * Reimplemented to create chanel altitude object.
169    */
170   HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
171
172 protected:
173
174   friend class HYDROData_Iterator;
175
176   /**
177    * Creates new object in the internal data structure. Use higher level objects 
178    * to create objects with real content.
179    */
180   HYDRODATA_EXPORT HYDROData_Channel();
181
182   /**
183    * Destructs properties of the object and object itself, removes it from the document.
184    */
185   virtual HYDRODATA_EXPORT ~HYDROData_Channel();
186 };
187
188 #endif