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

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

?? mitab_mapindexblock.cpp

?? mitab,讀取MapInfo的地圖文件
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/**********************************************************************
 * $Id: mitab_mapindexblock.cpp,v 1.13 2007/04/02 18:58:03 dmorissette Exp $
 *
 * Name:     mitab_mapindexblock.cpp
 * Project:  MapInfo TAB Read/Write library
 * Language: C++
 * Purpose:  Implementation of the TABMAPIndexBlock class used to handle
 *           reading/writing of the .MAP files' index blocks
 * Author:   Daniel Morissette, dmorissette@dmsolutions.ca
 *
 **********************************************************************
 * Copyright (c) 1999, 2000, Daniel Morissette
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 **********************************************************************
 *
 * $Log: mitab_mapindexblock.cpp,v $
 * Revision 1.13  2007/04/02 18:58:03  dmorissette
 * Fixed uninitialized variable warning in PickSeedsForSplit()
 *
 * Revision 1.12  2006/12/14 20:03:02  dmorissette
 * Improve write performance by keeping track of changes to index blocks
 * and committing to disk only if modified (related to bug 1585)
 *
 * Revision 1.11  2006/11/28 18:49:08  dmorissette
 * Completed changes to split TABMAPObjectBlocks properly and produce an
 * optimal spatial index (bug 1585)
 *
 * Revision 1.10  2006/11/20 20:05:58  dmorissette
 * First pass at improving generation of spatial index in .map file (bug 1585)
 * New methods for insertion and splittung in the spatial index are done.
 * Also implemented a method to dump the spatial index to .mif/.mid
 * Still need to implement splitting of TABMapObjectBlock to get optimal
 * results.
 *
 * Revision 1.9  2004/06/30 20:29:04  dmorissette
 * Fixed refs to old address danmo@videotron.ca
 *
 * Revision 1.8  2001/09/14 03:23:55  warmerda
 * Substantial upgrade to support spatial queries using spatial indexes
 *
 * Revision 1.7  2000/05/23 17:02:54  daniel
 * Removed unused variables
 *
 * Revision 1.6  2000/05/19 06:45:10  daniel
 * Modified generation of spatial index to split index nodes and produce a
 * more balanced tree.
 *
 * Revision 1.5  2000/01/15 22:30:44  daniel
 * Switch to MIT/X-Consortium OpenSource license
 *
 * Revision 1.4  1999/10/01 03:46:31  daniel
 * Added ReadAllEntries() and more complete Dump() for debugging files
 *
 * Revision 1.3  1999/09/29 04:23:51  daniel
 * Fixed typo in GetMBR()
 *
 * Revision 1.2  1999/09/26 14:59:37  daniel
 * Implemented write support
 *
 * Revision 1.1  1999/07/12 04:18:25  daniel
 * Initial checkin
 *
 **********************************************************************/

#include "mitab.h"

/*=====================================================================
 *                      class TABMAPIndexBlock
 *====================================================================*/


/**********************************************************************
 *                   TABMAPIndexBlock::TABMAPIndexBlock()
 *
 * Constructor.
 **********************************************************************/
TABMAPIndexBlock::TABMAPIndexBlock(TABAccess eAccessMode /*= TABRead*/):
    TABRawBinBlock(eAccessMode, TRUE)
{
    m_numEntries = 0;

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

    m_poCurChild = NULL;
    m_nCurChildIndex = -1;
    m_poParentRef = NULL;
    m_poBlockManagerRef = NULL;
}

/**********************************************************************
 *                   TABMAPIndexBlock::~TABMAPIndexBlock()
 *
 * Destructor.
 **********************************************************************/
TABMAPIndexBlock::~TABMAPIndexBlock()
{
    if (m_poCurChild)
    {
        if (m_eAccess == TABWrite || m_eAccess == TABReadWrite)
            m_poCurChild->CommitToFile();
        delete m_poCurChild;
    }
}

/**********************************************************************
 *                   TABMAPIndexBlock::InitBlockFromData()
 *
 * Perform some initialization on the block after its binary data has
 * been set or changed (or loaded from a file).
 *
 * Returns 0 if succesful or -1 if an error happened, in which case 
 * CPLError() will have been called.
 **********************************************************************/
int     TABMAPIndexBlock::InitBlockFromData(GByte *pabyBuf, 
                                            int nBlockSize, int nSizeUsed, 
                                            GBool bMakeCopy /* = TRUE */,
                                            FILE *fpSrc /* = NULL */, 
                                            int nOffset /* = 0 */)
{
    int nStatus;

    /*-----------------------------------------------------------------
     * First of all, we must call the base class' InitBlockFromData()
     *----------------------------------------------------------------*/
    nStatus = TABRawBinBlock::InitBlockFromData(pabyBuf, 
                                                nBlockSize, nSizeUsed,
                                                bMakeCopy,
                                                fpSrc, nOffset);
    if (nStatus != 0)   
        return nStatus;

    /*-----------------------------------------------------------------
     * Validate block type
     *----------------------------------------------------------------*/
    if (m_nBlockType != TABMAP_INDEX_BLOCK)
    {
        CPLError(CE_Failure, CPLE_FileIO,
                 "InitBlockFromData(): Invalid Block Type: got %d expected %d",
                 m_nBlockType, TABMAP_INDEX_BLOCK);
        CPLFree(m_pabyBuf);
        m_pabyBuf = NULL;
        return -1;
    }

    /*-----------------------------------------------------------------
     * Init member variables
     *----------------------------------------------------------------*/
    GotoByteInBlock(0x002);
    m_numEntries = ReadInt16();

    if (m_numEntries > 0)
        ReadAllEntries();

    return 0;
}

/**********************************************************************
 *                   TABMAPIndexBlock::CommitToFile()
 *
 * Commit the current state of the binary block to the file to which 
 * it has been previously attached.
 *
 * This method makes sure all values are properly set in the map object
 * block header and then calls TABRawBinBlock::CommitToFile() to do
 * the actual writing to disk.
 *
 * Returns 0 if succesful or -1 if an error happened, in which case 
 * CPLError() will have been called.
 **********************************************************************/
int     TABMAPIndexBlock::CommitToFile()
{
    int nStatus = 0;

    if ( m_pabyBuf == NULL )
    {
        CPLError(CE_Failure, CPLE_AssertionFailed, 
                 "CommitToFile(): Block has not been initialized yet!");
        return -1;
    }

    /*-----------------------------------------------------------------
     * Commit child first
     *----------------------------------------------------------------*/
    if (m_poCurChild)
    {
        if (m_poCurChild->CommitToFile() != 0)
            return -1;
    }

    /*-----------------------------------------------------------------
     * Nothing to do here if block has not been modified
     *----------------------------------------------------------------*/
    if (!m_bModified)
        return 0;

    /*-----------------------------------------------------------------
     * Make sure 4 bytes block header is up to date.
     *----------------------------------------------------------------*/
    GotoByteInBlock(0x000);

    WriteInt16(TABMAP_INDEX_BLOCK);    // Block type code
    WriteInt16(m_numEntries);

    nStatus = CPLGetLastErrorNo();

    /*-----------------------------------------------------------------
     * Loop through all entries, writing each of them, and calling
     * CommitToFile() (recursively) on any child index entries we may
     * encounter.
     *----------------------------------------------------------------*/
    for(int i=0; nStatus == 0 && i<m_numEntries; i++)
    {
        if (nStatus == 0)
            nStatus = WriteNextEntry(&(m_asEntries[i]));
    }


    /*-----------------------------------------------------------------
     * OK, call the base class to write the block to disk.
     *----------------------------------------------------------------*/
    if (nStatus == 0)
        nStatus = TABRawBinBlock::CommitToFile();

    return nStatus;
}


/**********************************************************************
 *                   TABMAPIndexBlock::InitNewBlock()
 *
 * Initialize a newly created block so that it knows to which file it
 * is attached, its block size, etc . and then perform any specific 
 * initialization for this block type, including writing a default 
 * block header, etc. and leave the block ready to receive data.
 *
 * This is an alternative to calling ReadFromFile() or InitBlockFromData()
 * that puts the block in a stable state without loading any initial
 * data in it.
 *
 * Returns 0 if succesful or -1 if an error happened, in which case 
 * CPLError() will have been called.
 **********************************************************************/
int     TABMAPIndexBlock::InitNewBlock(FILE *fpSrc, int nBlockSize, 
                                        int nFileOffset /* = 0*/)
{
    /*-----------------------------------------------------------------
     * Start with the default initialisation
     *----------------------------------------------------------------*/
    if ( TABRawBinBlock::InitNewBlock(fpSrc, nBlockSize, nFileOffset) != 0)
        return -1;

    /*-----------------------------------------------------------------
     * And then set default values for the block header.
     *----------------------------------------------------------------*/
    m_numEntries = 0;

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

    if (m_eAccess != TABRead)
    {
        GotoByteInBlock(0x000);

        WriteInt16(TABMAP_INDEX_BLOCK);     // Block type code
        WriteInt16(0);                      // num. index entries
    }

    if (CPLGetLastErrorNo() != 0)
        return -1;

    return 0;
}



/**********************************************************************
 *                   TABMAPIndexBlock::ReadNextEntry()
 *
 * Read the next index entry from the block and fill the sEntry
 * structure. 
 *
 * Returns 0 if succesful or -1 if we reached the end of the block.
 **********************************************************************/
int     TABMAPIndexBlock::ReadNextEntry(TABMAPIndexEntry *psEntry)
{
    if (m_nCurPos < 4)
        GotoByteInBlock( 0x004 );

    if (m_nCurPos > 4+(20*m_numEntries) )
    {
        // End of BLock
        return -1;
    }

    psEntry->XMin = ReadInt32();
    psEntry->YMin = ReadInt32();
    psEntry->XMax = ReadInt32();
    psEntry->YMax = ReadInt32();
    psEntry->nBlockPtr = ReadInt32();

    if (CPLGetLastErrorNo() != 0)
        return -1;

    return 0;
}

/**********************************************************************
 *                   TABMAPIndexBlock::ReadAllEntries()
 *
 * Init the block by reading all entries from the data block.
 *
 * Returns 0 if succesful or -1 on error.
 **********************************************************************/
int     TABMAPIndexBlock::ReadAllEntries()
{
    CPLAssert(m_numEntries <= TAB_MAX_ENTRIES_INDEX_BLOCK);
    if (m_numEntries == 0)
        return 0;
    
    if (GotoByteInBlock( 0x004 ) != 0)
        return -1;

    for(int i=0; i<m_numEntries; i++)
    {
        if ( ReadNextEntry(&(m_asEntries[i])) != 0)
            return -1;
    }

    return 0;
}

/**********************************************************************
 *                   TABMAPIndexBlock::WriteNextEntry()
 *
 * Write the sEntry index entry at current position in the block.
 *
 * Returns 0 if succesful or -1 if we reached the end of the block.
 **********************************************************************/
int     TABMAPIndexBlock::WriteNextEntry(TABMAPIndexEntry *psEntry)
{
    if (m_nCurPos < 4)
        GotoByteInBlock( 0x004 );

    WriteInt32(psEntry->XMin);
    WriteInt32(psEntry->YMin);
    WriteInt32(psEntry->XMax);
    WriteInt32(psEntry->YMax);
    WriteInt32(psEntry->nBlockPtr);

    if (CPLGetLastErrorNo() != 0)
        return -1;

    return 0;
}

/**********************************************************************
 *                   TABMAPIndexBlock::GetNumFreeEntries()
 *
 * Return the number of available entries in this block.
 *
 * __TODO__ This function could eventually be improved to search
 *          children leaves as well.
 **********************************************************************/
int     TABMAPIndexBlock::GetNumFreeEntries()
{
    /* nMaxEntries = (m_nBlockSize-4)/20;*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
三级一区在线视频先锋| 欧美午夜影院一区| 国内精品第一页| 日欧美一区二区| 亚洲已满18点击进入久久| 中文字幕一区二区三区在线不卡 | 精品国产一区二区三区不卡| 在线播放国产精品二区一二区四区 | 五月天激情综合| 一区二区三区国产| 亚洲主播在线观看| 亚洲国产美国国产综合一区二区| 亚洲综合一区在线| 日韩中文字幕一区二区三区| 首页欧美精品中文字幕| 日本亚洲视频在线| 韩国精品主播一区二区在线观看| 国产呦萝稀缺另类资源| 成人一区在线观看| av在线综合网| 欧美日韩国产色站一区二区三区| 制服丝袜中文字幕亚洲| 久久亚洲欧美国产精品乐播| 国产日韩av一区二区| 中文字幕亚洲区| 一级特黄大欧美久久久| 免费精品视频在线| 国产黑丝在线一区二区三区| a级精品国产片在线观看| 欧美色图免费看| 日韩女优毛片在线| 国产亚洲美州欧州综合国| 亚洲嫩草精品久久| 日韩影院在线观看| 国产精品一区二区三区乱码| 99精品视频在线播放观看| 精品视频在线视频| 久久先锋影音av鲁色资源| 亚洲图片另类小说| 美女一区二区三区| heyzo一本久久综合| 欧美主播一区二区三区| 精品日韩在线观看| 亚洲日本在线观看| 日本成人在线网站| 成人晚上爱看视频| 7777精品伊人久久久大香线蕉经典版下载| 日韩视频免费观看高清完整版在线观看| 久久蜜臀中文字幕| 一二三四社区欧美黄| 精品一区二区综合| 日本韩国欧美在线| ww亚洲ww在线观看国产| 一区二区三区丝袜| 国产精品羞羞答答xxdd| 欧美色大人视频| 国产欧美1区2区3区| 日韩精品亚洲一区二区三区免费| 粉嫩在线一区二区三区视频| 欧美日韩一区视频| 国产欧美日韩亚州综合| 亚洲精品国产高清久久伦理二区| 激情六月婷婷综合| 欧美高清精品3d| 亚洲视频小说图片| 国产一区在线观看视频| 欧美日韩一级片在线观看| 国产精品福利av| 国产一区 二区| 欧美人xxxx| 亚洲精品国久久99热| 高潮精品一区videoshd| 日韩一二三四区| 一区二区三区四区精品在线视频| 国产成人无遮挡在线视频| 91精品中文字幕一区二区三区| 亚洲视频在线一区二区| 国产成人av一区| 日韩免费观看高清完整版在线观看 | 亚洲少妇最新在线视频| 国产毛片精品视频| 日韩视频一区在线观看| 日日夜夜免费精品视频| 欧美色图在线观看| 亚洲免费av在线| av不卡在线观看| 欧美韩国日本一区| 国产精品66部| 亚洲精品一区二区三区影院| 日本 国产 欧美色综合| 欧美美女一区二区在线观看| 一区二区三区自拍| 一本色道久久综合狠狠躁的推荐| 国产精品毛片无遮挡高清| 国产电影精品久久禁18| 久久精品综合网| 国产精品1024| 久久久99精品免费观看| 国产一区999| 久久精品视频一区| 国产一区不卡在线| 久久久久成人黄色影片| 国产精品一区二区三区四区| 日韩一级完整毛片| 激情图区综合网| 久久影音资源网| 国产东北露脸精品视频| 国产片一区二区三区| 久久国产精品区| 精品国一区二区三区| 国产一区二区三区高清播放| 国产三级精品三级| 丁香婷婷综合激情五月色| 日韩一区二区精品在线观看| 五月天中文字幕一区二区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 亚洲精品中文在线| 在线精品视频免费观看| 亚洲一二三四在线| 欧美一二三区在线| 国产麻豆精品在线观看| 国产日产精品1区| 成人av片在线观看| 又紧又大又爽精品一区二区| 欧美系列亚洲系列| 久久国产成人午夜av影院| 久久久无码精品亚洲日韩按摩| 成人网在线播放| 亚洲影院理伦片| 欧美xxxx老人做受| 国产**成人网毛片九色 | 亚洲免费观看高清| 91精品国产综合久久婷婷香蕉| 麻豆国产一区二区| 国产精品天干天干在观线| 91欧美一区二区| 天堂午夜影视日韩欧美一区二区| 精品嫩草影院久久| 91欧美一区二区| 日本成人在线不卡视频| 国产欧美日韩不卡免费| 91国产精品成人| 免费亚洲电影在线| 国产精品欧美久久久久无广告| 欧美婷婷六月丁香综合色| 琪琪一区二区三区| 久久久精品欧美丰满| 欧美视频一区二区三区在线观看| 蜜桃久久久久久| 中文字幕中文字幕一区二区| 欧美日韩亚洲丝袜制服| 久久99精品久久久久久动态图 | 国产精品久久久久aaaa樱花| 欧美三级电影网站| 粉嫩av亚洲一区二区图片| 婷婷亚洲久悠悠色悠在线播放 | 日韩精品成人一区二区三区| 国产色一区二区| 欧美无乱码久久久免费午夜一区| 国产专区欧美精品| 亚洲地区一二三色| 国产亚洲欧美在线| 欧洲亚洲精品在线| 成人少妇影院yyyy| 亚洲chinese男男1069| 国产精品久久久久久久久搜平片| 91精品国产全国免费观看| av亚洲精华国产精华精华| 免费人成黄页网站在线一区二区| 亚洲蜜臀av乱码久久精品| 久久看人人爽人人| 欧美日韩国产a| 日本精品视频一区二区| 国产+成+人+亚洲欧洲自线| 久久成人18免费观看| 午夜欧美在线一二页| 亚洲欧洲日本在线| 国产欧美一区二区三区沐欲| 日韩一区二区在线观看视频| 欧美在线色视频| 粉嫩嫩av羞羞动漫久久久| 久久福利资源站| 性欧美大战久久久久久久久| 亚洲精品久久久久久国产精华液| 国产免费观看久久| 精品1区2区在线观看| 欧美高清激情brazzers| 欧美日韩一区不卡| 成人激情小说乱人伦| 九九**精品视频免费播放| 亚洲 欧美综合在线网络| 亚洲自拍欧美精品| 亚洲一区精品在线| 亚洲美女屁股眼交| 综合在线观看色| 中文字幕不卡一区| 欧美经典三级视频一区二区三区| 久久奇米777| 久久久精品国产免费观看同学| 日韩欧美色电影|