示例#1
0
 public Object clone() {
   ParamNumeric p = new ParamNumeric();
   p.setName(this.getName());
   p.setTitle(this.getTitle());
   if (this.getLowerBound() != null)
     p.setLowerBound(new Double(this.getLowerBound().doubleValue()));
   if (this.getUpperBound() != null)
     p.setUpperBound(new Double(this.getUpperBound().doubleValue()));
   p.setViewType(this.getViewType());
   if (value != null) p.setValue(new Double(value.doubleValue()));
   if (defaultValue != null) p.setDefaultValue(new Double(defaultValue.doubleValue()));
   if (this.getOptions() != null) {
     String[] v = new String[this.getOptions().length];
     for (int i = 0; i < this.getOptions().length; i++) v[i] = this.getOptions()[i];
     p.setOptions(v);
   }
   if (this.getLabels() != null) {
     String[] v = new String[this.getLabels().length];
     for (int i = 0; i < this.getLabels().length; i++) v[i] = this.getLabels()[i];
     p.setLabels(v);
   }
   p.required = required;
   return p;
 }
示例#2
0
  public static Scale makeHue(String aes) {
    Scale s = new Scale();
    s.setName("scale_" + aes + "_hue");
    s.aesName = aes;

    Param p;
    ParamNumeric pn;
    ParamVector pv;

    p = new ParamScaleLegend("legend", s.aesName, false);
    p.setTitle("");
    ((ParamScaleLegend) p).setAes(aes);
    p.setViewType(ParamScaleLegend.VIEW_SCALE);
    s.params.add(p);

    p = new ParamNone("Colour");
    p.setViewType(ParamNone.VIEW_SEPERATOR);
    s.params.add(p);

    p = new ParamVector();
    p.setName("h");
    p.setTitle("Hue range");
    p.setViewType(Param.VIEW_TWO_VALUE_ENTER);
    p.setValue(new String[] {"15", "375"});
    p.setDefaultValue(new String[] {"15", "375"});
    s.params.add(p);

    pn = new ParamNumeric();
    pn.setName("l");
    pn.setTitle("Luminance [0, 100]");
    pn.setViewType(Param.VIEW_ENTER);
    pn.setValue(new Double(65));
    pn.setDefaultValue(new Double(65));
    pn.setLowerBound(new Double(0));
    pn.setUpperBound(new Double(100));
    s.params.add(pn);

    pn = new ParamNumeric();
    pn.setName("c");
    pn.setTitle("Chroma");
    pn.setViewType(Param.VIEW_ENTER);
    pn.setValue(new Double(100));
    pn.setDefaultValue(new Double(100));
    pn.setLowerBound(new Double(0));
    s.params.add(pn);

    pn = new ParamNumeric();
    pn.setName("h.start");
    pn.setTitle("Hue start");
    pn.setViewType(Param.VIEW_ENTER);
    pn.setValue(new Double(0));
    pn.setDefaultValue(new Double(0));
    pn.setLowerBound(new Double(0));
    s.params.add(pn);

    pn = new ParamNumeric();
    pn.setName("direction");
    pn.setTitle("Colour wheel direction");
    pn.setViewType(Param.VIEW_COMBO);
    pn.setValue(new Double(1.0));
    pn.setDefaultValue(new Double(1.0));
    pn.setOptions(new String[] {"1.0", "-1.0"});
    pn.setLabels(new String[] {"clockwise", "counter clockwise"});
    s.params.add(pn);

    p = new ParamNone("Data");
    p.setViewType(ParamNone.VIEW_SEPERATOR);
    s.params.add(p);

    pv = new ParamVector();
    pv.setName("limits");
    pv.setTitle("Included levels");
    pv.setNumeric(false);
    s.params.add(pv);

    return s;
  }