jfreerails.client.renderer
Class StationBoxRenderer

java.lang.Object
  extended by jfreerails.client.renderer.StationBoxRenderer
All Implemented Interfaces:
Painter

public class StationBoxRenderer
extends java.lang.Object
implements Painter

Renders box showing the cargo waiting at a station.

Author:
Luke

Field Summary
private  java.awt.Color bgColor
           
private static int MAX_WIDTH
           
private  ModelRoot modelRoot
           
private static int SPACING
           
private  RenderersRoot vl
           
private  ReadOnlyWorld w
           
private static int WAGON_IMAGE_HEIGHT
           
private  int wagonImageWidth
           
 
Constructor Summary
StationBoxRenderer(ReadOnlyWorld world, RenderersRoot vl, ModelRoot modelRoot)
           
 
Method Summary
private  int[] calculateCarLoads(ImmutableCargoBundle cb, int category)
          The length of the returned array is the number of complete carloads of the specified cargo category in the specified bundle.
 void paint(java.awt.Graphics2D g)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WAGON_IMAGE_HEIGHT

private static final int WAGON_IMAGE_HEIGHT
See Also:
Constant Field Values

SPACING

private static final int SPACING
See Also:
Constant Field Values

MAX_WIDTH

private static final int MAX_WIDTH
See Also:
Constant Field Values

w

private final ReadOnlyWorld w

bgColor

private final java.awt.Color bgColor

vl

private final RenderersRoot vl

wagonImageWidth

private final int wagonImageWidth

modelRoot

private final ModelRoot modelRoot
Constructor Detail

StationBoxRenderer

public StationBoxRenderer(ReadOnlyWorld world,
                          RenderersRoot vl,
                          ModelRoot modelRoot)
Method Detail

paint

public void paint(java.awt.Graphics2D g)
Specified by:
paint in interface Painter

calculateCarLoads

private int[] calculateCarLoads(ImmutableCargoBundle cb,
                                int category)
The length of the returned array is the number of complete carloads of the specified cargo category in the specified bundle. The values in the array are the type of the cargo. E.g. if the bundle contained 2 carloads of cargo type 3 and 1 of type 7, {3, 3, 7} would be returned.