本文整理汇总了C++中CSLDuplicate函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLDuplicate函数的具体用法?C++ CSLDuplicate怎么用?C++ CSLDuplicate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CSLDuplicate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例6: CSLDestroy
CPLErr RawRasterBand::SetCategoryNames( char ** papszNewNames )
{
CSLDestroy( papszCategoryNames );
papszCategoryNames = CSLDuplicate( papszNewNames );
return CE_None;
}
示例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();
}
示例8: CSLDuplicate
int OGRDGNDataSource::PreCreate( const char *pszFilename,
char **papszOptions )
{
this->papszOptions = CSLDuplicate( papszOptions );
pszName = CPLStrdup( pszFilename );
return TRUE;
}
示例9: CSLDestroy
CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames )
{
reinterpret_cast<VRTDataset *>( poDS )->SetNeedsFlush();
CSLDestroy( m_papszCategoryNames );
m_papszCategoryNames = CSLDuplicate( papszNewNames );
return CE_None;
}
示例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);
}
示例11: CSLDestroy
CPLErr VRTRasterBand::SetCategoryNames( char ** papszNewNames )
{
((VRTDataset *) poDS)->SetNeedsFlush();
CSLDestroy( papszCategoryNames );
papszCategoryNames = CSLDuplicate( papszNewNames );
return CE_None;
}
示例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;
}
示例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 );
}
示例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);
}
示例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;
}