|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.kolls.railworld.CLoc
public class CLoc
The CLoc class pinpoints a location and direction within the map (on a track). Locations are represented using three pieces: The rail segment, the originating rail segment, and the percentage from the originating rail segment. For example, say segment A is 50 feet long, connecting at one end to segment B and at the other end to segment C. If the current segment is A, the originating segment is B, and the percentage is 0.75, the we are on segment A, heading toward segment C, currently at 37.5 feet into segment A.
| Field Summary | |
|---|---|
RailSegment |
orig
The origin RailSegment. |
double |
per
Percentage (0-1) through the segment. |
RailSegment |
r
The current RailSegment. |
| Constructor Summary | |
|---|---|
CLoc()
Constructs a CLoc will all null values. |
|
CLoc(RailSegment cur,
RailSegment start,
double p)
Constructs a CLoc given the three essentials. |
|
| Method Summary | |
|---|---|
java.awt.geom.Point2D |
getPoint()
Returns an absolute point for this location. |
CLoc |
reverse()
Returns the same position with opposite directionality. |
DLoc |
segFwd(Distance len)
Moves forward in the direction of travel a given distance. |
DLoc |
segFwd(Distance len,
Car myC,
Train myT)
Moves forward in the direction of travel a given distance, and generate rendering information for a given Train and/or Car. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public RailSegment r
RailSegment. The position is somewhere on this segment.
public RailSegment orig
RailSegment. This is where we came from. This provides
directionality to the location.
public double per
| Constructor Detail |
|---|
public CLoc(RailSegment cur,
RailSegment start,
double p)
cur - Current RailSegmentstart - The RailSegment we came from (originating segment)p - The percentage through the current segment we are.public CLoc()
| Method Detail |
|---|
public CLoc reverse()
public java.awt.geom.Point2D getPoint()
Point2D for this location.public DLoc segFwd(Distance len)
len - A Distance representing how far to move. The distance may exceed the current segment.
DLoc representing the new location.
public DLoc segFwd(Distance len,
Car myC,
Train myT)
Train and/or Car. This method generates the lines which will be drawn to render cars
in a Train. Note that lines will not be rendered for hidden segments, and cars will not be curved.
This method also registers the train and car with the segments and vice versa.
len - A Distance representing how far to move. The distance may exceed the current segment.myC - A Car for tracking segments. May be null.myT - A Train for tracking segments and recordings enters. May be null
DLoc representing the new location, and including rendering information.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||