]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls
authormpa <mpa@opencascade.com>
Mon, 24 Mar 2014 07:26:49 +0000 (11:26 +0400)
committermpa <mpa@opencascade.com>
Mon, 24 Mar 2014 07:26:49 +0000 (11:26 +0400)
src/VTKViewer/VTKViewer_PolyDataMapper.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.h

index 065347301c680b714ef6bb16ec734d767c3e0aad..3d8733cc5ef88e736e67b236e0ef8f26f724bc24 100644 (file)
@@ -254,6 +254,7 @@ VTKViewer_PolyDataMapper::VTKViewer_PolyDataMapper()
   this->MarkerScale               = VTK::MS_NONE;
   this->MarkerId                  = 0;
   this->BallEnabled               = false;
+  this->BallScale                 = VTK::MS_10;
   this->VertexProgram             = 0;
 }
 
@@ -384,6 +385,19 @@ void VTKViewer_PolyDataMapper::SetBallEnabled( bool theBallEnabled )
   this->Modified();
 }
 
+//-----------------------------------------------------------------------------
+int VTKViewer_PolyDataMapper::GetBallScale()
+{
+  return this->BallScale;
+}
+//-----------------------------------------------------------------------------
+void VTKViewer_PolyDataMapper::SetBallScale( int theBallScale )
+{
+  if( this->BallScale == theBallScale )
+    return;
+  this->BallScale = theBallScale;
+}
+
 //-----------------------------------------------------------------------------
 void VTKViewer_PolyDataMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
 {
@@ -778,8 +792,9 @@ namespace VTK
                    TVertex* theVertexArr,
                    vtkIdType &theCellId,
                    vtkIdType &theVertexId,
-                  TBall* theBallArr,
-                  vtkDataArray* theDiamArray)
+                   TBall* theBallArr,
+                   vtkDataArray* theDiamArray,
+                   int theBallScale )
   {
     vtkIdType* ptIds = theCells->GetPointer();
     vtkIdType* endPtIds = ptIds + theCells->GetNumberOfConnectivityEntries();
@@ -810,7 +825,7 @@ namespace VTK
       }
       
       if(mapBalls){
-       theBallArr[theCellId] = (TBall)theDiamArray->GetTuple(theCellId)[0];
+        theBallArr[theCellId] = (TBall)theDiamArray->GetTuple(theCellId)[0]*theBallScale;
       }
 
       ++theCellId;
@@ -823,7 +838,8 @@ namespace VTK
                         vtkPoints* thePoints,
                         TColorFunctorBase* theColorFunctor,
                         TVertex* theVertexArr,
-                       TBall* theBallArr)
+                        TBall* theBallArr,
+                        int theBallScale )
   {
     vtkIdType aCellId = 0, aVertexId = 0;
 
@@ -831,17 +847,17 @@ namespace VTK
     vtkDataArray* aDiams = theInput->GetCellData() ? theInput->GetCellData()->GetScalars() : 0;    
 
     if ( vtkCellArray* aCellArray = theInput->GetVerts() ) {
-      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams);
+      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams, theBallScale );
     }
   
     if ( vtkCellArray* aCellArray = theInput->GetLines() )
-      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams);
+      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams, theBallScale );
   
     if ( vtkCellArray* aCellArray = theInput->GetPolys() )
-      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams);
+      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams, theBallScale );
   
     if ( vtkCellArray* aCellArray = theInput->GetStrips() )
-      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams); 
+      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId, theBallArr, aDiams, theBallScale ); 
   }
 } // namespace VTK
 
@@ -920,9 +936,9 @@ int VTKViewer_PolyDataMapper::Draw( vtkRenderer* ren, vtkActor* act )
           aColorFunctor = new VTK::TPropertyColor( prop );
         }
         if ( points->GetDataType() == VTK_FLOAT )
-          VTK::DrawCellsPoints< float >( input, points, aColorFunctor, aVertexArr, aBallArray );
+          VTK::DrawCellsPoints< float >( input, points, aColorFunctor, aVertexArr, aBallArray, GetBallScale() );
         else
-          VTK::DrawCellsPoints< double >( input, points, aColorFunctor, aVertexArr, aBallArray );
+          VTK::DrawCellsPoints< double >( input, points, aColorFunctor, aVertexArr, aBallArray, GetBallScale() );
 
         delete aColorFunctor;
       }
index 7e8262c326d2c11aa98191bb17973f4d1caa051c..44b5e6bc6ff68b1ca0b4e3aa38b504f8255f69e6 100644 (file)
@@ -75,6 +75,11 @@ public:
   
   bool GetBallEnabled( );
 
+  //! Set ball scale factor
+  void SetBallScale( int );
+
+  int GetBallScale( );
+
   //! Set standard point marker
   void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale );
 
@@ -125,7 +130,8 @@ private:
   GLhandleARB       VertexProgram;
 
   bool              MarkerEnabled;
-  bool              BallEnabled;  
+  bool              BallEnabled; 
+  int               BallScale;
   VTK::MarkerType   MarkerType;
   VTK::MarkerScale  MarkerScale;
   int               MarkerId;