// Copyright (c) 2016 GeometryFactory Sarl (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Guillaume Damiand // Mostafa Ashraf #ifndef CGAL_DRAW_POINT_SET_3_H #define CGAL_DRAW_POINT_SET_3_H #include #include #include #include #include #ifdef DOXYGEN_RUNNING namespace CGAL { /*! \ingroup PkgDrawPointSet3D opens a new window and draws a point set. Parameters of the drawing are taken from the optional graphics scene options parameter. A call to this function blocks the execution of the program until the drawing window is closed. This function 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`. \tparam PS which must be an instantiation of a `CGAL::Point_set_3<...>`. \tparam GSOptions a model of `GraphicsSceneOptions` concept. \param ps the point set to draw. \param gso the graphics scene options parameter. \cgalAdvancedBegin The real declaration of this function template is: template void CGAL::draw(const CGAL::Point_set_3& ps, const GSOptions& gso); \cgalAdvancedEnd */ template void draw(const PS& ps, const GSOptions& gso); /*! \ingroup PkgDrawPointSet3D A shortcut to `CGAL::draw(ps, Graphics_scene_options{})`. */ template void draw(const PS& ps); /*! \ingroup PkgDrawPointSet3D adds the vertices, edges and faces of `ps` into the given graphic scene `gs`. Parameters of the cells are taken from the optional graphics scene options parameter `gso`. Note that `gs` is not cleared before being filled (to enable to draw several data structures in the same basic viewer). \tparam PS which must be an instantiation of a `CGAL::Point_set_3<...>`. \tparam GSOptions a model of `GraphicsSceneOptions` concept. \param ps the point set to draw. \param gs the graphic scene to fill. \param gso the graphics scene options parameter. \cgalAdvancedBegin The real declaration of this function template is: template void CGAL::add_to_graphics_scene(const CGAL::Point_set_3& ps, CGAL::Graphics_scene& gs, const GSOptions& gso); \cgalAdvancedEnd */ template void add_to_graphics_scene(const PS& ps, CGAL::Graphics_scene& gs, const GSOptions& gso); /*! \ingroup PkgDrawPointSet3D A shortcut to `CGAL::add_to_graphics_scene(ps, gs, Graphics_scene_options{})`. */ template void add_to_graphics_scene(const PS& ps, CGAL::Graphics_scene& gs); } /* namespace CGAL */ #endif namespace CGAL { namespace draw_function_for_PointSet { template void compute_elements(const PointSet& pointset, Graphics_scene& graphics_scene, const GSOptions& gs_options) { if (!gs_options.are_vertices_enabled()) { return; } for (typename PointSet::const_iterator it=pointset.begin(); it!=pointset.end(); ++it) { if(gs_options.draw_vertex(pointset, it)) { if (gs_options.colored_vertex(pointset, it)) { graphics_scene.add_point(pointset.point(*it), gs_options.vertex_color(pointset, it)); } else { graphics_scene.add_point(pointset.point(*it)); } } } } } // namespace draw_function_for_PointSet template void add_to_graphics_scene(const Point_set_3& apointset, Graphics_scene& graphics_scene, const GSOptions& gs_options) { draw_function_for_PointSet::compute_elements(apointset, graphics_scene, gs_options); } template void add_to_graphics_scene(const Point_set_3& apointset, Graphics_scene& graphics_scene) { CGAL::Graphics_scene_options, typename Point_set_3::const_iterator, int, int> gs_options; add_to_graphics_scene(apointset, graphics_scene, gs_options); } // Specialization of draw function. template void draw(const Point_set_3& apointset, const GSOptions& gs_options, const char *title="Point_set_3 Basic Viewer") { Graphics_scene buffer; add_to_graphics_scene(apointset, buffer, gs_options); draw_graphics_scene(buffer, title); } template void draw(const Point_set_3& apointset, const char *title="Point_set_3 Basic Viewer") { Graphics_scene buffer; add_to_graphics_scene(apointset, buffer); draw_graphics_scene(buffer, title); } } // End namespace CGAL #endif // CGAL_DRAW_POINT_SET_3_H