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"
27 #include "CurveCreator_ICurve.hxx"
28 #include "CurveCreator_PosPoint.hxx"
33 class CurveCreator_Curve;
37 * This is the support class that describes a modification operation that
38 * can be applied to CurveCreator_Curve.
40 class CurveCreator_Operation
46 * This is a type of CurveCreator_Curve modification operation.
50 Unknown = 0, //!< Unknown method.
51 AddPoints, //!< Method CurveCreator_Curve::addPoints
52 RemovePoints, //!< Method CurveCreator_Curve::removePoints
53 InsertPoints, //!< Method CurveCreator_Curve::insertPoints
54 SetType, //!< Method CurveCreator_Curve::setType
55 Clear, //!< Method CurveCreator_Curve::clear
56 SetCoordinates, //!< Method CurveCreator_Curve::setCoordinates
57 SetClosed, //!< Method CurveCreator_Curve::setClosed
58 MoveSection, //!< Method CurveCreator_Curve::moveSection
59 Join, //!< Method CurveCreator_Curve::join
60 AddSection, //!< Method CurveCreator_Curve::addSection
61 RemoveSection, //!< Method CurveCreator_Curve::removeSection
62 RenameSection //!< Method CurveCreator_Curve::renameSection
68 CurveCreator_Operation();
73 ~CurveCreator_Operation();
76 * This method initializes the object with an operation without parameters.
77 * It is applicable to the following operations:
81 * @return true in case of success; false otherwise.
83 bool init(const Type theType);
86 * This method initializes the object with an operation with one integer
87 * parameter. It is applicable to the following operations:
89 * <LI>RemoveSection</LI>
91 * @return true in case of success; false otherwise.
93 bool init(const Type theType, const int theIntParam);
96 * This method initializes the object with an operation with two integer
97 * parameters. It is applicable to the following operations:
101 * <LI>MoveSection</LI>
102 * <LI>Join (with 2 int arguments)</LI>
104 * @return true in case of success; false otherwise.
106 bool init(const Type theType, const int theIntParam1,
107 const int theIntParam2);
110 * This method initializes the object with an operation with
111 * list of pairs of integer parameters.
112 * It is applicable to the following operations:
114 * <LI>RemovePoints</LI>
116 * @return true in case of success; false otherwise.
118 bool init(const Type theType,
119 const CurveCreator_ICurve::SectionToPointList &theParamList1);
122 * This method initializes the object with an operation with one
123 * CurveCreator::Coordinates parameter and one integer parameter.
124 * It is applicable to the following operations:
128 * @return true in case of success; false otherwise.
130 bool init(const Type theType, const CurveCreator::Coordinates &theCoords,
131 const int theIntParam);
134 * This method initializes the object with an operation with
135 * list of pairs of integer parameters and CurveCreator::Coordinates parameters.
136 * It is applicable to the following operations:
138 * <LI>InsertPoints</LI>
140 * @return true in case of success; false otherwise.
142 bool init(const Type theType,
143 const CurveCreator_ICurve::SectionToPointCoordsList &theParamList1);
146 * This method initializes the object with an operation with one
147 * string, one CurveCreator::Coordinates parameter and two integer parameters.
148 * It is applicable to the following operations:
150 * <LI>AddSection</LI>
151 * <LI>InsertPoints</LI>
152 * <LI>SetCoordinates</LI>
154 * @return true in case of success; false otherwise.
156 bool init(const CurveCreator_Operation::Type theType,
157 const std::string& theName,
158 const CurveCreator::Coordinates &theCoords,
159 const int theIntParam1,
160 const int theIntParam2);
164 * This method initializes the object with an operation with one
165 * string parameter and one integer.
166 * It is applicable to the following operations:
168 * <LI>RenameSection</LI>
170 * @return true in case of success; false otherwise.
172 bool init(const CurveCreator_Operation::Type theType,
173 const std::string &theName,
174 const int theIntParam1 );
177 * This method applies the current operation to theCurve.
179 void apply(CurveCreator_Curve *theCurve);
184 * This method allocates required memory for the operation data.
185 * Returns myPData for convenience purpose.
187 void *allocate(const size_t theSize);
190 * This method clears initialized data pointers.
195 * This method returns the coordinates read from thePInt.
197 void getCoords(int *thePInt, CurveCreator::Coordinates &theCoords) const;