From 6791d5d2df9c3ab3aad2afb23a68f5c3f188f084 Mon Sep 17 00:00:00 2001 From: mpa Date: Mon, 24 Mar 2014 11:26:49 +0400 Subject: [PATCH] 0022479: EDF 2823 SMESH: Add "multiplier" coefficient for balls --- src/VTKViewer/VTKViewer_PolyDataMapper.cxx | 36 ++++++++++++++++------ src/VTKViewer/VTKViewer_PolyDataMapper.h | 8 ++++- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx index 065347301..3d8733cc5 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx @@ -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; } diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.h b/src/VTKViewer/VTKViewer_PolyDataMapper.h index 7e8262c32..44b5e6bc6 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.h +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.h @@ -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; -- 2.39.2