From 15fcc9d19a5973cb75903468d7a4d445bad33a14 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 19 Aug 2005 14:40:25 +0000 Subject: [PATCH] 1. To make myInteratorStyle member of SVTK_View, not of SVT_VieweWindow 2. Remove unused methods --- src/SVTK/SVTK_ViewWindow.cxx | 223 ++++++----------------------------- src/SVTK/SVTK_ViewWindow.h | 20 +--- 2 files changed, 39 insertions(+), 204 deletions(-) diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index e370e2020..77305f97a 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -57,22 +57,8 @@ SVTK_ViewWindow bottomView->Initialize(); */ - myInteractorStyle = SVTK_InteractorStyle::New(); - myInteractorStyle->SetRenderWidget( myView ); - myInteractorStyle->setViewWindow( this ); - myInteractorStyle->SetSelector( myView->GetSelector() ); - - myInteractorStyle->SetSelector( myView->GetSelector() ); - myView->SetInteractorStyle( myInteractorStyle ); myView->Initialize(); - connect(myView,SIGNAL(selectionChanged()),theModel,SLOT(onSelectionChanged())); - - //merge with V2_2_0_VISU_improvements:myInteractorStyle->setTriedron( myTrihedron ); - myInteractorStyle->FindPokedRenderer( 0, 0 ); - - SetSelectionMode( ActorSelection ); - myView->setFocusPolicy( StrongFocus ); myView->setFocus(); @@ -90,6 +76,9 @@ SVTK_ViewWindow this, SLOT(onMouseMoving( QMouseEvent* )) ); connect( myView, SIGNAL(contextMenuRequested( QContextMenuEvent * )), this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) ); + connect( myView, SIGNAL(selectionChanged()), + theModel,SLOT(onSelectionChanged())); + onResetView(); @@ -100,13 +89,7 @@ SVTK_ViewWindow //---------------------------------------------------------------------------- SVTK_ViewWindow ::~SVTK_ViewWindow() -{ - // In order to ensure that the interactor unregisters - // this RenderWindow, we assign a NULL RenderWindow to - // it before deleting it. - //myView->SetRenderWindow( NULL ); - //delete myView; -} +{} //---------------------------------------------------------------------------- vtkRenderer* @@ -119,10 +102,40 @@ SVTK_ViewWindow //---------------------------------------------------------------------------- SVTK_Selector* SVTK_ViewWindow -::GetSelector() { +::GetSelector() +{ return myView->GetSelector(); } +//---------------------------------------------------------------------------- +SVTK_InteractorStyle* +SVTK_ViewWindow +::getInteractorStyle() +{ + return myView->GetInteractorStyle(); +} + +//---------------------------------------------------------------------------- +SVTK_View* +SVTK_ViewWindow +::getView() { + return myView; +} + +SVTK_View* +SVTK_ViewWindow +::getRenderWindow() +{ + return myView; +} + +SVTK_View* +SVTK_ViewWindow +::getRWInteractor() +{ + return myView; +} + //---------------------------------------------------------------------------- void SVTK_ViewWindow @@ -315,44 +328,6 @@ SVTK_ViewWindow myView->onViewCubeAxes(); } -//---------------------------------------------------------------------------- -/*bool -SVTK_ViewWindow -::ComputeTrihedronSize( double& theNewSize, double& theSize ) -{ - // calculating diagonal of visible props of the renderer - float aBndBox[ 6 ]; - myTrihedron->VisibilityOff(); - - if ( ::ComputeVisiblePropBounds( myRenderer, aBndBox ) == 0 ) { - aBndBox[ 1 ] = aBndBox[ 3 ] = aBndBox[ 5 ] = 100; - aBndBox[ 0 ] = aBndBox[ 2 ] = aBndBox[ 4 ] = 0; - } - - myTrihedron->VisibilityOn(); - float aLength = 0; - static bool aCalcByDiag = false; - if ( aCalcByDiag ) { - aLength = sqrt( ( aBndBox[1]-aBndBox[0])*(aBndBox[1]-aBndBox[0] )+ - ( aBndBox[3]-aBndBox[2])*(aBndBox[3]-aBndBox[2] )+ - ( aBndBox[5]-aBndBox[4])*(aBndBox[5]-aBndBox[4] ) ); - } else { - aLength = aBndBox[ 1 ]-aBndBox[ 0 ]; - aLength = max( ( aBndBox[ 3 ] - aBndBox[ 2 ] ),aLength ); - aLength = max( ( aBndBox[ 5 ] - aBndBox[ 4 ] ),aLength ); - } - - float aSizeInPercents = myTrihedronSize; - - static float EPS_SIZE = 5.0E-3; - theSize = myTrihedron->GetSize(); - theNewSize = aLength * aSizeInPercents / 100.0; - - // if the new trihedron size have sufficient difference, then apply the value - return fabs( theNewSize - theSize) > theSize * EPS_SIZE || - fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE; -}*/ - //---------------------------------------------------------------------------- VTKViewer_Trihedron* SVTK_ViewWindow::GetTrihedron() { @@ -399,107 +374,6 @@ SVTK_ViewWindow myView->onAdjustCubeAxes(); } -#define INCREMENT_FOR_OP 10 - -//======================================================================= -// name : onPanLeft -// Purpose : Performs incremental panning to the left -//======================================================================= -void -SVTK_ViewWindow -::onPanLeft() -{ - myInteractorStyle->IncrementalPan( -INCREMENT_FOR_OP, 0 ); -} - -//======================================================================= -// name : onPanRight -// Purpose : Performs incremental panning to the right -//======================================================================= -void -SVTK_ViewWindow -::onPanRight() -{ - myInteractorStyle->IncrementalPan( INCREMENT_FOR_OP, 0 ); -} - -//======================================================================= -// name : onPanUp -// Purpose : Performs incremental panning to the top -//======================================================================= -void -SVTK_ViewWindow -::onPanUp() -{ - myInteractorStyle->IncrementalPan( 0, INCREMENT_FOR_OP ); -} - -//======================================================================= -// name : onPanDown -// Purpose : Performs incremental panning to the bottom -//======================================================================= -void -SVTK_ViewWindow -::onPanDown() -{ - myInteractorStyle->IncrementalPan( 0, -INCREMENT_FOR_OP ); -} - -//======================================================================= -// name : onZoomIn -// Purpose : Performs incremental zooming in -//======================================================================= -void -SVTK_ViewWindow -::onZoomIn() -{ - myInteractorStyle->IncrementalZoom( INCREMENT_FOR_OP ); -} - -//======================================================================= -// name : onZoomOut -// Purpose : Performs incremental zooming out -//======================================================================= -void -SVTK_ViewWindow -::onZoomOut() -{ - myInteractorStyle->IncrementalZoom( -INCREMENT_FOR_OP ); -} - -//======================================================================= -// name : onRotateLeft -// Purpose : Performs incremental rotating to the left -//======================================================================= -void -SVTK_ViewWindow -::onRotateLeft() -{ - myInteractorStyle->IncrementalRotate( -INCREMENT_FOR_OP, 0 ); -} - -//======================================================================= -// name : onRotateRight -// Purpose : Performs incremental rotating to the right -//======================================================================= -void -SVTK_ViewWindow -::onRotateRight() -{ - myInteractorStyle->IncrementalRotate( INCREMENT_FOR_OP, 0 ); -} - -//======================================================================= -// name : onRotateUp -// Purpose : Performs incremental rotating to the top -//======================================================================= -void -SVTK_ViewWindow -::onRotateUp() -{ - myInteractorStyle->IncrementalRotate( 0, -INCREMENT_FOR_OP ); -} - //======================================================================= void SVTK_ViewWindow @@ -548,25 +422,6 @@ SVTK_ViewWindow emit mouseDoubleClicked( this, event ); } -//======================================================================= -// name : onRotateDown -// Purpose : Performs incremental rotating to the bottom -//======================================================================= -void -SVTK_ViewWindow -::onRotateDown() -{ - myInteractorStyle->IncrementalRotate( 0, INCREMENT_FOR_OP ); -} - -//---------------------------------------------------------------------------- -//void -//SVTK_ViewWindow -//::InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors ) -//{ -// myView->InsertActor( theActor, theMoveInternalActors ); -//} - //---------------------------------------------------------------------------- void SVTK_ViewWindow @@ -583,14 +438,6 @@ SVTK_ViewWindow myView->RemoveActor( theActor, theUpdate ); } -//---------------------------------------------------------------------------- -//void -//SVTK_ViewWindow -//::MoveActor( VTKViewer_Actor* theActor) -//{ -// myView->MoveActor( theActor ); -//} - //---------------------------------------------------------------------------- QImage SVTK_ViewWindow diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index c985c2108..490b6a795 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -43,11 +43,11 @@ public: vtkRenderer* getRenderer(); SVTK_Selector* GetSelector(); + SVTK_InteractorStyle* getInteractorStyle(); - SVTK_View* getView() { return myView; } - SVTK_View* getRenderWindow() { return myView; } - SVTK_View* getRWInteractor() { return myView; } - SVTK_InteractorStyle* getInteractorStyle(){ return myInteractorStyle;} + SVTK_View* getView(); + SVTK_View* getRenderWindow(); + SVTK_View* getRWInteractor(); Selection_Mode SelectionMode() const; void SetSelectionMode(Selection_Mode theMode); @@ -118,17 +118,6 @@ public slots: void onAdjustTrihedron(); void onAdjustCubeAxes(); - - void onPanLeft(); - void onPanRight(); - void onPanUp(); - void onPanDown(); - void onZoomIn(); - void onZoomOut(); - void onRotateLeft(); - void onRotateRight(); - void onRotateUp(); - void onRotateDown(); protected slots: void onKeyPressed(QKeyEvent* event); @@ -142,7 +131,6 @@ protected: QImage dumpView(); SVTK_View* myView; - SVTK_InteractorStyle* myInteractorStyle; }; #ifdef WIN32 -- 2.39.2