net.kolls.railworld.segment
Class Crossing

java.lang.Object
  extended by net.kolls.railworld.RailSegment
      extended by net.kolls.railworld.segment.TrackSegment
          extended by net.kolls.railworld.segment.Crossing

public class Crossing
extends TrackSegment

At-grade crossing. Plays crossing sound when train is present or on adjacent segment.

Author:
Steve Kollmansberger

Nested Class Summary
 
Nested classes/interfaces inherited from class net.kolls.railworld.segment.TrackSegment
TrackSegment.TSEP
 
Field Summary
 
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
Crossing(RailSegment bg, RailSegment en, java.awt.geom.Line2D crds)
          Create a crossing.
 
Method Summary
 void draw(int z, java.awt.Graphics2D gc)
          Draw the segment.
 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.
 
Methods inherited from class net.kolls.railworld.segment.TrackSegment
canErase, createSEP, dest, editPanel, getCoords, getPoint, length, mouseOver, recomp, setCap
 
Methods inherited from class net.kolls.railworld.RailSegment
carHidden, click, destNZ, enter, getDest, getDests, getPoint, getPoints, 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
 

Constructor Detail

Crossing

public Crossing(RailSegment bg,
                RailSegment en,
                java.awt.geom.Line2D crds)
Create a crossing.

Parameters:
bg - Begin segment
en - End segment
crds - Line coords.
Method Detail

draw

public void draw(int z,
                 java.awt.Graphics2D gc)
Description copied from class: RailSegment
Draw the segment. Segments have several z-layers to allowed slightly overlaping pieces to still look nice. z = 1 is a static layer (lowest) z = 2 is a static layer (highest) z = 3 is reserved z = 4 is the dynamic layer. This is redrawn frequently, if requested by the segment.

Overrides:
draw in class TrackSegment
Parameters:
z - The currently z-layer to draw
gc - A Graphics2D graphics context.
See Also:
RailSegment.isDynamic()

isDynamic

public boolean isDynamic()
Description copied from class: RailSegment
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. Defaults to false (not dynamic). Non-dynamic segments also may not receive notifications for various events.

Overrides:
isDynamic in class RailSegment
Returns:
Indicates if the segment should receive z=4 draw events and click events.
See Also:
RailSegment.draw(int, Graphics2D), RailSegment.click(Point2D, RailCanvas)