|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.esri.map.JMap
public class JMap
This class implements a map control that can be used to display and navigate layers of various types.
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 java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String zoomInAction
public static final String zoomOutAction
public static final String panLeftAction
public static final String panRightAction
public static final String panUpAction
public static final String panDownAction
Constructor Detail |
---|
public JMap()
public JMap(SpatialReference spatialRef, Envelope mapExtent)
mapExtent
- Full extent of mapspatialRef
- Spatial reference of mapMethod Detail |
---|
public void setAnimationDuration(float seconds)
public float getAnimationDuration()
public JMap.AnimationMode getAnimationMode()
public void setAnimationMode(JMap.AnimationMode animationMode)
animationMode
- the animation mode to setpublic double getScale()
public void setScale(double scale)
scale
- the scale to set.protected void requestRender()
public void spatialReferenceInitialized()
protected void internalAddLayer(Layer layer)
public void refreshCopyright()
public void refreshMapTips()
protected void internalAddLayer(Layer layer, int index)
protected void finalize()
finalize
in class Object
public void dispose()
public void setBounds(int newX, int newY, int width, int height)
setBounds
in class Component
public void paintComponent(Graphics g)
paintComponent
in class JComponent
public void panTo(Geometry geometry)
geometry
- the geometry to pan topublic void setPanToleranceEnabled(boolean enablePanTolerance)
setPanTolerance(int)
.
enablePanTolerance
- true, to enable tolerance on mouse panning.setPanTolerance(int)
public void setPanTolerance(int toleranceInPixels)
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.setPanToleranceEnabled(boolean)
public boolean isPanToleranceEnabled()
setPanToleranceEnabled(boolean)
public int getPanTolerance()
setPanTolerance(int)
protected boolean spatialRefsAreEqual(Layer lyr)
lyr
- the lyr
public boolean isReady()
public void zoomTo(Geometry geometry)
geometry
- the geometry to zoom topublic void zoomToScale(double scale)
scale
- Scale to zoom topublic void zoomToScale(double scale, Point mapPoint)
scale
- Scale to zoom tomapPoint
- Point to center map aroundpublic void zoomToResolution(double resolution)
resolution
- resolution to zoom topublic void zoomToResolution(double resolution, Point mapPoint)
resolution
- resolution to zoom tomapPoint
- Point to center map aroundpublic void zoom(double factor)
factor
- factor to zoom bypublic void zoom(double factor, Point mapPoint)
factor
- factor to zoom bymapPoint
- Point to center map aroundpublic JMap.MouseWheelZoomDirection getMouseWheelZoomDirection()
public void setMouseWheelZoomDirection(JMap.MouseWheelZoomDirection direction)
direction
- the new mouse wheel zoom directionpublic SpatialReference getSpatialReference()
public double getResolution()
public String getMapUnits()
public Envelope getExtent()
public void setExtent(Geometry geometry)
extent
- the new extentpublic Envelope getFullExtent()
public void setFullExtent(Envelope fullExtent)
fullExtent
- Extent to setpublic TimeExtent getTimeInterval()
public void setTimeInterval(TimeExtent timeInterval)
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.
timeInterval
- the date/time interval to setpublic Point toMapPoint(int screenX, int screenY)
screenX
- The screen xscreenY
- The screen y
public Point toScreenPoint(Point src)
src
- the com.esri.core.geometry.Point in map coordinates
public boolean containsLayer(Layer layer)
layer
- the layer
public void addMapOverlay(MapOverlay overlay)
overlay
- Overlay to addpublic List<MapOverlay> getMapOverlays()
public void insertMapOverlay(int index, MapOverlay overlay)
index
- Index to insert overlay atoverlay
- Overlay to insertpublic void removeMapOverlay(MapOverlay overlay)
overlay
- Overlay to removepublic void removeMapOverlay(int index)
index
- Index of overlay to removepublic void setKeyboardEnabled(boolean enableKeyboardInput)
enableKeyboardInput
- true to enable keyboard inputpublic boolean isKeyboardEnabled()
public void addMapEventListener(MapEventListener listener)
listener
- Listener to addpublic void removeMapEventListener(MapEventListener listener)
listener
- Listener to removepublic void addProgressEventListener(ProgressEventListener listener)
listener
- Listener to addpublic void removeProgressEventListener(ProgressEventListener listener)
listener
- Listener to removeprotected void handleLayerStreamProgressEvent(ProgressEvent event)
event
- public void setRotation(double degrees)
degrees
- the new rotationpublic void setRotation(double degrees, float x, float y)
degrees
- the new rotationx
- rotation anchor point x in pixelsy
- rotation anchor point y in pixelspublic double getRotation()
public ResolutionList getResolutionList()
is ready
.
public void setZoomSnapEnabled(boolean zoomSnapEnabled)
zoomSnapEnabled
- true to enablepublic boolean isZoomSnapEnabled()
resolution list
. By default this is
false.public boolean isHidingNoDataTiles()
setHidingNoDataTiles(boolean)
public void setHidingNoDataTiles(boolean hiding)
hiding
- true if no data tiles are to be hidden.setZoomSnapEnabled which snaps to
resolution levels rather than displaying interpolated images between
resolution levels
public LayerList getLayers()
public void setLayers(LayerList layerList)
layerList
- the new layerspublic Grid getGrid()
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.
Grid
public void setWrapAroundEnabled(boolean enable)
enable
- true to enable and false to disablepublic boolean isWrapAroundEnabled()
public boolean isShowingEsriLogo()
public void setShowingEsriLogo(boolean show)
public int getMapTipDelay()
public void setMapTipDelay(int delay)
delay
- delay in milliseconds.public boolean isShowingCopyright()
setShowingCopyright(boolean)
,
Layer.isShowingCopyright()
,
Layer.setShowingCopyright(boolean)
public void setShowingCopyright(boolean show)
show
- true to display copyright of all layers whose copyright is showing,
false to not show any copyright.isShowingCopyright()
,
Layer.isShowingCopyright()
,
Layer.setShowingCopyright(boolean)
public LocationOnMap getCopyrightLocation()
public void setCopyrightLocation(LocationOnMap location)
location
- location relative to the map.public void setCopyrightSize(int width, int height)
width
- width, in pixels.height
- height, in pixels.public void paint(Graphics g)
paint
in class JComponent
public int getNumberOfPages()
getNumberOfPages
in interface Pageable
public void setPageFormat(PageFormat pageFormat)
pageFormat
- the new page formatpublic PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException
getPageFormat
in interface Pageable
IndexOutOfBoundsException
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException
getPrintable
in interface Pageable
IndexOutOfBoundsException
public MapPopup createPopup(JComponent[] content, Graphic graphic, boolean createAsDialog)
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)
.
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |