File indexing completed on 2024-03-24 15:13:32

0001 /*************************************************************************************
0002  *  Copyright (C) 2007-2011 by Aleix Pol <aleixpol@kde.org>                          *
0003  *  Copyright (C) 2010-2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> *
0004  *                                                                                   *
0005  *  This program is free software; you can redistribute it and/or                    *
0006  *  modify it under the terms of the GNU General Public License                      *
0007  *  as published by the Free Software Foundation; either version 2                   *
0008  *  of the License, or (at your option) any later version.                           *
0009  *                                                                                   *
0010  *  This program is distributed in the hope that it will be useful,                  *
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0013  *  GNU General Public License for more details.                                     *
0014  *                                                                                   *
0015  *  You should have received a copy of the GNU General Public License                *
0016  *  along with this program; if not, write to the Free Software                      *
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0018  *************************************************************************************/
0019 
0020 #ifndef ANALITZAPLOT_PLOTITEM_H
0021 #define ANALITZAPLOT_PLOTITEM_H
0022 
0023 #include <QStringList>
0024 #include <QSet>
0025 #include <QColor>
0026 #include <QVariant>
0027 
0028 #include "analitzaplotexport.h"
0029 #include "plottingenums.h"
0030 
0031 namespace Analitza {
0032 class Variables;
0033 class Expression;
0034 class PlotsModel;
0035 
0036 /**
0037  * \class PlotItem
0038  * 
0039  * \ingroup AnalitzaPlotModule
0040  *
0041  * \brief Represents a visual item.
0042  *
0043  * This class containes common properties of any plot object.
0044  */
0045 
0046 class ANALITZAPLOT_EXPORT PlotItem 
0047 {
0048 friend class PlotsModel;
0049 public:
0050     PlotItem(const QString &name, const QColor& col);
0051     virtual ~PlotItem();
0052 
0053     virtual const Analitza::Expression & expression() const = 0;
0054     virtual QString display() const = 0;
0055     virtual Analitza::Variables * variables() const = 0;
0056     virtual QString typeName() const = 0;
0057     virtual QString iconName() const = 0;
0058     virtual Dimension spaceDimension() const = 0; // dim of the space where the item can be drawn ... IS NOT the variety dimension
0059     virtual CoordinateSystem coordinateSystem() const = 0;
0060     
0061     QString name() const { return m_name; }
0062     void setName(const QString &newName);
0063     QColor color() const { return m_color; }
0064     void setColor(const QColor& newColor);
0065 
0066     bool isVisible() const { return m_graphVisible; }
0067     void setVisible(bool v);
0068 
0069     void clearTags();
0070     void addTags(const QSet<QString>& tag);
0071     QSet<QString> tags() const;
0072 
0073 protected:
0074     void setModel(PlotsModel *m);
0075     void emitDataChanged();
0076 
0077 private:
0078     QString m_name;
0079     QColor m_color;
0080     bool m_graphVisible;
0081     QSet<QString> m_tags;
0082     
0083     PlotsModel *m_model;
0084 };
0085 
0086 }
0087 
0088 Q_DECLARE_METATYPE(Analitza::PlotItem*)
0089 
0090 #endif // ANALITZAPLOT_PLOTITEM_H