us.zuercher.gpx2map.plotter
Class TrackPlotter

java.lang.Object
  extended by us.zuercher.gpx2map.plotter.AbstractPlotter
      extended by us.zuercher.gpx2map.plotter.AbstractTextPlotter
          extended by us.zuercher.gpx2map.plotter.WayPointPlotter
              extended by us.zuercher.gpx2map.plotter.TrackPlotter

public class TrackPlotter
extends WayPointPlotter

TrackPlotter extends WayPointPlotter to plot lines between track- and route-points.

Author:
Stephan Zuercher

Field Summary
private static int INITIAL_LINE_Z_ORDERING
          Initial Z-ordering for track and route lines.
private static int INITIAL_TRKPT_Z_ORDERING
          Initial Z-ordering for track- and route-points.
 
Fields inherited from class us.zuercher.gpx2map.plotter.AbstractTextPlotter
DEFAULT_FONT_NAME, DEFAULT_FONT_SIZE
 
Constructor Summary
TrackPlotter(File netpbmFile, MapSource mapSource)
          Constructs a new TrackPlotter for the given Netpbm file generated by the given MapSource.
 
Method Summary
 void add(Route route, Color color, MarkerStyle style, int styleRadius, boolean drawLines, boolean drawLabel)
          Adds a Route to the plotter.
 void add(Track track, Color color, MarkerStyle style, int styleRadius, boolean drawLines, boolean drawLabel)
          Adds a Track to the plotter.
 void add(TrackSegment trackSegment, Color color, MarkerStyle style, int styleRadius, boolean drawLines)
          Adds a TrackSegment to the plotter.
private  double computeMinLineLength(MarkerStyle style, int styleRadius)
          Computes the minimum line length to draw between two markers of a given style.
 
Methods inherited from class us.zuercher.gpx2map.plotter.WayPointPlotter
add, add, computeDistance
 
Methods inherited from class us.zuercher.gpx2map.plotter.AbstractTextPlotter
drawLabel, execute, setFontName, setFontSize
 
Methods inherited from class us.zuercher.gpx2map.plotter.AbstractPlotter
addLine, addShape, getCroppingRectangle, mapLocationToPixel, setCropping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_TRKPT_Z_ORDERING

private static final int INITIAL_TRKPT_Z_ORDERING
Initial Z-ordering for track- and route-points. They are drawn above track and route lines, but below text and way-points. Within the set of all track- and route-points, earlier points are rendered above later ones.

See Also:
Constant Field Values

INITIAL_LINE_Z_ORDERING

private static final int INITIAL_LINE_Z_ORDERING
Initial Z-ordering for track and route lines. Track and route lines are drawn below all other plotter shapes. Within the set of all lines, earlier lines are rendered above later ones.

See Also:
Constant Field Values
Constructor Detail

TrackPlotter

public TrackPlotter(File netpbmFile,
                    MapSource mapSource)
Constructs a new TrackPlotter for the given Netpbm file generated by the given MapSource.

Parameters:
netpbmFile - the Netpbm file to plot on
mapSource - the MapSource that generated the Netpbm file.
Method Detail

add

public void add(Track track,
                Color color,
                MarkerStyle style,
                int styleRadius,
                boolean drawLines,
                boolean drawLabel)
Adds a Track to the plotter. All track segments are automatically joined together by joining the last track-point in a segment with the first track-point of the following segment.

Parameters:
track - the track to add
color - the color to draw track lines and markers
style - the style to use for drawing track markers
styleRadius - the size of the track markers, if applicable
drawLines - if true, draws lines between the track-points
drawLabel - if true, labels the first track-point in the Track with the track's name

add

public void add(TrackSegment trackSegment,
                Color color,
                MarkerStyle style,
                int styleRadius,
                boolean drawLines)
Adds a TrackSegment to the plotter.

Parameters:
trackSegment - the track segment to add
color - the color to draw track lines and markers
style - the style to use for drawing track markers
styleRadius - the size of the track markers, if applicable
drawLines - if true, draws lines between the track-points

add

public void add(Route route,
                Color color,
                MarkerStyle style,
                int styleRadius,
                boolean drawLines,
                boolean drawLabel)
Adds a Route to the plotter.

Parameters:
route - the route to add
color - the color to draw route lines and markers
style - the style to use for drawing route markers
styleRadius - the size of the route markers, if applicable
drawLines - if true, draws lines between the route-points
drawLabel - if true, labels the first route-point in the Route with the route's name

computeMinLineLength

private double computeMinLineLength(MarkerStyle style,
                                    int styleRadius)
Computes the minimum line length to draw between two markers of a given style. Line shorter than this value will be completely obscured by the markers and therefore are not drawn.

Parameters:
style - the marker style to compute a minimum line length for
styleRadius - the style size, if applicable
Returns:
the minimum line length to draw between two markers of the given style.