|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gwtopenmaps.openlayers.client.util.JSObjectWrapper org.gwtopenmaps.openlayers.client.OpenLayersObjectWrapper org.gwtopenmaps.openlayers.client.OpenLayersEObjectWrapper org.gwtopenmaps.openlayers.client.Map
public class Map
The Map class is the hub of OpenLayers. Instances of the Map class are "interactive maps embedded in a webpage". In GWT-OpenLayers the map is wrapped in a MapWidget which is a GWT Widget. GWT Widgets can receive events from the browser and can be added to GWT Panels.
MapWidget mapWidget = new MapWidget("100%", "100%"); Map map = mapWidget.getMap(); //instantiates map map.setControls(new LayerSwitcher());Or
MapOptions options = new MapOptions(); options.setControls(new LayerSwitcher()); MapWidget mapWidget = new MapWidget("100%", "100%", options); Map map = mapWidget.getMap(); //instantiates map
Adjusted from OL API docs:
On their own maps do not provide much functionality. To extend a map
it's necessary to add controls, see Control
and layers, see Layer
to the map.
Nested Class Summary | |
---|---|
static interface |
Map.BrowserMenuListener
|
Field Summary |
---|
Fields inherited from class org.gwtopenmaps.openlayers.client.OpenLayersEObjectWrapper |
---|
eventListeners |
Constructor Summary | |
---|---|
protected |
Map(JSObject e)
|
Method Summary | |
---|---|
void |
addControl(Control control)
|
void |
addLayer(Layer layer)
|
void |
addLayers(Layer[] layers)
|
void |
addMapBaseLayerChangedListener(MapBaseLayerChangedListener listener)
|
void |
addMapClickListener(MapClickListener listener)
|
void |
addMapLayerAddedListener(MapLayerAddedListener listener)
|
void |
addMapLayerChangedListener(MapLayerChangedListener listener)
|
void |
addMapLayerRemovedListener(MapLayerRemovedListener listener)
|
void |
addMapMarkerAddedListener(MapMarkerAddedListener listener)
|
void |
addMapMarkerRemovedListener(MapMarkerRemovedListener listener)
|
void |
addMapMoveEndListener(MapMoveEndListener listener)
|
void |
addMapMoveListener(MapMoveListener listener)
|
void |
addMapPopupClosedListener(MapPopupClosedListener listener)
|
void |
addMapPopupOpenedListener(MapPopupOpenedListener listener)
|
void |
addMapZoomListener(MapZoomListener listener)
|
void |
addPopup(Popup popup)
|
void |
addPopupExclusive(Popup popup)
Closes all other popups first |
void |
destroy()
|
void |
disableBrowserContextMenu(Map.BrowserMenuListener listener)
|
boolean |
getAllOverlays()
|
LonLat |
getCenter()
|
Control |
getControlsByClass(String className)
|
Bounds |
getExtent()
|
Layer |
getLayer(String id)
Get a layer based on the id assigned by OpenLayers. |
Layer |
getLayerByName(String name)
This is not an OpenLayers native function. |
int |
getLayerIndex(Layer layer)
|
Layer[] |
getLayers()
|
Layer[] |
getLayersByName(String name)
|
LonLat |
getLonLatFromPixel(Pixel pixel)
|
Bounds |
getMaxExtent()
|
double |
getMaxResolution()
|
int |
getNumLayers()
|
Pixel |
getPixelFromLonLat(LonLat lonlat)
|
String |
getProjection()
|
double |
getResolution()
|
double |
getResolutionForZoom()
|
double |
getScale()
|
Size |
getSize()
|
Size |
getTileSize()
|
String |
getUnits()
See also MapUnits . |
int |
getZoom()
Returns current zoom level of map object. |
int |
getZoomForExtent(Bounds bounds,
boolean closest)
|
static Map |
narrowToMap(JSObject object)
|
void |
pan(int dx,
int dy)
|
void |
panTo(LonLat lonlat)
|
void |
raiseLayer(Layer layer,
int delta)
|
void |
removeControl(Control control)
|
void |
removeLayer(Layer layer)
|
void |
removeLayer(Layer layer,
boolean setNewBaseLayer)
|
void |
removeMapClickListener(MapClickListener listener)
Remove MapClickListener Defined on the Map |
void |
removeOverlayLayers()
This is not an OpenLayers native function. |
void |
removePopup(Popup popup)
|
void |
resetLayersZIndex()
Method: resetLayersZIndex Reset each layer's z-index based on layer's array index |
void |
setBaseLayer(Layer newBaseLayer)
|
void |
setCenter(LonLat lonlat)
|
void |
setCenter(LonLat lonlat,
int zoom)
|
void |
setFractionalZoom(boolean fractionalZoom)
Somehow this is not an API property in OL, but it seems it would make sense as an API property and it is well documented: |
void |
setLayerIndex(Layer layer,
int index)
|
void |
setLayerZIndex(Layer layer,
int zIdx)
Method: setLayerZIndex Parameters: layer - { |
void |
setMaxExtent(Bounds extent)
|
void |
setMinExtent(Bounds extent)
|
void |
setOptions(MapOptions mapOptions)
|
void |
setRestrictedExtent(Bounds extent)
|
void |
updateSize()
This function should be called by any external code which dynamically changes the size of the map div. |
void |
zoomTo(int zoomLevel)
|
void |
zoomToExtent(Bounds bounds)
|
void |
zoomToMaxExtent()
|
void |
zoomToScale(float scale,
boolean closest)
|
Methods inherited from class org.gwtopenmaps.openlayers.client.OpenLayersEObjectWrapper |
---|
getListeners, narrowToOpenLayersEObjectWrapper, removeListener |
Methods inherited from class org.gwtopenmaps.openlayers.client.OpenLayersObjectWrapper |
---|
getClassName, getEvents, narrowToOpenLayersObjectWrapper |
Methods inherited from class org.gwtopenmaps.openlayers.client.util.JSObjectWrapper |
---|
getJSObject, setJSObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Map(JSObject e)
Method Detail |
---|
public static Map narrowToMap(JSObject object)
public LonLat getCenter()
public void setCenter(LonLat lonlat)
public void setCenter(LonLat lonlat, int zoom)
public void addControl(Control control)
public void addLayer(Layer layer)
public void addLayers(Layer[] layers)
public void addPopup(Popup popup)
public void addPopupExclusive(Popup popup)
public void removePopup(Popup popup)
public int getNumLayers()
public Layer getLayer(String id)
Layer
can be asked for it's id. This id can be used
to get at the layer within the application.
id
- - String identifier assigned by OpenLayers
public Layer[] getLayers()
public Control getControlsByClass(String className)
public void removeLayer(Layer layer)
public void removeLayer(Layer layer, boolean setNewBaseLayer)
layer
- setNewBaseLayer
- - {Boolean} default is truepublic void removeControl(Control control)
public int getLayerIndex(Layer layer)
public void setLayerIndex(Layer layer, int index)
public void setLayerZIndex(Layer layer, int zIdx)
public void resetLayersZIndex()
public Layer getLayerByName(String name)
name
- - the name of a layer or part of it
public Layer[] getLayersByName(String name)
name
- - the name of a layer or part of it
public void removeOverlayLayers()
public void zoomToExtent(Bounds bounds)
public int getZoomForExtent(Bounds bounds, boolean closest)
public int getZoom()
public LonLat getLonLatFromPixel(Pixel pixel)
public Pixel getPixelFromLonLat(LonLat lonlat)
public String getProjection()
public String getUnits()
MapUnits
.
public Bounds getExtent()
public Bounds getMaxExtent()
public double getResolution()
public double getScale()
public void raiseLayer(Layer layer, int delta)
public void zoomTo(int zoomLevel)
public void zoomToScale(float scale, boolean closest)
public void zoomToMaxExtent()
public void setOptions(MapOptions mapOptions)
public void panTo(LonLat lonlat)
public void pan(int dx, int dy)
public Size getTileSize()
public Size getSize()
public double getMaxResolution()
public double getResolutionForZoom()
public void setFractionalZoom(boolean fractionalZoom)
Somehow this is not an API property in OL, but it seems it would make sense as an API property and it is well documented:
For a base layer that supports it, allow the map resolution to be set to a value between one of the values in the resolutions array. Default is false. When fractionalZoom is set to true, it is possible to zoom to an arbitrary extent. This requires a base layer from a source that supports requests for arbitrary extents (i.e. not cached tiles on a regular lattice). This means that fractionalZoom will not work with commercial layers (Google, Yahoo, VE), layers using TileCache, or any other pre-cached data sources. If you are using fractionalZoom, then you should also use getResolutionForZoom instead of layer.resolutions[zoom] as the former works for non-integer zoom levels.
public void setMinExtent(Bounds extent)
public void setMaxExtent(Bounds extent)
public void setRestrictedExtent(Bounds extent)
public boolean getAllOverlays()
public void setBaseLayer(Layer newBaseLayer)
public void updateSize()
public void destroy()
public void addMapBaseLayerChangedListener(MapBaseLayerChangedListener listener)
public void addMapLayerAddedListener(MapLayerAddedListener listener)
public void addMapLayerChangedListener(MapLayerChangedListener listener)
public void addMapLayerRemovedListener(MapLayerRemovedListener listener)
public void addMapMoveListener(MapMoveListener listener)
public void addMapMoveEndListener(MapMoveEndListener listener)
public void addMapZoomListener(MapZoomListener listener)
public void addMapMarkerAddedListener(MapMarkerAddedListener listener)
public void addMapMarkerRemovedListener(MapMarkerRemovedListener listener)
public void addMapPopupOpenedListener(MapPopupOpenedListener listener)
public void addMapPopupClosedListener(MapPopupClosedListener listener)
public void addMapClickListener(MapClickListener listener)
public void removeMapClickListener(MapClickListener listener)
listener
- public void disableBrowserContextMenu(Map.BrowserMenuListener listener)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |