Class SldTemplateStyleCatalogue
- java.lang.Object
-
- uk.ac.rdg.resc.edal.graphics.utils.SldTemplateStyleCatalogue
-
- All Implemented Interfaces:
StyleCatalogue
public class SldTemplateStyleCatalogue extends Object implements StyleCatalogue
An implementation of aStyleCatalogue
which is based on having resources containing Xml templates of SLD documents. This uses the singleton pattern and the object is obtained withgetStyleCatalogue()
- Author:
- Guy Griffiths
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addStylesInDirectory(File stylesDir)
Adds an external directory containing styles.MapImage
getMapImageFromStyle(String styleName, PlottingStyleParameters templateProperties, VariableMetadata metadata, LayerNameMapper layerNameMapper)
Returns a concreteMapImage
for a given styleList<String>
getScaledRoleForStyle(String styleName)
static SldTemplateStyleCatalogue
getStyleCatalogue()
Collection<String>
getSupportedStyles(VariableMetadata variableMetadata, LayerNameMapper layerNameMapper)
Gets the supported styles for a given variablestatic void
main(String[] args)
boolean
styleUsesPalette(String styleName)
-
-
-
Method Detail
-
getStyleCatalogue
public static SldTemplateStyleCatalogue getStyleCatalogue()
- Returns:
- An instance of the
SldTemplateStyleCatalogue
-
main
public static void main(String[] args)
-
getSupportedStyles
public Collection<String> getSupportedStyles(VariableMetadata variableMetadata, LayerNameMapper layerNameMapper)
Description copied from interface:StyleCatalogue
Gets the supported styles for a given variable- Specified by:
getSupportedStyles
in interfaceStyleCatalogue
- Parameters:
variableMetadata
- TheVariableMetadata
of the variable to get styles forlayerNameMapper
- TheLayerNameMapper
used to map layer names to dataset/variable pairs.- Returns:
- A
List
of the supported style names for this variable
-
styleUsesPalette
public boolean styleUsesPalette(String styleName)
- Specified by:
styleUsesPalette
in interfaceStyleCatalogue
- Parameters:
styleName
- The style name to test- Returns:
true
if this style needs a colour palette
-
getScaledRoleForStyle
public List<String> getScaledRoleForStyle(String styleName)
- Specified by:
getScaledRoleForStyle
in interfaceStyleCatalogue
- Parameters:
styleName
- The style name to test- Returns:
- The role which the scale range applies to. This is:
null
if no scaling takes place- An empty string if the named layer is scaled
- The child role which scaling is applied to TODO DOCUMENT MULTIPLE ROLES CASE
-
getMapImageFromStyle
public MapImage getMapImageFromStyle(String styleName, PlottingStyleParameters templateProperties, VariableMetadata metadata, LayerNameMapper layerNameMapper)
Description copied from interface:StyleCatalogue
Returns a concreteMapImage
for a given style- Specified by:
getMapImageFromStyle
in interfaceStyleCatalogue
- Parameters:
styleName
- The name of the styletemplateProperties
- The properties which should be injected into the style template. None of the methods in this object may returnnull
metadata
- TheVariableMetadata
of the variable being plotted. In the case that multiple variables are used for a single plot, this should be the parentVariableMetadata
of all required variableslayerNameMapper
- The associatedLayerNameMapper
. This is used to turnVariableMetadata
objects into concrete layer names for the style template- Returns:
- A
MapImage
, ready to generate images
-
addStylesInDirectory
public void addStylesInDirectory(File stylesDir) throws FileNotFoundException
Adds an external directory containing styles.- Parameters:
stylesDir
- The location of the directory to add.- Throws:
FileNotFoundException
- If the supplied path is not a directory
-
-