Salome HOME
Merge branch 'BR_LCM_COMP' into HEAD
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CurveCreatorProfile.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_CurveCreator_Profile_HeaderFile
20 #define HYDROGUI_CurveCreator_Profile_HeaderFile
21
22 #include "CurveCreator_Curve.hxx"
23
24 /**
25  *  The CurveCreator_Curve object is represented as one or more sets of
26  *  connected points; thus CurveCreator_Curve object can contain several
27  *  not connected curves (polylines or b-splines), each such curve has two
28  *  only ends start and end points in other words non-manifold curves
29  *  are not supported.
30  */
31 class HYDROGUI_CurveCreatorProfile : public CurveCreator_Curve
32 {
33
34 public:
35
36   //! Constructor of the curve.
37   HYDROGUI_CurveCreatorProfile();
38
39   //! Destructor.
40   virtual ~HYDROGUI_CurveCreatorProfile();
41
42 public:
43
44   /***********************************************/
45   /***           Section methods               ***/
46   /***********************************************/
47
48   //! For internal use only! Undo/Redo are not used here.
49   virtual bool clearInternal();
50
51   //! For internal use only! Undo/Redo are not used here.
52   virtual bool joinInternal( const std::list<int>& theSections );
53
54   //! For internal use only! Undo/Redo are not used here.
55   virtual bool moveSectionInternal( const int theISection,
56                                     const int theNewIndex);
57   //! Move section to new position in list
58   virtual bool moveSection( const int theISection,
59                             const int theNewIndex );
60   //! Join list of sections to one section (join all if the list is empty)
61   // The first section in the list is a leader, another sections are joined to it
62   virtual bool join( const std::list<int>& theSections );
63
64   //! For internal use only! Undo/Redo are not used here.
65   virtual int addSectionInternal( const std::string &theName, 
66                                   const CurveCreator::SectionType theType,
67                                   const bool theIsClosed,
68                                   const CurveCreator::Coordinates &thePoints);
69   //! Add a new section.
70   virtual int addSection( const std::string &theName, 
71                            const CurveCreator::SectionType theType,
72                            const bool theIsClosed );
73   //! Add a new section.
74   virtual int addSection( const std::string &theName, 
75                            const CurveCreator::SectionType theType,
76                            const bool theIsClosed,
77                            const CurveCreator::Coordinates &thePoints);
78   
79   
80   //! For internal use only! Undo/Redo are not used here.
81   virtual bool removeSectionInternal( const int theISection );
82
83   //! Removes the given sections.
84   virtual bool removeSection( const int theISection );
85
86   
87   //! For internal use only! Undo/Redo are not used here.
88   virtual bool setClosedInternal( const int theISection, 
89                                   const bool theIsClosed );
90   /**
91    *  Set "closed" flag of the specified section (all sections if
92    *  \a theISection is -1).
93    */
94   virtual bool setClosed( const int theISection, 
95                           const bool theIsClosed );
96
97   /***********************************************/
98   /***           Point methods                 ***/
99   /***********************************************/
100
101   //! For internal use only! Undo/Redo are not used here.
102   virtual bool addPointsInternal( const CurveCreator::SectionsMap &theSectionsMap );
103   /**
104    *  Add one point to the specified section starting from the given theIPnt index
105    *  (or at the end of points if \a theIPnt is -1).
106    */
107   //! For internal use only! Undo/Redo are not used here.
108   virtual bool setPointInternal( const CurveCreator::SectionsMap &theSectionsMap );
109
110   /**
111    *  Add one point to the specified section starting from the given theIPnt index.
112    *  Contrary to CurveCreator_Curve::addPoints(...) if \a theIPnt is -1 the right index
113    *  will be calculated automatically in accordance with X coordinate value of the point.
114    */
115   virtual bool addPoints( const CurveCreator::Coordinates &theCoords,
116                           const int theISection,
117                           const int theIPnt = -1 );
118
119   /**
120    * Indicates whether the points can be sorted.
121    */
122   virtual bool canPointsBeSorted();
123
124 protected:
125   /**
126    * Converts the list of custom point position objects into a list of point indices
127    * \param thePoints an source list
128    * \param theConvPoints a converted list
129    */
130   void convert( const CurveCreator::PosPointsList& thePoints,
131                 std::list<int>& theConvPoints );
132
133 };
134
135 #endif