Package hec.map.aidem

Class AiDemBaseMap

java.lang.Object
hec.map.MapObject
hec.map.aidem.AiDemBaseMap
All Implemented Interfaces:
ElevationMap, GridMap, MapObjectInterface, Serializable
Direct Known Subclasses:
AiDemFltMap, AiDemMap

public abstract class AiDemBaseMap extends MapObject implements GridMap
See Also:
  • Field Details

    • _cellsize

      protected double _cellsize
    • _data

      protected float[] _data
    • _lowerLeftCorner

      protected WorldPt _lowerLeftCorner
    • _maxElev

      protected float _maxElev
    • _minElev

      protected float _minElev
    • _nodata

      protected float _nodata
    • _numcol

      protected int _numcol
    • _numrow

      protected int _numrow
  • Constructor Details

    • AiDemBaseMap

      public AiDemBaseMap(String fileName)
    • AiDemBaseMap

      public AiDemBaseMap(MapIdentifier id)
    • AiDemBaseMap

      public AiDemBaseMap()
  • Method Details

    • load

      public void load() throws IOException
      Description copied from interface: MapObjectInterface
      Method to tell the Map Object to load its data into memory
      Specified by:
      load in interface MapObjectInterface
      Specified by:
      load in class MapObject
      Throws:
      IOException - Description of Exception
    • unload

      public void unload()
      Description copied from interface: MapObjectInterface
      Method to tell the Map Object to unload, because the map is done
      Specified by:
      unload in interface MapObjectInterface
      Specified by:
      unload in class MapObject
    • getAreaHeight

      public int getAreaHeight()
    • getAreaWidth

      public int getAreaWidth()
    • getResolutionX

      public double getResolutionX()
      Returns the width of each cell in the grid.

      Returns:
    • getResolutionY

      public double getResolutionY()
      Returns the height of each cell in the grid.

      Returns:
    • supportsNoDataValue

      public boolean supportsNoDataValue()
      Specified by:
      supportsNoDataValue in interface GridMap
    • getData

      public float[] getData()
    • getLowerLeftCorner

      public WorldPt getLowerLeftCorner()
    • getName

      public String getName()
      Description copied from interface: MapObjectInterface
      Gets the Name attribute of the MapObjectInterface object
      Specified by:
      getName in interface ElevationMap
      Specified by:
      getName in interface MapObjectInterface
      Overrides:
      getName in class MapObject
      Returns:
      The Name value
    • getGridCellSize

      public WorldRect getGridCellSize()
      Returns a Rectangle that contains the world location for each corner of the grid.

      Specified by:
      getGridCellSize in interface GridMap
      Returns:
    • init

      protected void init()
      Initializes the variables for the class to a base state. Sets the number of rows/columns to 0, the data array to null.
    • getMinimumElevation

      public double getMinimumElevation()
      Returns the minimum value found in the grid

      Specified by:
      getMinimumElevation in interface ElevationMap
      Returns:
    • getMaximumElevation

      public double getMaximumElevation()
      Returns the maximum value in the grid.

      Specified by:
      getMaximumElevation in interface ElevationMap
      Returns:
    • getNoDataValue

      public double getNoDataValue()
      Description copied from interface: ElevationMap
      Returns the value that represents an UNDEFINED elevation in the map.
      Specified by:
      getNoDataValue in interface ElevationMap
      Specified by:
      getNoDataValue in interface GridMap
    • setNoDataValue

      public void setNoDataValue(double noDataValue)
      Parameters:
      noDataValue -
    • cellToWorldPt

      public WorldPt cellToWorldPt(int row, int col)
      Returns the World Location for a cell at a particular row/column in the grid. The WorldPt references the upper left point of the cell from which the row,col point references. Grid Point (0,0) is the upper left corner of the grid.

      Parameters:
      row - the row index in Grid Coordinates (0 - getAreaHeight()), row 0 is the top of the grid.
      col - the col index in Grid Coordinates (0 - getAreaWidth()), col 0 is the left side of the grid.

      Returns:
    • cellToWorldPt

      public WorldPt cellToWorldPt(int cellIndex)
      Takes as input the array index from 0 to data.length-1 and computes the World Location for that data cell. The WorldPt references the upper left point of the cell from which the index references

      Parameters:
      cellIndex - index 0 is the upper left corner of the grid, index (data.length-1) is the lower right corner.

      Returns:
      WorldPt that contains the location of the cell at that index.
    • getElevation

      public float[] getElevation(double[] northing, double[] easting)
      Description copied from interface: ElevationMap
      Retruns an array of elevations for an array of northin/easting points. Northing/Easting array values are paired northing[0],easting[0], etc to make one point. Throws an invalid value exception if the northing/easting arrays are not the same size.
      Specified by:
      getElevation in interface ElevationMap
      Returns:
      array of elevation points. The elevation value elevation[n] was derived using the point (easting[n],northing[n]).
    • getElevation

      public float getElevation(WorldPt pt)
      Returns an elevation value for a given point on the map. If that point is outside the bounds of the map, returns RMAConst.UNDEF_FLOAT. If that point is within the bounds of the map, but yet at a point where there is no data, the NO_DATA_VALUE is returned. The exact value of this can be fetched with the method getNoDataValue()

      Specified by:
      getElevation in interface ElevationMap
      Parameters:
      pt - WorldPt

      Returns:
      float
    • worldPtToCell

      public int worldPtToCell(WorldPt pt)
      Converts a point in world coordinates to a an index into the data array. The value will range from 0 to data.length-1. An index value of 0 is the upper left corner of the grid, and data.length-1 is the lower right.

      Parameters:
      pt -

      Returns:
      the index into the float array.
    • worldPtToCell

      public int worldPtToCell(double pte, double ptn)
    • loadHeader

      public abstract void loadHeader() throws IOException
      Throws:
      IOException
    • fillArray

      public abstract boolean fillArray(float[] dest, long destPosition, long srcPosition, int length) throws IOException
      Throws:
      IOException