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

📄 tabmapobjhdr.cpp

📁 linux下一款GIS程序源码
💻 CPP
字号:
// tabmapobjhdr.cpp: implementation of the TABMAPObjHdr class.////////////////////////////////////////////////////////////////////////#include "tabmapobjhdr.h"#include "ugk_errhandle.h"#include "tabmapobjnone.h"#include "tabmapobjpoint.h"#include "tabmapobjfontpoint.h"#include "tabmapobjcustompoint.h"#include "tabmapobjline.h"#include "tabmapobjpline.h"#include "tabmapobjarc.h"#include "tabmapobjrectellipse.h"#include "tabmapobjtext.h"#include "tabmapobjmultipoint.h"/********************************************************************** *                    TABMAPObjHdr::NewObj() * * Alloc a new object of specified type or NULL for NONE types or if type  * is not supported. **********************************************************************/TABMAPObjHdr *TABMAPObjHdr::NewObj(UGKByte nNewObjType, UGKInt32 nId /*=0*/){    TABMAPObjHdr *poObj = NULL;    switch(nNewObjType)    {      case TAB_GEOM_NONE:        poObj = new TABMAPObjNone;        break;      case TAB_GEOM_SYMBOL_C:      case TAB_GEOM_SYMBOL:        poObj = new TABMAPObjPoint;        break;      case TAB_GEOM_FONTSYMBOL_C:      case TAB_GEOM_FONTSYMBOL:        poObj = new TABMAPObjFontPoint;        break;      case TAB_GEOM_CUSTOMSYMBOL_C:      case TAB_GEOM_CUSTOMSYMBOL:        poObj = new TABMAPObjCustomPoint;        break;      case TAB_GEOM_LINE_C:      case TAB_GEOM_LINE:        poObj = new TABMAPObjLine;        break;      case TAB_GEOM_PLINE_C:      case TAB_GEOM_PLINE:      case TAB_GEOM_REGION_C:      case TAB_GEOM_REGION:      case TAB_GEOM_MULTIPLINE_C:      case TAB_GEOM_MULTIPLINE:      case TAB_GEOM_V450_REGION_C:      case TAB_GEOM_V450_REGION:      case TAB_GEOM_V450_MULTIPLINE_C:      case TAB_GEOM_V450_MULTIPLINE:        poObj = new TABMAPObjPLine;        break;      case TAB_GEOM_ARC_C:      case TAB_GEOM_ARC:        poObj = new TABMAPObjArc;        break;      case TAB_GEOM_RECT_C:      case TAB_GEOM_RECT:      case TAB_GEOM_ROUNDRECT_C:      case TAB_GEOM_ROUNDRECT:      case TAB_GEOM_ELLIPSE_C:      case TAB_GEOM_ELLIPSE:        poObj = new TABMAPObjRectEllipse;        break;      case TAB_GEOM_TEXT_C:      case TAB_GEOM_TEXT:        poObj = new TABMAPObjText;        break;      case TAB_GEOM_MULTIPOINT_C:      case TAB_GEOM_MULTIPOINT:        poObj = new TABMAPObjMultiPoint;        break;      default:        UGKError(ET_Failure, UGKErr_AssertionFailed,                   "TABMAPObjHdr::NewObj(): Unsupported object type %d",                  nNewObjType);		      }    if (poObj)    {        poObj->m_nType = nNewObjType;        poObj->m_nId = nId;        poObj->m_nMinX = poObj->m_nMinY = poObj->m_nMaxX = poObj->m_nMaxY = 0;    }    return poObj;}/********************************************************************** *                    TABMAPObjHdr::ReadNextObj() * * Read next object in this block and allocate/init a new object for it * if succesful.   * Returns NULL in case of error or if we reached end of block. **********************************************************************/TABMAPObjHdr *TABMAPObjHdr::ReadNextObj(TABMAPObjectBlock *poObjBlock,                                        TABMAPHeaderBlock *poHeader){    TABMAPObjHdr *poObjHdr = NULL;    if (poObjBlock->AdvanceToNextObject(poHeader) != -1)    {        poObjHdr=TABMAPObjHdr::NewObj(poObjBlock->GetCurObjectType());        if (poObjHdr &&            ((poObjHdr->m_nId = poObjBlock->GetCurObjectId()) == -1 ||             poObjHdr->ReadObj(poObjBlock) != 0 ) )        {            // Failed reading object in block... an error was already produced            delete poObjHdr;            return NULL;        }    }    return poObjHdr;}/********************************************************************** *                    TABMAPObjHdr::IsCompressedType() * * Returns TRUE if the current object type uses compressed coordinates * or FALSE otherwise. **********************************************************************/UGKBool TABMAPObjHdr::IsCompressedType(){    // Compressed types are 1, 4, 7, etc.    return ((m_nType % 3) == 1 ? TRUE : FALSE);}/********************************************************************** *                   TABMAPObjHdr::WriteObjTypeAndId() * * Writetype+object id information... should be called only by the derived * classes' WriteObj() methods. * * Returns 0 on success, -1 on error. **********************************************************************/int TABMAPObjHdr::WriteObjTypeAndId(TABMAPObjectBlock *poObjBlock){    poObjBlock->WriteByte(m_nType);    return poObjBlock->WriteInt32(m_nId);}/********************************************************************** *                   TABMAPObjHdr::SetMBR() * **********************************************************************/void TABMAPObjHdr::SetMBR(UGKInt32 nMinX, UGKInt32 nMinY,                           UGKInt32 nMaxX, UGKInt32 nMaxY){    m_nMinX = MIN(nMinX, nMaxX);    m_nMinY = MIN(nMinY, nMaxY);    m_nMaxX = MAX(nMinX, nMaxX);    m_nMaxY = MAX(nMinY, nMaxY);}

⌨️ 快捷键说明

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