1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROData_Obstacle_HeaderFile
24 #define HYDROData_Obstacle_HeaderFile
26 #include "HYDROData_ArtificialObject.h"
28 DEFINE_STANDARD_HANDLE(HYDROData_Obstacle, HYDROData_ArtificialObject)
30 /**\class HYDROData_Obstacle
34 class HYDROData_Obstacle : public HYDROData_ArtificialObject
38 * Enumeration of tags corresponding to the persistent object parameters.
42 DataTag_First = HYDROData_ArtificialObject::DataTag_First + 100, ///< first tag, to reserve
43 DataTag_GeomObjectEntry, ///< study entry of the imported GEOM object
44 DataTag_FilePath, ///< imported file path
45 DataTag_Translation, ///< translation coefficients
49 DEFINE_STANDARD_RTTI(HYDROData_Obstacle);
52 * Returns the kind of this object. Must be redefined in all objects of known type.
54 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_OBSTACLE;}
57 * Dump object to Python script representation.
59 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
62 * Update the immersible zone object.
63 * Call this method whenever you made changes for object data.
65 HYDRODATA_EXPORT virtual void Update();
67 HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
70 * Checks that object has 2D presentation. Reimlemented to retun true.
72 HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
75 * Returns the top shape of the object.
77 HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const;
80 * Returns the 3d shape of the object.
82 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const;
85 * Returns default filling color for new obstacle.
87 HYDRODATA_EXPORT static QColor DefaultFillingColor();
90 * Returns default border color for new obstacle.
92 HYDRODATA_EXPORT static QColor DefaultBorderColor();
96 * Sets the 3d shape of the object.
98 HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
103 * Imports shape from file containing geometrical object and sets this
104 * shape as the obstacle shape.
105 * The supported file types:
110 * \param theFilePath the path to file
111 * \return \c true if file has been successfully read
113 HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFilePath );
116 * Stores the file path of the imported file.
117 * \param theFilePath file path
119 HYDRODATA_EXPORT void SetFilePath(const QString& theFilePath);
122 * Returns the imported file path.
124 HYDRODATA_EXPORT QString GetFilePath() const;
128 * Imports shape from IOR.
129 * \param theIOR the IOR of Geom object
130 * \return \c true if shape has been successfully imported
132 HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
135 * Stores the study entry of the imported GEOM object.
136 * \param theEntry GEOM object entry
138 HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
141 * Returns the imported GEOM object entry.
143 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
146 * Returns the imported GEOM object name.
148 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectName() const;
151 * Translate the obstacle to the given distance.
153 HYDRODATA_EXPORT void Translate( const double theDx,
155 const double theDz );
160 * Returns default filling color for new object.
162 HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
165 * Returns default border color for new object.
167 HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
170 * Returns the type of child altitude object.
171 * Reimplemented to create obstacle altitude object.
173 HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
178 * Imports shape from the BREP file.
179 * \param theFilePath the path to file
180 * \return shape as TopoDS_Shape (null shape if import was failed)
182 TopoDS_Shape ImportBREP( const QString& theFilePath ) const;
185 * Imports shape from the IGES file.
186 * \param theFilePath the path to file
187 * \return shape as TopoDS_Shape (null shape if import was failed)
189 TopoDS_Shape ImportIGES( const QString& theFilePath ) const;
192 * Imports shape from the STEP file.
193 * \param theFilePath the path to file
194 * \return shape as TopoDS_Shape (null shape if import was failed)
196 TopoDS_Shape ImportSTEP( const QString& theFilePath ) const;
199 * Create all necessary child group objects.
201 void createGroupObjects();
204 * Sets the translation coefficients.
206 void setTranslation( const double theDx, const double theDy, const double theDz );
209 * Returns the translation coefficients.
211 bool getTranslation( double& theDx, double& theDy, double& theDz ) const;
215 friend class HYDROData_Iterator;
218 * Creates new object in the internal data structure. Use higher level objects
219 * to create objects with real content.
221 HYDRODATA_EXPORT HYDROData_Obstacle();
224 * Destructs properties of the object and object itself, removes it from the document.
226 virtual HYDRODATA_EXPORT ~HYDROData_Obstacle();