+/*
+ <name>Lines</name>
+ <description>Lines from top to bottom</description>
+ <author>Marco Gittler</author>
+ <properties tag="lines" id="lines" />
+ <parameter default="5" type="constant" value="5" min="0" name="num" max="255" >
+ <name>Num</name>
+ </parameter>
+ <parameter default="4" type="constant" value="4" min="0" name="width" max="255" >
+ <name>Width</name>
+ </parameter>
+ </effect>
+
+*/
+void ParameterPlotter::setPointLists(const QDomElement& d, const QString& paramName, int startframe, int endframe) {
+
+ //QListIterator <QPair <QString, QMap< int , QVariant > > > nameit(params);
+ m_paramName = paramName;
+ itemParameter = d;
+ QDomNodeList namenode = d.elementsByTagName("parameter");
+
+ max_y = 0;
+ min_y = 0;
+ removeAllPlotObjects();
+ stretchFactors.clear();
+ parameterNameList.clear();
+ plotobjects.clear();
+
+ QString dat;
+ QTextStream stre(&dat);
+ d.save(stre, 2);
+ kDebug() << dat;
+ int i = 0;
+ while (!namenode.item(i).isNull() && namenode.item(i).toElement().attribute("name") != m_paramName)
+ i++;
+ if (namenode.count()) {
+
+
+ QDomElement pa = namenode.item(i).toElement();
+ QDomNode na = pa.firstChildElement("name");
+
+ parameterNameList << pa.attribute("namedesc").split(";");
+ emit parameterList(parameterNameList);
+
+ //max_y=pa.attributes().namedItem("max").nodeValue().toInt();
+ //int val=pa.attributes().namedItem("value").nodeValue().toInt();
+ QStringList defaults;
+ if (pa.attribute("start").contains(";"))
+ defaults = pa.attribute("start").split(";");
+ else if (pa.attribute("value").contains(";"))
+ defaults = pa.attribute("value").split(";");
+ else if (pa.attribute("default").contains(";"))
+ defaults = pa.attribute("default").split(";");
+ QStringList maxv = pa.attribute("max").split(";");
+ QStringList minv = pa.attribute("min").split(";");
+ for (int i = 0;i < maxv.size() && i < minv.size();i++) {
+ if (max_y < maxv[i].toInt()) max_y = maxv[i].toInt();
+ if (min_y > minv[i].toInt()) min_y = minv[i].toInt();
+ }
+ for (int i = 0;i < parameterNameList.count();i++) {
+ KPlotObject *plot = new KPlotObject(colors[plotobjects.size()%colors.size()]);
+ plot->setShowLines(true);
+ if (!stretchFactors.contains(i) && i < maxv.size()) {
+ if (maxv[i].toInt() != 0)
+ stretchFactors[i] = max_y / maxv[i].toInt();
+ else
+ stretchFactors[i] = 1.0;
+ }
+ if (i < defaults.size() && defaults[i].toDouble() > max_y)
+ defaults[i] = max_y;
+ int def = 0;
+ if (i < defaults.size())
+ def = (int)(defaults[i].toInt() * stretchFactors[i]);
+ QString name = "";
+ if (i < parameterNameList.size())
+ name = parameterNameList[i];
+ plot->addPoint(startframe, def, name);
+ //add keyframes here
+ plot->addPoint(endframe, def);
+
+ plotobjects.append(plot);
+ }
+
+ /*TODO keyframes
+ while (pointit.hasNext()){
+ pointit.next();
+ plot->addPoint(QPointF(pointit.key(),pointit.value().toDouble()),item.first,1);
+ if (pointit.value().toInt() >maxy)
+ max_y=pointit.value().toInt();
+ }*/
+
+ }
+ maxx = endframe;
+ maxy = max_y;
+ setLimits(-1, endframe + 1, min_y - 10, maxy + 10);
+
+ addPlotObjects(plotobjects);