X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Feature.cpp;h=ae771b5567b1dff3cc71ac5f52d9c4b15ff95969;hb=8e193b0425317ba19a21a752accaaf59909f52b2;hp=dbaa6f8240e9b6461e7e2ace6f738ae8e0e3e111;hpb=565ea47bca70316604a59dcc22b03f37602011ba;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index dbaa6f824..ae771b556 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -10,24 +10,30 @@ SketchPlugin_Feature::SketchPlugin_Feature() mySketch = 0; } -void SketchPlugin_Feature::setData(boost::shared_ptr theData) +void SketchPlugin_Feature::setPreview(const boost::shared_ptr& theShape) +{ + myPreview = theShape; +} + +const boost::shared_ptr& SketchPlugin_Feature::getPreview() const { - ModelAPI_Feature::setData(theData); + return myPreview; +} - // 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()); +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 aSketch = boost:: + dynamic_pointer_cast(document()->feature("Construction", a, true)); 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)) { + if ((*aSub)->data()->isEqual(data())) { mySketch = aSketch.get(); break; } @@ -35,14 +41,5 @@ void SketchPlugin_Feature::setData(boost::shared_ptr theData) } } } -} - -void SketchPlugin_Feature::setPreview(const boost::shared_ptr& theShape) -{ - myPreview = theShape; -} - -const boost::shared_ptr& SketchPlugin_Feature::getPreview() const -{ - return myPreview; + return mySketch; }