1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: CurveCreator_CurveEditor.hxx
24 // Created: Mon Jun 24 14:33:40 2013
25 // Author: Sergey KHROMOV
28 #ifndef _CurveCreator_CurveEditor_HeaderFile
29 #define _CurveCreator_CurveEditor_HeaderFile
32 #include <CurveCreator_Diff.hxx>
33 #include <CurveCreator_Curve.hxx>
36 * The CurveCreator_CurveEditor is designed to manage of
37 * editing operations of CurveCreator_Curve class.
39 class CURVECREATOR_EXPORT CurveCreator_CurveEditor
44 typedef std::list<CurveCreator_Diff> ListDiff;
48 //! Constuctor, initialized by the curve object
49 CurveCreator_CurveEditor(CurveCreator_Curve* thePCurve);
51 //! Destructor, detaches from the Curve
52 ~CurveCreator_CurveEditor();
54 //! Returns the curve.
55 CurveCreator_Curve *getCurve() const;
57 //! This method returns true if this editor is attached to a valid curve.
58 bool isAttached() const;
60 //! Undo previous operation
63 //! Redo last previously
\93undoed
\94 operation
66 //! Get number of available undo operations
67 int getNbUndo() const;
69 //! Get number of available redo operations
70 int getNbRedo() const;
72 //! Set depth of undo operations (unlimited if \a theDepth is -1
73 // or disabled if \a theDepth is 0)
74 void setUndoDepth(const int theDepth = -1);
76 //! Get depth of undo operations.
77 int getUndoDepth() const;
79 /** Set type of the specified section (or all sections
80 * if \a theISection is -1).
82 void setType(const CurveCreator::Type theType, const int theISection = -1);
84 /** Set section closed (or all sections
85 * if \a theISection is -1).
87 void setClosed(const bool theIsClosed, const int theISection);
89 /** Set section name (if theISection is invalid it is ignored).
91 void setName(const std::string& theName, const int theISection);
93 /** Add points to the specified section (or last section
94 * if \a theISection is -1).
96 void addPoints(const CurveCreator::Coordinates &thePoints,
97 const int theISection = -1);
99 //! Add a new section.
100 void addSection(const std::string &theName, const CurveCreator::Type theType,
101 const bool theIsClosed,
102 const CurveCreator::Coordinates &thePoints);
104 //! Removes the section. If theISection equals -1, removes the last section.
105 void removeSection(const int theISection = -1);
107 /** Insert points in the given position (add to the end of list
108 * if \a theIPnt parameter is -1) of the specified section
109 * (or last section if \a theISection parameter is -1).
111 void insertPoints(const CurveCreator::Coordinates &thePoints,
112 const int theISection = -1,
113 const int theIPnt = -1);
115 /** Remove \a nbPoints points from given \a theISection,
116 * starting from given \a theIPnt (of all points up to the end of
117 * section if \a theNbPoints is -1).
119 void removePoints(const int theISection,
121 const int theNbPoints = -1);
123 /** Mobe point in \a theISection from given position \a theOrigIPnt
124 * to new position \a theNewIPnt.
126 void movePoint(const int theISection,
127 const int theOrigIPnt,
128 const int theNewIPnt );
130 //! Remove all sections.
133 //! Set coordinates of specified point
134 void setCoordinates(const CurveCreator::Coordinates &theCoords,
135 const int theISection,
138 /** Move specified \a theISection to the specified position
139 * in the sections list.
141 void moveSection(const int theISection, const int theNewIndex);
143 //! Join two sections to one section
144 void join(const int theISectionTo, const int theISectionFrom);
146 //! Join all sections to the single curve
151 /** This method updates all undo/redo information required to be updated
152 * after curve modification operation. It returns false if undo/redo
153 * is disabled and true otherwise.
161 ListDiff::iterator myCurrenPos;
162 ListDiff myListDiffs;
163 CurveCreator_Curve* myPCurve;