Version: 9.16.0
CurveCreator_ICurve.hxx
Go to the documentation of this file.
1// Copyright (C) 2013-2026 CEA, EDF, OPEN CASCADE
2//
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, or (at your option) any later version.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20// File: CurveCreator_ICurve.hxx
21// Author: Alexander KOVALEV and Alexander SOLOVYOV
22
23#ifndef _CurveCreator_ICurve_HeaderFile
24#define _CurveCreator_ICurve_HeaderFile
25
26#include "CurveCreator.hxx"
28
29#include <TColgp_HArray1OfPnt.hxx>
30#include <AIS_InteractiveObject.hxx>
31
32#include <deque>
33#include <vector>
34#include <string>
35#include <list>
36
37namespace CurveCreator
38{
41 {
44 };
45
48 {
49 Dim2d = 2,
50 Dim3d = 3
51 };
52
53}
54
57{
60
62 virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
63};
64
73{
74public:
75 typedef std::pair<int,int> SectionToPoint;
76 typedef std::deque<SectionToPoint> SectionToPointList;
77
78 typedef std::deque< std::pair< SectionToPoint, CurveCreator::Coordinates > > SectionToPointCoordsList;
79
80public:
81 /***********************************************/
82 /*** Undo/Redo methods ***/
83 /***********************************************/
84
87
89 virtual int getNbUndo() const = 0;
90
92 virtual bool undo() = 0;
93
95 virtual int getNbRedo() const = 0;
96
98 virtual bool redo() = 0;
99
100
101 /***********************************************/
102 /*** Section methods ***/
103 /***********************************************/
104
106 virtual bool clear() = 0;
107
109 // The first section in the list is a leader, another sections are joined to it
110 virtual bool join( const std::list<int>& theSections ) = 0;
111
113 virtual int getNbSections() const = 0;
114
116 virtual int addSection( const std::string& theName,
117 const CurveCreator::SectionType theType,
118 const bool theIsClosed ) = 0;
119
121 virtual bool removeSection( const int theISection ) = 0;
122
124 virtual bool isClosed( const int theISection ) const = 0;
125
130 virtual bool setClosed( const int theISection,
131 const bool theIsClosed ) = 0;
132
134 virtual std::string getSectionName( const int theISection ) const = 0;
135
137 virtual bool setSectionName( const int theISection,
138 const std::string& theName ) = 0;
139
141 virtual CurveCreator::SectionType getSectionType( const int theISection ) const = 0;
142
147 virtual bool setSectionType( const int theISection,
148 const CurveCreator::SectionType theType ) = 0;
149
152 const int theSectionIndex) const = 0;
153
155 virtual CurveCreator_ISection* getSection(const int theSectionIndex) = 0;
156
157
158 /***********************************************/
159 /*** Point methods ***/
160 /***********************************************/
161
164
169 virtual bool addPoints( const CurveCreator::Coordinates& theCoords,
170 const int theISection,
171 const int theIPnt = -1 ) = 0;
172
174 virtual bool setPoint( const int theISection,
175 const int theIPnt,
176 const CurveCreator::Coordinates& theNewCoords ) = 0;
177
179 virtual bool setSeveralPoints( const SectionToPointCoordsList &theSectionToPntCoords,
180 const bool theIsToSaveDiff = true ) = 0;
181
183 virtual bool removePoint( const int theISection, const int theIPnt = -1 ) = 0;
185 virtual bool removeSeveralPoints( const SectionToPointList &theSectionToPntIDs) = 0;
186
188 virtual CurveCreator::Coordinates getPoint( const int theISection,
189 const int theIPnt ) const = 0;
190
194 virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const = 0;
195
200 virtual int getNbPoints( const int theISection ) const = 0;
201
205 virtual void setSkipSorting( const bool ) = 0;
206
210 virtual bool canPointsBeSorted() = 0;
211
216 virtual void saveCoordDiff( const SectionToPointCoordsList &theOldCoords ) = 0;
217
218 /***********************************************/
219 /*** Presentation methods ***/
220 /***********************************************/
221
222 virtual Handle(AIS_InteractiveObject) getAISObject( const bool theNeedToBuild = false ) const = 0;
223
224protected:
225 virtual void constructAISObject() = 0;
226
227};
228
229#endif
#define CURVECREATOR_EXPORT
Definition: CurveCreator_Macro.hxx:41
The CurveCreator_ICurve object is represented as one or more sets of connected points; thus CurveCrea...
Definition: CurveCreator_ICurve.hxx:73
virtual int getNbUndo() const =0
Get number of available undo operations.
virtual bool setSectionName(const int theISection, const std::string &theName)=0
Set name of the specified section.
virtual bool redo()=0
Redo last previously "undone" operation.
virtual bool join(const std::list< int > &theSections)=0
Join list of sections to one section (join all if the list is empty)
virtual bool removeSection(const int theISection)=0
Removes the given sections.
std::deque< SectionToPoint > SectionToPointList
Definition: CurveCreator_ICurve.hxx:76
virtual bool setSeveralPoints(const SectionToPointCoordsList &theSectionToPntCoords, const bool theIsToSaveDiff=true)=0
Set coordinates of specified points from different sections.
std::pair< int, int > SectionToPoint
Definition: CurveCreator_ICurve.hxx:75
virtual int getNbPoints(const int theISection) const =0
Get number of points in specified section or (the total number of points in Curve if theISection is e...
virtual bool isClosed(const int theISection) const =0
Get "closed" flag of the specified section.
virtual int getNbRedo() const =0
Get number of available redo operations.
virtual void setSkipSorting(const bool)=0
Set skip sorting flag.
virtual CurveCreator::SectionType getSectionType(const int theISection) const =0
Get type of the specified section.
virtual bool undo()=0
Undo previous operation.
virtual bool setPoint(const int theISection, const int theIPnt, const CurveCreator::Coordinates &theNewCoords)=0
Set coordinates of specified point.
virtual bool canPointsBeSorted()=0
Indicates whether the points can be sorted.
virtual CurveCreator::Coordinates getPoint(const int theISection, const int theIPnt) const =0
Get coordinates of specified point.
virtual bool addPoints(const CurveCreator::Coordinates &theCoords, const int theISection, const int theIPnt=-1)=0
Insert one or several points to the specified section starting from the given theIPnt index (or add t...
virtual const CurveCreator_ISection * getSection(const int theSectionIndex) const =0
Returns the curve section with the index.
virtual Handle(AIS_InteractiveObject) getAISObject(const bool theNeedToBuild
virtual void constructAISObject()=0
virtual int getNbSections() const =0
Get number of sections.
virtual std::string getSectionName(const int theISection) const =0
Returns specifyed section name.
virtual int addSection(const std::string &theName, const CurveCreator::SectionType theType, const bool theIsClosed)=0
Add a new section.
virtual bool setClosed(const int theISection, const bool theIsClosed)=0
Set "closed" flag of the specified section (all sections if theISection is -1).
virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints(int theISection
Get points of a section (the total points in Curve if theISection is equal to -1).
virtual bool setSectionType(const int theISection, const CurveCreator::SectionType theType)=0
Set type of the specified section (or all sections if theISection is -1).
std::deque< std::pair< SectionToPoint, CurveCreator::Coordinates > > SectionToPointCoordsList
Definition: CurveCreator_ICurve.hxx:78
virtual bool removePoint(const int theISection, const int theIPnt=-1)=0
Remove point with given id.
virtual ~CurveCreator_ICurve()
The destructor.
Definition: CurveCreator_ICurve.hxx:86
virtual CurveCreator_ISection * getSection(const int theSectionIndex)=0
Returns the curve section with the index.
virtual bool removeSeveralPoints(const SectionToPointList &theSectionToPntIDs)=0
Remove several points from different sections.
virtual bool clear()=0
Clear the polyline (remove all sections)
virtual CurveCreator::Dimension getDimension() const =0
Get the dimension.
virtual void saveCoordDiff(const SectionToPointCoordsList &theOldCoords)=0
Saves points coordinates difference.
Definition: CurveCreator.hxx:34
Dimension
Dimension of the curve.
Definition: CurveCreator_ICurve.hxx:48
@ Dim2d
Definition: CurveCreator_ICurve.hxx:49
@ Dim3d
Definition: CurveCreator_ICurve.hxx:50
std::deque< TypeCoord > Coordinates
List of coordinates in format depends on section dimension: 2D: [x1, y1, x2, y2, x3,...
Definition: CurveCreator.hxx:42
SectionType
Type of the section.
Definition: CurveCreator_ICurve.hxx:41
@ Spline
Definition: CurveCreator_ICurve.hxx:43
@ Polyline
Definition: CurveCreator_ICurve.hxx:42
The type represents the interface to the curve section.
Definition: CurveCreator_ICurve.hxx:57
virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints(int theDimension) const =0
Calculates the different points of the section.
virtual ~CurveCreator_ISection()
The destructor.
Definition: CurveCreator_ICurve.hxx:59