]> Creatis software - bbtk.git/blobdiff - packages/wxvtk/src/wxVTKRenderWindowInteractor.cxx
#3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7
[bbtk.git] / packages / wxvtk / src / wxVTKRenderWindowInteractor.cxx
index d952cf6906a4eb130f7cf9fbc8b5a97370cdbeb2..2e58ec634d418100a745519632c075d2c0200372 100644 (file)
@@ -1,18 +1,37 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
 /*=========================================================================
 
   Program:   Visualization Toolkit
   Module:    $RCSfile: wxVTKRenderWindowInteractor.cxx,v $
   Language:  C++
-  Date:      $Date: 2011/02/17 11:01:27 $
-  Version:   $Revision: 1.4 $
-
-  Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
-  All rights reserved.
-  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even 
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
-     PURPOSE.  See the above copyright notice for more information.
+  Date:      $Date: 2012/11/16 08:52:36 $
+  Version:   $Revision: 1.5 $
 
 =========================================================================*/
 
@@ -141,7 +160,15 @@ BEGIN_EVENT_TABLE(wxVTKRenderWindowInteractor, wxWindow)
   EVT_SIZE        (wxVTKRenderWindowInteractor::OnSize)
 END_EVENT_TABLE()
 
-vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision: 1.4 $")
+
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+  vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision: 1.5 $")
+#else
+  //...
+#endif
+
 vtkInstantiatorNewMacro(wxVTKRenderWindowInteractor)
 
 //---------------------------------------------------------------------------
@@ -166,9 +193,12 @@ wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor() : wxWindow(), vtkRend
 #ifdef VTK_DEBUG_LEAKS
   vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
 #endif
+
   this->RenderWindow = NULL;
   this->SetRenderWindow(vtkRenderWindow::New());
   this->RenderWindow->Delete();
+  this->SetBackgroundStyle( wxBG_STYLE_COLOUR );
+  this->SetBackgroundColour( wxColor(0,0,0,0) );
 }
 //---------------------------------------------------------------------------
 wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
@@ -202,6 +232,8 @@ wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
   // so we update the size information of the interactor/renderwindow here
   this->UpdateSize(size.x, size.y);
 #endif
+  this->SetBackgroundStyle( wxBG_STYLE_COLOUR );
+  this->SetBackgroundColour( wxColor(0,0,0,0) );
 }
 //---------------------------------------------------------------------------
 wxVTKRenderWindowInteractor::~wxVTKRenderWindowInteractor()
@@ -284,15 +316,17 @@ void wxVTKRenderWindowInteractor::UpdateSize(int x, int y)
       Size[1] = y;
       // and our RenderWindow's size
       RenderWindow->SetSize(x, y);
-    }
-  }
+    } // if x y
+  } // if RenderWindow
 }
 //---------------------------------------------------------------------------
 int wxVTKRenderWindowInteractor::CreateTimer(int WXUNUSED(timertype))
 {
   // it's a one shot timer
   if (!timer.Start(10, TRUE))
-    assert(false);
+       {
+       assert(false);
+       }
 
   return 1;
   
@@ -306,9 +340,11 @@ int wxVTKRenderWindowInteractor::DestroyTimer()
 //---------------------------------------------------------------------------
 void wxVTKRenderWindowInteractor::OnTimer(wxTimerEvent& WXUNUSED(event))
 {
-  if (!Enabled)
-    return;
-    
+       if (!Enabled)
+       {
+           return;
+    }
+
 #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
     // new style
     InvokeEvent(vtkCommand::TimerEvent, NULL);
@@ -390,6 +426,7 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event))
     rwin->UpdateGLRegion();
   }
 #endif
+
 }
 //---------------------------------------------------------------------------
 void wxVTKRenderWindowInteractor::OnEraseBackground(wxEraseEvent &event)
@@ -418,18 +455,17 @@ void wxVTKRenderWindowInteractor::OnSize(wxSizeEvent& WXUNUSED(event))
 //---------------------------------------------------------------------------
 void wxVTKRenderWindowInteractor::OnMotion(wxMouseEvent &event)
 {
- if (!Enabled) 
+       this->Render();
+
+       if (!Enabled) 
     {
-    return;
+       return;
     }
 #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
-  SetEventInformationFlipY(event.GetX(), event.GetY(), 
-    event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-
+  SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
   InvokeEvent(vtkCommand::MouseMoveEvent, NULL);
 #else
-  InteractorStyle->OnMouseMove(event.ControlDown(), event.ShiftDown(),
-    event.GetX(), Size[1] - event.GetY() - 1);
+  InteractorStyle->OnMouseMove(event.ControlDown(), event.ShiftDown(), event.GetX(), Size[1] - event.GetY() - 1);
 #endif
 }
 //---------------------------------------------------------------------------
@@ -443,14 +479,11 @@ void wxVTKRenderWindowInteractor::OnEnter(wxMouseEvent &event)
 
 #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
     // new style
-  SetEventInformationFlipY(event.GetX(), event.GetY(), 
-      event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-
+  SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
   InvokeEvent(vtkCommand::EnterEvent, NULL);
 #else
     // old style
-  InteractorStyle->OnEnter(event.ControlDown(), event.ShiftDown(),
-      event.GetX(), Size[1] - event.GetY() - 1);  
+  InteractorStyle->OnEnter(event.ControlDown(), event.ShiftDown(), event.GetX(), Size[1] - event.GetY() - 1);  
 #endif
 }
 //---------------------------------------------------------------------------