org.opengis.filter.FilterFactory2.not()方法的使用及代码示例

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

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

FilterFactory2.not介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

private Data buildNotFilter(int startOfFilterStack) {
  if (current.size() > (startOfFilterStack + 1)) {
    throw new UnsupportedFilterException("A not filter cannot have more than one filter");
  } else {
    Data tmp = (Data) current.pop();
    Data data = new Data(ff.not(tmp.filter));
    if (!tmp.fids.isEmpty()) {
      data.filter = Filter.INCLUDE;
      data.fids.clear();
      requiresPostProcessing = true;
    }
    return data;
  }
}

代码示例来源:origin: geotools/geotools

private Data buildNotFilter(int startOfFilterStack) {
  if (current.size() > (startOfFilterStack + 1)) {
    throw new UnsupportedFilterException("A not filter cannot have more than one filter");
  } else {
    Data tmp = (Data) current.pop();
    Data data = new Data(ff.not(tmp.filter));
    if (!tmp.fids.isEmpty()) {
      data.filter = Filter.INCLUDE;
      data.fids.clear();
      requiresPostProcessing = true;
    }
    return data;
  }
}

代码示例来源:origin: geotools/geotools

public Object visit(Not filter, Object arg1) {
  Filter unrolled = (Filter) filter.getFilter().accept(this, null);
  unrolled = ff.not(unrolled);
  return unrolled;
}

代码示例来源:origin: geotools/geotools

/**
 * @throws SAXException
 * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element,
 *     org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map)
 */
public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints)
    throws SAXException {
  FilterFactory2 factory = FilterSchema.filterFactory(hints);
  String name = element.getName();
  if (!"and".equalsIgnoreCase(name)
      && !"or".equalsIgnoreCase(name)
      && !"not".equalsIgnoreCase(name)) {
    throw new SAXException("Expected AND or OR logic filter");
  }
  if (value == null || value.length != 1) {
    throw new SAXException("Require a single filter for " + element);
  }
  try {
    Filter filter = (Filter) value[0].getValue();
    return factory.not(filter);
  } catch (ClassCastException filterRequired) {
    throw new SAXException("Require a single filter for " + element, filterRequired);
  } catch (IllegalFilterException e) {
    throw new SAXException("Illegal filter for " + element);
  }
}

代码示例来源:origin: geotools/geotools

public Object visit(Not filter, Object extraData) {
  return getFactory(extraData).not((Filter) filter.getFilter().accept(this, extraData));
}

代码示例来源:origin: geotools/geotools

static Not notIsNull() {
  return f.not(propertyIsNull());
}

代码示例来源:origin: geotools/geotools

/**
 * Creates the the logic filter if in a complete state.
 *
 * @return The created logic filter.
 * @throws IllegalFilterException if the filter is not complete.
 */
@SuppressWarnings("deprecation")
public Filter create() throws IllegalFilterException {
  Filter filter = null;
  LOGGER.finer("creating a logic filter");
  if (isComplete()) {
    LOGGER.finer("filter is complete, with type: " + this.logicType);
    if (logicType == AbstractFilter.LOGIC_NOT) {
      filter = ff.not(subFilters.get(0));
    } else if (logicType == AbstractFilter.LOGIC_AND) {
      filter = ff.and(subFilters);
    } else if (logicType == AbstractFilter.LOGIC_OR) {
      filter = ff.or(subFilters);
    }
    // reset the variables so it works right if called again.
    subFilters = new ArrayList<Filter>();
    this.logicType = -1;
    isComplete = false;
    return filter;
  } else {
    throw new IllegalFilterException("Attempted to generate incomplete logic filter.");
  }
}

代码示例来源:origin: geotools/geotools

public static Not not() {
  return f.not(propertyIsEqualTo());
}

代码示例来源:origin: geotools/geotools

static Not not() {
  return f.not(propertyIsEqualTo());
}

代码示例来源:origin: geotools/geotools

filters3.add(filters.get(j));
} else {
  filters3.add(ff.not(filters.get(j)));

代码示例来源:origin: geotools/geotools

private Not propertyNotNull(String name) {
    return ff.not(ff.isNull(ff.property(name)));
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Guards the filter against potential null values in the target property name (if it is a
 * property name, to start with)
 */
private Filter guardAgainstNulls(Filter filter, Expression potentialPropertyName) {
  if (potentialPropertyName instanceof PropertyName) {
    PropertyName pn = (PropertyName) potentialPropertyName;
    String name = pn.getPropertyName();
    if (isNillable(name)) {
      Not notNull = ff.not(ff.isNull(ff.property(name)));
      if (filter instanceof And) {
        And and = (And) filter;
        List<Filter> children = new ArrayList<Filter>(and.getChildren());
        children.add(notNull);
        return ff.and(children);
      } else {
        return ff.and(filter, notNull);
      }
    }
  }
  return filter;
}

代码示例来源:origin: geotools/geotools

filters3.add(filters.get(j));
} else {
  filters3.add(ff.not(filters.get(j)));

代码示例来源:origin: geotools/geotools

/** Try and Filter by the provided bbox, will default to Filter.EXCLUDE if null */
  public static Filter filterBBox(Envelope bBox, SimpleFeatureType ft)
      throws FactoryRegistryException, IllegalFilterException {
    if (bBox == null) {
      return Filter.INCLUDE;
    }
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
    PropertyName geomExpr = ff.property(ft.getGeometryDescriptor().getLocalName());
    Literal bboxExpr = ff.literal(JTS.toGeometry(bBox));
    Disjoint disjointFilter = ff.disjoint(geomExpr, bboxExpr);

    return ff.not(disjointFilter);
  }
}

代码示例来源:origin: geotools/geotools

return factory.not(disjoint);

代码示例来源:origin: geotools/geotools

public void testLogicFilter() throws IllegalFilterException {
  testExp1 = new LiteralExpressionImpl(Integer.valueOf(45));
  testExp2 = new LiteralExpressionImpl(Integer.valueOf(45));
  testExp3 = new AttributeExpressionImpl(testSchema, "testInteger");
  testExp4 = new AttributeExpressionImpl(testSchema, "testInteger");
  PropertyIsEqualTo cFilter1 = ff.equals(testExp1, testExp2);
  PropertyIsEqualTo cFilter2 = ff.equals(testExp2, testExp4);
  org.opengis.filter.Filter logFilter1 = ff.and(cFilter1, cFilter2);
  org.opengis.filter.Filter logFilter2 = ff.and(cFilter1, cFilter2);
  assertTrue(logFilter1.equals(logFilter2));
  logFilter1 = ff.not(cFilter2);
  assertTrue(!logFilter1.equals(logFilter2));
  cFilter1 = ff.equals(testExp1, testExp3);
  logFilter2 = ff.not(cFilter1);
  assertTrue(logFilter1.equals(logFilter2));
  assertTrue(!logFilter1.equals(ff.between(testExp1, testExp2, testExp3)));
  Or logFilter3 = ff.or(logFilter1, logFilter2);
  Or logFilter4 = ff.or(logFilter1, logFilter2);
  assertTrue(logFilter3.equals(logFilter4));
  // Questionable behavior.  Is this what we want?
  Or logFilter5 = ff.or(cFilter1, logFilter3);
  // does not change structure of logFilter3
  Or logFilter6 = ff.or(logFilter4, cFilter1);
  // different structure, but same result
  assertTrue(logFilter5.equals(logFilter6)); // do we want these equal?
  assertTrue(logFilter4.equals(logFilter3)); // shouldn't they be equal?
}

代码示例来源:origin: geotools/geotools

assertFalse(fac.not(filter).evaluate(testFeature));

代码示例来源:origin: geotools/geotools

public void testNotFilter() {
  // set GEOT-1566
  PropertyIsLike like = fac.like(fac.property("stringProperty"), "ab*");
  Not not = fac.not(like);
  DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor(fac);
  Not clone = (Not) not.accept(visitor, null);
  assertEquals(not, clone);
  assertNotSame(not, clone);
  assertNotSame(like, clone.getFilter());
}

代码示例来源:origin: geotools/geotools

org.opengis.filter.Filter notNullFilter = fac.not(nullFilter);

代码示例来源:origin: geotools/geotools

/**
 * Test that Filter works over Object as expected, provided there exists a {@link
 * PropertyAccessor} for the given kind of object.
 */
public void testEvaluateNonFeatureObject() {
  MockDataObject object = new MockDataObject();
  object.intVal = 5;
  object.stringVal = "cinco";
  org.opengis.filter.Filter f = fac.greater(fac.property("intVal"), fac.literal(3));
  assertTrue(f.evaluate(object));
  org.opengis.filter.Filter f2 =
      fac.and(f, fac.equals(fac.property("stringVal"), fac.literal("cinco")));
  assertTrue(f2.evaluate(object));
  org.opengis.filter.Filter f3 =
      fac.and(f, fac.equals(fac.property("stringVal"), fac.literal("seis")));
  assertFalse(f3.evaluate(object));
  org.opengis.filter.Filter f4 =
      fac.not(fac.and(f, fac.equals(fac.property("stringVal"), fac.literal("cinco"))));
  assertFalse(f4.evaluate(object));
}

相关文章