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