File indexing completed on 2024-04-21 14:43:53

0001 /*************************************************************************************
0002  *  Copyright (C) 2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com>      *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 
0020 #ifndef FUNCTIONEDITOR_H_builder
0021 #define FUNCTIONEDITOR_H_builder
0022 
0023 //Analitza includes
0024 #include "analitza/expression.h"
0025 
0026 //Qt includes
0027 #include <QWidget>
0028 
0029 namespace Ui
0030 {
0031     class PlotsBuilderWidget;
0032 }
0033 
0034 
0035 //TODO ANALITZAPLOT
0036 // typename deberia devolver una lista de cadenas no una cadena: Superfices, SuperficesEsfericas ... etc en vez de solo SurfaEs
0037 //...de esta manera se forma un arbol de categorias, de tipos de plots que la libreria puede dibujar
0038 class PlotsBuilder : public QWidget
0039 {
0040     Q_OBJECT
0041 public:
0042     //NOTE AvailablePlots ... more to come .. in the future
0043     enum PlotType
0044     {
0045         //2D
0046         CartesianGraphCurve = 0x1,
0047         CartesianImplicitCurve = 0x2,
0048         CartesianParametricCurve2D = 0x4,
0049         PolarGraphCurve = 0x8,
0050         //3D
0051         CartesianParametricCurve3D = 0x10,
0052         CartesianGraphSurface = 0x20,
0053         CartesianImplicitSurface = 0x40,
0054         CartesianParametricSurface = 0x80,
0055         CylindricalGraphSurface = 0x100,
0056         SphericalGraphSurface = 0x200,
0057         None = 0x0
0058         //profiles
0059     };
0060     
0061     Q_DECLARE_FLAGS(PlotTypes, PlotType)
0062     
0063 
0064     explicit PlotsBuilder(QWidget *parent);
0065     ~ PlotsBuilder() override;
0066 
0067     void setupTypes(PlotTypes t);
0068     PlotTypes types() const { return m_types; }
0069     void mapConnection(PlotType pt, QObject *recvr, const char * slot);
0070     
0071 public slots:
0072     void showAllTypes(); // show all types
0073     void hideAllTypes(); // hide all types
0074     
0075 private:
0076     void setupTypes();
0077     bool eventFilter(QObject *object, QEvent *event) override;
0078     Ui::PlotsBuilderWidget *m_widget;
0079     PlotTypes m_types;
0080     Analitza::Expression m_example;
0081     PlotType m_currentTyppe;
0082 };
0083 
0084 Q_DECLARE_OPERATORS_FOR_FLAGS(PlotsBuilder::PlotTypes)
0085 
0086 #endif