schmitzm.geotools.gui
Class GridPanelFormatter

java.lang.Object
  extended by schmitzm.geotools.gui.GridPanelFormatter
Direct Known Subclasses:
GridPanelFormatter_DHDN, GridPanelFormatter_LatLon1

public abstract class GridPanelFormatter
extends Object

This class defines how the GridPanel shows the coordinate grid and the coordinates.

Author:
Martin Schmitz

Field Summary
protected  CoordinateReferenceSystem crs
          CRS the formatter is created for.
static Class<? extends GridPanelFormatter>[] FORMATTERS
           
protected static ResourceProvider RESOURCE
           
 
Constructor Summary
GridPanelFormatter(CoordinateReferenceSystem crs)
          Creates a new formatter.
 
Method Summary
abstract  double determineGridDistance(GridPanel panel, double mapMinCoord, double mapMaxCoord, int panelSize)
          Determines a "fitting" fragmentation for the grid.
abstract  String formatCoordinate(GridPanel panel, double coord)
          Formats a coordinate for the grid CRS.
 CoordinateReferenceSystem getCRS()
          Returns the CRS the formatter can format.
 Font getFont()
           
static GridPanelFormatter getFormatterByID(String ID)
           
 int getHeightForHorizontal(GridPanel panel)
          Returns the default height for a horizontal Grid
abstract  String getId()
          A String ID that can be used to identify a Formatter-class.
abstract  String getTitle()
          A human readable title
 String getTooltip()
          Returns a tooltip String to applied to the GridPanels.
abstract  int getWidthForVertical(GridPanel panel)
          Returns the default width for a vertical Grid
 void setCRS(CoordinateReferenceSystem crs)
          Returns the CRS the formatter can format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMATTERS

public static final Class<? extends GridPanelFormatter>[] FORMATTERS

RESOURCE

protected static ResourceProvider RESOURCE

crs

protected CoordinateReferenceSystem crs
CRS the formatter is created for.

Constructor Detail

GridPanelFormatter

public GridPanelFormatter(CoordinateReferenceSystem crs)
Creates a new formatter.

Parameters:
crs - the CRS the formatter can format
Method Detail

getFormatterByID

public static GridPanelFormatter getFormatterByID(String ID)

determineGridDistance

public abstract double determineGridDistance(GridPanel panel,
                                             double mapMinCoord,
                                             double mapMaxCoord,
                                             int panelSize)
Determines a "fitting" fragmentation for the grid.

Parameters:
gridPanel - indicates (amongst others) the grid orientation
mapMinCoord - minimal coordinate to show in the grid (in the grid CRS)
mapMaxCoord - maximal coordinate to show in the grid (in the grid CRS)
panelSize - size of the grid panel in pixels

formatCoordinate

public abstract String formatCoordinate(GridPanel panel,
                                        double coord)
Formats a coordinate for the grid CRS.

Parameters:
coord - the coordinate
gridPanel - indicates (amongst others) the grid orientation
Returns:

getCRS

public CoordinateReferenceSystem getCRS()
Returns the CRS the formatter can format.


getFont

public Font getFont()

getHeightForHorizontal

public int getHeightForHorizontal(GridPanel panel)
Returns the default height for a horizontal Grid


getId

public abstract String getId()
A String ID that can be used to identify a Formatter-class. Take care, that the string is compatible with XML and doesn't containg freaky chars.


getTitle

public abstract String getTitle()
A human readable title


getWidthForVertical

public abstract int getWidthForVertical(GridPanel panel)
Returns the default width for a vertical Grid


setCRS

public void setCRS(CoordinateReferenceSystem crs)
Returns the CRS the formatter can format.


getTooltip

public String getTooltip()
Returns a tooltip String to applied to the GridPanels. May be null