Salome HOME
updated copyright message
[modules/gui.git] / src / VTKViewer / VTKViewer_DataSetMapper.cxx
index fad3d91795f5b916357da2b7fefac1cd65c19897..265bd96123cf3d9d8436acd159283763638c0c27 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include <vtkDataSetSurfaceFilter.h>
 #include <vtkObjectFactory.h>
 
-vtkCxxRevisionMacro(VTKViewer_DataSetMapper, "Revision$");
-vtkStandardNewMacro(VTKViewer_DataSetMapper);
+vtkStandardNewMacro(VTKViewer_DataSetMapper)
 
 //----------------------------------------------------------------------------
 VTKViewer_DataSetMapper::VTKViewer_DataSetMapper()
 {
   this->MarkerEnabled = false;
+  this->BallEnabled = false;
+  this->BallScale = 1;
   this->MarkerType    = VTK::MT_NONE;
   this->MarkerScale   = VTK::MS_NONE;
   this->MarkerId      = 0;
@@ -48,14 +49,16 @@ void VTKViewer_DataSetMapper::Render(vtkRenderer *ren, vtkActor *act)
   {
     vtkDataSetSurfaceFilter *gf = vtkDataSetSurfaceFilter::New();
     VTKViewer_PolyDataMapper *pm = VTKViewer_PolyDataMapper::New();
-    pm->SetInput(gf->GetOutput());
+    pm->SetInputConnection(gf->GetOutputPort());
 
     pm->SetMarkerEnabled( this->MarkerEnabled );
     if( this->MarkerType != VTK::MT_USER )
       pm->SetMarkerStd( this->MarkerType, this->MarkerScale );
     else
       pm->SetMarkerTexture( this->MarkerId, this->MarkerTexture );
-
+    pm->SetBallEnabled( this->BallEnabled );
+    pm->SetBallScale( this->BallScale );
+    
     this->GeometryExtractor = gf;
     this->PolyDataMapper = pm;
   }
@@ -71,6 +74,25 @@ void VTKViewer_DataSetMapper::SetMarkerEnabled( bool theMarkerEnabled )
       aMapper->SetMarkerEnabled( theMarkerEnabled );
 }
 
+
+//-----------------------------------------------------------------------------
+void VTKViewer_DataSetMapper::SetBallEnabled( bool theBallEnabled )
+{
+  this->BallEnabled = theBallEnabled;
+  if( this->PolyDataMapper )
+    if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
+      aMapper->SetBallEnabled( theBallEnabled );
+}
+
+//-----------------------------------------------------------------------------
+void VTKViewer_DataSetMapper::SetBallScale( double theBallScale )
+{
+  this->BallScale = theBallScale;
+  if( this->PolyDataMapper )
+    if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
+      aMapper->SetBallScale( theBallScale );
+}
+
 //----------------------------------------------------------------------------
 void VTKViewer_DataSetMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
 {