IGSTK

/build/buildd/igstk-4.2.0/Source/igstkViewProxy.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Image Guided Surgery Software Toolkit
00004   Module:    $RCSfile: igstkViewProxy.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-05-01 21:58:22 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) ISC  Insight Software Consortium.  All rights reserved.
00010   See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __igstkViewProxy_h
00018 #define __igstkViewProxy_h
00019 
00020 #include "igstkView.h"
00021 #include "igstkViewProxyBase.h"
00022 
00023 namespace igstk {
00024 
00025 
00040 template < class WidgetType>
00041 class ViewProxy : public ViewProxyBase 
00042 {
00043 public:
00044 
00045   typedef ViewProxy          Self;
00046   typedef ViewProxyBase      Superclass;
00047 
00048   igstkTypeMacro( ViewProxy, ViewProxyBase );
00049 
00050   ViewProxy( )
00051     {
00052     this->m_Widget = NULL;
00053     }
00054 
00055   ViewProxy( WidgetType * widget )
00056     {
00057     this->m_Widget = widget;
00058     }
00059 
00060   virtual ~ViewProxy() {}
00061     
00063   void Connect ( View * view )
00064     {
00065     vtkRenderer * renderer =
00066         ViewProxyBase::GetRenderer( view );
00067 
00068     vtkRenderWindowInteractor * interactor =
00069         ViewProxyBase::GetRenderWindowInteractor( view );
00070 
00071     this->m_Widget->SetRenderer( renderer ); 
00072     this->m_Widget->SetRenderWindowInteractor( interactor ); 
00073      
00074     // There is no need to call Widget->RequestSetView( view ) 
00075     // because this Connect() method is normally called as a 
00076     // consequence of calling Widget->RequestSetView(). In other
00077     // words, the view is already set in the Widget by the time
00078     // the Connect method is called.
00079 
00080     ViewProxyBase::InitializeInteractor( view );
00081     }  
00082 
00084   void SetRenderWindowSize( View * view, int width, int height )
00085     {
00086     ViewProxyBase::SetRenderWindowSize( view, width, height );
00087 
00088     }
00089 
00091   void SetPickedPointCoordinates( View * view, double x, double y ) 
00092     {
00093     ViewProxyBase::SetPickedPointCoordinates( view, x, y );
00094     }
00095 
00096 
00097 protected:
00098 
00099 private:
00100   WidgetType  * m_Widget;
00101 
00102 };
00103 
00104 } // end namespace igstk
00105 
00106 #endif