com.c5corp.c5utm
Class UtmImage

java.lang.Object
  extended by java.awt.Image
      extended by java.awt.image.BufferedImage
          extended by com.c5corp.c5utm.UtmImage
All Implemented Interfaces:
java.awt.image.RenderedImage, java.awt.image.WritableRenderedImage, java.awt.Transparency

public class UtmImage
extends java.awt.image.BufferedImage

A java.awt.image.BufferedImage that provides imaging methods for com.c5corp.c5utm.Points objects.

Since:
1.0.3
Author:
Brett Stalbaum copyright 2002-2005

Field Summary
static int LABEL_BEGINNING
          For rendering a track log, indicates a lable should be placed near the first point of the track.
static int LABEL_END
          For rendering a track log, indicates a lable should be placed near the last point of the track.
static int NO_LABEL
          For rendering a track log, indicates no lable should be rendered.
static int RENDER_COLLAR
          A white collar will be rendered only if the constructor UtmImage(Points thePoints, int RenderFlags, boolean render_collar).
static int RENDER_EMPTY_COLLAR
          If this class has this RenderFlags set, it will simply render an empty collar and utm key, but not elevation (Point) data, even if the other flags are set.
static int RENDER_HIGH
          If this class has this RenderFlags set, it will render the highest elevations in the image.
static int RENDER_LOW
          If this class has this RenderFlags set, it will render the lowest elevations in the image.
static int RENDER_MEAN
          If this class has this RenderFlags set, it will render the mean elevations in the image.
static int RENDER_MEDIAN
          If this class has this RenderFlags set, it will render the median elevations in the image.
static int RENDER_MODE
          If this class has this RenderFlags set, it will render the modal elevations in the image.
 
Fields inherited from class java.awt.image.BufferedImage
TYPE_3BYTE_BGR, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE, TYPE_BYTE_BINARY, TYPE_BYTE_GRAY, TYPE_BYTE_INDEXED, TYPE_CUSTOM, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE, TYPE_INT_BGR, TYPE_INT_RGB, TYPE_USHORT_555_RGB, TYPE_USHORT_565_RGB, TYPE_USHORT_GRAY
 
Fields inherited from class java.awt.Image
accelerationPriority, SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
UtmImage(Points thePoints)
          Creates a UtmImage object from a Points object, using default RENDER_PLAIN rendering by calling renderSimple().
UtmImage(Points thePoints, int renderFlags)
          Creates a UtmImage object from a Points object, with the set RenderFlags.
UtmImage(Points thePoints, int renderFlags, boolean renderCollar)
          Creates collared UtmImage object (with a stats legend and UTM tic marks) from a Points object, with the set RenderFlags.
 
Method Summary
 void renderRoute(Route route, java.awt.Color pointColor, java.awt.Color hatchColor, java.awt.Color labelColor, java.awt.Color lineColor, boolean labelPoint, java.sql.Connection connection)
          Draw a Route onto the image
 void renderSimple()
          Performs basic rendering of the Points object passed into the constructor.
 void renderStats()
          Performs statistical rendering of the Points object passed into the constructor.
 void renderTrackLog(TrackLog trackLog, java.awt.Color color, int label, java.sql.Connection connection)
          Draws a data in a TrackLog object onto the image, provided the TrackLog (or part of the track log) is in the area.
 void renderWayPoint(WayPoint wayPoint, java.awt.Color pointColor, java.awt.Color hatchColor, java.awt.Color labelColor, boolean labelPoint, java.sql.Connection connection)
          Draw a WayPoint object onto the image
 void renderWayPointList(WayPointList wayPointList, java.awt.Color pointColor, java.awt.Color hatchColor, java.awt.Color labelColor, boolean labelPoint, java.sql.Connection connection)
          Draw WayPointList (all the WayPoints it Contains) onto the image
 void setRenderFlags(int renderFlags)
          Sets the rendering flags
 void writeImageFile(java.io.File file, java.lang.String formatName)
          Writes a image file from this UtmImage object.
 void writeImageFile(java.lang.String path, java.lang.String filename)
          Writes a .png file from this UtmImage object.
 
Methods inherited from class java.awt.image.BufferedImage
addTileObserver, coerceData, copyData, createGraphics, flush, getAlphaRaster, getCapabilities, getColorModel, getData, getData, getGraphics, getHeight, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getProperty, getPropertyNames, getRaster, getRGB, getRGB, getSampleModel, getSource, getSources, getSubimage, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getTransparency, getType, getWidth, getWidth, getWritableTile, getWritableTileIndices, hasTileWriters, isAlphaPremultiplied, isTileWritable, releaseWritableTile, removeTileObserver, setData, setRGB, setRGB, toString
 
Methods inherited from class java.awt.Image
getAccelerationPriority, getScaledInstance, setAccelerationPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RENDER_HIGH

public static final int RENDER_HIGH
If this class has this RenderFlags set, it will render the highest elevations in the image.

See Also:
Constant Field Values

RENDER_LOW

public static final int RENDER_LOW
If this class has this RenderFlags set, it will render the lowest elevations in the image.

See Also:
Constant Field Values

RENDER_MEAN

public static final int RENDER_MEAN
If this class has this RenderFlags set, it will render the mean elevations in the image.

See Also:
Constant Field Values

RENDER_MEDIAN

public static final int RENDER_MEDIAN
If this class has this RenderFlags set, it will render the median elevations in the image.

See Also:
Constant Field Values

RENDER_MODE

public static final int RENDER_MODE
If this class has this RenderFlags set, it will render the modal elevations in the image.

See Also:
Constant Field Values

RENDER_COLLAR

public static final int RENDER_COLLAR
A white collar will be rendered only if the constructor UtmImage(Points thePoints, int RenderFlags, boolean render_collar).

See Also:
Constant Field Values

RENDER_EMPTY_COLLAR

public static final int RENDER_EMPTY_COLLAR
If this class has this RenderFlags set, it will simply render an empty collar and utm key, but not elevation (Point) data, even if the other flags are set.

See Also:
Constant Field Values

NO_LABEL

public static final int NO_LABEL
For rendering a track log, indicates no lable should be rendered.

See Also:
Constant Field Values

LABEL_BEGINNING

public static final int LABEL_BEGINNING
For rendering a track log, indicates a lable should be placed near the first point of the track.

See Also:
Constant Field Values

LABEL_END

public static final int LABEL_END
For rendering a track log, indicates a lable should be placed near the last point of the track.

See Also:
Constant Field Values
Constructor Detail

UtmImage

public UtmImage(Points thePoints)
Creates a UtmImage object from a Points object, using default RENDER_PLAIN rendering by calling renderSimple().

Parameters:
thePoints - the Points to produce the UtmImage from

UtmImage

public UtmImage(Points thePoints,
                int renderFlags)
Creates a UtmImage object from a Points object, with the set RenderFlags. See the public static final ints in this class for a description of what the various render flags do. Calls renderStats().

Parameters:
thePoints - the Points to produce the UtmImage from
renderFlags - the render flags

UtmImage

public UtmImage(Points thePoints,
                int renderFlags,
                boolean renderCollar)
Creates collared UtmImage object (with a stats legend and UTM tic marks) from a Points object, with the set RenderFlags. See the public static final ints in this class for a description of what the various render flags do. Calls renderStats().

Parameters:
thePoints - the Points to produce the UtmImage from
renderFlags - the render flags
renderCollar - true to render a collar
Method Detail

renderTrackLog

public void renderTrackLog(TrackLog trackLog,
                           java.awt.Color color,
                           int label,
                           java.sql.Connection connection)
Draws a data in a TrackLog object onto the image, provided the TrackLog (or part of the track log) is in the area.

Parameters:
trackLog - the TrackLog to render
color - the Color with which to render the TrackLog
label - an int specifying where to put a track lable
connection - a DB connection
Since:
2.0
See Also:
DbHelper, com.c5corp.c5gps, NO_LABEL, LABEL_BEGINNING, LABEL_END

renderWayPointList

public void renderWayPointList(WayPointList wayPointList,
                               java.awt.Color pointColor,
                               java.awt.Color hatchColor,
                               java.awt.Color labelColor,
                               boolean labelPoint,
                               java.sql.Connection connection)
Draw WayPointList (all the WayPoints it Contains) onto the image

Parameters:
wayPointList - the WayPointList to render
pointColor - the Color with which to render the pixel inside the cross hatch (the point)
hatchColor - the Color with which to render the cross hatch
labelColor - the Color with which to render the label, if labelPoint is true
labelPoint - renders the label (with the WayPoint name) if true
connection - a DB connection
Since:
2.0
See Also:
DbHelper, com.c5corp.c5gps

renderWayPoint

public void renderWayPoint(WayPoint wayPoint,
                           java.awt.Color pointColor,
                           java.awt.Color hatchColor,
                           java.awt.Color labelColor,
                           boolean labelPoint,
                           java.sql.Connection connection)
Draw a WayPoint object onto the image

Parameters:
wayPoint - the WayPoint to render
pointColor - the Color with which to render the pixel inside the cross hatch (the point)
hatchColor - the Color with which to render the cross hatch
labelColor - the Color with which to render the label, if labelPoint is true
labelPoint - renders the label (with the WayPoint name) if true
connection - a DB connection
Since:
2.0
See Also:
DbHelper, com.c5corp.c5gps

renderRoute

public void renderRoute(Route route,
                        java.awt.Color pointColor,
                        java.awt.Color hatchColor,
                        java.awt.Color labelColor,
                        java.awt.Color lineColor,
                        boolean labelPoint,
                        java.sql.Connection connection)
Draw a Route onto the image

Parameters:
route - the Route to render
pointColor - the Color with which to render the pixel inside the cross hatch (the point)
hatchColor - the Color with which to render the cross hatch
labelColor - the Color with which to render the label, if labelPoint is true
lineColor - the Color with which to render the lines
labelPoint - renders the label (with the WayPoint name) if true
connection - a DB connection
Since:
2.0
See Also:
DbHelper, com.c5corp.c5gps

renderSimple

public void renderSimple()
Performs basic rendering of the Points object passed into the constructor. In other words, has the same behavior as if the object is called with RenderFlags equalt to RENDER_PLAIN.


renderStats

public void renderStats()
Performs statistical rendering of the Points object passed into the constructor. I will render statistical info onto the image based on the value of the RenderFlags, which is passed in the constructor. RenderFlags can also be set with setRenderFlags().


setRenderFlags

public void setRenderFlags(int renderFlags)
Sets the rendering flags

Parameters:
renderFlags - the render flags

writeImageFile

public void writeImageFile(java.lang.String path,
                           java.lang.String filename)
Writes a .png file from this UtmImage object. The path and the file name are given in the parameters. Generally, it is good to use File.separator as your file separator. This method automatically adds File.separator between the path and the file name, and adds the .png extension automatically.

Parameters:
path - the path
filename - the filename
See Also:
File

writeImageFile

public void writeImageFile(java.io.File file,
                           java.lang.String formatName)
Writes a image file from this UtmImage object. The File paramter should be formed with an appropriate extension for the formatName, such as ".png". "png", "jpeg" or other file tyes supported by javax.imageio.ImageIO would be used for the formatName parameter.

Parameters:
file - a File object representing the output file
formatName - a javax.imageio.ImageIO informal format name, such as png, jpeg, tiff
See Also:
File, ImageIO