Package org.opengis.filter.capability

Examples of org.opengis.filter.capability.FunctionName


                    return proposal;
                }
            }

            public String getDescription() {
                FunctionName description = functionFinder.findFunctionDescription(proposal);
                if (description != null) {
                    StringBuilder builder = new StringBuilder();

                    builder.append(description.getName());
                    String seperator = null;
                    if (description.getArguments() != null && !description.getArguments().isEmpty()) {
                        for (Parameter<?> param : description.getArguments()) {
                            if (seperator == null) {
                                builder.append("(");
                                seperator = ",";
                            } else {
                                builder.append(seperator);
                            }
                            builder.append(param.getName());
                        }

                        builder.append(")\nWhere:\n");
                        for (Parameter<?> param : description.getArguments()) {
                            builder.append("  ");
                            describeParameter(builder, param);
                            builder.append("\n");
                        }
                    }
                    if (description.getReturn() != null) {
                        builder.append("Result:\n");
                        Parameter<?> param = description.getReturn();
                       
                        builder.append(" ");
                        describeParameter(builder, param);
                        builder.append("\n");
                    }
View Full Code Here


                semanticTypeIdentifier = semanticTypeIdentifier.concat(paletteName.toLowerCase());
               
                //create the classification function, if necessary
                if (classifierModified) {
                    //TODO: add other classifiers
                  FunctionName fn = null;
                    boolean createClassifier = true;
                    if (getCombo(COMBO_BREAKTYPE).getText().equalsIgnoreCase(Messages.StyleEditor_theme_uniques))
                      fn = UniqueIntervalFunction.NAME;
                    else if (getCombo(COMBO_BREAKTYPE).getText().equalsIgnoreCase(Messages.StyleEditor_theme_equalInterval))
                      fn = EqualIntervalFunction.NAME;
                    else if (getCombo(COMBO_BREAKTYPE).getText().equalsIgnoreCase(Messages.StyleEditor_theme_quantile))
                      fn = QuantileFunction.NAME;
                    else if (getCombo(COMBO_BREAKTYPE).getText().equalsIgnoreCase(Messages.StyleEditor_theme_standardDeviation))
                      fn = StandardDeviationFunction.NAME;
                    else if (getCombo(COMBO_BREAKTYPE).getText().equalsIgnoreCase(Messages.StyleEditor_theme_custom)){
                        classifier = customBreak;
                        createClassifier = false;
                    }else{
                        return;
                    }
                   
          if (createClassifier) {
            function = (ClassificationFunction) ff.function(fn.getFunctionName(), new Expression[fn.getArgumentCount()]);
           
            ProgressListener cancelProgress = ((StyleEditorDialog) getContainer()).getProgressListener();
            function.setProgressListener((org.geotools.util.ProgressListener) cancelProgress);
            numClasses = new Integer(getCombo(COMBO_CLASSES).getText()).intValue();
View Full Code Here

    }

    public void testParse() throws Exception {
        FilterMockData.functionName(document, document);

        FunctionName function = (FunctionName) parse(OGC.FunctionNameType);

        assertEquals("foo", function.getName());
        assertEquals(2, function.getArgumentCount());
    }
View Full Code Here

        assertEquals("foo", function.getName());
        assertEquals(2, function.getArgumentCount());
    }

    public void testEncode() throws Exception {
        FunctionName function = FilterMockData.functionName();
        Document dom = encode(function, new QName(OGC.NAMESPACE, "FunctionName"),
                OGC.FunctionNameType);

        assertEquals("foo", dom.getDocumentElement().getFirstChild().getNodeValue());
        assertEquals("2", dom.getDocumentElement().getAttribute("nArgs"));
View Full Code Here

        return factory.functionName(name, Integer.parseInt(nargs));
    }

    public Element encode(Object object, Document document, Element value)
        throws Exception {
        FunctionName function = (FunctionName) object;
        value.appendChild(document.createTextNode(function.getName()));
        value.setAttributeNS("", "nArgs", function.getArgumentCount() + "");

        return value;
    }
View Full Code Here

    }

    public void testParse() throws Exception {
        FilterMockData.functionName(document, document);

        FunctionName function = (FunctionName) parse(OGC.Function_NameType);
        assertEquals("foo", function.getName());
        assertEquals(2, function.getArgumentCount());
    }
View Full Code Here

        assertEquals("foo", function.getName());
        assertEquals(2, function.getArgumentCount());
    }

    public void testEncode() throws Exception {
        FunctionName function = FilterMockData.functionName();
        Document dom = encode(function, new QName(OGC.NAMESPACE, "Function"), OGC.Function_NameType);

        assertEquals("foo", dom.getDocumentElement().getFirstChild().getNodeValue());
        assertEquals("2", dom.getDocumentElement().getAttribute("nArgs"));
    }
View Full Code Here

       
        Functions functions = operators.getFunctions();
        if( functions == null ) return false;
       
        // Note that only function name is checked here
        FunctionName found = functions.getFunctionName( function.getName() );
        // And that's enough to assess if the function is supported
        return found != null;
    }
View Full Code Here

        return null;
    }

    @Override
    public Object visit(Function f, Object extraData) {
        FunctionName fn = f.getFunctionName();
        if (fn != null && fn.getReturn() != null && fn.getReturn().getType() != Object.class) {
            return fn.getReturn().getType();
        } else if (f instanceof FilterFunction_Convert) {
            // special case for the convert function, which has the return type as
            // a parameter
            return f.getParameters().get(1).evaluate(null, Class.class);
        }
View Full Code Here

* @source $URL$
*/
public class FunctionImplTest extends TestCase {

    public void testFunctionName() throws Exception {
        FunctionName fn = FunctionImpl.functionName("foo", "bar:Integer", "a", "x:String:1,1",
            "y:MultiPolygon", "z:java.util.Date:1,");
       
        assertEquals("foo", fn.getName());
        check(fn.getReturn(), "bar", Integer.class, 1, 1);
        check(fn.getArguments().get(0), "a", Object.class, 1, 1);
        check(fn.getArguments().get(1), "x", String.class, 1, 1);
        check(fn.getArguments().get(2), "y", MultiPolygon.class, 1, 1);
        check(fn.getArguments().get(3), "z", Date.class, 1, -1);
       
        fn = FunctionImpl.functionName("foo", "a", "geom::1,1", "b:Object:,");
        check(fn.getArguments().get(0), "geom", Geometry.class, 1, 1);
        check(fn.getArguments().get(1), "b", Object.class, -1, -1);
       
        fn = FunctionImpl.functionName("foo", "value", "geom::,");
        check(fn.getArguments().get(0), "geom", Geometry.class, -1, -1);
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.capability.FunctionName

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.