本文整理汇总了C++中CSLDuplicate函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLDuplicate函数的具体用法?C++ CSLDuplicate怎么用?C++ CSLDuplicate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CSLDuplicate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CSLDuplicate
HDF5ImageRasterBand::HDF5ImageRasterBand( HDF5ImageDataset *poDS, int nBand,
GDALDataType eType )
{
char **papszMetaGlobal;
this->poDS = poDS;
this->nBand = nBand;
eDataType = eType;
bNoDataSet = FALSE;
dfNoDataValue = -9999;
nBlockXSize = poDS->GetRasterXSize( );
nBlockYSize = 1;
/* -------------------------------------------------------------------- */
/* Take a copy of Global Metadata since I can't pass Raster */
/* variable to Iterate function. */
/* -------------------------------------------------------------------- */
papszMetaGlobal = CSLDuplicate( poDS->papszMetadata );
CSLDestroy( poDS->papszMetadata );
poDS->papszMetadata = NULL;
if( poDS->poH5Objects->nType == H5G_DATASET ) {
poDS->CreateMetadata( poDS->poH5Objects, H5G_DATASET );
}
/* -------------------------------------------------------------------- */
/* Recover Global Metadat and set Band Metadata */
/* -------------------------------------------------------------------- */
SetMetadata( poDS->papszMetadata );
CSLDestroy( poDS->papszMetadata );
poDS->papszMetadata = CSLDuplicate( papszMetaGlobal );
CSLDestroy( papszMetaGlobal );
/* check for chunksize and set it as the blocksize (optimizes read) */
hid_t listid = H5Dget_create_plist(((HDF5ImageDataset * )poDS)->dataset_id);
if (listid>0)
{
if(H5Pget_layout(listid) == H5D_CHUNKED)
{
hsize_t panChunkDims[3];
int nDimSize = H5Pget_chunk(listid, 3, panChunkDims);
nBlockXSize = (int) panChunkDims[nDimSize-1];
nBlockYSize = (int) panChunkDims[nDimSize-2];
}
H5Pclose(listid);
}
}
开发者ID:afarnham,项目名称:gdal,代码行数:50,代码来源:hdf5imagedataset.cpp
示例2: bNoDataSet
HDF5ImageRasterBand::HDF5ImageRasterBand( HDF5ImageDataset *poDSIn, int nBandIn,
GDALDataType eType ) :
bNoDataSet(false),
dfNoDataValue(-9999.0)
{
poDS = poDSIn;
nBand = nBandIn;
eDataType = eType;
nBlockXSize = poDS->GetRasterXSize( );
nBlockYSize = 1;
/* -------------------------------------------------------------------- */
/* Take a copy of Global Metadata since I can't pass Raster */
/* variable to Iterate function. */
/* -------------------------------------------------------------------- */
char **papszMetaGlobal = CSLDuplicate( poDSIn->papszMetadata );
CSLDestroy( poDSIn->papszMetadata );
poDSIn->papszMetadata = NULL;
if( poDSIn->poH5Objects->nType == H5G_DATASET ) {
poDSIn->CreateMetadata( poDSIn->poH5Objects, H5G_DATASET );
}
/* -------------------------------------------------------------------- */
/* Recover Global Metadata and set Band Metadata */
/* -------------------------------------------------------------------- */
SetMetadata( poDSIn->papszMetadata );
CSLDestroy( poDSIn->papszMetadata );
poDSIn->papszMetadata = CSLDuplicate( papszMetaGlobal );
CSLDestroy( papszMetaGlobal );
/* check for chunksize and set it as the blocksize (optimizes read) */
const hid_t listid = H5Dget_create_plist(poDSIn->dataset_id);
if (listid>0)
{
if(H5Pget_layout(listid) == H5D_CHUNKED)
{
hsize_t panChunkDims[3] = {0, 0, 0};
const int nDimSize = H5Pget_chunk(listid, 3, panChunkDims);
CPL_IGNORE_RET_VAL(nDimSize);
CPLAssert(nDimSize == poDSIn->ndims);
nBlockXSize = (int) panChunkDims[poDSIn->GetXIndex()];
nBlockYSize = (int) panChunkDims[poDSIn->GetYIndex()];
}
H5Pclose(listid);
}
}
开发者ID:nextgis-borsch,项目名称:lib_gdal,代码行数:50,代码来源:hdf5imagedataset.cpp
示例3: RGDAL_GetCategoryNames
SEXP
RGDAL_GetCategoryNames(SEXP sxpRasterBand) {
GDALRasterBand *pRasterBand = getGDALRasterPtr(sxpRasterBand);
char **pcCNames = pRasterBand->GetCategoryNames();
if (pcCNames == NULL) return(R_NilValue);
pcCNames = CSLDuplicate(pcCNames);
SEXP sxpCNames;
PROTECT(sxpCNames = allocVector(STRSXP, CSLCount(pcCNames)));
int i;
for (i = 0; i < CSLCount(pcCNames); ++i) {
const char *field = CSLGetField(pcCNames, i);
SET_VECTOR_ELT(sxpCNames, i, mkChar(field));
}
UNPROTECT(1);
return(sxpCNames);
}
开发者ID:jeroenooms,项目名称:rgdal,代码行数:29,代码来源:gdal-bindings.cpp
示例4: CSLFindString
CPLErr GDALMultiDomainMetadata::SetMetadata( char **papszMetadata,
const char *pszDomain )
{
if( pszDomain == NULL )
pszDomain = "";
int iDomain = CSLFindString( papszDomainList, pszDomain );
if( iDomain == -1 )
{
int nDomainCount;
papszDomainList = CSLAddString( papszDomainList, pszDomain );
nDomainCount = CSLCount( papszDomainList );
papoMetadataLists = (CPLStringList **)
CPLRealloc( papoMetadataLists, sizeof(void*)*(nDomainCount+1) );
papoMetadataLists[nDomainCount] = NULL;
papoMetadataLists[nDomainCount-1] = new CPLStringList();
iDomain = nDomainCount-1;
}
papoMetadataLists[iDomain]->Assign( CSLDuplicate( papszMetadata ) );
// we want to mark name/value pair domains as being sorted for fast
// access.
if( !EQUALN(pszDomain,"xml:",4) && !EQUAL(pszDomain, "SUBDATASETS") )
papoMetadataLists[iDomain]->Sort();
return CE_None;
}
开发者ID:drownedout,项目名称:datamap,代码行数:32,代码来源:gdalmultidomainmetadata.cpp
示例5: CPLHTTPInitializeRequest
void CPLHTTPInitializeRequest(CPLHTTPRequest *psRequest, const char *pszURL, const char *const *papszOptions) {
psRequest->pszURL = CPLStrdup(pszURL);
psRequest->papszOptions = CSLDuplicate(const_cast<char **>(papszOptions));
psRequest->nStatus = 0;
psRequest->pszContentType = 0;
psRequest->pszError = 0;
psRequest->pabyData = 0;
psRequest->nDataLen = 0;
psRequest->nDataAlloc = 0;
psRequest->m_curl_handle = 0;
psRequest->m_headers = 0;
psRequest->m_curl_error = 0;
psRequest->m_curl_handle = curl_easy_init();
if (psRequest->m_curl_handle == NULL) {
CPLError(CE_Fatal, CPLE_AppDefined, "CPLHTTPInitializeRequest(): Unable to create CURL handle.");
}
char** papszOptionsDup = CSLDuplicate(const_cast<char **>(psRequest->papszOptions));
/* Set User-Agent */
const char *pszUserAgent = CSLFetchNameValue(papszOptionsDup, "USERAGENT");
if (pszUserAgent == NULL)
papszOptionsDup = CSLAddNameValue(papszOptionsDup, "USERAGENT",
"GDAL WMS driver (http://www.gdal.org/frmt_wms.html)");
/* Set URL */
curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_URL, psRequest->pszURL);
/* Set Headers (copied&pasted from cpl_http.cpp, but unused by callers of CPLHTTPInitializeRequest) .*/
const char *headers = CSLFetchNameValue(const_cast<char **>(psRequest->papszOptions), "HEADERS");
if (headers != NULL) {
psRequest->m_headers = curl_slist_append(psRequest->m_headers, headers);
curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_HTTPHEADER, psRequest->m_headers);
}
curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_WRITEDATA, psRequest);
curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_WRITEFUNCTION, CPLHTTPWriteFunc);
psRequest->m_curl_error = reinterpret_cast<char *>(CPLMalloc(CURL_ERROR_SIZE + 1));
psRequest->m_curl_error[0] = '\0';
curl_easy_setopt(psRequest->m_curl_handle, CURLOPT_ERRORBUFFER, psRequest->m_curl_error);
CPLHTTPSetOptions(psRequest->m_curl_handle, papszOptionsDup);
CSLDestroy(papszOptionsDup);
}
开发者ID:0004c,项目名称:node-gdal,代码行数:47,代码来源:gdalhttp.cpp
示例6: CSLDestroy
CPLErr RawRasterBand::SetCategoryNames( char ** papszNewNames )
{
CSLDestroy( papszCategoryNames );
papszCategoryNames = CSLDuplicate( papszNewNames );
return CE_None;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:8,代码来源:rawdataset.cpp
示例7: CSLDuplicate
OGRWritableDWGLayer::OGRWritableDWGLayer( const char *pszLayerName,
char **papszOptionsIn,
OGRWritableDWGDataSource *poDSIn )
{
poDS = poDSIn;
papszOptions = CSLDuplicate( papszOptionsIn );
pDb = poDS->pDb;
/* -------------------------------------------------------------------- */
/* Create the DWGdirect layer object. */
/* -------------------------------------------------------------------- */
// Add a new layer to the drawing
OdDbLayerTablePtr pLayers;
OdDbLayerTableRecordPtr pLayer;
pLayers = pDb->getLayerTableId().safeOpenObject(OdDb::kForWrite);
pLayer = OdDbLayerTableRecord::createObject();
// Name must be set before a table object is added to a table.
pLayer->setName( pszLayerName );
// Add the object to the table.
hLayerId = pLayers->add(pLayer);
/* -------------------------------------------------------------------- */
/* Check for a layer color. */
/* -------------------------------------------------------------------- */
const char *pszColor = CSLFetchNameValue(papszOptionsIn,"COLOR");
if( pszColor != NULL )
{
char **papszTokens =
CSLTokenizeStringComplex( pszColor, ",", FALSE, FALSE );
if( CSLCount( papszTokens ) != 3 )
{
CPLError( CE_Warning, CPLE_AppDefined,
"COLOR=%s setting not parsable. Should be 'red,green,blue'.",
pszColor );
}
else
{
OdCmColor oColor;
oColor.setRGB( atoi(papszTokens[0]),
atoi(papszTokens[1]),
atoi(papszTokens[2]) );
pLayer->setColor( oColor );
}
}
/* -------------------------------------------------------------------- */
/* Create the starting OGRFeatureDefn. */
/* -------------------------------------------------------------------- */
poFeatureDefn = new OGRFeatureDefn( pszLayerName );
poFeatureDefn->Reference();
}
开发者ID:h4ck3rm1k3,项目名称:gdal_dxfdwg_no_oda,代码行数:58,代码来源:ogrwritabledwglayer.cpp
示例8: CSLDuplicate
int OGRDGNDataSource::PreCreate( const char *pszFilename,
char **papszOptions )
{
this->papszOptions = CSLDuplicate( papszOptions );
pszName = CPLStrdup( pszFilename );
return TRUE;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:9,代码来源:ogrdgndatasource.cpp
示例9: CSLDestroy
CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames )
{
reinterpret_cast<VRTDataset *>( poDS )->SetNeedsFlush();
CSLDestroy( m_papszCategoryNames );
m_papszCategoryNames = CSLDuplicate( papszNewNames );
return CE_None;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:10,代码来源:vrtrasterband.cpp
示例10: CSLDestroy
CPLErr GDALGeorefPamDataset::SetMetadata( char ** papszMetadata,
const char * pszDomain )
{
if( m_bPAMLoaded && (pszDomain == NULL || EQUAL(pszDomain, "")) )
{
CSLDestroy(m_papszMainMD);
m_papszMainMD = CSLDuplicate(papszMetadata);
}
return GDALPamDataset::SetMetadata(papszMetadata, pszDomain);
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:10,代码来源:gdalgeorefpamdataset.cpp
示例11: CSLDestroy
CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames )
{
((VRTDataset *) poDS)->SetNeedsFlush();
CSLDestroy( papszCategoryNames );
papszCategoryNames = CSLDuplicate( papszNewNames );
return CE_None;
}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:10,代码来源:vrtrasterband.cpp
示例12: CSLDestroy
OGRErr OGRUnionLayer::SetIgnoredFields( const char **papszFields )
{
OGRErr eErr = OGRLayer::SetIgnoredFields(papszFields);
if( eErr != OGRERR_NONE )
return eErr;
CSLDestroy(papszIgnoredFields);
papszIgnoredFields = papszFields ? CSLDuplicate((char**)papszFields) : NULL;
return eErr;
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:11,代码来源:ogrunionlayer.cpp
示例13: CSLDestroy
CPLErr VRTDriver::SetMetadata( char **papszMetadata, const char *pszDomain )
{
if( pszDomain && EQUAL(pszDomain,"SourceParsers") )
{
CSLDestroy( papszSourceParsers );
papszSourceParsers = CSLDuplicate( papszMetadata );
return CE_None;
}
return GDALDriver::SetMetadata( papszMetadata, pszDomain );
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:12,代码来源:vrtdriver.cpp
示例14: msContourLayerWhichShapes
int msContourLayerWhichShapes(layerObj *layer, rectObj rect, int isQuery)
{
rectObj newRect;
contourLayerInfo *clinfo = (contourLayerInfo *) layer->layerinfo;
if (layer->debug)
msDebug("Entering msContourLayerWhichShapes().\n");
if (clinfo == NULL) {
msSetError(MS_MISCERR, "Assertion failed: Contour layer not opened!!!",
"msContourLayerWhichShapes()");
return MS_FAILURE;
}
newRect = rect;
#ifdef USE_PROJ
/* if necessary, project the searchrect to source coords */
if (msProjectionsDiffer( &(layer->map->projection), &(layer->projection))) {
if (msProjectRect(&layer->projection, &layer->map->projection, &newRect)
!= MS_SUCCESS ) {
msDebug("msContourLayerWhichShapes(%s): unable to reproject map request rectangle into layer projection, canceling.\n", layer->name);
return MS_FAILURE;
}
}
#endif
/* regenerate the raster io */
msConnPoolRelease(&clinfo->ogrLayer, clinfo->hOGRDS);
msLayerClose(&clinfo->ogrLayer);
/* Open the raster source */
if (msContourLayerReadRaster(layer, newRect) != MS_SUCCESS)
return MS_FAILURE;
/* Generate Contour Dataset */
if (msContourLayerGenerateContour(layer) != MS_SUCCESS)
return MS_FAILURE;
GDALClose(clinfo->hDS);
clinfo->hDS = NULL;
free(clinfo->buffer);
/* Open our virtual ogr layer */
if (msLayerOpen(&clinfo->ogrLayer) != MS_SUCCESS)
return MS_FAILURE;
clinfo->ogrLayer.numitems = layer->numitems;
clinfo->ogrLayer.items = CSLDuplicate(layer->items);
return msLayerWhichShapes(&clinfo->ogrLayer, rect, isQuery);
}
开发者ID:abolfazl-esmaeeli,项目名称:mapserver,代码行数:52,代码来源:mapcontour.c
示例15: PamInitialize
CPLErr GDALPamRasterBand::SetCategoryNames( char ** papszNewNames )
{
PamInitialize();
if( !psPam )
return GDALRasterBand::SetCategoryNames( papszNewNames );
CSLDestroy( psPam->papszCategoryNames );
psPam->papszCategoryNames = CSLDuplicate( papszNewNames );
psPam->poParentDS->MarkPamDirty();
return CE_None;
}
开发者ID:ksshannon,项目名称:gdal,代码行数:13,代码来源:gdalpamrasterband.cpp
示例16: while
// set the metdata as a CSLStringList
CPLErr KEARasterBand::SetMetadata(char **papszMetadata, const char *pszDomain)
{
// only deal with 'default' domain - no geolocation etc
if( ( pszDomain != NULL ) && ( *pszDomain != '\0' ) )
return CE_Failure;
int nIndex = 0;
char *pszName;
const char *pszValue;
try
{
// iterate through each one
while( papszMetadata[nIndex] != NULL )
{
pszName = NULL;
pszValue = CPLParseNameValue( papszMetadata[nIndex], &pszName );
if( pszValue == NULL )
pszValue = "";
if( pszName != NULL )
{
// it is LAYER_TYPE? if so handle seperately
if( EQUAL( pszName, "LAYER_TYPE" ) )
{
if( EQUAL( pszValue, "athematic" ) )
{
this->m_pImageIO->setImageBandLayerType(this->nBand, kealib::kea_continuous );
}
else
{
this->m_pImageIO->setImageBandLayerType(this->nBand, kealib::kea_thematic );
}
}
else
{
// write it into the image
this->m_pImageIO->setImageBandMetaData(this->nBand, pszName, pszValue );
}
CPLFree(pszName);
}
nIndex++;
}
}
catch (kealib::KEAIOException &e)
{
return CE_Failure;
}
// destroy our list and duplicate the one passed in
// and use that as our list from now on
CSLDestroy(m_papszMetadataList);
m_papszMetadataList = CSLDuplicate(papszMetadata);
return CE_None;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:52,代码来源:keaband.cpp
示例17: CPLDebug
GDALOverviewDataset::GDALOverviewDataset(GDALDataset* poMainDS,
int nOvrLevel,
int bThisLevelOnly,
int bOwnDS)
{
this->poMainDS = poMainDS;
this->nOvrLevel = nOvrLevel;
this->bOwnDS = bOwnDS;
this->bThisLevelOnly = bThisLevelOnly;
eAccess = poMainDS->GetAccess();
nRasterXSize = poMainDS->GetRasterBand(1)->GetOverview(nOvrLevel)->GetXSize();
nRasterYSize = poMainDS->GetRasterBand(1)->GetOverview(nOvrLevel)->GetYSize();
poOvrDS = poMainDS->GetRasterBand(1)->GetOverview(nOvrLevel)->GetDataset();
if( poOvrDS != NULL && poOvrDS == poMainDS )
{
CPLDebug("GDAL", "Dataset of overview is the same as the main band. This is not expected");
poOvrDS = NULL;
}
nBands = poMainDS->GetRasterCount();
for(int i=0; i<nBands; i++)
{
SetBand(i+1, new GDALOverviewBand(this, i+1));
}
nGCPCount = 0;
pasGCPList = NULL;
papszMD_RPC = NULL;
papszMD_GEOLOCATION = NULL;
/* We create a fake driver that has the same name as the original */
/* one, but we cannot use the real driver object, so that code */
/* doesn't try to cast the GDALOverviewDataset* as a native dataset */
/* object */
if( poMainDS->GetDriver() != NULL )
{
poDriver = new GDALDriver();
poDriver->SetDescription(poMainDS->GetDriver()->GetDescription());
poDriver->SetMetadata(poMainDS->GetDriver()->GetMetadata());
}
SetDescription( poMainDS->GetDescription() );
CPLDebug( "GDAL", "GDALOverviewDataset(%s, this=%p) creation.",
poMainDS->GetDescription(), this );
papszOpenOptions = CSLDuplicate(poMainDS->GetOpenOptions());
/* Add OVERVIEW_LEVEL if not called from GDALOpenEx() but directly */
papszOpenOptions = CSLSetNameValue(papszOpenOptions, "OVERVIEW_LEVEL",
CPLSPrintf("%d", nOvrLevel));
}
开发者ID:garnertb,项目名称:gdal,代码行数:49,代码来源:gdaloverviewdataset.cpp
示例18: OGRSpatialReference
OGRS57DataSource::OGRS57DataSource(char** papszOpenOptions)
{
nLayers = 0;
papoLayers = NULL;
nModules = 0;
papoModules = NULL;
poClassContentExplorer = NULL;
poWriter = NULL;
pszName = NULL;
poSpatialRef = new OGRSpatialReference();
poSpatialRef->SetWellKnownGeogCS( "WGS84" );
bExtentsSet = FALSE;
/* -------------------------------------------------------------------- */
/* Allow initialization of options from the environment. */
/* -------------------------------------------------------------------- */
if( papszOpenOptions != NULL )
{
papszOptions = CSLDuplicate(papszOpenOptions);
}
else
{
const char *pszOptString = CPLGetConfigOption( "OGR_S57_OPTIONS", NULL );
papszOptions = NULL;
if ( pszOptString )
{
char **papszCurOption;
papszOptions =
CSLTokenizeStringComplex( pszOptString, ",", FALSE, FALSE );
if ( papszOptions && *papszOptions )
{
CPLDebug( "S57", "The following S57 options are being set:" );
papszCurOption = papszOptions;
while( *papszCurOption )
CPLDebug( "S57", " %s", *papszCurOption++ );
}
}
}
}
开发者ID:drownedout,项目名称:datamap,代码行数:48,代码来源:ogrs57datasource.cpp
示例19: RGDAL_GetMetadata
SEXP
RGDAL_GetMetadata(SEXP sxpObj, SEXP sxpDomain) {
void *pGDALObj = getGDALObjPtr(sxpObj);
const char *domain = asString(sxpDomain);
char **metadata = ((GDALMajorObject *)pGDALObj)->GetMetadata(domain);
if (metadata == NULL) return(R_NilValue);
metadata = CSLDuplicate(metadata);
SEXP sxpMetadata, sxpNames;
PROTECT(sxpMetadata = allocVector(VECSXP, CSLCount(metadata)));
PROTECT(sxpNames = allocVector(STRSXP, CSLCount(metadata)));
int i;
for (i = 0; i < CSLCount(metadata); ++i) {
const char *field = CSLGetField(metadata, i);
char *tag = NULL;
const char *value = CPLParseNameValue(field, &tag);
SET_VECTOR_ELT(sxpMetadata, i, value ? mkChar(value) : mkChar(""));
SET_STRING_ELT(sxpNames, i, tag ? mkChar(tag) : mkChar(""));
}
setAttrib(sxpMetadata, R_NamesSymbol, sxpNames);
UNPROTECT(2);
return(sxpMetadata);
}
开发者ID:jeroenooms,项目名称:rgdal,代码行数:41,代码来源:gdal-bindings.cpp
示例20: CPLError
GDALDataset* PDFWritableVectorDataset::Create( const char * pszName,
CPL_UNUSED int nXSize,
CPL_UNUSED int nYSize,
int nBands,
CPL_UNUSED GDALDataType eType,
char ** papszOptions )
{
if( nBands != 0 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"PDFWritableVectorDataset::Create() can only be called with "
"nBands = 0 to create a vector-only PDF");
return NULL;
}
PDFWritableVectorDataset* poDataset = new PDFWritableVectorDataset();
poDataset->SetDescription(pszName);
poDataset->papszOptions = CSLDuplicate(papszOptions);
return poDataset;
}
开发者ID:drownedout,项目名称:datamap,代码行数:21,代码来源:pdfwritabledataset.cpp
注:本文中的CSLDuplicate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论