本文整理汇总了C++中GDALDriver::TestCapability方法的典型用法代码示例。如果您正苦于以下问题:C++ GDALDriver::TestCapability方法的具体用法?C++ GDALDriver::TestCapability怎么用?C++ GDALDriver::TestCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GDALDriver
的用法示例。
在下文中一共展示了GDALDriver::TestCapability方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ogrDeleteDataSource
SEXP ogrDeleteDataSource (SEXP ogrSource, SEXP ogrDriver) {
#ifdef GDALV2
GDALDriver *poDriver;
#else
OGRSFDriver *poDriver;
#endif
installErrorHandler();
#ifdef GDALV2
poDriver = GetGDALDriverManager()->GetDriverByName(CHAR(STRING_ELT(ogrDriver, 0)));
#else
poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(
CHAR(STRING_ELT(ogrDriver, 0)) );
#endif
uninstallErrorHandlerAndTriggerError();
if (poDriver == NULL) {
error("Driver not available");
}
installErrorHandler();
#ifdef GDALV2
poDriver->Delete(CHAR(STRING_ELT(ogrSource, 0)));
#else
if (poDriver->TestCapability(ODrCDeleteDataSource)) {
if (poDriver->DeleteDataSource(CHAR(STRING_ELT(ogrSource, 0)))
!= OGRERR_NONE) {
uninstallErrorHandlerAndTriggerError();
error("Data source could not be deleted");
}
} else {
uninstallErrorHandlerAndTriggerError();
error("This driver is not capable of data source deletion");
}
#endif
uninstallErrorHandlerAndTriggerError();
return(R_NilValue);
}
示例2: Delaunay
int Delaunay(maps*& conf,maps*& inputs,maps*& outputs){
#ifdef DEBUG
fprintf(stderr,"\nService internal print\nStarting\n");
#endif
maps* cursor=inputs;
OGRGeometryH geometry,res;
int bufferDistance;
map* tmpm=NULL;
OGRRegisterAll();
std::vector<Point> points;
if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED)
return res;
DelaunayT T;
T.insert(points.begin(), points.end());
/* -------------------------------------------------------------------- */
/* Try opening the output datasource as an existing, writable */
/* -------------------------------------------------------------------- */
#if GDAL_VERSION_MAJOR >= 2
GDALDataset *poODS;
GDALDriverManager* poR=GetGDALDriverManager();
GDALDriver *poDriver = NULL;
#else
OGRDataSource *poODS;
OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();
OGRSFDriver *poDriver = NULL;
#endif
int iDriver;
map *tmpMap=getMapFromMaps(outputs,"Result","mimeType");
const char *oDriver;
oDriver="GeoJSON";
if(tmpMap!=NULL){
if(strcmp(tmpMap->value,"text/xml")==0){
oDriver="GML";
}
}
for( iDriver = 0;
iDriver < poR->GetDriverCount() && poDriver == NULL;
iDriver++ )
{
#ifdef DEBUG
#if GDAL_VERSION_MAJOR >= 2
fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetDescription());
#else
fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName());
#endif
#endif
if( EQUAL(
#if GDAL_VERSION_MAJOR >= 2
poR->GetDriver(iDriver)->GetDescription()
#else
poR->GetDriver(iDriver)->GetName()
#endif
,
oDriver) )
{
poDriver = poR->GetDriver(iDriver);
}
}
if( poDriver == NULL )
{
char emessage[8192];
sprintf( emessage, "Unable to find driver `%s'.\n", oDriver );
sprintf( emessage, "%sThe following drivers are available:\n",emessage );
for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
{
#if GDAL_VERSION_MAJOR >= 2
sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() );
#else
sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
#endif
}
setMapInMaps(conf,"lenv","message",emessage);
return SERVICE_FAILED;
}
#if GDAL_VERSION_MAJOR >=2
if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) )
#else
if( !poDriver->TestCapability( ODrCCreateDataSource ) )
#endif
{
char emessage[1024];
sprintf( emessage, "%s driver does not support data source creation.\n",
"json" );
setMapInMaps(conf,"lenv","message",emessage);
return SERVICE_FAILED;
}
/* -------------------------------------------------------------------- */
/* Create the output data source. */
/* -------------------------------------------------------------------- */
char *pszDestDataSource=(char*)malloc(100);
//.........这里部分代码省略.........