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>
7 #include <ModelAPI_ResultConstruction.h>
9 SketchPlugin_Feature::SketchPlugin_Feature()
14 SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
17 // find sketch that references to this feature
18 int aSketches = document()->size(ModelAPI_Feature::group());
19 for (int a = 0; a < aSketches && !mySketch; a++) {
20 ObjectPtr anObj = document()->object(ModelAPI_Feature::group(), a);
21 boost::shared_ptr<SketchPlugin_Sketch> aSketch =
22 boost::dynamic_pointer_cast<SketchPlugin_Sketch>(anObj);
24 std::list<ObjectPtr> aList = aSketch->data()->reflist(SketchPlugin_Sketch::FEATURES_ID())
26 std::list<ObjectPtr>::iterator aSub = aList.begin();
27 for (; aSub != aList.end(); aSub++) {
28 if ((*aSub)->data()->isEqual(data())) {
29 mySketch = aSketch.get();
39 AISObjectPtr SketchPlugin_Feature::simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
40 AISObjectPtr thePrevious)
42 boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
43 ModelAPI_ResultConstruction>(theRes);
45 boost::shared_ptr<GeomAPI_Shape> aPreview;
47 aPreview = aConstr->shape();
49 AISObjectPtr aResult = thePrevious;
51 aResult = AISObjectPtr(new GeomAPI_AISObject());
52 aResult->createShape(aPreview);