• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CPLCreateXMLNode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CPLCreateXMLNode函数的典型用法代码示例。如果您正苦于以下问题:C++ CPLCreateXMLNode函数的具体用法?C++ CPLCreateXMLNode怎么用?C++ CPLCreateXMLNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CPLCreateXMLNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tr_strdup

CPLXMLNode* GMLXercesHandler::AddAttributes(CPLXMLNode* psNode, void* attr)
{
    const Attributes* attrs = (const Attributes*) attr;

    CPLXMLNode* psLastChild = NULL;

    for(unsigned int i=0; i < attrs->getLength(); i++)
    {
        char* pszName = tr_strdup(attrs->getQName(i));
        char* pszValue = tr_strdup(attrs->getValue(i));

        CPLXMLNode* psChild = CPLCreateXMLNode(NULL, CXT_Attribute, pszName);
        CPLCreateXMLNode(psChild, CXT_Text, pszValue);

        CPLFree(pszName);
        CPLFree(pszValue);

        if (psLastChild == NULL)
            psNode->psChild = psChild;
        else
            psLastChild->psNext = psChild;
        psLastChild = psChild;
    }

    return psLastChild;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:26,代码来源:gmlhandler.cpp


示例2: VALIDATE_POINTER1

CPLXMLNode *GDALSerializeTPSTransformer( void *pTransformArg )

{
    VALIDATE_POINTER1( pTransformArg, "GDALSerializeTPSTransformer", NULL );

    CPLXMLNode *psTree;
    TPSTransformInfo *psInfo = static_cast<TPSTransformInfo *>(pTransformArg);

    psTree = CPLCreateXMLNode( NULL, CXT_Element, "TPSTransformer" );

/* -------------------------------------------------------------------- */
/*      Serialize bReversed.                                            */
/* -------------------------------------------------------------------- */
    CPLCreateXMLElementAndValue( 
        psTree, "Reversed", 
        CPLString().Printf( "%d", psInfo->bReversed ) );
                                 
/* -------------------------------------------------------------------- */
/*	Attach GCP List. 						*/
/* -------------------------------------------------------------------- */
    if( psInfo->nGCPCount > 0 )
    {
        int iGCP;
        CPLXMLNode *psGCPList = CPLCreateXMLNode( psTree, CXT_Element, 
                                                  "GCPList" );

        for( iGCP = 0; iGCP < psInfo->nGCPCount; iGCP++ )
        {
            CPLXMLNode *psXMLGCP;
            GDAL_GCP *psGCP = psInfo->pasGCPList + iGCP;

            psXMLGCP = CPLCreateXMLNode( psGCPList, CXT_Element, "GCP" );

            CPLSetXMLValue( psXMLGCP, "#Id", psGCP->pszId );

            if( psGCP->pszInfo != NULL && strlen(psGCP->pszInfo) > 0 )
                CPLSetXMLValue( psXMLGCP, "Info", psGCP->pszInfo );

            CPLSetXMLValue( psXMLGCP, "#Pixel", 
                            CPLString().Printf( "%.4f", psGCP->dfGCPPixel ) );

            CPLSetXMLValue( psXMLGCP, "#Line", 
                            CPLString().Printf( "%.4f", psGCP->dfGCPLine ) );

            CPLSetXMLValue( psXMLGCP, "#X", 
                            CPLString().Printf( "%.12E", psGCP->dfGCPX ) );

            CPLSetXMLValue( psXMLGCP, "#Y", 
                            CPLString().Printf( "%.12E", psGCP->dfGCPY ) );

            if( psGCP->dfGCPZ != 0.0 )
                CPLSetXMLValue( psXMLGCP, "#GCPZ", 
                                CPLString().Printf( "%.12E", psGCP->dfGCPZ ) );
        }
    }

    return psTree;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:58,代码来源:gdal_tps.cpp


示例3: OGR_G_ExportEnvelopeToKMLTree

CPLXMLNode* OGR_G_ExportEnvelopeToKMLTree( OGRGeometryH hGeometry )
{
    VALIDATE_POINTER1( hGeometry, "OGR_G_ExportEnvelopeToKMLTree", NULL );

    CPLXMLNode* psBox = NULL;
    CPLXMLNode* psCoord = NULL;
    OGREnvelope sEnvelope;
    char szCoordinate[256] = { 0 };
    char* pszY = NULL;

    memset( &sEnvelope, 0, sizeof(sEnvelope) );
    ((OGRGeometry*)(hGeometry))->getEnvelope( &sEnvelope );

    if( sEnvelope.MinX == 0 && sEnvelope.MaxX == 0
            && sEnvelope.MaxX == 0 && sEnvelope.MaxY == 0 )
    {
        /* there is apparently a special way of representing a null box
           geometry ... we should use it here eventually. */

        return NULL;
    }

    psBox = CPLCreateXMLNode( NULL, CXT_Element, "Box" );

    /* -------------------------------------------------------------------- */
    /*      Add minxy coordinate.                                           */
    /* -------------------------------------------------------------------- */
    psCoord = CPLCreateXMLNode( psBox, CXT_Element, "coord" );

    MakeKMLCoordinate( szCoordinate, sEnvelope.MinX, sEnvelope.MinY, 0.0,
                       FALSE );
    pszY = strstr(szCoordinate,",") + 1;
    pszY[-1] = '\0';

    CPLCreateXMLElementAndValue( psCoord, "X", szCoordinate );
    CPLCreateXMLElementAndValue( psCoord, "Y", pszY );

    /* -------------------------------------------------------------------- */
    /*      Add maxxy coordinate.                                           */
    /* -------------------------------------------------------------------- */
    psCoord = CPLCreateXMLNode( psBox, CXT_Element, "coord" );

    MakeKMLCoordinate( szCoordinate, sEnvelope.MaxX, sEnvelope.MaxY, 0.0,
                       FALSE );
    pszY = strstr(szCoordinate,",") + 1;
    pszY[-1] = '\0';

    CPLCreateXMLElementAndValue( psCoord, "X", szCoordinate );
    CPLCreateXMLElementAndValue( psCoord, "Y", pszY );

    return psBox;
}
开发者ID:drownedout,项目名称:datamap,代码行数:52,代码来源:ogr2kmlgeometry.cpp


示例4: addAuthorityIDBlock

static CPLXMLNode* addAuthorityIDBlock(CPLXMLNode *psTarget,
                                       const char *pszElement,
                                       const char *pszAuthority,
                                       const char *pszObjectType,
                                       int nCode,
                                       const char *pszVersion = "")

{
    char szURN[200];

/* -------------------------------------------------------------------- */
/*      Prepare partial URN without the actual code.                    */
/* -------------------------------------------------------------------- */
    if (pszVersion == NULL)
        pszVersion = "";

    CPLAssert(strlen(pszAuthority) + strlen(pszObjectType) < sizeof(szURN) - 30);

    sprintf(szURN, "urn:ogc:def:%s:%s:%s:",
            pszObjectType, pszAuthority, pszVersion);

/* -------------------------------------------------------------------- */
/*      Prepare the base name, eg. <srsID>.                             */
/* -------------------------------------------------------------------- */
    CPLXMLNode *psElement =
        CPLCreateXMLNode(psTarget, CXT_Element, pszElement);

/* -------------------------------------------------------------------- */
/*      Prepare the name element.                                       */
/* -------------------------------------------------------------------- */
    CPLXMLNode *psName =
        CPLCreateXMLNode(psElement, CXT_Element, "gml:name");

/* -------------------------------------------------------------------- */
/*      Prepare the codespace attribute.                                */
/* -------------------------------------------------------------------- */
    CPLCreateXMLNode(
        CPLCreateXMLNode(psName, CXT_Attribute, "gml:codeSpace"),
        CXT_Text, szURN);

/* -------------------------------------------------------------------- */
/*      Attach code value to name node.                                 */
/* -------------------------------------------------------------------- */
    char szCode[32];
    sprintf(szCode, "%d", nCode);

    CPLCreateXMLNode(psName, CXT_Text, szCode);

    return psElement;
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:50,代码来源:ogr_srs_xml.cpp


示例5: CPLCreateXMLNode

CPLXMLNode *VRTWarpedRasterBand::SerializeToXML( const char *pszVRTPath )

{
    CPLXMLNode *psTree = VRTRasterBand::SerializeToXML( pszVRTPath );

/* -------------------------------------------------------------------- */
/*      Set subclass.                                                   */
/* -------------------------------------------------------------------- */
    CPLCreateXMLNode( 
        CPLCreateXMLNode( psTree, CXT_Attribute, "subClass" ), 
        CXT_Text, "VRTWarpedRasterBand" );

    return psTree;
}
开发者ID:Chaduke,项目名称:bah.mod,代码行数:14,代码来源:vrtwarped.cpp


示例6: CSLFetchNameValue

CPLXMLNode *WCTSAuthId2crsId( char **papszParms, const char *pszName )

{
    const char *pszAuthId = CSLFetchNameValue( papszParms, pszName );
    CPLXMLNode *psCRSId;
    char **papszTokens;

    if( pszAuthId == NULL )
        WCTSEmitServiceException( 
            CPLSPrintf( "%s keyword missing", pszName ) );
    
    papszTokens = CSLTokenizeString2( pszAuthId, ":", 0 );
    if( CSLCount(papszTokens) != 2 )
        WCTSEmitServiceException( 
            CPLSPrintf( "%.500s value corrupt, use 'authority:code'.",
                        pszName ));
    
    psCRSId = CPLCreateXMLNode( NULL, CXT_Element, "crsID" );
    
    CPLCreateXMLElementAndValue( psCRSId, "gml:codeSpace", papszTokens[0]);
    CPLCreateXMLElementAndValue( psCRSId, "gml:code", papszTokens[1] );
    
    CSLDestroy( papszTokens );

    return psCRSId;
}
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:26,代码来源:ogrwcts.cpp


示例7: VALIDATE_POINTER1

CPLXMLNode *GDALSerializeTPSTransformer( void *pTransformArg )

{
    VALIDATE_POINTER1( pTransformArg, "GDALSerializeTPSTransformer", NULL );

    CPLXMLNode *psTree;
    TPSTransformInfo *psInfo = static_cast<TPSTransformInfo *>(pTransformArg);

    psTree = CPLCreateXMLNode( NULL, CXT_Element, "TPSTransformer" );

    /* -------------------------------------------------------------------- */
    /*      Serialize bReversed.                                            */
    /* -------------------------------------------------------------------- */
    CPLCreateXMLElementAndValue(
        psTree, "Reversed",
        CPLString().Printf( "%d", psInfo->bReversed ) );

    /* -------------------------------------------------------------------- */
    /*	Attach GCP List. 						*/
    /* -------------------------------------------------------------------- */
    if( psInfo->nGCPCount > 0 )
    {
        GDALSerializeGCPListToXML( psTree,
                                   psInfo->pasGCPList,
                                   psInfo->nGCPCount,
                                   NULL );
    }

    return psTree;
}
开发者ID:GeospatialDaryl,项目名称:VS2013__00_GDAL_111_x64,代码行数:30,代码来源:gdal_tps.cpp


示例8: PamFindMatchingHistogram

CPLErr VRTRasterBand::GetHistogram( double dfMin, double dfMax,
                                    int nBuckets, GUIntBig * panHistogram,
                                    int bIncludeOutOfRange, int bApproxOK,
                                    GDALProgressFunc pfnProgress,
                                    void *pProgressData )

{
/* -------------------------------------------------------------------- */
/*      Check if we have a matching histogram.                          */
/* -------------------------------------------------------------------- */
    CPLXMLNode *psHistItem = PamFindMatchingHistogram( m_psSavedHistograms,
                                           dfMin, dfMax, nBuckets,
                                           bIncludeOutOfRange, bApproxOK );
    if( psHistItem != NULL )
    {
        GUIntBig *panTempHist = NULL;

        if( PamParseHistogram( psHistItem, &dfMin, &dfMax, &nBuckets,
                               &panTempHist,
                               &bIncludeOutOfRange, &bApproxOK ) )
        {
            memcpy( panHistogram, panTempHist, sizeof(GUIntBig) * nBuckets );
            CPLFree( panTempHist );
            return CE_None;
        }
    }

/* -------------------------------------------------------------------- */
/*      We don't have an existing histogram matching the request, so    */
/*      generate one manually.                                          */
/* -------------------------------------------------------------------- */
    CPLErr eErr = GDALRasterBand::GetHistogram( dfMin, dfMax,
                                         nBuckets, panHistogram,
                                         bIncludeOutOfRange, bApproxOK,
                                         pfnProgress, pProgressData );

/* -------------------------------------------------------------------- */
/*      Save an XML description of this histogram.                      */
/* -------------------------------------------------------------------- */
    if( eErr == CE_None )
    {
        CPLXMLNode *psXMLHist = PamHistogramToXMLTree( dfMin, dfMax, nBuckets,
                                           panHistogram,
                                           bIncludeOutOfRange, bApproxOK );
        if( psXMLHist != NULL )
        {
            reinterpret_cast<VRTDataset *>( poDS )->SetNeedsFlush();

            if( m_psSavedHistograms == NULL )
                m_psSavedHistograms = CPLCreateXMLNode( NULL, CXT_Element,
                                                      "Histograms" );

            CPLAddXMLChild( m_psSavedHistograms, psXMLHist );
        }
    }

    return eErr;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:58,代码来源:vrtrasterband.cpp


示例9: addGMLId

static void addGMLId(CPLXMLNode *psParent)

{
    static void *hGMLIdMutex = NULL;

    CPLMutexHolderD(&hGMLIdMutex);

    CPLXMLNode *psId;
    static int nNextGMLId = 1;
    char       szIdText[40];

    sprintf(szIdText, "ogrcrs%d", nNextGMLId++);

    psId =
        CPLCreateXMLNode(
            CPLCreateXMLNode(psParent, CXT_Attribute, "gml:id"),
            CXT_Text, szIdText);
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:18,代码来源:ogr_srs_xml.cpp


示例10: CPLDestroyXMLNode

int OGRFMECacheIndex::Load()

{
/* -------------------------------------------------------------------- */
/*      Lock the cache index file if not already locked.                */
/* -------------------------------------------------------------------- */
    if( hLock == NULL && !Lock() )
        return FALSE;

    if( psTree != NULL )
    {
        CPLDestroyXMLNode( psTree );
        psTree = NULL;
    }

/* -------------------------------------------------------------------- */
/*      Open the index file.  If we don't get it, we assume it is       */
/*      because it doesn't exist, and we create a "stub" tree in        */
/*      memory.                                                         */
/* -------------------------------------------------------------------- */
    FILE *fpIndex;
    int  nLength;
    char *pszIndexBuffer;

    fpIndex = VSIFOpen( GetPath(), "rb" );
    if( fpIndex == NULL )
    {
        psTree = CPLCreateXMLNode( NULL, CXT_Element, "OGRFMECacheIndex" );
        return TRUE;
    }
    
/* -------------------------------------------------------------------- */
/*      Load the data from the file.                                    */
/* -------------------------------------------------------------------- */
    VSIFSeek( fpIndex, 0, SEEK_END );
    nLength = VSIFTell( fpIndex );
    VSIFSeek( fpIndex, 0, SEEK_SET );

    pszIndexBuffer = (char *) CPLMalloc(nLength+1);
    if( (int) VSIFRead( pszIndexBuffer, 1, nLength, fpIndex ) != nLength )
    {
        CPLError( CE_Failure, CPLE_FileIO, 
                  "Read of %d byte index file failed.", nLength );
        return FALSE;
    }
    VSIFClose( fpIndex );

/* -------------------------------------------------------------------- */
/*      Parse the result into an inmemory XML tree.                     */
/* -------------------------------------------------------------------- */
    pszIndexBuffer[nLength] = '\0';
    psTree = CPLParseXMLString( pszIndexBuffer );

    CPLFree( pszIndexBuffer );
    
    return psTree != NULL;
}
开发者ID:0004c,项目名称:node-gdal,代码行数:57,代码来源:ogrfmecacheindex.cpp


示例11: CPLFree

CPLXMLNode *VRTKernelFilteredSource::SerializeToXML( const char *pszVRTPath )

{
    CPLXMLNode *psSrc = VRTFilteredSource::SerializeToXML( pszVRTPath );

    if( psSrc == nullptr )
        return nullptr;

    CPLFree( psSrc->pszValue );
    psSrc->pszValue = CPLStrdup("KernelFilteredSource" );

    if( m_nKernelSize == 0 )
        return psSrc;

    CPLXMLNode *psKernel = CPLCreateXMLNode( psSrc, CXT_Element, "Kernel" );

    if( m_bNormalized )
        CPLCreateXMLNode(
            CPLCreateXMLNode( psKernel, CXT_Attribute, "normalized" ),
            CXT_Text, "1" );
    else
        CPLCreateXMLNode(
            CPLCreateXMLNode( psKernel, CXT_Attribute, "normalized" ),
            CXT_Text, "0" );

    const int nCoefCount = m_nKernelSize * m_nKernelSize;
    const size_t nBufLen = nCoefCount * 32;
    char *pszKernelCoefs = static_cast<char *>( CPLMalloc(nBufLen) );

    strcpy( pszKernelCoefs, "" );
    for( int iCoef = 0; iCoef < nCoefCount; iCoef++ )
        CPLsnprintf( pszKernelCoefs + strlen(pszKernelCoefs),
                     nBufLen - strlen(pszKernelCoefs),
                     "%.8g ", m_padfKernelCoefs[iCoef] );

    CPLSetXMLValue( psKernel, "Size", CPLSPrintf( "%d", m_nKernelSize ) );
    CPLSetXMLValue( psKernel, "Coefs", pszKernelCoefs );

    CPLFree( pszKernelCoefs );

    return psSrc;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:42,代码来源:vrtfilters.cpp


示例12: CPLFree

CPLXMLNode *VRTKernelFilteredSource::SerializeToXML( const char *pszVRTPath )

{
    CPLXMLNode *psSrc = VRTFilteredSource::SerializeToXML( pszVRTPath );
    CPLXMLNode *psKernel;
    char *pszKernelCoefs;
    int iCoef, nCoefCount = nKernelSize * nKernelSize;

    if( psSrc == NULL )
        return NULL;

    CPLFree( psSrc->pszValue );
    psSrc->pszValue = CPLStrdup("KernelFilteredSource" );

    if( nKernelSize == 0 )
        return psSrc;

    psKernel = CPLCreateXMLNode( psSrc, CXT_Element, "Kernel" );

    if( bNormalized )
        CPLCreateXMLNode( 
            CPLCreateXMLNode( psKernel, CXT_Attribute, "normalized" ), 
            CXT_Text, "1" );
    else
        CPLCreateXMLNode( 
            CPLCreateXMLNode( psKernel, CXT_Attribute, "normalized" ), 
            CXT_Text, "0" );

    pszKernelCoefs = (char *) CPLMalloc(nCoefCount * 32);

    strcpy( pszKernelCoefs, "" );
    for( iCoef = 0; iCoef < nCoefCount; iCoef++ )
        CPLsprintf( pszKernelCoefs + strlen(pszKernelCoefs), 
                 "%.8g ", padfKernelCoefs[iCoef] );
    
    CPLSetXMLValue( psKernel, "Size", CPLSPrintf( "%d", nKernelSize ) );
    CPLSetXMLValue( psKernel, "Coefs", pszKernelCoefs );

    CPLFree( pszKernelCoefs );

    return psSrc;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:42,代码来源:vrtfilters.cpp


示例13: VALIDATE_POINTER1

CPLXMLNode *GDALSerializeGCPTransformer( void *pTransformArg )

{
    CPLXMLNode *psTree = NULL;
    GCPTransformInfo *psInfo = (GCPTransformInfo *) pTransformArg;

    VALIDATE_POINTER1( pTransformArg, "GDALSerializeGCPTransformer", NULL );

    psTree = CPLCreateXMLNode( NULL, CXT_Element, "GCPTransformer" );

/* -------------------------------------------------------------------- */
/*      Serialize Order and bReversed.                                  */
/* -------------------------------------------------------------------- */
    CPLCreateXMLElementAndValue(
        psTree, "Order",
        CPLSPrintf( "%d", psInfo->nOrder ) );

    CPLCreateXMLElementAndValue(
        psTree, "Reversed",
        CPLSPrintf( "%d", psInfo->bReversed ) );

    if( psInfo->bRefine )
    {
        CPLCreateXMLElementAndValue(
            psTree, "Refine",
            CPLSPrintf( "%d", psInfo->bRefine ) );

        CPLCreateXMLElementAndValue(
            psTree, "MinimumGcps",
            CPLSPrintf( "%d", psInfo->nMinimumGcps ) );

        CPLCreateXMLElementAndValue(
            psTree, "Tolerance",
            CPLSPrintf( "%f", psInfo->dfTolerance ) );
    }

/* -------------------------------------------------------------------- */
/*     Attach GCP List.                                                 */
/* -------------------------------------------------------------------- */
    if( psInfo->nGCPCount > 0 )
    {
        if(psInfo->bRefine)
        {
            remove_outliers(psInfo);
        }

        GDALSerializeGCPListToXML( psTree,
                                   psInfo->pasGCPList,
                                   psInfo->nGCPCount,
                                   NULL );
    }

    return psTree;
}
开发者ID:koordinates,项目名称:gdal,代码行数:54,代码来源:gdal_crs.c


示例14: addProjArg

static void addProjArg(const OGRSpatialReference *poSRS, CPLXMLNode *psBase,
                       const char *pszMeasureType, double dfDefault,
                       int nParameterID, const char *pszWKTName)

{
    CPLXMLNode *psNode, *psValue;

    psNode = CPLCreateXMLNode(psBase, CXT_Element, "gml:usesParameterValue");

/* -------------------------------------------------------------------- */
/*      Handle the UOM.                                                 */
/* -------------------------------------------------------------------- */
    const char *pszUOMValue;

    if (EQUAL(pszMeasureType, "Angular"))
        pszUOMValue = "urn:ogc:def:uom:EPSG::9102";
    else
        pszUOMValue = "urn:ogc:def:uom:EPSG::9001";

    psValue = CPLCreateXMLNode(psNode, CXT_Element, "gml:value");

    CPLCreateXMLNode(
        CPLCreateXMLNode(psValue, CXT_Attribute, "gml:uom"),
        CXT_Text, pszUOMValue);

/* -------------------------------------------------------------------- */
/*      Add the parameter value itself.                                 */
/* -------------------------------------------------------------------- */
    double dfParmValue
        = poSRS->GetNormProjParm(pszWKTName, dfDefault, NULL);

    CPLCreateXMLNode(psValue, CXT_Text,
                     CPLString().Printf("%.16g", dfParmValue));

/* -------------------------------------------------------------------- */
/*      Add the valueOfParameter.                                       */
/* -------------------------------------------------------------------- */
    AddValueIDWithURN(psNode, "gml:valueOfParameter", "EPSG", "parameter",
                      nParameterID);
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:40,代码来源:ogr_srs_xml.cpp


示例15: while

CPLXMLNode* GMLExpatHandler::AddAttributes(CPLXMLNode* psNode, void* attr)
{
    const char** papszIter = (const char** )attr;

    CPLXMLNode* psLastChild = NULL;

    while(*papszIter)
    {
        CPLXMLNode* psChild = CPLCreateXMLNode(NULL, CXT_Attribute, papszIter[0]);
        CPLCreateXMLNode(psChild, CXT_Text, papszIter[1]);

        if (psLastChild == NULL)
            psNode->psChild = psChild;
        else
            psLastChild->psNext = psChild;
        psLastChild = psChild;

        papszIter += 2;
    }

    return psLastChild;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:22,代码来源:gmlhandler.cpp


示例16: CPLCreateXMLNode

CPLXMLNode *VRTDerivedRasterBand::SerializeToXML(const char *pszVRTPath)
{
    CPLXMLNode *psTree;

    psTree = VRTSourcedRasterBand::SerializeToXML( pszVRTPath );

/* -------------------------------------------------------------------- */
/*      Set subclass.                                                   */
/* -------------------------------------------------------------------- */
    CPLCreateXMLNode( 
        CPLCreateXMLNode( psTree, CXT_Attribute, "subClass" ), 
        CXT_Text, "VRTDerivedRasterBand" );

    /* ---- Encode DerivedBand-specific fields ---- */
    if( pszFuncName != NULL && strlen(pszFuncName) > 0 )
        CPLSetXMLValue(psTree, "PixelFunctionType", this->pszFuncName);
    if( this->eSourceTransferType != GDT_Unknown)
        CPLSetXMLValue(psTree, "SourceTransferType", 
		       GDALGetDataTypeName(this->eSourceTransferType));

    return psTree;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:22,代码来源:vrtderivedrasterband.cpp


示例17: PamHistogramToXMLTree

CPLXMLNode *
PamHistogramToXMLTree( double dfMin, double dfMax,
                       int nBuckets, GUIntBig * panHistogram,
                       int bIncludeOutOfRange, int bApprox )

{
    char *pszHistCounts;
    int iBucket;
    size_t iHistOffset;
    CPLXMLNode *psXMLHist;
    CPLString oFmt;

    if( nBuckets > (INT_MAX - 10) / 12 )
        return NULL;

    const size_t nLen = 22 * static_cast<size_t>(nBuckets) + 10;
    pszHistCounts = (char *) VSIMalloc(nLen);
    if( pszHistCounts == NULL )
        return NULL;

    psXMLHist = CPLCreateXMLNode( NULL, CXT_Element, "HistItem" );

    CPLSetXMLValue( psXMLHist, "HistMin",
                    oFmt.Printf( "%.16g", dfMin ));
    CPLSetXMLValue( psXMLHist, "HistMax",
                    oFmt.Printf( "%.16g", dfMax ));
    CPLSetXMLValue( psXMLHist, "BucketCount",
                    oFmt.Printf( "%d", nBuckets ));
    CPLSetXMLValue( psXMLHist, "IncludeOutOfRange",
                    oFmt.Printf( "%d", bIncludeOutOfRange ));
    CPLSetXMLValue( psXMLHist, "Approximate",
                    oFmt.Printf( "%d", bApprox ));

    iHistOffset = 0;
    pszHistCounts[0] = '\0';
    for( iBucket = 0; iBucket < nBuckets; iBucket++ )
    {
        snprintf( pszHistCounts + iHistOffset,
                  nLen - iHistOffset,
                  CPL_FRMT_GUIB, panHistogram[iBucket] );
        if( iBucket < nBuckets-1 )
            strcat( pszHistCounts + iHistOffset, "|" );
        iHistOffset += strlen(pszHistCounts+iHistOffset);
    }

    CPLSetXMLValue( psXMLHist, "HistCounts", pszHistCounts );
    CPLFree( pszHistCounts );

    return psXMLHist;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:50,代码来源:gdalpamrasterband.cpp


示例18: PamInitialize

CPLErr GDALPamRasterBand::SetDefaultHistogram( double dfMin, double dfMax, 
                                               int nBuckets, int *panHistogram)

{
    CPLXMLNode *psNode;

    PamInitialize();

    if( psPam == NULL )
        return GDALRasterBand::SetDefaultHistogram( dfMin, dfMax, 
                                                    nBuckets, panHistogram );

/* -------------------------------------------------------------------- */
/*      Do we have a matching histogram we should replace?              */
/* -------------------------------------------------------------------- */
    psNode = PamFindMatchingHistogram( psPam->psSavedHistograms, 
                                       dfMin, dfMax, nBuckets,
                                       TRUE, TRUE );
    if( psNode != NULL )
    {
        /* blow this one away */
        CPLRemoveXMLChild( psPam->psSavedHistograms, psNode );
        CPLDestroyXMLNode( psNode );
    }

/* -------------------------------------------------------------------- */
/*      Translate into a histogram XML tree.                            */
/* -------------------------------------------------------------------- */
    CPLXMLNode *psHistItem;

    psHistItem = PamHistogramToXMLTree( dfMin, dfMax, nBuckets, 
                                        panHistogram, TRUE, FALSE );
    if( psHistItem == NULL )
        return CE_Failure;

/* -------------------------------------------------------------------- */
/*      Insert our new default histogram at the front of the            */
/*      histogram list so that it will be the default histogram.        */
/* -------------------------------------------------------------------- */
    psPam->poParentDS->MarkPamDirty();

    if( psPam->psSavedHistograms == NULL )
        psPam->psSavedHistograms = CPLCreateXMLNode( NULL, CXT_Element,
                                                     "Histograms" );
            
    psHistItem->psNext = psPam->psSavedHistograms->psChild;
    psPam->psSavedHistograms->psChild = psHistItem;
    
    return CE_None;
}
开发者ID:Mofangbao,项目名称:node-gdal,代码行数:50,代码来源:gdalpamrasterband.cpp


示例19: addURN

static void addURN(CPLXMLNode *psTarget,
                   const char *pszAuthority,
                   const char *pszObjectType,
                   int nCode,
                   const char *pszVersion = "")

{
    char szURN[200];

    if (pszVersion == NULL)
        pszVersion = "";

    CPLAssert(strlen(pszAuthority) + strlen(pszObjectType) < sizeof(szURN) - 30);

    sprintf(szURN, "urn:ogc:def:%s:%s:%s:",
            pszObjectType, pszAuthority, pszVersion);

    if (nCode != 0)
        sprintf(szURN + strlen(szURN), "%d", nCode);

    CPLCreateXMLNode(
        CPLCreateXMLNode(psTarget, CXT_Attribute, "xlink:href"),
        CXT_Text, szURN);
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:24,代码来源:ogr_srs_xml.cpp


示例20: AddValueIDWithURN

static CPLXMLNode*
AddValueIDWithURN(CPLXMLNode *psTarget,
                  const char *pszElement,
                  const char *pszAuthority,
                  const char *pszObjectType,
                  int nCode,
                  const char *pszVersion = "")

{
    CPLXMLNode *psElement;

    psElement = CPLCreateXMLNode(psTarget, CXT_Element, pszElement);
    addURN(psElement, pszAuthority, pszObjectType, nCode, pszVersion);

    return psElement;
}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:16,代码来源:ogr_srs_xml.cpp



注:本文中的CPLCreateXMLNode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CPLDebug函数代码示例发布时间:2022-05-30
下一篇:
C++ CPLCalloc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap