亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mitab_mapindexblock.cpp

?? mitab,讀取MapInfo的地圖文件
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
    m_numEntries = 0;

    // Insert nSeed1 in this node
    InsertEntry(pasSrcEntries[nSeed1].XMin, 
                pasSrcEntries[nSeed1].YMin,
                pasSrcEntries[nSeed1].XMax, 
                pasSrcEntries[nSeed1].YMax,
                pasSrcEntries[nSeed1].nBlockPtr);

    // Move nSeed2 to 2nd node
    poNewNode->InsertEntry(pasSrcEntries[nSeed2].XMin, 
                           pasSrcEntries[nSeed2].YMin,
                           pasSrcEntries[nSeed2].XMax, 
                           pasSrcEntries[nSeed2].YMax,
                           pasSrcEntries[nSeed2].nBlockPtr);

    // Update cur child index if necessary
    if (nSeed1 == nSrcCurChildIndex)
        m_nCurChildIndex = m_numEntries-1;

    /*-----------------------------------------------------------------
     * Go through the rest of the entries and assign them to one 
     * of the 2 nodes.
     *
     * Criteria is minimal area difference.
     * Resolve ties by adding the entry to the node with smaller total
     * area, then to the one with fewer entries, then to either.
     *----------------------------------------------------------------*/
    for(int iEntry=0; iEntry<nSrcEntries; iEntry++)
    {
        if (iEntry == nSeed1 || iEntry == nSeed2)
            continue;

        // If one of the two nodes is almost full then all remaining
        // entries should go to the other node
        // The entry corresponding to the current child also automatically
        // stays in this node.
        if (iEntry == nSrcCurChildIndex)
        {
            InsertEntry(pasSrcEntries[iEntry].XMin, 
                        pasSrcEntries[iEntry].YMin,
                        pasSrcEntries[iEntry].XMax, 
                        pasSrcEntries[iEntry].YMax,
                        pasSrcEntries[iEntry].nBlockPtr);

            // Update current child index
            m_nCurChildIndex = m_numEntries-1;

            continue;

        }
        else if (m_numEntries >= TAB_MAX_ENTRIES_INDEX_BLOCK-1)
        {
            poNewNode->InsertEntry(pasSrcEntries[iEntry].XMin, 
                                   pasSrcEntries[iEntry].YMin,
                                   pasSrcEntries[iEntry].XMax, 
                                   pasSrcEntries[iEntry].YMax,
                                   pasSrcEntries[iEntry].nBlockPtr);
            continue;
        }
        else if (poNewNode->GetNumEntries() >= TAB_MAX_ENTRIES_INDEX_BLOCK-1)
        {
            InsertEntry(pasSrcEntries[iEntry].XMin, 
                        pasSrcEntries[iEntry].YMin,
                        pasSrcEntries[iEntry].XMax, 
                        pasSrcEntries[iEntry].YMax,
                        pasSrcEntries[iEntry].nBlockPtr);
            continue;
        }


        // Decide which of the two nodes to put this entry in
        double dAreaDiff1, dAreaDiff2;
        RecomputeMBR();
        dAreaDiff1 = ComputeAreaDiff(m_nMinX, m_nMinY, m_nMaxX, m_nMaxY,
                                     pasSrcEntries[iEntry].XMin, 
                                     pasSrcEntries[iEntry].YMin,
                                     pasSrcEntries[iEntry].XMax,
                                     pasSrcEntries[iEntry].YMax);

        GInt32 nXMin2, nYMin2, nXMax2, nYMax2;
        poNewNode->RecomputeMBR();
        poNewNode->GetMBR(nXMin2, nYMin2, nXMax2, nYMax2);
        dAreaDiff2 = ComputeAreaDiff(nXMin2, nYMin2, nXMax2, nYMax2,
                                     pasSrcEntries[iEntry].XMin, 
                                     pasSrcEntries[iEntry].YMin,
                                     pasSrcEntries[iEntry].XMax,
                                     pasSrcEntries[iEntry].YMax);
        if (dAreaDiff1 < dAreaDiff2)
        {
            // This entry stays in this node
            InsertEntry(pasSrcEntries[iEntry].XMin, 
                        pasSrcEntries[iEntry].YMin,
                        pasSrcEntries[iEntry].XMax, 
                        pasSrcEntries[iEntry].YMax,
                        pasSrcEntries[iEntry].nBlockPtr);
        }
        else
        {
            // This entry goes to new node
            poNewNode->InsertEntry(pasSrcEntries[iEntry].XMin, 
                                   pasSrcEntries[iEntry].YMin,
                                   pasSrcEntries[iEntry].XMax, 
                                   pasSrcEntries[iEntry].YMax,
                                   pasSrcEntries[iEntry].nBlockPtr);
        }
    }

    /*-----------------------------------------------------------------
     * Recompute MBR and update current node info in parent
     *----------------------------------------------------------------*/
    RecomputeMBR();
    poNewNode->RecomputeMBR();

    /*-----------------------------------------------------------------
     * Add second node info to parent and then flush it to disk.
     * This may trigger splitting of parent
     *----------------------------------------------------------------*/
    CPLAssert(m_poParentRef);
    int nMinX, nMinY, nMaxX, nMaxY;
    poNewNode->GetMBR(nMinX, nMinY, nMaxX, nMaxY);
    m_poParentRef->AddEntry(nMinX, nMinY, nMaxX, nMaxY,
                            poNewNode->GetNodeBlockPtr(), TRUE);
    poNewNode->CommitToFile();
    delete poNewNode;

    CPLFree(pasSrcEntries);

    return 0;
}

/**********************************************************************
 *                   TABMAPIndexBlock::SplitRootNode()
 *
 * (private method)
 *
 * Split a Root Node.
 * First, a level of nodes must be added to the tree, then the contents
 * of what used to be the root node is moved 1 level down and then that
 * node is split like a regular node.
 *
 * Returns 0 on success, -1 on error
 **********************************************************************/
int TABMAPIndexBlock::SplitRootNode(GInt32 nNewEntryXMin, GInt32 nNewEntryYMin,
                                    GInt32 nNewEntryXMax, GInt32 nNewEntryYMax)
{
    CPLAssert(m_poBlockManagerRef);
    CPLAssert(m_poParentRef == NULL);

    /*-----------------------------------------------------------------
     * Since a root note cannot be split, we add a level of nodes
     * under it and we'll do the split at that level.
     *----------------------------------------------------------------*/
    TABMAPIndexBlock *poNewNode = new TABMAPIndexBlock(m_eAccess);

    if (poNewNode->InitNewBlock(m_fp, 512, 
                                m_poBlockManagerRef->AllocNewBlock()) != 0)
    {
        return -1;
    }
    poNewNode->SetMAPBlockManagerRef(m_poBlockManagerRef);

    // Move all entries to the new child
    int nSrcEntries = m_numEntries;
    m_numEntries = 0;
    for(int iEntry=0; iEntry<nSrcEntries; iEntry++)
    {
        poNewNode->InsertEntry(m_asEntries[iEntry].XMin, 
                               m_asEntries[iEntry].YMin,
                               m_asEntries[iEntry].XMax, 
                               m_asEntries[iEntry].YMax,
                               m_asEntries[iEntry].nBlockPtr);
    }
    
    /*-----------------------------------------------------------------
     * Transfer current child object to new node.
     *----------------------------------------------------------------*/
    if (m_poCurChild)
    {
        poNewNode->SetCurChildRef(m_poCurChild, m_nCurChildIndex);
        m_poCurChild->SetParentRef(poNewNode);
        m_poCurChild = NULL;
        m_nCurChildIndex = -1;
    }

    /*-----------------------------------------------------------------
     * Place info about new child in current node.
     *----------------------------------------------------------------*/
    poNewNode->RecomputeMBR();
    int nMinX, nMinY, nMaxX, nMaxY;
    poNewNode->GetMBR(nMinX, nMinY, nMaxX, nMaxY);
    InsertEntry(nMinX, nMinY, nMaxX, nMaxY, poNewNode->GetNodeBlockPtr());

    /*-----------------------------------------------------------------
     * Keep a reference to the new child
     *----------------------------------------------------------------*/
    poNewNode->SetParentRef(this);
    m_poCurChild = poNewNode;
    m_nCurChildIndex = m_numEntries -1;

    /*-----------------------------------------------------------------
     * And finally force the child to split itself
     *----------------------------------------------------------------*/
    return m_poCurChild->SplitNode(nNewEntryXMin, nNewEntryYMin,
                                   nNewEntryXMax, nNewEntryYMax);
}


/**********************************************************************
 *                   TABMAPIndexBlock::RecomputeMBR()
 *
 * Recompute current block MBR, and update info in parent.
 **********************************************************************/
void TABMAPIndexBlock::RecomputeMBR()
{
    GInt32 nMinX, nMinY, nMaxX, nMaxY;

    nMinX = 1000000000;
    nMinY = 1000000000;
    nMaxX = -1000000000;
    nMaxY = -1000000000;

    for(int i=0; i<m_numEntries; i++)
    {
        if (m_asEntries[i].XMin < nMinX)
            nMinX = m_asEntries[i].XMin;
        if (m_asEntries[i].XMax > nMaxX)
            nMaxX = m_asEntries[i].XMax;

        if (m_asEntries[i].YMin < nMinY)
            nMinY = m_asEntries[i].YMin;
        if (m_asEntries[i].YMax > nMaxY)
            nMaxY = m_asEntries[i].YMax;
    }

    if (m_nMinX != nMinX ||
        m_nMinY != nMinY ||
        m_nMaxX != nMaxX ||
        m_nMaxY != nMaxY )
    {
        m_nMinX = nMinX;
        m_nMinY = nMinY;
        m_nMaxX = nMaxX;
        m_nMaxY = nMaxY;

        m_bModified = TRUE;

        if (m_poParentRef)
            m_poParentRef->UpdateCurChildMBR(m_nMinX, m_nMinY, 
                                             m_nMaxX, m_nMaxY,
                                             GetNodeBlockPtr());
    }

}

/**********************************************************************
 *                   TABMAPIndexBlock::UpateCurChildMBR()
 *
 * Update current child MBR info, and propagate info in parent.
 *
 * nBlockPtr is passed only to validate the consistency of the tree.
 **********************************************************************/
void TABMAPIndexBlock::UpdateCurChildMBR(GInt32 nXMin, GInt32 nYMin,
                                         GInt32 nXMax, GInt32 nYMax,
                                         GInt32 nBlockPtr)
{
    CPLAssert(m_poCurChild);
    CPLAssert(m_asEntries[m_nCurChildIndex].nBlockPtr == nBlockPtr);

    if (m_asEntries[m_nCurChildIndex].XMin == nXMin &&
        m_asEntries[m_nCurChildIndex].YMin == nYMin &&
        m_asEntries[m_nCurChildIndex].XMax == nXMax &&
        m_asEntries[m_nCurChildIndex].YMax == nYMax)
    {
        return;  /* Nothing changed... nothing to do */
    }

    m_bModified = TRUE;

    m_asEntries[m_nCurChildIndex].XMin = nXMin;
    m_asEntries[m_nCurChildIndex].YMin = nYMin;
    m_asEntries[m_nCurChildIndex].XMax = nXMax;
    m_asEntries[m_nCurChildIndex].YMax = nYMax;

    m_nMinX = 1000000000;
    m_nMinY = 1000000000;
    m_nMaxX = -1000000000;
    m_nMaxY = -1000000000;

    for(int i=0; i<m_numEntries; i++)
    {
        if (m_asEntries[i].XMin < m_nMinX)
            m_nMinX = m_asEntries[i].XMin;
        if (m_asEntries[i].XMax > m_nMaxX)
            m_nMaxX = m_asEntries[i].XMax;
    
        if (m_asEntries[i].YMin < m_nMinY)
            m_nMinY = m_asEntries[i].YMin;
        if (m_asEntries[i].YMax > m_nMaxY)
            m_nMaxY = m_asEntries[i].YMax;
    }

    if (m_poParentRef)
        m_poParentRef->UpdateCurChildMBR(m_nMinX, m_nMinY, m_nMaxX, m_nMaxY,
                                         GetNodeBlockPtr());

}


/**********************************************************************
 *                   TABMAPIndexBlock::SetMAPBlockManagerRef()
 *
 * Pass a reference to the block manager object for the file this 
 * block belongs to.  The block manager will be used by this object
 * when it needs to automatically allocate a new block.
 **********************************************************************/
void TABMAPIndexBlock::SetMAPBlockManagerRef(TABBinBlockManager *poBlockMgr)
{
    m_poBlockManagerRef = poBlockMgr;
};

/**********************************************************************
 *                   TABMAPIndexBlock::SetParentRef()
 *
 * Used to pass a reference to this node's parent.
 **********************************************************************/
void    TABMAPIndexBlock::SetParentRef(TABMAPIndexBlock *poParent)
{
    m_poParentRef = poParent;
}

/**********************************************************************
 *                   TABMAPIndexBlock::SetCurChildRef()
 *
 * Used to transfer a child object from one node to another
 **********************************************************************/
void    TABMAPIndexBlock::SetCurChildRef(TABMAPIndexBlock *poChild,
                                         int nChildIndex)
{
    m_poCurChild = poChild;
    m_nCurChildIndex = nChildIndex;
}

/**********************************************************************
 *                   TABMAPIndexBlock::Dump()
 *
 * Dump block contents... available only in DEBUG mode.
 **********************************************************************/
#ifdef DEBUG

void TABMAPIndexBlock::Dump(FILE *fpOut /*=NULL*/)
{
    if (fpOut == NULL)
        fpOut = stdout;

    fprintf(fpOut, "----- TABMAPIndexBlock::Dump() -----\n");
    if (m_pabyBuf == NULL)
    {
        fprintf(fpOut, "Block has not been initialized yet.");
    }
    else
    {
        fprintf(fpOut,"Index Block (type %d) at offset %d.\n", 
                                                m_nBlockType, m_nFileOffset);
        fprintf(fpOut,"  m_numEntries          = %d\n", m_numEntries);

        /*-------------------------------------------------------------
         * Loop through all entries, dumping each of them
         *------------------------------------------------------------*/
        if (m_numEntries > 0)
            ReadAllEntries();

        for(int i=0; i<m_numEntries; i++)
        {
            fprintf(fpOut, "    %6d -> (%d, %d) - (%d, %d)\n",
                    m_asEntries[i].nBlockPtr,
                    m_asEntries[i].XMin, m_asEntries[i].YMin,
                    m_asEntries[i].XMax, m_asEntries[i].YMax );
        }

    }

    fflush(fpOut);
}
#endif // DEBUG


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米色一区二区| 精品一区二区免费看| 91精品国产色综合久久| 懂色一区二区三区免费观看| 婷婷久久综合九色综合伊人色| 久久免费午夜影院| 欧美一区二区福利视频| 波多野结衣中文一区| 精品在线观看视频| 亚洲成年人影院| 国产精品久久久久影院老司| 欧美mv日韩mv| 欧美精品v国产精品v日韩精品| 成人av影院在线| 国产一区二区在线看| 五月综合激情网| 一区二区三区四区高清精品免费观看| 久久免费精品国产久精品久久久久| 欧美日韩国产片| 色综合中文字幕国产 | 美女任你摸久久| 亚洲一二三四区不卡| 一区在线观看视频| 日本一区二区三区在线不卡 | 亚洲精品日韩专区silk| 国产亚洲精品bt天堂精选| 日韩欧美黄色影院| 日韩一二三区视频| 欧美丝袜丝nylons| 色菇凉天天综合网| 91免费视频大全| 99精品国产99久久久久久白柏 | 5月丁香婷婷综合| 在线观看日韩毛片| 日本韩国视频一区二区| 91麻豆视频网站| 99精品国产热久久91蜜凸| 不卡视频一二三四| 成人av影院在线| 97久久精品人人爽人人爽蜜臀| 国产mv日韩mv欧美| 成人午夜精品在线| 99re6这里只有精品视频在线观看| 成人性色生活片免费看爆迷你毛片| 国产成人精品aa毛片| 风流少妇一区二区| 97aⅴ精品视频一二三区| 91看片淫黄大片一级在线观看| av在线免费不卡| 色婷婷香蕉在线一区二区| 在线免费观看日韩欧美| 欧美日韩在线直播| 欧美一区二区视频观看视频| 日韩视频一区二区| 精品sm捆绑视频| 中文字幕精品综合| 亚洲欧美日韩成人高清在线一区| 亚洲日本护士毛茸茸| 亚洲国产视频在线| 久久综合综合久久综合| 国产精品一色哟哟哟| 成人免费观看视频| 欧亚洲嫩模精品一区三区| 欧美日韩国产123区| 精品动漫一区二区三区在线观看| 精品福利在线导航| 国产精品国产自产拍高清av王其| 亚洲精品伦理在线| 日本不卡一区二区三区高清视频| 久久不见久久见免费视频7 | 欧美高清视频在线高清观看mv色露露十八| 欧美日韩国产天堂| 精品国产一区二区三区忘忧草 | 欧美色综合网站| 日韩视频免费观看高清完整版在线观看| 久久久国产精华| 亚洲欧美区自拍先锋| 美女精品一区二区| 成人高清视频在线观看| 欧美日韩aaaaa| 欧美电视剧免费全集观看| 国产精品久久久久永久免费观看| 亚洲国产精品一区二区www在线| 久久国产精品99久久久久久老狼 | 日韩精品一区二区三区在线播放| 国产日产精品1区| 亚洲成人久久影院| 成人亚洲一区二区一| 欧美老女人第四色| 中文字幕欧美激情| 视频一区二区三区在线| 成人18视频在线播放| 在线电影一区二区三区| 日韩美女久久久| 国产麻豆精品在线| 欧美三级电影在线观看| 中文字幕欧美区| 一区二区三区在线免费播放| 中文字幕乱码日本亚洲一区二区 | 一区二区三区产品免费精品久久75| 日韩成人一区二区| 亚洲成人午夜电影| 精品91自产拍在线观看一区| 欧美色倩网站大全免费| 色综合久久中文综合久久牛| 丁香天五香天堂综合| 国产酒店精品激情| 韩国av一区二区三区四区| 婷婷六月综合网| 水蜜桃久久夜色精品一区的特点 | 久久精品视频免费观看| 日韩欧美色综合网站| 欧美日韩免费观看一区三区| 在线一区二区视频| 欧美中文字幕一区| 欧美三级一区二区| 欧美日韩小视频| 欧美久久久久免费| 欧美日韩国产片| 欧美一区二区日韩| 日韩精品中午字幕| 久久色.com| 中文一区一区三区高中清不卡| 久久久久久**毛片大全| 国产欧美日韩精品一区| 国产精品免费看片| 亚洲乱码国产乱码精品精98午夜| 亚洲精品国产第一综合99久久| 亚洲午夜精品在线| 蜜桃视频在线观看一区二区| 久久精品国产久精国产爱| 精品一区二区三区蜜桃| 国产成人午夜99999| av在线不卡免费看| 欧美日韩大陆一区二区| 欧美一二三在线| 国产欧美日韩三区| 亚洲精品第一国产综合野| 日韩国产高清影视| 国产又粗又猛又爽又黄91精品| 风间由美一区二区三区在线观看| 色综合久久久久久久| 欧美一区二区女人| 国产精品精品国产色婷婷| 亚洲一区二区三区四区五区中文| 蜜桃av一区二区| 国产成人精品亚洲日本在线桃色 | 久久久久久**毛片大全| 亚洲欧美区自拍先锋| 美女一区二区久久| 成人v精品蜜桃久久一区| 欧美久久久久久蜜桃| 欧美激情一区三区| 日韩精品一区第一页| 粉嫩绯色av一区二区在线观看| 91精彩视频在线观看| 精品入口麻豆88视频| 亚洲黄网站在线观看| 国产精品正在播放| 欧美三级三级三级| 欧美激情综合网| 奇米精品一区二区三区在线观看一| 成人av在线一区二区三区| 欧美一区二区三区性视频| 一区在线观看视频| 国模一区二区三区白浆| 日本韩国欧美在线| 国产午夜精品在线观看| 天天色综合天天| 97久久精品人人澡人人爽| 26uuu国产日韩综合| 石原莉奈在线亚洲二区| 99免费精品在线| 久久综合国产精品| 婷婷开心久久网| 一本大道久久a久久综合婷婷| 久久综合久色欧美综合狠狠| 亚洲国产日韩综合久久精品| caoporm超碰国产精品| 精品99999| 久久国产剧场电影| 3d成人动漫网站| 亚洲成人1区2区| 欧美亚洲综合一区| 自拍偷拍亚洲综合| 国产精品亚洲综合一区在线观看| 91精品欧美一区二区三区综合在| 亚洲精选在线视频| 91小视频免费看| 亚洲欧洲精品天堂一级| 成人一区二区在线观看| 国产天堂亚洲国产碰碰| 狠狠色丁香久久婷婷综合丁香| 欧美日韩精品欧美日韩精品一综合| 亚洲色图色小说| 色婷婷精品久久二区二区蜜臂av| 国产精品女主播在线观看| 成人永久看片免费视频天堂| 久久亚洲一级片| 国产成人亚洲综合a∨婷婷图片|