Examples of MaxVisitor


Examples of org.geotools.feature.visitor.MaxVisitor

        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.MaxVisitor

            if (function == AggregationFunction.Average) {
                calc = new AverageVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.Count) {
                calc = new CountVisitor();
            } 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) {
View Full Code Here

Examples of org.geotools.feature.visitor.MaxVisitor

        // grab max of values lower than the target
        FilterFactory ff = getDataStore().getFilterFactory();
        Query qBelow = new Query(query);
        Filter lessFilter = ff.lessOrEqual(ff.property(attribute), ff.literal(targetValue));
        qBelow.setFilter(ff.and(query.getFilter(), lessFilter));
        MaxVisitor max = new MaxVisitor(attribute);
        handleVisitor(qBelow, max);
        Comparable maxBelow = (Comparable) max.getResult().getValue();
        if(maxBelow != null && maxBelow.equals(targetValue)) {
            // shortcut exit, we had a exact match
            nearest.setValue(maxBelow, null);
        } else {
            // grab mind of values higher than the target
View Full Code Here

Examples of org.geotools.feature.visitor.MaxVisitor

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

Examples of org.geotools.feature.visitor.MaxVisitor

   
    public void testMaxWithFilter() throws Exception {
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyName p = ff.property( aname("doubleProperty") );
       
        MaxVisitor v = new MyMaxVisitor(p);
       
        Filter f = ff.less( ff.property( aname("doubleProperty") ), ff.literal(2) );
        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.MaxVisitor

            return;
        }
        FilterFactory ff = dataStore.getFilterFactory();
        PropertyName p = ff.property( aname("doubleProperty") );
       
        MaxVisitor v = new MyMaxVisitor(p);
       
        DefaultQuery q = new DefaultQuery( tname("ft1"));
        q.setStartIndex(0);
        q.setMaxFeatures(2);
        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.MaxVisitor

      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();
     
      if ((globalMin instanceof Number) && (globalMax instanceof Number)) {
                return calculateNumerical(classNum, globalMin, globalMax);
            } else {
                return calculateNonNumerical(classNum, featureCollection);
View Full Code Here

Examples of org.geotools.feature.visitor.MaxVisitor

     * @throws IllegalFilterException
     * @throws IOException
     */
    static CalcResult calculateMax(SimpleFeatureCollection collection,
        Expression expression) throws IllegalFilterException, IOException {
        MaxVisitor maxVisitor = new MaxVisitor(expression);
        collection.accepts(maxVisitor, null);

        return maxVisitor.getResult();
    }
View Full Code Here

Examples of org.geotools.feature.visitor.MaxVisitor

            if (function == AggregationFunction.Average) {
                calc = new AverageVisitor(attIndex, features.getSchema());
            } else if (function == AggregationFunction.Count) {
                calc = new CountVisitor();
            } 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) {
View Full Code Here

Examples of org.geotools.feature.visitor.MaxVisitor

        // 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.