+/*!
+ Applies clipping planes to all visible (and clippable) objects
+*/
+void OCCViewer_Viewer::applyClippingPlanes(bool theUpdateHatch)
+{
+ if (myInternalClipPlanes.IsEmpty()) {
+ return; // Nothing to do
+ }
+
+ if (theUpdateHatch) {
+ double hatchScale = computeHatchScale();
+ for ( Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt ( myInternalClipPlanes ); aPlaneIt.More(); aPlaneIt.Next() ) {
+ Handle(Graphic3d_TextureMap) aTexture = aPlaneIt.Value()->CappingTexture();
+ setTextureScale(aTexture, hatchScale);
+ }
+ }
+
+ AIS_ListOfInteractive aList;
+ myAISContext->DisplayedObjects (aList);
+ for ( AIS_ListIteratorOfListOfInteractive anIter (aList); anIter.More(); anIter.Next() ) {
+ Handle(AIS_InteractiveObject) anObj = anIter.Value();
+ Handle(ViewerData_AISShape) aShape = Handle(ViewerData_AISShape)::DownCast (anObj);
+ if (!aShape.IsNull() && aShape->IsClippable()) {
+ aShape->SetClipPlanes(new Graphic3d_SequenceOfHClipPlane(myInternalClipPlanes));
+ }
+ }
+}
+