aim4.map.track
Class LineTrack

java.lang.Object
  extended by aim4.map.track.LineTrack
All Implemented Interfaces:
Track

public class LineTrack
extends Object
implements Track

A track segment that is a straight line


Nested Class Summary
 class LineTrack.Position
          A position on this track.
 
Constructor Summary
LineTrack(WayPoint p1, WayPoint p2)
          Create a track segment that is a straight line
 
Method Summary
 WayPoint getEndWayPoint()
          Get the ending waypoint of the track segment.
 double getLength()
          Get the length of the track.
 TrackPosition getPosition(double dist)
          Get the position on the track that is a given distance from the starting waypoint.
 Shape getShape()
          Get the shape of the track segment
 WayPoint getStartWayPoint()
          Get the starting waypoint of the track segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineTrack

public LineTrack(WayPoint p1,
                 WayPoint p2)
Create a track segment that is a straight line

Parameters:
p1 - the starting point
p2 - the ending point
Method Detail

getStartWayPoint

public WayPoint getStartWayPoint()
Get the starting waypoint of the track segment.

Specified by:
getStartWayPoint in interface Track
Returns:
the starting waypoint

getEndWayPoint

public WayPoint getEndWayPoint()
Get the ending waypoint of the track segment.

Specified by:
getEndWayPoint in interface Track
Returns:
the ending waypoint

getLength

public double getLength()
Get the length of the track.

Specified by:
getLength in interface Track
Returns:
the length of the track.

getPosition

public TrackPosition getPosition(double dist)
Get the position on the track that is a given distance from the starting waypoint. It returns null if the position is off the track (i.e., beyond the ending waypoint.)

Specified by:
getPosition in interface Track
Parameters:
dist - the distance from the starting waypoint; null if the distance is longer than the length of the track.

getShape

public Shape getShape()
Get the shape of the track segment

Specified by:
getShape in interface Track
Returns:
the shape of the track segment


Copyright © 2011. All Rights Reserved.