Skip to content

Commit

Permalink
Update code according to final doc api
Browse files Browse the repository at this point in the history
  • Loading branch information
gdamiand committed Nov 20, 2023
1 parent 39bb4eb commit 1a04e64
Show file tree
Hide file tree
Showing 3 changed files with 487 additions and 487 deletions.
34 changes: 17 additions & 17 deletions Basic_viewer/include/CGAL/Graphics_scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef CGAL_GRAPHICS_SCENE_H
#define CGAL_GRAPHICS_SCENE_H

#include <CGAL/license/GraphicsView.h>
// TODO #include <CGAL/license/GraphicsView.h>
#include <QString>

#include <iostream>
Expand Down Expand Up @@ -231,7 +231,7 @@ class Graphics_scene
return false;
}

bool is_a_face_started() const
bool a_face_started() const
{
return m_buffer_for_mono_faces.is_a_face_started() ||
m_buffer_for_colored_faces.is_a_face_started();
Expand Down Expand Up @@ -269,7 +269,21 @@ class Graphics_scene
{ m_buffer_for_colored_faces.face_end(); }
}

bool is_empty() const
template <typename KPoint>
void add_text(const KPoint &kp, const QString &txt)
{
Local_point p = get_local_point(kp);
m_texts.push_back(std::make_tuple(p, txt));
}

template <typename KPoint> void add_text(const KPoint &kp, const char *txt)
{ add_text(kp, QString(txt)); }

template <typename KPoint>
void add_text(const KPoint &kp, const std::string &txt)
{ add_text(kp, txt.c_str()); }

bool empty() const
{
return (m_buffer_for_mono_points.is_empty() &&
m_buffer_for_colored_points.is_empty() &&
Expand Down Expand Up @@ -361,20 +375,6 @@ class Graphics_scene
Local_kernel>::get_local_vector(v);
}

template <typename KPoint>
void add_text(const KPoint &kp, const QString &txt)
{
Local_point p = get_local_point(kp);
m_texts.push_back(std::make_tuple(p, txt));
}

template <typename KPoint> void add_text(const KPoint &kp, const char *txt)
{ add_text(kp, QString(txt)); }

template <typename KPoint>
void add_text(const KPoint &kp, const std::string &txt)
{ add_text(kp, txt.c_str()); }

void m_texts_clear()
{ m_texts.clear(); }

Expand Down
88 changes: 44 additions & 44 deletions Basic_viewer/include/CGAL/Graphics_scene_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,56 @@
namespace CGAL {

template <typename DS,
typename VertexHandle,
typename EdgeHandle,
typename FaceHandle,
typename VolumeHandle=void>
typename VertexDescriptor,
typename EdgeDescriptor,
typename FaceDescriptor,
typename VolumeDescriptor=void>
struct Graphics_scene_options;

// Drawing functor for a 2D combinatorial data structure
// (with vertices, edges and faces)
template <typename DS,
typename VertexHandle,
typename EdgeHandle,
typename FaceHandle>
struct Graphics_scene_options<DS, VertexHandle, EdgeHandle, FaceHandle, void>
typename VertexDescriptor,
typename EdgeDescriptor,
typename FaceDescriptor>
struct Graphics_scene_options<DS, VertexDescriptor, EdgeDescriptor, FaceDescriptor, void>
{

typedef VertexHandle vertex_descriptor;
typedef EdgeHandle edge_descriptor;
typedef FaceHandle face_descriptor;
typedef VertexDescriptor vertex_descriptor;
typedef EdgeDescriptor edge_descriptor;
typedef FaceDescriptor face_descriptor;

Graphics_scene_options(): m_enabled_vertices(true),
m_enabled_edges(true),
m_enabled_faces(true)
{
draw_vertex=[](const DS &, VertexHandle)->bool { return true; };
draw_edge=[](const DS &, EdgeHandle)->bool { return true; };
draw_face=[](const DS &, FaceHandle)->bool { return true; };
draw_vertex=[](const DS &, vertex_descriptor)->bool { return true; };
draw_edge=[](const DS &, edge_descriptor)->bool { return true; };
draw_face=[](const DS &, face_descriptor)->bool { return true; };

colored_vertex=[](const DS &, VertexHandle)->bool { return false; };
colored_edge=[](const DS &, EdgeHandle)->bool { return false; };
colored_face=[](const DS &, FaceHandle)->bool { return false; };
colored_vertex=[](const DS &, vertex_descriptor)->bool { return false; };
colored_edge=[](const DS &, edge_descriptor)->bool { return false; };
colored_face=[](const DS &, face_descriptor)->bool { return false; };

face_wireframe=[](const DS &, FaceHandle)->bool { return false; };
face_wireframe=[](const DS &, face_descriptor)->bool { return false; };
}

// The seven following functions should not be null
std::function<bool(const DS &, VertexHandle)> draw_vertex;
std::function<bool(const DS &, EdgeHandle)> draw_edge;
std::function<bool(const DS &, FaceHandle)> draw_face;
std::function<bool(const DS &, vertex_descriptor)> draw_vertex;
std::function<bool(const DS &, edge_descriptor)> draw_edge;
std::function<bool(const DS &, face_descriptor)> draw_face;

std::function<bool(const DS &, VertexHandle)> colored_vertex;
std::function<bool(const DS &, EdgeHandle)> colored_edge;
std::function<bool(const DS &, FaceHandle)> colored_face;
std::function<bool(const DS &, vertex_descriptor)> colored_vertex;
std::function<bool(const DS &, edge_descriptor)> colored_edge;
std::function<bool(const DS &, face_descriptor)> colored_face;

std::function<bool(const DS &, FaceHandle)> face_wireframe;
std::function<bool(const DS &, face_descriptor)> face_wireframe;

// These functions must be non null if the corresponding colored_XXX function
// returns true.
std::function<CGAL::IO::Color(const DS &, VertexHandle)> vertex_color;
std::function<CGAL::IO::Color(const DS &, EdgeHandle)> edge_color;
std::function<CGAL::IO::Color(const DS &, FaceHandle)> face_color;
std::function<CGAL::IO::Color(const DS &, vertex_descriptor)> vertex_color;
std::function<CGAL::IO::Color(const DS &, edge_descriptor)> edge_color;
std::function<CGAL::IO::Color(const DS &, face_descriptor)> face_color;

void disable_vertices() { m_enabled_vertices=false; }
void enable_vertices() { m_enabled_vertices=true; }
Expand All @@ -90,29 +90,29 @@ struct Graphics_scene_options<DS, VertexHandle, EdgeHandle, FaceHandle, void>
// Drawing functor for a 3D combinatorial data structure
// (with vertices, edges, faces and volumes)
template <typename DS,
typename VertexHandle,
typename EdgeHandle,
typename FaceHandle,
typename VolumeHandle>
typename VertexDescriptor,
typename EdgeDescriptor,
typename FaceDescriptor,
typename VolumeDescriptor>
struct Graphics_scene_options:
public Graphics_scene_options<DS, VertexHandle, EdgeHandle, FaceHandle>
public Graphics_scene_options<DS, VertexDescriptor, EdgeDescriptor, FaceDescriptor>
{
typedef VertexHandle vertex_descriptor;
typedef EdgeHandle edge_descriptor;
typedef FaceHandle face_descriptor;
typedef VolumeHandle volume_descriptor;
typedef VertexDescriptor vertex_descriptor;
typedef EdgeDescriptor edge_descriptor;
typedef FaceDescriptor face_descriptor;
typedef VolumeDescriptor volume_descriptor;

Graphics_scene_options() : m_enabled_volumes(true)
{
draw_volume=[](const DS &, VolumeHandle)->bool { return true; };
colored_volume=[](const DS &, VolumeHandle)->bool { return false; };
volume_wireframe=[](const DS &, VolumeHandle)->bool { return false; };
draw_volume=[](const DS &, volume_descriptor)->bool { return true; };
colored_volume=[](const DS &, volume_descriptor)->bool { return false; };
volume_wireframe=[](const DS &, volume_descriptor)->bool { return false; };
}

std::function<bool(const DS &, VolumeHandle)> draw_volume;
std::function<bool(const DS &, VolumeHandle)> colored_volume;
std::function<bool(const DS &, VolumeHandle)> volume_wireframe;
std::function<CGAL::IO::Color(const DS &, VolumeHandle)> volume_color;
std::function<bool(const DS &, volume_descriptor)> draw_volume;
std::function<bool(const DS &, volume_descriptor)> colored_volume;
std::function<bool(const DS &, volume_descriptor)> volume_wireframe;
std::function<CGAL::IO::Color(const DS &, volume_descriptor)> volume_color;

void disable_volumes() { m_enabled_volumes=false; }
void enable_volumes() { m_enabled_volumes=true; }
Expand Down
Loading

0 comments on commit 1a04e64

Please sign in to comment.