|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.kolls.railworld.RailSegment
net.kolls.railworld.segment.TrackSegment
net.kolls.railworld.segment.EESegment
public class EESegment
Entrance/Exit segment. Connected to a long, invisible segment which allows trains to smoothly enter and exit the map.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.kolls.railworld.segment.TrackSegment |
|---|
TrackSegment.TSEP |
| Field Summary | |
|---|---|
HiddenSegment |
HES
The hidden segment that trains exit on to. |
java.lang.String |
label
The description of this segment. |
| Fields inherited from class net.kolls.railworld.segment.TrackSegment |
|---|
cap, coords, POINT_BEGIN, POINT_END, railBedStroke, railStroke |
| Fields inherited from class net.kolls.railworld.RailSegment |
|---|
dests, ec, MOUSE_NEAR, pts, RAIL_BED_WIDTH, RAIL_WIDTH, trains |
| Constructor Summary | |
|---|---|
EESegment(RailSegment bg,
RailSegment en,
java.awt.geom.Line2D crds,
java.lang.String lbl)
Construct an entry/exit segment |
|
| Method Summary | |
|---|---|
SegmentEditPoint |
createSEP(int ptIdx,
RailSegment anchor)
Given a point index in the pts array and possibly a railsegment to attach, return a segmenteditpoint if such attachment is possible. |
RailSegment |
dest(RailSegment source)
Each rail segment must at the very least tell us where it comes from and where it goes, currently. |
void |
draw(int z,
java.awt.Graphics2D gc)
Draw the segment. |
javax.swing.JPanel |
editPanel()
You are guaranteed that the variable RailSegment.ec will be set prior to this call. |
java.awt.geom.Point2D |
getPoint(RailSegment start,
double myPos)
|
boolean |
isDynamic()
Dynamic segments receive additional events while the game is running; non-dynamic segments are only asked to draw z levels 1 and 2 at draw static time. |
java.lang.String |
mouseOver(java.awt.geom.Point2D pos)
Whenever a user mouses over the canvas, all dynamic segments receive this event. |
void |
recomp()
Called when changes are made; recompute or update any associated values. |
boolean |
singleton()
Singleton segments may only have one train in them at a time. |
| Methods inherited from class net.kolls.railworld.segment.TrackSegment |
|---|
canErase, getCoords, length, setCap |
| Methods inherited from class net.kolls.railworld.RailSegment |
|---|
carHidden, click, destNZ, enter, getDest, getDests, getPoint, getPoints, nearEditPoint, pixelStep, setDest, setPoint, step, trains, update, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String label
public HiddenSegment HES
| Constructor Detail |
|---|
public EESegment(RailSegment bg,
RailSegment en,
java.awt.geom.Line2D crds,
java.lang.String lbl)
bg - Begin segmenten - end segmentcrds - Line coordslbl - Text| Method Detail |
|---|
public void recomp()
RailSegment
recomp in class TrackSegmentpublic boolean singleton()
RailSegment
singleton in class RailSegmentpublic boolean isDynamic()
RailSegment
isDynamic in class RailSegmentdraw events
and click events.RailSegment.draw(int, Graphics2D),
RailSegment.click(Point2D, RailCanvas)public java.lang.String mouseOver(java.awt.geom.Point2D pos)
RailSegment
mouseOver in class TrackSegmentpos - The mouse position
RailSegment.isDynamic()public RailSegment dest(RailSegment source)
RailSegment
dest in class TrackSegmentsource - The rail segment of origin
null if there is none.
public java.awt.geom.Point2D getPoint(RailSegment start,
double myPos)
getPoint in class TrackSegmentstart - The segment of originmyPos - Percentage (0-1) along the segment
Point2D indicating the actual point that location represents
public void draw(int z,
java.awt.Graphics2D gc)
RailSegment
draw in class TrackSegmentz - The currently z-layer to drawgc - A Graphics2D graphics context.RailSegment.isDynamic()public javax.swing.JPanel editPanel()
RailSegmentRailSegment.ec will be set prior to this call.
So if you need to refresh the canvas or make any changes to it, you can use
that variable.
editPanel in class TrackSegmentJPanel to display in the sidebar to edit this segment's properties. Please keep width at 200 pixels top.
public SegmentEditPoint createSEP(int ptIdx,
RailSegment anchor)
RailSegment
createSEP in class TrackSegmentptIdx - The index into the pts array.anchor - The segment that desires to attach. (Note: do not attach the segment
automatically; it will be called through the anchor method in the edit point).
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||