1 #include "SketchPlugin_Feature.h"
2 #include "SketchPlugin_Sketch.h"
3 #include <ModelAPI_Document.h>
4 #include <ModelAPI_Data.h>
5 #include <ModelAPI_Object.h>
6 #include <ModelAPI_AttributeRefList.h>
8 SketchPlugin_Feature::SketchPlugin_Feature()
13 void SketchPlugin_Feature::setPreview(const boost::shared_ptr<GeomAPI_Shape>& theShape)
18 const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Feature::getPreview() const
23 SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
26 // find sketch that references to this feature
27 int aSketches = document()->size("Construction");
28 for(int a = 0; a < aSketches && !mySketch; a++) {
29 boost::shared_ptr<SketchPlugin_Sketch> aSketch = boost::
30 dynamic_pointer_cast<SketchPlugin_Sketch>(document()->feature("Construction", a, true));
32 std::list<boost::shared_ptr<ModelAPI_Feature> > aList =
33 aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list();
34 std::list<boost::shared_ptr<ModelAPI_Feature> >::iterator aSub = aList.begin();
35 for(; aSub != aList.end(); aSub++) {
36 if ((*aSub)->data()->isEqual(data())) {
37 mySketch = aSketch.get();