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

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

?? mitab_mapindexblock.cpp

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

    return (TAB_MAX_ENTRIES_INDEX_BLOCK - m_numEntries);
}

/**********************************************************************
 *                   TABMAPIndexBlock::GetEntry()
 *
 * Fetch a reference to the requested entry.
 *
 * @param iIndex index of entry, must be from 0 to GetNumEntries()-1. 
 *
 * @return a reference to the internal copy of the entry, or NULL if out
 * of range. 
 **********************************************************************/
TABMAPIndexEntry *TABMAPIndexBlock::GetEntry( int iIndex )
{
    if( iIndex < 0 || iIndex >= m_numEntries )
        return NULL;

    return m_asEntries + iIndex;
}

/**********************************************************************
 *                   TABMAPIndexBlock::GetCurMaxDepth()
 *
 * Return maximum depth in the currently loaded part of the index tree
 **********************************************************************/
int     TABMAPIndexBlock::GetCurMaxDepth()
{
    if (m_poCurChild)
        return m_poCurChild->GetCurMaxDepth() + 1;

    return 1;  /* No current child... this node counts for one. */
}

/**********************************************************************
 *                   TABMAPIndexBlock::GetMBR()
 *
 * Return the MBR for the current block.
 **********************************************************************/
void TABMAPIndexBlock::GetMBR(GInt32 &nXMin, GInt32 &nYMin, 
                                     GInt32 &nXMax, GInt32 &nYMax)
{
    nXMin = m_nMinX;
    nYMin = m_nMinY;
    nXMax = m_nMaxX;
    nYMax = m_nMaxY; 
}

/**********************************************************************
 *                   TABMAPIndexBlock::InsertEntry()
 *
 * Add a new entry to this index block.  It is assumed that there is at
 * least one free slot available, so if the block has to be split then it
 * should have been done prior to calling this function.
 *
 * Returns 0 on success, -1 on error.
 **********************************************************************/
int     TABMAPIndexBlock::InsertEntry(GInt32 nXMin, GInt32 nYMin,
                                      GInt32 nXMax, GInt32 nYMax,
                                      GInt32 nBlockPtr)
{
    if (m_eAccess != TABWrite && m_eAccess != TABReadWrite)
    {
        CPLError(CE_Failure, CPLE_AssertionFailed,
               "Failed adding index entry: File not opened for write access.");
        return -1;
    }

    if (GetNumFreeEntries() < 1)
    {
        CPLError(CE_Failure, CPLE_AssertionFailed,
                 "Current Block Index is full, cannot add new entry.");
        return -1;
    }

    /*-----------------------------------------------------------------
     * Update count of entries and store new entry.
     *----------------------------------------------------------------*/
    m_numEntries++;
    CPLAssert(m_numEntries <= TAB_MAX_ENTRIES_INDEX_BLOCK);

    m_asEntries[m_numEntries-1].XMin = nXMin;
    m_asEntries[m_numEntries-1].YMin = nYMin;
    m_asEntries[m_numEntries-1].XMax = nXMax;
    m_asEntries[m_numEntries-1].YMax = nYMax;
    m_asEntries[m_numEntries-1].nBlockPtr = nBlockPtr;

    m_bModified = TRUE;

    return 0;
}

/**********************************************************************
 *                   TABMAPIndexBlock::ChooseSubEntryForInsert()
 *
 * Select the entry in this index block in which the new entry should 
 * be inserted. The criteria used is to select the node whose MBR needs
 * the least enlargement to include the new entry. We resolve ties by
 * chosing the entry with the rectangle of smallest area.
 * (This is the ChooseSubtree part of Guttman's "ChooseLeaf" algorithm.)
 *
 * Returns the index of the best candidate or -1 of node is empty.
 **********************************************************************/
int     TABMAPIndexBlock::ChooseSubEntryForInsert(GInt32 nXMin, GInt32 nYMin,
                                                  GInt32 nXMax, GInt32 nYMax)
{
    GInt32 i, nBestCandidate=-1;

    double dOptimalAreaDiff=0;

    double dNewEntryArea = MITAB_AREA(nXMin, nYMin, nXMax, nYMax);

    for(i=0; i<m_numEntries; i++)
    {
        double dAreaDiff = 0;
        double dAreaBefore = MITAB_AREA(m_asEntries[i].XMin,
                                        m_asEntries[i].YMin,
                                        m_asEntries[i].XMax,
                                        m_asEntries[i].YMax);

        /* Does this entry fully contain the new entry's MBR ?
         */
        GBool bIsContained = (nXMin >= m_asEntries[i].XMin &&
                              nYMin >= m_asEntries[i].YMin &&
                              nXMax <= m_asEntries[i].XMax &&
                              nYMax <= m_asEntries[i].YMax );

        if (bIsContained)
        {
            /* If new entry is fully contained in this entry then
             * the area difference will be the difference between the area
             * of the entry to insert and the area of m_asEntries[i]
             *
             * The diff value is negative in this case.
             */
            dAreaDiff = dNewEntryArea - dAreaBefore;
        }
        else
        {
            /* Need to calculate the expanded MBR to calculate the area
             * difference.
             */
            GInt32 nXMin2, nYMin2, nXMax2, nYMax2;
            nXMin2 = MIN(m_asEntries[i].XMin, nXMin);
            nYMin2 = MIN(m_asEntries[i].YMin, nYMin);
            nXMax2 = MAX(m_asEntries[i].XMax, nXMax);
            nYMax2 = MAX(m_asEntries[i].YMax, nYMax);

            dAreaDiff = MITAB_AREA(nXMin2,nYMin2,nXMax2,nYMax2) - dAreaBefore;
        }

        /* Is this a better candidate?
         * Note, possible Optimization: In case of tie, we could to pick the 
         * candidate with the smallest area
         */

        if (/* No best candidate yet */
            (nBestCandidate == -1)
            /* or current candidate is contained and best candidate is not contained */
            || (dAreaDiff < 0 && dOptimalAreaDiff >= 0)
            /* or if both are either contained or not contained then use the one
             * with the smallest area diff, which means maximum coverage in the case
             * of contained rects, or minimum area increase when not contained 
             */
            || (((dOptimalAreaDiff < 0 && dAreaDiff < 0) ||
                 (dOptimalAreaDiff > 0 && dAreaDiff > 0)) && 
                ABS(dAreaDiff) < ABS(dOptimalAreaDiff)) )
        {
            nBestCandidate = i;
            dOptimalAreaDiff = dAreaDiff;
        }

    }

    return nBestCandidate;
}

/**********************************************************************
 *                   TABMAPIndexBlock::ChooseLeafForInsert()
 *
 * Recursively search the tree until we find the best leaf to
 * contain the specified object MBR.
 *
 * Returns the nBlockPtr of the selected leaf node entry (should be a
 * ref to a TABMAPObjectBlock) or -1 on error.
 *
 * After this call, m_poCurChild will be pointing at the selected child 
 * node, for use by later calls to UpdateLeafEntry()
 **********************************************************************/
GInt32  TABMAPIndexBlock::ChooseLeafForInsert(GInt32 nXMin, GInt32 nYMin,
                                              GInt32 nXMax, GInt32 nYMax)
{
    GBool bFound = FALSE;

    if (m_numEntries < 0)
        return -1;

    /*-----------------------------------------------------------------
     * Look for the best candidate to contain the new entry
     *----------------------------------------------------------------*/

    // Make sure blocks currently in memory are written to disk.
    // TODO: Could we avoid deleting m_poCurChild if it's already 
    //       the best candidate for insert?
    if (m_poCurChild)
    {
        m_poCurChild->CommitToFile();
        delete m_poCurChild;
        m_poCurChild = NULL;
        m_nCurChildIndex = -1;
    }

    int nBestCandidate = ChooseSubEntryForInsert(nXMin,nYMin,nXMax,nYMax);
       
    CPLAssert(nBestCandidate != -1);
    if (nBestCandidate == -1)
        return -1;  /* This should never happen! */

    // Try to load corresponding child... if it fails then we are
    // likely in a leaf node, so we'll add the new entry in the current
    // node.
    TABRawBinBlock *poBlock = NULL;

    // Prevent error message if referred block not committed yet.
    CPLPushErrorHandler(CPLQuietErrorHandler);

    if ((poBlock = TABCreateMAPBlockFromFile(m_fp, 
                                    m_asEntries[nBestCandidate].nBlockPtr,
                                    512, TRUE, TABReadWrite)) &&
        poBlock->GetBlockClass() == TABMAP_INDEX_BLOCK)
    {
        m_poCurChild = (TABMAPIndexBlock*)poBlock;
        poBlock = NULL;
        m_nCurChildIndex = nBestCandidate;
        m_poCurChild->SetParentRef(this);
        m_poCurChild->SetMAPBlockManagerRef(m_poBlockManagerRef);
        bFound = TRUE;
    }
                
    if (poBlock)
        delete poBlock;
            
    CPLPopErrorHandler();
    CPLErrorReset();


    if (bFound)
    {
        /*-------------------------------------------------------------
         * Found a child leaf... pass the call to it.
         *------------------------------------------------------------*/
        return m_poCurChild->ChooseLeafForInsert(nXMin, nYMin, nXMax, nYMax);
    }

    /*-------------------------------------------------------------
     * Found no child index node... we must be at the leaf level 
     * (leaf points at map object data blocks) so we return a ref 
     * to the TABMAPObjBlock for insertion
     *------------------------------------------------------------*/
    return m_asEntries[nBestCandidate].nBlockPtr;
}


/**********************************************************************
 *                   TABMAPIndexBlock::GetCurLeafEntryMBR()
 *
 * Get the MBR for specified nBlockPtr in the leaf at the end of the
 * chain of m_poCurChild refs.
 *
 * This method requires that the chain of m_poCurChild refs already point
 * to a leaf that contains the specified nBlockPtr, it is usually called
 * right after ChooseLeafForInsert().
 *
 * Returns 0 on success, -1 on error.
 **********************************************************************/
int     TABMAPIndexBlock::GetCurLeafEntryMBR(GInt32 nBlockPtr,
                                             GInt32 &nXMin, GInt32 &nYMin,
                                             GInt32 &nXMax, GInt32 &nYMax)
{
    if (m_poCurChild)
    {
        /* Pass the call down to current child */
        return m_poCurChild->GetCurLeafEntryMBR(nBlockPtr,
                                                nXMin, nYMin, nXMax, nYMax);
    }

    /* We're at the leaf level, look for the entry */
    for(int i=0; i<m_numEntries; i++)
    {
        if (m_asEntries[i].nBlockPtr == nBlockPtr)
        {
            /* Found it. Return its MBR */
            nXMin = m_asEntries[i].XMin;
            nYMin = m_asEntries[i].YMin;
            nXMax = m_asEntries[i].XMax;
            nYMax = m_asEntries[i].YMax;

            return 0;
        }
    }

    /* Not found! This should not happen if method is used properly. */
    CPLError(CE_Failure, CPLE_AssertionFailed,
             "Entry to update not found in GetCurLeafEntryMBR()!");
    return -1; 

}


/**********************************************************************
 *                   TABMAPIndexBlock::UpdateLeafEntry()
 *
 * Update the MBR for specified nBlockPtr in the leaf at the end of the
 * chain of m_poCurChild refs and update MBR of parents if required.
 *
 * This method requires that the chain of m_poCurChild refs already point
 * to a leaf that contains the specified nBlockPtr, it is usually called
 * right after ChooseLeafForInsert().
 *
 * Returns 0 on success, -1 on error.
 **********************************************************************/
int     TABMAPIndexBlock::UpdateLeafEntry(GInt32 nBlockPtr,
                                          GInt32 nXMin, GInt32 nYMin,
                                          GInt32 nXMax, GInt32 nYMax )
{
    if (m_poCurChild)
    {
        /* Pass the call down to current child */
        return m_poCurChild->UpdateLeafEntry(nBlockPtr,
                                             nXMin, nYMin, nXMax, nYMax);
    }

    /* We're at the leaf level, look for the entry to update */
    for(int i=0; i<m_numEntries; i++)
    {
        if (m_asEntries[i].nBlockPtr == nBlockPtr)
        {
            /* Found it. */
            TABMAPIndexEntry *psEntry = &m_asEntries[i];

            if (psEntry->XMin != nXMin ||
                psEntry->YMin != nYMin ||
                psEntry->XMax != nXMax ||
                psEntry->YMax != nYMax )
            {
                /* MBR changed. Update MBR of entry */
                psEntry->XMin = nXMin;
                psEntry->YMin = nYMin;
                psEntry->XMax = nXMax;
                psEntry->YMax = nYMax;

                m_bModified = TRUE;

                /* Update MBR of this node and all parents */
                RecomputeMBR();
            }

            return 0;
        }
    }

    /* Not found! This should not happen if method is used properly. */
    CPLError(CE_Failure, CPLE_AssertionFailed,
             "Entry to update not found in UpdateLeafEntry()!");
    return -1; 
}


/**********************************************************************
 *                   TABMAPIndexBlock::AddEntry()
 *
 * Recursively search the tree until we encounter the best leaf to
 * contain the specified object MBR and add the new entry to it.
 *
 * In the even that the selected leaf node would be full, then it will be
 * split and this split can propagate up to its parent, etc.
 *
 * If bAddInThisNodeOnly=TRUE, then the entry is added only locally and
 * we do not try to update the child node.  This is used when the parent 
 * of a node that is being splitted has to be updated.
 *
 * Returns 0 on success, -1 on error.
 **********************************************************************/
int     TABMAPIndexBlock::AddEntry(GInt32 nXMin, GInt32 nYMin,
                                   GInt32 nXMax, GInt32 nYMax,
                                   GInt32 nBlockPtr,
                                   GBool bAddInThisNodeOnly /*=FALSE*/)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产综合视频在线观看| 麻豆国产精品777777在线| 国产精品视频免费看| 亚洲人成亚洲人成在线观看图片| 日韩—二三区免费观看av| 国产精品99久久不卡二区| 精品区一区二区| 亚洲男人天堂一区| 国产精品996| 日韩色视频在线观看| 亚洲欧美日韩国产另类专区| 精品一区二区在线视频| 欧美日韩精品久久久| 国产精品嫩草99a| 精品一区二区成人精品| 欧美精三区欧美精三区| 亚洲欧美日韩中文字幕一区二区三区| 麻豆久久久久久| 欧美男男青年gay1069videost | 国产精品青草久久| 热久久久久久久| 色综合一区二区| 久久久精品国产免费观看同学| 天天综合天天综合色| 色综合久久天天综合网| 欧美电视剧在线看免费| 亚洲一区二区三区精品在线| 91视频在线观看| 国产欧美一区二区精品仙草咪| 极品尤物av久久免费看| 日韩欧美国产成人一区二区| 亚洲国产成人tv| 欧美日韩免费观看一区三区| 日韩一区在线播放| 99久久精品国产一区二区三区| 欧美国产精品专区| 成人高清免费在线播放| 国产精品久久综合| 北岛玲一区二区三区四区 | 欧美精品丝袜中出| 亚洲超丰满肉感bbw| 欧美日韩国产在线播放网站| 午夜精品一区二区三区电影天堂 | 91精品国模一区二区三区| 性久久久久久久久| 欧美一区二区三区日韩视频| 久久精品噜噜噜成人av农村| 精品国免费一区二区三区| 国产一区二区成人久久免费影院| 国产亚洲欧美在线| 国产精品一色哟哟哟| 久久精品夜色噜噜亚洲aⅴ| 国产一区二区免费看| 国产欧美一区二区三区鸳鸯浴| 国产成人免费视频网站| 国产精品久久精品日日| 91在线无精精品入口| 亚洲在线视频网站| 日韩视频一区二区三区在线播放 | 国产精品你懂的在线欣赏| 成人手机在线视频| 亚洲视频电影在线| 欧美日韩久久一区| 毛片基地黄久久久久久天堂| 日韩欧美一级二级三级| 国产成人av自拍| 亚洲乱码日产精品bd| 欧美日韩午夜在线| 激情丁香综合五月| 亚洲欧美精品午睡沙发| 欧美肥妇毛茸茸| 国产91精品在线观看| 性欧美疯狂xxxxbbbb| 国产丝袜欧美中文另类| 欧美日韩综合在线免费观看| 国产一区二区三区免费| 亚洲一区二区视频在线观看| 26uuu国产日韩综合| 91首页免费视频| 国产主播一区二区| 亚洲成人av免费| 国产精品色哟哟| 日韩欧美国产三级电影视频| 91浏览器入口在线观看| 精品一区二区av| 五月天中文字幕一区二区| 国产精品久久久久影院老司| 欧美一区二区三区电影| 色综合久久88色综合天天6| 狠狠色狠狠色合久久伊人| 亚洲一区二区成人在线观看| 国产精品无人区| 亚洲精品一区二区三区福利 | 亚洲视频免费观看| 国产午夜精品一区二区三区四区| 91久久香蕉国产日韩欧美9色| 国产成人亚洲综合a∨婷婷图片| 亚洲成人综合在线| 亚洲欧美日韩一区二区| 日本一区二区三级电影在线观看 | 在线观看亚洲精品| av一区二区三区四区| 国产一区二区三区免费| 免费的成人av| 午夜在线电影亚洲一区| 一区二区三区四区蜜桃| 国产精品久久三区| 欧美国产欧美亚州国产日韩mv天天看完整| 日韩午夜av一区| 欧美肥妇bbw| 欧美电影一区二区三区| 欧美片网站yy| 欧美二区在线观看| 91精品国产黑色紧身裤美女| 欧美福利视频导航| 欧美一区午夜视频在线观看| 欧美精品 国产精品| 91精品国产综合久久久久久漫画| 欧美性感一区二区三区| 欧美在线影院一区二区| 欧美制服丝袜第一页| 欧美日韩免费视频| 欧美一区二区三区视频免费播放| 欧美一级日韩一级| 日韩亚洲欧美高清| 欧美第一区第二区| xfplay精品久久| 国产免费观看久久| 亚洲人成网站影音先锋播放| 亚洲午夜影视影院在线观看| 亚洲成av人片一区二区三区 | 777精品伊人久久久久大香线蕉| 欧美日韩精品欧美日韩精品一综合| 欧美午夜片在线看| 538在线一区二区精品国产| 日韩欧美亚洲一区二区| 久久久三级国产网站| 国产精品高清亚洲| 亚洲电影激情视频网站| 久久国产麻豆精品| 福利视频网站一区二区三区| 91女神在线视频| 91精品国产91热久久久做人人 | 国产久卡久卡久卡久卡视频精品| 成人中文字幕电影| 在线一区二区三区四区| 日韩精品在线网站| 国产精品久久久久久福利一牛影视| 有坂深雪av一区二区精品| 天天综合网 天天综合色| 国产老肥熟一区二区三区| 91蝌蚪国产九色| 欧美一区午夜精品| 日韩一区欧美一区| 日韩av网站免费在线| 成人黄色软件下载| 欧美高清视频不卡网| 亚洲国产精品精华液ab| 亚洲一区二区免费视频| 国产suv精品一区二区6| 欧美日韩免费视频| 国产精品理伦片| 青娱乐精品在线视频| 99久久久国产精品免费蜜臀| 欧美一级在线视频| 亚洲卡通动漫在线| 国产一区二区h| 欧美日韩dvd在线观看| 国产免费久久精品| 蜜臀va亚洲va欧美va天堂| 91浏览器在线视频| 欧美激情一区二区三区四区| 日本中文字幕一区| 色综合婷婷久久| 久久久久久夜精品精品免费| 午夜影视日本亚洲欧洲精品| www.亚洲人| 欧美大片在线观看一区| 午夜电影网亚洲视频| 色综合久久天天综合网| 国产精品视频yy9299一区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 一区二区三区四区不卡视频| 国产大陆亚洲精品国产| 91精品国产91久久久久久最新毛片| 一区二区久久久久久| av一二三不卡影片| 国产精品色哟哟网站| 国产乱理伦片在线观看夜一区| 日韩久久久精品| 免费观看日韩av| 欧美精品v国产精品v日韩精品| 亚洲在线视频一区| 91美女在线视频| 国产精品乱码妇女bbbb| 国产精品123区| 久久久激情视频| 久久99国产精品麻豆| 日韩视频在线你懂得| 蜜臀久久99精品久久久久宅男|