📄 mitab.h
字号:
// for now. GBool m_bRoundCorners; double m_dRoundXRadius; double m_dRoundYRadius;};/*--------------------------------------------------------------------- * class TABEllipse * * Feature class to handle the MapInfo ellipse types: * * TAB_GEOM_ELLIPSE_C 0x19 * TAB_GEOM_ELLIPSE 0x1a * * An ellipse is defined by the coords of its 2 opposite corners (the MBR) * * Feature geometry can be either an OGRPoint defining the center of the * ellipse, or an OGRPolygon defining the ellipse itself. * * When an ellipse is read, the returned geometry is a OGRPolygon representing * the ellipse with 2 degrees line segments. * * In the case of the OGRPoint, then the X/Y Radius MUST be set, but. * However with an OGRPolygon, if the X/Y radius are not set (== 0) then * the MBR of the polygon will be used to define the ellipse parameters * and the center of the MBR is used as the center of the ellipse... * (i.e. the polygon vertices themselves will be ignored). *--------------------------------------------------------------------*/class TABEllipse: public TABFeature, public ITABFeaturePen, public ITABFeatureBrush{ public: TABEllipse(OGRFeatureDefn *poDefnIn); virtual ~TABEllipse(); virtual TABFeatureClass GetFeatureClass() { return TABFCEllipse; }; virtual int ValidateMapInfoType(TABMAPFile *poMapFile = NULL); virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); virtual int WriteGeometryToMIFFile(MIDDATAFile *fp); virtual const char *GetStyleString(); virtual void DumpMIF(FILE *fpOut = NULL); // MapInfo-specific attributes... made available through public vars // for now. double m_dCenterX; double m_dCenterY; double m_dXRadius; double m_dYRadius;};/*--------------------------------------------------------------------- * class TABArc * * Feature class to handle the MapInfo arc types: * * TAB_GEOM_ARC_C 0x0a * TAB_GEOM_ARC 0x0b * * In MapInfo, an arc is defined by the coords of the MBR corners of its * defining ellipse, which in this case is different from the arc's MBR, * and a start and end angle in degrees. * * Feature geometry can be either an OGRLineString or an OGRPoint. * * In any case, X/Y radius X/Y center, and start/end angle (in degrees * counterclockwise) MUST be set. * * When an arc is read, the returned geometry is an OGRLineString * representing the arc with 2 degrees line segments. *--------------------------------------------------------------------*/class TABArc: public TABFeature, public ITABFeaturePen{ private: double m_dStartAngle; // In degrees, counterclockwise, double m_dEndAngle; // starting at 3 o'clock public: TABArc(OGRFeatureDefn *poDefnIn); virtual ~TABArc(); virtual TABFeatureClass GetFeatureClass() { return TABFCArc; }; virtual int ValidateMapInfoType(TABMAPFile *poMapFile = NULL); virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); virtual int WriteGeometryToMIFFile(MIDDATAFile *fp); virtual const char *GetStyleString(); virtual void DumpMIF(FILE *fpOut = NULL); double GetStartAngle() { return m_dStartAngle; }; double GetEndAngle() { return m_dEndAngle; }; void SetStartAngle(double dAngle); void SetEndAngle(double dAngle); // MapInfo-specific attributes... made available through public vars // for now. double m_dCenterX; double m_dCenterY; double m_dXRadius; double m_dYRadius;};/*--------------------------------------------------------------------- * class TABText * * Feature class to handle the MapInfo text types: * * TAB_GEOM_TEXT_C 0x10 * TAB_GEOM_TEXT 0x11 * * Feature geometry is an OGRPoint corresponding to the lower-left * corner of the text MBR BEFORE ROTATION. * * Text string, and box height/width (box before rotation is applied) * are required in a valid text feature and MUST be set. * Text angle and other styles are optional. *--------------------------------------------------------------------*/class TABText: public TABFeature, public ITABFeatureFont, public ITABFeaturePen{ protected: char *m_pszString; double m_dAngle; double m_dHeight; double m_dWidth; double m_dfLineEndX; double m_dfLineEndY; GBool m_bLineEndSet; void UpdateTextMBR(); GInt32 m_rgbForeground; GInt32 m_rgbBackground; GInt16 m_nTextAlignment; // Justification/Vert.Spacing/arrow GInt16 m_nFontStyle; // Bold/italic/underlined/shadow/... const char *GetLabelStyleString(); public: TABText(OGRFeatureDefn *poDefnIn); virtual ~TABText(); virtual TABFeatureClass GetFeatureClass() { return TABFCText; }; virtual int ValidateMapInfoType(TABMAPFile *poMapFile = NULL); virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); virtual int WriteGeometryToMIFFile(MIDDATAFile *fp); virtual const char *GetStyleString(); virtual void DumpMIF(FILE *fpOut = NULL); const char *GetTextString(); double GetTextAngle(); double GetTextBoxHeight(); double GetTextBoxWidth(); GInt32 GetFontFGColor(); GInt32 GetFontBGColor(); void GetTextLineEndPoint(double &dX, double &dY); TABTextJust GetTextJustification(); TABTextSpacing GetTextSpacing(); TABTextLineType GetTextLineType(); GBool QueryFontStyle(TABFontStyle eStyleToQuery); void SetTextString(const char *pszStr); void SetTextAngle(double dAngle); void SetTextBoxHeight(double dHeight); void SetTextBoxWidth(double dWidth); void SetFontFGColor(GInt32 rgbColor); void SetFontBGColor(GInt32 rgbColor); void SetTextLineEndPoint(double dX, double dY); void SetTextJustification(TABTextJust eJust); void SetTextSpacing(TABTextSpacing eSpacing); void SetTextLineType(TABTextLineType eLineType); void ToggleFontStyle(TABFontStyle eStyleToToggle, GBool bStatus); int GetFontStyleMIFValue(); void SetFontStyleMIFValue(int nStyle, GBool bBGColorSet=FALSE); GBool IsFontBGColorUsed(); int GetFontStyleTABValue() {return m_nFontStyle;}; void SetFontStyleTABValue(int nStyle){m_nFontStyle=(GInt16)nStyle;};};/*--------------------------------------------------------------------- * class TABMultiPoint * * Feature class to handle MapInfo Multipoint features: * * TAB_GEOM_MULTIPOINT_C 0x34 * TAB_GEOM_MULTIPOINT 0x35 * * Feature geometry will be a OGRMultiPoint * * The symbol number is in the range [31..67], with 31=None and corresponds * to one of the 35 predefined "Old MapInfo Symbols" *--------------------------------------------------------------------*/class TABMultiPoint: public TABFeature, public ITABFeatureSymbol{ private: // We call it center, but it's more like a label point // Its value default to be the location of the first point GBool m_bCenterIsSet; double m_dCenterX, m_dCenterY; public: TABMultiPoint(OGRFeatureDefn *poDefnIn); virtual ~TABMultiPoint(); virtual TABFeatureClass GetFeatureClass() { return TABFCMultiPoint; }; virtual int ValidateMapInfoType(TABMAPFile *poMapFile = NULL); virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); int GetXY(int i, double &dX, double &dY); int GetNumPoints(); int GetCenter(double &dX, double &dY); void SetCenter(double dX, double dY); virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); virtual int WriteGeometryToMIFFile(MIDDATAFile *fp); virtual const char *GetStyleString(); virtual void DumpMIF(FILE *fpOut = NULL);};/*--------------------------------------------------------------------- * class TABDebugFeature * * Feature class to use for testing purposes... this one does not * correspond to any MapInfo type... it's just used to dump info about * feature types that are not implemented yet. *--------------------------------------------------------------------*/class TABDebugFeature: public TABFeature{ private: GByte m_abyBuf[512]; int m_nSize; int m_nCoordDataPtr; // -1 if none int m_nCoordDataSize; public: TABDebugFeature(OGRFeatureDefn *poDefnIn); virtual ~TABDebugFeature(); virtual TABFeatureClass GetFeatureClass() { return TABFCDebugFeature; }; virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); virtual int WriteGeometryToMIFFile(MIDDATAFile *fp); virtual void DumpMIF(FILE *fpOut = NULL);};/* -------------------------------------------------------------------- *//* Some stuff related to spatial reference system handling. *//* -------------------------------------------------------------------- */char *MITABSpatialRef2CoordSys( OGRSpatialReference * );OGRSpatialReference * MITABCoordSys2SpatialRef( const char * );GBool MITABExtractCoordSysBounds( const char * pszCoordSys, double &dXMin, double &dYMin, double &dXMax, double &dYMax );int MITABCoordSys2TABProjInfo(const char * pszCoordSys, TABProjInfo *psProj);typedef struct { int nMapInfoDatumID; const char *pszOGCDatumName; int nEllipsoid; double dfShiftX; double dfShiftY; double dfShiftZ; double dfDatumParm0; /* RotX */ double dfDatumParm1; /* RotY */ double dfDatumParm2; /* RotZ */ double dfDatumParm3; /* Scale Factor */ double dfDatumParm4; /* Prime Meridian */} MapInfoDatumInfo;typedef struct{ int nMapInfoId; const char *pszMapinfoName; double dfA; /* semi major axis in meters */ double dfInvFlattening; /* Inverse flattening */} MapInfoSpheroidInfo;/*--------------------------------------------------------------------- * The following are used for coordsys bounds lookup *--------------------------------------------------------------------*/typedef struct{ TABProjInfo sProj; /* Projection/datum definition */ double dXMin; /* Default bounds for that coordsys */ double dYMin; double dXMax; double dYMax;} MapInfoBoundsInfo;GBool MITABLookupCoordSysBounds(TABProjInfo *psCS, double &dXMin, double &dYMin, double &dXMax, double &dYMax);int MITABLoadCoordSysTable(const char *pszFname);void MITABFreeCoordSysTable();GBool MITABCoordSysTableLoaded();#endif /* _MITAB_H_INCLUDED_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -