wxVTKRenderWindowInteractorEditContour Class Reference

#include <wxVTKRenderWindowInteractorEditContour.h>

Inheritance diagram for wxVTKRenderWindowInteractorEditContour:
Inheritance graph
[legend]
Collaboration diagram for wxVTKRenderWindowInteractorEditContour:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxVTKRenderWindowInteractorEditContour (wxWindow *parent, wxWindowID id)
virtual ~wxVTKRenderWindowInteractorEditContour ()
virtual void OnButtonDown (wxMouseEvent &event)
 (VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)
virtual void OnButtonUp (wxMouseEvent &event)
virtual void OnButtonDouble (wxMouseEvent &event)
virtual void OnMotion (wxMouseEvent &event)
virtual void OnKeyDown (wxKeyEvent &event)
void SetState (int state)
int GetState ()
void SetObserver (vtkCommand *obs)
void PrintSelf (ostream &os, vtkIndent indent)
void Initialize ()
void Enable ()
bool Enable (bool enable)
void Disable ()
void Start ()
void UpdateSize (int x, int y)
int CreateTimer (int timertype)
int DestroyTimer ()
void TerminateApp ()
void OnPaint (wxPaintEvent &event)
void OnEraseBackground (wxEraseEvent &event)
void OnEnter (wxMouseEvent &event)
void OnLeave (wxMouseEvent &event)
void OnKeyUp (wxKeyEvent &event)
void OnTimer (wxTimerEvent &event)
void OnSize (wxSizeEvent &event)
void OnMouseWheel (wxMouseEvent &event)
void Render () throw (char*)
void SetRenderWhenDisabled (int newValue)
 vtkGetMacro (Stereo, int)
 vtkBooleanMacro (Stereo, int)
 vtkBooleanMacro (UseCaptureMouse, int)
virtual void SetStereo (int capable)
 vtkSetMacro (UseCaptureMouse, int)

Static Public Member Functions

static
wxVTKRenderWindowInteractor
New ()

Protected Member Functions

long GetHandleHack ()

Protected Attributes

wxTimer timer
int ActiveButton
int RenderAllowed
int Stereo

Private Attributes

int _state
vtkCommand * _obs

Detailed Description

Definition at line 198 of file wxVTKRenderWindowInteractorEditContour.h.


Constructor & Destructor Documentation

wxVTKRenderWindowInteractorEditContour::wxVTKRenderWindowInteractorEditContour ( wxWindow *  parent,
wxWindowID  id 
)

Definition at line 243 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _state.

00244   :wxVTKRenderWindowInteractor(parent,id){
00245         this->_state=0;
00246 }

wxVTKRenderWindowInteractorEditContour::~wxVTKRenderWindowInteractorEditContour (  )  [virtual]

Definition at line 248 of file wxVTKRenderWindowInteractorEditContour.cxx.

00248                                                                                {
00249 }


Member Function Documentation

int wxVTKRenderWindowInteractor::CreateTimer ( int  timertype  )  [inherited]
int wxVTKRenderWindowInteractor::DestroyTimer (  )  [inherited]

Definition at line 267 of file wxVTKRenderWindowInteractor.cxx.

00268 {
00269   // do nothing
00270   return 1;
00271 }

void wxVTKRenderWindowInteractor::Disable (  )  [inherited]

Definition at line 223 of file wxVTKRenderWindowInteractor.cxx.

00224 {
00225   // if already disabled then done
00226   if (!Enabled)
00227     return;
00228 
00229   // that's it (we can't remove the event handler like it should be...)
00230   Enabled = 0;
00231   Modified();
00232 }

bool wxVTKRenderWindowInteractor::Enable ( bool  enable  )  [inherited]

Definition at line 214 of file wxVTKRenderWindowInteractor.cxx.

References wxVTKRenderWindowInteractor::Enable().

00215 {
00216 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
00217   return wxGLCanvas::Enable(enable);
00218 #else
00219   return wxWindow::Enable(enable);
00220 #endif
00221 }

Here is the call graph for this function:

void wxVTKRenderWindowInteractor::Enable (  )  [inherited]

Definition at line 200 of file wxVTKRenderWindowInteractor.cxx.

Referenced by wxVTKRenderWindowInteractor::Enable(), and wxVTKRenderWindowInteractor::Initialize().

00201 {
00202   // if already enabled then done
00203   if (Enabled)
00204     return;
00205 
00206   // that's it
00207   Enabled = 1;
00208 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
00209   SetCurrent();
00210 #endif
00211   Modified();
00212 }

Here is the caller graph for this function:

long wxVTKRenderWindowInteractor::GetHandleHack (  )  [protected, inherited]

Definition at line 296 of file wxVTKRenderWindowInteractor.cxx.

Referenced by wxVTKRenderWindowInteractor::Render().

00297 {
00298   //helper function to hide the MSW vs GTK stuff
00299   long handle_tmp = 0;
00300 
00301 // __WXMSW__ is for Win32
00302 //__WXMAX__ stands for using Carbon C-headers, using either the CarbonLib/CFM or the native Mach-O builds (which then also use the latest features available)
00303 // __WXGTK__ is for both gtk 1.2.x and gtk 2.x
00304 #if defined(__WXMSW__) || defined(__WXMAC__)
00305     handle_tmp = (long)this->GetHandle();
00306 #endif //__WXMSW__
00307 
00308 //__WXCOCOA__ stands for using the objective-c Cocoa API
00309 #ifdef __WXCOCOA__
00310    // Here is how to find the NSWindow
00311    wxTopLevelWindow* toplevel = dynamic_cast<wxTopLevelWindow*>(
00312      wxGetTopLevelParent( this ) );
00313    if (toplevel != NULL )    
00314    {
00315      handle_tmp = (long)toplevel->GetNSWindow();
00316    }
00317    // The NSView will be deducted from 
00318    // [(NSWindow*)Handle contentView]
00319    // if only I knew how to write that in c++
00320 #endif //__WXCOCOA__
00321 
00322     // Find and return the actual X-Window.
00323 #if defined(__WXGTK__) || defined(__WXX11__)
00324     return (long)GetXWindow(this);
00325 #endif
00326 
00327 //#ifdef __WXMOTIF__
00328 //    handle_tmp = (long)this->GetXWindow();
00329 //#endif
00330 
00331   return handle_tmp;
00332 }

Here is the caller graph for this function:

int wxVTKRenderWindowInteractorEditContour::GetState (  ) 

Definition at line 321 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _state.

00321                                                          {
00322         return this->_state;
00323 }

void wxVTKRenderWindowInteractor::Initialize (  )  [inherited]

Definition at line 185 of file wxVTKRenderWindowInteractor.cxx.

References wxVTKRenderWindowInteractor::Enable().

00186 {
00187   int *size = RenderWindow->GetSize();
00188   // enable everything and start rendering
00189   Enable();
00190   //RenderWindow->Start();
00191 
00192   // set the size in the render window interactor
00193   Size[0] = size[0];
00194   Size[1] = size[1];
00195 
00196   // this is initialized
00197   Initialized = 1;
00198 }

Here is the call graph for this function:

wxVTKRenderWindowInteractor * wxVTKRenderWindowInteractor::New (  )  [static, inherited]
void wxVTKRenderWindowInteractorEditContour::OnButtonDouble ( wxMouseEvent &  event  )  [virtual]

Definition at line 283 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _obs, and _state.

00283                                                                               {
00284         if (this->_state==1){
00285 // EED 22 dec 2007 :  SIL que tengo que hacer aqui ..??  Esto creo que lo quito silvia y como se 
00286 // remplaza
00287 //        wxVTKRenderWindowInteractor::OnButtonDouble(event);
00288         }
00289         if (this->_state==2){
00290                 if(event.LeftDClick()==true){
00291                         SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00292                         _obs->Execute( NULL , wxEVT_LEFT_DCLICK  , NULL ) ;
00293                 }
00294         }
00295 }

void wxVTKRenderWindowInteractorEditContour::OnButtonDown ( wxMouseEvent &  event  )  [virtual]

(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)

Reimplemented from wxVTKRenderWindowInteractor.

Definition at line 251 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _obs, and _state.

00251                                                                             {
00252         if (this->_state==1){
00253           wxVTKRenderWindowInteractor::OnButtonDown(event);
00254         }
00255         if (this->_state==2){
00256                 if(event.LeftDown()==true){
00257                         SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00258                         _obs->Execute( NULL , wxEVT_LEFT_DOWN  , NULL ) ;
00259                 }
00260                 if(event.RightDown()==true){
00261             wxVTKRenderWindowInteractor::OnButtonDown(event);
00262                         SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00263                         _obs->Execute( NULL , wxEVT_RIGHT_DOWN  , NULL ) ;
00264                 }
00265         }
00266 }

void wxVTKRenderWindowInteractorEditContour::OnButtonUp ( wxMouseEvent &  event  )  [virtual]

Reimplemented from wxVTKRenderWindowInteractor.

Definition at line 268 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _obs, and _state.

00268                                                                           {
00269         if (this->_state==1){
00270           wxVTKRenderWindowInteractor::OnButtonUp(event);
00271         }
00272         if (this->_state==2){
00273                 if(event.LeftUp()==true){
00274                         SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00275                         _obs->Execute( NULL , wxEVT_LEFT_UP  , NULL ) ;
00276                 }
00277                 if(event.RightUp()==true){
00278             wxVTKRenderWindowInteractor::OnButtonUp(event);
00279                 }
00280         }
00281 }

void wxVTKRenderWindowInteractor::OnEnter ( wxMouseEvent &  event  )  [inherited]

Definition at line 406 of file wxVTKRenderWindowInteractor.cxx.

00407 {
00408         SetFocus();
00409   if (!Enabled) 
00410     {           
00411                 return; 
00412     }
00413 
00414 #if VTK_MAJOR_VERSION == 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
00415     // new style
00416   SetEventInformationFlipY(event.GetX(), event.GetY(), 
00417       event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00418 
00419   InvokeEvent(vtkCommand::EnterEvent, NULL);
00420 #else
00421     // old style
00422   InteractorStyle->OnEnter(event.ControlDown(), event.ShiftDown(),
00423       event.GetX(), Size[1] - event.GetY() - 1);  
00424 #endif
00425 }

void wxVTKRenderWindowInteractor::OnEraseBackground ( wxEraseEvent &  event  )  [inherited]

Definition at line 362 of file wxVTKRenderWindowInteractor.cxx.

00363 {
00364   //printf("EED wxVTKRenderWindowInteractor::OnEraseBackground \n");
00365   //turn off background erase to reduce flickering on MSW
00366   event.Skip(false);
00367 }

void wxVTKRenderWindowInteractorEditContour::OnKeyDown ( wxKeyEvent &  event  )  [virtual]

Reimplemented from wxVTKRenderWindowInteractor.

Definition at line 310 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _obs.

00310                                                                        {
00311         wxVTKRenderWindowInteractor::OnKeyDown(event);
00312         if (( event.GetKeyCode()==WXK_BACK ) || ( event.GetKeyCode()==WXK_DELETE) ){
00313                 _obs->Execute( NULL , WXK_CLEAR   , NULL ) ;
00314         }
00315 }

void wxVTKRenderWindowInteractor::OnKeyUp ( wxKeyEvent &  event  )  [inherited]

Definition at line 513 of file wxVTKRenderWindowInteractor.cxx.

00514 {
00515   if (!Enabled) 
00516     {
00517     return;
00518     }
00519 
00520 #if VTK_MAJOR_VERSION == 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
00521     // new style
00522   int keycode = event.GetKeyCode();
00523   char key = '\0';
00524   if (keycode < 256)
00525   {
00526     // TODO: Unicode in non-Unicode mode ??
00527     key = (char)keycode;
00528   }
00529 
00530   SetEventInformationFlipY(event.GetX(), event.GetY(), 
00531     event.ControlDown(), event.ShiftDown(), key, 0, NULL);
00532   InvokeEvent(vtkCommand::KeyReleaseEvent, NULL);
00533 #else
00534   InteractorStyle->OnKeyUp(event.ControlDown(), event.ShiftDown(), 
00535     event.GetKeyCode(), 1);
00536 #endif
00537   event.Skip();
00538 }

void wxVTKRenderWindowInteractor::OnLeave ( wxMouseEvent &  event  )  [inherited]

Definition at line 427 of file wxVTKRenderWindowInteractor.cxx.

00428 {
00429   if (!Enabled) 
00430     {
00431     return;
00432     }
00433 
00434 #if VTK_MAJOR_VERSION == 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
00435     // new style
00436   SetEventInformationFlipY(event.GetX(), event.GetY(), 
00437       event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00438 
00439   InvokeEvent(vtkCommand::LeaveEvent, NULL);
00440 #else
00441     // old style
00442   InteractorStyle->OnLeave(event.ControlDown(), event.ShiftDown(),
00443       event.GetX(), Size[1] - event.GetY() - 1);  
00444 #endif
00445 }

void wxVTKRenderWindowInteractorEditContour::OnMotion ( wxMouseEvent &  event  )  [virtual]

Reimplemented from wxVTKRenderWindowInteractor.

Definition at line 297 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _obs, and _state.

00297                                                                         {
00298         if (this->_state==1){
00299                 wxVTKRenderWindowInteractor::OnMotion(event);
00300         }
00301         if (this->_state==2){
00302                 wxVTKRenderWindowInteractor::OnMotion(event);
00303                 if(event.Moving()==true){
00304                         SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00305                         _obs->Execute( NULL , wxEVT_MOTION   , NULL ) ;
00306                 }
00307         }
00308 }

void wxVTKRenderWindowInteractor::OnMouseWheel ( wxMouseEvent &  event  )  [inherited]

Reimplemented in vtk3DSurfaceWidget, and wxVTKRenderWindowInteractorPlus.

Definition at line 654 of file wxVTKRenderWindowInteractor.cxx.

00655 {
00656 // Mouse wheel was only added after VTK 4.4 (I think...)
00657 #if VTK_MAJOR_VERSION == 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
00658   // new style
00659   //Set vtk event information ... The numebr of wheel rotations is stored in
00660   //the x varible.  y varible is zero
00661   SetEventInformationFlipY(event.GetWheelRotation() / event.GetWheelDelta(), 0, 
00662                            event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
00663   if(event.GetWheelRotation() > 0)
00664     {
00665       //Send event to VTK
00666 // EED
00667 //      InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
00668     }
00669   else
00670     {
00671       //Send event to VTK
00672 // EED
00673 //      InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
00674     }
00675 #endif
00676     
00677 }

void wxVTKRenderWindowInteractor::OnPaint ( wxPaintEvent &  event  )  [inherited]
void wxVTKRenderWindowInteractor::OnSize ( wxSizeEvent &  event  )  [inherited]
void wxVTKRenderWindowInteractor::OnTimer ( wxTimerEvent &  event  )  [inherited]
void wxVTKRenderWindowInteractor::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [inherited]

Definition at line 762 of file wxVTKRenderWindowInteractor.cxx.

00763 {
00764   this->Superclass::PrintSelf(os, indent);
00765 }

void wxVTKRenderWindowInteractor::Render (  )  throw (char*) [inherited]

Reimplemented in vtk3DSurfaceWidget.

Definition at line 680 of file wxVTKRenderWindowInteractor.cxx.

References wxVTKRenderWindowInteractor::GetHandleHack(), wxVTKRenderWindowInteractor::Handle, wxVTKRenderWindowInteractor::RenderAllowed, and wxVTKRenderWindowInteractor::RenderWhenDisabled.

Referenced by wxMaracasImageBrowser02::LoadData().

00681 {
00682   RenderAllowed = 1;
00683   if (!RenderWhenDisabled)
00684     {
00685     //the user doesn't want us to render when the toplevel frame
00686     //is disabled - first find the top level parent
00687     wxWindow *topParent = wxGetTopLevelParent(this);
00688     if (topParent)
00689       {
00690       //if it exists, check whether it's enabled
00691       //if it's not enabeld, RenderAllowed will be false
00692       RenderAllowed = topParent->IsEnabled();
00693       }
00694     }
00695 
00696   if (RenderAllowed)
00697     {
00698     if(Handle && (Handle == GetHandleHack()) )
00699       {
00700                   if(RenderWindow!=NULL){
00701                         RenderWindow->Render();
00702                   }else{
00703                           throw "wxVTKRenderWindowInteractor::Render(){RenderWindow not set}";
00704                   }
00705       }
00706 #if VTK_MAJOR_VERSION == 5 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
00707     else if(GetHandleHack())
00708       {
00709       //this means the user has reparented us; let's adapt to the
00710       //new situation by doing the WindowRemap dance
00711       //store the new situation
00712                   if(RenderWindow!=NULL){
00713                         Handle = GetHandleHack();
00714                         RenderWindow->SetNextWindowId(reinterpret_cast<void *>(Handle));
00715                         RenderWindow->WindowRemap();
00716                         RenderWindow->Render();
00717                   }
00718       }
00719 #endif
00720     }
00721 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wxVTKRenderWindowInteractorEditContour::SetObserver ( vtkCommand *  obs  ) 

Definition at line 325 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _obs.

Referenced by wxImageViewerWidget::ConstructVTK().

00325                                                                        {
00326         this->_obs=obs;
00327 }

Here is the caller graph for this function:

void wxVTKRenderWindowInteractor::SetRenderWhenDisabled ( int  newValue  )  [inherited]

Definition at line 723 of file wxVTKRenderWindowInteractor.cxx.

References wxVTKRenderWindowInteractor::RenderWhenDisabled.

00724 {
00725   //Change value of __RenderWhenDisabled ivar.
00726   //If __RenderWhenDisabled is false (the default), this widget will not
00727   //call Render() on the RenderWindow if the top level frame (i.e. the
00728   //containing frame) has been disabled.
00729 
00730   //This prevents recursive rendering during wxSafeYield() calls.
00731   //wxSafeYield() can be called during the ProgressMethod() callback of
00732   //a VTK object to have progress bars and other GUI elements updated -
00733   //it does this by disabling all windows (disallowing user-input to
00734   //prevent re-entrancy of code) and then handling all outstanding
00735   //GUI events.
00736         
00737   //However, this often triggers an OnPaint() method for wxVTKRWIs,
00738   //resulting in a Render(), resulting in Update() being called whilst
00739   //still in progress.
00740 
00741   RenderWhenDisabled = (bool)newValue;
00742 }

void wxVTKRenderWindowInteractorEditContour::SetState ( int  state  ) 

Definition at line 317 of file wxVTKRenderWindowInteractorEditContour.cxx.

References _state.

Referenced by wxImageViewerWidget::SetState().

00317                                                               {
00318         this->_state=state;
00319 }

Here is the caller graph for this function:

void wxVTKRenderWindowInteractor::SetStereo ( int  capable  )  [virtual, inherited]

Definition at line 748 of file wxVTKRenderWindowInteractor.cxx.

References wxVTKRenderWindowInteractor::Stereo.

00749 {
00750   if (Stereo != capable)
00751     {
00752     Stereo = capable;
00753     RenderWindow->StereoCapableWindowOn();
00754     RenderWindow->SetStereoTypeToCrystalEyes();
00755     Modified();
00756     }
00757 }

void wxVTKRenderWindowInteractor::Start (  )  [inherited]

Definition at line 234 of file wxVTKRenderWindowInteractor.cxx.

00235 {
00236   // the interactor cannot control the event loop
00237   vtkErrorMacro( << "wxVTKRenderWindowInteractor::Start() "
00238     "interactor cannot control event loop.");
00239 }

void wxVTKRenderWindowInteractor::TerminateApp (  )  [inline, inherited]

Definition at line 124 of file wxVTKRenderWindowInteractor.h.

00124 {};

void wxVTKRenderWindowInteractor::UpdateSize ( int  x,
int  y 
) [inherited]

Definition at line 241 of file wxVTKRenderWindowInteractor.cxx.

00242 {
00243   if( RenderWindow )
00244   {
00245     // if the size changed tell render window
00246     if ( x != Size[0] || y != Size[1] )
00247     {
00248       // adjust our (vtkRenderWindowInteractor size)
00249       Size[0] = x;
00250       Size[1] = y;
00251       // and our RenderWindow's size
00252       RenderWindow->SetSize(x, y);
00253     }
00254   }
00255 }

wxVTKRenderWindowInteractor::vtkBooleanMacro ( UseCaptureMouse  ,
int   
) [inherited]
wxVTKRenderWindowInteractor::vtkBooleanMacro ( Stereo  ,
int   
) [inherited]
wxVTKRenderWindowInteractor::vtkGetMacro ( Stereo  ,
int   
) [inherited]
wxVTKRenderWindowInteractor::vtkSetMacro ( UseCaptureMouse  ,
int   
) [inherited]

Member Data Documentation

int wxVTKRenderWindowInteractor::ActiveButton [protected, inherited]
int wxVTKRenderWindowInteractor::RenderAllowed [protected, inherited]

Definition at line 163 of file wxVTKRenderWindowInteractor.h.

Referenced by wxVTKRenderWindowInteractor::Render().

int wxVTKRenderWindowInteractor::Stereo [protected, inherited]
wxTimer wxVTKRenderWindowInteractor::timer [protected, inherited]

Definition at line 161 of file wxVTKRenderWindowInteractor.h.


The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1