这篇教程C++ CSLSetNameValue函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CSLSetNameValue函数的典型用法代码示例。如果您正苦于以下问题:C++ CSLSetNameValue函数的具体用法?C++ CSLSetNameValue怎么用?C++ CSLSetNameValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CSLSetNameValue函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CPLDebugGDALOverviewDataset::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,
示例2: CSLAddNameValueOGRLayer *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,
示例3: CPLFreeOGRPLScenesDataV1Dataset::~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,
示例4: CSLSetNameValuevoid 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,
示例5: CPLFreeOGRCouchDBDataSource::~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,
示例6: CPLFreeOGRGFTDataSource::~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,
示例7: snprintfvoid 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,
示例8: CPLFreeOGRCARTODBDataSource::~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,
示例9: CPLFreeOGRAmigoCloudDataSource::~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,
示例10: makeGeotiffintmakeGeotiff (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,
示例11: sprintfvoid 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,
示例12: CSLSetNameValuestd::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,
示例13: CSLSetNameValueint 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,
示例14: JakoGDALMemAddBandstatic 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,
示例15: CSLSetNameValue// set a single metadata itemCPLErr 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,
示例16: CPLErrorCPLErr 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,
示例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,
示例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,
示例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,
示例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,
示例21: GDAL_IMD_AA2Rstatic int GDAL_IMD_AA2R( char ***ppapszIMD ){ char **papszIMD = *ppapszIMD;/* -------------------------------------------------------------------- *//* Verify that we have a new format file. *//* -------------------------------------------------------------------- */ const char *pszValue = CSLFetchNameValue( papszIMD, "version" ); if( pszValue == NULL ) return FALSE; if( EQUAL(pszValue,"/"R/"") ) return TRUE; if( !EQUAL(pszValue,"/"AA/"") ) { CPLDebug( "IMD", "The file is not the expected 'version = /"AA/"' format./nProceeding, but file may be corrupted." ); }/* -------------------------------------------------------------------- *//* Fix the version line. *//* -------------------------------------------------------------------- */ papszIMD = CSLSetNameValue( papszIMD, "version", "/"R/"" );/* -------------------------------------------------------------------- *//* remove a bunch of fields. *//* -------------------------------------------------------------------- */ int iKey; static const char *apszToRemove[] = { "productCatalogId", "childCatalogId", "productType", "numberOfLooks", "effectiveBandwidth", "mode", "scanDirection", "cloudCover", "productGSD", NULL }; for( iKey = 0; apszToRemove[iKey] != NULL; iKey++ ) { int iTarget = CSLFindName( papszIMD, apszToRemove[iKey] ); if( iTarget != -1 ) papszIMD = CSLRemoveStrings( papszIMD, iTarget, 1, NULL ); }/* -------------------------------------------------------------------- *//* Replace various min/mean/max with just the mean. *//* -------------------------------------------------------------------- */ static const char *keylist[] = { "CollectedRowGSD", "CollectedColGSD", "SunAz", "SunEl", "SatAz", "SatEl", "InTrackViewAngle", "CrossTrackViewAngle", "OffNadirViewAngle", NULL }; for( iKey = 0; keylist[iKey] != NULL; iKey++ ) { CPLString osTarget; int iTarget; osTarget.Printf( "IMAGE_1.min%s", keylist[iKey] ); iTarget = CSLFindName( papszIMD, osTarget ); if( iTarget != -1 ) papszIMD = CSLRemoveStrings( papszIMD, iTarget, 1, NULL ); osTarget.Printf( "IMAGE_1.max%s", keylist[iKey] ); iTarget = CSLFindName( papszIMD, osTarget ); if( iTarget != -1 ) papszIMD = CSLRemoveStrings( papszIMD, iTarget, 1, NULL ); osTarget.Printf( "IMAGE_1.mean%s", keylist[iKey] ); iTarget = CSLFindName( papszIMD, osTarget ); if( iTarget != -1 ) { CPLString osValue = CSLFetchNameValue( papszIMD, osTarget ); CPLString osLine; osTarget.Printf( "IMAGE_1.%c%s", tolower(keylist[iKey][0]), keylist[iKey]+1 ); osLine = osTarget + "=" + osValue; CPLFree( papszIMD[iTarget] ); papszIMD[iTarget] = CPLStrdup(osLine); } } *ppapszIMD = papszIMD; return TRUE;//.........这里部分代码省略.........
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:101,
示例22: GDALGetDriverByName//.........这里部分代码省略......... if ((nBlockYOff+1) * nBlockYSize > nOvrYSize) nReqYSize = nOvrYSize - nBlockYOff * nBlockYSize; eErr = RasterIO(GF_Read, nBlockXOff * nBlockXSize * nOvrFactor, nBlockYOff * nBlockYSize * nOvrFactor, nReqXSize * nOvrFactor, nReqYSize * nOvrFactor, pabyMEMDSBuffer, nReqXSize, nReqYSize, eDataType, nBands, NULL, 0, 0, 0); if (eErr != CE_None) { break; } GDALDatasetH hMemDS = GDALCreate(hMemDriver, "MEM:::", nReqXSize, nReqYSize, 0, eDataType, NULL); if (hMemDS == NULL) { eErr = CE_Failure; break; } int iBand; for(iBand = 0; iBand < nBands; iBand ++) { char** papszOptions = NULL; char szTmp[64]; memset(szTmp, 0, sizeof(szTmp)); CPLPrintPointer(szTmp, pabyMEMDSBuffer + iBand * nDataTypeSize * nReqXSize * nReqYSize, sizeof(szTmp)); papszOptions = CSLSetNameValue(papszOptions, "DATAPOINTER", szTmp); GDALAddBand(hMemDS, eDataType, papszOptions); CSLDestroy(papszOptions); } GDALDatasetH hOutDS = GDALCreateCopy(hTileDriver, osTempFileName.c_str(), hMemDS, FALSE, papszTileDriverOptions, NULL, NULL); GDALClose(hMemDS); if (hOutDS) GDALClose(hOutDS); else { eErr = CE_Failure; break; }/* -------------------------------------------------------------------- *//* Insert new entry into raster table *//* -------------------------------------------------------------------- */ vsi_l_offset nDataLength; GByte *pabyData = VSIGetMemFileBuffer( osTempFileName.c_str(), &nDataLength, FALSE); OGRFeatureH hFeat = OGR_F_Create( OGR_L_GetLayerDefn(hRasterLayer) ); OGR_F_SetFieldBinary(hFeat, 0, (int)nDataLength, pabyData); OGR_L_CreateFeature(hRasterLayer, hFeat); /* Query raster ID to set it as the ID of the associated metadata */ int nRasterID = (int)OGR_F_GetFID(hFeat);
开发者ID:bhargav57,项目名称:OGRSpatialRef3D,代码行数:66,
示例23: mainint main( int nArgc, char ** papszArgv ){ char **papszOptions = NULL; int bReturnPrimitives = FALSE; char *pszDataPath = NULL; if( nArgc < 2 ) { printf( "Usage: s57dump [-pen] [-split] [-lnam] [-return-prim] [-no-update]/n" " [-return-link] [-data <dirpath>] filename/n" ); exit( 1 ); }/* -------------------------------------------------------------------- *//* Process commandline arguments. *//* -------------------------------------------------------------------- */ for( int iArg = 1; iArg < nArgc-1; iArg++ ) { if( EQUAL(papszArgv[iArg],"-split") ) papszOptions = CSLSetNameValue( papszOptions, S57O_SPLIT_MULTIPOINT, "ON" ); else if( EQUAL(papszArgv[iArg],"-data") ) pszDataPath = papszArgv[++iArg]; else if( EQUAL(papszArgv[iArg],"-no-update") ) papszOptions = CSLSetNameValue( papszOptions, S57O_UPDATES, "OFF" ); else if( EQUAL(papszArgv[iArg],"-pen") ) papszOptions = CSLSetNameValue( papszOptions, S57O_PRESERVE_EMPTY_NUMBERS, "ON" ); else if( EQUALN(papszArgv[iArg],"-return-prim",12) ) { papszOptions = CSLSetNameValue( papszOptions, S57O_RETURN_PRIMITIVES, "ON" ); bReturnPrimitives = TRUE; } else if( EQUALN(papszArgv[iArg],"-lnam",4) ) papszOptions = CSLSetNameValue( papszOptions, S57O_LNAM_REFS, "ON" ); else if( EQUALN(papszArgv[iArg],"-return-link",12) ) papszOptions = CSLSetNameValue( papszOptions, S57O_RETURN_LINKAGES, "ON" ); } /* -------------------------------------------------------------------- *//* Load the class definitions into the registrar. *//* -------------------------------------------------------------------- */ S57ClassRegistrar oRegistrar; int bRegistrarLoaded; bRegistrarLoaded = oRegistrar.LoadInfo( pszDataPath, NULL, TRUE ); S57ClassContentExplorer *poClassContentExplorer = NULL; if (bRegistrarLoaded) poClassContentExplorer = new S57ClassContentExplorer(&oRegistrar); /* -------------------------------------------------------------------- *//* Get a list of candidate files. *//* -------------------------------------------------------------------- */ char **papszFiles; int iFile; papszFiles = S57FileCollector( papszArgv[nArgc-1] ); for( iFile = 0; papszFiles != NULL && papszFiles[iFile] != NULL; iFile++ ) { printf( "Found: %s/n", papszFiles[iFile] ); } for( iFile = 0; papszFiles != NULL && papszFiles[iFile] != NULL; iFile++ ) { printf( "<------------------------------------------------------------------------->/n" ); printf( "/nFile: %s/n/n", papszFiles[iFile] ); S57Reader oReader( papszFiles[iFile] ); oReader.SetOptions( papszOptions ); int nOptionFlags = oReader.GetOptionFlags(); if( !oReader.Open( FALSE ) ) continue; if( bRegistrarLoaded ) { int bGeneric = FALSE; std::vector<int> anClassList; unsigned int i; oReader.CollectClassList(anClassList); oReader.SetClassBased( &oRegistrar, poClassContentExplorer ); printf( "Classes found:/n" ); for( i = 0; i < anClassList.size(); i++ ) { if( anClassList[i] == 0 ) continue; //.........这里部分代码省略.........
开发者ID:0004c,项目名称:node-gdal,代码行数:101,
示例24: main//.........这里部分代码省略......... Usage("transformation failed"); return EXIT_FAILURE; } // open input dataset GDALDataset *poSrcDataset = (GDALDataset *) GDALOpen( sFileName, GA_ReadOnly ); // GA_Update char* pszSpaRefDef = NULL; if( oDstSpatialReference.exportToWkt(&pszSpaRefDef) != OGRERR_NONE) { CPLFree( pszSpaRefDef ); GDALClose( (GDALDatasetH) poSrcDataset ); return EXIT_FAILURE; } // search point along image // add GCP to opened raster OGRPoint ptCenter(dfaCornersX[0], dfaCornersY[0]); OGRPoint pt1(dfaCornersX[1], dfaCornersY[1]); // NW Cormer OGRPoint pt2(dfaCornersX[2], dfaCornersY[2]); // NE Corner OGRPoint pt3(dfaCornersX[3], dfaCornersY[3]); // SE Corner OGRPoint pt4(dfaCornersX[4], dfaCornersY[4]); // SW Corner int nGCPCount = 0; OGREnvelope DstEnv; GDAL_GCP *paGSPs = PrepareGCP(sFileName, &pt1, &pt2, &pt3, &pt4, &ptCenter, oDstSpatialReference, poSrcDataset->GetRasterXSize(), poSrcDataset->GetRasterYSize(), nGCPCount, DstEnv); if(poSrcDataset->SetGCPs(nGCPCount, paGSPs, pszSpaRefDef) != CE_None) { Usage( "Set GCPs failed" ); return EXIT_FAILURE; } // create warper char **papszTO = NULL; papszTO = CSLSetNameValue( papszTO, "METHOD", "GCP_TPS" ); papszTO = CSLSetNameValue( papszTO, "NUM_THREADS", "4" ); papszTO = CSLSetNameValue( papszTO, "DST_SRS", pszSpaRefDef ); papszTO = CSLSetNameValue( papszTO, "SRC_SRS", pszSpaRefDef ); papszTO = CSLSetNameValue( papszTO, "INSERT_CENTER_LONG", "FALSE" ); GDALDriver *poOutputDriver = (GDALDriver *) GDALGetDriverByName( "GTiff" ); CPLSetConfigOption( "CHECK_WITH_INVERT_PROJ", "TRUE" ); void* hTransformArg = GDALCreateGenImgProjTransformer2( poSrcDataset, NULL, papszTO ); GDALTransformerInfo* psInfo = (GDALTransformerInfo*)hTransformArg; double adfThisGeoTransform[6]; double adfExtent[4]; int nThisPixels, nThisLines; // suggest the raster output size if( GDALSuggestedWarpOutput2( poSrcDataset, psInfo->pfnTransform, hTransformArg, adfThisGeoTransform, &nThisPixels, &nThisLines, adfExtent, 0 ) != CE_None ) { Usage( "Suggest Output failed" ); return EXIT_FAILURE; } adfThisGeoTransform[0] = DstEnv.MinX; adfThisGeoTransform[3] = DstEnv.MaxY; int nPixels = (int) ((DstEnv.MaxX - DstEnv.MinX) / adfThisGeoTransform[1] + 0.5); int nLines = (int) ((DstEnv.MaxY - DstEnv.MinY) / -adfThisGeoTransform[5] + 0.5); GDALSetGenImgProjTransformerDstGeoTransform( hTransformArg, adfThisGeoTransform); // create new raster CPLString sOutputRasterPath = CPLResetExtension(sFileName, "tif"); GDALDataset *poDstDataset = poOutputDriver->Create(sOutputRasterPath, nPixels, nLines, poSrcDataset->GetRasterCount(), GDT_Byte, NULL );
开发者ID:BishopGIS,项目名称:gisconf2015,代码行数:67,
示例25: mainint main( int argc, char ** argv ){ const char *pszSrcFilename = NULL; const char *pszDstFilename = NULL; int nOrder = 0; void *hTransformArg; GDALTransformerFunc pfnTransformer = NULL; int nGCPCount = 0; GDAL_GCP *pasGCPs = NULL; int bInverse = FALSE; char **papszTO = NULL; /* Check that we are running against at least GDAL 1.5 */ /* Note to developers : if we use newer API, please change the requirement */ if (atoi(GDALVersionInfo("VERSION_NUM")) < 1500) { fprintf(stderr, "At least, GDAL >= 1.5.0 is required for this version of %s, " "which was compiled against GDAL %s/n", argv[0], GDAL_RELEASE_NAME); exit(1); } GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc );/* -------------------------------------------------------------------- *//* Parse arguments. *//* -------------------------------------------------------------------- */ int i; for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(argv[i],"-t_srs") && i < argc-1 ) { char *pszSRS = SanitizeSRS(argv[++i]); papszTO = CSLSetNameValue( papszTO, "DST_SRS", pszSRS ); CPLFree( pszSRS ); } else if( EQUAL(argv[i],"-s_srs") && i < argc-1 ) { char *pszSRS = SanitizeSRS(argv[++i]); papszTO = CSLSetNameValue( papszTO, "SRC_SRS", pszSRS ); CPLFree( pszSRS ); } else if( EQUAL(argv[i],"-order") && i < argc-1 ) { nOrder = atoi(argv[++i]); papszTO = CSLSetNameValue( papszTO, "MAX_GCP_ORDER", argv[i] ); } else if( EQUAL(argv[i],"-tps") ) { papszTO = CSLSetNameValue( papszTO, "METHOD", "GCP_TPS" ); nOrder = -1; } else if( EQUAL(argv[i],"-rpc") ) { papszTO = CSLSetNameValue( papszTO, "METHOD", "RPC" ); } else if( EQUAL(argv[i],"-geoloc") ) { papszTO = CSLSetNameValue( papszTO, "METHOD", "GEOLOC_ARRAY" ); } else if( EQUAL(argv[i],"-i") ) { bInverse = TRUE; } else if( EQUAL(argv[i],"-to") && i < argc-1 ) { papszTO = CSLAddString( papszTO, argv[++i] ); } else if( EQUAL(argv[i],"-gcp") && i < argc - 4 ) { char* endptr = NULL; /* -gcp pixel line easting northing [elev] */ nGCPCount++; pasGCPs = (GDAL_GCP *) CPLRealloc( pasGCPs, sizeof(GDAL_GCP) * nGCPCount ); GDALInitGCPs( 1, pasGCPs + nGCPCount - 1 ); pasGCPs[nGCPCount-1].dfGCPPixel = atof(argv[++i]); pasGCPs[nGCPCount-1].dfGCPLine = atof(argv[++i]); pasGCPs[nGCPCount-1].dfGCPX = atof(argv[++i]); pasGCPs[nGCPCount-1].dfGCPY = atof(argv[++i]); if( argv[i+1] != NULL && (CPLStrtod(argv[i+1], &endptr) != 0.0 || argv[i+1][0] == '0') ) { /* Check that last argument is really a number and not a filename */ /* looking like a number (see ticket #863) */ if (endptr && *endptr == 0) pasGCPs[nGCPCount-1].dfGCPZ = atof(argv[++i]); }//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,
示例26: _mapcache_source_gdal_render_metatile/** * /private /memberof mapcache_source_gdal * /sa mapcache_source::render_metatile() */void _mapcache_source_gdal_render_metatile(mapcache_context *ctx, mapcache_metatile *tile){ mapcache_source_gdal *gdal = (mapcache_source_gdal*)tile->tile.tileset->source; char *srcSRS = "", *dstSRS; mapcache_buffer *data = mapcache_buffer_create(0,ctx->pool); GC_CHECK_ERROR(ctx); GDALDatasetH hDataset; GDALAllRegister(); OGRSpatialReferenceH hSRS; CPLErrorReset(); hSRS = OSRNewSpatialReference( NULL ); if( OSRSetFromUserInput( hSRS, tile->tile.grid->srs ) == OGRERR_NONE ) OSRExportToWkt( hSRS, &dstSRS ); else { ctx->set_error(ctx,MAPCACHE_SOURCE_GDAL_ERROR,"failed to parse gdal srs %s",tile->tile.grid->srs); return; } OSRDestroySpatialReference( hSRS ); hDataset = GDALOpen( gdal->datastr, GA_ReadOnly ); if( hDataset == NULL ) { ctx->set_error(ctx,MAPCACHE_SOURCE_GDAL_ERROR,"GDAL failed to open %s",gdal->datastr); return; } /* -------------------------------------------------------------------- */ /* Check that there's at least one raster band */ /* -------------------------------------------------------------------- */ if ( GDALGetRasterCount(hDataset) == 0 ) { ctx->set_error(ctx,MAPCACHE_SOURCE_GDAL_ERROR,"raster %s has no bands",gdal->datastr); return; } if( GDALGetProjectionRef( hDataset ) != NULL && strlen(GDALGetProjectionRef( hDataset )) > 0 ) srcSRS = apr_pstrdup(ctx->pool,GDALGetProjectionRef( hDataset )); else if( GDALGetGCPProjection( hDataset ) != NULL && strlen(GDALGetGCPProjection(hDataset)) > 0 && GDALGetGCPCount( hDataset ) > 1 ) srcSRS = apr_pstrdup(ctx->pool,GDALGetGCPProjection( hDataset )); GDALDriverH hDriver = GDALGetDriverByName( "MEM" ); GDALDatasetH hDstDS; /* -------------------------------------------------------------------- */ /* Create a transformation object from the source to */ /* destination coordinate system. */ /* -------------------------------------------------------------------- */ void *hTransformArg = GDALCreateGenImgProjTransformer( hDataset, srcSRS, NULL, dstSRS, TRUE, 1000.0, 0 ); if( hTransformArg == NULL ) { ctx->set_error(ctx,MAPCACHE_SOURCE_GDAL_ERROR,"gdal failed to create SRS transformation object"); return; } /* -------------------------------------------------------------------- */ /* Get approximate output definition. */ /* -------------------------------------------------------------------- */ int nPixels, nLines; double adfDstGeoTransform[6]; if( GDALSuggestedWarpOutput( hDataset, GDALGenImgProjTransform, hTransformArg, adfDstGeoTransform, &nPixels, &nLines ) != CE_None ) { ctx->set_error(ctx,MAPCACHE_SOURCE_GDAL_ERROR,"gdal failed to create suggested warp output"); return; } GDALDestroyGenImgProjTransformer( hTransformArg ); double dfXRes = (tile->bbox[2] - tile->bbox[0]) / tile->sx; double dfYRes = (tile->bbox[3] - tile->bbox[1]) / tile->sy; adfDstGeoTransform[0] = tile->bbox[0]; adfDstGeoTransform[3] = tile->bbox[3]; adfDstGeoTransform[1] = dfXRes; adfDstGeoTransform[5] = -dfYRes; hDstDS = GDALCreate( hDriver, "tempd_gdal_image", tile->sx, tile->sy, 4, GDT_Byte, NULL ); /* -------------------------------------------------------------------- */ /* Write out the projection definition. */ /* -------------------------------------------------------------------- */ GDALSetProjection( hDstDS, dstSRS ); GDALSetGeoTransform( hDstDS, adfDstGeoTransform ); char **papszWarpOptions = NULL; papszWarpOptions = CSLSetNameValue( papszWarpOptions, "INIT", "0" ); /* -------------------------------------------------------------------- */ /* Create a transformation object from the source to *///.........这里部分代码省略.........
开发者ID:MiniHero,项目名称:mapcache,代码行数:101,
示例27: CPLStrdupint OGRS57DataSource::Open( const char * pszFilename, int bTestOpen ){ int iModule; pszName = CPLStrdup( pszFilename ); /* -------------------------------------------------------------------- *//* Check a few bits of the header to see if it looks like an *//* S57 file (really, if it looks like an ISO8211 file). *//* -------------------------------------------------------------------- */ if( bTestOpen ) { FILE *fp; char pachLeader[10]; fp = VSIFOpenL( pszFilename, "rb" ); if( fp == NULL ) return FALSE; if( VSIFReadL( pachLeader, 1, 10, fp ) != 10 || (pachLeader[5] != '1' && pachLeader[5] != '2' && pachLeader[5] != '3' ) || pachLeader[6] != 'L' || (pachLeader[8] != '1' && pachLeader[8] != ' ') ) { VSIFCloseL( fp ); return FALSE; } VSIFCloseL( fp ); }/* -------------------------------------------------------------------- *//* Setup reader options. *//* -------------------------------------------------------------------- */ char **papszReaderOptions = NULL; S57Reader *poModule; poModule = new S57Reader( pszFilename ); papszReaderOptions = CSLSetNameValue(papszReaderOptions, S57O_LNAM_REFS, "ON" ); if( GetOption(S57O_UPDATES) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_UPDATES, GetOption(S57O_UPDATES)); if( GetOption(S57O_SPLIT_MULTIPOINT) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_SPLIT_MULTIPOINT, GetOption(S57O_SPLIT_MULTIPOINT) ); if( GetOption(S57O_ADD_SOUNDG_DEPTH) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_ADD_SOUNDG_DEPTH, GetOption(S57O_ADD_SOUNDG_DEPTH)); if( GetOption(S57O_PRESERVE_EMPTY_NUMBERS) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_PRESERVE_EMPTY_NUMBERS, GetOption(S57O_PRESERVE_EMPTY_NUMBERS) ); if( GetOption(S57O_RETURN_PRIMITIVES) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_RETURN_PRIMITIVES, GetOption(S57O_RETURN_PRIMITIVES) ); if( GetOption(S57O_RETURN_LINKAGES) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_RETURN_LINKAGES, GetOption(S57O_RETURN_LINKAGES) ); if( GetOption(S57O_RETURN_DSID) != NULL ) papszReaderOptions = CSLSetNameValue( papszReaderOptions, S57O_RETURN_DSID, GetOption(S57O_RETURN_DSID) ); poModule->SetOptions( papszReaderOptions ); CSLDestroy( papszReaderOptions );/* -------------------------------------------------------------------- *//* Try opening. *//* *//* Eventually this should check for catalogs, and if found *//* instantiate a whole series of modules. *//* -------------------------------------------------------------------- */ if( !poModule->Open( bTestOpen ) ) { delete poModule; return FALSE; } int bSuccess = TRUE; nModules = 1; papoModules = (S57Reader **) CPLMalloc(sizeof(void*)); papoModules[0] = poModule; //.........这里部分代码省略.........
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:101,
示例28: CPLStrdupGDALRasterizeOptions *GDALRasterizeOptionsNew(char** papszArgv, GDALRasterizeOptionsForBinary* psOptionsForBinary){ GDALRasterizeOptions *psOptions = new GDALRasterizeOptions; psOptions->pszFormat = CPLStrdup("GTiff"); psOptions->pfnProgress = GDALDummyProgress; psOptions->pProgressData = NULL; psOptions->bCreateOutput = FALSE; psOptions->b3D = FALSE; psOptions->bInverse = FALSE; memset(&(psOptions->sEnvelop), 0, sizeof(psOptions->sEnvelop)); psOptions->papszCreationOptions = NULL; psOptions->papszLayers = NULL; psOptions->pszSQL = NULL; psOptions->pszDialect = NULL; psOptions->pszBurnAttribute = NULL; psOptions->pszWHERE = NULL; psOptions->papszRasterizeOptions = NULL; psOptions->dfXRes = 0; psOptions->dfYRes = 0; psOptions->bCreateOutput = FALSE; psOptions->eOutputType = GDT_Float64; psOptions->bNoDataSet = FALSE; psOptions->dfNoData = 0; psOptions->bGotBounds = FALSE; psOptions->nXSize = 0; psOptions->nYSize = 0; psOptions->hSRS = NULL; psOptions->bTargetAlignedPixels = FALSE;/* -------------------------------------------------------------------- *//* Handle command line arguments. *//* -------------------------------------------------------------------- */ int argc = CSLCount(papszArgv); for( int i = 0; i < argc; i++ ) { if( EQUAL(papszArgv[i],"-of") && i < argc-1 ) { ++i; CPLFree(psOptions->pszFormat); psOptions->pszFormat = CPLStrdup(papszArgv[i]); psOptions->bCreateOutput = TRUE; if( psOptionsForBinary ) { psOptionsForBinary->bFormatExplicitlySet = TRUE; } } else if( EQUAL(papszArgv[i],"-q") || EQUAL(papszArgv[i],"-quiet") ) { if( psOptionsForBinary ) psOptionsForBinary->bQuiet = TRUE; } else if( EQUAL(papszArgv[i],"-a") && i < argc-1 ) { CPLFree(psOptions->pszBurnAttribute); psOptions->pszBurnAttribute = CPLStrdup(papszArgv[++i]); } else if( EQUAL(papszArgv[i],"-b") && i < argc-1 ) { if (strchr(papszArgv[i+1], ' ')) { char** papszTokens = CSLTokenizeString( papszArgv[i+1] ); char** papszIter = papszTokens; while(papszIter && *papszIter) { psOptions->anBandList.push_back(atoi(*papszIter)); papszIter ++; } CSLDestroy(papszTokens); i += 1; } else { while(i < argc-1 && ArgIsNumeric(papszArgv[i+1])) { psOptions->anBandList.push_back(atoi(papszArgv[i+1])); i += 1; } } } else if( EQUAL(papszArgv[i],"-3d") ) { psOptions->b3D = TRUE; psOptions->papszRasterizeOptions = CSLSetNameValue( psOptions->papszRasterizeOptions, "BURN_VALUE_FROM", "Z"); } else if( EQUAL(papszArgv[i],"-add") ) { psOptions->papszRasterizeOptions = CSLSetNameValue( psOptions->papszRasterizeOptions, "MERGE_ALG", "ADD"); } else if( EQUAL(papszArgv[i],"-chunkysize") && i < argc-1 ) { psOptions->papszRasterizeOptions = CSLSetNameValue( psOptions->papszRasterizeOptions, "CHUNKYSIZE", papszArgv[++i] ); }//.........这里部分代码省略.........
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:101,
注:本文中的CSLSetNameValue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CSLTestBoolean函数代码示例 C++ CSLFetchNameValueDef函数代码示例 |