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


Java FilterFactory2.id方法代码示例

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


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

示例1: addDeleteNewFeature

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
public static void addDeleteNewFeature(SimpleFeatureType sft, FeatureStore producerFS)
        throws InterruptedException, IOException {
    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(sft);
    DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    final Random random = new Random();

    String id = "1000";

    builder.add("Antoninus"); // name
    builder.add((int) Math.round(random.nextDouble()*110)); // age
    builder.add(new Date()); // dtg
    builder.add(WKTUtils$.MODULE$.read("POINT(-1 -1)")); // geom
    SimpleFeature feature = builder.buildFeature(id);

    featureCollection.add(feature);
    producerFS.addFeatures(featureCollection);

    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Filter idFilter = ff.id(ff.featureId(id));
    producerFS.removeFeatures(idFilter);
}
 
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:22,代码来源:KafkaQuickStart.java

示例2: id

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
public void id(){
    // id start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Filter filter;
    
    filter = ff.id(ff.featureId("CITY.98734597823459687235"),
                   ff.featureId("CITY.98734592345235823474"));
    // id end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:10,代码来源:FilterExamples.java

示例3: rid

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
public void rid() throws Exception {
    // rid start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Filter filter;
    
    // grab a specific revision
    filter = ff.id( ff.featureId("CITY.98734597823459687235","A457") );
    
    // You can also use ResourceId to grab a specific revision
    filter = ff.id( ff.resourceId("CITY.98734597823459687235","A457", new Version()) );
    
    // grab the one before that
    filter = ff.id(ff.resourceId("CITY.98734597823459687235","A457",new Version(Action.PREVIOUS) ));
    
     // grab the one after that
    filter = ff.id(ff.resourceId("CITY.98734597823459687235","A457",new Version(Action.NEXT) ));
    
     // grab the first one
    filter = ff.id(ff.resourceId("CITY.98734597823459687235","A457",new Version(Action.FIRST) ));
    
    // grab the first one (ie index = 1 )
    filter = ff.id(ff.resourceId("CITY.98734597823459687235","A457",new Version(1) ));
    
    // grab the twelfth record in the sequence (ie index = 12 )
    filter = ff.id(ff.resourceId("CITY.98734597823459687235","A457",new Version(12) ));
    
    // Grab the entry close to Jan 1985
    DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT );
    df.setTimeZone(TimeZone.getTimeZone("GMT"));
    filter = ff.id(ff.resourceId("CITY.98734597823459687235","A457",new Version(df.parse("1985-1-1"))));
    
     // Grab all the entries in the 1990s
    filter = ff.id(ff.resourceId("CITY.98734597823459687235",df.parse("1990-1-1"),df.parse("2000-1-1")));
    
    // rid end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:37,代码来源:FilterExamples.java

示例4: idSet

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
public void idSet(){
    // idSet start
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Filter filter;
    
    Set<FeatureId> selected = new HashSet<FeatureId>();
    selected.add(ff.featureId("CITY.98734597823459687235"));
    selected.add(ff.featureId("CITY.98734592345235823474"));
    
    filter = ff.id(selected);
    // idSet end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:13,代码来源:FilterExamples.java

示例5: grabSelectedIds

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
/**
 * How to find Features using IDs?
 * 
 * Each Feature has a FeatureID; you can use these FeatureIDs to request the feature again later.
 * 
 * If you have a Set<String> of feature IDs, which you would like to query from a shapefile:
 * 
 * @param selection
 *            Set of FeatureIDs identifying requested content
 * @return Selected Features
 * @throws IOException
 */
// grabSelectedIds start
SimpleFeatureCollection grabSelectedIds(Set<String> selection) throws IOException {
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    
    Set<FeatureId> fids = new HashSet<FeatureId>();
    for (String id : selection) {
        FeatureId fid = ff.featureId(id);
        fids.add(fid);
    }
    Filter filter = ff.id(fids);
    return featureSource.getFeatures(filter);
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:25,代码来源:FilterExamples.java

示例6: twoFeatureTypeStyles

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
private void twoFeatureTypeStyles() {
    // twoFeatureTypeStyles start
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
    FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2();
    
    Style style = styleFactory.getDefaultStyle();
    
    // Feature type style 1
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.featureTypeNames().add(new NameImpl("feature-type-1"));
    style.featureTypeStyles().add(fts);
    
    // Feature type style 2
    FeatureTypeStyle fts2 = styleFactory.createFeatureTypeStyle();
    fts2.featureTypeNames().add(new NameImpl("feature-type-2"));
    
    // creating the rule 1
    Rule rule1 = styleFactory.createRule();
    rule1.setName("rule1");
    Filter aFilter = filterFactory.id(Collections.singleton(filterFactory.featureId("FID")));
    rule1.setFilter(aFilter);
    fts2.rules().add(rule1);
    
    // creating the rule 2
    Rule rule2 = styleFactory.createRule();
    rule2.setIsElseFilter(true);
    rule2.setName("rule2");
    fts2.rules().add(rule2);
    
    style.featureTypeStyles().add(fts2);
    // twoFeatureTypeStyles end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:33,代码来源:StyleExamples.java


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