Package org.geotools.feature.visitor

Examples of org.geotools.feature.visitor.CalcResult


    synchronized (featureCollection) {
      if (featureCollection != previousFeatureCollection) {
        previousFeatureCollection = featureCollection;
        max = null;
        try {
          CalcResult result = calculateMax(featureCollection, expr);
          if (result != null) {
            max = result.getValue();
          }
        } catch (IllegalFilterException e) {
          LOGGER.log(Level.FINER, e.getLocalizedMessage(), e);
        } catch (IOException e) {
          LOGGER.log(Level.FINER, e.getLocalizedMessage(), e);
View Full Code Here


    synchronized (featureCollection) {
      if (featureCollection != previousFeatureCollection) {
        previousFeatureCollection = featureCollection;
        count = null;
        try {
          CalcResult result = calculateCount(featureCollection);
          if (result != null) {
            count = result.getValue();
          }
        } catch (IllegalFilterException e) {
          LOGGER.log(Level.FINER, e.getLocalizedMessage(), e);
        } catch (IOException e) {
          LOGGER.log(Level.FINER, e.getLocalizedMessage(), e);
View Full Code Here

    synchronized (featureCollection) {
      if (featureCollection != previousFeatureCollection) {
        previousFeatureCollection = featureCollection;
        min = null;
        try {
          CalcResult result = calculateMin(featureCollection, expr);
          if (result != null) {
            min = result.getValue();
          }
        } catch (IllegalFilterException e) {
          LOGGER.log(Level.FINER, e.getLocalizedMessage(), e);
        } catch (IOException e) {
          LOGGER.log(Level.FINER, e.getLocalizedMessage(), e);
View Full Code Here

        if (singlePass != null && singlePass) {
            AggregateFeatureCalc calc = new AggregateFeatureCalc(visitors);
            features.accepts(calc, new NullProgressListener());
            List<CalcResult> resultList = (List<CalcResult>) calc.getResult().getValue();
            for (int i = 0; i < functionList.size(); i++) {
                CalcResult result = resultList.get(i);
                if(result != null) {
                    results.put(functionList.get(i), (Number) result.getValue());
                }
            }
        } else {
            for (int i = 0; i < functionList.size(); i++) {
                final FeatureCalc calc = visitors.get(i);
View Full Code Here

    @Override
    public <T> T getDefaultValue(ResourceInfo resource, String dimensionName,
            DimensionInfo dimension, Class<T> clz) {
        final MaxVisitor max = new MaxVisitor(dimension.getAttribute());
        CalcResult res = getCalculatedResult((FeatureTypeInfo) resource, dimension, max);
        if (res.equals(CalcResult.NULL_RESULT)) {
            return null;
        } else {
            return Converters.convert(max.getMax(),clz);
        }
    }  
View Full Code Here

        }

        final FeatureCalc nearest = new NearestVisitor(ff.property(dimension.getAttribute()),
                this.toMatch);
       
        CalcResult res = getCalculatedResult((FeatureTypeInfo) resource, dimension, nearest);
        if (res.equals(CalcResult.NULL_RESULT)) {
            return null;
        } else {
            return Converters.convert(res.getValue(),clz);
        }
    }
View Full Code Here

    @Override
    public <T> T getDefaultValue(ResourceInfo resource, String dimensionName,
            DimensionInfo dimension, Class<T> clz) {
        final MinVisitor min = new MinVisitor(dimension.getAttribute());
        CalcResult res = getCalculatedResult((FeatureTypeInfo) resource, dimension, min);
        if (res.equals(CalcResult.NULL_RESULT)) {
            return null;
        } else {
            return Converters.convert(min.getMin(), clz);
        }
    }   
View Full Code Here

                result.addAll(values);
            }
        } else {
            final MinVisitor min = new MinVisitor(time.getAttribute());
            collection.accepts(min, null);
            CalcResult minResult = min.getResult();
            // check calcresult first to avoid potential IllegalStateException if no features are in collection
            if (minResult != CalcResult.NULL_RESULT) {
                result.add((Date) min.getMin());
                final MaxVisitor max = new MaxVisitor(time.getAttribute());
                collection.accepts(max, null);
View Full Code Here

            }
        } else {
            final MinVisitor min = new MinVisitor(elevation.getAttribute());
            collection.accepts(min, null);
            // check calcresult first to avoid potential IllegalStateException if no features are in collection
            CalcResult calcResult = min.getResult();
            if (calcResult != CalcResult.NULL_RESULT) {
                result.add(((Number) min.getMin()).doubleValue());
                final MaxVisitor max = new MaxVisitor(elevation.getAttribute());
                collection.accepts(max, null);
                result.add(((Number) max.getMax()).doubleValue());
View Full Code Here

     * @param calculator
     * @return
     */
    protected CalcResult getCalculatedResult(FeatureTypeInfo typeInfo, DimensionInfo dimension,
            FeatureCalc calculator) {
        CalcResult retval = null;
        try {
            FeatureCollection<?, ?> dimensionCollection = getDimensionCollection(typeInfo,
                    dimension);
            if (dimensionCollection == null) {
                throw new ServiceException(
View Full Code Here

TOP

Related Classes of org.geotools.feature.visitor.CalcResult

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.