Examples of MinVisitor


Examples of org.geotools.feature.visitor.MinVisitor

        final Query query = new Query(typeName);
        query.setPropertyNames(Arrays.asList(attributeName));

        final FeatureCalc visitor=
            metadataName.toLowerCase().endsWith("maximum")?
                new MaxVisitor(attributeName):new MinVisitor(attributeName);
        granuleCatalog.computeAggregateFunction(query, visitor);
        return visitor;
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

            } else if (function == AggregationFunction.Max) {
                calc = new MaxVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.Median) {
                calc = new MedianVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.Min) {
                calc = new MinVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.StdDev) {
                calc = new StandardDeviationVisitor(CommonFactoryFinder.getFilterFactory(null).property(aggAttribute));
            } else if (function == AggregationFunction.Sum) {
                calc = new SumVisitor(attIndex, features.getSchema());
            } else {
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

        } else {
            // grab mind of values higher than the target
            Query qAbove = new Query(query);
            Filter aboveFilter = ff.greater(ff.property(attribute), ff.literal(targetValue));
            qAbove.setFilter(ff.and(query.getFilter(), aboveFilter));
            MinVisitor min = new MinVisitor(attribute);
            handleVisitor(qAbove, min);
            Comparable minAbove = (Comparable) min.getResult().getValue();
            nearest.setValue(maxBelow, minAbove);
        }
       
        return true;
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

   
    public void testMin() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyName p = ff.property( aname("doubleProperty") );
       
        MinVisitor v = new MyMinVisitor(p);
        dataStore.getFeatureSource(tname("ft1")).accepts(Query.ALL, v, null);
        assertFalse(visited);
        assertEquals( 0.0, v.getResult().toDouble(), 0.01 );
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

   
    public void testMinWithFilter() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyName p = ff.property( aname("doubleProperty") );
       
        MinVisitor v = new MyMinVisitor(p);
       
        Filter f = ff.greater( ff.property( aname("doubleProperty") ), ff.literal(1) );
        Query q = new DefaultQuery( tname("ft1"), f);
        dataStore.getFeatureSource( tname("ft1")).accepts( q, v, null);
        assertFalse(visited);
        assertEquals( 1.1, v.getResult().toDouble(), 0.01 );
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

            return;
        }
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyName p = ff.property( aname("doubleProperty") );
       
        MinVisitor v = new MyMinVisitor(p);
       
        DefaultQuery q = new DefaultQuery( tname("ft1"));
        q.setStartIndex(0);
        q.setMaxFeatures(2);
        dataStore.getFeatureSource( tname("ft1")).accepts( q, v, null);
       
        assertFalse(visited);
        assertEquals( 0.0, v.getResult().toDouble(), 0.01 );
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

    private RangedClassifier calculate(SimpleFeatureCollection featureCollection) {
        int classNum = getClasses();
        Comparable globalMin;
        Comparable globalMax;
    try {
            MinVisitor minVisit = new MinVisitor(getParameters().get(0));
      if (progress == null) progress = new NullProgressListener();
      featureCollection.accepts(minVisit, progress);
      if (progress.isCanceled()) return null;
      globalMin = (Comparable) minVisit.getResult().getValue();

      MaxVisitor maxVisit = new MaxVisitor(getParameters().get(0));
      featureCollection.accepts(maxVisit, progress);
      if (progress.isCanceled()) return null;
      globalMax = (Comparable) maxVisit.getResult().getValue();
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

     * @throws IllegalFilterException
     * @throws IOException
     */
    static CalcResult calculateMin(SimpleFeatureCollection collection,
        Expression expression) throws IllegalFilterException, IOException {
        MinVisitor minVisitor = new MinVisitor(expression);
        collection.accepts(minVisitor, null);
        return minVisitor.getResult();
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

            } else if (function == AggregationFunction.Max) {
                calc = new MaxVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.Median) {
                calc = new MedianVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.Min) {
                calc = new MinVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.StdDev) {
                calc = new StandardDeviationVisitor(CommonFactoryFinder.getFilterFactory(null).property(aggAttribute));
            } else if (function == AggregationFunction.Sum) {
                calc = new SumVisitor(attIndex, features.getSchema());
            } else {
View Full Code Here

Examples of org.geotools.feature.visitor.MinVisitor

        // grab the feature collection and run the min/max visitors (this will move the
        // query to the dbms in case of such data source)
        Query q = new Query();
        q.setPropertyNames(new String[] {attribute.getName()});
        FeatureCollection fc = fs.getFeatures(q);
        MinVisitor minVisitor = new MinVisitor(attribute.getName());
        MaxVisitor maxVisitor = new MaxVisitor(attribute.getName());
        fc.accepts(minVisitor, null);
        fc.accepts(maxVisitor, null);
        Object min = minVisitor.getResult().getValue();
        attribute.setMin(Converters.convert(min, String.class));
        Object max = maxVisitor.getResult().getValue();
        attribute.setMax(Converters.convert(max, String.class));
    }
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.