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//----------------------------------------------------------------------------
35class albaVME;
36class vtkCubeSource;
37class vtkCylinderSource;
38class vtkTransformPolyDataFilter;
39class vtkTransform;
40class albaVMEGizmo;
41class vtkMatrix4x4;
42class vtkPlane;
43class vtkPlaneSource;
44
45//----------------------------------------------------------------------------
46// constants :
47//----------------------------------------------------------------------------
48
49//----------------------------------------------------------------------------
50// albaGizmoHandle :
51//----------------------------------------------------------------------------
90class ALBA_EXPORT albaGizmoHandle: public albaObserver, public albaServiceClient
91{
92public:
93
96 albaGizmoHandle(albaVME *input, albaObserver *listener = NULL,\
97 int constraintModality=BOUNDS,albaVME *parent=NULL, bool showShadingPlane = false);
98 virtual ~albaGizmoHandle();
99
101 void SetInput(albaVME *vme);
102 albaVME *GetInput() {return this->m_InputVme;};
103
104 //----------------------------------------------------------------------------
105 // events handling
106 //----------------------------------------------------------------------------
107
109 void SetListener(albaObserver *Listener) {m_Listener = Listener;};
110
112 albaObserver *GetListener() {return m_Listener;};
113
115 virtual void OnEvent(albaEventBase *alba_event);
116
117 //----------------------------------------------------------------------------
118 // highlight and show
119 //----------------------------------------------------------------------------
120
122 void Highlight(bool highlight);
123
125 void Show(bool show);
126 void ShowOn() {this->Show(true);};
127 void ShowOff() {this->Show(false);};
128 bool GetShow() {return m_Show;};
129
132 void SetLength(double length);
133 double GetLength();
134
136 void SetAbsPose(albaMatrix *absPose);
139
141 void SetPose(albaMatrix *pose);
144
149
150 enum CONSTRAINT_MODALITY {BOUNDS = 0, FREE};
151
152
155 void SetPivotMatrix(albaMatrix &matrix) {m_PivotMatrix = matrix;};
156
159 albaMatrix &GetPivotMatrix() {return m_PivotMatrix;};
160
161 enum GIZMOTYPE {XMIN = 0, XMAX, YMIN, YMAX, ZMIN, ZMAX};
162
166 void SetType(int type);
167
169 int GetType() {return m_GizmoType;};
170
172 void ShowShadingPlane(bool show);
173 void ShowShadingPlaneOn() {this->ShowShadingPlane(true);};
174 void ShowShadingPlaneOff() {this->ShowShadingPlane(false);};
175 bool GetShowShadingPlaneOn(){return m_ShowShadingPlane;};
176
179
181 void SetBounds(double bounds[6]);
182 void GetBounds(double bounds[6]);
183
185 void GetHandleCenter(int type, double HandleCenter[3]);
186
188 void SetBBCenters(double bounds[6]);
189
190protected:
191
193 void SetTranslationIntervals(double bounds[6]);
194
196
197 vtkCubeSource *m_Cube;
198
199 albaVMEGizmo *m_BoxGizmo;
200 albaVMEGizmo *m_ShadingPlaneGizmo;
201
202 vtkTransformPolyDataFilter *m_TranslateBoxPolyDataFilter;
203 vtkTransformPolyDataFilter *m_TranslateShadingPlanePolyDataFilter;
204
205 vtkTransform *m_TranslateBoxTr;
207
208 vtkTransformPolyDataFilter *m_TranslateBoxPolyDataFilterEnd;
209 vtkTransformPolyDataFilter *m_TranslateShadingPlanePolyDataFilterEnd;
210
211 vtkTransform *m_TranslateBoxTrEnd;
213
214 vtkTransformPolyDataFilter *m_RotateBoxPolyDataFilter;
215 vtkTransformPolyDataFilter *m_RotateShadingPlanePolyDataFilter;
216
217 vtkTransform *m_RotateBoxTr;
219
222
224
226
228 void SetColor(double col[3]);
229
231 void SetColor(double colR, double colG, double colB);
232
234 void GetColor(double color[3]);
235
237
239
240 double m_BBCenters[6][3];
241 double m_TranslationIntervals[6][2];
242
244
245 void Update();
246
248
250
252
253 vtkPlaneSource *m_PlaneSource;
254 vtkPlane *m_ShadingPlane;
255
256 double m_ShadingPlaneDimension[3];
257
258 double m_Color[3];
259
260 bool m_Show;
261
262 double m_Bounds[6];
263
264
266 friend class albaGizmoROITest;
267 friend class albaGizmoHandleTest;
268
269};
270#endif
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
albaInteractorCompositorMouse * m_IsaComp
Interactor style compositor.
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.
albaInteractorGenericMouse * 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.
Associates instances of albaInteractorGenericMouse to mouse buttons and ctrl/shift keys combinations.
Constrained interaction with mouse device.
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaVME -
Definition: albaVME.h:150