Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory


            }
            // okay now we will do a query for everything in the added or modified bounds
            FeatureSource<SimpleFeatureType, SimpleFeature> source = notifierLayer.getResource(FeatureSource.class, ProgressManager.instance().get());
            SimpleFeatureType schema=source.getSchema();
           
            FilterFactory fac=CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
            final List<String> queryAtts = obtainQueryAttributesForFeatureTable(schema);
            final DefaultQuery query=new DefaultQuery(schema.getName().getLocalPart(), Filter.EXCLUDE, queryAtts.toArray(new String[0]));

            String name = schema.getGeometryDescriptor().getName().getLocalPart();
      // add new features
            if( addedBounds!=null ){
              double minx=addedBounds.getMinX();
        double miny=addedBounds.getMinY();
        double maxx=addedBounds.getMaxX();
        double maxy=addedBounds.getMaxY();
        String srs=CRS.lookupIdentifier(schema.getCoordinateReferenceSystem(), false);
        BBOX bboxFilter = fac.bbox(name, minx, miny, maxx, maxy, srs);
       
                query.setFilter(bboxFilter);
                FeatureCollection<SimpleFeatureType, SimpleFeature>  features = source.getFeatures(query);
                this.table.update(features);
            }
            // update modified features
            if( modifiedBounds!=null ){
              double minx=modifiedBounds.getMinX();
        double miny=modifiedBounds.getMinY();
        double maxx=modifiedBounds.getMaxX();
        double maxy=modifiedBounds.getMaxY();
        String srs=CRS.lookupIdentifier(schema.getCoordinateReferenceSystem(), false);
        BBOX bboxFilter = fac.bbox(name, minx, miny, maxx, maxy, srs);

                query.setFilter(bboxFilter);
                FeatureCollection<SimpleFeatureType, SimpleFeature>  features = source.getFeatures(query);
                this.table.update(features);
            }       
View Full Code Here


        this.fid = fid2;
    }

    public synchronized SimpleFeature get( IProgressMonitor monitor, Object... params ) {
        if (feature == null) {
            FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools
                    .getDefaultHints());
            Id fidFilter = filterFactory.id(FeatureUtils.stringToId(filterFactory, fid));
           
            if( monitor == null ) monitor = new NullProgressMonitor();               
            try {
                monitor.beginTask("Get Feature", 100 );
               
View Full Code Here

* @param fid the feature id
* @return
*/
@SuppressWarnings("unchecked")
public static Filter id(String fid) {
    FilterFactory factory = CommonFactoryFinder.getFilterFactory2(GeoTools
            .getDefaultHints());
    Set<Identifier> id = stringToId(factory , fid);
    Id filter = factory.id(id);
    return filter;
}
View Full Code Here

        }
       
        if( !forceRefresh && fids.isEmpty() )
            return;
       
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        boolean modified=false;
        for( String fid : fids ) {
            if ( fid == null )
                continue;
            if( hidefeature ){
View Full Code Here

        Class< ? extends Geometry> expectedClass = (Class< ? extends Geometry>) geomAttr.getType()
                .getBinding();

        Geometry adaptedGeom = GeometryUtil.adapt(newGeometry, expectedClass);

        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
        FeatureId fid = ff.featureId(fidToUpdate);
        Set<FeatureId> ids = new HashSet<FeatureId>(1);
        ids.add(fid);
        Id filter = ff.id(ids);

        store.modifyFeatures(geomAttr, adaptedGeom, filter);
    }
View Full Code Here

     * @see org.locationtech.udig.project.internal.EditManager#refreshEditFeature()
     */
    public void refreshEditFeature() {
        Layer editLayer = getEditLayerInternal();
        try {
            FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools
                    .getDefaultHints());
            FeatureStore resource = editLayer.getResource(FeatureStore.class, null);
            Set<Identifier> fids = FeatureUtils.stringToId(filterFactory, getEditFeature().getID());
            Id filter = filterFactory.id(fids);
            FeatureIterator<SimpleFeature> features = resource.getFeatures(filter).features();
            if (features.hasNext()) {
                SimpleFeature feature = features.next();
                setEditFeature(feature, editLayer);
            } else {
View Full Code Here

       
        if( query.getFilter()==Filter.EXCLUDE ){
            return query; // nothing to draw get out of here!
        }
       
        FilterFactory ff=CommonFactoryFinder.getFilterFactory();
        Object editFilter=getLayer().getBlackboard().get(ProjectBlackboardConstants.MAP__RENDERING_FILTER);
        if (!(editFilter instanceof Filter) ){
            return query;
        }
        if( (editFilter instanceof Id) && ((Id)editFilter).getIDs().isEmpty() ){
          return query;
        }
       
        Filter newFilter;
        try {
            if( query.getFilter()==Filter.INCLUDE){
                newFilter=ff.not((Filter) editFilter);
            }else{
                editFilter=ff.not((Filter) editFilter);
                newFilter=ff.and((Filter)query.getFilter(), (Filter) editFilter);
            }
        } catch (IllegalFilterException e) {
            return query;
        }
        // return new Query( query.getTypeName(), query.getNamespace(), newFilter, query.getMaxFeatures(), query.getPropertyNames(), query.getHandle());
View Full Code Here

            ILayer layer=(ILayer) ((IAdaptable)getData()).getAdapter(ILayer.class);
            Filter filter=(Filter) ((IAdaptable)getData()).getAdapter(Filter.class);
           
            if (filter == null) {
              SimpleFeature feature = (SimpleFeature) ((IAdaptable) getData()).getAdapter(SimpleFeature.class);
              FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        if (feature != null) {
          filter = filterFactory.id(FeatureUtils.stringToId(
              filterFactory, feature.getID()));
        } else {
          return;
        }
            }
View Full Code Here

        Symbolizer[] syms = new Symbolizer[1];
        if (LineString.class.isAssignableFrom(type) || MultiLineString.class.isAssignableFrom(type))
            syms[0] = builder.createLineSymbolizer(baseColor, 2);
        if (Point.class.isAssignableFrom(type) || MultiPoint.class.isAssignableFrom(type)) {
            PointSymbolizer point = builder.createPointSymbolizer(builder.createGraphic());
            FilterFactory ff = builder.getFilterFactory();
            // point.getGraphic().getMarks()[0].setSize((Expression) ff.literal(10));
            point.getGraphic().setSize(ff.literal(10));
            Mark mark = (Mark) point.getGraphic().graphicalSymbols().get(0);
            mark.setFill(builder.createFill(baseColor));
            syms[0] = point;
        }
        if (Polygon.class.isAssignableFrom(type) || MultiPolygon.class.isAssignableFrom(type)) {
View Full Code Here

        sldContentManager.getDefaultFeatureTypeStyle().rules().add(rule);

    }

    private PropertyIsEqualTo createGeometryFunctionFilter( String geomXPath, Object geometryClassSimpleName ) throws IllegalFilterException {
        FilterFactory factory=CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        FilterFunction_geometryType geomTypeExpr=new FilterFunction_geometryType();
        List<Expression> params = new ArrayList<Expression>();
        params.add(factory.property(geomXPath));
        geomTypeExpr.setParameters(params);
       
        return factory.equals(geomTypeExpr, factory.literal(geometryClassSimpleName));
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.FilterFactory

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.