SHAPER 9.16.0
SketchSolver_ConstraintMulti.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef SketchSolver_ConstraintMulti_H_
21#define SketchSolver_ConstraintMulti_H_
22
23#include <SketchSolver_Constraint.h>
24
25#include <vector>
26
32{
33public:
35 SketchSolver_ConstraintMulti(ConstraintPtr theConstraint) :
36 SketchSolver_Constraint(theConstraint),
39 myIsFullValue(false),
40 myAdjusted(false),
41 myIsEventsBlocked(false),
43 {}
44
46 virtual void update();
47
49 virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*);
50
54 virtual bool remove();
55
57 virtual void blockEvents(bool isBlocked);
58
59protected:
61 virtual void process()
62 { /* do nothing here */ }
63
65 void getEntities(std::list<EntityWrapperPtr>& theEntities);
66
68 virtual void getAttributes(EntityWrapperPtr&, std::vector<EntityWrapperPtr>&)
69 { /* do nothing here */ }
70
72 virtual void adjustConstraint();
73
75 virtual void updateLocal() = 0;
76
78 virtual const std::string& nameNbObjects() = 0;
79
80protected:
82 virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY) = 0;
84 virtual void getAbsolute(double theRelX, double theRelY, double& theAbsX, double& theAbsY) = 0;
86 virtual void transformRelative(double& theX, double& theY) = 0;
87
88protected:
92
94
96 std::set<FeaturePtr> myOriginalFeatures;
97 std::set<FeaturePtr> myCopiedFeatures;
98
99 bool myIsEventsBlocked;
101};
102
103#endif
Send events to listeners about changing a feature.
Definition: PlaneGCSSolver_Update.h:38
Common base class for the Multi constraints.
Definition: SketchSolver_ConstraintMulti.h:32
virtual void getAttributes(EntityWrapperPtr &, std::vector< EntityWrapperPtr > &)
Generate list of attributes of constraint in order useful for SolveSpace constraints.
Definition: SketchSolver_ConstraintMulti.h:68
bool myAdjusted
the constraint is already adjusted (to not do it several times)
Definition: SketchSolver_ConstraintMulti.h:93
bool myIsFullValue
value whether the angle/distance is a full or single for objects
Definition: SketchSolver_ConstraintMulti.h:91
SketchSolver_ConstraintMulti(ConstraintPtr theConstraint)
Constructor based on SketchPlugin constraint.
Definition: SketchSolver_ConstraintMulti.h:35
virtual void blockEvents(bool isBlocked)
Block or unblock events from this constraint.
Definition: SketchSolver_ConstraintMulti.cpp:251
virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *)
Notify this object about the feature is changed somewhere.
Definition: SketchSolver_ConstraintMulti.cpp:227
virtual void transformRelative(double &theX, double &theY)=0
Apply transformation for relative coordinates.
void getEntities(std::list< EntityWrapperPtr > &theEntities)
Collect entities which are translated or rotated (not their copies)
Definition: SketchSolver_ConstraintMulti.cpp:45
std::set< FeaturePtr > myOriginalFeatures
lists of original features and their copies to find whether some of them are disappeared
Definition: SketchSolver_ConstraintMulti.h:96
virtual void adjustConstraint()
This method is used in derived objects to check consistence of constraint.
Definition: SketchSolver_ConstraintMulti.cpp:154
virtual void process()
Converts SketchPlugin constraint to a list of SolveSpace constraints.
Definition: SketchSolver_ConstraintMulti.h:61
virtual const std::string & nameNbObjects()=0
Returns name of NUMBER_OF_COPIES parameter for corresponding feature.
virtual void updateLocal()=0
Update parameters of derived classes.
int myNumberOfObjects
number of previous initial objects
Definition: SketchSolver_ConstraintMulti.h:89
int myNumberOfCopies
number of previous copies of initial objects
Definition: SketchSolver_ConstraintMulti.h:90
bool myIsProcessingNotify
the notification is already processing
Definition: SketchSolver_ConstraintMulti.h:100
virtual void getRelative(double theAbsX, double theAbsY, double &theRelX, double &theRelY)=0
Convert absolute coordinates to relative coordinates.
virtual bool remove()
Tries to remove constraint.
Definition: SketchSolver_ConstraintMulti.cpp:92
virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX, double &theAbsY)=0
Convert relative coordinates to absolute coordinates.
virtual void update()
Update constraint.
Definition: SketchSolver_ConstraintMulti.cpp:115
Converts SketchPlugin constraint to the constraint applicable for solver.
Definition: SketchSolver_Constraint.h:39