Class MapReader

  • Direct Known Subclasses:
    GrassRasterReader

    public abstract class MapReader
    extends Object

    A map reader object

    Since:
    1.1.0
    Author:
    Andrea Antonello - www.hydrologis.com, John Preston
    • Constructor Detail

      • MapReader

        public MapReader​(int _readerType)
        Creates a new instance of MapReader
    • Method Detail

      • close

        public abstract void close()
        close the resource, deallocation whatever needed to be deallocated
      • setOutputDataObject

        public void setOutputDataObject​(Object outputDataObject)
        Define the output data object. The output data object is the kind of result that the reader will give. This can be for example:
        • when you need to elaborate the data, a double matrix, so the odo would be new double[][]
        • when you need to visualize the data, a floatbuffer, so the odo would be new FloatBuffer
        Parameters:
        outputDataObject - the output data object
      • getOutputDataObject

        public Object getOutputDataObject()
        Returns:
        the output data object
      • getColorTable

        public ColorTable getColorTable()
        Returns:
        the colortable object
      • getMapWindow

        public Window getMapWindow()
        Returns:
        the window that corresponds to the map file that the reader has opened.
      • getDataWindow

        public Window getDataWindow()
        Returns:
        the window that corresponds to the active window.
      • setDataWindow

        public void setDataWindow​(Window window)
        Set the active reader window, i.e. the region out of which the reader will read
        Parameters:
        window - the region object
      • setParameter

        public void setParameter​(String key,
                                 Object obj)
        utility to set particular parameters supported keys: "novalue" "matrixtype" "progressbar" "commandoptions"
        Parameters:
        key -
        obj -
      • getParameter

        public Object getParameter​(String key,
                                   Object obj)
        Parameters:
        key - the parameter key
        obj - a default return object
        Returns:
        the parameter corrisponding to the passed key
      • open

        public abstract boolean open​(String fileName,
                                     String locationPath,
                                     String mapsetName)
        Open the resource
        Parameters:
        fileName - the name of the resource
        locationPath - the path to the GRASS location
        mapsetName - the name of the mapset holding the resource
        Returns:
        true if the resource was successfully opened
      • open

        public abstract boolean open​(String mapPath)
        Open the resource
        Parameters:
        mapPath - the full path to the resource that needs to be opened
        Returns:
        true if the resource was successfully opened
      • hasMoreData

        public abstract boolean hasMoreData​(IHMProgressMonitor monitor)
                                     throws Exception
        Parameters:
        monitor - progressmonitor
        Returns:
        true, if the resource has more data to read
        Throws:
        Exception
      • getNextData

        public abstract Object getNextData()
        Returns:
        get the data object
      • getNextDataColor

        public abstract ColorMapBuffer getNextDataColor​(int attIndex)
        Parameters:
        attIndex -
        Returns:
        the data color
      • getLegendString

        public abstract String getLegendString()
                                        throws IOException
        Returns:
        the string representing the legend
        Throws:
        IOException
      • getRange

        public abstract double[] getRange()
        Returns:
        an array containing the min and max value of the resource