Class GridCoverageBuilder

    • Constructor Detail

      • GridCoverageBuilder

        public GridCoverageBuilder()
        Creates a builder initialized to default values and factory.
      • GridCoverageBuilder

        public GridCoverageBuilder​(GridCoverageFactory factory)
        Creates a builder initialized to default values.
    • Method Detail

      • setCoordinateReferenceSystem

        public void setCoordinateReferenceSystem​(String code)
                                          throws IllegalArgumentException
        Sets the coordinate reference system to the specified authority code. This convenience method gives a preference to axis in (longitude, latitude) order.
        Throws:
        IllegalArgumentException - if the given CRS is illegal.
      • getEnvelope

        public Bounds getEnvelope()
        Returns a copy of current envelope. If no envelope has been explicitly defined, then the default is inferred from the CRS (by default a geographic envelope from 180°W to 180°E and 90°S to 90°N).
      • setEnvelope

        public void setEnvelope​(double... ordinates)
                         throws IllegalArgumentException
        Sets the envelope to the specified values, which must be the lower corner coordinates followed by upper corner coordinates. The number of arguments provided shall be twice the envelope dimension, and minimum shall not be greater than maximum.

        Example: (xmin, ymin, zmin, xmax, ymax, zmax)

        Throws:
        IllegalArgumentException
      • getSampleRange

        public NumberRange<? extends Number> getSampleRange()
        Returns the range of sample values. If no range has been explicitly defined, then the default is a range from 0 inclusive to 256 exclusive.
      • setSampleRange

        public void setSampleRange​(NumberRange<? extends Number> range)
        Sets the range of sample values.
      • setSampleRange

        public void setSampleRange​(int lower,
                                   int upper)
        Sets the range of sample values.
        Parameters:
        lower - The lower sample value (inclusive), typically 0.
        upper - The upper sample value (exclusive), typically 256.
      • getImageSize

        public Dimension getImageSize()
        Returns the image size. If no size has been explicitly defined, then the default is 256×256 pixels.
      • setImageSize

        public void setImageSize​(Dimension size)
        Sets the image size.
      • setImageSize

        public void setImageSize​(int width,
                                 int height)
        Sets the image size.
      • newVariable

        public GridCoverageBuilder.Variable newVariable​(CharSequence name,
                                                        Unit<?> units)
        Creates a new variable, which will be mapped to a sample dimension. Additional information like scale, offset and nodata values can be provided by invoking setters on the returned variable.
        Parameters:
        name - The variable name, or null for a default name.
        units - The variable units, or null if unknown.
        Returns:
        A new variable.
      • getBufferedImage

        public BufferedImage getBufferedImage()
        Returns the buffered image to be wrapped by GridCoverage2D. If no image has been explicitly defined, a new one is created the first time this method is invoked. Users can write in this image before to create the grid coverage.
      • setBufferedImage

        public void setBufferedImage​(BufferedImage image)
        Sets the buffered image. Invoking this method overwrite the image size with the given image size.
      • setBufferedImage

        public void setBufferedImage​(File file)
                              throws IOException
        Sets the buffered image by reading it from the given file. Invoking this method overwrite the image size with the given image size.
        Throws:
        IOException - if the image can't be read.
      • setBufferedImage

        public void setBufferedImage​(Random random)
        Sets the buffered image to a raster filled with random value using the specified random number generator. This method can be used for testing purpose, or for adding noise to a coverage.
      • getGridCoverage2D

        public GridCoverage2D getGridCoverage2D()
        Returns the grid coverage.