Esempio n. 1
0
void CUS::createPlot (QString &d, QDict<PlotLine> &lines, Indicator *output)
{
  if (! d.contains("plot"))
    return;

  QStringList l = QStringList::split("(", d, FALSE);
  if (l.count() != 2)
  {
    qDebug("CUS::createPlot: bad plot format: %s", d.ascii());
    return;
  }

  QString parms = l[1];
  parms.truncate(parms.find(")", -1, TRUE));
  l = QStringList::split(",", parms, FALSE);
  if (l.count() != 4)
  {
    qDebug("CUS::createPlot: missing plot parms: %s",d.ascii());
    return;
  }

  // 1.var name
  l[0] = l[0].stripWhiteSpace();
  PlotLine *pl = lines.find(l[0]);
  if (! pl)
  {
    qDebug("CUS::createPlot: bad plot parm 1: %s",d.ascii());
    return;
  }

  // 2.color
  l[1] = l[1].stripWhiteSpace();
  pl->setColor(l[1]);

  // 3.label
  l[2] = l[2].stripWhiteSpace();
  pl->setLabel(l[2]);

  // 4.linetype
  l[3] = l[3].stripWhiteSpace();
  pl->setType(l[3]);

  PlotLine *tline = new PlotLine;
  tline->copy(pl);
  output->addLine(tline);
}
Esempio n. 2
0
PlotLine * PP::calculateCustom (QString &p, QPtrList<PlotLine> &d)
{
  // format1: PP_TYPE
  if (checkFormat(p, d, 1, 1))
    return 0;

  int t = ppList.findIndex(formatStringList[0]);
  if (t == -1)
  {
    qDebug("PP::calculateCustom: invalid PP_TYPE parm");
    return 0;
  }

  QPtrList<PlotLine> pll;
  pll.setAutoDelete(TRUE);
  getPP(pll);

  PlotLine *line = new PlotLine;
  PlotLine *tline = pll.at(t);
  line->copy(tline);

  return line;
}