20 #ifndef SketchPlugin_ConstraintAngle_H_
21 #define SketchPlugin_ConstraintAngle_H_
23 #include "SketchPlugin.h"
24 #include "SketchPlugin_Sketch.h"
25 #include "SketchPlugin_ConstraintBase.h"
27 #include <ModelAPI_IReentrant.h>
43 inline static const std::string&
ID()
45 static const std::string MY_CONSTRAINT_ANGLE_ID(
"SketchConstraintAngle");
46 return MY_CONSTRAINT_ANGLE_ID;
49 SKETCHPLUGIN_EXPORT
virtual const std::string&
getKind()
56 inline static const std::string&
TYPE_ID()
58 static const std::string MY_TYPE_ID(
"AngleType");
64 static const std::string MY_TYPE_ID(
"AngleTypePrevious");
71 static const std::string MY_ANGLE_VALUE_ID(
"AngleValue");
72 return MY_ANGLE_VALUE_ID;
78 static const std::string MY_ANGLE_REVERSED_ID(
"AngleReversedLine1");
79 return MY_ANGLE_REVERSED_ID;
84 static const std::string MY_ANGLE_REVERSED_ID(
"AngleReversedLine2");
85 return MY_ANGLE_REVERSED_ID;
91 static const std::string MY_LOCATION_TYPE_ID(
"LocationType");
92 return MY_LOCATION_TYPE_ID;
98 static const std::string MY_SELECTED_FIRST_POINT_ID(
"SelectedPointA");
99 return MY_SELECTED_FIRST_POINT_ID;
105 static const std::string MY_SELECTED_SECOND_POINT_ID(
"SelectedPointB");
106 return MY_SELECTED_SECOND_POINT_ID;
110 static const int THE_VERSION_0 = 0;
111 static const int THE_VERSION_1 = 20191210;
116 static const std::string MY_VERSION_ID(
"version");
117 return MY_VERSION_ID;
122 SKETCHPLUGIN_EXPORT
virtual void execute();
127 SKETCHPLUGIN_EXPORT
virtual bool compute(
const std::string& theAttributeId);
133 SKETCHPLUGIN_EXPORT
virtual void colorConfigInfo(std::string& theSection, std::string& theName,
134 std::string& theDefault);
138 SKETCHPLUGIN_EXPORT
virtual void attributeChanged(
const std::string& theID);
141 SKETCHPLUGIN_EXPORT
virtual AISObjectPtr
getAISObject(AISObjectPtr thePrevious);
155 virtual std::string
processEvent(
const std::shared_ptr<Events_Message>& theMessage);
171 double getAngleForType(
double theAngle,
bool isReversed1 =
false,
bool isReversed2 =
false);
std::shared_ptr< ModelAPI_AttributeDouble > real(const std::string &theID)
Returns the real attribute by the identifier.
Definition: ModelAPI_Feature.h:211
Interface of a class which can process specific messages.
Definition: ModelAPI_IReentrant.h:35
Feature for creation of a new constraint fix angle between two lines.
Definition: SketchPlugin_ConstraintAngle.h:40
static const std::string & LOCATION_TYPE_ID()
attribute name of dimension location type
Definition: SketchPlugin_ConstraintAngle.h:89
double getAngleForType(double theAngle, bool isReversed1=false, bool isReversed2=false)
Converts the angle value according to the current angle type and sketch plane normal.
Definition: SketchPlugin_ConstraintAngle.cpp:328
SketchPlugin_ConstraintAngle()
Use plugin manager for features creation.
Definition: SketchPlugin_ConstraintAngle.cpp:68
double getNumericValue() override
Get numeric value of attribute MY_ANGLE_VALUE_ID()
Definition: SketchPlugin_ConstraintAngle.h:148
static const std::string & VERSION_ID()
Attribute name of the version of Angle feature.
Definition: SketchPlugin_ConstraintAngle.h:114
virtual const std::string & getKind()
Returns the kind of a feature.
Definition: SketchPlugin_ConstraintAngle.h:49
static const std::string & PREV_TYPE_ID()
attribute name of previous value of operation type
Definition: SketchPlugin_ConstraintAngle.h:62
void updateVersion()
Update parameters of the Angle to meet requirements for the latest version.
Definition: SketchPlugin_ConstraintAngle.cpp:542
static const std::string & ANGLE_REVERSED_FIRST_LINE_ID()
attribute name indicating the first line is reversed
Definition: SketchPlugin_ConstraintAngle.h:76
static const std::string & TYPE_ID()
attribute name of operation type
Definition: SketchPlugin_ConstraintAngle.h:56
virtual void colorConfigInfo(std::string &theSection, std::string &theName, std::string &theDefault)
Returns the parameters of color definition in the resources config manager.
Definition: SketchPlugin_ConstraintAngle.cpp:122
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: SketchPlugin_ConstraintAngle.cpp:73
void calculateAngle()
Calculate current value of the angle.
Definition: SketchPlugin_ConstraintAngle.cpp:222
static const std::string & ID()
Angle constraint kind.
Definition: SketchPlugin_ConstraintAngle.h:43
static const std::string & SELECTED_SECOND_POINT_ID()
attribute name indicating the second point selected
Definition: SketchPlugin_ConstraintAngle.h:103
void updateAngleValue()
Update value of ANGLE_VALUE attribute according to the current type.
Definition: SketchPlugin_ConstraintAngle.cpp:438
static const std::string & SELECTED_FIRST_POINT_ID()
attribute name indicating the first point selected
Definition: SketchPlugin_ConstraintAngle.h:96
virtual bool compute(const std::string &theAttributeId)
Computes the attribute value on the base of other attributes if the value can be computed.
Definition: SketchPlugin_ConstraintAngle.cpp:462
void calculateAnglePosition()
Compute the position of the angle presentation (the quarter selected by the user)
Definition: SketchPlugin_ConstraintAngle.cpp:260
static const std::string & ANGLE_REVERSED_SECOND_LINE_ID()
attribute name indicating the second line is reversed
Definition: SketchPlugin_ConstraintAngle.h:82
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
Returns the AIS preview.
Definition: SketchPlugin_ConstraintAngle.cpp:157
void setNumericValue(const double theValue) override
Set numeric value to attribute ANGLE_VALUE_ID()
Definition: SketchPlugin_ConstraintAngle.cpp:169
virtual void attributeChanged(const std::string &theID)
Called on change of any argument-attribute of this object.
Definition: SketchPlugin_ConstraintAngle.cpp:193
static const std::string & ANGLE_VALUE_ID()
attribute name of operation type
Definition: SketchPlugin_ConstraintAngle.h:69
virtual void execute()
Creates a new part document if needed.
Definition: SketchPlugin_ConstraintAngle.cpp:130
virtual std::string processEvent(const std::shared_ptr< Events_Message > &theMessage)
Apply information of the message to current object.
Definition: SketchPlugin_ConstraintAngle.cpp:176
Feature for creation of a new constraint between other features.
Definition: SketchPlugin_ConstraintBase.h:56