Example #1
0
 /** Gets string representation of ChannelView in the debug purposes */
 public String toString() {
   String ret = "";
   for (PlotDataProvider channel : plotDataProviders) {
     ret = ret + channel.getStation().getName() + "/" + channel.getChannelName() + " ";
   }
   return "ChannelView: " + ret;
 }
Example #2
0
  /** Prepares pixelized data for PlotDataProviders to draw. Should be called before paint. */
  public synchronized String updateData() {

    int width = graphAreaPanel.getWidth(); // - graphAreaPanel.getInsets().left -

    // graphAreaPanel.getInsets().right;
    logger.debug("Updating data " + this + "Width = " + width);
    graphs = new ArrayList<PlotData>();
    List<String> errorChannels = new ArrayList<String>();
    for (PlotDataProvider channel : plotDataProviders) {
      // lg.debug("processing channel: " + channel);
      PlotData data = null;
      try {
        data =
            channel.getPlotData(
                graphPanel.getTimeRange(),
                width,
                graphPanel.getFilter(),
                graphPanel.getRemoveGain(),
                graphPanel.getColorMode());
      } catch (TraceViewException e) {
        channel.setRotation(null);
        try {
          errorChannels.add(
              channel.getNetworkName()
                  + "/"
                  + channel.getStation()
                  + "/"
                  + channel.getLocationName()
                  + "/"
                  + channel.getChannelName()
                  + " - "
                  + e.getMessage());
          data =
              channel.getPlotData(
                  graphPanel.getTimeRange(),
                  width,
                  graphPanel.getFilter(),
                  graphPanel.getRemoveGain(),
                  graphPanel.getColorMode());
        } catch (TraceViewException | RemoveGainException e1) {
          // do nothing
          logger.error("TraceViewException:", e1);
        }
      } catch (RemoveGainException e) {
        try {
          errorChannels.add(
              channel.getNetworkName()
                  + "/"
                  + channel.getStation()
                  + "/"
                  + channel.getLocationName()
                  + "/"
                  + channel.getChannelName()
                  + " - "
                  + e.getMessage());
          data =
              channel.getPlotData(
                  graphPanel.getTimeRange(),
                  width,
                  graphPanel.getFilter(),
                  null,
                  graphPanel.getColorMode());
        } catch (TraceViewException | RemoveGainException e1) {
          // do nothing
          logger.error("TraceViewException:", e1);
        }
      }

      graphs.add(data);
      meanValue = data.getMeanValue();
    }

    Collections.sort(graphs);

    if (errorChannels.size() > 0) return errorChannels.get(0);
    else return "";
  }