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::linkUnspecifiedInputProperty(QVPropertyContainer *sourceContainer, QString sourcePropName, LinkType linkType)
00032 {
00033 QVWorker* worker;
00034 if((worker = dynamic_cast<QVWorker*>(sourceContainer)) != NULL)
00035 {
00036 int propType = worker->getPropertyType(sourcePropName);
00037
00038 if ( (propType != QVariant::Int) && (propType != QVariant::Double) ) {
00039 std::cerr << "Warning: a numericplot only can be linked to a int or double property." << std::endl;
00040 return false;
00041 }
00042 else
00043 return QVPlot::linkUnspecifiedInputProperty(worker, sourcePropName, linkType);
00044 }
00045 else
00046 return false;
00047 }
00048
00049 QStringList QVNumericPlot::getPropertyCurvNames(QString property) const
00050 {
00051 return (QStringList() << property);
00052 }
00053
00054 QList<double> QVNumericPlot::getPropertyCurvValues(QString property) const
00055 {
00056 int propType = getPropertyType(property);
00057
00058 QList<double> value;
00059 if (propType == QVariant::Int)
00060 value << getPropertyValue<int>(property);
00061 else if (propType == QVariant::Double)
00062 value << getPropertyValue<double>(property);
00063
00064 return value;
00065 }
00066
00067 QList<int> QVNumericPlot::getPropertyCurvOrders(QString) const
00068 {
00069 QList<int> order;
00070 return (order << 1);
00071 }
00072