com.gwtext.client.widgets.map
Class MapPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.gwtext.client.widgets.Component
              extended by com.gwtext.client.widgets.BoxComponent
                  extended by com.gwtext.client.widgets.Container
                      extended by com.gwtext.client.widgets.Panel
                          extended by com.gwtext.client.widgets.map.MapPanel
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, Observable
Direct Known Subclasses:
FreeEarthMap, GoogleMap, Map24Map, MapQuestMap, MicrosoftMap, MultiMap, OpenLayersMap, OpenStreetMap, YahooMap

public abstract class MapPanel
extends Panel

Base Map Panel for various map providers. This class adds support for the Mapstraction library.

Mapstraction is a library that provides a common API for various mapping APIs to enable switching from one to another as smoothly as possible. Developers can code their applications once, and then easily switch mapping provider based on project needs, terms and conditions, and new functionality.

Users can switch maps as desired based on personal taste and quality of maps in their local area. Various tools built on top of Mapstraction allow users to easily integrate maps into their own sites, and configure them with different controls, styles, and provider.


Field Summary
static com.gwtext.client.widgets.map.MapPanel.FilterOperator GE
           
static com.gwtext.client.widgets.map.MapPanel.MapType HYBRID
           
static com.gwtext.client.widgets.map.MapPanel.FilterOperator LE
           
static java.lang.String MAP_RENDERED_EVENT
           
protected  com.google.gwt.core.client.JavaScriptObject mapJS
           
static com.gwtext.client.widgets.map.MapPanel.MapType ROAD
           
static com.gwtext.client.widgets.map.MapPanel.MapType SATELLITE
           
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Constructor Summary
MapPanel()
          Create a new MapPanel.
 
Method Summary
 void add(Component component)
          Add a component to this Panel.
 void add(Component component, int top, int right)
          Add an absolutely positioned component over the map panel at the specificed location.
 void addEventListener(java.lang.String event, Function listener)
           
 void addFilter(java.lang.String field, com.gwtext.client.widgets.map.MapPanel.FilterOperator operator, double value)
          Adds a marker filter.
 void addFilter(java.lang.String field, com.gwtext.client.widgets.map.MapPanel.FilterOperator operator, int value)
          Adds a marker filter.
 void addFilter(java.lang.String field, com.gwtext.client.widgets.map.MapPanel.FilterOperator operator, java.lang.String value)
          Adds a marker filter.
 void addImageOverlay(java.lang.String id, java.lang.String imageURL, int opacity, double west, double south, double east, double north)
          Layers an georeferenced image over the map.
 void addLargeControls()
          Adds a large map panning control and zoom buttons to the map.
 void addMapTypeControls()
          Adds a map type control to the map (streets, aerial imagery etc) Supported by: yahoo, google, openstreetmap, multimap, mapquest.
 void addMarker(Marker marker)
          Adds a marker pin to the map.
 void addOverlay(java.lang.String overlayURL)
          Adds a GeoRSS or KML overlay to the map.
 void addOverlay(java.lang.String overlayURL, boolean autoCenterAndZoom)
          Adds a GeoRSS or KML overlay to the map.
 void addPolyline(Polyline polyline)
          Adds a polyline to the map.
 void addSmallControls()
          Adds a small map panning control and zoom buttons to the map.
protected  void afterRender()
          Template method that is called after the Component has been renedered.
 void autoCenterAndZoom()
          Sets the center and zoom of the map to the smallest bounding box containing all markers
 void doFilter()
          Executes all filters added since last call
protected abstract  com.google.gwt.core.client.JavaScriptObject doRenderMap(com.google.gwt.user.client.Element element)
           
 void doResize()
           
 BoundingBox getBounds()
          The maps bounding box.
 LatLonPoint getCenter()
          The center of the map.
 com.google.gwt.core.client.JavaScriptObject getMap()
          Return the native map object.
 int getZoom()
          The zoom level of the map.
 int getZoomLevelForBoundingBox(BoundingBox boundingBox)
          This method should be called only after the map has been rendered.
protected  void initComponent()
          This template method is called after the Component has been instantiated but before it's rendered.
 void removeAllMarkers()
          This method should be called only after the map has been rendered.
 void removeAllPolylines()
          This method should be called only after the map has been rendered.
 void removeMarker(Marker marker)
          This method should be called only after the map has been rendered.
 void removePolyline(Polyline polyline)
          This method should be called only after the map has been rendered.
 void resizeTo(int width, int height)
          This method should be called only after the map has been rendered.
 void setCenterAndZoom(LatLonPoint latLonPoint, int zoom)
           
 void setDragging(boolean dragging)
          Enable/disable dragging of the map (only implemented for yahoo and google) Supported by: yahoo, google, openstreetmap, multimap.
 void setHeight(int height)
          The height of this component in pixels (defaults to auto).
 void setMapType(com.gwtext.client.widgets.map.MapPanel.MapType mapType)
          Sets the imagery type for the map.
 void setWidth(int width)
          The component width.
 
Methods inherited from class com.gwtext.client.widgets.Panel
addButton, addListener, addTool, collapse, collapse, create, expand, expand, getBaseCls, getBody, getBodyStyle, getBodyWrap, getBottomToolbar, getCollapsedCls, getCollapseFirst, getConfigPrototype, getFloating, getFooter, getFrameHeight, getFrameWidth, getHeader, getHtml, getIconCls, getInnerHeight, getInnerWidth, getMinButtonWidth, getShadowOffset, getTabCls, getTitle, getTopToolbar, getUpdateManager, getXType, isAnimCollapse, isAutoScroll, isBodyBorder, isBorder, isClosable, isCollapsed, isCollapsible, isFrame, isHeader, isHeaderAsText, isHideCollapseTool, isMaskDisabled, isShadow, isShim, isTitleCollapse, load, load, setAnimCollapse, setAutoLoad, setAutoLoad, setAutoScroll, setBaseCls, setBodyBorder, setBodyStyle, setBorder, setBottomToolbar, setBottomToolbar, setBottomToolbar, setButtonAlign, setButtons, setClosable, setCollapsed, setCollapsedCls, setCollapseFirst, setCollapsible, setContentEl, setDraggable, setFloating, setFooter, setFrame, setHeader, setHeaderAsText, setHideCollapseTool, setHtml, setIconCls, setMargins, setMargins, setMaskDisabled, setMinButtonWidth, setPaddings, setPaddings, setShadow, setShadow, setShadowOffset, setShim, setTabCls, setTitle, setTitle, setTitleCollapse, setTools, setTopToolbar, setTopToolbar, setTopToolbar, toggleCollapse, toggleCollapse
 
Methods inherited from class com.gwtext.client.widgets.Container
add, add, add, addListener, bubble, cascade, clear, doLayout, doLayout, findBy, findByID, findByType, getActiveItem, getActiveItemID, getAutoDestroy, getBufferResize, getComponent, getComponent, getComponents, getHideBorders, getItems, getLayout, getMonitorResize, insert, iterator, remove, remove, remove, remove, removeAll, removeAll, setActiveItem, setActiveItemID, setAutoDestroy, setBufferResize, setDefaults, setHideBorders, setLayout, setMonitorResize
 
Methods inherited from class com.gwtext.client.widgets.BoxComponent
addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setPagePosition, setPosition, setSize, setSize, setWidth, syncSize, updateBox
 
Methods inherited from class com.gwtext.client.widgets.Component
addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, addPlugin, addStyleDependentName, addStyleName, beforeDestroy, check, checkExtVer, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, findParentBy, findParentByType, fireEvent, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getCls, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getXTypes, hashCode, hide, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, purgeListeners, removeClass, removeStyleDependentName, removeStyleName, render, render, render, render, render, render, resumeEvents, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoEl, setAutoShow, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setElement, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setVisible, show, suspendEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

mapJS

protected com.google.gwt.core.client.JavaScriptObject mapJS

MAP_RENDERED_EVENT

public static final java.lang.String MAP_RENDERED_EVENT
See Also:
Constant Field Values

GE

public static com.gwtext.client.widgets.map.MapPanel.FilterOperator GE

LE

public static com.gwtext.client.widgets.map.MapPanel.FilterOperator LE

ROAD

public static com.gwtext.client.widgets.map.MapPanel.MapType ROAD

SATELLITE

public static com.gwtext.client.widgets.map.MapPanel.MapType SATELLITE

HYBRID

public static com.gwtext.client.widgets.map.MapPanel.MapType HYBRID
Constructor Detail

MapPanel

public MapPanel()
Create a new MapPanel.

Method Detail

afterRender

protected void afterRender()
Description copied from class: Component
Template method that is called after the Component has been renedered.

Overrides:
afterRender in class Component

initComponent

protected void initComponent()
Description copied from class: Component
This template method is called after the Component has been instantiated but before it's rendered. Subclasses can override it to provide any "constructor" type logic thats desired/

Overrides:
initComponent in class Component

doRenderMap

protected abstract com.google.gwt.core.client.JavaScriptObject doRenderMap(com.google.gwt.user.client.Element element)

setWidth

public void setWidth(int width)
Description copied from class: BoxComponent
The component width. (defaults to auto)

Overrides:
setWidth in class BoxComponent
Parameters:
width - the width, -1 for auto

setHeight

public void setHeight(int height)
Description copied from class: BoxComponent
The height of this component in pixels (defaults to auto).

Overrides:
setHeight in class BoxComponent
Parameters:
height - the component height

doResize

public void doResize()

addEventListener

public void addEventListener(java.lang.String event,
                             Function listener)

addFilter

public void addFilter(java.lang.String field,
                      com.gwtext.client.widgets.map.MapPanel.FilterOperator operator,
                      java.lang.String value)
Adds a marker filter.

Parameters:
field - the name of attribute to filter on
operator - the filter operator
value - the value to compare against

addFilter

public void addFilter(java.lang.String field,
                      com.gwtext.client.widgets.map.MapPanel.FilterOperator operator,
                      int value)
Adds a marker filter.

Parameters:
field - the name of attribute to filter on
operator - the filter operator
value - the value to compare against

addFilter

public void addFilter(java.lang.String field,
                      com.gwtext.client.widgets.map.MapPanel.FilterOperator operator,
                      double value)
Adds a marker filter.

Parameters:
field - the name of attribute to filter on
operator - the filter operator
value - the value to compare against

addOverlay

public void addOverlay(java.lang.String overlayURL)
Adds a GeoRSS or KML overlay to the map. Some flavors of GeoRSS and KML are not supported by some of the Map providers

Parameters:
overlayURL - adds a GeoRSS or KML overlay to the map

setMapType

public void setMapType(com.gwtext.client.widgets.map.MapPanel.MapType mapType)
Sets the imagery type for the map.

Parameters:
mapType - the map type

addOverlay

public void addOverlay(java.lang.String overlayURL,
                       boolean autoCenterAndZoom)
Adds a GeoRSS or KML overlay to the map. Some flavors of GeoRSS and KML are not supported by some of the Map providers

Parameters:
overlayURL - adds a GeoRSS or KML overlay to the map
autoCenterAndZoom - true to auto center and zoom after the feed is loaded

addImageOverlay

public void addImageOverlay(java.lang.String id,
                            java.lang.String imageURL,
                            int opacity,
                            double west,
                            double south,
                            double east,
                            double north)
Layers an georeferenced image over the map.

Parameters:
id - unique ID of the image overlay
imageURL - url of image
opacity - 0-100
west - the west boundary
south - the south boundary
east - the east boundary
north - the north boundary

addLargeControls

public void addLargeControls()
Adds a large map panning control and zoom buttons to the map. Supported by: yahoo, google, openstreetmap, multimap, mapquest.


addMapTypeControls

public void addMapTypeControls()
Adds a map type control to the map (streets, aerial imagery etc) Supported by: yahoo, google, openstreetmap, multimap, mapquest.


addMarker

public void addMarker(Marker marker)
Adds a marker pin to the map.

Parameters:
marker - the marker to add

addPolyline

public void addPolyline(Polyline polyline)
Adds a polyline to the map.

Parameters:
polyline - the polyline to add

addSmallControls

public void addSmallControls()
Adds a small map panning control and zoom buttons to the map. Supported by: yahoo, google, openstreetmap, multimap, mapquest.


autoCenterAndZoom

public void autoCenterAndZoom()
Sets the center and zoom of the map to the smallest bounding box containing all markers


doFilter

public void doFilter()
Executes all filters added since last call


setDragging

public void setDragging(boolean dragging)
Enable/disable dragging of the map (only implemented for yahoo and google) Supported by: yahoo, google, openstreetmap, multimap.

Parameters:
dragging - true to enable dragging

getBounds

public BoundingBox getBounds()
The maps bounding box. This method should be called only after the map has been rendered.

Returns:
the BoundingBox

getCenter

public LatLonPoint getCenter()
The center of the map. This method should be called only after the map has been rendered.

Returns:
the center

getMap

public com.google.gwt.core.client.JavaScriptObject getMap()
Return the native map object. This method should be called only after the map has been rendered.

Returns:
this native map

getZoom

public int getZoom()
The zoom level of the map.

Returns:
the zoom level of the map

getZoomLevelForBoundingBox

public int getZoomLevelForBoundingBox(BoundingBox boundingBox)
This method should be called only after the map has been rendered.

Parameters:
boundingBox - the bounding box
Returns:
zoom level

removeMarker

public void removeMarker(Marker marker)
This method should be called only after the map has been rendered.


removeAllMarkers

public void removeAllMarkers()
This method should be called only after the map has been rendered.


removePolyline

public void removePolyline(Polyline polyline)
This method should be called only after the map has been rendered.


removeAllPolylines

public void removeAllPolylines()
This method should be called only after the map has been rendered.


resizeTo

public void resizeTo(int width,
                     int height)
This method should be called only after the map has been rendered.

Parameters:
width - thw width
height - the height

setCenterAndZoom

public void setCenterAndZoom(LatLonPoint latLonPoint,
                             int zoom)

add

public void add(Component component)
Add a component to this Panel.

Overrides:
add in class Container
Parameters:
component - the component to add

add

public void add(Component component,
                int top,
                int right)
Add an absolutely positioned component over the map panel at the specificed location.

Parameters:
component - the component to add
top - the top coordinate
right - the right coordinate