本文整理汇总了C++中GDALDestroyDriverManager函数的典型用法代码示例。如果您正苦于以下问题:C++ GDALDestroyDriverManager函数的具体用法?C++ GDALDestroyDriverManager怎么用?C++ GDALDestroyDriverManager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GDALDestroyDriverManager函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: GDALDestroyDriverManager
GDALImageFileType::~GDALImageFileType(void)
{
#ifdef OSG_WITH_GDAL
GDALDestroyDriverManager();
CPLCleanupTLS();
#endif
}
示例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;
}
示例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;
}
示例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;
}
}
示例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
}
示例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 );
}
示例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 );
}
示例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
}
示例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;
}
示例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;
}
示例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.");
//.........这里部分代码省略.........
示例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;
}
示例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;
}
示例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;
}