Class SpaceNavigatorController
- java.lang.Object
-
- gov.nih.mipav.view.input.spacenav.SpaceNavigatorController
-
public class SpaceNavigatorController extends java.lang.ObjectAllows for controlling a SpaceNavigator, could also be generalized for any joystick-type device. Details for: SpaceNavigator, Stick, Unknown Components: (8) 0. Z Axis, z, relative, analog, 0.0 1. Y Axis, y, relative, analog, 0.0 2. X Axis, x, relative, analog, 0.0 3. Z Rotation, rz, relative, analog, 0.0 4. Y Rotation, ry, relative, analog, 0.0 5. X Rotation, rx, relative, analog, 0.0 6. Button 0, 0, absolute, digital, 0.0 7. Button 1, 1, absolute, digital, 0.0 No Rumblers No subcontrollers- Author:
- justinsenseney
-
-
Field Summary
Fields Modifier and Type Field Description static intBUTTON0static intBUTTON1private static int[]buttonsIdxprivate static net.java.games.input.Component[]compsprivate static net.java.games.input.Controllercontrollerprivate static floatMAX_ROTATIONvalues returned by the device during poll (may not be correct)private static floatMAX_TRANSLATIONstatic intNUM_BUTTONSstatic intrxAxisIdxActual button indicesstatic intryAxisIdxActual button indicesstatic intrzAxisIdxActual button indicesstatic intXAXISstatic intxAxisIdxActual button indicesstatic intXROTATIONstatic intYAXISstatic intyAxisIdxActual button indicesstatic intYROTATIONstatic intZAXISDefault button indicesstatic intzAxisIdxActual button indicesstatic intZROTATION
-
Constructor Summary
Constructors Constructor Description SpaceNavigatorController()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckIfSpaceNavNeedsCalibration()private static intfindCompIndex(net.java.games.input.Component[] comps, net.java.games.input.Component.Identifier id, java.lang.String nm)private static net.java.games.input.ControllerfindSpaceNavigator(net.java.games.input.Controller[] cs)static boolean[]getButtons()Return all the buttons in a single array.static floatgetRX()X Rotationstatic floatgetRY()Y Rotationstatic floatgetRZ()Z Rotationstatic floatgetTX()X Translationstatic floatgetTY()Y Translationstatic floatgetTZ()Z Translationstatic booleanhasSpaceNavigator()private static booleanisButton(net.java.games.input.Component c)Return true if the component is a digital/absolute button, and its identifier name ends with "Button" (i.e. the identifier class is Component.Identifier.Button).static booleanisButtonPressed(int pos)static voidpoll()
-
-
-
Field Detail
-
NUM_BUTTONS
public static final int NUM_BUTTONS
- See Also:
- Constant Field Values
-
ZAXIS
public static final int ZAXIS
Default button indices- See Also:
- Constant Field Values
-
YAXIS
public static final int YAXIS
- See Also:
- Constant Field Values
-
XAXIS
public static final int XAXIS
- See Also:
- Constant Field Values
-
ZROTATION
public static final int ZROTATION
- See Also:
- Constant Field Values
-
YROTATION
public static final int YROTATION
- See Also:
- Constant Field Values
-
XROTATION
public static final int XROTATION
- See Also:
- Constant Field Values
-
BUTTON0
public static final int BUTTON0
- See Also:
- Constant Field Values
-
BUTTON1
public static final int BUTTON1
- See Also:
- Constant Field Values
-
MAX_ROTATION
private static final float MAX_ROTATION
values returned by the device during poll (may not be correct)- See Also:
- Constant Field Values
-
MAX_TRANSLATION
private static final float MAX_TRANSLATION
- See Also:
- Constant Field Values
-
controller
private static net.java.games.input.Controller controller
-
comps
private static final net.java.games.input.Component[] comps
-
xAxisIdx
public static final int xAxisIdx
Actual button indices
-
yAxisIdx
public static final int yAxisIdx
Actual button indices
-
zAxisIdx
public static final int zAxisIdx
Actual button indices
-
rxAxisIdx
public static final int rxAxisIdx
Actual button indices
-
ryAxisIdx
public static final int ryAxisIdx
Actual button indices
-
rzAxisIdx
public static final int rzAxisIdx
Actual button indices
-
buttonsIdx
private static final int[] buttonsIdx
-
-
Method Detail
-
hasSpaceNavigator
public static boolean hasSpaceNavigator()
-
findSpaceNavigator
private static net.java.games.input.Controller findSpaceNavigator(net.java.games.input.Controller[] cs)
-
findCompIndex
private static int findCompIndex(net.java.games.input.Component[] comps, net.java.games.input.Component.Identifier id, java.lang.String nm)
-
isButton
private static boolean isButton(net.java.games.input.Component c)
Return true if the component is a digital/absolute button, and its identifier name ends with "Button" (i.e. the identifier class is Component.Identifier.Button).
-
getButtons
public static boolean[] getButtons()
Return all the buttons in a single array. Each button value is a boolean.
-
isButtonPressed
public static boolean isButtonPressed(int pos)
-
poll
public static void poll()
-
getTX
public static float getTX()
X Translation- Returns:
- float value between .613 and -.613
-
getTY
public static float getTY()
Y Translation- Returns:
- float value between .613 and -.613
-
getTZ
public static float getTZ()
Z Translation- Returns:
- float value between .613 and -.613
-
getRX
public static float getRX()
X Rotation- Returns:
- float value between .560 and -.560
-
getRY
public static float getRY()
Y Rotation- Returns:
- float value between .560 and -.560
-
getRZ
public static float getRZ()
Z Rotation- Returns:
- float value between .560 and -.560
-
checkIfSpaceNavNeedsCalibration
public static boolean checkIfSpaceNavNeedsCalibration()
-
-