CGAL 6.1 - CGAL Basic Viewer
|
#include <CGAL/Qt/Basic_viewer.h>
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 Attributes | |
std::function< bool(QKeyEvent *, CGAL::Qt::Basic_viewer *)> | on_key_pressed |
Function called when a key is pressed. | |
Constructors | |
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 . | |
Setters | |
void | size_vertices (float s) |
Set size of vertices. | |
void | size_edges (float s) |
Set size of edges. | |
void | size_rays (float s) |
Set size of rays. | |
void | size_lines (float s) |
Set size of lines. | |
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 | draw_text (bool b) |
enables or disables the drawing of texts. | |
void | draw_mesh_triangles (bool b) |
Enables or disables the drawing of mesh triangles. | |
void | use_default_color (bool b) |
Enables or disables the use of only one color or the use of multiple colors. | |
void | use_default_color_normals (bool b) |
Enables or disables the use of a single color for all normals. | |
void | flat_shading (bool b) |
enables or disables the use of flat shading or the use of smooth shading. | |
void | reverse_normal (bool b) |
Enables or disables the reversal of normals. | |
void | default_color_normals (const CGAL::IO::Color &c) |
Sets the default color of the normals. | |
void | normal_height_factor (float h) |
Sets the height factor value of the normals. | |
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_default_color () |
Toggles the use of mono color mode. | |
void | toggle_use_default_color_normal () |
Toggles the use of the default color mode for normals. | |
void | toggle_flat_shading () |
Toggles the use of flat shading. | |
void | toggle_draw_text () |
Toggles the drawing of text. | |
void | reverse_all_normals () |
Reverses all normals of vertices and faces. | |
Getters | |
bool | draw_vertices () const |
Checks if vertices are drawn. | |
bool | draw_edges () const |
Checks if edges are drawn. | |
bool | draw_rays () const |
Checks if rays are drawn. | |
bool | draw_lines () const |
Checks if lines are drawn. | |
bool | draw_faces () const |
Checks if faces are drawn. | |
bool | draw_text () const |
Checks if text is drawn. | |
bool | use_default_color () const |
Checks if the default color mode is used. | |
bool | use_default_color_normal () const |
Checks if the default color mode for normals is used. | |
bool | reverse_normal () const |
Checks if normals are reversed. | |
bool | clipping_plane_enabled () const |
Checks if the clipping plane is enabled. | |
bool | is_two_dimensional () const |
Checks if m_no_2D_mode is false and the graphics scene is two-dimensional. | |
CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3 | clipping_plane () const |
Gets the clipping plane when enabled. | |
const Graphics_scene & | graphics_scene () const |
Gets the graphics scene of the viewer. | |
Draw | |
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. | |
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 |
Gets the clipping plane when enabled.
CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3
object. bool CGAL::Qt::Basic_viewer::clipping_plane_enabled | ( | ) | const |
Checks if the clipping plane is enabled.
true
if the clipping plane is enabled, false
otherwise. void CGAL::Qt::Basic_viewer::default_color_normals | ( | const CGAL::IO::Color & | c | ) |
Sets the default color of the normals.
c | The default color of the normals. |
bool CGAL::Qt::Basic_viewer::draw_edges | ( | ) | const |
Checks if edges are drawn.
true
if edges are drawn, false
otherwise. void CGAL::Qt::Basic_viewer::draw_edges | ( | bool | b | ) |
Enables or disables the drawing of edges.
b | Set to true to enable, false to disable. |
bool CGAL::Qt::Basic_viewer::draw_faces | ( | ) | const |
Checks if faces are drawn.
true
if faces are drawn, false
otherwise. void CGAL::Qt::Basic_viewer::draw_faces | ( | bool | b | ) |
enables or disables the drawing of faces.
b | Set to true to enable, false to disable. |
bool CGAL::Qt::Basic_viewer::draw_lines | ( | ) | const |
Checks if lines are drawn.
true
if lines are drawn, false
otherwise. void CGAL::Qt::Basic_viewer::draw_lines | ( | bool | b | ) |
Enables or disables the drawing of lines.
b | Set to true to enable, false to disable. |
void CGAL::Qt::Basic_viewer::draw_mesh_triangles | ( | bool | b | ) |
Enables or disables the drawing of mesh triangles.
b | Set to true to enable, false to disable. |
bool CGAL::Qt::Basic_viewer::draw_rays | ( | ) | const |
Checks if rays are drawn.
true
if rays are drawn, false
otherwise. void CGAL::Qt::Basic_viewer::draw_rays | ( | bool | b | ) |
Enables or disables the drawing of rays.
b | Set to true to enable, false to disable. |
bool CGAL::Qt::Basic_viewer::draw_text | ( | ) | const |
Checks if text is drawn.
true
if text is drawn, false
otherwise. void CGAL::Qt::Basic_viewer::draw_text | ( | bool | b | ) |
enables or disables the drawing of texts.
enables or disables the drawing of texts.
b | Set to true to enable, false to disable. |
bool CGAL::Qt::Basic_viewer::draw_vertices | ( | ) | const |
Checks if vertices are drawn.
true
if vertices are drawn, false
otherwise. void CGAL::Qt::Basic_viewer::draw_vertices | ( | bool | b | ) |
Enables or disables the drawing of vertices.
b | Set to true to enable, false to disable. |
void CGAL::Qt::Basic_viewer::flat_shading | ( | bool | b | ) |
enables or disables the use of flat shading or the use of smooth shading.
b | Set to true for flat shading, false for smooth shading. |
const Graphics_scene & CGAL::Qt::Basic_viewer::graphics_scene | ( | ) | const |
Gets the graphics scene of the viewer.
Graphics_scene
object. bool CGAL::Qt::Basic_viewer::is_two_dimensional | ( | ) | const |
Checks if m_no_2D_mode is false and the graphics scene is two-dimensional.
true
if m_no_2D_mode is false and the scene is 2D, false
otherwise. void CGAL::Qt::Basic_viewer::normal_height_factor | ( | float | h | ) |
Sets the height factor value of the normals.
h | The height factor value of the normals. |
bool CGAL::Qt::Basic_viewer::reverse_normal | ( | ) | const |
Checks if normals are reversed.
true
if normals are reversed, false
otherwise. void CGAL::Qt::Basic_viewer::reverse_normal | ( | bool | b | ) |
Enables or disables the reversal of normals.
b | Set to true to reverse normals, false to keep normals as is. |
void CGAL::Qt::Basic_viewer::size_edges | ( | float | s | ) |
Set size of edges.
s | The size of edges. |
void CGAL::Qt::Basic_viewer::size_lines | ( | float | s | ) |
Set size of lines.
s | The size of lines. |
void CGAL::Qt::Basic_viewer::size_rays | ( | float | s | ) |
Set size of rays.
s | The size of rays. |
void CGAL::Qt::Basic_viewer::size_vertices | ( | float | s | ) |
Set size of vertices.
s | The size of vertices. |
bool CGAL::Qt::Basic_viewer::use_default_color | ( | ) | const |
Checks if the default color mode is used.
true
if mono color mode is used, false
otherwise. void CGAL::Qt::Basic_viewer::use_default_color | ( | bool | b | ) |
Enables or disables the use of only one color or the use of multiple colors.
b | Set to true to use only one color, false to use multiple colors. |
bool CGAL::Qt::Basic_viewer::use_default_color_normal | ( | ) | const |
Checks if the default color mode for normals is used.
true
if default color mode for normals is used, false
otherwise. void CGAL::Qt::Basic_viewer::use_default_color_normals | ( | bool | b | ) |
Enables or disables the use of a single color for all normals.
b | Set to true to enable, false to disable. |
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.