1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #include "SketchPlugin_Feature.h"
4 #include "SketchPlugin_Sketch.h"
5 #include <ModelAPI_Document.h>
6 #include <ModelAPI_Data.h>
7 #include <ModelAPI_Object.h>
8 #include <ModelAPI_AttributeRefList.h>
9 #include <ModelAPI_ResultConstruction.h>
11 SketchPlugin_Feature::SketchPlugin_Feature()
16 void SketchPlugin_Feature::erase()
18 SketchPlugin_Sketch* aSketch = sketch();
20 aSketch->removeFeature(this);
22 ModelAPI_Feature::erase();
25 SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
28 // find sketch that references to this feature
29 const std::set<AttributePtr>& aBackRefs = data()->refsToMe();
30 std::set<AttributePtr>::const_iterator aBackRef = aBackRefs.begin();
31 for(; aBackRef != aBackRefs.end(); aBackRef++) {
32 std::shared_ptr<SketchPlugin_Sketch> aSketch =
33 std::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
35 mySketch = aSketch.get();