本文整理汇总了C++中CSLSetNameValue函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLSetNameValue函数的具体用法?C++ CSLSetNameValue怎么用?C++ CSLSetNameValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CSLSetNameValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:garnertb,项目名称:gdal,代码行数:49,代码来源:gdaloverviewdataset.cpp
示例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);
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:15,代码来源:gnmgenericnetwork.cpp
示例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);
}
}
开发者ID:OSGeo,项目名称:gdal,代码行数:15,代码来源:ogrplscenesdatav1dataset.cpp
示例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();
}
开发者ID:Nikoli,项目名称:qlandkartegt,代码行数:36,代码来源:CCreateMapFineTune.cpp
示例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 );
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:17,代码来源:ogrcouchdbdatasource.cpp
示例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 );
}
开发者ID:koordinates,项目名称:gdal,代码行数:17,代码来源:ogrgftdatasource.cpp
示例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 );
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:18,代码来源:pauxdataset.cpp
示例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 );
}
开发者ID:drownedout,项目名称:datamap,代码行数:18,代码来源:ogrcartodbdatasource.cpp
示例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);
}
开发者ID:ryandavid,项目名称:rotobox,代码行数:18,代码来源:ogramigoclouddatasource.cpp
示例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;
}
开发者ID:shigekun,项目名称:kiban2dem,代码行数:44,代码来源:dem.cpp
示例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 );
}
开发者ID:samalone,项目名称:gdal-ios,代码行数:19,代码来源:pauxdataset.cpp
示例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;
}
开发者ID:kirkjens,项目名称:PDAL,代码行数:19,代码来源:Polygon.cpp
示例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 );
}
}
}
开发者ID:garnertb,项目名称:gdal,代码行数:19,代码来源:vicarkeywordhandler.cpp
示例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);
}
开发者ID:jedbrown,项目名称:dohp,代码行数:20,代码来源:vhtjako.c
示例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;
}
}
开发者ID:drownedout,项目名称:datamap,代码行数:21,代码来源:keadataset.cpp
示例16: CPLError
CPLErr PAuxRasterBand::SetNoDataValue( double dfNewValue )
{
if( GetAccess() == GA_ReadOnly )
{
CPLError( CE_Failure, CPLE_NoWriteAccess,
"Can't update readonly dataset." );
return CE_Failure;
}
char szTarget[128];
char szValue[128];
snprintf( szTarget, sizeof(szTarget), "METADATA_IMG_%d_NO_DATA_VALUE", nBand );
CPLsnprintf( szValue, sizeof(szValue), "%24.12f", dfNewValue );
PAuxDataset *poPDS = reinterpret_cast<PAuxDataset *>( poDS );
poPDS->papszAuxLines =
CSLSetNameValue( poPDS->papszAuxLines, szTarget, szValue );
poPDS->bAuxUpdated = TRUE;
return CE_None;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:23,代码来源:pauxdataset.cpp
示例17: return
//.........这里部分代码省略.........
GetMD( 8, DESDCDT );
GetMD( 4, DESDCXM );
GetMD( 1, DESDG );
GetMD( 8, DESDGDT );
GetMD( 43, DESCLTX );
GetMD( 1, DESCATP );
GetMD( 40, DESCAUT );
GetMD( 1, DESCRSN );
GetMD( 8, DESSRDT );
GetMD( 15, DESCTLN );
/* Load DESID */
NITFGetField( szDESID, pachHeader, 2, 25);
/* For NITF < 02.10, we cannot rely on DESID=TRE_OVERFLOW to detect */
/* if DESOFLW and DESITEM are present. So if the next 4 bytes are non */
/* numeric, we'll assume that DESOFLW is there */
bHasDESOFLW = EQUALN(szDESID, "TRE_OVERFLOW", strlen("TRE_OVERFLOW")) ||
(!((pachHeader[nOffset+0] >= '0' && pachHeader[nOffset+0] <= '9') &&
(pachHeader[nOffset+1] >= '0' && pachHeader[nOffset+1] <= '9') &&
(pachHeader[nOffset+2] >= '0' && pachHeader[nOffset+2] <= '9') &&
(pachHeader[nOffset+3] >= '0' && pachHeader[nOffset+3] <= '9')));
if (bHasDESOFLW)
{
if ((int)psSegInfo->nSegmentHeaderSize < nOffset + 6 + 3 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"DES header too small");
NITFDESDeaccess(psDES);
return NULL;
}
GetMD( 6, DESOFLW );
GetMD( 3, DESITEM );
}
if ((int)psSegInfo->nSegmentHeaderSize < nOffset + 4 )
{
CPLError(CE_Failure, CPLE_AppDefined,
"DES header too small");
NITFDESDeaccess(psDES);
return NULL;
}
nDESSHL = atoi(NITFGetField( szTemp, pachHeader, nOffset, 4));
nOffset += 4;
if (nDESSHL < 0)
{
CPLError(CE_Failure, CPLE_AppDefined,
"Invalid value for DESSHL");
NITFDESDeaccess(psDES);
return NULL;
}
if ( (int)psSegInfo->nSegmentHeaderSize < nOffset + nDESSHL)
{
CPLError(CE_Failure, CPLE_AppDefined,
"DES header too small");
NITFDESDeaccess(psDES);
return NULL;
}
if (EQUALN(szDESID, "CSSHPA DES", strlen("CSSHPA DES")))
{
if ( nDESSHL != 62 && nDESSHL != 80)
{
CPLError(CE_Failure, CPLE_AppDefined,
"Invalid DESSHL for CSSHPA DES");
NITFDESDeaccess(psDES);
return NULL;
}
GetMD( 25, SHAPE_USE );
GetMD( 10, SHAPE_CLASS );
if (nDESSHL == 80)
GetMD( 18, CC_SOURCE );
GetMD( 3, SHAPE1_NAME );
GetMD( 6, SHAPE1_START );
GetMD( 3, SHAPE2_NAME );
GetMD( 6, SHAPE2_START );
GetMD( 3, SHAPE3_NAME );
GetMD( 6, SHAPE3_START );
}
else if (nDESSHL > 0)
GetMD( nDESSHL, DESSHF );
if ((int)psSegInfo->nSegmentHeaderSize > nOffset)
{
char* pszEscapedDESDATA =
CPLEscapeString( pachHeader + nOffset,
(int)psSegInfo->nSegmentHeaderSize - nOffset,
CPLES_BackslashQuotable );
psDES->papszMetadata = CSLSetNameValue( psDES->papszMetadata,
"NITF_DESDATA",
pszEscapedDESDATA );
CPLFree(pszEscapedDESDATA);
}
return psDES;
}
开发者ID:actian-geospatial,项目名称:ogr-ingres,代码行数:101,代码来源:nitfdes.c
示例18: msUVRASTERLayerWhichShapes
//.........这里部分代码省略.........
map_tmp->extent.minx = rect.minx-(0.5*map_cellsize)+(0.5*map_tmp->cellsize);
map_tmp->extent.miny = rect.miny-(0.5*map_cellsize)+(0.5*map_tmp->cellsize);
map_tmp->extent.maxx = map_tmp->extent.minx+((width-1)*map_tmp->cellsize);
map_tmp->extent.maxy = map_tmp->extent.miny+((height-1)*map_tmp->cellsize);
map_tmp->gt.rotation_angle = 0.0;
msCopyProjection(&map_tmp->projection, &layer->projection);
if (layer->debug == 5)
msDebug("msUVRASTERLayerWhichShapes(): extent: %g %g %g %g\n",
map_tmp->extent.minx, map_tmp->extent.miny,
map_tmp->extent.maxx, map_tmp->extent.maxy);
/* important to use that function, to compute map
geotransform, used by the resampling*/
msMapSetSize(map_tmp, width, height);
if (layer->debug == 5)
msDebug("msUVRASTERLayerWhichShapes(): geotransform: %g %g %g %g %g %g\n",
map_tmp->gt.geotransform[0], map_tmp->gt.geotransform[1],
map_tmp->gt.geotransform[2], map_tmp->gt.geotransform[3],
map_tmp->gt.geotransform[4], map_tmp->gt.geotransform[5]);
uvlinfo->extent = map_tmp->extent;
image_tmp = msImageCreate(width, height, map_tmp->outputformatlist[0],
NULL, NULL, map_tmp->resolution, map_tmp->defresolution,
&(map_tmp->imagecolor));
/* Default set to AVERAGE resampling */
if( CSLFetchNameValue( layer->processing, "RESAMPLE" ) == NULL ) {
alteredProcessing = CSLDuplicate( layer->processing );
alteredProcessing =
CSLSetNameValue( alteredProcessing, "RESAMPLE",
"AVERAGE");
savedProcessing = layer->processing;
layer->processing = alteredProcessing;
}
/* disable masking at this level: we don't want to apply the mask at the raster level,
* it will be applied with the correct cellsize and image size in the vector rendering
* phase.
*/
saved_layer_mask = layer->mask;
layer->mask = NULL;
if (msDrawRasterLayerLow(map_tmp, layer, image_tmp, NULL ) == MS_FAILURE) {
msSetError(MS_MISCERR, "Unable to draw raster data.", "msUVRASTERLayerWhichShapes()");
layer->mask = saved_layer_mask;
return MS_FAILURE;
}
/* restore layer mask */
layer->mask = saved_layer_mask;
/* restore the saved processing */
if (alteredProcessing != NULL) {
layer->processing = savedProcessing;
CSLDestroy(alteredProcessing);
}
/* free old query arrays */
if (uvlinfo->u) {
for (i=0; i<uvlinfo->width; ++i) {
free(uvlinfo->u[i]);
}
free(uvlinfo->u);
开发者ID:EOX-A,项目名称:mapserver,代码行数:67,代码来源:mapuvraster.c
示例19: Hopen
//.........这里部分代码省略.........
SWinqdatafields( hSW, pszFieldList, paiRank, paiNumType );
#if DEBUG
{
char *pszTmp =
SPrintArray( GDT_UInt32, paiRank, nFields, "," );
CPLDebug( "HDF4", "Number of data fields in swath %d: %d",
(int) i, (int) nFields );
CPLDebug( "HDF4", "List of data fields in swath %d: %s",
(int) i, pszFieldList );
CPLDebug( "HDF4", "Data fields ranks: %s", pszTmp );
CPLFree( pszTmp );
}
#endif
papszFields = CSLTokenizeString2( pszFieldList, ",",
CSLT_HONOURSTRINGS );
for ( j = 0; j < nFields; j++ )
{
SWfieldinfo( hSW, papszFields[j], &iRank, aiDimSizes,
&iNumType, NULL );
if ( iRank < 2 )
continue;
// Add field to the list of GDAL subdatasets
nCount = CSLCount( poDS->papszSubDatasets ) / 2;
sprintf( szTemp, "SUBDATASET_%d_NAME", nCount + 1 );
// We will use the field index as an identificator.
poDS->papszSubDatasets =
CSLSetNameValue( poDS->papszSubDatasets, szTemp,
CPLSPrintf("HDF4_EOS:EOS_SWATH:\"%s\":%s:%s",
poOpenInfo->pszFilename,
papszSwaths[i], papszFields[j]) );
sprintf( szTemp, "SUBDATASET_%d_DESC", nCount + 1 );
pszString = SPrintArray( GDT_UInt32, aiDimSizes,
iRank, "x" );
poDS->papszSubDatasets =
CSLSetNameValue( poDS->papszSubDatasets, szTemp,
CPLSPrintf( "[%s] %s %s (%s)", pszString,
papszFields[j],
papszSwaths[i],
poDS->GetDataTypeName(iNumType) ) );
CPLFree( pszString );
}
CSLDestroy( papszFields );
CPLFree( paiNumType );
CPLFree( paiRank );
CPLFree( pszFieldList );
SWdetach( hSW );
}
CSLDestroy( papszSwaths );
}
SWclose( hHDF4 );
/* -------------------------------------------------------------------- */
/* Process grid layers. */
/* -------------------------------------------------------------------- */
hHDF4 = GDopen( poOpenInfo->pszFilename, DFACC_READ );
nSubDatasets = GDinqgrid( poOpenInfo->pszFilename, NULL, &nStrBufSize );
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:67,代码来源:hdf4dataset.cpp
示例20: EXIFExtractMetadata
//.........这里部分代码省略.........
CPLError( CE_Warning, CPLE_AppDefined,
"Too many bytes in tag: %u, ignoring tag.",
poTIFFDirEntry->tdir_count );
}
else if (nDataWidth == 0 || poTIFFDirEntry->tdir_type >= TIFF_IFD )
{
CPLError( CE_Warning, CPLE_AppDefined,
"Invalid or unhandled EXIF data type: %d, ignoring tag.",
poTIFFDirEntry->tdir_type );
}
/* -------------------------------------------------------------------- */
/* This is at most 4 byte data so we can read it from tdir_offset */
/* -------------------------------------------------------------------- */
else if (space >= 0 && space <= 4) {
unsigned char data[4];
memcpy(data, &poTIFFDirEntry->tdir_offset, 4);
if (bSwabflag)
{
// Unswab 32bit value, and reswab per data type.
TIFFSwabLong((GUInt32*) data);
switch (poTIFFDirEntry->tdir_type) {
case TIFF_LONG:
case TIFF_SLONG:
case TIFF_FLOAT:
TIFFSwabLong((GUInt32*) data);
break;
case TIFF_SSHORT:
case TIFF_SHORT:
TIFFSwabArrayOfShort((GUInt16*) data,
poTIFFDirEntry->tdir_count);
break;
default:
break;
}
}
EXIFPrintData(pszTemp,
poTIFFDirEntry->tdir_type,
poTIFFDirEntry->tdir_count, data);
}
/* -------------------------------------------------------------------- */
/* The data is being read where tdir_offset point to in the file */
/* -------------------------------------------------------------------- */
else if (space > 0 && space < MAXSTRINGLENGTH)
{
unsigned char *data = (unsigned char *)VSIMalloc(space);
if (data) {
VSIFSeekL(fp,poTIFFDirEntry->tdir_offset+nTIFFHEADER,SEEK_SET);
VSIFReadL(data, 1, space, fp);
if (bSwabflag) {
switch (poTIFFDirEntry->tdir_type) {
case TIFF_SHORT:
case TIFF_SSHORT:
TIFFSwabArrayOfShort((GUInt16*) data,
poTIFFDirEntry->tdir_count);
break;
case TIFF_LONG:
case TIFF_SLONG:
case TIFF_FLOAT:
TIFFSwabArrayOfLong((GUInt32*) data,
poTIFFDirEntry->tdir_count);
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
TIFFSwabArrayOfLong((GUInt32*) data,
2*poTIFFDirEntry->tdir_count);
break;
case TIFF_DOUBLE:
TIFFSwabArrayOfDouble((double*) data,
poTIFFDirEntry->tdir_count);
break;
default:
break;
}
}
EXIFPrintData(pszTemp, poTIFFDirEntry->tdir_type,
poTIFFDirEntry->tdir_count, data);
CPLFree(data);
}
}
else
{
CPLError( CE_Warning, CPLE_AppDefined,
"Invalid EXIF header size: %ld, ignoring tag.",
(long) space );
}
papszMetadata = CSLSetNameValue(papszMetadata, pszName, pszTemp);
}
CPLFree(poTIFFDir);
return CE_None;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:101,代码来源:gdalexif.cpp
注:本文中的CSLSetNameValue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论