CGAL 6.1 - CGAL Basic Viewer
|
#include <CGAL/Qt/Basic_viewer.h>
Inherits CGAL::QGLViewer.
The class Basic_viewer
is a Qt widget based on QGLViewer
that allows to visualize 3D elements: points, segments, triangles, rays and lines.
This class stores a reference to a Graphics_scene
. Elements are added through the scene. This class requires CGAL_Qt6
, and is only available if the macro CGAL_USE_BASIC_VIEWER
is defined. Linking with the cmake target CGAL::CGAL_Basic_viewer
will link with CGAL_Qt6
and add the definition CGAL_USE_BASIC_VIEWER
.
CGAL::QGLViewer is our internal fork of QGLViewer class which is A versatile 3D OpenGL viewer based on QOpenGLWidget.
Public Member Functions | |
Basic_viewer (QWidget *parent, const Graphics_scene &scene, const char *title="") | |
Constructor given a pointer on a QWidget (can be a nullptr ) and a Graphics_scene . | |
void | draw_vertices (bool b) |
enables or disables the drawing of vertices. | |
void | draw_edges (bool b) |
enables or disables the drawing of edges. | |
void | draw_rays (bool b) |
enables or disables the drawing of rays. | |
void | draw_lines (bool b) |
enables or disables the drawing of lines. | |
void | draw_faces (bool b) |
enables or disables the drawing of faces. | |
void | use_mono_color (bool b) |
enables or disables the use of only one color (if b is true ) or the use of multiple colors (if b is false ). | |
void | draw_text (bool b) |
enables or disables the drawing of texts. | |
void | vertices_mono_color (const CGAL::IO::Color &c) |
sets the color used for vertices in mono color mode. | |
void | edges_mono_color (const CGAL::IO::Color &c) |
sets the color used for edges in mono color mode. | |
void | rays_mono_color (const CGAL::IO::Color &c) |
sets the color used for rays in mono color mode. | |
void | lines_mono_color (const CGAL::IO::Color &c) |
sets the color used for lines in mono color mode. | |
void | faces_mono_color (const CGAL::IO::Color &c) |
sets the color used for faces in mono color mode. | |
void | toggle_draw_vertices () |
toggles the drawing of vertices. | |
void | toggle_draw_edges () |
toggles the drawing of edges. | |
void | toggle_draw_rays () |
toggles the drawing of rays. | |
void | toggle_draw_lines () |
toggles the drawing of lines. | |
void | toggle_draw_faces () |
toggles the drawing of faces. | |
void | toggle_use_mono_color () |
toggles the use of mono color mode. | |
void | toggle_draw_text () |
toggles the drawing of text. | |
bool | draw_vertices () const |
returns true if vertices are drawn. | |
bool | draw_edges () const |
returns true if edges are drawn. | |
bool | draw_rays () const |
returns true if rays are drawn. | |
bool | draw_lines () const |
returns true if lines are drawn. | |
bool | draw_faces () const |
returns true if faces are drawn. | |
bool | use_mono_color () const |
returns true if mono color mode is used. | |
bool | reverse_normal () const |
returns true if normals are reversed. | |
bool | draw_text () const |
returns true if text are drawn. | |
const CGAL::IO::Color & | vertices_mono_color () const |
returns the mono color used for vertices. | |
const CGAL::IO::Color & | edges_mono_color () const |
returns the mono color used for edges. | |
const CGAL::IO::Color & | rays_mono_color () const |
returns the mono color used for rays. | |
const CGAL::IO::Color & | lines_mono_color () const |
returns the mono color used for lines. | |
const CGAL::IO::Color & | faces_mono_color () const |
returns the mono color used for faces. | |
bool | clipping_plane_enabled () const |
returns true if the clipping plane is enabled. | |
CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3 | clipping_plane () const |
returns the clipping plane when it is enabled. | |
const Graphics_scene & | graphics_scene () const |
returns the graphics scene of the viewer. | |
void | reverse_all_normals () |
reverses all normals of vertices and faces. | |
virtual void | draw () |
draws the viewer without recomputing all internal buffers. | |
virtual void | redraw () |
redraws the viewer, i.e., recompute all internal buffers and update the window. | |
Public Attributes | |
std::function< bool(QKeyEvent *, CGAL::Qt::Basic_viewer *)> | on_key_pressed |
Function called when a key is pressed. | |
CGAL::Qt::Basic_viewer::Basic_viewer | ( | QWidget * | parent, |
const Graphics_scene & | scene, | ||
const char * | title = "" |
||
) |
Constructor given a pointer on a QWidget
(can be a nullptr
) and a Graphics_scene
.
title
will be the title of the window.
CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3 CGAL::Qt::Basic_viewer::clipping_plane | ( | ) | const |
returns the clipping plane when it is enabled.
bool CGAL::Qt::Basic_viewer::clipping_plane_enabled | ( | ) | const |
returns true
if the clipping plane is enabled.
|
virtual |
draws the viewer without recomputing all internal buffers.
bool CGAL::Qt::Basic_viewer::draw_edges | ( | ) | const |
returns true
if edges are drawn.
void CGAL::Qt::Basic_viewer::draw_edges | ( | bool | b | ) |
enables or disables the drawing of edges.
bool CGAL::Qt::Basic_viewer::draw_faces | ( | ) | const |
returns true
if faces are drawn.
void CGAL::Qt::Basic_viewer::draw_faces | ( | bool | b | ) |
enables or disables the drawing of faces.
bool CGAL::Qt::Basic_viewer::draw_lines | ( | ) | const |
returns true
if lines are drawn.
void CGAL::Qt::Basic_viewer::draw_lines | ( | bool | b | ) |
enables or disables the drawing of lines.
bool CGAL::Qt::Basic_viewer::draw_rays | ( | ) | const |
returns true
if rays are drawn.
void CGAL::Qt::Basic_viewer::draw_rays | ( | bool | b | ) |
enables or disables the drawing of rays.
bool CGAL::Qt::Basic_viewer::draw_text | ( | ) | const |
returns true
if text are drawn.
void CGAL::Qt::Basic_viewer::draw_text | ( | bool | b | ) |
enables or disables the drawing of texts.
bool CGAL::Qt::Basic_viewer::draw_vertices | ( | ) | const |
returns true
if vertices are drawn.
void CGAL::Qt::Basic_viewer::draw_vertices | ( | bool | b | ) |
enables or disables the drawing of vertices.
const CGAL::IO::Color & CGAL::Qt::Basic_viewer::edges_mono_color | ( | ) | const |
returns the mono color used for edges.
void CGAL::Qt::Basic_viewer::edges_mono_color | ( | const CGAL::IO::Color & | c | ) |
sets the color used for edges in mono color mode.
const CGAL::IO::Color & CGAL::Qt::Basic_viewer::faces_mono_color | ( | ) | const |
returns the mono color used for faces.
void CGAL::Qt::Basic_viewer::faces_mono_color | ( | const CGAL::IO::Color & | c | ) |
sets the color used for faces in mono color mode.
const Graphics_scene & CGAL::Qt::Basic_viewer::graphics_scene | ( | ) | const |
returns the graphics scene of the viewer.
const CGAL::IO::Color & CGAL::Qt::Basic_viewer::lines_mono_color | ( | ) | const |
returns the mono color used for lines.
void CGAL::Qt::Basic_viewer::lines_mono_color | ( | const CGAL::IO::Color & | c | ) |
sets the color used for lines in mono color mode.
const CGAL::IO::Color & CGAL::Qt::Basic_viewer::rays_mono_color | ( | ) | const |
returns the mono color used for rays.
void CGAL::Qt::Basic_viewer::rays_mono_color | ( | const CGAL::IO::Color & | c | ) |
sets the color used for rays in mono color mode.
|
virtual |
redraws the viewer, i.e., recompute all internal buffers and update the window.
void CGAL::Qt::Basic_viewer::reverse_all_normals | ( | ) |
reverses all normals of vertices and faces.
bool CGAL::Qt::Basic_viewer::reverse_normal | ( | ) | const |
returns true
if normals are reversed.
void CGAL::Qt::Basic_viewer::toggle_draw_edges | ( | ) |
toggles the drawing of edges.
void CGAL::Qt::Basic_viewer::toggle_draw_faces | ( | ) |
toggles the drawing of faces.
void CGAL::Qt::Basic_viewer::toggle_draw_lines | ( | ) |
toggles the drawing of lines.
void CGAL::Qt::Basic_viewer::toggle_draw_rays | ( | ) |
toggles the drawing of rays.
void CGAL::Qt::Basic_viewer::toggle_draw_text | ( | ) |
toggles the drawing of text.
void CGAL::Qt::Basic_viewer::toggle_draw_vertices | ( | ) |
toggles the drawing of vertices.
void CGAL::Qt::Basic_viewer::toggle_use_mono_color | ( | ) |
toggles the use of mono color mode.
bool CGAL::Qt::Basic_viewer::use_mono_color | ( | ) | const |
returns true
if mono color mode is used.
void CGAL::Qt::Basic_viewer::use_mono_color | ( | bool | b | ) |
enables or disables the use of only one color (if b
is true
) or the use of multiple colors (if b
is false
).
const CGAL::IO::Color & CGAL::Qt::Basic_viewer::vertices_mono_color | ( | ) | const |
returns the mono color used for vertices.
void CGAL::Qt::Basic_viewer::vertices_mono_color | ( | const CGAL::IO::Color & | c | ) |
sets the color used for vertices in mono color mode.
std::function<bool(QKeyEvent *, CGAL::Qt::Basic_viewer *)> CGAL::Qt::Basic_viewer::on_key_pressed |
Function called when a key is pressed.
Users can define their own function in order to add specific behavior.