Class MapImage


  • public class MapImage
    extends Drawable
    • Constructor Detail

      • MapImage

        public MapImage()
    • Method Detail

      • getLegend

        public BufferedImage getLegend​(int componentSize)
                                throws EdalException
        Generate a legend for this MapImage.
        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 this MapImage depends upon
        Returns:
        An BufferedImage representing the legend for this MapImage
        Throws:
        EdalException
      • getLegend

        public BufferedImage getLegend​(int componentWidth,
                                       int componentHeight)
                                throws EdalException
        Generate a legend for this MapImage.
        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 this MapImage depends upon
        componentHeight - 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 this MapImage depends upon
        Returns:
        An BufferedImage representing the legend for this MapImage
        Throws:
        EdalException
      • getLegend

        public BufferedImage getLegend​(int componentWidth,
                                       int componentHeight,
                                       boolean force1D)
                                throws EdalException
        Generate a legend for this MapImage.
        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 this MapImage depends upon
        componentHeight - 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 this MapImage depends upon
        force1D - Force this legend to only use the first field.
        Returns:
        An BufferedImage representing the legend for this MapImage
        Throws:
        EdalException
      • getLegend

        public BufferedImage getLegend​(int componentWidth,
                                       int componentHeight,
                                       Color textColour,
                                       Color bgColour,
                                       boolean layerNameLabels,
                                       boolean force1D)
                                throws EdalException
        Generate a legend for this MapImage.
        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 this MapImage depends upon
        componentHeight - 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 this MapImage depends upon
        textColour - The Color of the text
        bgColour - The Color of the background
        layerNameLabels - Whether or not to plot the ID of the layers on the legend
        force1D - Force this legend to only use the first field.
        Returns:
        An BufferedImage representing the legend for this MapImage
        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 this MapImage.
        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 this MapImage depends upon
        componentHeight - 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 this MapImage depends upon
        textColour - The Color of the text
        bgColour - The Color of the background
        layerNameLabels - Whether or not to plot the ID of the layers on the legend
        background - Whether to draw a background map image for 2D legends
        force1D - 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 this MapImage
        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 this MapImage.
        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 this MapImage depends upon
        componentHeight - 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 this MapImage depends upon
        textColour - The Color of the text
        bgColour - The Color of the background
        layerNameLabels - Whether or not to plot the ID of the layers on the legend
        background - Whether to draw a background map image for 2D legends
        force1D - 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 this MapImage
        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 class Drawable
        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 return null.