00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #include <iostream>
00026 #include <qvgui/qvnumericplot.h>
00027
00028
00029 QVNumericPlot::QVNumericPlot(const QString name, bool time, int step, QWidget *parent): QVPlot(name, true, false, false, true, time, step, parent)
00030 { }
00031
00032 void QVNumericPlot::linkProperty(QVWorker &worker, const QString propertyName)
00033 {
00034 int propType = worker.getPropertyType(propertyName);
00035
00036 if ( (propType != QVariant::Int) && (propType != QVariant::Double) )
00037 std::cerr << "Warning: a numericplot only can be linked to a int or double property." << std::endl;
00038 else
00039 QVPlot::linkProperty(worker, propertyName);
00040 }
00041
00042 void QVNumericPlot::linkProperty(QVWorker &worker)
00043 {
00044 QStringList inputProper = worker.getPropertyListByType<int>() + worker.getPropertyListByType<double>();
00045 for (int i = 0; i < inputProper.size(); i++)
00046 if (worker.isOutput(inputProper[i]))
00047 linkProperty(worker, inputProper[i]);
00048 }
00049
00050 QStringList QVNumericPlot::getPropertyCurvNames(QString property) const
00051 {
00052 return (QStringList() << property);
00053 }
00054
00055 QList<double> QVNumericPlot::getPropertyCurvValues(QString property) const
00056 {
00057 int propType = getPropertyType(property);
00058
00059 QList<double> value;
00060 if (propType == QVariant::Int)
00061 value << getPropertyValue<int>(property);
00062 else if (propType == QVariant::Double)
00063 value << getPropertyValue<double>(property);
00064
00065 return value;
00066 }
00067
00068 QList<int> QVNumericPlot::getPropertyCurvOrders(QString property) const
00069 {
00070 QList<int> order;
00071 return (order << 1);
00072 }
00073