Android Open Source - webots-remote-control Camera Instruction






From Project

Back to project page webots-remote-control.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project webots-remote-control listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.black_mesa.webots_remote_control.communication_structures;
/*w  w w .  j  a v  a2s. co m*/
import java.io.Serializable;

/**
 * Instruction class for a Webots camera.
 * 
 * @author Ilja Kroonen
 * 
 */
public final class CameraInstruction implements Serializable {
  private static final long serialVersionUID = -1401919642170517372L;
  private final Type mType;
  private final double[] mArgs;

  private enum Type {
    MOVE, TURN, PITCH
  }

  private CameraInstruction(final Type type, final double[] args) {
    mType = type;
    mArgs = args;
  }

  /**
   * Creates a move CameraInstruction.
   * 
   * @param right
   *            Distance of the movement along the right vector.
   * @param up
   *            Distance of the movement along the up vector.
   * @param forward
   *            Distance of the movement along the forward vector.
   * @return Resulting instance.
   */
  public static CameraInstruction move(final double right, final double up, final double forward) {
    double[] args = { right, up, forward };
    return new CameraInstruction(Type.MOVE, args);
  }

  /**
   * Creates a turn CameraInstruction.
   * 
   * @param angle
   *            Angle of the turn (rad).
   * @return Resulting instance.
   */
  public static CameraInstruction turn(final double angle) {
    double[] args = { angle };
    return new CameraInstruction(Type.TURN, args);
  }

  /**
   * Creates a pitch CameraInstruction.
   * 
   * @param angle
   *            Angle of the turn (rad).
   * @return Resulting instance.
   */
  public static CameraInstruction pitch(final double angle) {
    double[] args = { angle };
    return new CameraInstruction(Type.PITCH, args);
  }

  @Override
  public String toString() {
    switch (mType) {
    case MOVE:
      return mType + "(" + mArgs[0] + "," + mArgs[1] + "," + mArgs[2] + ")";
    case TURN:
      return mType + "(" + mArgs[0] + ")";
    case PITCH:
      return mType + "(" + mArgs[0] + ")";
    }
    return null;
  }
}




Java Source Code List

org.black_mesa.webots_remote_control.activities.AboutFragment.java
org.black_mesa.webots_remote_control.activities.AddServerActivity.java
org.black_mesa.webots_remote_control.activities.CameraFragment.java
org.black_mesa.webots_remote_control.activities.ConnectionFragment.java
org.black_mesa.webots_remote_control.activities.MainActivity.java
org.black_mesa.webots_remote_control.client.CamerasManager.java
org.black_mesa.webots_remote_control.client.Client.java
org.black_mesa.webots_remote_control.client.ConnectionManager.java
org.black_mesa.webots_remote_control.client.ConnectionState.java
org.black_mesa.webots_remote_control.client.package-info.java
org.black_mesa.webots_remote_control.communication_structures.CameraInstructionQueue.java
org.black_mesa.webots_remote_control.communication_structures.CameraInstruction.java
org.black_mesa.webots_remote_control.communication_structures.CommunicationStructure.java
org.black_mesa.webots_remote_control.communication_structures.package-info.java
org.black_mesa.webots_remote_control.database.DataBaseContract.java
org.black_mesa.webots_remote_control.database.DataBaseHelper.java
org.black_mesa.webots_remote_control.database.DataSource.java
org.black_mesa.webots_remote_control.database.ServerListAdapter.java
org.black_mesa.webots_remote_control.database.Server.java
org.black_mesa.webots_remote_control.listeners.CameraJoysticksViewListener.java
org.black_mesa.webots_remote_control.listeners.CameraTouchListenerV1.java
org.black_mesa.webots_remote_control.listeners.CameraTouchListenerV2.java
org.black_mesa.webots_remote_control.listeners.CameraTouchListenerV3.java
org.black_mesa.webots_remote_control.listeners.CameraTouchListenerV4.java
org.black_mesa.webots_remote_control.listeners.CameraTouchListenerV5.java
org.black_mesa.webots_remote_control.listeners.ClientListener.java
org.black_mesa.webots_remote_control.listeners.ConnectionManagerListener.java
org.black_mesa.webots_remote_control.listeners.OnListEventsListener.java
org.black_mesa.webots_remote_control.listeners.package-info.java
org.black_mesa.webots_remote_control.utils.CameraTouchHandlerV1.java
org.black_mesa.webots_remote_control.utils.CameraTouchHandlerV2.java
org.black_mesa.webots_remote_control.utils.CameraTouchHandlerV3.java
org.black_mesa.webots_remote_control.utils.CameraTouchHandlerV4.java
org.black_mesa.webots_remote_control.utils.CameraTouchHandlerV5.java
org.black_mesa.webots_remote_control.utils.package-info.java
org.black_mesa.webots_remote_control.views.CameraJoysticksView.java
org.black_mesa.webots_remote_control.views.CameraView.java