1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_IConstraintWrapper.h
4 // Created: 30 Nov 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_IConstraintWrapper_H_
8 #define SketchSolver_IConstraintWrapper_H_
10 #include <SketchSolver_IEntityWrapper.h>
12 #include <SketchPlugin_Constraint.h>
17 /// Types of constraints
18 enum SketchSolver_ConstraintType {
19 CONSTRAINT_UNKNOWN = 0,
20 CONSTRAINT_COINCIDENCE, // base coincidence if we don't know exact type yet
21 CONSTRAINT_PT_PT_COINCIDENT,
22 CONSTRAINT_PT_ON_LINE,
23 CONSTRAINT_PT_ON_CIRCLE,
24 CONSTRAINT_MIDDLE_POINT,
25 CONSTRAINT_DISTANCE, // base distance if we don't know the measured objects yet
26 CONSTRAINT_PT_PT_DISTANCE,
27 CONSTRAINT_PT_LINE_DISTANCE,
31 CONSTRAINT_HORIZONTAL,
34 CONSTRAINT_PERPENDICULAR,
36 CONSTRAINT_EQUAL, // base equality if we don't know the measured objects yet
37 CONSTRAINT_EQUAL_LINES,
38 CONSTRAINT_EQUAL_LINE_ARC,
39 CONSTRAINT_EQUAL_RADIUS,
40 CONSTRAINT_TANGENT, // base tangency if we don't know the measured objects yet
41 CONSTRAINT_TANGENT_ARC_LINE,
42 CONSTRAINT_TANGENT_CIRCLE_LINE,
43 CONSTRAINT_TANGENT_ARC_ARC,
45 CONSTRAINT_MULTI_TRANSLATION,
46 CONSTRAINT_MULTI_ROTATION
50 * Wrapper providing operations with constraints regardless the solver.
52 class SketchSolver_IConstraintWrapper
55 virtual ~SketchSolver_IConstraintWrapper() {}
57 /// \brief Return ID of current constraint
58 const ConstraintID& id() const
60 /// \brief Change constraint ID
61 virtual void setId( const ConstraintID& theID) = 0;
63 /// \brief Return type of current entity
64 virtual SketchSolver_ConstraintType type() const = 0;
66 /// \brief Assign list of constrained objects
67 void setEntities(const std::list<EntityWrapperPtr>& theEntities)
68 { myConstrained = theEntities; }
69 /// \brief Return list of constrained objects
70 const std::list<EntityWrapperPtr>& entities() const
71 { return myConstrained; }
73 /// \brief Assign numeric parameter of constraint
74 virtual void setValue(const double& theValue) = 0;
75 /// \brief Return numeric parameter of constraint
76 virtual double value() const = 0;
78 /// \brief Store a boolean flag for full value using
79 void setIsFullValue(const bool& theFullValue)
80 { myIsFullValue = theFullValue; }
81 /// \brief Return a flag of a full value using
82 const bool& isFullValue() const
83 { return myIsFullValue; }
87 std::list<EntityWrapperPtr> myConstrained;
91 typedef std::shared_ptr<SketchSolver_IConstraintWrapper> ConstraintWrapperPtr;