Class SpaceNavigatorController
- java.lang.Object
-
- gov.nih.mipav.view.input.spacenav.SpaceNavigatorController
-
public class SpaceNavigatorController extends java.lang.Object
Allows 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 int
BUTTON0
static int
BUTTON1
private static int[]
buttonsIdx
private static net.java.games.input.Component[]
comps
private static net.java.games.input.Controller
controller
private static float
MAX_ROTATION
values returned by the device during poll (may not be correct)private static float
MAX_TRANSLATION
static int
NUM_BUTTONS
static int
rxAxisIdx
Actual button indicesstatic int
ryAxisIdx
Actual button indicesstatic int
rzAxisIdx
Actual button indicesstatic int
XAXIS
static int
xAxisIdx
Actual button indicesstatic int
XROTATION
static int
YAXIS
static int
yAxisIdx
Actual button indicesstatic int
YROTATION
static int
ZAXIS
Default button indicesstatic int
zAxisIdx
Actual button indicesstatic int
ZROTATION
-
Constructor Summary
Constructors Constructor Description SpaceNavigatorController()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkIfSpaceNavNeedsCalibration()
private static int
findCompIndex(net.java.games.input.Component[] comps, net.java.games.input.Component.Identifier id, java.lang.String nm)
private static net.java.games.input.Controller
findSpaceNavigator(net.java.games.input.Controller[] cs)
static boolean[]
getButtons()
Return all the buttons in a single array.static float
getRX()
X Rotationstatic float
getRY()
Y Rotationstatic float
getRZ()
Z Rotationstatic float
getTX()
X Translationstatic float
getTY()
Y Translationstatic float
getTZ()
Z Translationstatic boolean
hasSpaceNavigator()
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).static boolean
isButtonPressed(int pos)
static void
poll()
-
-
-
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()
-
-