Ejemplo n.º 1
0
 private static ParamGroup createDefaultParamGroup(final InputProductValidator validator) {
   final ParamGroup paramGroup = new ParamGroup();
   final DefaultRequestElementFactory factory = DefaultRequestElementFactory.getInstance();
   final Parameter inputProductParameter = factory.createDefaultInputProductParameter();
   inputProductParameter.addParamChangeListener(
       new ParamChangeListener() {
         public void parameterValueChanged(final ParamChangeEvent event) {
           validateInputProduct(event.getParameter(), validator);
         }
       });
   paramGroup.addParameter(inputProductParameter);
   final Parameter outputProductParameter = factory.createDefaultOutputProductParameter();
   final Object defaultValue = outputProductParameter.getProperties().getDefaultValue();
   if (defaultValue instanceof File) {
     outputProductParameter
         .getProperties()
         .setDefaultValue(new File((File) defaultValue, _defaultOutputProductFileName));
   }
   paramGroup.addParameter(outputProductParameter);
   paramGroup.addParameter(factory.createOutputFormatParameter());
   paramGroup.addParameter(factory.createDefaultLogPatternParameter(_defaultLogPrefix));
   try {
     paramGroup.addParameter(factory.createLogToOutputParameter(_defaultLogToOutput));
   } catch (ParamValidateException e) {
     Debug.trace("Unable to validate parameter '" + LOG_TO_OUTPUT_PARAM_NAME + "'"); /*I18N*/
     Debug.trace(e);
   }
   return paramGroup;
 }
Ejemplo n.º 2
0
 /**
  * Sets the default output product file name.
  *
  * @param name the output product file name
  */
 public void setDefaultOutputProductFileName(final String name) {
   final Parameter param = getParamGroup().getParameter(OUTPUT_PRODUCT_PARAM_NAME);
   final Object defaultValue = param.getProperties().getDefaultValue();
   if (defaultValue instanceof File) {
     final File file = (File) defaultValue;
     param.getProperties().setDefaultValue(new File(file.getParentFile(), name));
   }
 }
Ejemplo n.º 3
0
    private void addGeoParameter(ParamGroup pg) {

      paramNorthLat1 = new Parameter("geo_lat1", 90.0f);
      paramNorthLat1.getProperties().setDescription("North bound latitude");
      paramNorthLat1.getProperties().setPhysicalUnit("°");
      paramNorthLat1.getProperties().setMinValue(-90.0f);
      paramNorthLat1.getProperties().setMaxValue(90.0f);
      pg.addParameter(paramNorthLat1);

      paramWestLon1 = new Parameter("geo_lon1", -180.0f);
      paramWestLon1.getProperties().setDescription("West bound longitude");
      paramWestLon1.getProperties().setPhysicalUnit("°");
      paramWestLon1.getProperties().setMinValue(-180.0f);
      paramWestLon1.getProperties().setMaxValue(180.0f);
      pg.addParameter(paramWestLon1);

      paramSouthLat2 = new Parameter("geo_lat2", -90.0f);
      paramSouthLat2.getProperties().setDescription("South bound latitude");
      paramSouthLat2.getProperties().setPhysicalUnit("°");
      paramSouthLat2.getProperties().setMinValue(-90.0f);
      paramSouthLat2.getProperties().setMaxValue(90.0f);
      pg.addParameter(paramSouthLat2);

      paramEastLon2 = new Parameter("geo_lon2", 180.0f);
      paramEastLon2.getProperties().setDescription("East bound longitude");
      paramEastLon2.getProperties().setPhysicalUnit("°");
      paramEastLon2.getProperties().setMinValue(-180.0f);
      paramEastLon2.getProperties().setMaxValue(180.0f);
      pg.addParameter(paramEastLon2);

      if (canUseGeoCoordinates(product)) {
        syncLatLonWithXYParams();
      }
    }
Ejemplo n.º 4
0
    private void addPixelParameter(ParamGroup pg) {
      int w = product.getSceneRasterWidth();
      int h = product.getSceneRasterHeight();

      int x1 = 0;
      int y1 = 0;
      int x2 = w - 1;
      int y2 = h - 1;
      int sx = 1;
      int sy = 1;

      if (givenProductSubsetDef != null) {
        Rectangle region = givenProductSubsetDef.getRegion();
        if (region != null) {
          x1 = region.x;
          y1 = region.y;
          final int preX2 = x1 + region.width - 1;
          if (preX2 < x2) {
            x2 = preX2;
          }
          final int preY2 = y1 + region.height - 1;
          if (preY2 < y2) {
            y2 = preY2;
          }
        }
        sx = givenProductSubsetDef.getSubSamplingX();
        sy = givenProductSubsetDef.getSubSamplingY();
      }

      final int wMin = MIN_SUBSET_SIZE;
      final int hMin = MIN_SUBSET_SIZE;

      paramX1 = new Parameter("source_x1", x1);
      paramX1.getProperties().setDescription("Start X co-ordinate given in pixels"); /*I18N*/
      paramX1.getProperties().setMinValue(0);
      paramX1.getProperties().setMaxValue((w - wMin - 1) > 0 ? w - wMin - 1 : 0);

      paramY1 = new Parameter("source_y1", y1);
      paramY1.getProperties().setDescription("Start Y co-ordinate given in pixels"); /*I18N*/
      paramY1.getProperties().setMinValue(0);
      paramY1.getProperties().setMaxValue((h - hMin - 1) > 0 ? h - hMin - 1 : 0);

      paramX2 = new Parameter("source_x2", x2);
      paramX2.getProperties().setDescription("End X co-ordinate given in pixels"); /*I18N*/
      paramX2.getProperties().setMinValue(wMin - 1);
      final Integer maxValue = w - 1;
      paramX2.getProperties().setMaxValue(maxValue);

      paramY2 = new Parameter("source_y2", y2);
      paramY2.getProperties().setDescription("End Y co-ordinate given in pixels"); /*I18N*/
      paramY2.getProperties().setMinValue(hMin - 1);
      paramY2.getProperties().setMaxValue(h - 1);

      paramSX = new Parameter("source_sx", sx);
      paramSX
          .getProperties()
          .setDescription("Sub-sampling in X-direction given in pixels"); /*I18N*/
      paramSX.getProperties().setMinValue(1);
      paramSX.getProperties().setMaxValue(w / wMin + 1);

      paramSY = new Parameter("source_sy", sy);
      paramSY
          .getProperties()
          .setDescription("Sub-sampling in Y-direction given in pixels"); /*I18N*/
      paramSY.getProperties().setMinValue(1);
      paramSY.getProperties().setMaxValue(h / hMin + 1);

      pg.addParameter(paramX1);
      pg.addParameter(paramY1);
      pg.addParameter(paramX2);
      pg.addParameter(paramY2);
      pg.addParameter(paramSX);
      pg.addParameter(paramSY);
    }