• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • sources
  • kde-4.12
  • kdeedu
  • analitza
  • analitzaplot
plotter3d.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> *
3  * Copyright (C) 2007 by Abderrahman Taha: Basic OpenGL calls like scene, lights *
4  * and mouse behaviour taken from K3DSurf *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License *
8  * as published by the Free Software Foundation; either version 2 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the Free Software *
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
19  *************************************************************************************/
20 
21 #ifndef PLOTTER3D_H
22 #define PLOTTER3D_H
23 
24 #include "plotitem.h"
25 
26 #include <QModelIndex>
27 #include <QRect>
28 #include <QVector3D>
29 #include <QMatrix4x4>
30 
31 #define GL_GLEXT_PROTOTYPES
32 #ifdef Q_OS_WIN
33 #include <windows.h>
34 #include <GL/glew.h>
35 #endif
36 
37 #include <GL/glu.h>
38 
39 class QAbstractItemModel;
40 class QPainter;
41 class QPaintDevice;
42 class QModelIndex;
43 
44 namespace Analitza
45 {
46 
61 class ANALITZAPLOT_EXPORT Plotter3D
62 {
63  public:
64  static const GLubyte XAxisArrowColor[];
65  static const GLubyte YAxisArrowColor[];
66  static const GLubyte ZAxisArrowColor[];
67 
68  //TODO transparency effect when select current item
69 // enum FocusEffect {};
70 
71  Plotter3D(QAbstractItemModel* model = 0);
72  virtual ~Plotter3D();
73 
74  virtual void initGL();
75  virtual void setViewport(const QRectF &vp);
76  virtual void drawPlots();
77  virtual int currentPlot() const = 0;
78  virtual void modelChanged() = 0;
79 
81  virtual void renderGL() = 0;
82 
84  void updatePlots(const QModelIndex & parent, int start, int end);
85 
86  void setModel(QAbstractItemModel* f);
87  QAbstractItemModel* model() const { return m_model; }
88 
89  PlotStyle plotStyle() const { return m_plotStyle; }
90  void setPlotStyle(PlotStyle ps) { m_plotStyle = ps; }
91 // void setPlottingAttributes(PlotStyle st) { m_plotStyle = ps; }
92  PlottingFocusPolicy plottingFocusPolicy() const { return m_plottingFocusPolicy; }
93  void setPlottingFocusPolicy(PlottingFocusPolicy fp);
94 
96  void scale(GLdouble factor);
97 
98  // Advanced rotation features
99 
101  void rotate(int dx, int dy);
102 
104  CartesianAxis selectAxisArrow(int x, int y);
105 
107  void fixRotation(const QVector3D &direction);
108 
110  bool isRotationFixed() const { return !m_rotFixed.isNull(); }
111 
113  void showAxisArrowHint(CartesianAxis axis);
114 
116  void hideAxisHint();
117 
119  void setReferencePlaneColor(const QColor &color);
120 
122  void setUseSimpleRotation(bool simplerot) { m_simpleRotation = simplerot; }
123 
125  bool isUsingSimpleRotation() const { return m_simpleRotation; }
126 
128  void resetView();
129 
130  protected:
131  void addPlots(PlotItem* item);
132 
133  private:
134  void resetViewPrivate(const QVector3D& rot);
135 
136  enum SceneObjectType {Axes, RefPlaneXY, XArrowAxisHint, YArrowAxisHint, ZArrowAxisHint};
137 
138  PlotItem *itemAt(int row) const;
139 
140  void initAxes();
141  void initRefPlanes();
142 
143  QAbstractItemModel* m_model;
144 
145  QMap<PlotItem*, QPair<GLuint, GLuint> > m_itemGeometries; // pair:=<indexdata_id, vertex-normals_id>
146 
147  PlotStyle m_plotStyle;
148  PlottingFocusPolicy m_plottingFocusPolicy;
149 
150  //scene properties
151  QMap<SceneObjectType, GLuint > m_sceneObjects;
152  QRectF m_viewport;
153  const GLfloat m_depth;
154  GLdouble m_scale;
155  QMatrix4x4 m_rot;
156  QVector3D m_rotFixed;
157  CartesianAxis m_currentAxisIndicator;
158  bool m_simpleRotation;
159  QVector3D m_simpleRotationVector;
160  QVector3D m_lightpos;
161  QColor m_referencePlaneColor;
162 };
163 
164 }
165 
166 #endif // PLOTTER3D_H
Analitza::Plotter3D::isUsingSimpleRotation
bool isUsingSimpleRotation() const
Get information about the current rotarion approach: if return true then rotation is simple...
Definition: plotter3d.h:125
Analitza::Plotter3D::plotStyle
PlotStyle plotStyle() const
Definition: plotter3d.h:89
Analitza::Plotter3D
This class manage the OpenGL scene where the plots will be rendered.
Definition: plotter3d.h:61
plotitem.h
Analitza::PlotItem
Represents a visual item.
Definition: plotitem.h:45
Analitza::Plotter3D::setPlotStyle
void setPlotStyle(PlotStyle ps)
Definition: plotter3d.h:90
Analitza::Plotter3D::setUseSimpleRotation
void setUseSimpleRotation(bool simplerot)
If the flag simplerot is true the rotation ignores any fixed or free direction.
Definition: plotter3d.h:122
Analitza::PlotStyle
PlotStyle
Definition: plottingenums.h:49
Analitza::Plotter3D::isRotationFixed
bool isRotationFixed() const
Query if the rotation is fixed by a specific direction.
Definition: plotter3d.h:110
Analitza::PlottingFocusPolicy
PlottingFocusPolicy
Definition: plottingenums.h:55
Analitza::Plotter3D::model
QAbstractItemModel * model() const
Definition: plotter3d.h:87
Analitza::Plotter3D::plottingFocusPolicy
PlottingFocusPolicy plottingFocusPolicy() const
Definition: plotter3d.h:92
ANALITZAPLOT_EXPORT
#define ANALITZAPLOT_EXPORT
Definition: analitzaplotexport.h:28
Analitza::CartesianAxis
CartesianAxis
Definition: plottingenums.h:42
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal