com.moximedia.ows
Class Map

java.lang.Object
  extended bycom.moximedia.ows.Map
All Implemented Interfaces:
java.lang.Cloneable, LayerType, MeasureUnitsType, ScalebarUnitsType, java.io.Serializable, ServiceType

public class Map
extends java.lang.Object
implements ServiceType, LayerType, ScalebarUnitsType, MeasureUnitsType, java.lang.Cloneable, java.io.Serializable

The Map class contains the complete instance of an IMF map session, and modifications to the map layers, etc. that have been done during an application session. If the current state of the map is needed in subsequent pages, this object should be stored in the session object.

Author:
Doug Cates - www.moximedia.com
See Also:
Serialized Form

Field Summary
static int mapid
           
 
Fields inherited from interface com.moximedia.ows.types.ServiceType
SERVICE_TYPE_ACETATE, SERVICE_TYPE_WFS, SERVICE_TYPE_WMS
 
Fields inherited from interface com.moximedia.ows.types.LayerType
LAYER_TYPE_ACETATE, LAYER_TYPE_WFS, LAYER_TYPE_WMS
 
Fields inherited from interface com.moximedia.ows.types.ScalebarUnitsType
SCALEBAR_UNITS_FEET, SCALEBAR_UNITS_FEET_OR_MILES, SCALEBAR_UNITS_KILOMETERS, SCALEBAR_UNITS_METERS, SCALEBAR_UNITS_METERS_OR_KILOMETERS, SCALEBAR_UNITS_MILES, SCALEBAR_UNITS_NONE
 
Fields inherited from interface com.moximedia.ows.types.MeasureUnitsType
MEASURE_UNITS_DECIMAL_DEGREES, MEASURE_UNITS_FEET, MEASURE_UNITS_IMPERIAL, MEASURE_UNITS_METERS, MEASURE_UNITS_METRES, MEASURE_UNITS_METRIC, MEASURE_UNITS_UNKNOWN, MEASURE_UNITS_US, MEASURE_UNITS_YARDS
 
Constructor Summary
Map()
          Creates new Map
Map(java.lang.String outputDir, java.lang.String outputUrlPath)
          Creates new Map
 
Method Summary
 void addHighlightLayer(WmsLayer layer)
          Creates a highlighting acetate layer showing the selected features of the specified layer.
 void addLayer(int index, Layer layer)
          Adds a layer to the map at the specified index.
 void addLayer(Layer layer)
          Adds a layer to the map.
 void addMapScript(java.lang.String scriptName)
          Adds a map script to the map script array.
 void addProjection(Projection prj)
          Adds an available projection definition to the map.
 void addService(WfsService service)
          Adds a WfsService to the map.
 void addService(WmsService service)
          Adds a WmsService to the map.
 java.lang.Object clone()
          Makes a copy of the map object
 void doZoom(double mapX, double mapY, double zoomFactor)
          Changes the extent of the map, leaving the centre point the same.
 java.lang.String getAlertMessage()
          Gets an alert message set by IMF for display when the map redraws.
 Geometry getAreaOfInterest()
          Gets the geometry stored as an area of interest.
 Color getBackgroundColor()
          Gets the background color of the map.
 Projection getCenterCoordinateProjection()
          Gets the projection used to display the map center coordinate.
 java.lang.String getCopyrightOwner()
          Gets the copyright owner, if any.
 Editing getEditing()
          Gets the editing settings for this map.
 Envelope getExtent()
          Gets the current map extent.
 Folders getFolders()
          Gets the Folders associated with the map.
 Envelope getFullExtent()
          Gets the full extent of the map.
 int getHeight()
          Gets the map height, in pixels.
 java.awt.image.BufferedImage getImage()
          Fuses the images received from various services into a single image.
 java.lang.String getImageUrl()
          Fuses the images received from various services into a single image.
 Envelope getInitialExtent()
          Gets the initial extent of the map.
 java.util.HashMap getKnownProjections()
          Gets the HashMap containing the known projections.
 Layers getLayers()
          Gets the layers of the map.
 java.util.Locale getLocale()
          Gets the Locale used for internationalization.
 java.util.ArrayList getMapScripts()
          Gets the map script array, or null if there are not any.
 java.awt.geom.AffineTransform getMapTransform()
          Returns an AffineTransform for use to convert page units to map units.
 int getMapUnits()
          Gets the map units enumerator.
 Envelope getMaximumExtent()
          Gets the maximum extent of the map.
 java.awt.geom.AffineTransform getPageTransform()
          Returns an AffineTransform for use to convert map units to page units.
 Projection getProjection()
          Gets the display projection of the map.
 Projection getProjection(java.lang.String srs)
          Returns the projection with the spedified SRS.
 java.lang.String getProperty(java.lang.String name)
          Gets the value of a property set in the configuration XML using a <PROPERTY> element.
 java.lang.String getSaxParser()
          Gets the name of the class used for parsing XML.
 double getScale()
          Gets the current map scale.
 double getScale(double scaleFactor)
          Gets the scale for the specified scale factor (map units per pixel).
 int getScalebarUnits()
          Gets the scalebar units enumerator.
 double getScaleFactor()
          Gets the scale factor, which is map units per pixel, calculated in the x direction.
 double getScaleFactor(double scale)
          Gets the scale factor (map units per pixel) for the specified scale.
 java.lang.String getSrs()
          Gets the spatial reference system for the map display.
 java.lang.String getTempDir()
          Gets the temporary directory for image streaming.
 java.lang.String getTempUrlPath()
          Gets the temporary url path for image streaming.
 WfsService getWfsService(java.lang.String serviceName)
          Gets the WfsService with the specified name.
 java.util.ArrayList getWfsServices()
          Gets the array of WfsServices contained in this map.
 int getWidth()
          Gets the map width in pixels.
 WmsService getWmsService(int objectId)
          Gets the WmsService with the specified object id.
 WmsService getWmsService(java.lang.String serviceName)
          Gets the WMsService with the specified name.
 java.util.ArrayList getWmsServices()
          Gets the array of WMsServices contained in this map.
 boolean isCenterCoordinateVisible()
          Returns an indicator of whether the map center coordinate should be displayed on the map.
 boolean isCopyrightVisible()
          Returns an indicator of whether the copyright message should be displayed on the map.
 boolean isForwarded()
          Returns an indicator of whether the complete map should be fused from the various WMS servers then forwarded to the user.
 boolean isNorthArrowVisible()
          Returns an indicator of whether the north arrow should be shown.
 boolean isScalebarVisible()
          Returns an indicator of wheter the scalebar should be shown.
 void removeHighlightLayer(WmsLayer layer)
          Removes the highlighting acetate layer associated with the specified layer.
 void removeProperty(java.lang.String name)
          Removes the specified property.
 void setAreaOfInterest(Geometry geometry)
          Sets the geometry to be stored as an area of interest.
 void setBackgroundColor(Color color)
          Sets the background color of the map.
 void setEditing(Editing editing)
          Sets the editing settings for this map.
 void setExtent(Envelope extent)
          Sets the extent of the map to the specified envelope.
 void setFolders(Folders folders)
          Sets the folders associated with this map.
 void setForwarded(boolean forwarded)
          Sets of whether the complete map should be fused from the various WMS servers then forwarded to the user.
 void setFullExtent(Envelope extent)
          Sets the full extent of the map.
 void setInitialExtent(Envelope extent)
          Sets the initial display extent of the map.
 void setLocale(java.util.Locale locale)
          Sets the Locale used for internationalization.
 void setMaximumExtent(Envelope extent)
          Sets the maximum extent of the map.
 void setProjection(Projection projection)
          Sets the projection of the map.
 void setProperty(java.lang.String name, java.lang.String value)
          Sets the value of a property (programmer defined).
 void setSaxParser(java.lang.String className)
          Sets the class name of the SAX parser
 void setScalebarUnits(int units)
          Sets the scalebar units using the scalebar units enumerator.
 void setScalebarUnits(java.lang.String units)
          Sets the scalebar units using a String.
 void setSize(int width, int height)
          Sets the size of the map in pixels.
 void setSrs(java.lang.String srs)
          Sets the spatial reference system for the map display.
 void setTempDir(java.lang.String dir)
          Sets the temporary directory for image streaming.
 void setTempUrlPath(java.lang.String path)
          Sets the temporary path for image streaming.
 void setXmlAttribute(java.lang.String element, java.lang.String name, java.lang.String value)
          Sets one of the attributes of this object using a string value.
 Point toMapPoint(Point pagePoint)
          Gets the map coordinate for the specified page coordinate.
 Point toPagePoint(Point mapPoint)
          Gets the page coordinate for the specified map coordinate.
 void zoomToExtent(double x1, double y1, double x2, double y2)
          Changes the extent of the map to the specified extent.
 void zoomToExtent(Envelope env)
          Changes the extent of the map to the specified extent.
 void zoomToPreviousExtent()
          Sets the map extent to an extent from the previous extent stack, and removes the extent from the stack.
 void zoomToScale(double scale)
          Zooms the map extent to display at the specified scale, centered at the same point as before the extent change.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapid

public static int mapid
Constructor Detail

Map

public Map()
Creates new Map


Map

public Map(java.lang.String outputDir,
           java.lang.String outputUrlPath)
Creates new Map

Parameters:
outputDir - The directory where temporary images are created.
outputUrlPath - The URL path to the temporary directory.
Method Detail

getAreaOfInterest

public Geometry getAreaOfInterest()
Gets the geometry stored as an area of interest.

Returns:
The geometry, or null if no geometry is set.

setAreaOfInterest

public void setAreaOfInterest(Geometry geometry)
Sets the geometry to be stored as an area of interest.

Parameters:
geometry - The geometry, or null to clear the geometry.

getBackgroundColor

public Color getBackgroundColor()
Gets the background color of the map.

Returns:
The color.

setBackgroundColor

public void setBackgroundColor(Color color)
Sets the background color of the map.

Parameters:
color - The background color.

getEditing

public Editing getEditing()
Gets the editing settings for this map.

Returns:
The editing settings object.

setEditing

public void setEditing(Editing editing)
Sets the editing settings for this map.

Parameters:
editing - The editing settings object.

addHighlightLayer

public void addHighlightLayer(WmsLayer layer)
Creates a highlighting acetate layer showing the selected features of the specified layer.

Parameters:
layer - The layer to create highlighting for.

removeHighlightLayer

public void removeHighlightLayer(WmsLayer layer)
Removes the highlighting acetate layer associated with the specified layer.

Parameters:
layer - The layer to remove highlighting for.

addMapScript

public void addMapScript(java.lang.String scriptName)
Adds a map script to the map script array.

Parameters:
scriptName - The file name of the map script. Must be in the IMF directory or a subdirectory.

getMapScripts

public java.util.ArrayList getMapScripts()
Gets the map script array, or null if there are not any.

Returns:
The array of startup script file names.

getProperty

public java.lang.String getProperty(java.lang.String name)
Gets the value of a property set in the configuration XML using a <PROPERTY> element.

Parameters:
name - The property name
Returns:
The property value, or null.

removeProperty

public void removeProperty(java.lang.String name)
Removes the specified property.

Parameters:
name - The name of the property.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Sets the value of a property (programmer defined).

Parameters:
name - The property name
value - The property value.

getTempDir

public java.lang.String getTempDir()
Gets the temporary directory for image streaming.

Returns:
The name of the temporary directory, or null if one isn't defined.

setTempDir

public void setTempDir(java.lang.String dir)
Sets the temporary directory for image streaming.

Parameters:
dir - The name of the temporary directory.

getTempUrlPath

public java.lang.String getTempUrlPath()
Gets the temporary url path for image streaming.

Returns:
The name of the temporary path, or null if one isn't defined.

setTempUrlPath

public void setTempUrlPath(java.lang.String path)
Sets the temporary path for image streaming.

Parameters:
path - The name of the temporary path.

isForwarded

public boolean isForwarded()
Returns an indicator of whether the complete map should be fused from the various WMS servers then forwarded to the user.

Returns:
True if forwarding is set, otherwise false.

setForwarded

public void setForwarded(boolean forwarded)
Sets of whether the complete map should be fused from the various WMS servers then forwarded to the user.

Parameters:
forwarded - True if forwarding should be used, otherwise false.

getLocale

public java.util.Locale getLocale()
Gets the Locale used for internationalization.

Returns:
The locale object.

setLocale

public void setLocale(java.util.Locale locale)
Sets the Locale used for internationalization.

Parameters:
locale - The locale object.

addProjection

public void addProjection(Projection prj)
Adds an available projection definition to the map.

Parameters:
prj - The projection to add.

getKnownProjections

public java.util.HashMap getKnownProjections()
Gets the HashMap containing the known projections.

Returns:
the HashMap.

getProjection

public Projection getProjection(java.lang.String srs)
Returns the projection with the spedified SRS.

Parameters:
srs - The spatial reference system code.
Returns:
The projection, or null if a matching projection is not found.

getImage

public java.awt.image.BufferedImage getImage()
Fuses the images received from various services into a single image.

Returns:
The image as a BufferedImage object.

getImageUrl

public java.lang.String getImageUrl()
Fuses the images received from various services into a single image.

Returns:
The URL to the image.

clone

public java.lang.Object clone()
Makes a copy of the map object

Returns:
The copy.

addLayer

public void addLayer(int index,
                     Layer layer)
Adds a layer to the map at the specified index.

Parameters:
index - The position for the layer. 0 is drawn first.
layer - The layer.

addLayer

public void addLayer(Layer layer)
Adds a layer to the map.

Parameters:
layer - The layer.

getSaxParser

public java.lang.String getSaxParser()
Gets the name of the class used for parsing XML.

Returns:
The name of the class used for parsing XML.

setSaxParser

public void setSaxParser(java.lang.String className)
Sets the class name of the SAX parser

Parameters:
className - The class name of the SAX parser.

addService

public void addService(WfsService service)
Adds a WfsService to the map.

Parameters:
service - The service.

addService

public void addService(WmsService service)
Adds a WmsService to the map.

Parameters:
service - The service.

doZoom

public void doZoom(double mapX,
                   double mapY,
                   double zoomFactor)
Changes the extent of the map, leaving the centre point the same. If the zoomFactor is less than 1.0, the map will zoom in, otherwise it will zoom out. For example, a zoomFactor of 2.0 will zoom out 2 times, a zoom factor of 0.5 will zoom in 2 times, and a zoomFactor of 1.0 will not zoom at all.

Parameters:
mapX - The map centre x coordinate.
mapY - The map centre y coordinate.
zoomFactor - A number that determines the relative scale for the map.

getAlertMessage

public java.lang.String getAlertMessage()
Gets an alert message set by IMF for display when the map redraws.

Returns:
The message.

getCopyrightOwner

public java.lang.String getCopyrightOwner()
Gets the copyright owner, if any.

Returns:
The copyright owner.

getExtent

public Envelope getExtent()
Gets the current map extent.

Returns:
The extent in an Envelope object.

getFolders

public Folders getFolders()
Gets the Folders associated with the map. The folders object contains a list of Folder objects which contain map layers. The folders are usually initialized from an XML file.

Returns:
The Folders object for the map.

getFullExtent

public Envelope getFullExtent()
Gets the full extent of the map.

Returns:
The extent in an Envelope object.

getHeight

public int getHeight()
Gets the map height, in pixels.

Returns:
The map height, in pixels.

getInitialExtent

public Envelope getInitialExtent()
Gets the initial extent of the map.

Returns:
The extent in an Envelope object.

getLayers

public Layers getLayers()
Gets the layers of the map.

Returns:
The layers object.

getMapTransform

public java.awt.geom.AffineTransform getMapTransform()
Returns an AffineTransform for use to convert page units to map units.

Returns:
An AffineTransform for use to convert page units to map units.

getPageTransform

public java.awt.geom.AffineTransform getPageTransform()
Returns an AffineTransform for use to convert map units to page units.

Returns:
An AffineTransform for use to convert map units to page units.

getMapUnits

public int getMapUnits()
Gets the map units enumerator.

Returns:
The map units enumerator value.

getMaximumExtent

public Envelope getMaximumExtent()
Gets the maximum extent of the map.

Returns:
The extent in an Envelope object.

setMaximumExtent

public void setMaximumExtent(Envelope extent)
Sets the maximum extent of the map.

Parameters:
extent - The extent in an Envelope object.

getProjection

public Projection getProjection()
Gets the display projection of the map.

Returns:
The projection.

getWfsServices

public java.util.ArrayList getWfsServices()
Gets the array of WfsServices contained in this map.

Returns:
The services array.

getWfsService

public WfsService getWfsService(java.lang.String serviceName)
Gets the WfsService with the specified name.

Parameters:
serviceName - The service name.
Returns:
The related WfsService, or null if no service found with the specified name.

getWmsServices

public java.util.ArrayList getWmsServices()
Gets the array of WMsServices contained in this map.

Returns:
The services array.

getWmsService

public WmsService getWmsService(int objectId)
Gets the WmsService with the specified object id.

Parameters:
objectId - The id of the service
Returns:
The related WMsService, or null if no service found with the specified id.

getWmsService

public WmsService getWmsService(java.lang.String serviceName)
Gets the WMsService with the specified name.

Parameters:
serviceName - The service name.
Returns:
The related WMsService, or null if no service found with the specified name.

getWidth

public int getWidth()
Gets the map width in pixels.

Returns:
The map width in pixels.

getCenterCoordinateProjection

public Projection getCenterCoordinateProjection()
Gets the projection used to display the map center coordinate.

Returns:
The projection.

isCenterCoordinateVisible

public boolean isCenterCoordinateVisible()
Returns an indicator of whether the map center coordinate should be displayed on the map.

Returns:
True if the map center coordinate is displayed, otherwise false.

isCopyrightVisible

public boolean isCopyrightVisible()
Returns an indicator of whether the copyright message should be displayed on the map.

Returns:
True if the map center coordinate is displayed, otherwise false.

isNorthArrowVisible

public boolean isNorthArrowVisible()
Returns an indicator of whether the north arrow should be shown.

Returns:
True if the north arrow should be shown, otherwise false.

setExtent

public void setExtent(Envelope extent)
Sets the extent of the map to the specified envelope. The envelope may be re-aspected if necessary.

Parameters:
extent - The extent in an Envelope object.

setFolders

public void setFolders(Folders folders)
Sets the folders associated with this map.

Parameters:
folders - The folders.

setFullExtent

public void setFullExtent(Envelope extent)
Sets the full extent of the map.

Parameters:
extent - The extent in an Envelope object.

setInitialExtent

public void setInitialExtent(Envelope extent)
Sets the initial display extent of the map.

Parameters:
extent - The extent in an Envelope object.

setProjection

public void setProjection(Projection projection)
Sets the projection of the map. Does not set the SRS.

Parameters:
projection - The projection.

getScale

public double getScale()
Gets the current map scale.

Returns:
The map scale as a number.

getScale

public double getScale(double scaleFactor)
Gets the scale for the specified scale factor (map units per pixel).

Parameters:
scaleFactor - Map units per pixel.
Returns:
The map scale as a number.

getScaleFactor

public double getScaleFactor()
Gets the scale factor, which is map units per pixel, calculated in the x direction.

Returns:
The scale factor.

getScaleFactor

public double getScaleFactor(double scale)
Gets the scale factor (map units per pixel) for the specified scale.

Parameters:
scale - The scale.
Returns:
The calculated scale factor.

isScalebarVisible

public boolean isScalebarVisible()
Returns an indicator of wheter the scalebar should be shown.

Returns:
True unless scalebar units is SCALEBAR_UNITS_NONE.

getScalebarUnits

public int getScalebarUnits()
Gets the scalebar units enumerator.

Returns:
The units enumerator, see com.moximedia.ows.types.ScalebarUnitsType.

setScalebarUnits

public void setScalebarUnits(int units)
Sets the scalebar units using the scalebar units enumerator.

Parameters:
units - The units enumerator, see com.moximedia.ows.types.ScalebarUnitsType.

setScalebarUnits

public void setScalebarUnits(java.lang.String units)
Sets the scalebar units using a String.

Parameters:
units - The units string.

setSize

public void setSize(int width,
                    int height)
Sets the size of the map in pixels.

Parameters:
width - The map width in pixels.
height - The map height in pixels.

getSrs

public java.lang.String getSrs()
Gets the spatial reference system for the map display.

Returns:
The SRS code.

setSrs

public void setSrs(java.lang.String srs)
Sets the spatial reference system for the map display. Does not set the projection.

Parameters:
srs - The SRS code.

toMapPoint

public Point toMapPoint(Point pagePoint)
Gets the map coordinate for the specified page coordinate.

Parameters:
pagePoint - The page coordinate.
Returns:
The map coordinate.

toPagePoint

public Point toPagePoint(Point mapPoint)
Gets the page coordinate for the specified map coordinate.

Parameters:
mapPoint - The map coordinate.
Returns:
The page coordinate.

zoomToExtent

public void zoomToExtent(Envelope env)
Changes the extent of the map to the specified extent.

Parameters:
env - The extent, in an Envelope object.

zoomToExtent

public void zoomToExtent(double x1,
                         double y1,
                         double x2,
                         double y2)
Changes the extent of the map to the specified extent.

Parameters:
x1 - The minimum x value.
y1 - The minimum y value.
x2 - The maximum x value.
y2 - The maximum y value.

zoomToPreviousExtent

public void zoomToPreviousExtent()
Sets the map extent to an extent from the previous extent stack, and removes the extent from the stack.


zoomToScale

public void zoomToScale(double scale)
Zooms the map extent to display at the specified scale, centered at the same point as before the extent change.

Parameters:
scale - The scale as a number. For 1:10000, use 10000.

setXmlAttribute

public void setXmlAttribute(java.lang.String element,
                            java.lang.String name,
                            java.lang.String value)
Sets one of the attributes of this object using a string value. This method should only be called from the SAX event handler.

Parameters:
element - The XML element tag containing this attribute.
name - The XML attribute name.
value - The XML attribute value.


Internet Mapping Framework for OpenGIS Java Object Model API (v1.3.007)
Copyright © 2005 Moxi Media Inc. and Province of British Columbia. All Rights Reserved.