1 // Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: CurveCreator_Operation.hxx
21 // Author: Sergey KHROMOV
23 #ifndef _CurveCreator_Operation_HeaderFile
24 #define _CurveCreator_Operation_HeaderFile
26 #include "CurveCreator.hxx"
30 class CurveCreator_Curve;
34 * This is the support class that describes a modification operation that
35 * can be applied to CurveCreator_Curve.
37 class CurveCreator_Operation
43 * This is a type of CurveCreator_Curve modification operation.
47 Unknown = 0, //!< Unknown method.
48 AddPoints, //!< Method CurveCreator_Curve::addPoints
49 RemovePoints, //!< Method CurveCreator_Curve::removePoints
50 InsertPoints, //!< Method CurveCreator_Curve::insertPoints
51 SetType, //!< Method CurveCreator_Curve::setType
52 Clear, //!< Method CurveCreator_Curve::clear
53 SetCoordinates, //!< Method CurveCreator_Curve::setCoordinates
54 SetClosed, //!< Method CurveCreator_Curve::setClosed
55 MoveSection, //!< Method CurveCreator_Curve::moveSection
56 Join, //!< Method CurveCreator_Curve::join
57 AddSection, //!< Method CurveCreator_Curve::addSection
58 RemoveSection, //!< Method CurveCreator_Curve::removeSection
59 RenameSection //!< Method CurveCreator_Curve::renameSection
65 CurveCreator_Operation();
70 ~CurveCreator_Operation();
73 * This method initializes the object with an operation without parameters.
74 * It is applicable to the following operations:
77 * <LI>Join (without arguments)</LI>
79 * @return true in case of success; false otherwise.
81 bool init(const Type theType);
84 * This method initializes the object with an operation with one integer
85 * parameter. It is applicable to the following operations:
87 * <LI>RemoveSection</LI>
89 * @return true in case of success; false otherwise.
91 bool init(const Type theType, const int theIntParam);
94 * This method initializes the object with an operation with two integer
95 * parameters. It is applicable to the following operations:
99 * <LI>MoveSection</LI>
100 * <LI>Join (with 2 int arguments)</LI>
102 * @return true in case of success; false otherwise.
104 bool init(const Type theType, const int theIntParam1,
105 const int theIntParam2);
108 * This method initializes the object with an operation with three integer
109 * parameters. It is applicable to the following operations:
111 * <LI>RemovePoints</LI>
113 * @return true in case of success; false otherwise.
115 bool init(const Type theType, const int theIntParam1,
116 const int theIntParam2, const int theIntParam3);
119 * This method initializes the object with an operation with one
120 * CurveCreator::Coordinates parameter and one integer parameter.
121 * It is applicable to the following operations:
125 * @return true in case of success; false otherwise.
127 bool init(const Type theType, const CurveCreator::Coordinates &theCoords,
128 const int theIntParam);
131 * This method initializes the object with an operation with one
132 * CurveCreator::Coordinates parameter and two integer parameters.
133 * It is applicable to the following operations:
135 * <LI>AddSection</LI>
136 * <LI>InsertPoints</LI>
137 * <LI>SetCoordinates</LI>
139 * @return true in case of success; false otherwise.
141 bool init(const Type theType, const CurveCreator::Coordinates &theCoords,
142 const int theIntParam1, const int theIntParam2);
145 * This method initializes the object with an operation with one
146 * string, one CurveCreator::Coordinates parameter and two integer parameters.
147 * It is applicable to the following operations:
149 * <LI>AddSection</LI>
150 * <LI>InsertPoints</LI>
151 * <LI>SetCoordinates</LI>
153 * @return true in case of success; false otherwise.
155 bool init(const CurveCreator_Operation::Type theType,
156 const std::string& theName,
157 const CurveCreator::Coordinates &theCoords,
158 const int theIntParam1,
159 const int theIntParam2);
163 * This method initializes the object with an operation with one
164 * string parameter and one integer.
165 * It is applicable to the following operations:
167 * <LI>RenameSection</LI>
169 * @return true in case of success; false otherwise.
171 bool init(const CurveCreator_Operation::Type theType,
172 const std::string &theName,
173 const int theIntParam1 );
176 * This method applies the current operation to theCurve.
178 void apply(CurveCreator_Curve *theCurve);
183 * This method allocates required memory for the operation data.
184 * Returns myPData for convenience purpose.
186 void *allocate(const size_t theSize);
189 * This method clears initialized data pointers.
194 * This method returns the coordinates read from thePInt.
196 void getCoords(int *thePInt, CurveCreator::Coordinates &theCoords) const;