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>
13 /// Before writing a new method implementation in this file, please check the next rule:
14 /// exported public methods must not be implemented in this source file. They should be inline and
15 /// placed in the header file.
16 /// Because it leads to the runtime problem on the Linux OS.
18 /// The reason is that this is an abstract interface. An interface of this class can be used in
19 /// outside libraries through casting without a link to the current library.
21 SketchPlugin_Feature::SketchPlugin_Feature()
26 SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
29 // find sketch that references to this feature
30 const std::set<AttributePtr>& aBackRefs = data()->refsToMe();
31 std::set<AttributePtr>::const_iterator aBackRef = aBackRefs.begin();
32 for(; aBackRef != aBackRefs.end(); aBackRef++) {
33 std::shared_ptr<SketchPlugin_Sketch> aSketch =
34 std::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
36 mySketch = aSketch.get();