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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_Obstacle_HeaderFile
20 #define HYDROData_Obstacle_HeaderFile
22 #include "HYDROData_ArtificialObject.h"
24 DEFINE_STANDARD_HANDLE(HYDROData_Obstacle, HYDROData_ArtificialObject)
26 /**\class HYDROData_Obstacle
30 class HYDROData_Obstacle : public HYDROData_ArtificialObject
34 * Enumeration of tags corresponding to the persistent object parameters.
38 DataTag_First = HYDROData_ArtificialObject::DataTag_First + 100, ///< first tag, to reserve
39 DataTag_GeomObjectEntry, ///< study entry of the imported GEOM object
40 DataTag_FilePath, ///< imported file path
41 DataTag_Translation, ///< translation coefficients
45 DEFINE_STANDARD_RTTI(HYDROData_Obstacle);
48 * Returns the kind of this object. Must be redefined in all objects of known type.
50 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_OBSTACLE;}
53 * Dump object to Python script representation.
55 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
58 * Update the immersible zone object.
59 * Call this method whenever you made changes for object data.
61 HYDRODATA_EXPORT virtual void Update();
63 HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
66 * Checks that object has 2D presentation. Reimlemented to retun true.
68 HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
71 * Returns the top shape of the object.
73 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
76 * Returns the 3d shape of the object.
78 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
81 * Returns default filling color for new obstacle.
83 HYDRODATA_EXPORT static QColor DefaultFillingColor();
86 * Returns default border color for new obstacle.
88 HYDRODATA_EXPORT static QColor DefaultBorderColor();
92 * Sets the 3d shape of the object.
94 HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
99 * Imports shape from file containing geometrical object and sets this
100 * shape as the obstacle shape.
101 * The supported file types:
106 * \param theFilePath the path to file
107 * \return \c true if file has been successfully read
109 HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFilePath );
112 * Stores the file path of the imported file.
113 * \param theFilePath file path
115 HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
118 * Returns the imported file path.
120 HYDRODATA_EXPORT QString GetFilePath() const;
124 * Imports shape from IOR.
125 * \param theIOR the IOR of Geom object
126 * \return \c true if shape has been successfully imported
128 HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
131 * Stores the study entry of the imported GEOM object.
132 * \param theEntry GEOM object entry
134 HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
137 * Returns the imported GEOM object entry.
139 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
142 * Returns the imported GEOM object name.
144 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectName() const;
147 * Translate the obstacle to the given distance.
149 HYDRODATA_EXPORT void Translate( const double theDx,
151 const double theDz );
156 * Returns default filling color for new object.
158 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
161 * Returns default border color for new object.
163 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
166 * Returns the type of child altitude object.
167 * Reimplemented to create obstacle altitude object.
169 HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
174 * Imports shape from the BREP file.
175 * \param theFilePath the path to file
176 * \return shape as TopoDS_Shape (null shape if import was failed)
178 TopoDS_Shape ImportBREP( const QString& theFilePath ) const;
181 * Imports shape from the IGES file.
182 * \param theFilePath the path to file
183 * \return shape as TopoDS_Shape (null shape if import was failed)
185 TopoDS_Shape ImportIGES( const QString& theFilePath ) const;
188 * Imports shape from the STEP file.
189 * \param theFilePath the path to file
190 * \return shape as TopoDS_Shape (null shape if import was failed)
192 TopoDS_Shape ImportSTEP( const QString& theFilePath ) const;
195 * Create all necessary child group objects.
197 void createGroupObjects();
200 * Sets the translation coefficients.
202 void setTranslation( const double theDx, const double theDy, const double theDz );
205 * Returns the translation coefficients.
207 bool getTranslation( double& theDx, double& theDy, double& theDz ) const;
211 friend class HYDROData_Iterator;
214 * Creates new object in the internal data structure. Use higher level objects
215 * to create objects with real content.
217 HYDRODATA_EXPORT HYDROData_Obstacle();
220 * Destructs properties of the object and object itself, removes it from the document.
222 virtual HYDRODATA_EXPORT ~HYDROData_Obstacle();