Salome HOME
another z layer for hilight presentation
[modules/hydro.git] / src / HYDROData / HYDROData_Obstacle.h
1
2 #ifndef HYDROData_Obstacle_HeaderFile
3 #define HYDROData_Obstacle_HeaderFile
4
5 #include "HYDROData_ArtificialObject.h"
6
7 DEFINE_STANDARD_HANDLE(HYDROData_Obstacle, HYDROData_ArtificialObject)
8
9 /**\class HYDROData_Obstacle
10  * \brief 
11  *
12  */
13 class HYDROData_Obstacle : public HYDROData_ArtificialObject
14 {
15 protected:
16   /**
17    * Enumeration of tags corresponding to the persistent object parameters.
18    */
19   enum DataTag
20   {
21     DataTag_First = HYDROData_ArtificialObject::DataTag_First + 100, ///< first tag, to reserve
22     DataTag_GeomObjectEntry, ///< study entry of the imported GEOM object
23     DataTag_FilePath,        ///< imported file path
24     DataTag_Translation,     ///< translation coefficients
25   };
26
27 public:
28   DEFINE_STANDARD_RTTI(HYDROData_Obstacle);
29
30   /**
31    * Returns the kind of this object. Must be redefined in all objects of known type.
32    */
33   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_OBSTACLE;}
34
35   /**
36    * Dump object to Python script representation.
37    */
38   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
39
40   /**
41    * Update the immersible zone object.
42    * Call this method whenever you made changes for object data.
43    */
44   HYDRODATA_EXPORT virtual void Update();
45
46   /**
47    * Checks that object has 2D presentation. Reimlemented to retun true.
48    */
49   HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
50
51   /**
52    * Returns the top shape of the object.
53    */
54   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
55
56   /**
57    * Returns the 3d shape of the object.
58    */
59   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
60
61   /**
62    * Returns default filling color for new obstacle.
63    */
64   HYDRODATA_EXPORT static QColor DefaultFillingColor();
65
66   /**
67    * Returns default border color for new obstacle.
68    */
69   HYDRODATA_EXPORT static QColor DefaultBorderColor();
70
71
72   /**
73    * Sets the 3d shape of the object.
74    */
75   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
76
77 public:
78
79   /**
80    * Imports shape from file containing geometrical object and sets this
81    * shape as the obstacle shape.
82    * The supported file types:
83    *  - BREP
84    *  - IGES
85    *  - STEP
86    *  - ACIS
87    * \param theFilePath the path to file
88    * \return \c true if file has been successfully read
89    */
90   HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFilePath );
91
92   /**
93    * Stores the file path of the imported file.
94    * \param theFilePath file path
95    */
96   HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
97
98   /**
99    * Returns the imported file path.
100    */
101   HYDRODATA_EXPORT QString GetFilePath() const;
102
103   
104   /**
105    * Imports shape from IOR.
106    * \param theIOR the IOR of Geom object
107    * \return \c true if shape has been successfully imported
108    */
109   HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
110
111   /**
112    * Stores the study entry of the imported GEOM object.
113    * \param theEntry GEOM object entry
114    */
115   HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
116
117   /**
118    * Returns the imported GEOM object entry.
119    */
120   HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
121
122
123   /**
124    * Translate the obstacle to the given distance.
125    */
126   HYDRODATA_EXPORT void Translate( const double theDx,
127                                    const double theDy,
128                                    const double theDz );
129
130 protected:
131
132   /**
133    * Returns default filling color for new object.
134    */
135   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
136
137   /**
138    * Returns default border color for new object.
139    */
140   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
141
142   /**
143    * Returns the type of child altitude object.
144    * Reimplemented to create obstacle altitude object.
145    */
146   HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
147
148 private:
149
150   /**
151    * Imports shape from the BREP file.
152    * \param theFilePath the path to file
153    * \return shape as TopoDS_Shape (null shape if import was failed)
154    */
155   TopoDS_Shape ImportBREP( const QString& theFilePath ) const;
156
157   /**
158    * Imports shape from the IGES file.
159    * \param theFilePath the path to file
160    * \return shape as TopoDS_Shape (null shape if import was failed)
161    */
162   TopoDS_Shape ImportIGES( const QString& theFilePath ) const;
163
164   /**
165    * Imports shape from the STEP file.
166    * \param theFilePath the path to file
167    * \return shape as TopoDS_Shape (null shape if import was failed)
168    */
169   TopoDS_Shape ImportSTEP( const QString& theFilePath ) const;
170
171   /**
172    * Create all necessary child group objects.
173    */
174   void createGroupObjects();
175
176   /**
177    * Sets the translation coefficients.
178    */
179   void setTranslation( const double theDx, const double theDy, const double theDz );
180
181   /**
182    * Returns the translation coefficients.
183    */
184   bool getTranslation( double& theDx, double& theDy, double& theDz ) const;
185
186 protected:
187
188   friend class HYDROData_Iterator;
189
190   /**
191    * Creates new object in the internal data structure. Use higher level objects 
192    * to create objects with real content.
193    */
194   HYDRODATA_EXPORT HYDROData_Obstacle();
195
196   /**
197    * Destructs properties of the object and object itself, removes it from the document.
198    */
199   virtual HYDRODATA_EXPORT ~HYDROData_Obstacle();
200
201 };
202
203 #endif