com.esri.map
Class GPSLayer

java.lang.Object
  extended by com.esri.map.Layer
      extended by com.esri.map.GraphicsLayer
          extended by com.esri.map.GPSLayer

public final class GPSLayer
extends GraphicsLayer

This purpose of this layer is to display location from a IGPSWatcher. This layer can be created using a default serial port watcher (GPSLayer()) or using a custom watcher (GPSLayer(IGPSWatcher)).

This layer

NOTE: Currently only 1 GPSLayer per process is supported.


Nested Class Summary
static class GPSLayer.Mode
          GPS modes.
 
Nested classes/interfaces inherited from class com.esri.map.Layer
Layer.LayerStatus
 
Field Summary
 
Fields inherited from class com.esri.map.Layer
_credentials, _progress, _resolutionList, serviceInfo
 
Constructor Summary
GPSLayer()
          Creates a GPSLayer() with a serial-port GPS watcher.
GPSLayer(IGPSWatcher gpsWatcher)
          Creates a GPSLayer() with the specified watcher.
 
Method Summary
 boolean autoFocus()
          Deprecated. Instead, use getMode(). Auto-focus is replaced by GPSLayer.Mode.AUTOPAN.
 int getAutoFocusBoundary()
          Returns the value that is used to calculate the virtual boundary for auto-focus.
 GPSLayer.Mode getMode()
          Returns the current mode.
 double getNavigationPointHeightFactor()
          Factor that determines the position of the GPS relative to the screen along the vertical axis of the map's center. 0 represents the bottom edge and 1 represents the top, incremented uniformly.
 void recycle()
          Releases resources referenced by the Layer so that they can be recycled.
 void setAutoFocus(boolean autoFocus)
          Deprecated. Instead, use setMode(Mode) with GPSLayer.Mode.AUTOPAN.
 void setAutoFocusBoundary(int autoFocusBoundary)
          Sets the value used to calculate the virtual boundary for auto-focus.
 void setLocationSymbol(MarkerSymbol symbol)
          Changes the symbol to indicate the location.
 void setMode(GPSLayer.Mode mode)
          Sets the current mode.
 void setNavigationPointHeightFactor(double navigationPointHeightFactor)
          Sets the factor that determines the position of the GPS relative to the screen along the vertical axis of the map's center. 0 represents the bottom edge and 1 represents the top, incremented uniformly.
 void setShowStatus(boolean showStatus)
          This flag controls the display of the status of the IGPSWatcher.
 void setShowTrackPoints(boolean showTrackPoints)
          This flag controls the display of every location recorded by the IGPSWatcher.
 void setShowTrail(boolean showTrail)
          This flag controls the display of the path traced by the IGPSWatcher
 void setStatusSymbol(TextSymbol symbol)
          Changes the symbol to indicate the status.
 void setTrackPointSymbol(MarkerSymbol symbol)
          Changes the symbol to indicate the track points.
 void setTrailSymbol(LineSymbol symbol)
          Changes the symbol to indicate the trail.
 boolean showStatus()
          Returns whether the display of status is enabled.
 boolean showTrackPoints()
          Returns whether the display of track points is enabled.
 boolean showTrail()
          Returns whether the display of trail is enabled.
protected  void updateSpatialReferenceStatus(int SRStatus)
          This method is a callback from the native code.
 
Methods inherited from class com.esri.map.GraphicsLayer
addGraphic, addGraphics, attributesToJson, bringToFront, clearSelection, createNativeLayer, createSymbolImage, createSymbolImages, generateLegendInfo, getGraphic, getGraphicIDs, getGraphicIDs, getGraphicIDs, getLayerType, getLegend, getLegendImageGeometry, getLegendImageGeometryByType, getMapTip, getMaxDrawOrder, getMaxScale, getMinDrawOrder, getMinScale, getNumberOfGraphics, getRenderer, getSelectionColor, getSelectionIDs, getSelectionSymbol, init, initializeNativeLayer, initLayer, internalInit, isGraphicSelected, movePointGraphic, removeAll, removeGraphic, select, sendToBack, setGraphicVisible, setMapTip, setMaxScale, setMinScale, setRenderer, setSelectionColor, setSelectionIDs, setSelectionSymbol, unselect, updateGraphic, updateGraphic, updateGraphic, updateGraphic, updateGraphic, updateGraphic, updateGraphic, updateGraphic, validateMapTip
 
Methods inherited from class com.esri.map.Layer
addLayerInitializeCompleteListener, finalize, fireLayerCreateCompleteEvent, fireLayerCreateErrorEvent, fireLayerCreateErrorEvent, getCopyrightText, getCredentialsInternal, getDefaultSpatialReference, getDescription, getException, getExtent, getFullExtent, getInitialExtent, getInitializationError, getLayerHandle, getMap, getMapServer, getMapServerInfo, getMapServerLegendInfo, getName, getOpacity, getPopupInfo, getResolution, getResolutionList, getServiceDescription, getSpatialReference, getStatus, getUrl, getUrlHashCode, initializeAsync, internalGetLayerLegendInfos, isHidingNoDataTiles, isInitialized, isReady, isShowingCopyright, isVisible, loadServiceInfo, lock, reinitializeAsync, removeLayerInitializeCompleteListener, setCopyrightText, setCredentials, setDefaultSpatialReference, setDescription, setError, setException, setFullExtent, setInitialExtent, setLayerHandle, setMap, setMapServer, setName, setOpacity, setPopupInfos, setServiceDescription, setShowingCopyright, setStatus, setUrl, setVisible, unlock
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPSLayer

public GPSLayer()
Creates a GPSLayer() with a serial-port GPS watcher. The watcher will throw a runtime exception if there are no serial ports with GPS device.

Note: SerialPortGPSWatcher is currently supported on Windows only. This will fail to initialize when trying to use on Linux.


GPSLayer

public GPSLayer(IGPSWatcher gpsWatcher)
Creates a GPSLayer() with the specified watcher.

Parameters:
gpsWatcher - a IGPSWatcher. The layer tries to add a listener to the IGPSWatcher. So it is required that the watcher is not running.
Throws:
NullPointerException - if the input is null.
RuntimeException - if the watcher is running.
Method Detail

getMode

public GPSLayer.Mode getMode()
Returns the current mode. Default mode is GPSLayer.Mode.AUTOPAN.

Returns:
the current mode.
Since:
10.1.1
See Also:
setMode(Mode)

setMode

public void setMode(GPSLayer.Mode mode)
Sets the current mode. When the mode is changed to either GPSLayer.Mode.OFF or GPSLayer.Mode.AUTOPAN, the map's North is restored to top. Default mode is GPSLayer.Mode.AUTOPAN.

Parameters:
mode - the mode to be set.
Since:
10.1.1
See Also:
getMode(), setNavigationPointHeightFactor(double), setAutoFocusBoundary(int)

autoFocus

public boolean autoFocus()
Deprecated. Instead, use getMode(). Auto-focus is replaced by GPSLayer.Mode.AUTOPAN.

Returns whether auto-focus is enabled.

Returns:
true, if auto-focus is enabled; false, otherwise.
Since:
1.0
See Also:
setAutoFocus(boolean), setAutoFocusBoundary(int), getAutoFocusBoundary()

setAutoFocus

public void setAutoFocus(boolean autoFocus)
Deprecated. Instead, use setMode(Mode) with GPSLayer.Mode.AUTOPAN.

If true, the map zoom's in to the current location. Also, when the current location of the IGPSWatcher goes out of current extent, the extent of the map will be reset with current location as the center.

Parameters:
autoFocus - flag to turn on/off auto-focus.
Since:
1.0
See Also:
autoFocus(), setLocationSymbol(MarkerSymbol)

getNavigationPointHeightFactor

public double getNavigationPointHeightFactor()
Factor that determines the position of the GPS relative to the screen along the vertical axis of the map's center. 0 represents the bottom edge and 1 represents the top, incremented uniformly.

Returns:
the navigation point height factor. Default is 0.5.
Since:
10.1.1
See Also:
setNavigationPointHeightFactor(double)

setNavigationPointHeightFactor

public void setNavigationPointHeightFactor(double navigationPointHeightFactor)
Sets the factor that determines the position of the GPS relative to the screen along the vertical axis of the map's center. 0 represents the bottom edge and 1 represents the top, incremented uniformly.

This is applicable when the GPS mode is GPSLayer.Mode.NAVIGATION.

Parameters:
navigationPointHeightFactor - factor value.
Throws:
IllegalArgumentException - if the input value is less than 0 or greater than 1.
Since:
10.1.1
See Also:
getNavigationPointHeightFactor()

getAutoFocusBoundary

public int getAutoFocusBoundary()
Returns the value that is used to calculate the virtual boundary for auto-focus.

Returns:
the value used to calculate the virtual boundary for auto-focus. This value can range from 1 to 49.
See Also:
setAutoFocusBoundary(int)

setAutoFocusBoundary

public void setAutoFocusBoundary(int autoFocusBoundary)
Sets the value used to calculate the virtual boundary for auto-focus. For example, if this value is specified as 10, then the virtual boundary is the area that reduces the map's edges by 10% . When a location moves outside the virtual boundary, the map will be panned so that the new location is at the center of the map.

This is applicable when the GPS mode is GPSLayer.Mode.AUTOPAN.

Parameters:
autoFocusBoundary - percentage of the extent's width and height that will be used to calculate the virtual boundary.
Throws:
IllegalArgumentException - if the input value is less than 1 or greater than 49.
See Also:
getAutoFocusBoundary()

showStatus

public boolean showStatus()
Returns whether the display of status is enabled.

Returns:
true, if display of status is enabled; false, otherwise.
See Also:
setShowStatus(boolean)

setShowStatus

public void setShowStatus(boolean showStatus)
This flag controls the display of the status of the IGPSWatcher. The status is not displayed when the status is GPSStatus.RUNNING.

Parameters:
showStatus - flag to turn on/off the status display.
See Also:
showStatus(), setStatusSymbol(TextSymbol)

showTrail

public boolean showTrail()
Returns whether the display of trail is enabled.

Returns:
true, if the display of trail is enabled; false, otherwise.
See Also:
setShowTrail(boolean)

setShowTrail

public void setShowTrail(boolean showTrail)
This flag controls the display of the path traced by the IGPSWatcher

Parameters:
showTrail - flag to turn on/off the trail.
See Also:
showTrail(), setTrailSymbol(LineSymbol)

showTrackPoints

public boolean showTrackPoints()
Returns whether the display of track points is enabled.

Returns:
true, if the display of track points is enabled; false, otherwise.
See Also:
setShowTrackPoints(boolean)

setShowTrackPoints

public void setShowTrackPoints(boolean showTrackPoints)
This flag controls the display of every location recorded by the IGPSWatcher.

Parameters:
showTrackPoints - flag to turn on/off track points.
See Also:
showTrackPoints(), setTrackPointSymbol(MarkerSymbol)

setLocationSymbol

public void setLocationSymbol(MarkerSymbol symbol)
Changes the symbol to indicate the location.

Parameters:
symbol - a non-null symbol to be used for location.

setStatusSymbol

public void setStatusSymbol(TextSymbol symbol)
Changes the symbol to indicate the status.

Parameters:
symbol - a non-null symbol to be used for status.
See Also:
setShowStatus(boolean)

setTrackPointSymbol

public void setTrackPointSymbol(MarkerSymbol symbol)
Changes the symbol to indicate the track points.

Parameters:
symbol - a non-null symbol to be used for track points.
See Also:
setShowTrackPoints(boolean)

setTrailSymbol

public void setTrailSymbol(LineSymbol symbol)
Changes the symbol to indicate the trail.

Parameters:
symbol - a non-null symbol to be used for trail.
See Also:
setShowTrail(boolean)

updateSpatialReferenceStatus

protected void updateSpatialReferenceStatus(int SRStatus)
This method is a callback from the native code. When this is invoked, the value of the associated JMap is expected to be non-null. Since the GPSLayer requires the JMap to work, the layer waits for this callback.

Overrides:
updateSpatialReferenceStatus in class Layer

recycle

public void recycle()
Description copied from class: Layer
Releases resources referenced by the Layer so that they can be recycled.

Overrides:
recycle in class GraphicsLayer


Copyright © 2012. All Rights Reserved.