Salome HOME
4a9b4c3b659ddd25d6dbdfa6a8f020df995ed9f3
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_ICurve.hxx
1 // Copyright (C) 2013  CEA/DEN, EDF R&D, 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.
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_Macro.hxx"
27 #include <deque>
28
29 namespace CurveCreator
30 {
31   //! Type of the section
32   enum SectionType
33   {
34     Polyline,
35     Spline,
36   };
37
38   //! Dimension of the curve
39   enum Dimension
40   {
41     Dim2d = 2,
42     Dim3d = 3
43   };
44
45 };
46
47 /**
48  *  The CurveCreator_ICurve object is represented as one or more sets of
49  *  connected points; thus CurveCreator_ICurve object can contain several
50  *  not connected curves (polylines or b-splines), each such curve has two
51  *  only ends "start and end points" in other words non-manifold curves
52  *  are not supported.
53  */
54 class CURVECREATOR_EXPORT CurveCreator_ICurve
55 {
56 public:
57   /***********************************************/
58   /***          Undo/Redo methods              ***/
59   /***********************************************/
60
61   //! Get number of available undo operations
62   virtual int getNbUndo() const = 0;
63
64   //! Undo previous operation
65   virtual bool undo() = 0;
66
67   //! Get number of available redo operations
68   virtual int getNbRedo() const = 0;
69
70   //! Redo last previously "undone" operation
71   virtual bool redo() = 0;
72
73
74   /***********************************************/
75   /***           Section methods               ***/
76   /***********************************************/
77
78   //! Clear the polyline (remove all sections)
79   virtual bool clear() = 0;
80
81   //! Join range of sections to one section (join all sections if -1 is passed in one of arguments)
82   virtual bool join( const int theISectionTo = -1, 
83                      const int theISectionFrom = -1 ) = 0;
84
85   //! Get number of sections
86   virtual int getNbSections() const = 0;
87
88   //! Add a new section.
89   virtual int addSection( const std::string& theName, 
90                            const CurveCreator::SectionType theType,
91                            const bool theIsClosed ) = 0;
92
93   //! Removes the given sections.
94   virtual bool removeSection( const int theISection ) = 0;
95
96   //! Get "closed" flag of the specified section
97   virtual bool isClosed( const int theISection ) const = 0;
98
99   /**
100    *  Set "closed" flag of the specified section (all sections if
101    *  \a theISection is -1).
102    */
103   virtual bool setClosed( const int theISection, 
104                           const bool theIsClosed ) = 0;
105
106   //! Returns specifyed section name
107   virtual std::string getSectionName( const int theISection ) const = 0;
108
109   /** Set name of the specified section */
110   virtual bool setSectionName( const int theISection, 
111                                const std::string& theName ) = 0;
112
113   //! Get type of the specified section
114   virtual CurveCreator::SectionType getSectionType( const int theISection ) const = 0;
115
116   /**
117    *  Set type of the specified section (or all sections
118    *  if \a theISection is -1).
119    */
120   virtual bool setSectionType( const int theISection, 
121                                const CurveCreator::SectionType theType ) = 0;
122
123
124   /***********************************************/
125   /***           Point methods                 ***/
126   /***********************************************/
127
128   //! Get the dimension.
129   virtual CurveCreator::Dimension getDimension() const = 0;
130
131   /**
132    *  Insert one or several points to the specified section starting from the given theIPnt index
133    *  (or add these at the end of section points if \a theIPnt is -1).
134    */
135   virtual bool addPoints( const std::deque<float>& theCoords,
136                           const int theISection,
137                           const int theIPnt = -1 ) = 0;
138
139   //! Set coordinates of specified point
140   virtual bool setPoint( const int theISection,
141                          const int theIPnt,
142                          const std::deque<float>& theNewCoords ) = 0;
143
144   //! Remove point with given id
145   virtual bool removePoint( const int theISection, const int theIPnt = -1 ) = 0;
146
147   //! Get coordinates of specified point
148   virtual std::deque<float> getPoint( const int theISection, 
149                                       const int theIPnt ) const = 0;
150
151   /**
152    * Get points of a section (the total points in Curve if theISection is equal to -1)..
153    */
154   virtual std::deque<float> getPoints( const int theISection = -1 ) const = 0;
155
156   /**
157    *  Get number of points in specified section or (the total number of points
158    *  in Curve if theISection is equal to -1).
159    */
160   virtual int getNbPoints( const int theISection ) const = 0;
161
162
163   /***********************************************/
164   /***       Presentation methods              ***/
165   /***********************************************/
166 //  virtual TopoDS_Wire constructWire() const = 0;
167 };
168
169 #endif