Example #1
0
KstHistogram::KstHistogram(QDomElement &e)
: KstBaseCurve(e) {
  QString in_tag;
  KstVectorPtr in_V;
  QColor in_color("magenta");
  double xmax_in=1, xmin_in=-1;
  int in_n_bins = 10;
  KstHsNormType in_norm_mode;

  setHasPoints(false);
  setHasLines(true);

  in_norm_mode = KST_HS_NUMBER;
  /* parse the DOM tree */
  QDomNode n = e.firstChild();
  while( !n.isNull() ) {
    QDomElement e = n.toElement(); // try to convert the node to an element.
    if( !e.isNull() ) { // the node was really an element.
      if (e.tagName() == "tag") {
        in_tag = e.text();
      } else if (e.tagName() == "vectag") {
        KST::vectorList.lock().readLock();
        KstVectorList::Iterator it = KST::vectorList.findTag(e.text());
        if (it != KST::vectorList.end()) {
          in_V = *it;
        }
        KST::vectorList.lock().readUnlock();
      } else if (e.tagName() == "color") {
        in_color.setNamedColor(e.text());
      } else if (e.tagName() == "hasLines") {
	HasLines = (e.text() != "0");
      } else if (e.tagName() == "hasPoints") {
	HasPoints = (e.text() != "0");
      } else if (e.tagName() == "pointType") {
	Point.setType(e.text().toInt());
      } else if (e.tagName() == "NormMode") {
        if (e.text()=="NUMBER") in_norm_mode = KST_HS_NUMBER;
        else if (e.text()=="PERCENT") in_norm_mode = KST_HS_PERCENT;
        else if (e.text()=="FRACTION") in_norm_mode = KST_HS_FRACTION;
        else if (e.text()=="MAX_ONE") in_norm_mode = KST_HS_MAX_ONE;
      } else if (e.tagName() == "minX") {
        xmin_in = e.text().toDouble();
      } else if (e.tagName() == "maxX") {
        xmax_in = e.text().toDouble();
      } else if (e.tagName() == "numBins") {
        in_n_bins = e.text().toInt();
      }
    }
    n = n.nextSibling();
  }

  commonConstructor(in_tag, in_V, xmin_in, xmax_in, in_n_bins, in_norm_mode,
                    in_color);

}
Example #2
0
KstPSDCurve::KstPSDCurve(const QString &in_tag, KstVectorPtr in_V,
                         double in_freq, int in_len,
                         const QString &in_VUnits, const QString &in_RUnits,
                         const QColor &in_color)
: KstBaseCurve() {
  setHasPoints(false);
  setHasLines(true);

  commonConstructor(in_tag, in_V, in_freq, in_len,
                    in_VUnits, in_RUnits, in_color);
}
Example #3
0
KstPSDCurve::KstPSDCurve(QDomElement &e)
: KstBaseCurve(e) {
  QString in_tag;
  KstVectorPtr in_V;
  QColor in_color("blue");
  double in_freq=60.0;
  int in_len = 12;
  QString in_VUnits;
  QString in_RUnits;

  setHasPoints(false);
  setHasLines(true);

  /* parse the DOM tree */
  QDomNode n = e.firstChild();
  while( !n.isNull() ) {
    QDomElement e = n.toElement(); // try to convert the node to an element.
    if( !e.isNull() ) { // the node was really an element.
      if (e.tagName() == "tag") {
        in_tag = e.text();
      } else if (e.tagName() == "vectag") {
        KST::vectorList.lock().readLock();
        KstVectorList::Iterator it = KST::vectorList.findTag(e.text());
        if (it != KST::vectorList.end()) {
          in_V = *it;
        }
        KST::vectorList.lock().readUnlock();
      } else if (e.tagName() == "color") {
        in_color.setNamedColor(e.text());
      } else if (e.tagName() == "hasLines") {
	if (e.text() == "0") HasLines = false;
	else HasLines = true;
      } else if (e.tagName() == "hasPoints") {
	if (e.text() == "0") HasPoints = false;
	else HasPoints = true;
      } else if (e.tagName() == "pointType") {
	Point.setType(e.text().toInt());
      } else if (e.tagName() == "sampRate") {
        in_freq = e.text().toDouble();
      } else if (e.tagName() == "fftLen") {
        in_len = e.text().toInt();
      } else if (e.tagName() == "VUnits") {
        in_VUnits = e.text();
      } else if (e.tagName() == "RUnits") {
        in_RUnits = e.text();
      }
    }
    n = n.nextSibling();
  }

  commonConstructor(in_tag, in_V, in_freq, in_len,
                    in_VUnits, in_RUnits, in_color);
}
Example #4
0
KstVCurve::KstVCurve(const QString &in_tag, KstVectorPtr in_X, KstVectorPtr in_Y,
                     KstVectorPtr in_EX, KstVectorPtr in_EY,
                     const QColor &in_color)
    : KstBaseCurve() {
    setHasPoints(false);
    setHasLines(true);

    commonConstructor(in_tag, in_color);
    VX = in_X;
    VY = in_Y;
    EX = in_EX;
    EY = in_EY;
    update();
}
Example #5
0
KstVCurve::KstVCurve(QDomElement &e)
    : KstBaseCurve(e) {
    QString in_tag, xname, yname, exname, eyname;
    QColor in_color(KstColorSequence::next());

    setHasPoints(false);
    setHasLines(true);

    /* parse the DOM tree */
    QDomNode n = e.firstChild();
    while( !n.isNull() ) {
        QDomElement e = n.toElement(); // try to convert the node to an element.
        if( !e.isNull() ) { // the node was really an element.
            if (e.tagName() == "tag") {
                in_tag = e.text();
            } else if (e.tagName() == "xvectag") {
                xname = e.text();
            } else if (e.tagName() == "yvectag") {
                yname = e.text();
            } else if (e.tagName() == "exVectag") {
                exname = e.text();
            } else if (e.tagName() == "eyVectag") {
                eyname = e.text();
            } else if (e.tagName() == "color") {
                in_color.setNamedColor(e.text());
            } else if (e.tagName() == "hasLines") {
                HasLines = (e.text() != "0");
            } else if (e.tagName() == "hasPoints") {
                HasPoints = (e.text() != "0");
            } else if (e.tagName() == "pointType") {
                Point.setType(e.text().toInt());
            }
        }
        n = n.nextSibling();
    }

    _inputVectorLoadQueue.append(qMakePair(XVECTOR, xname));
    _inputVectorLoadQueue.append(qMakePair(YVECTOR, yname));
    _inputVectorLoadQueue.append(qMakePair(EXVECTOR, exname));
    _inputVectorLoadQueue.append(qMakePair(EYVECTOR, eyname));
    commonConstructor(in_tag, in_color);
}