本文整理汇总了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 );
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例8: CPLDestroyXMLNode
void GMLFeature::SetGeometryDirectly( CPLXMLNode* psGeom )
{
if (m_apsGeometry[0] != NULL)
CPLDestroyXMLNode(m_apsGeometry[0]);
m_nGeometryCount = 1;
m_apsGeometry[0] = psGeom;
}
示例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;
}
示例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);
}
}
示例11: Unlock
OGRFMECacheIndex::~OGRFMECacheIndex()
{
if( psTree != NULL )
{
Unlock();
CPLDestroyXMLNode( psTree );
psTree = NULL;
}
CPLFree( pszPath );
}
示例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;
}
示例13: CPLFree
OGRVRTDataSource::~OGRVRTDataSource()
{
CPLFree(pszName);
OGRVRTDataSource::CloseDependentDatasets();
CPLFree(paeLayerType);
if( psTree != nullptr)
CPLDestroyXMLNode(psTree);
delete poLayerPool;
}
示例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;
}
示例15: CPLFree
VRTRasterBand::~VRTRasterBand()
{
CPLFree( pszUnitType );
if( poColorTable != NULL )
delete poColorTable;
CSLDestroy( papszCategoryNames );
if( psSavedHistograms != NULL )
CPLDestroyXMLNode( psSavedHistograms );
delete poMaskBand;
}