📄 mitab.h
字号:
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 int SetQuickSpatialIndexMode(GBool bQuickSpatialIndexMode=TRUE);
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:
char *m_pszFname;
TABAccess m_eAccessMode;
char **m_papszTABFile;
char *m_pszVersion;
char **m_papszTABFnames;
TABFile **m_papoTABFiles;
int m_numTABFiles;
int m_nMainTableIndex; // The main table is the one that also
// contains the geometries
char **m_papszFieldNames;
char **m_papszWhereClause;
TABRelation *m_poRelation;
GBool m_bRelFieldsCreated;
///////////////
// Private Read access specific stuff
//
int ParseTABFile(const char *pszDatasetPath,
GBool bTestOpenNoError = FALSE);
int OpenForRead(const char *pszFname,
GBool bTestOpenNoError = FALSE );
///////////////
// Private Write access specific stuff
//
int OpenForWrite(const char *pszFname );
int WriteTABFile();
public:
TABView();
virtual ~TABView();
virtual TABFileClass GetFileClass() {return TABFC_TABView;}
virtual int Open(const char *pszFname, const char *pszAccess,
GBool bTestOpenNoError = FALSE );
virtual int Close();
virtual int SetQuickSpatialIndexMode(GBool bQuickSpatialIndexMode=TRUE);
virtual const char *GetTableName()
{return m_poRelation?m_poRelation->GetFeatureDefn()->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
//
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);
///////////////
// 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_nMainTableIndex!=-1?
m_papoTABFiles[m_nMainTableIndex]->GetProjInfo(poPI):-1; }
virtual int SetProjInfo(TABProjInfo *poPI)
{ return m_nMainTableIndex!=-1?
m_papoTABFiles[m_nMainTableIndex]->SetProjInfo(poPI):-1; }
virtual int SetMIFCoordSys(const char * /*pszMIFCoordSys*/) {return -1;};
#ifdef DEBUG
virtual void Dump(FILE *fpOut = NULL);
#endif
};
/*---------------------------------------------------------------------
* class TABSeamless
*
* TABSeamless is used to handle seamless .TAB files that are
* composed of a main .TAB file in which each feature is the MBR of
* a base table.
*
* TABSeamless are supported for read access only.
*--------------------------------------------------------------------*/
class TABSeamless: public IMapInfoFile
{
private:
char *m_pszFname;
char *m_pszPath;
TABAccess m_eAccessMode;
OGRFeatureDefn *m_poFeatureDefnRef;
TABFile *m_poIndexTable;
int m_nTableNameField;
int m_nCurBaseTableId;
TABFile *m_poCurBaseTable;
GBool m_bEOF;
///////////////
// Private Read access specific stuff
//
int OpenForRead(const char *pszFname,
GBool bTestOpenNoError = FALSE );
int OpenBaseTable(TABFeature *poIndexFeature,
GBool bTestOpenNoError = FALSE);
int OpenBaseTable(int nTableId, GBool bTestOpenNoError = FALSE);
int OpenNextBaseTable(GBool bTestOpenNoError =FALSE);
int EncodeFeatureId(int nTableId, int nBaseFeatureId);
int ExtractBaseTableId(int nEncodedFeatureId);
int ExtractBaseFeatureId(int nEncodedFeatureId);
public:
TABSeamless();
virtual ~TABSeamless();
virtual TABFileClass GetFileClass() {return TABFC_TABSeamless;}
virtual int Open(const char *pszFname, const char *pszAccess,
GBool bTestOpenNoError = FALSE );
virtual int Close();
virtual const char *GetTableName()
{return m_poFeatureDefnRef?m_poFeatureDefnRef->GetName():"";};
virtual void SetSpatialFilter( OGRGeometry * );
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
//
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);
///////////////
// Write access specific stuff
//
virtual int SetBounds(double dXMin, double dYMin,
double dXMax, double dYMax) {return -1;}
virtual int SetFeatureDefn(OGRFeatureDefn *poFeatureDefn,
TABFieldType *paeMapInfoNativeFieldTypes=NULL)
{return -1;}
virtual int AddFieldNative(const char *pszName,
TABFieldType eMapInfoType,
int nWidth=0, int nPrecision=0,
GBool bIndexed=FALSE,
GBool bUnique=FALSE) {return -1;}
virtual int SetSpatialRef(OGRSpatialReference *poSpatialRef) {return -1;}
virtual int SetFeature(TABFeature *poFeature,
int nFeatureId = -1) {return -1;}
virtual int SetFieldIndexed(int nFieldId) {return -1;}
///////////////
// semi-private.
virtual int GetProjInfo(TABProjInfo *poPI)
{ return m_poIndexTable?m_poIndexTable->GetProjInfo(poPI):-1; }
virtual int SetProjInfo(TABProjInfo *poPI) { return -1; }
virtual int SetMIFCoordSys(const char * /*pszMIFCoordSys*/) {return -1;};
#ifdef DEBUG
virtual void Dump(FILE *fpOut = NULL);
#endif
};
/*---------------------------------------------------------------------
* class MIFFile
*
* The main class for (MID/MIF) datasets. External programs should use this
* class to open a (MID/MIF) dataset and read/write features from/to it.
*
*--------------------------------------------------------------------*/
class MIFFile: public IMapInfoFile
{
private:
char *m_pszFname;
TABAccess m_eAccessMode;
int m_nVersion; /* Dataset version: 300, 450, 600, 900, etc. */
char *m_pszDelimiter;
char *m_pszUnique;
char *m_pszIndex;
char *m_pszCoordSys;
TABFieldType *m_paeFieldType;
GBool *m_pabFieldIndexed;
GBool *m_pabFieldUnique;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -