org.geotools.filter.Filters.accept()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.geotools.filter.Filters.accept()方法的一些代码示例,展示了Filters.accept()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Filters.accept()方法的具体详情如下:
包路径:org.geotools.filter.Filters
类名称:Filters
方法名:accept

Filters.accept介绍

[英]Safely visit the provided filter.

This method handles the case of:

  • Filter.INCLUDES: will call FilterVisitor2 method if available
  • Filter.EXCLUDES: will call FilterVisitor2 method if available
  • org.geotools.filter.Filter: will visit
    Please note that when called with a strict org.opengis.filter.Filter this method will fail with a ClassCastException
    [中]安全访问提供的过滤器。
    此方法处理以下情况:
    *过滤器。包括:如果可用,将调用FilterVisitor2方法
    过滤器。排除:将调用FilterVisitor2方法(如果可用)
    组织。地理工具。滤器过滤器:将访问
    请注意,当使用严格的
    组织调用时。opengis。滤器Filter
    此方法将因ClassCastException而失败

代码示例

代码示例来源:origin: org.geotools/gt-shapefile-renderer

public void visit(LogicFilter filter) {
  Iterator iter = filter.getFilterIterator();
  while (iter.hasNext()) {
    org.opengis.filter.Filter f = (org.opengis.filter.Filter) iter.next();
    Filters.accept(f, this);
  }
}

代码示例来源:origin: org.geotools/gt-main

/**
 * @see org.geotools.filter.FilterVisitor#visit(org.geotools.filter.LogicFilter)
 * @deprecated use one of {@link #visit(And, Object)},{@link #visit(Or, Object)},
 *     {@link #visit(Not, Object)}
 */
public void visit(LogicFilter filter) {
  for (Iterator it = filter.getFilterIterator(); it.hasNext();) {
    Filters.accept((org.opengis.filter.Filter)it.next(),this);
  }
}

代码示例来源:origin: org.geotools/gt2-shapefile-renderer

public void visit(LogicFilter filter) {
  Iterator iter = filter.getFilterIterator();
  while (iter.hasNext()) {
    org.opengis.filter.Filter f = (org.opengis.filter.Filter) iter.next();
    Filters.accept(f, this);
  }
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * @see org.geotools.filter.FilterVisitor#visit(org.geotools.filter.LogicFilter)
 * @deprecated use one of {@link #visit(And, Object)},{@link #visit(Or, Object)},
 *     {@link #visit(Not, Object)}
 */
public void visit(LogicFilter filter) {
  for (Iterator it = filter.getFilterIterator(); it.hasNext();) {
    Filters.accept((org.opengis.filter.Filter)it.next(),this);
  }
}

代码示例来源:origin: org.geotools/gt2-shapefile

/**
 * @see org.geotools.filter.FilterVisitor#visit(org.geotools.filter.LogicFilter)
 */
public void visit(LogicFilter filter) {
  switch (filter.getFilterType()) {
  case AbstractFilter.LOGIC_NOT:
    LOGGER.finest("[NOT] LogicFilter ignored!");
    break;
  case AbstractFilter.LOGIC_OR:
    LOGGER.finest("[OR] LogicFilter ignored!");
    break;
  case AbstractFilter.LOGIC_AND:
    Iterator list = filter.getFilterIterator();
    while (list.hasNext()) {
      Filters.accept((org.opengis.filter.Filter)list.next(),this);
    }
    break;
  default:
    LOGGER.finest("LogicFilter ignored!");
  }
}

代码示例来源:origin: org.geotools/gt2-main

public void visit(LogicFilter filter) {
  LogicFilter copy = null;
  
  Iterator iterator = filter.getFilterIterator();
  
  List subFilters = new ArrayList();
  while (iterator.hasNext()) {
    org.opengis.filter.Filter subFilter = (org.opengis.filter.Filter) iterator.next();
    Filters.accept(subFilter,this);
    subFilters.add(pages.pop());
  }
  try {
    copy = ff.createLogicFilter(filter.getFilterType());
    Iterator copyIterator = subFilters.iterator();
    while (copyIterator.hasNext()) {
      copy.addFilter((org.opengis.filter.Filter) copyIterator.next());
    }
  } catch (IllegalFilterException erp) {
    throw new RuntimeException(erp);
  }
  
  pages.push(copy);
}

代码示例来源:origin: org.geotools/gt2-main

/**
 * Deep copy the filter.
 * <p>
 * Filter objects are mutable, when copying a rich
 * data structure (like SLD) you will need to duplicate
 * the Filters referenced therein.
 * </p>
 */
public Filter duplicate( Filter filter ){
  DuplicatorFilterVisitor xerox = new DuplicatorFilterVisitor( ff );        
  Filters.accept( filter, xerox );
  return (Filter) xerox.getCopy();
  
}

代码示例来源:origin: org.geotools/gt-jdbc

Filters.accept((org.opengis.filter.Filter) list.next(),this);
  Filters.accept((org.opengis.filter.Filter) list.next(),this);

代码示例来源:origin: org.geotools/gt2-jdbc

Filters.accept((org.opengis.filter.Filter) list.next(),this);
  Filters.accept((org.opengis.filter.Filter) list.next(),this);

代码示例来源:origin: org.geotools/gt2-main

public void visit(org.geotools.filter.LogicFilter filter) {
  filter.getFilterType();
  
  String type = (String) logical.get(new Integer(filter.getFilterType()));
  
  start(type);
  
  java.util.Iterator list = filter.getFilterIterator();
  
  while (list.hasNext()) {
    Filters.accept((org.opengis.filter.Filter)list.next(),this);
  }
  
  end(type);
}

代码示例来源:origin: org.geotools/gt2-jdbc

/**
 * Performs the encoding, sends the encoded sql to the writer passed in.
 *
 * @param out the writer to encode the SQL to.
 * @param filter the Filter to be encoded.
 *
 * @throws SQLEncoderException If filter type not supported, or if there
 *         were io problems.
 */
public void encode(Writer out, org.opengis.filter.Filter filter) throws SQLEncoderException {
  if (getCapabilities().fullySupports(filter)) {
    this.out = out;
    try {
      out.write("WHERE ");
      Filters.accept( filter, this );
      //out.write(";");
    } catch (java.io.IOException ioe) {
      LOGGER.warning("Unable to export filter" + ioe);
      throw new SQLEncoderException("Problem writing filter: ", ioe);
    }
  } else {
    throw new SQLEncoderException("Filter type not supported");
  }
}

代码示例来源:origin: org.geotools/gt-jdbc

/**
 * Performs the encoding, sends the encoded sql to the writer passed in.
 *
 * @param out the writer to encode the SQL to.
 * @param filter the Filter to be encoded.
 *
 * @throws SQLEncoderException If filter type not supported, or if there
 *         were io problems.
 */
public void encode(Writer out, org.opengis.filter.Filter filter) throws SQLEncoderException {
  if (getCapabilities().fullySupports(filter)) {
    this.out = out;
    try {
      out.write("WHERE ");
      Filters.accept( filter, this );
    } catch (java.io.IOException ioe) {
      LOGGER.warning("Unable to export filter" + ioe);
      throw new SQLEncoderException("Problem writing filter: ", ioe);
    }
  } else {
    throw new SQLEncoderException("Filter type not supported");
  }
}

代码示例来源:origin: org.geotools/gt-wfs

protected  FeatureReader<SimpleFeatureType, SimpleFeature> wrapWithFilteringFeatureReader(Filter postFilter,  FeatureReader<SimpleFeatureType, SimpleFeature> reader, Filter processedFilter) {
  FilterEncodingPreProcessor visitor = new FilterEncodingPreProcessor(COMPLIANCE_LEVEL);
  Filters.accept( processedFilter, visitor);
  
  if( visitor.requiresPostProcessing() )
    return new FilteringFeatureReader<SimpleFeatureType, SimpleFeature>(reader, processedFilter);
  else
    return new FilteringFeatureReader<SimpleFeatureType, SimpleFeature>(reader, postFilter);
    
}

代码示例来源:origin: org.geotools/gt2-shapefile

Filters.accept(query.getFilter(), visitor);
if( !visitor.fids.isEmpty() ) {
  List recordsFound = queryFidIndex((String[]) visitor.fids.toArray(new String[0]));

代码示例来源:origin: org.geotools/gt-wfs

protected void init( Transaction transaction, Query query, Integer level ) throws IOException {
  FilterEncodingPreProcessor visitor = new FilterEncodingPreProcessor(level);
  Filters.accept( query.getFilter(), visitor );
  
  this.transaction=transaction;
  if( visitor.requiresPostProcessing() && query.getPropertyNames()!=Query.ALL_NAMES){
    FilterAttributeExtractor attributeExtractor=new FilterAttributeExtractor();
    query.getFilter().accept( attributeExtractor, null );
    Set<String> properties = new HashSet<String>(attributeExtractor.getAttributeNameSet());
    properties.addAll(Arrays.asList(query.getPropertyNames()));
    this.query = new Query(query);
    this.query.setPropertyNames((String[]) properties.toArray(new String[0]));
  } else {
    this.query=query;
  }
  
  this.filter=visitor.getFilter();
  Query nonFidQuery=new Query(query);
  Id fidFilter = visitor.getFidFilter();
  nonFidQuery.setFilter(fidFilter);
  if( fidFilter.getIDs().size()>0 ){
    delegate = StrictWFSStrategy.super.createFeatureReader(transaction, nonFidQuery);
  }else{
    delegate=nextReader();
  }
}

代码示例来源:origin: org.geotools/gt2-shapefile

/**
 * Performs a search on this <code>RTree</code>
 *
 * @param filter a <code>Filter</code>
 *
 * @return a <code>Collection</code> of <code>Data</code>
 *
 * @throws TreeException
 * @throws UnsupportedFilterException DOCUMENT ME!
 * @throws LockTimeoutException DOCUMENT ME!
 */
public List search(Filter filter)
  throws TreeException, UnsupportedFilterException, LockTimeoutException {
  // Aquire a read lock
  Lock lock = this.store.getReadLock();
  List ret = null;
  try {
    FilterConsumer fc = new FilterConsumer();
    Filters.accept( filter,fc);
    if (fc.getBounds() != null) {
      ret = this.search(fc.getBounds(), lock);
    } else {
      throw new UnsupportedFilterException("Not a valid filter");
    }
  } finally {
    // Release the lock
    this.store.releaseLock(lock);
  }
  return ret;
}

代码示例来源:origin: org.geotools/gt2-shapefile

if (filter != null) {
  FilterConsumer fc = new FilterConsumer();
  Filters.accept(filter,fc);
  bbox = fc.getBounds();

代码示例来源:origin: org.geotools/gt2-shapefile

/**
 * DOCUMENT ME!
 *
 * @param filter
 *
 *
 * @throws TreeException
 * @throws UnsupportedFilterException
 */
public Envelope getBounds(Filter filter)
  throws TreeException, UnsupportedFilterException {
  this.checkOpen();
  FilterConsumer fc = new FilterConsumer();
  Filters.accept( filter, fc );
  Envelope env = fc.getBounds();
  if (env == null) {
    throw new UnsupportedFilterException("Filter not supported");
  }
  Node root = this.store.getRoot();
  return env.contains(root.getBounds()) ? root.getBounds()
                     : this.getBoundsInternal(env, root);
}

相关文章