|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jdesktop.swingx.JXPanel
org.jdesktop.swingx.JXMapViewer
public class JXMapViewer
A tile oriented map component that can easily be used with tile sources
on the web like Google and Yahoo maps, satellite data such as NASA imagery,
and also with file based sources like pre-processed NASA images.
A known map provider can be used with the SLMapServerInfo,
which will connect to a 2km resolution version of NASA's Blue Marble Next Generation
imagery. @see SLMapServerInfo for more information.
Note, the JXMapViewer has three center point properties. The addressLocation property
represents an abstract center of the map. This would usually be something like the first item
in a search result. It is a GeoPosition. The centerPosition property represents
the current center point of the map. If the user pans the map then the centerPosition point will
change but the addressLocation will not. Calling recenterToAddressLocation() will move the map
back to that center address. The center property represents the same point as the centerPosition
property, but as a Point2D in pixel space instead of a GeoPosition in lat/long space. Note that
the center property is a Point2D in the entire world bitmap, not in the portion of the map currently
visible. You can use the getViewportBounds() method to find the portion of the map currently visible
and adjust your calculations accordingly. Changing the center property will change the centerPosition
property and vice versa. All three properties are bound.
SLMapServerInfo,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| 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.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| 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.beans.DesignMode |
|---|
PROPERTYNAME |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JXMapViewer()
Create a new JXMapViewer. |
|
| Method Summary | |
|---|---|
void |
calculateZoomFrom(Set<GeoPosition> positions)
Calculates a zoom level so that all points in the specified set will be visible on screen. |
Point2D |
convertGeoPositionToPoint(GeoPosition pos)
Converts the specified GeoPosition to a point in the JXMapViewer's local coordinate space. |
GeoPosition |
convertPointToGeoPosition(Point2D pt)
Converts the specified Point2D in the JXMapViewer's local coordinate space to a GeoPosition on the map. |
protected void |
drawMapTiles(Graphics g,
int zoom,
Rectangle viewportBounds)
Draw the map tiles. |
GeoPosition |
getAddressLocation()
Gets the current address location of the map. |
Point2D |
getCenter()
Gets the current pixel center of the map. |
GeoPosition |
getCenterPosition()
A property indicating the center position of the map |
Image |
getLoadingImage()
A property for an image which will be display when an image is still loading. |
org.jdesktop.swingx.painter.Painter |
getOverlayPainter()
Gets the current map overlay |
TileFactory |
getTileFactory()
Get the current factory |
Rectangle |
getViewportBounds()
Returns the bounds of the viewport in pixels. |
int |
getZoom()
Gets the current zoom level |
boolean |
isDesignTime()
Indicates whether the component is being used at design time, such as in a visual editor like NetBeans' Matisse |
boolean |
isDrawTileBorders()
Indicates if the tile borders should be drawn. |
boolean |
isHorizontalWrapped()
|
boolean |
isPanEnabled()
A property indicating if the map should be pannable by the user using the mouse. |
boolean |
isRecenterOnClickEnabled()
Indicates if the map should recenter itself on mouse clicks. |
boolean |
isRestrictOutsidePanning()
|
boolean |
isZoomEnabled()
A property indicating if the map should be zoomable by the user using the mouse wheel. |
void |
recenterToAddressLocation()
Re-centers the map to have the current address location be at the center of the map, accounting for the map's width and height. |
void |
setAddressLocation(GeoPosition addressLocation)
Gets the current address location of the map |
void |
setCenter(Point2D center)
Sets the new center of the map in pixel coordinates. |
void |
setCenterPosition(GeoPosition geoPosition)
A property indicating the center position of the map |
void |
setDesignTime(boolean b)
Indicate that the component is being used at design time, such as in a visual editor like NetBeans' Matisse |
void |
setDrawTileBorders(boolean drawTileBorders)
Set if the tile borders should be drawn. |
void |
setHorizontalWrapped(boolean horizontalWrapped)
|
void |
setLoadingImage(Image loadingImage)
A property for an image which will be display when an image is still loading. |
void |
setOverlayPainter(org.jdesktop.swingx.painter.Painter overlay)
Sets the map overlay. |
void |
setPanEnabled(boolean panEnabled)
A property indicating if the map should be pannable by the user using the mouse. |
void |
setRecenterOnClickEnabled(boolean b)
Sets whether the map should recenter itself on mouse clicks (middle mouse clicks?) |
void |
setRestrictOutsidePanning(boolean restrictOutsidePanning)
|
void |
setTileFactory(TileFactory factory)
Set the current tile factory |
void |
setZoom(int zoom)
Set the current zoom level |
void |
setZoomEnabled(boolean zoomEnabled)
A property indicating if the map should be zoomable by the user using the mouse wheel. |
| Methods inherited from class org.jdesktop.swingx.JXPanel |
|---|
getAlpha, getBackgroundPainter, getEffectiveAlpha, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, isInheritAlpha, isPaintBorderInsets, paint, paintComponent, setAlpha, setBackground, setBackgroundPainter, setInheritAlpha, setPaintBorderInsets, setScrollableTracksViewportHeight, setScrollableTracksViewportWidth |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JXMapViewer()
| Method Detail |
|---|
public void setDesignTime(boolean b)
setDesignTime in interface DesignModeb - indicates if the component is being used at design timeBeanContext,
BeanContextMembershipListener,
PropertyChangeEventpublic boolean isDesignTime()
isDesignTime in interface DesignMode
protected void drawMapTiles(Graphics g,
int zoom,
Rectangle viewportBounds)
g - Graphicszoom - zoom level to draw atviewportBounds - the bounds to draw withinpublic void setOverlayPainter(org.jdesktop.swingx.painter.Painter overlay)
overlay - the map overlay to useorg.jdesktop.swingx.painters.Painterpublic org.jdesktop.swingx.painter.Painter getOverlayPainter()
public Rectangle getViewportBounds()
public void setRecenterOnClickEnabled(boolean b)
b - if should recenterpublic boolean isRecenterOnClickEnabled()
public void setZoom(int zoom)
zoom - the new zoom levelpublic int getZoom()
public GeoPosition getAddressLocation()
public void setAddressLocation(GeoPosition addressLocation)
addressLocation - the new address locationgetAddressLocation()public void recenterToAddressLocation()
getAddressLocationpublic boolean isDrawTileBorders()
public void setDrawTileBorders(boolean drawTileBorders)
drawTileBorders - new value of this drawTileBorderspublic boolean isPanEnabled()
public void setPanEnabled(boolean panEnabled)
panEnabled - new property valuepublic boolean isZoomEnabled()
public void setZoomEnabled(boolean zoomEnabled)
zoomEnabled - the new value of the propertypublic void setCenterPosition(GeoPosition geoPosition)
geoPosition - the new property valuepublic GeoPosition getCenterPosition()
public TileFactory getTileFactory()
public void setTileFactory(TileFactory factory)
factory - the new property valuepublic Image getLoadingImage()
public void setLoadingImage(Image loadingImage)
loadingImage - the new property valuepublic Point2D getCenter()
public void setCenter(Point2D center)
center - the new center of the map in pixel coordinatespublic void calculateZoomFrom(Set<GeoPosition> positions)
positions - A set of GeoPositions to calculate the new zoom frompublic boolean isRestrictOutsidePanning()
public void setRestrictOutsidePanning(boolean restrictOutsidePanning)
public boolean isHorizontalWrapped()
public void setHorizontalWrapped(boolean horizontalWrapped)
public Point2D convertGeoPositionToPoint(GeoPosition pos)
pos - a GeoPosition on the map
public GeoPosition convertPointToGeoPosition(Point2D pt)
pt - a point in the local coordinate space of the map
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||