Package org.opengis.filter

Examples of org.opengis.filter.Filter


  @Test
  public void testGetBoundsIntersectsFiltered() throws Exception {
    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] { new Coordinate(0, 0),
        new Coordinate(-180, 180) });
    Filter filter = filterService.createIntersectsFilter(equator,beanLayer.getLayerInfo().getFeatureInfo().getGeometryType().getName());
    Envelope bounds = layerService.getBounds(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter);
    Assert.assertEquals(0, bounds.getMinX(), ALLOWANCE);
    Assert.assertEquals(0, bounds.getMinY(), ALLOWANCE);
    Assert.assertEquals(1, bounds.getMaxX(), ALLOWANCE);
View Full Code Here


    Map<String, String> layerFilters = request.getLayerFilters();

    for (Entry<VectorLayer, Filter> entry : filters.entrySet()) {
      String layerId = entry.getKey().getId();
      if (securityContext.isLayerVisible(layerId)) {
        Filter f = entry.getValue();
        if (layerFilters.containsKey(layerId)) {
          String layerFilter = layerFilters.get(layerId);
          f = filterService.createAndFilter(filterService.parseFilter(layerFilter), f);
        }
View Full Code Here

    if (newFeature.getGeometry() != null) {
      featureModel.setGeometry(feature, newFeature.getGeometry());
    }

    Filter securityFilter;
    if (isCreate) {
      securityFilter = getSecurityFilter(layer, securityContext.getCreateAuthorizedArea(layerId));
    } else {
      securityFilter = getSecurityFilter(layer, securityContext.getUpdateAuthorizedArea(layerId));
    }
    if (securityFilter.evaluate(feature)) {
      context.put(PipelineCode.FEATURE_DATA_OBJECT_KEY, layer.saveOrUpdate(feature));
      if (isCreate) {
        newFeature.setId(featureModel.getId(feature));
      }
    } else {
View Full Code Here

  public void execute(PipelineContext context, GetBoundsContainer response)
      throws GeomajasException {
    if (null == response.getEnvelope()) {
      VectorLayer layer = context.get(PipelineCode.LAYER_KEY, VectorLayer.class);
      CrsTransform crsTransform = context.get(PipelineCode.CRS_TRANSFORM_KEY, CrsTransform.class);
      Filter filter = context.get(PipelineCode.FILTER_KEY, Filter.class);
      Envelope bounds = layer.getBounds(filter);
      bounds = geoService.transform(bounds, crsTransform);
      response.setEnvelope(bounds);
    }
  }
View Full Code Here

    Assert.assertEquals(1, t);
  }

  @Test
  public void neFilterOnString() throws Exception {
    Filter filter = filterCreator.createCompareFilter(MTO_TEXT, "<>", "manyToOne-1");
    Iterator<?> it = layer.getElements(filter, 0, 0);
    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a AssociationFeature", it.next() instanceof AssociationFeature);
      t++;
View Full Code Here

    Assert.assertEquals(3, t);
  }

  @Test
  public void likeFilter() throws Exception {
    Filter wildCardFilter = filterCreator.createLikeFilter(MTO_TEXT, "*-1");
    Iterator<?> it = layer.getElements(wildCardFilter, 0, 0);
    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a AssociationFeature", it.next() instanceof AssociationFeature);
      t++;
    }
    Assert.assertEquals(1, t);

    Filter singleCharFilter = filterCreator.createLikeFilter(MTO_TEXT, "manyToOne-?");
    it = layer.getElements(singleCharFilter, 0, 0);
    t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a AssociationFeature", it.next() instanceof AssociationFeature);
      t++;
View Full Code Here

    Assert.assertEquals(4, t);
  }

  @Test
  public void andFilter() throws Exception {
    Filter textFilter = filterCreator.createCompareFilter(MTO_TEXT, "==", "manyToOne-1");
    Filter intFilter = filterCreator.createCompareFilter(MTO_INT, "<", "250");
    Filter filter = filterCreator.createLogicFilter(textFilter, "and", intFilter);
    Iterator<?> it = layer.getElements(filter, 0, 0);
    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a AssociationFeature", it.next() instanceof AssociationFeature);
      t++;
View Full Code Here

    Assert.assertEquals(1, t);
  }

  @Test
  public void orFilter() throws Exception {
    Filter textFilter = filterCreator.createCompareFilter(MTO_TEXT, "==", "manyToOne-1");
    Filter intFilter = filterCreator.createCompareFilter(MTO_INT, ">", "250");
    Filter filter = filterCreator.createLogicFilter(textFilter, "or", intFilter);
    Iterator<?> it = layer.getElements(filter, 0, 0);
    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a AssociationFeature", it.next() instanceof AssociationFeature);
      t++;
View Full Code Here

    Assert.assertEquals(3, t);
  }

  @Test
  public void notFilter() throws Exception {
    Filter textFilter = filterCreator.createCompareFilter(MTO_TEXT, "==", "manyToOne-1");
    Filter filter = filterCreator.createLogicFilter(textFilter, "NOT", null);
    Iterator<?> it = layer.getElements(filter, 0, 0);
    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a AssociationFeature", it.next() instanceof AssociationFeature);
      t++;
View Full Code Here

    layer.create(f4);
  }

  @Test
  public void betweenFilterOnInteger() throws Exception {
    Filter filter = filterCreator.createBetweenFilter(ATTR__MANY_TO_ONE__DOT__INT, "50", "250");
    Iterator<?> it = layer.getElements(filter, 0, 0);
    int t = 0;
    while (it.hasNext()) {
      Assert.assertTrue("Returned object must be a HibernateTestFeature",
          it.next() instanceof HibernateTestFeature);
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.