Package hec.map.aidem
Class AiDemMap
java.lang.Object
hec.map.MapObject
hec.map.aidem.AiDemBaseMap
hec.map.aidem.AiDemMap
- All Implemented Interfaces:
ElevationMap
,GridMap
,MapObjectInterface
,Serializable
- Direct Known Subclasses:
GrassAsciiMap
Simple class for reading ESRI .asc grid maps.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Number of bytes for the header.static final String
Fields inherited from class hec.map.aidem.AiDemBaseMap
_cellsize, _data, _lowerLeftCorner, _maxElev, _minElev, _nodata, _numcol, _numrow
Fields inherited from class hec.map.MapObject
_debug, _extent, _fileOpener, _loaded, _mapId, mCoordinateReferencySystem
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Ensures that the grid file is binary by checking for the presence of a .ascbin.boolean
fillArray
(float[] dest, long destPosition, long srcPosition, int length) Fills the destination array with data from this map starting at destPosition reading from srcPosition for length # of values.void
load()
Split the load between binary and ASCIIvoid
void
Loads the header section of the grid file giving us the information such as grid location, cell size, number of rows/columns.boolean
mapIdentifierEquals
(MapIdentifier mapid) check to see if the Map specified by the MapIdentifier mapid is the same map as this one.protected boolean
read the ASCII header.void
unload()
Method to tell the Map Object to unload, because the map is doneMethods inherited from class hec.map.aidem.AiDemBaseMap
cellToWorldPt, cellToWorldPt, getAreaHeight, getAreaWidth, getData, getElevation, getElevation, getGridCellSize, getLowerLeftCorner, getMaximumElevation, getMinimumElevation, getName, getNoDataValue, getResolutionX, getResolutionY, init, setNoDataValue, supportsNoDataValue, worldPtToCell, worldPtToCell
Methods inherited from class hec.map.MapObject
equals, getCoordinateInfo, getCoordinateReferenceSystem, getExtent, getFilenames, getFileOpener, getMapIdentifier, newFile, newThenOpenFile, openFile, readProjection, setExtent, setFileOpener, setMapIdentifier, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface hec.map.MapObjectInterface
getCoordinateReferenceSystem, getExtent, getMapIdentifier, setExtent, setMapIdentifier
-
Field Details
-
EXTENSION
- See Also:
-
BINARY_HEADER_LENGTH
public static final long BINARY_HEADER_LENGTHNumber of bytes for the header. Since the header starts at byte zero, the header occupies from byte 0 to byte 43. Byte 44 is the start of the float array.- See Also:
-
-
Constructor Details
-
AiDemMap
-
AiDemMap
-
AiDemMap
public AiDemMap()
-
-
Method Details
-
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 interfaceMapObjectInterface
- Overrides:
unload
in classAiDemBaseMap
-
load
Split the load between binary and ASCII- Specified by:
load
in interfaceMapObjectInterface
- Overrides:
load
in classAiDemBaseMap
- Throws:
IOException
- Description of Exception
-
loadHeader
Loads the header section of the grid file giving us the information such as grid location, cell size, number of rows/columns.- Specified by:
loadHeader
in classAiDemBaseMap
- Throws:
IOException
-
fillArray
public boolean fillArray(float[] dest, long destPosition, long srcPosition, int length) throws IOException Fills the destination array with data from this map starting at destPosition reading from srcPosition for length # of values.- Specified by:
fillArray
in classAiDemBaseMap
- Throws:
IOException
-
ensureBinaryFile
Ensures that the grid file is binary by checking for the presence of a .ascbin. If not, then the grid is converted to binary. This is done because reading a binary file is a lot quicker then reading the ascii version.- Throws:
IOException
-
readAsciiHeader
read the ASCII header. This was moved to its own method so that subclasses (in particular the GrassAsciiMap) can override since the format of their file is same except for the header- Parameters:
in
- reader for the ASCII file- Throws:
IOException
-
loadBin
- Throws:
IOException
-
mapIdentifierEquals
check to see if the Map specified by the MapIdentifier mapid is the same map as this one. AiDem files create a binary version of the ascii file so the test needs to check both the .asc and the .ascbin extensions.- Overrides:
mapIdentifierEquals
in classMapObject
- Parameters:
mapid
-- Returns:
- true if the mapid references the same map file as this map.
-