1 // File: PartSet_FeaturePrs.h
2 // Created: 04 Jun 2014
3 // Author: Natalia ERMOLAEVA
5 #include <PartSet_FeatureArcPrs.h>
6 #include <PartSet_Tools.h>
8 #include <SketchPlugin_Feature.h>
9 #include <SketchPlugin_Sketch.h>
10 #include <SketchPlugin_Arc.h>
12 #include <GeomDataAPI_Point2D.h>
14 #include <ModelAPI_Data.h>
15 #include <ModelAPI_Document.h>
16 #include <ModelAPI_AttributeRefAttr.h>
17 #include <ModelAPI_AttributeRefList.h>
19 #include <Precision.hxx>
23 PartSet_FeatureArcPrs::PartSet_FeatureArcPrs(FeaturePtr theSketch)
24 : PartSet_FeaturePrs(theSketch)
28 PartSet_SelectionMode PartSet_FeatureArcPrs::setPoint(double theX, double theY,
29 const PartSet_SelectionMode& theMode)
31 PartSet_SelectionMode aMode = theMode;
35 PartSet_Tools::setFeaturePoint(feature(), theX, theY, ARC_ATTR_CENTER);
36 aMode = SM_SecondPoint;
39 case SM_SecondPoint: {
40 PartSet_Tools::setFeaturePoint(feature(), theX, theY, ARC_ATTR_START);
41 aMode = SM_ThirdPoint;
45 PartSet_Tools::setFeaturePoint(feature(), theX, theY, ARC_ATTR_END);
55 std::string PartSet_FeatureArcPrs::getAttribute(const PartSet_SelectionMode& theMode) const
57 std::string aAttribute;
61 aAttribute = ARC_ATTR_CENTER;
64 aAttribute = ARC_ATTR_START;
67 aAttribute = ARC_ATTR_END;
75 PartSet_SelectionMode PartSet_FeatureArcPrs::getNextMode(const std::string& theAttribute) const
77 PartSet_SelectionMode aMode;
79 if (theAttribute == ARC_ATTR_CENTER)
80 aMode = SM_SecondPoint;
81 else if (theAttribute == ARC_ATTR_START)
82 aMode = SM_ThirdPoint;
83 else if (theAttribute == ARC_ATTR_END)
88 boost::shared_ptr<GeomDataAPI_Point2D> PartSet_FeatureArcPrs::featurePoint
89 (const PartSet_SelectionMode& theMode)
91 std::string aPointArg;
95 aPointArg = ARC_ATTR_CENTER;
98 aPointArg = ARC_ATTR_START;
101 aPointArg = ARC_ATTR_END;
106 boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
107 boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
108 (aData->attribute(aPointArg));