Package org.geotools.data

Examples of org.geotools.data.Parameter


        }
        // if annotation is not found, return a generic description using
        // the method return type
        if (result.isEmpty()) {
            if (!Void.class.equals(method.getReturnType())) {
                Parameter<?> VALUE = new Parameter("result", method.getReturnType(),
                        "Process result", "No description is available");
                result.put(VALUE.key, VALUE);
            }
        }
        return result;
View Full Code Here


            metadata = new HashMap<String, Object>();
            fillParameterMetadata(meta, metadata);
        }

        int min = info.primary() ? 0 : 1;
        Parameter resultParam = new Parameter(info.name(), resultType,
                new SimpleInternationalString(info.name()), new SimpleInternationalString(
                        info.description()), min > 0, min, 1, null, metadata);
        result.put(resultParam.key, resultParam);
    }
View Full Code Here

        }
       
       
        // finally build the parameter
        if (info != null) {
            return new Parameter(info.name(), type, new SimpleInternationalString(info.name()),
                    new SimpleInternationalString(info.description()), min > 0, min, max, defaultValue,
                    metadata);
        } else {
            return new Parameter("arg" + i, type, new SimpleInternationalString("Argument " + i),
                    new SimpleInternationalString("Input " + type.getName() + " value"), min > 0,
                    min, max, defaultValue, metadata);
        }
    }
View Full Code Here

                    }
                   
                    // find the corresponding argument in the input
                    // map and set it
                    Class<? extends Object> target = targetObject == null ? null : targetObject.getClass();
          Parameter p = paramInfo(target, i, paramTypes[i], annotations[i]);
                    Object value = input.get(p.key);
                   
                    if(value == null && p.getDefaultValue() != null) {
                        value = p.getDefaultValue();
                    }

                    // this takes care of array/collection conversions among
                    // others
                    args[i] = Converters.convert(value, paramTypes[i]);
View Full Code Here

        JLabel title = new JLabel(factory.getTitle().toString());
        page.add(title);
        JLabel description = new JLabel("Your process results are below:");
        page.add(description);
        for (Entry<String, Object> entry : resultMap.entrySet()) {
            Parameter<?> parameter = new Parameter(entry.getKey(), entry.getValue().getClass(),
                    Text.text("Result"), Text.text("Result of process"));
            JLabel label = new JLabel(entry.getKey());
            page.add(label);

            ParamField widget;
View Full Code Here

   
    @Test
    public void testGetInputParameters() throws Exception {
        Map<String,Parameter<?>> inputs = adapter.getInputParameters("foo");
       
        Parameter p = inputs.get("bar");
        assertNotNull(p);
        assertEquals("bar", p.key);
        assertEquals("bar", p.title.toString());
        assertEquals("The bar parameter", p.description.toString());
        assertEquals(String.class, p.type);
View Full Code Here

   
    @Test
    public void testGetOutputParameters() throws Exception {
        Map<String,Parameter<?>> outputs = adapter.getOutputParameters("foo");
       
        Parameter p = outputs.get("result");
        assertNotNull(p);
       
        assertEquals("result", p.key);
        assertEquals("result", p.title.toString());
        assertEquals("The result", p.description.toString());
View Full Code Here

        final ListView inputView = new ListView("inputs", new PropertyModel(execute, "inputs")) {

            @Override
            protected void populateItem(ListItem item) {
                InputParameterValues pv = (InputParameterValues) item.getModelObject();
                Parameter p = pv.getParameter();
                item.add(new Label("param", buildParamSpec(p)));
                item.add(new Label("paramDescription", p.description.toString(Locale.ENGLISH)));
                if (!pv.isComplex() && !pv.isCoordinateReferenceSystem() && !pv.isBoundingBox()) {
                    Fragment f = new Fragment("paramValue", "literal", WPSRequestBuilderPanel.this);
                    FormComponent literal = new TextField("literalValue", new PropertyModel(pv,
                            "values[0].value"));
                    literal.setRequired(p.minOccurs > 0);
                    literal.setLabel(new Model(p.key));
                    f.add(literal);
                    item.add(f);
                } else if (pv.isBoundingBox()) {
                    EnvelopePanel envelope = new EnvelopePanel("paramValue", new PropertyModel(pv,
                            "values[0].value"));
                    envelope.setCRSFieldVisible(true);
                    item.add(envelope);
                } else if (pv.isCoordinateReferenceSystem()) {
                    CRSPanel crs = new CRSPanel("paramValue", new PropertyModel(pv,
                            "values[0].value"));
                    item.add(crs);
                } else {
                    ComplexInputPanel input = new ComplexInputPanel("paramValue", pv, 0);
                    item.add(input);
                }
            }
        };
        inputView.setReuseItems(true);
        inputContainer.add(inputView);

        // the process outputs
        final WebMarkupContainer outputContainer = new WebMarkupContainer("outputContainer");
        outputContainer.setVisible(existingProcess);
        add(outputContainer);
        final ListView outputView = new ListView("outputs", new PropertyModel(execute, "outputs")) {

            @Override
            protected void populateItem(ListItem item) {
                OutputParameter pv = (OutputParameter) item.getModelObject();
                Parameter p = pv.getParameter();
                item.add(new CheckBox("include", new PropertyModel(pv, "include")));
                item.add(new Label("param", buildParamSpec(p)));
                item.add(new Label("paramDescription", p.description.toString(Locale.ENGLISH)));
                if (pv.isComplex()) {
                    DropDownChoice mime = new DropDownChoice("mime", new PropertyModel(pv,
View Full Code Here

            } catch(NullParameterAdditionalInfoException e) {
              // fine
            }
           
            hasRasterInput = hasRasterInput || IRasterLayer.class.isAssignableFrom(param.getParameterClass());
            paramInfo.put(param.getParameterName(), new Parameter(param.getParameterName(),
                    mapToGeoTools(param.getParameterClass()), Text.text(title),
                    Text.text(description), getAdditionalInfoMap(param)));
        }
       
        // check if there is any raster output
        boolean hasRasterOutput = false;
        OutputObjectsSet ooset = algorithm.getOutputObjects();
        for (int i = 0; i < ooset.getOutputObjectsCount(); i++) {
            Output output = ooset.getOutput(i);
            if (output instanceof OutputRasterLayer) {
                hasRasterOutput = true;
                break;
            }
        }

        // if there is any input or output raster we also need the user to specify
        // the grid structure, though we can get it from the first raster if there
        // are raster inputs, meaning in that case we'll grab it from
        if(hasRasterInput || hasRasterOutput) {
            // create a grid envelope, required only if there is no raster input we can
            // get the same info from
            if(hasRasterInput) {
                paramInfo.put(SEXTANTE_GRID_ENVELOPE, new Parameter(SEXTANTE_GRID_ENVELOPE,
                        Envelope.class, Text.text("Grid bounds (defaults to the bounds of the inputs)"),
                        Text.text("The real world coordinates bounding the grid"),
                        false, 0, 1, null, null));
                paramInfo.put(SEXTANTE_GRID_CELL_SIZE, new Parameter(SEXTANTE_GRID_CELL_SIZE,
                        Double.class, Text.text("Cell size (defaults to the size of the first input)"),
                        Text.text("The cell size in real world units"),
                        false, 0, 1, null, null));
            } else {
                paramInfo.put(SEXTANTE_GRID_ENVELOPE, new Parameter(SEXTANTE_GRID_ENVELOPE,
                        Envelope.class, Text.text("Grid bounds"),
                        Text.text("The real world coordinates bounding the grid"),
                        true, 1, 1, null, null));
                paramInfo.put(SEXTANTE_GRID_CELL_SIZE, new Parameter(SEXTANTE_GRID_CELL_SIZE,
                        Double.class, Text.text("Cell size"),
                        Text.text("The cell size in real world units"),
                        true, 1, 1, null, null));
            }
           
View Full Code Here

                outputClass = String.class;
            } else {
                throw new IllegalArgumentException("Don't know how to handle output of type" + output.getClass());
            }

            outputInfo.put(output.getName(), new Parameter(output.getName(), outputClass, Text
                    .text(output.getDescription()), Text.text(output.getDescription())));
        }

        return outputInfo;
View Full Code Here

TOP

Related Classes of org.geotools.data.Parameter

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.