GeoMapHelperListener
, GeoMapPositioned
public class GeoMap extends InternalGeoMap
256*1<. This measure is referred
to as map-coordinates. Geometric locations like longitude and latitude can be
obtained by helper methods. Note that a point in map-coordinates corresponds
to a given geometric position but also depending on the current zoom level.
You can zoomIn around current mouse position by left double click. Left right
click zooms out.
Methods of interest are
setZoom(int)
which sets the map's zoom level. Values between 1
and 18 are allowed.
setMapPosition(Point)
which sets the map's top left corner. (In
map coordinates)
setCenterPosition(Point)
which sets the map's center position.
(In map coordinates) for the given longitude and latitude. If you want
to center the map around this geometric location you need to pass the result
to the method
For performance tuning the two crucial parameters are the size of the tile
cache and the number of image-loader threads.
License is EPL (Eclipse Public License)
http://www.eclipse.org/legal/epl-v10.html. Contact at stepan.rutz@gmx.de
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ABOUT_MSG |
About message.
|
Constructor | Description |
---|---|
GeoMap(org.eclipse.swt.widgets.Composite parent,
int style) |
Creates a new
GeoMap using the default size for its internal
cache of tiles. |
GeoMap(org.eclipse.swt.widgets.Composite parent,
int style,
org.eclipse.swt.graphics.Point mapPosition,
int zoom) |
Creates a new
GeoMap using the default size for its internal
cache of tiles |
GeoMap(org.eclipse.swt.widgets.Composite parent,
int style,
org.eclipse.swt.graphics.Point mapPosition,
int zoom,
int cacheSize) |
Creates a new
GeoMap using the default size for its internal
cache of tiles |
Modifier and Type | Method | Description |
---|---|---|
void |
addGeoMapListener(GeoMapListener listener) |
Adds a GeoMapListener, that will be notified of changes to the position
and zoom level
|
void |
addMouseHandler(java.util.EventListener listener) |
Adds listener to appropriate listener lists depending on the listener
interfaces that are implemented.
|
org.eclipse.swt.graphics.Point |
getCenterPosition() |
Returns the position of the center of this GeoMap.
|
org.eclipse.swt.graphics.Point |
getCursorPosition() |
Returns the map position of the mouse cursor.
|
DefaultMouseHandler |
getDefaultMouseHandler() |
Returns the default mouse handler, so it may be configured or removed.
|
TileServer |
getTileServer() |
Returns the current TileServer of this GeoMap.
|
void |
removeGeoMapListener(GeoMapListener listener) |
Removes a GeoMapListener, so it no longer will be notified of changes to
the position and zoom level
|
void |
removeMouseHandler(java.util.EventListener listener) |
Removes listener from appropriate listener lists depending on the
listener interfaces that are implemented.
|
void |
setCenterPosition(org.eclipse.swt.graphics.Point mapPosition) |
Sets the position of the center of this GeoMap, without any panning
effect.
|
void |
setMapPosition(int x,
int y) |
Sets the position of the upper left corner of this GeoMap, without any
panning effect.
|
void |
setMapPosition(org.eclipse.swt.graphics.Point mapPosition) |
Sets the position of the upper left corner of this GeoMap, without any
panning effect.
|
void |
setTileServer(TileServer tileServer) |
Sets the current TileServer of this GeoMap.
|
void |
setZoom(int zoom) |
Sets the zoom level, without any transition effect.
|
void |
translateMapPosition(int tx,
int ty) |
Translates the position of the upper left corner of this GeoMap, without
any panning effect.
|
void |
zoomIn(org.eclipse.swt.graphics.Point pivot) |
Zooms in, while ensuring that the pivot point remains at the same screen
location.
|
void |
zoomOut(org.eclipse.swt.graphics.Point pivot) |
Zooms out, while ensuring that the pivot point remains at the same screen
location.
|
void |
zoomTo(org.eclipse.swt.graphics.Rectangle rect) |
Zooms into and centers on the specified rectangle.
|
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addInternalGeoMapListener, getMapPosition, getMaxZoom, getZoom, removeInternalGeoMapListener, tileUpdated
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final java.lang.String ABOUT_MSG
public GeoMap(org.eclipse.swt.widgets.Composite parent, int style)
GeoMap
using the default size for its internal
cache of tiles. The map is showing the position
(275091, 180145
at zoom level 11
. In other
words this constructor is best used only in debugging scenarios.parent
- SWT parent Composite
style
- SWT style as in Canvas
, since this class inherits
from it. Double buffering is always enabed.public GeoMap(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.graphics.Point mapPosition, int zoom)
GeoMap
using the default size for its internal
cache of tilesparent
- SWT parent Composite
style
- SWT style as in Canvas
, since this class inherits
from it. Double buffering is always enabed.mapPosition
- initial mapPosition.zoom
- initial map zoompublic GeoMap(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.graphics.Point mapPosition, int zoom, int cacheSize)
GeoMap
using the default size for its internal
cache of tilesparent
- SWT parent Composite
style
- SWT style as in Canvas
, since this class inherits
from it. Double buffering is always enabed.mapPosition
- initial mapPosition.zoom
- initial map zoomcacheSize
- initial cache size, eg number of tile-images that are kept in
cache to prevent reloading from the network.public DefaultMouseHandler getDefaultMouseHandler()
public void addMouseHandler(java.util.EventListener listener)
listener
- the listenerpublic void removeMouseHandler(java.util.EventListener listener)
listener
- the listenerpublic TileServer getTileServer()
public void setTileServer(TileServer tileServer)
tileServer
- the TileServerpublic void addGeoMapListener(GeoMapListener listener)
listener
- the GeoMapListenerpublic void removeGeoMapListener(GeoMapListener listener)
listener
- the GeoMapListenerpublic void setMapPosition(org.eclipse.swt.graphics.Point mapPosition)
mapPosition
- the new positionpublic void setMapPosition(int x, int y)
setMapPosition
in interface GeoMapPositioned
setMapPosition
in class InternalGeoMap
x
- the x-coordinate of the positiony
- the y-coordinate of the positionpublic void translateMapPosition(int tx, int ty)
tx
- the relative distance in x-directionty
- the relative distance in y-directionpublic void setZoom(int zoom)
setZoom
in interface GeoMapPositioned
setZoom
in class InternalGeoMap
zoom
- the new zoom levelpublic void zoomIn(org.eclipse.swt.graphics.Point pivot)
pivot
- the point that will remain at the same screen location.public void zoomOut(org.eclipse.swt.graphics.Point pivot)
pivot
- the point that will remain at the same screen location.public void zoomTo(org.eclipse.swt.graphics.Rectangle rect)
rect
- the rectanglepublic org.eclipse.swt.graphics.Point getCenterPosition()
public void setCenterPosition(org.eclipse.swt.graphics.Point mapPosition)
mapPosition
- the new positionpublic org.eclipse.swt.graphics.Point getCursorPosition()