Class MapArea
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- org.gwtopenmaps.openlayers.client.MapWidget
-
- uk.ac.rdg.resc.godiva.client.widgets.MapArea
-
- All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.shared.HasHandlers
,com.google.gwt.user.client.EventListener
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.IsWidget
,com.google.gwt.user.client.ui.RequiresResize
,OpacitySelectionHandler
,DialogBoxWithCloseButton.CentrePosIF
public class MapArea extends org.gwtopenmaps.openlayers.client.MapWidget implements OpacitySelectionHandler, DialogBoxWithCloseButton.CentrePosIF
A widget containing the main OpenLayers map.- Author:
- Guy Griffiths
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MapArea.FeatureInfoMessageAndFeatureIds
static class
MapArea.FixedLayerDetails
A class to store details for a "fixed" layer - i.e.protected class
MapArea.WmsDetails
-
Field Summary
Fields Modifier and Type Field Description protected org.gwtopenmaps.openlayers.client.layer.Image
animLayer
protected boolean
animLayerLoading
We keep track of this because animations can be turned off before they've finished loading.protected String
baseUrlForExport
protected Map<String,UnitConverter>
converters
Map of unit conversions to be applied to each layerprotected static org.gwtopenmaps.openlayers.client.Projection
CRS84
protected String
currentProjection
protected org.gwtopenmaps.openlayers.client.control.EditingToolbar
editingToolbar
protected static com.google.gwt.i18n.client.NumberFormat
FORMATTER
protected org.gwtopenmaps.openlayers.client.control.WMSGetFeatureInfo
getFeatureInfo
protected String
layersForExport
protected org.gwtopenmaps.openlayers.client.event.LayerLoadCancelListener
loadCancelListener
protected org.gwtopenmaps.openlayers.client.event.LayerLoadEndListener
loadEndListener
protected org.gwtopenmaps.openlayers.client.event.LayerLoadStartListener
loadStartListener
protected org.gwtopenmaps.openlayers.client.Map
map
int
maxFeatures
protected float
opacity
protected Map<String,MapArea.FixedLayerDetails>
overLayers
protected String
overlaysForExport
protected String
proxyUrl
protected String
transectLayer
protected GodivaActionsHandler
widgetDisabler
protected Map<String,MapArea.WmsDetails>
wmsLayers
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions
wmsNorthPolarOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions
wmsSouthPolarOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions
wmsStandardOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions
wmsWebMercOptions
-
Constructor Summary
Constructors Constructor Description MapArea(int width, int height, GodivaActionsHandler godivaListener, String proxyUrl, MapArea.FixedLayerDetails... additionalLayers)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnimationLayer(String wmsUrl, String layerId, String timeList, String currentElevation, String palette, String style, String scaleRange, String aboveMaxString, String belowMinString, String noDataString, int nColorBands, boolean logScale, String frameRate)
Adds an animation layer to the mapprotected void
addBaseLayers(MapArea.FixedLayerDetails[] additionalLayers)
protected void
addDrawingLayer()
void
addLayer(String wmsUrl, String internalLayerId, String wmsLayerName, String time, String targetTime, String elevation, String targetElevation, String style, String palette, String aboveMaxString, String belowMinString, String noDataString, String scaleRange, int nColourBands, boolean logScale, boolean queryable, boolean downloadable, boolean multipleElevations, boolean multipleTimes)
Adds a WMS layer to the mapprotected void
displayImagePopup(String url, String title)
Used to display an image in a new window.protected void
doAddingOfLayer(String wmsUrl, String internalLayerId, org.gwtopenmaps.openlayers.client.layer.WMSParams params, org.gwtopenmaps.openlayers.client.layer.WMSOptions options, boolean queryable, boolean downloadable, boolean multipleElevations, boolean multipleTimes)
String
getBackgroundMapName()
String
getBaseLayerLayers()
String
getBaseLayerUrl()
ScreenPosition
getCentre()
protected static org.gwtopenmaps.openlayers.client.MapOptions
getDefaultMapOptions()
String
getKMZUrl()
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions
getOptionsForCurrentProjection()
String
getOverlaysForExport()
protected String
getTransectLayerId()
protected void
init(MapArea.FixedLayerDetails[] additionalLayers)
protected MapArea.FeatureInfoMessageAndFeatureIds
processFeatureInfo(String text, UnitConverter converter)
void
removeLayer(String layerId)
void
setAllowTransects(boolean allowTransects)
void
setBackgroundMap(String layerName)
protected void
setGetFeatureInfoDetails(String wmsUrl, boolean multipleElevations, boolean multipleTimes, boolean downloadable, String layerId)
void
setOpacity(String layerId, float opacity)
void
setTransectLayerId(String transectLayer)
void
setUnitConverter(String layerId, UnitConverter converter)
Sets aUnitConverter
for a specified layer.void
stopAnimation()
void
updatePos()
This should be called when the position/size of the map has changed.void
zoomToExtent(String extents)
-
Methods inherited from class org.gwtopenmaps.openlayers.client.MapWidget
getMap, onAttach, onLoad, onResize, setHeight, setWidth
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
-
-
-
-
Field Detail
-
CRS84
protected static final org.gwtopenmaps.openlayers.client.Projection CRS84
-
FORMATTER
protected static final com.google.gwt.i18n.client.NumberFormat FORMATTER
-
maxFeatures
public int maxFeatures
-
map
protected org.gwtopenmaps.openlayers.client.Map map
-
wmsLayers
protected Map<String,MapArea.WmsDetails> wmsLayers
-
overLayers
protected Map<String,MapArea.FixedLayerDetails> overLayers
-
animLayer
protected org.gwtopenmaps.openlayers.client.layer.Image animLayer
-
currentProjection
protected String currentProjection
-
transectLayer
protected String transectLayer
-
wmsNorthPolarOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions wmsNorthPolarOptions
-
wmsSouthPolarOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions wmsSouthPolarOptions
-
wmsStandardOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions wmsStandardOptions
-
wmsWebMercOptions
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions wmsWebMercOptions
-
loadStartListener
protected org.gwtopenmaps.openlayers.client.event.LayerLoadStartListener loadStartListener
-
loadCancelListener
protected org.gwtopenmaps.openlayers.client.event.LayerLoadCancelListener loadCancelListener
-
loadEndListener
protected org.gwtopenmaps.openlayers.client.event.LayerLoadEndListener loadEndListener
-
widgetDisabler
protected GodivaActionsHandler widgetDisabler
-
baseUrlForExport
protected String baseUrlForExport
-
layersForExport
protected String layersForExport
-
overlaysForExport
protected String overlaysForExport
-
getFeatureInfo
protected org.gwtopenmaps.openlayers.client.control.WMSGetFeatureInfo getFeatureInfo
-
editingToolbar
protected org.gwtopenmaps.openlayers.client.control.EditingToolbar editingToolbar
-
proxyUrl
protected String proxyUrl
-
opacity
protected float opacity
-
converters
protected Map<String,UnitConverter> converters
Map of unit conversions to be applied to each layer
-
animLayerLoading
protected boolean animLayerLoading
We keep track of this because animations can be turned off before they've finished loading. This means the loading bar stays present.
-
-
Constructor Detail
-
MapArea
public MapArea(int width, int height, GodivaActionsHandler godivaListener, String proxyUrl, MapArea.FixedLayerDetails... additionalLayers)
-
-
Method Detail
-
addAnimationLayer
public void addAnimationLayer(String wmsUrl, String layerId, String timeList, String currentElevation, String palette, String style, String scaleRange, String aboveMaxString, String belowMinString, String noDataString, int nColorBands, boolean logScale, String frameRate)
Adds an animation layer to the map- Parameters:
wmsUrl
- The WMS URLlayerId
- The WMS layer IDtimeList
- A comma separated list of times for the animationcurrentElevation
- The elevation for the animationpalette
- The palette namestyle
- The style nameaboveMaxString
- A string representing the colour for data above the max scale rangebelowMinString
- A string representing the colour for data below min scale rangenoDataString
- A string representing the colour when there is no datascaleRange
- The scale range, of the form "[min],[max]"nColorBands
- The number of colour bands to uselogScale
- Whether to use a logarithmic colour scaleframeRate
- The frame rate of the final animation
-
stopAnimation
public void stopAnimation()
-
addLayer
public void addLayer(String wmsUrl, String internalLayerId, String wmsLayerName, String time, String targetTime, String elevation, String targetElevation, String style, String palette, String aboveMaxString, String belowMinString, String noDataString, String scaleRange, int nColourBands, boolean logScale, boolean queryable, boolean downloadable, boolean multipleElevations, boolean multipleTimes)
Adds a WMS layer to the map- Parameters:
wmsUrl
- The WMS URLinternalLayerId
- An internal layer ID. This allows us to add multiple WMS layers to this mapwmsLayerName
- The WMS layer IDtime
- The time (or time range) at which we want datatargetTime
- If we have a continuous time axis, what time should we try and colour the data's value atelevation
- The elevation (or elevation range) at which we want datatargetElevation
- If we have a continuous elevation axis, what elevation should we try and colour the data's value atstyle
- The style name for this layerpalette
- The palette name for this layeraboveMaxString
- The string defining the colour to display when values are above the maxbelowMinString
- The string defining the colour to display when values are below the minscaleRange
- The scale range (as a string: "[min],[max]")nColourBands
- The number of colour bands in the palettelogScale
- Whether to use a logarithmic scalemultipleElevations
- Whether we have multiple elevations availablemultipleTimes
- Whether we have multiple times available
-
doAddingOfLayer
protected void doAddingOfLayer(String wmsUrl, String internalLayerId, org.gwtopenmaps.openlayers.client.layer.WMSParams params, org.gwtopenmaps.openlayers.client.layer.WMSOptions options, boolean queryable, boolean downloadable, boolean multipleElevations, boolean multipleTimes)
-
removeLayer
public void removeLayer(String layerId)
-
setGetFeatureInfoDetails
protected void setGetFeatureInfoDetails(String wmsUrl, boolean multipleElevations, boolean multipleTimes, boolean downloadable, String layerId)
-
displayImagePopup
protected void displayImagePopup(String url, String title)
Used to display an image in a new window. This is used for showing vertical profiles or time series plots- Parameters:
url
- The absolute URL of the imagetitle
- The title of the popup box
-
zoomToExtent
public void zoomToExtent(String extents)
-
getKMZUrl
public String getKMZUrl()
- Returns:
- The URL used to get a KMZ of the currently displayed layer
-
getDefaultMapOptions
protected static org.gwtopenmaps.openlayers.client.MapOptions getDefaultMapOptions()
-
init
protected void init(MapArea.FixedLayerDetails[] additionalLayers)
-
setOpacity
public void setOpacity(String layerId, float opacity)
-
setUnitConverter
public void setUnitConverter(String layerId, UnitConverter converter)
Sets aUnitConverter
for a specified layer. This will allow GetFeatureInfo requests to display the correct value- Parameters:
layerId
- The internal layer to apply the conversion toconverter
- TheUnitConverter
to use
-
getBaseLayerUrl
public String getBaseLayerUrl()
-
getBaseLayerLayers
public String getBaseLayerLayers()
-
getOverlaysForExport
public String getOverlaysForExport()
-
getBackgroundMapName
public String getBackgroundMapName()
-
setBackgroundMap
public void setBackgroundMap(String layerName)
-
addBaseLayers
protected void addBaseLayers(MapArea.FixedLayerDetails[] additionalLayers)
-
getOptionsForCurrentProjection
protected org.gwtopenmaps.openlayers.client.layer.WMSOptions getOptionsForCurrentProjection()
-
processFeatureInfo
protected MapArea.FeatureInfoMessageAndFeatureIds processFeatureInfo(String text, UnitConverter converter)
-
addDrawingLayer
protected void addDrawingLayer()
-
getTransectLayerId
protected String getTransectLayerId()
-
setTransectLayerId
public void setTransectLayerId(String transectLayer)
-
setAllowTransects
public void setAllowTransects(boolean allowTransects)
-
getCentre
public ScreenPosition getCentre()
- Specified by:
getCentre
in interfaceDialogBoxWithCloseButton.CentrePosIF
-
updatePos
public void updatePos()
This should be called when the position/size of the map has changed. Failing to do so will lead to e.g. incorrect positions for GetFeatureInfo
-
-