|
||||||||||
| 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.Curve
public class Curve
A curved track segment represented using a cubic curve. The system finds sub-lines using a flatness of 5.
| Nested Class Summary | |
|---|---|
class |
Curve.CSEP
Edit point for setting up cubic curves |
| Field Summary | |
|---|---|
protected java.awt.geom.QuadCurve2D |
cc
The curve itself |
protected Distance |
len
Length of this curve, as calculated by sub lines |
protected double[] |
lens
The length of each subline |
static int |
POINT_BEGIN
Line begin point |
static int |
POINT_CP1
Control point 1 |
static int |
POINT_END
Line end point |
protected java.awt.Stroke |
railBedStroke
The rail bed pen |
protected java.awt.Stroke |
railStroke
The rail line pen |
protected java.awt.geom.Point2D[] |
seq
The sequence of points in the sublines |
| Fields inherited from class net.kolls.railworld.RailSegment |
|---|
dests, ec, MOUSE_NEAR, pts, RAIL_BED_WIDTH, RAIL_WIDTH, trains |
| Constructor Summary | |
|---|---|
Curve(RailSegment bg,
RailSegment en,
java.awt.geom.QuadCurve2D crds)
Create a new curve segment. |
|
| Method Summary | |
|---|---|
boolean |
canErase()
Can this segment be erased? In some cases, other segments must be erased first. |
protected SegmentEditPoint |
createSEP(int ptIdx,
RailSegment attach)
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)
|
Distance |
length()
all segments have a length can be 0 for signals, etc. |
void |
recomp()
Called when changes are made; recompute or update any associated values. |
| Methods inherited from class net.kolls.railworld.RailSegment |
|---|
carHidden, click, destNZ, enter, getDest, getDests, getPoint, getPoints, isDynamic, mouseOver, nearEditPoint, pixelStep, setDest, setPoint, singleton, step, trains, update, update |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.awt.geom.QuadCurve2D cc
public static final int POINT_BEGIN
public static final int POINT_END
public static final int POINT_CP1
protected Distance len
protected java.awt.geom.Point2D[] seq
protected double[] lens
protected java.awt.Stroke railBedStroke
protected java.awt.Stroke railStroke
| Constructor Detail |
|---|
public Curve(RailSegment bg,
RailSegment en,
java.awt.geom.QuadCurve2D crds)
TrackSegments.
bg - Beginning rail segmenten - Ending rail segmentcrds - Curve| Method Detail |
|---|
public boolean canErase()
RailSegment
canErase in class RailSegment
protected SegmentEditPoint createSEP(int ptIdx,
RailSegment attach)
RailSegment
createSEP in class RailSegmentptIdx - The index into the pts array.attach - 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.public RailSegment dest(RailSegment source)
RailSegment
dest in class RailSegmentsource - The rail segment of origin
null if there is none.
public void draw(int z,
java.awt.Graphics2D gc)
RailSegment
draw in class RailSegmentz - 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 RailSegmentJPanel to display in the sidebar to edit this segment's properties. Please keep width at 200 pixels top.
public java.awt.geom.Point2D getPoint(RailSegment start,
double myPos)
getPoint in class RailSegmentstart - The segment of originmyPos - Percentage (0-1) along the segment
Point2D indicating the actual point that location representspublic Distance length()
RailSegment
length in class RailSegmentDistance of the segment.public void recomp()
RailSegment
recomp in class RailSegment
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||