示例#1
0
  private static MeasurementInfo parseMeasurement(Node parent) throws XmlParserException {
    String id = "";
    String label = "";
    String sampleid = "";
    Vector<FileInfo> files = null;
    Vector<ScanInfo> scans = null;

    NodeList nodes = parent.getChildNodes();
    for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) {
      Node node = nodes.item(nodeid);
      if (node.getNodeType() != Node.ELEMENT_NODE) continue;

      Element element = (Element) node;
      if (element.getTagName().equals("id")) id = element.getTextContent();
      else if (element.getTagName().equals("label")) label = element.getTextContent();
      else if (element.getTagName().equals("sampleid")) sampleid = element.getTextContent();
      else if (element.getTagName().equals("scans")) scans = parseScans(node);
      else if (element.getTagName().equals("files")) files = parseFiles(node);
    }

    MeasurementInfo measurement = new MeasurementInfo(Integer.parseInt(id), sampleid);
    measurement.setLabel(label);
    measurement.addFileInfos(files);
    if (scans != null) measurement.addScanInfos(scans);

    return measurement;
  }
示例#2
0
  /**
   * Calculates the drop point for the cursor under the given coordinate.
   *
   * @param aCoordinate the coordinate to return the channel drop point for, cannot be <code>null
   *     </code>.
   * @return a drop point, never <code>null</code>.
   */
  private Point getCursorDropPoint(final Point aCoordinate) {
    Point dropPoint = new Point(aCoordinate);

    if (getModel().isSnapCursorMode()) {
      final MeasurementInfo signalHover = getModel().getSignalHover(aCoordinate);
      if ((signalHover != null) && !signalHover.isEmpty()) {
        dropPoint.x = signalHover.getMidSamplePos().intValue();
      }
    }
    dropPoint.y = 0;

    return dropPoint;
  }