From 917398577a81534c6fb2119ed24960000af29444 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 20 Apr 2016 17:37:21 +0300 Subject: [PATCH] #1404 Random crash with Shaper: AIS presentations: operation prs, result sketch prs and module base result fill internal container of objects in order to use the previous result of Compute when result tend to have an empty presentation. --- src/ModelAPI/ModelAPI_Events.h | 3 + src/ModuleBase/ModuleBase_ResultPrs.cpp | 27 ++-- src/PartSet/PartSet_OperationPrs.cpp | 101 ++++++++----- src/PartSet/PartSet_OperationPrs.h | 9 ++ src/PartSet/PartSet_ResultSketchPrs.cpp | 188 ++++++++++++++---------- src/PartSet/PartSet_ResultSketchPrs.h | 11 +- src/XGUI/XGUI_WorkshopListener.cpp | 38 +++++ src/XGUI/XGUI_WorkshopListener.h | 10 +- 8 files changed, 254 insertions(+), 133 deletions(-) diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 656ec109a..aee15049d 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -48,6 +48,9 @@ static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; +static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation"; +static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation"; + static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested"; diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 0a278d93a..726821ec1 100755 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -7,11 +7,13 @@ #include "ModuleBase_ResultPrs.h" #include "ModuleBase_Tools.h" +#include #include #include #include #include +#include #include #include @@ -69,27 +71,24 @@ bool ModuleBase_ResultPrs::isValidShapeType(const TopAbs_ShapeEnum& theBaseType, return aValid; } - void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); - if (!aShapePtr) { - Events_Error::throwException("An empty AIS presentation: ModuleBase_ResultPrs"); - return; - } - - myOriginalShape = aShapePtr->impl(); - if (!myOriginalShape.IsNull()) { - Set(myOriginalShape); - - // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(myOriginalShape, Attributes()); - AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); + if (aShapePtr.get()) { + myOriginalShape = aShapePtr->impl(); + if (!myOriginalShape.IsNull()) + Set(myOriginalShape); } - else + else { Events_Error::throwException("An empty AIS presentation: ModuleBase_ResultPrs"); + static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); + ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); + } + // change deviation coefficient to provide more precise circle + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); + AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); } void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 98bd33298..3858042e3 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include +#include #include @@ -77,49 +79,44 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t SetColor(myShapeColor); thePresentation->Clear(); + NCollection_DataMap aShapeToPrsMap; + fillShapeList(myFeatureShapes, aShapeToPrsMap); + + if (!aShapeToPrsMap.IsEmpty()) { + myShapeToPrsMap.Clear(); + myShapeToPrsMap.Assign(aShapeToPrsMap); + } XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(myWorkshop)->displayer(); Handle(Prs3d_Drawer) aDrawer = Attributes(); - // create presentations on the base of the shapes - bool anEmptyAIS = true; - QMap >::const_iterator anIt = myFeatureShapes.begin(), - aLast = myFeatureShapes.end(); - for (; anIt != aLast; anIt++) { - ObjectPtr anObject = anIt.key(); - QList aShapes = anIt.value(); - QList::const_iterator aShIt = aShapes.begin(), aShLast = aShapes.end(); - for (; aShIt != aShLast; aShIt++) { - GeomShapePtr aGeomShape = *aShIt; - // the shape should not be checked here on empty value because it should be checked in - // appendShapeIfVisible() on the step of filling myFeatureShapes list - // the reason is to avoid empty AIS object visualized in the viewer - //if (!aGeomShape.get()) continue; - TopoDS_Shape aShape = aGeomShape.get() ? aGeomShape->impl() : TopoDS_Shape(); - // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer); - - if (myUseAISWidth) { - AISObjectPtr anAISPtr = aDisplayer->getAISObject(anObject); - if (anAISPtr.get()) { - Handle(AIS_InteractiveObject) anIO = anAISPtr->impl(); - if (!anIO.IsNull()) { - int aWidth = anIO->Width(); - /// workaround for zero width. Else, there will be a crash - if (aWidth == 0) { // width returns of TSolid shape is zero - bool isDisplayed = !anIO->GetContext().IsNull(); - aWidth = PartSet_Tools::getAISDefaultWidth();// default width value - } - setWidth(aDrawer, aWidth); - } + for(NCollection_DataMap::Iterator anIter(myShapeToPrsMap); + anIter.More(); anIter.Next()) { + const TopoDS_Shape& aShape = anIter.Key(); + // change deviation coefficient to provide more precise circle + ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer); + + if (myUseAISWidth) { + Handle(AIS_InteractiveObject) anIO = anIter.Value(); + if (!anIO.IsNull()) { + int aWidth = anIO->Width(); + /// workaround for zero width. Else, there will be a crash + if (aWidth == 0) { // width returns of TSolid shape is zero + bool isDisplayed = !anIO->GetContext().IsNull(); + aWidth = PartSet_Tools::getAISDefaultWidth();// default width value } + setWidth(aDrawer, aWidth); } - StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer); - if (anEmptyAIS) - anEmptyAIS = false; } + StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer); } - if (anEmptyAIS) + + if (myShapeToPrsMap.IsEmpty()) { Events_Error::throwException("An empty AIS presentation: PartSet_OperationPrs"); + + //std::shared_ptr aMsg = std::shared_ptr( + // new Events_Message(Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION))); + //Events_Loop::loop()->send(aMsg); + } } void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, @@ -360,3 +357,37 @@ bool PartSet_OperationPrs::isSelectionAttribute(const AttributePtr& theAttribute anAttrType == ModelAPI_AttributeSelection::typeId() || anAttrType == ModelAPI_AttributeReference::typeId(); } + +void PartSet_OperationPrs::fillShapeList(const QMap >& theFeatureShapes, + NCollection_DataMap& theShapeToPrsMap) +{ + theShapeToPrsMap.Clear(); + + XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(myWorkshop)->displayer(); + Handle(Prs3d_Drawer) aDrawer = Attributes(); + + // create presentations on the base of the shapes + QMap >::const_iterator anIt = myFeatureShapes.begin(), + aLast = myFeatureShapes.end(); + for (; anIt != aLast; anIt++) { + ObjectPtr anObject = anIt.key(); + QList aShapes = anIt.value(); + QList::const_iterator aShIt = aShapes.begin(), aShLast = aShapes.end(); + for (; aShIt != aShLast; aShIt++) { + GeomShapePtr aGeomShape = *aShIt; + // the shape should not be checked here on empty value because it should be checked in + // appendShapeIfVisible() on the step of filling myFeatureShapes list + // the reason is to avoid empty AIS object visualized in the viewer + //if (!aGeomShape.get()) continue; + TopoDS_Shape aShape = aGeomShape.get() ? aGeomShape->impl() : TopoDS_Shape(); + // change deviation coefficient to provide more precise circle + Handle(AIS_InteractiveObject) anIO; + if (myUseAISWidth) { + AISObjectPtr anAISPtr = aDisplayer->getAISObject(anObject); + if (anAISPtr.get()) + anIO = anAISPtr->impl(); + } + theShapeToPrsMap.Bind(aShape, anIO); + } + } +} diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h index 6ea0ac622..0c49300ef 100755 --- a/src/PartSet/PartSet_OperationPrs.h +++ b/src/PartSet/PartSet_OperationPrs.h @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -129,7 +130,15 @@ private: GeomShapePtr theGeomShape, QMap >& theObjectShapes); + /// Fills the list of shapes by map of model objects + /// \param theFeatureShape a container to find shapes + /// \param theShapesMap an out container + void fillShapeList(const QMap >& theFeatureShapes, + NCollection_DataMap& theShapeToPrsMap); + private: + NCollection_DataMap myShapeToPrsMap; /// list of visualized shapes + QMap > myFeatureShapes; /// visualized shapes ModuleBase_IWorkshop* myWorkshop; /// current workshop diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index ede7d144d..04d9318ea 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -8,11 +8,13 @@ #include "PartSet_Tools.h" #include "ModuleBase_Tools.h" +#include #include #include #include #include +#include #include @@ -77,92 +79,39 @@ void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d) { thePresentation->Clear(); - std::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); - if (!aShapePtr) { - Events_Error::throwException("An empty AIS presentation: PartSet_ResultSketchPrs"); - return; - } + TopoDS_Shape aResultShape; + TopoDS_Compound anAuxiliaryCompound; + NCollection_List aFaceList; + fillShapes(aResultShape, anAuxiliaryCompound, mySketchFaceList); - setAuxiliaryPresentationStyle(false); + bool isEmptyPresentation = aResultShape.IsNull() && anAuxiliaryCompound.IsNull(); - myFacesList.clear(); - ResultConstructionPtr aConstruction = - std::dynamic_pointer_cast(myResult); - if (aConstruction.get()) { - int aFacesNum = aConstruction->facesNum(); - for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { - myFacesList.push_back(aConstruction->face(aFaceIndex)); - } + if (!aResultShape.IsNull()) { + myOriginalShape = aResultShape; + if (!myOriginalShape.IsNull()) + Set(myOriginalShape); } - myOriginalShape = aShapePtr->impl(); - if (!myOriginalShape.IsNull()) { - Set(myOriginalShape); - // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(myOriginalShape, Attributes()); - AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); - } - else - Events_Error::throwException("An empty AIS presentation: PartSet_ResultSketchPrs"); + if (!anAuxiliaryCompound.IsNull()) + myAuxiliaryCompound = anAuxiliaryCompound; - // visualize auxiliary shapes and sketch construction elements(point, center of a circle) - FeaturePtr aResultFeature = ModelAPI_Feature::feature(myResult); - CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast - (aResultFeature); - std::list anAuxiliaryResults; - /// append auxiliary shapes - for (int i = 0; i < aSketchFeature->numberOfSubs(); i++) { - FeaturePtr aFeature = aSketchFeature->subFeature(i); - if (PartSet_Tools::isAuxiliarySketchEntity(aFeature)) { - std::list aResults = aFeature->results(); - std::list::const_iterator aIt; - for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { - ResultPtr aResult = *aIt; - if (aResult.get() && aResult->shape().get()) - anAuxiliaryResults.push_back(aResult); - } - } - else { - /// append not-edges shapes, e.g. center of a circle, an arc, a point feature - const std::list >& aRes = aFeature->results(); - std::list >::const_iterator aResIter = aRes.cbegin(); - for (; aResIter != aRes.cend(); aResIter++) { - std::shared_ptr aConstr = std::dynamic_pointer_cast< - ModelAPI_ResultConstruction>(*aResIter); - if (aConstr) { - std::shared_ptr aGeomShape = aConstr->shape(); - if (aGeomShape.get()) { - const TopoDS_Shape& aShape = aGeomShape->impl(); - if (aShape.ShapeType() != TopAbs_EDGE) - anAuxiliaryResults.push_back(aConstr); - } - } - } - } - } + setAuxiliaryPresentationStyle(false); - if (anAuxiliaryResults.size() > 0) { + // change deviation coefficient to provide more precise circle + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); + AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); + + if (!myAuxiliaryCompound.IsNull()) { setAuxiliaryPresentationStyle(true); - BRep_Builder aBuilder; - TopoDS_Compound aComp; - aBuilder.MakeCompound(aComp); - std::list::const_iterator anIt = anAuxiliaryResults.begin(), - aLast = anAuxiliaryResults.end(); - for (; anIt != aLast; anIt++) { - ResultPtr aResult = *anIt; - if (aResult.get()) { - GeomShapePtr aGeomShape = aResult->shape(); - if (aGeomShape.get()) { - const TopoDS_Shape& aShape = aGeomShape->impl(); - if (!aShape.IsNull()) - aBuilder.Add(aComp, aShape); - } - } - } - myAuxiliaryCompound = aComp; Handle(Prs3d_Drawer) aDrawer = Attributes(); - StdPrs_WFDeflectionShape::Add(thePresentation, aComp, aDrawer); + StdPrs_WFDeflectionShape::Add(thePresentation, myAuxiliaryCompound, aDrawer); + } + + if (isEmptyPresentation) { + Events_Error::throwException("An empty AIS presentation: PartSet_ResultSketchPrs"); + static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); + ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); } } @@ -201,9 +150,9 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); aBuilder.Add(aComp, myOriginalShape); - std::list>::const_iterator aIt; - for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) { - TopoDS_Shape aFace = (*aIt)->impl(); + + for(NCollection_List::Iterator anIt(mySketchFaceList); anIt.More(); anIt.Next()) { + const TopoDS_Shape& aFace = anIt.Value(); aBuilder.Add(aComp, aFace); // for sketch presentation in the face mode wires should be selectable also // accoring to #1343 Improvement of Extrusion and Revolution operations @@ -291,3 +240,82 @@ void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle(const bool isAuxilia aLineAspect->SetTypeOfLine(aType); } } + +void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& theResultShape, + TopoDS_Compound& theAuxiliaryCompound, + NCollection_List& theFaceList) +{ + //if (!aResultShape.IsNull() || !anAuxiliaryCompound.IsNull()) + std::shared_ptr aShapePtr = ModelAPI_Tools::shape(myResult); + if (!aShapePtr) + return; + + theFaceList.Clear(); + ResultConstructionPtr aConstruction = + std::dynamic_pointer_cast(myResult); + if (aConstruction.get()) { + int aFacesNum = aConstruction->facesNum(); + for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) { + std::shared_ptr aFaceShape = aConstruction->face(aFaceIndex); + if (aFaceShape.get()) { + TopoDS_Shape aFace = (aFaceShape)->impl(); + theFaceList.Append(aFace); + } + } + } + theResultShape = aShapePtr->impl(); + + /// find auxiliary shapes + FeaturePtr aResultFeature = ModelAPI_Feature::feature(myResult); + CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast + (aResultFeature); + std::list anAuxiliaryResults; + for (int i = 0; i < aSketchFeature->numberOfSubs(); i++) { + FeaturePtr aFeature = aSketchFeature->subFeature(i); + if (PartSet_Tools::isAuxiliarySketchEntity(aFeature)) { + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { + ResultPtr aResult = *aIt; + if (aResult.get() && aResult->shape().get()) + anAuxiliaryResults.push_back(aResult); + } + } + else { + /// append not-edges shapes, e.g. center of a circle, an arc, a point feature + const std::list >& aRes = aFeature->results(); + std::list >::const_iterator aResIter = aRes.cbegin(); + for (; aResIter != aRes.cend(); aResIter++) { + std::shared_ptr aConstr = std::dynamic_pointer_cast< + ModelAPI_ResultConstruction>(*aResIter); + if (aConstr) { + std::shared_ptr aGeomShape = aConstr->shape(); + if (aGeomShape.get()) { + const TopoDS_Shape& aShape = aGeomShape->impl(); + if (aShape.ShapeType() != TopAbs_EDGE) + anAuxiliaryResults.push_back(aConstr); + } + } + } + } + } + + if (anAuxiliaryResults.size() > 0) { + BRep_Builder aBuilder; + //TopoDS_Compound aComp; + aBuilder.MakeCompound(theAuxiliaryCompound); + std::list::const_iterator anIt = anAuxiliaryResults.begin(), + aLast = anAuxiliaryResults.end(); + for (; anIt != aLast; anIt++) { + ResultPtr aResult = *anIt; + if (aResult.get()) { + GeomShapePtr aGeomShape = aResult->shape(); + if (aGeomShape.get()) { + const TopoDS_Shape& aShape = aGeomShape->impl(); + if (!aShape.IsNull()) + aBuilder.Add(theAuxiliaryCompound, aShape); + } + } + } + } +} diff --git a/src/PartSet/PartSet_ResultSketchPrs.h b/src/PartSet/PartSet_ResultSketchPrs.h index d2861823d..ce403d192 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.h +++ b/src/PartSet/PartSet_ResultSketchPrs.h @@ -57,6 +57,14 @@ private: /// \param isAuxiliary a boolean value if the properties are for auxiliary objects void setAuxiliaryPresentationStyle(const bool isAuxiliary); + /// Fills the containers by the current result + /// \param theResultShape contains a shape of the result, it will be set as a Shape of AIS_Shape + /// \param theAuxiliaryCompound a compound of auxiliary shapes + /// \param theFaceList a list of face shapes + void PartSet_ResultSketchPrs::fillShapes(TopoDS_Shape& aResultShape, + TopoDS_Compound& theAuxiliaryCompound, + NCollection_List& theFaceList); + /// Reference to result object ResultPtr myResult; @@ -67,7 +75,8 @@ private: TopoDS_Compound myAuxiliaryCompound; /// List of faces - std::list > myFacesList; + //std::list > myFacesList; + NCollection_List mySketchFaceList; }; diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 79fb1f007..cd9e9482c 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -93,6 +93,8 @@ void XGUI_WorkshopListener::initializeEventListening() aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED)); aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); + aLoop->registerListener(this, Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)); } //****************************************************** @@ -128,6 +130,10 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr& std::shared_ptr aUpdMsg = std::dynamic_pointer_cast(theMessage); onFeatureRedisplayMsg(aUpdMsg); + } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)) { + std::shared_ptr aUpdMsg = + std::dynamic_pointer_cast(theMessage); + onFeatureEmptyPresentationMsg(aUpdMsg); } //Update property panel on corresponding message. If there is no current operation (no //property panel), or received message has different feature to the current - do nothing. @@ -341,6 +347,8 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptrflush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); + //VSV FitAll updated viewer by it self if (aFirstVisualizedBody) myWorkshop->viewer()->fitAll(); @@ -348,6 +356,7 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptrupdateViewer(); } } + //****************************************************** void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptr& theMsg) { @@ -411,6 +420,7 @@ void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptrprocessEvent(theMsg); if (aDisplayed) { + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); //VSV FitAll updated viewer by it self if (aFirstVisualizedBody) myWorkshop->viewer()->fitAll(); @@ -422,6 +432,34 @@ void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptr& theMsg) +{ + std::set anObjects = theMsg->objects(); + std::set::const_iterator aIt; +#ifdef DEBUG_FEATURE_CREATED + QStringList anInfo; + for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { + anInfo.append(ModuleBase_Tools::objectInfo((*aIt))); + } + QString anInfoStr = anInfo.join(";\t"); + qDebug(QString("onFeatureEmptyPresentationMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); +#endif + + XGUI_Workshop* aWorkshop = workshop(); + XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + + bool aRedisplayed = false; + for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { + ObjectPtr anObject = *aIt; + aRedisplayed = aDisplayer->erase(anObject, false) || aRedisplayed; + } + + if (aRedisplayed) + aDisplayer->updateViewer(); +} + bool XGUI_WorkshopListener::event(QEvent * theEvent) { PostponeMessageQtEvent* aPostponedEv = dynamic_cast(theEvent); diff --git a/src/XGUI/XGUI_WorkshopListener.h b/src/XGUI/XGUI_WorkshopListener.h index 2567daffb..9601486f8 100755 --- a/src/XGUI/XGUI_WorkshopListener.h +++ b/src/XGUI/XGUI_WorkshopListener.h @@ -48,14 +48,18 @@ protected: bool event(QEvent * theEvent); /// Process feature update message - void onFeatureUpdatedMsg(const std::shared_ptr& ); + /// \param theMsg a message with a container of objects + void onFeatureUpdatedMsg(const std::shared_ptr& theMsg); /// Process feature created message - void onFeatureCreatedMsg(const std::shared_ptr& ); + /// \param theMsg a message with a container of objects + void onFeatureCreatedMsg(const std::shared_ptr& theMsg); /// Process feature redisplay message - void onFeatureRedisplayMsg(const std::shared_ptr& ); + /// \param theMsg a message with a container of objects + void onFeatureRedisplayMsg(const std::shared_ptr& theMsg); + void onFeatureEmptyPresentationMsg(const std::shared_ptr& theMsg); /// Displaus object and fit all viewer if the object is first (update viewer will not be called) /// Asks the module whether the object can be displayed /// \param theObj an object -- 2.39.2