org.opengis.filter.Not Java Examples
The following examples show how to use
org.opengis.filter.Not.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterToElastic.java From elasticgeo with GNU General Public License v3.0 | 6 votes |
/** * Write the FilterBuilder for a Not filter * * @param filter the filter to visit * @param extraData extra data (unused by this method) * */ public Object visit(Not filter, Object extraData) { if(filter.getFilter() instanceof PropertyIsNull) { Expression expr = ((PropertyIsNull) filter.getFilter()).getExpression(); expr.accept(this, extraData); } else { filter.getFilter().accept(this, extraData); } if(filter.getFilter() instanceof PropertyIsNull) { queryBuilder = ImmutableMap.of("exists", ImmutableMap.of("field", field)); } else { queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", queryBuilder)); } return extraData; }
Example #2
Source File: ElasticFilterTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testNot() { Not filter = ff.not(ff.id(ff.featureId("id"))); Map<String,Object> expected = ImmutableMap.of("bool", ImmutableMap.of("must_not", ImmutableMap.of("ids", ImmutableMap.of("values", ImmutableList.of("id"))))); builder.visit(filter, null); assertTrue(builder.createCapabilities().fullySupports(filter)); assertEquals(expected, builder.getQueryBuilder()); }
Example #3
Source File: ElasticFilterTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testPropertyIsNotNull() { Not filter = ff.not(ff.isNull(ff.property("prop"))); Map<String,Object> expected = ImmutableMap.of("exists", ImmutableMap.of("field", "prop")); builder.visit(filter, null); assertTrue(builder.createCapabilities().fullySupports(filter)); assertEquals(expected, builder.getQueryBuilder()); }
Example #4
Source File: ElasticFeatureFilterIT.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testGetFeaturesWithNOTLogicFilter() throws Exception { init(); FilterFactory ff = dataStore.getFilterFactory(); PropertyIsEqualTo property1 = ff.equals(ff.property("vendor_s"), ff.literal("D-Link")); Not filter = ff.not(property1); SimpleFeatureCollection features = featureSource.getFeatures(filter); assertEquals(7, features.size()); SimpleFeatureIterator iterator = features.features(); while (iterator.hasNext()) { SimpleFeature f = iterator.next(); assertTrue(!f.getAttribute("vendor_s").equals("D-Link")); } }
Example #5
Source File: ExtractGeometryFilterVisitor.java From geowave with Apache License 2.0 | 5 votes |
@Override public Object visit(final Not filter, final Object data) { // no matter what we have to return an infinite envelope // rationale // !(finite envelope) -> an unbounded area -> infinite // !(non spatial filter) -> infinite (no spatial concern) // !(infinite) -> ... infinite, as the first infinite could be the // result // of !(finite envelope) return new ExtractGeometryFilterVisitorResult(infinity(), null); }
Example #6
Source File: ExtractTimeFilterVisitor.java From geowave with Apache License 2.0 | 5 votes |
@Override public Object visit(final Not filter, final Object data) { final Object output = filter.getFilter().accept(this, data); if (output instanceof ParameterTimeConstraint) { return not((ParameterTimeConstraint) output); } else if (output instanceof TemporalConstraintsSet) { final TemporalConstraintsSet newRangeSet = new TemporalConstraintsSet(); final TemporalConstraintsSet rangeSet = (TemporalConstraintsSet) output; for (final Map.Entry<String, TemporalConstraints> entry : rangeSet.getSet()) { newRangeSet.getConstraintsFor(entry.getKey()).replaceWithMerged(not(entry.getValue())); } return newRangeSet; } return output; }
Example #7
Source File: FilterNode.java From sldeditor with GNU General Public License v3.0 | 4 votes |
/** * Sets the filter. * * @param filter the new expression * @param filterConfig the filter config */ public void setFilter(Filter filter, FilterConfigInterface filterConfig) { this.filter = filter; this.filterConfig = filterConfig; setDisplayString(); this.removeAllChildren(); TypeManager.getInstance().reset(); if (filterConfig != null) { FilterName filterName = filterConfig.getFilterConfiguration(); if (filter instanceof Not) { setNotFilter(filter, filterName); } else if (filter instanceof LogicFilterImpl) { setLogicFilter(filter, filterName); } else if (filter instanceof BinaryTemporalOperator) { setExpressionParameter( ((BinaryTemporalOperator) filter).getExpression1(), filterName.getParameter(0)); setExpressionParameter( ((BinaryTemporalOperator) filter).getExpression2(), filterName.getParameter(1)); } else if (filter instanceof PropertyIsNull) { setExpressionParameter( ((PropertyIsNull) filter).getExpression(), filterName.getParameter(0)); } else if (filter instanceof PropertyIsBetween) { setExpressionParameter( ((PropertyIsBetween) filter).getLowerBoundary(), filterName.getParameter(0)); setExpressionParameter( ((PropertyIsBetween) filter).getExpression(), filterName.getParameter(1)); setExpressionParameter( ((PropertyIsBetween) filter).getUpperBoundary(), filterName.getParameter(2)); } else if (filter instanceof PropertyIsLike) { setExpressionParameter( ((PropertyIsLike) filter).getExpression(), filterName.getParameter(0)); setExpressionParameter( ff.literal(((PropertyIsLike) filter).getLiteral()), filterName.getParameter(1)); setExpressionStringSizeParameter( ff.literal(((PropertyIsLike) filter).getWildCard()), filterName.getParameter(2), 1, true); setExpressionStringSizeParameter( ff.literal(((PropertyIsLike) filter).getSingleChar()), filterName.getParameter(3), 1, true); setExpressionStringSizeParameter( ff.literal(((PropertyIsLike) filter).getEscape()), filterName.getParameter(4), 1, true); setExpressionParameter( ff.literal(((PropertyIsLike) filter).isMatchingCase()), filterName.getParameter(5)); } else if (filter instanceof BinarySpatialOperator) { setBinarySpatialOperator(filter, filterName); } else if (filter instanceof BinaryComparisonAbstract) { setBinaryComparisonAbstract(filter, filterName); } else if (filter instanceof FidFilterImpl) { FidFilterImpl fidFilter = (FidFilterImpl) filter; for (Identifier identifier : fidFilter.getIdentifiers()) { setExpressionParameter(ff.literal(identifier), filterName.getParameter(0)); } } } }
Example #8
Source File: FilterPanelv2.java From sldeditor with GNU General Public License v3.0 | 4 votes |
/** * Adds the filter. * * @param node the node * @return the filter */ private Filter addFilter(FilterNode node) { Filter nodeFilter = node.getFilter(); FilterConfigInterface filterConfig = node.getFilterConfig(); if (nodeFilter instanceof LogicFilterImpl) { List<Filter> filterList = new ArrayList<>(); createFilterList(node, filterList); return filterConfig.createLogicFilter(filterList); } List<Expression> parameterFilter = new ArrayList<>(); if (originalFilter instanceof FidFilterImpl) { createExpressionParameterList(node, 1, parameterFilter); } else if (originalFilter instanceof BinaryTemporalOperator) { createExpressionParameterList(node, 2, parameterFilter); } else if (originalFilter instanceof PropertyIsBetween) { createExpressionParameterList(node, 3, parameterFilter); } else if (originalFilter instanceof PropertyIsNull) { createExpressionParameterList(node, 1, parameterFilter); } else if (originalFilter instanceof PropertyIsLike) { createExpressionParameterList(node, 6, parameterFilter); } else if (originalFilter instanceof BinarySpatialOperator) { createExpressionParameterList(node, 2, parameterFilter); } else if (originalFilter instanceof BinaryComparisonAbstract) { if (originalFilter instanceof Not) { createExpressionParameterList(node, 1, parameterFilter); } else if (originalFilter instanceof PropertyIsGreaterThan) { createExpressionParameterList(node, 2, parameterFilter); } else { createExpressionParameterList(node, 3, parameterFilter); } } else { return nodeFilter; } return filterConfig.createFilter(parameterFilter); }
Example #9
Source File: CriteriaVisitor.java From geomajas-project-server with GNU Affero General Public License v3.0 | 4 votes |
/** {@inheritDoc} */ @Override public Object visit(Not filter, Object userData) { Criterion c = (Criterion) filter.getFilter().accept(this, userData); return Restrictions.not(c); }