Example #1
0
 /**
  * Copies key, ObjectValue, description and readOnly property from the specified argument.
  *
  * @param argument The IArgument to copy values from
  */
 public void assignFrom(IArgument argument) {
   if (argument != null) {
     setKey(argument.getKey());
     setDescription(argument.getDescription());
     setValue(argument.getValue());
     setReadOnly(argument.isReadOnly());
   }
 }
  public void safeInitialize(IArgument[] properties) throws Exception {
    String unitId = "raster";
    String grassDb = null;
    String location = null;
    for (IArgument argument : properties) {
      String key = argument.getKey();

      if (key.equals("igrass")) {
        rasterMapName = argument.getValue();
      }
      if (key.equals("igrassascii")) {
        rasterMapName = argument.getValue();
        mapType = JGrassConstants.GRASSASCIIRASTERMAP;
      }
      if (key.equals("iesrigrid")) {
        rasterMapName = argument.getValue();
        mapType = JGrassConstants.ESRIRASTERMAP;
      }
      if (key.equals("ifluidturtle")) {
        rasterMapName = argument.getValue();
        mapType = JGrassConstants.FTRASTERMAP;
      }
      if (key.compareTo("grassdb") == 0) {
        grassDb = argument.getValue();
      }
      if (key.compareTo("location") == 0) {
        location = argument.getValue();
      }
      if (key.compareTo("mapset") == 0) {
        mapset = argument.getValue();
      }
    }

    componentId = mapType;
    componentDescr = componentId;

    locationPath = grassDb + File.separator + location;
    String activeRegionPath =
        grassDb
            + File.separator
            + location
            + File.separator
            + mapset
            + File.separator
            + JGrassConstants.WIND;
    activeRegion = new JGrassRegion(activeRegionPath);

    /*
     * create the output exchange item that will be passed over the link to which the component
     * is link to other componentes
     */
    rasterMapOutputEI = ModelsConstants.createRasterOutputExchangeItem(this, activeRegion);
  }