X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Displayer.cpp;h=2652ae0ed1753caa9e7f863862942f59b2ba4247;hb=00a3c1675ca0ead43040cafa3a99f984e1d8177b;hp=b68f63dd656d6f8f2eafa9726c4e3be10a43fe18;hpb=a94fc319f2aa64b43c9a73b5ff7063923648faec;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index b68f63dd6..2652ae0ed 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -18,12 +18,13 @@ // email : webmaster.salome@opencascade.com // +#include "XGUI_CustomPrs.h" #include "XGUI_Displayer.h" -#include "XGUI_Workshop.h" -#include "XGUI_ViewerProxy.h" -#include "XGUI_SelectionMgr.h" +#include "XGUI_FacesPanel.h" #include "XGUI_Selection.h" -#include "XGUI_CustomPrs.h" +#include "XGUI_SelectionMgr.h" +#include "XGUI_ViewerProxy.h" +#include "XGUI_Workshop.h" #ifndef HAVE_SALOME #include @@ -36,11 +37,12 @@ #include #include +#include +#include +#include #include #include -#include #include -#include #include #include @@ -74,7 +76,7 @@ #include #ifdef TINSPECTOR -#include +#include #endif #include @@ -1071,13 +1073,13 @@ Handle(SelectMgr_AndFilter) XGUI_Displayer::GetFilter() } bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSelectionModes, - bool theUpdateViewer) + const Standard_Integer theDisplayMode, bool theUpdateViewer) { bool aDisplayed = false; Handle(AIS_InteractiveContext) aContext = AISContext(); Handle(AIS_InteractiveObject) anAISIO = theAIS->impl(); if (!aContext.IsNull() && !anAISIO.IsNull()) { - aContext->Display(anAISIO, 0/*wireframe*/, 0, false/*update viewer*/, true, AIS_DS_Displayed); + aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, true, AIS_DS_Displayed); #ifdef TINSPECTOR if (getCallBack()) getCallBack()->Display(anAISIO); #endif @@ -1389,6 +1391,11 @@ bool XGUI_Displayer::customizeObject(ObjectPtr theObject) aCustomPrs->customisePresentation(aResult, anAISObj, myCustomPrs); isCustomized = myWorkshop->module()->afterCustomisePresentation(aResult, anAISObj, myCustomPrs) || isCustomized; + + // update presentation state if faces panel is active + if (anAISObj.get() && myWorkshop->facesPanel()) + isCustomized = myWorkshop->facesPanel()->customizeObject(theObject, anAISObj) || isCustomized; + return isCustomized; } @@ -1518,7 +1525,7 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const } else { deactivateTrihedron(false); - aContext->Erase(aTrihedron); + aContext->Erase(aTrihedron, Standard_True); #ifdef TINSPECTOR if (getCallBack()) getCallBack()->Remove(aTrihedron); #endif @@ -1541,6 +1548,9 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th const NCollection_DataMap>& theShapesToBeSelected) { + NCollection_Map aCompsolidPresentations; + NCollection_Map aSelectedPresentations; + NCollection_List anActiveOwners; theContext->MainSelector()->ActiveOwners(anActiveOwners); NCollection_List::Iterator anOwnersIt (anActiveOwners); @@ -1564,26 +1574,46 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th if (aShape.IsNull()) continue; + Handle(ModuleBase_BRepOwner) aCustomOwner = Handle(ModuleBase_BRepOwner)::DownCast(anOwner); + NCollection_DataMap > ::Iterator aShapeIt(theShapesToBeSelected); for (; aShapeIt.More(); aShapeIt.Next()) { - if (aShapeIt.Key().IsSame(aShape)) { - const TopoDS_Shape& aParameterShape = aShapeIt.Key(); - // isSame should be used here as it does not check orientation of shapes - // despite on isEqual of shapes or IsBound for shape in QMap. Orientation is - // different for Edges shapes in model shape and owner even if this is the same shape - if (aParameterShape.IsSame(aShape)) { - Handle(AIS_InteractiveObject) anOwnerPresentation = - Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); - NCollection_Map aPresentations = - theShapesToBeSelected.Find(aParameterShape); - if (aPresentations.Contains(anOwnerPresentation)) { - theContext->AddOrRemoveSelected(anOwner); - anOwner->SetSelected (Standard_True); - } + const TopoDS_Shape& aParameterShape = aShapeIt.Key(); + // isSame should be used here as it does not check orientation of shapes + // despite on isEqual of shapes or IsBound for shape in QMap. Orientation is + // different for Edges shapes in model shape and owner even if this is the same shape + if (aParameterShape.IsSame(aShape)) { + Handle(AIS_InteractiveObject) anOwnerPresentation = + Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); + NCollection_Map aPresentations = + theShapesToBeSelected.Find(aParameterShape); + if (aPresentations.Contains(anOwnerPresentation)) { + theContext->AddOrRemoveSelected(anOwner, Standard_False); + anOwner->SetSelected (Standard_True); + // collect selected presentations to do not select them if compsolid is selected + if (!aSelectedPresentations.Contains(anOwnerPresentation)) + aSelectedPresentations.Add(anOwnerPresentation); } } + else if (!aCustomOwner.IsNull()) { // CompSolid processing #2219 + // shape of owner is compound, but shape to be selected is compsolid, so + // we need to compare shape to AIS presentation of owner(rule of the owner creation) + Handle(AIS_Shape) anOwnerPresentation = + Handle(AIS_Shape)::DownCast(anOwner->Selectable()); + const TopoDS_Shape& aPresentationShape = anOwnerPresentation->Shape(); + if (aParameterShape.IsSame(anOwnerPresentation->Shape()) && + !aCompsolidPresentations.Contains(anOwnerPresentation)) + aCompsolidPresentations.Add(anOwnerPresentation); + } } } } + // select CompSolid presentations if their owners was not selected yet + NCollection_Map::Iterator anIt (aCompsolidPresentations); + for (; anIt.More(); anIt.Next()) { + if (aSelectedPresentations.Contains(anIt.Value())) + continue; + theContext->AddOrRemoveSelected(anIt.Value(), Standard_False); + } }