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_ResultConstruction.h>
12 /// Before writing a new method implementation in this file, please check the next rule:
13 /// exported public methods must not be implemented in this source file. They should be inline and
14 /// placed in the header file.
15 /// Because it leads to the runtime problem on the Linux OS.
17 /// The reason is that this is an abstract interface. An interface of this class can be used in
18 /// outside libraries through casting without a link to the current library.
20 SketchPlugin_Feature::SketchPlugin_Feature()
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();