1 // Copyright (C) 2007-2013 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.
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 // File: CurveCreator_Curve.hxx
24 // Created: Thu Jun 20 9:54:14 2013
25 // Author: Sergey KHROMOV
28 #ifndef _CurveCreator_Curve_HeaderFile
29 #define _CurveCreator_Curve_HeaderFile
32 #include <CurveCreator.hxx>
33 #include <CurveCreator_Macro.hxx>
34 #include <CurveCreator_Operation.hxx>
36 class CurveCreator_Section;
40 * The CurveCreator_Curve object is represented as one or more sets of
41 * connected points; thus CurveCreator_Curve object can contain several
42 * not connected curves (polylines or b-splines), each such curve has two
43 * only ends
\96 start and end points
\96 in other words non-manifold curves
46 class CURVECREATOR_EXPORT CurveCreator_Curve
50 typedef std::deque<CurveCreator_Section *> Sections;
53 //! Constructor of the curve.
54 /** The dimension is explicitly specified in the constructor
55 * and cannot be changed later.
57 CurveCreator_Curve(const CurveCreator::Dimension theDimension);
60 ~CurveCreator_Curve();
62 //! Returns true if this curve is locked by a curve editor.
63 bool isLocked() const;
65 //! Get the dimension.
66 CurveCreator::Dimension getDimension() const;
68 //! Get number of sections.
69 int getNbSections() const;
71 /** Get number of points in specified section or (the total number of points
72 * in Curve if theISection is equal to -1).
74 int getNbPoints(const int theISection = -1) const;
76 //! Get coordinates of specified point
77 CurveCreator::Coordinates getCoordinates
78 (const int theISection, const int theIPnt) const;
80 //! Get points of a section.
81 const CurveCreator::Coordinates &getPoints(const int theISection) const;
83 //! Get type of the specified section
84 CurveCreator::Type getType(const int theISection) const;
86 //! Get
\93closed
\94 flag of the specified section
87 bool isClosed(const int theISection) const;
91 /** Set type of the specified section (or all sections
92 * if \a theISection is -1).
94 void setType(const CurveCreator::Type theType, const int theISection = -1);
96 /** Add points to the specified section (or last section
97 * if \a theISection is -1).
100 (const CurveCreator::Coordinates &thePoints, const int theISection = -1);
102 //! Add a new section.
103 void addSection (const CurveCreator::Type theType,
104 const bool theIsClosed,
105 const CurveCreator::Coordinates &thePoints);
107 //! Removes the section. If theISection equals -1, removes the last section.
108 void removeSection(const int theISection = -1);
110 /** Insert points in the given position (add to the end of list
111 * if \a theIPnt parameter is -1) of the specified section
112 * (or last section if \a theISection parameter is -1).
114 void insertPoints(const CurveCreator::Coordinates &thePoints,
115 const int theISection = -1,
116 const int theIPnt = -1);
118 /** Remove \a nbPoints points from given \a theISection,
119 * starting from given \a theIPnt (of all points up to the end of
120 * section if \a theNbPoints is -1).
122 void removePoints(const int theISection,
124 const int theNbPoints = -1);
126 //! Remove all sections.
129 //! Set coordinates of specified point
130 void setCoordinates(const CurveCreator::Coordinates &theCoords,
131 const int theISection,
134 /** Set
\93closed
\94 flag of the specified section (all sections if
135 * \a theISection is -1).
137 void setClosed(const bool theIsClosed, const int theISection = -1);
139 /** Move specified \a theISection to the specified position
140 * in the sections list.
142 void moveSection(const int theISection, const int theNewIndex);
144 //! Join two sections to one section
145 void join(const int theISectionTo, const int theISectionFrom);
147 //! Join all sections to the single curve
151 * This method converts the point index to the index in
152 * an array of coordinates.
154 int toICoord(const int theIPnt) const;
159 Sections mySections; //!< curve data
160 CurveCreator::Dimension myDimension; //!< curve dimension
162 friend class CurveCreator_CurveEditor;
163 friend class CurveCreator_Operation;