/usr/include/analitzaplot/plotter3d.h is in libanalitza-dev 4:4.14.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /*************************************************************************************
* Copyright (C) 2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> *
* Copyright (C) 2007 by Abderrahman Taha: Basic OpenGL calls like scene, lights *
* and mouse behaviour taken from K3DSurf *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#ifndef PLOTTER3D_H
#define PLOTTER3D_H
#include "plotitem.h"
#include <QModelIndex>
#include <QRect>
#include <QVector3D>
#include <QMatrix4x4>
#define GL_GLEXT_PROTOTYPES
#ifdef Q_OS_WIN
#include <windows.h>
#include <GL/glew.h>
#endif
#include <GL/glu.h>
class QAbstractItemModel;
class QPainter;
class QPaintDevice;
class QModelIndex;
namespace Analitza
{
/**
* \class Plotter3D
*
* \ingroup AnalitzaPlotModule
*
* \brief This class manage the OpenGL scene where the plots will be rendered.
*
* Plotter3D provides an agnostic way to manage a 3d scene for draw math plots,
* Contains just OpenGL calls, so is uncoupled with QWidget nor QtQuick. This
* class needs the PlotsModel (to create the geometry for 3D plots) and also
* exposes some methods to change the scene (like hide/show the axis or
* reference planes for example)
*/
class ANALITZAPLOT_EXPORT Plotter3D
{
public:
static const GLubyte XAxisArrowColor[];
static const GLubyte YAxisArrowColor[];
static const GLubyte ZAxisArrowColor[];
//TODO transparency effect when select current item
// enum FocusEffect {};
Plotter3D(QAbstractItemModel* model = 0);
virtual ~Plotter3D();
virtual void initGL();
virtual void setViewport(const QRectF &vp);
virtual void drawPlots();
virtual int currentPlot() const = 0;
virtual void modelChanged() = 0;
/** Force OpenGL to render the scene. QGLWidget should call updateGL in this method. */
virtual void renderGL() = 0;
/** Force the plots from @p start to @p end to be recalculated. */
void updatePlots(const QModelIndex & parent, int start, int end);
void setModel(QAbstractItemModel* f);
QAbstractItemModel* model() const { return m_model; }
PlotStyle plotStyle() const { return m_plotStyle; }
void setPlotStyle(PlotStyle ps) { m_plotStyle = ps; }
// void setPlottingAttributes(PlotStyle st) { m_plotStyle = ps; }
PlottingFocusPolicy plottingFocusPolicy() const { return m_plottingFocusPolicy; }
void setPlottingFocusPolicy(PlottingFocusPolicy fp);
/** Set the scale of all the scene by @p factor */
void scale(GLdouble factor);
// Advanced rotation features
/** Rotates by @p dx and @p dy in screen coordinates. */
void rotate(int dx, int dy);
/** Query if there is a valid axis arrow for @p x and @p y screen coordinates. */
CartesianAxis selectAxisArrow(int x, int y);
/** Fix the rotation arround @p direction */
void fixRotation(const QVector3D &direction);
/** Query if the rotation is fixed by a specific direction. */
bool isRotationFixed() const { return !m_rotFixed.isNull(); }
//TODO set gridstyle, setshowrefbox
/** Show a little indicator (as a hint) next to the arrow of @p axis */
void showAxisArrowHint(CartesianAxis axis);
/** Hide the current indicator of the axis */
void hideAxisHint();
/** Set the color of the grids of the reference plane in the 3D view */
void setReferencePlaneColor(const QColor &color);
/** If the flag @p simplerot is true the rotation ignores any fixed or free direction */
void setUseSimpleRotation(bool simplerot) { m_simpleRotation = simplerot; }
/** Get information about the current rotarion approach: if return true then rotation is simple. */
bool isUsingSimpleRotation() const { return m_simpleRotation; }
/** sets the view to the initial perspective */
void resetView();
protected:
void addPlots(PlotItem* item);
private:
void resetViewPrivate(const QVector3D& rot);
enum SceneObjectType {Axes, RefPlaneXY, XArrowAxisHint, YArrowAxisHint, ZArrowAxisHint};
PlotItem *itemAt(int row) const;
void initAxes();
void initRefPlanes();
QAbstractItemModel* m_model;
QMap<PlotItem*, QPair<GLuint, GLuint> > m_itemGeometries; // pair:=<indexdata_id, vertex-normals_id>
PlotStyle m_plotStyle;
PlottingFocusPolicy m_plottingFocusPolicy;
//scene properties
QMap<SceneObjectType, GLuint > m_sceneObjects;
QRectF m_viewport;
const GLfloat m_depth;
GLdouble m_scale;
QMatrix4x4 m_rot;
QVector3D m_rotFixed;
CartesianAxis m_currentAxisIndicator;
bool m_simpleRotation;
QVector3D m_simpleRotationVector;
QVector3D m_lightpos;
QColor m_referencePlaneColor;
};
}
#endif // PLOTTER3D_H
|