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 longNumber of bytes for the header.static final StringFields inherited from class hec.map.aidem.AiDemBaseMap
_cellsize, _data, _lowerLeftCorner, _maxElev, _minElev, _nodata, _numcol, _numrowFields inherited from class hec.map.MapObject
_debug, _extent, _fileOpener, _loaded, _mapId, mCoordinateReferencySystem -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures that the grid file is binary by checking for the presence of a .ascbin.booleanfillArray(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.voidload()Split the load between binary and ASCIIvoidvoidLoads the header section of the grid file giving us the information such as grid location, cell size, number of rows/columns.booleanmapIdentifierEquals(MapIdentifier mapid) check to see if the Map specified by the MapIdentifier mapid is the same map as this one.protected booleanread the ASCII header.voidunload()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, worldPtToCellMethods inherited from class hec.map.MapObject
equals, getCoordinateInfo, getCoordinateReferenceSystem, getExtent, getFilenames, getFileOpener, getMapIdentifier, newFile, newThenOpenFile, openFile, readProjection, setExtent, setFileOpener, setMapIdentifier, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:MapObjectInterfaceMethod to tell the Map Object to unload, because the map is done- Specified by:
unloadin interfaceMapObjectInterface- Overrides:
unloadin classAiDemBaseMap
-
load
Split the load between binary and ASCII- Specified by:
loadin interfaceMapObjectInterface- Overrides:
loadin 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:
loadHeaderin 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:
fillArrayin 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:
mapIdentifierEqualsin classMapObject- Parameters:
mapid-- Returns:
- true if the mapid references the same map file as this map.
-