X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Displayer.cpp;h=bca8d2d24c37de2107155910d1d9fc51cca2d3a4;hb=622014f62af50bfd219fb242df168760849e2006;hp=a036e8f7503f43064338e915fdbdcf9720503a93;hpb=6654a921211670c15a79a997ca666a174fe8a6f6;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index a036e8f75..bca8d2d24 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -32,6 +33,13 @@ void XGUI_Displayer::Display(boost::shared_ptr theFeature, Handle(AIS_InteractiveContext) aContext = myViewer->AISContext(); Handle(AIS_Shape) anAIS = new AIS_Shape(theShape); + std::vector aDispAIS; + if (myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end()) { + aDispAIS = myFeature2AISObjectMap[theFeature]; + } + aDispAIS.push_back(anAIS); + myFeature2AISObjectMap[theFeature] = aDispAIS; + aContext->Display(anAIS, Standard_False); if (isUpdateViewer) @@ -39,10 +47,23 @@ void XGUI_Displayer::Display(boost::shared_ptr theFeature, } void XGUI_Displayer::Erase(boost::shared_ptr theFeature, - const TopoDS_Shape& theShape, const bool isUpdateViewer) + const bool isUpdateViewer) { + if (myFeature2AISObjectMap.find(theFeature) == myFeature2AISObjectMap.end()) + return; + + std::vector aDispAIS = myFeature2AISObjectMap[theFeature]; + std::vector::const_iterator anIt = aDispAIS.begin(), + aLast = aDispAIS.end(); Handle(AIS_InteractiveContext) aContext = myViewer->AISContext(); - aContext->EraseAll(); + for (; anIt != aLast; anIt++) { + Handle(AIS_InteractiveObject) anAIS = *anIt; + Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS); + if (anAISShape.IsNull()) + continue; + aContext->Erase(anAISShape); + } + if (isUpdateViewer) aContext->UpdateCurrentViewer(); } @@ -54,7 +75,14 @@ void XGUI_Displayer::LocalSelection(boost::shared_ptr theFeatu Handle(AIS_InteractiveContext) aContext = myViewer->AISContext(); Handle(AIS_Shape) anAIS = new AIS_Shape(theShape); + std::vector aDispAIS; + if (myFeature2AISObjectMap.find(theFeature) != myFeature2AISObjectMap.end()) { + aDispAIS = myFeature2AISObjectMap[theFeature]; + } + aDispAIS.push_back(anAIS); + myFeature2AISObjectMap[theFeature] = aDispAIS; aContext->Display(anAIS, Standard_False); + AIS_ListOfInteractive anAISList; anAISList.Append(anAIS); myViewer->setLocalSelection(anAISList, theMode, true);