本文整理汇总了C++中CPLPushErrorHandler函数的典型用法代码示例。如果您正苦于以下问题:C++ CPLPushErrorHandler函数的具体用法?C++ CPLPushErrorHandler怎么用?C++ CPLPushErrorHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CPLPushErrorHandler函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CPLFree
OGRErr OGRSQLiteSelectLayerCommonBehaviour::SetAttributeFilter( const char *pszQuery )
{
char*& m_pszAttrQuertyString = poLayer->GetAttrQueryString();
if( m_pszAttrQuertyString == NULL && pszQuery == NULL )
return OGRERR_NONE;
CPLFree(m_pszAttrQuertyString);
m_pszAttrQuertyString = (pszQuery) ? CPLStrdup(pszQuery) : NULL;
bAllowResetReadingEvenIfIndexAtZero = TRUE;
OGRFeatureQuery oQuery;
CPLPushErrorHandler(CPLQuietErrorHandler);
int bHasSpecialFields = (pszQuery != NULL && pszQuery[0] != '\0' &&
oQuery.Compile( poLayer->GetLayerDefn(), pszQuery ) == OGRERR_NONE &&
HasSpecialFields((swq_expr_node*)oQuery.GetSWQExpr(), poLayer->GetLayerDefn()->GetFieldCount()) );
CPLPopErrorHandler();
if( bHasSpecialFields || !BuildSQL() )
{
return poLayer->BaseSetAttributeFilter(pszQuery);
}
ResetReading();
return OGRERR_NONE;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:29,代码来源:ogrsqliteselectlayer.cpp
示例2: m_isDebug
Debug::Debug(bool isDebug, pdal::LogPtr log)
: m_isDebug(isDebug)
, m_log(log)
{
if (m_isDebug)
{
const char* gdal_debug = ::pdal::Utils::getenv("CPL_DEBUG");
if (gdal_debug == 0)
{
pdal::Utils::putenv("CPL_DEBUG=ON");
}
m_gdal_callback = boost::bind(&Debug::log, this, _1, _2, _3);
}
else
{
m_gdal_callback = boost::bind(&Debug::error, this, _1, _2, _3);
}
#if ((GDAL_VERSION_MAJOR == 1 && GDAL_VERSION_MINOR >= 9) || (GDAL_VERSION_MAJOR > 1))
CPLPushErrorHandlerEx(&Debug::trampoline, this);
#else
CPLPushErrorHandler(&Debug::trampoline);
#endif
}
开发者ID:mweisman,项目名称:PDAL,代码行数:25,代码来源:GDALUtils.cpp
示例3: pszEncoding
int IMapInfoFile::TestUtf8Capability() const
{
const char* pszEncoding( GetEncoding() );
if( strlen( pszEncoding ) == 0 )
{
return FALSE;
}
CPLClearRecodeWarningFlags();
CPLErrorReset();
CPLPushErrorHandler(CPLQuietErrorHandler);
char* pszTest( CPLRecode( "test", GetEncoding(), CPL_ENC_UTF8 ) );
CPLPopErrorHandler();
if( pszTest == nullptr )
{
return FALSE;
}
CPLFree( pszTest );
if( CPLGetLastErrorType() != 0 )
{
return FALSE;
}
return TRUE;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:29,代码来源:mitab_imapinfofile.cpp
示例4: GeoJSONStringPropertyToFieldType
OGRFieldType GeoJSONStringPropertyToFieldType( json_object* poObject )
{
if (poObject == NULL) {
return OFTString;
}
const char* pszStr = json_object_get_string( poObject );
OGRField sWrkField;
CPLPushErrorHandler(CPLQuietErrorHandler);
int bSuccess = OGRParseDate( pszStr, &sWrkField, 0 );
CPLPopErrorHandler();
CPLErrorReset();
if( bSuccess )
{
int bHasDate = strchr( pszStr, '/' ) != NULL ||
strchr( pszStr, '-' ) != NULL;
int bHasTime = strchr( pszStr, ':' ) != NULL;
if( bHasDate && bHasTime )
return OFTDateTime;
else if( bHasDate )
return OFTDate;
else
return OFTTime;
}
return OFTString;
}
开发者ID:drownedout,项目名称:datamap,代码行数:26,代码来源:ogrgeojsonutils.cpp
示例5: GetLayerDefn
OGRFeature * OGRGFTTableLayer::GetFeature( GIntBig nFID )
{
GetLayerDefn();
CPLString osSQL("SELECT ROWID");
for(int i=0;i<poFeatureDefn->GetFieldCount();i++)
{
osSQL += ",";
const char* pszFieldName =
poFeatureDefn->GetFieldDefn(i)->GetNameRef();
osSQL += EscapeAndQuote(pszFieldName);
}
if (bHiddenGeometryField)
{
osSQL += ",";
osSQL += EscapeAndQuote(GetGeometryColumn());
}
osSQL += " FROM ";
osSQL += osTableId;
osSQL += CPLSPrintf(" WHERE ROWID='" CPL_FRMT_GIB "'", nFID);
CPLPushErrorHandler(CPLQuietErrorHandler);
CPLHTTPResult * psResult = poDS->RunSQL(osSQL);
CPLPopErrorHandler();
if (psResult == NULL)
return NULL;
char* pszLine = (char*) psResult->pabyData;
if (pszLine == NULL || psResult->pszErrBuf != NULL)
{
CPLHTTPDestroyResult(psResult);
return NULL;
}
/* skip header line */
pszLine = OGRGFTGotoNextLine(pszLine);
if (pszLine == NULL || pszLine[0] == 0)
{
CPLHTTPDestroyResult(psResult);
return NULL;
}
int nLen = (int)strlen(pszLine);
if (nLen > 0 && pszLine[nLen-1] == '\n')
pszLine[nLen-1] = '\0';
OGRFeature* poFeature = BuildFeatureFromSQL(pszLine);
CPLHTTPDestroyResult(psResult);
return poFeature;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:54,代码来源:ogrgfttablelayer.cpp
示例6: CPLPushErrorHandler
void object::test<2>()
{
if( GDALHasTriangulation() )
{
double adfX[] = { 0, 1, 2, 3 };
double adfY[] = { 0, 1, 2, 3 };
CPLPushErrorHandler(CPLQuietErrorHandler);
psDT = GDALTriangulationCreateDelaunay(4, adfX, adfY);
CPLPopErrorHandler();
ensure(psDT == nullptr);
}
}
开发者ID:jef-n,项目名称:gdal,代码行数:12,代码来源:test_triangulation.cpp
示例7: CPLPushErrorHandler
void object::test<1>()
{
if( GDALHasTriangulation() )
{
double adfX[] = { 0, -5, -5, 5, 5 };
double adfY[] = { 0, -5, 5, -5, 5 };
CPLPushErrorHandler(CPLQuietErrorHandler);
psDT = GDALTriangulationCreateDelaunay(2, adfX, adfY);
CPLPopErrorHandler();
ensure(psDT == NULL);
}
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:12,代码来源:test_triangulation.cpp
示例8: main
int main( int argc, char **argv )
{
QCoreApplication app( argc, argv );
const QStringList args = QCoreApplication::arguments();
bool verbose = false;
for ( const QString &arg : args )
{
if ( arg == QLatin1String( "--verbose" ) )
verbose = true;
}
QgsApplication::init();
if ( !QgsApplication::isRunningFromBuildDir() )
{
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
QgsApplication::setPrefixPath( prefixPath ? prefixPath : CMAKE_INSTALL_PREFIX, TRUE );
}
if ( verbose )
std::cout << "Synchronizing CRS database with GDAL/PROJ definitions." << std::endl;
CPLPushErrorHandler( showError );
int res = QgsCoordinateReferenceSystem::syncDatabase();
CPLPopErrorHandler();
if ( res == 0 && verbose )
{
std::cout << "No CRS updates were necessary." << std::endl;
}
else if ( res > 0 && verbose )
{
std::cout << res << " CRSs updated." << std::endl;
}
else if ( res == std::numeric_limits<int>::min() )
{
std::cout << "CRSs synchronization not possible." << std::endl;
}
else if ( res < 0 )
{
std::cout << -res << " CRSs could not be updated." << std::endl;
}
QgsApplication::exitQgis();
return 0;
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:52,代码来源:main.cpp
示例9: gv_manager_get_dataset
GDALDatasetH gv_manager_get_dataset( GvManager *manager, const char * filename)
{
int i;
GvDataset *ds;
GDALDatasetH dataset;
/*
* Check for dataset in existing list of open files. Note that our
* filename check does not account for different possible names for
* one dataset.
*/
for( i = 0; i < manager->datasets->len; i++ )
{
ds = (GvDataset *) g_ptr_array_index(manager->datasets, i);
if( EQUAL(GDALGetDescription(ds->dataset),filename) )
{
return ds->dataset;
}
}
/*
* Try to open the dataset, preferably with update access. We don't
* want to report update access errors so we supress error reporting
* temporarily.
*/
CPLErrorReset();
CPLPushErrorHandler( CPLQuietErrorHandler );
dataset = GDALOpen( filename, GA_Update );
CPLPopErrorHandler();
if( dataset == NULL )
{
dataset = GDALOpen( filename, GA_ReadOnly );
}
if( dataset == NULL )
return NULL;
/*
* Add the dataset to the list of managed datasets.
*/
ds = g_new(GvDataset,1);
ds->dataset = dataset;
ds->rasters = g_new0(GvRaster *, GDALGetRasterCount(dataset));
g_ptr_array_add( manager->datasets, ds );
return dataset;
}
开发者ID:Onjrew,项目名称:OpenEV,代码行数:52,代码来源:gvmanager.c
示例10: GetLayerAndOverwriteIfNecessary
static OGRLayer* GetLayerAndOverwriteIfNecessary(GDALDataset *poDstDS,
const char* pszNewLayerName,
int bOverwrite,
int* pbErrorOccured)
{
if( pbErrorOccured )
*pbErrorOccured = FALSE;
/* GetLayerByName() can instanciate layers that would have been */
/* 'hidden' otherwise, for example, non-spatial tables in a */
/* Postgis-enabled database, so this apparently useless command is */
/* not useless... (#4012) */
CPLPushErrorHandler(CPLQuietErrorHandler);
OGRLayer* poDstLayer = poDstDS->GetLayerByName(pszNewLayerName);
CPLPopErrorHandler();
CPLErrorReset();
int iLayer = -1;
if (poDstLayer != NULL)
{
int nLayerCount = poDstDS->GetLayerCount();
for( iLayer = 0; iLayer < nLayerCount; iLayer++ )
{
OGRLayer *poLayer = poDstDS->GetLayer(iLayer);
if (poLayer == poDstLayer)
break;
}
if (iLayer == nLayerCount)
/* shouldn't happen with an ideal driver */
poDstLayer = NULL;
}
/* -------------------------------------------------------------------- */
/* If the user requested overwrite, and we have the layer in */
/* question we need to delete it now so it will get recreated */
/* (overwritten). */
/* -------------------------------------------------------------------- */
if( poDstLayer != NULL && bOverwrite )
{
if( poDstDS->DeleteLayer( iLayer ) != OGRERR_NONE )
{
fprintf( stderr,
"DeleteLayer() failed when overwrite requested.\n" );
if( pbErrorOccured )
*pbErrorOccured = TRUE;
}
poDstLayer = NULL;
}
return poDstLayer;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:52,代码来源:gnmanalyse.cpp
示例11: msGDALInitialize
void msGDALInitialize( void )
{
if( !bGDALInitialized ) {
msAcquireLock( TLOCK_GDAL );
GDALAllRegister();
CPLPushErrorHandler( CPLQuietErrorHandler );
msReleaseLock( TLOCK_GDAL );
bGDALInitialized = 1;
}
}
开发者ID:Dafvid,项目名称:mapserver,代码行数:13,代码来源:mapgdal.c
示例12: RGDAL_OpenDataset
SEXP
RGDAL_OpenDataset(SEXP filename, SEXP read_only, SEXP silent) {
const char *fn = asString(filename);
GDALAccess RWFlag;
if (asLogical(read_only))
RWFlag = GA_ReadOnly;
else
RWFlag = GA_Update;
/* Modification suggested by Even Rouault, 2009-08-08: */
CPLErrorReset();
if (asLogical(silent))
CPLPushErrorHandler(CPLQuietErrorHandler);
else
installErrorHandler();
GDALDataset *pDataset = (GDALDataset *) GDALOpen(fn, RWFlag);
if (pDataset == NULL)
error("%s\n", CPLGetLastErrorMsg());
if (asLogical(silent))
CPLPopErrorHandler();
else
uninstallErrorHandlerAndTriggerError();
/* Similarly to SWIG bindings, the following lines will cause
RGDAL_OpenDataset() to fail on - uncleared - errors even if pDataset is not
NULL. They could also be just removed. While pDataset != NULL, there's some
hope ;-) */
/* CPLErr eclass = CPLGetLastErrorType();
if (pDataset != NULL && eclass == CE_Failure) {
GDALClose(pDataset);
pDataset = NULL;
__errorHandler(eclass, CPLGetLastErrorNo(), CPLGetLastErrorMsg());
}*/
SEXP sxpHandle = R_MakeExternalPtr((void *) pDataset,
mkChar("GDAL Dataset"),
R_NilValue);
return(sxpHandle);
}
开发者ID:jeroenooms,项目名称:rgdal,代码行数:51,代码来源:gdal-bindings.cpp
示例13: osChangedSQL
int OGRGFTResultLayer::FetchNextRows()
{
if (!EQUALN(osSQL.c_str(), "SELECT", 6))
return FALSE;
aosRows.resize(0);
CPLString osChangedSQL(osSQL);
if (osSQL.ifind(" OFFSET ") == std::string::npos &&
osSQL.ifind(" LIMIT ") == std::string::npos)
{
osChangedSQL += CPLSPrintf(" OFFSET %d LIMIT %d",
nOffset, GetFeaturesToFetch());
}
CPLPushErrorHandler(CPLQuietErrorHandler);
CPLHTTPResult * psResult = poDS->RunSQL(osChangedSQL);
CPLPopErrorHandler();
if (psResult == NULL)
{
bEOF = TRUE;
return FALSE;
}
char* pszLine = (char*) psResult->pabyData;
if (pszLine == NULL ||
psResult->pszErrBuf != NULL)
{
CPLError(CE_Failure, CPLE_AppDefined, "RunSQL() failed");
CPLHTTPDestroyResult(psResult);
bEOF = TRUE;
return FALSE;
}
pszLine = OGRGFTGotoNextLine(pszLine);
if (pszLine == NULL)
{
CPLHTTPDestroyResult(psResult);
bEOF = TRUE;
return FALSE;
}
ParseCSVResponse(pszLine, aosRows);
CPLHTTPDestroyResult(psResult);
bEOF = (int)aosRows.size() < GetFeaturesToFetch();
return TRUE;
}
开发者ID:0004c,项目名称:node-gdal,代码行数:51,代码来源:ogrgftresultlayer.cpp
示例14: osSQLCommand
OGRLayer* OGRPLScenesDataset::ExecuteSQL( const char *pszSQLCommand,
OGRGeometry *poSpatialFilter,
const char *pszDialect )
{
if( EQUALN(pszSQLCommand, "SELECT ", strlen("SELECT ")) )
{
swq_select oSelect;
CPLString osSQLCommand(pszSQLCommand);
size_t nLimitPos = osSQLCommand.ifind(" limit ");
if( nLimitPos != std::string::npos )
osSQLCommand.resize(nLimitPos);
CPLPushErrorHandler(CPLQuietErrorHandler);
OGRErr eErr = oSelect.preparse(osSQLCommand);
CPLPopErrorHandler();
if( eErr != OGRERR_NONE )
return GDALDataset::ExecuteSQL(pszSQLCommand, poSpatialFilter, pszDialect);
/* -------------------------------------------------------------------- */
/* ORDER BY optimization on acquired field */
/* -------------------------------------------------------------------- */
if( oSelect.join_count == 0 && oSelect.poOtherSelect == NULL &&
oSelect.table_count == 1 && oSelect.order_specs == 1 &&
strcmp(oSelect.order_defs[0].field_name, "acquired") == 0 )
{
int idx;
OGRPLScenesLayer* poLayer = NULL;
for(idx = 0; idx < nLayers; idx ++ )
{
if( strcmp( papoLayers[idx]->GetName(),
oSelect.table_defs[0].table_name) == 0 )
{
poLayer = papoLayers[idx];
break;
}
}
if( poLayer != NULL )
{
poLayer->SetAcquiredOrderingFlag(
oSelect.order_defs[0].ascending_flag);
OGRLayer* poRet = GDALDataset::ExecuteSQL(pszSQLCommand, poSpatialFilter, pszDialect);
if( poRet )
oMapResultSetToSourceLayer[poRet] = poLayer;
return poRet;
}
}
}
return GDALDataset::ExecuteSQL(pszSQLCommand, poSpatialFilter, pszDialect);
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:49,代码来源:ogrplscenesdataset.cpp
示例15: OGR2SQLITE_ST_Area
static
void OGR2SQLITE_ST_Area(sqlite3_context* pContext,
int argc, sqlite3_value** argv)
{
OGRGeometry* poGeom = OGR2SQLITE_GetGeom(pContext, argc, argv, NULL);
if( poGeom != NULL )
{
CPLPushErrorHandler(CPLQuietErrorHandler);
sqlite3_result_double( pContext, OGR_G_Area((OGRGeometryH)poGeom) );
CPLPopErrorHandler();
}
else
sqlite3_result_null(pContext);
delete poGeom;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:15,代码来源:ogrsqlitesqlfunctions.cpp
示例16: OGR2SQLITE_ST_SRID
static
void OGR2SQLITE_ST_SRID(sqlite3_context* pContext,
int argc, sqlite3_value** argv)
{
int nSRSId = -1;
OGRGeometry* poGeom = OGR2SQLITE_GetGeom(pContext, argc, argv, &nSRSId);
if( poGeom != NULL )
{
CPLPushErrorHandler(CPLQuietErrorHandler);
sqlite3_result_int( pContext, nSRSId );
CPLPopErrorHandler();
}
else
sqlite3_result_null(pContext);
delete poGeom;
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:16,代码来源:ogrsqlitesqlfunctions.cpp
示例17: p4s_from_spatial_reference
Rcpp::CharacterVector p4s_from_spatial_reference(OGRSpatialReference *ref) {
Rcpp::CharacterVector proj4string(1);
char *cp;
CPLPushErrorHandler(CPLQuietErrorHandler); // don't break on EPSG's without proj4string
ref->morphFromESRI();
(void) ref->exportToProj4(&cp);
// eliminate trailing white space, the C-way:
if (strlen(cp) > 0)
for (char *cpws = cp + strlen(cp) - 1; cpws != cp && *cpws == ' '; cpws--)
*cpws = '\0';
proj4string[0] = cp;
CPLFree(cp);
CPLPopErrorHandler();
return proj4string;
}
开发者ID:rundel,项目名称:sfr,代码行数:17,代码来源:gdal.cpp
示例18: CPLPushErrorHandlerEx
GlobalDebug::GlobalDebug()
{
const char* gdal_debug = ::pdal::Utils::getenv("CPL_DEBUG");
if (gdal_debug == 0)
{
pdal::Utils::putenv("CPL_DEBUG=ON");
}
m_gdal_callback = boost::bind(&GlobalDebug::log, this, _1, _2, _3);
#if ((GDAL_VERSION_MAJOR == 1 && GDAL_VERSION_MINOR >= 9) || (GDAL_VERSION_MAJOR > 1))
CPLPushErrorHandlerEx(&GlobalDebug::trampoline, this);
#else
CPLPushErrorHandler(&GlobalDebug::trampoline);
#endif
}
开发者ID:mweisman,项目名称:PDAL,代码行数:17,代码来源:GDALUtils.cpp
示例19: CSLAddString
char* OGRCouchDBDataSource::GetETag(const char* pszURI)
{
// make a head request and only return the etag response header
char* pszEtag = NULL;
char **papszTokens;
char** papszOptions = NULL;
bMustCleanPersistant = TRUE;
papszOptions = CSLAddString(papszOptions, CPLSPrintf("PERSISTENT=CouchDB:%p", this));
papszOptions = CSLAddString(papszOptions, "HEADERS=Content-Type: application/json");
papszOptions = CSLAddString(papszOptions, "NO_BODY=1");
if (osUserPwd.size())
{
CPLString osUserPwdOption("USERPWD=");
osUserPwdOption += osUserPwd;
papszOptions = CSLAddString(papszOptions, osUserPwdOption);
}
CPLDebug("CouchDB", "HEAD %s", pszURI);
CPLString osFullURL(osURL);
osFullURL += pszURI;
CPLPushErrorHandler(CPLQuietErrorHandler);
CPLHTTPResult * psResult = CPLHTTPFetch( osFullURL, papszOptions);
CPLPopErrorHandler();
CSLDestroy(papszOptions);
if (psResult == NULL)
return NULL;
if (CSLFetchNameValue(psResult->papszHeaders, "Etag") != NULL)
{
papszTokens =
CSLTokenizeString2( CSLFetchNameValue(psResult->papszHeaders, "Etag"), "\"\r\n", 0 );
pszEtag = CPLStrdup(papszTokens[0]);
CSLDestroy( papszTokens );
}
CPLHTTPDestroyResult(psResult);
return pszEtag;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:46,代码来源:ogrcouchdbdatasource.cpp
示例20: CPLPushErrorHandler
void gdal::fast_delete_and_close( gdal::dataset_unique_ptr &dataset, GDALDriverH driver, const QString &path )
{
// see https://github.com/qgis/QGIS/commit/d024910490a39e65e671f2055c5b6543e06c7042#commitcomment-25194282
// faster if we close the handle AFTER delete, but doesn't work for windows
#ifdef Q_OS_WIN
// close dataset handle
dataset.reset();
#endif
CPLPushErrorHandler( CPLQuietErrorHandler );
GDALDeleteDataset( driver, path.toUtf8().constData() );
CPLPopErrorHandler();
#ifndef Q_OS_WIN
// close dataset handle
dataset.reset();
#endif
}
开发者ID:CS-SI,项目名称:QGIS,代码行数:18,代码来源:qgsogrutils.cpp
注:本文中的CPLPushErrorHandler函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论