📄 mitab.h
字号:
int AddFields(const char *pszLine); int GotoFeature(int nFeatureId); int NextFeature(); /////////////// // Private Write access specific stuff // GBool m_bPreParsed; GBool m_bHeaderWrote; int WriteMIFHeader(); void UpdateExtents(double dfX,double dfY); public: MIFFile(); virtual ~MIFFile(); virtual TABFileClass GetFileClass() {return TABFC_MIFFile;} 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 int TestCapability( const char * pszCap ) ; virtual int GetFeatureCount (int bForce); virtual void ResetReading(); 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); /* TODO */ 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 -1;} /* { return m_poMAPFile->GetHeaderBlock()->GetProjInfo( poPI ); }*/ virtual int SetProjInfo(TABProjInfo * /*poPI*/){return -1;} /* { return m_poMAPFile->GetHeaderBlock()->SetProjInfo( poPI ); }*/ virtual int SetMIFCoordSys(const char * pszMIFCoordSys);#ifdef DEBUG virtual void Dump(FILE * /*fpOut*/ = NULL) {};#endif};/*--------------------------------------------------------------------- * Define some error codes specific to this lib. *--------------------------------------------------------------------*/#define TAB_WarningFeatureTypeNotSupported 501#define TAB_WarningInvalidFieldName 502#define TAB_WarningBoundsOverflow 503/*--------------------------------------------------------------------- * Codes for the known MapInfo Geometry types *--------------------------------------------------------------------*/#define TAB_GEOM_NONE 0#define TAB_GEOM_SYMBOL_C 0x01#define TAB_GEOM_SYMBOL 0x02#define TAB_GEOM_LINE_C 0x04#define TAB_GEOM_LINE 0x05#define TAB_GEOM_PLINE_C 0x07#define TAB_GEOM_PLINE 0x08#define TAB_GEOM_ARC_C 0x0a#define TAB_GEOM_ARC 0x0b#define TAB_GEOM_REGION_C 0x0d#define TAB_GEOM_REGION 0x0e#define TAB_GEOM_TEXT_C 0x10#define TAB_GEOM_TEXT 0x11#define TAB_GEOM_RECT_C 0x13#define TAB_GEOM_RECT 0x14#define TAB_GEOM_ROUNDRECT_C 0x16#define TAB_GEOM_ROUNDRECT 0x17#define TAB_GEOM_ELLIPSE_C 0x19#define TAB_GEOM_ELLIPSE 0x1a#define TAB_GEOM_MULTIPLINE_C 0x25#define TAB_GEOM_MULTIPLINE 0x26#define TAB_GEOM_FONTSYMBOL_C 0x28 #define TAB_GEOM_FONTSYMBOL 0x29#define TAB_GEOM_CUSTOMSYMBOL_C 0x2b#define TAB_GEOM_CUSTOMSYMBOL 0x2c/* Version 450 object types: */#define TAB_GEOM_V450_REGION_C 0x2e#define TAB_GEOM_V450_REGION 0x2f#define TAB_GEOM_V450_MULTIPLINE_C 0x31#define TAB_GEOM_V450_MULTIPLINE 0x32/* Version 650 object types: */#define TAB_GEOM_MULTIPOINT_C 0x34#define TAB_GEOM_MULTIPOINT 0x35#define TAB_GEOM_COLLECTION_C 0x37#define TAB_GEOM_COLLECTION 0x38/*--------------------------------------------------------------------- * Codes for the feature classes *--------------------------------------------------------------------*/typedef enum{ TABFCNoGeomFeature = 0, TABFCPoint = 1, TABFCFontPoint = 2, TABFCCustomPoint = 3, TABFCText = 4, TABFCPolyline = 5, TABFCArc = 6, TABFCRegion = 7, TABFCRectangle = 8, TABFCEllipse = 9, TABFCMultiPoint = 10, TABFCCollection = 11, TABFCDebugFeature} TABFeatureClass;/*--------------------------------------------------------------------- * Definitions for text attributes *--------------------------------------------------------------------*/typedef enum TABTextJust_t{ TABTJLeft = 0, // Default: Left Justification TABTJCenter, TABTJRight} TABTextJust;typedef enum TABTextSpacing_t{ TABTSSingle = 0, // Default: Single spacing TABTS1_5, // 1.5 TABTSDouble} TABTextSpacing;typedef enum TABTextLineType_t{ TABTLNoLine = 0, // Default: No line TABTLSimple, TABTLArrow} TABTextLineType;typedef enum TABFontStyle_t // Can be OR'ed{ // except box and halo are mutually exclusive TABFSNone = 0, TABFSBold = 0x0001, TABFSItalic = 0x0002, TABFSUnderline = 0x0004, TABFSStrikeout = 0x0008, TABFSOutline = 0x0010, TABFSShadow = 0x0020, TABFSInverse = 0x0040, TABFSBlink = 0x0080, TABFSBox = 0x0100, // See note about box vs halo below. TABFSHalo = 0x0200, // MIF uses 256, see MIF docs, App.A TABFSAllCaps = 0x0400, // MIF uses 512 TABFSExpanded = 0x0800 // MIF uses 1024} TABFontStyle;/* TABFontStyle enum notes: * * The enumeration values above correspond to the values found in a .MAP * file. However, they differ a little from what is found in a MIF file: * Values 0x01 to 0x80 are the same in .MIF and .MAP files. * Values 0x200 to 0x800 in .MAP are 0x100 to 0x400 in .MIF * * What about TABFSBox (0x100) ? * TABFSBox is stored just like the other styles in .MAP files but it is not * explicitly stored in a MIF file. * If a .MIF FONT() clause contains the optional BG color, then this implies * that either Halo or Box was set. Thus if TABFSHalo (value 256 in MIF) * is not set in the style, then this implies that TABFSBox should be set. */typedef enum TABCustSymbStyle_t // Can be OR'ed{ TABCSNone = 0, // Transparent BG, use default colors TABCSBGOpaque = 0x01, // White pixels are opaque TABCSApplyColor = 0x02 // non-white pixels drawn using symbol color} TABCustSymbStyle;/*===================================================================== Base classes to be used to add supported drawing tools to each feature type =====================================================================*/class ITABFeaturePen{ protected: int m_nPenDefIndex; TABPenDef m_sPenDef; public: ITABFeaturePen(); ~ITABFeaturePen() {}; int GetPenDefIndex() {return m_nPenDefIndex;}; TABPenDef *GetPenDefRef() {return &m_sPenDef;}; GByte GetPenWidthPixel(); double GetPenWidthPoint(); int GetPenWidthMIF(); GByte GetPenPattern() {return m_sPenDef.nLinePattern;}; GInt32 GetPenColor() {return m_sPenDef.rgbColor;}; void SetPenWidthPixel(GByte val); void SetPenWidthPoint(double val); void SetPenWidthMIF(int val); void SetPenPattern(GByte val) {m_sPenDef.nLinePattern=val;}; void SetPenColor(GInt32 clr) {m_sPenDef.rgbColor = clr;}; const char *GetPenStyleString(); void DumpPenDef(FILE *fpOut = NULL);};class ITABFeatureBrush{ protected: int m_nBrushDefIndex; TABBrushDef m_sBrushDef; public: ITABFeatureBrush(); ~ITABFeatureBrush() {}; int GetBrushDefIndex() {return m_nBrushDefIndex;}; TABBrushDef *GetBrushDefRef() {return &m_sBrushDef;}; GInt32 GetBrushFGColor() {return m_sBrushDef.rgbFGColor;}; GInt32 GetBrushBGColor() {return m_sBrushDef.rgbBGColor;}; GByte GetBrushPattern() {return m_sBrushDef.nFillPattern;}; GByte GetBrushTransparent() {return m_sBrushDef.bTransparentFill;}; void SetBrushFGColor(GInt32 clr) { m_sBrushDef.rgbFGColor = clr;}; void SetBrushBGColor(GInt32 clr) { m_sBrushDef.rgbBGColor = clr;}; void SetBrushPattern(GByte val) { m_sBrushDef.nFillPattern=val;}; void SetBrushTransparent(GByte val) {m_sBrushDef.bTransparentFill=val;}; const char *GetBrushStyleString(); void DumpBrushDef(FILE *fpOut = NULL);};class ITABFeatureFont{ protected: int m_nFontDefIndex; TABFontDef m_sFontDef; public: ITABFeatureFont(); ~ITABFeatureFont() {}; int GetFontDefIndex() {return m_nFontDefIndex;}; TABFontDef *GetFontDefRef() {return &m_sFontDef;}; const char *GetFontNameRef() {return m_sFontDef.szFontName;}; void SetFontName(const char *pszName) { strncpy( m_sFontDef.szFontName, pszName, 32); m_sFontDef.szFontName[32] = '\0'; }; void DumpFontDef(FILE *fpOut = NULL);};class ITABFeatureSymbol{ protected: int m_nSymbolDefIndex; TABSymbolDef m_sSymbolDef; public: ITABFeatureSymbol(); ~ITABFeatureSymbol() {}; int GetSymbolDefIndex() {return m_nSymbolDefIndex;}; TABSymbolDef *GetSymbolDefRef() {return &m_sSymbolDef;}; GInt16 GetSymbolNo() {return m_sSymbolDef.nSymbolNo;}; GInt16 GetSymbolSize() {return m_sSymbolDef.nPointSize;}; GInt32 GetSymbolColor() {return m_sSymbolDef.rgbColor;}; void SetSymbolNo(GInt16 val) { m_sSymbolDef.nSymbolNo = val;}; void SetSymbolSize(GInt16 val) { m_sSymbolDef.nPointSize = val;}; void SetSymbolColor(GInt32 clr) { m_sSymbolDef.rgbColor = clr;}; const char *GetSymbolStyleString(double dfAngle = 0.0); void DumpSymbolDef(FILE *fpOut = NULL);};/*===================================================================== Feature Classes =====================================================================*//*--------------------------------------------------------------------- * class TABFeature * * Extend the OGRFeature to support MapInfo specific extensions related * to geometry types, representation strings, etc. * * TABFeature will be used as a base class for all the feature classes. * * This class will also be used to instanciate objects with no Geometry * (i.e. type TAB_GEOM_NONE) which is a valid case in MapInfo. * * The logic to read/write the object from/to the .DAT and .MAP files is also * implemented as part of this class and derived classes. *--------------------------------------------------------------------*/class TABFeature: public OGRFeature{ protected: int m_nMapInfoType; double m_dXMin; double m_dYMin; double m_dXMax; double m_dYMax; GBool m_bDeletedFlag; void CopyTABFeatureBase(TABFeature *poDestFeature); // Compr. Origin is set for TAB files by ValidateCoordType() GInt32 m_nXMin; GInt32 m_nYMin; GInt32 m_nXMax; GInt32 m_nYMax; GInt32 m_nComprOrgX;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -