1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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 #ifndef SketchSolver_ConstraintMultiTranslation_H_
21 #define SketchSolver_ConstraintMultiTranslation_H_
23 #include <SketchSolver_ConstraintMulti.h>
25 #include "GeomDataAPI_Point2D.h"
27 /** \class SketchSolver_ConstraintMultiTranslation
29 * \brief Convert translated features to the list of SolveSpace constraints
31 class SketchSolver_ConstraintMultiTranslation : public SketchSolver_ConstraintMulti
34 /// Constructor based on SketchPlugin constraint
35 SketchSolver_ConstraintMultiTranslation(ConstraintPtr theConstraint) :
36 SketchSolver_ConstraintMulti(theConstraint)
40 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
41 virtual void process();
43 /// \brief Generate list of translated entities
44 /// \param[out] theStartPoint start point of translation
45 /// \param[out] theEndPoint final point of translation
46 /// \param[out] theFullValue applying translation using the distance as a full or single value
47 /// \param[out] theEntities list of base entities
48 void getAttributes(EntityWrapperPtr& theStartPoint, EntityWrapperPtr& theEndPoint,
49 bool& theFullValue, std::list<EntityWrapperPtr>& theEntities);
51 /// \brief This method is used in derived objects to check consistence of constraint.
52 virtual void adjustConstraint();
54 /// \brief Update parameters (called from base class)
55 virtual void updateLocal();
58 /// \brief Convert absolute coordinates to relative coordinates
59 virtual void getRelative(double theAbsX, double theAbsY,
60 double& theRelX, double& theRelY);
61 /// \brief Convert relative coordinates to absolute coordinates
62 virtual void getAbsolute(double theRelX, double theRelY,
63 double& theAbsX, double& theAbsY);
64 /// \brief Apply transformation for relative coordinates
65 virtual void transformRelative(double& theX, double& theY);
67 /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
68 virtual const std::string& nameNbObjects();
71 AttributePoint2DPtr myStartPointAttribute;
72 AttributePoint2DPtr myEndPointAttribute;
74 double myDelta[2]; ///< increment of translation