Class ClassificationFunction

    • Field Detail

      • LOGGER

        protected static final Logger LOGGER
    • Constructor Detail

      • ClassificationFunction

        public ClassificationFunction​(FunctionName name)
    • Method Detail

      • setFallbackValue

        public void setFallbackValue​(Literal fallback)
        Description copied from interface: FunctionExpression
        Fallback value to use in the event the function is unavailable in the requested environment.

        The fallback value is not provided as one of the arguments, as it is an advanced option used in style layer descriptor documents to facilitate interoperability. It allows a user to specify an SQL function, and provide a value to use when the documented is used with a WFS that does not support the provided function.

        Specified by:
        setFallbackValue in interface FunctionExpression
      • getFallbackValue

        public Literal getFallbackValue()
        Description copied from interface: Function
        The value of the fallbackValue attribute is used as a default value, if the SE implementation does not support the function. If the implementation supports the function, then the result value is determined by executing the function.
        Specified by:
        getFallbackValue in interface Function
        Returns:
        Optional literal to use if an implementation for this function is not available.
      • getName

        public String getName()
        Gets the name of this function.
        Specified by:
        getName in interface Function
        Returns:
        the name of the function.
      • getFunctionName

        public FunctionName getFunctionName()
        Description copied from interface: Function
        Access to the FunctionName description as used in a FilterCapabilities document.
        Specified by:
        getFunctionName in interface Function
        Returns:
        FunctionName description, if available.
      • getParameters

        public List<Expression> getParameters()
        Returns the function parameters (the contents are Expressions, usually attribute expression and literal expression).
        Specified by:
        getParameters in interface Function
      • setProgressListener

        public void setProgressListener​(ProgressListener progress)
      • getClasses

        public int getClasses()
      • setClasses

        public void setClasses​(int classes)
      • getImplementationHints

        public Map<RenderingHints.Key,​?> getImplementationHints()
        Returns the implementation hints. The default implementation returns an empty map.
        Specified by:
        getImplementationHints in interface Factory
        Returns:
        The map of hints, or an {@linkplain java.util.Collections.emptyMap() empty map} if none.
      • decimalPlaces

        protected int decimalPlaces​(double slotWidth)
        Determines the number of decimal places to truncate the interval at.
      • round

        protected double round​(double value,
                               int decimalPlaces)
        Truncates a double to a certain number of decimals places. Note: truncation at zero decimal places will still show up as x.0, since we're using the double type.
        Parameters:
        value - number to round-off
        decimalPlaces - number of decimal places to leave
        Returns:
        the rounded value
      • fixRound

        protected double fixRound​(double value,
                                  int decimalPlaces,
                                  boolean up)
        Corrects a round off operation by incrementing or decrementing the decimal place (preferably the smallest one). This should usually be used to adjust the bounds to include a value. Example: 0.31-->0.44 where 0.44 is the maximum value and end of the range. We could just make the , round(0.31, 1)=0.3; round(0.44 max value = 0.49
      • toString

        public String toString()
        Creates a String representation of this Function with the function name and the arguments.
        Overrides:
        toString in class Object
      • computeGroupByPercentages

        protected double[] computeGroupByPercentages​(FeatureCollection collection,
                                                     double[] percentages,
                                                     int totalSize,
                                                     double min,
                                                     double classWidth)
                                              throws IOException
        This method return percentages by using a single groupBy query to retrieve class members. Can be used if the class width is the same for all the classes.
        Parameters:
        collection - the feature collection to classify
        percentages - the array of percentages to fill
        totalSize - the totalSize of the collection
        min - the min attribute value in the collection
        classWidth - the classWidth
        Returns:
        Throws:
        IOException
      • computePercentage

        protected void computePercentage​(double[] percentages,
                                         double classMembers,
                                         double totalSize,
                                         int index)
        Compute the percentage from the input parameters, setting in the percentages array at the specified index