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


Java SimpleFeatureStore.removeFeatures方法代码示例

本文整理汇总了Java中org.geotools.data.simple.SimpleFeatureStore.removeFeatures方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleFeatureStore.removeFeatures方法的具体用法?Java SimpleFeatureStore.removeFeatures怎么用?Java SimpleFeatureStore.removeFeatures使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.data.simple.SimpleFeatureStore的用法示例。


在下文中一共展示了SimpleFeatureStore.removeFeatures方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeExample

import org.geotools.data.simple.SimpleFeatureStore; //导入方法依赖的package包/类
private void removeExample() throws Exception {
    // removeExample start
    Transaction transaction = new DefaultTransaction("removeExample");
    SimpleFeatureStore store = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
    store.setTransaction(transaction);
    
    FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Filter filter = ff.id(Collections.singleton(ff.featureId("fred")));
    try {
        store.removeFeatures(filter);
        transaction.commit();
    } catch (Exception eek) {
        transaction.rollback();
    }
    // removeExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:SimpleFeatureStoreExamples.java

示例2: removeExample2

import org.geotools.data.simple.SimpleFeatureStore; //导入方法依赖的package包/类
private void removeExample2() throws Exception {
    // removeExample2 start
    Transaction transaction = new DefaultTransaction("removeExample");
    SimpleFeatureStore store = (SimpleFeatureStore) dataStore.getFeatureSource(typeName);
    store.setTransaction(transaction);
    
    FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Filter filter = ff.id(Collections.singleton(ff.featureId("fred")));
    try {
        final Set<FeatureId> removed = new HashSet<FeatureId>();
        SimpleFeatureCollection collection = store.getFeatures( new Query( typeName, filter, Query.NO_NAMES ));
        collection.accepts( new FeatureVisitor(){
            public void visit(Feature feature) {
                removed.add( feature.getIdentifier() );
            }
        }, null );
        store.removeFeatures(filter);
        transaction.commit();
    } catch (Exception eek) {
        transaction.rollback();
    }
    // removeExample2 end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:24,代码来源:SimpleFeatureStoreExamples.java

示例3: delete

import org.geotools.data.simple.SimpleFeatureStore; //导入方法依赖的package包/类
@Override
@Transactional(rollbackFor = { Throwable.class })
public void delete(String featureId) throws LayerException {
	SimpleFeatureSource source = getFeatureSource();
	if (source instanceof SimpleFeatureStore) {
		SimpleFeatureStore store = (SimpleFeatureStore) source;
		Filter filter = filterService.createFidFilter(new String[] { featureId });
		transactionSynchronization.synchTransaction(store);
		try {
			store.removeFeatures(filter);
			if (log.isDebugEnabled()) {
				log.debug("Deleted feature {} in {}", featureId, getFeatureSourceName());
			}
		} catch (IOException ioe) {
			featureModelUsable = false;
			throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION);
		}
	} else {
		log.error("Don't know how to delete from " + getFeatureSourceName() + ", class "
				+ source.getClass().getName() + " does not implement SimpleFeatureStore");
		throw new LayerException(ExceptionCode.DELETE_NOT_IMPLEMENTED, getFeatureSourceName(), source.getClass()
				.getName());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:25,代码来源:GeoToolsLayer.java


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