Examples of ParametersSet


Examples of es.unex.sextante.core.ParametersSet

   * @throws WrongParameterIDException
   */
  private void setAlgorithmInputs(Map<String, Object> input)
            throws WrongParameterIDException {

    ParametersSet paramSet = (ParametersSet) m_Algorithm.getParameters();
    Set<String> keys = input.keySet();
    Iterator<String> iter = keys.iterator();
    while(iter.hasNext()){
      String sKey = iter.next();
      if (!sKey.equals(GRID_EXTENT)){
        Object paramValue = input.get(sKey);
        Parameter param = paramSet.getParameter(sKey);
        param.setParameterValue(paramValue);
      }
      GridExtent ge = (GridExtent) input.get(GRID_EXTENT);
      m_Algorithm.setGridExtent(ge);
    }
View Full Code Here

Examples of es.unex.sextante.core.ParametersSet

    public Map<String, Parameter<?>> getParameterInfo(Name name) {
        checkName(name);
        GeoAlgorithm algorithm = Sextante.getAlgorithmFromCommandLineName(name.getLocalPart());

        ParametersSet paramSet = algorithm.getParameters();
        Map<String, Parameter<?>> paramInfo = new HashMap<String, Parameter<?>>();

        for (int i = 0; i < paramSet.getNumberOfParameters(); i++) {
            es.unex.sextante.parameters.Parameter param = paramSet.getParameter(i);
            paramInfo.put(param.getParameterName(), new Parameter(param.getParameterName(),
                    mapToGeoTools(param.getParameterClass()), Text.text(param
                            .getParameterDescription()),
                    Text.text(param.getParameterDescription()), getAdditionalInfoMap(param)));
        }
View Full Code Here

Examples of es.unex.sextante.core.ParametersSet

   */
  private void setAlgorithmInputs(Map<String, Object> input)
            throws GeoAlgorithmExecutionException {

      // set the normal parameters
    ParametersSet paramSet = (ParametersSet) m_Algorithm.getParameters();
    boolean gridExtendRequired = false;
    for(String sKey : input.keySet()) {
      if(SEXTANTE_GRID_CELL_SIZE.equals(sKey) || SEXTANTE_GRID_ENVELOPE.equals(sKey)) {
          // these two parameters we made up to expose the GridExtent, we'll deal with them later
          continue;
      }
      Object paramValue = input.get(sKey);
      Parameter param = paramSet.getParameter(sKey);
      if(paramValue instanceof FeatureCollection) {
        param.setParameterValue(GTVectorLayer.createLayer(DataUtilities.source((FeatureCollection) paramValue), Query.ALL));
      } else if(paramValue instanceof GridCoverage2D) {
          GTRasterLayer layer = new GTRasterLayer();
          gridExtendRequired = true;
          layer.create(paramValue);
          param.setParameterValue(layer);
      } else {
        param.setParameterValue(paramValue);
      }
    }
   
    // check the outputs as well for raster data
    OutputObjectsSet outputs = m_Algorithm.getOutputObjects();
        for (int i = 0; i < outputs.getOutputObjectsCount(); i++) {
            Output output = outputs.getOutput(i);
            if(output instanceof OutputRasterLayer) {
                gridExtendRequired = true;
            }
        }
   
        // handle the grid extent if necessary
    if(gridExtendRequired) {
        // get the cell size
        double cellSize = Double.NaN;
        if(input.get(SEXTANTE_GRID_CELL_SIZE) != null) {
            cellSize = (Double) input.get(SEXTANTE_GRID_CELL_SIZE);
        } else {
            for(String sKey : input.keySet()) {
                Object value = paramSet.getParameter(sKey).getParameterValueAsObject();
                if(value instanceof GTRasterLayer) {
                    cellSize = ((GTRasterLayer) value).getLayerCellSize();
                    return;
                }
            }
        }
        if(Double.isNaN(cellSize)) {
            throw new GeoAlgorithmExecutionException(SEXTANTE_GRID_CELL_SIZE
                    + " parameter could not be derived from inputs, and is not available among ");
        }
       
        // get the extents
        Envelope envelope = null;
        if(input.get(SEXTANTE_GRID_ENVELOPE) != null) {
            envelope = (Envelope) input.get(SEXTANTE_GRID_ENVELOPE);
        } else {
            for(String sKey : input.keySet()) {
                    Object value = paramSet.getParameter(sKey).getParameterValueAsObject();
                    if(value instanceof GTRasterLayer) {
                        GridExtent ge = ((GTRasterLayer) value).getLayerGridExtent();
                        Envelope genv = new Envelope(ge.getXMin(), ge.getXMax(), ge.getYMin(), ge.getYMax());
                        if(envelope == null) {
                            envelope = genv;
View Full Code Here

Examples of es.unex.sextante.core.ParametersSet

    public Map<String, Parameter<?>> getParameterInfo(Name name) {
        checkName(name);
        GeoAlgorithm algorithm = Sextante.getAlgorithmFromCommandLineName(name.getLocalPart());

        ParametersSet paramSet = algorithm.getParameters();
        Map<String, Parameter<?>> paramInfo = new LinkedHashMap<String, Parameter<?>>();

        boolean hasRasterInput = false;
        for (int i = 0; i < paramSet.getNumberOfParameters(); i++) {
            es.unex.sextante.parameters.Parameter param = paramSet.getParameter(i);
            String title = param.getParameterDescription();
            String description = title;
            try {
              String td = param.getParameterAdditionalInfo().getTextDescription();
              if(td != null) {
View Full Code Here

Examples of es.unex.sextante.core.ParametersSet

   */
  private void setAlgorithmInputs(Map<String, Object> input)
            throws GeoAlgorithmExecutionException {

      // set the normal parameters
    ParametersSet paramSet = (ParametersSet) m_Algorithm.getParameters();
    boolean gridExtendRequired = false;
    for(String sKey : input.keySet()) {
      if(SEXTANTE_GRID_CELL_SIZE.equals(sKey) || SEXTANTE_GRID_ENVELOPE.equals(sKey)) {
          // these two parameters we made up to expose the GridExtent, we'll deal with them later
          continue;
      }
      Object paramValue = input.get(sKey);
      Parameter param = paramSet.getParameter(sKey);
      if(paramValue instanceof FeatureCollection) {
        param.setParameterValue(GTVectorLayer.createLayer(DataUtilities.source((FeatureCollection) paramValue), Query.ALL));
      } else if(paramValue instanceof GridCoverage2D) {
          GTRasterLayer layer = new GTRasterLayer();
          gridExtendRequired = true;
          layer.create(paramValue);
          param.setParameterValue(layer);
      } else {
        param.setParameterValue(paramValue);
      }
    }
   
    // check the outputs as well for raster data
    OutputObjectsSet outputs = m_Algorithm.getOutputObjects();
        for (int i = 0; i < outputs.getOutputObjectsCount(); i++) {
            Output output = outputs.getOutput(i);
            if(output instanceof OutputRasterLayer) {
                gridExtendRequired = true;
            }
        }
   
        // handle the grid extent if necessary
    if(gridExtendRequired) {
        // get the cell size
        double cellSize = Double.NaN;
        if(input.get(SEXTANTE_GRID_CELL_SIZE) != null) {
            cellSize = (Double) input.get(SEXTANTE_GRID_CELL_SIZE);
        } else {
            for(String sKey : input.keySet()) {
                Object value = paramSet.getParameter(sKey).getParameterValueAsObject();
                if(value instanceof GTRasterLayer) {
                    cellSize = ((GTRasterLayer) value).getLayerCellSize();
                    return;
                }
            }
        }
        if(Double.isNaN(cellSize)) {
            throw new GeoAlgorithmExecutionException(SEXTANTE_GRID_CELL_SIZE
                    + " parameter could not be derived from inputs, and is not available among ");
        }
       
        // get the extents
        Envelope envelope = null;
        if(input.get(SEXTANTE_GRID_ENVELOPE) != null) {
            envelope = (Envelope) input.get(SEXTANTE_GRID_ENVELOPE);
        } else {
            for(String sKey : input.keySet()) {
                    Object value = paramSet.getParameter(sKey).getParameterValueAsObject();
                    if(value instanceof GTRasterLayer) {
                        GridExtent ge = ((GTRasterLayer) value).getLayerGridExtent();
                        Envelope genv = new Envelope(ge.getXMin(), ge.getXMax(), ge.getYMin(), ge.getYMax());
                        if(envelope == null) {
                            envelope = genv;
View Full Code Here

Examples of es.unex.sextante.core.ParametersSet

    public Map<String, Parameter<?>> getParameterInfo(Name name) {
        checkName(name);
        GeoAlgorithm algorithm = Sextante.getAlgorithmFromCommandLineName(name.getLocalPart());

        ParametersSet paramSet = algorithm.getParameters();
        Map<String, Parameter<?>> paramInfo = new LinkedHashMap<String, Parameter<?>>();

        boolean hasRasterInput = false;
        for (int i = 0; i < paramSet.getNumberOfParameters(); i++) {
            es.unex.sextante.parameters.Parameter param = paramSet.getParameter(i);
            String title = param.getParameterDescription();
            String description = title;
            try {
              String td = param.getParameterAdditionalInfo().getTextDescription();
              if(td != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.