ALBA
albaGizmoHandle.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGizmoHandle
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
18#ifndef __albaGizmoHandle_H__
19#define __albaGizmoHandle_H__
20
21//----------------------------------------------------------------------------
22// Include:
23//----------------------------------------------------------------------------
24#include "albaEvent.h"
25#include "albaObserver.h"
26#include "albaServiceClient.h"
27#include "albaAbsLogicManager.h"
28#include "albaMatrix.h"
29
30//----------------------------------------------------------------------------
31// forward references :
32//----------------------------------------------------------------------------
34class albaVME;
35class vtkCubeSource;
36class vtkCylinderSource;
37class vtkTransformPolyDataFilter;
38class vtkTransform;
39class albaVMEGizmo;
40class vtkMatrix4x4;
41class vtkPlane;
42class vtkPlaneSource;
43
44//----------------------------------------------------------------------------
45// constants :
46//----------------------------------------------------------------------------
47
48//----------------------------------------------------------------------------
49// albaGizmoHandle :
50//----------------------------------------------------------------------------
89class ALBA_EXPORT albaGizmoHandle: public albaObserver, public albaServiceClient
90{
91public:
92
95 albaGizmoHandle(albaVME *input, albaObserver *listener = NULL,\
96 int constraintModality=BOUNDS,albaVME *parent=NULL, bool showShadingPlane = false);
97 virtual ~albaGizmoHandle();
98
100 void SetInput(albaVME *vme);
101 albaVME *GetInput() {return this->m_InputVme;};
102
103 //----------------------------------------------------------------------------
104 // events handling
105 //----------------------------------------------------------------------------
106
108 void SetListener(albaObserver *Listener) {m_Listener = Listener;};
109
111 albaObserver *GetListener() {return m_Listener;};
112
114 virtual void OnEvent(albaEventBase *alba_event);
115
116 //----------------------------------------------------------------------------
117 // highlight and show
118 //----------------------------------------------------------------------------
119
121 void Highlight(bool highlight);
122
124 void Show(bool show);
125 void ShowOn() {this->Show(true);};
126 void ShowOff() {this->Show(false);};
127 bool GetShow() {return m_Show;};
128
131 void SetLength(double length);
132 double GetLength();
133
135 void SetAbsPose(albaMatrix *absPose);
138
140 void SetPose(albaMatrix *pose);
143
148
149 enum CONSTRAINT_MODALITY {BOUNDS = 0, FREE};
150
151
154 void SetPivotMatrix(albaMatrix &matrix) {m_PivotMatrix = matrix;};
155
158 albaMatrix &GetPivotMatrix() {return m_PivotMatrix;};
159
160 enum GIZMOTYPE {XMIN = 0, XMAX, YMIN, YMAX, ZMIN, ZMAX};
161
165 void SetType(int type);
166
168 int GetType() {return m_GizmoType;};
169
171 void ShowShadingPlane(bool show);
172 void ShowShadingPlaneOn() {this->ShowShadingPlane(true);};
173 void ShowShadingPlaneOff() {this->ShowShadingPlane(false);};
174 bool GetShowShadingPlaneOn(){return m_ShowShadingPlane;};
175
178
180 void SetBounds(double bounds[6]);
181 void GetBounds(double bounds[6]);
182
184 void GetHandleCenter(int type, double HandleCenter[3]);
185
187 void SetBBCenters(double bounds[6]);
188
189protected:
190
192 void SetTranslationIntervals(double bounds[6]);
193
195
196 vtkCubeSource *m_Cube;
197
198 albaVMEGizmo *m_BoxGizmo;
199 albaVMEGizmo *m_ShadingPlaneGizmo;
200
201 vtkTransformPolyDataFilter *m_TranslateBoxPolyDataFilter;
202 vtkTransformPolyDataFilter *m_TranslateShadingPlanePolyDataFilter;
203
204 vtkTransform *m_TranslateBoxTr;
206
207 vtkTransformPolyDataFilter *m_TranslateBoxPolyDataFilterEnd;
208 vtkTransformPolyDataFilter *m_TranslateShadingPlanePolyDataFilterEnd;
209
210 vtkTransform *m_TranslateBoxTrEnd;
212
213 vtkTransformPolyDataFilter *m_RotateBoxPolyDataFilter;
214 vtkTransformPolyDataFilter *m_RotateShadingPlanePolyDataFilter;
215
216 vtkTransform *m_RotateBoxTr;
218
221
222
224
226 void SetColor(double col[3]);
227
229 void SetColor(double colR, double colG, double colB);
230
232 void GetColor(double color[3]);
233
235
237
238 double m_BBCenters[6][3];
239 double m_TranslationIntervals[6][2];
240
242
243 void Update();
244
246
248
250
251 vtkPlaneSource *m_PlaneSource;
252 vtkPlane *m_ShadingPlane;
253
254 double m_ShadingPlaneDimension[3];
255
256 double m_Color[3];
257
258 bool m_Show;
259
260 double m_Bounds[6];
261
262
264 friend class albaGizmoROITest;
265 friend class albaGizmoHandleTest;
266
267};
268#endif
Constrained interaction with mouse device: the left button moves the VME (see OnLeftButtonDown).
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
virtual void OnEvent(albaEventBase *alba_event)
Events handling.
void ShowShadingPlaneOff()
void SetLength(double length)
Set/Get the length of the handle The handle dimensions are: (Length) x (Length) ax (Length/2)
vtkCubeSource * m_Cube
Cube source.
void SetBBCenters(double bounds[6])
DEPRECATED: To be removed, use SetBounds instead.
vtkTransformPolyDataFilter * m_TranslateBoxPolyDataFilterEnd
translate PDF for box
void SetColor(double col[3])
Set the gizmo color.
albaMatrix m_PivotMatrix
The Pivot Matrix.
void SetListener(albaObserver *Listener)
Set the event receiver object.
void SetAbsPose(albaMatrix *absPose)
Set the gizmo abs pose.
albaMatrix * GetAbsPose()
Get the gizmo abs pose.
void SetPivotMatrix(albaMatrix &matrix)
DEPRECATED: To be removed! Set the pivot matrix.
albaVME * GetInput()
albaMatrix * GetPose()
Get the gizmo abs pose.
virtual ~albaGizmoHandle()
vtkTransform * m_TranslateBoxTrEnd
translation transform for box
void UpdateShadingPlaneDimension(double b[6])
Since handles position has changed shading plane bounds must be recomputed.
vtkTransform * m_TranslateShadingPlaneTrEnd
translation transform for box
vtkTransformPolyDataFilter * m_RotateBoxPolyDataFilter
rotate PDF for box
vtkTransformPolyDataFilter * m_TranslateShadingPlanePolyDataFilter
translate PDF for box
vtkPlaneSource * m_PlaneSource
void SetPose(albaMatrix *pose)
Set the gizmo local pose.
vtkPlane * m_ShadingPlane
vtkTransformPolyDataFilter * m_RotateShadingPlanePolyDataFilter
rotate PDF for box
albaVMEGizmo * m_ShadingPlaneGizmo
void CreatePipeline()
Create vtk objects needed.
vtkTransformPolyDataFilter * m_TranslateShadingPlanePolyDataFilterEnd
translate PDF for box
int GetType()
Return the gizmo's type.
void GetBounds(double bounds[6])
void SetTranslationIntervals(double bounds[6])
Set translation intervals.
void SetConstrainRefSys(albaMatrix *constrain)
Set the constrain ref sys.
vtkTransform * m_TranslateBoxTr
translation transform for box
vtkTransform * m_TranslateShadingPlaneTr
translation transform for box
albaVME * m_InputVme
Register input vme.
albaObserver * m_Listener
Register the event receiver object.
void GetHandleCenter(int type, double HandleCenter[3])
Return the center of the handle.
void SetColor(double colR, double colG, double colB)
Set the gizmo color.
void SetInput(albaVME *vme)
Set the gizmo generating vme; the gizmo will be centered on this vme.
vtkTransform * m_RotateShadingPlaneTr
rotation transform for box
void SetBounds(double bounds[6])
Update the handle position given the bounding box.
albaBehaviorTransform * m_IsaGen
Generic Interactor style.
vtkTransform * m_RotateBoxTr
rotation transform for box
double GetLength()
albaVMEGizmo * m_BoxGizmo
albaMatrix & GetPivotMatrix()
DEPRECATED: To be removed! Get the pivot matrix.
bool GetShowShadingPlaneOn()
albaObserver * GetListener()
Get the event receiver object.
void Show(bool show)
Show the gizmo.
void SetType(int type)
Set the gizmo type.
void Highlight(bool highlight)
Highlight the gizmo: this change its color to yellow.
void ShowShadingPlane(bool show)
Show shading plane.
void GetColor(double color[3])
Get the gizmo color.
albaGizmoHandle(albaVME *input, albaObserver *listener=NULL, int constraintModality=BOUNDS, albaVME *parent=NULL, bool showShadingPlane=false)
Create a handle, input vme must be different from NULL and default handle type is XMIN.
albaMatrix * GetConstrainRefSys()
Get the constrain ref sys.
vtkTransformPolyDataFilter * m_TranslateBoxPolyDataFilter
translate PDF for box
int m_GizmoType
Register the gizmo type.
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:45
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaVME -
Definition: albaVME.h:150