Package uk.ac.rdg.resc.godiva.client
Class Godiva
- java.lang.Object
-
- uk.ac.rdg.resc.godiva.client.BaseWmsClient
-
- uk.ac.rdg.resc.godiva.client.Godiva
-
- All Implemented Interfaces:
com.google.gwt.core.client.EntryPoint
,org.gwtopenmaps.openlayers.client.event.EventListener
,org.gwtopenmaps.openlayers.client.event.MapMoveListener
,org.gwtopenmaps.openlayers.client.event.MapZoomListener
,AviExportHandler
,ElevationSelectionHandler
,GodivaActionsHandler
,LayerSelectionHandler
,PaletteSelectionHandler
,TimeDateSelectionHandler
,ErrorHandler
public class Godiva extends BaseWmsClient implements AviExportHandler
This is a concrete implementation ofBaseWmsClient
for a client which handles a single WMS layer at a time- Author:
- Guy Griffiths
-
-
Field Summary
Fields Modifier and Type Field Description protected AnimationButton
anim
protected String
currentLayerExtent
protected com.google.gwt.user.client.ui.Anchor
docLink
protected boolean
downloadable
protected com.google.gwt.user.client.ui.Anchor
email
protected com.google.gwt.user.client.ui.PushButton
infoButton
protected com.google.gwt.user.client.ui.Anchor
kmzLink
protected LayerSelectorIF
layerSelector
protected com.google.gwt.user.client.ui.Image
loadingImage
protected com.google.gwt.user.client.ui.Image
logo
protected com.google.gwt.user.client.ui.Anchor
permalink
protected boolean
permalinking
protected CaseInsensitiveParameterMap
permalinkParamsMap
protected boolean
profilesSupported
protected boolean
queryable
protected com.google.gwt.user.client.ui.Anchor
screenshot
protected boolean
timeseriesSupported
protected GodivaStateInfo
widgetCollection
protected static String
WMS_LAYER_ID
protected com.google.gwt.user.client.ui.PushButton
zoomToLayerExtents
-
Fields inherited from class uk.ac.rdg.resc.godiva.client.BaseWmsClient
dateTimeDetailsLoaded, docHref, layerDetailsLoaded, mapArea, mapHeight, mapWidth, minMaxDetailsLoaded, nearestTime, proxyUrl
-
-
Constructor Summary
Constructors Constructor Description Godiva()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
animationStarted(String times, String fps)
This is called when an animation is started.void
animationStopped()
Called when the animation is stopped.protected void
availableTimesLoaded(String layerId, List<String> availableTimes, String nearestTime)
This is called once a list of available times has been loadedvoid
disableWidgets()
Called to disable widgets.void
enableWidgets()
Called to enable widgets.String
getAviUrl(String times, String frameRate)
Returns the URL to fetch an AVI file.protected String
getCurrentTime()
Returns the "current" time.protected ElevationSelectorIF
getElevationSelector()
Gets a new elevation selector.protected LayerSelectorIF
getLayerSelector()
Gets a new layer selector.protected com.google.gwt.user.client.ui.Widget
getLayout()
Gets the layout.protected com.google.gwt.user.client.ui.Image
getLogo()
This is something that will almost certainly be changed for custom clients, so put it in a method which can be overriddenprotected PaletteSelectorIF
getPaletteSelector(LayerSelectorIF wmsUrlProvider, DialogBoxWithCloseButton.CentrePosIF localCentre)
Gets a new palette selector.protected TimeSelectorIF
getTimeSelector()
Gets a new time selector.protected GodivaStateInfo
getWidgetCollection(String layerId)
Gets theGodivaStateInfo
for the specified layerprotected void
init()
This gets called once the page has loaded.protected void
layerDetailsLoaded(LayerDetails layerDetails)
This is called once a layer's details have been loaded.protected void
loadingFinished()
This is called when all loading processes have finishedprotected void
loadingStarted()
This is called when a loading process startsprotected void
menuLoaded(LayerMenuItem menuTree)
void
onMapMove(org.gwtopenmaps.openlayers.client.event.MapMoveListener.MapMoveEvent eventObject)
void
onMapZoom(org.gwtopenmaps.openlayers.client.event.MapZoomListener.MapZoomEvent eventObject)
protected void
requestAndPopulateMenu()
Requests the layer menu from the server.protected void
requestLayerDetails(String wmsUrl, String layerId, String currentTime, boolean autoZoomAndPalette)
Request details about a particular layer.void
setOpacity(String layerId, float opacity)
Called when the opacity of a layer is setprotected void
setUnitConverter(UnitConverter converter)
Overrides the parent method using the single-WMS layer.void
updateLinksEtc()
Updates the links (KMZ, screenshot, email, permalink...)protected void
updateMap(MapArea mapArea, String layerUpdated)
This is where the map should be updated.-
Methods inherited from class uk.ac.rdg.resc.godiva.client.BaseWmsClient
autoAdjustPalette, dateSelected, datetimeSelected, elevationSelected, getMapArea, getMapHeight, getMapWidth, getUrlFromGetArgs, getWmsRequestUrl, handleCustomParams, handleError, initWithDefaults, invalidJson, layerDeselected, layerSelected, logScaleChanged, maybeRequestAutoRange, onModuleLoad, paletteChanged, populateWidgets, rangeLoaded, refreshLayerList, scaleRangeChanged, setLoading, setUnitConverter, updateMapBase
-
-
-
-
Field Detail
-
WMS_LAYER_ID
protected static final String WMS_LAYER_ID
- See Also:
- Constant Field Values
-
layerSelector
protected LayerSelectorIF layerSelector
-
widgetCollection
protected GodivaStateInfo widgetCollection
-
infoButton
protected com.google.gwt.user.client.ui.PushButton infoButton
-
logo
protected com.google.gwt.user.client.ui.Image logo
-
loadingImage
protected com.google.gwt.user.client.ui.Image loadingImage
-
permalinking
protected boolean permalinking
-
permalinkParamsMap
protected CaseInsensitiveParameterMap permalinkParamsMap
-
kmzLink
protected com.google.gwt.user.client.ui.Anchor kmzLink
-
permalink
protected com.google.gwt.user.client.ui.Anchor permalink
-
email
protected com.google.gwt.user.client.ui.Anchor email
-
screenshot
protected com.google.gwt.user.client.ui.Anchor screenshot
-
docLink
protected com.google.gwt.user.client.ui.Anchor docLink
-
anim
protected AnimationButton anim
-
queryable
protected boolean queryable
-
downloadable
protected boolean downloadable
-
timeseriesSupported
protected boolean timeseriesSupported
-
profilesSupported
protected boolean profilesSupported
-
currentLayerExtent
protected String currentLayerExtent
-
zoomToLayerExtents
protected com.google.gwt.user.client.ui.PushButton zoomToLayerExtents
-
-
Method Detail
-
init
protected void init()
Description copied from class:BaseWmsClient
This gets called once the page has loaded. Subclasses should use for initializing any widgets, and setting the layout. If this is not implemented, a blank page will be displayed- Specified by:
init
in classBaseWmsClient
-
getWidgetCollection
protected GodivaStateInfo getWidgetCollection(String layerId)
Description copied from class:BaseWmsClient
Gets theGodivaStateInfo
for the specified layer- Specified by:
getWidgetCollection
in classBaseWmsClient
- Parameters:
layerId
- The WMS layer ID- Returns:
- The state information, usually in the form of widgets
-
requestAndPopulateMenu
protected void requestAndPopulateMenu()
Requests the layer menu from the server. When the menu is returned, menuLoaded will be called- Specified by:
requestAndPopulateMenu
in classBaseWmsClient
-
availableTimesLoaded
protected void availableTimesLoaded(String layerId, List<String> availableTimes, String nearestTime)
Description copied from class:BaseWmsClient
This is called once a list of available times has been loaded- Specified by:
availableTimesLoaded
in classBaseWmsClient
- Parameters:
layerId
- the layer for which times have been loadedavailableTimes
- aList
of available timesnearestTime
- the nearest time to the current time (for e.g. auto selection)
-
updateMap
protected void updateMap(MapArea mapArea, String layerUpdated)
Description copied from class:BaseWmsClient
This is where the map should be updated. It gets called when all details have been loaded and we actually want to update the map. Clients should handle this in the appropriate way, which will almost certainly involve a call to mapArea.addLayer(...)- Specified by:
updateMap
in classBaseWmsClient
- Parameters:
mapArea
- The map area which can be updatedlayerUpdated
- The ID of the layer which we are viewing
-
loadingStarted
protected void loadingStarted()
Description copied from class:BaseWmsClient
This is called when a loading process starts- Specified by:
loadingStarted
in classBaseWmsClient
-
loadingFinished
protected void loadingFinished()
Description copied from class:BaseWmsClient
This is called when all loading processes have finished- Specified by:
loadingFinished
in classBaseWmsClient
-
getCurrentTime
protected String getCurrentTime()
Description copied from class:BaseWmsClient
Returns the "current" time. The definition of current may depend on exactly what the client does. This is the time used when requesting layer details from the server - i.e. the time to which the "nearestTime" will refer- Specified by:
getCurrentTime
in classBaseWmsClient
- Returns:
- A string representation of the current time
-
enableWidgets
public void enableWidgets()
Description copied from interface:GodivaActionsHandler
Called to enable widgets. This allows control of which widgets are available when e.g. animation is happening- Specified by:
enableWidgets
in interfaceGodivaActionsHandler
-
disableWidgets
public void disableWidgets()
Description copied from interface:GodivaActionsHandler
Called to disable widgets. This allows control of which widgets are available when e.g. animation is happening- Specified by:
disableWidgets
in interfaceGodivaActionsHandler
-
getAviUrl
public String getAviUrl(String times, String frameRate)
Description copied from interface:AviExportHandler
Returns the URL to fetch an AVI file. This depends on the timesteps and frame rate required (all other data can be obtained from the current state (GodivaStateInfo
)- Specified by:
getAviUrl
in interfaceAviExportHandler
- Parameters:
times
- A string representing the desired timesframeRate
- The frame rate, in frames-per-second- Returns:
- A URL which will lead to an AVI file containing an animation
-
animationStarted
public void animationStarted(String times, String fps)
Description copied from interface:AviExportHandler
This is called when an animation is started. We provide the times and FPS so that the implementation can call getAviUrl if required (for example to set a link to the AVI when an animation is started as an overlay)- Specified by:
animationStarted
in interfaceAviExportHandler
-
animationStopped
public void animationStopped()
Description copied from interface:AviExportHandler
Called when the animation is stopped.- Specified by:
animationStopped
in interfaceAviExportHandler
-
setOpacity
public void setOpacity(String layerId, float opacity)
Description copied from interface:PaletteSelectionHandler
Called when the opacity of a layer is set- Specified by:
setOpacity
in interfacePaletteSelectionHandler
- Parameters:
layerId
- The layer to set the opacity ofopacity
- The opacity as a float ranging from 0-1
-
layerDetailsLoaded
protected void layerDetailsLoaded(LayerDetails layerDetails)
Description copied from class:BaseWmsClient
This is called once a layer's details have been loaded. By default this will just populate the widgets associated with this layer, but subclasses may want to override this method to implement custom behaviour before/after populating the widgets- Overrides:
layerDetailsLoaded
in classBaseWmsClient
- Parameters:
layerDetails
- the details received from the server
-
onMapMove
public void onMapMove(org.gwtopenmaps.openlayers.client.event.MapMoveListener.MapMoveEvent eventObject)
- Specified by:
onMapMove
in interfaceorg.gwtopenmaps.openlayers.client.event.MapMoveListener
- Overrides:
onMapMove
in classBaseWmsClient
-
onMapZoom
public void onMapZoom(org.gwtopenmaps.openlayers.client.event.MapZoomListener.MapZoomEvent eventObject)
- Specified by:
onMapZoom
in interfaceorg.gwtopenmaps.openlayers.client.event.MapZoomListener
- Overrides:
onMapZoom
in classBaseWmsClient
-
requestLayerDetails
protected void requestLayerDetails(String wmsUrl, String layerId, String currentTime, boolean autoZoomAndPalette)
Description copied from class:BaseWmsClient
Request details about a particular layer. Once loaded, layerDetailsLoaded will be called.- Overrides:
requestLayerDetails
in classBaseWmsClient
- Parameters:
wmsUrl
- the base URL of the WMS server containing the layer detailslayerId
- the ID of the layer whose details are desiredcurrentTime
- the time we want to know the closest available time to. Can be nullautoZoomAndPalette
- true if we want to zoom to extents and possibly auto-adjust palette once the details have been loaded. Note that this will only auto-adjust the palette if the conditions are right
-
setUnitConverter
protected void setUnitConverter(UnitConverter converter)
Overrides the parent method using the single-WMS layer. Subclasses should use this to set aUnitConverter
- Parameters:
converter
- TheUnitConverter
to use for the WMS layer
-
updateLinksEtc
public void updateLinksEtc()
Updates the links (KMZ, screenshot, email, permalink...)- Specified by:
updateLinksEtc
in interfaceGodivaActionsHandler
-
menuLoaded
protected void menuLoaded(LayerMenuItem menuTree)
-
getLogo
protected com.google.gwt.user.client.ui.Image getLogo()
This is something that will almost certainly be changed for custom clients, so put it in a method which can be overridden
-
getPaletteSelector
protected PaletteSelectorIF getPaletteSelector(LayerSelectorIF wmsUrlProvider, DialogBoxWithCloseButton.CentrePosIF localCentre)
Gets a new palette selector. This method is used in the construction of the Godiva interface and is only called once.- Parameters:
wmsUrlProvider
- ALayerSelectorIF
which provides the currently selected WMS URL- Returns:
- A new instance of a
PaletteSelectorIF
-
getTimeSelector
protected TimeSelectorIF getTimeSelector()
Gets a new time selector. This method is used in the construction of the Godiva interface and is only called once.- Returns:
- A new instance of a
TimeSelectorIF
-
getElevationSelector
protected ElevationSelectorIF getElevationSelector()
Gets a new elevation selector. This method is used in the construction of the Godiva interface and is only called once.- Returns:
- A new instance of an
ElevationSelectorIF
-
getLayerSelector
protected LayerSelectorIF getLayerSelector()
Gets a new layer selector. This method is used in the construction of the Godiva interface and is only called once.- Returns:
- A new instance of a
LayerSelectorIF
-
getLayout
protected com.google.gwt.user.client.ui.Widget getLayout()
Gets the layout. This should return a top-level object which contains the entire page, since this is what gets added to the main window as the layout
-
-