本文整理汇总了Java中org.opengis.filter.Filter.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Filter.accept方法的具体用法?Java Filter.accept怎么用?Java Filter.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.filter.Filter
的用法示例。
在下文中一共展示了Filter.accept方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reprojectFilter
import org.opengis.filter.Filter; //导入方法依赖的package包/类
private Query reprojectFilter(Query query) throws IOException {
SimpleFeatureType nativeFeatureType = source.getSchema();
final GeometryDescriptor geom = nativeFeatureType.getGeometryDescriptor();
// if no geometry involved, no reprojection needed
if(geom == null)
return query;
try {
// default CRS: the CRS we can assume geometry and bbox elements in filter are
// that is, usually the declared one, but the native one in the leave case
CoordinateReferenceSystem defaultCRS = null;
// we need to reproject all bbox and geometries to a target crs, which is
// the native one usually, but it's the declared on in the force case (since in
// that case we completely ignore the native one)
CoordinateReferenceSystem targetCRS = null;
CoordinateReferenceSystem nativeCRS = geom.getCoordinateReferenceSystem();
if(srsHandling == ProjectionPolicy.FORCE_DECLARED) {
defaultCRS = declaredCRS;
targetCRS = declaredCRS;
nativeFeatureType = FeatureTypes.transform(nativeFeatureType, declaredCRS);
} else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED) {
defaultCRS = declaredCRS;
targetCRS = nativeCRS;
} else { // FeatureTypeInfo.LEAVE
defaultCRS = nativeCRS;
targetCRS = nativeCRS;
}
// now we apply a default to all geometries and bbox in the filter
ISODefaultCRSFilterVisitor defaultCRSVisitor = new ISODefaultCRSFilterVisitor(ff, defaultCRS);
Filter filter = query.getFilter() != null ? query.getFilter() : Filter.INCLUDE;
Filter defaultedFilter = (Filter) filter.accept(defaultCRSVisitor, null);
// and then we reproject all geometries so that the datastore receives
// them in the native projection system (or the forced one, in case of force)
ISOReprojectingFilterVisitor reprojectingVisitor = new ISOReprojectingFilterVisitor(ff, nativeFeatureType);
Filter reprojectedFilter = (Filter) defaultedFilter.accept(reprojectingVisitor, null);
Query reprojectedQuery = new Query(query);
reprojectedQuery.setFilter(reprojectedFilter);
return reprojectedQuery;
} catch(Exception e) {
throw new DataSourceException("Had troubles handling filter reprojection...", e);
}
}
示例2: isValidJoinFilter
import org.opengis.filter.Filter; //导入方法依赖的package包/类
boolean isValidJoinFilter(Filter filter) {
PostPreProcessFilterSplittingVisitor visitor =
new PostPreProcessFilterSplittingVisitor(joinFilterCapabilities, null, null);
filter.accept(visitor, null);
return visitor.getFilterPost() == null || visitor.getFilterPost() == Filter.INCLUDE;
}
示例3: applyDefaultCRS
import org.opengis.filter.Filter; //导入方法依赖的package包/类
/**
* Applies a default CRS to all geometric filter elements that do not
* already have one
*
* @param nativeCRS
* @param wfsVersion
*
*/
public static Filter applyDefaultCRS(Filter filter, CoordinateReferenceSystem defaultCRS) {
DefaultCRSFilterVisitor defaultVisitor = new DefaultCRSFilterVisitor(ff, defaultCRS);
return (Filter) filter.accept(defaultVisitor, null);
}
示例4: reprojectFilter
import org.opengis.filter.Filter; //导入方法依赖的package包/类
/**
* Reprojects all geometric filter elements to the native CRS of the
* provided schema
*
* @param filter
* @param schema
*
*/
public static Filter reprojectFilter(Filter filter, FeatureType schema) {
ISOReprojectingFilterVisitor visitor = new ISOReprojectingFilterVisitor(ff, schema);
return (Filter) filter.accept(visitor, null);
}