Class PaletteSelector
- java.lang.Object
-
- uk.ac.rdg.resc.godiva.client.widgets.PaletteSelector
-
- All Implemented Interfaces:
com.google.gwt.user.client.ui.IsWidget,PaletteSelectorIF
public class PaletteSelector extends Object implements PaletteSelectorIF
Implementation ofPaletteSelectorIFwhich can be either horizontally or vertically oriented, and contains controls for setting all palette variables- Author:
- Guy Griffiths
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface uk.ac.rdg.resc.godiva.client.state.PaletteSelectorIF
PaletteSelectorIF.OutOfRangeState
-
-
Constructor Summary
Constructors Constructor Description PaletteSelector(String wmsLayerId, int height, int width, PaletteSelectionHandler handler, LayerSelectorIF wmsUrlProvider, DialogBoxWithCloseButton.CentrePosIF localCentre, boolean vertical)Instantiates a newPaletteSelector
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.gwt.user.client.ui.WidgetasWidget()StringgetAboveMaxString()StringgetBelowMinString()StringgetDisplayScaleRange()StringgetNoDataColour()intgetNumColorBands()floatgetOpacity()StringgetScaleRange()StringgetSelectedPalette()StringgetSelectedStyle()booleanisEnabled()booleanisLocked()booleanisLogScale()voidpopulatePalettes(List<String> availablePalettes)Populates the list of available palette namesvoidpopulateStyles(List<String> availableStyles)voidselectPalette(String paletteString)Select the named palette, if availablevoidselectStyle(String styleString)Select the named style, if availablevoidsetAboveMax(PaletteSelectorIF.OutOfRangeState state)Sets the behaviour of values above the maximumvoidsetBelowMin(PaletteSelectorIF.OutOfRangeState state)Sets the behaviour of values below the minimumvoidsetCategorical(boolean categorical)voidsetEnabled(boolean enabled)Enables/disables the palette selectorvoidsetExtraAboveMaxColour(String aboveMaxColour)Sets a colour to use in addition to black/extend/transparent for values above the maximum scale valuevoidsetExtraBelowMinColour(String belowMinColour)Sets a colour to use in addition to black/extend/transparent for values below the minimum scale valuevoidsetId(String id)Sets the layer ID which this palette selector is currently active onvoidsetLogScale(boolean isLogScale)voidsetNoDataColour(String noDataColour)voidsetNoPaletteStyles(List<String> noPaletteStyles)Sets the list of styles which do not use a palette (e.g.voidsetNumColorBands(int nBands)Sets the number of colour bands in the current palettevoidsetOpacity(float opacityValue)Sets the opacity of the current palettevoidsetScaleLabels()booleansetScaleRange(String scaleRange, Boolean isLogScale)Sets the scale rangevoidsetUnitConverter(UnitConverter converter)Setting this allows thePaletteSelectorIFto work in different units to those used by the server.
-
-
-
Constructor Detail
-
PaletteSelector
public PaletteSelector(String wmsLayerId, int height, int width, PaletteSelectionHandler handler, LayerSelectorIF wmsUrlProvider, DialogBoxWithCloseButton.CentrePosIF localCentre, boolean vertical)
Instantiates a newPaletteSelector- Parameters:
wmsLayerId- The ID of the WMS layerheight- The height of the palette imagewidth- The width of the palette imagehandler- ThePaletteSelectionHandlerto handle palette eventswmsUrlProvider- ALayerSelectorIFwhich can be used to obtain the WMS URL for the current WMS layerlocalCentre- ADialogBoxWithCloseButton.CentrePosIFto define the local centre (usually over the centre of the map)vertical-trueif this palette selector should be vertically aligned
-
-
Method Detail
-
setId
public void setId(String id)
Description copied from interface:PaletteSelectorIFSets the layer ID which this palette selector is currently active on- Specified by:
setIdin interfacePaletteSelectorIF- Parameters:
id- The ID
-
populatePalettes
public void populatePalettes(List<String> availablePalettes)
Description copied from interface:PaletteSelectorIFPopulates the list of available palette names- Specified by:
populatePalettesin interfacePaletteSelectorIF
-
getSelectedPalette
public String getSelectedPalette()
- Specified by:
getSelectedPalettein interfacePaletteSelectorIF- Returns:
- The name of the currently selected palette
-
getAboveMaxString
public String getAboveMaxString()
- Specified by:
getAboveMaxStringin interfacePaletteSelectorIF- Returns:
- The string representation of the colour to display when values are above the maximum
-
setAboveMax
public void setAboveMax(PaletteSelectorIF.OutOfRangeState state)
Description copied from interface:PaletteSelectorIFSets the behaviour of values above the maximum- Specified by:
setAboveMaxin interfacePaletteSelectorIF
-
setExtraAboveMaxColour
public void setExtraAboveMaxColour(String aboveMaxColour)
Description copied from interface:PaletteSelectorIFSets a colour to use in addition to black/extend/transparent for values above the maximum scale value- Specified by:
setExtraAboveMaxColourin interfacePaletteSelectorIF- Parameters:
aboveMaxColour- The colour to display for values above the maximum scale range
-
getBelowMinString
public String getBelowMinString()
- Specified by:
getBelowMinStringin interfacePaletteSelectorIF- Returns:
- The string representation of the colour to display when values are below the minimum
-
setBelowMin
public void setBelowMin(PaletteSelectorIF.OutOfRangeState state)
Description copied from interface:PaletteSelectorIFSets the behaviour of values below the minimum- Specified by:
setBelowMinin interfacePaletteSelectorIF
-
setExtraBelowMinColour
public void setExtraBelowMinColour(String belowMinColour)
Description copied from interface:PaletteSelectorIFSets a colour to use in addition to black/extend/transparent for values below the minimum scale value- Specified by:
setExtraBelowMinColourin interfacePaletteSelectorIF- Parameters:
belowMinColour- The colour to display for values below the minimum scale range
-
setNoDataColour
public void setNoDataColour(String noDataColour)
- Specified by:
setNoDataColourin interfacePaletteSelectorIF- Parameters:
noDataColour- The colour to display for missing data
-
getNoDataColour
public String getNoDataColour()
- Specified by:
getNoDataColourin interfacePaletteSelectorIF- Returns:
- The colour to display for missing data
-
selectPalette
public void selectPalette(String paletteString)
Description copied from interface:PaletteSelectorIFSelect the named palette, if available- Specified by:
selectPalettein interfacePaletteSelectorIF- Parameters:
paletteString- The name of the palette to select
-
setScaleRange
public boolean setScaleRange(String scaleRange, Boolean isLogScale)
Description copied from interface:PaletteSelectorIFSets the scale range- Specified by:
setScaleRangein interfacePaletteSelectorIF- Parameters:
scaleRange- The desired scale range, of the form [min],[max]isLogScale- Whether we want this to be a log scale or not- Returns:
trueif the operation was successful (may not be if the palette is locked, or we want a negative value in a logarithmic range)
-
setScaleLabels
public void setScaleLabels()
-
getScaleRange
public String getScaleRange()
- Specified by:
getScaleRangein interfacePaletteSelectorIF- Returns:
- A
Stringof the form "[min],[max]" which represents the current scale range
-
getDisplayScaleRange
public String getDisplayScaleRange()
- Specified by:
getDisplayScaleRangein interfacePaletteSelectorIF- Returns:
- A
Stringof the form "[min],[max]" which represents the current scale range displayed. If there is no unit converter set, this will be equivalent toPaletteSelectorIF.getScaleRange().
-
getNumColorBands
public int getNumColorBands()
- Specified by:
getNumColorBandsin interfacePaletteSelectorIF- Returns:
- The number of colour bands in the currently selected palette
-
setNumColorBands
public void setNumColorBands(int nBands)
Description copied from interface:PaletteSelectorIFSets the number of colour bands in the current palette- Specified by:
setNumColorBandsin interfacePaletteSelectorIF
-
setLogScale
public void setLogScale(boolean isLogScale)
-
isLogScale
public boolean isLogScale()
- Specified by:
isLogScalein interfacePaletteSelectorIF- Returns:
- Whether or not this is a logarithmic scale
-
isLocked
public boolean isLocked()
- Specified by:
isLockedin interfacePaletteSelectorIF- Returns:
- Whether or not the palette is locked
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:PaletteSelectorIFEnables/disables the palette selector- Specified by:
setEnabledin interfacePaletteSelectorIF
-
asWidget
public com.google.gwt.user.client.ui.Widget asWidget()
- Specified by:
asWidgetin interfacecom.google.gwt.user.client.ui.IsWidget
-
populateStyles
public void populateStyles(List<String> availableStyles)
- Specified by:
populateStylesin interfacePaletteSelectorIF- Parameters:
availableStyles- The list of available style names
-
setNoPaletteStyles
public void setNoPaletteStyles(List<String> noPaletteStyles)
Description copied from interface:PaletteSelectorIFSets the list of styles which do not use a palette (e.g. contours, arrows)- Specified by:
setNoPaletteStylesin interfacePaletteSelectorIF- Parameters:
noPaletteStyles- The list of styles which do not use a palette
-
getSelectedStyle
public String getSelectedStyle()
- Specified by:
getSelectedStylein interfacePaletteSelectorIF- Returns:
- The name of the currently selected style
-
selectStyle
public void selectStyle(String styleString)
Description copied from interface:PaletteSelectorIFSelect the named style, if available- Specified by:
selectStylein interfacePaletteSelectorIF- Parameters:
styleString- The name of the style to select
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfacePaletteSelectorIF- Returns:
- Whether or not the current palette selector is enabled
-
getOpacity
public float getOpacity()
- Specified by:
getOpacityin interfacePaletteSelectorIF- Returns:
- The opacity of the current palette as a float ranging from 0-1
-
setOpacity
public void setOpacity(float opacityValue)
Description copied from interface:PaletteSelectorIFSets the opacity of the current palette- Specified by:
setOpacityin interfacePaletteSelectorIF- Parameters:
opacityValue- The opacity, as a float ranging from 0-1
-
setUnitConverter
public void setUnitConverter(UnitConverter converter)
Description copied from interface:PaletteSelectorIFSetting this allows thePaletteSelectorIFto work in different units to those used by the server. For example a client may always want to treat temperatures as degrees Celcius regardless of what the WMS server says.- Specified by:
setUnitConverterin interfacePaletteSelectorIF- Parameters:
converter- TheUnitConverterto use for converting display units to the underlying units used on the WMS server. Set tonullto use the WMS native units
-
setCategorical
public void setCategorical(boolean categorical)
- Specified by:
setCategoricalin interfacePaletteSelectorIF- Parameters:
categorical- Whether or not this palette should retrieve a categorical legend in place of the usual scaling tools
-
-