1 // Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: CurveCreator_ICurve.hxx
21 // Author: Alexander KOVALEV and Alexander SOLOVYOV
23 #ifndef _CurveCreator_ICurve_HeaderFile
24 #define _CurveCreator_ICurve_HeaderFile
26 #include "CurveCreator_Macro.hxx"
30 class Handle_AIS_InteractiveObject;
32 namespace CurveCreator
34 //! Type of the section
41 //! Dimension of the curve
51 * The CurveCreator_ICurve object is represented as one or more sets of
52 * connected points; thus CurveCreator_ICurve object can contain several
53 * not connected curves (polylines or b-splines), each such curve has two
54 * only ends "start and end points" in other words non-manifold curves
57 class CURVECREATOR_EXPORT CurveCreator_ICurve
60 typedef std::pair<int,int> SectionToPoint;
61 typedef std::deque<SectionToPoint> SectionToPointList;
63 typedef std::deque< std::pair< SectionToPoint,std::deque< float > > > SectionToPointCoordsList;
66 /***********************************************/
67 /*** Undo/Redo methods ***/
68 /***********************************************/
70 //! Get number of available undo operations
71 virtual int getNbUndo() const = 0;
73 //! Undo previous operation
74 virtual bool undo() = 0;
76 //! Get number of available redo operations
77 virtual int getNbRedo() const = 0;
79 //! Redo last previously "undone" operation
80 virtual bool redo() = 0;
83 /***********************************************/
84 /*** Section methods ***/
85 /***********************************************/
87 //! Clear the polyline (remove all sections)
88 virtual bool clear() = 0;
90 //! Join range of sections to one section (join all sections if -1 is passed in one of arguments)
91 virtual bool join( const int theISectionTo = -1,
92 const int theISectionFrom = -1 ) = 0;
94 //! Get number of sections
95 virtual int getNbSections() const = 0;
97 //! Add a new section.
98 virtual int addSection( const std::string& theName,
99 const CurveCreator::SectionType theType,
100 const bool theIsClosed ) = 0;
102 //! Removes the given sections.
103 virtual bool removeSection( const int theISection ) = 0;
105 //! Get "closed" flag of the specified section
106 virtual bool isClosed( const int theISection ) const = 0;
109 * Set "closed" flag of the specified section (all sections if
110 * \a theISection is -1).
112 virtual bool setClosed( const int theISection,
113 const bool theIsClosed ) = 0;
115 //! Returns specifyed section name
116 virtual std::string getSectionName( const int theISection ) const = 0;
118 /** Set name of the specified section */
119 virtual bool setSectionName( const int theISection,
120 const std::string& theName ) = 0;
122 //! Get type of the specified section
123 virtual CurveCreator::SectionType getSectionType( const int theISection ) const = 0;
126 * Set type of the specified section (or all sections
127 * if \a theISection is -1).
129 virtual bool setSectionType( const int theISection,
130 const CurveCreator::SectionType theType ) = 0;
133 /***********************************************/
134 /*** Point methods ***/
135 /***********************************************/
137 //! Get the dimension.
138 virtual CurveCreator::Dimension getDimension() const = 0;
141 * Insert one or several points to the specified section starting from the given theIPnt index
142 * (or add these at the end of section points if \a theIPnt is -1).
144 virtual bool addPoints( const std::deque<float>& theCoords,
145 const int theISection,
146 const int theIPnt = -1 ) = 0;
148 //! Set coordinates of specified point
149 virtual bool setPoint( const int theISection,
151 const std::deque<float>& theNewCoords ) = 0;
153 //! Set coordinates of specified points from different sections
154 virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords) = 0;
156 //! Remove point with given id
157 virtual bool removePoint( const int theISection, const int theIPnt = -1 ) = 0;
158 //! Remove several points from different sections
159 virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0;
161 //! Get coordinates of specified point
162 virtual std::deque<float> getPoint( const int theISection,
163 const int theIPnt ) const = 0;
166 * Get points of a section (the total points in Curve if theISection is equal to -1)..
168 virtual std::deque<float> getPoints( const int theISection = -1 ) const = 0;
171 * Get number of points in specified section or (the total number of points
172 * in Curve if theISection is equal to -1).
174 virtual int getNbPoints( const int theISection ) const = 0;
177 /***********************************************/
178 /*** Presentation methods ***/
179 /***********************************************/
181 virtual Handle_AIS_InteractiveObject getAISObject( const bool theNeedToBuild = false ) const = 0;
184 virtual void constructAISObject() = 0;