コード例 #1
0
  /**
   * _more_
   *
   * @param visible _more_
   * @throws Exception _more_
   */
  public void setPairProfilesVisibility(boolean visible) throws Exception {
    profilesVisibility = visible;
    Set s = getDataTimeSet();
    int len = s.getLength();
    if (len < 2) { // no pair do nothing
      return;
    }
    AnimationWidget aniWidget = this.getAnimationWidget();
    // aniWidget.setBoxPanelVisible( !visible);
    // if (visible) {
    aniWidget.gotoIndex(0);
    aniWidget.setRunning(false);
    // }

    if (visible) {

      Set timeset = subSetProfilesTimeSet(s);
      dataNode.setOutputTimes((SampledSet) timeset);
    } else {
      Set timeset = getDataTimeSet();
      dataNode.setOutputTimes((SampledSet) timeset);
    }
    // GuiUtils.enableTree(aniWidget.getContents(), !visible);
    // now update the display list label
    aeroDisplay.setProfilesVisibility(visible, 0);

    if (visible) {
      if (s != null) {
        double[][] samples = s.getDoubles();
        DateTime dt = new DateTime(samples[0][1], s.getSetUnits()[0]);
        DateTime dt1 = new DateTime(samples[0][0], s.getSetUnits()[0]);
        listlabel =
            dt1.dateString()
                + ":"
                + dt1.timeString()
                + " and "
                + dt.dateString()
                + ":"
                + dt.timeString();
      }

    } else {
      listlabel = null;
    }

    updateDisplayList();
    updateHeaderLabel();
  }
コード例 #2
0
  /**
   * Handles internal consequences of a change to the probe position.
   *
   * @param pos The probe's new position.
   */
  public void probeMoved(RealTuple pos) {
    if (!getHaveInitialized()) {
      return;
    }

    try {
      LatLonPoint llp = null;
      RealTupleType rttype = (RealTupleType) pos.getType();

      if (rttype.equals(RealTupleType.SpatialCartesian2DTuple)
          || rttype.equals(RealTupleType.SpatialCartesian3DTuple)) {
        llp = latLon(pos);
      } else if (rttype.equals(RealTupleType.SpatialEarth2DTuple)
          || rttype.equals(RealTupleType.SpatialEarth3DTuple)) {
        Real[] reals = pos.getRealComponents();

        llp = new LatLonTuple(reals[1], reals[0]);
      } else if (rttype.equals(RealTupleType.LatitudeLongitudeTuple)
          || rttype.equals(RealTupleType.LatitudeLongitudeAltitude)) {
        Real[] reals = pos.getRealComponents();

        llp = new LatLonTuple(reals[0], reals[1]);
      } else {
        throw new IllegalArgumentException("Can't convert position to navigable point");
      }

      if (llp != null) {
        dataNode.setLocation(llp); // invokes super.setLocation(llp)
      }
    } catch (Exception ex) {
      logException("probeMoved", ex);
    }
  }
コード例 #3
0
  /**
   * Constructs the vertical profile display and control buttons
   *
   * @param dataChoice The data for this instance.
   * @return <code>true</code> if and only if this instance was correctly initialized.
   * @throws VisADException couldn't create a VisAD object needed
   * @throws RemoteException couldn't create a remote object needed
   */
  public boolean init(DataChoice dataChoice) throws VisADException, RemoteException {

    /*
     * Initialize the superclass.
     */
    if (!super.init()) {
      return false;
    }
    setSpatialLoci(gridLocs);

    if (!setData(dataChoice)) {
      return false;
    }

    /*
     * Add the listener here (as opposed to in the contructor) so we
     * don't get spurious events before we are fully initialized
     */
    probe.addPropertyChangeListener(
        SelectorDisplayable.PROPERTY_POSITION,
        new PropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent evt) {
            if (getActive() && getHaveInitialized()) {
              lineProbeWasMoved();
            }
          }
        });
    probe.setPointSize(getDisplayScale());
    probe.setAutoSize(true);
    addDisplayable(probe, FLAG_COLOR);
    addDisplayable(gridLocs, FLAG_COLOR);

    dataNode = SoundingDataNode.getInstance(new Listener());

    dataNode.setData(getData(getDataInstance()));

    return true;
  }
コード例 #4
0
  /**
   * Respond to a timeChange event
   *
   * @param time new time
   */
  protected void timeChanged(Real time) {
    try {
      super.timeChanged(time);
      dataNode.setTime(new DateTime(time));
      if (getProfilesVisibility()) {
        AnimationWidget aniWidget = this.getAnimationWidget();
        int idx = 0;
        if (aniWidget.getTimes() != null) {
          int n = aniWidget.getTimes().length;
          for (int i = 0; i < n; i++) {
            if ((new DateTime(time)).equals(aniWidget.getTimeAtIndex(i))) {
              idx = i;
              continue;
            }
          }
        }
        aeroDisplay.setProfilesVisibility(true, idx);
        // display list update
        Set s = getDataTimeSet();
        if (s != null) {
          double[][] samples = s.getDoubles();
          DateTime dt = new DateTime(samples[0][idx + 1], s.getSetUnits()[0]);
          DateTime dt1 = new DateTime(samples[0][idx], s.getSetUnits()[0]);
          listlabel =
              dt1.dateString()
                  + ":"
                  + dt1.timeString()
                  + " and "
                  + dt.dateString()
                  + ":"
                  + dt.timeString();
        }

        updateDisplayList();
        updateHeaderLabel();
      }
    } catch (Exception ex) {
      logException("timeValueChanged", ex);
    }
  }