Example #1
0
 public final String toString() {
   final String res =
       " start:"
           + DebriefFormatDateTime.toStringHiRes(_start)
           + " end:"
           + DebriefFormatDateTime.toStringHiRes(_end);
   return res;
 }
Example #2
0
  public final GUIHandler.ComponentDetails exportThis(final Debrief.GUI.Frames.Session session) {
    // get the stepper
    final Debrief.GUI.Views.PlainView pv = session.getCurrentView();
    if (pv instanceof Debrief.GUI.Views.AnalysisView) {
      final Debrief.GUI.Tote.StepControl stepper =
          ((Debrief.GUI.Views.AnalysisView) pv).getTote().getStepper();

      // collate the details for this component
      final GUIHandler.ComponentDetails details = new GUIHandler.ComponentDetails();

      final MWC.GUI.StepperListener theStepper = stepper.getCurrentPainter();

      // is this the snail painter?
      if (theStepper instanceof SnailPainter) {
        final SnailPainter sp = (SnailPainter) theStepper;
        details.addProperty("VectorStretch", MWCXMLReader.writeThis(sp.getVectorStretch()));
      }

      details.addProperty("Cursor", stepper.getCurrentPainter().toString());

      //      details.addProperty("StepLarge", MWCXMLReader.writeThis(stepper.getStepLarge()));
      //      details.addProperty("StepSmall", MWCXMLReader.writeThis(stepper.getStepSmall()));

      // ok, we're switching to exporting the step size in microseconds
      // if we ever get the plain "StepLarge" parameter - we will assume it is millis, else
      // we will always receive the units

      details.addProperty("StepLargeMicros", MWCXMLReader.writeThis(stepper.getStepLarge()));
      details.addProperty("StepSmallMicros", MWCXMLReader.writeThis(stepper.getStepSmall()));

      details.addProperty("AutoStep", MWCXMLReader.writeThis(stepper.getAutoStep()));
      details.addProperty("DateFormat", stepper.getDateFormat());
      // the current DTG
      final HiResDate cTime = stepper.getCurrentTime();
      if (cTime != null) details.addProperty("CurrentTime", MWCXMLReader.writeThis(cTime));
      // the T-zero, if set
      if (stepper.getTimeZero() != null)
        details.addProperty("TimeZero", MWCXMLReader.writeThis(stepper.getTimeZero()));
      details.addProperty("Highlighter", stepper.getCurrentHighlighter().getName());
      // what's the time?
      final HiResDate theStartTime = stepper.getToolboxStartTime();
      if (theStartTime != null)
        details.addProperty(
            "Toolbox_Start_Time", DebriefFormatDateTime.toStringHiRes(theStartTime));
      final HiResDate theEndTime = stepper.getToolboxEndTime();
      if (theEndTime != null)
        details.addProperty("Toolbox_End_Time", DebriefFormatDateTime.toStringHiRes(theEndTime));

      return details;
    } else return null;
  }
  /**
   * over-ridden method, where we write out our data
   *
   * @param theData the data to plot
   * @param out the stream to write to
   * @throws java.io.IOException file-related troubles
   */
  protected final void plotData(MWC.GUI.Layers theData, java.io.BufferedWriter out)
      throws java.io.IOException {

    java.text.DateFormat df = new java.text.SimpleDateFormat("ddHHmm");
    df.setTimeZone(TimeZone.getTimeZone("GMT"));

    // work through the layers
    int num = _theData.size();
    for (int i = 0; i < num; i++) {
      Layer l = (Layer) _theData.elementAt(i);
      Enumeration<Editable> iter = l.elements();
      while (iter.hasMoreElements()) {
        Object oj = iter.nextElement();
        if (oj instanceof Debrief.Wrappers.FixWrapper) {
          Debrief.Wrappers.FixWrapper fw = (Debrief.Wrappers.FixWrapper) oj;
          WorldLocation pos = fw.getLocation();

          if (fw.getSymbolShowing()) {
            String lbl = fw.getName();
            writeBox(out, pos.getLong(), pos.getLat(), pos.getDepth(), fw.getColor(), lbl);
          }

          if (fw.getLabelShowing()) {
            String str = DebriefFormatDateTime.toStringHiRes(fw.getTime());
            writeText(out, pos.getLong(), pos.getLat(), pos.getDepth(), str, fw.getColor());
          }
        }
      }
    }

    // now draw the line connectors
    num = _theData.size();
    for (int i = 0; i < num; i++) {
      Layer l = (Layer) _theData.elementAt(i);
      Enumeration<Editable> iter = l.elements();
      int len = 0;
      while (iter.hasMoreElements()) {
        Object oj = iter.nextElement();

        if (oj instanceof MWC.GenericData.WatchableList) {
          // just check that we haven't got any dangling Fix lines
          // waiting to be finished
          if (len > 0) {
            // we have clearly written some fixes to the file, write the footer
            writeLineFooter(out, len);
            len = 0;
          }

          MWC.GenericData.WatchableList tw = (MWC.GenericData.WatchableList) oj;
          java.awt.Color col = tw.getColor();
          writeLineHeader(out, col);
        }

        if (oj instanceof Debrief.Wrappers.FixWrapper) {
          len++;
          Debrief.Wrappers.FixWrapper fw = (Debrief.Wrappers.FixWrapper) oj;
          WorldLocation pos = fw.getLocation();

          writeLineEntry(out, pos.getLong(), pos.getLat(), pos.getDepth());
        }
      }

      if (len > 0) {
        // we have clearly written some fixes to the file, write the footer
        writeLineFooter(out, len);
      }
    }
  }