?? mitab.h
字號:
/********************************************************************** * $Id: mitab.h,v 1.85 2006/07/25 13:24:47 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-2005, 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.85 2006/07/25 13:24:47 dmorissette * Updated for 1.5.1 release * * Revision 1.84 2006/07/25 13:22:58 dmorissette * Fixed initialization of MBR of TABCollection members (bug 1520) * * Revision 1.83 2006/02/16 15:13:38 dmorissette * Updated for 1.5.0 release * * Revision 1.82 2005/10/07 18:54:23 dmorissette * Ready for 1.5.0-beta1 release * * Revision 1.81 2005/10/06 23:05:08 dmorissette * TABCollection: Added automated sync'ing of OGRFeature's geometry in * SetRegion/Pline/MpointDirectly() methods (bug 1126) * * Revision 1.80 2005/10/06 19:15:30 dmorissette * Collections: added support for reading/writing pen/brush/symbol ids and * for writing collection objects to .TAB/.MAP (bug 1126) * * Revision 1.79 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.78 2005/05/21 03:16:01 fwarmerdam * Removed m_poFilterGeom ... should have been done yesterday with spatial * filter overhaul. * * Revision 1.77 2005/05/19 21:10:50 fwarmerdam * changed to use OGRLayers spatial filter support * * Revision 1.76 2005/05/19 15:26:59 jlacroix * Implement a method to set the StyleString of a TABFeature. * This is done via the ITABFeaturePen, Brush and Symbol classes. * * Revision 1.75 2005/04/01 16:48:41 dmorissette * Updated 1.4.0 release date * * Revision 1.74 2005/03/23 20:36:09 dmorissette * Ready for V1.4.0 * * 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.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 "ogr_featurestyle.h"#include "ogrsf_frmts.h"/*--------------------------------------------------------------------- * Current version of the MITAB library... always useful! *--------------------------------------------------------------------*/#define MITAB_VERSION "1.5.1 (2006-07-25)"#define MITAB_VERSION_INT 1005001 /* 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(); virtual int TestCapability( const char * pszCap ); virtual int GetFeatureCount (int bForce); virtual int GetExtent(OGREnvelope *psExtent, int bForce); /////////////// // Read access specific stuff // int GetNextFeatureId_Spatial( int nPrevId ); virtual int GetNextFeatureId(int nPrevId); virtual TABFeature *GetFeatureRef(int nFeatureId); virtual OGRFeatureDefn *GetLayerDefn(); virtual TABFieldType GetNativeFieldType(int nFieldId); virtual int GetBounds(double &dXMin, double &dYMin, double &dXMax, double &dYMax, GBool bForce = TRUE ); virtual OGRSpatialReference *GetSpatialRef(); virtual int GetFeatureCountByType(int &numPoints, int &numLines, int &numRegions, int &numTexts, GBool bForce = TRUE); virtual GBool IsFieldIndexed(int nFieldId); virtual GBool IsFieldUnique(int /*nFieldId*/) {return FALSE;}; /////////////// // Write access specific stuff // virtual int SetBounds(double dXMin, double dYMin, double dXMax, double dYMax); virtual int SetFeatureDefn(OGRFeatureDefn *poFeatureDefn, TABFieldType *paeMapInfoNativeFieldTypes = NULL); virtual int AddFieldNative(const char *pszName, TABFieldType eMapInfoType, int nWidth=0, int nPrecision=0, GBool bIndexed=FALSE, GBool bUnique=FALSE); virtual int SetSpatialRef(OGRSpatialReference *poSpatialRef); virtual int SetFeature(TABFeature *poFeature, int nFeatureId = -1); virtual int SetFieldIndexed(int nFieldId); /////////////// // semi-private. virtual int GetProjInfo(TABProjInfo *poPI) { return m_poMAPFile->GetHeaderBlock()->GetProjInfo( poPI ); } virtual int SetProjInfo(TABProjInfo *poPI); virtual int SetMIFCoordSys(const char *pszMIFCoordSys); int GetFieldIndexNumber(int nFieldId); TABINDFile *GetINDFileRef(); TABMAPFile *GetMAPFileRef() { return m_poMAPFile; }#ifdef DEBUG virtual void Dump(FILE *fpOut = NULL);#endif};/*--------------------------------------------------------------------- * class TABView * * TABView is used to handle special type of .TAB files that are * composed of a number of .TAB datasets linked through some indexed * fields. * * NOTE: The current implementation supports only TABViews composed * of 2 TABFiles linked through an indexed field of integer type. * It is unclear if any other type of views could exist anyways. *--------------------------------------------------------------------*/class TABView: public IMapInfoFile{ private:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -