示例#1
0
    public Widget makeExtraUI(final WebLayerItem item) {

      final CheckBox cb =
          GwtUtil.makeCheckBox(
              "Offset Calculation",
              "Calculate the distance, delta(RA), delta(Dec), and PA between two points",
              _posAngle);
      cb.addValueChangeHandler(
          new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> ev) {
              _posAngle = ev.getValue();
              redraw();
            }
          });

      SimpleInputField units =
          SimpleInputField.createByProp("PrefGroup.Generic.field.DistanceReadout");
      String pref = Preferences.get(DIST_READOUT);
      units.setValue(pref == null ? DEG : pref);
      units
          .getField()
          .addValueChangeHandler(
              new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent<String> ev) {
                  Preferences.set(DIST_READOUT, ev.getValue());
                  redraw();
                }
              });

      VerticalPanel vp = new VerticalPanel();
      vp.add(cb);
      vp.add(units);

      return vp;
    }
示例#2
0
  private void setDistOnShape(
      ShapeDataObj obj, double dist, ShapeDataObj.TextLocation texLoc, boolean isWorld) {
    String pref = Preferences.get(DIST_READOUT);

    if (isWorld) {
      if (pref != null && pref.equals(ARC_MIN)) {
        double arcmin = dist * 60.0;
        obj.setText(" " + _nf.format(arcmin) + "\'");
      } else if (pref != null && pref.equals(ARC_SEC)) {
        double arcsec = dist * 3600.0;
        obj.setText(" " + _nf.format(arcsec) + "\"");
      } else {
        obj.setText(" " + _nf.format(dist) + "&deg;");
      }
    } else {
      obj.setText(" " + ((int) dist) + " Pixels");
    }
    obj.setTextLocation(texLoc);
  }