Salome HOME
Abort document operation after error in process apply (Bug #340).
[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    * Returns the top shape of the object.
48    */
49   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
50
51   /**
52    * Returns the 3d shape of the object.
53    */
54   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
55
56   /**
57    * Returns default filling color for new obstacle.
58    */
59   HYDRODATA_EXPORT static QColor DefaultFillingColor();
60
61   /**
62    * Returns default border color for new obstacle.
63    */
64   HYDRODATA_EXPORT static QColor DefaultBorderColor();
65
66
67   /**
68    * Sets the 3d shape of the object.
69    */
70   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
71
72 public:
73
74   /**
75    * Imports shape from file containing geometrical object and sets this
76    * shape as the obstacle shape.
77    * The supported file types:
78    *  - BREP
79    *  - IGES
80    *  - STEP
81    *  - ACIS
82    * \param theFilePath the path to file
83    * \return \c true if file has been successfully read
84    */
85   HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFilePath );
86
87   /**
88    * Stores the file path of the imported file.
89    * \param theFilePath file path
90    */
91   HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
92
93   /**
94    * Returns the imported file path.
95    */
96   HYDRODATA_EXPORT QString GetFilePath() const;
97
98   
99   /**
100    * Imports shape from IOR.
101    * \param theIOR the IOR of Geom object
102    * \return \c true if shape has been successfully imported
103    */
104   HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
105
106   /**
107    * Stores the study entry of the imported GEOM object.
108    * \param theEntry GEOM object entry
109    */
110   HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
111
112   /**
113    * Returns the imported GEOM object entry.
114    */
115   HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
116
117
118   /**
119    * Translate the obstacle to the given distance.
120    */
121   HYDRODATA_EXPORT void Translate( const double theDx,
122                                    const double theDy,
123                                    const double theDz );
124
125 protected:
126
127   /**
128    * Returns default filling color for new object.
129    */
130   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
131
132   /**
133    * Returns default border color for new object.
134    */
135   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
136
137   /**
138    * Returns the type of child altitude object.
139    * Reimplemented to create obstacle altitude object.
140    */
141   HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
142
143 private:
144
145   /**
146    * Imports shape from the BREP file.
147    * \param theFilePath the path to file
148    * \return shape as TopoDS_Shape (null shape if import was failed)
149    */
150   TopoDS_Shape ImportBREP( const QString& theFilePath ) const;
151
152   /**
153    * Imports shape from the IGES file.
154    * \param theFilePath the path to file
155    * \return shape as TopoDS_Shape (null shape if import was failed)
156    */
157   TopoDS_Shape ImportIGES( const QString& theFilePath ) const;
158
159   /**
160    * Imports shape from the STEP file.
161    * \param theFilePath the path to file
162    * \return shape as TopoDS_Shape (null shape if import was failed)
163    */
164   TopoDS_Shape ImportSTEP( const QString& theFilePath ) const;
165
166   /**
167    * Create all necessary child group objects.
168    */
169   void createGroupObjects();
170
171   /**
172    * Sets the translation coefficients.
173    */
174   void setTranslation( const double theDx, const double theDy, const double theDz );
175
176   /**
177    * Returns the translation coefficients.
178    */
179   bool getTranslation( double& theDx, double& theDy, double& theDz ) const;
180
181 protected:
182
183   friend class HYDROData_Iterator;
184
185   /**
186    * Creates new object in the internal data structure. Use higher level objects 
187    * to create objects with real content.
188    */
189   HYDRODATA_EXPORT HYDROData_Obstacle();
190
191   /**
192    * Destructs properties of the object and object itself, removes it from the document.
193    */
194   virtual HYDRODATA_EXPORT ~HYDROData_Obstacle();
195
196 };
197
198 #endif