us.zuercher.gpx2map.plotter
Class ImageMarkerStyle

java.lang.Object
  extended by us.zuercher.gpx2map.plotter.ImageMarkerStyle
All Implemented Interfaces:
MarkerStyle

public class ImageMarkerStyle
extends Object
implements MarkerStyle

ImageMarkerStyle implements MarkerStyle to provide markers based on the contents of an image file. Images are loaded via CompositeImageFactory. Supported formats are therefore the formats supported by that factory.

Author:
Stephan Zuercher

Field Summary
private  boolean hasAlpha
          Flag indicating whether image data has alpha channel or not.
private  int height
          Image height.
private  File imageFile
          Image file.
private  int[][][] rasterLines
          Image raster line data.
private  int width
          Image width.
 
Constructor Summary
ImageMarkerStyle(File imageFile)
          Constructs a new ImageMarkerStyle from the given image location.
 
Method Summary
 int getHeight()
          Returns the marker's height.
 String getName()
          Returns this ImageMarkerStyle's name.
 AbstractShape getShape(Point center, int radius, Color color)
          Returns a ImageShape based on the contents of the image file given during construction.
 int getWidth()
          Returns the marker's width.
 boolean hasConstantDimensions()
          Returns true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageFile

private final File imageFile
Image file.


width

private final int width
Image width.


height

private final int height
Image height.


hasAlpha

private final boolean hasAlpha
Flag indicating whether image data has alpha channel or not.


rasterLines

private final int[][][] rasterLines
Image raster line data.

Constructor Detail

ImageMarkerStyle

public ImageMarkerStyle(File imageFile)
                 throws IOException
Constructs a new ImageMarkerStyle from the given image location.

Parameters:
imageFile - location of an image file
Throws:
IOException - if there's an error reading the image file.
Method Detail

getName

public String getName()
Returns this ImageMarkerStyle's name. The marker style's name is based on the image file's location.

Specified by:
getName in interface MarkerStyle
Returns:
this ImageMarkerStyle's name.

hasConstantDimensions

public boolean hasConstantDimensions()
Returns true.

Specified by:
hasConstantDimensions in interface MarkerStyle
Returns:
true
See Also:
MarkerStyle.hasConstantDimensions()

getHeight

public int getHeight()
Returns the marker's height.

Specified by:
getHeight in interface MarkerStyle
Returns:
the marker's height.
See Also:
MarkerStyle.getHeight()

getWidth

public int getWidth()
Returns the marker's width.

Specified by:
getWidth in interface MarkerStyle
Returns:
the marker's width.
See Also:
MarkerStyle.getWidth()

getShape

public AbstractShape getShape(Point center,
                              int radius,
                              Color color)
Returns a ImageShape based on the contents of the image file given during construction.

Specified by:
getShape in interface MarkerStyle
Parameters:
center - center point of the marker shape
radius - size of the marker shape (see above)
color - marker color
Returns:
a ImageShape
See Also:
MarkerStyle.getShape(Point, int, Color)