Examples of FilterFactory2


Examples of org.opengis.filter.FilterFactory2

        return selectionFids;
    }

    public Id getId() {
        checkWidget();
        FilterFactory2 fac = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        Set<Identifier> ids = FeatureUtils.stringToId(fac, selectionFids);
        return fac.id(ids);
    }
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

        CoordinateReferenceSystem crs = layer.getCRS();
       
        if( !bbox.getCoordinateReferenceSystem().equals( crs )) {
            bbox = bbox.transform(crs, true);
        }
        FilterFactory2 factory = (FilterFactory2) CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        Geometry geom = new GeometryFactory().toGeometry(bbox);
        Intersects filter = factory.intersects(factory.property(type.getGeometryDescriptor().getName()), factory.literal(geom));
       
        layer.getQuery(false);
        final FeatureCollection<SimpleFeatureType, SimpleFeature>  results = source.getFeatures( filter );
//        if( results.getCount() == 0 ) {
//            return null; // no content!
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

     * @param boundingBox in the same crs as the viewport model.
     * @return a Geometry filter in the correct CRS or null if an exception occurs.
     */
    private static Filter createBBoxFilter(ReferencedEnvelope boundingBox, ILayer layer,
            Class<? extends Filter> filterType) {
        FilterFactory2 factory = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
        if (!layer.hasResource(FeatureSource.class))
            return Filter.EXCLUDE;
        try {

            SimpleFeatureType schema = layer.getSchema();
            Name geom = getGeometryAttDescriptor(schema).getName();

            Filter bboxFilter = factory.bbox(factory.property(geom), boundingBox);

            return bboxFilter;
        } catch (Exception e) {
            ProjectPlugin.getPlugin().log(e);
            return Filter.EXCLUDE;
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

                oldSelection=(Filter) layer.getFilter();
                Filter filter;
                if (feature == null) {
                    filter = (Filter) Filter.EXCLUDE;
                } else {
                    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
                    filter = ff.id(feature.getIdentifier());
                }
                layer.setFilter(filter);
            }
        }
    }
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

       
        String cql = "#"+Integer.toHexString(c.getRGB() & 0x00ffffff);
        colorText.setText(cql);
        colorText.setEnabled(true);
       
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        Expression expression = ff.literal(cql);

        return expression;
    }
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

        if( combo.getControl().isEnabled() &&  !combo.getSelection().isEmpty() ){
            Object selection = ((StructuredSelection)combo.getSelection()).getFirstElement();
            if( selection != NONE ){
                if ( selection instanceof String){
                    String propertyName = (String) selection;
                    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
                   
                    return ff.property( propertyName );
                }
            }
        }
        if( spinner.isEnabled() ){
            int number = spinner.getSelection();
            FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
           
            return ff.literal( ((double)number)/100.0);
        }
        return null;
    }
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

    }
  }

@SuppressWarnings("unchecked")
private FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatureIterator( IProgressMonitor monitor, ILayer editLayer, BoundingBox bounds ) throws IOException {
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
   
    SimpleFeatureType featureType = editLayer.getSchema();   
    String geomName = featureType.getGeometryDescriptor().getLocalName();
   
    PropertyName attributeExpr = ff.property(geomName);
    BBOX filter = ff.bbox(attributeExpr, bounds);
   
    FeatureSource<SimpleFeatureType, SimpleFeature> source = editLayer.getResource(FeatureSource.class, monitor);   
    return source.getFeatures(filter);
}
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

  }

  private Filter createTrimmingLineFilter(ILayer selectedLayer, LineString trimmingLineInLayerCrs)
    throws OperationNotFoundException, TransformException {
    Filter filter = selectedLayer.getFilter();
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
    Intersects intersectsFilter;
    try {

      SimpleFeatureType schema = selectedLayer.getSchema();
      String typeName = schema.getGeometryDescriptor().getLocalName();

      intersectsFilter = ff.intersects(ff.property(typeName), ff.literal(trimmingLineInLayerCrs));
    } catch (IllegalFilterException e) {
      throw (RuntimeException) new RuntimeException().initCause(e);
    }

    if (Filter.EXCLUDE.equals(filter)) {
      filter = intersectsFilter;
    } else {
      filter = ff.and(filter, intersectsFilter);
    }
    return filter;
  }
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

    FeatureSource<SimpleFeatureType, SimpleFeature> source = selectedLayer.getResource(FeatureSource.class, null);

    String typename = source.getSchema().getName().toString();

    // creates the query with a bbox filter
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);

    Filter filter = selectedLayer.createBBoxFilter(bbox.get(0), null);
    Filter mergedFilter;
    Or filterOR = null;
    for (int index = 0; index < bbox.size(); index++) {

      mergedFilter = selectedLayer.createBBoxFilter(bbox.get(index), null);
      filterOR = ff.or(filter, mergedFilter);
    }

    Query query = new Query(typename, filterOR);

    // retrieves the feature in the bbox
View Full Code Here

Examples of org.opengis.filter.FilterFactory2

            assertTrue("Confirm String",
                    String.class.isAssignableFrom(attributeDescriptor.getType().getBinding()));

            assertNotNull(hotlinkDescriptor.getType() != null);
        }
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        SimpleFeatureCollection features = featureStore.getFeatures(ff.equals(ff.property("STATE"),
                ff.literal("Tasmania")));
        SimpleFeatureIterator iterator = features.features();
        assertTrue("Tasmania found", iterator.hasNext());
        SimpleFeature tasmania = iterator.next();

        List<IDocument> documents = hotlink.getDocuments(tasmania, new NullProgressMonitor());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.