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();
82 * Returns number of sections.
84 HYDRODATA_EXPORT virtual int NbSections() const = 0;
87 * Adds new one section.
88 * \param theSectName name of the section
89 * \param theSectionType type of section
90 * \param theIsClosed flag indicates closures of section
92 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
93 const SectionType theSectionType,
94 const bool theIsClosed ) = 0;
97 * Returns name of section with given index.
98 * \param theSectionIndex index of section
100 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
103 * Set name for section with given index.
104 * \param theSectionIndex index of section
105 * \param theSectionName new section name
107 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
108 const TCollection_AsciiString& theSectionName ) = 0;
111 * Returns type of section with given index.
112 * \param theSectionIndex index of section
114 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
117 * Set type for section with given index.
118 * \param theSectionIndex index of section
119 * \param theSectionType new section type
121 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
122 const SectionType theSectionType ) = 0;
125 * Returns true if section with given index is closed.
126 * \param theSectionIndex index of section
128 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
131 * Set closed flag for section with given index.
132 * \param theSectionIndex index of section
133 * \param theIsClosed new closures state
135 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
136 const bool theIsClosed ) = 0;
139 * Removes section with given index.
140 * \param theSectionIndex index of section
142 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
145 * Removes all sections.
147 HYDRODATA_EXPORT virtual void RemoveSections() = 0;
151 * Return number of profile points.
152 * \return number of points
154 HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
157 * Adds new point for section with index "theSectionIndex".
158 * \param theSectionIndex index of section
159 * \param thePoint point to add
160 * \param theBeforeIndex if not equal -1 then insert point before this index
162 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
163 const Point& thePoint,
164 const int theBeforeIndex = -1 ) = 0;
167 * Replaces point for section with index "theSectionIndex".
168 * \param theSectionIndex index of section
169 * \param thePoint new point
170 * \param thePointIndex index of point to replace
172 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
173 const Point& thePoint,
174 const int thePointIndex ) = 0;
177 * Removes point from section with index "theSectionIndex".
178 * \param theSectionIndex index of section
179 * \param thePointIndex index of point
181 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
182 const int thePointIndex ) = 0;
186 * Returns list of points.
187 * \param theSectionIndex if not equal -1 then list of points returned
188 * only for section with this index
189 * \return list of points
191 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1, bool IsConvertToGlobal = false ) const = 0;
193 HYDRODATA_EXPORT TopoDS_Shape GetShape() const;
194 HYDRODATA_EXPORT void SetShape( const TopoDS_Shape& theShape );
197 void RemovePolylineShape();
199 void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
200 Handle(TDataStd_IntegerList)& theTypesList,
201 Handle(TDataStd_BooleanList)& theClosuresList,
202 const bool theIsCreate = true ) const;
204 void removeSectionsLists();
206 void getPointsLists( const int theSectionIndex,
207 Handle(TDataStd_RealList)& theListX,
208 Handle(TDataStd_RealList)& theListY,
209 const bool theIsCreate = true ) const;
211 void removePointsLists( const int theSectionIndex = -1 ) const;
216 * Creates new object in the internal data structure. Use higher level objects
217 * to create objects with real content.
219 HYDRODATA_EXPORT HYDROData_IPolyline();
222 * Destructs properties of the object and object itself, removes it from the document.
224 HYDRODATA_EXPORT ~HYDROData_IPolyline();