83 |
|
|
84 |
The ``*Model`` classes are a central piece of the API. |
The ``*Model`` classes are a central piece of the API. |
85 |
This is a design similar |
This is a design similar |
86 |
to swing: for each numeric . |
to swing: for each controlled "thing" there is a ``Model`` object |
87 |
|
which implements a relevant interface. This allows us to, e.g., use special |
88 |
|
models in Jython code so that the variable controlled is actually |
89 |
|
directly an object attribute - the intent is to use this code |
90 |
|
in ``vob.putil.demokeys``. |
91 |
|
|
92 |
.. UML:: custominput_models |
.. UML:: custominput_models |
93 |
|
|
112 |
|
|
113 |
--- |
--- |
114 |
horizontally(50, xx, BoundedFloatModel, ModFloatModel); |
horizontally(50, xx, BoundedFloatModel, ModFloatModel); |
115 |
vertically(50, xx, Model, xx); |
vertically(50, yy, Model, xx); |
116 |
|
|
117 |
|
|
118 |
There can only be one main model per axis - to not confuse the user. |
There can only be one main model per axis - to not confuse the user. |
119 |
If desired, we may later add the capability to put in "non-main" |
If desired, we may later add the capability to put in "non-main" |
120 |
listeners, but this is not a priority. |
listeners, but this is not a priority. |
121 |
|
|
|
The input devices, on the other hand, are represented by a central class |
|
|
which allows programs to access the currently configured input devices: |
|
|
``InputDeviceManager``. From this class, users may get instances of |
|
|
the ``InputDevice`` class. This class also contains the methods for |
|
|
beginning and ending calibration and choosing axes by moving them. |
|
|
The ``InputDevice`` classes again allow users to get the axes. |
|
|
|
|
|
.. UML:: custominput_inputs |
|
|
|
|
|
class InputDeviceManager "interface" |
|
|
fields |
|
|
STATE_CALIBRATING |
|
|
STATE_CHOOSING |
|
|
STATE_NORMAL |
|
|
methods |
|
|
void setState(int state) |
|
|
Axis getCurrentChoice() |
|
|
assoc multi(1) - multi(*) InputDevice |
|
|
|
|
|
class InputDevice "interface" |
|
|
assoc multi(1) - multi(*) Axis |
|
|
|
|
|
class Axis "interface" |
|
|
methods |
|
|
getName() |
|
|
|
|
|
--- |
|
|
horizontally(60, InputDeviceManager, InputDevice, Axis); |
|
|
|
|
122 |
The models are connected to the axes through absolute and relative |
The models are connected to the axes through absolute and relative |
123 |
axis listeners: |
axis listeners: |
124 |
|
|
142 |
methods |
methods |
143 |
void changedRelative(float delta) |
void changedRelative(float delta) |
144 |
|
|
145 |
class BoundedFloatLinearAbsoluteAdapter inherit AbsoluteAxisListener |
class BoundedFloatLinearAbsoluteAdapter |
146 |
realize AbsoluteAxisListener |
realize AbsoluteAxisListener |
147 |
dep "use" BoundedFloatModel |
assoc multi(0..1) - multi(1) BoundedFloatModel |
148 |
|
|
149 |
class BoundedFloatLogAbsoluteAdapter inherit AbsoluteAxisListener |
class BoundedFloatLogAbsoluteAdapter |
150 |
realize AbsoluteAxisListener |
realize AbsoluteAxisListener |
151 |
dep "use" BoundedFloatModel |
assoc multi(0..1) - multi(1) BoundedFloatModel |
152 |
|
|
153 |
class ModFloatRelativeAdapter inherit RelativeAxisListener |
class ModFloatRelativeAdapter |
154 |
|
realize RelativeAxisListener |
155 |
|
assoc multi(0..1) - multi(1) ModFloatModel |
156 |
|
|
157 |
class BoundedFloatModel "interface" |
class BoundedFloatModel "interface" |
158 |
|
|
159 |
class ModFloatModel "interface" |
class ModFloatModel "interface" |
160 |
|
|
161 |
--- |
--- |
162 |
|
horizontally(150, xx, Axis, AxisListener); |
163 |
|
horizontally(100, yy, AbsoluteAxisListener, RelativeAxisListener); |
164 |
|
horizontally(40, zz, BoundedFloatLinearAbsoluteAdapter, BoundedFloatLogAbsoluteAdapter, ModFloatRelativeAdapter); |
165 |
|
horizontally(130, qq, BoundedFloatModel, ModFloatModel); |
166 |
|
|
167 |
|
vertically(60, ww, AxisListener, yy, zz, qq); |
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
The input devices, on the other hand, are represented by a central class |
172 |
|
which allows programs to access the currently configured input devices: |
173 |
|
``InputDeviceManager``. From this class, users may get instances of |
174 |
|
the ``InputDevice`` class. This class also contains the methods for |
175 |
|
beginning and ending calibration and choosing axes by moving them. |
176 |
|
The ``InputDevice`` classes again allow users to get the axes. |
177 |
|
|
178 |
|
.. UML:: custominput_inputs |
179 |
|
|
180 |
|
class InputDeviceManager "interface" |
181 |
|
fields |
182 |
|
STATE_CALIBRATING |
183 |
|
STATE_CHOOSING |
184 |
|
STATE_NORMAL |
185 |
|
methods |
186 |
|
void setState(int state) |
187 |
|
Axis getCurrentChoice() |
188 |
|
assoc multi(1) - multi(*) InputDevice |
189 |
|
|
190 |
|
class InputDevice "interface" |
191 |
|
assoc multi(1) - multi(*) Axis |
192 |
|
|
193 |
|
class Axis "interface" |
194 |
|
methods |
195 |
|
getName() |
196 |
|
|
197 |
|
--- |
198 |
|
horizontally(60, xx, InputDeviceManager, InputDevice, Axis); |
199 |
|
|
200 |
|
|
201 |
|
|