Class SpaceNavigatorController

java.lang.Object
gov.nih.mipav.view.input.spacenav.SpaceNavigatorController

public class SpaceNavigatorController extends 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 final int
     
    static final int
     
    private static final int[]
     
    private static final net.java.games.input.Component[]
     
    private static net.java.games.input.Controller
     
    private static final float
    values returned by the device during poll (may not be correct)
    private static final float
     
    static final int
     
    static final int
    Actual button indices
    static final int
    Actual button indices
    static final int
    Actual button indices
    static final int
     
    static final int
    Actual button indices
    static final int
     
    static final int
     
    static final int
    Actual button indices
    static final int
     
    static final int
    Default button indices
    static final int
    Actual button indices
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
     
    private static int
    findCompIndex(net.java.games.input.Component[] comps, net.java.games.input.Component.Identifier id, String nm)
     
    private static net.java.games.input.Controller
    findSpaceNavigator(net.java.games.input.Controller[] cs)
     
    static boolean[]
    Return all the buttons in a single array.
    static float
    X Rotation
    static float
    Y Rotation
    static float
    Z Rotation
    static float
    X Translation
    static float
    Y Translation
    static float
    Z Translation
    static boolean
     
    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
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NUM_BUTTONS

      public static final int NUM_BUTTONS
      See Also:
    • ZAXIS

      public static final int ZAXIS
      Default button indices
      See Also:
    • YAXIS

      public static final int YAXIS
      See Also:
    • XAXIS

      public static final int XAXIS
      See Also:
    • ZROTATION

      public static final int ZROTATION
      See Also:
    • YROTATION

      public static final int YROTATION
      See Also:
    • XROTATION

      public static final int XROTATION
      See Also:
    • BUTTON0

      public static final int BUTTON0
      See Also:
    • BUTTON1

      public static final int BUTTON1
      See Also:
    • MAX_ROTATION

      private static final float MAX_ROTATION
      values returned by the device during poll (may not be correct)
      See Also:
    • MAX_TRANSLATION

      private static final float MAX_TRANSLATION
      See Also:
    • 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
  • Constructor Details

    • SpaceNavigatorController

      public SpaceNavigatorController()
  • Method Details

    • 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, 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()