+ // 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;
+ }
+ }
+ }
+