本文整理汇总了C++中OGRDataSource::GetDriver方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRDataSource::GetDriver方法的具体用法?C++ OGRDataSource::GetDriver怎么用?C++ OGRDataSource::GetDriver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRDataSource
的用法示例。
在下文中一共展示了OGRDataSource::GetDriver方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGR_Dr_CreateDataSource
OGRDataSourceH OGR_Dr_CreateDataSource( OGRSFDriverH hDriver,
const char *pszName,
char ** papszOptions )
{
VALIDATE_POINTER1( hDriver, "OGR_Dr_CreateDataSource", NULL );
OGRSFDriver* poDriver = (OGRSFDriver *) hDriver;
CPLAssert( NULL != poDriver );
OGRDataSource* poDS = NULL;
poDS = poDriver->CreateDataSource( pszName, papszOptions );
/* This fix is explained in Ticket #1223 */
if( NULL != poDS )
{
poDS->SetDriver( poDriver );
CPLAssert( NULL != poDS->GetDriver() );
}
else
{
CPLDebug( "OGR", "CreateDataSource operation failed. NULL pointer returned." );
}
return (OGRDataSourceH) poDS;
}
示例2: OGR_Dr_Open
OGRDataSourceH OGR_Dr_Open( OGRSFDriverH hDriver, const char *pszName,
int bUpdate )
{
VALIDATE_POINTER1( hDriver, "OGR_Dr_Open", NULL );
OGRDataSource *poDS = ((OGRSFDriver *)hDriver)->Open( pszName, bUpdate );
if( poDS != NULL && poDS->GetDriver() == NULL )
poDS->SetDriver( (OGRSFDriver *)hDriver );
return (OGRDataSourceH) poDS;
}
示例3: CPLError
OGRDataSource *OGRSFDriver::CopyDataSource( OGRDataSource *poSrcDS,
const char *pszNewName,
char **papszOptions )
{
if( !TestCapability( ODrCCreateDataSource ) )
{
CPLError( CE_Failure, CPLE_NotSupported,
"%s driver does not support data source creation.",
GetName() );
return NULL;
}
OGRDataSource *poODS;
poODS = CreateDataSource( pszNewName, papszOptions );
if( poODS == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Process each data source layer. */
/* -------------------------------------------------------------------- */
for( int iLayer = 0; iLayer < poSrcDS->GetLayerCount(); iLayer++ )
{
OGRLayer *poLayer = poSrcDS->GetLayer(iLayer);
if( poLayer == NULL )
continue;
poODS->CopyLayer( poLayer, poLayer->GetLayerDefn()->GetName(),
papszOptions );
}
/* Make sure that the driver is attached to the created datasource */
/* It is also done in OGR_Dr_CopyDataSource() C method, in case */
/* another C++ implementation forgets to do it. Currently (Nov 2011), */
/* this implementation is the only one in the OGR source tree */
if( poODS != NULL && poODS->GetDriver() == NULL )
poODS->SetDriver( this );
return poODS;
}
示例4: OGR_Dr_CopyDataSource
OGRDataSourceH OGR_Dr_CopyDataSource( OGRSFDriverH hDriver,
OGRDataSourceH hSrcDS,
const char *pszNewName,
char **papszOptions )
{
VALIDATE_POINTER1( hDriver, "OGR_Dr_CopyDataSource", NULL );
VALIDATE_POINTER1( hSrcDS, "OGR_Dr_CopyDataSource", NULL );
VALIDATE_POINTER1( pszNewName, "OGR_Dr_CopyDataSource", NULL );
OGRDataSource* poDS =
((OGRSFDriver *) hDriver)->CopyDataSource(
(OGRDataSource *) hSrcDS, pszNewName, papszOptions );
/* Make sure that the driver is attached to the created datasource */
/* if not already done by the implementation of the CopyDataSource() */
/* method */
if( poDS != NULL && poDS->GetDriver() == NULL )
poDS->SetDriver( (OGRSFDriver *)hDriver );
return (OGRDataSourceH)poDS;
}