当前位置: 首页>>代码示例>>C++>>正文


C++ OGRDataSource::CopyLayer方法代码示例

本文整理汇总了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;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:35,代码来源:ogrsfdriver.cpp

示例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 ));
}
开发者ID:miccferr,项目名称:wmshp-electron,代码行数:7,代码来源:ogremulatedtransaction.cpp

示例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;
}
开发者ID:afarnham,项目名称:gdal,代码行数:42,代码来源:ogrsfdriver.cpp

示例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;
  }
开发者ID:,项目名称:,代码行数:37,代码来源:


注:本文中的OGRDataSource::CopyLayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。