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

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

?? ogr2gmlgeometry.cpp

?? mitab,讀取MapInfo的地圖文件
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/******************************************************************************
 * $Id: ogr2gmlgeometry.cpp 10646 2007-01-18 02:38:10Z warmerdam $
 *
 * Project:  GML Translator
 * Purpose:  Code to translate OGRGeometry to GML string representation.
 * Author:   Frank Warmerdam, warmerdam@pobox.com
 *
 ******************************************************************************
 * Copyright (c) 2002, Frank Warmerdam <warmerdam@pobox.com>
 *
 * 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.
 *****************************************************************************
 *
 * Independent Security Audit 2003/04/17 Andrey Kiselev:
 *   Completed audit of this module. All functions may be used without buffer
 *   overflows and stack corruptions if caller could be trusted.
 *
 * Security Audit 2003/03/28 warmerda:
 *   Completed security audit.  I believe that this module may be safely used 
 *   to generate GML from arbitrary but well formed OGRGeomety objects that
 *   come from a potentially hostile source, but through a trusted OGR importer
 *   without compromising the system.
 *
 */

#include "cpl_minixml.h"
#include "ogr_geometry.h"
#include "ogr_api.h"
#include "ogr_p.h"
#include "cpl_error.h"
#include "cpl_conv.h"

/************************************************************************/
/*                        MakeGMLCoordinate()                           */
/************************************************************************/

static void MakeGMLCoordinate( char *pszTarget, 
                               double x, double y, double z, int b3D )

{
    OGRMakeWktCoordinate( pszTarget, x, y, z, b3D ? 3 : 2 );
    while( *pszTarget != '\0' )
    {
        if( *pszTarget == ' ' )
            *pszTarget = ',';
        pszTarget++;
    }

#ifdef notdef
    if( !b3D )
    {
        if( x == (int) x && y == (int) y )
            sprintf( pszTarget, "%d,%d", (int) x, (int) y );
        else if( fabs(x) < 370 && fabs(y) < 370 )
            sprintf( pszTarget, "%.16g,%.16g", x, y );
        else if( fabs(x) > 100000000.0 || fabs(y) > 100000000.0 )
            sprintf( pszTarget, "%.16g,%.16g", x, y );
        else
            sprintf( pszTarget, "%.3f,%.3f", x, y );
    }
    else
    {
        if( x == (int) x && y == (int) y && z == (int) z )
            sprintf( pszTarget, "%d,%d,%d", (int) x, (int) y, (int) z );
        else if( fabs(x) < 370 && fabs(y) < 370 )
            sprintf( pszTarget, "%.16g,%.16g,%.16g", x, y, z );
        else if( fabs(x) > 100000000.0 || fabs(y) > 100000000.0 
                 || fabs(z) > 100000000.0 )
            sprintf( pszTarget, "%.16g,%.16g,%.16g", x, y, z );
        else
            sprintf( pszTarget, "%.3f,%.3f,%.3f", x, y, z );
    }
#endif
}

/************************************************************************/
/*                            _GrowBuffer()                             */
/************************************************************************/

static void _GrowBuffer( int nNeeded, char **ppszText, int *pnMaxLength )

{
    if( nNeeded+1 >= *pnMaxLength )
    {
        *pnMaxLength = MAX(*pnMaxLength * 2,nNeeded+1);
        *ppszText = (char *) CPLRealloc(*ppszText, *pnMaxLength);
    }
}

/************************************************************************/
/*                            AppendString()                            */
/************************************************************************/

static void AppendString( char **ppszText, int *pnLength, int *pnMaxLength,
                          const char *pszTextToAppend )

{
    _GrowBuffer( *pnLength + strlen(pszTextToAppend) + 1, 
                 ppszText, pnMaxLength );

    strcat( *ppszText + *pnLength, pszTextToAppend );
    *pnLength += strlen( *ppszText + *pnLength );
}


/************************************************************************/
/*                        AppendCoordinateList()                        */
/************************************************************************/

static void AppendCoordinateList( OGRLineString *poLine, 
                                  char **ppszText, int *pnLength, 
                                  int *pnMaxLength )

{
    char        szCoordinate[256];
    int         b3D = (poLine->getGeometryType() & wkb25DBit);

    *pnLength += strlen(*ppszText + *pnLength);
    _GrowBuffer( *pnLength + 20, ppszText, pnMaxLength );

    strcat( *ppszText + *pnLength, "<gml:coordinates>" );
    *pnLength += strlen(*ppszText + *pnLength);

    
    for( int iPoint = 0; iPoint < poLine->getNumPoints(); iPoint++ )
    {
        MakeGMLCoordinate( szCoordinate, 
                           poLine->getX(iPoint),
                           poLine->getY(iPoint),
                           poLine->getZ(iPoint),
                           b3D );
        _GrowBuffer( *pnLength + strlen(szCoordinate)+1, 
                     ppszText, pnMaxLength );

        if( iPoint != 0 )
            strcat( *ppszText + *pnLength, " " );
            
        strcat( *ppszText + *pnLength, szCoordinate );
        *pnLength += strlen(*ppszText + *pnLength);
    }
    
    _GrowBuffer( *pnLength + 20, ppszText, pnMaxLength );
    strcat( *ppszText + *pnLength, "</gml:coordinates>" );
    *pnLength += strlen(*ppszText + *pnLength);
}

/************************************************************************/
/*                       OGR2GMLGeometryAppend()                        */
/************************************************************************/

static int OGR2GMLGeometryAppend( OGRGeometry *poGeometry, 
                                  char **ppszText, int *pnLength, 
                                  int *pnMaxLength )

{

/* -------------------------------------------------------------------- */
/*      Check for Spatial Reference System attached to given geometry   */
/* -------------------------------------------------------------------- */

    // Buffer for srsName attribute (srsName="...")
    char szSrsName[30] = { 0 }; 
    int nSrsNameLength = 0;
    OGRBoolean bAddSrsName = FALSE; 

    // Flag used to filter Geometry Collection members that do not
    // need their own srsName attribute.
    static OGRBoolean bIsSubGeometry = FALSE;

    const OGRSpatialReference* poSRS = NULL;
    poSRS = poGeometry->getSpatialReference();

    if( NULL != poSRS && !bIsSubGeometry )
    {
        const char* pszAuthName = NULL;
        const char* pszAuthCode = NULL;
        const char* pszTarget = NULL;

        if (poSRS->IsProjected())
            pszTarget = "PROJCS";
        else
            pszTarget = "GEOGCS";

        pszAuthName = poSRS->GetAuthorityName( pszTarget );
        if( NULL != pszAuthName )
        {
            CPLDebug( "OGR", "Authority Name: %s", pszAuthName );

            if( EQUAL( pszAuthName, "EPSG" ) )
            {
                pszAuthCode = poSRS->GetAuthorityCode( pszTarget );
                if( NULL != pszAuthCode )
                {
                    sprintf( szSrsName, " srsName=\"%s:%s\"",
                            pszAuthName, pszAuthCode );

                    /* Yes, attach srsName attribute per geometry. */
                    bAddSrsName = TRUE; 
                    bIsSubGeometry = FALSE;

                    CPLDebug( "OGR", "  %s", szSrsName );
                }
            }
        }
    }

    /* Include srsName attribute in new buffer allocation. */
    if( bAddSrsName )
    {
        nSrsNameLength = strlen(szSrsName);
    }

/* -------------------------------------------------------------------- */
/*      2D Point                                                        */
/* -------------------------------------------------------------------- */
    if( poGeometry->getGeometryType() == wkbPoint )
    {
        char    szCoordinate[256];
        OGRPoint *poPoint = (OGRPoint *) poGeometry;

        MakeGMLCoordinate( szCoordinate, 
                           poPoint->getX(), poPoint->getY(), 0.0, FALSE );

        _GrowBuffer( *pnLength + strlen(szCoordinate) + 60 + nSrsNameLength, 
                     ppszText, pnMaxLength );

        sprintf( *ppszText + *pnLength, 
                "<gml:Point%s><gml:coordinates>%s</gml:coordinates></gml:Point>",
                 szSrsName, szCoordinate );

        *pnLength += strlen( *ppszText + *pnLength );
    }
/* -------------------------------------------------------------------- */
/*      3D Point                                                        */
/* -------------------------------------------------------------------- */
    else if( poGeometry->getGeometryType() == wkbPoint25D )
    {
        char    szCoordinate[256];
        OGRPoint *poPoint = (OGRPoint *) poGeometry;

        MakeGMLCoordinate( szCoordinate, 
                           poPoint->getX(), poPoint->getY(), poPoint->getZ(), 
                           TRUE );
                           
        _GrowBuffer( *pnLength + strlen(szCoordinate) + 70 + nSrsNameLength, 
                     ppszText, pnMaxLength );

        sprintf( *ppszText + *pnLength, 
                "<gml:Point%s><gml:coordinates>%s</gml:coordinates></gml:Point>",
                 szSrsName, szCoordinate );

        *pnLength += strlen( *ppszText + *pnLength );
    }

/* -------------------------------------------------------------------- */
/*      LineString and LinearRing                                       */
/* -------------------------------------------------------------------- */
    else if( poGeometry->getGeometryType() == wkbLineString 
             || poGeometry->getGeometryType() == wkbLineString25D )
    {
        int bRing = EQUAL(poGeometry->getGeometryName(),"LINEARRING");

        // Buffer for tag name + srsName attribute if set
        const size_t nLineTagLength = 16;
        char* pszLineTagName = NULL;
        pszLineTagName = (char *) CPLMalloc( nLineTagLength + nSrsNameLength + 1 );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费av| 久久综合av免费| 一区二区三区四区中文字幕| eeuss国产一区二区三区| 中文字幕日本不卡| 色综合久久99| 日韩成人精品在线| 精品99999| 成人黄页毛片网站| 亚洲精品精品亚洲| 欧美日韩国产一二三| 美美哒免费高清在线观看视频一区二区| 欧美本精品男人aⅴ天堂| 国产麻豆91精品| 亚洲欧美一区二区久久 | 精品动漫一区二区三区在线观看| 看电视剧不卡顿的网站| 国产亚洲va综合人人澡精品| 色香蕉成人二区免费| 午夜精品久久久| 久久久久久亚洲综合影院红桃| 国产成人av电影在线播放| 亚洲日本成人在线观看| 欧美一区午夜视频在线观看| 成人网男人的天堂| 亚洲成av人片一区二区三区| 久久午夜色播影院免费高清| 91免费观看国产| 狠狠色2019综合网| 亚洲欧洲国产日韩| 日韩欧美一级片| 成人国产精品免费观看动漫| 亚洲最大色网站| 精品国产一区久久| 欧美中文字幕一区二区三区亚洲| 国内久久婷婷综合| 亚洲亚洲精品在线观看| 国产亚洲va综合人人澡精品| 欧美日韩免费视频| www.亚洲在线| 精品一区二区三区在线播放视频 | 久久综合狠狠综合久久激情| 一本到一区二区三区| 国产一区二区三区日韩| 亚洲国产欧美日韩另类综合| 亚洲国产精品av| 亚洲精品一线二线三线无人区| 91视频91自| 国产东北露脸精品视频| 青青青爽久久午夜综合久久午夜| 亚洲免费观看高清完整版在线观看熊 | 亚洲欧美电影一区二区| 精品欧美一区二区久久 | 91免费国产在线| 国产精品亚洲综合一区在线观看| 夜夜亚洲天天久久| 亚洲欧美综合另类在线卡通| 久久综合一区二区| 欧美一二三区在线观看| 欧美精品久久一区| 欧美日韩一级二级| 91久久精品一区二区| 91在线看国产| 成人免费电影视频| 成人小视频在线观看| 国产毛片精品视频| 国产精品一区二区三区乱码| 激情成人午夜视频| 久久精品国产一区二区三| 日韩国产精品大片| 日本伊人精品一区二区三区观看方式| 亚洲宅男天堂在线观看无病毒| 日韩一区在线看| 亚洲图片另类小说| 亚洲精品一二三| 亚洲男人的天堂av| 自拍偷在线精品自拍偷无码专区| 1024成人网色www| 亚洲欧美成人一区二区三区| 亚洲日本青草视频在线怡红院| 成人欧美一区二区三区视频网页| 国产精品天干天干在观线| 国产精品国产三级国产普通话三级 | 久久影院午夜片一区| 精品国产亚洲一区二区三区在线观看| 在线播放日韩导航| 日韩女同互慰一区二区| 精品日本一线二线三线不卡| 精品盗摄一区二区三区| 中日韩av电影| 中文字幕一区二区三区乱码在线| 中文字幕制服丝袜一区二区三区| 亚洲激情校园春色| 婷婷中文字幕综合| 国产真实乱偷精品视频免| 国产传媒日韩欧美成人| 99精品欧美一区二区蜜桃免费| 色94色欧美sute亚洲线路一久| 欧美亚一区二区| 日韩一区二区三区四区| 久久女同性恋中文字幕| 成人欧美一区二区三区小说| 婷婷综合五月天| 国产精品羞羞答答xxdd| 一本久久精品一区二区| 4438x成人网最大色成网站| 精品日韩在线观看| 亚洲男人的天堂一区二区| 五月天婷婷综合| 国产成人在线看| 欧美日韩在线三级| 久久久精品免费观看| 亚洲午夜私人影院| 国产成人午夜高潮毛片| 欧美亚一区二区| 日韩一区在线播放| 香港成人在线视频| 国产高清不卡一区二区| 欧美日韩久久久| 亚洲国产精品99久久久久久久久| 亚洲高清一区二区三区| 国产风韵犹存在线视精品| 欧美片网站yy| 国产精品成人一区二区三区夜夜夜| 亚洲福中文字幕伊人影院| 激情成人午夜视频| 欧美男同性恋视频网站| 国产欧美日韩视频在线观看| 亚洲va欧美va天堂v国产综合| 成人中文字幕合集| 日韩免费看的电影| 一区二区三区蜜桃| thepron国产精品| 精品乱人伦小说| 天涯成人国产亚洲精品一区av| av在线不卡免费看| 欧美不卡一区二区| 日韩国产成人精品| 欧美日韩美女一区二区| 亚洲欧洲日韩一区二区三区| 国产一区中文字幕| 欧美一区二区黄色| 亚洲小说春色综合另类电影| 成人黄色777网| 久久久久久夜精品精品免费| 蜜臀av一区二区在线观看| 欧美日韩精品专区| 亚洲一区二区三区爽爽爽爽爽| 99精品欧美一区二区蜜桃免费| 国产亚洲精品免费| 国产自产v一区二区三区c| 日韩一区二区在线播放| 图片区日韩欧美亚洲| 欧美亚洲综合在线| 亚洲日本一区二区| 91麻豆精品一区二区三区| 欧美国产综合色视频| 国产九色精品成人porny| 欧美成人精品高清在线播放| 免费av网站大全久久| 日韩一区二区三区四区五区六区 | 男女激情视频一区| 欧美精品三级在线观看| 亚洲mv在线观看| 欧美日韩一区二区电影| 亚洲成人你懂的| 欧美日韩1区2区| 青青草视频一区| 精品久久五月天| 久久69国产一区二区蜜臀| 精品日韩99亚洲| 国产精品一品二品| 国产精品亲子乱子伦xxxx裸| 成人动漫av在线| 亚洲乱码精品一二三四区日韩在线| 91在线视频在线| 亚洲国产综合色| 51精品视频一区二区三区| 免费在线视频一区| 久久精品一区二区三区av| 国产成人av电影在线播放| 国产精品另类一区| 91国偷自产一区二区三区观看| 亚洲亚洲精品在线观看| 日韩视频免费直播| 国产成人综合网| 日韩毛片高清在线播放| 欧洲精品一区二区| 欧美a级一区二区| 国产欧美一区二区在线| 99久久免费精品| 天堂va蜜桃一区二区三区| 日韩精品专区在线| 成人黄色一级视频| 亚洲动漫第一页| 精品播放一区二区| 国产成人综合精品三级| 岛国av在线一区| 欧美成人一区二区| 成人国产精品免费观看视频|