Salome HOME
CMake: improved reloading of dependent CMake targets in Config file to
[modules/smesh.git] / src / OBJECT / SMESH_DeviceActor.cxx
index 562eaed739f011ba16d605f1288819fb8f18352c..02eefc529731a14d306fb607f83c91587c6a3307 100644 (file)
@@ -63,6 +63,8 @@
 
 #include <vtkRenderer.h>
 
+#include <vtkPlaneCollection.h>
+
 #include "utilities.h"
 
 #ifdef _DEBUG_
@@ -90,6 +92,7 @@ SMESH_DeviceActor
 
   myProperty = vtkProperty::New();
   myMapper = VTKViewer_PolyDataMapper::New();
+  myPlaneCollection = vtkPlaneCollection::New();
 
   vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
                                                                  myPolygonOffsetUnits);
@@ -139,6 +142,7 @@ SMESH_DeviceActor
   if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
 
   myMapper->Delete();
+  myPlaneCollection->Delete();
 
   myProperty->Delete();
 
@@ -228,6 +232,11 @@ SMESH_DeviceActor
     myExtractUnstructuredGrid->SetInputData(theGrid);
 
     myMergeFilter->SetGeometryConnection(myExtractUnstructuredGrid->GetOutputPort());
+    
+    //Pass diameters of the balls
+    if(myMapper->GetBallEnabled()) {
+      myMergeFilter->SetScalarsConnection(myExtractUnstructuredGrid->GetOutputPort());
+    }
 
     myExtractGeometry->SetInputConnection(myMergeFilter->GetOutputPort());
 
@@ -251,12 +260,20 @@ SMESH_DeviceActor
 
     anId++; // 5
     myMapper->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() );
+    if( myPlaneCollection->GetNumberOfItems() )
+      myMapper->SetClippingPlanes( myPlaneCollection );
 
     vtkLODActor::SetMapper( myMapper );
     Modified();
   }
 }
 
+void
+SMESH_DeviceActor
+::SetPlaneCollection( vtkPlaneCollection* theCollection )
+{
+  myPlaneCollection = theCollection;
+}
 
 VTKViewer_ExtractUnstructuredGrid* 
 SMESH_DeviceActor
@@ -935,6 +952,14 @@ void SMESH_DeviceActor::SetMarkerEnabled( bool theMarkerEnabled )
   myMapper->SetMarkerEnabled( theMarkerEnabled );
 }
 
+/*!
+ * Set point marker enabled
+ * \param theBallEnabled flag to enable/disable ball drawing
+ */
+void SMESH_DeviceActor::SetBallEnabled( bool theBallEnabled ) {
+  myMapper->SetBallEnabled( theBallEnabled );
+}
+
 /*!
  * Set standard point marker
  * \param theMarkerType type of the marker