infovis.visualization
Class Orientation

java.lang.Object
  extended by infovis.visualization.Orientation
All Implemented Interfaces:
Orientable, SwingConstants

public class Orientation
extends Object
implements Orientable

Simple implementation of interface Orientable with conveninent static methods.

Version:
$Revision: 1.8 $
Author:
Jean-Daniel Fekete

Field Summary
 
Fields inherited from interface infovis.visualization.Orientable
DIRECTION, NAME, ORIENTATION_CENTER, ORIENTATION_EAST, ORIENTATION_INVALID, ORIENTATION_NORTH, ORIENTATION_SOUTH, ORIENTATION_WEST, SQRT2
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
Orientation()
          Create an Orientation to the SOUTH.
Orientation(short orientation)
          Creates an orientation by specifying its initial value.
 
Method Summary
static short directionOrientation(double dx, double dy)
          Returns the closest orientation to a speficied direction.
static Point2D getDirection(short orientation)
          Returns a direction vector for a specified orientation.
 short getOrientation()
          Returns the orientation.
static short inverse(short orientation)
          Returns the inverse of a specified orientation.
static boolean isHorizontal(short orientation)
          Return true if the orientation is horizontal.
static boolean isVertical(short orientation)
          Return true if the orientation is vertical.
 void setOrientation(short orientation)
          Sets the orientation.
static String toString(short orientation)
          Returns a printable representation for a specified orientation.
static short turn90(short orientation)
          Returns the orientation turned by 90 degrees.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Orientation

public Orientation()
Create an Orientation to the SOUTH.


Orientation

public Orientation(short orientation)
Creates an orientation by specifying its initial value.

Parameters:
orientation - the initial value
Method Detail

getOrientation

public short getOrientation()
Returns the orientation.

Specified by:
getOrientation in interface Orientable
Returns:
the orientation.

setOrientation

public void setOrientation(short orientation)
Sets the orientation.

Specified by:
setOrientation in interface Orientable
Parameters:
orientation - the new orientation set

directionOrientation

public static short directionOrientation(double dx,
                                         double dy)
Returns the closest orientation to a speficied direction.

Parameters:
dx - the x component of the orientation
dy - the y component of the orientation
Returns:
the corresponding orientation value

inverse

public static short inverse(short orientation)
Returns the inverse of a specified orientation.

Parameters:
orientation - the orientation
Returns:
the inverse of the orientation.

turn90

public static short turn90(short orientation)
Returns the orientation turned by 90 degrees.

Parameters:
orientation - the orientation
Returns:
the orientation turned by 90 degrees.

isHorizontal

public static boolean isHorizontal(short orientation)
Return true if the orientation is horizontal.

Parameters:
orientation - the orientation
Returns:
true if the orientation is horizontal.

isVertical

public static boolean isVertical(short orientation)
Return true if the orientation is vertical.

Parameters:
orientation - the orientation
Returns:
true if the orientation is vertial.

toString

public static String toString(short orientation)
Returns a printable representation for a specified orientation.

Parameters:
orientation - the orientatio
Returns:
a printable representation for the orientation.

getDirection

public static Point2D getDirection(short orientation)
Returns a direction vector for a specified orientation.

Parameters:
orientation - the orientation
Returns:
the direction vector in a Point2D


Copyright © 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.