?? mitab_priv.h
字號:
GInt32 m_nMaxY; TABMAPObjHdr() {}; virtual ~TABMAPObjHdr() {}; static TABMAPObjHdr *NewObj(GByte nNewObjType, GInt32 nId=0); static TABMAPObjHdr *ReadNextObj(TABMAPObjectBlock *poObjBlock, TABMAPHeaderBlock *poHeader); GBool IsCompressedType(); int WriteObjTypeAndId(TABMAPObjectBlock *); void SetMBR(GInt32 nMinX, GInt32 nMinY, GInt32 nMaxX, GInt32 mMaxY); virtual int WriteObj(TABMAPObjectBlock *) {return -1;};// protected: virtual int ReadObj(TABMAPObjectBlock *) {return -1;};};class TABMAPObjHdrWithCoord: public TABMAPObjHdr{ public: GInt32 m_nCoordBlockPtr; GInt32 m_nCoordDataSize; /* Eventually this class may have methods to help maintaining refs to * coord. blocks when splitting object blocks. */};class TABMAPObjNone: public TABMAPObjHdr{ public: TABMAPObjNone() {}; virtual ~TABMAPObjNone() {}; virtual int WriteObj(TABMAPObjectBlock *) {return 0;};// protected: virtual int ReadObj(TABMAPObjectBlock *) {return 0;};};class TABMAPObjPoint: public TABMAPObjHdr{ public: GInt32 m_nX; GInt32 m_nY; GByte m_nSymbolId; TABMAPObjPoint() {}; virtual ~TABMAPObjPoint() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjFontPoint: public TABMAPObjPoint{ public: GByte m_nPointSize; GInt16 m_nFontStyle; GByte m_nR; GByte m_nG; GByte m_nB; GInt16 m_nAngle; /* In tenths of degree */ GByte m_nFontId; TABMAPObjFontPoint() {}; virtual ~TABMAPObjFontPoint() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjCustomPoint: public TABMAPObjPoint{ public: GByte m_nUnknown_; GByte m_nCustomStyle; GByte m_nFontId; TABMAPObjCustomPoint() {}; virtual ~TABMAPObjCustomPoint() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjLine: public TABMAPObjHdr{ public: GInt32 m_nX1; GInt32 m_nY1; GInt32 m_nX2; GInt32 m_nY2; GByte m_nPenId; TABMAPObjLine() {}; virtual ~TABMAPObjLine() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjPLine: public TABMAPObjHdrWithCoord{ public: GInt16 m_numLineSections; /* MULTIPLINE/REGION only. Not in PLINE */ GInt32 m_nLabelX; /* Centroid/label location */ GInt32 m_nLabelY; GInt32 m_nComprOrgX; /* Present only in compressed coord. case */ GInt32 m_nComprOrgY; GByte m_nPenId; GByte m_nBrushId; GBool m_bSmooth; /* TRUE if (m_nCoordDataSize & 0x80000000) */ TABMAPObjPLine() {}; virtual ~TABMAPObjPLine() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjRectEllipse: public TABMAPObjHdr{ public: GInt32 m_nCornerWidth; /* For rounded rect only */ GInt32 m_nCornerHeight; GByte m_nPenId; GByte m_nBrushId; TABMAPObjRectEllipse() {}; virtual ~TABMAPObjRectEllipse() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjArc: public TABMAPObjHdr{ public: GInt32 m_nStartAngle; GInt32 m_nEndAngle; GInt32 m_nArcEllipseMinX; /* MBR of the arc defining ellipse */ GInt32 m_nArcEllipseMinY; /* Only present in arcs */ GInt32 m_nArcEllipseMaxX; GInt32 m_nArcEllipseMaxY; GByte m_nPenId; TABMAPObjArc() {}; virtual ~TABMAPObjArc() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjText: public TABMAPObjHdrWithCoord{ public: /* String and its len stored in the nCoordPtr and nCoordSize */ GInt16 m_nTextAlignment; GInt32 m_nAngle; GInt16 m_nFontStyle; GByte m_nFGColorR; GByte m_nFGColorG; GByte m_nFGColorB; GByte m_nBGColorR; GByte m_nBGColorG; GByte m_nBGColorB; GInt32 m_nLineEndX; GInt32 m_nLineEndY; GInt32 m_nHeight; GByte m_nFontId; GByte m_nPenId; TABMAPObjText() {}; virtual ~TABMAPObjText() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjMultiPoint: public TABMAPObjHdrWithCoord{ public: GInt32 m_nNumPoints; GInt32 m_nComprOrgX; /* Present only in compressed coord. case */ GInt32 m_nComprOrgY; GByte m_nSymbolId; GInt32 m_nLabelX; /* Not sure if it's a label point, but */ GInt32 m_nLabelY; /* it's similar to what we find in PLINE */ TABMAPObjMultiPoint() {}; virtual ~TABMAPObjMultiPoint() {}; virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *);};class TABMAPObjCollection: public TABMAPObjHdrWithCoord{ public: GInt32 m_nRegionDataSize; GInt32 m_nPolylineDataSize; GInt32 m_nMPointDataSize; GInt32 m_nComprOrgX; /* Present only in compressed coord. case */ GInt32 m_nComprOrgY; GInt32 m_nNumMultiPoints; GInt16 m_nNumRegSections; GInt16 m_nNumPLineSections; GInt32 m_nTotalRegDataSize; GInt32 m_nTotalPolyDataSize; GByte m_nMultiPointSymbolId; GByte m_nRegionPenId; GByte m_nRegionBrushId; GByte m_nPolylinePenId; TABMAPObjCollection() {}; virtual ~TABMAPObjCollection() {} virtual int WriteObj(TABMAPObjectBlock *);// protected: virtual int ReadObj(TABMAPObjectBlock *); private: // private copy ctor and assignment operator to prevent shallow copying TABMAPObjCollection& operator=(const TABMAPObjCollection& rhs); TABMAPObjCollection(const TABMAPObjCollection& rhs);};/*===================================================================== Classes to handle .MAP files low-level blocks =====================================================================*//*--------------------------------------------------------------------- * class TABBinBlockManager * * This class is used to keep track of allocated blocks and is used * by various classes that need to allocate a new block in a .MAP file. *--------------------------------------------------------------------*/class TABBinBlockManager{ protected: int m_nBlockSize; GInt32 m_nLastAllocatedBlock; public: TABBinBlockManager(int nBlockSize=512) {m_nBlockSize=nBlockSize; m_nLastAllocatedBlock = -1; }; ~TABBinBlockManager() {}; GInt32 AllocNewBlock() {if (m_nLastAllocatedBlock==-1) m_nLastAllocatedBlock = 0; else m_nLastAllocatedBlock+=m_nBlockSize; return m_nLastAllocatedBlock; }; void Reset() {m_nLastAllocatedBlock=-1; }; void SetLastPtr(int nBlockPtr) {m_nLastAllocatedBlock=nBlockPtr; };};/*--------------------------------------------------------------------- * class TABRawBinBlock * * This is the base class used for all other data block types... it * contains all the base functions to handle binary data. *--------------------------------------------------------------------*/class TABRawBinBlock{ protected: FILE *m_fp; /* Associated file handle */ TABAccess m_eAccess; /* Read/Write access mode */ int m_nBlockType; GByte *m_pabyBuf; /* Buffer to contain the block's data */ int m_nBlockSize; /* Size of current block (and buffer) */ int m_nSizeUsed; /* Number of bytes used in buffer */ GBool m_bHardBlockSize;/* TRUE=Blocks MUST always be nSize bytes */ /* FALSE=last block may be less than nSize */ int m_nFileOffset; /* Location of current block in the file */ int m_nCurPos; /* Next byte to read from m_pabyBuf[] */ int m_nFirstBlockPtr;/* Size of file header when different from */ /* block size (used by GotoByteInFile()) */ int m_bModified; /* Used only to detect changes */ public: GBool bHardBlockSize = TRUE); virtual ~TABRawBinBlock(); virtual int ReadFromFile(FILE *fpSrc, int nOffset, int nSize = 512); virtual int CommitToFile(); virtual int InitBlockFromData(GByte *pabyBuf, int nSize, GBool bMakeCopy = TRUE, FILE *fpSrc = NULL, int nOffset = 0); virtual int InitNewBlock(FILE *fpSrc, int nBlockSize, int nFileOffset=0); int GetBlockType(); virtual int GetBlockClass() { return TAB_RAWBIN_BLOCK; }; GInt32 GetStartAddress() {return m_nFileOffset;};#ifdef DEBUG virtual void Dump(FILE *fpOut = NULL);#endif void DumpBytes(GInt32 nValue, int nOffset=0, FILE *fpOut=NULL); int GotoByteRel(int nOffset); int GotoByteInBlock(int nOffset); int GotoByteInFile(int nOffset, GBool bForceReadFromFile = FALSE, GBool bOffsetIsEndOfData = FALSE); void SetFirstBlockPtr(int nOffset); int GetNumUnusedBytes(); int GetFirstUnusedByteOffset(); int GetCurAddress(); virtual int ReadBytes(int numBytes, GByte *pabyDstBuf); GByte ReadByte(); GInt16 ReadInt16(); GInt32 ReadInt32(); float ReadFloat(); double ReadDouble(); virtual int WriteBytes(int nBytesToWrite, GByte *pBuf); int WriteByte(GByte byValue); int WriteInt16(GInt16 n16Value); int WriteInt32(GInt32 n32Value); int WriteFloat(float fValue); int WriteDouble(double dValue); int WriteZeros(int nBytesToWrite); int WritePaddedString(int nFieldSize, const char *pszString); void SetModifiedFlag(GBool bModified) {m_bModified=bModified;}; // This semi-private method gives a direct access to the internal // buffer... to be used with extreme care!!!!!!!!! GByte * GetCurDataPtr() { return (m_pabyBuf + m_nCurPos); } ;};/*--------------------------------------------------------------------- * class TABMAPHeaderBlock * * Class to handle Read/Write operation on .MAP Header Blocks *--------------------------------------------------------------------*/class TABMAPHeaderBlock: public TABRawBinBlock{ protected: TABProjInfo m_sProj; public: TABMAPHeaderBlock(TABAccess eAccessMode = TABRead); ~TABMAPHeaderBlock(); virtual int CommitToFile(); virtual int InitBlockFromData(GByte *pabyBuf, int nSize, GBool bMakeCopy = TRUE, FILE *fpSrc = NULL, int nOffset = 0); virtual int InitNewBlock(FILE *fpSrc, int nBlockSize, int nFileOffset=0); virtual int GetBlockClass() { return TABMAP_HEADER_BLOCK; }; int Int2Coordsys(GInt32 nX, GInt32 nY, double &dX, double &dY); int Coordsys2Int(double dX, double dY, GInt32 &nX, GInt32 &nY, GBool bIgnoreOverflow=FALSE); int ComprInt2Coordsys(GInt32 nCenterX, GInt32 nCenterY, int nDeltaX, int nDeltaY, double &dX, double &dY); int Int2CoordsysDist(GInt32 nX, GInt32 nY, double &dX, double &dY); int Coordsys2IntDist(double dX, double dY, GInt32 &nX, GInt32 &nY); int SetCoordsysBounds(double dXMin, double dYMin, double dXMax, double dYMax); int GetMapObjectSize(int nObjType); GBool MapObjectUsesCoordBlock(int nObjType); int GetProjInfo(TABProjInfo *psProjInfo); int SetProjInfo(TABProjInfo *psProjInfo);#ifdef DEBUG virtual void Dump(FILE *fpOut = NULL);#endif // Instead of having over 30 get/set methods, we'll make all data
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -