ALBA
albaInteractor2DIndicator.h
Go to the documentation of this file.
1/*=========================================================================
2Program: ALBA (Agile Library for Biomedical Applications)
3Module: albaInteractor2DIndicator.h
4Language: C++
5Date: $Date: 2021-01-01 12:00:00 $
6Version: $Revision: 1.0.0.0 $
7Authors: Daniele Giunchi
8==========================================================================
9Copyright (c) BIC-IOR 2021 (https://github.com/IOR-BIC)
10
11This software is distributed WITHOUT ANY WARRANTY; without even
12the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the above copyright notice for more information.
14=========================================================================*/
15
16#ifndef __albaInteractor2DIndicator_h
17#define __albaInteractor2DIndicator_h
18
19#include "albaInteractorPER.h"
20#include "albaEvent.h"
21#include "vtkALBATextActorMeter.h"
22
23//----------------------------------------------------------------------------
24// forward refs
25//----------------------------------------------------------------------------
26class albaRWI;
27class albaRWIBase;
29
30class vtkLineSource;
31class vtkCoordinate;
32class vtkPolyDataMapper2D;
33class vtkActor2D;
34class vtkRenderWindow;
35class vtkRenderer;
36class vtkXYPlotActor;
37class vtkTextActor;
38class vtkConeSource;
39
40
41
51//----------------------------------------------------------------------------
53 //----------------------------------------------------------------------------
54{
55public:
57
59 {
60 INDICATOR_ARROW = 0,
61
63
64 };
65
66
70
71
72
76
77
81
84 bool GetRegisterMeasure(){return m_RegisterMeasure;}
85
88 void SetLabel(albaString label);
89
92 albaString GetLabel() { if(m_MeterVector.size())
93 return albaString(m_MeterVector[m_MeterVector.size()-1]->GetText());
94 else
95 return albaString("");
96 }
100 int SizeMeasureVector(){ return m_MeterVector.size(); }
101
103 void ShowOnlyLastMeasure(bool show);
104
106 void ShowAllMeasures(bool show);
107
110
111protected:
114
122 virtual void OnMove (albaEventInteraction *e);
124 virtual void OnChar (albaEventInteraction *e) {};
125
128 void DrawMeasureTool(double x, double y);
129
130
131 //persistent measure BEGIN
132 std::vector<vtkActor2D *> m_LineActorVector1;
133 std::vector<vtkPolyDataMapper2D *> m_LineMapperVector1;
134 std::vector<vtkLineSource *> m_LineSourceVector1;
135
136 std::vector<vtkActor2D *> m_ConeActorVector;
137 std::vector<vtkPolyDataMapper2D *> m_ConeMapperVector;
138 std::vector<vtkConeSource *> m_ConeSourceVector;
139
140 std::vector<vtkActor2D *> m_LineActorVector2;
141 std::vector<vtkPolyDataMapper2D *> m_LineMapperVector2;
142 std::vector<vtkLineSource *> m_LineSourceVector2;
143
144 std::vector<vtkALBATextActorMeter *> m_MeterVector;
145
146
147 std::vector<vtkRenderer *> m_RendererVector;
148 //persistent measure END
149
150 vtkLineSource *m_ProbingLine;
151
152 vtkLineSource *m_Line;
153 vtkCoordinate *m_Coordinate;
154 vtkPolyDataMapper2D *m_LineMapper;
155 vtkActor2D *m_LineActor;
156
157 vtkLineSource *m_Line2;
158 vtkPolyDataMapper2D *m_LineMapper2;
159 vtkActor2D *m_LineActor2;
160 vtkRenderer *m_LastRenderer;
161 vtkRenderer *m_CurrentRenderer;
162 vtkRenderer *m_PreviousRenderer;
163
165
171
175
176
178
179 double m_PickedPoint[3];
181
182private:
183
184 albaInteractor2DIndicator(const albaInteractor2DIndicator&); // Not implemented.
185 void operator=(const albaInteractor2DIndicator&); // Not implemented.
186
187 friend class albaInteractor2DIndicatorTest;
188};
189#endif
190
Event class to transport a triggering button and a position from pointing devices.
Class implementing an interactor for creating 2D measure tool.
virtual void OnRightButtonUp(albaEventInteraction *e)
std::vector< vtkConeSource * > m_ConeSourceVector
virtual ~albaInteractor2DIndicator()
virtual void OnLeftButtonUp(albaEventInteraction *e)
virtual void OnRightButtonDown(albaEventInteraction *e)
virtual void OnMiddleButtonDown(albaEventInteraction *e)
void SetLabel(albaString label)
Set the label.
void ShowAllMeasures(bool show)
Show On/Off all measures.
void UndoMeasure()
Undo the last measure.
bool GetRegisterMeasure()
Get the boolean value of end measure.
std::vector< vtkPolyDataMapper2D * > m_ConeMapperVector
vtkLineSource * m_Line2
Second line of the measure tool (used for angle measures)
std::vector< vtkPolyDataMapper2D * > m_LineMapperVector1
albaRWIBase * GetCurrentRwi()
return the current rwi
virtual void OnButtonUp(albaEventInteraction *e)
albaTypeMacro(albaInteractor2DIndicator, albaInteractorPER)
std::vector< vtkLineSource * > m_LineSourceVector1
virtual void OnButtonDown(albaEventInteraction *e)
Perform a pick on start of interaction to find if the user pointed an object in the scene,...
std::vector< vtkPolyDataMapper2D * > m_LineMapperVector2
std::vector< vtkALBATextActorMeter * > m_MeterVector
albaString GetLabel()
Get the label.
std::vector< vtkRenderer * > m_RendererVector
void ShowOnlyLastMeasure(bool show)
Show On/Off only last measure.
virtual void OnMove(albaEventInteraction *e)
std::vector< vtkActor2D * > m_ConeActorVector
virtual void OnMiddleButtonUp(albaEventInteraction *e)
std::vector< vtkLineSource * > m_LineSourceVector2
vtkLineSource * m_Line
First line of the measure tool.
std::vector< vtkActor2D * > m_LineActorVector1
int SizeMeasureVector()
Return the dimension of Measure Vector.
std::vector< vtkActor2D * > m_LineActorVector2
vtkRenderer * m_LastRenderer
Renderer used for the first line.
virtual void OnLeftButtonDown(albaEventInteraction *e)
bool IsDisableUndoAndOkCancel()
Control if disabling various buttons.
albaVME * m_ProbedVME
VME probed by the m_ProbingLine.
void DrawMeasureTool(double x, double y)
Draw the measure tool according to the measure type selected.
albaDeviceButtonsPadMouse * m_Mouse
virtual void OnChar(albaEventInteraction *e)
void RemoveMeter()
Remove the meters from the render window.
Class implementing routing of events based on picking.
albaRWIBase is a vtkRenderWindowInteractor placed on a wxWindow
Definition: albaRWIBase.h:61
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:150