Salome HOME
Groups for obstacles implemented (Feature #242).
[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   };
25
26 public:
27   DEFINE_STANDARD_RTTI(HYDROData_Obstacle);
28
29   /**
30    * Returns the kind of this object. Must be redefined in all objects of known type.
31    */
32   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_OBSTACLE;}
33
34   /**
35    * Dump object to Python script representation.
36    */
37   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
38
39   /**
40    * Update the immersible zone object.
41    * Call this method whenever you made changes for object data.
42    */
43   HYDRODATA_EXPORT virtual void Update();
44
45   /**
46    * Returns the top shape of the object.
47    */
48   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
49
50   /**
51    * Returns the 3d shape of the object.
52    */
53   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
54
55   /**
56    * Returns default filling color for new obstacle.
57    */
58   HYDRODATA_EXPORT static QColor DefaultFillingColor();
59
60   /**
61    * Returns default border color for new obstacle.
62    */
63   HYDRODATA_EXPORT static QColor DefaultBorderColor();
64
65
66   /**
67    * Sets the 3d shape of the object.
68    */
69   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
70
71 public:
72
73   /**
74    * Imports shape from file containing geometrical object and sets this
75    * shape as the obstacle shape.
76    * The supported file types:
77    *  - BREP
78    *  - IGES
79    *  - STEP
80    *  - ACIS
81    * \param theFilePath the path to file
82    * \return \c true if file has been successfully read
83    */
84   HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFilePath );
85
86   /**
87    * Stores the file path of the imported file.
88    * \param theFilePath file path
89    */
90   HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
91
92   /**
93    * Returns the imported file path.
94    */
95   HYDRODATA_EXPORT QString GetFilePath() const;
96
97    /**
98    * Stores the study entry of the imported GEOM object.
99    * \param theEntry GEOM object entry
100    */
101   HYDRODATA_EXPORT void SetGeomObjectEntry(const QString& theEntry);
102
103   /**
104    * Returns the imported GEOM object entry.
105    */
106   HYDRODATA_EXPORT QString GetGeomObjectEntry() const;
107
108 protected:
109
110   /**
111    * Returns default filling color for new object.
112    */
113   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
114
115   /**
116    * Returns default border color for new object.
117    */
118   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
119
120   /**
121    * Create all necessary child group objects.
122    */
123   HYDRODATA_EXPORT virtual void createGroupObjects();
124
125 protected:
126
127   friend class HYDROData_Iterator;
128
129   /**
130    * Creates new object in the internal data structure. Use higher level objects 
131    * to create objects with real content.
132    */
133   HYDRODATA_EXPORT HYDROData_Obstacle();
134
135   /**
136    * Destructs properties of the object and object itself, removes it from the document.
137    */
138   virtual HYDRODATA_EXPORT ~HYDROData_Obstacle();
139
140 private:
141   /**
142    * Imports shape from the BREP file.
143    * \param theFilePath the path to file
144    * \return shape as TopoDS_Shape (null shape if import was failed)
145    */
146   TopoDS_Shape ImportBREP( const QString& theFilePath ) const;
147
148   /**
149    * Imports shape from the IGES file.
150    * \param theFilePath the path to file
151    * \return shape as TopoDS_Shape (null shape if import was failed)
152    */
153   TopoDS_Shape ImportIGES( const QString& theFilePath ) const;
154
155   /**
156    * Imports shape from the STEP file.
157    * \param theFilePath the path to file
158    * \return shape as TopoDS_Shape (null shape if import was failed)
159    */
160   TopoDS_Shape ImportSTEP( const QString& theFilePath ) const;
161 };
162
163 #endif