com.esri.map
Class JMap

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.esri.map.JMap
All Implemented Interfaces:
ImageObserver, MenuContainer, Pageable, Serializable

public class JMap
extends JComponent
implements Pageable

This class implements a map control that can be used to display and navigate layers of various types.

See Also:
Serialized Form

Nested Class Summary
static class JMap.AnimationMode
          Different animation modes controlling zoom animations.
 class JMap.LayerProgressEventListener
          Listener for layer progress events.
static class JMap.MouseWheelZoomDirection
          Choices for zoom direction based on mouse wheel movement.
 class JMap.PanDownAction
          Class to implement the required action on panning down.
 class JMap.PanLeftAction
          Class to implement the required action on panning left.
 class JMap.PanRightAction
          Class to implement the required action on panning right.
 class JMap.PanUpAction
          Class to implement the required action on panning up.
 class JMap.ZoomInAction
          Class to implement the required action on zooming in.
 class JMap.ZoomOutAction
          Class to implement the required action on zooming out.
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String panDownAction
          The Constant panDownAction.
static String panLeftAction
          The Constant panLeftAction.
static String panRightAction
          The Constant panRightAction.
static String panUpAction
          The Constant panUpAction.
static String zoomInAction
          The Constant zoomInAction.
static String zoomOutAction
          The Constant zoomOutAction.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JMap()
          Default constructor.
JMap(SpatialReference spatialRef, Envelope mapExtent)
          Construct a new Map with the given map extent and spatial reference.
 
Method Summary
 void addMapEventListener(MapEventListener listener)
          Add a map event listener.
 void addMapOverlay(MapOverlay overlay)
          Add the given map overlay to the map.
 void addProgressEventListener(ProgressEventListener listener)
          Add a progress event listener.
 boolean containsLayer(Layer layer)
          Returns true if the map contains the given layer.
 MapPopup createPopup(JComponent[] content, Graphic graphic, boolean createAsDialog)
          Create a new MapPopup.
 void dispose()
          Releases unmanaged resources, such as displayed layers.
protected  void finalize()
           
 float getAnimationDuration()
           
 JMap.AnimationMode getAnimationMode()
          Returns the current animation mode used when zooming.
 LocationOnMap getCopyrightLocation()
          Returns location of copyright relative to the map.
 Envelope getExtent()
          Returns the current extent of the map.
 Envelope getFullExtent()
          Get the full extent of the map.
 Grid getGrid()
          Returns the Grid instance of the map which allows for the type and visibility of the grid to be controlled.
 LayerList getLayers()
          Gets the list of layers which the map contains
 List<MapOverlay> getMapOverlays()
          Gets a list of map overlays.
 int getMapTipDelay()
          Returns the maptip delay.
 String getMapUnits()
          Gets the map units.
 JMap.MouseWheelZoomDirection getMouseWheelZoomDirection()
          Gets the zoom direction when the mouse wheel is moved forwards.
 int getNumberOfPages()
           
 PageFormat getPageFormat(int pageIndex)
           
 int getPanTolerance()
          Returns the tolerance on map panning by mouse.
 Printable getPrintable(int pageIndex)
           
 double getResolution()
          Gets the resolution of the map.
 ResolutionList getResolutionList()
          Gets the resolution list.
 double getRotation()
          Gets the rotation of the map.
 double getScale()
          Returns the current scale of the map.
 SpatialReference getSpatialReference()
          Returns the spatial reference of the map.
 TimeExtent getTimeInterval()
          Get the current date/time range being used to filter time aware layers.
protected  void handleLayerStreamProgressEvent(ProgressEvent event)
          Handler for layer stream progress events.
 void insertMapOverlay(int index, MapOverlay overlay)
          Add the given map overlay to the map.
protected  void internalAddLayer(Layer layer)
           
protected  void internalAddLayer(Layer layer, int index)
           
 boolean isHidingNoDataTiles()
          Checks if tiles with no data are hidden by displaying an image interpolated from tiles at a lower resolution.
 boolean isKeyboardEnabled()
          Gets if the keyboard is enabled for input.
 boolean isPanToleranceEnabled()
          Returns whether the tolerance on map panning by mouse is enabled.
 boolean isReady()
          Returns true if the map is ready.
 boolean isShowingCopyright()
          Returns whether copyright is showing.
 boolean isShowingEsriLogo()
           
 boolean isWrapAroundEnabled()
          Checks if is wrap around is enabled.
 boolean isZoomSnapEnabled()
          Checks if is zoom snap is enabled.
 void paint(Graphics g)
           
 void paintComponent(Graphics g)
           
 void panTo(Geometry geometry)
          Pans the map to the given geometry.
 void refreshCopyright()
          Refreshes copyright.
 void refreshMapTips()
          Refreshes maptip.
 void removeMapEventListener(MapEventListener listener)
          Remove a map event listener.
 void removeMapOverlay(int index)
          Remove the overlay at the given index from the map.
 void removeMapOverlay(MapOverlay overlay)
          Remove the given overlay from the map.
 void removeProgressEventListener(ProgressEventListener listener)
          Remove a progress event listener.
protected  void requestRender()
           
 void setAnimationDuration(float seconds)
           
 void setAnimationMode(JMap.AnimationMode animationMode)
          Sets the animation mode for zooming.
 void setBounds(int newX, int newY, int width, int height)
           
 void setCopyrightLocation(LocationOnMap location)
          Sets the copyright location.
 void setCopyrightSize(int width, int height)
          Sets the copyright size.
 void setExtent(Geometry geometry)
          Sets the current extent of the map.
 void setFullExtent(Envelope fullExtent)
          Set the full extent of the map.
 void setHidingNoDataTiles(boolean hiding)
          Hides no data tiles by displaying an image interpolated from tiles at a lower resolution.
 void setKeyboardEnabled(boolean enableKeyboardInput)
          Sets if keyboard input is enabled.
 void setLayers(LayerList layerList)
          Sets the list of layers which the map will contain.
 void setMapTipDelay(int delay)
          Sets the maptip delay.
 void setMouseWheelZoomDirection(JMap.MouseWheelZoomDirection direction)
          Sets the direction of zoom when the mouse wheel is moved forward.
 void setPageFormat(PageFormat pageFormat)
          Sets the page format.
 void setPanTolerance(int toleranceInPixels)
          Sets the tolerance level when panning by mouse.
 void setPanToleranceEnabled(boolean enablePanTolerance)
          Sets whether to enable tolerance when panning by mouse.
 void setRotation(double degrees)
          Set the rotation for the map.
 void setRotation(double degrees, float x, float y)
          Set the rotation for the map around a given screen point
 void setScale(double scale)
          Sets the scale of the map.
 void setShowingCopyright(boolean show)
          Sets whether to consider displaying copyright of all layers.
 void setShowingEsriLogo(boolean show)
           
 void setTimeInterval(TimeExtent timeInterval)
          Use this to set a date/time range to use to filter data in any time aware layers in the map.
 void setWrapAroundEnabled(boolean enable)
          Enables/Disables map wrap around.
 void setZoomSnapEnabled(boolean zoomSnapEnabled)
          Sets snapping to resolutions in the resolution list.
 void spatialReferenceInitialized()
          Spatial reference initialized.
protected  boolean spatialRefsAreEqual(Layer lyr)
          Spatial refs are equal.
 Point toMapPoint(int screenX, int screenY)
          Converts a point in screen coordinates to a point in map coordinates.
 Point toScreenPoint(Point src)
          Converts a point in map coordinates to a Point in screen coordinates.
 void zoom(double factor)
          Zooms the map by the given factor.
 void zoom(double factor, Point mapPoint)
          Zooms the map by the given factor centered at the given point.
 void zoomTo(Geometry geometry)
          Zooms to a geometry.
 void zoomToResolution(double resolution)
          Zooms the map to the given resolution.
 void zoomToResolution(double resolution, Point mapPoint)
          Zooms the map to the given resolution.
 void zoomToScale(double scale)
          Zooms to a scale.
 void zoomToScale(double scale, Point mapPoint)
          Zoom the map to the given scale, centered around the given point.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

zoomInAction

public static final String zoomInAction
The Constant zoomInAction.

See Also:
Constant Field Values

zoomOutAction

public static final String zoomOutAction
The Constant zoomOutAction.

See Also:
Constant Field Values

panLeftAction

public static final String panLeftAction
The Constant panLeftAction.

See Also:
Constant Field Values

panRightAction

public static final String panRightAction
The Constant panRightAction.

See Also:
Constant Field Values

panUpAction

public static final String panUpAction
The Constant panUpAction.

See Also:
Constant Field Values

panDownAction

public static final String panDownAction
The Constant panDownAction.

See Also:
Constant Field Values
Constructor Detail

JMap

public JMap()
Default constructor. The Map's spatial reference is determined by the first layer in the map. The Map's full extent is determined by the union of the extents of all the layers in the map.


JMap

public JMap(SpatialReference spatialRef,
            Envelope mapExtent)
Construct a new Map with the given map extent and spatial reference.

Parameters:
mapExtent - Full extent of map
spatialRef - Spatial reference of map
Method Detail

setAnimationDuration

public void setAnimationDuration(float seconds)

getAnimationDuration

public float getAnimationDuration()

getAnimationMode

public JMap.AnimationMode getAnimationMode()
Returns the current animation mode used when zooming.

Returns:
animation mode currently set.

setAnimationMode

public void setAnimationMode(JMap.AnimationMode animationMode)
Sets the animation mode for zooming.

Parameters:
animationMode - the animation mode to set

getScale

public double getScale()
Returns the current scale of the map.

Returns:
the current scale of the map.

setScale

public void setScale(double scale)
Sets the scale of the map.

Parameters:
scale - the scale to set.

requestRender

protected void requestRender()

spatialReferenceInitialized

public void spatialReferenceInitialized()
Spatial reference initialized.


internalAddLayer

protected void internalAddLayer(Layer layer)

refreshCopyright

public void refreshCopyright()
Refreshes copyright.

Since:
10.1.1

refreshMapTips

public void refreshMapTips()
Refreshes maptip.

Since:
10.1.1

internalAddLayer

protected void internalAddLayer(Layer layer,
                                int index)

finalize

protected void finalize()
Overrides:
finalize in class Object

dispose

public void dispose()
Releases unmanaged resources, such as displayed layers. Call this when you have finished with the Map, typically before the application exits.


setBounds

public void setBounds(int newX,
                      int newY,
                      int width,
                      int height)
Overrides:
setBounds in class Component

paintComponent

public void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

panTo

public void panTo(Geometry geometry)
Pans the map to the given geometry.

Parameters:
geometry - the geometry to pan to

setPanToleranceEnabled

public void setPanToleranceEnabled(boolean enablePanTolerance)
Sets whether to enable tolerance when panning by mouse. Default is false. When enabled, the default value for tolerance is 5 pixels. To set tolerance, use setPanTolerance(int).

Parameters:
enablePanTolerance - true, to enable tolerance on mouse panning.
See Also:
setPanTolerance(int)

setPanTolerance

public void setPanTolerance(int toleranceInPixels)
Sets the tolerance level when panning by mouse. The tolerance is applicable when enabled.

Parameters:
toleranceInPixels - tolerance amount, expressed in pixels. If the distance of mouse drag is less than the tolerance in both horizontal and vertical directions, then the map will not be panned.
See Also:
setPanToleranceEnabled(boolean)

isPanToleranceEnabled

public boolean isPanToleranceEnabled()
Returns whether the tolerance on map panning by mouse is enabled.

Returns:
true, if enabled; false otherwise. Default is false.
See Also:
setPanToleranceEnabled(boolean)

getPanTolerance

public int getPanTolerance()
Returns the tolerance on map panning by mouse. Default is 5 pixels.

Returns:
the tolerance level on map panning by mouse. This value is expressed in pixels.
See Also:
setPanTolerance(int)

spatialRefsAreEqual

protected boolean spatialRefsAreEqual(Layer lyr)
Spatial refs are equal.

Parameters:
lyr - the lyr
Returns:
true, if the ID of the spatial reference of the given tiled layer matches the ID of the Map's spatial reference.

isReady

public boolean isReady()
Returns true if the map is ready.

Returns:
true if the map is ready. That is, the map has a spatial reference set and has an extent from the first layer added.

zoomTo

public void zoomTo(Geometry geometry)
Zooms to a geometry.

Parameters:
geometry - the geometry to zoom to

zoomToScale

public void zoomToScale(double scale)
Zooms to a scale.

Parameters:
scale - Scale to zoom to

zoomToScale

public void zoomToScale(double scale,
                        Point mapPoint)
Zoom the map to the given scale, centered around the given point.

Parameters:
scale - Scale to zoom to
mapPoint - Point to center map around

zoomToResolution

public void zoomToResolution(double resolution)
Zooms the map to the given resolution.

Parameters:
resolution - resolution to zoom to

zoomToResolution

public void zoomToResolution(double resolution,
                             Point mapPoint)
Zooms the map to the given resolution.

Parameters:
resolution - resolution to zoom to
mapPoint - Point to center map around

zoom

public void zoom(double factor)
Zooms the map by the given factor.

Parameters:
factor - factor to zoom by

zoom

public void zoom(double factor,
                 Point mapPoint)
Zooms the map by the given factor centered at the given point.

Parameters:
factor - factor to zoom by
mapPoint - Point to center map around

getMouseWheelZoomDirection

public JMap.MouseWheelZoomDirection getMouseWheelZoomDirection()
Gets the zoom direction when the mouse wheel is moved forwards.

Returns:
the zoom direction when moving the mouse wheel forward.

setMouseWheelZoomDirection

public void setMouseWheelZoomDirection(JMap.MouseWheelZoomDirection direction)
Sets the direction of zoom when the mouse wheel is moved forward.

Parameters:
direction - the new mouse wheel zoom direction

getSpatialReference

public SpatialReference getSpatialReference()
Returns the spatial reference of the map. The spatial reference of the map is assumed to the be the spatial reference of the first layer added to the map.

Returns:
SpatialReference The spatial reference of the map

getResolution

public double getResolution()
Gets the resolution of the map.

Returns:
the map resolution

getMapUnits

public String getMapUnits()
Gets the map units. The map units are determined by the first layer added to the map.

Returns:
the map units

getExtent

public Envelope getExtent()
Returns the current extent of the map.

Returns:
Extent The current extent of the map

setExtent

public void setExtent(Geometry geometry)
Sets the current extent of the map.

Parameters:
extent - the new extent

getFullExtent

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

Returns:
Full extent of the map

setFullExtent

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

Parameters:
fullExtent - Extent to set

getTimeInterval

public TimeExtent getTimeInterval()
Get the current date/time range being used to filter time aware layers.

Returns:
the timeInterval

setTimeInterval

public void setTimeInterval(TimeExtent timeInterval)
Use this to set a date/time range to use to filter data in any time aware layers in the map. This will be applied to all layers that implement TimeAwareLayer that are currently in the map. Any new layers that implement TimeAwareLayer that are added to the map will have this range applied. Note that this will overwrite any time interval set on individual layers.

Parameters:
timeInterval - the date/time interval to set

toMapPoint

public Point toMapPoint(int screenX,
                        int screenY)
Converts a point in screen coordinates to a point in map coordinates.

Parameters:
screenX - The screen x
screenY - The screen y
Returns:
com.esri.core.geometry.Point A point in map coordinates

toScreenPoint

public Point toScreenPoint(Point src)
Converts a point in map coordinates to a Point in screen coordinates.

Parameters:
src - the com.esri.core.geometry.Point in map coordinates
Returns:
com.esri.core.geometry.Point A point in screen coordinates

containsLayer

public boolean containsLayer(Layer layer)
Returns true if the map contains the given layer.

Parameters:
layer - the layer
Returns:
true if the map contains the layer

addMapOverlay

public void addMapOverlay(MapOverlay overlay)
Add the given map overlay to the map. The overlay will be added to the top of the stack of overlays.

Parameters:
overlay - Overlay to add

getMapOverlays

public List<MapOverlay> getMapOverlays()
Gets a list of map overlays.

Returns:
a list of map overlays in this map.

insertMapOverlay

public void insertMapOverlay(int index,
                             MapOverlay overlay)
Add the given map overlay to the map. The overlay will be added at the given index.

Parameters:
index - Index to insert overlay at
overlay - Overlay to insert

removeMapOverlay

public void removeMapOverlay(MapOverlay overlay)
Remove the given overlay from the map.

Parameters:
overlay - Overlay to remove

removeMapOverlay

public void removeMapOverlay(int index)
Remove the overlay at the given index from the map.

Parameters:
index - Index of overlay to remove

setKeyboardEnabled

public void setKeyboardEnabled(boolean enableKeyboardInput)
Sets if keyboard input is enabled.

Parameters:
enableKeyboardInput - true to enable keyboard input

isKeyboardEnabled

public boolean isKeyboardEnabled()
Gets if the keyboard is enabled for input.

Returns:
true if keyboard input is enabled.

addMapEventListener

public void addMapEventListener(MapEventListener listener)
Add a map event listener.

Parameters:
listener - Listener to add

removeMapEventListener

public void removeMapEventListener(MapEventListener listener)
Remove a map event listener.

Parameters:
listener - Listener to remove

addProgressEventListener

public void addProgressEventListener(ProgressEventListener listener)
Add a progress event listener.

Parameters:
listener - Listener to add

removeProgressEventListener

public void removeProgressEventListener(ProgressEventListener listener)
Remove a progress event listener.

Parameters:
listener - Listener to remove

handleLayerStreamProgressEvent

protected void handleLayerStreamProgressEvent(ProgressEvent event)
Handler for layer stream progress events.

Parameters:
event -

setRotation

public void setRotation(double degrees)
Set the rotation for the map.

Parameters:
degrees - the new rotation

setRotation

public void setRotation(double degrees,
                        float x,
                        float y)
Set the rotation for the map around a given screen point

Parameters:
degrees - the new rotation
x - rotation anchor point x in pixels
y - rotation anchor point y in pixels

getRotation

public double getRotation()
Gets the rotation of the map.

Returns:
angle in degrees

getResolutionList

public ResolutionList getResolutionList()
Gets the resolution list. The resolution list is initially determined by the first layer added to the map. If the first layer is a tiled layer then the resolutions will be taken from the tiled layer's service. If the first layer is a dynamic layer or other then the resolution list will be empty. Resolutions can be added and removed from the resolution list after the Map is ready.

Returns:
the resolution list

setZoomSnapEnabled

public void setZoomSnapEnabled(boolean zoomSnapEnabled)
Sets snapping to resolutions in the resolution list.

Parameters:
zoomSnapEnabled - true to enable

isZoomSnapEnabled

public boolean isZoomSnapEnabled()
Checks if is zoom snap is enabled.

Returns:
true, if is zooming will snap to resolutions in the resolution list. By default this is false.

isHidingNoDataTiles

public boolean isHidingNoDataTiles()
Checks if tiles with no data are hidden by displaying an image interpolated from tiles at a lower resolution.

Returns:
true if no data tiles are hidden
See Also:
setHidingNoDataTiles(boolean)

setHidingNoDataTiles

public void setHidingNoDataTiles(boolean hiding)
Hides no data tiles by displaying an image interpolated from tiles at a lower resolution. This method may be called before adding a layer to the map. Tile which display 'No data' can exist, for example for a remote area at a given resolution.

Parameters:
hiding - true if no data tiles are to be hidden.
See Also:
setZoomSnapEnabled which snaps to resolution levels rather than displaying interpolated images between resolution levels

getLayers

public LayerList getLayers()
Gets the list of layers which the map contains

Returns:
the layers

setLayers

public void setLayers(LayerList layerList)
Sets the list of layers which the map will contain.

Parameters:
layerList - the new layers

getGrid

public Grid getGrid()
Returns the Grid instance of the map which allows for the type and visibility of the grid to be controlled. The Grid instance also allows for the style of the grid to be changed.

Returns:
the map Grid

setWrapAroundEnabled

public void setWrapAroundEnabled(boolean enable)
Enables/Disables map wrap around.

Parameters:
enable - true to enable and false to disable

isWrapAroundEnabled

public boolean isWrapAroundEnabled()
Checks if is wrap around is enabled.

Returns:
true, if is wrap around enabled

isShowingEsriLogo

public boolean isShowingEsriLogo()

setShowingEsriLogo

public void setShowingEsriLogo(boolean show)

getMapTipDelay

public int getMapTipDelay()
Returns the maptip delay.

Returns:
the maptip delay, in milliseconds.
Since:
10.1.1

setMapTipDelay

public void setMapTipDelay(int delay)
Sets the maptip delay.

Parameters:
delay - delay in milliseconds.
Since:
10.1.1

isShowingCopyright

public boolean isShowingCopyright()
Returns whether copyright is showing.

Since:
10.1.1
See Also:
setShowingCopyright(boolean), Layer.isShowingCopyright(), Layer.setShowingCopyright(boolean)

setShowingCopyright

public void setShowingCopyright(boolean show)
Sets whether to consider displaying copyright of all layers.

Parameters:
show - true to display copyright of all layers whose copyright is showing, false to not show any copyright.
Since:
10.1.1
See Also:
isShowingCopyright(), Layer.isShowingCopyright(), Layer.setShowingCopyright(boolean)

getCopyrightLocation

public LocationOnMap getCopyrightLocation()
Returns location of copyright relative to the map.

Returns:
location of copyright on map.
Since:
10.1.1

setCopyrightLocation

public void setCopyrightLocation(LocationOnMap location)
Sets the copyright location.

Parameters:
location - location relative to the map.
Since:
10.1.1

setCopyrightSize

public void setCopyrightSize(int width,
                             int height)
Sets the copyright size.

Parameters:
width - width, in pixels.
height - height, in pixels.
Since:
10.1.1

paint

public void paint(Graphics g)
Overrides:
paint in class JComponent

getNumberOfPages

public int getNumberOfPages()
Specified by:
getNumberOfPages in interface Pageable

setPageFormat

public void setPageFormat(PageFormat pageFormat)
Sets the page format.

Parameters:
pageFormat - the new page format

getPageFormat

public PageFormat getPageFormat(int pageIndex)
                         throws IndexOutOfBoundsException
Specified by:
getPageFormat in interface Pageable
Throws:
IndexOutOfBoundsException

getPrintable

public Printable getPrintable(int pageIndex)
                       throws IndexOutOfBoundsException
Specified by:
getPrintable in interface Pageable
Throws:
IndexOutOfBoundsException

createPopup

public MapPopup createPopup(JComponent[] content,
                            Graphic graphic,
                            boolean createAsDialog)
Create a new MapPopup. This method will create a new MapPopup that will contain the given content that will point to the location of the given graphic. To create the MapPopup as a JInternalFrame, set createAsDialog false. To create the MapPopup as a JDialog, set createAsDialog true. The JInternalFrame version will not be visible outside the bounds of the map control, the JDialog one can be dragged outside of the map control.

Note that the content parameter is an array of JComponent. If more than one item is included in this array, the items will be displayed one on top of the other. The MapPopup will display arrows that can be used to step backwards and forwards through the items.

The MapPopup will initially be invisible: display it by calling setVisible(true).

Parameters:
content - An array of JComponents that will be displayed in the MapPopup.
graphic - When displayed, the MapPopup's tail will point to this graphic.
createAsDialog - Set true to create the MapPopup as a JDialog based control. Set false to create as a JInternalFrame based control.
Returns:
A new MapPopup


Copyright © 2012. All Rights Reserved.