📄 avc.h
字号:
/********************************************************************** * $Id: avc.h,v 1.17 2004/02/11 05:49:44 daniel Exp $ * * Name: avc.h * Project: Arc/Info Vector coverage (AVC) BIN<->E00 conversion library * Language: ANSI C * Purpose: Header file containing all definitions for the library. * Author: Daniel Morissette, danmo@videotron.ca * ********************************************************************** * Copyright (c) 1999-2001, Daniel Morissette * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ********************************************************************** * * $Log: avc.h,v $ * Revision 1.17 2004/02/11 05:49:44 daniel * Added support for deleted flag in arc.dir (bug 2332) * * Revision 1.16 2002/02/14 16:34:15 warmerda * fixed prototype name for AVCBinReadNextPrj * * Revision 1.15 2002/02/13 20:35:24 warmerda * added AVCBinReadObject * * Revision 1.14 2001/11/25 21:15:23 daniel * Added hack (AVC_MAP_TYPE40_TO_DOUBLE) to map type 40 fields bigger than 8 * digits to double precision as we generate E00 output (bug599) * * Revision 1.13 2001/02/20 15:24:11 daniel * Updated AVC_VERSION="1.2.0 (2000-10-17)" * * Revision 1.12 2000/09/26 21:38:44 daniel * Updated AVC_VERSION * * Revision 1.11 2000/09/26 20:21:04 daniel * Added AVCCoverPC write * * Revision 1.10 2000/09/22 19:45:20 daniel * Switch to MIT-style license * * Revision 1.9 2000/05/29 15:31:30 daniel * Added Japanese DBCS support * * Revision 1.8 2000/01/10 02:56:01 daniel * Added read support for "weird" coverages * * Revision 1.7 1999/12/24 07:18:34 daniel * Added PC Arc/Info coverages support * * Revision 1.6 1999/08/23 18:15:56 daniel * Added AVCE00DeleteCoverage() * * Revision 1.5 1999/06/08 22:07:28 daniel * Added AVCReadWrite in AVCAccess type * * Revision 1.4 1999/05/17 16:16:41 daniel * Added RXP + TXT/TX6/TX7 write support * * Revision 1.3 1999/05/11 02:15:04 daniel * Added coverage write support * * Revision 1.2 1999/02/25 03:39:39 daniel * Added TXT, TX6/TX7, RXP and RPL support * * Revision 1.1 1999/01/29 16:29:24 daniel * Initial revision * **********************************************************************/#ifndef _AVC_H_INCLUDED_#define _AVC_H_INCLUDED_#include "cpl_conv.h"#include "cpl_string.h"#include "dbfopen.h"#include "avc_mbyte.h"CPL_C_START/*--------------------------------------------------------------------- * Current version of the AVCE00 library... always useful! *--------------------------------------------------------------------*/#define AVC_VERSION "1.2.1 (2001-11-25)"/* Coverage precision */#define AVC_DEFAULT_PREC 0#define AVC_SINGLE_PREC 1#define AVC_DOUBLE_PREC 2/* AVC_FORMAT_DBF_FLOAT used as nPrecision value only for AVCPrintRealValue() */#define AVC_FORMAT_DBF_FLOAT 42/* Coverage file types */typedef enum{ AVCFileUnknown = 0, AVCFileARC, AVCFilePAL, AVCFileCNT, AVCFileLAB, AVCFilePRJ, AVCFileTOL, AVCFileLOG, AVCFileTXT, /* TXT and TX6 share the same binary format */ AVCFileTX6, AVCFileRXP, AVCFileRPL, /* RPL is a PAL for a region */ AVCFileTABLE}AVCFileType;/* Read or Write access flag */typedef enum{ AVCRead, AVCWrite, AVCReadWrite} AVCAccess;/* Coverage type: PC Arc/Info or Unix Arc/Info v7 */typedef enum{ AVCCoverTypeUnknown = 0, AVCCoverV7, AVCCoverPC, AVCCoverWeird /* Unknown version... hybrid between V7 and PC !!! */} AVCCoverType;/* Enum for byte ordering */typedef enum{ AVCBigEndian, /* CPL_MSB, Motorola ordering */ AVCLittleEndian /* CPL_LSB, Intel ordering */} AVCByteOrder;/* Macros to establish byte ordering for each coverage type * The rule until now: all coverage types use big endian (Motorola ordering) * except PC Arc/Info coverages. */#define AVC_COVER_BYTE_ORDER(cover_type) \ ((cover_type) == AVCCoverPC ? AVCLittleEndian : AVCBigEndian )/*===================================================================== Structures =====================================================================*//*--------------------------------------------------------------------- * Structures defining various Arc/Info objects types. * These are shared by the Binary and the E00 functions. *--------------------------------------------------------------------*/typedef struct AVCVertex_t{ double x; /* Even for single precision, we always */ double y; /* use doubles for the vertices in memory. */}AVCVertex;/*--------------------------------------------------------------------- * AVCArc: Information about an ARC *--------------------------------------------------------------------*/typedef struct AVCArc_t{ GInt32 nArcId; GInt32 nUserId; GInt32 nFNode; GInt32 nTNode; GInt32 nLPoly; GInt32 nRPoly; GInt32 numVertices; AVCVertex *pasVertices; }AVCArc;/*--------------------------------------------------------------------- * AVCPal: A PAL (Polygon Arc List) references all the arcs that * constitute a polygon. *--------------------------------------------------------------------*/typedef struct AVCPalArc_t{ GInt32 nArcId; GInt32 nFNode; GInt32 nAdjPoly;}AVCPalArc;typedef struct AVCPal_t{ GInt32 nPolyId; AVCVertex sMin; AVCVertex sMax; GInt32 numArcs; AVCPalArc *pasArcs;}AVCPal;/*--------------------------------------------------------------------- * AVCCnt: Information about a CNT (polygon centroid) *--------------------------------------------------------------------*/typedef struct AVCCnt_t{ GInt32 nPolyId; AVCVertex sCoord; GInt32 numLabels; /* 0 or 1 */ GInt32 *panLabelIds;}AVCCnt;/*--------------------------------------------------------------------- * AVCLab: Information about a LAB (polygon Label) *--------------------------------------------------------------------*/typedef struct AVCLab_t{ GInt32 nValue; GInt32 nPolyId; AVCVertex sCoord1; AVCVertex sCoord2; AVCVertex sCoord3;}AVCLab;/*--------------------------------------------------------------------- * AVCTol: Information about a TOL record (coverage tolerances) *--------------------------------------------------------------------*/typedef struct AVCTol_t{ GInt32 nIndex; GInt32 nFlag; double dValue;}AVCTol;/*--------------------------------------------------------------------- * AVCTxt: Information about a TXT/TX6/TX7 record (annotations) *--------------------------------------------------------------------*/typedef struct AVCTxt_t{ GInt32 nTxtId; GInt32 nUserId; GInt32 nLevel; float f_1e2; /* Always (float)-1e+20, even for double precision! */ GInt32 nSymbol; GInt32 numVerticesLine; GInt32 n28; /* Unknown value at byte 28 */ GInt32 numChars; GInt32 numVerticesArrow; GInt16 anJust1[20]; GInt16 anJust2[20]; double dHeight; double dV2; /* ??? */ double dV3; /* ??? */ char *pszText; AVCVertex *pasVertices;}AVCTxt;/*--------------------------------------------------------------------- * AVCRxp: Information about a RXP record (something related to regions...) *--------------------------------------------------------------------*/typedef struct AVCRxp_t{ GInt32 n1; GInt32 n2;}AVCRxp;/*--------------------------------------------------------------------- * AVCTableDef: Definition of an INFO table's structure. * This info is read from several files: * info/arc.dir * info/arc####.dat * info/arc####.nit * * And the data for the table itself is stored in a binary * file in the coverage directory. *--------------------------------------------------------------------*/typedef struct AVCFieldInfo_t{ char szName[17]; GInt16 nSize; GInt16 v2; GInt16 nOffset; GInt16 v4; GInt16 v5; GInt16 nFmtWidth; GInt16 nFmtPrec; GInt16 nType1; GInt16 nType2; GInt16 v10; GInt16 v11; GInt16 v12; GInt16 v13; char szAltName[17]; GInt16 nIndex; /* >0 if valid, or -1 if field is deleted */}AVCFieldInfo;#define AVC_FT_DATE 10#define AVC_FT_CHAR 20#define AVC_FT_FIXINT 30#define AVC_FT_FIXNUM 40#define AVC_FT_BININT 50#define AVC_FT_BINFLOAT 60typedef struct AVCTableDef_t{ /* Stuff read from the arc.dir file * (1 record, corresponding to this table, from the arc.dir file) */ char szTableName[33]; char szInfoFile[9]; GInt16 numFields; GInt16 nRecSize; GInt32 numRecords; char szExternal[3]; /* "XX" or " " */ GInt16 bDeletedFlag; /* 1 if deleted, 0 if table is active */ /* Data file path read from the arc####.dat file */ char szDataFile[81]; /* Field information read from the arc####.nit file */ AVCFieldInfo *pasFieldDef;}AVCTableDef;typedef struct AVCField_t{ GInt16 nInt16; GInt32 nInt32; float fFloat; double dDouble; char *pszStr;}AVCField;/*--------------------------------------------------------------------- * Stuff related to buffered reading of raw binary files *--------------------------------------------------------------------*/#define AVCRAWBIN_READBUFSIZE 1024typedef struct AVCRawBinFile_t{ FILE *fp; char *pszFname; AVCAccess eAccess; AVCByteOrder eByteOrder; GByte abyBuf[AVCRAWBIN_READBUFSIZE]; int nOffset; /* Location of current buffer in the file */ int nCurSize; /* Nbr of bytes currently loaded */ int nCurPos; /* Next byte to read from abyBuf[] */ int nFileDataSize; /* File Size as stated in the header */ /* EOF=TRUE passed this point in file */ /* Set to -1 if not specified. */ /* Handle on dataset's multibyte character encoding info. */ AVCDBCSInfo *psDBCSInfo;}AVCRawBinFile;/*--------------------------------------------------------------------- * Stuff related to reading and writing binary coverage files *--------------------------------------------------------------------*/typedef struct AVCBinHeader_t{ GUInt32 nSignature; GInt32 nPrecision; /* <0 for double prec., >0 for single prec. */ GInt32 nRecordSize; /* nbr of 2 byte words, 0 for var. length */ GInt32 nLength; /* Overall file length, in 2 byte words */}AVCBinHeader;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -