File indexing completed on 2024-04-21 07:26:28

0001 /*************************************************************************************
0002  *  Copyright (C) 2007-2009 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_ABSTRACTPLANECURVE_H
0021 #define ANALITZAPLOT_ABSTRACTPLANECURVE_H
0022 
0023 #include "abstractfunctiongraph.h"
0024 #include <QLineF>
0025 
0026 #define CONSTRUCTORS(name) \
0027 name (const Analitza::Expression &functionExpression, const QSharedPointer<Analitza::Variables>& variables) :AbstractPlaneCurve(functionExpression, variables) { }
0028 
0029 namespace Analitza {
0030 class Variables;
0031 
0032 class AbstractPlaneCurve : public AbstractFunctionGraph 
0033 {
0034 public:
0035     explicit AbstractPlaneCurve(const Analitza::Expression& e, const QSharedPointer<Analitza::Variables>& v = {});
0036     ~AbstractPlaneCurve() override;
0037 
0038     QVector<QPointF> points;
0039     QVector<int> jumps;
0040     
0041     virtual void update(const QRectF& viewport) = 0;
0042     virtual QPair<QPointF, QString> image(const QPointF &mousepos) = 0;
0043     virtual QLineF tangent(const QPointF &mousepos) = 0;
0044 
0045 protected:
0046     bool addPoint(const QPointF& p);
0047 };
0048 
0049 }
0050 
0051 #endif // ANALITZAPLOT_ABSTRACTPLANECURVE_H