CGAL 6.0 - CGAL Basic Viewer
Loading...
Searching...
No Matches
CGAL::Qt::Basic_viewer Class Reference

#include <CGAL/Qt/Basic_viewer.h>

Inherits from

CGAL::QGLViewer.

Definition

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.

Examples
Basic_viewer/draw_several_windows.cpp, and Basic_viewer/draw_surface_mesh_small_faces.cpp.

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_scenegraphics_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.
 

Constructor & Destructor Documentation

◆ Basic_viewer()

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.

Member Data Documentation

◆ on_key_pressed

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.