本文整理汇总了C++中GDALDestroyDriverManager函数的典型用法代码示例。如果您正苦于以下问题:C++ GDALDestroyDriverManager函数的具体用法?C++ GDALDestroyDriverManager怎么用?C++ GDALDestroyDriverManager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GDALDestroyDriverManager函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
CPLJoinableThread* hThread;
printf("main thread %p\n", (void*)CPLGetPID());
argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );
CPLSetConfigOption("GDAL_CACHEMAX", "0");
CPLSetConfigOption("GDAL_DEBUG_BLOCK_CACHE", "ON");
MyDataset* poDS = new MyDataset();
char buf1[] = { 1 } ;
CPL_IGNORE_RET_VAL(GDALRasterIO(GDALGetRasterBand(poDS, 1), GF_Write, 0, 0, 1, 1, buf1, 1, 1, GDT_Byte, 0, 0));
hThread = CPLCreateJoinableThread(thread_func, NULL);
CPLSleep(0.3);
CPL_IGNORE_RET_VAL(GDALRasterIO(GDALGetRasterBand(poDS, 1), GF_Write, 1, 0, 1, 1, buf1, 1, 1, GDT_Byte, 0, 0));
GDALFlushCacheBlock();
CPLJoinThread(hThread);
delete poDS;
GDALDestroyDriverManager();
CSLDestroy( argv );
return 0;
}
开发者ID:nextgis-borsch,项目名称:tests,代码行数:29,代码来源:testblockcachewrite.cpp
示例2: GDALDestroyDriverManager
GDALImageFileType::~GDALImageFileType(void)
{
#ifdef OSG_WITH_GDAL
GDALDestroyDriverManager();
CPLCleanupTLS();
#endif
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:7,代码来源:OSGGDALImageFileType.cpp
示例3: while
GlobalEnvironment::~GlobalEnvironment()
{
while (m_threadMap.size())
{
thread_map::iterator iter = m_threadMap.begin();
ThreadEnvironment* env = iter->second;
delete env;
m_threadMap.erase(iter);
}
#ifdef PDAL_HAVE_PYTHON
if (m_pythonEnvironment)
delete m_pythonEnvironment;
m_pythonEnvironment = 0;
#endif
#ifdef PDAL_HAVE_GDAL
if (m_bIsGDALInitialized)
{
if (m_gdal_debug)
delete m_gdal_debug;
(void) GDALDestroyDriverManager();
m_bIsGDALInitialized = false;
}
#endif
return;
}
开发者ID:mweisman,项目名称:PDAL,代码行数:29,代码来源:GlobalEnvironment.cpp
示例4: main
int main(int argc, char *argv[])
{
QgsApplication app(argc, argv, TRUE);
qDebug() << "SRS DB path: " << app.srsDbFilePath();
WfipsMainWindow *mainWindow = new WfipsMainWindow();
mainWindow->show();
int rc = app.exec();
GDALDestroyDriverManager();
OGRCleanupAll();
return rc;
}
开发者ID:firelab,项目名称:wfips,代码行数:11,代码来源:main2.cpp
示例5: msGDALCleanup
void msGDALCleanup( void )
{
if( bGDALInitialized )
{
int iRepeat = 5;
msAcquireLock( TLOCK_GDAL );
#if GDAL_RELEASE_DATE > 20101207
{
/*
** Cleanup any unreferenced but open datasets as will tend
** to exist due to deferred close requests. We are careful
** to only close one file at a time before refecting the
** list as closing some datasets may cause others to be
** closed (subdatasets in a VRT for instance).
*/
GDALDatasetH *pahDSList = NULL;
int nDSCount = 0;
int bDidSomething;
do {
int i;
GDALGetOpenDatasets( &pahDSList, &nDSCount );
bDidSomething = FALSE;
for( i = 0; i < nDSCount && !bDidSomething; i++ )
{
if( GDALReferenceDataset( pahDSList[i] ) == 1 )
{
GDALClose( pahDSList[i] );
bDidSomething = TRUE;
}
else
GDALDereferenceDataset( pahDSList[i] );
}
} while( bDidSomething );
}
#endif
while( iRepeat-- )
CPLPopErrorHandler();
#if GDAL_RELEASE_DATE > 20021001
GDALDestroyDriverManager();
#endif
msReleaseLock( TLOCK_GDAL );
bGDALInitialized = 0;
}
}
开发者ID:mapserver,项目名称:mapserver-import,代码行数:51,代码来源:mapgdal.c
示例6: OGRCleanupAll
/**
* \brief Cleanup all OGR related resources.
*
* FIXME
*/
void OGRCleanupAll()
{
GDALDestroyDriverManager();
#if defined(WIN32) && defined(_MSC_VER)
// Horrible hack: for some reason MSVC doesn't export those classes&symbols
// if they are not referenced from the DLL itself
if(OGRwillNeverBeTrue)
{
OGRRegisterMutexedDataSource();
OGRRegisterMutexedLayer();
OGRCreateEmulatedTransactionDataSourceWrapper(NULL,NULL,FALSE,FALSE);
}
#endif
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:20,代码来源:ogrsfdriverregistrar.cpp
示例7: Usage
static void Usage(const char* pszErrorMsg = nullptr)
{
printf(
"Usage: gdal_grid [--help-general]\n"
" [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/\n"
" CInt16/CInt32/CFloat32/CFloat64}]\n"
" [-of format] [-co \"NAME=VALUE\"]\n"
" [-zfield field_name] [-z_increase increase_value] [-z_multiply multiply_value]\n"
" [-a_srs srs_def] [-spat xmin ymin xmax ymax]\n"
" [-clipsrc <xmin ymin xmax ymax>|WKT|datasource|spat_extent]\n"
" [-clipsrcsql sql_statement] [-clipsrclayer layer]\n"
" [-clipsrcwhere expression]\n"
" [-l layername]* [-where expression] [-sql select_statement]\n"
" [-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize]\n"
" [-a algorithm[:parameter1=value1]*]"
" [-q]\n"
" <src_datasource> <dst_filename>\n"
"\n"
"Available algorithms and parameters with their defaults:\n"
" Inverse distance to a power (default)\n"
" invdist:power=2.0:smoothing=0.0:radius1=0.0:radius2=0.0:angle=0.0:max_points=0:min_points=0:nodata=0.0\n"
" Inverse distance to a power with nearest neighbor search\n"
" invdistnn:power=2.0:radius=1.0:max_points=12:min_points=0:nodata=0\n"
" Moving average\n"
" average:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0\n"
" Nearest neighbor\n"
" nearest:radius1=0.0:radius2=0.0:angle=0.0:nodata=0.0\n"
" Various data metrics\n"
" <metric name>:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0\n"
" possible metrics are:\n"
" minimum\n"
" maximum\n"
" range\n"
" count\n"
" average_distance\n"
" average_distance_pts\n"
" Linear\n"
" linear:radius=-1.0:nodata=0.0\n"
"\n");
if( pszErrorMsg != nullptr )
fprintf(stderr, "\nFAILURE: %s\n", pszErrorMsg);
GDALDestroyDriverManager();
exit( 1 );
}
开发者ID:jef-n,项目名称:gdal,代码行数:47,代码来源:gdal_grid_bin.cpp
示例8: GDALExit
static int GDALExit( int nCode )
{
const char *pszDebug = CPLGetConfigOption("CPL_DEBUG",NULL);
if( pszDebug && (EQUAL(pszDebug,"ON") || EQUAL(pszDebug,"") ) )
{
GDALDumpOpenDatasets( stderr );
CPLDumpSharedList( NULL );
}
GDALDestroyDriverManager();
#ifdef OGR_ENABLED
OGRCleanupAll();
#endif
exit( nCode );
}
开发者ID:sameke,项目名称:node-gdal,代码行数:17,代码来源:gdalwarp_bin.cpp
示例9: GDALDestroy
void GDALDestroy(void)
{
if( bGDALDestroyAlreadyCalled )
return;
bGDALDestroyAlreadyCalled = TRUE;
CPLDebug("GDAL", "In GDALDestroy - unloading GDAL shared library.");
bInGDALGlobalDestructor = TRUE;
GDALDestroyDriverManager();
#ifdef OGR_ENABLED
OGRCleanupAll();
#endif
bInGDALGlobalDestructor = FALSE;
#ifndef _MSC_VER
CPLFinalizeTLS();
#endif
}
开发者ID:samalone,项目名称:gdal-ios,代码行数:18,代码来源:gdaldllmain.cpp
示例10: main
int main(int argc, char* argv[])
{
/*printf("test_huge_mapping\n");
test_huge_mapping();*/
printf("Physical memory : " CPL_FRMT_GIB " bytes\n", CPLGetPhysicalRAM());
if( !test_two_pages() )
return 0;
test_raw_auto(TRUE);
test_raw_auto(FALSE);
CPLVirtualMemManagerTerminate();
GDALDestroyDriverManager();
return 0;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:18,代码来源:test_virtualmem.cpp
示例11: SetApplication
int wxGISServerApp::OnExit()
{
if(m_pServer)
m_pServer->Exit();
SetApplication(NULL);
#ifdef __WXMSW__
wxSocketBase::Shutdown();
#endif
SerializeLibs();
GDALDestroyDriverManager();
OGRCleanupAll();
UnLoadLibs();
#ifdef wxUSE_SNGLINST_CHECKER
wxDELETE( m_pChecker );
#endif
return wxAppConsole::OnExit();//success == true ? EXIT_SUCCESS : EXIT_FAILURE;
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:23,代码来源:serverapp.cpp
示例12: main
int main( int nArgc, char ** papszArgv )
{
GDALDatasetH hDataset;
const char *pszResampling = "nearest";
const char *pszFilename = NULL;
int anLevels[1024];
int nLevelCount = 0;
int nResultStatus = 0;
int bReadOnly = FALSE;
int bClean = FALSE;
GDALProgressFunc pfnProgress = GDALTermProgress;
int *panBandList = NULL;
int nBandCount = 0;
char **papszOpenOptions = NULL;
/* Check that we are running against at least GDAL 1.7 */
/* Note to developers : if we use newer API, please change the requirement */
if (atoi(GDALVersionInfo("VERSION_NUM")) < 1700)
{
fprintf(stderr, "At least, GDAL >= 1.7.0 is required for this version of %s, "
"which was compiled against GDAL %s\n", papszArgv[0], GDAL_RELEASE_NAME);
exit(1);
}
GDALAllRegister();
nArgc = GDALGeneralCmdLineProcessor( nArgc, &papszArgv, 0 );
if( nArgc < 1 )
exit( -nArgc );
/* -------------------------------------------------------------------- */
/* Parse commandline. */
/* -------------------------------------------------------------------- */
for( int iArg = 1; iArg < nArgc; iArg++ )
{
if( EQUAL(papszArgv[iArg], "--utility_version") )
{
printf("%s was compiled against GDAL %s and is running against GDAL %s\n",
papszArgv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME"));
CSLDestroy( papszArgv );
return 0;
}
else if( EQUAL(papszArgv[iArg],"--help") )
Usage();
else if( EQUAL(papszArgv[iArg],"-r") )
{
CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
pszResampling = papszArgv[++iArg];
}
else if( EQUAL(papszArgv[iArg],"-ro"))
bReadOnly = TRUE;
else if( EQUAL(papszArgv[iArg],"-clean"))
bClean = TRUE;
else if( EQUAL(papszArgv[iArg],"-q") || EQUAL(papszArgv[iArg],"-quiet") )
pfnProgress = GDALDummyProgress;
else if( EQUAL(papszArgv[iArg],"-b"))
{
CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
const char* pszBand = papszArgv[iArg+1];
int nBand = atoi(pszBand);
if( nBand < 1 )
{
printf( "Unrecognizable band number (%s).\n", papszArgv[iArg+1] );
Usage();
GDALDestroyDriverManager();
exit( 2 );
}
iArg++;
nBandCount++;
panBandList = (int *)
CPLRealloc(panBandList, sizeof(int) * nBandCount);
panBandList[nBandCount-1] = nBand;
}
else if( EQUAL(papszArgv[iArg], "-oo") )
{
CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);
papszOpenOptions = CSLAddString( papszOpenOptions,
papszArgv[++iArg] );
}
else if( papszArgv[iArg][0] == '-' )
Usage(CPLSPrintf("Unknown option name '%s'", papszArgv[iArg]));
else if( pszFilename == NULL )
pszFilename = papszArgv[iArg];
else if( atoi(papszArgv[iArg]) > 0 )
{
anLevels[nLevelCount++] = atoi(papszArgv[iArg]);
if( anLevels[nLevelCount-1] == 1 )
{
printf("Warning: Overview with subsampling factor of 1 requested. This will copy the full resolution dataset in the overview !\n");
}
}
else
Usage("Too many command options.");
}
if( pszFilename == NULL )
Usage("No datasource specified.");
//.........这里部分代码省略.........
开发者ID:sameke,项目名称:node-gdal,代码行数:101,代码来源:gdaladdo.cpp
示例13: main
//.........这里部分代码省略.........
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 );
if( NULL == poDstDataset )
{
Usage( "Create Output failed" );
return EXIT_FAILURE;
}
poDstDataset->SetProjection( pszSpaRefDef );
poDstDataset->SetGeoTransform( adfThisGeoTransform );
#ifdef APRROX_MAXERROR
hTransformArg = GDALCreateApproxTransformer( GDALGenImgProjTransform, hTransformArg, APRROX_MAXERROR);
GDALTransformerFunc pfnTransformer = GDALApproxTransform;
GDALApproxTransformerOwnsSubtransformer(hTransformArg, TRUE);
#else
GDALTransformerFunc pfnTransformer = GDALGenImgProjTransform;
#endif // APRROX_MAXERROR
// warp
GDALWarpOptions *psWO = GDALCreateWarpOptions();
psWO->eWorkingDataType = GDT_Byte;
psWO->eResampleAlg = GRA_NearestNeighbour;
psWO->hSrcDS = poSrcDataset;
psWO->hDstDS = poDstDataset;
psWO->pfnTransformer = pfnTransformer;
psWO->pTransformerArg = hTransformArg;
psWO->pfnProgress = GDALTermProgress;
psWO->nBandCount = poSrcDataset->GetRasterCount();
psWO->panSrcBands = (int *) CPLMalloc(psWO->nBandCount*sizeof(int));
psWO->panDstBands = (int *) CPLMalloc(psWO->nBandCount*sizeof(int));
for(int i = 0; i < psWO->nBandCount; ++i )
{
psWO->panSrcBands[i] = i+1;
psWO->panDstBands[i] = i+1;
}
GDALWarpOperation oWO;
if( oWO.Initialize( psWO ) == CE_None )
{
#ifdef MULTI
if( oWO.ChunkAndWarpMulti( 0, 0, poDstDataset->GetRasterXSize(), poDstDataset->GetRasterYSize() ) != CE_None)
#else //MULTI
if( oWO.ChunkAndWarpImage( 0, 0, poDstDataset->GetRasterXSize(), poDstDataset->GetRasterYSize() ) != CE_None)
#endif //MULTI
{
const char* err = CPLGetLastErrorMsg();
Usage( CPLSPrintf("Warp failed.%s", err) );
return EXIT_FAILURE;
}
}
// cleanup
GDALDestroyWarpOptions( psWO );
CSLDestroy( papszTO );
CPLFree( pszSpaRefDef );
GDALClose( (GDALDatasetH) poSrcDataset );
GDALClose( (GDALDatasetH) poDstDataset );
GDALDestroyDriverManager();
return EXIT_SUCCESS;
}
开发者ID:BishopGIS,项目名称:gisconf2015,代码行数:101,代码来源:main.cpp
示例14: main
int main(int argc, char* argv[])
{
// Register GDAL/OGR drivers
::GDALAllRegister();
::OGRRegisterAll();
std::cout
<< "GDAL C/C++ API tests"
<< " (" << ::GDALVersionInfo("--version") << ")"
<< "\n---------------------------------------------------------\n";
argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );
if (argc < 1)
{
std::cout
<< "\n---------------------------------------------------------\n"
<< "No tests to run\n";
return EXIT_SUCCESS;
}
// Initialize TUT framework
int nRetCode = EXIT_FAILURE;
{
tut::reporter visi;
tut::runner.get().set_callback(&visi);
try
{
if (argc == 1)
{
tut::runner.get().run_tests();
}
else if (argc == 2 && std::string(argv[1]) == "--list")
{
tut::groupnames gl = tut::runner.get().list_groups();
tut::groupnames::const_iterator b = gl.begin();
tut::groupnames::const_iterator e = gl.end();
tut::groupnames::difference_type d = std::distance(b, e);
std::cout << "Registered " << d << " test groups:\n" << std::endl;
while (b != e)
{
std::cout << " " << *b << std::endl;
++b;
}
}
else if (argc == 2 && std::string(argv[1]) != "--list")
{
tut::check_test_group(argv[1]);
tut::runner.get().run_tests(argv[1]);
}
else if (argc == 3)
{
tut::check_test_group(argv[1]);
tut::test_result result;
tut::runner.get().run_test(argv[1], std::atoi(argv[2]), result);
}
nRetCode = EXIT_SUCCESS;
}
catch (const std::exception& ex)
{
std::cerr << "GDAL C/C++ API tests error: " << ex.what() << std::endl;
nRetCode = EXIT_FAILURE;
}
}
CSLDestroy(argv);
GDALDestroyDriverManager();
OGRCleanupAll();
CPLDumpSharedList( NULL );
CPLCleanupTLS();
return nRetCode;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:77,代码来源:gdal_unit_test.cpp
示例15: main
//.........这里部分代码省略.........
eErr = GDALRasterIO ( hMaskBand, GF_Write, 0, iLine, nXSize, 1,
pabyMask, nXSize, 1, GDT_Byte,
0, 0 );
if( eErr != CE_None ) {
CPLError(CE_Warning, CPLE_AppDefined,
"ERROR writeing out line to mask band.");
break;
}
}
if (!bQuiet)
GDALTermProgress( 0.5 * ((iLine+1) / (double) nYSize), NULL, NULL );
}
/* -------------------------------------------------------------------- */
/* Now process from the bottom back up .*/
/* -------------------------------------------------------------------- */
memset( panLastLineCounts, 0, sizeof(int) * nXSize);
for( iLine = nYSize-1; iLine >= 0; iLine-- )
{
CPLErr eErr;
eErr = GDALDatasetRasterIO( hOutDS, GF_Read, 0, iLine, nXSize, 1,
pabyLine, nXSize, 1, GDT_Byte,
nDstBands, NULL, nDstBands, nXSize * nDstBands, 1 );
if( eErr != CE_None )
break;
/***** read the mask band line back in *****/
if (bSetMask) {
eErr = GDALRasterIO ( hMaskBand, GF_Read, 0, iLine, nXSize, 1,
pabyMask, nXSize, 1, GDT_Byte,
0, 0 );
if( eErr != CE_None )
break;
}
ProcessLine( pabyLine, pabyMask, 0, nXSize-1, nBands, nDstBands,
nNearDist, nMaxNonBlack, bNearWhite, &oColors,
panLastLineCounts,
TRUE, // bDoHorizontalCheck
TRUE, // bDoVerticalCheck
TRUE // bBottomUp
);
ProcessLine( pabyLine, pabyMask, nXSize-1, 0, nBands, nDstBands,
nNearDist, nMaxNonBlack, bNearWhite, &oColors,
panLastLineCounts,
TRUE, // bDoHorizontalCheck
FALSE, // bDoVerticalCheck
TRUE // bBottomUp
);
eErr = GDALDatasetRasterIO( hOutDS, GF_Write, 0, iLine, nXSize, 1,
pabyLine, nXSize, 1, GDT_Byte,
nDstBands, NULL, nDstBands, nXSize * nDstBands, 1 );
if( eErr != CE_None )
break;
/***** write out the mask band line *****/
if (bSetMask) {
eErr = GDALRasterIO ( hMaskBand, GF_Write, 0, iLine, nXSize, 1,
pabyMask, nXSize, 1, GDT_Byte,
0, 0 );
if( eErr != CE_None )
break;
}
if (!bQuiet)
GDALTermProgress( 0.5 + 0.5 * (nYSize-iLine) / (double) nYSize,
NULL, NULL );
}
CPLFree(pabyLine);
if (bSetMask)
CPLFree(pabyMask);
CPLFree( panLastLineCounts );
GDALClose( hOutDS );
if( hInDS != hOutDS )
GDALClose( hInDS );
GDALDumpOpenDatasets( stderr );
CSLDestroy( argv );
CSLDestroy( papszCreationOptions );
GDALDestroyDriverManager();
return 0;
}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:101,代码来源:nearblack.cpp
示例16: main
//.........这里部分代码省略.........
/* Create a transformation object from the source to */
/* destination coordinate system. */
/* -------------------------------------------------------------------- */
if( nGCPCount != 0 && nOrder == -1 )
{
pfnTransformer = GDALTPSTransform;
hTransformArg =
GDALCreateTPSTransformer( nGCPCount, pasGCPs, FALSE );
}
else if( nGCPCount != 0 )
{
pfnTransformer = GDALGCPTransform;
hTransformArg =
GDALCreateGCPTransformer( nGCPCount, pasGCPs, nOrder, FALSE );
}
else
{
pfnTransformer = GDALGenImgProjTransform;
hTransformArg =
GDALCreateGenImgProjTransformer2( hSrcDS, hDstDS, papszTO );
}
CSLDestroy( papszTO );
if( hTransformArg == NULL )
{
exit( 1 );
}
/* -------------------------------------------------------------------- */
/* Read points from stdin, transform and write to stdout. */
/* -------------------------------------------------------------------- */
while( !feof(stdin) )
{
char szLine[1024];
if( fgets( szLine, sizeof(szLine)-1, stdin ) == NULL )
break;
char **papszTokens = CSLTokenizeString(szLine);
double dfX, dfY, dfZ = 0.0;
int bSuccess = TRUE;
if( CSLCount(papszTokens) < 2 )
{
CSLDestroy(papszTokens);
continue;
}
dfX = atof(papszTokens[0]);
dfY = atof(papszTokens[1]);
if( CSLCount(papszTokens) >= 3 )
dfZ = atof(papszTokens[2]);
if( pfnTransformer( hTransformArg, bInverse, 1,
&dfX, &dfY, &dfZ, &bSuccess )
&& bSuccess )
{
printf( "%.15g %.15g %.15g\n", dfX, dfY, dfZ );
}
else
{
printf( "transformation failed.\n" );
}
CSLDestroy(papszTokens);
}
if( nGCPCount != 0 && nOrder == -1 )
{
GDALDestroyTPSTransformer(hTransformArg);
}
else if( nGCPCount != 0 )
{
GDALDestroyGCPTransformer(hTransformArg);
}
else
{
GDALDestroyGenImgProjTransformer(hTransformArg);
}
if (nGCPCount)
{
GDALDeinitGCPs( nGCPCount, pasGCPs );
CPLFree( pasGCPs );
}
if (hSrcDS)
GDALClose(hSrcDS);
if (hDstDS)
GDALClose(hDstDS);
GDALDumpOpenDatasets( stderr );
GDALDestroyDriverManager();
CSLDestroy( argv );
return 0;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,代码来源:gdaltransform.cpp
示例17: main
//.........这里部分代码省略.........
}
}
}
else if(stOper == op_kpaths)
{
if(pszDataSource == NULL)
Usage("No network dataset provided");
if(nFromFID == -1 || nToFID == -1)
Usage("Invalid input from or to identificators");
// open
poDS = (GNMNetwork*) GDALOpenEx( pszDataSource,
GDAL_OF_UPDATE | GDAL_OF_GNM, NULL, NULL, NULL );
if(NULL == poDS)
{
fprintf( stderr, "\nFailed to open network at %s\n", pszDataSource);
nRet = 1;
goto exit;
}
if(CSLFindName(papszALO, GNM_MD_NUM_PATHS) == -1)
{
CPLDebug("GNM", "No K in options, add %d value", nK);
papszALO = CSLAddNameValue(papszALO, GNM_MD_NUM_PATHS,
CPLSPrintf("%d", nK));
}
poResultLayer = poDS->GetPath(nFromFID, nToFID, GATKShortestPath,
papszALO);
if(NULL == pszDataset)
{
ReportOnLayer(poResultLayer, bQuiet == FALSE);
}
else
{
if(CreateAndFillOutputDataset(poResultLayer, pszDataset, pszFormat,
pszLayer, papszDSCO, papszLCO, bQuiet)
!= OGRERR_NONE)
{
nRet = 1;
goto exit;
}
}
}
else if(stOper == op_resource)
{
if(pszDataSource == NULL)
Usage("No network dataset provided");
// open
poDS = (GNMNetwork*) GDALOpenEx( pszDataSource,
GDAL_OF_UPDATE | GDAL_OF_GNM, NULL, NULL, NULL );
if(NULL == poDS)
{
fprintf( stderr, "\nFailed to open network at %s\n", pszDataSource);
nRet = 1;
goto exit;
}
poResultLayer = poDS->GetPath(nFromFID, nToFID, GATConnectedComponents,
papszALO);
if(NULL == pszDataset)
{
ReportOnLayer(poResultLayer, bQuiet == FALSE);
}
else
{
if(CreateAndFillOutputDataset(poResultLayer, pszDataset, pszFormat,
pszLayer, papszDSCO, papszLCO, bQuiet)
!= OGRERR_NONE)
{
nRet = 1;
goto exit;
}
}
}
else
{
printf("\nNeed an operation. See help what you can do with gnmanalyse:\n");
Usage();
}
exit:
CSLDestroy(papszDSCO);
CSLDestroy(papszLCO);
CSLDestroy(papszALO);
if(poResultLayer != NULL)
poDS->ReleaseResultSet(poResultLayer);
if( poDS != NULL )
GDALClose( (GDALDatasetH)poDS );
GDALDestroyDriverManager();
return nRet;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:101,代码来源:gnmanalyse.cpp
示例18: MAIN_START
MAIN_START(argc, argv)
{
/* Check strict compilation and runtime library version as we use C++ API */
if (! GDAL_CHECK_VERSION(argv[0]))
exit(1);
EarlySetConfigOptions(argc, argv);
/* -------------------------------------------------------------------- */
/* Generic arg processing. */
/* -------------------------------------------------------------------- */
GDALAllRegister();
argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );
if( argc < 1 )
exit( -argc );
for( int i = 0; 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"));
CSLDestroy( argv );
return 0;
}
else if( EQUAL(argv[i],"--help") )
{
Usage();
}
}
GDALGridOptionsForBinary* psOptionsForBinary = GDALGridOptionsForBinaryNew();
/* coverity[tainted_data] */
GDALGridOptions *psOptions = GDALGridOptionsNew(argv + 1, psOptionsForBinary);
CSLDestroy( argv );
if( psOptions == nullptr )
{
Usage();
}
if( !(psOptionsForBinary->bQuiet) )
{
GDALGridOptionsSetProgress(psOptions, GDALTermProgress, nullptr);
}
if( psOptionsForBinary->pszSource == nullptr )
Usage("No input file specified.");
if( psOptionsForBinary->pszDest== nullptr )
Usage("No output file specified.");
if( psOptionsForBinary->pszDest == nullptr )
psOptionsForBinary->pszDest = CPLStrdup(psOptionsForBinary->pszSource);
/* -------------------------------------------------------------------- */
/* Open input file. */
/* -------------------------------------------------------------------- */
GDALDatasetH hInDS = GDALOpenEx( psOptionsForBinary->pszSource, GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR,
nullptr, nullptr, nullptr );
if( hInDS == nullptr )
exit( 1 );
int bUsageError = FALSE;
GDALDatasetH hOutDS = GDALGrid(psOptionsForBinary->pszDest,
hInDS,
psOptions, &bUsageError);
if(bUsageError == TRUE)
Usage();
int nRetCode = hOutDS ? 0 : 1;
GDALClose(hInDS);
GDALClose(hOutDS);
GDALGridOptionsFree(psOptions);
GDALGridOptionsForBinaryFree(psOptionsForBinary);
OGRCleanupAll();
GDALDestroyDriverManager();
return nRetCode;
}
开发者ID:jef-n,项目名称:gdal,代码行数:80,代码来源:gdal_grid_bin.cpp
示例19: main
int main(int argc, char** argv)
{
/* Check strict compilation and runtime library version as we use C++ API */
if (! GDAL_CHECK_VERSION(argv[0]))
exit(1);
EarlySetConfigOptions(argc, argv);
/* -------------------------------------------------------------------- */
/* Generic arg processing. */
/* -------------------------------------------------------------------- */
GDALAllRegister();
argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );
if( argc < 1 )
exit( -argc );
for( int i = 0; 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"));
CSLDestroy( argv );
return 0;
}
else if( EQUAL(argv[i],"--help") )
{
Usage();
}
}
GDALRasterizeOptionsForBinary* psOptionsForBinary = GDALRasterizeOptionsForBinaryNew();
GDALRasterizeOptions *psOptions = GDALRasterizeOptionsNew(argv + 1, psOptionsForBinary);
CSLDestroy( argv );
if( psOptions == NULL )
{
Usage();
}
if( !(psOptionsForBinary->bQuiet) )
{
GDALRasterizeOptionsSetProgress(psOptions, GDALTermProgress, NULL);
}
if( psOptionsForBinary->pszSource == NULL )
Usage("No input file specified.");
if( psOptionsForBinary->pszDest == NULL )
Usage("No output file specified.");
/* -------------------------------------------------------------------- */
/* Open input file. */
/* -------------------------------------------------------------------- */
GDALDatasetH hInDS = GDALOpenEx( psOptionsForBinary->pszSource, GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR,
NULL, NULL, NULL );
if( hInDS == NULL )
exit( 1 );
/* -------------------------------------------------------------------- */
/* Open output file if it exists. */
/* -------------------------------------------------------------------- */
GDALDatasetH hDstDS = NULL;
if( !(psOptionsForBinary->bCreateOutput) )
{
CPLPushErrorHandler( CPLQuietErrorHandler );
hDstDS = GDALOpenEx( psOptionsForBinary->pszDest, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR | GDAL_OF_UPDATE,
NULL, NULL, NULL );
CPLPopErrorHandler();
}
if (hDstDS == NULL && !psOptionsForBinary->bQuiet && !psOptionsForBinary->bFormatExplicitlySet)
CheckExtensionConsistency(psOptionsForBinary->pszDest, psOptionsForBinary->pszFormat);
int bUsageError = FALSE;
GDALDatasetH hRetDS = GDALRasterize(psOptionsForBinary->pszDest,
hDstDS,
hInDS,
psOptions, &bUsageError);
if(bUsageError == TRUE)
Usage();
int nRetCode = (hRetDS) ? 0 : 1;
GDALClose(hInDS);
GDALClose(hRetDS);
GDALRasterizeOptionsFree(psOptions);
GDALRasterizeOptionsForBinaryFree(psOptionsForBinary);
GDALDestroyDriverManager();
return nRetCode;
}
开发者ID:sameke,项目名称:node-gdal,代码行数:94,代码来源:gdal_rasterize_bin.cpp
示例20: main
//.........这里部分代码省略.........
else if( EQUAL(argv[i], "-norat") )
bShowRAT = FALSE;
else if( EQUAL(argv[i], "-noct") )
bShowColorTable = FALSE;
else if( EQUAL(argv[i], "-mdd") && i < argc-1 )
papszExtraMDDomains = CSLAddString( papszExtraMDDomains,
argv[++i] );
else if( argv[i][0] == '-' )
Usage();
else if( pszFilename == NULL )
pszFilename = argv[i];
else
Usage();
}
if( pszFilename == NULL )
Usage();
/* -------------------------------------------------------------------- */
/* Open dataset. */
/* -------------------------------------------------------------------- */
hDataset = GDALOpen( pszFilename, GA_ReadOnly );
if( hDataset == NULL )
{
fprintf( stderr,
"gdalinfo failed - unable to open '%s'.\n",
pszFilename );
CSLDestroy( argv );
GDALDumpOpenDatasets( stderr );
GDALDestroyDriverManager();
CPLDumpSharedList( NULL );
exit( 1 );
}
/* -------------------------------------------------------------------- */
/* Report general info. */
/* -------------------------------------------------------------------- */
hDriver = GDALGetDatasetDriver( hDataset );
printf( "Driver: %s/%s\n",
GDALGetDriverShortName( hDriver ),
GDALGetDriverLongName( hDriver ) );
papszFileList = GDALGetFileList( hDataset );
if( CSLCount(papszFileList) == 0 )
{
printf( "Files: none associated\n" );
}
else
{
printf( "Files: %s\n", papszFileList[0] );
for( i = 1; papszFileList[i] != NULL; i++ )
printf( " %s\n", papszFileList[i] );
}
CSLDestroy( papszFileList );
printf( "Size is %d, %d\n",
GDALGetRasterXSize( hDataset ),
GDALGetRasterYSize( hDataset ) );
/* -------------------------------------------------------------------- */
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:67,代码来源:gdalinfo.c
注:本文中的GDALDestroyDriverManager函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论