예제 #1
0
  /**
   * _more_
   *
   * @param stormTrack _more_
   * @param param _more_
   * @return _more_
   */
  protected LineState makeLine(StormTrack stormTrack, StormParam param) {
    List<Real> values = new ArrayList<Real>();
    List<DateTime> times = stormTrack.getTrackTimes();
    List<StormTrackPoint> trackPoints = stormTrack.getTrackPoints();
    double min = 0;
    double max = 0;
    Unit unit = null;
    for (int pointIdx = 0; pointIdx < times.size(); pointIdx++) {
      Real value = trackPoints.get(pointIdx).getAttribute(param);
      if (value == null) {
        continue;
      }
      if (unit == null) {
        unit = ((RealType) value.getType()).getDefaultUnit();
      }
      values.add(value);
      double dvalue = value.getValue();
      //            System.err.print(","+dvalue);
      if ((pointIdx == 0) || (dvalue > max)) {
        max = dvalue;
      }
      if ((pointIdx == 0) || (dvalue < min)) {
        min = dvalue;
      }
    }
    if (values.size() == 0) {
      return null;
    }
    //        System.err.println("");
    String paramLabel = param.toString();
    String label = stormTrack.getWay().toString(); // +":" + paramLabel;
    LineState lineState = new LineState();
    lineState.setRangeIncludesZero(true);
    if (stormTrack.getWay().isObservation()) {
      lineState.setWidth(2);
    } else {
      lineState.setWidth(1);
    }
    lineState.setRange(new Range(min, max));
    lineState.setChartName(paramLabel);
    lineState.setAxisLabel("[" + unit + "]");

    //        System.err.println (param + " " +  StormDataSource.TYPE_STORMCATEGORY);
    if (Misc.equals(param, StormDataSource.PARAM_STORMCATEGORY)) {
      //            lineState.setShape(LineState.LINETYPE_BAR);
      lineState.setLineType(LineState.LINETYPE_BAR);
      lineState.setLineType(LineState.LINETYPE_AREA);
    } else {
      lineState.setLineType(LineState.LINETYPE_SHAPES_AND_LINES);
      lineState.setShape(LineState.SHAPE_LARGEPOINT);
    }

    lineState.setColor(stormDisplayState.getWayDisplayState(stormTrack.getWay()).getColor());
    lineState.setName(label);
    lineState.setTrack(times, values);
    return lineState;
  }
예제 #2
0
 /**
  * _more_
  *
  * @return _more_
  */
 private List<Integer> findForecastHours() {
   List<Integer> forecastHours = new ArrayList<Integer>();
   Hashtable seenForecastHour = new Hashtable();
   Hashtable seen = new Hashtable();
   for (StormTrack track : stormDisplayState.getTrackCollection().getTracks()) {
     if (track.getWay().isObservation()) {
       continue;
     }
     if (!chartWays.contains(track.getWay())) {
       continue;
     }
     for (StormTrackPoint stormTrackPoint : track.getTrackPoints()) {
       Integer forecastHour = new Integer(stormTrackPoint.getForecastHour());
       if (seenForecastHour.get(forecastHour) == null) {
         seenForecastHour.put(forecastHour, forecastHour);
         forecastHours.add(forecastHour);
       }
     }
   }
   return (List<Integer>) Misc.sort(forecastHours);
 }