38 #include "vtkCommand.h"
39 #include "vtkCallbackCommand.h"
40 #include "vtkCamera.h"
41 #include "vtkRenderer.h"
42 #include "vtkSmartPointer.h"
47 ioOpenSynchronizedViews,
57 std::vector< QGoSynchronizedView3D * >::iterator
58 SynchronizedViewIt = ioOpenSynchronizedViews.begin();
60 while ( SynchronizedViewIt != ioOpenSynchronizedViews.end() )
64 if ( ( *SynchronizedViewIt )->HasViewer() )
67 for (
int i = 0; i < 4; i++ )
69 ( *SynchronizedViewIt )->GetCamera(i)
70 ->AddObserver(vtkCommand::ModifiedEvent,
94 ( *SynchronizedViewIt )->GetImageView(),
95 SLOT( SetSliceViewXY(
int) ) );
99 ( *SynchronizedViewIt )->GetImageView(),
100 SLOT( SetSliceViewXZ(
int) ) );
104 ( *SynchronizedViewIt )->GetImageView(),
105 SLOT( SetSliceViewYZ(
int) ) );
107 ++SynchronizedViewIt;
117 std::vector< QGoSynchronizedView3D * >::iterator SynchronizedViewIt;
129 for (
int i = 0; i < 4; i++ )
140 for (
int i = 0; i < 4; i++ )
151 long unsigned int eventId,
164 long unsigned int eventId,
176 long unsigned int eventId,
188 long unsigned int eventId,
199 long unsigned int eventId,
209 std::vector< QGoSynchronizedView3D * > p_m_QGoSynchronizedView3Ds =
210 *
static_cast< std::vector< QGoSynchronizedView3D * > *
>( clientData );
212 vtkCamera *movedCamera =
213 static_cast< vtkCamera *
>( caller );
215 std::vector< QGoSynchronizedView3D * >::iterator SynchronizedViewIt =
216 p_m_QGoSynchronizedView3Ds.begin();
218 while ( SynchronizedViewIt != p_m_QGoSynchronizedView3Ds.end() )
234 if ( ( ( *SynchronizedViewIt )->GetCamera(iCamera) )
235 && ( ( *SynchronizedViewIt )->GetCamera(iCamera) != movedCamera ) )
237 ( *SynchronizedViewIt )->GetCamera(iCamera)->DeepCopy(movedCamera);
239 ( *SynchronizedViewIt )->Render(iCamera);
242 ++SynchronizedViewIt;
251 for (
int i = 0; i < 4; i++ )
271 if ( ioSynchronizedView )
275 std::vector< QGoSynchronizedView3D * >::iterator
282 for (
int i = 0; i < 4; i++ )
299 if ( ioSynchronizedView )
306 for (
int i = 0; i < 4; i++ )
309 ->AddObserver(vtkCommand::ModifiedEvent,
331 SLOT( SetSliceViewXY(
int) ) );
334 SLOT( SetSliceViewXZ(
int) ) );
337 SLOT( SetSliceViewYZ(
int) ) );
341 std::cerr <<
"trying to synchronize a visualization object missing a QGoImageView"
bool HasViewer(void)
true if the widget has a viewer
void SetupCallBack()
setup the callback command object (client data, called function...etc)
QGoImageView3D * GetImageView()
static void synchronizeCamera(int iCamera, vtkObject *caller, long unsigned int eventId, void *clientData, void *callData)
void removeSynchronizedView(QGoSynchronizedView3D *ioSynchronizedView)
remove a QGoSynchronizedView3D from the vector of synchronized Managers (this method takes care of re...
static void synchronizeCameras3(vtkObject *caller, long unsigned int eventId, void *clientData, void *callData)
callback function to synchornize cameras (has to be public)
QGoSynchronizedView3DCallbacks(std::vector< QGoSynchronizedView3D * > ioOpenSynchronizedViews, QObject *iParent=0)
the constructor do most of the work : add observers & callbacks to QGoSynchronizedViews of the vector...
~QGoSynchronizedView3DCallbacks()
std::vector< QGoSynchronizedView3D * > m_openSynchronizedView
class used to display a QWidget containing a two dimensional vtkimagedata* or itkimage*. QGoSynchronizedView3D provide the interface to synchronize cameras among several GoSynchronizedView3D.
static void synchronizeCameras0(vtkObject *caller, long unsigned int eventId, void *clientData, void *callData)
callback function to synchornize cameras (has to be public)
static void synchronizeCameras1(vtkObject *caller, long unsigned int eventId, void *clientData, void *callData)
callback function to synchornize cameras (has to be public)
This object takes a list of QGoSynchronizedView and synchronize their cameras by setting up callbacks...
void SliceViewXZChanged(int oSlice)
signals for synchronizing sliders (gives current XZ slice of any changing QGoSynchronizedView) ...
std::vector< vtkCallbackCommand * > m_vtkCallBackCamSync
void addSynchronizedView(QGoSynchronizedView3D *ioSynchronizedView)
add a QGoSynchronizedView3D to the vector of synchronized Managers (this method takes care of adding ...
void SliceViewYZChanged(int oSlice)
signals for synchronizing sliders (gives current YZ slice of any changing QGoSynchronizedView) ...
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void SliceViewXYChanged(int oSlice)
signals for synchronizing sliders (gives current XYslice of any changing QGoSynchronizedView) ...
vtkCamera * GetCamera(void)
get the camera of the current fullscreen view
static void synchronizeCameras2(vtkObject *caller, long unsigned int eventId, void *clientData, void *callData)
callback function to synchornize cameras (has to be public)