1 // Copyright (C) 2013-2022 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, or (at your option) any later version.
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
63 SetColorSection //!< Method CurveCreator_Curve::setColorSection
69 CurveCreator_Operation();
74 ~CurveCreator_Operation();
77 * This method initializes the object with an operation without parameters.
78 * It is applicable to the following operations:
82 * @return true in case of success; false otherwise.
84 bool init(const Type theType);
87 * This method initializes the object with an operation with one integer
88 * parameter. It is applicable to the following operations:
90 * <LI>RemoveSection</LI>
92 * @return true in case of success; false otherwise.
94 bool init(const Type theType, const int theIntParam);
97 * This method initializes the object with an operation with two integer
98 * parameters. It is applicable to the following operations:
102 * <LI>MoveSection</LI>
103 * <LI>Join (with 2 int arguments)</LI>
105 * @return true in case of success; false otherwise.
107 bool init(const Type theType, const int theIntParam1,
108 const int theIntParam2);
111 * This method initializes the object with an operation with 4 integer
112 * parameter (1 as first param + 3 as interger array)
114 bool init(const Type theType, const int theIntParam1,
115 const int theIntParam2[3]);
119 * This method initializes the object with an operation with two integer
120 * parameters. It is applicable to the following operations:
122 * <LI>Join (with a list of int arguments)</LI>
124 * @return true in case of success; false otherwise.
126 bool init(const Type theType, const std::list<int> theParamList);
129 * This method initializes the object with an operation with
130 * list of pairs of integer parameters.
131 * It is applicable to the following operations:
133 * <LI>RemovePoints</LI>
135 * @return true in case of success; false otherwise.
137 bool init(const Type theType,
138 const CurveCreator_ICurve::SectionToPointList &theParamList1);
141 * This method initializes the object with an operation with one
142 * CurveCreator::Coordinates parameter and one integer parameter.
143 * It is applicable to the following operations:
147 * @return true in case of success; false otherwise.
149 bool init(const Type theType, const CurveCreator::Coordinates &theCoords,
150 const int theIntParam);
153 * This method initializes the object with an operation with
154 * list of pairs of integer parameters and CurveCreator::Coordinates parameters.
155 * It is applicable to the following operations:
157 * <LI>InsertPoints</LI>
159 * @return true in case of success; false otherwise.
161 bool init(const Type theType,
162 const CurveCreator_ICurve::SectionToPointCoordsList &theParamList1);
165 * This method initializes the object with an operation with one
166 * string, one CurveCreator::Coordinates parameter and two integer parameters.
167 * It is applicable to the following operations:
169 * <LI>AddSection</LI>
170 * <LI>InsertPoints</LI>
171 * <LI>SetCoordinates</LI>
173 * @return true in case of success; false otherwise.
175 bool init(const CurveCreator_Operation::Type theType,
176 const std::string& theName,
177 const CurveCreator::Coordinates &theCoords,
178 const int theIntParam1,
179 const int theIntParam2);
183 * This method initializes the object with an operation with one
184 * string parameter and one integer.
185 * It is applicable to the following operations:
187 * <LI>RenameSection</LI>
189 * @return true in case of success; false otherwise.
191 bool init(const CurveCreator_Operation::Type theType,
192 const std::string &theName,
193 const int theIntParam1 );
196 * This method applies the current operation to theCurve.
198 void apply(CurveCreator_Curve *theCurve);
203 * This method allocates required memory for the operation data.
204 * Returns myPData for convenience purpose.
206 void *allocate(const size_t theSize);
209 * This method clears initialized data pointers.
214 * This method returns the coordinates read from thePInt.
216 void getCoords(int *thePInt, CurveCreator::Coordinates &theCoords) const;