?? mitab_priv.h
字號:
/********************************************************************** * $Id: mitab_priv.h,v 1.40 2005/10/06 19:15:31 dmorissette Exp $ * * Name: mitab_priv.h * Project: MapInfo TAB Read/Write library * Language: C++ * Purpose: Header file containing private definitions for the library. * Author: Daniel Morissette, dmorissette@dmsolutions.ca * ********************************************************************** * Copyright (c) 1999-2003, 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: mitab_priv.h,v $ * Revision 1.44 2007/02/22 18:35:53 dmorissette * Fixed problem writing collections where MITAB was sometimes trying to * read past EOF in write mode (bug 1657). * * Revision 1.40 2005/10/06 19:15:31 dmorissette * Collections: added support for reading/writing pen/brush/symbol ids and * for writing collection objects to .TAB/.MAP (bug 1126) * * Revision 1.39 2005/10/04 15:44:31 dmorissette * First round of support for Collection objects. Currently supports reading * from .TAB/.MAP and writing to .MIF. Still lacks symbol support and write * support. (Based in part on patch and docs from Jim Hope, bug 1126) * * Revision 1.38 2005/03/22 23:24:54 dmorissette * Added support for datum id in .MAP header (bug 910) * * Revision 1.37 2004/06/30 20:29:04 dmorissette * Fixed refs to old address danmo@videotron.ca * * Revision 1.36 2003/08/12 23:17:21 dmorissette * Added reading of v500+ coordsys affine params (Anthony D. - Encom) * * Revision 1.35 2003/01/18 20:25:44 daniel * Increased MIDMAXCHAR value to 10000 * * Revision 1.34 2002/04/25 16:05:24 julien * Disabled the overflow warning in SetCoordFilter() by adding bIgnoreOverflow * variable in Coordsys2Int of the TABMAPFile class and TABMAPHeaderBlock class * * Revision 1.33 2002/04/22 13:49:09 julien * Add EOF validation in MIDDATAFile::GetLastLine() (Bug 819) * * Revision 1.32 2002/03/26 19:27:43 daniel * Got rid of tabs in source * * Revision 1.31 2002/03/26 01:48:40 daniel * Added Multipoint object type (V650) * * Revision 1.30 2002/02/22 20:44:51 julien * Prevent infinite loop with TABRelation by suppress the m_poCurFeature object * from the class and setting it in the calling function and add GetFeature in * the class. (bug 706) * * Revision 1.29 2001/11/19 15:07:54 daniel * Added TABMAPObjNone to handle the case of TAB_GEOM_NONE * * Revision 1.28 2001/11/17 21:54:06 daniel * Made several changes in order to support writing objects in 16 bits * coordinate format. New TABMAPObjHdr-derived classes are used to hold * object info in mem until block is full. * * Revision 1.27 2001/09/18 20:33:52 warmerda * fixed case of spatial search on file with just one object block * * Revision 1.26 2001/09/14 03:23:55 warmerda * Substantial upgrade to support spatial queries using spatial indexes * * Revision 1.25 2001/05/01 18:28:10 daniel * Fixed default BRUSH, should be BRUSH(1,0,16777215). * * Revision 1.24 2001/05/01 03:39:51 daniel * Added SetLastPtr() to TABBinBlockManager. * * Revision 1.23 2001/03/15 03:57:51 daniel * Added implementation for new OGRLayer::GetExtent(), returning data MBR. * * Revision 1.22 2000/11/23 21:11:07 daniel * OOpps... VC++ didn't like the way TABPenDef, etc. were initialized * * Revision 1.21 2000/11/23 20:47:46 daniel * Use MI defaults for Pen, Brush, Font, Symbol instead of all zeros * * Revision 1.20 2000/11/15 04:13:50 daniel * Fixed writing of TABMAPToolBlock to allocate a new block when full * * Revision 1.19 2000/11/13 22:19:30 daniel * Added TABINDNode::UpdateCurChildEntry() * * Revision 1.18 2000/05/19 06:45:25 daniel * Modified generation of spatial index to split index nodes and produce a * more balanced tree. * * Revision 1.17 2000/03/01 00:30:03 daniel * Completed support for joined tables * * Revision 1.16 2000/02/28 16:53:23 daniel * Added support for indexed, unique, and for new V450 object types * * ... * * Revision 1.1 1999/07/12 04:18:25 daniel * Initial checkin * **********************************************************************/#ifndef _MITAB_PRIV_H_INCLUDED_#define _MITAB_PRIV_H_INCLUDED_#include "cpl_conv.h"#include "cpl_string.h"#include "ogr_feature.h"class TABFile;class TABFeature;class TABMAPToolBlock;class TABMAPIndexBlock;/*--------------------------------------------------------------------- * Access mode: Read or Write *--------------------------------------------------------------------*/typedef enum{ TABRead, TABWrite, TABReadWrite /* ReadWrite not implemented yet */} TABAccess;/*--------------------------------------------------------------------- * Supported .MAP block types (the first byte at the beginning of a block) *--------------------------------------------------------------------*/#define TAB_RAWBIN_BLOCK -1#define TABMAP_HEADER_BLOCK 0#define TABMAP_INDEX_BLOCK 1#define TABMAP_OBJECT_BLOCK 2#define TABMAP_COORD_BLOCK 3#define TABMAP_GARB_BLOCK 4#define TABMAP_TOOL_BLOCK 5#define TABMAP_LAST_VALID_BLOCK_TYPE 5/*--------------------------------------------------------------------- * Drawing Tool types *--------------------------------------------------------------------*/#define TABMAP_TOOL_PEN 1#define TABMAP_TOOL_BRUSH 2#define TABMAP_TOOL_FONT 3#define TABMAP_TOOL_SYMBOL 4/*--------------------------------------------------------------------- * Limits related to .TAB version number. If we pass any of those limits * then we have to switch dataset version up from 300 to 450 *--------------------------------------------------------------------*/#define TAB_300_MAX_VERTICES 32767/*--------------------------------------------------------------------- * struct TABMAPIndexEntry - Entries found in type 1 blocks of .MAP files * * We will use this struct to rebuild the geographic index in memory *--------------------------------------------------------------------*/typedef struct TABMAPIndexEntry_t{ // These members refer to the info we find in the file GInt32 XMin; GInt32 YMin; GInt32 XMax; GInt32 YMax; GInt32 nBlockPtr;}TABMAPIndexEntry;#define TAB_MAX_ENTRIES_INDEX_BLOCK ((512-4)/20)/*--------------------------------------------------------------------- * TABVertex *--------------------------------------------------------------------*/typedef struct TABVertex_t{ double x; double y;} TABVertex;/*--------------------------------------------------------------------- * TABTableType - Attribute table format *--------------------------------------------------------------------*/typedef enum{ TABTableNative, // The default TABTableDBF, TABTableAccess} TABTableType;/*--------------------------------------------------------------------- * TABFieldType - Native MapInfo attribute field types *--------------------------------------------------------------------*/typedef enum{ TABFUnknown = 0, TABFChar, TABFInteger, TABFSmallInt, TABFDecimal, TABFFloat, TABFDate, TABFLogical} TABFieldType;#define TABFIELDTYPE_2_STRING(type) \ (type == TABFChar ? "Char" : \ type == TABFInteger ? "Integer" : \ type == TABFSmallInt ? "SmallInt" : \ type == TABFDecimal ? "Decimal" : \ type == TABFFloat ? "Float" : \ type == TABFDate ? "Date" : \ type == TABFLogical ? "Logical" : \ "Unknown field type" )/*--------------------------------------------------------------------- * TABDATFieldDef *--------------------------------------------------------------------*/typedef struct TABDATFieldDef_t{ char szName[11]; char cType; GByte byLength; GByte byDecimals; TABFieldType eTABType;} TABDATFieldDef;/*--------------------------------------------------------------------- * TABMAPCoordSecHdr * struct used in the TABMAPCoordBlock to store info about the coordinates * for a section of a PLINE MULTIPLE or a REGION. *--------------------------------------------------------------------*/typedef struct TABMAPCoordSecHdr_t{ GInt32 numVertices; GInt16 numHoles; GInt32 nXMin; GInt32 nYMin; GInt32 nXMax; GInt32 nYMax; GInt32 nDataOffset; int nVertexOffset;} TABMAPCoordSecHdr;/*--------------------------------------------------------------------- * TABProjInfo * struct used to store the projection parameters from the .MAP header *--------------------------------------------------------------------*/typedef struct TABProjInfo_t{ GByte nProjId; // See MapInfo Ref. Manual, App. F and G GByte nEllipsoidId; GByte nUnitsId; double adProjParams[6]; // params in same order as in .MIF COORDSYS GInt16 nDatumId; // Datum Id added in MapInfo 7.8+ (.map V500) double dDatumShiftX; // Before that, we had to always lookup datum double dDatumShiftY; // parameters to establish datum id double dDatumShiftZ; double adDatumParams[5]; // Affine parameters only in .map version 500 and up GByte nAffineFlag; // 0=No affine param, 1=Affine params GByte nAffineUnits; double dAffineParamA; // Affine params double dAffineParamB; double dAffineParamC; double dAffineParamD; double dAffineParamE; double dAffineParamF;} TABProjInfo;/*--------------------------------------------------------------------- * TABPenDef - Pen definition information *--------------------------------------------------------------------*/typedef struct TABPenDef_t{ GInt32 nRefCount; GByte nPixelWidth; GByte nLinePattern; int nPointWidth; GInt32 rgbColor;} TABPenDef;/* MI Default = PEN(1,2,0) */#define MITAB_PEN_DEFAULT {0, 1, 2, 0, 0x000000}/*--------------------------------------------------------------------- * TABBrushDef - Brush definition information *--------------------------------------------------------------------*/typedef struct TABBrushDef_t{ GInt32 nRefCount; GByte nFillPattern; GByte bTransparentFill; // 1 = Transparent GInt32 rgbFGColor; GInt32 rgbBGColor;} TABBrushDef;/* MI Default = BRUSH(1,0,16777215) */#define MITAB_BRUSH_DEFAULT {0, 1, 0, 0, 0xffffff}/*--------------------------------------------------------------------- * TABFontDef - Font Name information *--------------------------------------------------------------------*/typedef struct TABFontDef_t{ GInt32 nRefCount; char szFontName[33];} TABFontDef;/* MI Default = FONT("Arial",0,0,0) */#define MITAB_FONT_DEFAULT {0, "Arial"}/*--------------------------------------------------------------------- * TABSymbolDef - Symbol definition information *--------------------------------------------------------------------*/typedef struct TABSymbolDef_t{ GInt32 nRefCount; GInt16 nSymbolNo; GInt16 nPointSize; GByte _nUnknownValue_;// Style??? GInt32 rgbColor;} TABSymbolDef;/* MI Default = SYMBOL(35,0,12) */#define MITAB_SYMBOL_DEFAULT {0, 35, 12, 0, 0x000000}/*--------------------------------------------------------------------- * class TABToolDefTable * * Class to handle the list of Drawing Tool Definitions for a dataset * * This class also contains methods to read tool defs from the file and * write them to the file. *--------------------------------------------------------------------*/class TABToolDefTable{ protected: TABPenDef **m_papsPen; int m_numPen; int m_numAllocatedPen; TABBrushDef **m_papsBrush; int m_numBrushes; int m_numAllocatedBrushes; TABFontDef **m_papsFont; int m_numFonts; int m_numAllocatedFonts; TABSymbolDef **m_papsSymbol; int m_numSymbols; int m_numAllocatedSymbols; public: TABToolDefTable(); ~TABToolDefTable(); int ReadAllToolDefs(TABMAPToolBlock *poToolBlock); int WriteAllToolDefs(TABMAPToolBlock *poToolBlock); TABPenDef *GetPenDefRef(int nIndex); int AddPenDefRef(TABPenDef *poPenDef); int GetNumPen(); TABBrushDef *GetBrushDefRef(int nIndex); int AddBrushDefRef(TABBrushDef *poBrushDef); int GetNumBrushes(); TABFontDef *GetFontDefRef(int nIndex); int AddFontDefRef(TABFontDef *poFontDef); int GetNumFonts(); TABSymbolDef *GetSymbolDefRef(int nIndex); int AddSymbolDefRef(TABSymbolDef *poSymbolDef); int GetNumSymbols(); int GetMinVersionNumber();};/*===================================================================== Classes to handle Object Headers inside TABMAPObjectBlocks =====================================================================*/class TABMAPObjectBlock;class TABMAPHeaderBlock;class TABMAPObjHdr{ public: GByte m_nType; GInt32 m_nId; GInt32 m_nMinX; /* Object MBR */ GInt32 m_nMinY; GInt32 m_nMaxX;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -