1 /****************************************************************************** 2 * $Id: aigrid.h 202f8010aba43611725e3e6ba2ddb5971bc9fdb0 2018-02-25 22:13:32Z Even Rouault $ 3 * 4 * Project: Arc/Info Binary Grid Translator 5 * Purpose: Grid file access include file. 6 * Author: Frank Warmerdam, warmerdam@pobox.com 7 * 8 ****************************************************************************** 9 * Copyright (c) 1999, Frank Warmerdam 10 * 11 * Permission is hereby granted, free of charge, to any person obtaining a 12 * copy of this software and associated documentation files (the "Software"), 13 * to deal in the Software without restriction, including without limitation 14 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15 * and/or sell copies of the Software, and to permit persons to whom the 16 * Software is furnished to do so, subject to the following conditions: 17 * 18 * The above copyright notice and this permission notice shall be included 19 * in all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 * DEALINGS IN THE SOFTWARE. 28 ****************************************************************************/ 29 30 #ifndef AIGRID_H_INCLUDED 31 #define AIGRID_H_INCLUDED 32 33 #include "cpl_conv.h" 34 35 CPL_C_START 36 37 #define ESRI_GRID_NO_DATA -2147483647 38 /*#define ESRI_GRID_FLOAT_NO_DATA -340282306073709652508363335590014353408.0 */ 39 #define ESRI_GRID_FLOAT_NO_DATA -340282346638528859811704183484516925440.0 40 41 /* ==================================================================== */ 42 /* Grid Instance */ 43 /* ==================================================================== */ 44 45 typedef struct { 46 int nBlocks; 47 GUInt32 *panBlockOffset; 48 int *panBlockSize; 49 50 VSILFILE *fpGrid; // The w001001.adf file. 51 int bTriedToLoad; 52 } AIGTileInfo; 53 54 typedef struct { 55 /* Private information */ 56 57 AIGTileInfo *pasTileInfo; 58 59 int bHasWarned; 60 int nFailedOpenings; 61 62 /* public information */ 63 64 char *pszCoverName; // Path of coverage directory. 65 66 GInt32 nCellType; 67 GInt32 bCompressed; 68 69 #define AIG_CELLTYPE_INT 1 70 #define AIG_CELLTYPE_FLOAT 2 71 72 GInt32 nBlockXSize; 73 GInt32 nBlockYSize; 74 75 GInt32 nBlocksPerRow; 76 GInt32 nBlocksPerColumn; 77 78 int nTileXSize; 79 int nTileYSize; 80 81 int nTilesPerRow; 82 int nTilesPerColumn; 83 84 double dfLLX; 85 double dfLLY; 86 double dfURX; 87 double dfURY; 88 89 double dfCellSizeX; 90 double dfCellSizeY; 91 92 int nPixels; 93 int nLines; 94 95 double dfMin; 96 double dfMax; 97 double dfMean; 98 double dfStdDev; 99 100 } AIGInfo_t; 101 102 /* ==================================================================== */ 103 /* Private APIs */ 104 /* ==================================================================== */ 105 106 CPLErr AIGAccessTile( AIGInfo_t *psInfo, int iTileX, int iTileY ); 107 CPLErr AIGReadBlock( VSILFILE * fp, GUInt32 nBlockOffset, int nBlockSize, 108 int nBlockXSize, int nBlockYSize, GInt32 * panData, 109 int nCellType, int bCompressed ); 110 111 CPLErr AIGReadHeader( const char *, AIGInfo_t * ); 112 CPLErr AIGReadBlockIndex( AIGInfo_t *, AIGTileInfo *, 113 const char *pszBasename ); 114 CPLErr AIGReadBounds( const char *, AIGInfo_t * ); 115 CPLErr AIGReadStatistics( const char *, AIGInfo_t * ); 116 117 CPLErr DecompressCCITTRLETile( unsigned char *pabySrcData, int nSrcBytes, 118 unsigned char *pabyDstData, int nDstBytes, 119 int nBlockXSize, int nBlockYSize ); 120 121 /* ==================================================================== */ 122 /* Public APIs */ 123 /* ==================================================================== */ 124 125 AIGInfo_t *AIGOpen( const char *, const char * ); 126 127 CPLErr AIGReadTile( AIGInfo_t *, int, int, GInt32 * ); 128 CPLErr AIGReadFloatTile( AIGInfo_t *, int, int, float * ); 129 130 void AIGClose( AIGInfo_t * ); 131 132 VSILFILE *AIGLLOpen( const char *, const char * ); 133 134 CPL_C_END 135 136 #endif /* ndef AIGRID_H_INCLUDED */ 137