本文整理汇总了C++中CSLSetNameValue函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLSetNameValue函数的具体用法?C++ CSLSetNameValue怎么用?C++ CSLSetNameValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CSLSetNameValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: CSLAddNameValue
OGRLayer *GNMGenericNetwork::CopyLayer(OGRLayer *poSrcLayer,
const char *pszNewName, char **papszOptions)
{
if(CSLFindName(papszOptions, "DST_SRSWKT") == -1)
{
papszOptions = CSLAddNameValue(papszOptions, "DST_SRSWKT",
GetProjectionRef());
}
else
{
papszOptions = CSLSetNameValue(papszOptions, "DST_SRSWKT",
GetProjectionRef());
}
return GDALDataset::CopyLayer(poSrcLayer, pszNewName, papszOptions);
}
示例3: CPLFree
OGRPLScenesDataV1Dataset::~OGRPLScenesDataV1Dataset()
{
for( int i = 0; i < m_nLayers; i++ )
delete m_papoLayers[i];
CPLFree(m_papoLayers);
if( m_bMustCleanPersistent )
{
char **papszOptions =
CSLSetNameValue(
nullptr, "CLOSE_PERSISTENT", CPLSPrintf("PLSCENES:%p", this));
CPLHTTPDestroyResult(CPLHTTPFetch(m_osBaseURL, papszOptions));
CSLDestroy(papszOptions);
}
}
示例4: CSLSetNameValue
void CCreateMapFineTune::slotSave()
{
IMap& map = CMapDB::self().getMap();
GDALDataset * srcds = map.getDataset();
if(srcds == 0)
{
return;
}
double adfGeoTransform[6];
double u1, v1, u2, v2;
map.dimensions(u1, v1, u2, v2);
map.convertRad2M(u1, v1);
map.convertRad2M(u2, v2);
srcds->GetGeoTransform( adfGeoTransform );
adfGeoTransform[0] = u1;
adfGeoTransform[3] = v1;
progressBar->show();
GDALDriver * driver = srcds->GetDriver();
char **papszOptions = NULL;
papszOptions = CSLSetNameValue( papszOptions, "TILED", "YES" );
papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", "DEFLATE" );
GDALDataset * dstds = driver->CreateCopy(labelOutfile->text().toLocal8Bit(), srcds, false, papszOptions, ProgressFunc, this);
if(dstds)
{
dstds->SetGeoTransform( adfGeoTransform );
GDALClose(dstds);
}
CSLDestroy( papszOptions );
progressBar->hide();
}
示例5: CPLFree
OGRCouchDBDataSource::~OGRCouchDBDataSource()
{
for( int i = 0; i < nLayers; i++ )
delete papoLayers[i];
CPLFree( papoLayers );
if( bMustCleanPersistent )
{
char** papszOptions = NULL;
papszOptions = CSLSetNameValue(papszOptions, "CLOSE_PERSISTENT", CPLSPrintf("CouchDB:%p", this));
CPLHTTPDestroyResult( CPLHTTPFetch( osURL, papszOptions ) );
CSLDestroy(papszOptions);
}
CPLFree( pszName );
}
示例6: CPLFree
OGRGFTDataSource::~OGRGFTDataSource()
{
for( int i = 0; i < nLayers; i++ )
delete papoLayers[i];
CPLFree( papoLayers );
if (bMustCleanPersistent)
{
char** papszOptions = nullptr;
papszOptions = CSLSetNameValue(papszOptions, "CLOSE_PERSISTENT", CPLSPrintf("GFT:%p", this));
CPLHTTPDestroyResult( CPLHTTPFetch( GetAPIURL(), papszOptions) );
CSLDestroy(papszOptions);
}
CPLFree( pszName );
}
示例7: snprintf
void PAuxRasterBand::SetDescription( const char *pszNewDescription )
{
if( GetAccess() == GA_Update )
{
char szTarget[128];
snprintf( szTarget, sizeof(szTarget), "ChanDesc-%d", nBand );
PAuxDataset *poPDS = reinterpret_cast<PAuxDataset *>( poDS );
poPDS->papszAuxLines =
CSLSetNameValue( poPDS->papszAuxLines,
szTarget, pszNewDescription );
poPDS->bAuxUpdated = TRUE;
}
GDALRasterBand::SetDescription( pszNewDescription );
}
示例8: CPLFree
OGRCARTODBDataSource::~OGRCARTODBDataSource()
{
for( int i = 0; i < nLayers; i++ )
delete papoLayers[i];
CPLFree( papoLayers );
if (bMustCleanPersistant)
{
char** papszOptions = NULL;
papszOptions = CSLSetNameValue(papszOptions, "CLOSE_PERSISTENT", CPLSPrintf("CARTODB:%p", this));
CPLHTTPFetch( GetAPIURL(), papszOptions);
CSLDestroy(papszOptions);
}
CPLFree( pszName );
CPLFree( pszAccount );
}
示例9: CPLFree
OGRAmigoCloudDataSource::~OGRAmigoCloudDataSource()
{
for( int i = 0; i < nLayers; i++ )
delete papoLayers[i];
CPLFree( papoLayers );
if( bMustCleanPersistent )
{
char** papszOptions = NULL;
papszOptions = CSLSetNameValue(papszOptions, "CLOSE_PERSISTENT", CPLSPrintf("AMIGOCLOUD:%p", this));
CPLHTTPDestroyResult( CPLHTTPFetch( GetAPIURL(), papszOptions) );
CSLDestroy(papszOptions);
}
CPLFree( pszName );
CPLFree(pszProjetctId);
}
示例10: makeGeotiff
int
makeGeotiff (struct deminfo *d0, char *outpath,int nodata)
{
GDALAllRegister ();
GDALDataType band_type = GDT_Float32;
int bands = 1;
int dsn_xsize = (d0->highx - d0->lowx + 1);
int dsn_ysize = (d0->highy - d0->lowy + 1);
char **papszCreateOptions = NULL;
papszCreateOptions = CSLSetNameValue (papszCreateOptions, "PROFILE", "GeoTIFF");
//papszCreateOptions = CSLSetNameValue( papszCreateOptions, "TFW", "YES" );
//papszCreateOptions = CSLSetNameValue (papszCreateOptions, "INTERLEAVE", "PIXEL");
//papszCreateOptions = CSLSetNameValue (papszCreateOptions, "TILED", "YES");
//papszCreateOptions = CSLSetNameValue (papszCreateOptions, "COMPRESS", "LZW");
GDALDriverH hDriver = GDALGetDriverByName ("GTiff");
GDALDatasetH hDsnDS = GDALCreate (hDriver, outpath, dsn_xsize, dsn_ysize, bands, band_type, papszCreateOptions);
double dsnGeoTransform[6];
dsnGeoTransform[0] = d0->W;
dsnGeoTransform[1] = (d0->E - d0->W) / dsn_xsize;
dsnGeoTransform[2] = 0;
dsnGeoTransform[3] = d0->N;
dsnGeoTransform[4] = 0;
dsnGeoTransform[5] = -1.0 * (d0->N - d0->S) / dsn_ysize;
GDALSetGeoTransform (hDsnDS, dsnGeoTransform);
char pszSRS_WKT[1024] = "GEOGCS[\"JGD2000\", DATUM[\"Japanese Geodetic Datum 2000\", SPHEROID[\"GRS 1980\", 6378137.0, 298.257222101, AUTHORITY[\"EPSG\",\"7019\"]], TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],AUTHORITY[\"EPSG\",\"6612\"]], PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]], UNIT[\"degree\", 0.017453292519943295], AXIS[\"Geodetic longitude\", EAST], AXIS[\"Geodetic latitude\", NORTH], AUTHORITY[\"EPSG\",\"4612\"]]";
GDALSetProjection (hDsnDS, pszSRS_WKT);
GDALRasterBandH t_band = GDALGetRasterBand (hDsnDS, 1);
if(nodata==1){
GDALSetRasterNoDataValue (t_band, -9999);
}
GDALRasterIO (t_band, GF_Write, 0, 0, dsn_xsize, dsn_ysize, d0->alti, dsn_xsize, dsn_ysize, band_type, 0, 0);
CSLDestroy (papszCreateOptions);
GDALClose (hDsnDS);
return 0;
}
示例11: sprintf
void PAuxRasterBand::SetDescription( const char *pszNewDescription )
{
PAuxDataset *poPDS = (PAuxDataset *) poDS;
if( GetAccess() == GA_Update )
{
char szTarget[128];
sprintf( szTarget, "ChanDesc-%d", nBand );
poPDS->papszAuxLines =
CSLSetNameValue( poPDS->papszAuxLines,
szTarget, pszNewDescription );
poPDS->bAuxUpdated = TRUE;
}
GDALRasterBand::SetDescription( pszNewDescription );
}
示例12: CSLSetNameValue
std::string Polygon::json(double precision) const
{
std::ostringstream prec;
prec << precision;
char **papszOptions = NULL;
papszOptions = CSLSetNameValue(papszOptions, "COORDINATE_PRECISION",
prec.str().c_str() );
std::string w(wkt());
gdal::SpatialRef srs(m_srs.getWKT(pdal::SpatialReference::eCompoundOK));
gdal::Geometry g(w, srs);
char* json = OGR_G_ExportToJsonEx(g.get(), papszOptions);
std::string output(json);
OGRFree(json);
return output;
}
示例13: CSLSetNameValue
int VICARKeywordHandler::ReadGroup( CPL_UNUSED const char *pszPathPrefix ) {
CPLString osName, osValue, osProperty;
for( ; true; ) {
if( !ReadPair( osName, osValue ) )
return FALSE;
if( EQUAL(osName,"END") )
return TRUE;
if( EQUAL(osName,"PROPERTY") || EQUAL(osName,"HISTORY") || EQUAL(osName,"TASK"))
osProperty = osValue;
else {
if ( !EQUAL(osProperty,"") )
osName = osProperty + "." + osName;
papszKeywordList = CSLSetNameValue( papszKeywordList, osName, osValue );
}
}
}
示例14: JakoGDALMemAddBand
static dErr JakoGDALMemAddBand(GDALDatasetH dset,GDALDataType dtype,void *memory)
{
char buf[256] = {0},**bandoptions = NULL;
int bytes,nx,ny;
CPLErr cplerr;
dErr err;
dFunctionBegin;
bytes = GDALGetDataTypeSize(dtype);
nx = GDALGetRasterXSize(dset);
ny = GDALGetRasterYSize(dset);
err = dMalloc(nx*ny*bytes,(void**)memory);dCHK(err);
// This is where the API moves from merely cumbersome to outright demeaning, like some twisted hazing ritual.
CPLPrintPointer(buf,*(void**)memory,sizeof(buf));
bandoptions = CSLSetNameValue(bandoptions,"DATAPOINTER",buf);
cplerr = GDALAddBand(dset,dtype,bandoptions);dCPLCHK(cplerr);
CSLDestroy(bandoptions);
dFunctionReturn(0);
}
示例15: CSLSetNameValue
// set a single metadata item
CPLErr KEADataset::SetMetadataItem(const char *pszName, const char *pszValue, const char *pszDomain)
{
// only deal with 'default' domain - no geolocation etc
if( ( pszDomain != NULL ) && ( *pszDomain != '\0' ) )
return CE_Failure;
try
{
this->m_pImageIO->setImageMetaData(pszName, pszValue );
// CSLSetNameValue will update if already there
m_papszMetadataList = CSLSetNameValue( m_papszMetadataList, pszName, pszValue );
return CE_None;
}
catch (kealib::KEAIOException &e)
{
CPLError( CE_Failure, CPLE_AppDefined,
"Unable to write metadata: %s", e.what() );
return CE_Failure;
}
}