ebgeo.maprequest
Class ArcIMSMapService

java.lang.Object
  extended byebgeo.maprequest.MapService
      extended byebgeo.maprequest.ArcIMSMapService
All Implemented Interfaces:
Comparable

public class ArcIMSMapService
extends MapService

A MapService that talks to ArcIMS based web sites.


Nested Class Summary
 class ArcIMSMapService.MapDownloaderThread
           
 
Field Summary
protected  int addTextHeight
           
protected  String baseURL
           
protected  HttpClient client
           
protected  String datum
           
protected  boolean generateSegmentsRandomly
           
protected  String imageFormat
           
protected  String infoURL
           
protected  double initialMaxX
           
protected  double initialMaxY
           
protected  double initialMinX
           
protected  double initialMinY
           
protected  Vector layers
           
protected  int mapDelay
           
protected  String mapDescription
           
protected  int maxHeight
           
protected  int maxWidth
           
protected  double maxXExtent
           
protected  double maxYExtent
           
protected  int minHeight
           
protected  int minWidth
           
protected  double minXExtent
           
protected  double minYExtent
           
protected  double oziAdjustEasting
           
protected  double oziAdjustNorthing
           
protected  String projection
           
protected  String refererURL
           
protected  String requestURL
           
 
Fields inherited from class ebgeo.maprequest.MapService
addText, cs, locale, supportsPanning, supportsZooming
 
Constructor Summary
ArcIMSMapService(Properties props)
          Creates a new instance of MapRequest
 
Method Summary
protected  HttpMethodBase buildRequest(String xml)
           
 void buildUpMap(BufferedImage image, String tempDirectory, Component parentComponent, BoundedRangeModel progress, MainWindow main)
          Build up a map by requesting an appropriate number of smaller maps appropriate for this service.
 boolean configure()
          Instruct the service that it should configure itself for its map.
protected  boolean configureCookies()
           
protected  Vector createSegments(MapImageParameters params, Graphics2D graphics)
           
protected  boolean deleteSegments(String outputDirectory, Vector segments)
           
protected  boolean downloadImage(String url, String outputDirectory, String filename)
           
protected  boolean extractCapabilities()
           
 String extractXML(String response)
          Extract the XML reply component from the ArcWeb response.
 String getCountry()
          Get the country that this map is from.
protected  Vector getDefaultLayers()
           
 String getDriverDescription()
          Get the description of this driver.
protected  String getImageFormat()
           
 int getImageHeight()
          Get the height of the map image.
 int getImageWidth()
          Get the width of the map image.
 double getInitialMaxX()
          Get the suggested initial maximum X value for this map.
 double getInitialMaxY()
          Get the suggested initial maximum Y value for this map.
 double getInitialMinX()
          Get the suggested initial minimum X value for this map.
 double getInitialMinY()
          Get the suggested initial minimum Y value for this map.
 Vector getLayers()
          Get the list of layers to display.
protected  int getMapDelay()
          Get the number of seconds to sleep between map image requests.
 String getMapDescription()
          Get the description of the map.
 MapImageParameters getMapImageParameters()
          Get the area of map and size to draw.
 String getMapInfoURL()
          Get a URL giving information about the map and/or web site.
protected  int getMaxHeight()
          Get the maximum height that can be requested from this service.
protected  int getMaxWidth()
          Get the maximum width that can be requested from this service.
 double getMaxXExtent()
          Get the maximum valid X value for this map.
 double getMaxYExtent()
          Get the maximum valid Y value for this map.
 double getMinXExtent()
          Get the minimum valid X value for this map.
 double getMinYExtent()
          Get the minimum valid Y value for this map.
 String getState()
          Get the state or province that this map is from.
 boolean isConfigured()
          Check if this service has been configured for the map.
protected  boolean isGenerateSegmentsRandomly()
          Check if map segments (where a map needs multiple segments) should be generated in a ramdom order.
protected  boolean renderAddText(Graphics2D graphics)
           
protected  boolean renderSegment(MapSegment segment, Graphics2D graphics, String tempDirectory)
           
protected  boolean requestMap(double minx, double miny, double maxx, double maxy, int width, int height, String outputDirectory, String filename)
           
protected  String sendRequest(HttpMethodBase request)
           
 void setLayers(Vector layers)
          Set the list of layers to display.
 void setMapImageParameters(MapImageParameters imageParams)
          Set the area of map and size to draw.
 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.
 MapImageParameters validateMapImageParameters(MapImageParameters params)
          Check that the map image parameters are valid for this map.
 
Methods inherited from class ebgeo.maprequest.MapService
compareTo, extractDegrees, extractMinutes, getAddText, getCs, getLocale, isSupportsPanning, isSupportsZooming, setAddText, setCs, setCs, setLocale, setSupportsPanning, setSupportsZooming, writeImage, writeMapFile, writeMapFile, writeOziMapFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapDescription

protected String mapDescription

projection

protected String projection

datum

protected String datum

oziAdjustNorthing

protected double oziAdjustNorthing

oziAdjustEasting

protected double oziAdjustEasting

baseURL

protected String baseURL

infoURL

protected String infoURL

requestURL

protected String requestURL

refererURL

protected String refererURL

mapDelay

protected int mapDelay

imageFormat

protected String imageFormat

generateSegmentsRandomly

protected boolean generateSegmentsRandomly

minXExtent

protected double minXExtent

minYExtent

protected double minYExtent

maxXExtent

protected double maxXExtent

maxYExtent

protected double maxYExtent

initialMinX

protected double initialMinX

initialMaxX

protected double initialMaxX

initialMinY

protected double initialMinY

initialMaxY

protected double initialMaxY

layers

protected Vector layers

addTextHeight

protected int addTextHeight

maxWidth

protected int maxWidth

maxHeight

protected int maxHeight

minWidth

protected int minWidth

minHeight

protected int minHeight

client

protected HttpClient client
Constructor Detail

ArcIMSMapService

public ArcIMSMapService(Properties props)
Creates a new instance of MapRequest

Method Detail

getDriverDescription

public String getDriverDescription()
Description copied from class: MapService
Get the description of this driver.

Specified by:
getDriverDescription in class MapService
Returns:
Returns the description of this driver.

getLayers

public Vector getLayers()
Description copied from class: MapService
Get the list of layers to display.

Specified by:
getLayers in class MapService

extractXML

public String extractXML(String response)
Extract the XML reply component from the ArcWeb response.

Parameters:
response - The response from the web server.
Returns:
Returns only the XML reply component of the response.

buildRequest

protected HttpMethodBase buildRequest(String xml)

extractCapabilities

protected boolean extractCapabilities()

getMaxWidth

protected int getMaxWidth()
Get the maximum width that can be requested from this service.


getMaxHeight

protected int getMaxHeight()
Get the maximum height that can be requested from this service.


getMapDelay

protected int getMapDelay()
Get the number of seconds to sleep between map image requests.


getImageFormat

protected String getImageFormat()

isGenerateSegmentsRandomly

protected boolean isGenerateSegmentsRandomly()
Check if map segments (where a map needs multiple segments) should be generated in a ramdom order.

Returns:
Returns true if the segments should be generated in a random order, or false if they can be generated sequentially.

sendRequest

protected String sendRequest(HttpMethodBase request)

getDefaultLayers

protected Vector getDefaultLayers()

requestMap

protected boolean requestMap(double minx,
                             double miny,
                             double maxx,
                             double maxy,
                             int width,
                             int height,
                             String outputDirectory,
                             String filename)

downloadImage

protected boolean downloadImage(String url,
                                String outputDirectory,
                                String filename)

configureCookies

protected boolean configureCookies()

createSegments

protected Vector createSegments(MapImageParameters params,
                                Graphics2D graphics)

deleteSegments

protected boolean deleteSegments(String outputDirectory,
                                 Vector segments)

renderAddText

protected boolean renderAddText(Graphics2D graphics)

renderSegment

protected boolean renderSegment(MapSegment segment,
                                Graphics2D graphics,
                                String tempDirectory)

buildUpMap

public void buildUpMap(BufferedImage image,
                       String tempDirectory,
                       Component parentComponent,
                       BoundedRangeModel progress,
                       MainWindow main)
Build up a map by requesting an appropriate number of smaller maps appropriate for this service.

Specified by:
buildUpMap in class MapService
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 void stopBuildUpMap()
Description copied from class: MapService
If this object is currently building up a map (because MapService.buildUpMap(BufferedImage,String,Component,BoundedRangeModel,MainWindow) was called) then calling this method instructs the map service to stop building up a map.

Specified by:
stopBuildUpMap in class MapService

getMapDescription

public String getMapDescription()
Description copied from class: MapService
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.

Specified by:
getMapDescription in class MapService

configure

public boolean configure()
Description copied from class: MapService
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.

Specified by:
configure in class MapService

isConfigured

public boolean isConfigured()
Description copied from class: MapService
Check if this service has been configured for the map.

Specified by:
isConfigured in class MapService

setLayers

public void setLayers(Vector layers)
Description copied from class: MapService
Set the list of layers to display.

Specified by:
setLayers in class MapService

getInitialMinY

public double getInitialMinY()
Description copied from class: MapService
Get the suggested initial minimum Y value for this map.

Specified by:
getInitialMinY in class MapService

getInitialMaxY

public double getInitialMaxY()
Description copied from class: MapService
Get the suggested initial maximum Y value for this map.

Specified by:
getInitialMaxY in class MapService

getInitialMinX

public double getInitialMinX()
Description copied from class: MapService
Get the suggested initial minimum X value for this map.

Specified by:
getInitialMinX in class MapService

getInitialMaxX

public double getInitialMaxX()
Description copied from class: MapService
Get the suggested initial maximum X value for this map.

Specified by:
getInitialMaxX in class MapService

getMaxXExtent

public double getMaxXExtent()
Description copied from class: MapService
Get the maximum valid X value for this map.

Specified by:
getMaxXExtent in class MapService

getMaxYExtent

public double getMaxYExtent()
Description copied from class: MapService
Get the maximum valid Y value for this map.

Specified by:
getMaxYExtent in class MapService

getMinXExtent

public double getMinXExtent()
Description copied from class: MapService
Get the minimum valid X value for this map.

Specified by:
getMinXExtent in class MapService

getMinYExtent

public double getMinYExtent()
Description copied from class: MapService
Get the minimum valid Y value for this map.

Specified by:
getMinYExtent in class MapService

validateMapImageParameters

public MapImageParameters validateMapImageParameters(MapImageParameters params)
Description copied from class: MapService
Check that the map image parameters are valid for this map.

Specified by:
validateMapImageParameters in class MapService
Parameters:
params - The requested map image parameters.
Returns:
Returns the closest possible valid map image parameters to the parameters requested.

getCountry

public String getCountry()
Description copied from class: MapService
Get the country that this map is from. Returns an empty string if this map is from more than one country.

Specified by:
getCountry in class MapService

getState

public String getState()
Description copied from class: MapService
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.

Specified by:
getState in class MapService

getImageHeight

public int getImageHeight()
Description copied from class: MapService
Get the height of the map image.

Specified by:
getImageHeight in class MapService

getImageWidth

public int getImageWidth()
Description copied from class: MapService
Get the width of the map image.

Specified by:
getImageWidth in class MapService

setMapImageParameters

public void setMapImageParameters(MapImageParameters imageParams)
Description copied from class: MapService
Set the area of map and size to draw.

Specified by:
setMapImageParameters in class MapService

getMapImageParameters

public MapImageParameters getMapImageParameters()
Description copied from class: MapService
Get the area of map and size to draw.

Specified by:
getMapImageParameters in class MapService

getMapInfoURL

public String getMapInfoURL()
Description copied from class: MapService
Get a URL giving information about the map and/or web site.

Specified by:
getMapInfoURL in class MapService