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()
15 SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
18 // find sketch that references to this feature
19 int aSketches = document()->size(ModelAPI_Feature::group());
20 for (int a = 0; a < aSketches && !mySketch; a++) {
21 ObjectPtr anObj = document()->object(ModelAPI_Feature::group(), a);
22 boost::shared_ptr<SketchPlugin_Sketch> aSketch =
23 boost::dynamic_pointer_cast<SketchPlugin_Sketch>(anObj);
25 std::list<ObjectPtr> aList = aSketch->data()->reflist(SketchPlugin_Sketch::FEATURES_ID())
27 std::list<ObjectPtr>::iterator aSub = aList.begin();
28 for (; aSub != aList.end(); aSub++) {
29 if ((*aSub)->data()->isEqual(data())) {
30 mySketch = aSketch.get();
40 AISObjectPtr SketchPlugin_Feature::simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
41 AISObjectPtr thePrevious)
43 boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
44 ModelAPI_ResultConstruction>(theRes);
46 boost::shared_ptr<GeomAPI_Shape> aPreview;
48 aPreview = aConstr->shape();
50 AISObjectPtr aResult = thePrevious;
52 aResult = AISObjectPtr(new GeomAPI_AISObject());
53 aResult->createShape(aPreview);