]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
To implement configure event
authorapo <apo@opencascade.com>
Tue, 6 Sep 2005 08:29:07 +0000 (08:29 +0000)
committerapo <apo@opencascade.com>
Tue, 6 Sep 2005 08:29:07 +0000 (08:29 +0000)
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_InteractorStyle.h
src/SVTK/SVTK_RenderWindowInteractor.cxx
src/SVTK/SVTK_Renderer.cxx

index 4ab6048618322848afed495b4ed8589035bb840a..7f642941e9694c4d0701feaf582531896cc57397 100644 (file)
@@ -272,6 +272,15 @@ SVTK_InteractorStyle
 }
 
 
+//----------------------------------------------------------------------------
+void
+SVTK_InteractorStyle
+::OnConfigure() 
+{
+  GetCurrentRenderer()->InvokeEvent(vtkCommand::ConfigureEvent,NULL);
+}
+
+
 //----------------------------------------------------------------------------
 void
 SVTK_InteractorStyle
@@ -1312,92 +1321,90 @@ SVTK_InteractorStyle
                 void* clientData, 
                 void* callData )
 {
-  if ( event < vtkCommand::UserEvent  )
-    vtkInteractorStyle::ProcessEvents( object, event, clientData, callData );
-
-  else if ( clientData ) {
+  if ( clientData ) {
     vtkObject* anObject = reinterpret_cast<vtkObject*>( clientData );
     SVTK_InteractorStyle* self = dynamic_cast<SVTK_InteractorStyle*>( anObject );
     if ( self ) {
       switch ( event ) {
       case SVTK::SpaceMouseMoveEvent : 
        self->onSpaceMouseMove( (double*)callData ); 
-       break;
+       return;
       case SVTK::SpaceMouseButtonEvent : 
        self->onSpaceMouseButton( *((int*)callData) ); 
-       break;
+       return;
       case SVTK::PanLeftEvent: 
        self->IncrementalPan( -self->mySpeedIncrement, 0 );
-       break;
+       return;
       case SVTK::PanRightEvent:
        self->IncrementalPan( self->mySpeedIncrement, 0 );
-       break;
+       return;
       case SVTK::PanUpEvent:
        self->IncrementalPan( 0, self->mySpeedIncrement );
-       break;
+       return;
       case SVTK::PanDownEvent:
        self->IncrementalPan( 0, -self->mySpeedIncrement );
-       break;
+       return;
       case SVTK::ZoomInEvent:
        self->IncrementalZoom( self->mySpeedIncrement );
-       break;
+       return;
       case SVTK::ZoomOutEvent:
        self->IncrementalZoom( -self->mySpeedIncrement );
-       break;
+       return;
       case SVTK::RotateLeftEvent: 
        self->IncrementalRotate( -self->mySpeedIncrement, 0 );
-       break;
+       return;
       case SVTK::RotateRightEvent:
        self->IncrementalRotate( self->mySpeedIncrement, 0 );
-       break;
+       return;
       case SVTK::RotateUpEvent:
        self->IncrementalRotate( 0, -self->mySpeedIncrement );
-       break;
+       return;
       case SVTK::RotateDownEvent:
        self->IncrementalRotate( 0, self->mySpeedIncrement );
-       break;
+       return;
       case SVTK::PlusSpeedIncrementEvent:
        ++(self->mySpeedIncrement);
-       break;
+       return;
       case SVTK::MinusSpeedIncrementEvent:
        --(self->mySpeedIncrement);
-       break;
+       return;
       case SVTK::SetSpeedIncrementEvent:
        self->mySpeedIncrement = *((int*)callData);
-       break;
+       return;
 
       case SVTK::SetSpaceMouseF1Event:
        self->mySpaceMouseBtns[0] = *((int*)callData);
-       break;
+       return;
       case SVTK::SetSpaceMouseF2Event:
        self->mySpaceMouseBtns[1] = *((int*)callData);
-       break;
+       return;
       case SVTK::SetSpaceMouseF3Event:
        self->mySpaceMouseBtns[2] = *((int*)callData);
-       break;
+       return;
       case SVTK::SetSpaceMouseF4Event:
        self->mySpaceMouseBtns[3] = *((int*)callData);
-       break;
+       return;
       case SVTK::SetSpaceMouseF5Event:
        self->mySpaceMouseBtns[4] = *((int*)callData);
-       break;
+       return;
 
       case SVTK::StartZoom:
        self->startZoom();
-       break;
+       return;
       case SVTK::StartPan:
        self->startPan();
-       break;
+       return;
       case SVTK::StartRotate:
        self->startRotate();
-       break;
+       return;
       case SVTK::StartGlobalPan:
        self->startGlobalPan();
-       break;
+       return;
       case SVTK::StartFitArea:
        self->startFitArea();
-       break;
+       return;
       }
     }
   }
+  vtkInteractorStyle::ProcessEvents( object, event, clientData, callData );
 }
index fc93a577d9a5b87215a0c5d907e9acfee9ce17da..c8fd0dd5fa499442aa6f181a28df236c03bb81c1 100644 (file)
@@ -94,6 +94,7 @@ class SVTK_EXPORT SVTK_InteractorStyle :
   virtual void OnTimer();
 
   // VTK events
+  virtual void OnConfigure();
   virtual void OnMouseMove();
   virtual void OnLeftButtonDown();
   virtual void OnLeftButtonUp();
index d90c7147981c35b95feeb99a3fbc84d316d8a608..98ce10b3e908a7739f3cf77bd9e1aa70405416a1 100644 (file)
@@ -198,7 +198,6 @@ QVTK_RenderWindowInteractor
 #endif
   GetRenderWindow()->SetWindowId((void*)winId());
   myInteractor->Enable();
-  myInteractor->ConfigureEvent();
 }
 
 //----------------------------------------------------------------------------
@@ -215,10 +214,11 @@ QVTK_RenderWindowInteractor
 ::paintEvent( QPaintEvent* theEvent ) 
 {
   if(myInteractor->GetEnabled()){
-    if(!myInteractor->GetInitialized())
+    if(!myInteractor->GetInitialized()){
       myInteractor->Initialize();
-    else
-      myInteractor->Render();
+      myInteractor->ConfigureEvent();
+    }
+    myInteractor->Render();
   }
 }
 
index 5f18d28eec98a16bcd5cc6e9bf820d625861faa6..e342545c3917ab60562fd886bc1e1744f38f9e0b 100644 (file)
@@ -76,6 +76,9 @@ SVTK_Renderer
   this->AddObserver(vtkCommand::ResetCameraEvent,
                    myEventCallbackCommand.GetPointer(), 
                    myPriority);
+  this->AddObserver(vtkCommand::ConfigureEvent,
+                   myEventCallbackCommand.GetPointer(), 
+                   myPriority);
 }
 
 SVTK_Renderer
@@ -92,6 +95,11 @@ SVTK_Renderer
 {
   SVTK_Renderer* self = reinterpret_cast<SVTK_Renderer*>(theClientData);
 
+  switch(theEvent){
+  case vtkCommand::ConfigureEvent:
+    self->onResetView();
+    break;
+  }
   switch(theEvent){
   case vtkCommand::ResetCameraEvent:
     self->onFitAll();