⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mitab_mapobjectblock.cpp

📁 GIS系统支持库Geospatial Data Abstraction Library代码.GDAL is a translator library for raster geospatial dat
💻 CPP
📖 第 1 页 / 共 4 页
字号:
 * **********************************************************************//********************************************************************** *                   TABMAPObjCustomPoint::ReadObj() * * Read Object information starting after the object id **********************************************************************/int TABMAPObjCustomPoint::ReadObj(TABMAPObjectBlock *poObjBlock){//__TODO__  For now this is read directly in ReadGeometryFromMAPFile()//          This will be implemented the day we support random update.    return 0;}/********************************************************************** *                   TABMAPObjCustomPoint::WriteObj() * * Write Object information with the type+object id * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjCustomPoint::WriteObj(TABMAPObjectBlock *poObjBlock){    // Write object type and id    TABMAPObjHdr::WriteObjTypeAndId(poObjBlock);    poObjBlock->WriteByte(m_nUnknown_);  // ???     poObjBlock->WriteByte(m_nCustomStyle); // 0x01=Show BG, 0x02=Apply Color    poObjBlock->WriteIntCoord(m_nX, m_nY, IsCompressedType());    poObjBlock->WriteByte(m_nSymbolId);      // Symbol index    poObjBlock->WriteByte(m_nFontId);      // Font index  if (CPLGetLastErrorNo() != 0)        return -1;    return 0;}/********************************************************************** *                   class TABMAPObjRectEllipse * **********************************************************************//********************************************************************** *                   TABMAPObjRectEllipse::ReadObj() * * Read Object information starting after the object id **********************************************************************/int TABMAPObjRectEllipse::ReadObj(TABMAPObjectBlock *poObjBlock){//__TODO__  For now this is read directly in ReadGeometryFromMAPFile()//          This will be implemented the day we support random update.    return 0;}/********************************************************************** *                   TABMAPObjRectEllipse::WriteObj() * * Write Object information with the type+object id * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjRectEllipse::WriteObj(TABMAPObjectBlock *poObjBlock){    // Write object type and id    TABMAPObjHdr::WriteObjTypeAndId(poObjBlock);    if (m_nType == TAB_GEOM_ROUNDRECT ||         m_nType == TAB_GEOM_ROUNDRECT_C)    {        if (IsCompressedType())        {            poObjBlock->WriteInt16(m_nCornerWidth);            poObjBlock->WriteInt16(m_nCornerHeight);        }        else        {            poObjBlock->WriteInt32(m_nCornerWidth);            poObjBlock->WriteInt32(m_nCornerHeight);        }    }    poObjBlock->WriteIntMBRCoord(m_nMinX, m_nMinY, m_nMaxX, m_nMaxY,                                  IsCompressedType());    poObjBlock->WriteByte(m_nPenId);      // Pen index    poObjBlock->WriteByte(m_nBrushId);      // Brush index    if (CPLGetLastErrorNo() != 0)        return -1;    return 0;}/********************************************************************** *                   class TABMAPObjArc * **********************************************************************//********************************************************************** *                   TABMAPObjArc::ReadObj() * * Read Object information starting after the object id **********************************************************************/int TABMAPObjArc::ReadObj(TABMAPObjectBlock *poObjBlock){//__TODO__  For now this is read directly in ReadGeometryFromMAPFile()//          This will be implemented the day we support random update.    return 0;}/********************************************************************** *                   TABMAPObjArc::WriteObj() * * Write Object information with the type+object id * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjArc::WriteObj(TABMAPObjectBlock *poObjBlock){    // Write object type and id    TABMAPObjHdr::WriteObjTypeAndId(poObjBlock);    poObjBlock->WriteInt16(m_nStartAngle);    poObjBlock->WriteInt16(m_nEndAngle);        // An arc is defined by its defining ellipse's MBR:    poObjBlock->WriteIntMBRCoord(m_nArcEllipseMinX, m_nArcEllipseMinY,                                  m_nArcEllipseMaxX, m_nArcEllipseMaxY,                                  IsCompressedType());    // Write the Arc's actual MBR    poObjBlock->WriteIntMBRCoord(m_nMinX, m_nMinY, m_nMaxX, m_nMaxY,                                  IsCompressedType());    poObjBlock->WriteByte(m_nPenId);      // Pen index    if (CPLGetLastErrorNo() != 0)        return -1;    return 0;}/********************************************************************** *                   class TABMAPObjText * **********************************************************************//********************************************************************** *                   TABMAPObjText::ReadObj() * * Read Object information starting after the object id **********************************************************************/int TABMAPObjText::ReadObj(TABMAPObjectBlock *poObjBlock){//__TODO__  For now this is read directly in ReadGeometryFromMAPFile()//          This will be implemented the day we support random update.    return 0;}/********************************************************************** *                   TABMAPObjText::WriteObj() * * Write Object information with the type+object id * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjText::WriteObj(TABMAPObjectBlock *poObjBlock){    // Write object type and id    TABMAPObjHdr::WriteObjTypeAndId(poObjBlock);    poObjBlock->WriteInt32(m_nCoordBlockPtr);     // String position    poObjBlock->WriteInt16(m_nCoordDataSize);     // String length    poObjBlock->WriteInt16(m_nTextAlignment);     // just./spacing/arrow    poObjBlock->WriteInt16(m_nAngle);             // Tenths of degree    poObjBlock->WriteInt16(m_nFontStyle);         // Font style/effect    poObjBlock->WriteByte(m_nFGColorR );    poObjBlock->WriteByte(m_nFGColorG );    poObjBlock->WriteByte(m_nFGColorB );    poObjBlock->WriteByte(m_nBGColorR );    poObjBlock->WriteByte(m_nBGColorG );    poObjBlock->WriteByte(m_nBGColorB );    // Label line end point    poObjBlock->WriteIntCoord(m_nLineEndX, m_nLineEndY, IsCompressedType());    // Text Height    poObjBlock->WriteInt32(m_nHeight);    // Font name    poObjBlock->WriteByte(m_nFontId);      // Font name index    // MBR after rotation    poObjBlock->WriteIntMBRCoord(m_nMinX, m_nMinY, m_nMaxX, m_nMaxY,                                  IsCompressedType());    poObjBlock->WriteByte(m_nPenId);      // Pen index    if (CPLGetLastErrorNo() != 0)        return -1;    return 0;}/********************************************************************** *                   class TABMAPObjMultiPoint * * Applies to PLINE, MULTIPLINE and REGION object types **********************************************************************//********************************************************************** *                   TABMAPObjMultiPoint::ReadObj() * * Read Object information starting after the object id which should  * have been read by TABMAPObjHdr::ReadNextObj() already. * This function should be called only by TABMAPObjHdr::ReadNextObj(). * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjMultiPoint::ReadObj(TABMAPObjectBlock *poObjBlock){    m_nCoordBlockPtr = poObjBlock->ReadInt32();    m_nNumPoints = poObjBlock->ReadInt32();    if (IsCompressedType())    {        m_nCoordDataSize = m_nNumPoints * 2 * 2;    }    else    {        m_nCoordDataSize = m_nNumPoints * 2 * 4;    }#ifdef TABDUMP    printf("MULTIPOINT: id=%d, type=%d, "           "CoordBlockPtr=%d, CoordDataSize=%d, numPoints=%d\n",           m_nId, m_nType, m_nCoordBlockPtr, m_nCoordDataSize, m_nNumPoints);#endif    // ?????    poObjBlock->ReadInt32();    poObjBlock->ReadInt32();    poObjBlock->ReadInt32();    poObjBlock->ReadByte();    poObjBlock->ReadByte();    poObjBlock->ReadByte();    m_nSymbolId = poObjBlock->ReadByte();    // ?????    poObjBlock->ReadByte();    if (IsCompressedType())    {        // Region center/label point, relative to compr. coord. origin        // No it's not relative to the Object block center        m_nLabelX = poObjBlock->ReadInt16();        m_nLabelY = poObjBlock->ReadInt16();        // Compressed coordinate origin        m_nComprOrgX = poObjBlock->ReadInt32();        m_nComprOrgY = poObjBlock->ReadInt32();        m_nLabelX += m_nComprOrgX;        m_nLabelY += m_nComprOrgY;        m_nMinX = m_nComprOrgX + poObjBlock->ReadInt16();  // Read MBR        m_nMinY = m_nComprOrgY + poObjBlock->ReadInt16();        m_nMaxX = m_nComprOrgX + poObjBlock->ReadInt16();        m_nMaxY = m_nComprOrgY + poObjBlock->ReadInt16();    }    else    {        // Region center/label point        m_nLabelX = poObjBlock->ReadInt32();        m_nLabelY = poObjBlock->ReadInt32();        m_nMinX = poObjBlock->ReadInt32();    // Read MBR        m_nMinY = poObjBlock->ReadInt32();        m_nMaxX = poObjBlock->ReadInt32();        m_nMaxY = poObjBlock->ReadInt32();        // Init. Compr. Origin to a default value in case type is ever changed        m_nComprOrgX = (m_nMinX + m_nMaxX) / 2;        m_nComprOrgY = (m_nMinY + m_nMaxY) / 2;    }    if (CPLGetLastErrorNo() != 0)        return -1;    return 0;}/********************************************************************** *                   TABMAPObjMultiPoint::WriteObj() * * Write Object information with the type+object id * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjMultiPoint::WriteObj(TABMAPObjectBlock *poObjBlock){    // Write object type and id    TABMAPObjHdr::WriteObjTypeAndId(poObjBlock);    poObjBlock->WriteInt32(m_nCoordBlockPtr);    // Number of points    poObjBlock->WriteInt32(m_nNumPoints);//  unknown bytes    poObjBlock->WriteInt32(0);    poObjBlock->WriteInt32(0);    poObjBlock->WriteInt32(0);    poObjBlock->WriteByte(0);    poObjBlock->WriteByte(0);    poObjBlock->WriteByte(0);    // Symbol Id    poObjBlock->WriteByte(m_nSymbolId);    // ????    poObjBlock->WriteByte(0);    // MBR    if (IsCompressedType())    {        // Region center/label point, relative to compr. coord. origin        // No it's not relative to the Object block center        poObjBlock->WriteInt16(m_nLabelX - m_nComprOrgX);        poObjBlock->WriteInt16(m_nLabelY - m_nComprOrgY);        poObjBlock->WriteInt32(m_nComprOrgX);        poObjBlock->WriteInt32(m_nComprOrgY);        // MBR relative to object origin (and not object block center)        poObjBlock->WriteInt16(m_nMinX - m_nComprOrgX);        poObjBlock->WriteInt16(m_nMinY - m_nComprOrgY);        poObjBlock->WriteInt16(m_nMaxX - m_nComprOrgX);        poObjBlock->WriteInt16(m_nMaxY - m_nComprOrgY);    }    else    {        // Region center/label point        poObjBlock->WriteInt32(m_nLabelX);        poObjBlock->WriteInt32(m_nLabelY);        poObjBlock->WriteInt32(m_nMinX);        poObjBlock->WriteInt32(m_nMinY);        poObjBlock->WriteInt32(m_nMaxX);        poObjBlock->WriteInt32(m_nMaxY);    }    if (CPLGetLastErrorNo() != 0)        return -1;    return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -