ebgeo.maprequest
Class MapService

java.lang.Object
  extended byebgeo.maprequest.MapService
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
ArcIMSMapService, WMSMapService

public abstract class MapService
extends Object
implements Comparable

The super class for map services.


Field Summary
protected  String addText
          Text to add to the bottom of a map.
protected  MRCoordinateSystem cs
          The coordinate system for this map.
protected  Locale locale
          The locale of the map (used for getAddText()).
protected  boolean supportsPanning
          True if this map supports panning.
protected  boolean supportsZooming
          True if this map supports zooming.
 
Constructor Summary
MapService()
          Creates a new instance of MapService
MapService(Properties props)
          Construct a map service from some properties.
 
Method Summary
abstract  void buildUpMap(BufferedImage image, String tempDirectory, Component parentComponent, BoundedRangeModel progress, MainWindow main)
          Create a map image for the requested map.
 int compareTo(Object o)
           
abstract  boolean configure()
          Instruct the service that it should configure itself for its map.
 int extractDegrees(double degrees)
          Extract the whole number of degrees from a floating point amount.
 double extractMinutes(double degrees)
          Extract the number of minutes from a floating point amount of degrees.
 String getAddText()
          Get the text to add to the bottom of a map, with special characters replaced by appropriatly formatted date/time symbols.
abstract  String getCountry()
          Get the country that this map is from.
 MRCoordinateSystem getCs()
          Get the coordinate system for this map.
abstract  String getDriverDescription()
          Get the description of this driver.
abstract  int getImageHeight()
          Get the height of the map image.
abstract  int getImageWidth()
          Get the width of the map image.
abstract  double getInitialMaxX()
          Get the suggested initial maximum X value for this map.
abstract  double getInitialMaxY()
          Get the suggested initial maximum Y value for this map.
abstract  double getInitialMinX()
          Get the suggested initial minimum X value for this map.
abstract  double getInitialMinY()
          Get the suggested initial minimum Y value for this map.
abstract  Vector getLayers()
          Get the list of layers to display.
 Locale getLocale()
          Get the locale for this map.
abstract  String getMapDescription()
          Get the description of the map.
abstract  MapImageParameters getMapImageParameters()
          Get the area of map and size to draw.
abstract  String getMapInfoURL()
          Get a URL giving information about the map and/or web site.
abstract  double getMaxXExtent()
          Get the maximum valid X value for this map.
abstract  double getMaxYExtent()
          Get the maximum valid Y value for this map.
abstract  double getMinXExtent()
          Get the minimum valid X value for this map.
abstract  double getMinYExtent()
          Get the minimum valid Y value for this map.
abstract  String getState()
          Get the state or province that this map is from.
abstract  boolean isConfigured()
          Check if this service has been configured for the map.
 boolean isSupportsPanning()
          Check if this map supports panning.
 boolean isSupportsZooming()
          Check if this map supports zooming.
protected  void setAddText(String addText)
          Set the text to add to the bottom of a map.
 void setCs(MRCoordinateSystem cs)
          Set the coordinate system for this map.
 void setCs(String datum, String projection)
          Set the coordinate system for this map.
abstract  void setLayers(Vector layers)
          Set the list of layers to display.
protected  void setLocale(Locale locale)
          Setter for property locale.
abstract  void setMapImageParameters(MapImageParameters imageParams)
          Set the area of map and size to draw.
protected  void setSupportsPanning(boolean supportsPanning)
          Setter for property supportsPanning.
protected  void setSupportsZooming(boolean supportsZooming)
          Setter for property supportsZooming.
abstract  void stopBuildUpMap()
          If this object is currently building up a map (because buildUpMap(BufferedImage,String,Component,BoundedRangeModel,MainWindow) was called) then calling this method instructs the map service to stop building up a map.
abstract  MapImageParameters validateMapImageParameters(MapImageParameters params)
          Check that the map image parameters are valid for this map.
 boolean writeImage(BufferedImage imageOut, String outputDirectory, String outputFilename)
          Write the map image to a file.
 boolean writeMapFile(String directory, String imageFilename, String mapFilename)
          Deprecated. Use writeMapFile("oziexplorer",directory,imageFilename,mapFilename) instead.
 boolean writeMapFile(String system, String directory, String imageFilename, String mapFilename)
          Write a calibration file for an external GIS system.
protected  boolean writeOziMapFile(String directory, String imageFilename, String mapFilename)
          Write a calibration file for the current image suitable for Ozi Explorer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cs

protected MRCoordinateSystem cs
The coordinate system for this map.


supportsPanning

protected boolean supportsPanning
True if this map supports panning.


supportsZooming

protected boolean supportsZooming
True if this map supports zooming.


locale

protected Locale locale
The locale of the map (used for getAddText()).


addText

protected String addText
Text to add to the bottom of a map.

Constructor Detail

MapService

public MapService()
Creates a new instance of MapService


MapService

public MapService(Properties props)
Construct a map service from some properties. This is the normal way the system constructs a map service.

Parameters:
props - The properties for this service.
Method Detail

getDriverDescription

public abstract String getDriverDescription()
Get the description of this driver.

Returns:
Returns the description of this driver.

getMapDescription

public abstract String getMapDescription()
Get the description of the map. Some drivers may be able to be used for different maps, so this method identifies the map that the driver is being used for.


getMapInfoURL

public abstract String getMapInfoURL()
Get a URL giving information about the map and/or web site.


isConfigured

public abstract boolean isConfigured()
Check if this service has been configured for the map.


configure

public abstract boolean configure()
Instruct the service that it should configure itself for its map. The service returns true if it suceeded in configuring itself, or false if not.


getLayers

public abstract Vector getLayers()
Get the list of layers to display.


setLayers

public abstract void setLayers(Vector layers)
Set the list of layers to display.


getMinXExtent

public abstract double getMinXExtent()
Get the minimum valid X value for this map.


getMinYExtent

public abstract double getMinYExtent()
Get the minimum valid Y value for this map.


getMaxXExtent

public abstract double getMaxXExtent()
Get the maximum valid X value for this map.


getMaxYExtent

public abstract double getMaxYExtent()
Get the maximum valid Y value for this map.


getInitialMinX

public abstract double getInitialMinX()
Get the suggested initial minimum X value for this map.


getInitialMaxX

public abstract double getInitialMaxX()
Get the suggested initial maximum X value for this map.


getInitialMinY

public abstract double getInitialMinY()
Get the suggested initial minimum Y value for this map.


getInitialMaxY

public abstract double getInitialMaxY()
Get the suggested initial maximum Y value for this map.


validateMapImageParameters

public abstract MapImageParameters validateMapImageParameters(MapImageParameters params)
Check that the map image parameters are valid for this map.

Parameters:
params - The requested map image parameters.
Returns:
Returns the closest possible valid map image parameters to the parameters requested.

buildUpMap

public abstract void buildUpMap(BufferedImage image,
                                String tempDirectory,
                                Component parentComponent,
                                BoundedRangeModel progress,
                                MainWindow main)
Create a map image for the requested map. When finished, this method should call MainWindow.mapDone(), or MainWindow.mapFailed(String) if there was an error.

Parameters:
image - The image to draw the map on.
tempDirectory - A temporary directory that can be used to write temporary files to.
parentComponent - A component to send repaint() requests to as each map segment is made available.
progress - A progress bar to update.
main - The main window. When the map has been requested, MainWindow.mapDone() is called.

stopBuildUpMap

public abstract void stopBuildUpMap()
If this object is currently building up a map (because buildUpMap(BufferedImage,String,Component,BoundedRangeModel,MainWindow) was called) then calling this method instructs the map service to stop building up a map.


getCountry

public abstract String getCountry()
Get the country that this map is from. Returns an empty string if this map is from more than one country.


getState

public abstract String getState()
Get the state or province that this map is from. Returns an empty string if this map is from more than one state or province, or if this map is not from any state or province.


getImageWidth

public abstract int getImageWidth()
Get the width of the map image.


getImageHeight

public abstract int getImageHeight()
Get the height of the map image.


setMapImageParameters

public abstract void setMapImageParameters(MapImageParameters imageParams)
Set the area of map and size to draw.


getMapImageParameters

public abstract MapImageParameters getMapImageParameters()
Get the area of map and size to draw.


writeImage

public boolean writeImage(BufferedImage imageOut,
                          String outputDirectory,
                          String outputFilename)
Write the map image to a file.


extractDegrees

public int extractDegrees(double degrees)
Extract the whole number of degrees from a floating point amount.

Returns:
Returns the absolute whole number of degrees. e.g. -30.2 returns 30. 45.1 returns 45.

extractMinutes

public double extractMinutes(double degrees)
Extract the number of minutes from a floating point amount of degrees.

Returns:
Returns only the fractional amount of degrees expressed as a floating point amount of minutes. e.g. -30.5 degrees will return 30.0 minutes.

writeMapFile

public boolean writeMapFile(String system,
                            String directory,
                            String imageFilename,
                            String mapFilename)
Write a calibration file for an external GIS system.

Parameters:
system - The system to write the calibration file to. At present only "oziexplorer" is supported.
directory - The directory to write the file to.
imageFilename - The file name of the associated map image.
mapFilename - The name of the file to write the calibration information to.

writeMapFile

public boolean writeMapFile(String directory,
                            String imageFilename,
                            String mapFilename)
Deprecated. Use writeMapFile("oziexplorer",directory,imageFilename,mapFilename) instead.

Write a calibration file for the current image suitable for Ozi Explorer.


writeOziMapFile

protected boolean writeOziMapFile(String directory,
                                  String imageFilename,
                                  String mapFilename)
Write a calibration file for the current image suitable for Ozi Explorer.


compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getCs

public MRCoordinateSystem getCs()
Get the coordinate system for this map.

Returns:
Returns the coordinate system.

setCs

public void setCs(MRCoordinateSystem cs)
Set the coordinate system for this map.

Parameters:
cs - The new value for the coordinate system.

setCs

public void setCs(String datum,
                  String projection)
Set the coordinate system for this map.

Parameters:
datum - The name of a datum on which the coordinate system is based.
projection - The name of a projection which the coordinate system uses.

isSupportsPanning

public boolean isSupportsPanning()
Check if this map supports panning.

Returns:
Returns true if this map supports panning, or false otherwise.

setSupportsPanning

protected void setSupportsPanning(boolean supportsPanning)
Setter for property supportsPanning.

Parameters:
supportsPanning - New value of property supportsPanning.

isSupportsZooming

public boolean isSupportsZooming()
Check if this map supports zooming.

Returns:
Returns true if this map supports zooming, or false otherwise.

setSupportsZooming

protected void setSupportsZooming(boolean supportsZooming)
Setter for property supportsZooming.

Parameters:
supportsZooming - New value of property supportsZooming.

getLocale

public Locale getLocale()
Get the locale for this map. This is used for any required text formatting.


setLocale

protected void setLocale(Locale locale)
Setter for property locale.

Parameters:
locale - New value of property locale.

getAddText

public String getAddText()
Get the text to add to the bottom of a map, with special characters replaced by appropriatly formatted date/time symbols.

Returns:
Returns the text to add, or null if no text is to be added.
See Also:
StringUtils.formatStringForDateTime(String,Locale)

setAddText

protected void setAddText(String addText)
Set the text to add to the bottom of a map.

Parameters:
addText - The text to add, or null if no text is to be added.