From: nds Date: Tue, 20 May 2014 06:16:02 +0000 (+0400) Subject: refs #30 - Sketch base GUI: create, draw lines X-Git-Tag: V_0.2~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=565ea47bca70316604a59dcc22b03f37602011ba;p=modules%2Fshaper.git refs #30 - Sketch base GUI: create, draw lines Check the following scenario: create sketch, line. Undo/Redo. As a result the line is displayed. Undo/Redo. The line is displayed again. --- diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index e75bc01e6..dbaa6f824 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -2,6 +2,7 @@ #include "SketchPlugin_Sketch.h" #include #include +#include #include SketchPlugin_Feature::SketchPlugin_Feature() @@ -16,16 +17,20 @@ void SketchPlugin_Feature::setData(boost::shared_ptr theData) // 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)); - 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; + 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; + } } } } diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 73515eae7..7f6bb00d7 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -247,7 +247,7 @@ void XGUI_Displayer::EraseDeletedFeatures(const bool isUpdateViewer) for (; aFIt != aFLast; aFIt++) { boost::shared_ptr aFeature = (*aFIt).first; - if (!aFeature || !aFeature->data()->isValid()) { + if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) { Handle(AIS_InteractiveObject) anAIS = (*aFIt).second; if (!anAIS.IsNull()) { aContext->Erase(anAIS, false);