ALBA
albaInteractorSlider.h
Go to the documentation of this file.
1/*=========================================================================
2Program: ALBA
3Module: albaInteractorSlider.h
4Language: C++
5Date: $Date: 2019-04-01 12:00:00 $
6Version: $Revision: 1.0.0.0 $
7Authors: Nicola Vanella
8==========================================================================
9Copyright (c) BIC-IOR 2019 (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 __albaInteractorSlider_h
17#define __albaInteractorSlider_h
18
19//----------------------------------------------------------------------------
20// Include :
21//----------------------------------------------------------------------------
22#include "albaEvent.h"
23//#include "albaGUI.h"
24#include "albaInteractorPER.h"
25
26//----------------------------------------------------------------------------
27// Forward references :
28//----------------------------------------------------------------------------
30class albaRWI;
31
32class vtkActor2D;
33class vtkCoordinate;
34class vtkLineSource;
35class vtkPolyDataMapper2D;
36class vtkRenderWindow;
37class vtkRenderer;
38class vtkRendererCollection;
39class vtkTextActor;
40class vtkTextMapper;
41
42#define ID_TIMER 702
43
44// Class Name: albaInteractorSlider
45class ALBA_EXPORT albaInteractorSlider : public wxFrame, public albaInteractorPER
46{
47public:
48
50 {
51 ID_VALUE_CHANGED = MINID,
52 };
53
55 {
56 HORIZONTAL = 0,
58 };
59
61 albaInteractorSlider(albaView *view, int orientation = HORIZONTAL, double value = 0.0, double minValue = -1.0, double maxValue = 1.0);
62 albaInteractorSlider(albaView *view, int orientation, double value, double minValue, double maxValue, int x, int y, int lenght);
63
65
67
68 virtual void OnEvent(albaEventBase *event);
69
70 void ShowSlider(bool show);
71 void ShowText(bool show) { m_ShowText = show; };
72
74
75 void SetSteps(int steps);
76 void SetRange(double min, double max);
77
78 double GetValue() { return m_Value; };
79 void SetValue(double value);
80
81 void OnTimer(wxTimerEvent& event);
82
83protected:
84
87 virtual void OnMove(albaEventInteraction *e);
88
89 void UpdatePadPosition(double pos);
91
92 double ValueToPosition(double value);
93 bool IsInBound(double *pos);
94
96 vtkRenderer *m_Renderer;
98 vtkRenderWindow *m_RenderWindow;
99
100 vtkCoordinate *m_Coordinate;
101
103
104 // Slider Props
105 int m_SliderPosition[2];
108
109 int m_Bounds[4];
112
113 double m_Value;
116
117 double m_Steps;
118 double m_ValStep;
119
121
122 // Edit Line Props
123 vtkLineSource *m_EditLineSource;
124 vtkPolyDataMapper2D *m_EditLineMapper;
125 vtkActor2D *m_EditLineActor;
126
127 double m_LineP1[3];
128 double m_LineP2[3];
129
131 double m_EditLineColor[3];
132
133 double m_TextColor[3];
134
135 // Decrease-Increase Line Props
136 vtkLineSource *m_DescreaseLineSource;
137 vtkPolyDataMapper2D *m_DescreaseLineMapper;
139
140 vtkLineSource *m_IncreaseLineSource;
141 vtkPolyDataMapper2D *m_IncreaseLineMapper;
143
144 // Pad Line Props
145 vtkLineSource *m_PadLineSource;
146 vtkPolyDataMapper2D *m_PadLineMapper;
147 vtkActor2D *m_PadLineActor;
148
149 double m_PadLineColor[3];
150
152 int m_PadDirection; // -1=decrease | 1=increase
153 int m_PadStep; // = EditLine_Lenght / m_Steps
155
157
158 // Text Labels
159 vtkTextMapper *m_TextValueMapper;
160 vtkTextActor *m_TextValueActor;
161 vtkTextActor *m_TextMinActor;
162 vtkTextActor *m_TextMaxActor;
163
165
166private:
167
168 double m_Time;
169 wxTimer m_timer;
170
171 albaInteractorSlider(const albaInteractorSlider&); // Not implemented.
172 void operator=(const albaInteractorSlider&); // Not implemented.
173
174 friend class albaInteractorSliderTest;
175
177 DECLARE_EVENT_TABLE();
178};
179#endif
180
MINID
Definition: albaDecl.h:420
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
Event class to transport a triggering button and a position from pointing devices.
Class implementing routing of events based on picking.
virtual void OnEvent(albaEventBase *event)
Process events coming from input device.
vtkPolyDataMapper2D * m_PadLineMapper
albaDeviceButtonsPadMouse * m_Mouse
albaInteractorSlider(albaView *view, int orientation=HORIZONTAL, double value=0.0, double minValue=-1.0, double maxValue=1.0)
void OnTimer(wxTimerEvent &event)
void SetRendererByView(albaView *view)
virtual void OnMove(albaEventInteraction *e)
vtkRenderWindow * m_RenderWindow
vtkPolyDataMapper2D * m_IncreaseLineMapper
void ShowSlider(bool show)
virtual ~albaInteractorSlider()
vtkPolyDataMapper2D * m_DescreaseLineMapper
void SetValue(double value)
vtkLineSource * m_PadLineSource
bool IsInBound(double *pos)
vtkCoordinate * m_Coordinate
virtual void OnLeftButtonDown(albaEventInteraction *e)
vtkTextMapper * m_TextValueMapper
albaInteractorSlider(albaView *view, int orientation, double value, double minValue, double maxValue, int x, int y, int lenght)
vtkLineSource * m_DescreaseLineSource
vtkTextActor * m_TextValueActor
albaTypeMacro(albaInteractorSlider, albaInteractorPER)
vtkPolyDataMapper2D * m_EditLineMapper
void SetSteps(int steps)
double ValueToPosition(double value)
void SetRange(double min, double max)
vtkLineSource * m_IncreaseLineSource
vtkLineSource * m_EditLineSource
virtual void OnLeftButtonUp(albaEventInteraction *e)
void UpdatePadPosition(double pos)
albaView is the base class for Views in alba.
Definition: albaView.h:79