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_IPolyline_HeaderFile
24 #define HYDROData_IPolyline_HeaderFile
26 #include "HYDROData_Entity.h"
29 DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
33 class Handle(TDataStd_RealList);
34 class Handle(TDataStd_ExtStringList);
35 class Handle(TDataStd_BooleanList);
36 class Handle(TDataStd_IntegerList);
39 /**\class HYDROData_IPolyline
40 * \brief Base class that stores/retreives information about the 2D points.
42 class HYDROData_IPolyline : public HYDROData_Entity
46 enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
49 typedef NCollection_Sequence<Point> PointsList;
53 * Enumeration of tags corresponding to the persistent object parameters.
57 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
60 DataTag_PolylineShape,
65 DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
70 * Sets wire color for object.
72 HYDRODATA_EXPORT virtual void SetWireColor( const QColor& theColor );
75 * Returns wire color of object.
77 HYDRODATA_EXPORT virtual QColor GetWireColor() const;
80 * Returns default wire color for new object.
82 HYDRODATA_EXPORT static QColor DefaultWireColor();
87 * Returns the 3D presentation of all points.
89 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const = 0;
93 * Returns number of sections.
95 HYDRODATA_EXPORT virtual int NbSections() const = 0;
98 * Adds new one section.
99 * \param theSectName name of the section
100 * \param theSectionType type of section
101 * \param theIsClosed flag indicates closures of section
103 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
104 const SectionType theSectionType,
105 const bool theIsClosed ) = 0;
108 * Returns name of section with given index.
109 * \param theSectionIndex index of section
111 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
114 * Set name for section with given index.
115 * \param theSectionIndex index of section
116 * \param theSectionName new section name
118 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
119 const TCollection_AsciiString& theSectionName ) = 0;
122 * Returns type of section with given index.
123 * \param theSectionIndex index of section
125 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
128 * Set type for section with given index.
129 * \param theSectionIndex index of section
130 * \param theSectionType new section type
132 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
133 const SectionType theSectionType ) = 0;
136 * Returns true if section with given index is closed.
137 * \param theSectionIndex index of section
139 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
142 * Set closed flag for section with given index.
143 * \param theSectionIndex index of section
144 * \param theIsClosed new closures state
146 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
147 const bool theIsClosed ) = 0;
150 * Removes section with given index.
151 * \param theSectionIndex index of section
153 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
156 * Removes all sections.
158 HYDRODATA_EXPORT virtual void RemoveSections() = 0;
162 * Return number of profile points.
163 * \return number of points
165 HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
168 * Adds new point for section with index "theSectionIndex".
169 * \param theSectionIndex index of section
170 * \param thePoint point to add
171 * \param theBeforeIndex if not equal -1 then insert point before this index
173 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
174 const Point& thePoint,
175 const int theBeforeIndex = -1 ) = 0;
178 * Replaces point for section with index "theSectionIndex".
179 * \param theSectionIndex index of section
180 * \param thePoint new point
181 * \param thePointIndex index of point to replace
183 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
184 const Point& thePoint,
185 const int thePointIndex ) = 0;
188 * Removes point from section with index "theSectionIndex".
189 * \param theSectionIndex index of section
190 * \param thePointIndex index of point
192 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
193 const int thePointIndex ) = 0;
197 * Returns list of points.
198 * \param theSectionIndex if not equal -1 then list of points returned
199 * only for section with this index
200 * \return list of points
202 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
206 TopoDS_Shape getPolylineShape() const;
208 void setPolylineShape( const TopoDS_Shape& theShape );
210 void removePolylineShape();
213 void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
214 Handle(TDataStd_IntegerList)& theTypesList,
215 Handle(TDataStd_BooleanList)& theClosuresList,
216 const bool theIsCreate = true ) const;
218 void removeSectionsLists();
220 void getPointsLists( const int theSectionIndex,
221 Handle(TDataStd_RealList)& theListX,
222 Handle(TDataStd_RealList)& theListY,
223 const bool theIsCreate = true ) const;
225 void removePointsLists( const int theSectionIndex = -1 ) const;
230 * Creates new object in the internal data structure. Use higher level objects
231 * to create objects with real content.
233 HYDRODATA_EXPORT HYDROData_IPolyline();
236 * Destructs properties of the object and object itself, removes it from the document.
238 HYDRODATA_EXPORT ~HYDROData_IPolyline();