本文整理汇总了Java中org.opengis.filter.Or类的典型用法代码示例。如果您正苦于以下问题:Java Or类的具体用法?Java Or怎么用?Java Or使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Or类属于org.opengis.filter包,在下文中一共展示了Or类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetFeaturesWithORLogicFilter
import org.opengis.filter.Or; //导入依赖的package包/类
@Test
public void testGetFeaturesWithORLogicFilter() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo property1 = ff.equals(ff.property("vendor_s"), ff.literal("D-Link"));
PropertyIsEqualTo property2 = ff.equals(ff.property("vendor_s"), ff.literal("Linksys"));
Or filter = ff.or(property1, property2);
SimpleFeatureCollection features = featureSource.getFeatures(filter);
assertEquals(6, features.size());
SimpleFeatureIterator iterator = features.features();
while (iterator.hasNext()) {
SimpleFeature f = iterator.next();
assertTrue(f.getAttribute("vendor_s").equals("D-Link")
|| f.getAttribute("vendor_s").equals("Linksys"));
}
}
示例2: getLayerGroupsFor
import org.opengis.filter.Or; //导入依赖的package包/类
private Iterable<LayerGroupInfo> getLayerGroupsFor(final FeatureTypeInfo featureType) {
List<LayerGroupInfo> layerGroups = new ArrayList<LayerGroupInfo>();
// get the layers whose default style is that style, they might be in layer groups
// using their default style
Iterable<LayerInfo> layers = catalog.getLayers(featureType);
// build a query retrieving the first list of candidates
List<Filter> filters = new ArrayList<>();
for (LayerInfo layer : layers) {
filters.add(ff.equal(ff.property("layers.id"), ff.literal(layer.getId()), true, MatchAction.ANY));
filters.add(ff.equal(ff.property("rootLayer.id"), ff.literal(layer.getId()), true));
}
Or groupFilter = ff.or(filters);
try(CloseableIterator<LayerGroupInfo> it = catalog.list(LayerGroupInfo.class, groupFilter)) {
while(it.hasNext()) {
LayerGroupInfo lg = it.next();
layerGroups.add(lg);
}
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to load groups associated with feature type " + featureType.prefixedName(), e);
}
loadGroupParents(layerGroups);
return layerGroups;
}
示例3: testOr
import org.opengis.filter.Or; //导入依赖的package包/类
@Test
public void testOr() {
final Or filter = ff.or(ff.id(ff.featureId("id1")), ff.id(ff.featureId("id2")));
Map<String,Object> expected = ImmutableMap.of("bool", ImmutableMap.of("should",
ImmutableList.of(ImmutableMap.of("ids", ImmutableMap.of("values", ImmutableList.of("id1"))),
ImmutableMap.of("ids", ImmutableMap.of("values", ImmutableList.of("id2"))))));
builder.visit(filter, null);
assertTrue(builder.createFilterCapabilities().fullySupports(filter));
assertEquals(expected, builder.getQueryBuilder());
}
示例4: visit
import org.opengis.filter.Or; //导入依赖的package包/类
@Override
public Object visit(
final Or filter,
final Object data ) {
final TemporalConstraintsSet constraints = new TemporalConstraintsSet();
for (final Filter f : filter.getChildren()) {
final Object output = f.accept(
this,
data);
if (output instanceof ParameterTimeConstraint) {
final ParameterTimeConstraint ranges = (ParameterTimeConstraint) output;
constraints.getConstraintsFor(
ranges.getName()).replaceWithMerged(
ranges);
}
else if (output instanceof TemporalConstraintsSet) {
final TemporalConstraintsSet rangeSet = (TemporalConstraintsSet) output;
for (final Map.Entry<String, TemporalConstraints> entry : rangeSet.getSet()) {
constraints.getConstraintsFor(
entry.getKey()).replaceWithMerged(
entry.getValue());
}
}
}
return constraints;
}
示例5: visit
import org.opengis.filter.Or; //导入依赖的package包/类
@Override
public Object visit(
final Or filter,
final Object data ) {
final PropertyConstraintSet constraints = new PropertyConstraintSet();
for (final Filter f : filter.getChildren()) {
final Object output = f.accept(
this,
data);
if (output instanceof PropertyConstraintSet) {
constraints.union((PropertyConstraintSet) output);
}
}
return constraints;
}
示例6: visit
import org.opengis.filter.Or; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Object visit(Or filter, Object userData) {
Criterion c = null;
for (Filter element : filter.getChildren()) {
if (c == null) {
c = (Criterion) element.accept(this, userData);
} else {
c = Restrictions.or(c, (Criterion) element.accept(this, userData));
}
}
return c;
}
示例7: visit
import org.opengis.filter.Or; //导入依赖的package包/类
@Override
public Object visit(Or or, Object o) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
示例8: visit
import org.opengis.filter.Or; //导入依赖的package包/类
@Override
public Object visit(
final Or filter,
final Object data ) {
ExtractGeometryFilterVisitorResult finalResult = new ExtractGeometryFilterVisitorResult(
new GeometryFactory().toGeometry(new Envelope()),
null);
for (final Filter f : filter.getChildren()) {
final Object obj = f.accept(
this,
data);
if ((obj != null) && (obj instanceof ExtractGeometryFilterVisitorResult)) {
final ExtractGeometryFilterVisitorResult currentResult = (ExtractGeometryFilterVisitorResult) obj;
final Geometry currentGeom = currentResult.getGeometry();
final double currentArea = currentGeom.getArea();
if (finalResult.getGeometry().isEmpty()) {
finalResult = currentResult;
}
else if (!Double.isInfinite(currentArea) && !Double.isNaN(currentArea)) {
if (currentResult.matchPredicate(finalResult)) {
finalResult = new ExtractGeometryFilterVisitorResult(
finalResult.getGeometry().union(
currentGeom),
currentResult.getCompareOp());
}
else {
finalResult = new ExtractGeometryFilterVisitorResult(
finalResult.getGeometry().union(
currentGeom),
null);
}
}
else {
finalResult = new ExtractGeometryFilterVisitorResult(
finalResult.getGeometry(),
null);
}
}
}
if (finalResult.getGeometry().isEmpty()) {
return new ExtractGeometryFilterVisitorResult(
infinity(),
null);
}
return finalResult;
}
示例9: visit
import org.opengis.filter.Or; //导入依赖的package包/类
/**
* Write the FilterBuilder for an Or filter
*
* @param filter the filter to visit
* @param extraData extra data (unused by this method)
*
*/
public Object visit(Or filter, Object extraData) {
return visit((BinaryLogicOperator)filter, "OR");
}