summaryrefslogtreecommitdiff
path: root/src/GudhUI/view/Viewer.h
blob: 00f9b2455e6b66533cc5a1ee509bb94320c3213d (plain)
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
#ifndef VIEWER_H
#define VIEWER_H

// Workaround for moc-qt4 not parsing boost headers
#include <CGAL/config.h>

#include <QGLViewer/qglviewer.h>
#include "View_parameter.h"
#include "model/Complex_typedefs.h"
#include "Color.h"
#include "Viewer_instructor.h"

class Viewer_instructor;

class Viewer : public QGLViewer {
	Q_OBJECT

	Viewer_instructor * instructor;

	/**
	 * light angles
	 */
	double theta,phi;
	typedef Complex::GT Gudhi_kernel;
	typedef Gudhi_kernel::Point_3 Point_3;
public:
	Viewer(QWidget* parent);

	void set_instructor(Viewer_instructor* instructor_);

	void show_entire_scene();

	void draw();


	void set_bounding_box(const Point_3 & lower_left,const Point_3 & upper_right);

	void update_GL();

	void init_scene();

	void init_light();

	void set_light();

	void set_light_direction(double theta,double phi);

	/**
	 * set the light in the direction of the observer
	 */
	void set_light_direction();


protected:
	virtual void postSelection(const QPoint& point);


public:

	////////////////////////
	// draw
	////////////////////////
	void set_size_point(double size_points);

	void set_color(const Color& color);

	void draw_point(const Point_3& p,const Color& color,double size_points);

	void begin_draw_points(double size,bool light=false);

	void draw_points(const Point_3 & point);

	void end_draw_points();

	void draw_edge(const Point_3 &a,const Point_3 &b,const Color& color,double size);

	void begin_draw_edges(double size,bool light=false);

	void draw_edges(const Point_3 &a,const Point_3 &b);

	void end_draw_edges();

	void begin_draw_triangles(double size,bool light,bool transparent = false);

	void draw_triangles(const Point_3& p1,const Point_3& p2,const Point_3& p3);

	//todo remove
	void draw_triangles(const  std::vector<Point_3*>& points);

	void end_draw_triangles();


	signals:
	void click(const Point_3& position);
};



#endif