SHAPER  9.12.0
SketchSolver_ConstraintMovement.h
1 // Copyright (C) 2017-2023 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 // File: SketchSolver_ConstraintMovement.h
21 // Created: 15 Jun 2015
22 // Author: Artem ZHIDKOV
23 
24 #ifndef SketchSolver_ConstraintMovement_H_
25 #define SketchSolver_ConstraintMovement_H_
26 
27 #include <SketchSolver_ConstraintFixed.h>
28 
29 class GeomAPI_Pnt2d;
30 
36 {
37 public:
39  SketchSolver_ConstraintMovement(FeaturePtr theFeature);
40 
42  SketchSolver_ConstraintMovement(AttributePtr theMovedAttribute, const int thePointIndex = -1);
43 
45  void startPoint(const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint);
46 
49  void moveTo(const std::shared_ptr<GeomAPI_Pnt2d>& theDestinationPoint);
50 
52  virtual void blockEvents(bool isBlocked);
53 
55  FeaturePtr movedFeature() const
56  { return myMovedFeature; }
57 
58 protected:
60  virtual void process();
61 
64  ConstraintWrapperPtr initMovement();
65 
67  ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr& theArcExtremity);
68 
70  ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr& theCircular);
71 
73  ConstraintWrapperPtr fixPointOnEllipse(const EntityWrapperPtr& theConic);
74 
75 private:
76  FeaturePtr myMovedFeature;
77  AttributePtr myDraggedAttribute;
78  int myDraggedPointIndex;
79  std::shared_ptr<GeomAPI_Pnt2d> myStartPoint;
80 
81  bool mySimpleMove;
82 };
83 
84 #endif
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
Stores data of the Fixed constraint.
Definition: SketchSolver_ConstraintFixed.h:30
Stores data to the Fixed constraint for the moved feature only.
Definition: SketchSolver_ConstraintMovement.h:36
ConstraintWrapperPtr fixArcExtremity(const EntityWrapperPtr &theArcExtremity)
Create constraint to fix moved arc extremity.
Definition: SketchSolver_ConstraintMovement.cpp:156
virtual void blockEvents(bool isBlocked)
Block or unblock events from this constraint.
Definition: SketchSolver_ConstraintMovement.cpp:67
SketchSolver_ConstraintMovement(FeaturePtr theFeature)
Creates movement constraint based on feature.
Definition: SketchSolver_ConstraintMovement.cpp:50
void startPoint(const std::shared_ptr< GeomAPI_Pnt2d > &theStartPoint)
Set coordinates of the start point of the movement.
Definition: SketchSolver_ConstraintMovement.cpp:300
ConstraintWrapperPtr fixPointOnCircle(const EntityWrapperPtr &theCircular)
Create constraint to fix moved point on circle/arc.
Definition: SketchSolver_ConstraintMovement.cpp:194
void moveTo(const std::shared_ptr< GeomAPI_Pnt2d > &theDestinationPoint)
Set coordinates of fixed feature to the values where it has been dragged.
Definition: SketchSolver_ConstraintMovement.cpp:310
ConstraintWrapperPtr fixPointOnEllipse(const EntityWrapperPtr &theConic)
Create constraint to fix moved point on ellipse/elliptic arc.
Definition: SketchSolver_ConstraintMovement.cpp:236
virtual void process()
Converts SketchPlugin constraint to a list of SolveSpace constraints.
Definition: SketchSolver_ConstraintMovement.cpp:73
FeaturePtr movedFeature() const
Returns moved feature.
Definition: SketchSolver_ConstraintMovement.h:55
ConstraintWrapperPtr initMovement()
Create Fixed constraint for the feature basing on its type and moved point.
Definition: SketchSolver_ConstraintMovement.cpp:109