mil.navy.nps.dis
Class WorldCoordinate

java.lang.Object
  extended bymil.navy.nps.dis.PduElement
      extended bymil.navy.nps.dis.WorldCoordinate
All Implemented Interfaces:
java.lang.Cloneable, SerializationInterface

public class WorldCoordinate
extends PduElement

Entity location in world coordinates.

Version:
1.0
Author:
Don McGregor (http://www.npsnet.org/~mcgredo)
Location:
Web: http://www.web3d.org/WorkingGroups/vrtp/mil/navy/nps/dis/WorldCoordinate.java
or locally: ~/mil/navy/nps/dis/WorldCoordinate.java
Hierarchy Diagram:
Summary:
Location of the origin of the entity's coordinate system shall be specified by a set of three coordinates: X, Y, and Z.
Explanation
The WorldCoordinate class describes the location of an entity in 64-bit x,y,z coordinates. This crops up often enough to warrant its own class. (This is also known as "World Coordinates", as contrasted to "entity coordinates", which are 32-bit.

History:
12Dec96 /Don McGregor /New
10Mar97 /Don McGregor /changes for javadoc
16Apr97 /Don McGregor /PrintStream passed to printValues
12Aug97 /Don McGregor /elaborated printValues
8Dec97 /Ronan Fauglas /changes for documentation templates + complements in documentation
11Dec97 /Ronan Fauglas /changes access methods names from "variable()" to "getVariable()"
11Dec97 /Ronan Fauglas /changed " class" to "public class" (was private by default).
References:
DIS Data Dictionary: World Coordinate Record
DIS specification : IEEE 1278.1, 5.3.34
See Also:
PduElement, SerializationInterface, EntityCoordinate

Field Summary
 int sizeOf
          Constant value--size of a World Coordinate record when written out; here :sizeOf = 24 bytes.
protected  double x
          First coordinate of the entity's coordinate system , along X axis
protected  double y
          Second coordinate of the entity's coordinate system , along Y axis
protected  double z
          Third coordinate of the entity's coordinate system , along Z axis
 
Constructor Summary
WorldCoordinate()
          Constructs an new WorldCoordinate Object, centered.
WorldCoordinate(double pX, double pY, double pZ)
          Constructs a new WorldCoordinate Object whose coordinate values are passed in parameters.
 
Method Summary
 java.lang.Object clone()
          Makes deep copies of all the instance variables, so we don't have two objects pointing to the same data.
 void deSerialize(java.io.DataInputStream pInputStream)
          Deserialize our data from the input stream.
 double getX()
           
 double getY()
           
 double getZ()
           
 int length()
          Returns the length of the object when serialized in a stream.
 void printValues(int indentLevel, java.io.PrintStream printStream)
          Prints the generated serialized object for debugging.
 void serialize(java.io.DataOutputStream outputStream)
          Serialize our data out to the stream.
 void setX(double pX)
           
 void setY(double pY)
           
 void setZ(double pZ)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double x
First coordinate of the entity's coordinate system , along X axis


y

protected double y
Second coordinate of the entity's coordinate system , along Y axis


z

protected double z
Third coordinate of the entity's coordinate system , along Z axis


sizeOf

public final int sizeOf
Constant value--size of a World Coordinate record when written out; here :sizeOf = 24 bytes.

See Also:
Constant Field Values
Constructor Detail

WorldCoordinate

public WorldCoordinate()
Constructs an new WorldCoordinate Object, centered.


WorldCoordinate

public WorldCoordinate(double pX,
                       double pY,
                       double pZ)
Constructs a new WorldCoordinate Object whose coordinate values are passed in parameters.

Parameters:
pX - the first coordinate in the cartesian coordinate system
pY - the second coordinate in the cartesian coordinate system
pZ - the third coordinate in the cartesian coordinate system
Method Detail

clone

public java.lang.Object clone()
Description copied from class: PduElement
Makes deep copies of all the instance variables, so we don't have two objects pointing to the same data. The accessor methods make copies of the objects, rather than returning the objects themselves. The runtime provides the right object type with the call to super.clone(), and we cast it to our type. Subclasses should do the same thing, and all these ivars will be taken care of automatically.

Overrides:
clone in class PduElement
Returns:
a clone of this instance
See Also:
Object

serialize

public void serialize(java.io.DataOutputStream outputStream)
Description copied from class: PduElement
Serialize our data out to the stream. Subclasses of us should call super.Serialize() to make sure the superclasse's data is serialized out. The order in which instance variables are serialized is significant. They must be serialized in the same order they appear in the DIS spec. Prints out some information during execution if debugging flag is set.

Specified by:
serialize in interface SerializationInterface
Specified by:
serialize in class PduElement
Parameters:
outputStream - the stream to which this object is serialized
Throws:
java.lang.RuntimeException - when IO error occurs.

deSerialize

public void deSerialize(java.io.DataInputStream pInputStream)
Description copied from class: PduElement
Deserialize our data from the input stream. Subclasses of us should call super.deSerialize to make sure the superclass's data are properly affected. The order in which instance variables are serialized is significant. They must be deSerialized in the same order as they have been serialized as specified by the DIS spec.

Specified by:
deSerialize in interface SerializationInterface
Specified by:
deSerialize in class PduElement
Parameters:
pInputStream - the stream from which this object is initialized
Throws:
java.lang.RuntimeException - when IO error occurs.

length

public int length()
Description copied from class: PduElement
Returns the length of the object when serialized in a stream.

Specified by:
length in class PduElement
Returns:
the length of the object when serialized in a stream

printValues

public void printValues(int indentLevel,
                        java.io.PrintStream printStream)
Description copied from class: PduElement
Prints the generated serialized object for debugging.

Specified by:
printValues in class PduElement
Parameters:
indentLevel - number of spaces to indent for visibility

getX

public double getX()

setX

public void setX(double pX)

getY

public double getY()

setY

public void setY(double pY)

getZ

public double getZ()

setZ

public void setZ(double pZ)