Salome HOME
Bug #202 - Fatal error during polyline creation
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Profile.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 #ifndef _CurveCreator_Profile_HeaderFile
21 #define _CurveCreator_Profile_HeaderFile
22
23 #include "CurveCreator_Curve.hxx"
24
25 /**
26  *  The CurveCreator_Curve object is represented as one or more sets of
27  *  connected points; thus CurveCreator_Curve object can contain several
28  *  not connected curves (polylines or b-splines), each such curve has two
29  *  only ends start and end points in other words non-manifold curves
30  *  are not supported.
31  */
32 class CURVECREATOR_EXPORT CurveCreator_Profile : public CurveCreator_Curve
33 {
34
35 public:
36
37   //! Constructor of the curve.
38   CurveCreator_Profile();
39
40   //! Destructor.
41   virtual ~CurveCreator_Profile();
42
43 public:
44
45   /***********************************************/
46   /***           Section methods               ***/
47   /***********************************************/
48
49   //! For internal use only! Undo/Redo are not used here.
50   virtual bool clearInternal();
51
52   //! For internal use only! Undo/Redo are not used here.
53   virtual bool joinInternal( const int theISectionTo = -1, 
54                              const int theISectionFrom = -1 );
55
56   //! For internal use only! Undo/Redo are not used here.
57   virtual bool moveSectionInternal( const int theISection,
58                                     const int theNewIndex);
59   //! Move section to new position in list
60   virtual bool moveSection( const int theISection,
61                             const int theNewIndex );
62
63   //! Join range of sections to one section (join all sections if -1 is passed in one of arguments)
64   virtual bool join( const int theISectionTo = -1, 
65                      const int theISectionFrom = -1 );
66
67   //! For internal use only! Undo/Redo are not used here.
68   virtual int addSectionInternal( const std::string &theName, 
69                                   const CurveCreator::SectionType theType,
70                                   const bool theIsClosed,
71                                   const CurveCreator::Coordinates &thePoints);
72   //! Add a new section.
73   virtual int addSection( const std::string &theName, 
74                            const CurveCreator::SectionType theType,
75                            const bool theIsClosed );
76   //! Add a new section.
77   virtual int addSection( const std::string &theName, 
78                            const CurveCreator::SectionType theType,
79                            const bool theIsClosed,
80                            const CurveCreator::Coordinates &thePoints);
81   
82   
83   //! For internal use only! Undo/Redo are not used here.
84   virtual bool removeSectionInternal( const int theISection );
85
86   //! Removes the given sections.
87   virtual bool removeSection( const int theISection );
88
89   
90   //! For internal use only! Undo/Redo are not used here.
91   virtual bool setClosedInternal( const int theISection, 
92                                   const bool theIsClosed );
93   /**
94    *  Set "closed" flag of the specified section (all sections if
95    *  \a theISection is -1).
96    */
97   virtual bool setClosed( const int theISection, 
98                           const bool theIsClosed );
99
100   
101   //! For internal use only! Undo/Redo are not used here.
102   virtual bool setSectionTypeInternal( const int theISection, 
103                                        const CurveCreator::SectionType theType );
104   /**
105    *  Set type of the specified section (or all sections
106    *  if \a theISection is -1).
107    */
108   virtual bool setSectionType( const int theISection, 
109                                const CurveCreator::SectionType theType );
110
111
112   /***********************************************/
113   /***           Point methods                 ***/
114   /***********************************************/
115
116   //! For internal use only! Undo/Redo are not used here.
117   virtual bool addPointsInternal( const CurveCreator::SectionsMap &theSectionsMap );
118   /**
119    *  Add one point to the specified section starting from the given theIPnt index
120    *  (or at the end of points if \a theIPnt is -1).
121    */
122   //! For internal use only! Undo/Redo are not used here.
123   virtual bool setPointInternal( const CurveCreator::SectionsMap &theSectionsMap );
124
125 protected:
126   /**
127    * Converts the list of custom point position objects into a list of point indices
128    * \param thePoints an source list
129    * \param theConvPoints a converted list
130    */
131   void convert( const CurveCreator::PosPointsList& thePoints,
132                 std::list<int>& theConvPoints );
133
134 };
135
136 #endif