org.opengts.war.tools
Class MapProviderAdapter

java.lang.Object
  extended by org.opengts.war.tools.MapProviderAdapter
All Implemented Interfaces:
MapProvider
Direct Known Subclasses:
JSMap

public abstract class MapProviderAdapter
extends java.lang.Object
implements MapProvider


Field Summary
 
Fields inherited from interface org.opengts.war.tools.MapProvider
DEFAULT_LATITUDE, DEFAULT_LONGITUDE, FEATURE_CENTER_ON_LAST, FEATURE_CORRIDORS, FEATURE_DETAIL_INFO_BOX, FEATURE_DETAIL_REPORT, FEATURE_DISTANCE_RULER, FEATURE_GEOZONES, FEATURE_LATLON_DISPLAY, FEATURE_REPLAY_POINTS, ID_DETAIL_CONTROL, ID_DETAIL_TABLE, ID_DISTANCE_DISPLAY, ID_LAT_LON_DISPLAY, ID_LATEST_BATTERY, ID_LATEST_EVENT_DATE, ID_LATEST_EVENT_TIME, ID_LATEST_EVENT_TMZ, ID_MESSAGE_TEXT, ID_ZONE_LATITUDE_, ID_ZONE_LONGITUDE_, ID_ZONE_RADIUS_M, MAP_HEIGHT, MAP_WIDTH, PROP_auto_count_device, PROP_auto_count_fleet, PROP_auto_enable_device, PROP_auto_enable_fleet, PROP_auto_interval_device, PROP_auto_interval_fleet, PROP_auto_onload_device, PROP_auto_onload_fleet, PROP_combineSpeedHeading, PROP_default_latitude, PROP_default_longitude, PROP_default_zoom, PROP_detail_showSatCount, PROP_iconSel_fleet, PROP_iconSel_fleet_legend, PROP_iconSelector, PROP_iconSelector_legend, PROP_info_inclBlankAddress, PROP_info_inclBlankOptFields, PROP_info_showAltitude, PROP_info_showOptionalFields, PROP_info_showSpeed, PROP_javascript_inline, PROP_javascript_src, PROP_map_fillFrame, PROP_map_height, PROP_map_includeGeozones, PROP_map_maxCreationAge, PROP_map_minProximity, PROP_map_pushpins, PROP_map_routeLine, PROP_map_routeLine_arrows, PROP_map_routeLine_color, PROP_map_routeLine_snapToRoad, PROP_map_view, PROP_map_width, PROP_maxPushpins_device, PROP_maxPushpins_fleet, PROP_maxPushpins_report, PROP_pushpin_zoom, PROP_replay_enable, PROP_replay_interval, PROP_replay_singlePushpin, PROP_scrollWheelZoom, PROP_zone_map_corridor, PROP_zone_map_height, PROP_zone_map_multipoint, PROP_zone_map_polygon, PROP_zone_map_width, ZONE_HEIGHT, ZONE_WIDTH
 
Constructor Summary
MapProviderAdapter(java.lang.String name, java.lang.String key)
          Constructor
MapProviderAdapter(java.lang.String name, java.lang.String key, long featureMask)
          Constructor
 
Method Summary
 java.lang.String _getIconLegendHtml(java.lang.String legendXml, RequestProperties reqState, boolean outputHtml)
           
 void addSupportedFeature(long feature)
          Adds the specified feature to the list of supported map features
 java.lang.String getAuthorization()
          Gets this MapProvider's authorization key
 long getAutoUpdateCount(boolean isFleet)
          Gets the auto-update count for this MapProvider
 boolean getAutoUpdateEnabled(boolean isFleet)
          Gets the auto-update enabled state for this MapProvider
 long getAutoUpdateInterval(boolean isFleet)
          Gets the auto-update interval for this MapProvider
 boolean getAutoUpdateOnLoad(boolean isFleet)
          Gets the auto-update 'OnLoad' state for this MapProvider
 java.lang.String[] getCorridorInstructions(java.util.Locale loc)
          Returns the localized GeoCorridor instructions
 GeoPoint getDefaultCenter(GeoPoint dft)
          Gets the default center GeoPoint (when no other points are displayed)
 double getDefaultZoom(double dft, boolean withPushpins)
          Gets the default zoom/scale level for this MapProvider
 int getDefaultZoom(int dft, boolean withPushpins)
          Gets the default zoom/scale level for this MapProvider
 MapDimension getDimension()
          Gets this MapProvider's frame dimension
 java.lang.String[] getGeozoneInstructions(int type, java.util.Locale loc)
          Returns instructions for manipulating a Geozone
 int getGeozoneSupportedPointCount(int type)
          Returns the number of supported points for the specified Geozone type
 int getHeight()
          Gets the MapProvider's frame height
static java.lang.String GetIconLegendHtml(java.lang.String refName, java.util.Locale locale, OrderedMap<java.lang.String,PushpinIcon> pushpinMap, java.lang.String legendType, org.w3c.dom.Element legendElem, boolean outputHtml)
           
 java.lang.String getIconSelector(boolean isFleet)
          Gets this MapProvider's icon selector
 java.lang.String getIconSelector(RequestProperties reqState)
          Gets this MapProvider's icon selector
 java.lang.String getIconSelectorLegend(boolean isFleet)
          Gets this MapProvider's icon selector legend html
 java.lang.String getIconSelectorLegend(RequestProperties reqState)
          Gets this MapProvider's icon selector legend html
protected  java.lang.String getMapCellStyle(RequestProperties reqState, MapDimension mapDim)
          Returns the style attributes for the displayed map cell
abstract  java.lang.String getMapID()
          Returns the 'id' of the html tag block contain the map image
 long getMaxPushpins(RequestProperties reqState)
          Returns the maximum number of allowed pushpins on the map
 java.lang.String getName()
          Gets this MapProvider's name
 RTProperties getProperties()
          Gets this MapProvider's properties
 OrderedMap<java.lang.String,PushpinIcon> getPushpinIconMap(RequestProperties reqState)
          Returns the PushpinIcon map
 boolean getReplayEnabled()
          Gets the replay enabled state for this MapProvider
 long getReplayInterval()
          Gets the replay interval for this MapProvider (in milliseconds)
 boolean getReplaySinglePushpin()
          Returns true if only a single pushpin is to be displayed at a time during replay
 int getWidth()
          Gets the MapProvider's frame width
 MapDimension getZoneDimension()
          Gets this MapProvider's frame dimension for the Geozone map
 int getZoneHeight()
          Gets the MapProvider's frame height
 int getZoneWidth()
          Gets the MapProvider's frame width
static java.lang.String ID_ZONE_LATITUDE(int ndx)
           
static java.lang.String ID_ZONE_LONGITUDE(int ndx)
           
 boolean isFeatureSupported(long feature)
          Returns true if the specified map feature is supported
 void postInit()
          Called after initialization of this MapProvider.
 void setIconSelector(boolean isFleet, java.lang.String iconSel)
          Sets this MapProvider's icon selector
 void setIconSelectorLegend(boolean isFleet, java.lang.String legend)
          Sets this MapProvider's icon selector legend html
 void setProperties(java.lang.String props)
          Sets this MapProvider's properties
 void setProperty(java.lang.String key, java.lang.String val)
          Adds a property key/value to this MapProvider
 void setSupportedFeatures(long featureMask)
          Sets the supported map features
 java.lang.String toString()
          Returns a String representation of this instance
 boolean validate()
          Performs simple validation checks on the authorization key, etc, and returns true is the validation was successful.
abstract  void writeJavaScript(java.io.PrintWriter out, RequestProperties state)
          Writes any required JavaScript to the html stream
 void writeMapCell(java.io.PrintWriter out, RequestProperties reqState, MapDimension mapDim)
          Writes the map table view to the http output stream
protected  void writeMapUpdate_precheck(RequestProperties reqState)
          Allows the subclass MapProvider to adjust the session state prior to displaying the map
 void writeMapUpdate(int mapDataFormat, RequestProperties reqState)
          Writes the events in XML/JSON format to the http output stream.
 void writeMapUpdate(java.io.PrintWriter out, int indentLevel, int mapDataFormat, boolean isTopLevelTag, RequestProperties reqState)
          Writes the events in XML/JSON format to the http output stream.
 void writeStyle(java.io.PrintWriter out, RequestProperties reqState)
          Writes any required CSS to the specified PrintWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapProviderAdapter

public MapProviderAdapter(java.lang.String name,
                          java.lang.String key)
Constructor

Parameters:
name - This MapProvider name
key - This MapProvider key

MapProviderAdapter

public MapProviderAdapter(java.lang.String name,
                          java.lang.String key,
                          long featureMask)
Constructor

Parameters:
name - This MapProvider name
key - This MapProvider key
Method Detail

ID_ZONE_LATITUDE

public static java.lang.String ID_ZONE_LATITUDE(int ndx)

ID_ZONE_LONGITUDE

public static java.lang.String ID_ZONE_LONGITUDE(int ndx)

postInit

public void postInit()
Called after initialization of this MapProvider. This allows the MapProvider to perform any required initialization after all attributes have been set


setSupportedFeatures

public void setSupportedFeatures(long featureMask)
Sets the supported map features

Parameters:
featureMask - The mask containing the supported features

addSupportedFeature

public void addSupportedFeature(long feature)
Adds the specified feature to the list of supported map features

Parameters:
feature - The feature to add to the supported features

isFeatureSupported

public boolean isFeatureSupported(long feature)
Returns true if the specified map feature is supported

Specified by:
isFeatureSupported in interface MapProvider
Parameters:
feature - The feature tested for support
Returns:
True if the specified feature is supported

validate

public boolean validate()
Performs simple validation checks on the authorization key, etc, and returns true is the validation was successful.

Returns:
True if the validation checks are successful, false otherwise.

getName

public java.lang.String getName()
Gets this MapProvider's name

Specified by:
getName in interface MapProvider
Returns:
The map provider name

getAuthorization

public java.lang.String getAuthorization()
Gets this MapProvider's authorization key

Specified by:
getAuthorization in interface MapProvider
Returns:
The map provider authorization key

toString

public java.lang.String toString()
Returns a String representation of this instance

Overrides:
toString in class java.lang.Object
Returns:
A String representation of this instance

setProperties

public void setProperties(java.lang.String props)
Sets this MapProvider's properties

Specified by:
setProperties in interface MapProvider
Parameters:
props - The map provider properties

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String val)
Adds a property key/value to this MapProvider

Parameters:
key - The property key
val - The property value

getProperties

public RTProperties getProperties()
Gets this MapProvider's properties

Specified by:
getProperties in interface MapProvider
Returns:
The map provider properties

setIconSelector

public void setIconSelector(boolean isFleet,
                            java.lang.String iconSel)
Sets this MapProvider's icon selector

Parameters:
isFleet - True if the specified icon selector is for the fleet maps
iconSel - The icon selector

getIconSelector

public java.lang.String getIconSelector(boolean isFleet)
Gets this MapProvider's icon selector

Parameters:
isFleet - True if the specified icon selector is for the fleet maps
Returns:
The map provider icon selector

getIconSelector

public java.lang.String getIconSelector(RequestProperties reqState)
Gets this MapProvider's icon selector

Specified by:
getIconSelector in interface MapProvider
Parameters:
reqState - The RequestProperties for the current session
Returns:
The map provider icon selector

_getIconLegendHtml

public java.lang.String _getIconLegendHtml(java.lang.String legendXml,
                                           RequestProperties reqState,
                                           boolean outputHtml)

GetIconLegendHtml

public static java.lang.String GetIconLegendHtml(java.lang.String refName,
                                                 java.util.Locale locale,
                                                 OrderedMap<java.lang.String,PushpinIcon> pushpinMap,
                                                 java.lang.String legendType,
                                                 org.w3c.dom.Element legendElem,
                                                 boolean outputHtml)

setIconSelectorLegend

public void setIconSelectorLegend(boolean isFleet,
                                  java.lang.String legend)
Sets this MapProvider's icon selector legend html

Parameters:
isFleet - True if the specified legend is for the fleet maps
legend - The legend HTML

getIconSelectorLegend

public java.lang.String getIconSelectorLegend(boolean isFleet)
Gets this MapProvider's icon selector legend html

Returns:
The map provider icon selector legend html

getIconSelectorLegend

public java.lang.String getIconSelectorLegend(RequestProperties reqState)
Gets this MapProvider's icon selector legend html

Specified by:
getIconSelectorLegend in interface MapProvider
Parameters:
reqState - The RequestProperties for the current session
Returns:
The map provider icon selector legend html

getZoneDimension

public MapDimension getZoneDimension()
Gets this MapProvider's frame dimension for the Geozone map

Specified by:
getZoneDimension in interface MapProvider
Returns:
The map provider frame dimension for the Geozone map

getZoneWidth

public int getZoneWidth()
Gets the MapProvider's frame width

Specified by:
getZoneWidth in interface MapProvider
Returns:
The map providers frame width

getZoneHeight

public int getZoneHeight()
Gets the MapProvider's frame height

Specified by:
getZoneHeight in interface MapProvider
Returns:
The map providers frame height

getDimension

public MapDimension getDimension()
Gets this MapProvider's frame dimension

Specified by:
getDimension in interface MapProvider
Returns:
The map provider frame dimension

getWidth

public int getWidth()
Gets the MapProvider's frame width

Specified by:
getWidth in interface MapProvider
Returns:
The map providers frame width

getHeight

public int getHeight()
Gets the MapProvider's frame height

Specified by:
getHeight in interface MapProvider
Returns:
The map providers frame height

getMaxPushpins

public long getMaxPushpins(RequestProperties reqState)
Returns the maximum number of allowed pushpins on the map

Specified by:
getMaxPushpins in interface MapProvider
Parameters:
reqState - The current session RequestProperties instance
Returns:
The maximum number of allowed pushpins

getDefaultCenter

public GeoPoint getDefaultCenter(GeoPoint dft)
Gets the default center GeoPoint (when no other points are displayed)

Specified by:
getDefaultCenter in interface MapProvider
Parameters:
dft - The default GeoPoint returned if this MapProvider does not explicitly define a point
Returns:
The default center GeoPoint

getDefaultZoom

public double getDefaultZoom(double dft,
                             boolean withPushpins)
Gets the default zoom/scale level for this MapProvider

Specified by:
getDefaultZoom in interface MapProvider
Parameters:
dft - The default zoom/scale returned if this MapProvider does not explicitly define a value
withPushpins - True to return the default zoom when pushpins are displayed
Returns:
The default zoom level

getDefaultZoom

public int getDefaultZoom(int dft,
                          boolean withPushpins)
Gets the default zoom/scale level for this MapProvider

Parameters:
dft - The default zoom/scale returned if this MapProvider does not explicitly define a value
withPushpins - True to return the default zoom when pushpins are displayed
Returns:
The default zoom level

getAutoUpdateEnabled

public boolean getAutoUpdateEnabled(boolean isFleet)
Gets the auto-update enabled state for this MapProvider

Specified by:
getAutoUpdateEnabled in interface MapProvider
Parameters:
isFleet - True for fleet map
Returns:
True if auto-update is enabled for this MapProvider

getAutoUpdateOnLoad

public boolean getAutoUpdateOnLoad(boolean isFleet)
Gets the auto-update 'OnLoad' state for this MapProvider

Specified by:
getAutoUpdateOnLoad in interface MapProvider
Parameters:
isFleet - True for fleet map
Returns:
True if auto-update is to be automatically start on-load

getAutoUpdateInterval

public long getAutoUpdateInterval(boolean isFleet)
Gets the auto-update interval for this MapProvider

Specified by:
getAutoUpdateInterval in interface MapProvider
Parameters:
isFleet - True for fleet map
Returns:
The auto-update interval

getAutoUpdateCount

public long getAutoUpdateCount(boolean isFleet)
Gets the auto-update count for this MapProvider

Specified by:
getAutoUpdateCount in interface MapProvider
Parameters:
isFleet - True for fleet map
Returns:
The auto-update count

getReplayEnabled

public boolean getReplayEnabled()
Gets the replay enabled state for this MapProvider

Specified by:
getReplayEnabled in interface MapProvider
Returns:
True if replay is enabled for this MapProvider

getReplayInterval

public long getReplayInterval()
Gets the replay interval for this MapProvider (in milliseconds)

Specified by:
getReplayInterval in interface MapProvider
Returns:
The replay interval

getReplaySinglePushpin

public boolean getReplaySinglePushpin()
Returns true if only a single pushpin is to be displayed at a time during replay

Specified by:
getReplaySinglePushpin in interface MapProvider
Returns:
True if only a single pushpin is to be displayed at a time during replay

getMapID

public abstract java.lang.String getMapID()
Returns the 'id' of the html tag block contain the map image

Returns:
The html tag block id

writeStyle

public void writeStyle(java.io.PrintWriter out,
                       RequestProperties reqState)
                throws java.io.IOException
Writes any required CSS to the specified PrintWriter. This method is intended to be overridden to provide the required behavior.

Specified by:
writeStyle in interface MapProvider
Parameters:
out - The PrintWriter
reqState - The session RequestProperties
Throws:
java.io.IOException

writeJavaScript

public abstract void writeJavaScript(java.io.PrintWriter out,
                                     RequestProperties state)
                              throws java.io.IOException
Writes any required JavaScript to the html stream

Specified by:
writeJavaScript in interface MapProvider
Parameters:
out - The handle to the html output stream
state - The current session state
Throws:
java.io.IOException

getMapCellStyle

protected java.lang.String getMapCellStyle(RequestProperties reqState,
                                           MapDimension mapDim)
Returns the style attributes for the displayed map cell

Parameters:
reqState - The current session state
mapDim - The specified map dimension
Returns:
The style attributes for the displayed map cell

writeMapCell

public void writeMapCell(java.io.PrintWriter out,
                         RequestProperties reqState,
                         MapDimension mapDim)
                  throws java.io.IOException
Writes the map table view to the http output stream

Specified by:
writeMapCell in interface MapProvider
Parameters:
out - The http output stream
reqState - The current session state
mapDim - The specified map dimensions
Throws:
java.io.IOException

writeMapUpdate_precheck

protected void writeMapUpdate_precheck(RequestProperties reqState)
Allows the subclass MapProvider to adjust the session state prior to displaying the map

Parameters:
reqState - The current session state

writeMapUpdate

public void writeMapUpdate(int mapDataFormat,
                           RequestProperties reqState)
                    throws java.io.IOException
Writes the events in XML/JSON format to the http output stream. The criteria used for selecting EventData records is specified with the RequestProperties session state.

Specified by:
writeMapUpdate in interface MapProvider
Parameters:
reqState - The current session state containing the EventData selection criteria
Throws:
java.io.IOException

writeMapUpdate

public void writeMapUpdate(java.io.PrintWriter out,
                           int indentLevel,
                           int mapDataFormat,
                           boolean isTopLevelTag,
                           RequestProperties reqState)
                    throws java.io.IOException
Writes the events in XML/JSON format to the http output stream. The criteria used for selecting EventData records is specified with the RequestProperties session state.

Specified by:
writeMapUpdate in interface MapProvider
Parameters:
out - The output stream
indentLevel - The indent level
mapDataFormat - The map data format
isTopLevelTag - True if top-level tag
reqState - The current session state containing the EventData selection criteria
Throws:
java.io.IOException

getPushpinIconMap

public OrderedMap<java.lang.String,PushpinIcon> getPushpinIconMap(RequestProperties reqState)
Returns the PushpinIcon map

Specified by:
getPushpinIconMap in interface MapProvider
Parameters:
reqState - The RequestProperties state from the current session
Returns:
The PushpinIcon map

getGeozoneSupportedPointCount

public int getGeozoneSupportedPointCount(int type)
Returns the number of supported points for the specified Geozone type

Specified by:
getGeozoneSupportedPointCount in interface MapProvider
Parameters:
type - The Geozone type
Returns:
The number of supported points for the specified Geozone type

getGeozoneInstructions

public java.lang.String[] getGeozoneInstructions(int type,
                                                 java.util.Locale loc)
Returns instructions for manipulating a Geozone

Specified by:
getGeozoneInstructions in interface MapProvider
Parameters:
loc - The current Locale
type - The Geozone type
Returns:
The localized instructions

getCorridorInstructions

public java.lang.String[] getCorridorInstructions(java.util.Locale loc)
Returns the localized GeoCorridor instructions

Specified by:
getCorridorInstructions in interface MapProvider
Parameters:
loc - The current Locale
Returns:
An array of instruction line items