PARP Research Group University of Murcia, Spain


src/qvgui/qvnumericplot.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007, 2008, 2009. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
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                 if (not (       sourceContainer->isType<int>(sourcePropName)    ||
00038                                 sourceContainer->isType<double>(sourcePropName) ||
00039                                 sourceContainer->isType<uChar>(sourcePropName)
00040                         ))
00041                 //if ( (propType != QVariant::Int) && (propType != QVariant::Double) )
00042                         {
00043                         std::cerr << "Warning: a numericplot only can be linked to a int or double property." << std::endl;
00044                         return false;
00045                         }
00046                 else
00047                         return QVPlot::linkUnspecifiedInputProperty(worker, sourcePropName, linkType);
00048                 }
00049         else
00050                 return false;
00051         }
00052 
00053 QStringList QVNumericPlot::getPropertyCurvNames(QString property) const
00054         {
00055         return (QStringList() << property);
00056         }
00057 
00058 QList<double> QVNumericPlot::getPropertyCurvValues(QString property) const
00059         {
00060         //int propType = getPropertyType(property);
00061 
00062         QList<double> value;
00063         if (isType<int>(property))
00064         //if (propType == QVariant::Int)
00065                 value << getPropertyValue<int>(property);
00066         else if (isType<double>(property))
00067         //else if (propType == QVariant::Double)
00068                 value << getPropertyValue<double>(property);
00069         else if (isType<uChar>(property))
00070                 value << getPropertyValue<uChar>(property);
00071 
00072         return value;
00073         }
00074 
00075 QList<int> QVNumericPlot::getPropertyCurvOrders(QString) const
00076         {
00077         QList<int> order;
00078         return (order << 1);
00079         }
00080 



QVision framework. PARP research group, copyright 2007, 2008.