Пример #1
0
 /**
  * gets label on x-axis.
  *
  * @return String
  */
 @Override
 public String getXAxisLabel() {
   if (xData != null) {
     return xData.getLabel();
   } else {
     return "";
   }
 }
Пример #2
0
  /**
   * cloning.
   *
   * @return java.lang.Object
   */
  @Override
  public Object clone() {
    Spectrum1D spectrum = null;
    spectrum = (Spectrum1D) super.clone();
    spectrum.setData((IOrderedDataArray1D) xData.clone(), (IDataArray1D) yData.clone());
    spectrum.copyPeakTable(this.peakTable);
    spectrum.copyPatternTable(this.patternTable);
    spectrum.copyAssignments(this.assignments);

    return spectrum;
  }
Пример #3
0
 /** adjusts full view to a pretty range. */
 protected void adjustFullViewRange() {
   double w;
   if (isFullSpectrum()) {
     Range1D.Double xrange = xData.getRange1D();
     w = xrange.getXWidth();
     xrange.set(xrange.getXMin() - .05 * w, xrange.getXMax() + .05 * w);
     setXFullViewRange(xrange);
     Range1D.Double yrange = yData.getRange1D();
     w = yrange.getXWidth();
     yrange.set(yrange.getXMin() - .05 * w, yrange.getXMax() + .05 * w);
     setYFullViewRange(yrange);
   } else {
     /* include 0.0 in y-range and add 5% on to all borders */
     int n = xData.getLength();
     if (n > 1) {
       Range1D.Double xrange = xData.getRange1D();
       w = xrange.getXWidth();
       xrange.set(xrange.getXMin() - .05 * w, xrange.getXMax() + .05 * w);
       setXFullViewRange(xrange);
     } else if (n == 1) {
       double x = xData.pointAt(0);
       setXFullViewRange(new Range1D.Double(x - 50, x + 50));
     } else {
       setXFullViewRange(new Range1D.Double(0., 300.));
     }
     if (n > 1) {
       Range1D.Double yrange = yData.getRange1D();
       yrange.set(Math.min(yrange.getXMin(), 0.0), Math.max(yrange.getXMax(), 0.0));
       w = yrange.getXWidth();
       if (yrange.getXMin() == 0.0) {
         yrange.set(yrange.getXMin(), yrange.getXMax() + .05 * w);
       } else {
         yrange.set(yrange.getXMin() - .05 * w, yrange.getXMax());
       }
       setYFullViewRange(yrange);
     } else {
       setYFullViewRange(new Range1D.Double(0., 100.));
     }
   }
 }
Пример #4
0
 /**
  * translate x values by <code>amount</code> together with all associated data e.g. for
  * calibration
  *
  * @param amount double
  */
 public void translate(double amount) {
   double[] tvec = new double[2];
   tvec[0] = amount;
   tvec[1] = 0.0;
   xData.translate(amount);
   if (peakTable != null) {
     for (int i = 0; i < peakTable.length; i++) {
       peakTable[i].translate(tvec);
     }
   }
   if (patternTable != null) {
     for (int i = 0; i < patternTable.length; i++) {
       patternTable[i].translate(tvec);
     }
   }
   if (assignments != null) {
     for (int i = 0; i < assignments.length; i++) {
       assignments[i].translate(tvec);
     }
   }
   adjustFullViewRange();
 }