/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2008-2010, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotools.filter.function; import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.geotools.data.Parameter; import org.geotools.factory.CommonFactoryFinder; import org.geotools.filter.capability.FunctionNameImpl; import org.geotools.text.Text; import org.geotools.util.Converters; import org.geotools.util.KVP; import org.opengis.filter.FilterFactory2; import org.opengis.filter.capability.FunctionName; import org.opengis.filter.expression.Expression; import org.opengis.filter.expression.ExpressionVisitor; import org.opengis.filter.expression.Function; import org.opengis.filter.expression.Literal; /** * This is an implemenation of the Interpolate function as defined by * OGC Symbology Encoding (SE) 1.1 specification. *

* The first parameter should be either the name of a numeric feature property * or, if this function is being used as a raster colormap, the String "RasterData" * (case-insensitive). *

* Following this there should be a sequence of interpolation points, each of which * is described by two parameters: the first a datum and the second a return value. * In the SE speicification these parameters are expected to be Literals but in this * implementation more general Expressions are also supported. *

* Two optional parameters can be provided following the interpolation points: * A "method" parameter which can take the values "numeric" or "color" and a * "mode" parameter which can take the values "linear", "cosine" or "cubic" * (Note: it would make more sense if these terms were reversed but we are * adhering to their use as published in the OGC specification). *

* Number of points and interpolation modes *