Esempio n. 1
0
 /**
  * Set the LineWidth property.
  *
  * @param value The new value for LineWidth
  */
 public void setLineWidth(float value) {
   super.setLineWidth(value);
   try {
     if (maxDistanceBox != null) {
       maxDistanceBox.setLineWidth(value);
     }
   } catch (Exception exc) {
     LogUtil.logException("Setting color", exc);
   }
 }
Esempio n. 2
0
 /**
  * Add to the properties list
  *
  * @param comps List of label/widgets
  * @param compMap Optional mapping to hold components for later access
  */
 protected void getPropertiesComponents(List comps, Hashtable compMap) {
   super.getPropertiesComponents(comps, compMap);
   startTextFld = new JTextField(startText, 5);
   endTextFld = new JTextField(endText, 5);
   comps.add(GuiUtils.rLabel("Start Label:"));
   comps.add(GuiUtils.left(startTextFld));
   comps.add(GuiUtils.rLabel("End Label:"));
   comps.add(GuiUtils.left(endTextFld));
   maxDistanceFld = null;
   tvm = null;
   if (viewDescriptor != null) {
     VMManager vmManager = control.getControlContext().getIdv().getVMManager();
     List vms = vmManager.getViewManagers(TransectViewManager.class);
     tvm = (TransectViewManager) VMManager.findViewManagerInList(viewDescriptor, vms);
     if ((tvm != null) && (maxDataDistance != null)) {
       maxDistanceFld =
           new JTextField(maxDataDistance.getValue() + " [" + maxDataDistance.getUnit() + "]", 15);
       maxDistanceFld.setToolTipText("Maximum distance shown. e.g.: value[unit]");
       comps.add(GuiUtils.rLabel("Max distance:"));
       comps.add(GuiUtils.left(maxDistanceFld));
     }
   }
 }
Esempio n. 3
0
  /**
   * Handle glyph moved
   *
   * @throws RemoteException On badness
   * @throws VisADException On badness
   */
  public void updateLocation() throws VisADException, RemoteException {
    super.updateLocation();
    if (points.size() < 2) {
      return;
    }
    if (showText) {
      setText(startTextDisplayable, 0, startText, startTextType);
      setText(endTextDisplayable, 1, endText, endTextType);
    }

    checkBoxVisibility();
    if ((maxDataDistance == null) || (maxDistanceBox == null)) {
      return;
    }
    double km = maxDataDistance.getValue(CommonUnit.meter) / 1000.0;
    if (km > 2000) {
      return;
    }

    EarthLocation p1 = (EarthLocation) points.get(0);
    EarthLocation p2 = (EarthLocation) points.get(1);

    MathType mathType = RealTupleType.LatitudeLongitudeAltitude;

    Bearing baseBearing =
        Bearing.calculateBearing(
            p1.getLatitude().getValue(),
            p1.getLongitude().getValue(),
            p2.getLatitude().getValue(),
            p2.getLongitude().getValue(),
            null);

    double baseAngle = baseBearing.getAngle();

    LatLonPointImpl[] llps =
        new LatLonPointImpl[] {
          Bearing.findPoint(
              p1.getLatitude().getValue(),
              p1.getLongitude().getValue(),
              baseAngle + 90.0,
              km,
              null),
          Bearing.findPoint(
              p2.getLatitude().getValue(),
              p2.getLongitude().getValue(),
              baseAngle + 90.0,
              km,
              null),
          Bearing.findPoint(
              p2.getLatitude().getValue(), p2.getLongitude().getValue(), baseAngle - 90, km, null),
          Bearing.findPoint(
              p1.getLatitude().getValue(), p1.getLongitude().getValue(), baseAngle - 90, km, null),
          Bearing.findPoint(
              p1.getLatitude().getValue(), p1.getLongitude().getValue(), baseAngle + 90.0, km, null)
        };

    float[][] lineVals = getPointValues();
    float alt = lineVals[2][0];
    lineVals = new float[3][llps.length];
    for (int i = 0; i < lineVals[0].length; i++) {
      lineVals[0][i] = (float) llps[i].getLatitude();
      lineVals[1][i] = (float) llps[i].getLongitude();
    }

    float[][] tmp = new float[3][];

    for (int i = 0; i < lineVals[0].length - 1; i++) {
      tmp[0] =
          Misc.merge(
              tmp[0],
              Misc.interpolate(
                  2 + getNumInterpolationPoints(), lineVals[0][i], lineVals[0][i + 1]));
      tmp[1] =
          Misc.merge(
              tmp[1],
              Misc.interpolate(
                  2 + getNumInterpolationPoints(), lineVals[1][i], lineVals[1][i + 1]));
    }

    tmp[2] = new float[tmp[0].length];
    lineVals = tmp;

    for (int i = 0; i < lineVals[0].length; i++) {
      lineVals[2][i] = alt;
    }

    Data theData = new Gridded3DSet(mathType, lineVals, lineVals[0].length);
    maxDistanceBox.setData(theData);
  }
Esempio n. 4
0
 /**
  * Toggle the visibility
  *
  * @param visible is visible
  * @throws RemoteException On badness
  * @throws VisADException On badness
  */
 public void setVisible(boolean visible) throws VisADException, RemoteException {
   super.setVisible(visible);
   checkBoxVisibility();
 }