From df756dbdbd15d0b6cb1f5e3038a17ee7433788c7 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 20 May 2014 10:51:06 +0400 Subject: [PATCH] Remove setData overlapping: it causes problem of linking in Linux --- src/SketchPlugin/SketchPlugin_Feature.cpp | 55 ++++++++++++----------- src/SketchPlugin/SketchPlugin_Feature.h | 4 +- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index dbaa6f824..6f8f41af8 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -10,33 +10,6 @@ SketchPlugin_Feature::SketchPlugin_Feature() mySketch = 0; } -void SketchPlugin_Feature::setData(boost::shared_ptr theData) -{ - ModelAPI_Feature::setData(theData); - - // find sketch that references to this feature - int aSketches = document()->size("Construction"); - for(int a = 0; a < aSketches && !mySketch; a++) { - boost::shared_ptr anObj = - boost::dynamic_pointer_cast(document()->feature("Construction", a)); - if (anObj) { - boost::shared_ptr aSketch = - boost::dynamic_pointer_cast(anObj->featureRef()); - if (aSketch) { - std::list > aList = - aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list(); - std::list >::iterator aSub = aList.begin(); - for(; aSub != aList.end(); aSub++) { - if ((*aSub)->data()->isEqual(theData)) { - mySketch = aSketch.get(); - break; - } - } - } - } - } -} - void SketchPlugin_Feature::setPreview(const boost::shared_ptr& theShape) { myPreview = theShape; @@ -46,3 +19,31 @@ const boost::shared_ptr& SketchPlugin_Feature::getPreview() const { return myPreview; } + +SketchPlugin_Sketch* SketchPlugin_Feature::sketch() +{ + if (!mySketch) { + // find sketch that references to this feature + int aSketches = document()->size("Construction"); + for(int a = 0; a < aSketches && !mySketch; a++) { + boost::shared_ptr anObj = + boost::dynamic_pointer_cast(document()->feature("Construction", a)); + if (anObj) { + boost::shared_ptr aSketch = + boost::dynamic_pointer_cast(anObj->featureRef()); + if (aSketch) { + std::list > aList = + aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list(); + std::list >::iterator aSub = aList.begin(); + for(; aSub != aList.end(); aSub++) { + if ((*aSub)->data()->isEqual(data())) { + mySketch = aSketch.get(); + break; + } + } + } + } + } + } + return mySketch; +} diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index d83e21cce..db6a6d660 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -42,11 +42,9 @@ protected: /// Sets the higher-level feature for the sub-feature (sketch for line) void setSketch(SketchPlugin_Sketch* theSketch) {mySketch = theSketch;} /// Returns the sketch of this feature - SketchPlugin_Sketch* sketch() {return mySketch;} + SketchPlugin_Sketch* sketch(); /// initializes mySketch SketchPlugin_Feature(); - /// Sets the data manager of an object and here initializes mySketch field - SKETCHPLUGIN_EXPORT virtual void setData(boost::shared_ptr theData); friend class SketchPlugin_Sketch; -- 2.30.2