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 QVNumericPlot::QVNumericPlot(const QString name, bool time, int step, QWidget *parent): QVPlot(name, true, false, false, true, time, step, parent)
00029 { }
00030
00031 bool QVNumericPlot::linkProperty(QVWorker &worker, const QString propertyName)
00032 {
00033 int propType = worker.getPropertyType(propertyName);
00034
00035 if ( (propType != QVariant::Int) && (propType != QVariant::Double) ) {
00036 std::cerr << "Warning: a numericplot only can be linked to a int or double property." << std::endl;
00037 return false;
00038 }
00039 else
00040 return QVPlot::linkProperty(worker, propertyName);
00041 }
00042
00043 void QVNumericPlot::linkProperty(QVWorker &worker)
00044 {
00045 QStringList inputProper = worker.getPropertyListByType<int>() + worker.getPropertyListByType<double>();
00046 for (int i = 0; i < inputProper.size(); i++)
00047 if (worker.isOutput(inputProper[i]))
00048 linkProperty(worker, inputProper[i]);
00049 }
00050
00051 QStringList QVNumericPlot::getPropertyCurvNames(QString property) const
00052 {
00053 return (QStringList() << property);
00054 }
00055
00056 QList<double> QVNumericPlot::getPropertyCurvValues(QString property) const
00057 {
00058 int propType = getPropertyType(property);
00059
00060 QList<double> value;
00061 if (propType == QVariant::Int)
00062 value << getPropertyValue<int>(property);
00063 else if (propType == QVariant::Double)
00064 value << getPropertyValue<double>(property);
00065
00066 return value;
00067 }
00068
00069 QList<int> QVNumericPlot::getPropertyCurvOrders(QString property) const
00070 {
00071 QList<int> order;
00072 return (order << 1);
00073 }
00074