summaryrefslogtreecommitdiff
path: root/src/GudhUI/view
diff options
context:
space:
mode:
authorsalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-01-27 10:20:13 +0000
committersalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-01-27 10:20:13 +0000
commitf527cde6342c5b8109a20f0a6b483327c6569844 (patch)
tree1c0464b56b21ef7767f814b9a35a6e5c68aa7613 /src/GudhUI/view
parentdf6c26bdcb28805e8949d08dad5acd012e91ecb8 (diff)
Merge GudhUI, a UI for gudhi based on Qt
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@427 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 17fedd974f14a8225b27d94361e835964eeb5cba
Diffstat (limited to 'src/GudhUI/view')
-rw-r--r--src/GudhUI/view/Color.h21
-rw-r--r--src/GudhUI/view/FirstCoordProjector.h24
-rw-r--r--src/GudhUI/view/Projector3D.h28
-rw-r--r--src/GudhUI/view/View_parameter.h137
-rw-r--r--src/GudhUI/view/Viewer.cpp197
-rwxr-xr-xsrc/GudhUI/view/Viewer.h96
-rw-r--r--src/GudhUI/view/Viewer_instructor.cpp206
-rwxr-xr-xsrc/GudhUI/view/Viewer_instructor.h108
8 files changed, 817 insertions, 0 deletions
diff --git a/src/GudhUI/view/Color.h b/src/GudhUI/view/Color.h
new file mode 100644
index 00000000..a63456cb
--- /dev/null
+++ b/src/GudhUI/view/Color.h
@@ -0,0 +1,21 @@
+/*
+ * Color.h
+ *
+ * Created on: Aug 26, 2014
+ * Author: dsalinas
+ */
+
+#ifndef COLOR_H_
+#define COLOR_H_
+
+
+
+struct Color{
+ double r;
+ double g;
+ double b;
+ Color(double r_,double g_,double b_):r(r_),g(g_),b(b_){}
+};
+
+
+#endif /* COLOR_H_ */
diff --git a/src/GudhUI/view/FirstCoordProjector.h b/src/GudhUI/view/FirstCoordProjector.h
new file mode 100644
index 00000000..2659eef1
--- /dev/null
+++ b/src/GudhUI/view/FirstCoordProjector.h
@@ -0,0 +1,24 @@
+/*
+ * FirstCoordProjector.h
+ *
+ * Created on: Aug 27, 2014
+ * Author: dsalinas
+ */
+
+#ifndef FIRSTCOORDPROJECTOR_H_
+#define FIRSTCOORDPROJECTOR_H_
+
+#include "utils/UI_utils.h"
+#include "Projector3D.h"
+
+class FirstCoordProjector3D : public Projector3D{
+ typedef Projector3D::Point Point;
+ typedef Projector3D::Point_3 Point_3;
+
+ Point_3 operator()(const Point& p) const{
+ assert(p.dimension()>=3);
+ return Point_3(p.x(),p.y(),p.z());
+ }
+};
+
+#endif /* FIRSTCOORDPROJECTOR_H_ */
diff --git a/src/GudhUI/view/Projector3D.h b/src/GudhUI/view/Projector3D.h
new file mode 100644
index 00000000..503b35c5
--- /dev/null
+++ b/src/GudhUI/view/Projector3D.h
@@ -0,0 +1,28 @@
+/*
+ * Projector.h
+ *
+ * Created on: Aug 27, 2014
+ * Author: dsalinas
+ */
+
+#ifndef PROJECTOR3D_H_
+#define PROJECTOR3D_H_
+
+#include "model/Complex_typedefs.h"
+
+
+class Projector3D{
+public:
+ typedef Geometry_trait::Point Point;
+ typedef Geometry_trait::Point_3 Point_3;
+
+ virtual Point_3 operator()(const Point&) const = 0;
+
+ virtual ~Projector3D(){
+ }
+
+};
+
+
+
+#endif /* PROJECTOR3D_H_ */
diff --git a/src/GudhUI/view/View_parameter.h b/src/GudhUI/view/View_parameter.h
new file mode 100644
index 00000000..39c5d7dd
--- /dev/null
+++ b/src/GudhUI/view/View_parameter.h
@@ -0,0 +1,137 @@
+/*
+ * View_parameter.h
+ *
+ * Created on: Mar 10, 2014
+ * Author: David Salinas
+ * Copyright 2013 INRIA. All rights reserved
+ */
+
+#ifndef VIEW_PARAMETER_H_
+#define VIEW_PARAMETER_H_
+
+#include <iostream>
+
+/**
+ * Different parameters for the view such as the camera angle,
+ * the light, options for vertices/edges/triangles.
+ */
+class View_parameter{
+public:
+ bool light;
+ bool relative_light;
+
+ double size_vertices;
+ double size_edges;
+ double light_edges; // in 0-1
+ double light_triangles;// in 0-1
+
+ /**
+ * light angle
+ */
+ double theta;
+ double phi;
+
+ enum VERTEX_MODE{ V_NONE,V_SIMPLE,V_COUNT};
+ enum EDGE_MODE{ E_NONE,E_SIMPLE,E_COUNT};
+ enum TRIANGLE_MODE{ T_NONE,T_SIMPLE,T_COUNT};
+
+
+
+
+ VERTEX_MODE vertex_mode;
+ EDGE_MODE edge_mode;
+ TRIANGLE_MODE triangle_mode;
+
+ void change_vertex_mode(){
+ int current_value = vertex_mode;
+ vertex_mode = static_cast<VERTEX_MODE>(++current_value % V_COUNT);
+ std::cout<<"Vertex mode : ";
+ switch (vertex_mode) {
+ case V_NONE:
+ std::cout<<"empty\n";
+ break;
+ case V_SIMPLE:
+ std::cout<<"simple\n";
+ break;
+ default:
+ break;
+ }
+ }
+
+ void change_vertex_mode(int new_mode){
+ vertex_mode = static_cast<VERTEX_MODE>(new_mode % V_COUNT);
+ }
+
+ void change_edge_mode(){
+ int current_value = edge_mode;
+ edge_mode = static_cast<EDGE_MODE>(++current_value % E_COUNT);
+ }
+
+ void change_edge_mode(int new_mode){
+ edge_mode = static_cast<EDGE_MODE>(new_mode % E_COUNT);
+ }
+
+
+ void change_triangle_mode(){
+ int current_value = triangle_mode;
+ triangle_mode = static_cast<TRIANGLE_MODE>(++current_value % T_COUNT);
+ }
+
+
+
+
+
+ View_parameter(){
+ light = true;
+ relative_light = true;
+ vertex_mode = V_SIMPLE;
+ edge_mode = E_SIMPLE;
+ triangle_mode = T_NONE;
+
+ size_vertices = 3;
+ size_edges = 2;
+
+ light_edges = 0.3;
+ light_triangles = 0.85;
+ theta = 0;
+ phi = 0;
+ }
+
+ friend std::ostream& operator<<(std::ostream& stream, const View_parameter& param){
+ stream << param.light<< " ";
+ stream << param.relative_light<< " ";
+ stream << param.vertex_mode<< " ";
+ stream << param.edge_mode<< " ";
+ stream << param.triangle_mode<< " ";
+ stream << param.size_vertices<< " ";
+ stream << param.size_edges<< " ";
+ stream << param.light_edges<< " ";
+ stream << param.light_triangles<< " ";
+ stream << param.theta<< " ";
+ stream << param.phi<< " ";
+ return stream;
+ }
+
+ friend std::istream& operator>>(std::istream& stream, View_parameter& param){
+ stream >> param.light;
+ stream >> param.relative_light;
+ int a;
+ stream>>a;
+ param.vertex_mode = static_cast<VERTEX_MODE>(a % V_COUNT);
+ stream>>a;
+ param.edge_mode = static_cast<EDGE_MODE>(a % E_COUNT);
+ stream>>a;
+ param.triangle_mode = static_cast<TRIANGLE_MODE>(a % T_COUNT);
+ stream>>a;
+ stream >> param.size_vertices;
+ stream >> param.size_edges;
+ stream >> param.light_edges;
+ stream >> param.light_triangles;
+ stream >> param.theta;
+ stream >> param.phi;
+ return stream;
+ }
+
+};
+
+#endif /* VIEW_PARAMETER_H_ */
diff --git a/src/GudhUI/view/Viewer.cpp b/src/GudhUI/view/Viewer.cpp
new file mode 100644
index 00000000..d8a35faf
--- /dev/null
+++ b/src/GudhUI/view/Viewer.cpp
@@ -0,0 +1,197 @@
+/*
+ * Viewer.cpp
+ *
+ * Created on: Aug 26, 2014
+ * Author: dsalinas
+ */
+
+#include "Viewer.h"
+#include "utils/UI_utils.h"
+
+Viewer::Viewer(QWidget* parent): QGLViewer(QGLFormat(QGL::SampleBuffers),parent),instructor(0),theta(0),phi(0){
+}
+
+void
+Viewer::set_instructor(Viewer_instructor* instructor_){
+ instructor = instructor_;
+}
+
+void
+Viewer::show_entire_scene(){
+ this->showEntireScene();
+}
+
+void
+Viewer::draw(){
+ instructor->give_instructions();
+}
+
+
+void
+Viewer::set_bounding_box(const Point_3 & lower_left,const Point_3 & upper_right){
+ this->camera()->setSceneBoundingBox(
+ qglviewer::Vec(lower_left[0], lower_left[1], lower_left[2]),
+ qglviewer::Vec(upper_right[0], upper_right[1], upper_right[2])
+ );
+}
+
+void
+Viewer::update_GL(){
+ this->updateGL();
+
+}
+
+void
+Viewer::init_scene(){
+ this->setBackgroundColor(Qt::white);
+ ::glEnable(GL_LINE_SMOOTH);
+ init_light();
+}
+
+void
+Viewer::init_light(){
+ ::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+}
+
+void
+Viewer::set_light(){
+ if(theta>=0 && phi >=0){
+ const GLfloat pos[4] = {(float)(sin(phi)*cos(theta)),(float)(sin(phi)*sin(theta)),(float)(cos(phi)),0.};
+ glLightfv(GL_LIGHT0, GL_POSITION, pos);
+ }
+}
+
+void
+Viewer::set_light_direction(double theta_,double phi_){
+ theta = theta_;
+ phi = phi_;
+}
+
+/**
+ * set the light in the direction of the observer
+ */
+void
+Viewer::set_light_direction(){
+ theta = -1;
+ phi = -1;
+}
+
+
+void
+Viewer::postSelection(const QPoint& point){
+ bool found;
+
+ auto vec = this->camera()->pointUnderPixel(point,found);
+
+ if(found){
+ Point_3 position(vec[0],vec[1],vec[2]);
+ emit(click(position));
+ }
+}
+
+////////////////////////
+// draw
+////////////////////////
+void
+Viewer::set_size_point(double size_points){
+ ::glPointSize(size_points);
+}
+
+void
+Viewer::draw_point(const Point_3& p,const Color& color,double size_points){
+ ::glColor3f(color.r,color.g,color.b);
+ ::glDisable(GL_LIGHTING);
+ ::glEnable(GL_POINT_SMOOTH);
+ ::glPointSize(size_points);
+ ::glBegin(GL_POINTS);
+ ::glVertex3d(p.x(), p.y(), p.z());
+ ::glEnd();
+ ::glDisable(GL_POINT_SMOOTH);
+}
+
+void
+Viewer::begin_draw_points(double size,bool light){
+ light?glEnable(GL_LIGHTING):glDisable(GL_LIGHTING);
+ ::glEnable(GL_POINT_SMOOTH);
+ ::glPointSize(size);
+ ::glBegin(GL_POINTS);
+}
+
+void
+Viewer::set_color(const Color& color){
+ ::glColor3f(color.r,color.g,color.b);
+}
+
+void
+Viewer::draw_points(const Point_3 & point){
+ ::glVertex3d(point.x(),point.y(),point.z());
+}
+
+void
+Viewer::end_draw_points(){
+ ::glEnd();
+ ::glDisable(GL_POINT_SMOOTH);
+}
+
+void
+Viewer::draw_edge(const Point_3 &a,const Point_3 &b,const Color& color,double size){
+ ::glColor3f(color.r,color.g,color.b);
+ ::glPointSize(3.0);
+ ::glLineWidth(size);
+ ::glBegin(GL_LINES);
+ ::glVertex3f(a.x(),a.y(),a.z());
+ ::glVertex3f(b.x(),b.y(),b.z());
+ ::glEnd();
+}
+
+void
+Viewer::begin_draw_edges(double size,bool light){
+ ::glLineWidth(size);
+ ::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
+ ::glEnable(GL_POLYGON_OFFSET_LINE);
+ ::glPolygonOffset(3.0f,-3.0f);
+ light?glEnable(GL_LIGHTING):glDisable(GL_LIGHTING);
+ ::glBegin(GL_LINES);
+}
+
+void
+Viewer::draw_edges(const Point_3 &a,const Point_3 &b){
+ ::glVertex3f(a.x(),a.y(),a.z());
+ ::glVertex3f(b.x(),b.y(),b.z());
+}
+
+void
+Viewer::end_draw_edges(){
+ ::glEnd();
+}
+
+void
+Viewer::begin_draw_triangles(double size,bool light,bool transparent){
+ if(transparent){
+ ::glEnable (GL_BLEND);
+ ::glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+ ::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
+ ::glEnable(GL_POLYGON_OFFSET_FILL);
+ ::glPolygonOffset(3.0f,-3.0f);
+ light?glEnable(GL_LIGHTING):glDisable(GL_LIGHTING);
+ ::glBegin(GL_TRIANGLES);
+}
+
+void
+Viewer::draw_triangles(const Point_3& p1,const Point_3& p2,const Point_3& p3){
+ if(!CGAL::collinear(p1,p2,p3)){
+ auto triangle_normal = CGAL::unit_normal(p1,p2,p3);
+ ::glNormal3d(triangle_normal.x(),triangle_normal.y(),triangle_normal.z());
+ ::glVertex3d(p1.x(),p1.y(),p1.z());
+ ::glVertex3d(p2.x(),p2.y(),p2.z());
+ ::glVertex3d(p3.x(),p3.y(),p3.z());
+ }
+}
+
+void
+Viewer::end_draw_triangles(){
+ ::glEnd();
+}
+
+#include "Viewer.moc"
diff --git a/src/GudhUI/view/Viewer.h b/src/GudhUI/view/Viewer.h
new file mode 100755
index 00000000..5639aa56
--- /dev/null
+++ b/src/GudhUI/view/Viewer.h
@@ -0,0 +1,96 @@
+#ifndef VIEWER_H
+#define VIEWER_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
diff --git a/src/GudhUI/view/Viewer_instructor.cpp b/src/GudhUI/view/Viewer_instructor.cpp
new file mode 100644
index 00000000..3cb8f152
--- /dev/null
+++ b/src/GudhUI/view/Viewer_instructor.cpp
@@ -0,0 +1,206 @@
+/*
+ * Viewer_instructor.cpp
+ *
+ * Created on: Aug 26, 2014
+ * Author: dsalinas
+ */
+
+#include <utility>
+#include "Viewer_instructor.h"
+#include "utils/UI_utils.h"
+#include "FirstCoordProjector.h"
+
+
+Viewer_instructor::Viewer_instructor(QWidget* parent,
+ Viewer* viewer,
+ const Complex& mesh
+):viewer_(viewer),mesh_(mesh),projector_(new FirstCoordProjector3D()){
+ viewer_->set_instructor(this);
+}
+
+
+void
+Viewer_instructor::initialize_bounding_box(){
+ auto pair_bounding_box = compute_bounding_box_corners();
+ viewer_->set_bounding_box(proj(pair_bounding_box.first),proj(pair_bounding_box.second));
+ viewer_->init_scene();
+}
+
+std::pair<Complex::Point,Complex::Point>
+Viewer_instructor::compute_bounding_box_corners(){
+ if(mesh_.empty()){
+ return std::make_pair(Point(-1,-1,-1,1),Point(1,1,1,1));
+ }
+ else{
+ double x_min = 1e10;
+ double y_min = 1e10;
+ double z_min = 1e10;
+ double x_max = -1e10;
+ double y_max = -1e10;
+ double z_max = -1e10;
+ for( auto vi : mesh_.vertex_range())
+ {
+ auto pt = proj(mesh_.point(vi));
+ x_min = (std::min)(x_min,pt.x());
+ y_min = (std::min)(y_min,pt.y());
+ z_min = (std::min)(z_min,pt.z());
+
+ x_max = (std::max)(x_max,pt.x());
+ y_max = (std::max)(y_max,pt.y());
+ z_max = (std::max)(z_max,pt.z());
+
+ }
+ return std::make_pair(
+ Point(x_min,y_min,z_min,1.),
+ Point(x_max,y_max,z_max,1.)
+ );
+ }
+}
+
+void
+Viewer_instructor::show_entire_scene(){
+ viewer_->show_entire_scene();
+}
+
+const qglviewer::Camera*
+Viewer_instructor::camera() const{
+ return viewer_->camera();
+}
+
+int
+Viewer_instructor::width() const{
+ return viewer_->width();
+}
+int
+Viewer_instructor::height() const{
+ return viewer_->height();
+}
+
+/**
+ * to change display parameters
+ */
+View_parameter&
+Viewer_instructor::view_params(){
+ return view_params_;
+}
+
+
+void
+Viewer_instructor::give_instructions(){
+ if(view_params_.relative_light)
+ viewer_->set_light_direction();
+ else
+ viewer_->set_light_direction(view_params_.theta,view_params_.phi);
+ viewer_->set_light();
+
+ if (view_params_.edge_mode) draw_edges();
+ if (view_params_.triangle_mode) draw_triangles();
+ if (view_params_.vertex_mode) draw_points();
+
+}
+
+void
+Viewer_instructor::draw_edges(){
+ viewer_->begin_draw_edges(view_params_.size_edges,false);
+
+ for(auto edge : mesh_.edge_range()){
+ set_color_edge(edge);
+ const Point& a = mesh_.point(mesh_.first_vertex(edge));
+ const Point& b = mesh_.point(mesh_.second_vertex(edge)) ;
+ viewer_->draw_edges(proj(a),proj(b));
+ }
+
+ viewer_->end_draw_edges();
+}
+
+void
+Viewer_instructor::draw_triangles(){
+ const double size_triangles = 1.0;
+ viewer_->begin_draw_triangles(size_triangles,view_params_.light);
+
+ for(const auto& fit : mesh_.triangle_range()) {
+ set_color_triangle(fit);
+ if(view_params_.triangle_mode){
+ auto fit_it = fit.begin();
+ const Point& p1 = mesh_.point(*fit_it);
+ const Point& p2 = mesh_.point(*(++fit_it));
+ const Point& p3 = mesh_.point(*(++fit_it));
+ viewer_->draw_triangles(proj(p1),proj(p2),proj(p3));
+ }
+ }
+ viewer_->end_draw_triangles();
+}
+
+void
+Viewer_instructor::draw_points(){
+ viewer_->begin_draw_points( view_params_.size_vertices);
+ for( auto vi : mesh_.vertex_range())
+ {
+ viewer_->set_size_point(view_params_.size_vertices);
+ set_color_vertex(vi);
+ viewer_->draw_points(proj(mesh_.point(vi)));
+ }
+ viewer_->end_draw_points();
+}
+
+
+void
+Viewer_instructor::draw_edge(const Point&,const Point&){
+
+}
+
+void
+Viewer_instructor::draw_point(const Point&){
+
+}
+
+
+/**
+ * set the right color of vertex/edge/triangle considering the view_params choice
+ */
+void
+Viewer_instructor::set_color_vertex(Vertex_handle vh){
+ viewer_->set_color(Color(view_params_.light_edges,view_params_.light_edges,view_params_.light_edges));
+}
+
+void
+Viewer_instructor::set_color_edge(Edge_handle eh) {
+ viewer_->set_color(Color(view_params_.light_edges,view_params_.light_edges,view_params_.light_edges));
+}
+
+void
+Viewer_instructor::set_color_triangle(const Simplex_handle& triangle){
+ viewer_->set_color(Color(view_params_.light_triangles,view_params_.light_triangles,view_params_.light_triangles));
+}
+
+
+Viewer_instructor::Point_3
+Viewer_instructor::proj(const Point& p) const{
+ return (*projector_)(p);
+}
+
+
+void
+Viewer_instructor::sceneChanged(){
+ UIDBG("sceneChanged");
+ viewer_->update_GL();
+}
+
+void
+Viewer_instructor::change_draw_vertices(){
+ view_params_.change_vertex_mode();
+}
+void
+Viewer_instructor::change_draw_edges(){
+ view_params_.change_edge_mode();
+}
+void
+Viewer_instructor::change_draw_triangles(){
+ view_params_.change_triangle_mode();
+}
+void
+Viewer_instructor::change_light(){
+ view_params_.light =! view_params_.light ;
+}
+
+#include "Viewer_instructor.moc"
diff --git a/src/GudhUI/view/Viewer_instructor.h b/src/GudhUI/view/Viewer_instructor.h
new file mode 100755
index 00000000..9a2a236b
--- /dev/null
+++ b/src/GudhUI/view/Viewer_instructor.h
@@ -0,0 +1,108 @@
+#ifndef VIEWER_INSTRUCTOR_H
+#define VIEWER_INSTRUCTOR_H
+
+// todo do a viewer instructor that have directely a pointer to a QGLviewer and buffer ot not triangles
+
+
+#include <memory>
+
+#include <QFileDialog>
+#include <QKeyEvent>
+#include <QGLViewer/camera.h>
+
+
+#include "model/Complex_typedefs.h"
+
+#include "Projector3D.h"
+#include "View_parameter.h"
+#include "Viewer.h"
+
+class Viewer;
+class Viewer_parameter;
+
+class Viewer_instructor : public QWidget{
+ Q_OBJECT
+
+ typedef Geometry_trait::Point_3 Point_3;
+ typedef Complex::Point Point;
+ typedef Complex::Vertex_handle Vertex_handle;
+ typedef Complex::Edge_handle Edge_handle;
+ typedef Complex::Simplex_handle Simplex_handle;
+
+
+ Viewer* viewer_;
+ View_parameter view_params_;
+ const Complex& mesh_;
+ std::unique_ptr<Projector3D> projector_;
+
+
+public:
+
+ Viewer_instructor(QWidget* parent,
+ Viewer* viewer,
+ const Complex& mesh
+ );
+
+
+ void initialize_bounding_box();
+
+ std::pair<Point,Point> compute_bounding_box_corners();
+
+ void show_entire_scene();
+
+ const qglviewer::Camera* camera() const;
+
+ int width() const;
+ int height() const;
+
+ /**
+ * to change display parameters
+ */
+ View_parameter& view_params();
+
+
+public:
+
+ /**
+ * gives instructions to the viewer
+ */
+ void give_instructions();
+
+ void draw_edges();
+ void draw_triangles();
+ void draw_points();
+
+
+ void draw_edge(const Point&,const Point&);
+
+ void draw_point(const Point&);
+
+
+ /**
+ * set the right color of vertex/edge/triangle considering the view_params choice
+ */
+ void set_color_vertex(Vertex_handle vh);
+ void set_color_edge(Edge_handle eh);
+
+ void set_color_triangle(const Simplex_handle& triangle);
+
+private:
+ /**
+ * Projection to 3D needed for the viewer.
+ */
+ Point_3 proj(const Point& p) const;
+
+ public slots :
+
+ void sceneChanged();
+
+ void change_draw_vertices();
+ void change_draw_edges();
+ void change_draw_triangles();
+ void change_light();
+
+
+
+};
+
+#endif //VIEWER_INSTRUCTOR_H