#include <GeomAPI_Pnt.h>
#include <GeomAPI_IScreenParams.h>
+#include <SUIT_Application.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewModel.h>
#include <AIS_InteractiveContext.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_Point.hxx>
#endif
#include <AIS_Selection.hxx>
+#include <Graphic3d_MapOfStructure.hxx>
+#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <PrsDim_Dimension.hxx>
return anInfo.join(theSeparator);
}
+/// Apply the clipping planes to all objects in the "OCC3D" viewer.
+void applyClippingPlanes()
+{
+ SUIT_Application *pApp = SUIT_Session::session()->activeApplication();
+ QList<SUIT_ViewManager*> viewMgrs;
+ pApp->viewManagers(QString("OCCViewer"), viewMgrs);
+ if (!viewMgrs.isEmpty()) {
+ SUIT_ViewManager *pViewMgr = viewMgrs.first();
+ if (pViewMgr) {
+ SUIT_ViewModel *pViewMdl = pViewMgr->getViewModel();
+ if (pViewMdl) {
+ pViewMdl->applyClippingPlanes(true);
+ }
+ }
+ }
+}
+
//**************************************************************
XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
: myWorkshop(theWorkshop),
if (anAIS.get())
aDisplayed = display(theObject, anAIS, isShading, theUpdateViewer);
}
+
+ if (aDisplayed) {
+ applyClippingPlanes();
+ }
+
return aDisplayed;
}
if (!anAISIO.IsNull()) {
appendResultObject(theObject, theAIS);
+ // bos#40617: Apply clipping planes
+ // Retrieve the clipping plane from the OCCT Presentation Manager directly,
+ // as they are stored in the ViewModel of the OCCViewer in GUI, where we
+ // don't have access to.
+ Handle(ViewerData_AISShape) aShape = Handle(ViewerData_AISShape)::DownCast (anAISIO);
+ if (!aShape.IsNull() && aShape->IsClippable()) {
+ Graphic3d_MapOfStructure aSetOfStructures;
+ aContext->MainPrsMgr()->StructureManager()->DisplayedStructures( aSetOfStructures );
+ Graphic3d_MapIteratorOfMapOfStructure aStructureIt( aSetOfStructures );
+ for( ; aStructureIt.More(); aStructureIt.Next() ) {
+ const Handle(Graphic3d_Structure)& aStructure = aStructureIt.Key();
+ if ( aStructure->IsEmpty() || !aStructure->IsVisible() || aStructure->CStructure()->IsForHighlight )
+ continue;
+ const Handle(Graphic3d_SequenceOfHClipPlane) &planes = aStructure->ClipPlanes();
+ if (!planes.IsNull() && !planes->IsEmpty()) {
+ aShape->SetClipPlanes(planes);
+ break;
+ }
+ }
+ }
+
//bool isCustomized = customizeObject(theObject);
int aDispMode = isShading? Shading : Wireframe;
}
myResult2AISObjectMap.remove(theObject);
+ if (aErased) {
+ applyClippingPlanes();
+ }
+
#ifdef DEBUG_DISPLAY
std::ostringstream aPtrStr;
aPtrStr << theObject.get();