📄 mitab.h
字号:
/********************************************************************** * $Id: mitab.h,v 1.73 2004/07/07 22:18:02 dmorissette Exp $ * * Name: mitab.h * Project: MapInfo TAB Read/Write library * Language: C++ * Purpose: Header file containing public definitions for the library. * Author: Daniel Morissette, dmorissette@dmsolutions.ca * ********************************************************************** * Copyright (c) 1999-2004, 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.h,v $ * Revision 1.73 2004/07/07 22:18:02 dmorissette * Updated 1.3.0 release date * * Revision 1.72 2004/06/30 20:22:31 dmorissette * Ready for V1.3.0 * * Revision 1.71 2003/08/07 03:20:46 dmorissette * Added mitab_c_getlibversion() to C API. (Uffe K. - bug 21) * * Revision 1.70 2003/07/24 02:47:58 daniel * Version 1.2.4 * * Revision 1.69 2002/10/15 23:30:49 daniel * Version 1.2.3 * * Revision 1.68 2002/07/06 15:36:57 daniel * Version 1.2.2 * * Revision 1.67 2002/06/28 18:39:10 julien * Change version number (1.2.2-dev) * * Revision 1.66 2002/06/28 18:32:37 julien * Add SetSpatialFilter() in TABSeamless class (Bug 164, MapServer) * Use double for comparison in Coordsys2Int() in mitab_mapheaderblock.cpp * * Revision 1.65 2002/06/17 15:00:30 julien * Add IsInteriorRing() function in TABRegion to validate if a ring is internal * * Revision 1.64 2002/05/08 20:02:29 daniel * Version 1.2.1 * * Revision 1.63 2002/05/08 15:10:48 julien * Implement MIFFile::SetMIFCoordSys in mitab_capi.cpp (Bug 984) * * Revision 1.62 2002/05/03 15:09:41 daniel * Version 1.2.0 * * Revision 1.61 2002/03/26 19:27:43 daniel * Got rid of tabs in source * * Revision 1.60 2002/03/26 03:17:13 daniel * Added Get/SetCenter() to MultiPoint * * Revision 1.59 2002/03/26 01:48:40 daniel * Added Multipoint object type (V650) * * Revision 1.58 2001/11/17 21:54:05 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.57 2001/11/02 17:27:21 daniel * Version 1.1.3 * * Revision 1.56 2001/09/19 21:39:15 warmerda * get extents efficiently * * Revision 1.55 2001/09/19 14:31:22 warmerda * added m_nPreloadedId to keep track of preloaded line * * Revision 1.54 2001/09/14 03:23:55 warmerda * Substantial upgrade to support spatial queries using spatial indexes * * Revision 1.53 2001/06/25 01:51:19 daniel * Version 1.1.2 * * Revision 1.52 2001/05/01 18:36:10 daniel * Version 1.1.1 * * Revision 1.51 2001/03/15 03:57:51 daniel * Added implementation for new OGRLayer::GetExtent(), returning data MBR. * * Revision 1.50 2001/03/09 04:16:02 daniel * Added TABSeamless for reading seamless TAB files * * Revision 1.49 2001/02/28 07:15:08 daniel * Added support for text label line end point * * Revision 1.48 2001/02/27 19:59:05 daniel * Enabled spatial filter in IMapInfoFile::GetNextFeature(), and avoid * unnecessary feature cloning in GetNextFeature() and GetFeature() * * Revision 1.47 2001/01/23 22:06:50 daniel * Added MITABCoordSysTableLoaded() * * Revision 1.46 2001/01/23 21:23:41 daniel * Added projection bounds lookup table, called from TABFile::SetProjInfo() * * Revision 1.45 2001/01/22 16:03:59 warmerda * expanded tabs * * Revision 1.44 2000/11/23 20:47:45 daniel * Use MI defaults for Pen, Brush, Font, Symbol instead of all zeros * * Revision 1.43 2000/11/22 04:04:04 daniel * Added TAB_WarningBoundsOverflow * * Revision 1.42 2000/11/15 04:35:35 daniel * MITAB_VERSION 1.0.4 * * Revision 1.41 2000/10/19 20:15:41 daniel * Update MITAB_VERSION to 1.0.3 * * Revision 1.40 2000/10/03 22:11:43 daniel * Added MITAB_VERSION * * Revision 1.39 2000/10/03 19:29:51 daniel * Include OGR StyleString stuff (implemented by Stephane) * * Revision 1.38 2000/09/19 17:23:52 daniel * Maintain and/or compute valid region and polyline center/label point * * Revision 1.37 2000/09/07 23:32:13 daniel * Added RecordDeletedFlag to TABFeature with get/set methods * * Revision 1.36 2000/07/27 02:03:57 daniel * Remove extra comma at end of TABCustSymbStyle enum * * Revision 1.35 2000/07/04 01:45:16 warmerda * avoid warning on nfieldid of IsFieldUnique * * Revision 1.34 2000/06/28 00:30:25 warmerda * added count of points, lines, egions and text for MIFFile * * Revision 1.33 2000/04/21 12:40:01 daniel * Added TABPolyline::GetNumParts()/GetPartRef() * * Revision 1.32 2000/02/28 16:41:48 daniel * Added support for indexed, unique, and for new V450 object types * * ... * * Revision 1.1 1999/07/12 04:18:23 daniel * Initial checkin * **********************************************************************/#ifndef _MITAB_H_INCLUDED_#define _MITAB_H_INCLUDED_#include "mitab_priv.h"#include "ogr_feature.h"#include "ogrsf_frmts.h"/*--------------------------------------------------------------------- * Current version of the MITAB library... always useful! *--------------------------------------------------------------------*/#define MITAB_VERSION "1.3.0 (2004-07-07)"#define MITAB_VERSION_INT 1003000 /* version x.y.z -> xxxyyyzzz */#ifndef PI# define PI 3.14159265358979323846#endif#ifndef ROUND_INT# define ROUND_INT(dX) ((int)((dX) < 0.0 ? (dX)-0.5 : (dX)+0.5 ))#endifclass TABFeature;/*--------------------------------------------------------------------- * Codes for the GetFileClass() in the IMapInfoFile-derived classes *--------------------------------------------------------------------*/typedef enum{ TABFC_IMapInfoFile = 0, TABFC_TABFile, TABFC_TABView, TABFC_TABSeamless, TABFC_MIFFile} TABFileClass;/*--------------------------------------------------------------------- * class IMapInfoFile * * Virtual base class for the TABFile and MIFFile classes. * * This is the definition of the public interface methods that should * be available for any type of MapInfo dataset. *--------------------------------------------------------------------*/class IMapInfoFile : public OGRLayer{ private: protected: int m_nCurFeatureId; TABFeature *m_poCurFeature; GBool m_bBoundsSet; public: IMapInfoFile() ; virtual ~IMapInfoFile(); virtual TABFileClass GetFileClass() {return TABFC_IMapInfoFile;} virtual int Open(const char *pszFname, const char *pszAccess, GBool bTestOpenNoError = FALSE ) = 0; virtual int Close() = 0; virtual const char *GetTableName() = 0; /////////////// // Static method to detect file type, create an object to read that // file and open it. static IMapInfoFile *SmartOpen(const char *pszFname, GBool bTestOpenNoError = FALSE); /////////////// // OGR methods for read support virtual void ResetReading() = 0; virtual int GetFeatureCount (int bForce) = 0; virtual OGRFeature *GetNextFeature(); virtual OGRFeature *GetFeature(long nFeatureId); virtual OGRErr CreateFeature(OGRFeature *poFeature); virtual int TestCapability( const char * pszCap ) =0; virtual int GetExtent(OGREnvelope *psExtent, int bForce) =0; /////////////// // Read access specific stuff // virtual int GetNextFeatureId(int nPrevId) = 0; virtual TABFeature *GetFeatureRef(int nFeatureId) = 0; virtual OGRFeatureDefn *GetLayerDefn() = 0; virtual TABFieldType GetNativeFieldType(int nFieldId) = 0; virtual int GetBounds(double &dXMin, double &dYMin, double &dXMax, double &dYMax, GBool bForce = TRUE ) = 0; virtual OGRSpatialReference *GetSpatialRef() = 0; virtual int GetFeatureCountByType(int &numPoints, int &numLines, int &numRegions, int &numTexts, GBool bForce = TRUE ) = 0; virtual GBool IsFieldIndexed(int nFieldId) = 0; virtual GBool IsFieldUnique(int nFieldId) = 0; /////////////// // Write access specific stuff // GBool IsBoundsSet() {return m_bBoundsSet;} virtual int SetBounds(double dXMin, double dYMin, double dXMax, double dYMax) = 0; virtual int SetFeatureDefn(OGRFeatureDefn *poFeatureDefn, TABFieldType *paeMapInfoNativeFieldTypes = NULL)=0; virtual int AddFieldNative(const char *pszName, TABFieldType eMapInfoType, int nWidth=0, int nPrecision=0, GBool bIndexed=FALSE, GBool bUnique=FALSE) = 0; virtual OGRErr CreateField( OGRFieldDefn *poField, int bApproxOK = TRUE ); virtual int SetSpatialRef(OGRSpatialReference *poSpatialRef) = 0; virtual int SetFeature(TABFeature *poFeature, int nFeatureId = -1) = 0; virtual int SetFieldIndexed(int nFieldId) = 0; /////////////// // semi-private. virtual int GetProjInfo(TABProjInfo *poPI) = 0; virtual int SetProjInfo(TABProjInfo *poPI) = 0; virtual int SetMIFCoordSys(const char *pszMIFCoordSys) = 0;#ifdef DEBUG virtual void Dump(FILE *fpOut = NULL) = 0;#endif};/*--------------------------------------------------------------------- * class TABFile * * The main class for TAB datasets. External programs should use this * class to open a TAB dataset and read/write features from/to it. * *--------------------------------------------------------------------*/class TABFile: public IMapInfoFile{ private: char *m_pszFname; TABAccess m_eAccessMode; char **m_papszTABFile; int m_nVersion; char *m_pszCharset; int *m_panIndexNo; TABTableType m_eTableType; // NATIVE (.DAT) or DBF TABDATFile *m_poDATFile; // Attributes file TABMAPFile *m_poMAPFile; // Object Geometry file TABINDFile *m_poINDFile; // Attributes index file OGRFeatureDefn *m_poDefn; OGRSpatialReference *m_poSpatialRef; int bUseSpatialTraversal; int m_nLastFeatureId; /////////////// // Private Read access specific stuff // int ParseTABFileFirstPass(GBool bTestOpenNoError); int ParseTABFileFields(); /////////////// // Private Write access specific stuff // int WriteTABFile(); public: TABFile(); virtual ~TABFile(); virtual TABFileClass GetFileClass() {return TABFC_TABFile;} virtual int Open(const char *pszFname, const char *pszAccess, GBool bTestOpenNoError = FALSE ); virtual int Close(); virtual const char *GetTableName() {return m_poDefn?m_poDefn->GetName():"";}; virtual void ResetReading();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -