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_IPolyline_HeaderFile
20 #define HYDROData_IPolyline_HeaderFile
22 #include "HYDROData_Entity.h"
25 DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
29 class Handle(TDataStd_RealList);
30 class Handle(TDataStd_ExtStringList);
31 class Handle(TDataStd_BooleanList);
32 class Handle(TDataStd_IntegerList);
35 /**\class HYDROData_IPolyline
36 * \brief Base class that stores/retreives information about the 2D points.
38 class HYDROData_IPolyline : public HYDROData_Entity
42 enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
45 typedef NCollection_Sequence<Point> PointsList;
49 * Enumeration of tags corresponding to the persistent object parameters.
53 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
56 DataTag_PolylineShape,
61 DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
66 * Sets wire color for object.
68 HYDRODATA_EXPORT virtual void SetWireColor( const QColor& theColor );
71 * Returns wire color of object.
73 HYDRODATA_EXPORT virtual QColor GetWireColor() const;
76 * Returns default wire color for new object.
78 HYDRODATA_EXPORT static QColor DefaultWireColor();
83 * Returns the 3D presentation of all points.
85 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const = 0;
89 * Returns number of sections.
91 HYDRODATA_EXPORT virtual int NbSections() const = 0;
94 * Adds new one section.
95 * \param theSectName name of the section
96 * \param theSectionType type of section
97 * \param theIsClosed flag indicates closures of section
99 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
100 const SectionType theSectionType,
101 const bool theIsClosed ) = 0;
104 * Returns name of section with given index.
105 * \param theSectionIndex index of section
107 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
110 * Set name for section with given index.
111 * \param theSectionIndex index of section
112 * \param theSectionName new section name
114 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
115 const TCollection_AsciiString& theSectionName ) = 0;
118 * Returns type of section with given index.
119 * \param theSectionIndex index of section
121 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
124 * Set type for section with given index.
125 * \param theSectionIndex index of section
126 * \param theSectionType new section type
128 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
129 const SectionType theSectionType ) = 0;
132 * Returns true if section with given index is closed.
133 * \param theSectionIndex index of section
135 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
138 * Set closed flag for section with given index.
139 * \param theSectionIndex index of section
140 * \param theIsClosed new closures state
142 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
143 const bool theIsClosed ) = 0;
146 * Removes section with given index.
147 * \param theSectionIndex index of section
149 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
152 * Removes all sections.
154 HYDRODATA_EXPORT virtual void RemoveSections() = 0;
158 * Return number of profile points.
159 * \return number of points
161 HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
164 * Adds new point for section with index "theSectionIndex".
165 * \param theSectionIndex index of section
166 * \param thePoint point to add
167 * \param theBeforeIndex if not equal -1 then insert point before this index
169 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
170 const Point& thePoint,
171 const int theBeforeIndex = -1 ) = 0;
174 * Replaces point for section with index "theSectionIndex".
175 * \param theSectionIndex index of section
176 * \param thePoint new point
177 * \param thePointIndex index of point to replace
179 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
180 const Point& thePoint,
181 const int thePointIndex ) = 0;
184 * Removes point from section with index "theSectionIndex".
185 * \param theSectionIndex index of section
186 * \param thePointIndex index of point
188 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
189 const int thePointIndex ) = 0;
193 * Returns list of points.
194 * \param theSectionIndex if not equal -1 then list of points returned
195 * only for section with this index
196 * \return list of points
198 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
202 TopoDS_Shape getPolylineShape() const;
204 void setPolylineShape( const TopoDS_Shape& theShape );
206 void removePolylineShape();
209 void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
210 Handle(TDataStd_IntegerList)& theTypesList,
211 Handle(TDataStd_BooleanList)& theClosuresList,
212 const bool theIsCreate = true ) const;
214 void removeSectionsLists();
216 void getPointsLists( const int theSectionIndex,
217 Handle(TDataStd_RealList)& theListX,
218 Handle(TDataStd_RealList)& theListY,
219 const bool theIsCreate = true ) const;
221 void removePointsLists( const int theSectionIndex = -1 ) const;
226 * Creates new object in the internal data structure. Use higher level objects
227 * to create objects with real content.
229 HYDRODATA_EXPORT HYDROData_IPolyline();
232 * Destructs properties of the object and object itself, removes it from the document.
234 HYDRODATA_EXPORT ~HYDROData_IPolyline();