本文整理汇总了C++中OGRDataSource::CopyLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRDataSource::CopyLayer方法的具体用法?C++ OGRDataSource::CopyLayer怎么用?C++ OGRDataSource::CopyLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRDataSource
的用法示例。
在下文中一共展示了OGRDataSource::CopyLayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
return poODS;
}
示例2: WrapLayer
OGRLayer *OGRDataSourceWithTransaction::CopyLayer( OGRLayer *poSrcLayer,
const char *pszNewName,
char **papszOptions )
{
if( !m_poBaseDataSource ) return NULL;
return WrapLayer(m_poBaseDataSource->CopyLayer(poSrcLayer, pszNewName, papszOptions ));
}
示例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:
JNIEXPORT jlong JNICALL Java_es_gva_cit_jogr_OGRDataSource_copyLayerNat
(JNIEnv *env, jobject obj, jlong cPtr, jlong poSrcLayer, jstring pszNewName, jobjectArray papszOptions){
OGRDataSource *ds = (OGRDataSource *) 0 ;
int longitud;
char **opciones;
OGRLayer *layer_dstno;
OGRLayer *layer;
long ptr_dtno=-1;
ds = *(OGRDataSource **)&cPtr;
layer = *(OGRLayer **)&poSrcLayer;
if(ds!=NULL && layer!=NULL){
longitud = env->GetArrayLength( papszOptions);
opciones = (char **)malloc(sizeof(char *)*longitud);
for(int i=0;i<longitud;i++){
jstring el = (jstring)env->GetObjectArrayElement(papszOptions,i);
const char *simple_option = env->GetStringUTFChars( el, 0);
opciones[i]=(char *)malloc(strlen(simple_option));
strcpy(opciones[i],simple_option);
env->ReleaseStringUTFChars( el, simple_option);
}
const char *name = env->GetStringUTFChars( pszNewName, 0);
layer_dstno = ds->CopyLayer(layer, name, opciones);
env->ReleaseStringUTFChars( pszNewName, name);
}
for(int i=0;i<longitud;i++)free(opciones[i]);
free(opciones);
if(layer_dstno==NULL)return -1;
ptr_dtno = (long)&(*layer_dstno);
return (jlong)ptr_dtno;
}