1 // File: SketchPlugin_Constraint.cpp
2 // Created: 08 May 2014
3 // Author: Artem ZHIDKOV
5 #include "SketchPlugin_Constraint.h"
7 #include <ModelAPI_Data.h>
8 #include <SketchPlugin_Sketch.h>
10 const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Constraint::preview()
15 void SketchPlugin_Constraint::addConstrainedObject(
16 const std::string& theAttrID,
17 const boost::shared_ptr<ModelAPI_AttributeReference>& theReference)
19 if (!data()->attribute(theAttrID).get())
20 data()->addAttribute(theAttrID, theReference->type());
21 boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(
22 data()->attribute(theAttrID))->setValue(theReference->value());
25 void SketchPlugin_Constraint::addConstrainedObject(
26 const std::string& theAttrID,
27 const boost::shared_ptr<ModelAPI_AttributeRefAttr>& theReference)
29 if (!data()->attribute(theAttrID).get())
30 data()->addAttribute(theAttrID, theReference->type());
31 boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
32 data()->attribute(theAttrID))->setValue(theReference->value());
35 void SketchPlugin_Constraint::getSketchParameters(
36 std::list< boost::shared_ptr<ModelAPI_Attribute> >& theParams)
38 theParams.push_back(sketch()->data()->attribute(SKETCH_ATTR_ORIGIN));
39 theParams.push_back(sketch()->data()->attribute(SKETCH_ATTR_DIRX));
40 theParams.push_back(sketch()->data()->attribute(SKETCH_ATTR_DIRY));
41 theParams.push_back(sketch()->data()->attribute(SKETCH_ATTR_NORM));