77 lines
1.2 KiB
C++
77 lines
1.2 KiB
C++
#ifndef MAPVIEW_H
|
|
#define MAPVIEW_H
|
|
|
|
#include <QOpenGLWidget>
|
|
#include <QOpenGLFunctions>
|
|
#include <QOpenGLShaderProgram>
|
|
#include <QBasicTimer>
|
|
|
|
#include <Indoor/geo/Point3.h>
|
|
#include <Indoor/nav/dijkstra/DijkstraPath.h>
|
|
|
|
#include "elements/Path.h"
|
|
|
|
namespace Floorplan {
|
|
class IndoorMap;
|
|
}
|
|
|
|
class Renderable;
|
|
class Path;
|
|
|
|
|
|
class MapView : public QOpenGLWidget, protected QOpenGLFunctions {
|
|
|
|
private:
|
|
|
|
QMatrix4x4 matProject;
|
|
QMatrix4x4 matView;
|
|
|
|
QVector3D lightPos;
|
|
QVector3D eyePos;
|
|
|
|
|
|
QBasicTimer timer;
|
|
|
|
std::vector<Renderable*> elements;
|
|
Path* path;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MapView(QWidget* parent = 0);
|
|
|
|
/** set the map to display */
|
|
void setMap(Floorplan::IndoorMap* map);
|
|
|
|
/** the position to look at */
|
|
void setLookAt(const Point3 pos, const Point3 dir = Point3(-1, -1, 0.1));
|
|
|
|
|
|
/** set the path to disply */
|
|
void setPath(const std::vector<Point3>& path);
|
|
|
|
/** set the path to disply */
|
|
template <typename Node> void setPath(const DijkstraPath<Node>& path) {
|
|
this->path->set(path);
|
|
}
|
|
|
|
|
|
protected:
|
|
|
|
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
|
|
|
|
void initializeGL();
|
|
|
|
void paintGL();
|
|
|
|
void resizeGL(int width, int height);
|
|
|
|
private:
|
|
|
|
void draw();
|
|
|
|
};
|
|
|
|
#endif // MAPVIEW_H
|