ALBA
albaGizmoPolylineGraph.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGizmoPolylineGraph
5 Authors: Josef Kohout, 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 __albaGizmoPolylineGraph_h
18#define __albaGizmoPolylineGraph_h
19
20//----------------------------------------------------------------------------
21// Include:
22//----------------------------------------------------------------------------
23#include "albaDefines.h"
24#include "albaGizmoInterface.h"
25#include "albaMatrix.h"
28
29//---------------------------------------------------------------------------
30// forward refs:
31//---------------------------------------------------------------------------
33
34
35class albaEvent;
36class albaVME;
37class albaVMEGizmo;
38
39class vtkSphereSource;
40class vtkArrowSource;
41class vtkPlaneSource;
42class vtkAppendPolyData;
43class vtkTransformPolyDataFilter;
44
45class albaVMEPolylineGraph;
47
53{
54public:
56 inline static albaGizmoPolylineGraph* New(albaVME* inputVme,
57 albaObserver *Listener = NULL, const char *name = "GizmoPath", bool showOnlyDirectionAxis = false, bool testMode = false)
58 {
59 albaGizmoPolylineGraph* pThis = new albaGizmoPolylineGraph(inputVme,Listener, name, showOnlyDirectionAxis, testMode);
60 pThis->InternalInitInstance();
61 return pThis;
62 }
63
65 inline virtual void Delete()
66 {
67 if (this != NULL)
68 {
69 InternalRelease();
70 delete this;
71 }
72 }
73
74protected:
75 albaGizmoPolylineGraph(albaVME* inputVme, albaObserver *Listener = NULL, const char *name = "GizmoPath", bool showOnlyDirectionAxis = false, bool testMode = false);
76
78 virtual void InternalInitInstance();
79
81 virtual void InternalRelease();
82
83public:
85 inline void SetConstraintPolylineGraph(albaVMEPolylineGraph* constraintPolylineGraph);
86
88 virtual void SetCurvilinearAbscissa(vtkIdType branchId, double s);
89
91 inline double GetCurvilinearAbscissa();
92
94 inline vtkIdType GetActiveBranchId();;
95
97 virtual void SetGizmoLength (double lineLength);
98
101 virtual void Show(bool show) ;
102
104 /*virtual*/ void OnEvent(albaEventBase *alba_event);
105
107 void SetInput(albaVME *vme) {return;};
108
110 virtual void SetColor(double col[3]);
111
112 inline albaVMEGizmo* GetOutput() {
113 return m_VmeGizmo;
114 }
115
116protected:
118 virtual void CreateVMEGizmo();
119
121 virtual void DestroyVMEGizmo();
122
124 virtual void CreateGizmoVTKData();
125
127 virtual void DestroyGizmoVTKData();
128
130 virtual void CreateInteractor();
131
133 virtual void DestroyInteractor();
134
136 virtual void OnTransform(albaEvent *e);
137
139
141 albaVMEGizmo *m_VmeGizmo; //<VME gizmo (this is used by medCurvilinearAbscisaHelper)
142
144
145 vtkSphereSource *m_SphereSource; //<sphere denoting the position
146 vtkArrowSource* m_AxisSource[3]; //<source for axis
147 vtkTransformPolyDataFilter* m_Axis[3]; //<correctly positioned axis
148
149 vtkPlaneSource *m_PlaneSource;
150 vtkAppendPolyData *m_AppendPolyData;
151
152 bool m_ShowOnlyDirectionAxis; //< if true visualize only directional arrow source and hides the perpendiculars
153 bool m_TestMode; //< if true don't visualize gui
154
155
157
159 {
160 FREE = 0,
164 };
165
166};
167
168#pragma region inlines
169//------------------------------------------------------------------------
170inline void albaGizmoPolylineGraph::SetConstraintPolylineGraph( albaVMEPolylineGraph* constraintPolylineGraph )
171//------------------------------------------------------------------------
172{
174}
175
176//------------------------------------------------------------------------
178//------------------------------------------------------------------------
179{
181}
182
183//------------------------------------------------------------------------
185//------------------------------------------------------------------------
186{
188}
189
190//------------------------------------------------------------------------
191inline void albaGizmoPolylineGraph::SetCurvilinearAbscissa( vtkIdType branchId, double s )
192//------------------------------------------------------------------------
193{
195}
196#pragma endregion inlines
197
198
199#endif
Constrained interaction with mouse device: the left button moves the VME (see OnLeftButtonDown).
Decorate input vme with curvilinear abscissa interface for albaVMEPolylineGraph constrained interacti...
vtkIdType GetActiveBranchId()
Get the active branch ie the branch to which inputVME is currently constrained.
void SetConstraintPolylineGraph(albaVMEPolylineGraph *constraintPolylineGraph)
Set the polyline graph constraint.
double GetCurvilinearAbscissa()
Get the curvilinear abscissa.
int SetCurvilinearAbscissa(vtkIdType branchId, double s)
Set the curvilinear abscissa value s on branchId branch, return ALBA_OK or ALBA_ERROR.
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaEvent - Class implementing ALBA application events.
Definition: albaEvent.h:55
Base class for operations and views gizmos.
Gizmo Helper Object for interaction stuff debug: this class should be expanded and refactored increme...
virtual void DestroyInteractor()
Destroys the interactor of the gizmo.
virtual void SetGizmoLength(double lineLength)
Set the length of the gizmo.
vtkSphereSource * m_SphereSource
albaCurvilinearAbscissaOnSkeletonHelper * m_CurvilinearAbscissaHelper
void LogTransformEvent(albaEvent *e)
virtual void OnTransform(albaEvent *e)
Handles ID_TRANSFORM event.
double GetCurvilinearAbscissa()
Get curvilinear abscissa along given constraint skeleton branch.
virtual void Show(bool show)
Show/Hide the gizmos using actor visibility instead of pipe creation/destruction: this is used for fa...
void SetConstraintPolylineGraph(albaVMEPolylineGraph *constraintPolylineGraph)
Set the constraint polyline graph.
virtual void CreateGizmoVTKData()
Creates VTK pipeline for the gizmo.
albaBehaviorTransform * m_LeftMouseInteractor
static albaGizmoPolylineGraph * New(albaVME *inputVme, albaObserver *Listener=NULL, const char *name="GizmoPath", bool showOnlyDirectionAxis=false, bool testMode=false)
The only way to construct correctly the instance.
void SetInput(albaVME *vme)
Not used since this gizmo is not moving anything.
virtual void SetCurvilinearAbscissa(vtkIdType branchId, double s)
Set curvilinear abscissa along given constraint skeleton branch.
vtkAppendPolyData * m_AppendPolyData
virtual void CreateInteractor()
Creates the interactor for the gizmo.
vtkIdType GetActiveBranchId()
Get the active branch ie the branch to which gizmo is currently constrained.
albaGizmoPolylineGraph(albaVME *inputVme, albaObserver *Listener=NULL, const char *name="GizmoPath", bool showOnlyDirectionAxis=false, bool testMode=false)
void OnEvent(albaEventBase *alba_event)
Events handling method.
virtual void Delete()
The only way to destruct correctly the instance.
virtual void InternalInitInstance()
Initializes the object.
virtual void DestroyVMEGizmo()
Destroys the gizmo.
virtual void CreateVMEGizmo()
Creates the gizmo.
virtual void DestroyGizmoVTKData()
Destroys VTK pipeline for the gizmo.
virtual void InternalRelease()
Finalizes the object.
virtual void SetColor(double col[3])
Set the gizmo color.
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:150