当前位置: 首页>>代码示例>>C++>>正文


C++ CPLDestroyXMLNode函数代码示例

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


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

示例1: CPLFree

GMLFeature::~GMLFeature()

{
    CPLFree( m_pszFID );

    int i;
    for( i = 0; i < m_nPropertyCount; i++ )
    {
        int nSubProperties = m_pasProperties[i].nSubProperties;
        if (nSubProperties == 1)
            CPLFree( m_pasProperties[i].aszSubProperties[0] );
        else if (nSubProperties > 1)
        {
            for( int j = 0; j < nSubProperties; j++)
                CPLFree( m_pasProperties[i].papszSubProperties[j] );
            CPLFree( m_pasProperties[i].papszSubProperties );
        }
    }

    if (m_nGeometryCount == 1)
    {
        CPLDestroyXMLNode(m_apsGeometry[0]);
    }
    else if (m_nGeometryCount > 1)
    {
        for(i=0;i<m_nGeometryCount;i++)
            CPLDestroyXMLNode(m_papsGeometry[i]);
        CPLFree(m_papsGeometry);
    }

    CPLFree( m_pasProperties );
    CSLDestroy( m_papszOBProperties );
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:33,代码来源:gmlfeature.cpp

示例2: FlushCache

DIMAPDataset::~DIMAPDataset()

{
    FlushCache();

    CPLDestroyXMLNode( psProduct );

    CPLFree( pszGCPProjection );
    if( nGCPCount > 0 )
    {
        GDALDeinitGCPs( nGCPCount, pasGCPList );
        CPLFree( pasGCPList );
    }

    if( poImageDS != NULL )
        delete poImageDS;

    CSLDestroy(papszXMLDimapMetadata);

/* -------------------------------------------------------------------- */
/*      Disconnect the bands so our destructor doesn't try and          */
/*      delete them since they really belonged to poImageDS.            */
/* -------------------------------------------------------------------- */
    int iBand;
    for( iBand = 0; iBand < GetRasterCount(); iBand++ )
        papoBands[iBand] = NULL;
}
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:27,代码来源:dimapdataset.cpp

示例3: CPLParseXMLFile

/**
 * LoadMetadata()
 */
void GDALMDReaderResursDK1::LoadMetadata()
{
    if(m_bIsMetadataLoad)
        return;

    if (!m_osXMLSourceFilename.empty())
    {
        CPLXMLNode* psNode = CPLParseXMLFile(m_osXMLSourceFilename);

        if(psNode != NULL)
        {
            CPLXMLNode* pMSPRootNode = CPLSearchXMLNode(psNode, "=MSP_ROOT");

            if(pMSPRootNode != NULL)
            {
                m_papszIMDMD = ReadXMLToList(pMSPRootNode, m_papszIMDMD, "MSP_ROOT");
            }
            CPLDestroyXMLNode(psNode);
        }
    }

    m_papszDEFAULTMD = CSLAddNameValue(m_papszDEFAULTMD, MD_NAME_MDTYPE, "MSP");

    m_bIsMetadataLoad = true;

    if(NULL == m_papszIMDMD)
    {
        return;
    }

    //extract imagery metadata
    const char* pszSatId = CSLFetchNameValue(m_papszIMDMD, "MSP_ROOT.cCodeKA");
    if(NULL != pszSatId)
    {
        m_papszIMAGERYMD = CSLAddNameValue(m_papszIMAGERYMD, MD_NAME_SATELLITE,
                                           CPLStripQuotes(pszSatId));
    }


    const char* pszDate = CSLFetchNameValue(m_papszIMDMD,
                                            "MSP_ROOT.Normal.dSceneDate");

    if(NULL != pszDate)
    {
        const char* pszTime = CSLFetchNameValue(m_papszIMDMD,
                                         "MSP_ROOT.Normal.tSceneTime");
        if(NULL == pszTime)
            pszTime = "00:00:00.000000";

        char buffer[80];
        time_t timeMid = GetAcquisitionTimeFromString(CPLSPrintf( "%s %s",
                                                     pszDate, pszTime));
        strftime (buffer, 80, MD_DATETIMEFORMAT, localtime(&timeMid));
        m_papszIMAGERYMD = CSLAddNameValue(m_papszIMAGERYMD,
                                           MD_NAME_ACQDATETIME, buffer);
    }

    m_papszIMAGERYMD = CSLAddNameValue(m_papszIMAGERYMD, MD_NAME_CLOUDCOVER,
                                       MD_CLOUDCOVER_NA);
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:63,代码来源:reader_rdk1.cpp

示例4: OGR_G_CreateFromGML

OGRGeometryH OGR_G_CreateFromGML( const char *pszGML )

{
    if( pszGML == NULL || strlen(pszGML) == 0 )
    {
        CPLError( CE_Failure, CPLE_AppDefined, 
                  "GML Geometry is empty in GML2OGRGeometry()." );
        return NULL;
    }

/* -------------------------------------------------------------------- */
/*      Try to parse the XML snippet using the MiniXML API.  If this    */
/*      fails, we assume the minixml api has already posted a CPL       */
/*      error, and just return NULL.                                    */
/* -------------------------------------------------------------------- */
    CPLXMLNode *psGML = CPLParseXMLString( pszGML );

    if( psGML == NULL )
        return NULL;

/* -------------------------------------------------------------------- */
/*      Convert geometry recursively.                                   */
/* -------------------------------------------------------------------- */
    OGRGeometry *poGeometry;

    poGeometry = GML2OGRGeometry_XMLNode( psGML );

    CPLDestroyXMLNode( psGML );
    
    return (OGRGeometryH) poGeometry;
}
开发者ID:maowang,项目名称:sqlite-ogc,代码行数:31,代码来源:gml2ogrgeometry.cpp

示例5: SetGeometryDirectly

void GMLFeature::SetGeometryDirectly( int nIdx, CPLXMLNode* psGeom )

{
    if( nIdx == 0 && m_nGeometryCount <= 1 )
    {
        SetGeometryDirectly( psGeom );
        return;
    }
    else if( nIdx > 0 && m_nGeometryCount <= 1 )
    {
        m_papsGeometry = (CPLXMLNode **) CPLMalloc(2 * sizeof(CPLXMLNode *));
        m_papsGeometry[0] = m_apsGeometry[0];
        m_papsGeometry[1] = NULL;
        m_apsGeometry[0] = NULL;
    }

    if( nIdx >= m_nGeometryCount )
    {
        m_papsGeometry = (CPLXMLNode **) CPLRealloc(m_papsGeometry,
            (nIdx + 2) * sizeof(CPLXMLNode *));
        for( int i = m_nGeometryCount; i <= nIdx + 1; i++ )
            m_papsGeometry[i] = NULL;
        m_nGeometryCount = nIdx + 1;
    }
    if (m_papsGeometry[nIdx] != NULL)
        CPLDestroyXMLNode(m_papsGeometry[nIdx]);
    m_papsGeometry[nIdx] = psGeom;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:28,代码来源:gmlfeature.cpp

示例6: gv_symbol_manager_save_vector_symbol

int gv_symbol_manager_save_vector_symbol( GvSymbolManager *manager, 
                                          const char *symbol_name, 
                                          const char *new_name )

{
    GvSymbolObj *symbol;

    /* allocate a new symbol object */
    symbol = g_hash_table_lookup( manager->symbol_cache, symbol_name );

    CPLDebug("OpenEV", "save_vector_symbol(%s->%s)", symbol_name, new_name );

    if ( symbol && symbol->type == GV_SYMBOL_VECTOR )
    {
        GvShape     *shape;
        CPLXMLNode  *xml_shape;

        shape = (GvShape *)symbol->buffer;
        xml_shape = gv_shape_to_xml_tree( shape );

        if ( CPLSerializeXMLTreeToFile( xml_shape, new_name ) )
        {
            CPLDestroyXMLNode( xml_shape );
            return TRUE;
        }
    }

    return FALSE;

}
开发者ID:Onjrew,项目名称:OpenEV,代码行数:30,代码来源:gvsymbolmanager.c

示例7: ParseKMLGeometry

static OGRGeometry* ParseKMLGeometry(const char* pszKML)
{
    CPLXMLNode* psXML = CPLParseXMLString(pszKML);
    if (psXML == nullptr)
        return nullptr;

    if (psXML->eType != CXT_Element)
    {
        CPLDestroyXMLNode(psXML);
        return nullptr;
    }

    OGRGeometry* poGeom = ParseKMLGeometry(psXML);

    CPLDestroyXMLNode(psXML);
    return poGeom;
}
开发者ID:koordinates,项目名称:gdal,代码行数:17,代码来源:ogrgftlayer.cpp

示例8: CPLDestroyXMLNode

void GMLFeature::SetGeometryDirectly( CPLXMLNode* psGeom )

{
    if (m_apsGeometry[0] != NULL)
        CPLDestroyXMLNode(m_apsGeometry[0]);
    m_nGeometryCount = 1;
    m_apsGeometry[0] = psGeom;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:gmlfeature.cpp

示例9: 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

示例10: CPLParseXMLFile

/**
 * LoadMetadata()
 */
void GDALMDReaderRapidEye::LoadMetadata()
{
    if(m_bIsMetadataLoad)
        return;

    CPLXMLNode* psNode = CPLParseXMLFile(m_osXMLSourceFilename);

    if(psNode != NULL)
    {
        CPLXMLNode* pRootNode = CPLSearchXMLNode(psNode, "=re:EarthObservation");

        if(pRootNode != NULL)
        {
            m_papszIMDMD = ReadXMLToList(pRootNode->psChild, m_papszIMDMD);
        }
        CPLDestroyXMLNode(psNode);
    }

    m_papszDEFAULTMD = CSLAddNameValue(m_papszDEFAULTMD, MD_NAME_MDTYPE, "RE");

    m_bIsMetadataLoad = true;

    if(NULL == m_papszIMDMD)
    {
        return;
    }

    //extract imagery metadata
    const char* pszSatId = CSLFetchNameValue(m_papszIMDMD,
    "gml:using.eop:EarthObservationEquipment.eop:platform.eop:Platform.eop:serialIdentifier");
    if(NULL != pszSatId)
    {
        m_papszIMAGERYMD = CSLAddNameValue(m_papszIMAGERYMD,
                                MD_NAME_SATELLITE, CPLStripQuotes(pszSatId));
    }

    const char* pszDateTime = CSLFetchNameValue(m_papszIMDMD,
    "gml:using.eop:EarthObservationEquipment.eop:acquisitionParameters.re:Acquisition.re:acquisitionDateTime");
    if(NULL != pszDateTime)
    {
        char buffer[80];
        time_t timeMid = GetAcquisitionTimeFromString(pszDateTime);
        strftime (buffer, 80, MD_DATETIMEFORMAT, localtime(&timeMid));
        m_papszIMAGERYMD = CSLAddNameValue(m_papszIMAGERYMD,
                                           MD_NAME_ACQDATETIME, buffer);
    }

    const char* pszCC = CSLFetchNameValue(m_papszIMDMD,
    "gml:resultOf.re:EarthObservationResult.opt:cloudCoverPercentage");
    if(NULL != pszSatId)
    {
        m_papszIMAGERYMD = CSLAddNameValue(m_papszIMAGERYMD,
                                MD_NAME_CLOUDCOVER, pszCC);
    }

}
开发者ID:drownedout,项目名称:datamap,代码行数:59,代码来源:reader_rapid_eye.cpp

示例11: Unlock

OGRFMECacheIndex::~OGRFMECacheIndex()

{
    if( psTree != NULL )
    {
        Unlock();
        CPLDestroyXMLNode( psTree );
        psTree = NULL;
    }       
    CPLFree( pszPath );
}
开发者ID:0004c,项目名称:node-gdal,代码行数:11,代码来源:ogrfmecacheindex.cpp

示例12: strlen

GDALDataset *ECRGTOCDataset::Open( GDALOpenInfo * poOpenInfo )

{
    const char *pszFilename = poOpenInfo->pszFilename;
    CPLString osProduct, osDiscId;

    if( !Identify( poOpenInfo ) )
        return NULL;

    if( EQUALN(pszFilename, "ECRG_TOC_ENTRY:",strlen("ECRG_TOC_ENTRY:")))
    {
        pszFilename += strlen("ECRG_TOC_ENTRY:");
        osProduct = pszFilename;
        size_t iPos = osProduct.find(":");
        if (iPos == std::string::npos)
            return NULL;
        osProduct.resize(iPos);

        pszFilename += iPos + 1;
        osDiscId = pszFilename;
        iPos = osDiscId.find(":");
        if (iPos == std::string::npos)
            return NULL;
        osDiscId.resize(iPos);

        pszFilename += iPos + 1;
    }

/* -------------------------------------------------------------------- */
/*      Parse the XML file                                              */
/* -------------------------------------------------------------------- */
    CPLXMLNode* psXML = CPLParseXMLFile(pszFilename);
    if (psXML == NULL)
    {
        return NULL;
    }

    GDALDataset* poDS = Build( pszFilename, psXML, osProduct, osDiscId,
                               poOpenInfo->pszFilename);
    CPLDestroyXMLNode(psXML);

    if (poDS && poOpenInfo->eAccess == GA_Update)
    {
        CPLError(CE_Failure, CPLE_NotSupported,
                 "ECRGTOC driver does not support update mode");
        delete poDS;
        return NULL;
    }

    return poDS;
}
开发者ID:drownedout,项目名称:datamap,代码行数:51,代码来源:ecrgtocdataset.cpp

示例13: CPLFree

OGRVRTDataSource::~OGRVRTDataSource()

{
    CPLFree(pszName);

    OGRVRTDataSource::CloseDependentDatasets();

    CPLFree(paeLayerType);

    if( psTree != nullptr)
        CPLDestroyXMLNode(psTree);

    delete poLayerPool;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:14,代码来源:ogrvrtdatasource.cpp

示例14: 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

示例15: CPLFree

VRTRasterBand::~VRTRasterBand()

{
    CPLFree( pszUnitType );

    if( poColorTable != NULL )
        delete poColorTable;

    CSLDestroy( papszCategoryNames );
    if( psSavedHistograms != NULL )
        CPLDestroyXMLNode( psSavedHistograms );

    delete poMaskBand;
}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:14,代码来源:vrtrasterband.cpp


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