Package org.opengis.filter

Examples of org.opengis.filter.Filter


    Assert.assertEquals(7, t2);
  }

  @Test
  public void compareFilterOnFloat() throws LayerException {
    Filter lt = filterService.createCompareFilter(PARAM_FLOAT_ATTR, "<", "15");
    Iterator<?> it = layer.getElements(lt, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
      t++;
    }
    Assert.assertEquals(4, t);
    Filter ne = filterService.createCompareFilter(PARAM_FLOAT_ATTR, "<>", "10");
    it = layer.getElements(ne, 0, 0);
    t = 0;
    while (it.hasNext()) {
      it.next();
      t++;
View Full Code Here


    Assert.assertEquals(7, t);
  }

  @Test
  public void compareFilterOnDouble() throws LayerException {
    Filter lt = filterService.createCompareFilter(PARAM_DOUBLE_ATTR, "<", "15");
    Iterator<?> it = layer.getElements(lt, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
      t++;
    }
    Assert.assertEquals(4, t);
    Filter ne = filterService.createCompareFilter(PARAM_DOUBLE_ATTR, "<>", "10");
    it = layer.getElements(ne, 0, 0);

    t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

  public void compareFilterOnDate() throws ParseException, LayerException {
    DateFormat format = new SimpleDateFormat("dd/mm/yyyy");
    Date d1;
    d1 = format.parse("12/12/2005");

    Filter filter = filterService.createCompareFilter(PARAM_DATE_ATTR, "<", d1);
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

    Assert.assertEquals(4, t);
  }

  @Test
  public void compareFilterOnBoolean() throws LayerException {
    Filter eq = filterService.createCompareFilter(PARAM_BOOLEAN_ATTR, "==", "true");
    Iterator<?> it = layer.getElements(eq, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
      t++;
    }
    Assert.assertEquals(4, t);

    Filter ne = filterService.createCompareFilter(PARAM_BOOLEAN_ATTR, "<>", "true");
    it = layer.getElements(ne, 0, 0);

    t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

    Assert.assertEquals(4, t);
  }

  @Test
  public void compareFilterOnString() throws LayerException {
    Filter eq = filterService.createCompareFilter(PARAM_TEXT_ATTR, "==", "inside");
    Iterator<?> it = layer.getElements(eq, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
      t++;
    }
    Assert.assertEquals(1, t);

    Filter ne = filterService.createCompareFilter(PARAM_TEXT_ATTR, "<>", "inside");
    it = layer.getElements(ne, 0, 0);

    t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

    Assert.assertEquals(7, t);
  }

  @Test
  public void likeFilter() throws LayerException {
    Filter filter = filterService.createLikeFilter(PARAM_TEXT_ATTR, "*sid*");
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

    Assert.assertEquals(2, t);
  }

  @Test
  public void logicFilter() throws LayerException {
    Filter filter1 = filterService.createCompareFilter(PARAM_INT_ATTR, "<", "15");
    Filter filter2 = filterService.createLikeFilter(PARAM_TEXT_ATTR, "over*");
    Filter filter = filterService.createLogicFilter(filter1, "and", filter2);

    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
View Full Code Here

    Assert.assertEquals(1, t);
  }

  @Test
  public void fidFilter() throws LayerException {
    Filter filter = filterService.createFidFilter(new String[] { LAYER_NAME + ".1", LAYER_NAME + ".2" });
    Iterator<?> it = layer.getElements(filter, 0, 0);
    SimpleFeature f = (SimpleFeature) it.next();
    f = (SimpleFeature) it.next();
    Assert.assertEquals("inside", f.getAttribute(PARAM_TEXT_ATTR));
  }
View Full Code Here

  @Test
  public void containsFilter() throws LayerException {
    SimpleFeature feature = (SimpleFeature) layer.read(LAYER_NAME+".1");
    Geometry geom = (Geometry) feature.getDefaultGeometry();
    Filter filter = filterService.createContainsFilter(geom, PARAM_GEOMETRY_ATTR);
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

  @Test
  public void withinFilter() throws LayerException {
    SimpleFeature feature = (SimpleFeature) layer.read(LAYER_NAME+".7");
    Geometry geom = (Geometry) feature.getDefaultGeometry();
    Filter filter = filterService.createWithinFilter(geom, PARAM_GEOMETRY_ATTR);
    Iterator<?> it = layer.getElements(filter, 0, 0);

    int t = 0;
    while (it.hasNext()) {
      it.next();
View Full Code Here

TOP

Related Classes of org.opengis.filter.Filter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.