Пример #1
0
  /**
   * set the default sampling; this is an unavoidable violation of MathType immutability - a
   * RealTupleType must be an argument (directly or through a SetType) to the constructor of its
   * default Set; this method throws an Exception if getDefaultSet has previously been invoked
   */
  public synchronized void setDefaultSet(Set sampling) throws VisADException {
    if (sampling.getDimension() != getDimension()) {
      throw new SetException("RealTupleType.setDefaultSet: dimensions don't match");
    }
    if (DefaultSetEverAccessed) {
      throw new TypeException("RealTupleType: DefaultSet already accessed" + " so cannot change");
    }
    DefaultSet = sampling;

    /* WLH 4 Feb 98 copied from constructor */
    if (DefaultSet != null && !Unit.canConvertArray(DefaultSet.getSetUnits(), DefaultUnits)) {
      throw new UnitException(
          "RealTupleType: default Set Units must be " + "convertable with default Units");
    }
    if (DefaultCoordinateSystem != null && DefaultSet != null) {
      CoordinateSystem cs = DefaultSet.getCoordinateSystem();
      if (cs != null && !cs.getReference().equals(DefaultCoordinateSystem.getReference())) {
        throw new CoordinateSystemException(
            "RealTupleType: Default coordinate system "
                + DefaultCoordinateSystem.getReference()
                + " must match"
                + " default set CoordinateSystem "
                + (cs == null ? null : cs.getReference()));
      }
      if (!Unit.canConvertArray(
          DefaultCoordinateSystem.getCoordinateSystemUnits(), DefaultSet.getSetUnits())) {
        throw new UnitException(
            "RealTupleType: CoordinateSystem Units must be "
                + "convertable with default Set Units");
      }
    }
  }
Пример #2
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();
  }
Пример #3
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);
    }
  }
Пример #4
0
 /**
  * array of component types; default CoordinateSystem for values of this type (including Function
  * domains) and may be null; default Set used when this type is a FunctionType domain and may be
  * null
  */
 public RealTupleType(RealType[] types, CoordinateSystem coord_sys, Set set)
     throws VisADException {
   super(types);
   if (coord_sys != null && types.length != coord_sys.getDimension()) {
     throw new CoordinateSystemException("RealTupleType: bad CoordinateSystem dimension");
   }
   DefaultCoordinateSystem = coord_sys;
   DefaultSet = set;
   DefaultSetEverAccessed = false;
   setDefaultUnits(types);
   if (DefaultCoordinateSystem != null
       && !Unit.canConvertArray(
           DefaultCoordinateSystem.getCoordinateSystemUnits(), DefaultUnits)) {
     throw new UnitException(
         "RealTupleType: CoordinateSystem Units must be " + "convertable with default Units");
   }
   if (DefaultSet != null && !Unit.canConvertArray(DefaultSet.getSetUnits(), DefaultUnits)) {
     throw new UnitException(
         "RealTupleType: default Set Units must be " + "convertable with default Units");
   }
   if (DefaultCoordinateSystem != null && DefaultSet != null) {
     CoordinateSystem cs = DefaultSet.getCoordinateSystem();
     if (cs != null && !cs.getReference().equals(DefaultCoordinateSystem.getReference())) {
       throw new CoordinateSystemException(
           "RealTupleType: Default coordinate system "
               + (coord_sys == null ? null : coord_sys.getReference())
               + " must match"
               + " default set CoordinateSystem "
               + (cs == null ? null : cs.getReference()));
     }
     if (!Unit.canConvertArray(
         DefaultCoordinateSystem.getCoordinateSystemUnits(), DefaultSet.getSetUnits())) {
       throw new UnitException(
           "RealTupleType: CoordinateSystem Units must be "
               + "convertable with default Set Units");
     }
   }
 }