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 ofPaletteSelectorIF
which 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.Widget
asWidget()
String
getAboveMaxString()
String
getBelowMinString()
String
getDisplayScaleRange()
String
getNoDataColour()
int
getNumColorBands()
float
getOpacity()
String
getScaleRange()
String
getSelectedPalette()
String
getSelectedStyle()
boolean
isEnabled()
boolean
isLocked()
boolean
isLogScale()
void
populatePalettes(List<String> availablePalettes)
Populates the list of available palette namesvoid
populateStyles(List<String> availableStyles)
void
selectPalette(String paletteString)
Select the named palette, if availablevoid
selectStyle(String styleString)
Select the named style, if availablevoid
setAboveMax(PaletteSelectorIF.OutOfRangeState state)
Sets the behaviour of values above the maximumvoid
setBelowMin(PaletteSelectorIF.OutOfRangeState state)
Sets the behaviour of values below the minimumvoid
setCategorical(boolean categorical)
void
setEnabled(boolean enabled)
Enables/disables the palette selectorvoid
setExtraAboveMaxColour(String aboveMaxColour)
Sets a colour to use in addition to black/extend/transparent for values above the maximum scale valuevoid
setExtraBelowMinColour(String belowMinColour)
Sets a colour to use in addition to black/extend/transparent for values below the minimum scale valuevoid
setId(String id)
Sets the layer ID which this palette selector is currently active onvoid
setLogScale(boolean isLogScale)
void
setNoDataColour(String noDataColour)
void
setNoPaletteStyles(List<String> noPaletteStyles)
Sets the list of styles which do not use a palette (e.g.void
setNumColorBands(int nBands)
Sets the number of colour bands in the current palettevoid
setOpacity(float opacityValue)
Sets the opacity of the current palettevoid
setScaleLabels()
boolean
setScaleRange(String scaleRange, Boolean isLogScale)
Sets the scale rangevoid
setUnitConverter(UnitConverter converter)
Setting this allows thePaletteSelectorIF
to 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
- ThePaletteSelectionHandler
to handle palette eventswmsUrlProvider
- ALayerSelectorIF
which can be used to obtain the WMS URL for the current WMS layerlocalCentre
- ADialogBoxWithCloseButton.CentrePosIF
to define the local centre (usually over the centre of the map)vertical
-true
if this palette selector should be vertically aligned
-
-
Method Detail
-
setId
public void setId(String id)
Description copied from interface:PaletteSelectorIF
Sets the layer ID which this palette selector is currently active on- Specified by:
setId
in interfacePaletteSelectorIF
- Parameters:
id
- The ID
-
populatePalettes
public void populatePalettes(List<String> availablePalettes)
Description copied from interface:PaletteSelectorIF
Populates the list of available palette names- Specified by:
populatePalettes
in interfacePaletteSelectorIF
-
getSelectedPalette
public String getSelectedPalette()
- Specified by:
getSelectedPalette
in interfacePaletteSelectorIF
- Returns:
- The name of the currently selected palette
-
getAboveMaxString
public String getAboveMaxString()
- Specified by:
getAboveMaxString
in 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:PaletteSelectorIF
Sets the behaviour of values above the maximum- Specified by:
setAboveMax
in interfacePaletteSelectorIF
-
setExtraAboveMaxColour
public void setExtraAboveMaxColour(String aboveMaxColour)
Description copied from interface:PaletteSelectorIF
Sets a colour to use in addition to black/extend/transparent for values above the maximum scale value- Specified by:
setExtraAboveMaxColour
in interfacePaletteSelectorIF
- Parameters:
aboveMaxColour
- The colour to display for values above the maximum scale range
-
getBelowMinString
public String getBelowMinString()
- Specified by:
getBelowMinString
in 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:PaletteSelectorIF
Sets the behaviour of values below the minimum- Specified by:
setBelowMin
in interfacePaletteSelectorIF
-
setExtraBelowMinColour
public void setExtraBelowMinColour(String belowMinColour)
Description copied from interface:PaletteSelectorIF
Sets a colour to use in addition to black/extend/transparent for values below the minimum scale value- Specified by:
setExtraBelowMinColour
in interfacePaletteSelectorIF
- Parameters:
belowMinColour
- The colour to display for values below the minimum scale range
-
setNoDataColour
public void setNoDataColour(String noDataColour)
- Specified by:
setNoDataColour
in interfacePaletteSelectorIF
- Parameters:
noDataColour
- The colour to display for missing data
-
getNoDataColour
public String getNoDataColour()
- Specified by:
getNoDataColour
in interfacePaletteSelectorIF
- Returns:
- The colour to display for missing data
-
selectPalette
public void selectPalette(String paletteString)
Description copied from interface:PaletteSelectorIF
Select the named palette, if available- Specified by:
selectPalette
in interfacePaletteSelectorIF
- Parameters:
paletteString
- The name of the palette to select
-
setScaleRange
public boolean setScaleRange(String scaleRange, Boolean isLogScale)
Description copied from interface:PaletteSelectorIF
Sets the scale range- Specified by:
setScaleRange
in 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:
true
if 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:
getScaleRange
in interfacePaletteSelectorIF
- Returns:
- A
String
of the form "[min],[max]" which represents the current scale range
-
getDisplayScaleRange
public String getDisplayScaleRange()
- Specified by:
getDisplayScaleRange
in interfacePaletteSelectorIF
- Returns:
- A
String
of 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:
getNumColorBands
in interfacePaletteSelectorIF
- Returns:
- The number of colour bands in the currently selected palette
-
setNumColorBands
public void setNumColorBands(int nBands)
Description copied from interface:PaletteSelectorIF
Sets the number of colour bands in the current palette- Specified by:
setNumColorBands
in interfacePaletteSelectorIF
-
setLogScale
public void setLogScale(boolean isLogScale)
-
isLogScale
public boolean isLogScale()
- Specified by:
isLogScale
in interfacePaletteSelectorIF
- Returns:
- Whether or not this is a logarithmic scale
-
isLocked
public boolean isLocked()
- Specified by:
isLocked
in interfacePaletteSelectorIF
- Returns:
- Whether or not the palette is locked
-
setEnabled
public void setEnabled(boolean enabled)
Description copied from interface:PaletteSelectorIF
Enables/disables the palette selector- Specified by:
setEnabled
in interfacePaletteSelectorIF
-
asWidget
public com.google.gwt.user.client.ui.Widget asWidget()
- Specified by:
asWidget
in interfacecom.google.gwt.user.client.ui.IsWidget
-
populateStyles
public void populateStyles(List<String> availableStyles)
- Specified by:
populateStyles
in interfacePaletteSelectorIF
- Parameters:
availableStyles
- The list of available style names
-
setNoPaletteStyles
public void setNoPaletteStyles(List<String> noPaletteStyles)
Description copied from interface:PaletteSelectorIF
Sets the list of styles which do not use a palette (e.g. contours, arrows)- Specified by:
setNoPaletteStyles
in interfacePaletteSelectorIF
- Parameters:
noPaletteStyles
- The list of styles which do not use a palette
-
getSelectedStyle
public String getSelectedStyle()
- Specified by:
getSelectedStyle
in interfacePaletteSelectorIF
- Returns:
- The name of the currently selected style
-
selectStyle
public void selectStyle(String styleString)
Description copied from interface:PaletteSelectorIF
Select the named style, if available- Specified by:
selectStyle
in interfacePaletteSelectorIF
- Parameters:
styleString
- The name of the style to select
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfacePaletteSelectorIF
- Returns:
- Whether or not the current palette selector is enabled
-
getOpacity
public float getOpacity()
- Specified by:
getOpacity
in 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:PaletteSelectorIF
Sets the opacity of the current palette- Specified by:
setOpacity
in interfacePaletteSelectorIF
- Parameters:
opacityValue
- The opacity, as a float ranging from 0-1
-
setUnitConverter
public void setUnitConverter(UnitConverter converter)
Description copied from interface:PaletteSelectorIF
Setting this allows thePaletteSelectorIF
to 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:
setUnitConverter
in interfacePaletteSelectorIF
- Parameters:
converter
- TheUnitConverter
to use for converting display units to the underlying units used on the WMS server. Set tonull
to use the WMS native units
-
setCategorical
public void setCategorical(boolean categorical)
- Specified by:
setCategorical
in interfacePaletteSelectorIF
- Parameters:
categorical
- Whether or not this palette should retrieve a categorical legend in place of the usual scaling tools
-
-