ALBA
albaGizmoAutoscaleHelper.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGizmoAutoscaleHelper
5 Authors: Stefano Perticoni
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaGizmoAutoscaleHelper_h
18#define __albaGizmoAutoscaleHelper_h
19
20#include "albaTransformBase.h"
21
22//----------------------------------------------------------------------------
23// forward declarations :
24//----------------------------------------------------------------------------
25class vtkRenderer;
26class vtkTransform;
27class vtkCamera;
28class albaOBB;
29class vtkCallbackCommand;
30class vtkObject;
31class vtkActor;
32class albaVME;
33
41{
42public:
45
47
49 void SetRenderer(vtkRenderer *ren);
50
52 vtkRenderer *GetRenderer() {return m_Renderer;}
53
55 void SetFollowScale(bool flag) {m_FollowScale=flag;Modified();}
56 bool GetFollowScale() {return m_FollowScale;}
57 void FollowScaleOn() {SetFollowScale(true);}
58 void FollowScaleOff() {SetFollowScale(false);}
59
62 void SetRenderWindowHeightPercentage(double percentage) {m_RenderWindowHeightPercentage = percentage;};
63 double GetRenderWindowHeightPercentage() {return m_RenderWindowHeightPercentage;};
64
66 void SetActor(vtkActor *actor) {m_Actor = actor;};
67 vtkActor *GetActor() {return m_Actor;};
68
70 void SetVME(albaVME *vme);
71 albaVME *GetVME() {return m_VME;};
72
74
78 virtual unsigned long GetMTime();
79
80protected:
81
85 void SetBounds(albaOBB *bounds) {m_Bounds=bounds;}
86 albaOBB *GetBounds() {return m_Bounds;}
87
89 void UpdatePoseMatrix(albaMatrix *matrix,albaMatrix *old_view_matrix, albaMatrix *new_view_matrix);
90
92
97 static void AutoFitting(albaMatrix *matrix,albaOBB *tracked_bounds,vtkRenderer *ren);
98 void AutoFitting() {AutoFitting(m_Matrix,m_Bounds,m_Renderer);}
99
101 static void ComputeScaling(albaOBB *inBox, albaOBB *outBox,double *scale);
102
105
107 virtual void InternalUpdate();
108
109 static void InternalProcessEvents(vtkObject* sender, unsigned long channel, void* clientdata, void* calldata);
110
111 vtkRenderer* m_Renderer;
112 vtkCamera* m_Camera;
114
116
117 double m_VMEBounds[6];
118
122
123 vtkCallbackCommand* m_EventRouter;
124
125 vtkActor *m_Actor;
127
128private:
129 albaGizmoAutoscaleHelper(const albaGizmoAutoscaleHelper&); // Not implemented
130 void operator=(const albaGizmoAutoscaleHelper&); // Not implemented
131};
132
133#endif /* __albaGizmoAutoscaleHelper_h */
Helper object for gizmo autoscaling ie actor2D-like behavior.
void SetRenderWindowHeightPercentage(double percentage)
Set the size of the gizmo when autoscale is enabled.
bool m_FollowScale
Flag for enabling the scaling according to camera frustum.
void UpdatePoseMatrix(albaMatrix *matrix, albaMatrix *old_view_matrix, albaMatrix *new_view_matrix)
Change the given matrix to follow camera movements.
vtkCamera * m_Camera
this is to find if the render's active camera is changed
void SetBounds(albaOBB *bounds)
Set the bounds of the object that should follow the camera.
virtual int DeepCopy(albaGizmoAutoscaleHelper *trans)
double m_RenderWindowHeightPercentage
gizmoHeight / renderWindowHeight (1 at maximum)
static void ComputeScaling(albaOBB *inBox, albaOBB *outBox, double *scale)
Compute scale between two boxes in order to fit viewport Y.
virtual ~albaGizmoAutoscaleHelper()
vtkCallbackCommand * m_EventRouter
virtual void InternalUpdate()
Updates the internal matrix.
albaTypeMacro(albaGizmoAutoscaleHelper, albaTransformBase)
void SetVME(albaVME *vme)
Set the vme to be autoscaled (to be used from the pipe)
void SetRenderer(vtkRenderer *ren)
Set the renderer used as input for this transform.
void SetFollowScale(bool flag)
Enable/Disable following of the camera scaling (on by default)
static void InternalProcessEvents(vtkObject *sender, unsigned long channel, void *clientdata, void *calldata)
vtkRenderer * GetRenderer()
Return the renderer used as input for this transform.
virtual unsigned long GetMTime()
Get the MTime: this is the bit of magic that makes everything work.
static void AutoFitting(albaMatrix *matrix, albaOBB *tracked_bounds, vtkRenderer *ren)
Change matrix scale to create a transform making two boxes to fit.Translation and Orientation are lef...
vtkRenderer * m_Renderer
This stores the renderer used as input.
void SetActor(vtkActor *actor)
Set the prop to be autoscaled (to be used from the pipe)
albaOBB * m_Bounds
m_Bounds of the object that should follow the camera
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
This class simply stores a Box boundary (i.e.
Definition: albaOBB.h:37
Superclass for Homogeneous transformations.
void Modified()
update modification time stamp for this object
albaVME -
Definition: albaVME.h:150