Class MapImage
- java.lang.Object
-
- uk.ac.rdg.resc.edal.graphics.style.Drawable
-
- uk.ac.rdg.resc.edal.graphics.style.MapImage
-
public class MapImage extends Drawable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class uk.ac.rdg.resc.edal.graphics.style.Drawable
Drawable.NameAndRange
-
-
Constructor Summary
Constructors Constructor Description MapImage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedImage
drawImage(PlottingDomainParams params, FeatureCatalogue catalogue)
Set<Drawable.NameAndRange>
getFieldsWithScales()
List<Drawable>
getLayers()
BufferedImage
getLegend(int componentSize)
Generate a legend for thisMapImage
.BufferedImage
getLegend(int componentWidth, int componentHeight)
Generate a legend for thisMapImage
.BufferedImage
getLegend(int componentWidth, int componentHeight, boolean force1D)
Generate a legend for thisMapImage
.BufferedImage
getLegend(int componentWidth, int componentHeight, Color textColour, Color bgColour, boolean layerNameLabels, boolean force1D)
Generate a legend for thisMapImage
.BufferedImage
getLegend(int componentWidth, int componentHeight, Color textColour, Color bgColour, boolean layerNameLabels, boolean background, boolean force1D, float extraAmountOutOfRange, float fontProportion)
Generate a legend for thisMapImage
.BufferedImage
getLegend(int componentWidth, int componentHeight, Color textColour, Color bgColour, boolean layerNameLabels, boolean background, boolean force1D, float extraAmountOutOfRangeLow, float extraAmountOutOfRangeHigh, float fontProportion)
Generate a legend for thisMapImage
.static BufferedImage
getLegendLabels(Drawable.NameAndRange nameAndRange, float extraAmountOutOfRangeLow, float extraAmountOutOfRangeHigh, int componentSize, Color textColor, boolean layerNameLabels, int fontHeight)
This returns an image suitable for plotting next to a vertical colourbar.-
Methods inherited from class uk.ac.rdg.resc.edal.graphics.style.Drawable
getOpacityTransform, setOpacityTransform
-
-
-
-
Method Detail
-
drawImage
public BufferedImage drawImage(PlottingDomainParams params, FeatureCatalogue catalogue) throws EdalException
- Specified by:
drawImage
in classDrawable
- Throws:
EdalException
-
getLegend
public BufferedImage getLegend(int componentSize) throws EdalException
Generate a legend for thisMapImage
.- Parameters:
componentSize
- A single integer specifying the size of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends upon- Returns:
- An
BufferedImage
representing the legend for thisMapImage
- Throws:
EdalException
-
getLegend
public BufferedImage getLegend(int componentWidth, int componentHeight) throws EdalException
Generate a legend for thisMapImage
.- Parameters:
componentWidth
- A single integer specifying the width of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends uponcomponentHeight
- A single integer specifying the height of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends upon- Returns:
- An
BufferedImage
representing the legend for thisMapImage
- Throws:
EdalException
-
getLegend
public BufferedImage getLegend(int componentWidth, int componentHeight, boolean force1D) throws EdalException
Generate a legend for thisMapImage
.- Parameters:
componentWidth
- A single integer specifying the width of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends uponcomponentHeight
- A single integer specifying the height of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends uponforce1D
- Force this legend to only use the first field.- Returns:
- An
BufferedImage
representing the legend for thisMapImage
- Throws:
EdalException
-
getLegend
public BufferedImage getLegend(int componentWidth, int componentHeight, Color textColour, Color bgColour, boolean layerNameLabels, boolean force1D) throws EdalException
Generate a legend for thisMapImage
.- Parameters:
componentWidth
- A single integer specifying the width of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends uponcomponentHeight
- A single integer specifying the height of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends upontextColour
- TheColor
of the textbgColour
- TheColor
of the backgroundlayerNameLabels
- Whether or not to plot the ID of the layers on the legendforce1D
- Force this legend to only use the first field.- Returns:
- An
BufferedImage
representing the legend for thisMapImage
- Throws:
EdalException
-
getLegend
public BufferedImage getLegend(int componentWidth, int componentHeight, Color textColour, Color bgColour, boolean layerNameLabels, boolean background, boolean force1D, float extraAmountOutOfRange, float fontProportion) throws EdalException
Generate a legend for thisMapImage
.- Parameters:
componentWidth
- A single integer specifying the width of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends uponcomponentHeight
- A single integer specifying the height of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends upontextColour
- TheColor
of the textbgColour
- TheColor
of the backgroundlayerNameLabels
- Whether or not to plot the ID of the layers on the legendbackground
- Whether to draw a background map image for 2D legendsforce1D
- Force this legend to only use the first field.extraAmountOutOfRange
- This is the fraction of the colourbar which *gets added* as out-of-range data. i.e. if it's 1, the result would be 1/3 below min, 1/3 in range, 1/3 above max.fontProportion
- The proportion of the largest dimension of the main component which the font height should take up- Returns:
- An
BufferedImage
representing the legend for thisMapImage
- Throws:
EdalException
-
getLegend
public BufferedImage getLegend(int componentWidth, int componentHeight, Color textColour, Color bgColour, boolean layerNameLabels, boolean background, boolean force1D, float extraAmountOutOfRangeLow, float extraAmountOutOfRangeHigh, float fontProportion) throws EdalException
Generate a legend for thisMapImage
.- Parameters:
componentWidth
- A single integer specifying the width of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends uponcomponentHeight
- A single integer specifying the height of each component of the legend. The final image size will depend upon this number as well as the number of unique data fields which thisMapImage
depends upontextColour
- TheColor
of the textbgColour
- TheColor
of the backgroundlayerNameLabels
- Whether or not to plot the ID of the layers on the legendbackground
- Whether to draw a background map image for 2D legendsforce1D
- Force this legend to only use the first field.extraAmountOutOfRangeLow
- This is the fraction of the colourbar which *gets added* as out-of-range data below the minimum i.e. if it's 1, the result would be 1/3 below min, 1/3 in range, 1/3 above max.extraAmountOutOfRangeHigh
- This is the fraction of the colourbar which *gets added* as out-of-range data above the maximum i.e. if it's 1, the result would be 1/3 below min, 1/3 in range, 1/3 above max.fontProportion
- The proportion of the largest dimension of the main component which the font height should take up- Returns:
- An
BufferedImage
representing the legend for thisMapImage
- Throws:
EdalException
-
getLegendLabels
public static BufferedImage getLegendLabels(Drawable.NameAndRange nameAndRange, float extraAmountOutOfRangeLow, float extraAmountOutOfRangeHigh, int componentSize, Color textColor, boolean layerNameLabels, int fontHeight)
This returns an image suitable for plotting next to a vertical colourbar. Rotate it if required.- Parameters:
nameAndRange
-extraAmountOutOfRangeLow
-extraAmountOutOfRangeHigh
-componentSize
-textColor
-layerNameLabels
-- Returns:
-
getFieldsWithScales
public Set<Drawable.NameAndRange> getFieldsWithScales()
- Specified by:
getFieldsWithScales
in classDrawable
- Returns:
- A list of all the fields used in this image layer, and their
appropriate scale ranges. If there is NO scale range there can be
NO data field and vice versa - i.e. a
Drawable.NameAndRange
object must have all non-null fields. If the layer doesn't depend on any data, this should return an empty set. It should never returnnull
.
-
-