diff --git a/.github/test.sh b/.github/test.sh index 59d4820ecdd..e69a77b2995 100755 --- a/.github/test.sh +++ b/.github/test.sh @@ -2,8 +2,8 @@ /usr/local/bin/cmake --version FACTOR=$1 set -ex -cd Polyhedron/demo -/usr/local/bin/cmake -S Polyhedron -B build -DCGAL_DIR=$2 +cd Lab/demo +/usr/local/bin/cmake -S Lab -B build -DCGAL_DIR=$2 LIST_OF_PLUGINS=$(/usr/local/bin/cmake --build build -t help | egrep 'plugin$' |& cut -d\ -f2) PLUGINS_ARRAY=(${LIST_OF_PLUGINS}); NB_OF_PLUGINS=${#PLUGINS_ARRAY[@]} diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index a98dfba56b8..51bffe93ef2 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -1,4 +1,4 @@ -name: Test Polyhedron Demo +name: Compile CGAL Lab on: [push, pull_request,workflow_dispatch] diff --git a/Advancing_front_surface_reconstruction/package_info/Advancing_front_surface_reconstruction/dependencies b/Advancing_front_surface_reconstruction/package_info/Advancing_front_surface_reconstruction/dependencies index d885997679a..e48c91b7e6a 100644 --- a/Advancing_front_surface_reconstruction/package_info/Advancing_front_surface_reconstruction/dependencies +++ b/Advancing_front_surface_reconstruction/package_info/Advancing_front_surface_reconstruction/dependencies @@ -23,7 +23,6 @@ Number_types Polyhedron Profiling_tools Property_map -Random_numbers STL_Extension Spatial_sorting Stream_support diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Descartes.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Descartes.h index 0adc7652b04..bc2287665f0 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Descartes.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Descartes.h @@ -68,9 +68,9 @@ private: Polynomial poly_; int number_of_real_roots_; - IT* numerator; - IT* denominator_exponent; - bool* is_exact; + std::vector numerator; + std::vector denominator_exponent; + std::vector is_exact; IT LEFT,SCALE,DENOM; bool is_strong_; int k; @@ -91,9 +91,9 @@ public: k(kk), interval_given(false) { - numerator = new IT[CGAL::degree(P)]; - denominator_exponent = new IT[CGAL::degree(P)]; - is_exact = new bool[CGAL::degree(P)]; + numerator.resize(CGAL::degree(P)); + denominator_exponent.resize(CGAL::degree(P)); + is_exact.resize(CGAL::degree(P)); number_of_real_roots_ = 0; if(CGAL::degree(P) == 0) { @@ -116,9 +116,9 @@ public: k(kk), interval_given(true) { - numerator = new IT[CGAL::degree(P)]; - denominator_exponent = new IT[CGAL::degree(P)]; - is_exact = new bool[CGAL::degree(P)]; + numerator.resize(CGAL::degree(P)); + denominator_exponent.resize(CGAL::degree(P)); + is_exact.resize(CGAL::degree(P)); number_of_real_roots_ = 0; if(CGAL::degree(P) == 0) { @@ -153,9 +153,9 @@ public: k(D.k), interval_given(D.interval_given) { - numerator = new IT[CGAL::degree(poly_)]; - denominator_exponent = new IT[CGAL::degree(poly_)]; - is_exact = new bool[CGAL::degree(poly_)]; + numerator.resize(CGAL::degree(poly_)); + denominator_exponent.resize(CGAL::degree(poly_)); + is_exact.resize(CGAL::degree(poly_)); for(int i=0; i m_alpha) std::cerr << "Warning: refining with an alpha greater than the last iteration's!" << std::endl; if(refining && offset != m_offset) std::cerr << "Warning: refining with a different offset value!" << std::endl; +#endif m_alpha = FT(alpha); m_sq_alpha = square(m_alpha); diff --git a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h index a22a398115e..cf7782447aa 100644 --- a/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h +++ b/Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h @@ -17,36 +17,63 @@ #ifndef CGAL_DRAW_ARRANGEMENT_2_H #define CGAL_DRAW_ARRANGEMENT_2_H -#include +#include #ifdef DOXYGEN_RUNNING namespace CGAL { /*! \ingroup PkgArrangementOnSurface2Draw - * - * opens a new window and draws `arr`, an instance of the `CGAL::Arrangement_2` - * class template. A call to this function is blocking; that is, the program - * continues only after the user closes the window. 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 GeometryTraits_2 a geometry traits type, a model of a 2D arrangement - * traits concept. At this point it must be an instance of either - * `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. - * - * \tparam Dcel the \dcel type, a model of the `ArrangementDcel` concept. - * - * \param arr the 2D arrangement to draw. - * \param title the window title. - * - * \sa `ArrangementDcel` - * \sa `ArrangementTraits_2` + + opens a new window and draws `arr`, an instance of the `CGAL::Arrangement_2` class template. 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 GeometryTraits_2 a geometry traits type, a model of a 2D arrangement traits concept. At this point it must be an instance of either `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. +\tparam Dcel the \dcel type, a model of the `ArrangementDcel` concept. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param arr the 2D arrangement to draw. +\param gso the graphics scene options parameter. + +\sa `ArrangementDcel` +\sa `ArrangementTraits_2` +*/ +template +void draw(const Arrangement_2& arr, const GSOptions& gso); + +/*! \ingroup PkgArrangementOnSurface2Draw + + A shortcut to `CGAL::draw(arr, Graphics_scene_options{})`. +*/ +template +void draw(const Arrangement_2& arr); + +/*! \ingroup PkgArrangementOnSurface2Draw + +adds the vertices, edges and faces of `arr` 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 GeometryTraits_2 a geometry traits type, a model of a 2D arrangement traits concept. At this point it must be an instance of either `CGAL::Arr_segment_traits_2` or `CGAL::Arr_conic_traits_2`. +\tparam Dcel the \dcel type, a model of the `ArrangementDcel` concept. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param arr the 2D arrangement to draw. +\param gs the graphic scene to fill. +\param gso the graphics scene options parameter. + */ +template +void add_to_graphics_scene(const Arrangement_2& arr, + CGAL::Graphics_scene& gs, const GSOptions& gso); + +/*! \ingroup PkgArrangementOnSurface2Draw + + A shortcut to `CGAL::add_to_graphics_scene(arr, gs, Graphics_scene_options{})`. */ template -void draw(const Arrangement_2& arr, - const char* title = "2D Arrangement Basic Viewer"); +void add_to_graphics_scene(const Arrangement_2& arr, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp index c72c0168c04..1b10d7504fa 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/draw_arr.cpp @@ -100,13 +100,24 @@ int main() { << arr.number_of_faces() << std::endl; std::size_t id(0); - CGAL::draw(arr, [&] (Arrangement_2::Face_const_handle) -> CGAL::IO::Color { - float h = 360.0f * id++ / arr.number_of_faces(); - float s = 0.5; - float v = 0.5; - auto [r, g, b] = hsv_to_rgb(h, s, v); - return CGAL::IO::Color(r,g,b); - }, "hsv colors", true); - return EXIT_SUCCESS; + CGAL::Graphics_scene_options gso; + gso.colored_face=[](const Arrangement_2&, Arrangement_2::Face_const_handle) -> bool + { return true; }; + + gso.face_color=[&id](const Arrangement_2& arr, Arrangement_2::Face_const_handle) -> CGAL::IO::Color + { + float h = 360.0f * id++ / arr.number_of_faces(); + float s = 0.5; + float v = 0.5; + auto [r, g, b] = hsv_to_rgb(h, s, v); + return CGAL::IO::Color(r,g,b); + }; + + CGAL::draw(arr, gso, "hsv colors"); + + return EXIT_SUCCESS; } diff --git a/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h b/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h index 7810ca4e62f..16833cca363 100644 --- a/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h +++ b/Arrangement_on_surface_2/include/CGAL/draw_arrangement_2.h @@ -26,349 +26,70 @@ #include #include -#include - -#ifdef CGAL_USE_BASIC_VIEWER +#include +#include +#include +#include #include -#include #include #include #include namespace CGAL { -struct Default_color_generator { - /*! Obtain color - */ - template - CGAL::IO::Color operator()(HalfedgeHandle /* h */) { - static std::random_device rd; - static std::mt19937 rng(rd()); - static std::uniform_int_distribution uni(0, 255); - return CGAL::IO::Color(uni(rng), uni(rng), uni(rng)); - } -}; - -// Viewer class for`< Polygon_2 -template -class Aos_2_basic_viewer_qt : public Basic_viewer_qt { - using Aos = ArrangementOnSurface_2; - using Color_generator = ColorGenerator; - using Base = Basic_viewer_qt; - using Gt = typename Aos::Geometry_traits_2; - using Point = typename Aos::Point_2; - using X_monotone_curve = typename Aos::X_monotone_curve_2; - using Vertex_const_handle = typename Aos::Vertex_const_handle; - using Halfedge_const_handle = typename Aos::Halfedge_const_handle; - using Face_const_handle = typename Aos::Face_const_handle; - using Ccb_halfedge_const_circulator = - typename Aos::Ccb_halfedge_const_circulator; - -public: - /// Construct the viewer. - /// @param arr the arrangement to view - /// @param title the title of the window - Aos_2_basic_viewer_qt(QWidget* parent, const Aos& aos, - Color_generator color_generator, - const char* title = "2D Arrangement Basic Viewer", - bool draw_vertices = false) : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, draw_vertices, true, true, false, false), - m_aos(aos), - m_color_generator(color_generator) +namespace draw_function_for_arrangement_2 +{ + template + class Draw_arr_tool { - // mimic the computation of Camera::pixelGLRatio() - auto bbox = bounding_box(); - CGAL::qglviewer::Vec minv(bbox.xmin(), bbox.ymin(), 0); - CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0); - auto diameter = (maxv - minv).norm(); - m_pixel_ratio = diameter / m_height; - } + public: + using Halfedge_const_handle=typename Arr::Halfedge_const_handle; + using Vertex_const_handle=typename Arr::Vertex_const_handle; + using Face_const_handle=typename Arr::Face_const_handle; + using Ccb_halfedge_const_circulator=typename Arr::Ccb_halfedge_const_circulator; + using Inner_ccb_const_iterator=typename Arr::Inner_ccb_const_iterator; + using Outer_ccb_const_iterator=typename Arr::Outer_ccb_const_iterator; + using Gt=typename Arr::Geometry_traits_2; + using Point=typename Arr::Point_2; + using X_monotone_curve = typename Arr::X_monotone_curve_2; - /*! Intercept the resizing of the window. - */ - virtual void resizeGL(int width, int height) { - CGAL::QGLViewer::resizeGL(width, height); - m_width = width; - m_height = height; - CGAL::qglviewer::Vec p; - auto ratio = camera()->pixelGLRatio(p); - if (ratio != m_pixel_ratio) { - m_pixel_ratio = ratio; - add_elements(); - } - } + Draw_arr_tool(Arr& a_aos, CGAL::Graphics_scene& a_gs, const GSOptions& a_gso): + m_aos(a_aos), m_gs(a_gs), m_gso(a_gso) + {} - /*! Compute an approximation of the bounding box of a point. - * \param[in] p the (exact) point. - * Call this member function only if the geometry traits is equipped with - * the coordinate-approximation functionality of a point coordinate. - * This function must be inlined (e.g., a template) to enable the - * compiled-time dispatching in the function `bounding_box()`. - */ - template - CGAL::Bbox_2 approximate_bbox(const Point& p, const Approximate& approx) { - auto x = approx(p, 0); - auto y = approx(p, 1); - return CGAL::Bbox_2(x, y, x, y); - } + /// Add a face. + void add_face(Face_const_handle face) + { + // std::cout << "add_face()\n"; + for (Inner_ccb_const_iterator it = face->inner_ccbs_begin(); + it != face->inner_ccbs_end(); ++it) + { add_ccb(*it); } - /*! Obtain the bounding box of a point. - * \param[in] p the point. - * We assume that if the coordinate-approximation functionality is not - * supported, the point supports the member function `bbox()`. - * This function must be inlined (e.g., a template) to enable the - * compiled-time dispatching in the function `bounding_box()`. - */ - template - CGAL::Bbox_2 exact_bbox(const Point& p) { return p.bbox(); } - - /*! Compile time dispatching - */ -#if 0 - template - void bounding_box_impl2(CGAL::Bbox_2& bbox, const Point& p, T const&, long) - { bbox += exact_bbox(p); } - - template - auto bounding_box_impl2(CGAL::Bbox_2& bbox, const Point& p, T const& approx, - int) -> decltype(approx.operator()(p), void()) - { bbox += approximate_bbox(p, approx); } - - template - void bounding_box_impl1(CGAL::Bbox_2& bbox, const Point& p, T const&, long) - { bbox += exact_bbox(p); } - - template - auto bounding_box_impl1(CGAL::Bbox_2& bbox, const Point& p, T const& traits, - int) -> - decltype(traits.approximate_2_object(), void()) { - using Approximate = typename Gt::Approximate_2; - bounding_box_impl2(bbox, p, traits.approximate_2_object(), 0); - } -#else - template - void bounding_box_impl1(CGAL::Bbox_2& bbox, const Point& p, T const& traits, - int) - { bbox += approximate_bbox(p, traits.approximate_2_object()); } -#endif - - /*! Compute the bounding box. - */ - CGAL::Bbox_2 bounding_box() { - CGAL::Bbox_2 bbox; - const auto* traits = this->m_aos.geometry_traits(); - // At this point we assume that the arrangement is not open, and thus the - // bounding box is defined by the vertices. - for (auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) - bounding_box_impl1(bbox, it->point(), *traits, 0); - return bbox; - } - - /*! Add all faces. - */ - template - void add_faces(const Traits&) { - for (auto it = m_aos.unbounded_faces_begin(); - it != m_aos.unbounded_faces_end(); ++it) - add_face(it); - } - - /*! Add all faces. - */ - template - void - add_faces(Arr_geodesic_arc_on_sphere_traits_2 const&) - { add_face(m_aos.faces_begin()); } - - /*! Add all elements to be drawn. - */ - void add_elements() { - // std::cout << "add_elements()\n"; - // std::cout << "ratio: " << this->pixel_ratio() << std::endl; - clear(); - m_visited.clear(); - - if (m_aos.is_empty()) return; - add_faces(*(this->m_aos.geometry_traits())); - - // Add edges that do not separate faces. - for (auto it = m_aos.edges_begin(); it != m_aos.edges_end(); ++it) - if (it->face() == it->twin()->face()) draw_curve(it->curve()); - - // Add all points - for (auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) - draw_point(it->point()); - - m_visited.clear(); - } - - /*/ Obtain the pixel ratio - */ - double pixel_ratio() const { return m_pixel_ratio; } - -protected: - template - Halfedge_const_handle - find_smallest(Ccb_halfedge_const_circulator circ, - Arr_geodesic_arc_on_sphere_traits_2 const&) - { return circ; } - - /*! Find the halfedge incident to the lexicographically smallest vertex - * along the CCB, such that there is no other halfedge underneath. - */ - template - Halfedge_const_handle find_smallest(Ccb_halfedge_const_circulator circ, - const Traits&) { - // std::cout << "find_smallest()\n"; - const auto* traits = this->m_aos.geometry_traits(); - auto cmp_xy = traits->compare_xy_2_object(); - auto cmp_y = traits->compare_y_at_x_right_2_object(); - - // Find the first halfedge directed from left to right - auto curr = circ; - do if (curr->direction() == CGAL::ARR_LEFT_TO_RIGHT) break; - while (++curr != circ); - Halfedge_const_handle ext = curr; - - // Find the halfedge incident to the lexicographically smallest vertex, - // such that there is no other halfedge underneath. - do { - // Discard edges not directed from left to right: - if (curr->direction() != CGAL::ARR_LEFT_TO_RIGHT) continue; - - - auto res = cmp_xy(curr->source()->point(), ext->source()->point()); - - // Discard the edges inciden to a point strictly larger than the point - // incident to the stored extreme halfedge: - if (res == LARGER) continue; - - // Store the edge inciden to a point strictly smaller: - if (res == SMALLER) { - ext = curr; - continue; + for (Outer_ccb_const_iterator it = face->outer_ccbs_begin(); + it != face->outer_ccbs_end(); ++it) + { + add_ccb(*it); + draw_region(*it); } - - // The incident points are equal; compare the halfedges themselves: - if (cmp_y(curr->curve(), ext->curve(), curr->source()->point()) == - SMALLER) - ext = curr; - } while (++curr != circ); - - return ext; - } - - /*! Draw a region using aproximate coordinates. - * Call this member function only if the geometry traits is equipped with - * the coordinate-approximation functionality of a curve. - * This function must be inlined (e.g., a template) to enable the - * compiled-time dispatching in the function `draw_region()`. - */ - template - void draw_approximate_region(Halfedge_const_handle curr, - const Approximate& approx) { - // std::cout << "draw_approximate_region()\n"; - std::vector polyline; - double error(this->pixel_ratio()); - bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT; - approx(curr->curve(), error, std::back_inserter(polyline), l2r); - if (polyline.empty()) return; - auto it = polyline.begin(); - auto prev = it++; - for (; it != polyline.end(); prev = it++) { - this->add_segment(*prev, *it); - this->add_point_in_face(*prev); } - } - /*! Draw an exact curve. - */ - template - void draw_exact_curve(const XMonotoneCurve& curve) { - const auto* traits = this->m_aos.geometry_traits(); - auto ctr_min = traits->construct_min_vertex_2_object(); - auto ctr_max = traits->construct_max_vertex_2_object(); - this->add_segment(ctr_min(curve), ctr_max(curve)); - } - - /*! Draw an exact region. - */ - void draw_exact_region(Halfedge_const_handle curr) { - // this->add_point_in_face(curr->source()->point()); - draw_exact_curve(curr->curve()); - } - - /*! Compile time dispatching - */ -#if 0 - template - void draw_region_impl2(Halfedge_const_handle curr, T const&, long) - { draw_exact_region(curr); } - - template - auto draw_region_impl2(Halfedge_const_handle curr, T const& approx, int) -> - decltype(approx.template operator()(X_monotone_curve{}, double{}, I{}, - bool{}), void()) - { draw_approximate_region(curr, approx); } - - template - void draw_region_impl1(Halfedge_const_handle curr, T const&, long) - { draw_exact_region(curr); } - - template - auto draw_region_impl1(Halfedge_const_handle curr, T const& traits, int) -> - decltype(traits.approximate_2_object(), void()) { - using Approximate = typename Gt::Approximate_2; - draw_region_impl2(curr, traits.approximate_2_object(), 0); - } -#else - template - void draw_region_impl1(Halfedge_const_handle curr, T const& traits, int) - { draw_approximate_region(curr, traits.approximate_2_object()); } -#endif - - template - void draw_region_impl1 - (Halfedge_const_handle curr, - Arr_geodesic_arc_on_sphere_traits_2 const& traits, - int) { - // std::cout << "draw_region_impl1()\n"; - auto approx = traits.approximate_2_object(); - using Kernel = Kernel_; - using Traits = Arr_geodesic_arc_on_sphere_traits_2; - using Ak = typename Traits::Approximate_kernel; - using Ap = typename Traits::Approximate_point_2; - using Approx_point_3 = typename Ak::Point_3; - - std::vector polyline; - double error(0.01); - bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT; - approx(curr->curve(), error, std::back_inserter(polyline), l2r); - if (polyline.empty()) return; - auto it = polyline.begin(); - auto x = it->dx(); - auto y = it->dy(); - auto z = it->dz(); - auto l = std::sqrt(x*x + y*y + z*z); - Approx_point_3 prev(x/l, y/l, z/l); - for (++it; it != polyline.end(); ++it) { - auto x = it->dx(); - auto y = it->dy(); - auto z = it->dz(); - auto l = std::sqrt(x*x + y*y + z*z); - Approx_point_3 next(x/l, y/l, z/l); - this->add_segment(prev, next); - prev = next; - // this->add_point_in_face(*prev); + /// Add a Connected Component of the Boundary. + void add_ccb(Ccb_halfedge_const_circulator circ) + { + // std::cout << "add_ccb()\n"; + auto curr = circ; + do { + auto new_face = curr->twin()->face(); + if (m_visited.find(new_face) != m_visited.end()) continue; + m_visited[new_face] = true; + add_face(new_face); + } while (++curr != circ); } - } - /*! Draw a region. - */ - void draw_region(Ccb_halfedge_const_circulator circ) { + ///! Draw a region. + void draw_region(Ccb_halfedge_const_circulator circ) + { // std::cout << "draw_region()\n"; /* Check whether the traits has a member function called * approximate_2_object() and if so check whether the return type, namely @@ -385,21 +106,315 @@ protected: * * For now we use C++14 features. */ - auto color = m_color_generator(circ->face()); - this->face_begin(color); + if(m_gso.colored_face(m_aos, circ->face())) + { m_gs.face_begin(m_gso.face_color(m_aos, circ->face())); } + else + { m_gs.face_begin(); } - const auto* traits = this->m_aos.geometry_traits(); - auto ext = find_smallest(circ, *traits); - auto curr = ext; + const auto* traits = this->m_aos.geometry_traits(); + auto ext = find_smallest(circ, *traits); + auto curr = ext; - do { - // Skip halfedges that are "antenas": - while (curr->face() == curr->twin()->face()) curr = curr->twin()->next(); - draw_region_impl1(curr, *traits, 0); - curr = curr->next(); - } while (curr != ext); + do { + // Skip halfedges that are "antenas": + while (curr->face() == curr->twin()->face()) curr = curr->twin()->next(); + draw_region_impl1(curr, *traits, 0); + curr = curr->next(); + } while (curr != ext); - this->face_end(); + m_gs.face_end(); + } + + /// Compile time dispatching +#if 0 + template + void draw_region_impl2(Halfedge_const_handle curr, T const&, long) + { draw_exact_region(curr); } + + template + auto draw_region_impl2(Halfedge_const_handle curr, T const& approx, int) -> + decltype(approx.template operator()(X_monotone_curve{}, double{}, I{}, + bool{}), void()) + { draw_approximate_region(curr, approx); } + + template + void draw_region_impl1(Halfedge_const_handle curr, T const&, long) + { draw_exact_region(curr); } + + template + auto draw_region_impl1(Halfedge_const_handle curr, T const& traits, int) -> + decltype(traits.approximate_2_object(), void()) { + using Approximate = typename Gt::Approximate_2; + draw_region_impl2(curr, traits.approximate_2_object(), 0); + } +#else + template + void draw_region_impl1(Halfedge_const_handle curr, T const& traits, int) + { draw_approximate_region(curr, traits.approximate_2_object()); } +#endif + + template + void draw_region_impl1 + (Halfedge_const_handle curr, + Arr_geodesic_arc_on_sphere_traits_2 const& traits, + int) + { + if(!m_gso.draw_edge(m_aos, curr)) + { return; } + + // std::cout << "draw_region_impl1()\n"; + auto approx = traits.approximate_2_object(); + using Kernel = Kernel_; + using Traits = Arr_geodesic_arc_on_sphere_traits_2; + using Ak = typename Traits::Approximate_kernel; + using Ap = typename Traits::Approximate_point_2; + using Approx_point_3 = typename Ak::Point_3; + + std::vector polyline; + double error(0.01); + bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT; + approx(curr->curve(), error, std::back_inserter(polyline), l2r); + if (polyline.empty()) return; + auto it = polyline.begin(); + auto x = it->dx(); + auto y = it->dy(); + auto z = it->dz(); + auto l = std::sqrt(x*x + y*y + z*z); + Approx_point_3 prev(x/l, y/l, z/l); + for (++it; it != polyline.end(); ++it) { + auto x = it->dx(); + auto y = it->dy(); + auto z = it->dz(); + auto l = std::sqrt(x*x + y*y + z*z); + Approx_point_3 next(x/l, y/l, z/l); + + if(m_gso.colored_edge(m_aos, curr)) + { m_gs.add_segment(prev, next, m_gso.edge_color(m_aos, curr)); } + else + { m_gs.add_segment(prev, next); } + + prev = next; + // m_gs.add_point_in_face(*prev); + } + } + + /*! Draw a region using aproximate coordinates. + * Call this member function only if the geometry traits is equipped with + * the coordinate-approximation functionality of a curve. + * This function must be inlined (e.g., a template) to enable the + * compiled-time dispatching in the function `draw_region()`. + */ + template + void draw_approximate_region(Halfedge_const_handle curr, + const Approximate& approx) + { + // std::cout << "draw_approximate_region()\n"; + std::vector polyline; + double error(0.01); // TODO? (this->pixel_ratio()); + bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT; + approx(curr->curve(), error, std::back_inserter(polyline), l2r); + if (polyline.empty()) return; + auto it = polyline.begin(); + auto prev = it++; + for (; it != polyline.end(); prev = it++) { + if(m_gso.draw_edge(m_aos, curr)) + { + if(m_gso.colored_edge(m_aos, curr)) + { m_gs.add_segment(*prev, *it, m_gso.edge_color(m_aos, curr)); } + else + { m_gs.add_segment(*prev, *it); } + } + m_gs.add_point_in_face(*prev); + } + } + + /// Draw an exact curve. + template + void draw_exact_curve(const XMonotoneCurve& curve) + { + const auto* traits = this->m_aos.geometry_traits(); + auto ctr_min = traits->construct_min_vertex_2_object(); + auto ctr_max = traits->construct_max_vertex_2_object(); + m_gs.add_segment(ctr_min(curve), ctr_max(curve)); + } + + /// Draw an exact region. + void draw_exact_region(Halfedge_const_handle curr) + { + // this->add_point_in_face(curr->source()->point()); + draw_exact_curve(curr->curve()); + } + + /// Add all faces. + template + void add_faces(const Traits&) + { + for (auto it=m_aos.unbounded_faces_begin(); it!=m_aos.unbounded_faces_end(); ++it) + { add_face(it); } + } + + /// Add all faces. + template + void add_faces(Arr_geodesic_arc_on_sphere_traits_2 const&) + { add_face(m_aos.faces_begin()); } + + /// Compile time dispatching +#if 0 + template + void draw_point_impl2(const Point& p, T const&, long) { m_gs.add_point(p); } + + template + auto draw_point_impl2(const Point& p, T const& approx, int) -> + decltype(approx.operator()(p), void()) + { m_gs.add_point(approx(p)); } + + template + void draw_point_impl1(const Point& p, T const&, long) { m_gs.add_point(p); } + + template + auto draw_point_impl1(const Point& p, T const& traits, int) -> + decltype(traits.approximate_2_object(), void()) { + using Approximate = typename Gt::Approximate_2; + draw_point_impl2(p, traits.approximate_2_object(), true); + } +#else + template + void draw_point_impl1(const Point& p, T const& traits, int, + bool colored, const CGAL::IO::Color& color) + { + if(colored) + { m_gs.add_point(traits.approximate_2_object()(p), color); } + else + { m_gs.add_point(traits.approximate_2_object()(p)); } + } +#endif + + template + void draw_point_impl1 + (const Point& p, + Arr_geodesic_arc_on_sphere_traits_2 const& traits, + int, + bool colored, + const CGAL::IO::Color& color) + { + auto approx = traits.approximate_2_object(); + using Traits = Arr_geodesic_arc_on_sphere_traits_2; + using Ak = typename Traits::Approximate_kernel; + using Approx_point_3 = typename Ak::Point_3; + auto ap = approx(p); + auto x = ap.dx(); + auto y = ap.dy(); + auto z = ap.dz(); + auto l = std::sqrt(x*x + y*y + z*z); + Approx_point_3 p3(x/l, y/l, z/l); + if(colored) + { m_gs.add_point(p3, color); } + else + { m_gs.add_point(p3); } + } + + /// Draw a point. + void draw_point(Vertex_const_handle vh) + { + const auto* traits = m_aos.geometry_traits(); + if(m_gso.draw_vertex(m_aos, vh)) + { + if(m_gso.colored_vertex(m_aos, vh)) + { draw_point_impl1(vh->point(), *traits, 0, true, + m_gso.vertex_color(m_aos, vh)); } + else + { draw_point_impl1(vh->point(), *traits, 0, false, CGAL::IO::Color()); } // color will be unused + } + } + + template + Halfedge_const_handle + find_smallest(Ccb_halfedge_const_circulator circ, + Arr_geodesic_arc_on_sphere_traits_2 const&) + { return circ; } + + /*! Find the halfedge incident to the lexicographically smallest vertex + * along the CCB, such that there is no other halfedge underneath. + */ + template + Halfedge_const_handle find_smallest(Ccb_halfedge_const_circulator circ, + const Traits&) + { + // std::cout << "find_smallest()\n"; + const auto* traits = this->m_aos.geometry_traits(); + auto cmp_xy = traits->compare_xy_2_object(); + auto cmp_y = traits->compare_y_at_x_right_2_object(); + + // Find the first halfedge directed from left to right + auto curr = circ; + do if (curr->direction() == CGAL::ARR_LEFT_TO_RIGHT) break; + while (++curr != circ); + Halfedge_const_handle ext = curr; + + // Find the halfedge incident to the lexicographically smallest vertex, + // such that there is no other halfedge underneath. + do { + // Discard edges not directed from left to right: + if (curr->direction() != CGAL::ARR_LEFT_TO_RIGHT) continue; + + auto res = cmp_xy(curr->source()->point(), ext->source()->point()); + + // Discard the edges inciden to a point strictly larger than the point + // incident to the stored extreme halfedge: + if (res == LARGER) continue; + + // Store the edge inciden to a point strictly smaller: + if (res == SMALLER) { + ext = curr; + continue; + } + + // The incident points are equal; compare the halfedges themselves: + if (cmp_y(curr->curve(), ext->curve(), curr->source()->point()) == + SMALLER) + ext = curr; + } while (++curr != circ); + + return ext; + } + + /// Add all elements to be drawn. + void add_elements() + { + // std::cout << "add_elements()\n"; + // std::cout << "ratio: " << this->pixel_ratio() << std::endl; + m_visited.clear(); + + if (m_aos.is_empty()) return; + + if(m_gso.are_faces_enabled()) + { add_faces(*(this->m_aos.geometry_traits())); } + + // Add edges that do not separate faces. + if(m_gso.are_edges_enabled()) + { + for (auto it = m_aos.edges_begin(); it != m_aos.edges_end(); ++it) + { if (it->face()==it->twin()->face()) + { + if(m_gso.draw_edge(m_aos, it)) + { + if(m_gso.colored_edge(m_aos, it)) + { draw_curve(it->curve(), true, m_gso.edge_color(m_aos, it)); } + else + { draw_curve(it->curve(), false, CGAL::IO::Color()); } + } + } + } + } + + // Add all points + if(m_gso.are_vertices_enabled()) + { + for (auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) + { draw_point(it); } + } + + m_visited.clear(); } /*! Draw a curve using aproximate coordinates. @@ -410,349 +425,195 @@ protected: */ template void draw_approximate_curve(const XMonotoneCurve& curve, - const Approximate& approx) { + const Approximate& approx, + bool colored, const CGAL::IO::Color& c) + { std::vector polyline; - double error(this->pixel_ratio()); + double error(0.01); // TODO? (this->pixel_ratio()); approx(curve, error, std::back_inserter(polyline)); if (polyline.empty()) return; auto it = polyline.begin(); auto prev = it++; - for (; it != polyline.end(); prev = it++) this->add_segment(*prev, *it); + for (; it != polyline.end(); prev = it++) + { + if(colored) + { m_gs.add_segment(*prev, *it, c); } + else + { m_gs.add_segment(*prev, *it); } + } + } /*! Compile time dispatching */ #if 0 - template - void draw_curve_impl2(const X_monotone_curve& xcv, T const&, long) - { draw_exact_curve(xcv); } + template + void draw_curve_impl2(const X_monotone_curve& xcv, T const&, long) + { draw_exact_curve(xcv); } - template - auto draw_curve_impl2(const X_monotone_curve& xcv, T const& approx, int) -> - decltype(approx.template operator()(X_monotone_curve{}, double{}, I{}, - bool{}), void()) - { draw_approximate_curve(xcv, approx); } + template + auto draw_curve_impl2(const X_monotone_curve& xcv, T const& approx, int) -> + decltype(approx.template operator()(X_monotone_curve{}, double{}, I{}, + bool{}), void()) + { draw_approximate_curve(xcv, approx); } - template - void draw_curve_impl1(const X_monotone_curve& xcv, T const&, long) - { draw_exact_curve(xcv); } + template + void draw_curve_impl1(const X_monotone_curve& xcv, T const&, long) + { draw_exact_curve(xcv); } - template - auto draw_curve_impl1(const X_monotone_curve& xcv, T const& traits, int) -> - decltype(traits.approximate_2_object(), void()) { - using Approximate = typename Gt::Approximate_2; - draw_curve_impl2(xcv, traits.approximate_2_object(), 0); - } + template + auto draw_curve_impl1(const X_monotone_curve& xcv, T const& traits, int) -> + decltype(traits.approximate_2_object(), void()) { + using Approximate = typename Gt::Approximate_2; + draw_curve_impl2(xcv, traits.approximate_2_object(), 0); + } #else - template - void draw_curve_impl1(const X_monotone_curve& xcv, T const& traits, int) - { draw_approximate_curve(xcv, traits.approximate_2_object()); } + template + void draw_curve_impl1(const X_monotone_curve& xcv, T const& traits, int, + bool colored, const CGAL::IO::Color& c) + { draw_approximate_curve(xcv, traits.approximate_2_object(), colored, c); } #endif - template - void draw_curve_impl1 - (const X_monotone_curve& xcv, - Arr_geodesic_arc_on_sphere_traits_2 const& traits, - int) { - auto approx = traits.approximate_2_object(); - using Kernel = Kernel_; - using Traits = Arr_geodesic_arc_on_sphere_traits_2; - using Ak = typename Traits::Approximate_kernel; - using Ap = typename Traits::Approximate_point_2; - using Approx_point_3 = typename Ak::Point_3; - std::vector apoints; - double error(0.01); - approx(xcv, error, std::back_inserter(apoints)); - auto it = apoints.begin(); - auto x = it->dx(); - auto y = it->dy(); - auto z = it->dz(); - auto l = std::sqrt(x*x + y*y + z*z); - Approx_point_3 prev(x/l, y/l, z/l); - for (++it; it != apoints.end(); ++it) { + template + void draw_curve_impl1 + (const X_monotone_curve& xcv, + Arr_geodesic_arc_on_sphere_traits_2 const& traits, + int, + bool colored, const CGAL::IO::Color& c) + { + auto approx = traits.approximate_2_object(); + using Kernel = Kernel_; + using Traits = Arr_geodesic_arc_on_sphere_traits_2; + using Ak = typename Traits::Approximate_kernel; + using Ap = typename Traits::Approximate_point_2; + using Approx_point_3 = typename Ak::Point_3; + std::vector apoints; + double error(0.01); + approx(xcv, error, std::back_inserter(apoints)); + auto it = apoints.begin(); auto x = it->dx(); auto y = it->dy(); auto z = it->dz(); auto l = std::sqrt(x*x + y*y + z*z); - Approx_point_3 next(x/l, y/l, z/l); - this->add_segment(prev, next); - prev = next; + Approx_point_3 prev(x/l, y/l, z/l); + for (++it; it != apoints.end(); ++it) { + auto x = it->dx(); + auto y = it->dy(); + auto z = it->dz(); + auto l = std::sqrt(x*x + y*y + z*z); + Approx_point_3 next(x/l, y/l, z/l); + if(colored) + { m_gs.add_segment(prev, next, c); } + else + { m_gs.add_segment(prev, next); } + prev = next; + } } - } - /*! Draw a curve. - */ - template - void draw_curve(const XMonotoneCurve& curve) { - /* Check whether the traits has a member function called - * approximate_2_object() and if so check whether the return type, namely - * `Approximate_2` has an appropriate operator. - * - * C++20 supports concepts and `requires` expression; see, e.g., - * https://en.cppreference.com/w/cpp/language/constraints; thus, the first - * condition above can be elegantly verified as follows: - * constexpr bool has_approximate_2_object = - * requires(const Gt& traits) { traits.approximate_2_object(); }; - * - * C++17 has experimental constructs called is_detected and - * is_detected_v that can be used to achieve the same goal. - * - * For now we use C++14 features. - */ -#if 0 - if constexpr (std::experimental::is_detected_v) + /// Draw a curve. + template + void draw_curve(const XMonotoneCurve& curve, + bool colored, const CGAL::IO::Color& c) { - const auto* traits = this->m_aos.geometry_traits(); - auto approx = traits->approximate_2_object(); - draw_approximate_curve(curve, approx); - return; - } - draw_exact_curve(curve); -#else - const auto* traits = this->m_aos.geometry_traits(); - draw_curve_impl1(curve, *traits, 0); -#endif - } - - /*! Compile time dispatching - */ + /* Check whether the traits has a member function called + * approximate_2_object() and if so check whether the return type, namely + * `Approximate_2` has an appropriate operator. + * + * C++20 supports concepts and `requires` expression; see, e.g., + * https://en.cppreference.com/w/cpp/language/constraints; thus, the first + * condition above can be elegantly verified as follows: + * constexpr bool has_approximate_2_object = + * requires(const Gt& traits) { traits.approximate_2_object(); }; + * + * C++17 has experimental constructs called is_detected and + * is_detected_v that can be used to achieve the same goal. + * + * For now we use C++14 features. + */ #if 0 - template - void draw_point_impl2(const Point& p, T const&, long) { add_point(p); } - - template - auto draw_point_impl2(const Point& p, T const& approx, int) -> - decltype(approx.operator()(p), void()) - { add_point(approx(p)); } - - template - void draw_point_impl1(const Point& p, T const&, long) { add_point(p); } - - template - auto draw_point_impl1(const Point& p, T const& traits, int) -> - decltype(traits.approximate_2_object(), void()) { - using Approximate = typename Gt::Approximate_2; - draw_point_impl2(p, traits.approximate_2_object(), true); - } + if constexpr (std::experimental::is_detected_v) + { + const auto* traits = this->m_aos.geometry_traits(); + auto approx = traits->approximate_2_object(); + draw_approximate_curve(curve, approx); + return; + } + draw_exact_curve(curve); #else - template - void draw_point_impl1(const Point& p, T const& traits, int) - { add_point(traits.approximate_2_object()(p)); } + const auto* traits = this->m_aos.geometry_traits(); + draw_curve_impl1(curve, *traits, 0, colored, c); #endif - - template - void draw_point_impl1 - (const Point& p, - Arr_geodesic_arc_on_sphere_traits_2 const& traits, - int) { - auto approx = traits.approximate_2_object(); - using Traits = Arr_geodesic_arc_on_sphere_traits_2; - using Ak = typename Traits::Approximate_kernel; - using Approx_point_3 = typename Ak::Point_3; - auto ap = approx(p); - auto x = ap.dx(); - auto y = ap.dy(); - auto z = ap.dz(); - auto l = std::sqrt(x*x + y*y + z*z); - Approx_point_3 p3(x/l, y/l, z/l); - add_point(p3); - } - - /*! Draw a point. - */ - void draw_point(const Point& p) { - const auto* traits = m_aos.geometry_traits(); - draw_point_impl1(p, *traits, 0); - } - - /*! Add a Connected Component of the Boundary. - */ - void add_ccb(Ccb_halfedge_const_circulator circ) { - // std::cout << "add_ccb()\n"; - auto curr = circ; - do { - auto new_face = curr->twin()->face(); - if (m_visited.find(new_face) != m_visited.end()) continue; - m_visited[new_face] = true; - add_face(new_face); - } while (++curr != circ); - } - - /*! Add a face. - */ - void add_face(Face_const_handle face) { - // std::cout << "add_face()\n"; - using Inner_ccb_const_iterator = typename Aos::Inner_ccb_const_iterator; - using Outer_ccb_const_iterator = typename Aos::Outer_ccb_const_iterator; - - for (Inner_ccb_const_iterator it = face->inner_ccbs_begin(); - it != face->inner_ccbs_end(); ++it) - add_ccb(*it); - - for (Outer_ccb_const_iterator it = face->outer_ccbs_begin(); - it != face->outer_ccbs_end(); ++it) { - add_ccb(*it); - draw_region(*it); } - } - //! - virtual void keyPressEvent(QKeyEvent* e) { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } + protected: + Arr& m_aos; + CGAL::Graphics_scene& m_gs; + const GSOptions& m_gso; + std::unordered_map m_visited; + }; - // Call: * add_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing +} // namespace draw_function_for_arrangement_2 - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } +#define CGAL_ARR_TYPE CGAL::Arrangement_on_surface_2 -protected: - //! The window width in pixels. - int m_width = CGAL_BASIC_VIEWER_INIT_SIZE_X; +template +void add_to_graphics_scene(const CGAL_ARR_TYPE& aos, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso) +{ + draw_function_for_arrangement_2::Draw_arr_tool dar(aos, graphics_scene, gso); + dar.add_elements(); +} - //! The window height in pixels. - int m_height = CGAL_BASIC_VIEWER_INIT_SIZE_Y; - - //! The ratio between pixel and opengl units (in world coordinate system). - double m_pixel_ratio = 1; - - //! The arrangement to draw. - const Aos& m_aos; - - //! The color generator. - Color_generator m_color_generator; - - std::unordered_map m_visited; -}; - -//! Basic viewer of a 2D arrangement. -template -class Aos_2_viewer_qt : public Aos_2_basic_viewer_qt { -public: - using Aos = ArrangementOnSurface_2; - using Color_generator = ColorGenerator; - using Base = Aos_2_basic_viewer_qt; - using Point = typename Aos::Point_2; - using X_monotone_curve = typename Aos::X_monotone_curve_2; - using Halfedge_const_handle = typename Aos::Halfedge_const_handle; - using Face_const_handle = typename Aos::Face_const_handle; - using Ccb_halfedge_const_circulator = - typename Aos::Ccb_halfedge_const_circulator; - - /// Construct the viewer. - /// @param arr the arrangement to view - /// @param title the title of the window - Aos_2_viewer_qt(QWidget* parent, const Aos& aos, - Color_generator color_generator, - const char* title = "2D Arrangement on Surface Basic Viewer", - bool draw_vertices = false) : - Base(parent, aos, color_generator, title, draw_vertices) - {} -}; - -/*! Draw an arrangement on surface. - */ template -void draw(const Arrangement_on_surface_2& aos, - const char* title = "2D Arrangement on Surface Basic Viewer", - bool draw_vertices = false) { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif +void add_to_graphics_scene(const CGAL_ARR_TYPE& aos, + CGAL::Graphics_scene& graphics_scene) +{ + CGAL::Graphics_scene_options + gso; + gso.colored_face=[](const CGAL_ARR_TYPE&, + typename CGAL_ARR_TYPE::Face_const_handle) -> bool + { return true; }; - if (cgal_test_suite) return; - using Gt = GeometryTraits_2; - using Tt = TopologyTraits; - using Aos = CGAL::Arrangement_on_surface_2; - using Viewer = Aos_2_viewer_qt; + gso.face_color=[](const CGAL_ARR_TYPE&, + typename CGAL_ARR_TYPE::Face_const_handle fh) -> CGAL::IO::Color + { + CGAL::Random random((unsigned int)(std::size_t)(&*fh)); + return get_random_color(random); + }; - CGAL::Qt::init_ogl_context(4,3); - - int argc = 1; - const char* argv[2] = {"t2_viewer", nullptr}; - QApplication app(argc, const_cast(argv)); - Default_color_generator color_generator; - Viewer mainwindow(app.activeWindow(), aos, color_generator, title, - draw_vertices); - mainwindow.add_elements(); - mainwindow.show(); - app.exec(); + add_to_graphics_scene(aos, graphics_scene, gso); } -/*! Draw an arrangement. - */ -template -void draw(const Arrangement_2& arr, - const char* title = "2D Arrangement Basic Viewer", - bool draw_vertices = false) { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif +#ifdef CGAL_USE_BASIC_VIEWER - if (cgal_test_suite) return; - using Gt = GeometryTraits_2; - using Arr = CGAL::Arrangement_2; - using Viewer = Aos_2_viewer_qt; - - CGAL::Qt::init_ogl_context(4,3); - - int argc = 1; - const char* argv[2] = {"t2_viewer", nullptr}; - QApplication app(argc, const_cast(argv)); - Default_color_generator color_generator; - Viewer mainwindow(app.activeWindow(), arr, color_generator, title, - draw_vertices); - mainwindow.add_elements(); - mainwindow.show(); - app.exec(); -} - -/*! Draw an arrangement using a given color generator. - */ -template -void draw(const Arrangement_2& arr, - ColorGenerator color_generator, - const char* title = "2D Arrangement Basic Viewer", - bool draw_vertices = false) { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (cgal_test_suite) return; - - using Color_generator = ColorGenerator; - using Gt = GeometryTraits_2; - using Arr = CGAL::Arrangement_2; - using Viewer = Aos_2_viewer_qt; - - CGAL::Qt::init_ogl_context(4,3); - - int argc = 1; - const char* argv[2] = {"t2_viewer", nullptr}; - QApplication app(argc, const_cast(argv)); - Viewer mainwindow(app.activeWindow(), arr, color_generator, title, - draw_vertices); - mainwindow.add_elements(); - mainwindow.show(); - app.exec(); -} +/// Draw an arrangement on surface. +template +void draw(const CGAL_ARR_TYPE& aos, const GSOptions& gso, + const char* title = "2D Arrangement on Surface Basic Viewer") +{ + CGAL::Graphics_scene graphics_scene; + add_to_graphics_scene(aos, graphics_scene, gso); + draw_graphics_scene(graphics_scene, title); } -#endif +template +void draw(const CGAL_ARR_TYPE& aos, + const char* title = "2D Arrangement on Surface Basic Viewer") +{ + CGAL::Graphics_scene graphics_scene; + add_to_graphics_scene(aos, graphics_scene); + draw_graphics_scene(graphics_scene, title); +} + +#endif // CGAL_USE_BASIC_VIEWER + +#undef CGAL_ARR_TYPE + +} // namespace CGAL + #endif diff --git a/Arrangement_on_surface_2/package_info/Arrangement_on_surface_2/dependencies b/Arrangement_on_surface_2/package_info/Arrangement_on_surface_2/dependencies index a723fb58f63..c830d4b62e7 100644 --- a/Arrangement_on_surface_2/package_info/Arrangement_on_surface_2/dependencies +++ b/Arrangement_on_surface_2/package_info/Arrangement_on_surface_2/dependencies @@ -3,6 +3,7 @@ Algebraic_kernel_d Arithmetic_kernel Arrangement_on_surface_2 BGL +Basic_viewer CGAL_Core Cartesian_kernel Circular_kernel_2 @@ -10,7 +11,6 @@ Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView HalfedgeDS Hash_map Homogeneous_kernel diff --git a/BGL/doc/BGL/BGL.txt b/BGL/doc/BGL/BGL.txt index cf7e8a73903..96be1186c66 100644 --- a/BGL/doc/BGL/BGL.txt +++ b/BGL/doc/BGL/BGL.txt @@ -510,11 +510,12 @@ Dynamic property tags, such as `dynamic_vertex_property_t`, are a generalization value type of the dynamic property map, and a default value. `boost::property_map::%type` is used to obtain the type of the dynamic property map for a graph of type `G`, for a -dynamic property tag `T`. This type must be default constructible and assignable. +dynamic property tag `T`. This type must be assignable, and if no +default is provided it must be default constructible. As for ordinary properties, the function `%get()` is overloaded and serves for retrieving a property map for a given graph and dynamic property tag, as well as for retrieving a value for a given key and -property map. +property map. The default value is provided as third parameter. The following example shows how to attach a `string` property to vertices and a `double` value to the halfedges of a graph. diff --git a/BGL/doc/BGL/Doxyfile.in b/BGL/doc/BGL/Doxyfile.in index 72d3e79168c..f37650c983f 100644 --- a/BGL/doc/BGL/Doxyfile.in +++ b/BGL/doc/BGL/Doxyfile.in @@ -34,6 +34,7 @@ ALIASES += "bgllink{1}= EXTRACT_ALL=NO HIDE_UNDOC_MEMBERS = YES HIDE_UNDOC_CLASSES = YES +WARN_IF_INCOMPLETE_DOC = NO # macros to be used inside the code ALIASES += "cgalAssociatedTypesBegin=
Associated Types
" diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt index 6032e29a6c9..89497261a96 100644 --- a/BGL/doc/BGL/PackageDescription.txt +++ b/BGL/doc/BGL/PackageDescription.txt @@ -449,6 +449,9 @@ the requirement for traversal of all faces in a graph. /// \defgroup PkgBGLHelperFct Helper Functions /// \ingroup PkgBGLRef +/// \defgroup PkgBGLGeneratorFct Generator Functions +/// \ingroup PkgBGLRef + /// \defgroup PkgBGLIterators Iterators and Circulators /// \ingroup PkgBGLRef @@ -520,7 +523,14 @@ by attaching and initializing external IDs to the elements of the graph. Generic convenience functions for testing if an edge is a border edge, if a mesh is triangular, for conversion between models of different `FaceGraph` concepts, etc. -Most functions are in the header file `` +All functions are in the header file `` +*/ + +/*! +\addtogroup PkgBGLGeneratorrFct +Generic convenience functions for generating meshes such as a triangle, a quad, or a grid. + +All functions are in the header file `` */ /*! @@ -667,6 +677,7 @@ user might encounter. - `CGAL::is_valid_face_graph()` - `CGAL::is_valid_polygon_mesh()` +\cgalCRPSection{Generator Functions} - `CGAL::is_tetrahedron()` - `CGAL::is_hexahedron()` - `CGAL::make_triangle()` diff --git a/BGL/examples/BGL_graphcut/face_selection_borders_regularization_example.cpp b/BGL/examples/BGL_graphcut/face_selection_borders_regularization_example.cpp index c9671dd408e..38de21612d5 100644 --- a/BGL/examples/BGL_graphcut/face_selection_borders_regularization_example.cpp +++ b/BGL/examples/BGL_graphcut/face_selection_borders_regularization_example.cpp @@ -2,7 +2,7 @@ #include #include #include - +#include #include #include diff --git a/BGL/examples/BGL_surface_mesh/gwdwg.cpp b/BGL/examples/BGL_surface_mesh/gwdwg.cpp index f9a7228f711..aaa5eb333bf 100644 --- a/BGL/examples/BGL_surface_mesh/gwdwg.cpp +++ b/BGL/examples/BGL_surface_mesh/gwdwg.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include diff --git a/BGL/examples/BGL_surface_mesh/write_inp.cpp b/BGL/examples/BGL_surface_mesh/write_inp.cpp index 7554bed208d..aedd8f539fb 100644 --- a/BGL/examples/BGL_surface_mesh/write_inp.cpp +++ b/BGL/examples/BGL_surface_mesh/write_inp.cpp @@ -1,5 +1,6 @@ #include #include +#include #include diff --git a/BGL/include/CGAL/boost/graph/generators.h b/BGL/include/CGAL/boost/graph/generators.h index a4e91f177fb..6454253811d 100644 --- a/BGL/include/CGAL/boost/graph/generators.h +++ b/BGL/include/CGAL/boost/graph/generators.h @@ -19,23 +19,15 @@ #include #include +#include +#include +#include + #include #include #include namespace CGAL { -namespace Euler { - -// Some forward declaration to break the helpers.h > generators.h > Euler_operations.h cycle -template< typename Graph> -void fill_hole(typename boost::graph_traits::halfedge_descriptor h, - Graph& g); - -template -typename boost::graph_traits::face_descriptor add_face(const VertexRange& vr, - Graph& g); - -} // namespace Euler namespace internal { @@ -126,7 +118,7 @@ random_face_in_mesh(const Graph& g, CGAL::Random& rnd = get_default_random()) } // namespace internal /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * * \brief creates an isolated triangle * with its vertices initialized to `p0`, `p1` and `p2`, and adds it to the graph `g`. @@ -256,7 +248,7 @@ struct Default_grid_maker } // namespace internal /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * * \brief creates an isolated quad with * its vertices initialized to `p0`, `p1`, `p2`, and `p3`, and adds it to the graph `g`. @@ -287,17 +279,35 @@ make_quad(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g) } /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * \brief creates an isolated hexahedron * with its vertices initialized to `p0`, `p1`, ...\ , and `p7`, and adds it to the graph `g`. * \image html hexahedron.png * \image latex hexahedron.png - * \returns the halfedge that has the target vertex associated with `p0`, in the face with the vertices with the points `p0`, `p1`, `p2`, and `p3`. + * \returns the halfedge that has the target vertex associated with `p0`, + * in the face with the vertices with the points `p0`, `p1`, `p2`, and `p3` + * (or `p0`, `p2` and `p3` when `do_not_triangulate` is set to `false`). + * + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" + * among the ones listed below + * \cgalNamedParamsBegin + * \cgalParamNBegin{do_not_triangulate_faces} + * \cgalParamDescription{a Boolean used to specify whether the hexadron's faces + * should be triangulated or not. + * The default value is `true`, and faces are not triangulated.} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalNamedParamsEnd **/ -template +template typename boost::graph_traits::halfedge_descriptor make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3, - const P& p4, const P& p5, const P& p6, const P& p7, Graph& g) + const P& p4, const P& p5, const P& p6, const P& p7, + Graph& g, + const NamedParameters& np = parameters::default_values()) { typedef typename boost::graph_traits Traits; typedef typename Traits::halfedge_descriptor halfedge_descriptor; @@ -306,6 +316,9 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3, typedef typename boost::property_map::type Point_property_map; Point_property_map ppmap = get(CGAL::vertex_point, g); + const bool triangulate = !parameters::choose_parameter( + parameters::get_parameter(np, internal_np::do_not_triangulate_faces), true); + vertex_descriptor v0, v1, v2, v3, v4, v5, v6, v7; v0 = add_vertex(g); v1 = add_vertex(g); @@ -326,6 +339,14 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3, halfedge_descriptor ht = internal::make_quad(v4, v5, v6, v7, g); halfedge_descriptor hb = prev(internal::make_quad(v0, v3, v2, v1, g), g); + + std::array he_faces; + if(triangulate) + { + he_faces[0] = hb; + he_faces[1] = ht; + } + for(int i=0; i <4; ++i) { halfedge_descriptor h = halfedge(add_edge(g), g); @@ -342,14 +363,72 @@ make_hexahedron(const P& p0, const P& p1, const P& p2, const P& p3, for(int i=0; i <4; ++i) { Euler::fill_hole(opposite(hb, g), g); + if(triangulate) + he_faces[i+2] = opposite(hb, g); hb = next(hb, g); } + if(triangulate) + { + for (halfedge_descriptor hi : he_faces) + { + halfedge_descriptor nnhi = next(next(hi, g), g); + Euler::split_face(hi, nnhi, g); + } + } + return next(next(hb, g), g); } /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct + * \brief creates an isolated hexahedron + * equivalent to `c`, and adds it to the graph `g`. + * \returns the halfedge that has the target vertex associated with `c.min()`, + * aligned with x-axis, + * in the bottom face of the cuboid. + * + * \tparam IsoCuboid a model of `IsoCuboid_3` + * \tparam Graph a model of `MutableFaceGraph` + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * \param c the iso-cuboid describing the geometry of the hexahedron + * \param g the graph to which the hexahedron will be appended + * \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" + * among the ones listed below + * \cgalNamedParamsBegin + * \cgalParamNBegin{do_not_triangulate_faces} + * \cgalParamDescription{a Boolean used to specify whether the hexadron's faces + * should be triangulated or not. + * The default value is `true`, and faces are not triangulated.} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class model of `Kernel`.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + **/ +template +typename boost::graph_traits::halfedge_descriptor +make_hexahedron(const IsoCuboid& c, + Graph& g, + const NamedParameters& np = parameters::default_values()) +{ + using GT = typename GetGeomTraits::type; + GT gt = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits)); + typename GT::Construct_vertex_3 v = gt.construct_vertex_3_object(); + + return CGAL::make_hexahedron(v(c, 0), v(c, 1), v(c, 2), v(c, 3), + v(c, 4), v(c, 5), v(c, 6), v(c, 7), + g, + np); +} + +/** + * \ingroup PkgBGLGeneratorFct * \brief creates an isolated tetrahedron * with its vertices initialized to `p0`, `p1`, `p2`, and `p3`, and adds it to the graph `g`. * \image html tetrahedron.png @@ -447,7 +526,7 @@ make_tetrahedron(const P& p0, const P& p1, const P& p2, const P& p3, Graph& g) } /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * * \brief creates a triangulated regular prism, outward oriented, * having `nb_vertices` vertices in each of its bases and adds it to the graph `g`. @@ -547,7 +626,7 @@ make_regular_prism(typename boost::graph_traits::vertices_size_type nb_ve } /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * \brief creates a pyramid, outward oriented, having `nb_vertices` vertices in its base and adds it to the graph `g`. * * If `center` is `(0, 0, 0)`, then the first point of the base is `(radius, 0, 0)` @@ -635,7 +714,7 @@ make_pyramid(typename boost::graph_traits::vertices_size_type nb_vertices } /** - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * * \brief creates an icosahedron, outward oriented, centered in `center` and adds it to the graph `g`. * @@ -730,7 +809,7 @@ make_icosahedron(Graph& g, } /*! - * \ingroup PkgBGLHelperFct + * \ingroup PkgBGLGeneratorFct * * \brief creates a row major ordered grid with `i` cells along the width and `j` cells * along the height and adds it to the graph `g`. diff --git a/BGL/include/CGAL/boost/graph/helpers.h b/BGL/include/CGAL/boost/graph/helpers.h index 43016f9889f..32b99ba397d 100644 --- a/BGL/include/CGAL/boost/graph/helpers.h +++ b/BGL/include/CGAL/boost/graph/helpers.h @@ -1081,8 +1081,5 @@ int halfedge_index_in_face(typename boost::graph_traits::halfedge_descrip } // namespace CGAL -// Here at the bottom because helpers.h must include generators (for backward compatibility reasons), -// and Euler_operations.h needs helpers.h -#include #endif // CGAL_BOOST_GRAPH_HELPERS_H diff --git a/BGL/include/CGAL/draw_face_graph.h b/BGL/include/CGAL/draw_face_graph.h index 7e1de8031ec..11c1da1d618 100644 --- a/BGL/include/CGAL/draw_face_graph.h +++ b/BGL/include/CGAL/draw_face_graph.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 GeometryFactory (France) +// Copyright (c) 2018-2022 GeometryFactory (France) // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -9,199 +9,151 @@ // // Author(s) : Guillaume Damiand // Laurent Rineau +// Mostafa Ashraf #ifndef CGAL_DRAW_FACE_GRAPH_H #define CGAL_DRAW_FACE_GRAPH_H -#ifdef CGAL_USE_BASIC_VIEWER - +#include +#include #include #include #include namespace CGAL { -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorFaceGraph +namespace draw_function_for_FG { + +template +void compute_elements(const FG &fg, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gs_options) { - template - CGAL::IO::Color operator()(const Graph& /*g*/, - typename boost::graph_traits::face_descriptor /*f*/) const + using Point=typename boost::property_map_value::type; + using Kernel = typename CGAL::Kernel_traits::Kernel; + using Vector = typename Kernel::Vector_3; + + auto vnormals = get(CGAL::dynamic_vertex_property_t(), fg); + auto point_pmap = get(CGAL::vertex_point, fg); + for (auto v : vertices(fg)) { - return get_random_color(CGAL::get_default_random()); - } - - // edges and vertices are black by default - template - CGAL::IO::Color operator()(const Graph& /*g*/, - typename boost::graph_traits::edge_descriptor /*e*/) const - { - return IO::black(); - } - - template - CGAL::IO::Color operator()(const Graph& /*g*/, - typename boost::graph_traits::vertex_descriptor /*v*/) const - { - return IO::black(); - } -}; - -class SimpleFaceGraphViewerQt : public Basic_viewer_qt -{ - using Base = Basic_viewer_qt; - -public: - SimpleFaceGraphViewerQt(QWidget* parent) : - Base(parent, "", false, true, true, true, false), - m_compute_elements_impl([]{}) - { - } - - /// Construct the viewer. - /// @param g the face graph to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big objects where this time could be long) - template - SimpleFaceGraphViewerQt(QWidget* parent, - const Graph& g, - const char* title="Basic Face Graph Viewer", - bool anofaces=false) : - SimpleFaceGraphViewerQt(parent, g, title, anofaces, DefaultColorFunctorFaceGraph()) - { - } - - template - SimpleFaceGraphViewerQt(QWidget* parent, - const Graph& g, - const char* title, - bool anofaces, - ColorFunctor fcolor) : - // First draw: no vertex; edges, faces; mono-color; inverse normal - Base(parent, title, false, true, true, true, false), - m_compute_elements_impl(compute_elements_functor(g, anofaces, fcolor)) - { - } - - void init() override { - compute_elements(); - Base::init(); - } - - void compute_elements() { - m_compute_elements_impl(); - } - - template - void set_face_graph(const Graph& g, - bool anofaces, - ColorFunctor fcolor) { - m_compute_elements_impl = compute_elements_functor(g, anofaces, fcolor); - } - - template - void set_face_graph(const Graph& g, - bool anofaces=false) { - set_mesh(g, anofaces, DefaultColorFunctorFaceGraph()); - } -protected: - template - std::function - compute_elements_functor(const Graph& g, - bool anofaces, - ColorFunctor fcolor) - { - using Point = typename boost::property_map_value::type; - using Kernel = typename CGAL::Kernel_traits::Kernel; - using Vector = typename Kernel::Vector_3; - - auto vnormals = get(CGAL::dynamic_vertex_property_t(), g); - auto point_pmap = get(CGAL::vertex_point, g); - for (auto v : vertices(g)) + Vector n(NULL_VECTOR); + int i = 0; + for (auto h : halfedges_around_target(halfedge(v, fg), fg)) { - Vector n(NULL_VECTOR); - int i=0; - for (auto h : halfedges_around_target(halfedge(v, g), g)) + if (!is_border(h, fg)) { - if (!is_border(h, g)) + Vector ni = CGAL::cross_product( + Vector(get(point_pmap, source(h, fg)), + get(point_pmap, target(h, fg))), + Vector(get(point_pmap, target(h, fg)), + get(point_pmap, target(next(h, fg), fg)))); + if (ni!=NULL_VECTOR) { - Vector ni = CGAL::cross_product( - Vector(get(point_pmap, source(h, g)), get(point_pmap, target(h, g))), - Vector(get(point_pmap, target(h, g)), get(point_pmap, target(next(h, g), g)))); - if (ni != NULL_VECTOR) - { - n+=ni; - ++i; - } + n += ni; + ++i; } } - put(vnormals, v, n/i); } - - // This function return a lambda expression, type-erased in a - // `std::function` object. - return [this, &g, vnormals, anofaces, fcolor, point_pmap]() - { - this->clear(); - - if (!anofaces) - { - for (auto fh: faces(g)) - { - const CGAL::IO::Color& c = fcolor(g, fh); - face_begin(c); - auto hd=halfedge(fh, g); - const auto first_hd = hd; - do - { - auto v = source(hd, g); - add_point_in_face(get(point_pmap, v), get(vnormals, v)); - hd=next(hd, g); - } - while(hd!=first_hd); - face_end(); - } - } - - for (auto e: edges(g)) - { - const CGAL::IO::Color& c = fcolor(g, e); - add_segment(get(point_pmap, source(halfedge(e, g), g)), - get(point_pmap, target(halfedge(e, g), g)), - c); - } - - for (auto v: vertices(g)) - { - const CGAL::IO::Color& c = fcolor(g, v); - this->add_point(get(point_pmap, v), c); - } - }; + put(vnormals, v, n / i); } - void keyPressEvent(QKeyEvent *e) override + if (gs_options.are_faces_enabled()) { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); + for (auto fh : faces(fg)) + { + if (fh != boost::graph_traits::null_face() && // face exists + gs_options.draw_face(fg, fh)) // face is drawn + { + if(gs_options.colored_face(fg, fh)) // face is colored + { graphics_scene.face_begin(gs_options.face_color(fg, fh)); } + else + { graphics_scene.face_begin(); } + auto hd = halfedge(fh, fg); + const auto first_hd = hd; + do + { + auto v = source(hd, fg); + graphics_scene.add_point_in_face(get(point_pmap, v), get(vnormals, v)); + hd = next(hd, fg); + } + while (hd != first_hd); + graphics_scene.face_end(); + } + } } -protected: - std::function m_compute_elements_impl; -}; + if(gs_options.are_edges_enabled()) + { + for (auto e : edges(fg)) + { + if(gs_options.colored_edge(fg, e)) // edge is colored + { + graphics_scene.add_segment(get(point_pmap, source(halfedge(e, fg), fg)), + get(point_pmap, target(halfedge(e, fg), fg)), + gs_options.edge_color(fg, e)); + } + else + { + graphics_scene.add_segment(get(point_pmap, source(halfedge(e, fg), fg)), + get(point_pmap, target(halfedge(e, fg), fg))); + } + } + } + + if(gs_options.are_vertices_enabled()) + { + for (auto v : vertices(fg)) + { + if(gs_options.colored_vertex(fg, v)) // vertex is colored + { + graphics_scene.add_point(get(point_pmap, v), + gs_options.vertex_color(fg, v)); + } + else + { + graphics_scene.add_point(get(point_pmap, v)); + } + } + } +} + +} // draw_function_for_FG + +template +void add_to_graphics_scene_for_fg(const FG &fg, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gs_options) +{ + draw_function_for_FG::compute_elements(fg, graphics_scene, gs_options); +} + +template +void add_to_graphics_scene_for_fg(const FG &fg, + CGAL::Graphics_scene &graphics_scene) +{ + Graphics_scene_options::vertex_descriptor, + typename boost::graph_traits::edge_descriptor, + typename boost::graph_traits::face_descriptor> + gs_options; + + gs_options.colored_face = [](const FG&, + typename boost::graph_traits::face_descriptor) -> bool + { return true; }; + + gs_options.face_color = [] (const FG&, + typename boost::graph_traits::face_descriptor fh) -> CGAL::IO::Color + { + if (fh==boost::graph_traits::null_face()) + { return CGAL::IO::Color(100, 125, 200); } + + return get_random_color(CGAL::get_default_random()); + }; + + add_to_graphics_scene_for_fg(fg, graphics_scene, gs_options); +} } // End namespace CGAL -#endif // CGAL_USE_BASIC_VIEWER - #endif // CGAL_DRAW_SURFACE_MESH_H diff --git a/BGL/test/BGL/next.cpp b/BGL/test/BGL/next.cpp index fd69cc00304..4332aa86637 100644 --- a/BGL/test/BGL/next.cpp +++ b/BGL/test/BGL/next.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include typedef CGAL::Exact_predicates_exact_constructions_kernel K; typedef K::Point_3 Point_3; diff --git a/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp b/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp index a8f84f6e654..34d704bb679 100644 --- a/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp +++ b/BGL/test/BGL/test_Collapse_edge_with_constraints.cpp @@ -1,6 +1,7 @@ #include #include #include +#include typedef CGAL::Simple_cartesian K; typedef K::Point_3 Point_3; diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index fe7c3275dd1..3fdcfe0edec 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -2,6 +2,7 @@ #include "test_Prefix.h" #include #include +#include #include #include diff --git a/BGL/test/BGL/test_Face_filtered_graph.cpp b/BGL/test/BGL/test_Face_filtered_graph.cpp index 9623d2868bd..9917b7d06a5 100644 --- a/BGL/test/BGL/test_Face_filtered_graph.cpp +++ b/BGL/test/BGL/test_Face_filtered_graph.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "test_Prefix.h" diff --git a/BGL/test/BGL/test_test_face.cpp b/BGL/test/BGL/test_test_face.cpp index aa4e0fa0879..7afbc79385b 100644 --- a/BGL/test/BGL/test_test_face.cpp +++ b/BGL/test/BGL/test_test_face.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include diff --git a/Barycentric_coordinates_2/package_info/Barycentric_coordinates_2/dependencies b/Barycentric_coordinates_2/package_info/Barycentric_coordinates_2/dependencies index 1ea1e70b883..09b948be599 100644 --- a/Barycentric_coordinates_2/package_info/Barycentric_coordinates_2/dependencies +++ b/Barycentric_coordinates_2/package_info/Barycentric_coordinates_2/dependencies @@ -21,7 +21,6 @@ Number_types Polygon Profiling_tools Property_map -Random_numbers STL_Extension Spatial_sorting Stream_support diff --git a/Basic_viewer/doc/Basic_viewer/Basic_viewer.txt b/Basic_viewer/doc/Basic_viewer/Basic_viewer.txt new file mode 100644 index 00000000000..970ddbd5f5f --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/Basic_viewer.txt @@ -0,0 +1,173 @@ +namespace CGAL { +/*! + +\mainpage User Manual +\anchor Chapter_Basic_viewer +\anchor ChapterBasicViewer + +\author Guillaume Damiand and Mostafa Ashraf +\cgalAutoToc + + +\section BV_Intro Introduction + +The basic viewer package provides interactive visualization for most \cgal packages, such as +\ref PkgArrangementOnSurface2Ref "2D Arrangements", +\ref PkgBooleanSetOperations2Ref "2D Boolean Set", +\ref PkgLinearCellComplexRef "Linear cell complex", +\ref PkgNef3Ref "3D Nef", +\ref PkgPeriodic2Triangulation2Ref "2D Periodic Triangulations", +\ref PkgPointSet3Ref "3D Point Set", +\ref PkgPolygon2Ref "2D Polygon", +\ref PkgPolyhedronRef "3D Polyhedral Surface", +\ref PkgStraightSkeleton2Ref "2D Straight Skeleton", +\ref PkgSurface_mesh "Surface Mesh", +\ref PkgTriangulation2Ref "2D Triangulation", +\ref PkgTriangulation3Ref "3D Triangulation", +\ref PkgVoronoiDiagram2Ref "2D Voronoi Diagram", +and more. + +The most simple use case of the basic viewer is the call of the global `draw()` function. There is one draw function for each \cgal package. Such a call opens a new interactive window showing the given model and allowing to navigate in the scene, show or hide some specific cells, show the interior of the model if any, etc. + +The drawing can be tuned using `Graphics_scene_options`, for example to change the color of some cells or hide some cells. + +More complex usage can be achieved by using the `Graphics_scene` class. Different \cgal data structures can be added in a same `Graphics_scene` allowing to visualize them simultaneously in a same window. Like for the draw function, the drawing parameters can be tuned thanks to the `Graphics_scene_options`. + +Two classes are based on \qt. + - `CGAL::Qt::Basic_viewer` is a \qt widget that inherits from `QGLViewer` (libQGLViewer is an open source C++ library based on \qt that eases the creation of OpenGL 3D viewers). + - `CGAL::Qt::QApplication_and_basic_viewer` which regroups a `Qt::QApplication` and a `CGAL::Qt::Basic_viewer`. + + +\section BV_SoftwareDesign Software Design + +The diagram in \cgalFigureRef{fig_basic_viewer_diagram_class} shows the main classes and functions of this package. + +\cgalFigureBegin{fig_basic_viewer_diagram_class,basic_viewer_diagramme_class.svg} +UML diagram of the classes and functions of the package (only partial representation). +\cgalFigureEnd + + +\section BV_BasicUsage Basic Usage: The Global Draw Functions + +A first simple solution provided to draw the different data structures of \cgal is the global `draw()` function. This function is templated by the type of the data structure to draw. The following example shows how it can be used. + +\cgalExample{Basic_viewer/draw_lcc.cpp} + +This example creates a 3D linear cell complex of a hexahedron, and draws it. The result is shown in the following figure. + +\cgalFigureBegin{basic_viewer_ex1,lcc_draw.png} +Example of drawing of a 3D LCC. +\cgalFigureEnd + +Users can interact with the viewer using some specific keys or mouse interactions. Pressing key 'h' makes pop up a help window showing the different shortcuts and mouse interactions. The main functionalities of the viewer are: + +
    +
  • Versatile Rendering: + +The viewer supports the rendering of various geometric elements, such as points, edges, faces, rays, and lines. +Different rendering modes, including mono and colored representation, are available for these elements.
  • + +
  • Camera Control: + +The viewer allows users to move the camera, switch between 2D and 3D viewing modes, adjusting the camera accordingly. +Camera settings, such as orthographic or perspective projection, can be configured based on the dimension of the scene.
  • + +
  • User Interaction: + +Users can interact with the viewer through keyboard inputs, enabling them to control rendering options, toggle the display of elements, and adjust visual parameters. +Key presses are mapped to specific actions, such as toggling the clipping plane, changing rendering modes, adjusting the size of elements, and modifying ambient light color.
  • + +
  • Clipping Plane: + +The viewer includes support for a clipping plane, enabling users to selectively render parts of the scene. +The clipping plane can be toggled on and off, and its rendering style can be modified (solid, wireframe, etc.).
  • +
+ +\subsection BV_GraphicSceneOptions Tuning with Graphics Scene Options + +There is one specialization of each draw function that takes graphics scene options as additional parameter, allowing to tune the drawing. + +The `Graphics_scene_options` class provides a set of options and customization parameters for rendering geometric structures in a graphics scene. Its main purpose is to allow users to control the visual appearance of various cells such as vertices, edges, faces, and volumes in a graphical representation of a given data structure. + +The following example shows how to use graphics scene options to tune the drawing of a surface mesh. We define our own class `My_graphics_scene_options` that inherits from `Graphics_scene_options` to get all the default parameters. In this class, we only override the two methods `colored_vertex` and `vertex_color` to draw all vertices in color, and chose randomly green or blue colors for one out of two vertices. + +\cgalExample{Basic_viewer/draw_surface_mesh_vcolor.cpp} + +The result of this example can be shown in \cgalFigureRef{basic_viewer_ex2}. + +\cgalFigureBegin{basic_viewer_ex2,draw_surface_mesh_vcolor.png} +Example of tuned drawing of a 3D surface mesh where some vertex colors are changed. +\cgalFigureEnd + +The drawing options can depend on the cells. In the following example the color of each face depends on its height. + +\cgalExample{Basic_viewer/draw_surface_mesh_height.cpp} + +The result of this example is shown in \cgalFigureRef{basic_viewer_ex3}. + +\cgalFigureBegin{basic_viewer_ex3,draw_surface_height.png} +Example of mesh drawing with a color for each face computed depending on its height. +\cgalFigureEnd + + +\section BV_GraphicsScene The Graphics Scene + +It is possible to do more advanced visualizations by using the class `Graphics_scene`. It is a container class for various geometric elements, such as points, segments, rays, lines, faces and texts. It provides several methods to add elements, possibly with individual colors. Things are a little bit different for faces. You must call `face_begin()` to start a new face (possibly with a color), add all the points in the face by using `add_point_in_face()`, and call `face_end()` to finish the face. Note that the given polygonal face is internally triangulated. + +This class also stores the normal of the faces (computed automatically), and possibly the normal of the vertices that can be provided by the users. + +Users can either fill directly a `Graphics_scene` using these methods, or by using a global function `add_to_graphics_scene()` that fills the scene using all the geometric elements of a given \cgal data structure. Like for the draw functions, there is an overload of `add_to_graphics_scene()` for each \cgal package. + +A `Graphics_scene` can be drawn using the basic viewer thanks to the `draw_graphics_scene()` function. + +The following example shows in a same viewer both a `Point_set_3` and a `Polyhedron_3`. Note that, like the draw functions, each `add_to_graphics_scene()` can use an optional `Graphics_scene_options` as parameter allowing to tune the drawing of the given data structure. In the example, we change the color of all vertices of the point set. + +\cgalExample{Basic_viewer/draw_mesh_and_points.cpp} + +The result of this example is shown in \cgalFigureRef{basic_viewer_ex4} where we can see in green the original points of the point cloud, superposed with the polyhedron surface reconstructed by the Poisson surface reconstruction method. + +\cgalFigureBegin{basic_viewer_ex4,draw_mesh_and_points.png} +Example of drawing of a point cloud and a polyhedron in a same viewer. +\cgalFigureEnd + + +\section BV_BasicViewer The Basic Viewer Class + +The class `CGAL::Qt::Basic_viewer` is a \qt widget that inherits from `QGLViewer` and mainly stores a `Graphics_scene` and allows to visualize it and interact with the scene. Since this class is a \qt widget, it can be used into more complex \qt code to create more advanced demos. + +In the following example, we create two graphics scenes, one filled with a point cloud, a second one filled with the polyhedral surface reconstructed by the Poisson surface reconstruction method. Then, we create two basic viewers associated with these two scenes. The two basic viewers are added into a \qt layout allowing to visualize the two scenes side by side. + +\cgalExample{Basic_viewer/draw_several_windows.cpp} + +The result of this example is shown in \cgalFigureRef{basic_viewer_ex5}. + +\cgalFigureBegin{basic_viewer_ex5,draw_several_windows.png} +Example of drawing of two `Basic_viewer` side by side. +\cgalFigureEnd + + + +\section BV_Interactions Adding Interaction + +In the previous examples, the models are only drawn once and there is no interaction with the user to update the drawing. + +It is possible to define such interactions thanks to the class `CGAL::Qt::QApplication_and_basic_viewer`. In this class, you can define your own function that is called automatically by the viewer when a user presses a key. This can be used to change some parameters and update the drawing accordingly. + +We illustrate this possibility in the following example that shows a surface mesh, while coloring the small faces in red. To do so, we use our own graphics scene options than change the color of a face depending on its size. A face is considered small if its size is below a certain threshold. This threshold can be updated by the user, pressing key 'I' to increase it and 'D' to decrease it. This is done in the key pressed function defined in the `QApplication_and_basic_viewer`. When the threshold changes, the graphics scene is recomputed to take the modification of the size threshold into account. + +\cgalExample{Basic_viewer/draw_surface_mesh_small_faces.cpp} + +The result of this example is shown in \cgalFigureRef{basic_viewer_ex6}, showing to the left the initial drawing of the 3D model, and to the right the same model after having changed the size threshold. + +\cgalFigureBegin{basic_viewer_ex6,draw_surface_mesh_small_faces.png} +Two examples of drawing of a mesh with small faces in red. Left: With the initial threshold. Right: After having increased the threshold. +\cgalFigureEnd + + +\section BV_Design Design and Implementation History + +This package was started by Mostafa Ashraf during his 2022 GSoC project. Guillaume Damiand, who mentored the project, reworked large parts of the package, wrote examples and the manual. + +*/ + +} /* namespace CGAL */ diff --git a/Basic_viewer/doc/Basic_viewer/CGAL/Graphics_scene.h b/Basic_viewer/doc/Basic_viewer/CGAL/Graphics_scene.h new file mode 100644 index 00000000000..8d1abd593f8 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/CGAL/Graphics_scene.h @@ -0,0 +1,107 @@ + +namespace CGAL { + +/*! + \ingroup PkgBasicViewerClasses + +The class `Graphics_scene` stores points, segments, triangles, rays, and lines. Elements can be added, possibly with associated colors. Non triangular faces can be directly added and are triangulated internally. + +*/ +class Graphics_scene { +public: + /// adds the given point in the scene. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template + void add_point(const KPoint &p); + + /// adds the given colored point in the scene. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template + void add_point(const KPoint &p, const CGAL::IO::Color &color); + + /// adds the given segment in the scene. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template + void add_segment(const KPoint &p1, const KPoint &p2); + + /// adds the given colored segment in the scene. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template + void add_segment(const KPoint &p1, const KPoint &p2, + const CGAL::IO::Color &color); + + /// adds the given ray in the scene: a half line starting from `p` and having `v` as direction. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + /// \tparam KVector a model of `Kernel::Vector_2` or `Kernel::Vector_3`. + template + void add_ray(const KPoint &p, const KVector &v); + + /// adds the given colored ray in the scene: a half line starting from `p` and having `v` as direction. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + /// \tparam KVector a model of `Kernel::Vector_2` or `Kernel::Vector_3`. + template + void add_ray(const KPoint &p, const KVector &v, + const CGAL::IO::Color &color); + + /// adds the given line in the scene, defined by `p` and `v` as direction. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + /// \tparam KVector a model of `Kernel::Vector_2` or `Kernel::Vector_3`. + template + void add_line(const KPoint &p, const KVector &v); + + /// adds the given colored line in the scene, defined by `p` and `v` as direction. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + /// \tparam KVector a model of `Kernel::Vector_2` or `Kernel::Vector_3`. + template + void add_line(const KPoint &p, const KVector &v, + const CGAL::IO::Color &color); + + /// starts a new face. + void face_begin(); + + /// starts a new colored face. + void face_begin(const CGAL::IO::Color &color); + + /// return `true` iff a face is started. + bool a_face_started() const; + + /// adds the given point in the current face. + /// @pre `a_face_started()` + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template bool add_point_in_face(const KPoint &kp); + + /// adds the given point in the current face, having the vertex normal. + /// @pre `a_face_started()` + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + /// \tparam KVector a model of `Kernel::Vector_2` or `Kernel::Vector_3`. + template + bool add_point_in_face(const KPoint &kp, const KVector &p_normal); + + /// ends the current face. + /// @pre `a_face_started()` + void face_end(); + + /// adds the given text at the given position in the scene. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template + void add_text(const KPoint &kp, const char *txt); + + /// adds the given text at the given position in the scene. + /// \tparam KPoint a model of `Kernel::Point_2`, `Kernel::Point_3`, `Kernel::WeightedPoint_2` or `Kernel::WeightedPoint_3`. + template + void add_text(const KPoint &kp, const std::string &txt); + + /// returns `true` iff the scene has no element. + bool empty() const; + + /// clears the scene, i.e., removes all points, segments, triangles, and text. + void clear(); + + /// returns the bounding box of all the elements in the scene. + const CGAL::Bbox_3& bounding_box() const; + + /// returns `true` if the scene is in 2D, i.e., lies on the XY or XZ or YZ plane. + bool is_two_dimensional() const; +}; + +} // namespace CGAL diff --git a/Basic_viewer/doc/Basic_viewer/CGAL/Graphics_scene_options.h b/Basic_viewer/doc/Basic_viewer/CGAL/Graphics_scene_options.h new file mode 100644 index 00000000000..ac2fa1dc3ed --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/CGAL/Graphics_scene_options.h @@ -0,0 +1,37 @@ + +namespace CGAL { + +/*! +\ingroup PkgBasicViewerClasses + +The class `Graphics_scene_options` is used to tune the way that the cells of a given data structure of \cgal are considered. +The different `std::function` can be modified to change for example the behavior of the drawing. +`VolumeDescriptor` can be `void` for data structures that do not represent volumes. + +This class is a model of `GraphicsSceneOptions` when `VolumeDescriptor` is `void`, or a model of `GraphicsSceneOptionsWithVolumes` otherwise (`VolumeDescriptor` non `void`). + +\tparam DS a data structure of \cgal. +\tparam VertexDescriptor a descriptor of vertices of `DS`. +\tparam EdgeDescriptor a descriptor of edges of `DS`. +\tparam FaceDescriptor a descriptor of faces of `DS`. +\tparam VolumeDescriptor a descriptor of volumes of `DS`. `void` by default. + +\cgalModels{GraphicsSceneOptions or GraphicsSceneOptionsWithVolumes} +*/ + +template +struct Graphics_scene_options +{ +public: + typedef VertexDescriptor vertex_descriptor; + typedef EdgeDescriptor edge_descriptor; + typedef FaceDescriptor face_descriptor; + typedef VolumeDescriptor volume_descriptor; + +}; + +} // End namespace CGAL diff --git a/Basic_viewer/doc/Basic_viewer/CGAL/Qt/Basic_viewer.h b/Basic_viewer/doc/Basic_viewer/CGAL/Qt/Basic_viewer.h new file mode 100644 index 00000000000..6ff91f29739 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/CGAL/Qt/Basic_viewer.h @@ -0,0 +1,177 @@ +namespace CGAL { + namespace Qt { + +//------------------------------------------------------------------------------ +/*! + \ingroup PkgBasicViewerClasses + +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. +*/ +class Basic_viewer : public CGAL::QGLViewer +{ +public: + /// Constructor given a pointer on a `QWidget` (can be a `nullptr`) and a `Graphics_scene`. + /// `title` will be the title of the window. + Basic_viewer(QWidget* parent, + const Graphics_scene& scene, + const char* title=""); + + /// enables or disables the drawing of vertices. + void draw_vertices(bool b); + + /// enables or disables the drawing of edges. + void draw_edges(bool b); + + /// enables or disables the drawing of rays. + void draw_rays(bool b); + + /// enables or disables the drawing of lines. + void draw_lines(bool b); + + /// enables or disables the drawing of faces. + void draw_faces(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 use_mono_color(bool b); + + /// enables or disables the drawing of texts. + void draw_text(bool b); + + /// sets the color used for vertices in mono color mode. + void vertices_mono_color(const CGAL::IO::Color& c); + + /// sets the color used for edges in mono color mode. + void edges_mono_color(const CGAL::IO::Color& c); + + /// sets the color used for rays in mono color mode. + void rays_mono_color(const CGAL::IO::Color& c); + + /// sets the color used for lines in mono color mode. + void lines_mono_color(const CGAL::IO::Color& c); + + /// sets the color used for faces in mono color mode. + void faces_mono_color(const CGAL::IO::Color& c); + + /// toggles the drawing of vertices. + void toggle_draw_vertices(); + + /// toggles the drawing of edges. + void toggle_draw_edges(); + + /// toggles the drawing of rays. + void toggle_draw_rays(); + + /// toggles the drawing of lines. + void toggle_draw_lines(); + + /// toggles the drawing of faces. + void toggle_draw_faces(); + + /// toggles the use of mono color mode. + void toggle_use_mono_color(); + + /// toggles the drawing of text. + void toggle_draw_text(); + + /// returns `true` if vertices are drawn. + bool draw_vertices() const; + + /// returns `true` if edges are drawn. + bool draw_edges() const; + + /// returns `true` if rays are drawn. + bool draw_rays() const; + + /// returns `true` if lines are drawn. + bool draw_lines() const; + + /// returns `true` if faces are drawn. + bool draw_faces() const; + + /// returns `true` if mono color mode is used. + bool use_mono_color() const; + + /// returns `true` if normals are reversed. + bool reverse_normal() const; + + /// returns `true` if text are drawn. + bool draw_text() const; + + /// returns the mono color used for vertices. + const CGAL::IO::Color& vertices_mono_color() const; + + /// returns the mono color used for edges. + const CGAL::IO::Color& edges_mono_color() const; + + /// returns the mono color used for rays. + const CGAL::IO::Color& rays_mono_color() const; + + /// returns the mono color used for lines. + const CGAL::IO::Color& lines_mono_color() const; + + /// returns the mono color used for faces. + const CGAL::IO::Color& faces_mono_color() const; + + /// returns `true` if the clipping plane is enabled. + bool clipping_plane_enabled() const; + + /// returns the clipping plane when it is enabled. + CGAL::Exact_predicates_inexact_constructions_kernel::Plane_3 clipping_plane() const; + + /// returns the graphics scene of the viewer. + const Graphics_scene& graphics_scene() const; + + /// reverses all normals of vertices and faces. + void reverse_all_normals(); + + /// draws the viewer without recomputing all internal buffers. + virtual void draw(); + + /// redraws the viewer, i.e., recompute all internal buffers and update the window. + virtual void redraw(); + + /// Function called when a key is pressed. Users can define their own function in order + /// to add specific behavior. + std::function on_key_pressed; +}; + + +//------------------------------------------------------------------------------ +/*! + \ingroup PkgBasicViewerClasses + +The class `QApplication_and_basic_viewer` regroups a `Basic_viewer` and Qt `QApplication`. The `QApplication` is created in the constructor, but started by the `run()` method. This allows for example users to modify the `on_key_pressed` method of the `Basic_viewer` to define their own behavior. + +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`. + +*/ +class QApplication_and_basic_viewer +{ +public: + /// Constructor given a `Graphics_scene` and possibly a title. + QApplication_and_basic_viewer(const CGAL::Graphics_scene& gs, + const char* title="CGAL Basic Viewer"); + + /// runs the `QApplication`, i.e., open the Qt window. A call to this method is blocking, that is the program continues as soon as the user closes the window. + void run(); + + /// returns a reference to the `Basic_viewer` associated with this. + Basic_viewer& basic_viewer(); +}; + +} // End namespace Qt + +//------------------------------------------------------------------------------ +/*! + \ingroup PkgBasicViewerClasses + + opens a new window and draws the given `Graphics_scene` (which must have been filled before). `title` will be the title of the window. A call to this method is blocking, that is the program continues as soon as the user closes the window. 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. +*/ +void draw_graphics_scene(const Graphics_scene& graphic_scene, + const char *title="CGAL Basic Viewer") +{} + +} // End namespace CGAL + diff --git a/Basic_viewer/doc/Basic_viewer/Concepts/GraphicsSceneOptions.h b/Basic_viewer/doc/Basic_viewer/Concepts/GraphicsSceneOptions.h new file mode 100644 index 00000000000..f845dc79281 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/Concepts/GraphicsSceneOptions.h @@ -0,0 +1,128 @@ +/*! +\ingroup PkgBasicViewerConcepts + +The concept `GraphicsSceneOptions` defines data and methods used to tune the way that the cells of a given data structure of \cgal are considered for drawing or to be added into a graphics scene. +The different `std::function` can be modified to change for example the behavior of the drawing. + +\cgalHasModelsBegin +\cgalHasModelsBare{\link CGAL::Graphics_scene_options `CGAL::Graphics_scene_options`\endlink} +\cgalHasModelsEnd + +*/ +class GraphicsSceneOptions +{ +public: + /*! + A data structure of \cgal. + */ + typedef unspecified_type DS; + + /*! + A descriptor of vertices of `DS` + */ + typedef unspecified_type vertex_descriptor; + + /*! + A descriptor of edges of `DS` + */ + typedef unspecified_type edge_descriptor; + + /*! + A descriptor of faces of `DS` + */ + typedef unspecified_type face_descriptor; + + /// `std::function` that returns `true` if the given vertex must be ignored, `false` otherwise. + /// Returns `false` by default. + std::function ignore_vertex; + + /// `std::function` that returns `true` if the given edge must be ignored, `false` otherwise. + /// Returns `true` by default. + std::function ignore_edge; + + /// `std::function` that returns `true` if the given face must be ignored, `false` otherwise. + /// Returns `true` by default. + std::function ignore_face; + + /// `std::function` that returns `true` if the given vertex is colored, `false` otherwise. + /// Returns `false` by default. + /// For non colored vertices, this is the role of the user of a graphic scene to decide which color must be used (cf. for example `Basic_viewer`, `vertices_mono_color`). + std::function is_vertex_colored; + + /// `std::function` that returns `true` if the given edge is colored, `false` otherwise. + /// For non colored edges, this is the role of the user of a graphic scene to decide which color must be used (cf. for example `Basic_viewer`, `edges_mono_color`). + /// Returns `false` by default. + std::function is_edge_colored; + + /// `std::function` that returns `true` if the given face is colored, `false` otherwise. + /// For non colored faces, this is the role of the user of a graphic scene to decide which color must be used (cf. for example `Basic_viewer`, `faces_mono_color`). + /// Returns `false` by default. + std::function is_face_colored; + + /// `std::function` that returns `true` if the given face is in wireframe, `false` otherwise. + /// Returns `false` by default. + std::function is_face_wireframe; + + /// `std::function` that returns the color of the given vertex. + /// `nullptr` by default. + std::function vertex_color; + + /// `std::function` that returns the color of the given edge. + /// `nullptr` by default. + std::function edge_color; + + /// `std::function` that returns the color of the given face. + /// `nullptr` by default. + std::function face_color; + + /// ignores all vertices when `b` is `true`; otherwise ignores only vertices for which `ignore_vertex()` returns `true`. + void ignore_all_vertices(bool b); + + /// ignores all edges when `b` is `true`; otherwise ignores only edges for which `ignore_edge()` returns `true`. + void ignore_all_edges(bool b); + + /// ignores all faces when `b` is `true`; otherwise ignores only faces for which `ignore_face()` returns `true`. + void ignore_all_faces(bool b); +}; + +/*! +\ingroup PkgBasicViewerConcepts +\cgalConcept + +The concept `GraphicsSceneOptionsWithVolumes` extends the concept `GraphicsSceneOptions` to deal with data structures that represent volumes. + +\cgalRefines{GraphicsSceneOptions} + +\cgalHasModelsBegin +\cgalHasModelsBare{\link CGAL::Graphics_scene_options `CGAL::Graphics_scene_options`\endlink} +\cgalHasModelsEnd + +*/ +class GraphicsSceneOptionsWithVolumes +{ +public: + /*! + %A descriptor of volumes of `DS`. + */ + typedef unspecified_type volume_descriptor; + + /// `std::function` that returns `true` if the given volume must be ignored, `false` otherwise. + /// Returns `false` by default. + std::function ignore_volume; + + /// `std::function` that returns `true` if the given volume is colored, `false` otherwise. + /// For non colored volumes, this is the role of the user of a graphic scene to decide which color must be used (cf. for example `Basic_viewer`, `faces_mono_color`). + /// Returns `false` by default. + std::function is_volume_colored; + + /// `std::function` that returns `true` if the given volume is in wireframe, `false` otherwise. + /// Returns `false` by default. + std::function is_volume_wireframe; + + /// `std::function` that returns the color of the given volume, i.e. the color of all the faces of this volume. + /// `nullptr` by default. + std::function volume_color; + + /// ignores all volumes when `b` is `true`; otherwise ignore only volumes for which `ignore_volume()` returns `true`. + void ignore_all_volumes(bool b); +}; diff --git a/Basic_viewer/doc/Basic_viewer/Doxyfile.in b/Basic_viewer/doc/Basic_viewer/Doxyfile.in new file mode 100644 index 00000000000..8b325940a19 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/Doxyfile.in @@ -0,0 +1,5 @@ +@INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} + +PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - CGAL Basic Viewer" + +EXAMPLE_PATH += ${CGAL_Surface_mesh_EXAMPLE_DIR} \ No newline at end of file diff --git a/Basic_viewer/doc/Basic_viewer/PackageDescription.txt b/Basic_viewer/doc/Basic_viewer/PackageDescription.txt new file mode 100644 index 00000000000..d90a773fed5 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/PackageDescription.txt @@ -0,0 +1,83 @@ +/// \defgroup PkgBasicViewerRef Basic Viewer Reference + +/// \defgroup PkgBasicViewerConcepts Concepts +/// \ingroup PkgBasicViewerRef + +/// \defgroup PkgBasicViewerClasses Classes +/// \ingroup PkgBasicViewerRef + +/*! +\addtogroup PkgBasicViewerRef +\cgalPkgDescriptionBegin{Basic Viewer,PkgBasicViewer} +\cgalPkgPicture{basic_viewer_logo.png} +\cgalPkgSummaryBegin +\cgalPkgAuthor{Guillaume Damiand and Mostafa Ashraf} +\cgalPkgDesc{This package provides interactive visualization for most \cgal packages. +First, the function `draw()` is provided for each data structure. +Several data structures can be added to a same graphics scene and visualized simultaneously. +Rendering can be controlled (color, point size, etc.). +Finally a \qt widget is provided that can be integrated in the GUI of a user application.} +\cgalPkgManuals{Chapter_Basic_viewer,PkgBasicViewerRef} +\cgalPkgSummaryEnd +\cgalPkgShortInfoBegin +\cgalPkgSince{6.0} +\cgalPkgBib{cgal:d-bv} +\cgalPkgLicense{\ref licensesLGPL "LGPL"} +\cgalPkgShortInfoEnd +\cgalPkgDescriptionEnd + +\cgalClassifedRefPages + +\cgalCRPSection{Concepts} +- `GraphicsSceneOptions` +- `GraphicsSceneOptionsWithVolumes` + +\cgalCRPSection{Classes} +- `CGAL::Qt::Basic_viewer` +- `CGAL::Graphics_scene` +- `CGAL::Graphics_scene_options` +- `CGAL::Qt::QApplication_and_basic_viewer` + +\cgalCRPSubsection{Draw a Graphics Scene} + +- `CGAL::draw_graphics_scene()` + +\cgalCRPSubsection{Draw for Different Packages} + +- `CGAL::Arrangement_2` \link PkgArrangementOnSurface2Draw CGAL::draw() \endlink +- `CGAL::Constrained_triangulation_2` \link PkgDrawTriangulation2 CGAL::draw() \endlink +- `CGAL::Linear_cell_complex_for_combinatorial_map` \link PkgDrawLinearCellComplex CGAL::draw() \endlink +- `CGAL::Linear_cell_complex_for_generalized_map` \link PkgDrawLinearCellComplex CGAL::draw() \endlink +- `CGAL::Nef_polyhedron_3` \link PkgDrawNef3 CGAL::draw() \endlink +- `CGAL::Periodic_2_triangulation_2` \link PkgDrawPeriodic2Triangulation2 CGAL::draw() \endlink +- `CGAL::Point_set_3` \link PkgDrawPointSet3D CGAL::draw() \endlink +- `CGAL::Polygon_2` \link PkgDrawPolygon2 CGAL::draw() \endlink +- `CGAL::Polygon_set_2` \link PkgDrawPolygonSet2 CGAL::draw() \endlink +- `CGAL::Polygon_with_holes_2` \link PkgDrawPolygonWithHoles2 CGAL::draw() \endlink +- `CGAL::Polyhedron_3` \link PkgDrawPolyhedron CGAL::draw() \endlink +- `CGAL::Surface_mesh` \link PkgDrawSurfaceMesh CGAL::draw() \endlink +- `CGAL::Surface_mesh_topology` \link PkgDrawFaceGraphWithPaths CGAL::draw() \endlink +- `CGAL::Triangulation_2` \link PkgDrawTriangulation2 CGAL::draw() \endlink +- `CGAL::Triangulation_3` \link PkgDrawTriangulation3 CGAL::draw() \endlink +- `CGAL::Voronoi_diagram_2` \link PkgDrawVoronoiDiagram2 CGAL::draw() \endlink + +\cgalCRPSubsection{Fill Graphics Scene for Different Packages} + +- `CGAL::Arrangement_2` \link PkgArrangementOnSurface2Draw CGAL::add_to_graphics_scene() \endlink +- `CGAL::Constrained_triangulation_2` \link PkgDrawTriangulation2 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Linear_cell_complex_for_combinatorial_map` \link PkgDrawLinearCellComplex CGAL::add_to_graphics_scene() \endlink +- `CGAL::Linear_cell_complex_for_generalized_map` \link PkgDrawLinearCellComplex CGAL::add_to_graphics_scene() \endlink +- `CGAL::Nef_polyhedron_3` \link PkgDrawNef3 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Periodic_2_triangulation_2` \link PkgDrawPeriodic2Triangulation2 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Point_set_3` \link PkgDrawPointSet3D CGAL::add_to_graphics_scene() \endlink +- `CGAL::Polygon_2` \link PkgDrawPolygon2 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Polygon_set_2` \link PkgDrawPolygonSet2 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Polygon_with_holes_2` \link PkgDrawPolygonWithHoles2 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Polyhedron_3` \link PkgDrawPolyhedron CGAL::add_to_graphics_scene() \endlink +- `CGAL::Surface_mesh` \link PkgDrawSurfaceMesh CGAL::add_to_graphics_scene() \endlink +- `CGAL::Surface_mesh_topology` \link PkgDrawFaceGraphWithPaths CGAL::add_to_graphics_scene() \endlink +- `CGAL::Triangulation_2` \link PkgDrawTriangulation2 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Triangulation_3` \link PkgDrawTriangulation3 CGAL::add_to_graphics_scene() \endlink +- `CGAL::Voronoi_diagram_2` \link PkgDrawVoronoiDiagram2 CGAL::add_to_graphics_scene() \endlink + +*/ diff --git a/Basic_viewer/doc/Basic_viewer/dependencies b/Basic_viewer/doc/Basic_viewer/dependencies new file mode 100644 index 00000000000..c684a90bb27 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/dependencies @@ -0,0 +1,16 @@ +Manual +Boolean_set_operations_2 +Linear_cell_complex +Nef_3 +Periodic_2_triangulation_2 +Point_set_3 +Polygon +Polyhedron +Straight_skeleton_2 +Surface_mesh +Surface_mesh_topology +Triangulation_2 +Triangulation_3 +Voronoi_diagram_2 +Kernel_23 +Arrangement_on_surface_2 diff --git a/Basic_viewer/doc/Basic_viewer/examples.txt b/Basic_viewer/doc/Basic_viewer/examples.txt new file mode 100644 index 00000000000..2e18952fcb4 --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/examples.txt @@ -0,0 +1,8 @@ +/*! +\example Basic_viewer/draw_lcc.cpp +\example Basic_viewer/draw_mesh_and_points.cpp +\example Basic_viewer/draw_several_windows.cpp +\example Basic_viewer/draw_surface_mesh_small_faces.cpp +\example Basic_viewer/draw_surface_mesh_height.cpp +\example Basic_viewer/draw_surface_mesh_vcolor.cpp +*/ diff --git a/Basic_viewer/doc/Basic_viewer/fig/basic_viewer_diagramme_class.svg b/Basic_viewer/doc/Basic_viewer/fig/basic_viewer_diagramme_class.svg new file mode 100644 index 00000000000..3ec94e9d1af --- /dev/null +++ b/Basic_viewer/doc/Basic_viewer/fig/basic_viewer_diagramme_class.svg @@ -0,0 +1,530 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Basic_viewer + + + + + Graphics_scene + + + void add_point(apoint) + + + void add_point(apoint, acolor) + + + + + + + + void add_segment(apoint1, apoint2, acolor) + + void add_segment(apoint1, apoint2) + + void face_begin(acolor) + + void add_point_in_face(apoint) + + void face_begin() + + void face_end() + ... + + Basic_viewer (QWidget *parent, const Graphics_scene &scene)+ void draw()+ void redraw()... + + + 1 + + + + QApplication_and_basic_viewer + + QApplication_and_basic_viewer (const Graphics_scene &scene)+ void run()+ Basic_viewer & basic_viewer () + + + 1 + void draw_graphics_scene(const Graphics_scene& gs) + void draw(const DS& ds) + + void draw(const DS& ds, const Graphics_scene_option& gso) + void add_to_graphics_scene(const DS& ds, Graphics_scene& gs) + void add_to_graphics_scene(const DS& ds, Graphics_scene& gs, const Graphics_scene_option& gso) + + diff --git a/Basic_viewer/doc/Basic_viewer/fig/basic_viewer_logo.png b/Basic_viewer/doc/Basic_viewer/fig/basic_viewer_logo.png new file mode 100644 index 00000000000..05df4ad850c Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/basic_viewer_logo.png differ diff --git a/Basic_viewer/doc/Basic_viewer/fig/draw_mesh_and_points.png b/Basic_viewer/doc/Basic_viewer/fig/draw_mesh_and_points.png new file mode 100644 index 00000000000..4fd65f7d502 Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/draw_mesh_and_points.png differ diff --git a/Basic_viewer/doc/Basic_viewer/fig/draw_several_windows.png b/Basic_viewer/doc/Basic_viewer/fig/draw_several_windows.png new file mode 100644 index 00000000000..3a7cb06c6eb Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/draw_several_windows.png differ diff --git a/Basic_viewer/doc/Basic_viewer/fig/draw_surface_height.png b/Basic_viewer/doc/Basic_viewer/fig/draw_surface_height.png new file mode 100644 index 00000000000..082b3a29228 Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/draw_surface_height.png differ diff --git a/Basic_viewer/doc/Basic_viewer/fig/draw_surface_mesh_small_faces.png b/Basic_viewer/doc/Basic_viewer/fig/draw_surface_mesh_small_faces.png new file mode 100644 index 00000000000..d6b4066ca7f Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/draw_surface_mesh_small_faces.png differ diff --git a/Basic_viewer/doc/Basic_viewer/fig/draw_surface_mesh_vcolor.png b/Basic_viewer/doc/Basic_viewer/fig/draw_surface_mesh_vcolor.png new file mode 100644 index 00000000000..74f1e959f9c Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/draw_surface_mesh_vcolor.png differ diff --git a/Basic_viewer/doc/Basic_viewer/fig/lcc_draw.png b/Basic_viewer/doc/Basic_viewer/fig/lcc_draw.png new file mode 100644 index 00000000000..b86f9323c57 Binary files /dev/null and b/Basic_viewer/doc/Basic_viewer/fig/lcc_draw.png differ diff --git a/Basic_viewer/examples/Basic_viewer/CMakeLists.txt b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt new file mode 100644 index 00000000000..f758661d6bb --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/CMakeLists.txt @@ -0,0 +1,41 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + +#/!\ /!\ +#/!\ /!\ +# Used in /CGAL/Documentation/doc/Documentation/Developer_manual/create_and_use_a_cmakelist.txt. +# Careful when modifying + +cmake_minimum_required(VERSION 3.1...3.23) +project(Basic_viewer_Examples) + +#CGAL_Qt6 is needed for the drawing. +find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6) +find_package(Eigen3 3.1.0) +include(CGAL_Eigen3_support) + +create_single_source_cgal_program("draw_lcc.cpp") +create_single_source_cgal_program("draw_mesh_and_points.cpp") +create_single_source_cgal_program("draw_several_windows.cpp") +create_single_source_cgal_program("draw_surface_mesh_height.cpp") +create_single_source_cgal_program("draw_surface_mesh_small_faces.cpp") +create_single_source_cgal_program("draw_surface_mesh_vcolor.cpp") + +if(CGAL_Qt6_FOUND) + #link it with the required CGAL libraries + target_link_libraries(draw_lcc PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_mesh_and_points PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_several_windows PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_surface_mesh_height PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_surface_mesh_small_faces PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_surface_mesh_vcolor PUBLIC CGAL::CGAL_Basic_viewer) +else() + message("CGAL_Qt6 not configured: examples that require Qt will not be compiled.") +endif() + +if(TARGET CGAL::Eigen3_support) + target_link_libraries(draw_mesh_and_points PUBLIC CGAL::Eigen3_support) + target_link_libraries(draw_several_windows PUBLIC CGAL::Eigen3_support) +endif() + +#end of the file diff --git a/Basic_viewer/examples/Basic_viewer/draw_lcc.cpp b/Basic_viewer/examples/Basic_viewer/draw_lcc.cpp new file mode 100644 index 00000000000..019db26519a --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/draw_lcc.cpp @@ -0,0 +1,17 @@ +#include +#include + +using LCC=CGAL::Linear_cell_complex_for_combinatorial_map<3>; +using Point=LCC::Point; + +int main() +{ + LCC lcc; + lcc.make_hexahedron(Point(0,0,0), Point(5,0,0), + Point(5,5,0), Point(0,5,0), + Point(0,5,4), Point(0,0,4), + Point(5,0,4), Point(5,5,4)); + CGAL::draw(lcc); + + return EXIT_SUCCESS; +} diff --git a/Basic_viewer/examples/Basic_viewer/draw_mesh_and_points.cpp b/Basic_viewer/examples/Basic_viewer/draw_mesh_and_points.cpp new file mode 100644 index 00000000000..e104f016447 --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/draw_mesh_and_points.cpp @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using Kernel=CGAL::Exact_predicates_inexact_constructions_kernel; +using Point=Kernel::Point_3; +using Vector=Kernel::Vector_3; +using Pwn=std::pair; +using Polyhedron=CGAL::Polyhedron_3; +using PS3=CGAL::Point_set_3; + +struct Graphics_scene_options_green_points: + public CGAL::Graphics_scene_options +{ + bool colored_vertex(const PS3&, typename PS3::const_iterator) const + { return true; } + CGAL::IO::Color vertex_color(const PS3&, typename PS3::const_iterator) const + { return CGAL::IO::Color(0,220,0); } +}; + +int main(void) +{ + std::vector points; + + if(!CGAL::IO::read_points(CGAL::data_file_path("points_3/kitten.xyz"), std::back_inserter(points), + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()))) + { + std::cerr << "Error: cannot read input file " << CGAL::data_file_path("points_3/kitten.xyz") << std::endl; + return EXIT_FAILURE; + } + + Polyhedron output_mesh; + + double average_spacing = CGAL::compute_average_spacing + (points, 6, CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); + + if (CGAL::poisson_surface_reconstruction_delaunay + (points.begin(), points.end(), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map(), + output_mesh, average_spacing)) + { + PS3 point_set; + for(Pwn& it: points) + { point_set.insert(it.first); } + + CGAL::Graphics_scene scene; + CGAL::add_to_graphics_scene(point_set, scene, Graphics_scene_options_green_points()); + CGAL::add_to_graphics_scene(output_mesh, scene); + CGAL::draw_graphics_scene(scene); + } + else + { return EXIT_FAILURE; } + + return EXIT_SUCCESS; +} diff --git a/Basic_viewer/examples/Basic_viewer/draw_several_windows.cpp b/Basic_viewer/examples/Basic_viewer/draw_several_windows.cpp new file mode 100644 index 00000000000..2ac2ff2d66d --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/draw_several_windows.cpp @@ -0,0 +1,91 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CGAL_USE_BASIC_VIEWER +#include +#endif + +#include +#include + +using Kernel=CGAL::Exact_predicates_inexact_constructions_kernel; +using Point=Kernel::Point_3; +using Vector=Kernel::Vector_3; +using Pwn=std::pair; +using Polyhedron=CGAL::Polyhedron_3; +using PS3=CGAL::Point_set_3; + +int main(void) +{ + /// (1) Some CGAL code that create data structures and fill two Graphics_scene. + std::vector points; + + if(!CGAL::IO::read_points(CGAL::data_file_path("points_3/kitten.xyz"), std::back_inserter(points), + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()))) + { + std::cerr << "Error: cannot read input file " << CGAL::data_file_path("points_3/kitten.xyz") << std::endl; + return EXIT_FAILURE; + } + + Polyhedron output_mesh; + + double average_spacing = CGAL::compute_average_spacing + (points, 6, CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); + + if (!CGAL::poisson_surface_reconstruction_delaunay + (points.begin(), points.end(), + CGAL::First_of_pair_property_map(), + CGAL::Second_of_pair_property_map(), + output_mesh, average_spacing)) + { return EXIT_FAILURE; } + + PS3 point_set; + for(Pwn& it: points) + { point_set.insert(it.first); } + + CGAL::Graphics_scene scene1, scene2; + CGAL::add_to_graphics_scene(point_set, scene1); + CGAL::add_to_graphics_scene(output_mesh, scene2); + + /// (2) Qt code that create windows, add them in a layout, and create app. +#ifdef CGAL_USE_BASIC_VIEWER + +#if defined(CGAL_TEST_SUITE) + bool cgal_test_suite=true; +#else + bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); +#endif + + if (cgal_test_suite) { return EXIT_SUCCESS; } + + int argc=1; + const char* argv[2]={"Draw several windows example","\0"}; + QApplication app(argc,const_cast(argv)); + + QMainWindow* mainWindow=new QMainWindow; + QWidget *centralWidget = new QWidget(mainWindow); + QHBoxLayout* layout = new QHBoxLayout(mainWindow); + + CGAL::Qt::Basic_viewer bv1(mainWindow, scene1); + CGAL::Qt::Basic_viewer bv2(mainWindow, scene2); + bv1.draw_vertices(true); + + layout->addWidget(&bv1); + layout->addWidget(&bv2); + + centralWidget->setLayout(layout); + mainWindow->setCentralWidget(centralWidget); + + mainWindow->show(); + app.exec(); +#endif + + return EXIT_SUCCESS; +} diff --git a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_height.cpp b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_height.cpp new file mode 100644 index 00000000000..719ac3254ed --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_height.cpp @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point; +typedef CGAL::Surface_mesh Mesh; + +struct Colored_faces_given_height: + public CGAL::Graphics_scene_options +{ + Colored_faces_given_height(const Mesh& sm) + { + if(sm.is_empty()) return; + + double m_min_y=0., m_max_y=0.; + bool first=true; + for(typename Mesh::Vertex_index vi: sm.vertices()) + { + if(first) + { m_min_y=sm.point(vi).y(); m_max_y=m_min_y; first=false; } + else + { + m_min_y=(std::min)(m_min_y, sm.point(vi).y()); + m_max_y=(std::max)(m_max_y, sm.point(vi).y()); + } + } + + this->colored_face=[](const Mesh &, typename Mesh::Face_index)->bool { return true; }; + + this->face_color=[m_min_y, m_max_y] + (const Mesh& sm, typename Mesh::Face_index fi)->CGAL::IO::Color + { + double res=0.; + std::size_t n=0; + for(typename Mesh::Vertex_index vi: vertices_around_face(sm.halfedge(fi), sm)) + { + res+=sm.point(vi).y(); + ++n; + } + // Random color depending on the "height" of the facet + CGAL::Random random(static_cast(30*((res/n)-m_min_y)/(m_max_y-m_min_y))); + return CGAL::get_random_color(random); + }; + } +}; + +int main(int argc, char* argv[]) +{ + const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off"); + + Mesh sm; + if(!CGAL::IO::read_polygon_mesh(filename, sm)) + { + std::cerr << "Invalid input file: " << filename << std::endl; + return EXIT_FAILURE; + } + + CGAL::draw(sm, Colored_faces_given_height(sm)); + + return EXIT_SUCCESS; +} diff --git a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp new file mode 100644 index 00000000000..396f3a9a814 --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_small_faces.cpp @@ -0,0 +1,158 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::Simple_cartesian K; +typedef CGAL::Surface_mesh Mesh; +typedef Mesh::Vertex_index vertex_descriptor; +typedef Mesh::Face_index face_descriptor; +typedef K::FT FT; + +template +struct Graphics_scene_options_small_faces: + public CGAL::Graphics_scene_options::vertex_descriptor, + typename boost::graph_traits::edge_descriptor, + typename boost::graph_traits::face_descriptor> +{ + using Base=CGAL::Graphics_scene_options::vertex_descriptor, + typename boost::graph_traits::edge_descriptor, + typename boost::graph_traits::face_descriptor>; + + Graphics_scene_options_small_faces(const SM& sm): Base(), m_sm(sm) + { + typename SM::template Property_map faces_size; + boost::tie(faces_size, m_with_size)=sm.template property_map("f:size"); + if(!m_with_size) + { return; } + + m_min_size=faces_size[*(sm.faces().begin())]; + m_max_size=m_min_size; + FT cur_size; + for (typename SM::Face_range::iterator f=sm.faces().begin(); f!=sm.faces().end(); ++f) + { + cur_size=faces_size[*f]; + if (cur_sizem_max_size) m_max_size=cur_size; + } + + this->face_color=[=](const SM& sm, + typename boost::graph_traits::face_descriptor fh) -> CGAL::IO::Color + { return this->get_face_color(sm, fh); }; + + this->colored_face = [](const SM&, + typename boost::graph_traits::face_descriptor) -> bool + { return true; }; + } + + CGAL::IO::Color get_face_color(const SM& sm, + typename boost::graph_traits::face_descriptor fh) + { + // Default color of faces + CGAL::IO::Color c(75,160,255); + if(!m_with_size) { return c; } + + // Compare the size of the face with the % m_threshold + bool exist; + typename SM::template Property_map faces_size; + boost::tie(faces_size, exist)=sm.template property_map("f:size"); + assert(exist); + + // If the face is small, color it in red. + if (get(faces_size, fh)1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off"); + + Mesh sm; + if(!CGAL::IO::read_polygon_mesh(filename, sm)) + { + std::cerr << "Invalid input file: " << filename << std::endl; + return EXIT_FAILURE; + } + + CGAL::Polygon_mesh_processing::triangulate_faces(sm); + + Mesh::Property_map faces_size; + bool created; + boost::tie(faces_size, created)=sm.add_property_map("f:size",0.); + assert(created); + + for(face_descriptor fd : sm.faces()) + { faces_size[fd]=CGAL::Polygon_mesh_processing::face_area(fd, sm); } + + Graphics_scene_options_small_faces gsosm(sm); + CGAL::Graphics_scene gs; + + add_to_graphics_scene(sm, gs, gsosm); + +#ifdef CGAL_USE_BASIC_VIEWER + + CGAL::Qt::QApplication_and_basic_viewer app(gs, "Small faces"); + if(app) + { + app.basic_viewer().on_key_pressed= + [&sm, &gsosm, &gs] (QKeyEvent* e, CGAL::Qt::Basic_viewer* basic_viewer) -> bool + { + const ::Qt::KeyboardModifiers modifiers = e->modifiers(); + if ((e->key() == ::Qt::Key_I) && (modifiers == ::Qt::NoButton)) + { + gsosm.m_threshold+=5; + if(gsosm.m_threshold>100) { gsosm.m_threshold=100; } + basic_viewer->displayMessage + (QString("Small faces threshold=%1.").arg(gsosm.m_threshold)); + + gs.clear(); + add_to_graphics_scene(sm, gs, gsosm); + basic_viewer->redraw(); + } + else if ((e->key() == ::Qt::Key_D) && (modifiers == ::Qt::NoButton)) + { + if(gsosm.m_threshold<5) { gsosm.m_threshold=0; } + else { gsosm.m_threshold-=5; } + basic_viewer->displayMessage + (QString("Small faces threshold=%1.").arg(gsosm.m_threshold)); + + gs.clear(); + add_to_graphics_scene(sm, gs, gsosm); + basic_viewer->redraw(); + } + else + { + // Return false will call the base method to process others/classicals key + return false; + } + return true; + }; + + // Here we add shortcut descriptions + app.basic_viewer().setKeyDescription(::Qt::Key_I, "Increase threshold for small faces"); + app.basic_viewer().setKeyDescription(::Qt::Key_D, "Decrease threshold for small faces"); + + // Then we run the app + app.run(); + } + +#endif + + sm.remove_property_map(faces_size); + + return EXIT_SUCCESS; +} diff --git a/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_vcolor.cpp b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_vcolor.cpp new file mode 100644 index 00000000000..209d73bd71a --- /dev/null +++ b/Basic_viewer/examples/Basic_viewer/draw_surface_mesh_vcolor.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include + +using Kernel=CGAL::Simple_cartesian; +using Point=Kernel::Point_3; +using Mesh=CGAL::Surface_mesh; + +// Inherit from CGAL::Graphics_scene_options to get all the default values. +struct My_graphics_scene_options: + public CGAL::Graphics_scene_options::vertex_descriptor, + typename boost::graph_traits::edge_descriptor, + typename boost::graph_traits::face_descriptor> +{ + // All vertices are colored. + bool colored_vertex(const Mesh&, + typename boost::graph_traits::vertex_descriptor) const + { return true; } + + // Change the color of vertices randomly. + CGAL::IO::Color vertex_color(const Mesh&, + typename boost::graph_traits::vertex_descriptor) const + { + static bool v_green=true; + v_green=!v_green; + if(v_green) // 1 vertex out of two green (randomly) + { return CGAL::IO::Color(0,220,0); } + else // the others are blue + { return CGAL::IO::Color(0,0,220); } + } +}; + + +int main(int argc, char* argv[]) +{ + const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off"); + + Mesh sm; + if(!CGAL::IO::read_polygon_mesh(filename, sm)) + { + std::cerr << "Invalid input file: " << filename << std::endl; + return EXIT_FAILURE; + } + + // Draw the mesh using the new graphics scene option. + CGAL::draw(sm, My_graphics_scene_options()); + return EXIT_SUCCESS; +} diff --git a/GraphicsView/include/CGAL/Basic_shaders.h b/Basic_viewer/include/CGAL/Basic_shaders.h similarity index 100% rename from GraphicsView/include/CGAL/Basic_shaders.h rename to Basic_viewer/include/CGAL/Basic_shaders.h diff --git a/GraphicsView/include/CGAL/Buffer_for_vao.h b/Basic_viewer/include/CGAL/Buffer_for_vao.h similarity index 90% rename from GraphicsView/include/CGAL/Buffer_for_vao.h rename to Basic_viewer/include/CGAL/Buffer_for_vao.h index dde60abb832..d7c9619619a 100644 --- a/GraphicsView/include/CGAL/Buffer_for_vao.h +++ b/Basic_viewer/include/CGAL/Buffer_for_vao.h @@ -10,8 +10,8 @@ // // Author(s) : Guillaume Damiand -#ifndef CGAL_VBO_BUFFER_FILLER_H -#define CGAL_VBO_BUFFER_FILLER_H +#ifndef CGAL_BUFFER_FOR_VAO_H +#define CGAL_BUFFER_FOR_VAO_H #include @@ -125,13 +125,43 @@ namespace internal static const typename Local_kernel::Ray_2& get_local_ray(const typename Local_kernel::Ray_2& r) { return r; } }; + + template + void mark_domains(CDT& tri, + typename CDT::Face_handle start, int index, + std::queue& border) + { + if (start->info().m_nesting_level!=-1) return; + std::queue queue; + queue.push(start); + while (!queue.empty()) + { + auto fh=queue.front(); + queue.pop(); + if (fh->info().m_nesting_level==-1) + { + fh->info().m_nesting_level=index; + for (int i = 0; i < 3; i++) + { + typename CDT::Edge e(fh,i); + auto n = fh->neighbor(i); + if (n->info().m_nesting_level==-1) + { + if (tri.is_constrained(e)) { border.push(e); } + else { queue.push(n); } + } + } + } + } + } } // End namespace internal //------------------------------------------------------------------------------ -template class Buffer_for_vao { public: + using BufferType=float; + using IndexType=std::size_t; typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; typedef Local_kernel::Point_3 Local_point; typedef Local_kernel::Vector_3 Local_vector; @@ -163,6 +193,7 @@ public: if (m_index_buffer!=nullptr) { m_index_buffer->clear(); } if (m_flat_normal_buffer!=nullptr) { m_flat_normal_buffer->clear(); } if (m_gouraud_normal_buffer!=nullptr) { m_gouraud_normal_buffer->clear(); } + if (m_bb!=nullptr) { (*m_bb)=CGAL::Bbox_3(); } m_zero_x=true; m_zero_y=true; @@ -203,11 +234,10 @@ public: bool has_zero_z() const { return m_zero_z; } - void negate_normals() + void negate_normals() const { m_inverse_normal=!m_inverse_normal; - for (std::vector*array=m_flat_normal_buffer; array!=nullptr; - array=(array==m_gouraud_normal_buffer?nullptr:m_gouraud_normal_buffer)) + for (std::vector*array: {m_flat_normal_buffer, m_gouraud_normal_buffer}) { for (std::size_t i=0; isize(); ++i) { (*array)[i]=-(*array)[i]; } @@ -458,31 +488,31 @@ public: /// adds `kp` coordinates to `buffer` template - static void add_point_in_buffer(const KPoint& kp, std::vector& buffer) + static void add_point_in_buffer(const KPoint& kp, std::vector& buffer) { Local_point p=get_local_point(kp); - buffer.push_back(static_cast(p.x())); - buffer.push_back(static_cast(p.y())); - buffer.push_back(static_cast(p.z())); + buffer.push_back(static_cast(p.x())); + buffer.push_back(static_cast(p.y())); + buffer.push_back(static_cast(p.z())); } /// adds `kv` coordinates to `buffer` template - static void add_normal_in_buffer(const KVector& kv, std::vector& buffer, + static void add_normal_in_buffer(const KVector& kv, std::vector& buffer, bool inverse_normal=false) { Local_vector n=(inverse_normal?-get_local_vector(kv):get_local_vector(kv)); - buffer.push_back(static_cast(n.x())); - buffer.push_back(static_cast(n.y())); - buffer.push_back(static_cast(n.z())); + buffer.push_back(static_cast(n.x())); + buffer.push_back(static_cast(n.y())); + buffer.push_back(static_cast(n.z())); } ///adds `acolor` RGB components to `buffer` - static void add_color_in_buffer(const CGAL::IO::Color& acolor, std::vector& buffer) + static void add_color_in_buffer(const CGAL::IO::Color& acolor, std::vector& buffer) { - buffer.push_back((float)acolor.red()/(float)255); - buffer.push_back((float)acolor.green()/(float)255); - buffer.push_back((float)acolor.blue()/(float)255); + buffer.push_back((BufferType)acolor.red()/(BufferType)255); + buffer.push_back((BufferType)acolor.green()/(BufferType)255); + buffer.push_back((BufferType)acolor.blue()/(BufferType)255); } /// @return true iff the points of 'facet' form a convex face @@ -737,62 +767,20 @@ protected: { cdt.insert_constraint(previous, first); } } - // (2) We mark all external triangles - // (2.1) We initialize is_external and is_process values + // (2.1) We initialize nesting_level for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(), fitend = cdt.all_faces_end(); fit!=fitend; ++fit) - { - fit->info().is_external = true; - fit->info().is_process = false; - } - // (2.2) We check if the facet is external or internal - std::queue face_queue, faces_internal; - if (cdt.infinite_vertex()->face()!=nullptr) - { - typename CDT::Face_circulator - incident_faces(cdt.infinite_vertex()), end_incident_faces(incident_faces); - do - { face_queue.push(incident_faces); } - while(++incident_faces!=end_incident_faces); - } - // std::cout<<"# faces PUSHED "<info().is_process) - { - fh->info().is_process=true; - for(int i=0; i<3; ++i) - { - if(!cdt.is_constrained(std::make_pair(fh, i))) - { - if (fh->neighbor(i)!=nullptr) - { face_queue.push(fh->neighbor(i)); } - } - else - { faces_internal.push(fh->neighbor(i)); } - } - } - } + { fit->info().m_nesting_level=-1; } - while(!faces_internal.empty()) + std::queue border; + internal::mark_domains(cdt, cdt.infinite_face(), 0, border); + while(!border.empty()) { - typename CDT::Face_handle fh=faces_internal.front(); - faces_internal.pop(); - if(!fh->info().is_process) - { - fh->info().is_process = true; - fh->info().is_external = false; - for(unsigned int i=0; i<3; ++i) - { - if(!cdt.is_constrained(std::make_pair(fh, i))) - { - if (fh->neighbor(i)!=nullptr) - { faces_internal.push(fh->neighbor(i)); } - } - } - } + auto e=border.front(); + border.pop(); + auto n=e.first->neighbor(e.second); + if (n->info().m_nesting_level==-1) + { internal::mark_domains(cdt, n, e.first->info().m_nesting_level+1, border); } } // (3) Now we iterates on the internal faces to add the vertices @@ -800,7 +788,7 @@ protected: for(typename CDT::Finite_faces_iterator ffit=cdt.finite_faces_begin(), ffitend = cdt.finite_faces_end(); ffit!=ffitend; ++ffit) { - if(!ffit->info().is_external) + if(ffit->info().in_domain()) { for(unsigned int i=0; i<3; ++i) { @@ -882,9 +870,8 @@ protected: struct Face_info { - bool exist_edge[3]; - bool is_external; - bool is_process; + int m_nesting_level=-1; + bool in_domain() { return m_nesting_level%2==1; } }; typedef CGAL::Projection_traits_3 P_traits; @@ -899,8 +886,8 @@ protected: std::vector* m_pos_buffer; std::vector* m_index_buffer; std::vector* m_color_buffer; - std::vector* m_flat_normal_buffer; - std::vector* m_gouraud_normal_buffer; + mutable std::vector* m_flat_normal_buffer; + mutable std::vector* m_gouraud_normal_buffer; CGAL::Bbox_3* m_bb; @@ -908,7 +895,7 @@ protected: bool m_zero_y; /// True iff all points have y==0 bool m_zero_z; /// True iff all points have z==0 - bool m_inverse_normal; + mutable bool m_inverse_normal; // Local variables, used when we started a new face.g bool m_face_started; @@ -923,4 +910,4 @@ protected: } // End namespace CGAL -#endif // CGAL_VBO_BUFFER_FILLER_H +#endif // CGAL_BUFFER_FOR_VAO_H diff --git a/Basic_viewer/include/CGAL/Graphics_scene.h b/Basic_viewer/include/CGAL/Graphics_scene.h new file mode 100644 index 00000000000..155a471b217 --- /dev/null +++ b/Basic_viewer/include/CGAL/Graphics_scene.h @@ -0,0 +1,436 @@ +// Copyright (c) 2022 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_GRAPHICS_SCENE_H +#define CGAL_GRAPHICS_SCENE_H + +// TODO #include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace CGAL { + +//------------------------------------------------------------------------------ +inline CGAL::IO::Color get_random_color(CGAL::Random& random) +{ + CGAL::IO::Color res; + do + { + res=CGAL::IO::Color(random.get_int(0,256), + random.get_int(0,256), + random.get_int(0,256)); + } + while(res.red()==255 && res.green()==255 && res.blue()==255); + return res; +} +//------------------------------------------------------------------------------ +// This class is responsible for dealing with available CGAL data structures and +// handling buffers. +class Graphics_scene +{ +public: + using BufferType=float; + + typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; + typedef Local_kernel::Point_3 Local_point; + typedef Local_kernel::Vector_3 Local_vector; + + Graphics_scene() + : m_buffer_for_mono_points(&arrays[POS_MONO_POINTS], nullptr, + &m_bounding_box, nullptr, nullptr, nullptr), + m_buffer_for_colored_points(&arrays[POS_COLORED_POINTS], nullptr, + &m_bounding_box, &arrays[COLOR_POINTS], + nullptr, nullptr), + m_buffer_for_mono_segments(&arrays[POS_MONO_SEGMENTS], nullptr, + &m_bounding_box, nullptr, nullptr, nullptr), + m_buffer_for_colored_segments(&arrays[POS_COLORED_SEGMENTS], nullptr, + &m_bounding_box, &arrays[COLOR_SEGMENTS], + nullptr, nullptr), + m_buffer_for_mono_rays(&arrays[POS_MONO_RAYS], nullptr, &m_bounding_box, + nullptr, nullptr), + m_buffer_for_colored_rays(&arrays[POS_COLORED_RAYS], nullptr, + &m_bounding_box, &arrays[COLOR_RAYS], nullptr, + nullptr), + m_buffer_for_mono_lines(&arrays[POS_MONO_RAYS], nullptr, + &m_bounding_box, nullptr, nullptr), + m_buffer_for_colored_lines(&arrays[POS_COLORED_LINES], nullptr, + &m_bounding_box, &arrays[COLOR_LINES], + nullptr, nullptr), + m_buffer_for_mono_faces( + &arrays[POS_MONO_FACES], nullptr, &m_bounding_box, nullptr, + &arrays[FLAT_NORMAL_MONO_FACES], &arrays[SMOOTH_NORMAL_MONO_FACES]), + m_buffer_for_colored_faces(&arrays[POS_COLORED_FACES], nullptr, + &m_bounding_box, &arrays[COLOR_FACES], + &arrays[FLAT_NORMAL_COLORED_FACES], + &arrays[SMOOTH_NORMAL_COLORED_FACES]) + {} + + const Buffer_for_vao &get_buffer_for_mono_points() const + { return m_buffer_for_mono_points; } + + const Buffer_for_vao &get_buffer_for_colored_points() const + { return m_buffer_for_colored_points; } + + const Buffer_for_vao &get_buffer_for_mono_segments() const + { return m_buffer_for_mono_segments; } + + const Buffer_for_vao &get_buffer_for_colored_segments() const + { return m_buffer_for_colored_segments; } + + const Buffer_for_vao &get_buffer_for_mono_rays() const + { return m_buffer_for_mono_rays; } + + const Buffer_for_vao &get_buffer_for_colored_rays() const + { return m_buffer_for_colored_rays; } + + const Buffer_for_vao &get_buffer_for_mono_lines() const + { return m_buffer_for_mono_lines; } + + const Buffer_for_vao &get_buffer_for_colored_lines() const + { return m_buffer_for_colored_lines; } + + const Buffer_for_vao &get_buffer_for_mono_faces() const + { return m_buffer_for_mono_faces; } + + const Buffer_for_vao &get_buffer_for_colored_faces() const + { return m_buffer_for_colored_faces; } + + const CGAL::Bbox_3 &bounding_box() const { return m_bounding_box; } + + const std::vector &get_array_of_index(int index) const + { assert(index(arrays[index].size()*sizeof(BufferType)); } + + unsigned int number_of_elements(int index) const + { return static_cast(arrays[index].size()/3); } + + void initiate_bounding_box(const CGAL::Bbox_3& new_bounding_box) + { m_bounding_box = new_bounding_box; } + + void update_bounding_box(const CGAL::Bbox_3 &box) { m_bounding_box+=box; } + + template + void update_bounding_box_for_ray(const KPoint &p, const KVector &v) + { + Local_point lp = get_local_point(p); + Local_vector lv = get_local_vector(v); + update_bounding_box((lp + lv).bbox()); + } + + template + void update_bounding_box_for_line(const KPoint &p, const KVector &v, + const KVector &pv) + { + Local_point lp = get_local_point(p); + Local_vector lv = get_local_vector(v); + Local_vector lpv = get_local_vector(pv); + update_bounding_box(lp.bbox() + (lp + lv).bbox() + (lp + lpv).bbox()); + } + + void reverse_all_normals() const + { + m_buffer_for_mono_faces.negate_normals(); + m_buffer_for_colored_faces.negate_normals(); + } + + template void add_point(const KPoint &p) + { m_buffer_for_mono_points.add_point(p); } + + template + void add_point(const KPoint &p, const CGAL::IO::Color &acolor) + { m_buffer_for_colored_points.add_point(p, acolor); } + + template + void add_segment(const KPoint &p1, const KPoint &p2) + { m_buffer_for_mono_segments.add_segment(p1, p2); } + + template + void add_segment(const KPoint &p1, const KPoint &p2, + const CGAL::IO::Color &acolor) + { m_buffer_for_colored_segments.add_segment(p1, p2, acolor); } + + template + void add_ray(const KPoint &p, const KVector &v) + { + double bigNumber = 1e30; + m_buffer_for_mono_rays.add_ray_segment(p, (p + (bigNumber)*v)); + } + + template + void add_ray(const KPoint &p, const KVector &v, + const CGAL::IO::Color &acolor) + { + double bigNumber = 1e30; + m_buffer_for_colored_rays.add_ray_segment(p, (p + (bigNumber)*v), acolor); + } + + template + void add_line(const KPoint &p, const KVector &v) + { + double bigNumber = 1e30; + m_buffer_for_mono_lines.add_line_segment((p - (bigNumber)*v), + (p + (bigNumber)*v)); + } + + template + void add_line(const KPoint &p, const KVector &v, + const CGAL::IO::Color &acolor) + { + double bigNumber = 1e30; + m_buffer_for_colored_lines.add_line_segment((p - (bigNumber)*v), + (p + (bigNumber)*v), acolor); + } + + template bool add_point_in_face(const KPoint &kp) + { + if (m_buffer_for_mono_faces.is_a_face_started()) + { return m_buffer_for_mono_faces.add_point_in_face(kp); } + else if (m_buffer_for_colored_faces.is_a_face_started()) + { return m_buffer_for_colored_faces.add_point_in_face(kp); } + return false; + } + + template + bool add_point_in_face(const KPoint &kp, const KVector &p_normal) + { + if (m_buffer_for_mono_faces.is_a_face_started()) + { return m_buffer_for_mono_faces.add_point_in_face(kp, p_normal); } + else if (m_buffer_for_colored_faces.is_a_face_started()) + { return m_buffer_for_colored_faces.add_point_in_face(kp, p_normal); } + return false; + } + + bool a_face_started() const + { + return m_buffer_for_mono_faces.is_a_face_started() || + m_buffer_for_colored_faces.is_a_face_started(); + } + + void face_begin() + { + if (a_face_started()) + { + std::cerr + << "You cannot start a new face before to finish the previous one." + << std::endl; + } + else + { m_buffer_for_mono_faces.face_begin(); } + } + + void face_begin(const CGAL::IO::Color &acolor) + { + if (a_face_started()) + { + std::cerr + << "You cannot start a new face before to finish the previous one." + << std::endl; + } + else + { m_buffer_for_colored_faces.face_begin(acolor); } + } + + void face_end() + { + if (m_buffer_for_mono_faces.is_a_face_started()) + { m_buffer_for_mono_faces.face_end(); } + else if (m_buffer_for_colored_faces.is_a_face_started()) + { m_buffer_for_colored_faces.face_end(); } + } + + template + void add_text(const KPoint &kp, const std::string &txt) + { + Local_point p = get_local_point(kp); + m_texts.push_back(std::make_tuple(p, txt)); + } + + template + void add_text(const KPoint &kp, const char *txt) + { add_text(kp, std::string(txt)); } + + bool empty() const + { + return (m_buffer_for_mono_points.is_empty() && + m_buffer_for_colored_points.is_empty() && + m_buffer_for_mono_segments.is_empty() && + m_buffer_for_colored_segments.is_empty() && + m_buffer_for_mono_rays.is_empty() && + m_buffer_for_colored_rays.is_empty() && + m_buffer_for_mono_lines.is_empty() && + m_buffer_for_colored_lines.is_empty() && + m_buffer_for_mono_faces.is_empty() && + m_buffer_for_colored_faces.is_empty()); + } + + bool has_zero_x() const + { + return m_buffer_for_mono_points.has_zero_x() && + m_buffer_for_colored_points.has_zero_x() && + m_buffer_for_mono_segments.has_zero_x() && + m_buffer_for_colored_segments.has_zero_x() && + m_buffer_for_mono_faces.has_zero_x() && + m_buffer_for_colored_faces.has_zero_x() && + m_buffer_for_mono_rays.has_zero_x() && + m_buffer_for_colored_rays.has_zero_x() && + m_buffer_for_mono_lines.has_zero_x() && + m_buffer_for_colored_lines.has_zero_x(); + } + + bool has_zero_y() const + { + return m_buffer_for_mono_points.has_zero_y() && + m_buffer_for_colored_points.has_zero_y() && + m_buffer_for_mono_segments.has_zero_y() && + m_buffer_for_colored_segments.has_zero_y() && + m_buffer_for_mono_faces.has_zero_y() && + m_buffer_for_colored_faces.has_zero_y() && + m_buffer_for_mono_rays.has_zero_y() && + m_buffer_for_colored_rays.has_zero_y() && + m_buffer_for_mono_lines.has_zero_y() && + m_buffer_for_colored_lines.has_zero_y(); + } + + bool has_zero_z() const + { + return m_buffer_for_mono_points.has_zero_z() && + m_buffer_for_colored_points.has_zero_z() && + m_buffer_for_mono_segments.has_zero_z() && + m_buffer_for_colored_segments.has_zero_z() && + m_buffer_for_mono_faces.has_zero_z() && + m_buffer_for_colored_faces.has_zero_z() && + m_buffer_for_mono_rays.has_zero_z() && + m_buffer_for_colored_rays.has_zero_z() && + m_buffer_for_mono_lines.has_zero_z() && + m_buffer_for_colored_lines.has_zero_z(); + } + + // Returns true if the data structure lies on a XY or XZ or YZ plane + bool is_two_dimensional() const + { + return (!empty() && (has_zero_x() || has_zero_y() || has_zero_z())); + } + + void clear() + { + m_buffer_for_mono_points.clear(); + m_buffer_for_colored_points.clear(); + m_buffer_for_mono_segments.clear(); + m_buffer_for_colored_segments.clear(); + m_buffer_for_mono_rays.clear(); + m_buffer_for_colored_rays.clear(); + m_buffer_for_mono_lines.clear(); + m_buffer_for_colored_lines.clear(); + m_buffer_for_mono_faces.clear(); + m_buffer_for_colored_faces.clear(); + m_texts.clear(); + m_bounding_box=CGAL::Bbox_3(); + } + + template + static Local_point get_local_point(const KPoint &p) + { + return internal::Geom_utils::Kernel, + Local_kernel>::get_local_point(p); + } + + template + static Local_vector get_local_vector(const KVector &v) + { + return internal::Geom_utils::Kernel, + Local_kernel>::get_local_vector(v); + } + + void m_texts_clear() + { m_texts.clear(); } + + std::size_t m_texts_size() const + { return m_texts.size(); } + + const std::vector>& get_m_texts() const + { return m_texts; } + +public: + // The following enum gives the indices of different elements of arrays + // vectors. + enum Buffers { + BEGIN_POS = 0, + POS_MONO_POINTS = BEGIN_POS, + POS_COLORED_POINTS, + POS_MONO_SEGMENTS, + POS_COLORED_SEGMENTS, + POS_MONO_RAYS, + POS_COLORED_RAYS, + POS_MONO_LINES, + POS_COLORED_LINES, + POS_MONO_FACES, + POS_COLORED_FACES, + END_POS, + BEGIN_COLOR = END_POS, + COLOR_POINTS = BEGIN_COLOR, + COLOR_SEGMENTS, + COLOR_RAYS, + COLOR_LINES, + COLOR_FACES, + END_COLOR, + BEGIN_NORMAL = END_COLOR, + SMOOTH_NORMAL_MONO_FACES = BEGIN_NORMAL, + FLAT_NORMAL_MONO_FACES, + SMOOTH_NORMAL_COLORED_FACES, + FLAT_NORMAL_COLORED_FACES, + END_NORMAL, + LAST_INDEX = END_NORMAL + }; + +protected: + Buffer_for_vao m_buffer_for_mono_points; + Buffer_for_vao m_buffer_for_colored_points; + Buffer_for_vao m_buffer_for_mono_segments; + Buffer_for_vao m_buffer_for_colored_segments; + Buffer_for_vao m_buffer_for_mono_rays; + Buffer_for_vao m_buffer_for_colored_rays; + Buffer_for_vao m_buffer_for_mono_lines; + Buffer_for_vao m_buffer_for_colored_lines; + Buffer_for_vao m_buffer_for_mono_faces; + Buffer_for_vao m_buffer_for_colored_faces; + + std::vector> m_texts; + + std::vector arrays[LAST_INDEX]; + + CGAL::Bbox_3 m_bounding_box; +}; + +} // namespace CGAL + +#endif // CGAL_GRAPHICS_SCENE_H diff --git a/Basic_viewer/include/CGAL/Graphics_scene_options.h b/Basic_viewer/include/CGAL/Graphics_scene_options.h new file mode 100644 index 00000000000..b610665ed40 --- /dev/null +++ b/Basic_viewer/include/CGAL/Graphics_scene_options.h @@ -0,0 +1,127 @@ +// Copyright (c) 2022 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_GRAPHICS_SCENE_OPTIONS_H +#define CGAL_GRAPHICS_SCENE_OPTIONS_H + +#include +#include +#include + +namespace CGAL { + +template +struct Graphics_scene_options; + +// Drawing functor for a 2D combinatorial data structure +// (with vertices, edges and faces) +template +struct Graphics_scene_options +{ + + 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 &, 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 &, 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 &, face_descriptor)->bool { return false; }; + } + + // The seven following functions should not be null + std::function draw_vertex; + std::function draw_edge; + std::function draw_face; + + std::function colored_vertex; + std::function colored_edge; + std::function colored_face; + + std::function face_wireframe; + + // These functions must be non null if the corresponding colored_XXX function + // returns true. + std::function vertex_color; + std::function edge_color; + std::function face_color; + + void disable_vertices() { m_enabled_vertices=false; } + void enable_vertices() { m_enabled_vertices=true; } + bool are_vertices_enabled() const { return m_enabled_vertices; } + + void disable_edges() { m_enabled_edges=false; } + void enable_edges() { m_enabled_edges=true; } + bool are_edges_enabled() const { return m_enabled_edges; } + + void disable_faces() { m_enabled_faces=false; } + void enable_faces() { m_enabled_faces=true; } + bool are_faces_enabled() const { return m_enabled_faces; } + +protected: + bool m_enabled_vertices, m_enabled_edges, m_enabled_faces; +}; + +// Drawing functor for a 3D combinatorial data structure +// (with vertices, edges, faces and volumes) +template +struct Graphics_scene_options: + public Graphics_scene_options +{ + 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 &, 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 draw_volume; + std::function colored_volume; + std::function volume_wireframe; + std::function volume_color; + + void disable_volumes() { m_enabled_volumes=false; } + void enable_volumes() { m_enabled_volumes=true; } + bool are_volumes_enabled() const { return m_enabled_volumes; } + +protected: + bool m_enabled_volumes; +}; + +} // End namespace CGAL + +#endif // CGAL_GRAPHICS_SCENE_OPTIONS_H diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/Basic_viewer/include/CGAL/Qt/Basic_viewer.h similarity index 58% rename from GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h rename to Basic_viewer/include/CGAL/Qt/Basic_viewer.h index 9cb3c235a22..20ef729341d 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/Basic_viewer/include/CGAL/Qt/Basic_viewer.h @@ -9,14 +9,17 @@ // // // Author(s) : Guillaume Damiand +// Mostafa Ashraf -#ifndef CGAL_BASIC_VIEWER_QT_H -#define CGAL_BASIC_VIEWER_QT_H +#ifndef CGAL_BASIC_VIEWER_H +#define CGAL_BASIC_VIEWER_H -#include +// TODO #include +#include #include #include #include +#include #ifdef CGAL_USE_BASIC_VIEWER @@ -47,53 +50,42 @@ #include #include -#include #include #include #include -#include #include +#include #define CGAL_BASIC_VIEWER_INIT_SIZE_X 500 #define CGAL_BASIC_VIEWER_INIT_SIZE_Y 450 -namespace CGAL -{ - +namespace CGAL { +namespace Qt { //------------------------------------------------------------------------------ -inline CGAL::IO::Color get_random_color(CGAL::Random& random) -{ - CGAL::IO::Color res; - do - { - res=CGAL::IO::Color(random.get_int(0,256), - random.get_int(0,256), - random.get_int(0,256)); - } - while(res.red()==255 && res.green()==255 && res.blue()==255); - return res; -} -//------------------------------------------------------------------------------ -class Basic_viewer_qt : public CGAL::QGLViewer +class Basic_viewer : public CGAL::QGLViewer { public: + using BufferType=float; typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; typedef Local_kernel::Point_3 Local_point; typedef Local_kernel::Vector_3 Local_vector; + using GS=Graphics_scene; // Constructor/Destructor - Basic_viewer_qt(QWidget* parent, - const char* title="", - bool draw_vertices=false, - bool draw_edges=true, - bool draw_faces=true, - bool use_mono_color=false, - bool inverse_normal=false, - bool draw_rays=true, - bool draw_lines=true, - bool draw_text=true, - bool no_2D_mode=false) : + Basic_viewer(QWidget* parent, + const Graphics_scene& buf, + const char* title="", + bool draw_vertices=false, + bool draw_edges=true, + bool draw_faces=true, + bool use_mono_color=false, + bool inverse_normal=false, + bool draw_rays=true, + bool draw_lines=true, + bool draw_text=true, + bool no_2D_mode=false) : CGAL::QGLViewer(parent), + gBuffer(buf), m_draw_vertices(draw_vertices), m_draw_edges(draw_edges), m_draw_rays(draw_rays), @@ -114,55 +106,7 @@ public: m_lines_mono_color(0, 0, 0), m_faces_mono_color(60, 60, 200), m_ambient_color(0.6f, 0.5f, 0.5f, 0.5f), - m_are_buffers_initialized(false), - m_buffer_for_mono_points(&arrays[POS_MONO_POINTS], - nullptr, - &m_bounding_box, - nullptr, nullptr, nullptr), - m_buffer_for_colored_points(&arrays[POS_COLORED_POINTS], - nullptr, - &m_bounding_box, - &arrays[COLOR_POINTS], - nullptr, nullptr), - m_buffer_for_mono_segments(&arrays[POS_MONO_SEGMENTS], - nullptr, - &m_bounding_box, - nullptr, nullptr, nullptr), - m_buffer_for_colored_segments(&arrays[POS_COLORED_SEGMENTS], - nullptr, - &m_bounding_box, - &arrays[COLOR_SEGMENTS], - nullptr, nullptr), - m_buffer_for_mono_rays(&arrays[POS_MONO_RAYS], - nullptr, - &m_bounding_box, - nullptr, nullptr), - m_buffer_for_colored_rays(&arrays[POS_COLORED_RAYS], - nullptr, - &m_bounding_box, - &arrays[COLOR_RAYS], - nullptr, nullptr), - m_buffer_for_mono_lines(&arrays[POS_MONO_RAYS], - nullptr, - &m_bounding_box, - nullptr, nullptr), - m_buffer_for_colored_lines(&arrays[POS_COLORED_LINES], - nullptr, - &m_bounding_box, - &arrays[COLOR_LINES], - nullptr, nullptr), - m_buffer_for_mono_faces(&arrays[POS_MONO_FACES], - nullptr, - &m_bounding_box, - nullptr, - &arrays[FLAT_NORMAL_MONO_FACES], - &arrays[SMOOTH_NORMAL_MONO_FACES]), - m_buffer_for_colored_faces(&arrays[POS_COLORED_FACES], - nullptr, - &m_bounding_box, - &arrays[COLOR_FACES], - &arrays[FLAT_NORMAL_COLORED_FACES], - &arrays[SMOOTH_NORMAL_COLORED_FACES]) + m_are_buffers_initialized(false) { // Define 'Control+Q' as the new exit shortcut (default was 'Escape') setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL, ::Qt::Key_Q); @@ -187,9 +131,12 @@ public: setKeyDescription(::Qt::Key_O, "Toggles 2D mode only"); // Add custom mouse description - setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::LeftButton, "Rotate the clipping plane when enabled"); - setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::RightButton, "Translate the clipping plane when enabled"); - setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::MiddleButton, "Control the clipping plane transparency when enabled"); + setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::LeftButton, + "Rotate the clipping plane when enabled"); + setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::RightButton, + "Translate the clipping plane when enabled"); + setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::MiddleButton, + "Control the clipping plane transparency when enabled"); setMouseBinding(::Qt::ControlModifier, ::Qt::LeftButton, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); setMouseBinding(::Qt::ControlModifier, ::Qt::RightButton, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); @@ -209,117 +156,95 @@ public: resize(CGAL_BASIC_VIEWER_INIT_SIZE_X, CGAL_BASIC_VIEWER_INIT_SIZE_Y); if (inverse_normal) - { negate_all_normals(); } + { reverse_all_normals(); } } - ~Basic_viewer_qt() + ~Basic_viewer() { makeCurrent(); - for (unsigned int i=0; i - void add_point(const KPoint& p) - { m_buffer_for_mono_points.add_point(p); } - - template - void add_point(const KPoint& p, const CGAL::IO::Color& acolor) - { m_buffer_for_colored_points.add_point(p, acolor); } - - template - void add_segment(const KPoint& p1, const KPoint& p2) - { m_buffer_for_mono_segments.add_segment(p1, p2); } - - template - void add_segment(const KPoint& p1, const KPoint& p2, - const CGAL::IO::Color& acolor) - { m_buffer_for_colored_segments.add_segment(p1, p2, acolor); } - - template - void update_bounding_box_for_ray(const KPoint &p, const KVector &v) - { - Local_point lp = get_local_point(p); - Local_vector lv = get_local_vector(v); - CGAL::Bbox_3 b = (lp + lv).bbox(); - m_bounding_box += b; - } - - template - void update_bounding_box_for_line(const KPoint &p, const KVector &v, - const KVector &pv) - { - Local_point lp = get_local_point(p); - Local_vector lv = get_local_vector(v); - Local_vector lpv = get_local_vector(pv); - - CGAL::Bbox_3 b = lp.bbox() + (lp + lv).bbox() + (lp + lpv).bbox(); - m_bounding_box += b; - } - - template - void add_ray(const KPoint &p, const KVector &v) - { - double bigNumber = 1e30; - m_buffer_for_mono_rays.add_ray_segment(p, (p + (bigNumber)*v)); - } - - template - void add_ray(const KPoint &p, const KVector &v, const CGAL::IO::Color &acolor) - { - double bigNumber = 1e30; - m_buffer_for_colored_rays.add_ray_segment(p, (p + (bigNumber)*v), acolor); - } - - template - void add_line(const KPoint &p, const KVector &v) - { - double bigNumber = 1e30; - m_buffer_for_mono_lines.add_line_segment((p - (bigNumber)*v), - (p + (bigNumber)*v)); - } - - template - void add_line(const KPoint &p, const KVector &v, const CGAL::IO::Color &acolor) - { - double bigNumber = 1e30; - m_buffer_for_colored_lines.add_line_segment((p - (bigNumber)*v), - (p + (bigNumber)*v), acolor); - } - - template - 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 - void add_text(const KPoint& kp, const char* txt) - { add_text(kp, QString(txt)); } - - template - void add_text(const KPoint& kp, const std::string& txt) - { add_text(kp, txt.c_str()); } - - bool is_a_face_started() const - { - return m_buffer_for_mono_faces.is_a_face_started() || - m_buffer_for_colored_faces.is_a_face_started(); - } - - void face_begin() - { - if (is_a_face_started()) - { - std::cerr<<"You cannot start a new face before to finish the previous one."< - bool add_point_in_face(const KPoint& kp) - { - if (m_buffer_for_mono_faces.is_a_face_started()) - { return m_buffer_for_mono_faces.add_point_in_face(kp); } - else if (m_buffer_for_colored_faces.is_a_face_started()) - { return m_buffer_for_colored_faces.add_point_in_face(kp); } - return false; - } - - template - bool add_point_in_face(const KPoint& kp, const KVector& p_normal) - { - if (m_buffer_for_mono_faces.is_a_face_started()) - { return m_buffer_for_mono_faces.add_point_in_face(kp, p_normal); } - else if (m_buffer_for_colored_faces.is_a_face_started()) - { return m_buffer_for_colored_faces.add_point_in_face(kp, p_normal); } - return false; - } - - void face_end() - { - if (m_buffer_for_mono_faces.is_a_face_started()) - { m_buffer_for_mono_faces.face_end(); } - else if (m_buffer_for_colored_faces.is_a_face_started()) - { return m_buffer_for_colored_faces.face_end(); } - } + const Graphics_scene& graphics_scene() const + { return gBuffer; } virtual void redraw() { @@ -475,21 +266,362 @@ public: update(); } -protected: - // Shortcuts to simplify function calls. - template - static Local_point get_local_point(const KPoint& p) + void reverse_all_normals() { - return internal::Geom_utils::Kernel, Local_kernel>:: - get_local_point(p); - } - template - static Local_vector get_local_vector(const KVector& v) - { - return internal::Geom_utils::Kernel, Local_kernel>:: - get_local_vector(v); + m_inverse_normal=!m_inverse_normal; + gBuffer.reverse_all_normals(); } + // Returns true if the data structure lies on a plane + bool is_two_dimensional() const + { return !m_no_2D_mode && gBuffer.is_two_dimensional(); } + + virtual void draw() + { + glEnable(GL_DEPTH_TEST); + + QMatrix4x4 clipping_mMatrix; + clipping_mMatrix.setToIdentity(); + for(int i=0; i< 16 ; i++) + { clipping_mMatrix.data()[i] = m_frame_plane->matrix()[i]; } + QVector4D clipPlane = clipping_mMatrix * QVector4D(0.0, 0.0, 1.0, 0.0); + QVector4D plane_point = clipping_mMatrix * QVector4D(0,0,0,1); + if(!m_are_buffers_initialized) + { initialize_buffers(); } + + QColor color; + attrib_buffers(this); + + if(m_draw_vertices) + { + rendering_program_p_l.bind(); + + // rendering_mode == -1: draw all + // rendering_mode == 0: draw inside clipping plane + // rendering_mode == 1: draw outside clipping plane + auto renderer = [this, &color, &clipPlane, &plane_point](float rendering_mode) { + vao[VAO_MONO_POINTS].bind(); + color.setRgbF((double)m_vertices_mono_color.red()/(double)255, + (double)m_vertices_mono_color.green()/(double)255, + (double)m_vertices_mono_color.blue()/(double)255); + rendering_program_p_l.setAttributeValue("color",color); + rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points)); + rendering_program_p_l.setUniformValue("clipPlane", clipPlane); + rendering_program_p_l.setUniformValue("pointPlane", plane_point); + rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); + glDrawArrays(GL_POINTS, 0, static_cast(gBuffer.number_of_elements(GS::POS_MONO_POINTS))); + vao[VAO_MONO_POINTS].release(); + + vao[VAO_COLORED_POINTS].bind(); + if (m_use_mono_color) + { + color.setRgbF((double)m_vertices_mono_color.red()/(double)255, + (double)m_vertices_mono_color.green()/(double)255, + (double)m_vertices_mono_color.blue()/(double)255); + rendering_program_p_l.disableAttributeArray("color"); + rendering_program_p_l.setAttributeValue("color",color); + } + else + { + rendering_program_p_l.enableAttributeArray("color"); + } + rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points)); + rendering_program_p_l.setUniformValue("clipPlane", clipPlane); + rendering_program_p_l.setUniformValue("pointPlane", plane_point); + rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); + glDrawArrays(GL_POINTS, 0, static_cast(gBuffer.number_of_elements(GS::POS_COLORED_POINTS))); + vao[VAO_COLORED_POINTS].release(); + }; + + enum { + DRAW_ALL = -1, // draw all + DRAW_INSIDE_ONLY, // draw only the part inside the clipping plane + DRAW_OUTSIDE_ONLY // draw only the part outside the clipping plane + }; + + if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_ONLY) + { + renderer(DRAW_INSIDE_ONLY); + } + else + { + renderer(DRAW_ALL); + } + + rendering_program_p_l.release(); + } + + if(m_draw_edges) + { + rendering_program_p_l.bind(); + + // rendering_mode == -1: draw all + // rendering_mode == 0: draw inside clipping plane + // rendering_mode == 1: draw outside clipping plane + auto renderer = [this, &color, &clipPlane, &plane_point](float rendering_mode) { + vao[VAO_MONO_SEGMENTS].bind(); + color.setRgbF((double)m_edges_mono_color.red()/(double)255, + (double)m_edges_mono_color.green()/(double)255, + (double)m_edges_mono_color.blue()/(double)255); + rendering_program_p_l.setAttributeValue("color",color); + rendering_program_p_l.setUniformValue("clipPlane", clipPlane); + rendering_program_p_l.setUniformValue("pointPlane", plane_point); + rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); + glLineWidth(m_size_edges); + glDrawArrays(GL_LINES, 0, static_cast(gBuffer.number_of_elements(GS::POS_MONO_SEGMENTS))); + vao[VAO_MONO_SEGMENTS].release(); + + vao[VAO_COLORED_SEGMENTS].bind(); + if (m_use_mono_color) + { + color.setRgbF((double)m_edges_mono_color.red()/(double)255, + (double)m_edges_mono_color.green()/(double)255, + (double)m_edges_mono_color.blue()/(double)255); + rendering_program_p_l.disableAttributeArray("color"); + rendering_program_p_l.setAttributeValue("color",color); + } + else + { + rendering_program_p_l.enableAttributeArray("color"); + } + rendering_program_p_l.setUniformValue("clipPlane", clipPlane); + rendering_program_p_l.setUniformValue("pointPlane", plane_point); + rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); + glLineWidth(m_size_edges); + glDrawArrays(GL_LINES, 0, static_cast(gBuffer.number_of_elements(GS::POS_COLORED_SEGMENTS))); + vao[VAO_COLORED_SEGMENTS].release(); + }; + + enum { + DRAW_ALL = -1, // draw all + DRAW_INSIDE_ONLY, // draw only the part inside the clipping plane + DRAW_OUTSIDE_ONLY // draw only the part outside the clipping plane + }; + + if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_ONLY) + { + renderer(DRAW_INSIDE_ONLY); + } + else + { + renderer(DRAW_ALL); + } + + rendering_program_p_l.release(); + } + + if(m_draw_rays) + { + rendering_program_p_l.bind(); + + vao[VAO_MONO_RAYS].bind(); + color.setRgbF((double)m_rays_mono_color.red()/(double)255, + (double)m_rays_mono_color.green()/(double)255, + (double)m_rays_mono_color.blue()/(double)255); + rendering_program_p_l.setAttributeValue("color",color); + glLineWidth(m_size_rays); + glDrawArrays(GL_LINES, 0, static_cast(gBuffer.number_of_elements(GS::POS_MONO_RAYS))); + vao[VAO_MONO_RAYS].release(); + + vao[VAO_COLORED_RAYS].bind(); + if (m_use_mono_color) + { + color.setRgbF((double)m_rays_mono_color.red()/(double)255, + (double)m_rays_mono_color.green()/(double)255, + (double)m_rays_mono_color.blue()/(double)255); + rendering_program_p_l.disableAttributeArray("color"); + rendering_program_p_l.setAttributeValue("color",color); + } + else + { + rendering_program_p_l.enableAttributeArray("color"); + } + glLineWidth(m_size_rays); + glDrawArrays(GL_LINES, 0, static_cast(gBuffer.number_of_elements(GS::POS_COLORED_RAYS))); + vao[VAO_COLORED_RAYS].release(); + + rendering_program_p_l.release(); + } + + if(m_draw_lines) + { + rendering_program_p_l.bind(); + + vao[VAO_MONO_LINES].bind(); + color.setRgbF((double)m_lines_mono_color.red()/(double)255, + (double)m_lines_mono_color.green()/(double)255, + (double)m_lines_mono_color.blue()/(double)255); + rendering_program_p_l.setAttributeValue("color",color); + glLineWidth(m_size_lines); + glDrawArrays(GL_LINES, 0, static_cast(gBuffer.number_of_elements(GS::POS_MONO_LINES))); + vao[VAO_MONO_LINES].release(); + + rendering_program_p_l.release(); + + vao[VAO_COLORED_LINES].bind(); + if (m_use_mono_color) + { + color.setRgbF((double)m_lines_mono_color.red()/(double)255, + (double)m_lines_mono_color.green()/(double)255, + (double)m_lines_mono_color.blue()/(double)255); + rendering_program_p_l.disableAttributeArray("color"); + rendering_program_p_l.setAttributeValue("color",color); + } + else + { + rendering_program_p_l.enableAttributeArray("color"); + } + glLineWidth(m_size_lines); + glDrawArrays(GL_LINES, 0, static_cast(gBuffer.number_of_elements(GS::POS_COLORED_LINES))); + vao[VAO_COLORED_LINES].release(); + + rendering_program_p_l.release(); + } + + // Fix Z-fighting by drawing faces at a depth + GLfloat offset_factor; + GLfloat offset_units; + if (is_two_dimensional()) { + glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor); + glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units); + glPolygonOffset(0.1f, 0.9f); + } + + if (m_draw_faces) + { + rendering_program_face.bind(); + + // reference: https://stackoverflow.com/questions/37780345/opengl-how-to-create-order-independent-transparency + // rendering_mode == -1: draw all as solid; + // rendering_mode == 0: draw solid only; + // rendering_mode == 1: draw transparent only; + auto renderer = [this, &color, &clipPlane, &plane_point](float rendering_mode) { + + vao[VAO_MONO_FACES].bind(); + color.setRgbF((double)m_faces_mono_color.red()/(double)255, + (double)m_faces_mono_color.green()/(double)255, + (double)m_faces_mono_color.blue()/(double)255); + rendering_program_face.setAttributeValue("color",color); + rendering_program_face.setUniformValue("rendering_mode", rendering_mode); + rendering_program_face.setUniformValue("rendering_transparency", clipping_plane_rendering_transparency); + rendering_program_face.setUniformValue("clipPlane", clipPlane); + rendering_program_face.setUniformValue("pointPlane", plane_point); + glDrawArrays(GL_TRIANGLES, 0, static_cast(gBuffer.number_of_elements(GS::POS_MONO_FACES))); + vao[VAO_MONO_FACES].release(); + + vao[VAO_COLORED_FACES].bind(); + if (m_use_mono_color) + { + color.setRgbF((double)m_faces_mono_color.red()/(double)255, + (double)m_faces_mono_color.green()/(double)255, + (double)m_faces_mono_color.blue()/(double)255); + rendering_program_face.disableAttributeArray("color"); + rendering_program_face.setAttributeValue("color",color); + } + else + { + rendering_program_face.enableAttributeArray("color"); + } + rendering_program_face.setUniformValue("rendering_mode", rendering_mode); + rendering_program_face.setUniformValue("rendering_transparency", clipping_plane_rendering_transparency); + rendering_program_face.setUniformValue("clipPlane", clipPlane); + rendering_program_face.setUniformValue("pointPlane", plane_point); + glDrawArrays(GL_TRIANGLES, 0, static_cast(gBuffer.number_of_elements(GS::POS_COLORED_FACES))); + vao[VAO_COLORED_FACES].release(); + }; + + auto renderer_clipping_plane = [this](bool clipping_plane_rendering) { + if (!isOpenGL_4_3()) return; + if (!clipping_plane_rendering) return; + // render clipping plane here + rendering_program_clipping_plane.bind(); + vao[VAO_CLIPPING_PLANE].bind(); + glLineWidth(0.1f); + glDrawArrays(GL_LINES, 0, static_cast((m_array_for_clipping_plane.size()/3))); + glLineWidth(1.0f); + vao[VAO_CLIPPING_PLANE].release(); + rendering_program_clipping_plane.release(); + }; + + enum { + DRAW_SOLID_ALL = -1, // draw all mesh in solid mode + DRAW_SOLID_HALF, // draw only the mesh inside the clipping plane as solid + DRAW_TRANSPARENT_HALF // draw only the mesh outside the clipping plane as transparent + }; + + if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_TRANSPARENT_HALF) + { + // The z-buffer will prevent transparent objects from being displayed behind other transparent objects. + // Before rendering all transparent objects, disable z-testing first. + + // 1. draw solid first + renderer(DRAW_SOLID_HALF); + + // 2. draw transparent layer second with back face culling to avoid messy triangles + glDepthMask(false); //disable z-testing + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + glFrontFace(GL_CW); + renderer(DRAW_TRANSPARENT_HALF); + + // 3. draw solid again without culling and blend to make sure the solid mesh is visible + glDepthMask(true); //enable z-testing + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + renderer(DRAW_SOLID_HALF); + + // 4. render clipping plane here + renderer_clipping_plane(clipping_plane_rendering); + } + else if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_WIRE_HALF || + m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_ONLY) + { + // 1. draw solid HALF + renderer(DRAW_SOLID_HALF); + + // 2. render clipping plane here + renderer_clipping_plane(clipping_plane_rendering); + } + else + { + // 1. draw solid FOR ALL + renderer(DRAW_SOLID_ALL); + } + + if (is_two_dimensional()) + glPolygonOffset(offset_factor, offset_units); + + rendering_program_face.release(); + } + + if (m_draw_text) + { + glDisable(GL_LIGHTING); + for (std::size_t i=0; iprojectedCoordinatesOf + (CGAL::qglviewer::Vec(std::get<0>(m_texts_vec[i]).x(), + std::get<0>(m_texts_vec[i]).y(), + std::get<0>(m_texts_vec[i]).z())); + + drawText((int)screenPos[0], (int)screenPos[1], + QString(std::get<1>(m_texts_vec[i]).c_str())); + } + glEnable(GL_LIGHTING); + } + + // Multiply matrix to get in the frame coordinate system. + // glMultMatrixd(manipulatedFrame()->matrix()); // Linker error + // Scale down the drawings + // glScalef(0.3f, 0.3f, 0.3f); // Linker error + // Draw an axis using the QGLViewer static function + // drawAxis(); + } + +protected: void compile_shaders() { rendering_program_face.removeAllShaders(); @@ -497,7 +629,7 @@ protected: rendering_program_clipping_plane.removeAllShaders(); // Create the buffers - for (unsigned int i=0; i(arrays[POS_MONO_POINTS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_MONO_POINTS).data(), + gBuffer.get_size_of_index(GS::POS_MONO_POINTS)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3); + // TODO/QUESTION can we use double for BufferType? + // if not remove the template parameter and use float everywhere. buffers[bufn].release(); @@ -635,19 +769,19 @@ protected: vao[VAO_COLORED_POINTS].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_COLORED_POINTS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_COLORED_POINTS).data(), + gBuffer.get_size_of_index(GS::POS_COLORED_POINTS)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3); buffers[bufn].release(); ++bufn; - CGAL_assertion(bufn(arrays[COLOR_POINTS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::COLOR_POINTS).data(), + gBuffer.get_size_of_index(GS::COLOR_POINTS)); rendering_program_p_l.enableAttributeArray("color"); rendering_program_p_l.setAttributeBuffer("color",GL_FLOAT,0,3); buffers[bufn].release(); @@ -660,10 +794,10 @@ protected: vao[VAO_MONO_SEGMENTS].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_MONO_SEGMENTS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_MONO_SEGMENTS).data(), + gBuffer.get_size_of_index(GS::POS_MONO_SEGMENTS)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3); @@ -677,20 +811,20 @@ protected: vao[VAO_COLORED_SEGMENTS].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_COLORED_SEGMENTS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_COLORED_SEGMENTS).data(), + gBuffer.get_size_of_index(GS::POS_COLORED_SEGMENTS)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3); buffers[bufn].release(); ++bufn; - CGAL_assertion(bufn(arrays[COLOR_SEGMENTS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::COLOR_SEGMENTS).data(), + gBuffer.get_size_of_index(GS::COLOR_SEGMENTS)); rendering_program_p_l.enableAttributeArray("color"); rendering_program_p_l.setAttributeBuffer("color",GL_FLOAT,0,3); buffers[bufn].release(); @@ -705,10 +839,10 @@ protected: vao[VAO_MONO_RAYS].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_MONO_RAYS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_MONO_RAYS).data(), + gBuffer.get_size_of_index(GS::POS_MONO_RAYS)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeArray("vertex",GL_FLOAT,0,3); @@ -723,20 +857,20 @@ protected: vao[VAO_COLORED_RAYS].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_COLORED_RAYS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_COLORED_RAYS).data(), + gBuffer.get_size_of_index(GS::POS_COLORED_RAYS)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3); buffers[bufn].release(); ++bufn; - CGAL_assertion(bufn(arrays[COLOR_RAYS].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::COLOR_RAYS).data(), + gBuffer.get_size_of_index(GS::COLOR_RAYS)); rendering_program_p_l.enableAttributeArray("color"); rendering_program_p_l.setAttributeBuffer("color",GL_FLOAT,0,3); buffers[bufn].release(); @@ -750,10 +884,10 @@ protected: vao[VAO_MONO_LINES].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_MONO_LINES].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_MONO_LINES).data(), + gBuffer.get_size_of_index(GS::POS_MONO_LINES)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeArray("vertex",GL_FLOAT,0,3); @@ -768,20 +902,20 @@ protected: vao[VAO_COLORED_LINES].bind(); ++bufn; - CGAL_assertion(bufn(arrays[POS_COLORED_LINES].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_COLORED_LINES).data(), + gBuffer.get_size_of_index(GS::POS_COLORED_LINES)); rendering_program_p_l.enableAttributeArray("vertex"); rendering_program_p_l.setAttributeBuffer("vertex",GL_FLOAT,0,3); buffers[bufn].release(); ++bufn; - CGAL_assertion(bufn(arrays[COLOR_LINES].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::COLOR_LINES).data(), + gBuffer.get_size_of_index(GS::COLOR_LINES)); rendering_program_p_l.enableAttributeArray("color"); rendering_program_p_l.setAttributeBuffer("color",GL_FLOAT,0,3); buffers[bufn].release(); @@ -798,10 +932,10 @@ protected: // 5.1.1) points of the mono faces ++bufn; - CGAL_assertion(bufn(arrays[POS_MONO_FACES].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_MONO_FACES).data(), + gBuffer.get_size_of_index(GS::POS_MONO_FACES)); rendering_program_face.enableAttributeArray("vertex"); rendering_program_face.setAttributeBuffer("vertex",GL_FLOAT,0,3); @@ -809,19 +943,17 @@ protected: // 5.1.2) normals of the mono faces ++bufn; - CGAL_assertion(bufn(arrays[FLAT_NORMAL_MONO_FACES].size()* - sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::FLAT_NORMAL_MONO_FACES).data(), + gBuffer.get_size_of_index(GS::FLAT_NORMAL_MONO_FACES)); } else { - buffers[bufn].allocate(arrays[SMOOTH_NORMAL_MONO_FACES].data(), - static_cast(arrays[SMOOTH_NORMAL_MONO_FACES].size()* - sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::SMOOTH_NORMAL_MONO_FACES).data(), + gBuffer.get_size_of_index(GS::SMOOTH_NORMAL_MONO_FACES)); } rendering_program_face.enableAttributeArray("normal"); rendering_program_face.setAttributeBuffer("normal",GL_FLOAT,0,3); @@ -837,10 +969,10 @@ protected: // 5.2.1) points of the color faces ++bufn; - CGAL_assertion(bufn(arrays[POS_COLORED_FACES].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::POS_COLORED_FACES).data(), + gBuffer.get_size_of_index(GS::POS_COLORED_FACES)); rendering_program_face.enableAttributeArray("vertex"); rendering_program_face.setAttributeBuffer("vertex",GL_FLOAT,0,3); @@ -848,19 +980,17 @@ protected: // 5.2.2) normals of the color faces ++bufn; - CGAL_assertion(bufn(arrays[FLAT_NORMAL_COLORED_FACES].size()* - sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::FLAT_NORMAL_COLORED_FACES).data(), + gBuffer.get_size_of_index(GS::FLAT_NORMAL_COLORED_FACES)); } else { - buffers[bufn].allocate(arrays[SMOOTH_NORMAL_COLORED_FACES].data(), - static_cast(arrays[SMOOTH_NORMAL_COLORED_FACES].size()* - sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::SMOOTH_NORMAL_COLORED_FACES).data(), + gBuffer.get_size_of_index(GS::SMOOTH_NORMAL_COLORED_FACES)); } rendering_program_face.enableAttributeArray("normal"); rendering_program_face.setAttributeBuffer("normal",GL_FLOAT,0,3); @@ -869,10 +999,10 @@ protected: // 5.2.3) colors of the faces ++bufn; - CGAL_assertion(bufn(arrays[COLOR_FACES].size()*sizeof(float))); + buffers[bufn].allocate(gBuffer.get_array_of_index(GS::COLOR_FACES).data(), + gBuffer.get_size_of_index(GS::COLOR_FACES)); rendering_program_face.enableAttributeArray("color"); rendering_program_face.setAttributeBuffer("color",GL_FLOAT,0,3); @@ -892,10 +1022,10 @@ protected: vao[VAO_CLIPPING_PLANE].bind(); ++bufn; - CGAL_assertion(bufn < NB_VBO_BUFFERS); + CGAL_assertion(bufn < NB_GL_BUFFERS); buffers[bufn].bind(); - buffers[bufn].allocate(arrays[POS_CLIPPING_PLANE].data(), - static_cast(arrays[POS_CLIPPING_PLANE].size() * sizeof(float))); + buffers[bufn].allocate(m_array_for_clipping_plane.data(), + static_cast(m_array_for_clipping_plane.size()*sizeof(BufferType))); rendering_program_clipping_plane.enableAttributeArray("vertex"); rendering_program_clipping_plane.setAttributeBuffer("vertex", GL_FLOAT, 0, 3); @@ -934,13 +1064,13 @@ protected: 1.0f ); CGAL::Bbox_3 bb; - if (bb==bounding_box()) // Case of "empty" bounding box + if (bb==gBuffer.bounding_box()) // Case of "empty" bounding box { bb=Local_point(CGAL::ORIGIN).bbox(); bb=bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer } else - { bb=bounding_box(); } + { bb=gBuffer.bounding_box(); } QVector4D position((bb.xmax()-bb.xmin())/2, (bb.ymax()-bb.ymin())/2, @@ -988,12 +1118,6 @@ protected: } } - // Returns true if the data structure lies on a plane - bool is_two_dimensional() { - return (!is_empty() && !m_no_2D_mode && - (has_zero_x() || has_zero_y() || has_zero_z())); - } - void set_camera_mode() { if (is_two_dimensional()) @@ -1004,9 +1128,9 @@ protected: constraint.setTranslationConstraintType(CGAL::qglviewer::AxisPlaneConstraint::FREE); double cx=0., cy=0., cz=0.; - if (has_zero_x()) { cx=1.; } - else if (has_zero_y()) { cy=1.; } - else { cz=1.; } + if (gBuffer.has_zero_x()) { cx=1.; } + else if (gBuffer.has_zero_y()) { cy=1.; } + else { cz=1.; } camera()->setViewDirection(CGAL::qglviewer::Vec(-cx,-cy,-cz)); constraint.setRotationConstraintDirection(CGAL::qglviewer::Vec(cx, cy, cz)); @@ -1019,349 +1143,6 @@ protected: } } - virtual void draw() - { - glEnable(GL_DEPTH_TEST); - - QMatrix4x4 clipping_mMatrix; - clipping_mMatrix.setToIdentity(); - for(int i=0; i< 16 ; i++) - { clipping_mMatrix.data()[i] = m_frame_plane->matrix()[i]; } - QVector4D clipPlane = clipping_mMatrix * QVector4D(0.0, 0.0, 1.0, 0.0); - QVector4D plane_point = clipping_mMatrix * QVector4D(0,0,0,1); - if(!m_are_buffers_initialized) - { initialize_buffers(); } - - QColor color; - attrib_buffers(this); - - if(m_draw_vertices) - { - rendering_program_p_l.bind(); - - // rendering_mode == -1: draw all - // rendering_mode == 0: draw inside clipping plane - // rendering_mode == 1: draw outside clipping plane - auto renderer = [this, &color, &clipPlane, &plane_point](float rendering_mode) { - vao[VAO_MONO_POINTS].bind(); - color.setRgbF((double)m_vertices_mono_color.red()/(double)255, - (double)m_vertices_mono_color.green()/(double)255, - (double)m_vertices_mono_color.blue()/(double)255); - rendering_program_p_l.setAttributeValue("color",color); - rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points)); - rendering_program_p_l.setUniformValue("clipPlane", clipPlane); - rendering_program_p_l.setUniformValue("pointPlane", plane_point); - rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); - glDrawArrays(GL_POINTS, 0, static_cast(arrays[POS_MONO_POINTS].size()/3)); - vao[VAO_MONO_POINTS].release(); - - vao[VAO_COLORED_POINTS].bind(); - if (m_use_mono_color) - { - color.setRgbF((double)m_vertices_mono_color.red()/(double)255, - (double)m_vertices_mono_color.green()/(double)255, - (double)m_vertices_mono_color.blue()/(double)255); - rendering_program_p_l.disableAttributeArray("color"); - rendering_program_p_l.setAttributeValue("color",color); - } - else - { - rendering_program_p_l.enableAttributeArray("color"); - } - rendering_program_p_l.setUniformValue("point_size", GLfloat(m_size_points)); - rendering_program_p_l.setUniformValue("clipPlane", clipPlane); - rendering_program_p_l.setUniformValue("pointPlane", plane_point); - rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); - glDrawArrays(GL_POINTS, 0, static_cast(arrays[POS_COLORED_POINTS].size()/3)); - vao[VAO_COLORED_POINTS].release(); - }; - - enum { - DRAW_ALL = -1, // draw all - DRAW_INSIDE_ONLY, // draw only the part inside the clipping plane - DRAW_OUTSIDE_ONLY // draw only the part outside the clipping plane - }; - - if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_ONLY) - { - renderer(DRAW_INSIDE_ONLY); - } - else - { - renderer(DRAW_ALL); - } - - rendering_program_p_l.release(); - } - - if(m_draw_edges) - { - rendering_program_p_l.bind(); - - // rendering_mode == -1: draw all - // rendering_mode == 0: draw inside clipping plane - // rendering_mode == 1: draw outside clipping plane - auto renderer = [this, &color, &clipPlane, &plane_point](float rendering_mode) { - vao[VAO_MONO_SEGMENTS].bind(); - color.setRgbF((double)m_edges_mono_color.red()/(double)255, - (double)m_edges_mono_color.green()/(double)255, - (double)m_edges_mono_color.blue()/(double)255); - rendering_program_p_l.setAttributeValue("color",color); - rendering_program_p_l.setUniformValue("clipPlane", clipPlane); - rendering_program_p_l.setUniformValue("pointPlane", plane_point); - rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); - glLineWidth(m_size_edges); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_MONO_SEGMENTS].size()/3)); - vao[VAO_MONO_SEGMENTS].release(); - - vao[VAO_COLORED_SEGMENTS].bind(); - if (m_use_mono_color) - { - color.setRgbF((double)m_edges_mono_color.red()/(double)255, - (double)m_edges_mono_color.green()/(double)255, - (double)m_edges_mono_color.blue()/(double)255); - rendering_program_p_l.disableAttributeArray("color"); - rendering_program_p_l.setAttributeValue("color",color); - } - else - { - rendering_program_p_l.enableAttributeArray("color"); - } - rendering_program_p_l.setUniformValue("clipPlane", clipPlane); - rendering_program_p_l.setUniformValue("pointPlane", plane_point); - rendering_program_p_l.setUniformValue("rendering_mode", rendering_mode); - glLineWidth(m_size_edges); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_COLORED_SEGMENTS].size()/3)); - vao[VAO_COLORED_SEGMENTS].release(); - }; - - enum { - DRAW_ALL = -1, // draw all - DRAW_INSIDE_ONLY, // draw only the part inside the clipping plane - DRAW_OUTSIDE_ONLY // draw only the part outside the clipping plane - }; - - if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_ONLY) - { - renderer(DRAW_INSIDE_ONLY); - } - else - { - renderer(DRAW_ALL); - } - - rendering_program_p_l.release(); - } - - if(m_draw_rays) - { - rendering_program_p_l.bind(); - - vao[VAO_MONO_RAYS].bind(); - color.setRgbF((double)m_rays_mono_color.red()/(double)255, - (double)m_rays_mono_color.green()/(double)255, - (double)m_rays_mono_color.blue()/(double)255); - rendering_program_p_l.setAttributeValue("color",color); - glLineWidth(m_size_rays); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_MONO_RAYS].size()/3)); - vao[VAO_MONO_RAYS].release(); - - vao[VAO_COLORED_RAYS].bind(); - if (m_use_mono_color) - { - color.setRgbF((double)m_rays_mono_color.red()/(double)255, - (double)m_rays_mono_color.green()/(double)255, - (double)m_rays_mono_color.blue()/(double)255); - rendering_program_p_l.disableAttributeArray("color"); - rendering_program_p_l.setAttributeValue("color",color); - } - else - { - rendering_program_p_l.enableAttributeArray("color"); - } - glLineWidth(m_size_rays); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_COLORED_RAYS].size()/3)); - vao[VAO_COLORED_RAYS].release(); - - rendering_program_p_l.release(); - } - - if(m_draw_lines) - { - rendering_program_p_l.bind(); - - vao[VAO_MONO_LINES].bind(); - color.setRgbF((double)m_lines_mono_color.red()/(double)255, - (double)m_lines_mono_color.green()/(double)255, - (double)m_lines_mono_color.blue()/(double)255); - rendering_program_p_l.setAttributeValue("color",color); - glLineWidth(m_size_lines); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_MONO_LINES].size()/3)); - vao[VAO_MONO_LINES].release(); - - rendering_program_p_l.release(); - - vao[VAO_COLORED_LINES].bind(); - if (m_use_mono_color) - { - color.setRgbF((double)m_rays_mono_color.red()/(double)255, - (double)m_rays_mono_color.green()/(double)255, - (double)m_rays_mono_color.blue()/(double)255); - rendering_program_p_l.disableAttributeArray("color"); - rendering_program_p_l.setAttributeValue("color",color); - } - else - { - rendering_program_p_l.enableAttributeArray("color"); - } - glLineWidth(m_size_lines); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_COLORED_LINES].size()/3)); - vao[VAO_COLORED_LINES].release(); - - rendering_program_p_l.release(); - } - - // Fix Z-fighting by drawing faces at a depth - GLfloat offset_factor; - GLfloat offset_units; - if (is_two_dimensional()) { - glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &offset_factor); - glGetFloatv(GL_POLYGON_OFFSET_UNITS, &offset_units); - glPolygonOffset(0.1f, 0.9f); - } - - if (m_draw_faces) - { - rendering_program_face.bind(); - - // reference: https://stackoverflow.com/questions/37780345/opengl-how-to-create-order-independent-transparency - // rendering_mode == -1: draw all as solid; - // rendering_mode == 0: draw solid only; - // rendering_mode == 1: draw transparent only; - auto renderer = [this, &color, &clipPlane, &plane_point](float rendering_mode) { - - vao[VAO_MONO_FACES].bind(); - color.setRgbF((double)m_faces_mono_color.red()/(double)255, - (double)m_faces_mono_color.green()/(double)255, - (double)m_faces_mono_color.blue()/(double)255); - rendering_program_face.setAttributeValue("color",color); - rendering_program_face.setUniformValue("rendering_mode", rendering_mode); - rendering_program_face.setUniformValue("rendering_transparency", clipping_plane_rendering_transparency); - rendering_program_face.setUniformValue("clipPlane", clipPlane); - rendering_program_face.setUniformValue("pointPlane", plane_point); - glDrawArrays(GL_TRIANGLES, 0, static_cast(arrays[POS_MONO_FACES].size()/3)); - vao[VAO_MONO_FACES].release(); - - vao[VAO_COLORED_FACES].bind(); - if (m_use_mono_color) - { - color.setRgbF((double)m_faces_mono_color.red()/(double)255, - (double)m_faces_mono_color.green()/(double)255, - (double)m_faces_mono_color.blue()/(double)255); - rendering_program_face.disableAttributeArray("color"); - rendering_program_face.setAttributeValue("color",color); - } - else - { - rendering_program_face.enableAttributeArray("color"); - } - rendering_program_face.setUniformValue("rendering_mode", rendering_mode); - rendering_program_face.setUniformValue("rendering_transparency", clipping_plane_rendering_transparency); - rendering_program_face.setUniformValue("clipPlane", clipPlane); - rendering_program_face.setUniformValue("pointPlane", plane_point); - glDrawArrays(GL_TRIANGLES, 0, static_cast(arrays[POS_COLORED_FACES].size()/3)); - vao[VAO_COLORED_FACES].release(); - }; - - auto renderer_clipping_plane = [this](bool clipping_plane_rendering) { - if (!isOpenGL_4_3()) return; - if (!clipping_plane_rendering) return; - // render clipping plane here - rendering_program_clipping_plane.bind(); - vao[VAO_CLIPPING_PLANE].bind(); - glLineWidth(0.1f); - glDrawArrays(GL_LINES, 0, static_cast(arrays[POS_CLIPPING_PLANE].size() / 3)); - glLineWidth(1.0f); - vao[VAO_CLIPPING_PLANE].release(); - rendering_program_clipping_plane.release(); - }; - - enum { - DRAW_SOLID_ALL = -1, // draw all mesh in solid mode - DRAW_SOLID_HALF, // draw only the mesh inside the clipping plane as solid - DRAW_TRANSPARENT_HALF // draw only the mesh outside the clipping plane as transparent - }; - - if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_TRANSPARENT_HALF) - { - // The z-buffer will prevent transparent objects from being displayed behind other transparent objects. - // Before rendering all transparent objects, disable z-testing first. - - // 1. draw solid first - renderer(DRAW_SOLID_HALF); - - // 2. draw transparent layer second with back face culling to avoid messy triangles - glDepthMask(false); //disable z-testing - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_CULL_FACE); - glCullFace(GL_BACK); - glFrontFace(GL_CW); - renderer(DRAW_TRANSPARENT_HALF); - - // 3. draw solid again without culling and blend to make sure the solid mesh is visible - glDepthMask(true); //enable z-testing - glDisable(GL_CULL_FACE); - glDisable(GL_BLEND); - renderer(DRAW_SOLID_HALF); - - // 4. render clipping plane here - renderer_clipping_plane(clipping_plane_rendering); - } - else if (m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_WIRE_HALF || - m_use_clipping_plane == CLIPPING_PLANE_SOLID_HALF_ONLY) - { - // 1. draw solid HALF - renderer(DRAW_SOLID_HALF); - - // 2. render clipping plane here - renderer_clipping_plane(clipping_plane_rendering); - } - else - { - // 1. draw solid FOR ALL - renderer(DRAW_SOLID_ALL); - } - - if (is_two_dimensional()) - glPolygonOffset(offset_factor, offset_units); - - rendering_program_face.release(); - } - - if (m_draw_text) - { - glDisable(GL_LIGHTING); - for (std::size_t i=0; iprojectedCoordinatesOf - (CGAL::qglviewer::Vec(std::get<0>(m_texts[i]).x(), - std::get<0>(m_texts[i]).y(), - std::get<0>(m_texts[i]).z())); - - drawText((int)screenPos[0], (int)screenPos[1], std::get<1>(m_texts[i])); - } - glEnable(GL_LIGHTING); - } - - // Multiply matrix to get in the frame coordinate system. - // glMultMatrixd(manipulatedFrame()->matrix()); // Linker error - // Scale down the drawings - // glScalef(0.3f, 0.3f, 0.3f); // Linker error - // Draw an axis using the QGLViewer static function - // drawAxis(); - } - virtual void init() { set_camera_mode(); @@ -1381,13 +1162,13 @@ protected: compile_shaders(); CGAL::Bbox_3 bb; - if (bb==bounding_box()) // Case of "empty" bounding box + if (bb==gBuffer.bounding_box()) // Case of "empty" bounding box { bb=Local_point(CGAL::ORIGIN).bbox(); bb=bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer } else - { bb=bounding_box(); } + { bb=gBuffer.bounding_box(); } this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(), bb.ymin(), bb.zmin()), @@ -1402,117 +1183,112 @@ protected: void generate_clipping_plane() { - qreal size=((bounding_box().xmax() - bounding_box().xmin()) + - (bounding_box().ymax() - bounding_box().ymin()) + - (bounding_box().zmax() - bounding_box().zmin())); + qreal size=((gBuffer.bounding_box().xmax()-gBuffer.bounding_box().xmin()) + + (gBuffer.bounding_box().ymax()-gBuffer.bounding_box().ymin()) + + (gBuffer.bounding_box().zmax()-gBuffer.bounding_box().zmin())); const unsigned int nbSubdivisions=30; - arrays[POS_CLIPPING_PLANE].clear(); + auto& array = m_array_for_clipping_plane; + array.clear(); for (unsigned int i=0; i<=nbSubdivisions; ++i) { const float pos = float(size*(2.0*i/nbSubdivisions-1.0)); - arrays[POS_CLIPPING_PLANE].push_back(pos); - arrays[POS_CLIPPING_PLANE].push_back(float(-size)); - arrays[POS_CLIPPING_PLANE].push_back(0.f); + array.push_back(pos); + array.push_back(float(-size)); + array.push_back(0.f); - arrays[POS_CLIPPING_PLANE].push_back(pos); - arrays[POS_CLIPPING_PLANE].push_back(float(+size)); - arrays[POS_CLIPPING_PLANE].push_back(0.f); + array.push_back(pos); + array.push_back(float(+size)); + array.push_back(0.f); - arrays[POS_CLIPPING_PLANE].push_back(float(-size)); - arrays[POS_CLIPPING_PLANE].push_back(pos); - arrays[POS_CLIPPING_PLANE].push_back(0.f); + array.push_back(float(-size)); + array.push_back(pos); + array.push_back(0.f); - arrays[POS_CLIPPING_PLANE].push_back(float(size)); - arrays[POS_CLIPPING_PLANE].push_back(pos); - arrays[POS_CLIPPING_PLANE].push_back(0.f); + array.push_back(float(size)); + array.push_back(pos); + array.push_back(0.f); } } - void negate_all_normals() - { - m_buffer_for_mono_faces.negate_normals(); - m_buffer_for_colored_faces.negate_normals(); - } - virtual void keyPressEvent(QKeyEvent *e) { - const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - - if ((e->key()==::Qt::Key_C) && (modifiers==::Qt::NoButton)) + if(!on_key_pressed || !on_key_pressed(e, this)) { - if (!isOpenGL_4_3()) return; - if (!is_two_dimensional()) + const ::Qt::KeyboardModifiers modifiers = e->modifiers(); + if ((e->key()==::Qt::Key_C) && (modifiers==::Qt::NoButton)) { - // toggle clipping plane - m_use_clipping_plane = (m_use_clipping_plane + 1) % CLIPPING_PLANE_END_INDEX; - if (m_use_clipping_plane==CLIPPING_PLANE_OFF) - { setManipulatedFrame(nullptr); } - else - { setManipulatedFrame(m_frame_plane); } - - switch(m_use_clipping_plane) + if (!isOpenGL_4_3()) return; + if (!is_two_dimensional()) { - case CLIPPING_PLANE_OFF: displayMessage(QString("Draw clipping = false")); break; - case CLIPPING_PLANE_SOLID_HALF_TRANSPARENT_HALF: clipping_plane_rendering=true; displayMessage(QString("Draw clipping = solid half & transparent half")); break; - case CLIPPING_PLANE_SOLID_HALF_WIRE_HALF: displayMessage(QString("Draw clipping = solid half & wireframe half")); break; - case CLIPPING_PLANE_SOLID_HALF_ONLY: displayMessage(QString("Draw clipping = solid half only")); break; - default: break; - } - update(); - } - } + // toggle clipping plane + m_use_clipping_plane = (m_use_clipping_plane + 1) % CLIPPING_PLANE_END_INDEX; + if (m_use_clipping_plane==CLIPPING_PLANE_OFF) + { setManipulatedFrame(nullptr); } + else + { setManipulatedFrame(m_frame_plane); } - else if ((e->key()==::Qt::Key_C) && (modifiers==::Qt::AltModifier)) - { - if (!isOpenGL_4_3()) return; - if (m_use_clipping_plane!=CLIPPING_PLANE_OFF) + switch(m_use_clipping_plane) + { + case CLIPPING_PLANE_OFF: displayMessage(QString("Draw clipping = false")); break; + case CLIPPING_PLANE_SOLID_HALF_TRANSPARENT_HALF: clipping_plane_rendering=true; displayMessage(QString("Draw clipping = solid half & transparent half")); break; + case CLIPPING_PLANE_SOLID_HALF_WIRE_HALF: displayMessage(QString("Draw clipping = solid half & wireframe half")); break; + case CLIPPING_PLANE_SOLID_HALF_ONLY: displayMessage(QString("Draw clipping = solid half only")); break; + default: break; + } + update(); + } + } + + else if ((e->key()==::Qt::Key_C) && (modifiers==::Qt::AltModifier)) { - clipping_plane_rendering = !clipping_plane_rendering; - displayMessage(QString("Draw clipping plane=%1.").arg(clipping_plane_rendering?"true":"false")); + if (!isOpenGL_4_3()) return; + if (m_use_clipping_plane!=CLIPPING_PLANE_OFF) + { + clipping_plane_rendering = !clipping_plane_rendering; + displayMessage(QString("Draw clipping plane=%1.").arg(clipping_plane_rendering?"true":"false")); + update(); + } + } + else if ((e->key()==::Qt::Key_E) && (modifiers==::Qt::NoButton)) + { + m_draw_edges=!m_draw_edges; + displayMessage(QString("Draw edges=%1.").arg(m_draw_edges?"true":"false")); update(); } - } - else if ((e->key()==::Qt::Key_E) && (modifiers==::Qt::NoButton)) - { - m_draw_edges=!m_draw_edges; - displayMessage(QString("Draw edges=%1.").arg(m_draw_edges?"true":"false")); - update(); - } - else if ((e->key()==::Qt::Key_M) && (modifiers==::Qt::NoButton)) - { - m_use_mono_color=!m_use_mono_color; - displayMessage(QString("Mono color=%1.").arg(m_use_mono_color?"true":"false")); - update(); - } - else if ((e->key()==::Qt::Key_N) && (modifiers==::Qt::NoButton)) - { - m_inverse_normal=!m_inverse_normal; - displayMessage(QString("Inverse normal=%1.").arg(m_inverse_normal?"true":"false")); - negate_all_normals(); - redraw(); - } - else if ((e->key()==::Qt::Key_S) && (modifiers==::Qt::NoButton)) - { - m_flatShading=!m_flatShading; - if (m_flatShading) - displayMessage("Flat shading."); - else - displayMessage("Gouraud shading."); - redraw(); - } - else if ((e->key()==::Qt::Key_T) && (modifiers==::Qt::NoButton)) - { - m_draw_text=!m_draw_text; - displayMessage(QString("Draw text=%1.").arg(m_draw_text?"true":"false")); - update(); - } - else if ((e->key()==::Qt::Key_U) && (modifiers==::Qt::NoButton)) - { - if (is_two_dimensional()) + else if ((e->key()==::Qt::Key_M) && (modifiers==::Qt::NoButton)) { - displayMessage(QString("Move camera direction upside down.")); - /* CGAL::qglviewer::Vec cur=camera()->viewDirection(); + m_use_mono_color=!m_use_mono_color; + displayMessage(QString("Mono color=%1.").arg(m_use_mono_color?"true":"false")); + update(); + } + else if ((e->key()==::Qt::Key_N) && (modifiers==::Qt::NoButton)) + { + reverse_all_normals(); + displayMessage(QString("Inverse normal=%1.").arg(m_inverse_normal?"true":"false")); + redraw(); + } + else if ((e->key()==::Qt::Key_S) && (modifiers==::Qt::NoButton)) + { + m_flatShading=!m_flatShading; + if (m_flatShading) + displayMessage("Flat shading."); + else + displayMessage("Gouraud shading."); + redraw(); + } + else if ((e->key()==::Qt::Key_T) && (modifiers==::Qt::NoButton)) + { + m_draw_text=!m_draw_text; + displayMessage(QString("Draw text=%1.").arg(m_draw_text?"true":"false")); + update(); + } + else if ((e->key()==::Qt::Key_U) && (modifiers==::Qt::NoButton)) + { + if (is_two_dimensional()) + { + displayMessage(QString("Move camera direction upside down.")); + /* CGAL::qglviewer::Vec cur=camera()->viewDirection(); // TODO ! double cx=cur.x, cy=cur.y, cz=cur.z; if (has_zero_x()) { cx=-cx; } else if (has_zero_y()) { cy=-cy; } @@ -1522,137 +1298,139 @@ protected: else if (has_zero_y()) { cy=(cur.y<0?-1.:1); } else { cz=(cur.z<0?-1.:1); }*/ - camera()->setUpVector(-camera()->upVector()); + camera()->setUpVector(-camera()->upVector()); //camera()->frame()->setConstraint(NULL); // camera()->setViewDirection(CGAL::qglviewer::Vec(-cx,-cy,-cz)); //constraint.setRotationConstraintDirection(CGAL::qglviewer::Vec(cx, cy, cz)); //camera()->frame()->setConstraint(&constraint); //update(); - redraw(); + redraw(); + } } - } - else if ((e->key()==::Qt::Key_V) && (modifiers==::Qt::NoButton)) - { - m_draw_vertices=!m_draw_vertices; - displayMessage(QString("Draw vertices=%1.").arg(m_draw_vertices?"true":"false")); - update(); - } - else if ((e->key()==::Qt::Key_W) && (modifiers==::Qt::NoButton)) - { - m_draw_faces=!m_draw_faces; - displayMessage(QString("Draw faces=%1.").arg(m_draw_faces?"true":"false")); - update(); - } - else if ((e->key()==::Qt::Key_Plus) && (!modifiers.testFlag(::Qt::ControlModifier))) // No ctrl - { - m_size_edges+=.5; - displayMessage(QString("Size of edges=%1.").arg(m_size_edges)); - update(); - } - else if ((e->key()==::Qt::Key_Minus) && (!modifiers.testFlag(::Qt::ControlModifier))) // No ctrl - { - if (m_size_edges>.5) m_size_edges-=.5; - displayMessage(QString("Size of edges=%1.").arg(m_size_edges)); - update(); - } - else if ((e->key()==::Qt::Key_Plus) && (modifiers.testFlag(::Qt::ControlModifier))) - { - m_size_points+=.5; - displayMessage(QString("Size of points=%1.").arg(m_size_points)); - update(); - } - else if ((e->key()==::Qt::Key_Minus) && (modifiers.testFlag(::Qt::ControlModifier))) - { - if (m_size_points>.5) m_size_points-=.5; - displayMessage(QString("Size of points=%1.").arg(m_size_points)); - update(); - } - else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::NoButton)) - { - m_ambient_color.setX(m_ambient_color.x()+.1); - if (m_ambient_color.x()>1.) m_ambient_color.setX(1.); - m_ambient_color.setY(m_ambient_color.x()+.1); - if (m_ambient_color.y()>1.) m_ambient_color.setY(1.); - m_ambient_color.setZ(m_ambient_color.x()+.1); - if (m_ambient_color.z()>1.) m_ambient_color.setZ(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::NoButton)) - { - m_ambient_color.setX(m_ambient_color.x()-.1); - if (m_ambient_color.x()<0.) m_ambient_color.setX(0.); - m_ambient_color.setY(m_ambient_color.y()-.1); - if (m_ambient_color.y()<0.) m_ambient_color.setY(0.); - m_ambient_color.setZ(m_ambient_color.z()-.1); - if (m_ambient_color.z()<0.) m_ambient_color.setZ(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::ShiftModifier)) - { - m_ambient_color.setX(m_ambient_color.x()+.1); - if (m_ambient_color.x()>1.) m_ambient_color.setX(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::AltModifier)) - { - m_ambient_color.setY(m_ambient_color.y()+.1); - if (m_ambient_color.y()>1.) m_ambient_color.setY(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::ControlModifier)) - { - m_ambient_color.setZ(m_ambient_color.z()+.1); - if (m_ambient_color.z()>1.) m_ambient_color.setZ(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::ShiftModifier)) - { - m_ambient_color.setX(m_ambient_color.x()-.1); - if (m_ambient_color.x()<0.) m_ambient_color.setX(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::AltModifier)) - { - m_ambient_color.setY(m_ambient_color.y()-.1); - if (m_ambient_color.y()<0.) m_ambient_color.setY(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::ControlModifier)) - { - m_ambient_color.setZ(m_ambient_color.z()-.1); - if (m_ambient_color.z()<0.) m_ambient_color.setZ(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - update(); - } - else if ((e->key()==::Qt::Key_O) && (modifiers==::Qt::NoButton)) - { - bool old_2D=is_two_dimensional(); - m_no_2D_mode=!m_no_2D_mode; - if (old_2D!=is_two_dimensional()) + else if ((e->key()==::Qt::Key_V) && (modifiers==::Qt::NoButton)) { - if (is_two_dimensional()) - { displayMessage(QString("Viewer is in 2D mode.")); } - else { displayMessage(QString("Viewer is in 3D mode.")); } + m_draw_vertices=!m_draw_vertices; + displayMessage(QString("Draw vertices=%1.").arg(m_draw_vertices?"true":"false")); update(); } + else if ((e->key()==::Qt::Key_W) && (modifiers==::Qt::NoButton)) + { + m_draw_faces=!m_draw_faces; + displayMessage(QString("Draw faces=%1.").arg(m_draw_faces?"true":"false")); + update(); + } + else if ((e->key()==::Qt::Key_Plus) && (!modifiers.testFlag(::Qt::ControlModifier))) // No ctrl + { + m_size_edges+=.5; + displayMessage(QString("Size of edges=%1.").arg(m_size_edges)); + update(); + } + else if ((e->key()==::Qt::Key_Minus) && (!modifiers.testFlag(::Qt::ControlModifier))) // No ctrl + { + if (m_size_edges>.5) m_size_edges-=.5; + displayMessage(QString("Size of edges=%1.").arg(m_size_edges)); + update(); + } + else if ((e->key()==::Qt::Key_Plus) && (modifiers.testFlag(::Qt::ControlModifier))) + { + m_size_points+=.5; + displayMessage(QString("Size of points=%1.").arg(m_size_points)); + update(); + } + else if ((e->key()==::Qt::Key_Minus) && (modifiers.testFlag(::Qt::ControlModifier))) + { + if (m_size_points>.5) m_size_points-=.5; + displayMessage(QString("Size of points=%1.").arg(m_size_points)); + update(); + } + else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::NoButton)) + { + m_ambient_color.setX(m_ambient_color.x()+.1); + if (m_ambient_color.x()>1.) m_ambient_color.setX(1.); + m_ambient_color.setY(m_ambient_color.x()+.1); + if (m_ambient_color.y()>1.) m_ambient_color.setY(1.); + m_ambient_color.setZ(m_ambient_color.x()+.1); + if (m_ambient_color.z()>1.) m_ambient_color.setZ(1.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::NoButton)) + { + m_ambient_color.setX(m_ambient_color.x()-.1); + if (m_ambient_color.x()<0.) m_ambient_color.setX(0.); + m_ambient_color.setY(m_ambient_color.y()-.1); + if (m_ambient_color.y()<0.) m_ambient_color.setY(0.); + m_ambient_color.setZ(m_ambient_color.z()-.1); + if (m_ambient_color.z()<0.) m_ambient_color.setZ(0.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::ShiftModifier)) + { + m_ambient_color.setX(m_ambient_color.x()+.1); + if (m_ambient_color.x()>1.) m_ambient_color.setX(1.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::AltModifier)) + { + m_ambient_color.setY(m_ambient_color.y()+.1); + if (m_ambient_color.y()>1.) m_ambient_color.setY(1.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageUp) && (modifiers==::Qt::ControlModifier)) + { + m_ambient_color.setZ(m_ambient_color.z()+.1); + if (m_ambient_color.z()>1.) m_ambient_color.setZ(1.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::ShiftModifier)) + { + m_ambient_color.setX(m_ambient_color.x()-.1); + if (m_ambient_color.x()<0.) m_ambient_color.setX(0.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::AltModifier)) + { + m_ambient_color.setY(m_ambient_color.y()-.1); + if (m_ambient_color.y()<0.) m_ambient_color.setY(0.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_PageDown) && (modifiers==::Qt::ControlModifier)) + { + m_ambient_color.setZ(m_ambient_color.z()-.1); + if (m_ambient_color.z()<0.) m_ambient_color.setZ(0.); + displayMessage(QString("Light color=(%1 %2 %3)."). + arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); + update(); + } + else if ((e->key()==::Qt::Key_O) && (modifiers==::Qt::NoButton)) + { + bool old_2D=is_two_dimensional(); + m_no_2D_mode=!m_no_2D_mode; + if (old_2D!=is_two_dimensional()) + { + if (is_two_dimensional()) + { displayMessage(QString("Viewer is in 2D mode.")); } + else { displayMessage(QString("Viewer is in 3D mode.")); } + set_camera_mode(); + update(); + } + } + else + { CGAL::QGLViewer::keyPressEvent(e); } // By default call QGLViewer key press } - else - CGAL::QGLViewer::keyPressEvent(e); } virtual QString helpString() const @@ -1689,8 +1467,12 @@ protected: text += "Press Escape to exit the viewer."; return text; } +public: + std::function on_key_pressed; protected: + const Graphics_scene& gBuffer; + bool m_draw_vertices; bool m_draw_edges; bool m_draw_rays; @@ -1713,6 +1495,10 @@ protected: int m_use_clipping_plane=CLIPPING_PLANE_OFF; CGAL::qglviewer::ManipulatedFrame* m_frame_plane=nullptr; + // Buffer for clipping plane is not stored in the scene because it is not + // filled by users but by the basic viewer. + std::vector m_array_for_clipping_plane; + double m_size_points; double m_size_edges; double m_size_rays; @@ -1726,60 +1512,14 @@ protected: QVector4D m_ambient_color; bool m_are_buffers_initialized; - CGAL::Bbox_3 m_bounding_box; // CGAL::qglviewer::LocalConstraint constraint; CGAL::qglviewer::WorldConstraint constraint; - // The following enum gives the indices of different elements of arrays vectors. - enum - { - BEGIN_POS=0, - POS_MONO_POINTS=BEGIN_POS, - POS_COLORED_POINTS, - POS_MONO_SEGMENTS, - POS_COLORED_SEGMENTS, - POS_MONO_RAYS, - POS_COLORED_RAYS, - POS_MONO_LINES, - POS_COLORED_LINES, - POS_MONO_FACES, - POS_COLORED_FACES, - POS_CLIPPING_PLANE, - END_POS, - BEGIN_COLOR=END_POS, - COLOR_POINTS=BEGIN_COLOR, - COLOR_SEGMENTS, - COLOR_RAYS, - COLOR_LINES, - COLOR_FACES, - END_COLOR, - BEGIN_NORMAL=END_COLOR, - SMOOTH_NORMAL_MONO_FACES=BEGIN_NORMAL, - FLAT_NORMAL_MONO_FACES, - SMOOTH_NORMAL_COLORED_FACES, - FLAT_NORMAL_COLORED_FACES, - END_NORMAL, - LAST_INDEX=END_NORMAL - }; - std::vector arrays[LAST_INDEX]; + static const unsigned int NB_GL_BUFFERS=(GS::END_POS-GS::BEGIN_POS)+ + (GS::END_COLOR-GS::BEGIN_COLOR)+3; // +2 for normals (mono and color), +1 for clipping plane - Buffer_for_vao m_buffer_for_mono_points; - Buffer_for_vao m_buffer_for_colored_points; - Buffer_for_vao m_buffer_for_mono_segments; - Buffer_for_vao m_buffer_for_colored_segments; - Buffer_for_vao m_buffer_for_mono_rays; - Buffer_for_vao m_buffer_for_colored_rays; - Buffer_for_vao m_buffer_for_mono_lines; - Buffer_for_vao m_buffer_for_colored_lines; - Buffer_for_vao m_buffer_for_mono_faces; - Buffer_for_vao m_buffer_for_colored_faces; - Buffer_for_vao m_buffer_for_clipping_plane; - - static const unsigned int NB_VBO_BUFFERS=(END_POS-BEGIN_POS)+ - (END_COLOR-BEGIN_COLOR)+2; // +2 for 2 vectors of normals - - QOpenGLBuffer buffers[NB_VBO_BUFFERS]; + QOpenGLBuffer buffers[NB_GL_BUFFERS]; // +1 for the buffer of clipping plane // The following enum gives the indices of the different vao. enum @@ -1806,9 +1546,99 @@ protected: bool clipping_plane_rendering = true; // will be toggled when alt+c is pressed, which is used for indicating whether or not to render the clipping plane ; float clipping_plane_rendering_transparency = 0.5f; // to what extent the transparent part should be rendered; - std::vector > m_texts; }; +//------------------------------------------------------------------------------ +class QApplication_and_basic_viewer +{ +public: + QApplication_and_basic_viewer(const CGAL::Graphics_scene& buffer, + const char* title="CGAL Basic Viewer"): + m_application(nullptr), + m_basic_viewer(nullptr), + m_argc(1) + { + m_argv[0]=new char[strlen(title)+1]; + memcpy(m_argv[0], title, strlen(title)+1); + m_argv[1]=nullptr; + +#if defined(CGAL_TEST_SUITE) + bool cgal_test_suite = true; +#else + bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); +#endif + + if (cgal_test_suite) + { return; } + + Qt::init_ogl_context(4, 3); + m_application=new QApplication(m_argc, const_cast(m_argv)); + m_basic_viewer=new Basic_viewer(m_application->activeWindow(), + buffer, title); + } + + ~QApplication_and_basic_viewer() + { + delete[] m_argv[0]; + delete m_basic_viewer; + delete m_application; + } + + operator bool() const + { return m_application!=nullptr; } + + void run() + { + if (m_application!=nullptr) + { + m_basic_viewer->show(); + m_application->exec(); + } + } + + Basic_viewer& basic_viewer() + { + CGAL_assertion(m_basic_viewer!=nullptr); + return *m_basic_viewer; + } + +protected: + QApplication* m_application; + Basic_viewer* m_basic_viewer; + char *m_argv[2]; + int m_argc; +}; + +} // End namespace Qt + +// A shortcut to use directly CGAL::Basic_viewer instead of CGAL::Qt::Basic_viewer. +// Can be changed later if we have several viewers. +using Qt::Basic_viewer; + +inline +void draw_graphics_scene(const Graphics_scene& graphics_scene, + const char *title="CGAL Basic Viewer") +{ +#if defined(CGAL_TEST_SUITE) + bool cgal_test_suite = true; +#else + bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); +#endif + + if (!cgal_test_suite) + { + Qt::init_ogl_context(4, 3); + + int argc = 1; + const char *argv[2] = {title, nullptr}; + QApplication app(argc, const_cast(argv)); + Basic_viewer basic_viewer(app.activeWindow(), graphics_scene, title); + + basic_viewer.show(); + app.exec(); + } +} + } // End namespace CGAL #else // CGAL_USE_BASIC_VIEWER @@ -1822,8 +1652,15 @@ namespace CGAL std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."< -void draw(const PS& aps); + +template +struct Graphics_scene_options_polygon_set_2: public CGAL::Graphics_scene_options +{}; + +/*! +\ingroup PkgDrawPolygonSet2 + +opens a new window and draws a 2D polygon 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 PS2 which must be an instanciation of a `CGAL::Polygon_set_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptionsPolygonSet2` concept. + +\param ps2 the polygon 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::Polygon_set_2& ps2, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void draw(const PS2& ps2, const GSOptions& gso); + +/*! +\ingroup PkgDrawPolygonSet2 + +A shortcut to `CGAL::draw(ps2, Graphics_scene_options_polygon_set_2{})`. +*/ +template +void draw(const PS2& ps2); + +/*! +\ingroup PkgDrawPolygonSet2 + +adds the vertices, edges and faces of `ps2` 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 PS2 which must be an instanciation of a `CGAL::Polygon_set_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptionsPolygonSet2` concept. + +\param ps2 the polygon 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::Polygon_set_2& ps2, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const PS2& ps2, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawPolygonSet2 + +A shortcut to `CGAL::add_to_graphics_scene(ps2, gs, Graphics_scene_options_polygon_set_2{})`. +*/ +template +void add_to_graphics_scene(const PS2& ps2, + CGAL::Graphics_scene& gs); } /* end namespace CGAL */ diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GraphicsSceneOptionsPolygonSet2.h b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GraphicsSceneOptionsPolygonSet2.h new file mode 100644 index 00000000000..458b9baa283 --- /dev/null +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/Concepts/GraphicsSceneOptionsPolygonSet2.h @@ -0,0 +1,38 @@ +/*! +\ingroup PkgBooleanSetOperations2Concepts + +The concept `GraphicsSceneOptionsPolygonSet2` defines data and methods used to tune the way that the cells of a `Polygon_set_2` are considered for drawing or to be added into a graphics scene. + +\cgalRefines{GraphicsSceneOptions} + +\cgalHasModelsBegin +\cgalHasModelsBare{\link CGAL::Graphics_scene_options_polygon_set_2 `CGAL::Graphics_scene_options_polygon_set_2`\endlink} +\cgalHasModelsEnd + +*/ +class GraphicsSceneOptionsPolygonSet2 +{ +public: + /// returns the color of the unbounded face. + const CGAL::IO::Color& unbounded_face_color() const; + /// sets the color of the unbounded face to `c`. + void unbounded_face_color(const CGAL::IO::Color& c); + + /// returns `true` if the unbounded face must be drawn, `false` otherwise. + /// Returns `false` by default. + bool draw_unbounded() const; + /// sets the draw of unbounded face to `b`. + void draw_unbounded(bool b); + /// toggles the draw unbounded face value. + void toggle_draw_unbounded(); + + /// returns the height of the box used to draw the unbounded face. + int height() const; + /// returns the width of the box used to draw the unbounded face. + int width() const; + + /// sets the height of the box used to draw the unbounded face to `i`. + void height(int i); + /// sets the width of the box used to draw the unbounded face to `i`. + void width(int i); +}; diff --git a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt index f67e57f7e1a..a562dd4e48a 100644 --- a/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt +++ b/Boolean_set_operations_2/doc/Boolean_set_operations_2/PackageDescription.txt @@ -69,6 +69,8 @@ containment predicates. - \link boolean_connect_holes `CGAL::connect_holes()` \endlink \cgalCRPSection{Draw a Polygon_set_2} -- \link PkgDrawPolygonSet2 CGAL::draw() \endlink +- \link PkgDrawPolygonSet2 CGAL::draw() \endlink +- `GraphicsSceneOptionsPolygonSet2` +- `CGAL::Graphics_scene_options_polygon_set_2` */ diff --git a/Boolean_set_operations_2/include/CGAL/draw_polygon_set_2.h b/Boolean_set_operations_2/include/CGAL/draw_polygon_set_2.h index bd9cfec7f7c..3ae8c90a999 100644 --- a/Boolean_set_operations_2/include/CGAL/draw_polygon_set_2.h +++ b/Boolean_set_operations_2/include/CGAL/draw_polygon_set_2.h @@ -19,40 +19,159 @@ #include - -#include - -#ifdef DOXYGEN_RUNNING -namespace CGAL { - -/*! - * \ingroup PkgDrawPolygonSet2 - * - * opens a new window and draws `aps`, an instance of the `CGAL::Polygon_set_2` - * class. A call to this function is blocking, that is the program continues as - * soon as the user closes the window. 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 an instance of the `CGAL::Polygon_set_2` class. - * \param aps the polygon set to draw. - */ -template -void draw(const PS& aps); - -} /* namespace CGAL */ -#endif - -#ifdef CGAL_USE_BASIC_VIEWER - -#include +#include +#include +#include #include namespace CGAL { -template -class Polygon_set_2_basic_viewer_qt : public Basic_viewer_qt { - using Base = Basic_viewer_qt; +template +struct Graphics_scene_options_polygon_set_2 : + public CGAL::Graphics_scene_options +{ + void unbounded_face_color(const CGAL::IO::Color& c) + { m_unbounded_face_color=c; } + const CGAL::IO::Color& unbounded_face_color() const + { return m_unbounded_face_color; } + + bool draw_unbounded() const + { return m_draw_unbounded; } + void draw_unbounded(bool b) + { m_draw_unbounded=b; } + void toggle_draw_unbounded() + { m_draw_unbounded=!m_draw_unbounded; } + + int height() const + { return m_height; } + int width() const + { return m_width; } + + void height(int i) + { m_height=i; } + void width(int i) + { m_width=i; } + +protected: + bool m_draw_unbounded=true; + CGAL::IO::Color m_unbounded_face_color=CGAL::IO::Color(75,160,255); + int m_width=0, m_height=0; +}; + +namespace draw_function_for_boolean_set_2 { + +template +void compute_loop(const typename PS2::Polygon_2& p, bool hole, + CGAL::Graphics_scene& gs, + const GSOptions& gso) +{ + if (gso.are_faces_enabled() && hole) + { gs.add_point_in_face(p.vertex(p.size()-1)); } + + auto prev = p.vertices_begin(); + auto it = prev; + + // First vertex + if (gso.are_vertices_enabled() && gso.draw_vertex(p, it)) + { + if(gso.colored_vertex(p, it)) + { gs.add_point(*it, gso.vertex_color(p, it)); } + else + { gs.add_point(*it); } + } + + if (gso.are_faces_enabled()) + { gs.add_point_in_face(*it); } + + // Other vertices + for (++it; it!=p.vertices_end(); ++it) + { + if (gso.are_vertices_enabled() && gso.draw_vertex(p, it)) + { // Add point + if(gso.colored_vertex(p, it)) + { gs.add_point(*it, gso.vertex_color(p, it)); } + else + { gs.add_point(*it); } + } + + if (gso.are_edges_enabled() && gso.draw_edge(p, prev)) + { // Add segment with previous point + if(gso.colored_edge(p, prev)) + { gs.add_segment(*prev, *it, gso.edge_color(p, prev)); } + else + { gs.add_segment(*prev, *it); } + } + + if (gso.are_faces_enabled()) + { gs.add_point_in_face(*it); } // add point in face + prev = it; + } + + // Last segment (between last and first point) + if (gso.are_edges_enabled() && gso.draw_edge(p, prev)) + { + if(gso.colored_edge(p, prev)) + { gs.add_segment(*prev, *(p.vertices_begin()), gso.edge_color(p, prev)); } + else + { gs.add_segment(*prev, *(p.vertices_begin())); } + } +} + +/// Compute the elements of a polygon with holes. +template +void compute_elements(const PWH& pwh, + CGAL::Graphics_scene& gs, + const GSOptions& gso) +{ + if (!gso.draw_unbounded() && pwh.outer_boundary().is_empty()) return; + + if (gso.are_faces_enabled()) + { gs.face_begin(gso.unbounded_face_color()); } + + using Pnt=typename PWH::Polygon_2::Point_2; + const Pnt* point_in_face=nullptr; + if (pwh.outer_boundary().is_empty()) + { + if(gso.width()!=0 && gso.height()!=0) + { + typename PWH::Polygon_2 pgn; + pgn.push_back(Pnt(-gso.width(), -gso.height())); + pgn.push_back(Pnt(gso.width(), -gso.height())); + pgn.push_back(Pnt(gso.width(), gso.height())); + pgn.push_back(Pnt(-gso.width(), gso.height())); + draw_function_for_boolean_set_2::compute_loop(pgn, false, gs, gso); + point_in_face = &(pgn.vertex(pgn.size()-1)); + } + } + else + { + const auto& outer_boundary = pwh.outer_boundary(); + draw_function_for_boolean_set_2::compute_loop(outer_boundary, false, gs, gso); + point_in_face = &(outer_boundary.vertex(outer_boundary.size()-1)); + } + + for (auto it = pwh.holes_begin(); it != pwh.holes_end(); ++it) + { + draw_function_for_boolean_set_2::compute_loop(*it, true, gs, gso); + if (gso.are_faces_enabled() && point_in_face && point_in_face!=nullptr) + { gs.add_point_in_face(*point_in_face); } + } + + if (gso.are_faces_enabled()) + { gs.face_end(); } +} + +} // End namespace draw_function_for_boolean_set_2 + +#ifdef CGAL_USE_BASIC_VIEWER + +template +class Polygon_set_2_basic_viewer_qt : public Basic_viewer +{ + using Base = Basic_viewer; using Ps = PolygonSet_2; using Pwh = typename Ps::Polygon_with_holes_2; using Pgn = typename Ps::Polygon_2; @@ -60,13 +179,15 @@ class Polygon_set_2_basic_viewer_qt : public Basic_viewer_qt { public: Polygon_set_2_basic_viewer_qt(QWidget* parent, const Ps& ps, - const char* title = "Basic Polygon_set_2 Viewer", - bool draw_unbounded = false, - bool draw_vertices = false) : - Base(parent, title, draw_vertices), + GSOptions& gs_options, + const char* title = "Basic Polygon_set_2 Viewer") : + Base(parent, graphics_scene, title), m_ps(ps), - m_draw_unbounded(draw_unbounded) + gso(gs_options) { + gso.width(CGAL_BASIC_VIEWER_INIT_SIZE_X); + gso.height(CGAL_BASIC_VIEWER_INIT_SIZE_Y); + if (ps.is_empty()) return; // mimic the computation of Camera::pixelGLRatio() @@ -74,37 +195,39 @@ public: CGAL::qglviewer::Vec minv(bbox.xmin(), bbox.ymin(), 0); CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0); auto diameter = (maxv - minv).norm(); - m_pixel_ratio = diameter / m_height; + m_pixel_ratio = diameter / gso.height(); } /*! Intercept the resizing of the window. */ virtual void resizeGL(int width, int height) { CGAL::QGLViewer::resizeGL(width, height); - m_width = width; - m_height = height; + gso.width(width); + gso.height(height); CGAL::qglviewer::Vec p; - auto ratio = camera()->pixelGLRatio(p); - if (ratio != m_pixel_ratio) { + auto ratio = this->camera()->pixelGLRatio(p); + if (ratio != m_pixel_ratio) + { m_pixel_ratio = ratio; add_elements(); } } - /*! Compute the elements of a polygon set. - */ - virtual void add_elements() { - clear(); - - std::vector pwhs; - m_ps.polygons_with_holes(std::back_inserter(pwhs)); - for (const auto& pwh : pwhs) add_elements(pwh); - } - /*! Obtain the pixel ratio. */ double pixel_ratio() const { return m_pixel_ratio; } + /*! Compute the elements of a polygon set. + */ + virtual void add_elements() + { + graphics_scene.clear(); + std::vector pwhs; + m_ps.polygons_with_holes(std::back_inserter(pwhs)); + for (const auto& pwh : pwhs) + { draw_function_for_boolean_set_2::compute_elements(pwh, graphics_scene, gso); } + } + /*! Compute the bounding box. */ CGAL::Bbox_2 bounding_box() { @@ -122,64 +245,7 @@ public: return bbox; } -protected: - /*! Compute the elements of a polygon with holes. - */ - void add_elements(const Pwh& pwh) { - if (! m_draw_unbounded && pwh.outer_boundary().is_empty()) return; - - CGAL::IO::Color c(75,160,255); - face_begin(c); - - const Pnt* point_in_face; - if (pwh.outer_boundary().is_empty()) { - Pgn pgn; - pgn.push_back(Pnt(-m_width, -m_height)); - pgn.push_back(Pnt(m_width, -m_height)); - pgn.push_back(Pnt(m_width, m_height)); - pgn.push_back(Pnt(-m_width, m_height)); - compute_loop(pgn, false); - point_in_face = &(pgn.vertex(pgn.size()-1)); - } - else { - const auto& outer_boundary = pwh.outer_boundary(); - compute_loop(outer_boundary, false); - point_in_face = &(outer_boundary.vertex(outer_boundary.size()-1)); - } - - for (auto it = pwh.holes_begin(); it != pwh.holes_end(); ++it) { - compute_loop(*it, true); - add_point_in_face(*point_in_face); - } - - face_end(); - } - - void compute_loop(const Pgn& p, bool hole) { - if (hole) add_point_in_face(p.vertex(p.size()-1)); - - auto prev = p.vertices_begin(); - auto it = prev; - add_point(*it); - add_point_in_face(*it); - for (++it; it != p.vertices_end(); ++it) { - add_point(*it); // add vertex - add_segment(*prev, *it); // add segment with previous point - add_point_in_face(*it); // add point in face - prev = it; - } - - // Add the last segment between the last point and the first one - add_segment(*prev, *(p.vertices_begin())); - } - private: - //! The window width in pixels. - int m_width = CGAL_BASIC_VIEWER_INIT_SIZE_X; - - //! The window height in pixels. - int m_height = CGAL_BASIC_VIEWER_INIT_SIZE_Y; - //! The ratio between pixel and opengl units (in world coordinate system). double m_pixel_ratio = 1; @@ -188,14 +254,39 @@ private: //! Indicates whether to draw unbounded polygons with holes. bool m_draw_unbounded = false; + + Graphics_scene graphics_scene; + GSOptions& gso; }; -// Specialization of draw function. +#endif // CGAL_USE_BASIC_VIEWER + +#define CGAL_PS2_TYPE CGAL::Polygon_set_2 + +// Specializations of add_to_graphics_scene function +template +void add_to_graphics_scene(const CGAL_PS2_TYPE& ap2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso) +{ draw_function_for_boolean_set_2::compute_elements(ap2, graphics_scene, gso); } + template -void draw(const CGAL::Polygon_set_2& ps, - const char* title = "Polygon_set_2 Basic Viewer", - bool draw_vertices = false, - bool draw_unbounded = false) +void add_to_graphics_scene(const CGAL_PS2_TYPE& ap2, + CGAL::Graphics_scene &graphics_scene) +{ + CGAL::Graphics_scene_options_polygon_set_2 gso; + draw_function_for_boolean_set_2::compute_elements(ap2, graphics_scene, gso); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function. +template +void draw(const CGAL_PS2_TYPE& ps, GSOptions& gso, + const char* title = "Polygon_set_2 Basic Viewer") { #if defined(CGAL_TEST_SUITE) bool cgal_test_suite = true; @@ -203,22 +294,35 @@ void draw(const CGAL::Polygon_set_2& ps, bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); #endif - if (! cgal_test_suite) { + if (! cgal_test_suite) + { using Ps = CGAL::Polygon_set_2; - using Viewer = Polygon_set_2_basic_viewer_qt; + using Viewer = Polygon_set_2_basic_viewer_qt; CGAL::Qt::init_ogl_context(4,3); int argc = 1; const char* argv[2] = {"t2_viewer", nullptr}; QApplication app(argc, const_cast(argv)); - Viewer mainwindow(app.activeWindow(), ps, title, draw_unbounded, draw_vertices); - mainwindow.add_elements(); - mainwindow.show(); + Viewer basic_viewer(app.activeWindow(), ps, gso, title); + basic_viewer.show(); app.exec(); } } -} // End namespace CGAL +template +void draw(const CGAL_PS2_TYPE& ps, + const char* title = "Polygon_set_2 Basic Viewer") +{ + CGAL::Graphics_scene_options_polygon_set_2 gso; + draw(ps, gso, title); +} #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_PS2_TYPE + +} // End namespace CGAL + #endif // CGAL_DRAW_POLYGON_SET_2_H diff --git a/Boolean_set_operations_2/package_info/Boolean_set_operations_2/dependencies b/Boolean_set_operations_2/package_info/Boolean_set_operations_2/dependencies index c5720a8c2b1..4f01f6dce65 100644 --- a/Boolean_set_operations_2/package_info/Boolean_set_operations_2/dependencies +++ b/Boolean_set_operations_2/package_info/Boolean_set_operations_2/dependencies @@ -1,6 +1,8 @@ Algebraic_foundations Arithmetic_kernel Arrangement_on_surface_2 +BGL +Basic_viewer Boolean_set_operations_2 CGAL_Core Cartesian_kernel @@ -9,7 +11,6 @@ Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView HalfedgeDS Hash_map Homogeneous_kernel @@ -23,7 +24,12 @@ Modular_arithmetic Number_types Polygon Profiling_tools +Property_map +Random_numbers STL_Extension +Spatial_sorting Stream_support Surface_sweep_2 +TDS_2 +Triangulation_2 Union_find diff --git a/Combinatorial_map/package_info/Combinatorial_map/dependencies b/Combinatorial_map/package_info/Combinatorial_map/dependencies index 0902e1798f1..e4b0bcc4263 100644 --- a/Combinatorial_map/package_info/Combinatorial_map/dependencies +++ b/Combinatorial_map/package_info/Combinatorial_map/dependencies @@ -20,6 +20,5 @@ Modular_arithmetic Number_types Profiling_tools Property_map -Random_numbers STL_Extension Stream_support diff --git a/Convex_decomposition_3/package_info/Convex_decomposition_3/dependencies b/Convex_decomposition_3/package_info/Convex_decomposition_3/dependencies index 09382985c87..cbdbc3424ad 100644 --- a/Convex_decomposition_3/package_info/Convex_decomposition_3/dependencies +++ b/Convex_decomposition_3/package_info/Convex_decomposition_3/dependencies @@ -28,7 +28,6 @@ Polygon Polyhedron Profiling_tools Property_map -Random_numbers STL_Extension Spatial_sorting Stream_support diff --git a/Convex_hull_3/include/CGAL/convex_hull_3.h b/Convex_hull_3/include/CGAL/convex_hull_3.h index 51555a5d57b..eac14144073 100644 --- a/Convex_hull_3/include/CGAL/convex_hull_3.h +++ b/Convex_hull_3/include/CGAL/convex_hull_3.h @@ -33,6 +33,7 @@ #include #include +#include #include #include #include diff --git a/Documentation/doc/CMakeLists.txt b/Documentation/doc/CMakeLists.txt index 0e7ddd3b95a..f9efeb99354 100644 --- a/Documentation/doc/CMakeLists.txt +++ b/Documentation/doc/CMakeLists.txt @@ -354,6 +354,10 @@ configure_file(${CGAL_DOC_RESOURCE_DIR}/BaseDoxyfile.in set(CGAL_DOC_DOXY_DEFAULT "${CGAL_DOC_DXY_DIR}/BaseDoxyfile") +if (BE_QUIET) + file(APPEND ${CGAL_DOC_DOXY_DEFAULT} "WARN_LOGFILE=doxygen.log\n") +endif() + # pkglist_filter gets the path to the pkglist_filter of this source # directory. if(WIN32) diff --git a/Documentation/doc/Documentation/packages.txt b/Documentation/doc/Documentation/packages.txt index 7002020a1a0..af93af92d6a 100644 --- a/Documentation/doc/Documentation/packages.txt +++ b/Documentation/doc/Documentation/packages.txt @@ -168,5 +168,6 @@ \package_listing{GraphicsView} \package_listing{CGAL_ipelets} +\package_listing{Basic_viewer} */ diff --git a/GraphicsView/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h b/GraphicsView/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h index 1348f5d2932..a44bd71044f 100644 --- a/GraphicsView/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h +++ b/GraphicsView/include/CGAL/Qt/PolygonWithHolesGraphicsItem.h @@ -19,7 +19,6 @@ #include #include -#include #include #include #include diff --git a/Triangulation_2/include/CGAL/apply_to_range.h b/GraphicsView/include/CGAL/apply_to_range.h similarity index 100% rename from Triangulation_2/include/CGAL/apply_to_range.h rename to GraphicsView/include/CGAL/apply_to_range.h diff --git a/GraphicsView/package_info/GraphicsView/dependencies b/GraphicsView/package_info/GraphicsView/dependencies index f74d1ba2e46..b4a464ef5e7 100644 --- a/GraphicsView/package_info/GraphicsView/dependencies +++ b/GraphicsView/package_info/GraphicsView/dependencies @@ -11,4 +11,3 @@ Number_types Profiling_tools STL_Extension Stream_support -Triangulation_2 diff --git a/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h b/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h index d2a1f11653b..a39cfd90715 100644 --- a/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h +++ b/HalfedgeDS/include/CGAL/boost/graph/properties_HalfedgeDS_base.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace CGAL { @@ -126,11 +127,20 @@ typename boost::property_map::type get(PropertyTag,CGAL_HDS_CLASS&) { return typename boost::property_map::type(); } + // generalized 3-ary get functions -template +template> && + !std::is_same_v> && + !std::is_same_v> && + !std::is_same_v> + > +> typename boost::property_traits< typename boost::property_map::type >::reference get(PropertyTag p,CGAL_HDS_CLASS& g, const Key& key) -{ return get(get(p, g), key); } +{ + return get(get(p, g), key); +} template typename boost::property_traits< typename boost::property_map::const_type >::reference @@ -139,13 +149,13 @@ get(PropertyTag p,CGAL_HDS_CLASS const& g, const Key& key) -#define DECLARE_HDS_DYNAMIC_PM(TAG, DESCRIPTOR) \ +#define DECLARE_HDS_DYNAMIC_PM(TAG, DESCRIPTOR) \ template \ typename boost::property_map::const_type \ -get(const TAG&, const CGAL_HDS_CLASS&) \ -{ \ +get(const TAG&, const CGAL_HDS_CLASS&, const T& dv = T()) \ +{ \ typedef typename boost::graph_traits< CGAL_HDS_CLASS >::DESCRIPTOR descriptor; \ - return internal::Dynamic_property_map(); \ + return internal::Dynamic_property_map(dv); \ } DECLARE_HDS_DYNAMIC_PM(dynamic_vertex_property_t, vertex_descriptor) diff --git a/Hash_map/test/Hash_map/Hash.cpp b/Hash_map/test/Hash_map/Hash.cpp index fc12a7571fb..e73d4c3033d 100644 --- a/Hash_map/test/Hash_map/Hash.cpp +++ b/Hash_map/test/Hash_map/Hash.cpp @@ -11,9 +11,9 @@ #include #include #include +#include #include #include -#include typedef CGAL::Simple_cartesian Kernel; diff --git a/Heat_method_3/package_info/Heat_method_3/dependencies b/Heat_method_3/package_info/Heat_method_3/dependencies index 42f0881808e..fe8fe1b0af7 100644 --- a/Heat_method_3/package_info/Heat_method_3/dependencies +++ b/Heat_method_3/package_info/Heat_method_3/dependencies @@ -12,7 +12,6 @@ Modular_arithmetic Number_types Profiling_tools Property_map -Random_numbers STL_Extension Solver_interface Stream_support diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index d7f5269a6ee..e0a13836cd3 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -10,7 +10,8 @@ Release date: October 2023 - **Breaking change**: C++17 is now required - Support for Visual `C++` 14.0 (Visual studio 2015) is dropped. -- The demos as well as the `draw()` functions using the `Basic_viewer` are based on Qt6 +- The demos as well as the `Basic_viewer` are based on Qt6. +- The `Basic_viewer` is improved and documented. - **Breaking change**: The usage of `boost::shared_ptr` has been replaced by `std::shared_ptr`. Packages affected are 2D Straight Line Skeleton and Shape Detection. - **Breaking change**: The usage of `boost::optional` has been replaced by `std::optional`. Packages affected are 2D Straight Line Skeleton, 3D Fast Intersection and Distance Computation (AABB Tree), and the Kernel intersection. - **Breaking change**: The usage of `boost::variant` has been replaced by `std::variant`. Packages affected are 2D Arrangements, and the Kernel intersection. @@ -72,6 +73,8 @@ Release date: October 2023 `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` that refines a soup of triangles so that no pair of triangles intersects in their interiors. Also added, the function `autorefine()` operating directly on a triangle mesh and updating it using the aforementioned function on a triangle soup. +- Added the function `CGAL::Polygon_mesh_processing::add_bbox()` that enables to add a tight or extended, triangulated or not, + bounding box to a face graph. ### [2D Arrangements](https://doc.cgal.org/6.0/Manual/packages.html#PkgArrangementOnSurface2) - Fixed a bug in the zone construction code applied to arrangements of geodesic arcs on a sphere, diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 6335ead8411..98d27538371 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -73,6 +73,8 @@ if(CGAL_BRANCH_BUILD) set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CGAL_SOURCE_DIR}/GraphicsView" CACHE INTERNAL "Directory containing the GraphicsView package") + file(GLOB INCLUDE_CGAL_QT_DIRECTORIES "${CGAL_SOURCE_DIR}/*/include/CGAL/Qt") + message(STATUS "Include CGAL/Qt directories: ${INCLUDE_CGAL_QT_DIRECTORIES}") message(STATUS "Installation package directory: ${CGAL_INSTALLATION_PACKAGE_DIR}") message(STATUS "Maintenance package directory: ${CGAL_MAINTENANCE_PACKAGE_DIR}") @@ -104,6 +106,7 @@ else(CGAL_BRANCH_BUILD) set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package") + set(INCLUDE_CGAL_QT_DIRECTORIES "${CGAL_SOURCE_DIR}/include/CGAL/Qt") # Enable testing with CGAL_ENABLE_TESTING. Before CGAL-6.0, users would enable # the tests by specifying BUILD_TESTING. For compatibility, If BUILD_TESTING is @@ -652,7 +655,7 @@ cache_get(CGAL_3RD_PARTY_INCLUDE_DIRS ) cache_get(CGAL_3RD_PARTY_LIBRARIES ) cache_get(CGAL_3RD_PARTY_LIBRARIES_DIRS) -install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/Qt" COMPONENT CGAL_Qt6) +install(DIRECTORY ${INCLUDE_CGAL_QT_DIRECTORIES} DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/" COMPONENT CGAL_Qt6) if(CGAL_BRANCH_BUILD) install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt6) install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt6) @@ -1052,7 +1055,7 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.") execute_process( COMMAND "${CMAKE_COMMAND}" -DCGAL_BUILD_THREE_DOC=TRUE - -DDOXYGEN_EXECUTABLE=${DOXYGEN_EXECUTABLE} + -DDOXYGEN_EXECUTABLE=${DOXYGEN_EXECUTABLE} -DBE_QUIET=TRUE "${CGAL_SOURCE_DIR}/Documentation/doc" WORKING_DIRECTORY "${DOC_DIR}") execute_process( diff --git a/Installation/cmake/modules/CGAL_SetupCGAL_Qt6Dependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGAL_Qt6Dependencies.cmake index f4c961ab97d..e8bc2f8c788 100644 --- a/Installation/cmake/modules/CGAL_SetupCGAL_Qt6Dependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGAL_Qt6Dependencies.cmake @@ -25,7 +25,7 @@ set(CGAL_SetupCGAL_Qt6Dependencies_included TRUE) # ^^^^^^^^^^^^ # - :module:`Qt6Config` -find_package(Qt6 QUIET COMPONENTS Widgets OpenGL OpenGLWidgets OPTIONAL_COMPONENTS Svg) +find_package(Qt6 QUIET COMPONENTS OpenGL OpenGLWidgets Widgets OPTIONAL_COMPONENTS Svg) set(CGAL_Qt6_MISSING_DEPS "") if(NOT Qt6OpenGLWidgets_FOUND) diff --git a/Installation/cmake/modules/list_of_whitelisted_headers.cmake b/Installation/cmake/modules/list_of_whitelisted_headers.cmake index 9cbef5d8a57..64fc508ffe1 100644 --- a/Installation/cmake/modules/list_of_whitelisted_headers.cmake +++ b/Installation/cmake/modules/list_of_whitelisted_headers.cmake @@ -11,9 +11,9 @@ set(list_of_whitelisted_headers_txt [=[ CGAL/Three/Edge_container.h CGAL/Three/exceptions.h CGAL/Three/Point_container.h - CGAL/Three/Polyhedron_demo_io_plugin_interface.h - CGAL/Three/Polyhedron_demo_plugin_helper.h - CGAL/Three/Polyhedron_demo_plugin_interface.h + CGAL/Three/CGAL_Lab_io_plugin_interface.h + CGAL/Three/CGAL_Lab_plugin_helper.h + CGAL/Three/CGAL_Lab_plugin_interface.h CGAL/Three/Primitive_container.h CGAL/Three/Scene_draw_interface.h CGAL/Three/Scene_group_item.h diff --git a/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h b/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h index 1905d336703..600314c0330 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Bbox_2.h @@ -102,6 +102,12 @@ dilates the bounding box by a specified number of ULP. */ void dilate(int dist); +/*! +scales the bounding box by `factor`, while keeping its center fixed. +\pre `factor > 0` +*/ +void scale(double factor); + /// @} }; /* end Bbox_2 */ diff --git a/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h b/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h index f44a44e4812..734f79bc76e 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Bbox_3.h @@ -115,6 +115,13 @@ Bbox_3& operator+=(const Bbox_3 &c); dilates the bounding box by a specified number of ULP. */ void dilate(int dist); + +/*! +scales the bounding box by `factor`, while keeping its center fixed. +\pre `factor > 0` +*/ +void scale(double factor); + /// @} }; /* end Bbox_3 */ diff --git a/Kernel_23/include/CGAL/Bbox_2.h b/Kernel_23/include/CGAL/Bbox_2.h index 57e482e8b0c..0222cf94778 100644 --- a/Kernel_23/include/CGAL/Bbox_2.h +++ b/Kernel_23/include/CGAL/Bbox_2.h @@ -71,6 +71,7 @@ public: inline Bbox_2& operator+=(const Bbox_2 &b); inline void dilate(int dist); + inline void scale(double factor); }; inline @@ -170,6 +171,25 @@ Bbox_2::dilate(int dist) rep[3] = float_advance(rep[3],dist); } +inline +void +Bbox_2::scale(double factor) +{ + CGAL_precondition(factor > 0); + + if(factor == 1.) + return; + + std::array half_width = { (xmax() - xmin()) * 0.5, + (ymax() - ymin()) * 0.5 }; + std::array center = { xmin() + half_width[0], + ymin() + half_width[1] }; + rep[0] = center[0] - factor * half_width[0]; + rep[1] = center[1] - factor * half_width[1]; + rep[2] = center[0] + factor * half_width[0]; + rep[3] = center[1] + factor * half_width[1]; +} + inline bool do_overlap(const Bbox_2 &bb1, const Bbox_2 &bb2) diff --git a/Kernel_23/include/CGAL/Bbox_3.h b/Kernel_23/include/CGAL/Bbox_3.h index b5bb3640800..dc750e4d0e0 100644 --- a/Kernel_23/include/CGAL/Bbox_3.h +++ b/Kernel_23/include/CGAL/Bbox_3.h @@ -76,7 +76,8 @@ public: Bbox_3 operator+(const Bbox_3& b) const; Bbox_3& operator+=(const Bbox_3& b); - void dilate(int dist); + inline void dilate(int dist); + inline void scale(double factor); }; inline @@ -200,6 +201,28 @@ Bbox_3::dilate(int dist) rep[5] = float_advance(rep[5],dist); } +inline +void +Bbox_3::scale(double factor) +{ + CGAL_precondition(factor > 0); + + if (factor == 1.) + return; + + std::array half_width = { (xmax() - xmin()) * 0.5, + (ymax() - ymin()) * 0.5, + (zmax() - zmin()) * 0.5 }; + std::array center = { xmin() + half_width[0], + ymin() + half_width[1], + zmin() + half_width[2] }; + rep[0] = center[0] - factor * half_width[0]; + rep[1] = center[1] - factor * half_width[1]; + rep[2] = center[2] - factor * half_width[2]; + rep[3] = center[0] + factor * half_width[0]; + rep[4] = center[1] + factor * half_width[1]; + rep[5] = center[2] + factor * half_width[2]; +} inline bool diff --git a/Polyhedron/demo/Polyhedron/C2t3_type.h b/Lab/demo/Lab/C2t3_type.h similarity index 100% rename from Polyhedron/demo/Polyhedron/C2t3_type.h rename to Lab/demo/Lab/C2t3_type.h diff --git a/Polyhedron/demo/Polyhedron/C3t3_type.h b/Lab/demo/Lab/C3t3_type.h similarity index 98% rename from Polyhedron/demo/Polyhedron/C3t3_type.h rename to Lab/demo/Lab/C3t3_type.h index fe815264335..0231ccb8999 100644 --- a/Polyhedron/demo/Polyhedron/C3t3_type.h +++ b/Lab/demo/Lab/C3t3_type.h @@ -3,7 +3,7 @@ #include "config.h" #include "Plugins/Mesh_3/config_mesh_3.h" -// as otherwise it gets set via inclusion of Polyhedron_3.h +// as otherwise it gets set via inclusion of cgallab.h #include #include "SMesh_type.h" diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp b/Lab/demo/Lab/CGAL_Lab.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp rename to Lab/demo/Lab/CGAL_Lab.cpp index ce8046a360f..72464ed4ddb 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.cpp +++ b/Lab/demo/Lab/CGAL_Lab.cpp @@ -1,4 +1,4 @@ -#include "Polyhedron_demo.h" +#include "cgallab.h" #include "MainWindow.h" #include #include @@ -11,12 +11,12 @@ #include -struct Polyhedron_demo_impl { +struct CGAL_Lab_impl { bool catch_exceptions; QScopedPointer mainWindow; - Polyhedron_demo_impl() : catch_exceptions(true) {} -}; // end struct Polyhedron_demo_impl + CGAL_Lab_impl() : catch_exceptions(true) {} +}; // end struct CGAL_Lab_impl int& code_to_call_before_creation_of_QCoreApplication(int& i) { QSurfaceFormat fmt; @@ -35,7 +35,7 @@ int& code_to_call_before_creation_of_QCoreApplication(int& i) { return i; } -Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, +CGAL_Lab::CGAL_Lab(int& argc, char **argv, QString application_name, QString main_window_title, QStringList input_keywords) @@ -45,7 +45,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, // object. argv) , d_ptr_is_initialized(false) - , d_ptr(new Polyhedron_demo_impl) + , d_ptr(new CGAL_Lab_impl) { //We set the locale to avoid any trouble with VTK std::setlocale(LC_ALL, "C"); @@ -129,7 +129,7 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, } #endif - mainWindow.loadScript(":/cgal/Polyhedron_3/javascript/lib.js"); + mainWindow.loadScript(":/cgal/Lab/javascript/lib.js"); QFileInfo autostart_js("autostart.js"); if(!parser.isSet(no_autostart) && autostart_js.exists()) { mainWindow.loadScript(autostart_js); @@ -140,14 +140,14 @@ Polyhedron_demo::Polyhedron_demo(int& argc, char **argv, } -Polyhedron_demo::~Polyhedron_demo() {} +CGAL_Lab::~CGAL_Lab() {} -void Polyhedron_demo::do_not_catch_exceptions() { +void CGAL_Lab::do_not_catch_exceptions() { d_ptr->catch_exceptions = false; setProperty("no-try-catch", true); } -bool Polyhedron_demo::notify(QObject* receiver, QEvent* event) +bool CGAL_Lab::notify(QObject* receiver, QEvent* event) { if(!d_ptr_is_initialized || !d_ptr->catch_exceptions) return QApplication::notify(receiver, event); @@ -171,7 +171,7 @@ bool Polyhedron_demo::notify(QObject* receiver, QEvent* event) return false; } -int Polyhedron_demo::try_exec() +int CGAL_Lab::try_exec() { // A Qt Script may have closed the main window. // The following loop launch app.exec() only if the main window is visible. diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h b/Lab/demo/Lab/CGAL_Lab_detect_sharp_edges.h similarity index 85% rename from Polyhedron/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h rename to Lab/demo/Lab/CGAL_Lab_detect_sharp_edges.h index cd6cfb5e3c1..e6ec2a21925 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_detect_sharp_edges.h +++ b/Lab/demo/Lab/CGAL_Lab_detect_sharp_edges.h @@ -1,6 +1,6 @@ -#ifndef POLYHEDRON_DEMO_DETECT_SHARP_EDGES_H -#define POLYHEDRON_DEMO_DETECT_SHARP_EDGES_H +#ifndef LAB_DEMO_DETECT_SHARP_EDGES_H +#define LAB_DEMO_DETECT_SHARP_EDGES_H #include @@ -29,4 +29,4 @@ namespace CGAL }//end namespace CGAL -#endif //POLYHEDRON_DEMO_DETECT_SHARP_EDGES_H +#endif //LAB_DEMO_DETECT_SHARP_EDGES_H diff --git a/Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp b/Lab/demo/Lab/CGAL_double_edit.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/CGAL_double_edit.cpp rename to Lab/demo/Lab/CGAL_double_edit.cpp diff --git a/Polyhedron/demo/Polyhedron/CGAL_double_edit.h b/Lab/demo/Lab/CGAL_double_edit.h similarity index 100% rename from Polyhedron/demo/Polyhedron/CGAL_double_edit.h rename to Lab/demo/Lab/CGAL_double_edit.h diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Lab/demo/Lab/CMakeLists.txt similarity index 88% rename from Polyhedron/demo/Polyhedron/CMakeLists.txt rename to Lab/demo/Lab/CMakeLists.txt index 172b5bd63e9..f71fa87c647 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Lab/demo/Lab/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1...3.23) -project(Polyhedron_Demo) +project(Lab_Demo) include(FeatureSummary) @@ -32,9 +32,6 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") include_directories(BEFORE ./ ./include ./CGAL_demo) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}") -option(POLYHEDRON_QTSCRIPT_DEBUGGER - "Activate the use of Qt Script Debugger in Polyhedron_3 demo" OFF) - # Find CGAL find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt6 ImageIO) set_package_properties(CGAL PROPERTIES TYPE REQUIRED) @@ -73,8 +70,8 @@ set_package_properties( PURPOSE "Required for the partition plugin.") # Activate concurrency? -option(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY "Enable concurrency" ON) -if(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY) +option(LAB_DEMO_ACTIVATE_CONCURRENCY "Enable concurrency" ON) +if(LAB_DEMO_ACTIVATE_CONCURRENCY) find_package(TBB QUIET) include(CGAL_TBB_support) if(NOT TARGET CGAL::TBB_support) @@ -130,9 +127,9 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) qt6_generate_moc("File_loader_dialog.h" "${CMAKE_CURRENT_BINARY_DIR}/File_loader_dialog_moc.cpp") - include(${CMAKE_CURRENT_SOURCE_DIR}/polyhedron_demo_macros.cmake) + include(${CMAKE_CURRENT_SOURCE_DIR}/cgallab_macros.cmake) - qt6_add_resources(CGAL_Qt6_RESOURCE_FILES Polyhedron_3.qrc) + qt6_add_resources(CGAL_Qt6_RESOURCE_FILES cgallab.qrc) find_path( CGAL_THREE_HEADERS_PATH NAMES CGAL/Three/Scene_item.h @@ -162,8 +159,8 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) # put plugins (which are shared libraries) at the same location as # executable files - set(CGAL_POLYHEDRON_DEMO_PLUGINS_DIR "${RUNTIME_OUTPUT_PATH}") - set(LIBRARY_OUTPUT_PATH "${CGAL_POLYHEDRON_DEMO_PLUGINS_DIR}") + set(CGAL_LAB_DEMO_PLUGINS_DIR "${RUNTIME_OUTPUT_PATH}") + set(LIBRARY_OUTPUT_PATH "${CGAL_LAB_DEMO_PLUGINS_DIR}") add_library( demo_framework SHARED @@ -187,7 +184,7 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) Scene_item_rendering_helper.cpp Scene_item_rendering_helper_moc.cpp Primitive_container.cpp - Polyhedron_demo_plugin_helper.cpp + cgallab_plugin_helper.cpp CGAL_double_edit.cpp) target_link_libraries(demo_framework PUBLIC Qt6::OpenGLWidgets Qt6::Widgets Qt6::Gui Qt6::Qml CGAL::CGAL_Qt6) @@ -350,9 +347,9 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) add_definitions(-DUSE_FORWARD_DECL) add_library( - polyhedron_demo SHARED + cgal_lab SHARED MainWindow.cpp - Polyhedron_demo.cpp + CGAL_Lab.cpp File_loader_dialog_moc.cpp Use_ssh.cpp ${CGAL_Qt6_RESOURCE_FILES} @@ -363,30 +360,30 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) ${statisticsUI_FILES} ${SubViewerUI_files}) target_link_libraries( - polyhedron_demo PUBLIC demo_framework point_dialog Qt6::Gui Qt6::OpenGLWidgets + cgal_lab PUBLIC demo_framework point_dialog Qt6::Gui Qt6::OpenGLWidgets Qt6::Widgets ) if(LIBSSH_FOUND) - target_compile_definitions(polyhedron_demo PRIVATE -DCGAL_USE_SSH) - target_link_libraries(polyhedron_demo PRIVATE ${LIBSSH_LIBRARIES}) - target_include_directories(polyhedron_demo SYSTEM PRIVATE ${LIBSSH_INCLUDE_DIR}) + target_compile_definitions(cgal_lab PRIVATE -DCGAL_USE_SSH) + target_link_libraries(cgal_lab PRIVATE ${LIBSSH_LIBRARIES}) + target_include_directories(cgal_lab SYSTEM PRIVATE ${LIBSSH_INCLUDE_DIR}) endif() #libssh if(TARGET Qt6::WebSockets) - target_compile_definitions(polyhedron_demo PRIVATE -DCGAL_USE_WEBSOCKETS) + target_compile_definitions(cgal_lab PRIVATE -DCGAL_USE_WEBSOCKETS) target_compile_definitions(demo_framework PRIVATE -DCGAL_USE_WEBSOCKETS) - target_link_libraries(polyhedron_demo PRIVATE Qt6::WebSockets) + target_link_libraries(cgal_lab PRIVATE Qt6::WebSockets) endif() - cgal_add_compilation_test(polyhedron_demo) - add_executable(Polyhedron_3 Polyhedron_3.cpp) - target_link_libraries(Polyhedron_3 PRIVATE polyhedron_demo) - add_to_cached_list(CGAL_EXECUTABLE_TARGETS Polyhedron_3) - cgal_add_compilation_test(Polyhedron_3) + cgal_add_compilation_test(cgal_lab) + add_executable(cgallab cgallab.cpp) + target_link_libraries(cgallab PRIVATE cgal_lab) + add_to_cached_list(CGAL_EXECUTABLE_TARGETS cgallab) + cgal_add_compilation_test(cgallab) - target_link_libraries(Polyhedron_3 PRIVATE demo_framework) + target_link_libraries(cgallab PRIVATE demo_framework) # Link with CGAL - target_link_libraries(Polyhedron_3 PUBLIC CGAL::CGAL_Qt6) + target_link_libraries(cgallab PUBLIC CGAL::CGAL_Qt6) - add_to_cached_list(CGAL_EXECUTABLE_TARGETS Polyhedron_3) + add_to_cached_list(CGAL_EXECUTABLE_TARGETS cgallab) ########### # PLUGINS # @@ -407,17 +404,17 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) # add_executable(CGAL_Mesh_3 Mesh_3.cpp) add_dependencies(CGAL_Mesh_3 Mesh_3) - target_link_libraries(CGAL_Mesh_3 PRIVATE polyhedron_demo) + target_link_libraries(CGAL_Mesh_3 PRIVATE cgal_lab) add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_Mesh_3) add_executable(CGAL_Classification Classification.cpp) add_dependencies(CGAL_Classification Classification) - target_link_libraries(CGAL_Classification PRIVATE polyhedron_demo) + target_link_libraries(CGAL_Classification PRIVATE cgal_lab) add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_Classification) add_executable(CGAL_PMP PMP.cpp) add_dependencies(CGAL_PMP PMP) - target_link_libraries(CGAL_PMP PRIVATE polyhedron_demo) + target_link_libraries(CGAL_PMP PRIVATE cgal_lab) add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_PMP) #WS Server @@ -432,14 +429,14 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) if(TARGET CGAL_Qt6) export( TARGETS CGAL CGAL_Qt6 CGAL_ImageIO - FILE polyhedron_demo_targets.cmake - NAMESPACE Polyhedron_) + FILE cgal_lab_targets.cmake + NAMESPACE Lab_) endif() if(TARGET CGAL_Qt6_moc_and_resources) export( TARGETS CGAL_Qt6_moc_and_resources - NAMESPACE Polyhedron_ APPEND - FILE polyhedron_demo_targets.cmake) + NAMESPACE Lab_ APPEND + FILE cgal_lab_targets.cmake) endif() export( TARGETS demo_framework @@ -452,26 +449,26 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) scene_selection_item scene_item_decorator scene_k_ring_selection - NAMESPACE Polyhedron_ APPEND - FILE polyhedron_demo_targets.cmake) + NAMESPACE Lab_ APPEND + FILE cgal_lab_targets.cmake) - configure_file(CGAL_polyhedron_demoConfig.cmake.in - CGAL_polyhedron_demoConfig.cmake) + configure_file(cgallabConfig.cmake.in + cgallabConfig.cmake) #TO DO script the activation of all the plugins. else(CGAL_Qt6_FOUND AND Qt6_FOUND) - set(POLYHEDRON_MISSING_DEPS "") + set(Lab_MISSING_DEPS "") if(NOT CGAL_Qt6_FOUND) - set(POLYHEDRON_MISSING_DEPS "the CGAL Qt6 library, ${POLYHEDRON_MISSING_DEPS}") + set(Lab_MISSING_DEPS "the CGAL Qt6 library, ${Lab_MISSING_DEPS}") endif() if(NOT Qt6_FOUND) - set(POLYHEDRON_MISSING_DEPS "Qt6, ${POLYHEDRON_MISSING_DEPS}") + set(Lab_MISSING_DEPS "Qt6, ${Lab_MISSING_DEPS}") endif() - message("NOTICE: XX This demo requires ${POLYHEDRON_MISSING_DEPS} and will not be compiled.") + message("NOTICE: XX This demo requires ${Lab_MISSING_DEPS} and will not be compiled.") endif(CGAL_Qt6_FOUND AND Qt6_FOUND) diff --git a/Polyhedron/demo/Polyhedron/Callback_signaler.cpp b/Lab/demo/Lab/Callback_signaler.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Callback_signaler.cpp rename to Lab/demo/Lab/Callback_signaler.cpp diff --git a/Polyhedron/demo/Polyhedron/Callback_signaler.h b/Lab/demo/Lab/Callback_signaler.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Callback_signaler.h rename to Lab/demo/Lab/Callback_signaler.h diff --git a/Polyhedron/demo/Polyhedron/Classification.cpp b/Lab/demo/Lab/Classification.cpp similarity index 86% rename from Polyhedron/demo/Polyhedron/Classification.cpp rename to Lab/demo/Lab/Classification.cpp index 525a1ca1cfc..5f504652c4f 100644 --- a/Polyhedron/demo/Polyhedron/Classification.cpp +++ b/Lab/demo/Lab/Classification.cpp @@ -1,4 +1,4 @@ -#include "Polyhedron_demo.h" +#include "cgallab.h" #include #include #include @@ -10,7 +10,7 @@ */ int main(int argc, char **argv) { - Polyhedron_demo app(argc, argv, + CGAL_Lab app(argc, argv, "Classification demo", "CGAL Classification Demo", QStringList() << "Classification"); diff --git a/Polyhedron/demo/Polyhedron/Color_map.h b/Lab/demo/Lab/Color_map.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Color_map.h rename to Lab/demo/Lab/Color_map.h diff --git a/Polyhedron/demo/Polyhedron/Color_ramp.cpp b/Lab/demo/Lab/Color_ramp.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Color_ramp.cpp rename to Lab/demo/Lab/Color_ramp.cpp diff --git a/Polyhedron/demo/Polyhedron/Color_ramp.h b/Lab/demo/Lab/Color_ramp.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Color_ramp.h rename to Lab/demo/Lab/Color_ramp.h diff --git a/Polyhedron/demo/Polyhedron/Details.ui b/Lab/demo/Lab/Details.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Details.ui rename to Lab/demo/Lab/Details.ui diff --git a/Polyhedron/demo/Polyhedron/Edge_container.cpp b/Lab/demo/Lab/Edge_container.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Edge_container.cpp rename to Lab/demo/Lab/Edge_container.cpp diff --git a/Polyhedron/demo/Polyhedron/FileLoaderDialog.ui b/Lab/demo/Lab/FileLoaderDialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/FileLoaderDialog.ui rename to Lab/demo/Lab/FileLoaderDialog.ui diff --git a/Polyhedron/demo/Polyhedron/File_loader_dialog.h b/Lab/demo/Lab/File_loader_dialog.h similarity index 100% rename from Polyhedron/demo/Polyhedron/File_loader_dialog.h rename to Lab/demo/Lab/File_loader_dialog.h diff --git a/Polyhedron/demo/Polyhedron/Image_type.h b/Lab/demo/Lab/Image_type.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Image_type.h rename to Lab/demo/Lab/Image_type.h diff --git a/Polyhedron/demo/Polyhedron/Image_type_fwd.h b/Lab/demo/Lab/Image_type_fwd.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Image_type_fwd.h rename to Lab/demo/Lab/Image_type_fwd.h diff --git a/Polyhedron/demo/Polyhedron/Kernel_type.h b/Lab/demo/Lab/Kernel_type.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Kernel_type.h rename to Lab/demo/Lab/Kernel_type.h diff --git a/Polyhedron/demo/Polyhedron/LightingDialog.ui b/Lab/demo/Lab/LightingDialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/LightingDialog.ui rename to Lab/demo/Lab/LightingDialog.ui diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Lab/demo/Lab/MainWindow.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/MainWindow.cpp rename to Lab/demo/Lab/MainWindow.cpp index f85d0355570..2269b4a2839 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Lab/demo/Lab/MainWindow.cpp @@ -52,8 +52,8 @@ #include -#include -#include +#include +#include #include #include "ui_SubViewer.h" #include "ui_MainWindow.h" @@ -247,7 +247,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren // add the "About CGAL..." and "About demo..." entries this->addAboutCGAL(); - this->addAboutDemo(":/cgal/Polyhedron_3/about.html"); + this->addAboutDemo(":/cgal/Lab/about.html"); // Connect the button "addButton" with actionLoad ui->addButton->setDefaultAction(ui->actionLoad); @@ -662,7 +662,7 @@ void MainWindow::loadPlugins() } } } - QString env_path = qgetenv("POLYHEDRON_DEMO_PLUGINS_PATH"); + QString env_path = qgetenv("LAB_DEMO_PLUGINS_PATH"); #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QChar separator = QDir::listSeparator(); #else @@ -734,8 +734,8 @@ bool MainWindow::hasPlugin(const QString& pluginName) const bool MainWindow::initPlugin(QObject* obj) { QObjectList childs = this->children(); - CGAL::Three::Polyhedron_demo_plugin_interface* plugin = - qobject_cast(obj); + CGAL::Three::CGAL_Lab_plugin_interface* plugin = + qobject_cast(obj); if(plugin) { // Call plugin's init() method obj->setParent(this); @@ -759,8 +759,8 @@ bool MainWindow::initPlugin(QObject* obj) bool MainWindow::initIOPlugin(QObject* obj) { - CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin = - qobject_cast(obj); + CGAL::Three::CGAL_Lab_io_plugin_interface* plugin = + qobject_cast(obj); if(plugin) { plugin->init(); io_plugins << plugin; @@ -973,7 +973,7 @@ void MainWindow::reloadItem() { continue; } - CGAL::Three::Polyhedron_demo_io_plugin_interface* fileloader = findLoader(loader_name); + CGAL::Three::CGAL_Lab_io_plugin_interface* fileloader = findLoader(loader_name); QFileInfo fileinfo(filename); bool ok; QList new_items = loadItem(fileinfo, fileloader, ok, false); @@ -1017,8 +1017,8 @@ void MainWindow::reloadItem() { } } -CGAL::Three::Polyhedron_demo_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const { - for(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin : +CGAL::Three::CGAL_Lab_io_plugin_interface* MainWindow::findLoader(const QString& loader_name) const { + for(CGAL::Three::CGAL_Lab_io_plugin_interface* io_plugin : io_plugins) { if(io_plugin->name() == loader_name) { return io_plugin; @@ -1103,7 +1103,7 @@ void MainWindow::open(QString filename) { // collect all io_plugins and offer them to load if the file extension match one name filter // also collect all available plugins in case of a no extension match - for(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin : io_plugins) { + for(CGAL::Three::CGAL_Lab_io_plugin_interface* io_plugin : io_plugins) { if ( file_matches_filter(io_plugin->loadNameFilters(), filename.toLower()) ) { if ( !io_plugin->canLoad(fileinfo) ) continue; @@ -1115,7 +1115,7 @@ void MainWindow::open(QString filename) } } //if no plugin is correct, offer them all. - for(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin : io_plugins) { + for(CGAL::Three::CGAL_Lab_io_plugin_interface* io_plugin : io_plugins) { all_items << io_plugin->name(); } } @@ -1183,7 +1183,7 @@ bool MainWindow::open(QString filename, QString loader_name) { QList MainWindow::loadItem(QFileInfo fileinfo, - CGAL::Three::Polyhedron_demo_io_plugin_interface* loader, + CGAL::Three::CGAL_Lab_io_plugin_interface* loader, bool &ok, bool add_to_scene) { if(!fileinfo.isFile() || !fileinfo.isReadable()) { @@ -1834,10 +1834,10 @@ void MainWindow::on_actionLoad_triggered() filters << "All Files (*)"; - typedef QMap FilterPluginMap; + typedef QMap FilterPluginMap; FilterPluginMap filterPluginMap; - for(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin : io_plugins) { + for(CGAL::Three::CGAL_Lab_io_plugin_interface* plugin : io_plugins) { QStringList split_filters = plugin->loadNameFilters().split(";;"); for(const QString& filter : split_filters) { FilterPluginMap::iterator it = filterPluginMap.find(filter); @@ -1868,7 +1868,7 @@ void MainWindow::on_actionLoad_triggered() FilterPluginMap::iterator it = filterPluginMap.find(dialog.selectedNameFilter()); - CGAL::Three::Polyhedron_demo_io_plugin_interface* selectedPlugin = nullptr; + CGAL::Three::CGAL_Lab_io_plugin_interface* selectedPlugin = nullptr; if(it != filterPluginMap.end()) { selectedPlugin = it.value(); @@ -1927,10 +1927,10 @@ void MainWindow::on_actionSaveAs_triggered() while(!to_save.empty()) { Scene_item* item = to_save.front(); - QVector canSavePlugins; + QVector canSavePlugins; QStringList filters; QString sf; - for(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin : io_plugins) { + for(CGAL::Three::CGAL_Lab_io_plugin_interface* plugin : io_plugins) { if(plugin->canSave(item)) { canSavePlugins << plugin; filters += plugin->saveNameFilters(); @@ -2046,7 +2046,7 @@ void MainWindow::on_actionSaveAs_triggered() void MainWindow::save(QString filename, QList& to_save) { QFileInfo fileinfo(filename); bool saved = false; - for(CGAL::Three::Polyhedron_demo_io_plugin_interface* plugin : io_plugins) { + for(CGAL::Three::CGAL_Lab_io_plugin_interface* plugin : io_plugins) { if( plugin->canSave(to_save.front()) && file_matches_filter(plugin->saveNameFilters(),filename.toLower()) ) { @@ -2879,14 +2879,14 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() std::vector colors; std::vector rendering_modes; QStringList not_saved; - Polyhedron_demo_io_plugin_interface* camera_plugin = nullptr; + CGAL_Lab_io_plugin_interface* camera_plugin = nullptr; QMap > group_children_map; for(int i = 0; i < scene->numberOfEntries(); ++i) { Scene_item* item = scene->item(i); QString loader;// = item->property("loader_name").toString(); QString ext; - for(Polyhedron_demo_io_plugin_interface* iop : io_plugins) + for(CGAL_Lab_io_plugin_interface* iop : io_plugins) { if(iop->name() == "camera_positions_plugin") camera_plugin = iop; @@ -3087,8 +3087,8 @@ void MainWindow::on_actionSa_ve_Scene_as_Script_triggered() tr("Enter the name of your scene file.")); if(path.isEmpty()) return; - if(!path.contains("/tmp/Polyhedron_demo_")) - path.prepend("/tmp/Polyhedron_demo_"); + if(!path.contains("/tmp/CGAL_Lab_")) + path.prepend("/tmp/CGAL_Lab_"); try{ ssh_session session = nullptr; bool res = establish_ssh_session_from_agent(session, @@ -3608,7 +3608,7 @@ void MainWindow::test_all_actions() selectSceneItem(0); for(PluginNamePair pnp : plugins) { - Polyhedron_demo_plugin_interface* plugin = pnp.first; + CGAL_Lab_plugin_interface* plugin = pnp.first; for(QAction* action : plugin->actions()){ if(plugin->applicable(action)){ qDebug()<<"Testing "<text()<<" on"; @@ -3724,7 +3724,7 @@ void MainWindow::on_actionLoad_a_Scene_from_a_Script_File_triggered() ssh_free(session); return; } - path.prepend("Polyhedron_demo_"); + path.prepend("CGAL_Lab_"); path = tr("/tmp/%2").arg(path); res = pull_file(session,path.toStdString().c_str(), filename.toStdString().c_str()); if(!res) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Lab/demo/Lab/MainWindow.h similarity index 97% rename from Polyhedron/demo/Polyhedron/MainWindow.h rename to Lab/demo/Lab/MainWindow.h index e3100ad783f..da5a4cb6a2f 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Lab/demo/Lab/MainWindow.h @@ -33,8 +33,8 @@ class QMenu; class QWidgetAction; namespace CGAL { namespace Three{ -class Polyhedron_demo_io_plugin_interface; -class Polyhedron_demo_plugin_interface; +class CGAL_Lab_io_plugin_interface; +class CGAL_Lab_plugin_interface; class Scene_item; class Viewer_interface; } @@ -88,14 +88,14 @@ public: /*! Finds an I/O plugin. * throws std::invalid_argument if no loader with that argument can be found @returns the I/O plugin associated with `loader_name`*/ - CGAL::Three::Polyhedron_demo_io_plugin_interface* findLoader(const QString& loader_name) const; + CGAL::Three::CGAL_Lab_io_plugin_interface* findLoader(const QString& loader_name) const; /*! \brief loads on or more item with a given loader. * * throws `std::logic_error` if loading does not succeed or * `std::invalid_argument` if `fileinfo` specifies an invalid file*/ QList loadItem(QFileInfo fileinfo, - CGAL::Three::Polyhedron_demo_io_plugin_interface*, + CGAL::Three::CGAL_Lab_io_plugin_interface*, bool& ok, bool add_to_scene=true); @@ -418,11 +418,11 @@ private: QSortFilterProxyModel* proxyModel; QTreeView* sceneView; Ui::MainWindow* ui; - QVector io_plugins; + QVector io_plugins; QString last_saved_dir; QMap default_plugin_selection; // typedef to make Q_FOREACH work - typedef QPair PluginNamePair; + typedef QPair PluginNamePair; QVector plugins; //!Called when "Add new group" in the file menu is triggered. QAction* actionAddToGroup; diff --git a/Polyhedron/demo/Polyhedron/MainWindow.ui b/Lab/demo/Lab/MainWindow.ui similarity index 96% rename from Polyhedron/demo/Polyhedron/MainWindow.ui rename to Lab/demo/Lab/MainWindow.ui index a56c2c1afe8..32ad15dda37 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.ui +++ b/Lab/demo/Lab/MainWindow.ui @@ -14,7 +14,7 @@ CGAL Three - + :/cgal/icons/resources/cgal_logo.xpm:/cgal/icons/resources/cgal_logo.xpm @@ -132,7 +132,7 @@ + - + :/cgal/icons/plus:/cgal/icons/plus @@ -143,7 +143,7 @@ - - + :/cgal/icons/minus:/cgal/icons/minus @@ -154,7 +154,7 @@ ... - + :/cgal/icons/duplicate:/cgal/icons/duplicate @@ -165,7 +165,7 @@ ... - + :/cgal/icons/resources/up.png:/cgal/icons/resources/up.png @@ -176,7 +176,7 @@ ... - + :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png @@ -344,7 +344,7 @@ - + :/cgal/icons/plus:/cgal/icons/plus @@ -356,7 +356,7 @@ - + :/cgal/icons/minus:/cgal/icons/minus @@ -368,7 +368,7 @@ - + :/cgal/icons/duplicate:/cgal/icons/duplicate @@ -471,8 +471,8 @@ - - + + diff --git a/Polyhedron/demo/Polyhedron/MainWindow_config.h b/Lab/demo/Lab/MainWindow_config.h similarity index 89% rename from Polyhedron/demo/Polyhedron/MainWindow_config.h rename to Lab/demo/Lab/MainWindow_config.h index 7c43749e79a..833bd9c1c67 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow_config.h +++ b/Lab/demo/Lab/MainWindow_config.h @@ -3,7 +3,7 @@ #include -#ifdef polyhedron_demo_EXPORTS +#ifdef cgal_lab_EXPORTS # define mainwindow_EXPORTS #endif diff --git a/Polyhedron/demo/Polyhedron/Mainpage.md b/Lab/demo/Lab/Mainpage.md similarity index 83% rename from Polyhedron/demo/Polyhedron/Mainpage.md rename to Lab/demo/Lab/Mainpage.md index 444a5ee8b98..516b8a0606d 100644 --- a/Polyhedron/demo/Polyhedron/Mainpage.md +++ b/Lab/demo/Lab/Mainpage.md @@ -1,9 +1,9 @@ Main Page {#mainpage} ============ -These pages are not documenting the whole Polyhedron demo but only the API that can be useful to create and add a new plugin. +These pages are not documenting the whole Lab but only the API that can be useful to create and add a new plugin. -Understanding the Polyhedron demo +Understanding the Lab ============ There are several levels in this demo. @@ -18,19 +18,19 @@ A plugin usually defines an object that inherits from Scene_item or uses some of Creating a simple Plugin ============ -A basic plugin will inherit from Polyhedron_demo_plugin_interface. It can also inherits from the Polyhedron_demo_plugin_helper instead, for a more detailed model of plugin. -Its name must be of the form Polyhedron_demo_xxxx_yyyy_plugin. \n +A basic plugin will inherit from CGAL_Lab_plugin_interface. It can also inherits from the CGAL_Lab_plugin_helper instead, for a more detailed model of plugin. +Its name must be of the form CGAL_Lab_xxxx_yyyy_plugin. \n In the CMakeList.txt file, in the section Plugins, add the following lines : - polyhedron_demo_plugin(xxxx_yyyy_plugin Polyhedron_demo_xxxx_yyyy_plugin) + cgal_lab_plugin(xxxx_yyyy_plugin CGAL_Lab_xxxx_yyyy_plugin) target_link_libraries(xxxx_yyyy_plugin scene_polyhedron_item) - [init]: @ref Polyhedron_demo_plugin_helper#init(QMainWindow *, Scene_interface *) + [init]: @ref CGAL_Lab_plugin_helper#init(QMainWindow *, Scene_interface *) The class must contain the following lines :\n Q_OBJECT\n - Q_INTERFACES(Polyhedron_demo_plugin_interface)\n - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")\n + Q_INTERFACES(CGAL_Lab_plugin_interface)\n + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0")\n In the function [init], get a reference to the Scene and to the MainWindow. Then, create and link the actions of the plugin.\n Create a list of QActions containing the actions of the plugin.\n @@ -43,7 +43,7 @@ If the plugin implements a new Scene_item, please notice that a Scene_itam have A plugin must always contain ~~~~~~~~~~~~~{.cpp} -#include "Polyhedron_demo_xxxx_yyyy_plugin.moc" +#include "CGAL_Lab_xxxx_yyyy_plugin.moc" ~~~~~~~~~~~~~ List of useful classes : @@ -52,8 +52,8 @@ List of useful classes : - Viewer_interface - Scene_interface - Scene_item -- Polyhedron_demo_plugin_helper -- Polyhedron_demo_plugin_interface +- CGAL_Lab_plugin_helper +- CGAL_Lab_plugin_interface Example : @@ -184,21 +184,21 @@ private: }; //end of class Scene_triangle_item -#include -class Polyhedron_demo_example_plugin : +#include +class CGAL_Lab_example_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { //Configures CMake to use MOC correctly Q_OBJECT - Q_INTERFACES(Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public : // To silent a warning -Woverloaded-virtual // See https://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings - using Polyhedron_demo_plugin_helper::init; + using CGAL_Lab_plugin_helper::init; void init(QMainWindow* mainWindow, Scene_interface* scene_interface) { @@ -233,8 +233,8 @@ private: Scene_item* triangle; QAction* actionDrawTriangle; -}; //end of class Polyhedron_demo_example_plugin +}; //end of class CGAL_Lab_example_plugin -#include "Polyhedron_demo_example_plugin.moc" +#include "CGAL_Lab_example_plugin.moc" ~~~~~~~~~~~~~ diff --git a/Polyhedron/demo/Polyhedron/Mesh_3.cpp b/Lab/demo/Lab/Mesh_3.cpp similarity index 85% rename from Polyhedron/demo/Polyhedron/Mesh_3.cpp rename to Lab/demo/Lab/Mesh_3.cpp index 611139956e1..6840b8fffab 100644 --- a/Polyhedron/demo/Polyhedron/Mesh_3.cpp +++ b/Lab/demo/Lab/Mesh_3.cpp @@ -1,4 +1,4 @@ -#include "Polyhedron_demo.h" +#include "cgallab.h" #include #include #include @@ -10,7 +10,7 @@ */ int main(int argc, char **argv) { - Polyhedron_demo app(argc, argv, + CGAL_Lab app(argc, argv, "Mesh_3 demo", "CGAL Mesh_3 Demo", QStringList() << "Mesh_3"); diff --git a/Polyhedron/demo/Polyhedron/Messages_interface.h b/Lab/demo/Lab/Messages_interface.h similarity index 82% rename from Polyhedron/demo/Polyhedron/Messages_interface.h rename to Lab/demo/Lab/Messages_interface.h index 5a8ec184556..70565a38b4d 100644 --- a/Polyhedron/demo/Polyhedron/Messages_interface.h +++ b/Lab/demo/Lab/Messages_interface.h @@ -13,6 +13,6 @@ public: }; Q_DECLARE_INTERFACE(Messages_interface, - "com.geometryfactory.PolyhedronDemo.MessagesInterface/1.0") + "com.geometryfactory.CGALLab.MessagesInterface/1.0") #endif // MESSAGES_INTERFACE_H diff --git a/Polyhedron/demo/Polyhedron/Nef_type.h b/Lab/demo/Lab/Nef_type.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Nef_type.h rename to Lab/demo/Lab/Nef_type.h diff --git a/Polyhedron/demo/Polyhedron/Nef_type_fwd.h b/Lab/demo/Lab/Nef_type_fwd.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Nef_type_fwd.h rename to Lab/demo/Lab/Nef_type_fwd.h diff --git a/Polyhedron/demo/Polyhedron/One_ring_iterators.h b/Lab/demo/Lab/One_ring_iterators.h similarity index 100% rename from Polyhedron/demo/Polyhedron/One_ring_iterators.h rename to Lab/demo/Lab/One_ring_iterators.h diff --git a/Polyhedron/demo/Polyhedron/PMP.cpp b/Lab/demo/Lab/PMP.cpp similarity index 91% rename from Polyhedron/demo/Polyhedron/PMP.cpp rename to Lab/demo/Lab/PMP.cpp index 3b3b4509f6e..a0f53d4ce6b 100644 --- a/Polyhedron/demo/Polyhedron/PMP.cpp +++ b/Lab/demo/Lab/PMP.cpp @@ -1,4 +1,4 @@ -#include "Polyhedron_demo.h" +#include "cgallab.h" #include #include #include @@ -19,7 +19,7 @@ int main(int argc, char **argv) QSurfaceFormat::setDefaultFormat(fmt); QStringList keywords; keywords << "PMP"; - Polyhedron_demo app(argc, argv, + CGAL_Lab app(argc, argv, "PMP demo", "CGAL Polygon Mesh Processing Demo", keywords); diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt b/Lab/demo/Lab/Plugins/AABB_tree/CMakeLists.txt similarity index 72% rename from Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt rename to Lab/demo/Lab/Plugins/AABB_tree/CMakeLists.txt index 452504968c9..7f941111d24 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/AABB_tree/CMakeLists.txt @@ -1,10 +1,10 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) -polyhedron_demo_plugin(do_trees_intersect_plugin Do_trees_intersect_plugin) +cgal_lab_plugin(do_trees_intersect_plugin Do_trees_intersect_plugin) target_link_libraries(do_trees_intersect_plugin PUBLIC scene_surface_mesh_item scene_movable_sm_item) -polyhedron_demo_plugin(cut_plugin Cut_plugin) +cgal_lab_plugin(cut_plugin Cut_plugin) target_link_libraries(cut_plugin PUBLIC scene_surface_mesh_item scene_basic_objects scene_color_ramp) if(TARGET CGAL::TBB_support) diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/Lab/demo/Lab/Plugins/AABB_tree/Cut_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp rename to Lab/demo/Lab/Plugins/AABB_tree/Cut_plugin.cpp index 9c6105b5db7..c5d3dda9825 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp +++ b/Lab/demo/Lab/Plugins/AABB_tree/Cut_plugin.cpp @@ -8,8 +8,8 @@ #include "Messages_interface.h" #include "Scene_plane_item.h" #include "Scene_surface_mesh_item.h" -#include -#include +#include +#include #include #include #include @@ -923,22 +923,22 @@ private: }; // end class Scene_edges_item using namespace CGAL::Three; -class Polyhedron_demo_cut_plugin : +class CGAL_Lab_cut_plugin : public QObject, - public Polyhedron_demo_plugin_interface, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_plugin_interface, + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90") public: - Polyhedron_demo_cut_plugin() : QObject(), edges_item(nullptr) { + CGAL_Lab_cut_plugin() : QObject(), edges_item(nullptr) { } - ~Polyhedron_demo_cut_plugin(); + ~CGAL_Lab_cut_plugin(); bool applicable(QAction*) const override{ // returns true if one surface_mesh is in the entries @@ -1007,7 +1007,7 @@ public: return false; } - using Polyhedron_demo_io_plugin_interface::init; + using CGAL_Lab_io_plugin_interface::init; void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) override; QList actions() const override; @@ -1124,10 +1124,10 @@ private: Edge_sm_trees edge_sm_trees; template void apply(Item* item, QMap< QObject*, Facets_tree*>& f_trees, QMap& e_trees); -}; // end Polyhedron_demo_cut_plugin +}; // end CGAL_Lab_cut_plugin -Polyhedron_demo_cut_plugin::~Polyhedron_demo_cut_plugin() +CGAL_Lab_cut_plugin::~CGAL_Lab_cut_plugin() { for(Facet_sm_tree *tree : facet_sm_trees.values()) { @@ -1140,7 +1140,7 @@ Polyhedron_demo_cut_plugin::~Polyhedron_demo_cut_plugin() } -void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_cut_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) { @@ -1190,11 +1190,11 @@ void Polyhedron_demo_cut_plugin::init(QMainWindow* mainWindow, } -QList Polyhedron_demo_cut_plugin::actions() const { +QList CGAL_Lab_cut_plugin::actions() const { return _actions; } -void Polyhedron_demo_cut_plugin::updateTrees(int id) +void CGAL_Lab_cut_plugin::updateTrees(int id) { if(plane_item && qobject_cast(scene->item(id))) @@ -1202,7 +1202,7 @@ if(plane_item && } template -void Polyhedron_demo_cut_plugin::apply(Item* item, QMap< QObject*, Facets_tree*>& f_trees, QMap& e_trees) +void CGAL_Lab_cut_plugin::apply(Item* item, QMap< QObject*, Facets_tree*>& f_trees, QMap& e_trees) { const Mesh& mesh = *item->polyhedron(); if(!CGAL::is_triangle_mesh(mesh)) @@ -1252,7 +1252,7 @@ void Polyhedron_demo_cut_plugin::apply(Item* item, QMap< QObject*, Facets_tree*> } } -void Polyhedron_demo_cut_plugin::createCutPlane() { +void CGAL_Lab_cut_plugin::createCutPlane() { bool updating = false; Scene_aabb_plane_item::Cut_planes_types type; int plane_id = -1; @@ -1313,7 +1313,7 @@ void Polyhedron_demo_cut_plugin::createCutPlane() { cut(); } -void Polyhedron_demo_cut_plugin::Intersection() +void CGAL_Lab_cut_plugin::Intersection() { QApplication::setOverrideCursor(Qt::WaitCursor); if(!plane_item) @@ -1325,7 +1325,7 @@ void Polyhedron_demo_cut_plugin::Intersection() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_cut_plugin::SignedFacets() { +void CGAL_Lab_cut_plugin::SignedFacets() { QApplication::setOverrideCursor(Qt::WaitCursor); if(!plane_item) createCutPlane(); @@ -1340,7 +1340,7 @@ void Polyhedron_demo_cut_plugin::SignedFacets() { QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_cut_plugin::UnsignedFacets() { +void CGAL_Lab_cut_plugin::UnsignedFacets() { QApplication::setOverrideCursor(Qt::WaitCursor); if(!plane_item) createCutPlane(); @@ -1354,7 +1354,7 @@ void Polyhedron_demo_cut_plugin::UnsignedFacets() { } QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_cut_plugin::UnsignedEdges() { +void CGAL_Lab_cut_plugin::UnsignedEdges() { QApplication::setOverrideCursor(Qt::WaitCursor); if(!plane_item) createCutPlane(); @@ -1369,7 +1369,7 @@ void Polyhedron_demo_cut_plugin::UnsignedEdges() { QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_cut_plugin::computeIntersection() +void CGAL_Lab_cut_plugin::computeIntersection() { QApplication::setOverrideCursor(Qt::WaitCursor); if(!edges_item) { @@ -1417,7 +1417,7 @@ void Polyhedron_demo_cut_plugin::computeIntersection() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_cut_plugin::cut() +void CGAL_Lab_cut_plugin::cut() { if(!plane_item) return; diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp b/Lab/demo/Lab/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp rename to Lab/demo/Lab/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp index 96741cfd9f0..ae68ee33187 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp +++ b/Lab/demo/Lab/Plugins/AABB_tree/Do_trees_intersect_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -18,11 +18,11 @@ class DoTreesIntersectplugin: public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: bool eventFilter(QObject *, QEvent *event) override diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp b/Lab/demo/Lab/Plugins/AABB_tree/Scene_movable_sm_item.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp rename to Lab/demo/Lab/Plugins/AABB_tree/Scene_movable_sm_item.cpp index 96051a607c4..049cfd6611b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.cpp +++ b/Lab/demo/Lab/Plugins/AABB_tree/Scene_movable_sm_item.cpp @@ -92,7 +92,7 @@ void Scene_movable_sm_item_priv::compute_elements() const typedef boost::graph_traits::face_descriptor face_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef boost::graph_traits::edge_descriptor edge_descriptor; - typedef CGAL::Buffer_for_vao CPF; + typedef CGAL::Buffer_for_vao CPF; flat_vertices.clear(); flat_normals.clear(); edges_vertices.clear(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.h b/Lab/demo/Lab/Plugins/AABB_tree/Scene_movable_sm_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Scene_movable_sm_item.h rename to Lab/demo/Lab/Plugins/AABB_tree/Scene_movable_sm_item.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp b/Lab/demo/Lab/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp rename to Lab/demo/Lab/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp index 91390c759dd..0ab0d872c88 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Alpha_wrap_3/Alpha_wrap_3_plugin.cpp @@ -1,7 +1,7 @@ #include -#include -#include +#include +#include #include "Scene_surface_mesh_item.h" #include "Scene_polygon_soup_item.h" @@ -293,13 +293,13 @@ Q_SIGNALS: void status_report(QString); }; -class Polyhedron_demo_alpha_wrap_3_plugin +class CGAL_Lab_alpha_wrap_3_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper + public CGAL::Three::CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") using Triangles = std::vector; using Segments = std::vector; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Alpha_wrap_3/CMakeLists.txt similarity index 72% rename from Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Alpha_wrap_3/CMakeLists.txt index 3f6540236e3..f77202905c6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Alpha_wrap_3/CMakeLists.txt @@ -1,8 +1,8 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) #if the plugin has a UI file qt6_wrap_ui(alpha_wrap_3UI_FILES alpha_wrap_3_dialog.ui) -polyhedron_demo_plugin(alpha_wrap_3_plugin Alpha_wrap_3_plugin ${alpha_wrap_3UI_FILES}) +cgal_lab_plugin(alpha_wrap_3_plugin Alpha_wrap_3_plugin ${alpha_wrap_3UI_FILES}) #if the plugin uses external libraries like scene_items target_link_libraries(alpha_wrap_3_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_points_with_normal_item scene_selection_item scene_polylines_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/alpha_wrap_3_dialog.ui b/Lab/demo/Lab/Plugins/Alpha_wrap_3/alpha_wrap_3_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Alpha_wrap_3/alpha_wrap_3_dialog.ui rename to Lab/demo/Lab/Plugins/Alpha_wrap_3/alpha_wrap_3_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt b/Lab/demo/Lab/Plugins/Camera_position/CMakeLists.txt similarity index 77% rename from Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Camera_position/CMakeLists.txt index e080e6837a3..c06fbc2f630 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Camera_position/CMakeLists.txt @@ -1,7 +1,7 @@ -include( polyhedron_demo_macros ) +include( cgallab_macros ) qt6_wrap_ui( cameraUI_FILES Camera_positions_list.ui ) -polyhedron_demo_plugin(camera_positions_plugin +cgal_lab_plugin(camera_positions_plugin Camera_positions_plugin Camera_positions_list.cpp ${cameraUI_FILES} diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp b/Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.cpp rename to Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.h b/Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.h rename to Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui b/Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.ui similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui rename to Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.ui index d1b910addf4..170a92300f9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_list.ui +++ b/Lab/demo/Lab/Plugins/Camera_position/Camera_positions_list.ui @@ -43,7 +43,7 @@ ... - + :/cgal/icons/plus:/cgal/icons/plus @@ -54,7 +54,7 @@ ... - + :/cgal/icons/minus:/cgal/icons/minus @@ -72,7 +72,7 @@ &Up - + :/cgal/icons/resources/up.png:/cgal/icons/resources/up.png @@ -86,7 +86,7 @@ &Down - + :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png @@ -120,7 +120,7 @@ PushButton - + :/cgal/icons/resources/front.png:/cgal/icons/resources/front.png @@ -134,7 +134,7 @@ PushButton - + :/cgal/icons/resources/back.png:/cgal/icons/resources/back.png @@ -148,7 +148,7 @@ PushButton - + :/cgal/icons/resources/top.png:/cgal/icons/resources/top.png @@ -162,7 +162,7 @@ PushButton - + :/cgal/icons/resources/bot.png:/cgal/icons/resources/bot.png @@ -176,7 +176,7 @@ PushButton - + :/cgal/icons/resources/left.png:/cgal/icons/resources/left.png @@ -190,7 +190,7 @@ PushButton - + :/cgal/icons/resources/right.png:/cgal/icons/resources/right.png @@ -217,7 +217,7 @@ - + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp b/Lab/demo/Lab/Plugins/Camera_position/Camera_positions_plugin.cpp similarity index 75% rename from Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp rename to Lab/demo/Lab/Plugins/Camera_position/Camera_positions_plugin.cpp index 53104cf7256..3a342fcf246 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Camera_position/Camera_positions_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Camera_position/Camera_positions_plugin.cpp @@ -1,6 +1,6 @@ #include #include "Messages_interface.h" -#include +#include #include "Camera_positions_list.h" @@ -9,13 +9,13 @@ #include using namespace CGAL::Three; -class Polyhedron_demo_camera_positions_plugin : +class CGAL_Lab_camera_positions_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90") public: void init() override; @@ -40,7 +40,7 @@ private: Camera_positions_list* cpl; }; -void Polyhedron_demo_camera_positions_plugin::init() +void CGAL_Lab_camera_positions_plugin::init() { cpl = new Camera_positions_list(CGAL::Three::Three::mainWindow()); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt b/Lab/demo/Lab/Plugins/Classification/CMakeLists.txt similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Classification/CMakeLists.txt index dffeae9f713..26c5f32631f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Classification/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) if(TARGET CGAL::Eigen3_support) @@ -22,7 +22,7 @@ if(TARGET CGAL::Eigen3_support) qt6_wrap_ui(classificationUI_FILES Classification_widget.ui Classification_advanced_widget.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( classification_plugin Classification_plugin Point_set_item_classification.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_advanced_widget.ui b/Lab/demo/Lab/Plugins/Classification/Classification_advanced_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_advanced_widget.ui rename to Lab/demo/Lab/Plugins/Classification/Classification_advanced_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp b/Lab/demo/Lab/Plugins/Classification/Classification_plugin.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp rename to Lab/demo/Lab/Plugins/Classification/Classification_plugin.cpp index 5ac906e1c56..d75cf0e3f73 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Classification/Classification_plugin.cpp @@ -19,7 +19,7 @@ #include "Scene_polygon_soup_item.h" #include -#include +#include #include #include @@ -48,13 +48,13 @@ using namespace CGAL::Three; -class Polyhedron_demo_classification_plugin : +class CGAL_Lab_classification_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") struct LabelButton { @@ -136,7 +136,7 @@ public: void print_message(QString message) { CGAL::Three::Three::information(message); } QList actions() const { return QList() << actionClassification; } - using Polyhedron_demo_plugin_helper::init; + using CGAL_Lab_plugin_helper::init; void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) { mw = mainWindow; @@ -1714,6 +1714,6 @@ private: Item_map item_map; -}; // end Polyhedron_demo_classification_plugin +}; // end CGAL_Lab_classification_plugin #include "Classification_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_widget.ui b/Lab/demo/Lab/Plugins/Classification/Classification_widget.ui similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_widget.ui rename to Lab/demo/Lab/Plugins/Classification/Classification_widget.ui index e96efa5c7d3..3bd4c66dc88 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_widget.ui +++ b/Lab/demo/Lab/Plugins/Classification/Classification_widget.ui @@ -64,7 +64,7 @@ - + :/cgal/icons/resources/help_button.png:/cgal/icons/resources/help_button.png @@ -75,7 +75,7 @@ - + :/cgal/icons/check-off.png:/cgal/icons/check-off.png @@ -195,7 +195,7 @@ - + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp rename to Lab/demo/Lab/Plugins/Classification/Cluster_classification.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h b/Lab/demo/Lab/Plugins/Classification/Cluster_classification.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.h rename to Lab/demo/Lab/Plugins/Classification/Cluster_classification.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h b/Lab/demo/Lab/Plugins/Classification/Item_classification_base.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h rename to Lab/demo/Lab/Plugins/Classification/Item_classification_base.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp rename to Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h b/Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.h rename to Lab/demo/Lab/Plugins/Classification/Point_set_item_classification.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp b/Lab/demo/Lab/Plugins/Classification/Surface_mesh_item_classification.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp rename to Lab/demo/Lab/Plugins/Classification/Surface_mesh_item_classification.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.h b/Lab/demo/Lab/Plugins/Classification/Surface_mesh_item_classification.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.h rename to Lab/demo/Lab/Plugins/Classification/Surface_mesh_item_classification.h diff --git a/Lab/demo/Lab/Plugins/Convex_decomposition/CMakeLists.txt b/Lab/demo/Lab/Plugins/Convex_decomposition/CMakeLists.txt new file mode 100644 index 00000000000..37bd33d7bc2 --- /dev/null +++ b/Lab/demo/Lab/Plugins/Convex_decomposition/CMakeLists.txt @@ -0,0 +1,4 @@ +include(cgallab_macros) + +cgal_lab_plugin(nef_plugin Nef_plugin) +target_link_libraries(nef_plugin PUBLIC scene_nef_polyhedron_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp b/Lab/demo/Lab/Plugins/Convex_decomposition/Nef_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp rename to Lab/demo/Lab/Plugins/Convex_decomposition/Nef_plugin.cpp index c5b7a5c04c8..6af71c9242a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/Nef_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Convex_decomposition/Nef_plugin.cpp @@ -1,7 +1,7 @@ #include "Scene_surface_mesh_item.h" #include "Scene_nef_polyhedron_item.h" -#include +#include #include #include @@ -11,13 +11,13 @@ #include #include using namespace CGAL::Three; -class Polyhedron_demo_nef_plugin : +class CGAL_Lab_nef_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: @@ -100,10 +100,10 @@ public Q_SLOTS: void on_actionDifference_triggered(); void on_actionMinkowskiSum_triggered(); void on_actionConvexDecomposition_triggered(); -}; // end class Polyhedron_demo_nef_plugin +}; // end class CGAL_Lab_nef_plugin void -Polyhedron_demo_nef_plugin::on_actionToNef_triggered() +CGAL_Lab_nef_plugin::on_actionToNef_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -133,7 +133,7 @@ Polyhedron_demo_nef_plugin::on_actionToNef_triggered() void -Polyhedron_demo_nef_plugin::on_actionConvexDecomposition_triggered() +CGAL_Lab_nef_plugin::on_actionConvexDecomposition_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -178,7 +178,7 @@ Polyhedron_demo_nef_plugin::on_actionConvexDecomposition_triggered() } void -Polyhedron_demo_nef_plugin::on_actionToPoly_triggered() +CGAL_Lab_nef_plugin::on_actionToPoly_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -213,21 +213,21 @@ Polyhedron_demo_nef_plugin::on_actionToPoly_triggered() } } -void Polyhedron_demo_nef_plugin::on_actionUnion_triggered() +void CGAL_Lab_nef_plugin::on_actionUnion_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); boolean_operation(BOOLEAN_UNION); QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_nef_plugin::on_actionIntersection_triggered() +void CGAL_Lab_nef_plugin::on_actionIntersection_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); boolean_operation(BOOLEAN_INTERSECTION); QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_nef_plugin::on_actionDifference_triggered() +void CGAL_Lab_nef_plugin::on_actionDifference_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); boolean_operation(BOOLEAN_DIFFERENCE); @@ -235,14 +235,14 @@ void Polyhedron_demo_nef_plugin::on_actionDifference_triggered() } void -Polyhedron_demo_nef_plugin::on_actionMinkowskiSum_triggered() +CGAL_Lab_nef_plugin::on_actionMinkowskiSum_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); boolean_operation(MINKOWSKI_SUM); QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_nef_plugin::boolean_operation(const Boolean_operation operation) +void CGAL_Lab_nef_plugin::boolean_operation(const Boolean_operation operation) { const int indexA = scene->selectionAindex(); const int indexB = scene->selectionBindex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt b/Lab/demo/Lab/Plugins/Convex_hull/CMakeLists.txt similarity index 75% rename from Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Convex_hull/CMakeLists.txt index 9897d0bb789..4b0ecd2ac94 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Convex_hull/CMakeLists.txt @@ -1,12 +1,12 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) -polyhedron_demo_plugin(convex_hull_plugin Convex_hull_plugin KEYWORDS +cgal_lab_plugin(convex_hull_plugin Convex_hull_plugin KEYWORDS PointSetProcessing) target_link_libraries( convex_hull_plugin PUBLIC scene_points_with_normal_item scene_polylines_item scene_selection_item scene_surface_mesh_item) -polyhedron_demo_plugin(kernel_plugin Kernel_plugin) +cgal_lab_plugin(kernel_plugin Kernel_plugin) target_link_libraries(kernel_plugin PUBLIC scene_surface_mesh_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp b/Lab/demo/Lab/Plugins/Convex_hull/Convex_hull_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp rename to Lab/demo/Lab/Plugins/Convex_hull/Convex_hull_plugin.cpp index b7df3dde9e9..dfd173cae62 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Convex_hull_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Convex_hull/Convex_hull_plugin.cpp @@ -9,19 +9,19 @@ #include "Scene_polyhedron_selection_item.h" #include "SMesh_type.h" -#include +#include #include #include #include using namespace CGAL::Three; -class Polyhedron_demo_convex_hull_plugin : +class CGAL_Lab_convex_hull_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow*mw, Scene_interface* scene_interface, @@ -51,10 +51,10 @@ private: QList _actions; Scene_interface* scene; QMainWindow* mw; -}; // end Polyhedron_demo_convex_hull_plugin +}; // end CGAL_Lab_convex_hull_plugin -void Polyhedron_demo_convex_hull_plugin::on_actionConvexHull_triggered() +void CGAL_Lab_convex_hull_plugin::on_actionConvexHull_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_points_with_normal_item* pts_item = diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp b/Lab/demo/Lab/Plugins/Convex_hull/Kernel_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp rename to Lab/demo/Lab/Plugins/Convex_hull/Kernel_plugin.cpp index 77de7dfaa1b..a5aaf34054a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/Kernel_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Convex_hull/Kernel_plugin.cpp @@ -8,7 +8,7 @@ #include "Scene_surface_mesh_item.h" #include "SMesh_type.h" -#include +#include #include #include #include @@ -24,13 +24,13 @@ typedef Kernel::Vector_3 Vector; typedef Kernel::Plane_3 Plane; typedef Kernel::FT FT; using namespace CGAL::Three; -class Polyhedron_demo_kernel_plugin : +class CGAL_Lab_kernel_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: QList actions() const { @@ -57,10 +57,10 @@ private: CGAL::Three::Scene_interface* scene; QMainWindow* mw; -}; // end Polyhedron_demo_kernel_plugin +}; // end CGAL_Lab_kernel_plugin -void Polyhedron_demo_kernel_plugin::on_actionKernel_triggered() +void CGAL_Lab_kernel_plugin::on_actionKernel_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt b/Lab/demo/Lab/Plugins/Display/CMakeLists.txt similarity index 72% rename from Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Display/CMakeLists.txt index 0c251b585cb..cdfa77c9f5f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Display/CMakeLists.txt @@ -1,14 +1,14 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) qt6_wrap_ui(display_propertyUI_FILES Display_property.ui) -polyhedron_demo_plugin(display_property_plugin Display_property_plugin ${display_propertyUI_FILES} KEYWORDS Viewer) +cgal_lab_plugin(display_property_plugin Display_property_plugin ${display_propertyUI_FILES} KEYWORDS Viewer) target_link_libraries(display_property_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_color_ramp) if(TARGET CGAL::Eigen3_support) qt6_wrap_ui(heat_methodUI_FILES Heat_method.ui) - polyhedron_demo_plugin(heat_method_plugin Heat_method_plugin ${heat_methodUI_FILES} KEYWORDS Viewer) + cgal_lab_plugin(heat_method_plugin Heat_method_plugin ${heat_methodUI_FILES} KEYWORDS Viewer) target_link_libraries(heat_method_plugin PUBLIC scene_surface_mesh_item scene_selection_item scene_color_ramp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property.ui b/Lab/demo/Lab/Plugins/Display/Display_property.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Display/Display_property.ui rename to Lab/demo/Lab/Plugins/Display/Display_property.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp rename to Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp index 68826d91862..ec4b1647c08 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/Display_property_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Display/Display_property_plugin.cpp @@ -11,8 +11,8 @@ #include "Scene_points_with_normal_item.h" #include "triangulate_primitive.h" -#include -#include +#include +#include #include #include #include @@ -67,11 +67,11 @@ public: class Display_property_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: QAction* actionDisplayProperties; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method.ui b/Lab/demo/Lab/Plugins/Display/Heat_method.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method.ui rename to Lab/demo/Lab/Plugins/Display/Heat_method.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp b/Lab/demo/Lab/Plugins/Display/Heat_method_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp rename to Lab/demo/Lab/Plugins/Display/Heat_method_plugin.cpp index e901d5f3dab..7cf450a671d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Display/Heat_method_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Display/Heat_method_plugin.cpp @@ -9,8 +9,8 @@ #include "Scene_polyhedron_selection_item.h" #include "Scene_surface_mesh_item.h" -#include -#include +#include +#include #include #include #include @@ -131,7 +131,7 @@ public: void computeElements() const override { - typedef CGAL::Buffer_for_vao CPF; + typedef CGAL::Buffer_for_vao CPF; QApplication::setOverrideCursor(Qt::WaitCursor); @@ -207,11 +207,11 @@ public: class Heat_method_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") using Vertex_distance_map = SMesh::Property_map; using Heat_method = CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/3mf_io_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/3mf_io_plugin.cpp index d757a5aaba2..b382ee84f2e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/3mf_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/3mf_io_plugin.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include @@ -21,11 +21,11 @@ using namespace NMR; class Io_3mf_plugin: public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "3mf_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "3mf_io_plugin.json") typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef std::vector PointRange; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Lab/demo/Lab/Plugins/IO/CMakeLists.txt similarity index 58% rename from Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt rename to Lab/demo/Lab/Plugins/IO/CMakeLists.txt index ec7b583d8a2..b42cf127ca8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/IO/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) find_package(LASLIB QUIET) set_package_properties( @@ -8,39 +8,39 @@ set_package_properties( include(CGAL_LASLIB_support) -polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin KEYWORDS Viewer) +cgal_lab_plugin(gocad_plugin GOCAD_io_plugin KEYWORDS Viewer) target_link_libraries(gocad_plugin PUBLIC scene_surface_mesh_item) qt6_wrap_ui( funcUI_FILES Function_dialog.ui ) -polyhedron_demo_plugin(io_implicit_function_plugin +cgal_lab_plugin(io_implicit_function_plugin Implicit_function_io_plugin ${funcUI_FILES} KEYWORDS Viewer Mesh_3) target_link_libraries(io_implicit_function_plugin PUBLIC scene_implicit_function_item) -polyhedron_demo_plugin(nef_io_plugin Nef_io_plugin KEYWORDS Viewer) +cgal_lab_plugin(nef_io_plugin Nef_io_plugin KEYWORDS Viewer) target_link_libraries(nef_io_plugin PUBLIC scene_nef_polyhedron_item) -polyhedron_demo_plugin(off_plugin OFF_io_plugin +cgal_lab_plugin(off_plugin OFF_io_plugin KEYWORDS Viewer Mesh_3 PointSetProcessing Classification PMP) target_link_libraries(off_plugin PUBLIC scene_polygon_soup_item scene_points_with_normal_item scene_surface_mesh_item) -polyhedron_demo_plugin(off_to_nef_plugin OFF_to_nef_io_plugin KEYWORDS Viewer) +cgal_lab_plugin(off_to_nef_plugin OFF_to_nef_io_plugin KEYWORDS Viewer) target_link_libraries(off_to_nef_plugin PUBLIC scene_nef_polyhedron_item) -polyhedron_demo_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS Viewer Mesh_3) +cgal_lab_plugin(polylines_io_plugin Polylines_io_plugin KEYWORDS Viewer Mesh_3) target_link_libraries(polylines_io_plugin PUBLIC scene_polylines_item) -polyhedron_demo_plugin(wkt_plugin WKT_io_plugin KEYWORDS Viewer PointSetProcessing Mesh_3) +cgal_lab_plugin(wkt_plugin WKT_io_plugin KEYWORDS Viewer PointSetProcessing Mesh_3) target_link_libraries(wkt_plugin PUBLIC scene_polylines_item) -polyhedron_demo_plugin(stl_plugin STL_io_plugin KEYWORDS Viewer PMP) +cgal_lab_plugin(stl_plugin STL_io_plugin KEYWORDS Viewer PMP) target_link_libraries(stl_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item) -polyhedron_demo_plugin(surf_io_plugin Surf_io_plugin KEYWORDS Viewer PMP) +cgal_lab_plugin(surf_io_plugin Surf_io_plugin KEYWORDS Viewer PMP) target_link_libraries(surf_io_plugin PUBLIC scene_surface_mesh_item) -polyhedron_demo_plugin(lcc_io_plugin lcc_io_plugin KEYWORDS Viewer) +cgal_lab_plugin(lcc_io_plugin lcc_io_plugin KEYWORDS Viewer) target_link_libraries(lcc_io_plugin PUBLIC scene_lcc_item) find_package(VTK QUIET COMPONENTS vtkCommonCore vtkIOCore vtkIOLegacy vtkIOXML @@ -50,7 +50,7 @@ set_package_properties( DESCRIPTION "A library for image processing." PURPOSE "Can be used for I/O (DICOM, VTU, VTP.") -polyhedron_demo_plugin(triangulation_3_io_plugin triangulation_3_io_plugin KEYWORDS Viewer) +cgal_lab_plugin(triangulation_3_io_plugin triangulation_3_io_plugin KEYWORDS Viewer) target_link_libraries(triangulation_3_io_plugin PUBLIC scene_triangulation_3_item) if(VTK_FOUND) @@ -63,7 +63,7 @@ if(VTK_FOUND) VTK::FiltersCore VTK::FiltersSources) endif() if(VTK_LIBRARIES) - polyhedron_demo_plugin(vtk_plugin VTK_io_plugin KEYWORDS Viewer Mesh_3) + cgal_lab_plugin(vtk_plugin VTK_io_plugin KEYWORDS Viewer Mesh_3) target_link_libraries(vtk_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_c3t3_item scene_points_with_normal_item ${VTK_LIBRARIES}) target_compile_definitions(vtk_plugin PRIVATE -DCGAL_USE_VTK -DNOMINMAX) @@ -76,33 +76,21 @@ if(VTK_FOUND) else() message(STATUS "NOTICE: the vtk IO plugin needs VTK 6.0 or greater and will not be compiled.") endif() -polyhedron_demo_plugin(xyz_plugin XYZ_io_plugin KEYWORDS Viewer PointSetProcessing Classification) +cgal_lab_plugin(xyz_plugin XYZ_io_plugin KEYWORDS Viewer PointSetProcessing Classification) target_link_libraries(xyz_plugin PUBLIC scene_points_with_normal_item) -list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_rvalue_references has_cxx_rvalues) -list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_variadic_templates has_cxx_variadic) - -if(has_cxx_rvalues LESS 0 OR has_cxx_variadic LESS 0) - message(STATUS "NOTICE: LAS/PLY IO examples require a C++11 compiler and will not be compiled.") -else() - set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) - - polyhedron_demo_plugin(ply_plugin PLY_io_plugin KEYWORDS Viewer PointSetProcessing Classification PMP) - target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_textured_item) - target_compile_features(ply_plugin PRIVATE ${needed_cxx_features}) - - if (TARGET CGAL::LASLIB_support) - polyhedron_demo_plugin(las_plugin LAS_io_plugin KEYWORDS Viewer PointSetProcessing Classification) - target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item CGAL::LASLIB_support) - target_compile_features(las_plugin PRIVATE ${needed_cxx_features}) - if(MSVC) - target_compile_definitions( - las_plugin - PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") - endif() - else() - message(STATUS "NOTICE: the LAS IO plugin needs LAS libraries and will not be compiled.") +cgal_lab_plugin(ply_plugin PLY_io_plugin KEYWORDS Viewer PointSetProcessing Classification PMP) +target_link_libraries(ply_plugin PUBLIC scene_points_with_normal_item scene_polygon_soup_item scene_surface_mesh_item scene_textured_item) +if (TARGET CGAL::LASLIB_support) + cgal_lab_plugin(las_plugin LAS_io_plugin KEYWORDS Viewer PointSetProcessing Classification) + target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item CGAL::LASLIB_support) + if(MSVC) + target_compile_definitions( + las_plugin + PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") endif() +else() + message(STATUS "NOTICE: the LAS IO plugin needs LAS libraries and will not be compiled.") endif() find_path( @@ -119,7 +107,7 @@ if(3MF_LIBRARIES AND 3MF_INCLUDE_DIR AND EXISTS "${3MF_INCLUDE_DIR}/Model/COM/NMR_DLLInterfaces.h") include_directories(${3MF_INCLUDE_DIR}) - polyhedron_demo_plugin(io_3mf_plugin 3mf_io_plugin KEYWORDS Viewer PMP) + cgal_lab_plugin(io_3mf_plugin 3mf_io_plugin KEYWORDS Viewer PMP) target_link_libraries(io_3mf_plugin PRIVATE scene_surface_mesh_item scene_points_with_normal_item scene_polylines_item ${3MF_LIBRARIES}) target_compile_definitions(io_3mf_plugin PRIVATE -DCGAL_LINKED_WITH_3MF) else() diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Function_dialog.ui b/Lab/demo/Lab/Plugins/IO/Function_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/IO/Function_dialog.ui rename to Lab/demo/Lab/Plugins/IO/Function_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/GOCAD_io_plugin.cpp similarity index 79% rename from Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/GOCAD_io_plugin.cpp index 36233827a32..fab076c3b34 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/GOCAD_io_plugin.cpp @@ -5,9 +5,9 @@ #include "SMesh_type.h" #include -#include -#include -#include +#include +#include +#include #include #include @@ -18,14 +18,14 @@ using namespace CGAL::Three; -class Polyhedron_demo_gocad_plugin : +class CGAL_Lab_gocad_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "gocad_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "gocad_io_plugin.json") public: @@ -38,17 +38,17 @@ public: bool save(QFileInfo fileinfo, QList& ); }; -QString Polyhedron_demo_gocad_plugin::nameFilters() const { +QString CGAL_Lab_gocad_plugin::nameFilters() const { return "GOCAD files (*.ts)"; } -bool Polyhedron_demo_gocad_plugin::canLoad(QFileInfo) const { +bool CGAL_Lab_gocad_plugin::canLoad(QFileInfo) const { return true; } QList -Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { +CGAL_Lab_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { // Open file std::ifstream in(fileinfo.filePath().toUtf8()); @@ -101,13 +101,13 @@ Polyhedron_demo_gocad_plugin::load(QFileInfo fileinfo, bool& ok, bool add_to_sce return QList()<(item); } -bool Polyhedron_demo_gocad_plugin:: +bool CGAL_Lab_gocad_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/Implicit_function_io_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/Implicit_function_io_plugin.cpp index 628362efd0b..77f94babd2c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Implicit_function_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/Implicit_function_io_plugin.cpp @@ -14,8 +14,8 @@ // File Description : //****************************************************************************** -#include -#include +#include +#include #include "implicit_functions/Implicit_function_interface.h" #include "Scene_implicit_function_item.h" @@ -33,11 +33,11 @@ using namespace CGAL::Three; class Io_implicit_function_plugin : public QObject, - protected Polyhedron_demo_plugin_helper + protected CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "implicit_function_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "implicit_function_io_plugin.json") public: Io_implicit_function_plugin(); @@ -50,7 +50,7 @@ public: // bool canLoad() const { return false; } - typedef Polyhedron_demo_plugin_helper Plugin_helper; + typedef CGAL_Lab_plugin_helper Plugin_helper; using Plugin_helper::init; virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/LAS_io_plugin.cpp similarity index 79% rename from Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/LAS_io_plugin.cpp index a46bc54d3bf..faaf4c880ea 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/LAS_io_plugin.cpp @@ -1,17 +1,17 @@ #include "Scene_points_with_normal_item.h" -#include +#include #include #include #include #include using namespace CGAL::Three; -class Polyhedron_demo_las_plugin : +class CGAL_Lab_las_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "las_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "las_io_plugin.json") public: QString name() const { return "las_plugin"; } @@ -23,11 +23,11 @@ public: bool save(QFileInfo fileinfo,QList& ); }; -bool Polyhedron_demo_las_plugin::canLoad(QFileInfo ) const { +bool CGAL_Lab_las_plugin::canLoad(QFileInfo ) const { return true; } -QList Polyhedron_demo_las_plugin:: +QList CGAL_Lab_las_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { std::ifstream in(fileinfo.filePath().toUtf8(), std::ios_base::binary); @@ -70,12 +70,12 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { return QList()<(item); } -bool Polyhedron_demo_las_plugin::save(QFileInfo fileinfo,QList& items) +bool CGAL_Lab_las_plugin::save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); // Check extension (quietly) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/Nef_io_plugin.cpp similarity index 78% rename from Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/Nef_io_plugin.cpp index 25b5c1d7432..95e31eb9808 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Nef_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/Nef_io_plugin.cpp @@ -1,18 +1,18 @@ #include "Scene_nef_polyhedron_item.h" -#include +#include #include #include #include using namespace CGAL::Three; -class Polyhedron_demo_io_nef_plugin : +class CGAL_Lab_io_nef_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "nef_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "nef_io_plugin.json") public: QString nameFilters() const override; @@ -29,16 +29,16 @@ public: } }; -QString Polyhedron_demo_io_nef_plugin::nameFilters() const { +QString CGAL_Lab_io_nef_plugin::nameFilters() const { return "nef files (*.nef3)"; } -bool Polyhedron_demo_io_nef_plugin::canLoad(QFileInfo) const { +bool CGAL_Lab_io_nef_plugin::canLoad(QFileInfo) const { return true; } -QList Polyhedron_demo_io_nef_plugin:: +QList CGAL_Lab_io_nef_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { //do not try file with extension different from nef3 if (fileinfo.suffix() != "nef3") @@ -79,13 +79,13 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { return QList()<(item); } -bool Polyhedron_demo_io_nef_plugin::save(QFileInfo fileinfo,QList& items) +bool CGAL_Lab_io_nef_plugin::save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); // This plugin supports polyhedrons and polygon soups diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/OFF_io_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/OFF_io_plugin.cpp index c413104e883..e0677c1c663 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/OFF_io_plugin.cpp @@ -3,7 +3,7 @@ #include "Scene_points_with_normal_item.h" #include -#include +#include #include #include @@ -20,13 +20,13 @@ using namespace CGAL::Three; -class Polyhedron_demo_off_plugin : +class CGAL_Lab_off_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "off_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "off_io_plugin.json") public: bool isDefaultLoader(const Scene_item *item) const override @@ -53,11 +53,11 @@ public: bool save(QFileInfo fileinfo,QList& ) override; }; -bool Polyhedron_demo_off_plugin::canLoad(QFileInfo) const { +bool CGAL_Lab_off_plugin::canLoad(QFileInfo) const { return true; } -QList Polyhedron_demo_off_plugin:: +QList CGAL_Lab_off_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { if(fileinfo.size() == 0) @@ -105,7 +105,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { CGAL::Three::Scene_item* -Polyhedron_demo_off_plugin::load_off(QFileInfo fileinfo) { +CGAL_Lab_off_plugin::load_off(QFileInfo fileinfo) { // Open file std::ifstream in(fileinfo.filePath().toUtf8()); if(!in) { @@ -207,7 +207,7 @@ Polyhedron_demo_off_plugin::load_off(QFileInfo fileinfo) { } CGAL::Three::Scene_item* -Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) { +CGAL_Lab_off_plugin::load_obj(QFileInfo fileinfo) { // Open file std::ifstream in(fileinfo.filePath().toUtf8()); if(!in) { @@ -230,7 +230,7 @@ Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) { return nullptr; } -bool Polyhedron_demo_off_plugin::canSave(const CGAL::Three::Scene_item* item) +bool CGAL_Lab_off_plugin::canSave(const CGAL::Three::Scene_item* item) { // This plugin supports surface_meshes and polygon soups return qobject_cast(item) || @@ -240,7 +240,7 @@ bool Polyhedron_demo_off_plugin::canSave(const CGAL::Three::Scene_item* item) bool -Polyhedron_demo_off_plugin:: +CGAL_Lab_off_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/OFF_to_nef_io_plugin.cpp similarity index 71% rename from Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/OFF_to_nef_io_plugin.cpp index 9e6cfd399ee..f5cea640b93 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_to_nef_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/OFF_to_nef_io_plugin.cpp @@ -1,17 +1,17 @@ #include "Scene_nef_polyhedron_item.h" #include "Nef_type.h" -#include +#include #include #include using namespace CGAL::Three; -class Polyhedron_demo_off_to_nef_plugin : +class CGAL_Lab_off_to_nef_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "off_to_nef_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "off_to_nef_io_plugin.json") public: QString name() const { return "off_to_nef_plugin"; } @@ -23,11 +23,11 @@ public: bool save(QFileInfo fileinfo,QList& ); }; -bool Polyhedron_demo_off_to_nef_plugin::canLoad(QFileInfo) const { +bool CGAL_Lab_off_to_nef_plugin::canLoad(QFileInfo) const { return true; } -QList Polyhedron_demo_off_to_nef_plugin:: +QList CGAL_Lab_off_to_nef_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ std::ifstream in(fileinfo.filePath().toUtf8()); @@ -57,12 +57,12 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ return QList()<&) { return false; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp index fe4120c5919..917f13a844e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/PLY_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp @@ -4,7 +4,7 @@ #include "Scene_points_with_normal_item.h" #include -#include +#include #include #include @@ -21,13 +21,13 @@ using namespace CGAL::Three; -class Polyhedron_demo_ply_plugin : +class CGAL_Lab_ply_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "ply_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "ply_io_plugin.json") public: bool isDefaultLoader(const CGAL::Three::Scene_item *item) const override @@ -46,13 +46,13 @@ public: }; -bool Polyhedron_demo_ply_plugin:: +bool CGAL_Lab_ply_plugin:: canLoad(QFileInfo) const { return true; } QList -Polyhedron_demo_ply_plugin:: +CGAL_Lab_ply_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { std::ifstream in(fileinfo.filePath().toUtf8(), std::ios_base::binary); @@ -175,7 +175,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { return QList(); } -bool Polyhedron_demo_ply_plugin::canSave(const CGAL::Three::Scene_item* item) +bool CGAL_Lab_ply_plugin::canSave(const CGAL::Three::Scene_item* item) { // This plugin supports point sets and any type of surface return (qobject_cast(item) @@ -184,7 +184,7 @@ bool Polyhedron_demo_ply_plugin::canSave(const CGAL::Three::Scene_item* item) || qobject_cast(item)); } -bool Polyhedron_demo_ply_plugin:: +bool CGAL_Lab_ply_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/Polylines_io_plugin.cpp similarity index 90% rename from Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/Polylines_io_plugin.cpp index 75503490a2a..b737f8f3710 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Polylines_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/Polylines_io_plugin.cpp @@ -1,9 +1,9 @@ #include "Scene_polylines_item.h" #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -14,22 +14,22 @@ #include #include using namespace CGAL::Three; -class Polyhedron_demo_polylines_io_plugin : +class CGAL_Lab_polylines_io_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_io_plugin_interface, + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "polylines_io_plugin.json") - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "polylines_io_plugin.json") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90") public: // To silent a warning -Woverloaded-virtual // See https://stackoverflow.com/questions/9995421/gcc-woverloaded-virtual-warnings - using Polyhedron_demo_io_plugin_interface::init; + using CGAL_Lab_io_plugin_interface::init; //! Configures the widget void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, @@ -54,10 +54,10 @@ public: actionSimplify_polylines->setProperty("subMenuName", "Operations on Polylines"); actionSimplify_polylines->setObjectName("actionSimplifyPolylines"); - connect(actionSplit_polylines, &QAction::triggered, this, &Polyhedron_demo_polylines_io_plugin::split); - connect(actionSplit_polylines_graph, &QAction::triggered, this, &Polyhedron_demo_polylines_io_plugin::split_graph); - connect(actionJoin_polylines, &QAction::triggered, this, &Polyhedron_demo_polylines_io_plugin::join); - connect(actionSimplify_polylines, &QAction::triggered, this, &Polyhedron_demo_polylines_io_plugin::simplify); + connect(actionSplit_polylines, &QAction::triggered, this, &CGAL_Lab_polylines_io_plugin::split); + connect(actionSplit_polylines_graph, &QAction::triggered, this, &CGAL_Lab_polylines_io_plugin::split_graph); + connect(actionJoin_polylines, &QAction::triggered, this, &CGAL_Lab_polylines_io_plugin::join); + connect(actionSimplify_polylines, &QAction::triggered, this, &CGAL_Lab_polylines_io_plugin::simplify); } @@ -118,7 +118,7 @@ private: QAction* actionSimplify_polylines; }; -bool Polyhedron_demo_polylines_io_plugin::canLoad(QFileInfo fileinfo) const{ +bool CGAL_Lab_polylines_io_plugin::canLoad(QFileInfo fileinfo) const{ if(!fileinfo.suffix().contains("cgal")) return true; std::ifstream in(fileinfo.filePath().toUtf8()); @@ -134,7 +134,7 @@ bool Polyhedron_demo_polylines_io_plugin::canLoad(QFileInfo fileinfo) const{ QList -Polyhedron_demo_polylines_io_plugin:: +CGAL_Lab_polylines_io_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ // Open file @@ -212,12 +212,12 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ return QList()<(item) != 0; } -bool Polyhedron_demo_polylines_io_plugin:: +bool CGAL_Lab_polylines_io_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); @@ -259,7 +259,7 @@ save(QFileInfo fileinfo,QList& items) return res; } -void Polyhedron_demo_polylines_io_plugin::split() +void CGAL_Lab_polylines_io_plugin::split() { Scene_polylines_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); Scene_group_item* group = new Scene_group_item("Split Polylines"); @@ -324,7 +324,7 @@ polylines_to_split(std::vector >& polylines, CGAL::split_graph_into_polylines(const_graph, visitor); } -void Polyhedron_demo_polylines_io_plugin::split_graph() +void CGAL_Lab_polylines_io_plugin::split_graph() { Scene_item* main_item = scene->item(scene->mainSelectionIndex()); Scene_polylines_item* polylines_item = @@ -339,7 +339,7 @@ void Polyhedron_demo_polylines_io_plugin::split_graph() scene->addItem(new_item); } -void Polyhedron_demo_polylines_io_plugin::simplify() +void CGAL_Lab_polylines_io_plugin::simplify() { Scene_polylines_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); bool ok; @@ -362,7 +362,7 @@ void Polyhedron_demo_polylines_io_plugin::simplify() item->redraw(); } -void Polyhedron_demo_polylines_io_plugin::join() +void CGAL_Lab_polylines_io_plugin::join() { std::vector items; diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/STL_io_plugin.cpp similarity index 87% rename from Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/STL_io_plugin.cpp index 20fa2f36ca1..5515bbc1a58 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/STL_io_plugin.cpp @@ -4,7 +4,7 @@ #include "Kernel_type.h" #include "Scene.h" -#include +#include #include #include @@ -26,13 +26,13 @@ #include using namespace CGAL::Three; -class Polyhedron_demo_stl_plugin : +class CGAL_Lab_stl_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "stl_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "stl_io_plugin.json") public: QString nameFilters() const; @@ -44,18 +44,18 @@ public: bool save(QFileInfo fileinfo,QList&); }; -QString Polyhedron_demo_stl_plugin::nameFilters() const { +QString CGAL_Lab_stl_plugin::nameFilters() const { return "STL files (*.stl)"; } -bool Polyhedron_demo_stl_plugin::canLoad(QFileInfo) const { +bool CGAL_Lab_stl_plugin::canLoad(QFileInfo) const { return true; } QList -Polyhedron_demo_stl_plugin:: +CGAL_Lab_stl_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ // Open file @@ -120,12 +120,12 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ return QList()<(item); } -bool Polyhedron_demo_stl_plugin:: +bool CGAL_Lab_stl_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/Surf_io_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/Surf_io_plugin.cpp index c939b1fb086..2dd051b6bbf 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/Surf_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/Surf_io_plugin.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -18,11 +18,11 @@ using namespace CGAL::Three; class Surf_io_plugin: public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "surf_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "surf_io_plugin.json") public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp index ca824a3e9ee..58512209f23 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/VTK_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/VTK_io_plugin.cpp @@ -18,8 +18,8 @@ #include "Scene_polylines_item.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -183,13 +183,13 @@ namespace CGAL{ }//end namespace CGAL -class Polyhedron_demo_vtk_plugin : +class CGAL_Lab_vtk_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "vtk_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "vtk_io_plugin.json") public: typedef boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -543,7 +543,7 @@ public: CGAL::Three::Three::scene()->addItem(point_item); return QList()< +#include #include #include #include @@ -10,13 +10,13 @@ #include using namespace CGAL::Three; -class Polyhedron_demo_wkt_plugin : +class CGAL_Lab_wkt_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "wkt_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "wkt_io_plugin.json") public: bool isDefaultLoader(const CGAL::Three::Scene_item *item) const @@ -37,13 +37,13 @@ public: bool save(QFileInfo fileinfo,QList&); }; -bool Polyhedron_demo_wkt_plugin:: +bool CGAL_Lab_wkt_plugin:: canLoad(QFileInfo) const { return true; } QList -Polyhedron_demo_wkt_plugin:: +CGAL_Lab_wkt_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { std::ifstream in(fileinfo.filePath().toUtf8(), std::ios_base::binary); @@ -77,13 +77,13 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { return QList() << item; } -bool Polyhedron_demo_wkt_plugin::canSave(const CGAL::Three::Scene_item* item) +bool CGAL_Lab_wkt_plugin::canSave(const CGAL::Three::Scene_item* item) { // This plugin supports polylines return (qobject_cast(item)); } -bool Polyhedron_demo_wkt_plugin:: +bool CGAL_Lab_wkt_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/XYZ_io_plugin.cpp similarity index 84% rename from Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/XYZ_io_plugin.cpp index 174ecaa9f9f..253abdb867b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/XYZ_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/XYZ_io_plugin.cpp @@ -2,20 +2,20 @@ #include "Kernel_type.h" #include -#include +#include #include #include #include #include using namespace CGAL::Three; -class Polyhedron_demo_xyz_plugin : +class CGAL_Lab_xyz_plugin : public QObject, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "xyz_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "xyz_io_plugin.json") public: @@ -28,13 +28,13 @@ public: bool save(QFileInfo fileinfo,QList&); }; -bool Polyhedron_demo_xyz_plugin::canLoad(QFileInfo) const { +bool CGAL_Lab_xyz_plugin::canLoad(QFileInfo) const { return true; } QList -Polyhedron_demo_xyz_plugin:: +CGAL_Lab_xyz_plugin:: load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { // Open file @@ -74,13 +74,13 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) return QList()<(item); } -bool Polyhedron_demo_xyz_plugin:: +bool CGAL_Lab_xyz_plugin:: save(QFileInfo fileinfo,QList& items) { Scene_item* item = items.front(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/lcc_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/lcc_io_plugin.cpp similarity index 86% rename from Polyhedron/demo/Polyhedron/Plugins/IO/lcc_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/lcc_io_plugin.cpp index c5ef473636f..027b52fd69e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/lcc_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/lcc_io_plugin.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -10,11 +10,11 @@ class LCC_io_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "lcc_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "lcc_io_plugin.json") public: bool isDefaultLoader(const CGAL::Three::Scene_item *item) const override diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/triangulation_3_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/triangulation_3_io_plugin.cpp similarity index 89% rename from Polyhedron/demo/Polyhedron/Plugins/IO/triangulation_3_io_plugin.cpp rename to Lab/demo/Lab/Plugins/IO/triangulation_3_io_plugin.cpp index b0312c5eb6a..a44639008a4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/triangulation_3_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/triangulation_3_io_plugin.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include "T3_type.h" #include #include @@ -8,11 +8,11 @@ class Triangulation_3_io_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "triangulation_3_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "triangulation_3_io_plugin.json") public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/Isosurfacing_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Isosurfacing_3/CMakeLists.txt similarity index 56% rename from Polyhedron/demo/Polyhedron/Plugins/Isosurfacing_3/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Isosurfacing_3/CMakeLists.txt index 8707fb421bd..dd6d352dfbe 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Isosurfacing_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Isosurfacing_3/CMakeLists.txt @@ -1,6 +1,6 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) -polyhedron_demo_plugin(isosurface_3_plugin Isosurface_3_plugin KEYWORDS +cgal_lab_plugin(isosurface_3_plugin Isosurface_3_plugin KEYWORDS Isosurface_3) target_link_libraries( isosurface_3_plugin PUBLIC scene_polygon_soup_item scene_image_item ) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Isosurfacing_3/Isosurface_3_plugin.cpp b/Lab/demo/Lab/Plugins/Isosurfacing_3/Isosurface_3_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/Isosurfacing_3/Isosurface_3_plugin.cpp rename to Lab/demo/Lab/Plugins/Isosurfacing_3/Isosurface_3_plugin.cpp index 3e33a22f83d..57467f98a4c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Isosurfacing_3/Isosurface_3_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Isosurfacing_3/Isosurface_3_plugin.cpp @@ -7,18 +7,18 @@ #include "SMesh_type.h" #include "Image_type.h" -#include +#include #include #include using namespace CGAL::Three; -class Polyhedron_demo_isosurface_3_plugin : +class CGAL_Lab_isosurface_3_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow*mw, Scene_interface* scene_interface, @@ -45,9 +45,9 @@ private: QList _actions; Scene_interface* scene; QMainWindow* mw; -}; // end Polyhedron_demo_convex_hull_plugin +}; // end CGAL_Lab_convex_hull_plugin -class Polyhedron_demo_isosurface_3_plugin_helper { +class CGAL_Lab_isosurface_3_plugin_helper { typedef float Word_type; typedef std::size_t vertex_descriptor; typedef std::pair surface_descriptor; @@ -121,7 +121,7 @@ class Polyhedron_demo_isosurface_3_plugin_helper { }; public: - Polyhedron_demo_isosurface_3_plugin_helper(const Image* image) + CGAL_Lab_isosurface_3_plugin_helper(const Image* image) { image_ = image; } @@ -322,7 +322,7 @@ private: } }; -void Polyhedron_demo_isosurface_3_plugin::on_actionDualLabel_triggered() +void CGAL_Lab_isosurface_3_plugin::on_actionDualLabel_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -340,7 +340,7 @@ void Polyhedron_demo_isosurface_3_plugin::on_actionDualLabel_triggered() time_per_op.start(); std::cout << "Dual contour label image..."; - Polyhedron_demo_isosurface_3_plugin_helper helper(img_item->image()); + CGAL_Lab_isosurface_3_plugin_helper helper(img_item->image()); helper.dual_contouring_label_image(); std::vector vertices; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt b/Lab/demo/Lab/Plugins/Mesh_2/CMakeLists.txt similarity index 72% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Mesh_2/CMakeLists.txt index 3f3be1c57aa..3d5e1d8d9d3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Mesh_2/CMakeLists.txt @@ -1,7 +1,7 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) #if the plugin has a UI file qt6_wrap_ui(mesh_2UI_FILES mesh_2_dialog.ui) -polyhedron_demo_plugin(mesh_2_plugin Mesh_2_plugin ${mesh_2UI_FILES}) +cgal_lab_plugin(mesh_2_plugin Mesh_2_plugin ${mesh_2UI_FILES}) #if the plugin uses external libraries like scene_items target_link_libraries( mesh_2_plugin PUBLIC scene_surface_mesh_item scene_polylines_item diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp index 6c9e1f0a8f4..e55c30779bb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/Mesh_2_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_2/Mesh_2_plugin.cpp @@ -11,8 +11,8 @@ #include -#include -#include +#include +#include #include "Scene_surface_mesh_item.h" @@ -139,13 +139,13 @@ void cdt2_to_face_graph(const CDT& cdt, TriangleMesh& tm, int constant_coordinat } } -class Polyhedron_demo_mesh_2_plugin : +class CGAL_Lab_mesh_2_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper + public CGAL::Three::CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_2/mesh_2_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_2/mesh_2_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_2/mesh_2_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp index 536545443d4..af885246ea4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -1,7 +1,7 @@ #include #include "Scene_c3t3_item.h" #include -#include +#include #include #include #include @@ -9,13 +9,13 @@ #include -class Polyhedron_demo_c3t3_binary_io_plugin : +class CGAL_Lab_c3t3_binary_io_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "c3t3_io_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "c3t3_io_plugin.json") public: QString name() const override { return "C3t3_io_plugin"; } @@ -42,7 +42,7 @@ private: }; -bool Polyhedron_demo_c3t3_binary_io_plugin::canLoad(QFileInfo fi) const { +bool CGAL_Lab_c3t3_binary_io_plugin::canLoad(QFileInfo fi) const { if(!fi.suffix().contains("cgal")) return true; std::ifstream in(fi.filePath().toUtf8(), @@ -71,7 +71,7 @@ bool Polyhedron_demo_c3t3_binary_io_plugin::canLoad(QFileInfo fi) const { } QList -Polyhedron_demo_c3t3_binary_io_plugin::load( +CGAL_Lab_c3t3_binary_io_plugin::load( QFileInfo fileinfo, bool& ok, bool add_to_scene) { // Open file @@ -185,14 +185,14 @@ Polyhedron_demo_c3t3_binary_io_plugin::load( return QList(); } -bool Polyhedron_demo_c3t3_binary_io_plugin::canSave(const CGAL::Three::Scene_item* item) +bool CGAL_Lab_c3t3_binary_io_plugin::canSave(const CGAL::Three::Scene_item* item) { // This plugin supports c3t3 items. return qobject_cast(item); } bool -Polyhedron_demo_c3t3_binary_io_plugin:: +CGAL_Lab_c3t3_binary_io_plugin:: save(QFileInfo fileinfo, QList &items) { Scene_item* item = items.front(); @@ -481,7 +481,7 @@ struct Update_cell_from_CDT_3 { }; // end struct Update_cell bool -Polyhedron_demo_c3t3_binary_io_plugin:: +CGAL_Lab_c3t3_binary_io_plugin:: try_load_a_cdt_3(std::istream& is, C3t3& c3t3) { std::cerr << "Try load a CDT_3..."; @@ -522,7 +522,7 @@ try_load_a_cdt_3(std::istream& is, C3t3& c3t3) } void -Polyhedron_demo_c3t3_binary_io_plugin:: +CGAL_Lab_c3t3_binary_io_plugin:: update_c3t3(C3t3& c3t3) { using Cell_handle = C3t3::Triangulation::Cell_handle; @@ -563,7 +563,7 @@ update_c3t3(C3t3& c3t3) //Generates a compilation error. bool -Polyhedron_demo_c3t3_binary_io_plugin:: +CGAL_Lab_c3t3_binary_io_plugin:: try_load_other_binary_format(std::istream& is, C3t3& c3t3) { CGAL::IO::set_ascii_mode(is); @@ -583,7 +583,7 @@ try_load_other_binary_format(std::istream& is, C3t3& c3t3) std::getline(is, s); if(s != "") { if(s != std::string(" ") + CGAL::Get_io_signature()()) { - std::cerr << "Polyhedron_demo_c3t3_binary_io_plugin::try_load_other_binary_format:" + std::cerr << "CGAL_Lab_c3t3_binary_io_plugin::try_load_other_binary_format:" << "\n expected format: " << CGAL::Get_io_signature()() << "\n got format:" << s << std::endl; return false; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp index 8fbe68dfc4e..21dc40ab0f0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_rib_exporter_plugin.cpp @@ -6,8 +6,8 @@ #endif #include -#include -#include +#include +#include #include #include "Scene_c3t3_item.h" @@ -33,11 +33,11 @@ using namespace CGAL::Three; class C3t3_rib_exporter_plugin : public QObject, - protected Polyhedron_demo_plugin_helper + protected CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "c3t3_rib_exporter_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "c3t3_rib_exporter_plugin.json") public: C3t3_rib_exporter_plugin(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt similarity index 90% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt index 2d3ac39315e..de2ff090aee 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Mesh_3/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) remove_definitions(-DQT_STATICPLUGIN) @@ -8,7 +8,7 @@ qt6_wrap_cpp(VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_interface.h) qt6_wrap_ui(meshingUI_FILES Meshing_dialog.ui Smoother_dialog.ui Local_optimizers_dialog.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( mesh_3_plugin Mesh_3_plugin Mesh_3_plugin_cgal_code.cpp @@ -59,7 +59,7 @@ endif() find_package(Boost QUIET OPTIONAL_COMPONENTS filesystem system) if(Boost_FILESYSTEM_FOUND) qt6_wrap_ui( imgUI_FILES Image_res_dialog.ui raw_image.ui) - polyhedron_demo_plugin(io_image_plugin Io_image_plugin + cgal_lab_plugin(io_image_plugin Io_image_plugin Volume_plane_intersection.cpp Raw_image_dialog.cpp ${imgUI_FILES} @@ -78,7 +78,7 @@ if(Boost_FILESYSTEM_FOUND) else() message(STATUS "NOTICE: the Io_image_plugin requires boost-filesystem, and will not be compiled") endif() -polyhedron_demo_plugin( +cgal_lab_plugin( mesh_3_optimization_plugin Optimization_plugin Optimization_plugin_cgal_code.cpp @@ -101,15 +101,15 @@ else() "A deprecated class will be used to replace it. Warnings are to be expected.") endif() -polyhedron_demo_plugin(c3t3_io_plugin C3t3_io_plugin KEYWORDS Viewer Mesh_3) +cgal_lab_plugin(c3t3_io_plugin C3t3_io_plugin KEYWORDS Viewer Mesh_3) target_link_libraries(c3t3_io_plugin PUBLIC scene_c3t3_item) qt6_wrap_ui(tetraUI_FILES Tetrahedra_filter_widget.ui) -polyhedron_demo_plugin(tetrahedra_filtering_plugin Tetrahedra_filtering_plugin ${tetraUI_FILES} KEYWORDS Mesh_3 Viewer) +cgal_lab_plugin(tetrahedra_filtering_plugin Tetrahedra_filtering_plugin ${tetraUI_FILES} KEYWORDS Mesh_3 Viewer) target_link_libraries(tetrahedra_filtering_plugin PUBLIC scene_c3t3_item scene_tetrahedra_item) qt6_wrap_ui(ribUI_FILES Rib_dialog.ui) -polyhedron_demo_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin +cgal_lab_plugin(c3t3_rib_exporter_plugin C3t3_rib_exporter_plugin ${ribUI_FILES} KEYWORDS Mesh_3) target_link_libraries(c3t3_rib_exporter_plugin PUBLIC scene_c3t3_item) @@ -121,7 +121,7 @@ if(TBB_FOUND) endif() qt6_wrap_ui(offsetMeshingUI_FILES Offset_meshing_dialog.ui) -polyhedron_demo_plugin(offset_meshing_plugin Offset_meshing_plugin +cgal_lab_plugin(offset_meshing_plugin Offset_meshing_plugin ${offsetMeshingUI_FILES}) target_link_libraries(offset_meshing_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Facet_extra_criterion.h b/Lab/demo/Lab/Plugins/Mesh_3/Facet_extra_criterion.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Facet_extra_criterion.h rename to Lab/demo/Lab/Plugins/Mesh_3/Facet_extra_criterion.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_3/Image_res_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Image_res_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Image_res_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp index 317e15e7dc7..4720d8aa35b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_image_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Io_image_plugin.cpp @@ -17,8 +17,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -48,7 +48,7 @@ #include #include #include "Raw_image_dialog.h" -#include +#include #ifdef CGAL_USE_VTK #include @@ -253,13 +253,13 @@ enum class Directory_extension_type class Io_image_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper, - public CGAL::Three::Polyhedron_demo_io_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_helper, + public CGAL::Three::CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90" FILE "io_image_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90" FILE "io_image_plugin.json") public: bool applicable(QAction*) const override @@ -267,7 +267,7 @@ public: return qobject_cast(scene->item(scene->mainSelectionIndex())); } - using Polyhedron_demo_io_plugin_interface::init; + using CGAL_Lab_io_plugin_interface::init; void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface *mi) override diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Io_implicit_function_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Io_implicit_function_plugin.cpp index 7f31055cf59..6f554a4e229 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Io_implicit_function_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Io_implicit_function_plugin.cpp @@ -16,8 +16,8 @@ //#include //#include -#include -#include +#include +#include #include "implicit_functions/Implicit_function_interface.h" #include "Scene_implicit_function_item.h" @@ -36,11 +36,11 @@ using namespace CGAL::Three; class Io_implicit_function_plugin : public QObject, - protected Polyhedron_demo_plugin_helper + protected CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: Io_implicit_function_plugin(); @@ -53,7 +53,7 @@ public: // bool canLoad() const { return false; } - typedef Polyhedron_demo_plugin_helper Plugin_helper; + typedef CGAL_Lab_plugin_helper Plugin_helper; using Plugin_helper::init; virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_3/Local_optimizers_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Local_optimizers_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Local_optimizers_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp index 5bba4d4c6e1..d84bd9fc6f6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin.cpp @@ -1,8 +1,8 @@ #include "config.h" #include "config_mesh_3.h" -#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER -#include +#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER +#include #include #include #include "Messages_interface.h" @@ -60,11 +60,11 @@ Q_DECLARE_METATYPE(Protection_flags) class Mesh_3_plugin : public QObject, - protected Polyhedron_demo_plugin_interface + protected CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "mesh_3_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "mesh_3_plugin.json") Q_PROPERTY(double angle READ get_angle WRITE set_angle) Q_PROPERTY(double sharp_edges_angle_bound @@ -1058,4 +1058,4 @@ treat_result(Scene_item& source_item, #include "Mesh_3_plugin.moc" -#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp index 2f24fe814d3..e46ecd6c4de 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.cpp @@ -528,6 +528,6 @@ Meshing_thread* cgal_code_mesh_3(const Image* pImage, #endif //CGAL_MESH_3_DEMO_ACTIVATE_SEGMENTED_IMAGES -//#include "Polyhedron_demo_mesh_3_plugin_cgal_code.moc" +//#include "CGAL_Lab_mesh_3_plugin_cgal_code.moc" //#include "Scene_c3t3_item.moc" //Check this one, it's strange moc include. diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h rename to Lab/demo/Lab/Plugins/Mesh_3/Mesh_3_plugin_cgal_code.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h rename to Lab/demo/Lab/Plugins/Mesh_3/Mesh_function.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_3/Meshing_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Meshing_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Meshing_thread.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Meshing_thread.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.h b/Lab/demo/Lab/Plugins/Mesh_3/Meshing_thread.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Meshing_thread.h rename to Lab/demo/Lab/Plugins/Mesh_3/Meshing_thread.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp index d4a5dc15ffb..a6bee4c8a12 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Offset_meshing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Offset_meshing_plugin.cpp @@ -1,8 +1,8 @@ #include "config.h" -#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER -#include +#include #include "ui_Offset_meshing_dialog.h" #include "C3t3_type.h" @@ -414,13 +414,13 @@ Q_SIGNALS: void resultReady(SMesh *offset_mesh); }; -class Polyhedron_demo_offset_meshing_plugin +class CGAL_Lab_offset_meshing_plugin : public QObject, - protected Polyhedron_demo_plugin_interface + protected CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: QAction* actionOffsetMeshing; @@ -500,10 +500,10 @@ public: public Q_SLOTS: void offset_meshing(); void inflate_mesh(); -}; // class Polyhedron_demo_offset_meshing_plugin +}; // class CGAL_Lab_offset_meshing_plugin void -Polyhedron_demo_offset_meshing_plugin:: +CGAL_Lab_offset_meshing_plugin:: offset_meshing() { Scene_item* item = nullptr; @@ -712,7 +712,7 @@ offset_meshing() } void -Polyhedron_demo_offset_meshing_plugin:: +CGAL_Lab_offset_meshing_plugin:: inflate_mesh() { const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -762,4 +762,4 @@ inflate_mesh() #include "Offset_meshing_plugin.moc" -#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Optimization_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Optimization_plugin.cpp index 6454a6f4cde..07df7563414 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Optimization_plugin.cpp @@ -6,9 +6,9 @@ #include "config.h" #include "config_mesh_3.h" -#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER -#include +#include #include #include "Messages_interface.h" @@ -75,13 +75,13 @@ QString translate(CGAL::Mesh_optimization_return_code rc); using namespace CGAL::Three; class Mesh_3_optimization_plugin : public QObject, - protected Polyhedron_demo_plugin_interface + protected CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "optimization_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "optimization_plugin.json") - typedef Polyhedron_demo_plugin_interface Base; + typedef CGAL_Lab_plugin_interface Base; public: Mesh_3_optimization_plugin(); virtual void init(QMainWindow*, Scene_interface*, Messages_interface*); @@ -644,4 +644,4 @@ translate(CGAL::Mesh_optimization_return_code rc) #include "Optimization_plugin.moc" -#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Optimization_plugin_cgal_code.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Optimizer_thread.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Optimizer_thread.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.h b/Lab/demo/Lab/Plugins/Mesh_3/Optimizer_thread.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Optimizer_thread.h rename to Lab/demo/Lab/Plugins/Mesh_3/Optimizer_thread.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Raw_image_dialog.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Raw_image_dialog.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h b/Lab/demo/Lab/Plugins/Mesh_3/Raw_image_dialog.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Raw_image_dialog.h rename to Lab/demo/Lab/Plugins/Mesh_3/Raw_image_dialog.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Rib_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_3/Rib_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Rib_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Rib_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui b/Lab/demo/Lab/Plugins/Mesh_3/Smoother_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Smoother_dialog.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Smoother_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Tetrahedra_filter_widget.ui b/Lab/demo/Lab/Plugins/Mesh_3/Tetrahedra_filter_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Tetrahedra_filter_widget.ui rename to Lab/demo/Lab/Plugins/Mesh_3/Tetrahedra_filter_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Tetrahedra_filtering_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Tetrahedra_filtering_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Tetrahedra_filtering_plugin.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Tetrahedra_filtering_plugin.cpp index 9c8d9877f59..a3cab77388c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Tetrahedra_filtering_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/Tetrahedra_filtering_plugin.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include @@ -33,11 +33,11 @@ public: class Q_DECL_EXPORT Tetrahedra_filtering_plugin: public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "tetrahedra_filtering_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "tetrahedra_filtering_plugin.json") public : void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*)override { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h b/Lab/demo/Lab/Plugins/Mesh_3/Volume_plane.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane.h rename to Lab/demo/Lab/Plugins/Mesh_3/Volume_plane.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h b/Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_interface.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_interface.h rename to Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_interface.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp b/Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_intersection.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_intersection.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h b/Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_intersection.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_intersection.h rename to Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_intersection.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h b/Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_thread.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Volume_plane_thread.h rename to Lab/demo/Lab/Plugins/Mesh_3/Volume_plane_thread.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h b/Lab/demo/Lab/Plugins/Mesh_3/config_mesh_3.h similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h rename to Lab/demo/Lab/Plugins/Mesh_3/config_mesh_3.h index 482e1f323fc..d03fd13cc57 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/config_mesh_3.h +++ b/Lab/demo/Lab/Plugins/Mesh_3/config_mesh_3.h @@ -13,9 +13,9 @@ //#define CGAL_PROFILE -// #define CGAL_POLYHEDRON_DEMO_NO_NEF -// #define CGAL_POLYHEDRON_DEMO_NO_SURFACE_MESHER -// #define CGAL_POLYHEDRON_DEMO_NO_PARAMETRIZATION +// #define CGAL_LAB_DEMO_NO_NEF +// #define CGAL_LAB_DEMO_NO_SURFACE_MESHER +// #define CGAL_LAB_DEMO_NO_PARAMETRIZATION //#define CGAL_MESH_3_VERBOSE //#define CGAL_MESH_3_PERTURBER_HIGH_VERBOSITY @@ -26,16 +26,16 @@ //#define SHOW_REMAINING_BAD_ELEMENT_IN_RED -#ifndef CGAL_POLYHEDRON_DEMO_NO_PARAMETRIZATION -# define CGAL_POLYHEDRON_DEMO_USE_PARAMETRIZATION +#ifndef CGAL_LAB_DEMO_NO_PARAMETRIZATION +# define CGAL_LAB_DEMO_USE_PARAMETRIZATION #endif -#ifndef CGAL_POLYHEDRON_DEMO_NO_NEF -# define CGAL_POLYHEDRON_DEMO_USE_NEF +#ifndef CGAL_LAB_DEMO_NO_NEF +# define CGAL_LAB_DEMO_USE_NEF #endif -#ifndef CGAL_POLYHEDRON_DEMO_NO_SURFACE_MESHER -# define CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#ifndef CGAL_LAB_DEMO_NO_SURFACE_MESHER +# define CGAL_LAB_DEMO_USE_SURFACE_MESHER #endif //#define CGAL_MESH_3_DEMO_BIGGER_HISTOGRAM_WITH_WHITE_BACKGROUNG diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/include/gsl/gsl_assert b/Lab/demo/Lab/Plugins/Mesh_3/include/gsl/gsl_assert similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/include/gsl/gsl_assert rename to Lab/demo/Lab/Plugins/Mesh_3/include/gsl/gsl_assert diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/include/gsl/pointers b/Lab/demo/Lab/Plugins/Mesh_3/include/gsl/pointers similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/include/gsl/pointers rename to Lab/demo/Lab/Plugins/Mesh_3/include/gsl/pointers diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/raw_image.ui b/Lab/demo/Lab/Plugins/Mesh_3/raw_image.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/raw_image.ui rename to Lab/demo/Lab/Plugins/Mesh_3/raw_image.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/split_polylines.cpp b/Lab/demo/Lab/Plugins/Mesh_3/split_polylines.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/split_polylines.cpp rename to Lab/demo/Lab/Plugins/Mesh_3/split_polylines.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/split_polylines.h b/Lab/demo/Lab/Plugins/Mesh_3/split_polylines.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Mesh_3/split_polylines.h rename to Lab/demo/Lab/Plugins/Mesh_3/split_polylines.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Animate_mesh_plugin.cpp b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Animate_mesh_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Animate_mesh_plugin.cpp rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Animate_mesh_plugin.cpp index fdbe540b33e..e5fc1a20a4c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Animate_mesh_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Animate_mesh_plugin.cpp @@ -11,7 +11,7 @@ #include "Scene_surface_mesh_item.h" #include #include -#include +#include #include #include "ui_Animate_widget.h" @@ -37,11 +37,11 @@ public: class Q_DECL_EXPORT Animate_mesh_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper + public CGAL::Three::CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public : void init(QMainWindow* mw, CGAL::Three::Scene_interface* scene_interface, @@ -78,8 +78,8 @@ public : connect(dock_widget->helpButton, &QPushButton::clicked,this, [this](){ QMessageBox::information(dock_widget, QString("Animation"), QString("The TRJS format contains information for a succession of modifications on a Surface Mesh. " - "Such a modification is called a frame, and every frame is composed with a ligne for the " - "number of points modified, and one ligne per modified point and its index.\n\n" + "Such a modification is called a frame, and every frame is composed with a line for the " + "number of points modified, and one line per modified point and its index.\n\n" "Example:\n\n" "n \n" "id1 x1 y1 z1 \n" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Animate_widget.ui b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Animate_widget.ui similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Animate_widget.ui rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Animate_widget.ui index 3afb30392b0..4127220e6ff 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Animate_widget.ui +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Animate_widget.ui @@ -45,7 +45,7 @@ - + :/cgal/icons/resources/help_button.png:/cgal/icons/resources/help_button.png @@ -144,7 +144,7 @@ - + :/cgal/icons/resources/play.jpeg:/cgal/icons/resources/play.jpeg @@ -161,7 +161,7 @@ - + :/cgal/icons/resources/pause.jpeg:/cgal/icons/resources/pause.jpeg @@ -178,7 +178,7 @@ - + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png @@ -195,7 +195,7 @@ - + :/cgal/icons/resources/right_arrow.png:/cgal/icons/resources/right_arrow.png @@ -212,7 +212,7 @@ - + :/cgal/icons/resources/reset.jpg:/cgal/icons/resources/reset.jpg @@ -223,8 +223,8 @@ - - + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/CMakeLists.txt similarity index 72% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/CMakeLists.txt index 8c27fa77cad..81fc877f16b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/CMakeLists.txt @@ -1,35 +1,35 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) qt6_wrap_ui(clip_polyhedronUI_FILES Clip_polyhedron_plugin.ui) -polyhedron_demo_plugin(clip_polyhedron_plugin Clip_polyhedron_plugin +cgal_lab_plugin(clip_polyhedron_plugin Clip_polyhedron_plugin ${clip_polyhedronUI_FILES}) target_link_libraries( clip_polyhedron_plugin PUBLIC scene_surface_mesh_item scene_basic_objects scene_movable_sm_item) -polyhedron_demo_plugin(point_set_from_vertices_plugin +cgal_lab_plugin(point_set_from_vertices_plugin Point_set_from_vertices_plugin) target_link_libraries( point_set_from_vertices_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_points_with_normal_item) -polyhedron_demo_plugin(point_set_from_sampling_plugin +cgal_lab_plugin(point_set_from_sampling_plugin Point_set_from_sampling_plugin) target_link_libraries( point_set_from_sampling_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_points_with_normal_item) -polyhedron_demo_plugin(diff_between_meshes_plugin Diff_between_meshes_plugin) +cgal_lab_plugin(diff_between_meshes_plugin Diff_between_meshes_plugin) target_link_libraries(diff_between_meshes_plugin PUBLIC scene_surface_mesh_item) qt6_wrap_ui( animateUI_FILES Animate_widget.ui ) - polyhedron_demo_plugin(animate_mesh_plugin Animate_mesh_plugin ${animateUI_FILES}) + cgal_lab_plugin(animate_mesh_plugin Animate_mesh_plugin ${animateUI_FILES}) target_link_libraries(animate_mesh_plugin PUBLIC scene_surface_mesh_item) if( TARGET CGAL::METIS_support ) qt6_wrap_ui( partitionUI_FILES PartitionDialog.ui ) - polyhedron_demo_plugin(partition_plugin Partition_graph_plugin ${partitionUI_FILES}) + cgal_lab_plugin(partition_plugin Partition_graph_plugin ${partitionUI_FILES}) target_link_libraries(partition_plugin PUBLIC scene_surface_mesh_item CGAL::METIS_support ) else() message(STATUS "NOTICE: the Partition plugin needs METIS libraries and will not be compiled.") diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp index a78cd1150ba..b26e60c5d82 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include "Plugins/AABB_tree/Scene_movable_sm_item.h" @@ -77,13 +77,13 @@ public: }; //end of class Scene_triangle_item -class Q_DECL_EXPORT Clip_polyhedron_plugin : +class Q_DECL_EXPORT Clip_cgal_lab_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public : // Adds an action to the menu and configures the widget void init(QMainWindow* mw, @@ -127,10 +127,10 @@ public : connect(actionClipPolyhedra , SIGNAL(triggered()), this, SLOT(pop_widget())); connect(ui_widget.clipButton, &QPushButton::clicked, - this, &Clip_polyhedron_plugin::clip); + this, &Clip_cgal_lab_plugin::clip); connect(actionStartClippingWithPoly, &QAction::triggered, - this, &Clip_polyhedron_plugin::start_clipping_with_poly); + this, &Clip_cgal_lab_plugin::start_clipping_with_poly); connect(ui_widget.helpButton, &QPushButton::clicked, [this](){ diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui index 02fee88c1bd..c69a0ac29f1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.ui @@ -48,7 +48,7 @@ - + :/cgal/icons/resources/help_button.png:/cgal/icons/resources/help_button.png @@ -187,8 +187,8 @@ Only available in Split mode. - - + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp similarity index 88% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp index 8b0c4afe385..907cd7fa16e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp @@ -10,20 +10,20 @@ #include #include -#include +#include #include #include #include #include "Messages_interface.h" using namespace CGAL::Three; -class Polyhedron_demo_diff_between_meshes_plugin : +class CGAL_Lab_diff_between_meshes_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, @@ -51,9 +51,9 @@ private: CGAL::Three::Scene_interface* scene; QAction* actionDiff; -}; // end Polyhedron_demo_diff_between_meshes_plugin +}; // end CGAL_Lab_diff_between_meshes_plugin -void Polyhedron_demo_diff_between_meshes_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_diff_between_meshes_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { @@ -64,12 +64,12 @@ void Polyhedron_demo_diff_between_meshes_plugin::init(QMainWindow* mainWindow, this, SLOT(diff())); } -QList Polyhedron_demo_diff_between_meshes_plugin::actions() const { +QList CGAL_Lab_diff_between_meshes_plugin::actions() const { return QList() << actionDiff; } -void Polyhedron_demo_diff_between_meshes_plugin::diff() +void CGAL_Lab_diff_between_meshes_plugin::diff() { typedef CGAL::Face_filtered_graph Filtered_graph; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/PartitionDialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/PartitionDialog.ui rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/PartitionDialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Partition_graph_plugin.cpp b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Partition_graph_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Partition_graph_plugin.cpp rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Partition_graph_plugin.cpp index cf7439cb97f..c81f01c31db 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Partition_graph_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Partition_graph_plugin.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "ui_PartitionDialog.h" #include "Color_map.h" @@ -35,11 +35,11 @@ public: using namespace CGAL::Three; class Partition_graph_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: @@ -137,6 +137,6 @@ private: } -}; // end class Polyhedron_demo_affine_transform_plugin +}; // end class CGAL_Lab_affine_transform_plugin #include "Partition_graph_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_sampling_plugin.cpp b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Point_set_from_sampling_plugin.cpp similarity index 88% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_sampling_plugin.cpp rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Point_set_from_sampling_plugin.cpp index aa6ea4c1ba0..9419cba29a0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_sampling_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Point_set_from_sampling_plugin.cpp @@ -12,20 +12,20 @@ #include "Scene_surface_mesh_item.h" #include "Scene_polygon_soup_item.h" -#include +#include #include "Messages_interface.h" #include #include using namespace CGAL::Three; -class Polyhedron_demo_point_set_from_sampling_plugin : +class CGAL_Lab_point_set_from_sampling_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, @@ -48,9 +48,9 @@ private: QAction* actionPointSetFromSampling; -}; // end Polyhedron_demo_point_set_from_sampling_plugin +}; // end CGAL_Lab_point_set_from_sampling_plugin -void Polyhedron_demo_point_set_from_sampling_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_point_set_from_sampling_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { @@ -61,13 +61,13 @@ void Polyhedron_demo_point_set_from_sampling_plugin::init(QMainWindow* mainWindo this, SLOT(createPointSet())); } -QList Polyhedron_demo_point_set_from_sampling_plugin::actions() const { +QList CGAL_Lab_point_set_from_sampling_plugin::actions() const { return QList() << actionPointSetFromSampling; } -void Polyhedron_demo_point_set_from_sampling_plugin::createPointSet() +void CGAL_Lab_point_set_from_sampling_plugin::createPointSet() { QApplication::setOverrideCursor(Qt::WaitCursor); const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp similarity index 80% rename from Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp rename to Lab/demo/Lab/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp index c57ec6e38f9..19ee1e3bccf 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Operations_on_polyhedra/Point_set_from_vertices_plugin.cpp @@ -9,17 +9,17 @@ #include "Scene_surface_mesh_item.h" #include "Scene_polygon_soup_item.h" -#include +#include #include "Messages_interface.h" using namespace CGAL::Three; -class Polyhedron_demo_point_set_from_vertices_plugin : +class CGAL_Lab_point_set_from_vertices_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, @@ -43,9 +43,9 @@ private: template void apply(Item *item); -}; // end Polyhedron_demo_point_set_from_vertices_plugin +}; // end CGAL_Lab_point_set_from_vertices_plugin -void Polyhedron_demo_point_set_from_vertices_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_point_set_from_vertices_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { @@ -56,12 +56,12 @@ void Polyhedron_demo_point_set_from_vertices_plugin::init(QMainWindow* mainWindo this, SLOT(createPointSet())); } -QList Polyhedron_demo_point_set_from_vertices_plugin::actions() const { +QList CGAL_Lab_point_set_from_vertices_plugin::actions() const { return QList() << actionPointSetFromPolyhedronVertices; } template -void Polyhedron_demo_point_set_from_vertices_plugin::apply(Item *item) +void CGAL_Lab_point_set_from_vertices_plugin::apply(Item *item) { Scene_points_with_normal_item* points = new Scene_points_with_normal_item(*item->polyhedron()); @@ -73,7 +73,7 @@ void Polyhedron_demo_point_set_from_vertices_plugin::apply(Item *item) scene->addItem (points); } } -void Polyhedron_demo_point_set_from_vertices_plugin::createPointSet() +void CGAL_Lab_point_set_from_vertices_plugin::createPointSet() { QApplication::setOverrideCursor(Qt::WaitCursor); const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp index d651bdcd61b..0edc6f05f18 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp @@ -9,7 +9,7 @@ #include "Scene_polygon_soup_item.h" #include "Scene_surface_mesh_item.h" -#include +#include #include #include #include @@ -49,13 +49,13 @@ public: } }; -class Polyhedron_demo_affine_transform_plugin +class CGAL_Lab_affine_transform_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") enum class Item_type { UNKNOWN, POINT_SET, POLYGON_SOUP, POLYGON_MESH }; using Generic_scene_aff_transformed_item = Scene_aff_transformed_item; // just for clarity @@ -137,17 +137,17 @@ public: ui.lineEditA->hide(); connect(ui.applyTransfo_Button, &QPushButton::clicked, - this, &Polyhedron_demo_affine_transform_plugin::applySingleTransformation); + this, &CGAL_Lab_affine_transform_plugin::applySingleTransformation); connect(ui.transfo_ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSingleTransfoValues(int))); connect(ui.resetMatrix_Button, &QPushButton::clicked, - this, &Polyhedron_demo_affine_transform_plugin::resetTransformMatrix); + this, &CGAL_Lab_affine_transform_plugin::resetTransformMatrix); connect(ui.clearButton, &QPushButton::clicked, - this, &Polyhedron_demo_affine_transform_plugin::clear); + this, &CGAL_Lab_affine_transform_plugin::clear); connect(ui.undoButton, &QPushButton::clicked, - this, &Polyhedron_demo_affine_transform_plugin::undo); + this, &CGAL_Lab_affine_transform_plugin::undo); connect(ui.validatePushButton, &QPushButton::clicked, - this, &Polyhedron_demo_affine_transform_plugin::end); + this, &CGAL_Lab_affine_transform_plugin::end); std::fill(std::begin(scaling), std::end(scaling), 1.); std::fill(std::begin(lastScaling), std::end(lastScaling), 1.); @@ -223,7 +223,7 @@ public Q_SLOTS: }; void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: transformMatrix(double* res) const { QMatrix4x4 manipulatedMatrix, scalingMatrix; @@ -244,7 +244,7 @@ transformMatrix(double* res) const } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: updateUiMatrix() { if(!started()) @@ -291,7 +291,7 @@ updateUiMatrix() } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: resetTransformMatrix() { if(!started()) @@ -315,7 +315,7 @@ resetTransformMatrix() } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: updateSingleTransfoValues(int index) { ui.lineEditZ->setToolTip("Value along the z-axis."); @@ -353,7 +353,7 @@ updateSingleTransfoValues(int index) } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: applySingleTransformation() { if(!started()) @@ -418,7 +418,7 @@ applySingleTransformation() } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: normalize() { // Get the scale factor for the item's coordinates to be in [0..1] @@ -442,7 +442,7 @@ normalize() } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: generateItemGrid() { Scene_surface_mesh_item* item = qobject_cast(scene->item(scene->mainSelectionIndex())); @@ -522,7 +522,7 @@ generateItemGrid() template void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: start(SceneItem* item) { CGAL_precondition(item && !aff_transformed_item); @@ -551,7 +551,7 @@ start(SceneItem* item) aff_transformed_item->setName(tr("Affine Transformation")); connect(aff_transformed_item->manipulatedFrame(), &CGAL::qglviewer::ManipulatedFrame::modified, - this, &Polyhedron_demo_affine_transform_plugin::updateUiMatrix); + this, &CGAL_Lab_affine_transform_plugin::updateUiMatrix); connect(aff_transformed_item, SIGNAL(applyTransformation()), this, SLOT(transformItem())); @@ -559,13 +559,13 @@ start(SceneItem* item) connect(aff_transformed_item, &SceneTransformedItem::aboutToBeDestroyed, dockWidget, &QDockWidget::hide); connect(aff_transformed_item, &SceneTransformedItem::aboutToBeDestroyed, - this, &Polyhedron_demo_affine_transform_plugin::resetTransformedItem); + this, &CGAL_Lab_affine_transform_plugin::resetTransformedItem); connect(aff_transformed_item, &SceneTransformedItem::aboutToBeDestroyed, [](){ QApplication::restoreOverrideCursor(); }); // delete this transformed item if the item it was created for is deleted connect(item, &SceneItem::aboutToBeDestroyed, - this, &Polyhedron_demo_affine_transform_plugin::killTransformedItem); + this, &CGAL_Lab_affine_transform_plugin::killTransformedItem); Scene_interface::Item_id transformed_item_index = scene->addItem(aff_transformed_item); scene->setSelectedItem(transformed_item_index); @@ -574,7 +574,7 @@ start(SceneItem* item) } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: transformItem() { if(started()) @@ -606,7 +606,7 @@ transformItem() } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: endPointSet(const QMatrix4x4& transform_matrix) { Scene_aff_transformed_point_set_item* aff_transformed_pts_item = static_cast(aff_transformed_item); @@ -639,7 +639,7 @@ endPointSet(const QMatrix4x4& transform_matrix) } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: endPolygonSoup(const QMatrix4x4& transform_matrix) { Scene_aff_transformed_polygon_soup_item* aff_transformed_ps_item = static_cast(aff_transformed_item); @@ -668,7 +668,7 @@ endPolygonSoup(const QMatrix4x4& transform_matrix) } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: endPolygonMesh(const QMatrix4x4& transform_matrix) { Scene_aff_transformed_surface_mesh_item* aff_transformed_sm_item = static_cast(aff_transformed_item); @@ -695,7 +695,7 @@ endPolygonMesh(const QMatrix4x4& transform_matrix) } void -Polyhedron_demo_affine_transform_plugin:: +CGAL_Lab_affine_transform_plugin:: end() { ui.validatePushButton->setEnabled(false); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp index 51355a07b5f..3c4af7ce421 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -17,7 +18,7 @@ #include #include -#include +#include #include #include "Scene_surface_mesh_item.h" @@ -57,11 +58,11 @@ namespace params = CGAL::parameters; class Q_DECL_EXPORT Basic_generator_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "basic_generator_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "basic_generator_plugin.json") public : void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, @@ -253,9 +254,9 @@ void Basic_generator_plugin::on_tab_changed() nb = nbs[PRISM]; QPixmap pic; if(dock_widget->prismCheckBox->isChecked()) - pic = QPixmap(":/cgal/Polyhedron_3/resources/prism.png"); + pic = QPixmap(":/cgal/Lab/resources/prism.png"); else - pic = QPixmap(":/cgal/Polyhedron_3/resources/prism-open.png"); + pic = QPixmap(":/cgal/Lab/resources/prism-open.png"); dock_widget->prism_picLabel->setPixmap(pic); dock_widget->prism_picLabel->show(); } @@ -271,9 +272,9 @@ void Basic_generator_plugin::on_tab_changed() nb = nbs[PYRAMID]; QPixmap pic; if(dock_widget->pyramidCheckBox->isChecked()) - pic = QPixmap(":/cgal/Polyhedron_3/resources/pyramid.png"); + pic = QPixmap(":/cgal/Lab/resources/pyramid.png"); else - pic = QPixmap(":/cgal/Polyhedron_3/resources/pyramid-open.png"); + pic = QPixmap(":/cgal/Lab/resources/pyramid-open.png"); dock_widget->pyramid_picLabel->setPixmap(pic); dock_widget->pyramid_picLabel->show(); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui b/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui rename to Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui index 03641b57a94..9593a39e381 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_widget.ui +++ b/Lab/demo/Lab/Plugins/PCA/Basic_generator_widget.ui @@ -31,7 +31,7 @@ - :/cgal/Polyhedron_3/resources/prism.png + :/cgal/Lab/resources/prism.png false @@ -223,7 +223,7 @@ QGroupBox::title { - :/cgal/Polyhedron_3/resources/icosphere.png + :/cgal/Lab/resources/icosphere.png @@ -540,7 +540,7 @@ QGroupBox::title { - :/cgal/Polyhedron_3/resources/hexahedron.png + :/cgal/Lab/resources/hexahedron.png false @@ -750,7 +750,7 @@ QGroupBox::title { - :/cgal/Polyhedron_3/resources/tetrahedron.png + :/cgal/Lab/resources/tetrahedron.png @@ -910,7 +910,7 @@ li.checked::marker { content: "\2612"; } - :/cgal/Polyhedron_3/resources/grid.png + :/cgal/Lab/resources/grid.png @@ -1219,8 +1219,8 @@ li.checked::marker { content: "\2612"; } - - + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/Lab/demo/Lab/Plugins/PCA/CMakeLists.txt similarity index 81% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt rename to Lab/demo/Lab/Plugins/PCA/CMakeLists.txt index 5e73bc65730..cb8939c8ada 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/PCA/CMakeLists.txt @@ -1,12 +1,12 @@ -include(polyhedron_demo_macros) -polyhedron_demo_plugin(pca_plugin Pca_plugin KEYWORDS PointSetProcessing) +include(cgallab_macros) +cgal_lab_plugin(pca_plugin Pca_plugin KEYWORDS PointSetProcessing) target_link_libraries( pca_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_basic_objects) qt6_wrap_ui(transformUI_FILES Transformation_widget.ui MeshOnGrid_dialog.ui) -polyhedron_demo_plugin(affine_transform_plugin Affine_transform_plugin +cgal_lab_plugin(affine_transform_plugin Affine_transform_plugin ${transformUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries(affine_transform_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item @@ -15,26 +15,26 @@ target_link_libraries(affine_transform_plugin PUBLIC scene_surface_mesh_item scene_aff_transformed_polygon_soup_item scene_aff_transformed_surface_mesh_item) -polyhedron_demo_plugin(edit_box_plugin Edit_box_plugin) +cgal_lab_plugin(edit_box_plugin Edit_box_plugin) target_link_libraries(edit_box_plugin PUBLIC scene_edit_box_item scene_surface_mesh_item) qt6_wrap_ui(clipUI_FILES Clipping_box_widget.ui) -polyhedron_demo_plugin(clipping_box_plugin Clipping_box_plugin ${clipUI_FILES}) +cgal_lab_plugin(clipping_box_plugin Clipping_box_plugin ${clipUI_FILES}) target_link_libraries(clipping_box_plugin PUBLIC scene_edit_box_item scene_basic_objects) -polyhedron_demo_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin) +cgal_lab_plugin(create_bbox_mesh_plugin Create_bbox_mesh_plugin) target_link_libraries(create_bbox_mesh_plugin PUBLIC scene_surface_mesh_item) -polyhedron_demo_plugin(create_obb_mesh_plugin Create_obb_mesh_plugin) +cgal_lab_plugin(create_obb_mesh_plugin Create_obb_mesh_plugin) target_link_libraries(create_obb_mesh_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item scene_selection_item scene_points_with_normal_item) qt6_wrap_ui(volumesUI_FILES Basic_generator_widget.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( basic_generator_plugin Basic_generator_plugin ${volumesUI_FILES} KEYWORDS PolygonMesh PointSetProcessing) target_link_libraries( diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Clipping_box_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Clipping_box_plugin.cpp index aa32c500594..38f753b9e3e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Clipping_box_plugin.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include @@ -15,6 +15,7 @@ #include #include #include +#include #include "Selection_visualizer.h" #include "Scene_plane_item.h" @@ -33,11 +34,11 @@ public: using namespace CGAL::Three; class Clipping_box_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_widget.ui b/Lab/demo/Lab/Plugins/PCA/Clipping_box_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Clipping_box_widget.ui rename to Lab/demo/Lab/Plugins/PCA/Clipping_box_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Create_bbox_mesh_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Create_bbox_mesh_plugin.cpp index ee591ddc04a..cdeb6b6377f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_bbox_mesh_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Create_bbox_mesh_plugin.cpp @@ -3,23 +3,25 @@ #include #include +#include + #include #include #include #include #include "Scene_surface_mesh_item.h" -#include +#include using namespace CGAL::Three; class Create_bbox_mesh_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*); @@ -164,7 +166,7 @@ bbox(bool extended) Scene_item* item; EPICK::Iso_cuboid_3 ic(bbox); SMesh* p = new SMesh; - CGAL::make_hexahedron(ic[0], ic[1], ic[2], ic[3], ic[4], ic[5], ic[6], ic[7], *p); + CGAL::make_hexahedron(ic, *p); item = new Scene_surface_mesh_item(p); item->setName(name + (extended ? " (Extended Bbox)" : " (Bbox)")); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Create_obb_mesh_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Create_obb_mesh_plugin.cpp index cae392b0c94..6b2a7349cc6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Create_obb_mesh_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Create_obb_mesh_plugin.cpp @@ -13,7 +13,7 @@ #include "Scene_polyhedron_selection_item.h" #include "Scene_points_with_normal_item.h" -#include +#include #include @@ -23,11 +23,11 @@ typedef Scene_surface_mesh_item Scene_facegraph_item; class Create_obb_mesh_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Edit_box_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Edit_box_plugin.cpp index 77569a7b810..38aafd82023 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Edit_box_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Edit_box_plugin.cpp @@ -7,21 +7,22 @@ #include #include #include +#include #include #include #include -#include +#include #include using namespace CGAL::Three; class Edit_box_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/MeshOnGrid_dialog.ui b/Lab/demo/Lab/Plugins/PCA/MeshOnGrid_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/MeshOnGrid_dialog.ui rename to Lab/demo/Lab/Plugins/PCA/MeshOnGrid_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Pca_plugin.cpp similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp rename to Lab/demo/Lab/Plugins/PCA/Pca_plugin.cpp index 2fcecd22abd..86e7ec404bd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Pca_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Pca_plugin.cpp @@ -5,12 +5,13 @@ #include "Scene_points_with_normal_item.h" #include "Scene_plane_item.h" -#include +#include #include #include #include #include +#include #include "Kernel_type.h" #include @@ -42,13 +43,13 @@ CGAL::Bbox_3 triangles(const TriangleMesh& mesh, using namespace CGAL::Three; -class Polyhedron_demo_pca_plugin : +class CGAL_Lab_pca_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: @@ -91,9 +92,9 @@ public Q_SLOTS: private: Scene_interface* scene; QList _actions; -}; // end Polyhedron_demo_pca_plugin +}; // end CGAL_Lab_pca_plugin -void Polyhedron_demo_pca_plugin::on_actionFitPlane_triggered() +void CGAL_Lab_pca_plugin::on_actionFitPlane_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -160,7 +161,7 @@ void Polyhedron_demo_pca_plugin::on_actionFitPlane_triggered() } } -void Polyhedron_demo_pca_plugin::on_actionFitLine_triggered() +void CGAL_Lab_pca_plugin::on_actionFitLine_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.cpp b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.cpp rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.h b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_item.h rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_item.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_point_set_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.h b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_point_set_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_point_set_item.h rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_point_set_item.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_polygon_soup_item.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h b/Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h rename to Lab/demo/Lab/Plugins/PCA/Scene_aff_transformed_surface_mesh_item.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp b/Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.cpp rename to Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.h b/Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item.h similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.h rename to Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item.h index 0d99b9ce08e..9b00d3bda81 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item.h +++ b/Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item.h @@ -13,7 +13,7 @@ class SCENE_EDIT_BOX_ITEM_EXPORT Scene_edit_box_item: { Q_OBJECT Q_INTERFACES(CGAL::Three::Scene_transparent_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.TransparentInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.TransparentInterface/1.0") public: typedef CGAL::Simple_cartesian Kernel; struct vertex; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item_config.h b/Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Scene_edit_box_item_config.h rename to Lab/demo/Lab/Plugins/PCA/Scene_edit_box_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Transformation_widget.ui b/Lab/demo/Lab/Plugins/PCA/Transformation_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PCA/Transformation_widget.ui rename to Lab/demo/Lab/Plugins/PCA/Transformation_widget.ui diff --git a/Lab/demo/Lab/Plugins/PMP/AddBboxDialog.ui b/Lab/demo/Lab/Plugins/PMP/AddBboxDialog.ui new file mode 100644 index 00000000000..1de3d65e9eb --- /dev/null +++ b/Lab/demo/Lab/Plugins/PMP/AddBboxDialog.ui @@ -0,0 +1,105 @@ + + + AddBboxDialog + + + + 0 + 0 + 413 + 108 + + + + Dialog + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Triangulate bbox + + + + + + + + + Scaling : + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + DoubleEdit + QLineEdit +
CGAL_double_edit.h
+
+
+ + + buttonBox + accepted() + AddBboxDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AddBboxDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Lab/demo/Lab/Plugins/PMP/CMakeLists.txt similarity index 76% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt rename to Lab/demo/Lab/Plugins/PMP/CMakeLists.txt index 232e6f364d6..d068b0a5c81 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/PMP/CMakeLists.txt @@ -1,7 +1,7 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) if(TARGET CGAL::Eigen3_support) - polyhedron_demo_plugin(jet_fitting_plugin Jet_fitting_plugin) + cgal_lab_plugin(jet_fitting_plugin Jet_fitting_plugin) target_link_libraries( jet_fitting_plugin PUBLIC scene_surface_mesh_item scene_polylines_item CGAL::Eigen3_support) @@ -11,7 +11,7 @@ endif() if(TARGET CGAL::Eigen3_support) - polyhedron_demo_plugin(interpolated_corrected_principal_curvatures_plugin Interpolated_corrected_principal_curvatures_plugin) + cgal_lab_plugin(interpolated_corrected_principal_curvatures_plugin Interpolated_corrected_principal_curvatures_plugin) target_link_libraries( interpolated_corrected_principal_curvatures_plugin PUBLIC scene_surface_mesh_item scene_polylines_item CGAL::Eigen3_support) @@ -23,22 +23,22 @@ else() ) endif() -polyhedron_demo_plugin(extrude_plugin Extrude_plugin KEYWORDS PMP) +cgal_lab_plugin(extrude_plugin Extrude_plugin KEYWORDS PMP) target_link_libraries(extrude_plugin PUBLIC scene_surface_mesh_item scene_selection_item) if(TARGET CGAL::Eigen3_support) if("${EIGEN3_VERSION}" VERSION_GREATER "3.1.90") qt6_wrap_ui( hole_fillingUI_FILES Hole_filling_widget.ui) - polyhedron_demo_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES} KEYWORDS PMP) + cgal_lab_plugin(hole_filling_plugin Hole_filling_plugin ${hole_fillingUI_FILES} KEYWORDS PMP) target_link_libraries(hole_filling_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_selection_item CGAL::Eigen3_support) qt6_wrap_ui( fairingUI_FILES Fairing_widget.ui) - polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES} KEYWORDS PMP) + cgal_lab_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES} KEYWORDS PMP) target_link_libraries(fairing_plugin PUBLIC scene_selection_item CGAL::Eigen3_support) qt6_wrap_ui( Mean_curvature_flow_skeleton_pluginUI_FILES Mean_curvature_flow_skeleton_plugin.ui) - polyhedron_demo_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES}) + cgal_lab_plugin(mean_curvature_flow_skeleton_plugin Mean_curvature_flow_skeleton_plugin ${Mean_curvature_flow_skeleton_pluginUI_FILES}) target_link_libraries(mean_curvature_flow_skeleton_plugin PUBLIC scene_surface_mesh_item @@ -49,7 +49,7 @@ if(TARGET CGAL::Eigen3_support) CGAL::Eigen3_support) # The smoothing plugin can still do some things, even if Ceres is not found qt6_wrap_ui( smoothingUI_FILES Smoothing_plugin.ui Smoothing_tangential_relaxation.ui) - polyhedron_demo_plugin(smoothing_plugin Smoothing_plugin ${smoothingUI_FILES}) + cgal_lab_plugin(smoothing_plugin Smoothing_plugin ${smoothingUI_FILES}) target_link_libraries(smoothing_plugin PUBLIC scene_surface_mesh_item scene_selection_item CGAL::Eigen3_support) find_package(Ceres QUIET) include(CGAL_Ceres_support) @@ -64,7 +64,7 @@ if(TARGET CGAL::Eigen3_support) target_link_libraries(extrude_plugin PUBLIC CGAL::Eigen3_support) qt6_wrap_ui(remeshPlanarPatchesUI_FILES Remesh_planar_patches_dialog.ui) - polyhedron_demo_plugin(remesh_planar_patches_plugin Remesh_planar_patches_plugin + cgal_lab_plugin(remesh_planar_patches_plugin Remesh_planar_patches_plugin ${remeshPlanarPatchesUI_FILES} KEYWORDS PMP) target_link_libraries(remesh_planar_patches_plugin PUBLIC scene_surface_mesh_item CGAL::Eigen3_support) @@ -86,62 +86,61 @@ else() endif() qt6_wrap_ui(soupUI_FILES Repair_soup.ui) -polyhedron_demo_plugin(orient_soup_plugin Orient_soup_plugin ${soupUI_FILES} +cgal_lab_plugin(orient_soup_plugin Orient_soup_plugin ${soupUI_FILES} KEYWORDS Classification PMP) target_link_libraries( orient_soup_plugin PUBLIC scene_polygon_soup_item scene_surface_mesh_item scene_polylines_item scene_points_with_normal_item) -polyhedron_demo_plugin(inside_out_plugin Inside_out_plugin KEYWORDS PMP) +cgal_lab_plugin(inside_out_plugin Inside_out_plugin KEYWORDS PMP) target_link_libraries(inside_out_plugin PUBLIC scene_surface_mesh_item scene_polygon_soup_item) -polyhedron_demo_plugin(join_and_split_plugin Join_and_split_polyhedra_plugin KEYWORDS PMP) +cgal_lab_plugin(join_and_split_plugin Join_and_split_polyhedra_plugin KEYWORDS PMP) target_link_libraries(join_and_split_plugin PUBLIC scene_surface_mesh_item scene_selection_item) qt6_wrap_ui( point_inside_polyhedronUI_FILES Point_inside_polyhedron_widget.ui) -polyhedron_demo_plugin(point_inside_polyhedron_plugin Point_inside_polyhedron_plugin ${point_inside_polyhedronUI_FILES}) +cgal_lab_plugin(point_inside_polyhedron_plugin Point_inside_polyhedron_plugin ${point_inside_polyhedronUI_FILES}) target_link_libraries(point_inside_polyhedron_plugin PUBLIC scene_surface_mesh_item scene_points_with_normal_item) qt6_wrap_ui( polyhedron_slicerUI_FILES Polyhedron_slicer_widget.ui) -polyhedron_demo_plugin(polyhedron_slicer_plugin Polyhedron_slicer_plugin ${polyhedron_slicerUI_FILES}) +cgal_lab_plugin(polyhedron_slicer_plugin Polyhedron_slicer_plugin ${polyhedron_slicerUI_FILES}) target_link_libraries(polyhedron_slicer_plugin PUBLIC scene_surface_mesh_item scene_basic_objects scene_polylines_item) -polyhedron_demo_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin KEYWORDS PMP) +cgal_lab_plugin(polyhedron_stitching_plugin Polyhedron_stitching_plugin KEYWORDS PMP) target_link_libraries(polyhedron_stitching_plugin PUBLIC scene_surface_mesh_item scene_polylines_item) qt6_wrap_ui( selectionUI_FILES Selection_widget.ui) -polyhedron_demo_plugin(selection_plugin Selection_plugin ${selectionUI_FILES} KEYWORDS PMP Viewer Classification Mesh_3) +cgal_lab_plugin(selection_plugin Selection_plugin ${selectionUI_FILES} KEYWORDS PMP Viewer Classification Mesh_3) target_link_libraries(selection_plugin PUBLIC scene_selection_item scene_points_with_normal_item scene_polylines_item) #to keep it simple to compile add_custom_target(self_intersection_plugin) add_dependencies(self_intersection_plugin selection_plugin) -polyhedron_demo_plugin(triangulate_facets_plugin Triangulate_facets_plugin KEYWORDS PMP) +cgal_lab_plugin(triangulate_facets_plugin Triangulate_facets_plugin KEYWORDS PMP) target_link_libraries(triangulate_facets_plugin PUBLIC scene_surface_mesh_item scene_selection_item scene_polygon_soup_item) -polyhedron_demo_plugin(corefinement_plugin Corefinement_plugin KEYWORDS PMP) +cgal_lab_plugin(corefinement_plugin Corefinement_plugin KEYWORDS PMP) target_link_libraries(corefinement_plugin PUBLIC scene_surface_mesh_item) -polyhedron_demo_plugin(surface_intersection_plugin Surface_intersection_plugin +cgal_lab_plugin(surface_intersection_plugin Surface_intersection_plugin KEYWORDS PMP) target_link_libraries( surface_intersection_plugin PUBLIC scene_surface_mesh_item scene_polylines_item scene_points_with_normal_item) -qt6_wrap_ui( repairUI_FILES RemoveNeedlesDialog.ui SelfSnapDialog.ui) -polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin ${repairUI_FILES} KEYWORDS PMP) +qt6_wrap_ui( repairUI_FILES RemoveNeedlesDialog.ui SelfSnapDialog.ui AddBboxDialog.ui) +cgal_lab_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin ${repairUI_FILES} KEYWORDS PMP) target_link_libraries(repair_polyhedron_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item scene_polygon_soup_item) if(TARGET CGAL::TBB_support) target_link_libraries(repair_polyhedron_plugin PUBLIC CGAL::TBB_support) endif() - if(TARGET CGAL::Eigen3_support) qt6_wrap_ui(isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui) - polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin + cgal_lab_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES} KEYWORDS PMP) target_link_libraries(isotropic_remeshing_plugin PUBLIC scene_surface_mesh_item scene_selection_item CGAL::Eigen3_support) @@ -154,29 +153,29 @@ else() message(STATUS "NOTICE: Eigen 3.1 (or greater) was not found. Isotropic remeshing plugin will not be available.") endif() -polyhedron_demo_plugin(distance_plugin Distance_plugin KEYWORDS PMP) +cgal_lab_plugin(distance_plugin Distance_plugin KEYWORDS PMP) target_link_libraries(distance_plugin PUBLIC scene_surface_mesh_item scene_color_ramp) if(TARGET CGAL::TBB_support) target_link_libraries(distance_plugin PUBLIC CGAL::TBB_support) endif() -polyhedron_demo_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin KEYWORDS Viewer Mesh_3 PMP) +cgal_lab_plugin(detect_sharp_edges_plugin Detect_sharp_edges_plugin KEYWORDS Viewer Mesh_3 PMP) target_link_libraries(detect_sharp_edges_plugin PUBLIC scene_surface_mesh_item) qt6_wrap_ui(randomPerturbationUI_FILES Random_perturbation_dialog.ui) -polyhedron_demo_plugin(random_perturbation_plugin Random_perturbation_plugin +cgal_lab_plugin(random_perturbation_plugin Random_perturbation_plugin ${randomPerturbationUI_FILES} KEYWORDS PMP) target_link_libraries(random_perturbation_plugin PUBLIC scene_surface_mesh_item scene_selection_item) -polyhedron_demo_plugin(degenerated_faces_plugin Degenerated_faces_plugin +cgal_lab_plugin(degenerated_faces_plugin Degenerated_faces_plugin KEYWORDS PMP) target_link_libraries(degenerated_faces_plugin PUBLIC scene_surface_mesh_item scene_selection_item) qt6_wrap_ui(engravUI_FILES Engrave_dock_widget.ui) -polyhedron_demo_plugin(engrave_text_plugin Engrave_text_plugin +cgal_lab_plugin(engrave_text_plugin Engrave_text_plugin ${engravUI_FILES}) target_link_libraries( engrave_text_plugin PUBLIC scene_surface_mesh_item scene_selection_item diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Corefinement_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Corefinement_plugin.cpp index 96636a12d51..fd4d90b94fa 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Corefinement_plugin.cpp @@ -2,7 +2,7 @@ #include #include #include "Messages_interface.h" -#include +#include #include #include "Scene_surface_mesh_item.h" @@ -13,13 +13,13 @@ using namespace CGAL::Three; namespace PMP = CGAL::Polygon_mesh_processing; namespace params = CGAL::parameters; -class Polyhedron_demo_corefinement_sm_plugin : +class CGAL_Lab_corefinement_sm_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "corefinement_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "corefinement_plugin.json") enum bool_op {CRF_UNION, CRF_INTER, CRF_MINUS, CRF_MINUS_OP}; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Degenerated_faces_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Degenerated_faces_plugin.cpp index 7f490dc1f93..802d0bfe509 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Degenerated_faces_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Degenerated_faces_plugin.cpp @@ -7,7 +7,7 @@ #include "Scene_surface_mesh_item.h" #include "Scene_polyhedron_selection_item.h" -#include +#include #include #include @@ -21,11 +21,11 @@ typedef Scene_facegraph_item::Face_graph Face_graph; using namespace CGAL::Three; class Degenerated_faces_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "degenerated_faces_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "degenerated_faces_plugin.json") public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Detect_sharp_edges_plugin.cpp similarity index 87% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Detect_sharp_edges_plugin.cpp index e8065f1ddb0..4c288234aa8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Detect_sharp_edges_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Detect_sharp_edges_plugin.cpp @@ -5,11 +5,11 @@ #include #include -#include +#include #include "Scene_surface_mesh_item.h" -#include "Polyhedron_demo_detect_sharp_edges.h" +#include "CGAL_Lab_detect_sharp_edges.h" typedef Scene_surface_mesh_item Scene_facegraph_item; typedef CGAL::Kernel_traits::Kernel Kernel; @@ -20,13 +20,13 @@ typedef boost::graph_traits::face_descriptor face_descriptor; using namespace CGAL::Three; -class Polyhedron_demo_detect_sharp_edges_plugin : +class CGAL_Lab_detect_sharp_edges_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "detect_sharp_edges_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "detect_sharp_edges_plugin.json") public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) { @@ -66,15 +66,15 @@ private: QAction* actionSharEdges; CGAL::Three::Scene_interface* scene; QMainWindow* mw; -}; // end Polyhedron_demo_detect_sharp_edges_plugin +}; // end CGAL_Lab_detect_sharp_edges_plugin -void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdgesWithInputDialog() +void CGAL_Lab_detect_sharp_edges_plugin::detectSharpEdgesWithInputDialog() { detectSharpEdges(true); } namespace PMP = CGAL::Polygon_mesh_processing; -void Polyhedron_demo_detect_sharp_edges_plugin::detectSharpEdges(bool input_dialog, +void CGAL_Lab_detect_sharp_edges_plugin::detectSharpEdges(bool input_dialog, double angle) { QApplication::setOverrideCursor(Qt::WaitCursor); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Distance_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Distance_plugin.cpp index 3034e7f58a3..38fbd35c7cb 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Distance_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Distance_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -344,11 +344,11 @@ private: }; class DistancePlugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "distance_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "distance_plugin.json") typedef Kernel::Point_3 Point_3; public: diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui b/Lab/demo/Lab/Plugins/PMP/Engrave_dock_widget.ui similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui rename to Lab/demo/Lab/Plugins/PMP/Engrave_dock_widget.ui index a893a256196..c09e56b7dd6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_dock_widget.ui +++ b/Lab/demo/Lab/Plugins/PMP/Engrave_dock_widget.ui @@ -85,7 +85,7 @@ - + :/cgal/icons/resources/up.png:/cgal/icons/resources/up.png @@ -109,7 +109,7 @@ - + :/cgal/icons/resources/right_arrow.png:/cgal/icons/resources/right_arrow.png @@ -133,7 +133,7 @@ - + :/cgal/icons/resources/down.png:/cgal/icons/resources/down.png @@ -151,7 +151,7 @@ - + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png @@ -307,10 +307,10 @@ - - - - + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp index 8c3048eaa3f..b02afe6fb9f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Engrave_text_plugin.cpp @@ -1,5 +1,5 @@ //General Plugin Data -#include +#include #include #include "ui_Engrave_dock_widget.h" @@ -296,11 +296,11 @@ public: class Q_DECL_EXPORT Engrave_text_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: typedef CGAL::Surface_mesh_shortest_path_traits SP_traits; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Extrude_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Extrude_plugin.cpp index a2647094914..538307e8e42 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Extrude_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -312,11 +312,11 @@ Vector estimate_normals(const std::vector& tris) class ExtrudePlugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "extrude_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "extrude_plugin.json") public: bool applicable(QAction* action) const override diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Fairing_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Fairing_plugin.cpp index ade3641a6fc..70c2398acf5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Fairing_plugin.cpp @@ -2,7 +2,7 @@ #include #include "Messages_interface.h" -#include +#include #include #include "Scene_polyhedron_selection_item.h" #include "ui_Fairing_widget.h" @@ -32,13 +32,13 @@ typedef Scene_surface_mesh_item Scene_facegraph_item; typedef Scene_facegraph_item::Face_graph FaceGraph; using namespace CGAL::Three; -class Polyhedron_demo_fairing_plugin : +class CGAL_Lab_fairing_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "fairing_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "fairing_plugin.json") public: bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())) @@ -145,8 +145,8 @@ private: QDockWidget* dock_widget; Ui::Fairing ui_widget; -}; // end Polyhedron_demo_fairing_plugin +}; // end CGAL_Lab_fairing_plugin -// Q_EXPORT_PLUGIN2(Polyhedron_demo_fairing_plugin, Polyhedron_demo_fairing_plugin) +// Q_EXPORT_PLUGIN2(CGAL_Lab_fairing_plugin, CGAL_Lab_fairing_plugin) #include "Fairing_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui b/Lab/demo/Lab/Plugins/PMP/Fairing_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_widget.ui rename to Lab/demo/Lab/Plugins/PMP/Fairing_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Hole_filling_plugin.cpp similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Hole_filling_plugin.cpp index 98399be1d54..07371d079ad 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Hole_filling_plugin.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include "ui_Hole_filling_widget.h" @@ -339,13 +339,13 @@ public Q_SLOTS: }; // end class Scene_hole_visualizer /////////////////////////////////////////////////////////////////////////////////////////////////// using namespace CGAL::Three; -class Polyhedron_demo_hole_filling_plugin : +class CGAL_Lab_hole_filling_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "hole_filling_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "hole_filling_plugin.json") public: bool applicable(QAction* action) const { @@ -455,9 +455,9 @@ private: "Use 'Visualize Holes' button to create one by selecting the polyhedron item!"; } -}; // end Polyhedron_demo_hole_filling_plugin +}; // end CGAL_Lab_hole_filling_plugin -void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_hole_filling_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) { @@ -507,7 +507,7 @@ void Polyhedron_demo_hole_filling_plugin::init(QMainWindow* mainWindow, { connect(scene_casted, SIGNAL(itemAboutToBeDestroyed(CGAL::Three::Scene_item*)), this, SLOT(item_about_to_be_destroyed(CGAL::Three::Scene_item*))); } } -void Polyhedron_demo_hole_filling_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) { +void CGAL_Lab_hole_filling_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) { Scene_face_graph_item* poly_item = qobject_cast(scene_item); if(poly_item) { // erase assoc polylines item @@ -527,7 +527,7 @@ void Polyhedron_demo_hole_filling_plugin::item_about_to_be_destroyed(CGAL::Three } } // removes Scene_hole_visualizer items -void Polyhedron_demo_hole_filling_plugin::dock_widget_closed() { +void CGAL_Lab_hole_filling_plugin::dock_widget_closed() { // remove all Scene_hole_visualizer items for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) @@ -540,7 +540,7 @@ void Polyhedron_demo_hole_filling_plugin::dock_widget_closed() { on_Accept_button(); } // creates a Scene_hole_visualizer and associate it with active Scene_face_graph_item -void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() { +void CGAL_Lab_hole_filling_plugin::on_Visualize_holes_button() { Scene_face_graph_item* poly_item = getSelectedItem(); if(!poly_item) { print_message("Error: please select a polyhedron item from Geometric Objects list!"); @@ -570,7 +570,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Visualize_holes_button() { } } // fills selected holes on active Scene_hole_visualizer -void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() { +void CGAL_Lab_hole_filling_plugin::on_Fill_selected_holes_button() { // get active polylines item Scene_hole_visualizer* hole_visualizer = getSelectedItem(); if(!hole_visualizer) { @@ -602,7 +602,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Fill_selected_holes_button() { } // fills all holes and removes associated Scene_hole_visualizer if any -void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() { +void CGAL_Lab_hole_filling_plugin::on_Select_all_holes_button() { Scene_hole_visualizer* hole_visualizer = getSelectedItem(); if(!hole_visualizer) { print_message(no_selected_hole_visualizer_error_message()); @@ -611,7 +611,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Select_all_holes_button() { hole_visualizer->select_deselect_all(true); } -void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() { +void CGAL_Lab_hole_filling_plugin::on_Select_small_holes_button() { Scene_hole_visualizer* hole_visualizer = getSelectedItem(); if(!hole_visualizer) { print_message(no_selected_hole_visualizer_error_message()); @@ -629,7 +629,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Select_small_holes_button() { scene->itemChanged(hole_visualizer); } -void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() { +void CGAL_Lab_hole_filling_plugin::on_Deselect_all_holes_button() { Scene_hole_visualizer* hole_visualizer = getSelectedItem(); if(!hole_visualizer) { print_message(no_selected_hole_visualizer_error_message()); @@ -639,7 +639,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Deselect_all_holes_button() { } // Simply create polyline items and put them into scene - nothing related with other parts of the plugin -void Polyhedron_demo_hole_filling_plugin::on_Create_polyline_items_button(){ +void CGAL_Lab_hole_filling_plugin::on_Create_polyline_items_button(){ Scene_hole_visualizer* hole_visualizer = getSelectedItem(); if(!hole_visualizer) { print_message(no_selected_hole_visualizer_error_message()); @@ -658,7 +658,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Create_polyline_items_button(){ scene->addItem(polyline_item); } } -void Polyhedron_demo_hole_filling_plugin::on_Accept_button() { +void CGAL_Lab_hole_filling_plugin::on_Accept_button() { if(last_active_item == nullptr) { return; } accept_reject_toggle(false); @@ -668,7 +668,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Accept_button() { new_facets.clear(); last_active_item = nullptr; } -void Polyhedron_demo_hole_filling_plugin::on_Reject_button() { +void CGAL_Lab_hole_filling_plugin::on_Reject_button() { if(last_active_item == nullptr) { return; } accept_reject_toggle(false); @@ -682,7 +682,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Reject_button() { last_active_item = nullptr; } // To delete Scene_hole_visualizer when it becomes empty -void Polyhedron_demo_hole_filling_plugin::hole_visualizer_changed() { +void CGAL_Lab_hole_filling_plugin::hole_visualizer_changed() { Scene_hole_visualizer* hole_visualizer = qobject_cast(this->sender()); if(hole_visualizer && hole_visualizer->polyline_data_list.empty()) { scene->erase( scene->item_id(hole_visualizer)); @@ -690,7 +690,7 @@ void Polyhedron_demo_hole_filling_plugin::hole_visualizer_changed() { } } // helper function for filling holes -bool Polyhedron_demo_hole_filling_plugin::fill +bool CGAL_Lab_hole_filling_plugin::fill (Face_graph& poly, fg_halfedge_descriptor it) { int action_index = ui_widget.action_combo_box->currentIndex(); @@ -787,7 +787,7 @@ bool Polyhedron_demo_hole_filling_plugin::fill } // fills selected holes on active Scene_hole_visualizer -void Polyhedron_demo_hole_filling_plugin::on_Fill_from_selection_button() { +void CGAL_Lab_hole_filling_plugin::on_Fill_from_selection_button() { // get selection item Scene_polyhedron_selection_item* edge_selection = getSelectedItem(); if(!edge_selection || @@ -919,7 +919,7 @@ void Polyhedron_demo_hole_filling_plugin::on_Fill_from_selection_button() { edge_selection->polyhedron_item()->itemChanged(); } -void Polyhedron_demo_hole_filling_plugin::hole_filling_polyline_action() { +void CGAL_Lab_hole_filling_plugin::hole_filling_polyline_action() { Scene_polylines_item* polylines_item = qobject_cast(scene->item(scene->mainSelectionIndex())); if(!polylines_item) { print_message("Error: there is no selected polyline item!"); @@ -990,6 +990,6 @@ void Polyhedron_demo_hole_filling_plugin::hole_filling_polyline_action() { QApplication::restoreOverrideCursor(); } -// Q_EXPORT_PLUGIN2(Polyhedron_demo_hole_filling_plugin, Polyhedron_demo_hole_filling_plugin) +// Q_EXPORT_PLUGIN2(CGAL_Lab_hole_filling_plugin, CGAL_Lab_hole_filling_plugin) #include "Hole_filling_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui b/Lab/demo/Lab/Plugins/PMP/Hole_filling_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_widget.ui rename to Lab/demo/Lab/Plugins/PMP/Hole_filling_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Inside_out_plugin.cpp similarity index 87% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Inside_out_plugin.cpp index 93633b3ab2a..61ab9a4b069 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Inside_out_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Inside_out_plugin.cpp @@ -6,16 +6,16 @@ #include "Scene_polygon_soup_item.h" #include "Scene_surface_mesh_item.h" -#include +#include #include using namespace CGAL::Three; -class Polyhedron_demo_inside_out_plugin : +class CGAL_Lab_inside_out_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "inside_out_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "inside_out_plugin.json") public: @@ -63,9 +63,9 @@ private: QList _actions; Scene_interface *scene; QMainWindow* mw; -}; // end Polyhedron_demo_inside_out_plugin +}; // end CGAL_Lab_inside_out_plugin -void Polyhedron_demo_inside_out_plugin::on_actionInsideOut_triggered() +void CGAL_Lab_inside_out_plugin::on_actionInsideOut_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -98,7 +98,7 @@ void Polyhedron_demo_inside_out_plugin::on_actionInsideOut_triggered() } } -void Polyhedron_demo_inside_out_plugin::on_actionOrientCC_triggered() +void CGAL_Lab_inside_out_plugin::on_actionOrientCC_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp index 33250cf3e81..4a75dfd7a3b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Interpolated_corrected_principal_curvatures_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include "Scene_surface_mesh_item.h" @@ -14,13 +14,13 @@ #include using namespace CGAL::Three; -class Polyhedron_demo_interpolated_corrected_principal_curvatures_and_directions_plugin : +class CGAL_Lab_interpolated_corrected_principal_curvatures_and_directions_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: @@ -47,7 +47,7 @@ public Q_SLOTS: private : Scene_interface *scene; QList _actions; -}; // end Polyhedron_demo_interpolated_corrected_principal_curvatures_and_directions_plugin +}; // end CGAL_Lab_interpolated_corrected_principal_curvatures_and_directions_plugin void compute(SMesh* sMesh, @@ -127,7 +127,7 @@ void compute(SMesh* sMesh, } } -void Polyhedron_demo_interpolated_corrected_principal_curvatures_and_directions_plugin::on_actionEstimateCurvature_triggered() +void CGAL_Lab_interpolated_corrected_principal_curvatures_and_directions_plugin::on_actionEstimateCurvature_triggered() { // get active polyhedron const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui b/Lab/demo/Lab/Plugins/PMP/Isotropic_remeshing_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui rename to Lab/demo/Lab/Plugins/PMP/Isotropic_remeshing_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Isotropic_remeshing_plugin.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Isotropic_remeshing_plugin.cpp index 5140c35002f..5001dd3e83c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include "Scene_surface_mesh_item.h" @@ -164,13 +164,13 @@ void split_long_duplicated_edge(const HedgeRange& hedge_range, } using namespace CGAL::Three; -class Polyhedron_demo_isotropic_remeshing_plugin : +class CGAL_Lab_isotropic_remeshing_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "isotropic_remeshing_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "isotropic_remeshing_plugin.json") typedef boost::graph_traits::edge_descriptor edge_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -1364,6 +1364,6 @@ public: private: QAction* actionIsotropicRemeshing_; Ui::Isotropic_remeshing_dialog ui; -}; // end Polyhedron_demo_isotropic_remeshing_plugin +}; // end CGAL_Lab_isotropic_remeshing_plugin #include "Isotropic_remeshing_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Jet_fitting_plugin.cpp similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Jet_fitting_plugin.cpp index 245e13ef210..9bb1d326a03 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Jet_fitting_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Jet_fitting_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include "Scene_surface_mesh_item.h" #include "Scene_polylines_item.h" @@ -11,13 +11,13 @@ #include #include using namespace CGAL::Three; -class Polyhedron_demo_jet_fitting_plugin : +class CGAL_Lab_jet_fitting_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: @@ -46,7 +46,7 @@ public Q_SLOTS: private : Scene_interface *scene; QList _actions; -}; // end Polyhedron_demo_jet_fitting_plugin +}; // end CGAL_Lab_jet_fitting_plugin template @@ -117,7 +117,7 @@ void compute(Poly* pMesh, } -void Polyhedron_demo_jet_fitting_plugin::on_actionEstimateCurvature_triggered() +void CGAL_Lab_jet_fitting_plugin::on_actionEstimateCurvature_triggered() { // get active polyhedron const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp index 2688c4a8034..c00934451b4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Join_and_split_polyhedra_plugin.cpp @@ -8,8 +8,8 @@ #include "Scene_polylines_item.h" #include "Messages_interface.h" -#include -#include +#include +#include #include #include @@ -27,13 +27,13 @@ typedef Scene_surface_mesh_item Scene_facegraph_item; typedef Scene_facegraph_item::Face_graph FaceGraph; using namespace CGAL::Three; -class Polyhedron_demo_join_and_split_polyhedra_plugin: +class CGAL_Lab_join_and_split_polyhedra_plugin: public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "join_and_split_polyhedra_plugin.json") - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "join_and_split_polyhedra_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) QAction* actionJoinPolyhedra, *actionSplitPolyhedra, *actionColorConnectedComponents; Messages_interface* msg_interface; public: @@ -80,9 +80,9 @@ public Q_SLOTS: private : CGAL::Three::Scene_interface* scene; -}; // end Polyhedron_demo_polyhedron_stitching_plugin +}; // end CGAL_Lab_polyhedron_stitching_plugin -void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionJoinPolyhedra_triggered() +void CGAL_Lab_join_and_split_polyhedra_plugin::on_actionJoinPolyhedra_triggered() { CGAL::Three::Scene_interface::Item_id mainSelectionIndex = scene->selectionIndices().first(); @@ -135,7 +135,7 @@ bool operator()(const FaceGraph& mesh1, const FaceGraph& mesh2) } }; -void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionSplitPolyhedra_triggered() +void CGAL_Lab_join_and_split_polyhedra_plugin::on_actionSplitPolyhedra_triggered() { for(int index : scene->selectionIndices()) { Scene_facegraph_item* item = @@ -195,7 +195,7 @@ struct Polyhedron_cc_marker{ } }; -void Polyhedron_demo_join_and_split_polyhedra_plugin::on_actionColorConnectedComponents_triggered() +void CGAL_Lab_join_and_split_polyhedra_plugin::on_actionColorConnectedComponents_triggered() { // wait cursor diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp index 81bd34ee997..7c333459555 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include "ui_Mean_curvature_flow_skeleton_plugin.h" @@ -79,19 +79,19 @@ struct Polyline_visitor }; using namespace CGAL::Three; -class Polyhedron_demo_mean_curvature_flow_skeleton_plugin : +class CGAL_Lab_mean_curvature_flow_skeleton_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionMCFSkeleton; QAction* actionConvert_to_medial_skeleton; public: - ~Polyhedron_demo_mean_curvature_flow_skeleton_plugin() + ~CGAL_Lab_mean_curvature_flow_skeleton_plugin() { delete ui; } @@ -317,9 +317,9 @@ private: QDockWidget* dockWidget = nullptr; Ui::Mean_curvature_flow_skeleton_plugin* ui = nullptr; -}; // end Polyhedron_demo_mean_curvature_flow_skeleton_plugin +}; // end CGAL_Lab_mean_curvature_flow_skeleton_plugin -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionMCFSkeleton_triggered() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionMCFSkeleton_triggered() { dockWidget->show(); dockWidget->raise(); @@ -328,19 +328,19 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionMCFSkeleton_t getMCFItem(); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_checkbox_toggled(bool b) +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_checkbox_toggled(bool b) { ui->omega_P->setEnabled(b); ui->label_omega_P->setEnabled(b); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionUpdateBBox(bool) +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionUpdateBBox(bool) { double diag = scene->len_diagonal(); ui->min_edge_length->setValue(0.002 * diag); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionSegment() { Scene_mcf_item* item = getMCFItem(); @@ -431,7 +431,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSegment() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConvert_to_medial_skeleton_triggered() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionConvert_to_medial_skeleton_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -473,7 +473,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConvert_to_me } } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionContract() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionContract() { Scene_mcf_item* item = getMCFItem(); @@ -497,7 +497,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionContract() scene->setSelectedItem(scene->item_id(item)); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionCollapse() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionCollapse() { Scene_mcf_item* item = getMCFItem(); @@ -523,7 +523,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionCollapse() scene->setSelectedItem(scene->item_id(item)); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSplit() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionSplit() { Scene_mcf_item* item = getMCFItem(); @@ -549,7 +549,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSplit() scene->setSelectedItem(scene->item_id(item)); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionDegeneracy() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionDegeneracy() { Scene_mcf_item* item = getMCFItem(); @@ -600,7 +600,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionDegeneracy() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionRun() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionRun() { Scene_mcf_item* item = getMCFItem(); @@ -723,7 +723,7 @@ if(!contracted_item) QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSkeletonize() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionSkeletonize() { Scene_mcf_item* item = getMCFItem(); @@ -784,7 +784,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionSkeletonize() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConverge() +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionConverge() { Scene_mcf_item* item = getMCFItem(); @@ -836,7 +836,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionConverge() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item* corpse ) +void CGAL_Lab_mean_curvature_flow_skeleton_plugin::on_actionItemAboutToBeDestroyed(CGAL::Three::Scene_item* corpse ) { Scene_mcf_item *mcf= qobject_cast(corpse); @@ -856,7 +856,7 @@ void Polyhedron_demo_mean_curvature_flow_skeleton_plugin::on_actionItemAboutToBe } void -Polyhedron_demo_mean_curvature_flow_skeleton_plugin::createContractedItem(Scene_mcf_item* item) +CGAL_Lab_mean_curvature_flow_skeleton_plugin::createContractedItem(Scene_mcf_item* item) { if(!item) return; @@ -889,7 +889,7 @@ Polyhedron_demo_mean_curvature_flow_skeleton_plugin::createContractedItem(Scene_ } Scene_mcf_item* -Polyhedron_demo_mean_curvature_flow_skeleton_plugin::getMCFItem() +CGAL_Lab_mean_curvature_flow_skeleton_plugin::getMCFItem() { for(int index : scene->selectionIndices()) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui b/Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui rename to Lab/demo/Lab/Plugins/PMP/Mean_curvature_flow_skeleton_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp index de23c0ac471..a0336156632 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Orient_soup_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Orient_soup_plugin.cpp @@ -13,7 +13,7 @@ #include "Scene_surface_mesh_item.h" #include "Scene_points_with_normal_item.h" -#include +#include #include #include @@ -21,13 +21,13 @@ #include "Messages_interface.h" #include "ui_Repair_soup.h" using namespace CGAL::Three; -class Polyhedron_demo_orient_soup_plugin : +class CGAL_Lab_orient_soup_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "orient_soup_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "orient_soup_plugin.json") public: void init(QMainWindow* mainWindow, @@ -69,9 +69,9 @@ private: QAction* actionDisplayNonManifoldEdges; QAction* actionClean; -}; // end Polyhedron_demo_orient_soup_plugin +}; // end CGAL_Lab_orient_soup_plugin -void Polyhedron_demo_orient_soup_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_orient_soup_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) { @@ -98,10 +98,10 @@ void Polyhedron_demo_orient_soup_plugin::init(QMainWindow* mainWindow, actionClean = new QAction(tr("Clean Polygon Soup"), mainWindow); actionClean->setProperty("subMenuName", "Polygon Mesh Processing"); connect(actionClean, &QAction::triggered, - this, &Polyhedron_demo_orient_soup_plugin::cleanSoup); + this, &CGAL_Lab_orient_soup_plugin::cleanSoup); } -QList Polyhedron_demo_orient_soup_plugin::actions() const { +QList CGAL_Lab_orient_soup_plugin::actions() const { return QList() << actionOrientSM << actionShuffle @@ -137,7 +137,7 @@ void set_fcolors(SMesh* smesh, std::vector colors) fcolors[fd] = colors[color_id++]; } -void Polyhedron_demo_orient_soup_plugin::orientSM() +void CGAL_Lab_orient_soup_plugin::orientSM() { for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { @@ -186,7 +186,7 @@ void Polyhedron_demo_orient_soup_plugin::orientSM() } } -void Polyhedron_demo_orient_soup_plugin::shuffle() +void CGAL_Lab_orient_soup_plugin::shuffle() { for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) { @@ -208,7 +208,7 @@ void Polyhedron_demo_orient_soup_plugin::shuffle() } template -void Polyhedron_demo_orient_soup_plugin::apply_shuffle( Item* root_item, +void CGAL_Lab_orient_soup_plugin::apply_shuffle( Item* root_item, const CGAL::Three::Scene_interface::Item_id& index) { QApplication::setOverrideCursor(Qt::WaitCursor); @@ -225,7 +225,7 @@ void Polyhedron_demo_orient_soup_plugin::apply_shuffle( Item* root_item, QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_orient_soup_plugin::displayNonManifoldEdges() +void CGAL_Lab_orient_soup_plugin::displayNonManifoldEdges() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -241,7 +241,7 @@ void Polyhedron_demo_orient_soup_plugin::displayNonManifoldEdges() } } //todo: nm-points should probably be a pair, and the removal check be on both members -void Polyhedron_demo_orient_soup_plugin::createPointsAndPolyline(std::vector& nm_points, bool warn) +void CGAL_Lab_orient_soup_plugin::createPointsAndPolyline(std::vector& nm_points, bool warn) { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -316,7 +316,7 @@ public: } }; -void Polyhedron_demo_orient_soup_plugin::cleanSoup() +void CGAL_Lab_orient_soup_plugin::cleanSoup() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Point_inside_polyhedron_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Point_inside_polyhedron_plugin.cpp index 61e15f68eb3..5474f99979a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Point_inside_polyhedron_plugin.cpp @@ -6,7 +6,7 @@ #include "Scene_points_with_normal_item.h" #include #include -#include +#include #include #include @@ -31,13 +31,13 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel; -class Polyhedron_demo_point_inside_polyhedron_plugin : +class CGAL_Lab_point_inside_cgal_lab_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: bool applicable(QAction*) const @@ -267,6 +267,6 @@ private: QDockWidget* dock_widget; Ui::Point_inside_polyhedron ui_widget; -}; // end Polyhedron_demo_point_inside_polyhedron_plugin +}; // end CGAL_Lab_point_inside_cgal_lab_plugin #include "Point_inside_polyhedron_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui b/Lab/demo/Lab/Plugins/PMP/Point_inside_polyhedron_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Point_inside_polyhedron_widget.ui rename to Lab/demo/Lab/Plugins/PMP/Point_inside_polyhedron_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Polyhedron_slicer_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Polyhedron_slicer_plugin.cpp index a220547b722..59033b835bf 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Polyhedron_slicer_plugin.cpp @@ -8,7 +8,7 @@ #include "Scene_polylines_item.h" #include "Scene.h" -#include +#include #include #include "ui_Polyhedron_slicer_widget.h" @@ -27,13 +27,13 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel; using namespace CGAL::Three; -class Polyhedron_demo_polyhedron_slicer_plugin : +class CGAL_Lab_polyhedron_slicer_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: bool applicable(QAction*) const @@ -93,9 +93,9 @@ private: const std::vector& plane_positions, std::list >& polylines); -}; // end Polyhedron_demo_polyhedron_slicer_plugin +}; // end CGAL_Lab_polyhedron_slicer_plugin -void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow, +void CGAL_Lab_polyhedron_slicer_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) { @@ -119,11 +119,11 @@ void Polyhedron_demo_polyhedron_slicer_plugin::init(QMainWindow* mainWindow, connect(ui_widget.Update_plane_button, SIGNAL(clicked()), this, SLOT(on_Update_plane_button_clicked())); } -QList Polyhedron_demo_polyhedron_slicer_plugin::actions() const { +QList CGAL_Lab_polyhedron_slicer_plugin::actions() const { return QList() << actionSlicerWidget; } -void Polyhedron_demo_polyhedron_slicer_plugin::slicer_widget_action(){ +void CGAL_Lab_polyhedron_slicer_plugin::slicer_widget_action(){ if(dock_widget->isVisible()) { return; } dock_widget->show(); dock_widget->raise(); @@ -156,7 +156,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::slicer_widget_action(){ } // when manipulated frame of plane is modified, update line-edits -void Polyhedron_demo_polyhedron_slicer_plugin::plane_manipulated_frame_modified() { +void CGAL_Lab_polyhedron_slicer_plugin::plane_manipulated_frame_modified() { CGAL::qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame(); const CGAL::qglviewer::Vec& pos = mf->position(); ui_widget.Center_x->setText(QString::number(pos.x)); @@ -176,7 +176,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::plane_manipulated_frame_modified( } // when Update Plane button is clicked, update manipulated frame of plane with line-edits -bool Polyhedron_demo_polyhedron_slicer_plugin::on_Update_plane_button_clicked() { +bool CGAL_Lab_polyhedron_slicer_plugin::on_Update_plane_button_clicked() { CGAL::qglviewer::ManipulatedFrame* mf = plane_item->manipulatedFrame(); // get center bool ok_1 = true, ok_2 = true, ok_3 = true; @@ -215,7 +215,7 @@ bool Polyhedron_demo_polyhedron_slicer_plugin::on_Update_plane_button_clicked() } // generate multiple cuts, until any cut does not intersect with bbox -void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked() +void CGAL_Lab_polyhedron_slicer_plugin::on_Generate_button_clicked() { Scene_surface_mesh_item* sm_item = getSelectedItem(); if(! sm_item) { @@ -324,7 +324,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::on_Generate_button_clicked() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_polyhedron_slicer_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) { +void CGAL_Lab_polyhedron_slicer_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* scene_item) { if(plane_item == nullptr) { return; }// which means this plugin erased plane_item Scene_plane_item* destroyed_plane = qobject_cast(scene_item); if(destroyed_plane && destroyed_plane == plane_item) { @@ -333,7 +333,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::item_about_to_be_destroyed(CGAL:: } } -void Polyhedron_demo_polyhedron_slicer_plugin::dock_widget_closed() { +void CGAL_Lab_polyhedron_slicer_plugin::dock_widget_closed() { CGAL_assertion(plane_item != NULL); CGAL::Three::Scene_interface::Item_id id = scene->item_id(plane_item); plane_item = nullptr; @@ -341,7 +341,7 @@ void Polyhedron_demo_polyhedron_slicer_plugin::dock_widget_closed() { } // this function assumes 'planes' are parallel template -void Polyhedron_demo_polyhedron_slicer_plugin::intersection_of_plane_Polyhedra_3_using_AABB_wrapper( +void CGAL_Lab_polyhedron_slicer_plugin::intersection_of_plane_Polyhedra_3_using_AABB_wrapper( TriangleMesh& poly, const std::vector& planes, const std::vector& plane_positions, diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_widget.ui b/Lab/demo/Lab/Plugins/PMP/Polyhedron_slicer_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_slicer_widget.ui rename to Lab/demo/Lab/Plugins/PMP/Polyhedron_slicer_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Polyhedron_stitching_plugin.cpp similarity index 80% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Polyhedron_stitching_plugin.cpp index 6bedf046e85..fd4a38b9075 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Polyhedron_stitching_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Polyhedron_stitching_plugin.cpp @@ -5,8 +5,8 @@ #include "Scene_surface_mesh_item.h" #include "Scene_polylines_item.h" -#include -#include +#include +#include #include #include @@ -16,13 +16,13 @@ #include using namespace CGAL::Three; -class Polyhedron_demo_polyhedron_stitching_plugin : +class CGAL_Lab_polyhedron_stitching_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "polyhedron_stitching_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "polyhedron_stitching_plugin.json") QAction* actionDetectBorders; QAction* actionStitchBorders; @@ -78,12 +78,12 @@ public Q_SLOTS: void on_actionStitchByCC_triggered(); void on_actionMergeReversibleCCs_triggered(); -}; // end Polyhedron_demo_polyhedron_stitching_plugin +}; // end CGAL_Lab_polyhedron_stitching_plugin template -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_triggered(Scene_interface::Item_id index) +void CGAL_Lab_polyhedron_stitching_plugin::on_actionDetectBorders_triggered(Scene_interface::Item_id index) { typedef typename Item::Face_graph FaceGraph; Item* item = qobject_cast(scene->item(index)); @@ -118,7 +118,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_trigger } } -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_triggered() +void CGAL_Lab_polyhedron_stitching_plugin::on_actionDetectBorders_triggered() { for(int index : scene->selectionIndices()){ on_actionDetectBorders_triggered(index); @@ -126,7 +126,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionDetectBorders_trigger } template -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_triggered(Scene_interface::Item_id index) +void CGAL_Lab_polyhedron_stitching_plugin::on_actionStitchBorders_triggered(Scene_interface::Item_id index) { Item* item = qobject_cast(scene->item(index)); @@ -140,7 +140,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_trigger } -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_triggered() +void CGAL_Lab_polyhedron_stitching_plugin::on_actionStitchBorders_triggered() { for(int index : scene->selectionIndices()){ on_actionStitchBorders_triggered(index); @@ -148,7 +148,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchBorders_trigger } template -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchByCC_triggered(Scene_interface::Item_id index) +void CGAL_Lab_polyhedron_stitching_plugin::on_actionStitchByCC_triggered(Scene_interface::Item_id index) { Item* item = qobject_cast(scene->item(index)); @@ -162,7 +162,7 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchByCC_triggered( } template -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_triggered(Scene_interface::Item_id index) +void CGAL_Lab_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_triggered(Scene_interface::Item_id index) { Item* item = qobject_cast(scene->item(index)); @@ -175,14 +175,14 @@ void Polyhedron_demo_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_tr scene->itemChanged(item); } -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionStitchByCC_triggered() +void CGAL_Lab_polyhedron_stitching_plugin::on_actionStitchByCC_triggered() { for(int index : scene->selectionIndices()){ on_actionStitchByCC_triggered(index); } } -void Polyhedron_demo_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_triggered() +void CGAL_Lab_polyhedron_stitching_plugin::on_actionMergeReversibleCCs_triggered() { for(int index : scene->selectionIndices()){ on_actionMergeReversibleCCs_triggered(index); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Random_perturbation_dialog.ui b/Lab/demo/Lab/Plugins/PMP/Random_perturbation_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Random_perturbation_dialog.ui rename to Lab/demo/Lab/Plugins/PMP/Random_perturbation_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Random_perturbation_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Random_perturbation_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Random_perturbation_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Random_perturbation_plugin.cpp index 004768739cd..d43ef36b3d6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Random_perturbation_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Random_perturbation_plugin.cpp @@ -1,7 +1,7 @@ #include -#include +#include #include "Scene_surface_mesh_item.h" #include "Scene_polyhedron_selection_item.h" @@ -27,13 +27,13 @@ #include "ui_Random_perturbation_dialog.h" using namespace CGAL::Three; -class Polyhedron_demo_random_perturbation_plugin : +class CGAL_Lab_random_perturbation_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "random_perturbation_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "random_perturbation_plugin.json") public: void init(QMainWindow* mainWindow, @@ -228,7 +228,7 @@ private: QMainWindow* mw; QAction* actionRandomPerturbation_; -}; // end Polyhedron_demo_random_perturbation_plugin +}; // end CGAL_Lab_random_perturbation_plugin #include "Random_perturbation_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_dialog.ui b/Lab/demo/Lab/Plugins/PMP/Remesh_planar_patches_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_dialog.ui rename to Lab/demo/Lab/Plugins/PMP/Remesh_planar_patches_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Remesh_planar_patches_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Remesh_planar_patches_plugin.cpp index 067f2c8fe72..49797844677 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Remesh_planar_patches_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Remesh_planar_patches_plugin.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include "Scene_surface_mesh_item.h" @@ -51,13 +51,13 @@ struct Mesh_map }; using namespace CGAL::Three; -class Polyhedron_demo_remesh_planar_patches_plugin : +class CGAL_Lab_remesh_planar_patches_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "isotropic_remeshing_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "isotropic_remeshing_plugin.json") typedef Scene_surface_mesh_item::Face_graph Mesh; typedef boost::graph_traits::face_descriptor face_descriptor; @@ -322,6 +322,6 @@ private: QAction* actionRemeshPlanarPatches_; Ui::Remesh_planar_patches_dialog ui; -}; // end Polyhedron_demo_remesh_planar_patches_plugin +}; // end CGAL_Lab_remesh_planar_patches_plugin #include "Remesh_planar_patches_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/RemoveNeedlesDialog.ui b/Lab/demo/Lab/Plugins/PMP/RemoveNeedlesDialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/RemoveNeedlesDialog.ui rename to Lab/demo/Lab/Plugins/PMP/RemoveNeedlesDialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Repair_polyhedron_plugin.cpp similarity index 86% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Repair_polyhedron_plugin.cpp index 5d87af53f59..5371fa50dfc 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -4,8 +4,8 @@ #include "Scene_polygon_soup_item.h" #include "Scene_points_with_normal_item.h" #include -#include -#include +#include +#include #include #include @@ -25,18 +25,19 @@ #include "ui_RemoveNeedlesDialog.h" #include "ui_SelfSnapDialog.h" +#include "ui_AddBboxDialog.h" #include #include #include using namespace CGAL::Three; -class Polyhedron_demo_repair_polyhedron_plugin : +class CGAL_Lab_repair_cgal_lab_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "repair_polyhedron_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "repair_polyhedron_plugin.json") public: @@ -60,6 +61,7 @@ public: actionAutorefineAndRMSelfIntersections = new QAction(tr("Autorefine and Remove Self-Intersections (Deprecated)"), mw); actionRemoveNeedlesAndCaps = new QAction(tr("Remove Needles And Caps")); actionSnapBorders = new QAction(tr("Snap Boundaries")); + actionAddBbox = new QAction(tr("Add Bounding Box")); actionRemoveIsolatedVertices->setObjectName("actionRemoveIsolatedVertices"); actionRemoveDegenerateFaces->setObjectName("actionRemoveDegenerateFaces"); @@ -73,6 +75,7 @@ public: actionAutorefineAndRMSelfIntersections->setObjectName("actionAutorefineAndRMSelfIntersections"); actionRemoveNeedlesAndCaps->setObjectName("actionRemoveNeedlesAndCaps"); actionSnapBorders->setObjectName("actionSnapBorders"); + actionAddBbox->setObjectName("actionAddBbox"); actionRemoveDegenerateFaces->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); actionStitchCloseBorderHalfedges->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); @@ -85,6 +88,7 @@ public: actionNewAutorefine->setProperty("subMenuName", "Polygon Mesh Processing/Repair"); actionAutorefineAndRMSelfIntersections->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); actionSnapBorders->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental"); + actionAddBbox->setProperty("subMenuName", "Polygon Mesh Processing"); autoConnectActions(); } @@ -102,7 +106,8 @@ public: << actionNewAutorefine << actionAutorefineAndRMSelfIntersections << actionRemoveNeedlesAndCaps - << actionSnapBorders; + << actionSnapBorders + << actionAddBbox; } bool applicable(QAction* action) const @@ -127,6 +132,8 @@ public: template void on_actionRemoveDegenerateFaces_triggered(Scene_interface::Item_id index); template + void on_actionAddBbox_triggered(Scene_interface::Item_id index); + template void on_actionRemoveSelfIntersections_triggered(Scene_interface::Item_id index); template void on_actionStitchCloseBorderHalfedges_triggered(Scene_interface::Item_id index); @@ -156,6 +163,7 @@ public Q_SLOTS: void on_actionAutorefineAndRMSelfIntersections_triggered(); void on_actionRemoveNeedlesAndCaps_triggered(); void on_actionSnapBorders_triggered(); + void on_actionAddBbox_triggered(); private: QAction* actionRemoveIsolatedVertices; @@ -170,12 +178,13 @@ private: QAction* actionAutorefineAndRMSelfIntersections; QAction* actionRemoveNeedlesAndCaps; QAction* actionSnapBorders; + QAction* actionAddBbox; Messages_interface* messages; -}; // end Polyhedron_demo_repair_polyhedron_plugin +}; // end CGAL_Lab_repair_cgal_lab_plugin template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveIsolatedVertices_triggered(Scene_interface::Item_id index) { Item* poly_item = qobject_cast(scene->item(index)); @@ -191,7 +200,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_t } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveIsolatedVertices_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -199,7 +208,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveIsolatedVertices_t QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveNeedlesAndCaps_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveNeedlesAndCaps_triggered() { QCursor tmp_cursor(Qt::WaitCursor); CGAL::Three::Three::CursorScopeGuard guard(tmp_cursor); @@ -226,7 +235,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveNeedlesAndCaps_tri sm_item->itemChanged(); } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionSnapBorders_triggered() { const Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); @@ -365,8 +374,43 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionSnapBorders_triggered() sm_item->itemChanged(); } +template +void CGAL_Lab_repair_cgal_lab_plugin::on_actionAddBbox_triggered(Scene_interface::Item_id index) +{ + Item* poly_item = + qobject_cast(scene->item(index)); + if (poly_item) + { + QDialog dialog; + Ui::AddBboxDialog ui; + ui.setupUi(&dialog); + ui.triangulate_bbox->setChecked(true); + ui.bbox_scaling->setValue(1.0); + + if(dialog.exec() != QDialog::Accepted) + return; + + QApplication::setOverrideCursor(Qt::WaitCursor); + const double scaling = ui.bbox_scaling->value(); + CGAL::Polygon_mesh_processing::add_bbox(*poly_item->face_graph(), + CGAL::parameters::bbox_scaling(scaling). + do_not_triangulate_faces(!ui.triangulate_bbox->isChecked())); + + poly_item->invalidateOpenGLBuffers(); + Q_EMIT poly_item->itemChanged(); + QApplication::restoreOverrideCursor(); + CGAL::Three::Three::information(tr("Bbox has been added (%1 @%)").arg(scaling)); + } +} + +void CGAL_Lab_repair_cgal_lab_plugin::on_actionAddBbox_triggered() +{ + const Scene_interface::Item_id index = scene->mainSelectionIndex(); + on_actionAddBbox_triggered(index); +} + template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveDegenerateFaces_triggered(Scene_interface::Item_id index) { Item* poly_item = qobject_cast(scene->item(index)); if (poly_item) @@ -386,7 +430,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_tr } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveDegenerateFaces_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -395,7 +439,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveDegenerateFaces_tr } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveSelfIntersections_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveSelfIntersections_triggered(Scene_interface::Item_id index) { Item* poly_item = qobject_cast(scene->item(index)); if (poly_item) @@ -415,7 +459,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveSelfIntersections_ } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveSelfIntersections_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionRemoveSelfIntersections_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -424,7 +468,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionRemoveSelfIntersections_ } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionAutorefine_triggered(Scene_interface::Item_id index) { Item* poly_item = qobject_cast(scene->item(index)); if (poly_item) @@ -442,7 +486,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered(Sce } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionAutorefine_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -451,7 +495,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered() } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered(const std::vector& indices) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionNewAutorefine_triggered(const std::vector& indices) { namespace PMP = CGAL::Polygon_mesh_processing; Polygon_soup::Points points; @@ -507,7 +551,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered( Q_EMIT new_item->itemChanged(); } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionNewAutorefine_triggered() { std::vector indices; for (Scene_interface::Item_id index : scene->selectionIndices()) @@ -523,7 +567,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionNewAutorefine_triggered( } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfIntersections_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionAutorefineAndRMSelfIntersections_triggered(Scene_interface::Item_id index) { Item* poly_item = qobject_cast(scene->item(index)); if (poly_item) @@ -545,7 +589,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfInter } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfIntersections_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionAutorefineAndRMSelfIntersections_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -554,7 +598,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfInter } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionStitchCloseBorderHalfedges_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionStitchCloseBorderHalfedges_triggered(Scene_interface::Item_id index) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; namespace PMP = CGAL::Polygon_mesh_processing; @@ -579,7 +623,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionStitchCloseBorderHalfedg } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionStitchCloseBorderHalfedges_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionStitchCloseBorderHalfedges_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -588,7 +632,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionStitchCloseBorderHalfedg } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionDuplicateNMVertices_triggered(Scene_interface::Item_id index) { namespace PMP = CGAL::Polygon_mesh_processing; @@ -605,7 +649,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_trig } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionExtractNMVertices_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionExtractNMVertices_triggered(Scene_interface::Item_id index) { namespace PMP = CGAL::Polygon_mesh_processing; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -630,7 +674,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionExtractNMVertices_trigge } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionDuplicateNMVertices_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -638,7 +682,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_trig QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionExtractNMVertices_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionExtractNMVertices_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -647,7 +691,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionExtractNMVertices_trigge } template -void Polyhedron_demo_repair_polyhedron_plugin::on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered(Scene_interface::Item_id index) +void CGAL_Lab_repair_cgal_lab_plugin::on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered(Scene_interface::Item_id index) { namespace PMP = CGAL::Polygon_mesh_processing; @@ -665,7 +709,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionMergeDuplicatedVerticesO } } -void Polyhedron_demo_repair_polyhedron_plugin::on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered() +void CGAL_Lab_repair_cgal_lab_plugin::on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); const Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_soup.ui b/Lab/demo/Lab/Plugins/PMP/Repair_soup.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_soup.ui rename to Lab/demo/Lab/Plugins/PMP/Repair_soup.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp b/Lab/demo/Lab/Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp rename to Lab/demo/Lab/Plugins/PMP/Scene_facegraph_item_k_ring_selection.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h b/Lab/demo/Lab/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h rename to Lab/demo/Lab/Plugins/PMP/Scene_facegraph_item_k_ring_selection.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection_config.h b/Lab/demo/Lab/Plugins/PMP/Scene_facegraph_item_k_ring_selection_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_facegraph_item_k_ring_selection_config.h rename to Lab/demo/Lab/Plugins/PMP/Scene_facegraph_item_k_ring_selection_config.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_mcf_item.cpp b/Lab/demo/Lab/Plugins/PMP/Scene_mcf_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_mcf_item.cpp rename to Lab/demo/Lab/Plugins/PMP/Scene_mcf_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_mcf_item.h b/Lab/demo/Lab/Plugins/PMP/Scene_mcf_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Scene_mcf_item.h rename to Lab/demo/Lab/Plugins/PMP/Scene_mcf_item.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp index 2c50e614ac0..f9ce55fd6f7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Selection_plugin.cpp @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include #include #include "ui_Selection_widget.h" @@ -72,15 +72,15 @@ struct Polyline_visitor void end_polyline(){} }; using namespace CGAL::Three; -class Polyhedron_demo_selection_plugin : +class CGAL_Lab_selection_plugin : public QObject, - public Polyhedron_demo_plugin_helper, - public Polyhedron_demo_io_plugin_interface + public CGAL_Lab_plugin_helper, + public CGAL_Lab_io_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface CGAL::Three::Polyhedron_demo_io_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "selection_plugin.json") - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface CGAL::Three::CGAL_Lab_io_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "selection_plugin.json") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.IOPluginInterface/1.90") public: QString nameFilters() const override { return "Selection files(*.selection.txt)"; } QString name() const override { return "selection_sm_plugin"; } @@ -153,7 +153,7 @@ public: << actionSelfIntersection; } - using Polyhedron_demo_io_plugin_interface::init; + using CGAL_Lab_io_plugin_interface::init; virtual void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface* m) override{ mw = mainWindow; scene = scene_interface; @@ -202,7 +202,7 @@ public: connect(ui_widget.Selection_type_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(on_Selection_type_combo_box_changed(int))); connect(ui_widget.lassoCheckBox, &QCheckBox::toggled, - this, &Polyhedron_demo_selection_plugin::on_LassoCheckBox_changed); + this, &CGAL_Lab_selection_plugin::on_LassoCheckBox_changed); connect(ui_widget.Insertion_radio_button, SIGNAL(toggled(bool)), this, SLOT(on_Insertion_radio_button_toggled(bool))); connect(ui_widget.Brush_size_spin_box, SIGNAL(valueChanged(int)), this, SLOT(on_Brush_size_spin_box_changed(int))); connect(ui_widget.validateButton, SIGNAL(clicked()), this, SLOT(on_validateButton_clicked())); @@ -946,7 +946,7 @@ public Q_SLOTS: //Split vertex case 1: { - QPixmap pm(":/cgal/Polyhedron_3/resources/euler_vertex.png"); + QPixmap pm(":/cgal/Lab/resources/euler_vertex.png"); ui_widget.docImage_Label->setPixmap(pm); break; } @@ -955,14 +955,14 @@ public Q_SLOTS: //Split face case 4: { - QPixmap pm(":/cgal/Polyhedron_3/resources/euler_facet.png"); + QPixmap pm(":/cgal/Lab/resources/euler_facet.png"); ui_widget.docImage_Label->setPixmap(pm); break; } //Collapse edge case 5: { - QPixmap pm(":/cgal/Polyhedron_3/resources/general_collapse.png"); + QPixmap pm(":/cgal/Lab/resources/general_collapse.png"); ui_widget.docImage_Label->setPixmap(pm); break; } @@ -971,21 +971,21 @@ public Q_SLOTS: //Remove center vertex case 8: { - QPixmap pm(":/cgal/Polyhedron_3/resources/euler_center.png"); + QPixmap pm(":/cgal/Lab/resources/euler_center.png"); ui_widget.docImage_Label->setPixmap(pm); break; } //Add vertex and face to border case 9: { - QPixmap pm(":/cgal/Polyhedron_3/resources/add_facet1.png"); + QPixmap pm(":/cgal/Lab/resources/add_facet1.png"); ui_widget.docImage_Label->setPixmap(pm); break; } //add facet to border case 10: { - QPixmap pm(":/cgal/Polyhedron_3/resources/add_facet2.png"); + QPixmap pm(":/cgal/Lab/resources/add_facet2.png"); ui_widget.docImage_Label->setPixmap(pm); break; } @@ -1173,7 +1173,7 @@ private: Selection_item_map selection_item_map; int last_mode; bool from_plugin; -}; // end Polyhedron_demo_selection_plugin +}; // end CGAL_Lab_selection_plugin template @@ -1193,7 +1193,7 @@ bool selfIntersect(Mesh* mesh, std::vector::face_descriptor Face_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; @@ -1271,6 +1271,6 @@ void Polyhedron_demo_selection_plugin::on_actionSelfIntersection_triggered() QMessageBox::information(mw, tr("No self intersection"), tr("None of the selected surfaces self-intersect.")); } -//Q_EXPORT_PLUGIN2(Polyhedron_demo_selection_plugin, Polyhedron_demo_selection_plugin) +//Q_EXPORT_PLUGIN2(CGAL_Lab_selection_plugin, CGAL_Lab_selection_plugin) #include "Selection_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_widget.ui b/Lab/demo/Lab/Plugins/PMP/Selection_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Selection_widget.ui rename to Lab/demo/Lab/Plugins/PMP/Selection_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/SelfSnapDialog.ui b/Lab/demo/Lab/Plugins/PMP/SelfSnapDialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/SelfSnapDialog.ui rename to Lab/demo/Lab/Plugins/PMP/SelfSnapDialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp index 70747cdddc9..91673050de3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp @@ -1,7 +1,7 @@ #include -#include -#include +#include +#include #include #include @@ -42,12 +42,12 @@ typedef boost::graph_traits::face_descriptor face_descrip typedef CGAL::dynamic_vertex_property_t Vertex_bool_property; typedef typename boost::property_map::type VCMap; -class Polyhedron_demo_smothing_plugin - : public QObject, public Polyhedron_demo_plugin_helper +class CGAL_Lab_smothing_plugin + : public QObject, public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.ui b/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_plugin.ui rename to Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_tangential_relaxation.ui b/Lab/demo/Lab/Plugins/PMP/Smoothing_tangential_relaxation.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Smoothing_tangential_relaxation.ui rename to Lab/demo/Lab/Plugins/PMP/Smoothing_tangential_relaxation.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Surface_intersection_plugin.cpp similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Surface_intersection_plugin.cpp index 968a270f706..8eddd406ae4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Surface_intersection_plugin.cpp @@ -3,7 +3,7 @@ #include "Kernel_type.h" #include "Scene_surface_mesh_item.h" -#include +#include #include #include "Scene_polylines_item.h" @@ -26,13 +26,13 @@ typedef boost::graph_traits::face_descriptor using namespace CGAL::Three; namespace PMP = CGAL::Polygon_mesh_processing; -class Polyhedron_demo_intersection_plugin : +class CGAL_Lab_intersection_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "surface_intersection_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "surface_intersection_plugin.json") public: @@ -104,9 +104,9 @@ public Q_SLOTS: void intersectionSurfacePolyline(); void intersectionPolylines(); -}; // end class Polyhedron_demo_intersection_plugin +}; // end class CGAL_Lab_intersection_plugin -void Polyhedron_demo_intersection_plugin::intersectionSurfaces() +void CGAL_Lab_intersection_plugin::intersectionSurfaces() { Scene_face_graph_item* itemA = nullptr; for(CGAL::Three::Scene_interface::Item_id index : scene->selectionIndices()) @@ -168,7 +168,7 @@ void Polyhedron_demo_intersection_plugin::intersectionSurfaces() } } #include -void Polyhedron_demo_intersection_plugin::intersectionPolylines() +void CGAL_Lab_intersection_plugin::intersectionPolylines() { typedef std::pair< std::pair, @@ -260,7 +260,7 @@ void Polyhedron_demo_intersection_plugin::intersectionPolylines() } } -void Polyhedron_demo_intersection_plugin::intersectionSurfacePolyline() +void CGAL_Lab_intersection_plugin::intersectionSurfacePolyline() { typedef std::pair >Poly_intersection; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Triangulate_facets_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp rename to Lab/demo/Lab/Plugins/PMP/Triangulate_facets_plugin.cpp index cd91bd1a6eb..cef1f5e8aab 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Triangulate_facets_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Triangulate_facets_plugin.cpp @@ -2,7 +2,7 @@ #include #include #include "Messages_interface.h" -#include +#include #include #include "Scene_surface_mesh_item.h" @@ -12,13 +12,13 @@ #include using namespace CGAL::Three; -class Polyhedron_demo_triangulate_facets_plugin : +class CGAL_Lab_triangulate_facets_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "triangulate_facets_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "triangulate_facets_plugin.json") typedef Scene_surface_mesh_item::Face_graph FaceGraph; typedef boost::graph_traits::face_descriptor face_descriptor; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Alpha_shape_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Alpha_shape_plugin.cpp index 0c9bf82f8af..15f2b812b36 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Alpha_shape_plugin.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -111,7 +111,7 @@ private: -#include +#include class DockWidget : public QDockWidget, public Ui::AlphaShapesWidget @@ -127,11 +127,11 @@ public: using namespace CGAL::Three; class Q_DECL_EXPORT Alpha_shape_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public : void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*)override { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_widget.ui b/Lab/demo/Lab/Plugins/Point_set/Alpha_shape_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Alpha_shape_widget.ui rename to Lab/demo/Lab/Plugins/Point_set/Alpha_shape_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt b/Lab/demo/Lab/Plugins/Point_set/CMakeLists.txt similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Point_set/CMakeLists.txt index 3bade0d26e6..7434d33fa30 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Point_set/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) if(TARGET CGAL::Eigen3_support) find_package(SCIP QUIET) @@ -25,7 +25,7 @@ if(TARGET CGAL::Eigen3_support) endif() qt6_wrap_ui(surface_reconstructionUI_FILES Surface_reconstruction_plugin.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( surface_reconstruction_plugin Surface_reconstruction_plugin Surface_reconstruction_poisson_impl.cpp @@ -48,7 +48,7 @@ if(TARGET CGAL::Eigen3_support) qt6_wrap_ui(point_set_normal_estimationUI_FILES Point_set_normal_estimation_plugin.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( point_set_normal_estimation_plugin Point_set_normal_estimation_plugin ${point_set_normal_estimationUI_FILES} KEYWORDS PointSetProcessing Classification) @@ -58,21 +58,21 @@ if(TARGET CGAL::Eigen3_support) CGAL::Eigen3_support) qt6_wrap_ui(features_detection_pluginUI_FILES Features_detection_plugin.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( features_detection_plugin Features_detection_plugin ${features_detection_pluginUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries( features_detection_plugin PUBLIC scene_points_with_normal_item CGAL::Eigen3_support) - polyhedron_demo_plugin(point_set_smoothing_plugin Point_set_smoothing_plugin + cgal_lab_plugin(point_set_smoothing_plugin Point_set_smoothing_plugin KEYWORDS PointSetProcessing) target_link_libraries( point_set_smoothing_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler CGAL::Eigen3_support) - polyhedron_demo_plugin( + cgal_lab_plugin( point_set_average_spacing_plugin Point_set_average_spacing_plugin KEYWORDS PointSetProcessing Classification) target_link_libraries( @@ -82,7 +82,7 @@ if(TARGET CGAL::Eigen3_support) qt6_wrap_ui(point_set_shape_detectionUI_FILES Point_set_shape_detection_plugin.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( point_set_shape_detection_plugin Point_set_shape_detection_plugin ${point_set_shape_detectionUI_FILES} KEYWORDS PointSetProcessing Classification) @@ -98,7 +98,7 @@ if(TARGET CGAL::Eigen3_support) if(TARGET CGAL::OpenGR_support OR CGAL::pointmatcher_support) qt6_wrap_ui(register_point_setsUI_FILES Register_point_sets_plugin.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( register_point_sets_plugin Register_point_sets_plugin ${register_point_setsUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries(register_point_sets_plugin @@ -125,7 +125,7 @@ endif() qt6_wrap_ui(point_set_bilateral_smoothingUI_FILES Point_set_bilateral_smoothing_plugin.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_bilateral_smoothing_plugin Point_set_bilateral_smoothing_plugin ${point_set_bilateral_smoothingUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries( @@ -133,7 +133,7 @@ target_link_libraries( scene_callback_signaler) qt6_wrap_ui(ps_outliers_removal_UI_FILES Point_set_outliers_removal_plugin.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_outliers_removal_plugin Point_set_outliers_removal_plugin ${ps_outliers_removal_UI_FILES} KEYWORDS PointSetProcessing) target_link_libraries( @@ -141,7 +141,7 @@ target_link_libraries( scene_callback_signaler) qt6_wrap_ui(point_set_selectionUI_FILES Point_set_selection_widget.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_selection_plugin Point_set_selection_plugin ${point_set_selectionUI_FILES} KEYWORDS PointSetProcessing Classification) target_link_libraries( @@ -149,7 +149,7 @@ target_link_libraries( scene_polylines_item scene_edit_box_item) qt6_wrap_ui(point_set_simplificationUI_FILES Point_set_simplification_plugin.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_simplification_plugin Point_set_simplification_plugin ${point_set_simplificationUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries( @@ -157,43 +157,43 @@ target_link_libraries( scene_callback_signaler) qt6_wrap_ui(point_set_upsamplingUI_FILES Point_set_upsampling_plugin.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_upsampling_plugin Point_set_upsampling_plugin ${point_set_upsamplingUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries(point_set_upsampling_plugin PUBLIC scene_points_with_normal_item) qt6_wrap_ui(point_set_wlopFILES Point_set_wlop_plugin.ui) -polyhedron_demo_plugin(point_set_wlop_plugin Point_set_wlop_plugin +cgal_lab_plugin(point_set_wlop_plugin Point_set_wlop_plugin ${point_set_wlopFILES} KEYWORDS PointSetProcessing) target_link_libraries(point_set_wlop_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler) -polyhedron_demo_plugin(point_set_clustering_plugin Point_set_clustering_plugin +cgal_lab_plugin(point_set_clustering_plugin Point_set_clustering_plugin KEYWORDS PointSetProcessing) target_link_libraries( point_set_clustering_plugin PUBLIC scene_points_with_normal_item scene_callback_signaler) -polyhedron_demo_plugin(merge_point_sets_plugin Merge_point_sets_plugin KEYWORDS +cgal_lab_plugin(merge_point_sets_plugin Merge_point_sets_plugin KEYWORDS PointSetProcessing Classification) target_link_libraries(merge_point_sets_plugin PUBLIC scene_points_with_normal_item) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_interference_plugin Point_set_interference_plugin KEYWORDS PointSetProcessing) target_link_libraries(point_set_interference_plugin PUBLIC scene_points_with_normal_item) qt6_wrap_ui(alpha_shapeUI_FILES Alpha_shape_widget.ui) -polyhedron_demo_plugin(alpha_shape_plugin Alpha_shape_plugin +cgal_lab_plugin(alpha_shape_plugin Alpha_shape_plugin ${alpha_shapeUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries(alpha_shape_plugin PUBLIC scene_points_with_normal_item scene_c3t3_item) qt6_wrap_ui(distanceUI_FILES Point_set_to_mesh_distance_widget.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( point_set_to_mesh_distance_plugin Point_set_to_mesh_distance_plugin ${distanceUI_FILES} KEYWORDS PointSetProcessing) target_link_libraries( diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Features_detection_plugin.cpp similarity index 81% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Features_detection_plugin.cpp index 7cf27359a7f..99d7ab15026 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Features_detection_plugin.cpp @@ -4,8 +4,8 @@ #include #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include @@ -13,13 +13,13 @@ #include "ui_Features_detection_plugin.h" using namespace CGAL::Three; -class Polyhedron_demo_features_detection_plugin : +class CGAL_Lab_features_detection_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionDetectFeatures; public: QList actions() const { return QList() << actionDetectFeatures; } @@ -40,13 +40,13 @@ public Q_SLOTS: void on_actionDetectFeatures_triggered(); private: Scene_interface* scene; -}; // end Polyhedron_demo_features_detection_plugin +}; // end CGAL_Lab_features_detection_plugin -class Polyhedron_demo_features_detection_dialog : public QDialog, private Ui::VCMFeaturesDetectionDialog +class CGAL_Lab_features_detection_dialog : public QDialog, private Ui::VCMFeaturesDetectionDialog { Q_OBJECT public: - Polyhedron_demo_features_detection_dialog(QWidget* /*parent*/ = nullptr) + CGAL_Lab_features_detection_dialog(QWidget* /*parent*/ = nullptr) { setupUi(this); } @@ -56,7 +56,7 @@ class Polyhedron_demo_features_detection_dialog : public QDialog, private Ui::VC float threshold() const { return m_inputFeaturesThreshold->value(); } }; -void Polyhedron_demo_features_detection_plugin::on_actionDetectFeatures_triggered() +void CGAL_Lab_features_detection_plugin::on_actionDetectFeatures_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -71,7 +71,7 @@ void Polyhedron_demo_features_detection_plugin::on_actionDetectFeatures_triggere return; // Gets options - Polyhedron_demo_features_detection_dialog dialog; + CGAL_Lab_features_detection_dialog dialog; if(!dialog.exec()) return; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Features_detection_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Features_detection_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Features_detection_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Merge_point_sets_plugin.cpp similarity index 84% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Merge_point_sets_plugin.cpp index 694ce765c3b..d59a237e5ed 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Merge_point_sets_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Merge_point_sets_plugin.cpp @@ -1,6 +1,6 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include +#include #include #include @@ -12,13 +12,13 @@ using namespace CGAL::Three; -class Polyhedron_demo_merge_point_sets_plugin : +class CGAL_Lab_merge_point_sets_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: QAction* actionMergePointSets; @@ -51,9 +51,9 @@ public Q_SLOTS: void on_actionMergePointSets_triggered(); private : Scene_interface *scene; -}; // end Polyhedron_demo_merge_point_sets_plugin +}; // end CGAL_Lab_merge_point_sets_plugin -void Polyhedron_demo_merge_point_sets_plugin::on_actionMergePointSets_triggered() +void CGAL_Lab_merge_point_sets_plugin::on_actionMergePointSets_triggered() { QApplication::setOverrideCursor(Qt::WaitCursor); CGAL::Three::Scene_interface::Item_id mainSelectionIndex diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_average_spacing_plugin.cpp similarity index 88% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_average_spacing_plugin.cpp index 78c0e2482d4..41c25a19447 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_average_spacing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_average_spacing_plugin.cpp @@ -2,8 +2,8 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -43,13 +43,13 @@ struct Compute_average_spacing_functor }; using namespace CGAL::Three; -class Polyhedron_demo_point_set_average_spacing_plugin : +class CGAL_Lab_point_set_average_spacing_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: QAction* actionAverageSpacing; @@ -76,9 +76,9 @@ public: public Q_SLOTS: void on_actionAverageSpacing_triggered(); -}; // end Polyhedron_demo_point_set_average_spacing_plugin +}; // end CGAL_Lab_point_set_average_spacing_plugin -void Polyhedron_demo_point_set_average_spacing_plugin::on_actionAverageSpacing_triggered() +void CGAL_Lab_point_set_average_spacing_plugin::on_actionAverageSpacing_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp similarity index 89% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp index 03f18810236..d52a38e2e19 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -49,13 +49,13 @@ struct Bilateral_smoothing_functor }; using namespace CGAL::Three; -class Polyhedron_demo_point_set_bilateral_smoothing_plugin : +class CGAL_Lab_point_set_bilateral_smoothing_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionBilateralSmoothing; @@ -80,7 +80,7 @@ public: public Q_SLOTS: void on_actionBilateralSmoothing_triggered(); -}; // end Polyhedron_demo_point_set_bilateral_smoothing_plugin +}; // end CGAL_Lab_point_set_bilateral_smoothing_plugin class Point_set_demo_point_set_bilateral_smoothing_dialog : public QDialog, private Ui::PointSetBilateralSmoothingDialog { @@ -96,7 +96,7 @@ class Point_set_demo_point_set_bilateral_smoothing_dialog : public QDialog, priv unsigned int sharpness_angle () const { return m_sharpnessAngle->value(); } }; -void Polyhedron_demo_point_set_bilateral_smoothing_plugin::on_actionBilateralSmoothing_triggered() +void CGAL_Lab_point_set_bilateral_smoothing_plugin::on_actionBilateralSmoothing_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_bilateral_smoothing_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_clustering_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_clustering_plugin.cpp index b998a35750e..d078763cc97 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_clustering_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_clustering_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -48,13 +48,13 @@ struct Clustering_functor using namespace CGAL::Three; -class Polyhedron_demo_point_set_clustering_plugin : +class CGAL_Lab_point_set_clustering_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionCluster; @@ -83,7 +83,7 @@ public Q_SLOTS: }; // end -void Polyhedron_demo_point_set_clustering_plugin::on_actionCluster_triggered() +void CGAL_Lab_point_set_clustering_plugin::on_actionCluster_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_interference_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_interference_plugin.cpp similarity index 92% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_interference_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_interference_plugin.cpp index f81e808381c..6ab2aa44ace 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_interference_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_interference_plugin.cpp @@ -2,7 +2,7 @@ #include "Scene_points_with_normal_item.h" //CGAL includes #include -#include +#include #include #include #include @@ -21,12 +21,12 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; class Point_set_interference_plugin: public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: bool applicable(QAction *) const diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp index 2f05e738308..f27dec9b488 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -90,13 +90,13 @@ struct Vector_to_pmap using namespace CGAL::Three; -class Polyhedron_demo_point_set_normal_estimation_plugin : +class CGAL_Lab_point_set_normal_estimation_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionNormalEstimation; QAction* actionNormalOrientation; @@ -171,7 +171,7 @@ class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::Norm }; -void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalInversion_triggered() +void CGAL_Lab_point_set_normal_estimation_plugin::on_actionNormalInversion_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -193,7 +193,7 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalInversio } } -void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimation_triggered() +void CGAL_Lab_point_set_normal_estimation_plugin::on_actionNormalEstimation_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -292,7 +292,7 @@ void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalEstimati } } -void Polyhedron_demo_point_set_normal_estimation_plugin::on_actionNormalOrientation_triggered() +void CGAL_Lab_point_set_normal_estimation_plugin::on_actionNormalOrientation_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_normal_estimation_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_normal_estimation_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp similarity index 89% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp index c18343a17a9..d1262d2448a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_outliers_removal_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -51,13 +51,13 @@ struct Outlier_removal_functor }; using namespace CGAL::Three; -class Polyhedron_demo_point_set_outliers_removal_plugin : +class CGAL_Lab_point_set_outliers_removal_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: QAction* actionOutlierRemoval; @@ -84,7 +84,7 @@ public: public Q_SLOTS: void on_actionOutlierRemoval_triggered(); -}; // end Polyhedron_demo_point_set_outliers_removal_plugin +}; // end CGAL_Lab_point_set_outliers_removal_plugin class Point_set_demo_outlier_removal_dialog : public QDialog, private Ui::OutlierRemovalDialog { @@ -101,7 +101,7 @@ class Point_set_demo_outlier_removal_dialog : public QDialog, private Ui::Outlie int nbNeighbors() const { return m_inputNbNeighbors->value(); } }; -void Polyhedron_demo_point_set_outliers_removal_plugin::on_actionOutlierRemoval_triggered() +void CGAL_Lab_point_set_outliers_removal_plugin::on_actionOutlierRemoval_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_outliers_removal_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_outliers_removal_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_outliers_removal_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_selection_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_selection_plugin.cpp index 9281c202af2..d0021dee701 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_selection_plugin.cpp @@ -16,7 +16,7 @@ #include "Scene_polylines_item.h" #include -#include +#include #include #include "ui_Point_set_selection_widget.h" #include @@ -540,13 +540,13 @@ public: }; -class Polyhedron_demo_point_set_selection_plugin : +class CGAL_Lab_point_set_selection_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: bool applicable(QAction*) const { return qobject_cast(scene->item(scene->mainSelectionIndex())); @@ -950,7 +950,7 @@ public Q_SLOTS: edit_box->setRenderingMode(Wireframe); edit_box->setName("Selection Box"); connect(edit_box, &Scene_edit_box_item::aboutToBeDestroyed, - this, &Polyhedron_demo_point_set_selection_plugin::reset_editbox); + this, &CGAL_Lab_point_set_selection_plugin::reset_editbox); scene->addItem(edit_box); for(CGAL::QGLViewer* v : CGAL::QGLViewer::QGLViewerPool()){ v->installEventFilter(edit_box); @@ -994,8 +994,8 @@ private: double rg_epsilon; double rg_cluster_epsilon; unsigned int rg_normal_threshold; -}; // end Polyhedron_demo_point_set_selection_plugin +}; // end CGAL_Lab_point_set_selection_plugin -//Q_EXPORT_PLUGIN2(Polyhedron_demo_point_set_selection_plugin, Polyhedron_demo_point_set_selection_plugin) +//Q_EXPORT_PLUGIN2(CGAL_Lab_point_set_selection_plugin, CGAL_Lab_point_set_selection_plugin) #include "Point_set_selection_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_selection_widget.ui similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_selection_widget.ui index ad54bab94ea..a7434b528b0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_widget.ui +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_selection_widget.ui @@ -47,7 +47,7 @@ - + :/cgal/icons/resources/pss_rectangle.png:/cgal/icons/resources/pss_rectangle.png @@ -76,7 +76,7 @@ - + :/cgal/icons/resources/pss_freeform.png:/cgal/icons/resources/pss_freeform.png @@ -99,7 +99,7 @@ - + :/cgal/icons/resources/pss_region.png:/cgal/icons/resources/pss_region.png @@ -125,7 +125,7 @@ - + :/cgal/icons/resources/pss_box.png:/cgal/icons/resources/pss_box.png @@ -169,7 +169,7 @@ - + :/cgal/icons/resources/pss_new.png:/cgal/icons/resources/pss_new.png @@ -198,7 +198,7 @@ - + :/cgal/icons/resources/pss_union.png:/cgal/icons/resources/pss_union.png @@ -224,7 +224,7 @@ - + :/cgal/icons/resources/pss_inter.png:/cgal/icons/resources/pss_inter.png @@ -250,7 +250,7 @@ - + :/cgal/icons/resources/pss_diff.png:/cgal/icons/resources/pss_diff.png @@ -283,7 +283,7 @@ - + :/cgal/icons/resources/help_button.png:/cgal/icons/resources/help_button.png @@ -329,10 +329,10 @@ - - - - + + + + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp index 5648125b774..1baaa63af33 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.cpp @@ -4,8 +4,8 @@ #include "Scene_surface_mesh_item.h" #include -#include -#include +#include +#include #include #include @@ -111,13 +111,13 @@ public: typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic_kernel; typedef Epic_kernel::Point_3 Point; using namespace CGAL::Three; -class Polyhedron_demo_point_set_shape_detection_plugin : +class CGAL_Lab_point_set_shape_detection_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionDetect; QAction* actionEstimateParameters; @@ -904,9 +904,9 @@ private: void build_alpha_shape (Point_set& points, std::shared_ptr plane, Scene_surface_mesh_item* sm_item, double epsilon); -}; // end Polyhedron_demo_point_set_shape_detection_plugin +}; // end CGAL_Lab_point_set_shape_detection_plugin -void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetectShapesSM_triggered() { +void CGAL_Lab_point_set_shape_detection_plugin::on_actionDetectShapesSM_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -952,7 +952,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetectShapesSM_t } } -void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered() { +void CGAL_Lab_point_set_shape_detection_plugin::on_actionDetect_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -996,7 +996,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::on_actionDetect_triggered } template -void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape +void CGAL_Lab_point_set_shape_detection_plugin::build_alpha_shape (Point_set& points, std::shared_ptr plane, Scene_surface_mesh_item* sm_item, double epsilon) { typedef Kernel::Point_2 Point_2; @@ -1058,7 +1058,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape delete soup_item; } -void Polyhedron_demo_point_set_shape_detection_plugin::on_actionEstimateParameters_triggered() { +void CGAL_Lab_point_set_shape_detection_plugin::on_actionEstimateParameters_triggered() { CGAL::Random rand(static_cast(time(nullptr))); const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_shape_detection_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_shape_detection_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_simplification_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_simplification_plugin.cpp index 05eb2d41493..b2c04168025 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_simplification_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -91,13 +91,13 @@ struct Hierarchy_simplify_functor }; using namespace CGAL::Three; -class Polyhedron_demo_point_set_simplification_plugin : +class CGAL_Lab_point_set_simplification_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionSimplify; @@ -124,7 +124,7 @@ public Q_SLOTS: void on_actionSimplify_triggered(); -}; // end Polyhedron_demo_point_set_simplification_plugin +}; // end CGAL_Lab_point_set_simplification_plugin class Point_set_demo_point_set_simplification_dialog : public QDialog, private Ui::PointSetSimplificationDialog { @@ -180,7 +180,7 @@ public Q_SLOTS: }; -void Polyhedron_demo_point_set_simplification_plugin::on_actionSimplify_triggered() +void CGAL_Lab_point_set_simplification_plugin::on_actionSimplify_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_simplification_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_simplification_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_simplification_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_smoothing_plugin.cpp similarity index 85% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_smoothing_plugin.cpp index 84f4b902a8b..cfab206f8f1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_smoothing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_smoothing_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -36,13 +36,13 @@ struct Jet_smoothing_functor }; using namespace CGAL::Three; -class Polyhedron_demo_point_set_smoothing_plugin : +class CGAL_Lab_point_set_smoothing_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionJetSmoothing; @@ -67,9 +67,9 @@ public: public Q_SLOTS: void on_actionJetSmoothing_triggered(); -}; // end Polyhedron_demo_point_set_smoothing_plugin +}; // end CGAL_Lab_point_set_smoothing_plugin -void Polyhedron_demo_point_set_smoothing_plugin::on_actionJetSmoothing_triggered() +void CGAL_Lab_point_set_smoothing_plugin::on_actionJetSmoothing_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp index ca915ab64cb..7cd98d08b0f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include @@ -120,11 +120,11 @@ public: class Point_set_to_mesh_distance_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: bool applicable(QAction*) const diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_widget.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_to_mesh_distance_widget.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_upsampling_plugin.cpp similarity index 90% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_upsampling_plugin.cpp index e50440ace3b..5b670819aac 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_upsampling_plugin.cpp @@ -1,8 +1,8 @@ #include "config.h" #include "Scene_points_with_normal_item.h" #include "Messages_interface.h" -#include -#include +#include +#include #include #include @@ -22,13 +22,13 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; using namespace CGAL::Three; -class Polyhedron_demo_point_set_upsampling_plugin : +class CGAL_Lab_point_set_upsampling_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionEdgeAwareUpsampling; Messages_interface* message_interface; @@ -53,7 +53,7 @@ public: public Q_SLOTS: void on_actionEdgeAwareUpsampling_triggered(); -}; // end Polyhedron_demo_point_set_upsampling_plugin +}; // end CGAL_Lab_point_set_upsampling_plugin class Point_set_demo_point_set_upsampling_dialog : public QDialog, private Ui::PointSetUpsamplingDialog { @@ -76,7 +76,7 @@ public: }; -void Polyhedron_demo_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_triggered() +void CGAL_Lab_point_set_upsampling_plugin::on_actionEdgeAwareUpsampling_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_upsampling_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_upsampling_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_upsampling_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Point_set_wlop_plugin.cpp similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Point_set_wlop_plugin.cpp index 519b4fff4ef..adbe8b3461c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Point_set_wlop_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #include #include @@ -70,13 +70,13 @@ struct Wlop_functor using namespace CGAL::Three; -class Polyhedron_demo_point_set_wlop_plugin : +class CGAL_Lab_point_set_wlop_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") QAction* actionSimplifyAndRegularize; @@ -101,7 +101,7 @@ public: public Q_SLOTS: void on_actionSimplifyAndRegularize_triggered(); -}; // end Polyhedron_demo_point_set_wlop_plugin +}; // end CGAL_Lab_point_set_wlop_plugin class Point_set_demo_point_set_wlop_simplification_and_regularization_dialog : public QDialog, private Ui::WLOPRegularizationAndSimplificationDialog { @@ -116,7 +116,7 @@ class Point_set_demo_point_set_wlop_simplification_and_regularization_dialog : p double neighborhoodRadius() const { return m_neighborhoodRadius->value(); } }; -void Polyhedron_demo_point_set_wlop_plugin::on_actionSimplifyAndRegularize_triggered() +void CGAL_Lab_point_set_wlop_plugin::on_actionSimplifyAndRegularize_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Point_set_wlop_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_wlop_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Point_set_wlop_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Register_point_sets_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Register_point_sets_plugin.cpp index 70f44f0c3dc..8ad7acc6fdc 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Register_point_sets_plugin.cpp @@ -1,7 +1,7 @@ #include "config.h" #include "Scene_points_with_normal_item.h" -#include -#include +#include +#include #ifdef CGAL_LINKED_WITH_OPENGR #define CGAL_OPENGR_VERBOSE @@ -93,13 +93,13 @@ private: -class Polyhedron_demo_register_point_sets_plugin : +class CGAL_Lab_register_point_sets_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: QAction* actionRegisterPointSets; @@ -140,9 +140,9 @@ public Q_SLOTS: void on_actionRegisterPointSets_triggered(); private : Scene_interface *scene; -}; // end Polyhedron_demo_register_point_sets_plugin +}; // end CGAL_Lab_register_point_sets_plugin -void Polyhedron_demo_register_point_sets_plugin::on_actionRegisterPointSets_triggered() +void CGAL_Lab_register_point_sets_plugin::on_actionRegisterPointSets_triggered() { std::vector items = get_point_set_items(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Register_point_sets_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Register_point_sets_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Register_point_sets_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_advancing_front_impl.cpp b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_advancing_front_impl.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_advancing_front_impl.cpp rename to Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_advancing_front_impl.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_plugin.cpp similarity index 89% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp rename to Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_plugin.cpp index 675c6e83fab..7edc769bf70 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_plugin.cpp @@ -11,8 +11,8 @@ #include "Scene_surface_mesh_item.h" #include "Scene_points_with_normal_item.h" #include "SMesh_type.h" -#include -#include +#include +#include #include @@ -55,11 +55,11 @@ SMesh* polygonal_reconstruct (const Point_set& points, double model_complexity, const QString& solver_name); -class Polyhedron_demo_surface_reconstruction_plugin_dialog : public QDialog, private Ui::SurfaceReconstructionDialog +class CGAL_Lab_surface_reconstruction_plugin_dialog : public QDialog, private Ui::SurfaceReconstructionDialog { Q_OBJECT public: - Polyhedron_demo_surface_reconstruction_plugin_dialog(QWidget* /*parent*/ = nullptr) + CGAL_Lab_surface_reconstruction_plugin_dialog(QWidget* /*parent*/ = nullptr) { setupUi(this); #if !defined(CGAL_USE_GLPK) && !defined(CGAL_USE_SCIP) @@ -140,14 +140,14 @@ public: }; -class Polyhedron_demo_surface_reconstruction_plugin : +class CGAL_Lab_surface_reconstruction_plugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper + public CGAL::Three::CGAL_Lab_plugin_helper { Q_OBJECT - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) QAction* actionSurfaceReconstruction; public: @@ -160,10 +160,10 @@ public: } - void advancing_front_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog); - void scale_space_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog); - void poisson_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog); - void polygonal_reconstruction (const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog); + void advancing_front_reconstruction (const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog); + void scale_space_reconstruction (const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog); + void poisson_reconstruction (const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog); + void polygonal_reconstruction (const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog); //! Applicate for Point_sets with normals. bool applicable(QAction*) const { @@ -181,7 +181,7 @@ public Q_SLOTS: }; // end class Polyhedron_surface_reconstruction_plugin -void Polyhedron_demo_surface_reconstruction_plugin::on_actionSurfaceReconstruction_triggered() +void CGAL_Lab_surface_reconstruction_plugin::on_actionSurfaceReconstruction_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -191,7 +191,7 @@ void Polyhedron_demo_surface_reconstruction_plugin::on_actionSurfaceReconstructi if(pts_item) { //generate the dialog box to set the options - Polyhedron_demo_surface_reconstruction_plugin_dialog dialog; + CGAL_Lab_surface_reconstruction_plugin_dialog dialog; dialog.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); if (!pts_item->point_set()->has_normal_map()) @@ -234,8 +234,8 @@ void Polyhedron_demo_surface_reconstruction_plugin::on_actionSurfaceReconstructi } } -void Polyhedron_demo_surface_reconstruction_plugin::advancing_front_reconstruction -(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog) +void CGAL_Lab_surface_reconstruction_plugin::advancing_front_reconstruction +(const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog) { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -278,8 +278,8 @@ void Polyhedron_demo_surface_reconstruction_plugin::advancing_front_reconstructi } -void Polyhedron_demo_surface_reconstruction_plugin::scale_space_reconstruction -(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog) +void CGAL_Lab_surface_reconstruction_plugin::scale_space_reconstruction +(const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog) { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -353,8 +353,8 @@ void Polyhedron_demo_surface_reconstruction_plugin::scale_space_reconstruction } -void Polyhedron_demo_surface_reconstruction_plugin::poisson_reconstruction -(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog) +void CGAL_Lab_surface_reconstruction_plugin::poisson_reconstruction +(const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog) { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); @@ -399,8 +399,8 @@ void Polyhedron_demo_surface_reconstruction_plugin::poisson_reconstruction } } -void Polyhedron_demo_surface_reconstruction_plugin::polygonal_reconstruction -(const Polyhedron_demo_surface_reconstruction_plugin_dialog& dialog) +void CGAL_Lab_surface_reconstruction_plugin::polygonal_reconstruction +(const CGAL_Lab_surface_reconstruction_plugin_dialog& dialog) { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_plugin.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.ui rename to Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_plugin.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp rename to Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_poisson_impl.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_polygonal_impl.cpp b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_polygonal_impl.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_polygonal_impl.cpp rename to Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_polygonal_impl.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp b/Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp rename to Lab/demo/Lab/Plugins/Point_set/Surface_reconstruction_scale_space_impl.cpp diff --git a/Lab/demo/Lab/Plugins/Subdivision_methods/CMakeLists.txt b/Lab/demo/Lab/Plugins/Subdivision_methods/CMakeLists.txt new file mode 100644 index 00000000000..d157fa270f8 --- /dev/null +++ b/Lab/demo/Lab/Plugins/Subdivision_methods/CMakeLists.txt @@ -0,0 +1,4 @@ +include(cgallab_macros) + +cgal_lab_plugin(subdivision_methods_plugin Subdivision_methods_plugin) +target_link_libraries(subdivision_methods_plugin PUBLIC scene_surface_mesh_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp b/Lab/demo/Lab/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp similarity index 86% rename from Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp rename to Lab/demo/Lab/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp index 9b1ff600672..8ec139d0558 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Subdivision_methods/Subdivision_methods_plugin.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include #include #include "Messages_interface.h" @@ -16,15 +16,15 @@ using namespace CGAL::Three; namespace params = CGAL::parameters; -class Polyhedron_demo_subdivision_methods_plugin : +class CGAL_Lab_subdivision_methods_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: - // used by Polyhedron_demo_plugin_helper + // used by CGAL_Lab_plugin_helper QList actions() const { return _actions; } @@ -74,11 +74,11 @@ private : void apply_sqrt3(FaceGraphItem* item, int nb_steps); template void apply_doosabin(FaceGraphItem* item, int nb_steps); -}; // end Polyhedron_demo_subdivision_methods_plugin +}; // end CGAL_Lab_subdivision_methods_plugin template -void Polyhedron_demo_subdivision_methods_plugin::apply_loop(FaceGraphItem* item, int nb_steps) +void CGAL_Lab_subdivision_methods_plugin::apply_loop(FaceGraphItem* item, int nb_steps) { typename FaceGraphItem::Face_graph* graph = item->face_graph(); QElapsedTimer time; @@ -92,7 +92,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_loop(FaceGraphItem* item, scene->itemChanged(item); } -void Polyhedron_demo_subdivision_methods_plugin::on_actionLoop_triggered() +void CGAL_Lab_subdivision_methods_plugin::on_actionLoop_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); @@ -112,7 +112,7 @@ void Polyhedron_demo_subdivision_methods_plugin::on_actionLoop_triggered() } template -void Polyhedron_demo_subdivision_methods_plugin::apply_catmullclark(FaceGraphItem* item, int nb_steps) +void CGAL_Lab_subdivision_methods_plugin::apply_catmullclark(FaceGraphItem* item, int nb_steps) { typename FaceGraphItem::Face_graph* graph = item->face_graph(); if(!graph) return; @@ -127,7 +127,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_catmullclark(FaceGraphIte scene->itemChanged(item); } -void Polyhedron_demo_subdivision_methods_plugin::on_actionCatmullClark_triggered() +void CGAL_Lab_subdivision_methods_plugin::on_actionCatmullClark_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); @@ -147,7 +147,7 @@ void Polyhedron_demo_subdivision_methods_plugin::on_actionCatmullClark_triggered } template -void Polyhedron_demo_subdivision_methods_plugin::apply_sqrt3(FaceGraphItem* item, int nb_steps) +void CGAL_Lab_subdivision_methods_plugin::apply_sqrt3(FaceGraphItem* item, int nb_steps) { typename FaceGraphItem::Face_graph* graph = item->face_graph(); if(!graph) return; @@ -162,7 +162,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_sqrt3(FaceGraphItem* item scene->itemChanged(item); } -void Polyhedron_demo_subdivision_methods_plugin::on_actionSqrt3_triggered() +void CGAL_Lab_subdivision_methods_plugin::on_actionSqrt3_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); @@ -183,7 +183,7 @@ void Polyhedron_demo_subdivision_methods_plugin::on_actionSqrt3_triggered() } template -void Polyhedron_demo_subdivision_methods_plugin::apply_doosabin(FaceGraphItem* item, int nb_steps) +void CGAL_Lab_subdivision_methods_plugin::apply_doosabin(FaceGraphItem* item, int nb_steps) { typename FaceGraphItem::Face_graph* graph = item->face_graph(); if(!graph) return; @@ -198,7 +198,7 @@ void Polyhedron_demo_subdivision_methods_plugin::apply_doosabin(FaceGraphItem* i scene->itemChanged(item); } -void Polyhedron_demo_subdivision_methods_plugin::on_actionDooSabin_triggered() +void CGAL_Lab_subdivision_methods_plugin::on_actionDooSabin_triggered() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Lab/demo/Lab/Plugins/Surface_mesh/CMakeLists.txt similarity index 84% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Surface_mesh/CMakeLists.txt index ff5ea5c442f..c1d42328697 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Surface_mesh/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) @@ -8,7 +8,7 @@ if(NOT CGAL_DISABLE_GMP) find_package(CGAL REQUIRED COMPONENTS Core) qt6_wrap_ui(parameterizationUI_FILES Parameterization_widget.ui OTE_dialog.ui) - polyhedron_demo_plugin(parameterization_plugin Parameterization_plugin + cgal_lab_plugin(parameterization_plugin Parameterization_plugin ${parameterizationUI_FILES}) target_link_libraries( parameterization_plugin PUBLIC scene_surface_mesh_item scene_textured_item @@ -25,7 +25,7 @@ if(NOT CGAL_DISABLE_GMP) endif() qt6_wrap_ui(segmentationUI_FILES Mesh_segmentation_widget.ui) - polyhedron_demo_plugin(mesh_segmentation_plugin Mesh_segmentation_plugin + cgal_lab_plugin(mesh_segmentation_plugin Mesh_segmentation_plugin ${segmentationUI_FILES}) target_link_libraries(mesh_segmentation_plugin PUBLIC scene_surface_mesh_item) @@ -36,18 +36,18 @@ if(NOT CGAL_DISABLE_GMP) endif() qt6_wrap_ui( mesh_simplificationUI_FILES Mesh_simplification_dialog.ui) - polyhedron_demo_plugin(mesh_simplification_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) + cgal_lab_plugin(mesh_simplification_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES}) target_link_libraries(mesh_simplification_plugin PUBLIC scene_surface_mesh_item scene_selection_item) qt6_wrap_ui(shortestPathUI_FILES Shortest_path_widget.ui) - polyhedron_demo_plugin(shortest_path_plugin Shortest_path_plugin + cgal_lab_plugin(shortest_path_plugin Shortest_path_plugin ${shortestPathUI_FILES}) target_link_libraries( shortest_path_plugin PUBLIC scene_surface_mesh_item scene_shortest_path_item scene_basic_objects) qt6_wrap_ui(basicUI_FILES Surface_mesh_approximation_dockwidget.ui) - polyhedron_demo_plugin( + cgal_lab_plugin( surface_mesh_approximation_plugin Surface_mesh_approximation_plugin ${basicUI_FILES} VSA_wrapper.cpp) target_link_libraries( diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp index f4c70653e01..82603e4aca6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Mesh_segmentation_plugin.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "ui_Mesh_segmentation_widget.h" #include "Scene_surface_mesh_item.h" @@ -53,13 +53,13 @@ private: }; using namespace CGAL::Three; -class Polyhedron_demo_mesh_segmentation_plugin : +class CGAL_Lab_mesh_segmentation_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: typedef std::map > SM_item_sdf_map; @@ -139,7 +139,7 @@ private: } }; -void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_sdf() +void CGAL_Lab_mesh_segmentation_plugin::init_color_map_sdf() { color_map_sdf = std::vector(256); int r = 0, g = 0, b = 255; @@ -153,7 +153,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_sdf() } } -void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_segmentation() +void CGAL_Lab_mesh_segmentation_plugin::init_color_map_segmentation() { color_map_segmentation.push_back(QColor( 173, 35, 35)); @@ -173,18 +173,18 @@ void Polyhedron_demo_mesh_segmentation_plugin::init_color_map_segmentation() } -void Polyhedron_demo_mesh_segmentation_plugin::itemAboutToBeDestroyed(CGAL::Three::Scene_item* scene_item) +void CGAL_Lab_mesh_segmentation_plugin::itemAboutToBeDestroyed(CGAL::Three::Scene_item* scene_item) { if(Scene_surface_mesh_item* sm_item = qobject_cast(scene_item)) { sm_item_sdf_map.erase(sm_item); } } -void Polyhedron_demo_mesh_segmentation_plugin::on_actionSegmentation_triggered() +void CGAL_Lab_mesh_segmentation_plugin::on_actionSegmentation_triggered() { dock_widget->show(); dock_widget->raise();} template -void Polyhedron_demo_mesh_segmentation_plugin::apply_SDF_button_clicked(FacegraphItem* item) +void CGAL_Lab_mesh_segmentation_plugin::apply_SDF_button_clicked(FacegraphItem* item) { typedef typename FacegraphItem::Face_graph Facegraph; QApplication::setOverrideCursor(Qt::WaitCursor); @@ -235,7 +235,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::apply_SDF_button_clicked(Facegrap } QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mesh_segmentation_plugin::on_SDF_button_clicked() +void CGAL_Lab_mesh_segmentation_plugin::on_SDF_button_clicked() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); @@ -244,7 +244,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::on_SDF_button_clicked() } template -void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(FacegraphItem* item) +void CGAL_Lab_mesh_segmentation_plugin::apply_Partition_button_clicked(FacegraphItem* item) { typedef typename FacegraphItem::Face_graph Facegraph; @@ -343,7 +343,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::apply_Partition_button_clicked(Fa QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_mesh_segmentation_plugin::on_Partition_button_clicked() +void CGAL_Lab_mesh_segmentation_plugin::on_Partition_button_clicked() { CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_surface_mesh_item* sm_item = qobject_cast(scene->item(index)); @@ -352,7 +352,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::on_Partition_button_clicked() } template -void Polyhedron_demo_mesh_segmentation_plugin::colorize_sdf( +void CGAL_Lab_mesh_segmentation_plugin::colorize_sdf( SceneFacegraphItem* item, SDFPropertyMap sdf_values, std::vector& color_vector) @@ -384,7 +384,7 @@ void Polyhedron_demo_mesh_segmentation_plugin::colorize_sdf( template -void Polyhedron_demo_mesh_segmentation_plugin::colorize_segmentation( +void CGAL_Lab_mesh_segmentation_plugin::colorize_segmentation( SceneFacegraphItem* item, SegmentPropertyMap segment_ids, std::vector& color_vector) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui b/Lab/demo/Lab/Plugins/Surface_mesh/Mesh_segmentation_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_segmentation_widget.ui rename to Lab/demo/Lab/Plugins/Surface_mesh/Mesh_segmentation_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_dialog.ui b/Lab/demo/Lab/Plugins/Surface_mesh/Mesh_simplification_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_dialog.ui rename to Lab/demo/Lab/Plugins/Surface_mesh/Mesh_simplification_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp similarity index 94% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp index 31f46ffc2fb..c01293a01c6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Mesh_simplification_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include "Scene_surface_mesh_item.h" #include "Scene_polyhedron_selection_item.h" @@ -55,13 +55,13 @@ public: using namespace CGAL::Three; -class Polyhedron_demo_mesh_simplification_plugin : +class CGAL_Lab_mesh_simplification_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: @@ -93,9 +93,9 @@ private : QMainWindow *mw; QList _actions; -}; // end Polyhedron_demo_mesh_simplification_plugin +}; // end CGAL_Lab_mesh_simplification_plugin -void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered() +void CGAL_Lab_mesh_simplification_plugin::on_actionSimplify_triggered() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/OTE_dialog.ui b/Lab/demo/Lab/Plugins/Surface_mesh/OTE_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/OTE_dialog.ui rename to Lab/demo/Lab/Plugins/Surface_mesh/OTE_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp similarity index 97% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index eb9be7db96e..11e779948e8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -1,6 +1,6 @@ #include "config.h" -#ifdef CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER -#include +#ifdef CGAL_LAB_DEMO_USE_SURFACE_MESHER +#include #include "ui_Remeshing_dialog.h" #include @@ -403,13 +403,13 @@ Q_SIGNALS: }; using namespace CGAL::Three; -class Polyhedron_demo_offset_meshing_plugin : +class CGAL_Lab_offset_meshing_plugin : public QObject, - protected Polyhedron_demo_plugin_interface + protected CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: void init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { @@ -459,9 +459,9 @@ private: QAction* actionInflateMesh; Scene_interface *scene; QMainWindow *mw; -}; // end class Polyhedron_demo_offset_meshing_plugin +}; // end class CGAL_Lab_offset_meshing_plugin -void Polyhedron_demo_offset_meshing_plugin::inflate_mesh() +void CGAL_Lab_offset_meshing_plugin::inflate_mesh() { const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); Scene_item* item = scene->item(index); @@ -504,7 +504,7 @@ void Polyhedron_demo_offset_meshing_plugin::inflate_mesh() sm_item->invalidateOpenGLBuffers(); } -void Polyhedron_demo_offset_meshing_plugin::offset_meshing() +void CGAL_Lab_offset_meshing_plugin::offset_meshing() { Scene_surface_mesh_item* sm_item = nullptr; Scene_polygon_soup_item* soup_item = nullptr; @@ -688,4 +688,4 @@ void Polyhedron_demo_offset_meshing_plugin::offset_meshing() #include "Offset_meshing_plugin.moc" -#endif // CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER +#endif // CGAL_LAB_DEMO_USE_SURFACE_MESHER diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_plugin.cpp similarity index 96% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_plugin.cpp index fc3ab82204f..d9ec9149133 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_plugin.cpp @@ -7,8 +7,8 @@ #include "Scene_textured_surface_mesh_item.h" #include "Scene_polyhedron_selection_item.h" #include "SMesh_type.h" -#include -#include +#include +#include #include #include "Scene.h" #include @@ -308,22 +308,22 @@ private: using namespace CGAL::Three; -class Polyhedron_demo_parameterization_plugin : +class CGAL_Lab_parameterization_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: - // used by Polyhedron_demo_plugin_helper + // used by CGAL_Lab_plugin_helper QList actions() const { return _actions; } - ~Polyhedron_demo_parameterization_plugin() + ~CGAL_Lab_parameterization_plugin() { delete navigation; } @@ -381,8 +381,8 @@ public: ui_widget.graphicsView->installEventFilter(navigation); ui_widget.graphicsView->viewport()->installEventFilter(navigation); ui_widget.component_numberLabel->setText("Component : 1"); - connect(ui_widget.prevButton, &QPushButton::clicked, this, &Polyhedron_demo_parameterization_plugin::on_prevButton_pressed); - connect(ui_widget.nextButton, &QPushButton::clicked, this, &Polyhedron_demo_parameterization_plugin::on_nextButton_pressed); + connect(ui_widget.prevButton, &QPushButton::clicked, this, &CGAL_Lab_parameterization_plugin::on_prevButton_pressed); + connect(ui_widget.nextButton, &QPushButton::clicked, this, &CGAL_Lab_parameterization_plugin::on_nextButton_pressed); addDockWidget(dock_widget); dock_widget->setVisible(false); current_uv_item = nullptr; @@ -501,9 +501,9 @@ private: Navigation* navigation = nullptr; QMap projections; UVItem* current_uv_item = nullptr; -}; // end Polyhedron_demo_parameterization_plugin +}; // end CGAL_Lab_parameterization_plugin -void Polyhedron_demo_parameterization_plugin::on_prevButton_pressed() +void CGAL_Lab_parameterization_plugin::on_prevButton_pressed() { int id = scene->mainSelectionIndex(); for(UVItem* pl : projections) @@ -521,7 +521,7 @@ void Polyhedron_demo_parameterization_plugin::on_prevButton_pressed() replacePolyline(); } -void Polyhedron_demo_parameterization_plugin::on_nextButton_pressed() +void CGAL_Lab_parameterization_plugin::on_nextButton_pressed() { int id = scene->mainSelectionIndex(); for(UVItem* pl : projections) @@ -540,7 +540,7 @@ void Polyhedron_demo_parameterization_plugin::on_nextButton_pressed() replacePolyline(); } -void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterization_method method) +void CGAL_Lab_parameterization_plugin::parameterize(const Parameterization_method method) { // get active polyhedron Scene_facegraph_item* poly_item = nullptr; @@ -1002,49 +1002,49 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio } -void Polyhedron_demo_parameterization_plugin::on_actionMVC_triggered() +void CGAL_Lab_parameterization_plugin::on_actionMVC_triggered() { std::cerr << "MVC..."; parameterize(PARAM_MVC); } -void Polyhedron_demo_parameterization_plugin::on_actionDCP_triggered() +void CGAL_Lab_parameterization_plugin::on_actionDCP_triggered() { std::cerr << "DCP..."; parameterize(PARAM_DCP); } -void Polyhedron_demo_parameterization_plugin::on_actionLSC_triggered() +void CGAL_Lab_parameterization_plugin::on_actionLSC_triggered() { std::cerr << "LSC..."; parameterize(PARAM_LSC); } -void Polyhedron_demo_parameterization_plugin::on_actionDAP_triggered() +void CGAL_Lab_parameterization_plugin::on_actionDAP_triggered() { std::cerr << "DAP..."; parameterize(PARAM_DAP); } -void Polyhedron_demo_parameterization_plugin::on_actionIAP_triggered() +void CGAL_Lab_parameterization_plugin::on_actionIAP_triggered() { std::cerr << "IAP..."; parameterize(PARAM_IAP); } -void Polyhedron_demo_parameterization_plugin::on_actionARAP_triggered() +void CGAL_Lab_parameterization_plugin::on_actionARAP_triggered() { std::cerr << "ARAP..."; parameterize(PARAM_ARAP); } -void Polyhedron_demo_parameterization_plugin::on_actionOTE_triggered() +void CGAL_Lab_parameterization_plugin::on_actionOTE_triggered() { std::cerr << "OTE..."; parameterize(PARAM_OTE); } -void Polyhedron_demo_parameterization_plugin::on_actionBTP_triggered() +void CGAL_Lab_parameterization_plugin::on_actionBTP_triggered() { std::cerr << "BTP..."; parameterize(PARAM_BTP); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_widget.ui b/Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_widget.ui similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_widget.ui rename to Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_widget.ui index 07c61cca041..f874ecaec16 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_widget.ui +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Parameterization_widget.ui @@ -48,7 +48,7 @@ - + :/cgal/icons/resources/left_arrow.png:/cgal/icons/resources/left_arrow.png @@ -69,7 +69,7 @@ - + :/cgal/icons/resources/right_arrow.png:/cgal/icons/resources/right_arrow.png @@ -80,7 +80,7 @@ - + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h similarity index 98% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h rename to Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h index f9af8a8cfec..91962532d80 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Scene_polyhedron_shortest_path_item.h @@ -35,7 +35,7 @@ class SCENE_POLYHEDRON_SHORTEST_PATH_ITEM_EXPORT Scene_polyhedron_shortest_path_ { Q_OBJECT - friend class Polyhedron_demo_shortest_path_plugin; + friend class CGAL_Lab_shortest_path_plugin; public: typedef CGAL::Three::Scene_interface::Bbox Bbox; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Shortest_path_plugin.cpp similarity index 89% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Shortest_path_plugin.cpp index d6be0d38c6a..7b284766640 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Shortest_path_plugin.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -26,13 +26,13 @@ typedef Scene_surface_mesh_item Scene_facegraph_item; typedef Scene_facegraph_item::Face_graph FaceGraph; using namespace CGAL::Three; -class Polyhedron_demo_shortest_path_plugin : +class CGAL_Lab_shortest_path_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") private: typedef boost::property_map::type VertexIndexMap; @@ -137,17 +137,17 @@ private: Ui::Shortest_path ui_widget; }; -Scene_polyhedron_shortest_path_item::Selection_mode Polyhedron_demo_shortest_path_plugin::get_selection_mode() const +Scene_polyhedron_shortest_path_item::Selection_mode CGAL_Lab_shortest_path_plugin::get_selection_mode() const { return (Scene_polyhedron_shortest_path_item::Selection_mode) ui_widget.Selection_type_combo_box->currentIndex(); } -Scene_polyhedron_shortest_path_item::Primitives_mode Polyhedron_demo_shortest_path_plugin::get_primitives_mode() const +Scene_polyhedron_shortest_path_item::Primitives_mode CGAL_Lab_shortest_path_plugin::get_primitives_mode() const { return (Scene_polyhedron_shortest_path_item::Primitives_mode) ui_widget.Primitives_type_combo_box->currentIndex(); } -void Polyhedron_demo_shortest_path_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* sceneItem) +void CGAL_Lab_shortest_path_plugin::item_about_to_be_destroyed(CGAL::Three::Scene_item* sceneItem) { // if polyhedron item Scene_facegraph_item* polyhedronItem = qobject_cast(sceneItem); @@ -177,7 +177,7 @@ void Polyhedron_demo_shortest_path_plugin::item_about_to_be_destroyed(CGAL::Thre } } -void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex) +void CGAL_Lab_shortest_path_plugin::new_item(int itemIndex) { Scene_polyhedron_shortest_path_item* item = qobject_cast(scene->item(itemIndex)); @@ -230,7 +230,7 @@ void Polyhedron_demo_shortest_path_plugin::new_item(int itemIndex) m_shortestPathsMap.insert(std::make_pair(item->polyhedron_item(), item)); } -void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered() +void CGAL_Lab_shortest_path_plugin::on_actionMakeShortestPaths_triggered() { Scene_facegraph_item* polyhedronItem = getSelectedItem(); if (polyhedronItem) @@ -258,7 +258,7 @@ void Polyhedron_demo_shortest_path_plugin::on_actionMakeShortestPaths_triggered( } } -void Polyhedron_demo_shortest_path_plugin::on_Selection_type_combo_box_changed(int index) +void CGAL_Lab_shortest_path_plugin::on_Selection_type_combo_box_changed(int index) { std::cout << "Selection mode changed: " << index << std::endl; @@ -268,7 +268,7 @@ void Polyhedron_demo_shortest_path_plugin::on_Selection_type_combo_box_changed(i } } -void Polyhedron_demo_shortest_path_plugin::on_Primitives_type_combo_box_changed(int index) +void CGAL_Lab_shortest_path_plugin::on_Primitives_type_combo_box_changed(int index) { std::cout << "Primitives mode changed: " << index << std::endl; @@ -278,7 +278,7 @@ void Polyhedron_demo_shortest_path_plugin::on_Primitives_type_combo_box_changed( } } -void Polyhedron_demo_shortest_path_plugin::check_and_set_ids(FaceGraph* polyhedron) +void CGAL_Lab_shortest_path_plugin::check_and_set_ids(FaceGraph* polyhedron) { typedef boost::graph_traits::vertex_iterator vertex_iterator; typedef boost::graph_traits::halfedge_iterator halfedge_iterator; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui b/Lab/demo/Lab/Plugins/Surface_mesh/Shortest_path_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Shortest_path_widget.ui rename to Lab/demo/Lab/Plugins/Surface_mesh/Shortest_path_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_dockwidget.ui b/Lab/demo/Lab/Plugins/Surface_mesh/Surface_mesh_approximation_dockwidget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_dockwidget.ui rename to Lab/demo/Lab/Plugins/Surface_mesh/Surface_mesh_approximation_dockwidget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp index d0714d3f41b..47fe1125b89 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp @@ -13,8 +13,8 @@ #include "Messages_interface.h" #include -#include -#include +#include +#include #include #include @@ -28,13 +28,13 @@ using namespace CGAL::Three; -class Polyhedron_demo_surface_mesh_approximation_plugin : +class CGAL_Lab_surface_mesh_approximation_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") typedef boost::property_map >::type Face_id_map; struct Patch_id_pmap @@ -63,7 +63,7 @@ class Polyhedron_demo_surface_mesh_approximation_plugin : typedef std::pair SM_wrapper_pair; public: - Polyhedron_demo_surface_mesh_approximation_plugin() { + CGAL_Lab_surface_mesh_approximation_plugin() { std::srand(time(nullptr)); } @@ -281,12 +281,12 @@ private: Messages_interface *mi; SM_wrapper_map m_sm_wrapper_map; -}; // end Polyhedron_demo_surface_mesh_approximation_plugin +}; // end CGAL_Lab_surface_mesh_approximation_plugin -void Polyhedron_demo_surface_mesh_approximation_plugin::on_actionSurfaceMeshApproximation_triggered() +void CGAL_Lab_surface_mesh_approximation_plugin::on_actionSurfaceMeshApproximation_triggered() { dock_widget->show(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonSeeding_clicked() { +void CGAL_Lab_surface_mesh_approximation_plugin::on_buttonSeeding_clicked() { const Scene_interface::Item_id sm_id = scene->mainSelectionIndex(); Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(sm_id)); @@ -356,7 +356,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonSeeding_clicked QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonFit_clicked() { +void CGAL_Lab_surface_mesh_approximation_plugin::on_buttonFit_clicked() { Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(scene->mainSelectionIndex())); if (!sm_item) { @@ -403,7 +403,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonFit_clicked() { QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonAdd_clicked() { +void CGAL_Lab_surface_mesh_approximation_plugin::on_buttonAdd_clicked() { Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(scene->mainSelectionIndex())); if (!sm_item) { @@ -454,7 +454,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonAdd_clicked() { QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonTeleport_clicked() { +void CGAL_Lab_surface_mesh_approximation_plugin::on_buttonTeleport_clicked() { Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(scene->mainSelectionIndex())); if (!sm_item) { @@ -505,7 +505,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonTeleport_clicke QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonSplit_clicked() { +void CGAL_Lab_surface_mesh_approximation_plugin::on_buttonSplit_clicked() { Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(scene->mainSelectionIndex())); if (!sm_item) { @@ -558,7 +558,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonSplit_clicked() QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonMeshing_clicked() { +void CGAL_Lab_surface_mesh_approximation_plugin::on_buttonMeshing_clicked() { Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(scene->mainSelectionIndex())); if (!sm_item) { @@ -627,7 +627,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_buttonMeshing_clicked QApplication::restoreOverrideCursor(); } -void Polyhedron_demo_surface_mesh_approximation_plugin::on_comboMetric_currentIndexChanged(const int) { +void CGAL_Lab_surface_mesh_approximation_plugin::on_comboMetric_currentIndexChanged(const int) { Scene_surface_mesh_item *sm_item = qobject_cast( scene->item(scene->mainSelectionIndex())); if (!sm_item) { @@ -645,7 +645,7 @@ void Polyhedron_demo_surface_mesh_approximation_plugin::on_comboMetric_currentIn scene->itemChanged(scene->item_id(sm_item)); } -void Polyhedron_demo_surface_mesh_approximation_plugin::itemAboutToBeDestroyed(CGAL::Three::Scene_item *scene_item) +void CGAL_Lab_surface_mesh_approximation_plugin::itemAboutToBeDestroyed(CGAL::Three::Scene_item *scene_item) { if (Scene_surface_mesh_item *sm_item = qobject_cast(scene_item)) { SM_wrapper_map::iterator search = m_sm_wrapper_map.find(sm_item); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h b/Lab/demo/Lab/Plugins/Surface_mesh/UVProjector.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h rename to Lab/demo/Lab/Plugins/Surface_mesh/UVProjector.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp b/Lab/demo/Lab/Plugins/Surface_mesh/VSA_wrapper.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh/VSA_wrapper.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h b/Lab/demo/Lab/Plugins/Surface_mesh/VSA_wrapper.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/VSA_wrapper.h rename to Lab/demo/Lab/Plugins/Surface_mesh/VSA_wrapper.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/CMakeLists.txt similarity index 88% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Surface_mesh_deformation/CMakeLists.txt index 2a90c0efba9..ff58d6aaac0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) if(TARGET CGAL::Eigen3_support AND "${EIGEN3_VERSION}" VERSION_GREATER "3.1.90") @@ -10,7 +10,7 @@ if(TARGET CGAL::Eigen3_support AND "${EIGEN3_VERSION}" VERSION_GREATER "3.1.90") scene_edit_item PUBLIC CGAL::Eigen3_support scene_surface_mesh_item scene_k_ring_selection scene_basic_objects) - polyhedron_demo_plugin(edit_plugin Edit_polyhedron_plugin Deform_mesh.ui) + cgal_lab_plugin(edit_plugin Edit_polyhedron_plugin Deform_mesh.ui) target_link_libraries(edit_plugin PUBLIC scene_surface_mesh_item scene_edit_item scene_selection_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Deform_mesh.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Deform_mesh.ui rename to Lab/demo/Lab/Plugins/Surface_mesh_deformation/Deform_mesh.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp similarity index 86% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp index 9f1c6b3ffb9..c83ba2b196d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Edit_polyhedron_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "Scene_surface_mesh_item.h" @@ -17,19 +17,19 @@ typedef Scene_surface_mesh_item Scene_facegraph_item; using namespace CGAL::Three; -class Polyhedron_demo_edit_polyhedron_plugin : +class CGAL_Lab_edit_cgal_lab_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: - Polyhedron_demo_edit_polyhedron_plugin() - : Polyhedron_demo_plugin_helper(), dock_widget(nullptr) + CGAL_Lab_edit_cgal_lab_plugin() + : CGAL_Lab_plugin_helper(), dock_widget(nullptr) { } - ~Polyhedron_demo_edit_polyhedron_plugin() + ~CGAL_Lab_edit_cgal_lab_plugin() { delete e_shortcut; } @@ -84,12 +84,12 @@ private: QAction* actionDeformation = nullptr; RenderingMode last_RM; QShortcut* e_shortcut = nullptr; -}; // end Polyhedron_demo_edit_polyhedron_plugin +}; // end CGAL_Lab_edit_cgal_lab_plugin -QList Polyhedron_demo_edit_polyhedron_plugin::actions() const { +QList CGAL_Lab_edit_cgal_lab_plugin::actions() const { return QList() << actionDeformation; } -bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { +bool CGAL_Lab_edit_cgal_lab_plugin::applicable(QAction*) const { for(CGAL::Three::Scene_interface::Item_id i : scene->selectionIndices()) { if(qobject_cast(scene->item(i))) @@ -105,7 +105,7 @@ bool Polyhedron_demo_edit_polyhedron_plugin::applicable(QAction*) const { return false; } -void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) +void CGAL_Lab_edit_cgal_lab_plugin::init(QMainWindow* mainWindow, CGAL::Three::Scene_interface* scene_interface, Messages_interface*) { mw = mainWindow; scene = scene_interface; @@ -117,8 +117,8 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL: actionDeformation->setShortcutContext(Qt::ApplicationShortcut); autoConnectActions(); e_shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_E), mw); - connect(e_shortcut, &QShortcut::activated, this, &Polyhedron_demo_edit_polyhedron_plugin::dispatchAction); - connect(e_shortcut, &QShortcut::activatedAmbiguously, this, &Polyhedron_demo_edit_polyhedron_plugin::dispatchAction); + connect(e_shortcut, &QShortcut::activated, this, &CGAL_Lab_edit_cgal_lab_plugin::dispatchAction); + connect(e_shortcut, &QShortcut::activatedAmbiguously, this, &CGAL_Lab_edit_cgal_lab_plugin::dispatchAction); // Connect Scene::newItem so that, if dock_widget is visible, convert // automatically polyhedron items to "edit polyhedron" items. @@ -164,7 +164,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::init(QMainWindow* mainWindow, CGAL: /////////////////////////////////////////////////////////////////// } -void Polyhedron_demo_edit_polyhedron_plugin::on_actionDeformation_triggered() +void CGAL_Lab_edit_cgal_lab_plugin::on_actionDeformation_triggered() { // dock widget should be constructed in init() if(dock_widget->isVisible()) { dock_widget->hide(); } @@ -173,7 +173,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_actionDeformation_triggered() /////// Dock window signal handlers ////// // what they do is simply transmitting required 'action' to selected scene_edit_polyhedron_item object -void Polyhedron_demo_edit_polyhedron_plugin::on_AddCtrlVertPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_AddCtrlVertPushButton_clicked() { int item_id = scene->selectionIndices().front(); @@ -182,7 +182,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_AddCtrlVertPushButton_clicked() edit_item->create_ctrl_vertices_group(); } -void Polyhedron_demo_edit_polyhedron_plugin::on_PrevCtrlVertPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_PrevCtrlVertPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -192,7 +192,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_PrevCtrlVertPushButton_clicked() edit_item->invalidateOpenGLBuffers(); scene->itemChanged(edit_item); // for repaint } -void Polyhedron_demo_edit_polyhedron_plugin::on_NextCtrlVertPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_NextCtrlVertPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -202,7 +202,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_NextCtrlVertPushButton_clicked() edit_item->invalidateOpenGLBuffers(); scene->itemChanged(edit_item); // for repaint } -void Polyhedron_demo_edit_polyhedron_plugin::on_SelectAllVerticesPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_SelectAllVerticesPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -212,7 +212,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_SelectAllVerticesPushButton_clic edit_item->invalidateOpenGLBuffers(); scene->itemChanged(edit_item); // for repaint } -void Polyhedron_demo_edit_polyhedron_plugin::on_DeleteCtrlVertPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_DeleteCtrlVertPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -223,7 +223,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_DeleteCtrlVertPushButton_clicked edit_item->invalidateOpenGLBuffers(); scene->itemChanged(edit_item); // for repaint } -void Polyhedron_demo_edit_polyhedron_plugin::on_ClearROIPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_ClearROIPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -233,11 +233,11 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ClearROIPushButton_clicked() edit_item->invalidateOpenGLBuffers(); scene->itemChanged(edit_item); // for repaint } -void Polyhedron_demo_edit_polyhedron_plugin::on_ApplyAndClosePushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_ApplyAndClosePushButton_clicked() { dock_widget->setVisible(false); } -void Polyhedron_demo_edit_polyhedron_plugin::on_DiscardChangesPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_DiscardChangesPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -247,7 +247,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_DiscardChangesPushButton_clicked edit_item->invalidateOpenGLBuffers(); scene->itemChanged(edit_item); //for redraw } -void Polyhedron_demo_edit_polyhedron_plugin::on_ShowROICheckBox_stateChanged(int /*state*/) +void CGAL_Lab_edit_cgal_lab_plugin::on_ShowROICheckBox_stateChanged(int /*state*/) { for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { @@ -256,7 +256,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ShowROICheckBox_stateChanged(int scene->itemChanged(edit_item); // just for redraw } } -void Polyhedron_demo_edit_polyhedron_plugin::on_ShowAsSphereCheckBox_stateChanged(int state) +void CGAL_Lab_edit_cgal_lab_plugin::on_ShowAsSphereCheckBox_stateChanged(int state) { for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { @@ -269,7 +269,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ShowAsSphereCheckBox_stateChange scene->itemChanged(edit_item); // just for redraw } } -void Polyhedron_demo_edit_polyhedron_plugin::on_ActivatePivotingCheckBox_stateChanged(int state) +void CGAL_Lab_edit_cgal_lab_plugin::on_ActivatePivotingCheckBox_stateChanged(int state) { for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { @@ -285,7 +285,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ActivatePivotingCheckBox_stateCh scene->itemChanged(edit_item); } } -void Polyhedron_demo_edit_polyhedron_plugin::on_ActivateFixedPlaneCheckBox_stateChanged(int) +void CGAL_Lab_edit_cgal_lab_plugin::on_ActivateFixedPlaneCheckBox_stateChanged(int) { for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { @@ -296,7 +296,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ActivateFixedPlaneCheckBox_state scene->itemChanged(edit_item); } } -void Polyhedron_demo_edit_polyhedron_plugin::on_OverwritePushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_OverwritePushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -304,7 +304,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_OverwritePushButton_clicked() edit_item->overwrite_deform_object(); } -void Polyhedron_demo_edit_polyhedron_plugin::on_Select_isolated_components_button_clicked() { +void CGAL_Lab_edit_cgal_lab_plugin::on_Select_isolated_components_button_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); if(!edit_item) return; // the selected item is not of the right type @@ -316,7 +316,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_Select_isolated_components_butto } } -void Polyhedron_demo_edit_polyhedron_plugin::on_Get_minimum_button_clicked() { +void CGAL_Lab_edit_cgal_lab_plugin::on_Get_minimum_button_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); if(!edit_item) return; // the selected item is not of the right type @@ -327,7 +327,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_Get_minimum_button_clicked() { } } -void Polyhedron_demo_edit_polyhedron_plugin::on_SaveROIPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_SaveROIPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -339,7 +339,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_SaveROIPushButton_clicked() edit_item->save_roi(fileName.toLocal8Bit().data()); } -void Polyhedron_demo_edit_polyhedron_plugin::on_ReadROIPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_ReadROIPushButton_clicked() { int item_id = scene->selectionIndices().front(); Scene_edit_polyhedron_item* edit_item = qobject_cast(scene->item(item_id)); @@ -355,7 +355,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ReadROIPushButton_clicked() } -void Polyhedron_demo_edit_polyhedron_plugin::dock_widget_visibility_changed(bool visible) +void CGAL_Lab_edit_cgal_lab_plugin::dock_widget_visibility_changed(bool visible) { if(!visible) { @@ -425,7 +425,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::dock_widget_visibility_changed(bool } -void Polyhedron_demo_edit_polyhedron_plugin::on_ROIRadioButton_toggled(bool value) { +void CGAL_Lab_edit_cgal_lab_plugin::on_ROIRadioButton_toggled(bool value) { int k_ring = value ? ui_widget.BrushSpinBoxRoi->value() : ui_widget.BrushSpinBoxCtrlVert->value(); for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) @@ -437,7 +437,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_ROIRadioButton_toggled(bool valu } } -void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxCtrlVert_changed(int value) { +void CGAL_Lab_edit_cgal_lab_plugin::on_BrushSpinBoxCtrlVert_changed(int value) { if(ui_widget.ROIRadioButton->isChecked()) { return; } for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { @@ -448,7 +448,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxCtrlVert_changed(int } } -void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxRoi_changed(int value) { +void CGAL_Lab_edit_cgal_lab_plugin::on_BrushSpinBoxRoi_changed(int value) { if(!ui_widget.ROIRadioButton->isChecked()) { return; } for(CGAL::Three::Scene_interface::Item_id i = 0, end = scene->numberOfEntries(); i < end; ++i) { @@ -460,7 +460,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::on_BrushSpinBoxRoi_changed(int valu } Scene_edit_polyhedron_item* -Polyhedron_demo_edit_polyhedron_plugin::convert_to_edit_facegraph(Item_id i, +CGAL_Lab_edit_cgal_lab_plugin::convert_to_edit_facegraph(Item_id i, Scene_facegraph_item* poly_item) { QString poly_item_name = poly_item->name(); @@ -481,7 +481,7 @@ Polyhedron_demo_edit_polyhedron_plugin::convert_to_edit_facegraph(Item_id i, } Scene_facegraph_item* -Polyhedron_demo_edit_polyhedron_plugin::convert_to_plain_facegraph(Item_id i, +CGAL_Lab_edit_cgal_lab_plugin::convert_to_plain_facegraph(Item_id i, Scene_edit_polyhedron_item* edit_item) { Scene_facegraph_item* poly_item = edit_item->to_sm_item(); @@ -491,7 +491,7 @@ Polyhedron_demo_edit_polyhedron_plugin::convert_to_plain_facegraph(Item_id i, } -void Polyhedron_demo_edit_polyhedron_plugin::on_importSelectionPushButton_clicked() +void CGAL_Lab_edit_cgal_lab_plugin::on_importSelectionPushButton_clicked() { Scene_polyhedron_selection_item* selection_item = nullptr; @@ -531,7 +531,7 @@ bool need_sel(true), need_edit(true); importSelection(selection_item, edit_item); } -void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_selection_item *selection_item, Scene_edit_polyhedron_item *edit_item) +void CGAL_Lab_edit_cgal_lab_plugin::importSelection(Scene_polyhedron_selection_item *selection_item, Scene_edit_polyhedron_item *edit_item) { //converts the selection in selected points @@ -575,7 +575,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_se v->update(); } -void Polyhedron_demo_edit_polyhedron_plugin::updateSelectionItems(Scene_facegraph_item* target) +void CGAL_Lab_edit_cgal_lab_plugin::updateSelectionItems(Scene_facegraph_item* target) { for(int i = 0; inumberOfEntries(); i++) { @@ -597,7 +597,7 @@ void Polyhedron_demo_edit_polyhedron_plugin::updateSelectionItems(Scene_facegrap } } -void Polyhedron_demo_edit_polyhedron_plugin::dispatchAction() +void CGAL_Lab_edit_cgal_lab_plugin::dispatchAction() { if(applicable(actionDeformation)) on_actionDeformation_triggered(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp rename to Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h similarity index 99% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h rename to Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h index c799d52b64a..cd185bd797d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h +++ b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h @@ -249,7 +249,7 @@ class SCENE_EDIT_POLYHEDRON_ITEM_EXPORT Scene_edit_polyhedron_item public CGAL::Three::Scene_transparent_interface { Q_INTERFACES(CGAL::Three::Scene_transparent_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.TransparentInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.TransparentInterface/1.0") Q_OBJECT public: Scene_edit_polyhedron_item(){} //needed by the transparent interface diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h b/Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h rename to Lab/demo/Lab/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/CMakeLists.txt b/Lab/demo/Lab/Plugins/Tetrahedral_remeshing/CMakeLists.txt similarity index 91% rename from Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Tetrahedral_remeshing/CMakeLists.txt index 15dc949776e..12faf5bd3d0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Tetrahedral_remeshing/CMakeLists.txt @@ -1,4 +1,4 @@ -include(polyhedron_demo_macros) +include(cgallab_macros) remove_definitions(-DQT_STATICPLUGIN) @@ -8,7 +8,7 @@ qt6_wrap_cpp(VOLUME_MOC_OUTFILES ${CMAKE_CURRENT_SOURCE_DIR}/Volume_plane_interface.h) qt6_wrap_ui(tetRemeshingUI_FILES Tetrahedral_remeshing_dialog.ui) -polyhedron_demo_plugin( +cgal_lab_plugin( tetrahedral_remeshing_plugin Tetrahedral_remeshing_plugin ${tetRemeshingUI_FILES} KEYWORDS Tetrahedral_remeshing) target_link_libraries(tetrahedral_remeshing_plugin PUBLIC scene_c3t3_item diff --git a/Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_dialog.ui b/Lab/demo/Lab/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_dialog.ui rename to Lab/demo/Lab/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_plugin.cpp b/Lab/demo/Lab/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_plugin.cpp similarity index 95% rename from Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_plugin.cpp rename to Lab/demo/Lab/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_plugin.cpp index 0a75dbae932..8448a8c310c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Tetrahedral_remeshing/Tetrahedral_remeshing_plugin.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include "Scene_c3t3_item.h" #include "C3t3_type.h" @@ -45,13 +45,13 @@ std::size_t nb_test_midpoint = 0; #endif using namespace CGAL::Three; -class Polyhedron_demo_tetrahedral_remeshing_plugin : +class CGAL_Lab_tetrahedral_remeshing_plugin : public QObject, - public Polyhedron_demo_plugin_interface + public CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0" FILE "tetrahedral_remeshing_plugin.json") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0" FILE "tetrahedral_remeshing_plugin.json") public: void init(QMainWindow* mainWindow, Scene_interface* scene_interface, Messages_interface*) @@ -239,6 +239,6 @@ private: private: QAction* actionTetrahedralRemeshing_; -}; // end Polyhedron_demo_tetrahedral_remeshing_plugin +}; // end CGAL_Lab_tetrahedral_remeshing_plugin #include "Tetrahedral_remeshing_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_dialog.ui b/Lab/demo/Lab/Plugins/Three_examples/Basic_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_dialog.ui rename to Lab/demo/Lab/Plugins/Three_examples/Basic_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_dock_widget.ui b/Lab/demo/Lab/Plugins/Three_examples/Basic_dock_widget.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_dock_widget.ui rename to Lab/demo/Lab/Plugins/Three_examples/Basic_dock_widget.ui diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_item_plugin.cpp b/Lab/demo/Lab/Plugins/Three_examples/Basic_item_plugin.cpp similarity index 90% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_item_plugin.cpp rename to Lab/demo/Lab/Plugins/Three_examples/Basic_item_plugin.cpp index 6aaaf519c94..f637c5ab053 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_item_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Three_examples/Basic_item_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -12,11 +12,11 @@ //adds a scene_plane_item to the scene, and adds the selected item and the plane to a new group. class BasicItemPlugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: //! [applicable] //This plugin is only applicable if there is exactly one selected item. diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_plugin.cpp b/Lab/demo/Lab/Plugins/Three_examples/Basic_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_plugin.cpp rename to Lab/demo/Lab/Plugins/Three_examples/Basic_plugin.cpp index 0edb4560030..31a13f1315f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Basic_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Three_examples/Basic_plugin.cpp @@ -7,7 +7,7 @@ Change the value of EXAMPLE_COMPLEXITY in the first line to change the behavior #define EXAMPLE_COMPLEXITY 0 #include "ui_Basic_dialog.h" //! [headers_plugin] -#include +#include #include #include #include @@ -36,11 +36,11 @@ public: //This plugin creates an action in Operations depending on EXAMPLE_COMPLEXITY. class BasicPlugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: //decides if the plugin's actions will be displayed or not. bool applicable(QAction*) const override diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt b/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt similarity index 76% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt rename to Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt index 23f8d5f8999..054890dd1f0 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/CMakeLists.txt +++ b/Lab/demo/Lab/Plugins/Three_examples/CMakeLists.txt @@ -17,15 +17,15 @@ find_package(Qt6 QUIET OPTIONAL_COMPONENTS WebSockets) if(RUNNING_CGAL_AUTO_TEST OR CGAL_TEST_SUITE) - polyhedron_demo_plugin(example_plugin Example_plugin) + cgal_lab_plugin(example_plugin Example_plugin) qt6_wrap_ui(basicUI_FILES Basic_dialog.ui) - polyhedron_demo_plugin(basic_plugin Basic_plugin ${basicUI_FILES}) + cgal_lab_plugin(basic_plugin Basic_plugin ${basicUI_FILES}) qt6_wrap_ui(dockUI_FILES Basic_dock_widget.ui) - polyhedron_demo_plugin(dock_widget_plugin Dock_widget_plugin ${dockUI_FILES}) + cgal_lab_plugin(dock_widget_plugin Dock_widget_plugin ${dockUI_FILES}) - polyhedron_demo_plugin(basic_item_plugin Basic_item_plugin) + cgal_lab_plugin(basic_item_plugin Basic_item_plugin) # links the library containing the scene_plane_item with the plugin target_link_libraries(basic_item_plugin PUBLIC scene_basic_objects) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Dock_widget_plugin.cpp b/Lab/demo/Lab/Plugins/Three_examples/Dock_widget_plugin.cpp similarity index 90% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Dock_widget_plugin.cpp rename to Lab/demo/Lab/Plugins/Three_examples/Dock_widget_plugin.cpp index 392b89540a2..18cacc932ba 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Dock_widget_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Three_examples/Dock_widget_plugin.cpp @@ -1,5 +1,5 @@ #include "ui_Basic_dock_widget.h" -#include +#include #include #include #include @@ -22,11 +22,11 @@ public: //This plugin crates an action in Operations that creates a DOckWidget to display a number in the 'console' dockwidet. class BasicPlugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_helper + public CGAL::Three::CGAL_Lab_plugin_helper { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: //decides if the plugin's actions will be displayed or not. bool applicable(QAction*) const override diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Example_plugin.cpp b/Lab/demo/Lab/Plugins/Three_examples/Example_plugin.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Example_plugin.cpp rename to Lab/demo/Lab/Plugins/Three_examples/Example_plugin.cpp index ec18b465754..52d0bba4383 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Example_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Three_examples/Example_plugin.cpp @@ -1,4 +1,4 @@ -//! \file Polyhedron_demo_example_plugin.cpp +//! \file CGAL_Lab_example_plugin.cpp #include #include @@ -137,17 +137,17 @@ void Scene_triangle_item::initializeBuffers(CGAL::Three::Viewer_interface *viewe vertices.shrink_to_fit(); } //! [fillbuffers] -#include +#include //The actual plugin using namespace CGAL::Three; -class Q_DECL_EXPORT Polyhedron_demo_example_plugin : +class Q_DECL_EXPORT CGAL_Lab_example_plugin : public QObject, - public Polyhedron_demo_plugin_helper + public CGAL_Lab_plugin_helper { //Configures CMake to use MOC correctly Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public : @@ -188,6 +188,6 @@ private: CGAL::Three::Scene_item* triangle; QList _actions; -}; //end of class Polyhedron_demo_example_plugin +}; //end of class CGAL_Lab_example_plugin #include "Example_plugin.moc" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Group_item_plugin.cpp b/Lab/demo/Lab/Plugins/Three_examples/Group_item_plugin.cpp similarity index 89% rename from Polyhedron/demo/Polyhedron/Plugins/Three_examples/Group_item_plugin.cpp rename to Lab/demo/Lab/Plugins/Three_examples/Group_item_plugin.cpp index 1f247de9c5d..2b6f5ddc3d5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Three_examples/Group_item_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Three_examples/Group_item_plugin.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -10,11 +10,11 @@ //This plugin crates an action in Operations that displays "Hello World" in the 'console' dockwidet. class GroupItemPlugin : public QObject, - public CGAL::Three::Polyhedron_demo_plugin_interface + public CGAL::Three::CGAL_Lab_plugin_interface { Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") public: //This plugin is only applicable if there is at exactly one selected item. bool applicable(QAction*) const diff --git a/Polyhedron/demo/Polyhedron/Point_container.cpp b/Lab/demo/Lab/Point_container.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Point_container.cpp rename to Lab/demo/Lab/Point_container.cpp diff --git a/Polyhedron/demo/Polyhedron/Point_dialog_config.h b/Lab/demo/Lab/Point_dialog_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Point_dialog_config.h rename to Lab/demo/Lab/Point_dialog_config.h diff --git a/Polyhedron/demo/Polyhedron/Preferences.ui b/Lab/demo/Lab/Preferences.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Preferences.ui rename to Lab/demo/Lab/Preferences.ui diff --git a/Polyhedron/demo/Polyhedron/Primitive_container.cpp b/Lab/demo/Lab/Primitive_container.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Primitive_container.cpp rename to Lab/demo/Lab/Primitive_container.cpp diff --git a/Polyhedron/demo/Polyhedron/SMesh_type.h b/Lab/demo/Lab/SMesh_type.h similarity index 100% rename from Polyhedron/demo/Polyhedron/SMesh_type.h rename to Lab/demo/Lab/SMesh_type.h diff --git a/Polyhedron/demo/Polyhedron/SSH_dialog.ui b/Lab/demo/Lab/SSH_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/SSH_dialog.ui rename to Lab/demo/Lab/SSH_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Lab/demo/Lab/Scene.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene.cpp rename to Lab/demo/Lab/Scene.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene.h b/Lab/demo/Lab/Scene.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene.h rename to Lab/demo/Lab/Scene.h diff --git a/Polyhedron/demo/Polyhedron/Scene_basic_objects_config.h b/Lab/demo/Lab/Scene_basic_objects_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_basic_objects_config.h rename to Lab/demo/Lab/Scene_basic_objects_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp b/Lab/demo/Lab/Scene_c3t3_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_c3t3_item.cpp rename to Lab/demo/Lab/Scene_c3t3_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item.h b/Lab/demo/Lab/Scene_c3t3_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_c3t3_item.h rename to Lab/demo/Lab/Scene_c3t3_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_c3t3_item_config.h b/Lab/demo/Lab/Scene_c3t3_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_c3t3_item_config.h rename to Lab/demo/Lab/Scene_c3t3_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_config.h b/Lab/demo/Lab/Scene_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_config.h rename to Lab/demo/Lab/Scene_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_find_items.h b/Lab/demo/Lab/Scene_find_items.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_find_items.h rename to Lab/demo/Lab/Scene_find_items.h diff --git a/Polyhedron/demo/Polyhedron/Scene_group_item.cpp b/Lab/demo/Lab/Scene_group_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_group_item.cpp rename to Lab/demo/Lab/Scene_group_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.cpp b/Lab/demo/Lab/Scene_image_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_image_item.cpp rename to Lab/demo/Lab/Scene_image_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item.h b/Lab/demo/Lab/Scene_image_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_image_item.h rename to Lab/demo/Lab/Scene_image_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_image_item_config.h b/Lab/demo/Lab/Scene_image_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_image_item_config.h rename to Lab/demo/Lab/Scene_image_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp b/Lab/demo/Lab/Scene_implicit_function_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_implicit_function_item.cpp rename to Lab/demo/Lab/Scene_implicit_function_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item.h b/Lab/demo/Lab/Scene_implicit_function_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_implicit_function_item.h rename to Lab/demo/Lab/Scene_implicit_function_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_implicit_function_item_config.h b/Lab/demo/Lab/Scene_implicit_function_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_implicit_function_item_config.h rename to Lab/demo/Lab/Scene_implicit_function_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_item.cpp b/Lab/demo/Lab/Scene_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_item.cpp rename to Lab/demo/Lab/Scene_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp b/Lab/demo/Lab/Scene_item_rendering_helper.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_item_rendering_helper.cpp rename to Lab/demo/Lab/Scene_item_rendering_helper.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_item_with_properties.cpp b/Lab/demo/Lab/Scene_item_with_properties.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_item_with_properties.cpp rename to Lab/demo/Lab/Scene_item_with_properties.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_lcc_item.cpp b/Lab/demo/Lab/Scene_lcc_item.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Scene_lcc_item.cpp rename to Lab/demo/Lab/Scene_lcc_item.cpp index 1247ab267f1..917a75bb646 100644 --- a/Polyhedron/demo/Polyhedron/Scene_lcc_item.cpp +++ b/Lab/demo/Lab/Scene_lcc_item.cpp @@ -88,7 +88,7 @@ struct lcc_priv{ faces.push_back(pt->z() + offset.z); } } - else if (CGAL::Buffer_for_vao::is_facet_convex(f.points,f.normal)) + else if (CGAL::Buffer_for_vao::is_facet_convex(f.points,f.normal)) { if (f.size()==4) { diff --git a/Polyhedron/demo/Polyhedron/Scene_lcc_item.h b/Lab/demo/Lab/Scene_lcc_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_lcc_item.h rename to Lab/demo/Lab/Scene_lcc_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp b/Lab/demo/Lab/Scene_nef_polyhedron_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp rename to Lab/demo/Lab/Scene_nef_polyhedron_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.h b/Lab/demo/Lab/Scene_nef_polyhedron_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.h rename to Lab/demo/Lab/Scene_nef_polyhedron_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item_config.h b/Lab/demo/Lab/Scene_nef_polyhedron_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item_config.h rename to Lab/demo/Lab/Scene_nef_polyhedron_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_plane_item.cpp b/Lab/demo/Lab/Scene_plane_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_plane_item.cpp rename to Lab/demo/Lab/Scene_plane_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_plane_item.h b/Lab/demo/Lab/Scene_plane_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_plane_item.h rename to Lab/demo/Lab/Scene_plane_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Lab/demo/Lab/Scene_points_with_normal_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp rename to Lab/demo/Lab/Scene_points_with_normal_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h b/Lab/demo/Lab/Scene_points_with_normal_item.h similarity index 97% rename from Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h rename to Lab/demo/Lab/Scene_points_with_normal_item.h index 05a7723b3eb..d3eebed8e99 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h +++ b/Lab/demo/Lab/Scene_points_with_normal_item.h @@ -32,7 +32,7 @@ class SCENE_POINTS_WITH_NORMAL_ITEM_EXPORT Scene_points_with_normal_item { Q_OBJECT Q_INTERFACES(CGAL::Three::Scene_zoomable_item_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.ZoomInterface/1.0") public: Scene_points_with_normal_item(); diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item_config.h b/Lab/demo/Lab/Scene_points_with_normal_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_points_with_normal_item_config.h rename to Lab/demo/Lab/Scene_points_with_normal_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp b/Lab/demo/Lab/Scene_polygon_soup_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp rename to Lab/demo/Lab/Scene_polygon_soup_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h b/Lab/demo/Lab/Scene_polygon_soup_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h rename to Lab/demo/Lab/Scene_polygon_soup_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item_config.h b/Lab/demo/Lab/Scene_polygon_soup_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polygon_soup_item_config.h rename to Lab/demo/Lab/Scene_polygon_soup_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp b/Lab/demo/Lab/Scene_polyhedron_item_decorator.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_item_decorator.cpp rename to Lab/demo/Lab/Scene_polyhedron_item_decorator.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item_decorator.h b/Lab/demo/Lab/Scene_polyhedron_item_decorator.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_item_decorator.h rename to Lab/demo/Lab/Scene_polyhedron_item_decorator.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_item_decorator_config.h b/Lab/demo/Lab/Scene_polyhedron_item_decorator_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_item_decorator_config.h rename to Lab/demo/Lab/Scene_polyhedron_item_decorator_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp b/Lab/demo/Lab/Scene_polyhedron_selection_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.cpp rename to Lab/demo/Lab/Scene_polyhedron_selection_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h b/Lab/demo/Lab/Scene_polyhedron_selection_item.h similarity index 99% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h rename to Lab/demo/Lab/Scene_polyhedron_selection_item.h index a65e7adf764..ff58bf5a658 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h +++ b/Lab/demo/Lab/Scene_polyhedron_selection_item.h @@ -13,7 +13,7 @@ #include #include -#include "Polyhedron_demo_detect_sharp_edges.h" +#include "CGAL_Lab_detect_sharp_edges.h" // Laurent Rineau, 2016/04/07: that header should not be included here, but // only in the .cpp file. But that header file does contain the body of a @@ -193,9 +193,9 @@ class SCENE_POLYHEDRON_SELECTION_ITEM_EXPORT Scene_polyhedron_selection_item { Q_OBJECT Q_INTERFACES(CGAL::Three::Scene_print_item_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PrintInterface/1.0") -friend class Polyhedron_demo_selection_plugin; +friend class CGAL_Lab_selection_plugin; public: typedef boost::graph_traits::face_descriptor fg_face_descriptor; diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item_config.h b/Lab/demo/Lab/Scene_polyhedron_selection_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item_config.h rename to Lab/demo/Lab/Scene_polyhedron_selection_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_shortest_path_item_config.h b/Lab/demo/Lab/Scene_polyhedron_shortest_path_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polyhedron_shortest_path_item_config.h rename to Lab/demo/Lab/Scene_polyhedron_shortest_path_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp b/Lab/demo/Lab/Scene_polylines_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polylines_item.cpp rename to Lab/demo/Lab/Scene_polylines_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item.h b/Lab/demo/Lab/Scene_polylines_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polylines_item.h rename to Lab/demo/Lab/Scene_polylines_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_polylines_item_config.h b/Lab/demo/Lab/Scene_polylines_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_polylines_item_config.h rename to Lab/demo/Lab/Scene_polylines_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_spheres_item.cpp b/Lab/demo/Lab/Scene_spheres_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_spheres_item.cpp rename to Lab/demo/Lab/Scene_spheres_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_spheres_item.h b/Lab/demo/Lab/Scene_spheres_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_spheres_item.h rename to Lab/demo/Lab/Scene_spheres_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Lab/demo/Lab/Scene_surface_mesh_item.cpp similarity index 99% rename from Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp rename to Lab/demo/Lab/Scene_surface_mesh_item.cpp index 4bdd7f76581..d17c3b6f248 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Lab/demo/Lab/Scene_surface_mesh_item.cpp @@ -447,7 +447,7 @@ void Scene_surface_mesh_item_priv::compute_elements(Scene_item_rendering_helper: idx_data_.reserve(num_faces(*smesh_) * 3); - typedef CGAL::Buffer_for_vao CPF; + typedef CGAL::Buffer_for_vao CPF; typedef boost::graph_traits::face_descriptor face_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef boost::graph_traits::edge_descriptor edge_descriptor; @@ -2524,7 +2524,7 @@ void Scene_surface_mesh_item::fill_flat_vertex_map() typedef EPICK::Point_3 Point; typedef CGAL::Surface_mesh SMesh; typedef boost::graph_traits::face_descriptor face_descriptor; - typedef CGAL::Buffer_for_vao CPF; + typedef CGAL::Buffer_for_vao CPF; if(d->flat_vertex_map_ready) return; diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h b/Lab/demo/Lab/Scene_surface_mesh_item.h similarity index 97% rename from Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h rename to Lab/demo/Lab/Scene_surface_mesh_item.h index 555f57f5fd5..31e0f1951eb 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.h +++ b/Lab/demo/Lab/Scene_surface_mesh_item.h @@ -38,10 +38,10 @@ class SCENE_SURFACE_MESH_ITEM_EXPORT Scene_surface_mesh_item public CGAL::Three::Scene_print_item_interface { Q_INTERFACES(CGAL::Three::Scene_print_item_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PrintInterface/1.0") Q_OBJECT Q_INTERFACES(CGAL::Three::Scene_zoomable_item_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0") + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.ZoomInterface/1.0") public: typedef SMesh Face_graph; diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item_config.h b/Lab/demo/Lab/Scene_surface_mesh_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_surface_mesh_item_config.h rename to Lab/demo/Lab/Scene_surface_mesh_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Scene_tetrahedra_item.cpp b/Lab/demo/Lab/Scene_tetrahedra_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_tetrahedra_item.cpp rename to Lab/demo/Lab/Scene_tetrahedra_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_tetrahedra_item.h b/Lab/demo/Lab/Scene_tetrahedra_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_tetrahedra_item.h rename to Lab/demo/Lab/Scene_tetrahedra_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp b/Lab/demo/Lab/Scene_textured_polyhedron_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_textured_polyhedron_item.cpp rename to Lab/demo/Lab/Scene_textured_polyhedron_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp b/Lab/demo/Lab/Scene_textured_surface_mesh_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.cpp rename to Lab/demo/Lab/Scene_textured_surface_mesh_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.h b/Lab/demo/Lab/Scene_textured_surface_mesh_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_textured_surface_mesh_item.h rename to Lab/demo/Lab/Scene_textured_surface_mesh_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp b/Lab/demo/Lab/Scene_triangulation_3_item.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.cpp rename to Lab/demo/Lab/Scene_triangulation_3_item.cpp diff --git a/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.h b/Lab/demo/Lab/Scene_triangulation_3_item.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_triangulation_3_item.h rename to Lab/demo/Lab/Scene_triangulation_3_item.h diff --git a/Polyhedron/demo/Polyhedron/Scene_triangulation_3_item_config.h b/Lab/demo/Lab/Scene_triangulation_3_item_config.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Scene_triangulation_3_item_config.h rename to Lab/demo/Lab/Scene_triangulation_3_item_config.h diff --git a/Polyhedron/demo/Polyhedron/Selection_visualizer.h b/Lab/demo/Lab/Selection_visualizer.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Selection_visualizer.h rename to Lab/demo/Lab/Selection_visualizer.h diff --git a/Polyhedron/demo/Polyhedron/Server_ws.cpp b/Lab/demo/Lab/Server_ws.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Server_ws.cpp rename to Lab/demo/Lab/Server_ws.cpp diff --git a/Polyhedron/demo/Polyhedron/Server_ws.h b/Lab/demo/Lab/Server_ws.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Server_ws.h rename to Lab/demo/Lab/Server_ws.h diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.cpp b/Lab/demo/Lab/Show_point_dialog.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Show_point_dialog.cpp rename to Lab/demo/Lab/Show_point_dialog.cpp diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.h b/Lab/demo/Lab/Show_point_dialog.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Show_point_dialog.h rename to Lab/demo/Lab/Show_point_dialog.h diff --git a/Polyhedron/demo/Polyhedron/Show_point_dialog.ui b/Lab/demo/Lab/Show_point_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Show_point_dialog.ui rename to Lab/demo/Lab/Show_point_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/Statistics_on_item_dialog.ui b/Lab/demo/Lab/Statistics_on_item_dialog.ui similarity index 100% rename from Polyhedron/demo/Polyhedron/Statistics_on_item_dialog.ui rename to Lab/demo/Lab/Statistics_on_item_dialog.ui diff --git a/Polyhedron/demo/Polyhedron/SubViewer.ui b/Lab/demo/Lab/SubViewer.ui similarity index 94% rename from Polyhedron/demo/Polyhedron/SubViewer.ui rename to Lab/demo/Lab/SubViewer.ui index 62a56d47ccc..d27796c3ed8 100644 --- a/Polyhedron/demo/Polyhedron/SubViewer.ui +++ b/Lab/demo/Lab/SubViewer.ui @@ -60,7 +60,7 @@ - + :/cgal/icons/resources/exit.png:/cgal/icons/resources/exit.png @@ -81,8 +81,8 @@ - - + + diff --git a/Polyhedron/demo/Polyhedron/T3_type.h b/Lab/demo/Lab/T3_type.h similarity index 100% rename from Polyhedron/demo/Polyhedron/T3_type.h rename to Lab/demo/Lab/T3_type.h diff --git a/Polyhedron/demo/Polyhedron/TODO b/Lab/demo/Lab/TODO similarity index 100% rename from Polyhedron/demo/Polyhedron/TODO rename to Lab/demo/Lab/TODO diff --git a/Polyhedron/demo/Polyhedron/TextRenderer.cpp b/Lab/demo/Lab/TextRenderer.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/TextRenderer.cpp rename to Lab/demo/Lab/TextRenderer.cpp diff --git a/Polyhedron/demo/Polyhedron/Three.cpp b/Lab/demo/Lab/Three.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Three.cpp rename to Lab/demo/Lab/Three.cpp index 8e6b8943e15..84c7c19ae1a 100644 --- a/Polyhedron/demo/Polyhedron/Three.cpp +++ b/Lab/demo/Lab/Three.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include @@ -112,7 +112,7 @@ void Three::addDockWidget(QDockWidget* dock_widget) } -void Three::autoConnectActions(Polyhedron_demo_plugin_interface *plugin) +void Three::autoConnectActions(CGAL_Lab_plugin_interface *plugin) { QObject* thisObject = dynamic_cast(plugin); if(!thisObject) diff --git a/Polyhedron/demo/Polyhedron/Travel_isolated_components.h b/Lab/demo/Lab/Travel_isolated_components.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Travel_isolated_components.h rename to Lab/demo/Lab/Travel_isolated_components.h diff --git a/Polyhedron/demo/Polyhedron/Triangle_container.cpp b/Lab/demo/Lab/Triangle_container.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/Triangle_container.cpp rename to Lab/demo/Lab/Triangle_container.cpp diff --git a/Lab/demo/Lab/UseCGAL_Lab.cmake b/Lab/demo/Lab/UseCGAL_Lab.cmake new file mode 100644 index 00000000000..bb2fd14877d --- /dev/null +++ b/Lab/demo/Lab/UseCGAL_Lab.cmake @@ -0,0 +1,12 @@ +message(STATUS "Using CGAL Lab from: ${CGAL_LAB_DEMO_DIR}") + +list(INSERT CMAKE_MODULE_PATH 0 "${CGAL_LAB_DEMO_CMAKE_MODULE_PATH}") + +message(STATUS "Now CMAKE_MODULE_PATH is: ${CMAKE_MODULE_PATH}") + +include( cgallab_macros ) +include( cgal_lab_targets ) + + +include_directories( ${CGAL_LAB_DEMO_HEADERS_DIRS} ) +add_definitions(${CGAL_LAB_DEMO_DEFINITIONS}) diff --git a/Polyhedron/demo/Polyhedron/Use_ssh.cpp b/Lab/demo/Lab/Use_ssh.cpp similarity index 98% rename from Polyhedron/demo/Polyhedron/Use_ssh.cpp rename to Lab/demo/Lab/Use_ssh.cpp index a4495160fbc..a4bcbddd6d5 100644 --- a/Polyhedron/demo/Polyhedron/Use_ssh.cpp +++ b/Lab/demo/Lab/Use_ssh.cpp @@ -408,16 +408,16 @@ bool explore_the_galaxy(ssh_session &session, { std::string sbuf(buffer, nbytes); - if(sbuf.find("Polyhedron_demo_") != std::string::npos) + if(sbuf.find("CGAL_Lab_") != std::string::npos) { std::istringstream iss(sbuf); std::string file; while(iss >> file) { - if(file.find("Polyhedron_demo_") != std::string::npos) + if(file.find("CGAL_Lab_") != std::string::npos) { QString name(file.c_str()); - files.push_back(name.remove("Polyhedron_demo_")); + files.push_back(name.remove("CGAL_Lab_")); } } } diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Lab/demo/Lab/Viewer.cpp similarity index 90% rename from Polyhedron/demo/Polyhedron/Viewer.cpp rename to Lab/demo/Lab/Viewer.cpp index ac0ab4fb27f..70c2b60e838 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Lab/demo/Lab/Viewer.cpp @@ -1199,23 +1199,23 @@ QOpenGLShaderProgram* Viewer::declare_program(int name, } if(isOpenGL_4_3()) { - if(strcmp(f_shader,":/cgal/Polyhedron_3/resources/shader_flat.frag" ) == 0) + if(strcmp(f_shader,":/cgal/Lab/resources/shader_flat.frag" ) == 0) { - if(!program->addShaderFromSourceFile(QOpenGLShader::Geometry,":/cgal/Polyhedron_3/resources/shader_flat.geom" )) + if(!program->addShaderFromSourceFile(QOpenGLShader::Geometry,":/cgal/Lab/resources/shader_flat.geom" )) { std::cerr<<"adding geometry shader FAILED"<addShaderFromSourceFile(QOpenGLShader::Geometry,":/cgal/Polyhedron_3/resources/solid_wireframe_shader.geom" )) + if(!program->addShaderFromSourceFile(QOpenGLShader::Geometry,":/cgal/Lab/resources/solid_wireframe_shader.geom" )) { std::cerr<<"adding geometry shader FAILED"<addShaderFromSourceFile(QOpenGLShader::Geometry,":/cgal/Polyhedron_3/resources/no_interpolation_shader.geom" )) + if(!program->addShaderFromSourceFile(QOpenGLShader::Geometry,":/cgal/Lab/resources/no_interpolation_shader.geom" )) { std::cerr<<"adding geometry shader FAILED"<setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasCutPlane", true); @@ -1249,9 +1249,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_C3T3_EDGES: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_c3t3_edges.vert" , ":/cgal/Polyhedron_3/resources/shader_c3t3_edges.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_edges.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_edges.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_c3t3_edges.vert" , ":/cgal/Lab/resources/shader_c3t3_edges.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_c3t3_edges.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_c3t3_edges.frag"); program->setProperty("hasCutPlane", true); program->setProperty("hasSurfaceMode", true); program->setProperty("hasSubdomainIndicesValues", true); @@ -1260,9 +1260,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_WITH_LIGHT: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_light.vert" , ":/cgal/Polyhedron_3/resources/shader_with_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_with_light.vert" , ":/cgal/Lab/resources/shader_with_light.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_with_light.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_with_light.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasTransparency", true); @@ -1272,9 +1272,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_HEAT_INTENSITY: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/heat_intensity_shader.vert" , ":/cgal/Polyhedron_3/resources/heat_intensity_shader.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/heat_intensity_shader.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/heat_intensity_shader.frag"); + ? declare_program(name, ":/cgal/Lab/resources/heat_intensity_shader.vert" , ":/cgal/Lab/resources/heat_intensity_shader.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/heat_intensity_shader.vert" , + ":/cgal/Lab/resources/compatibility_shaders/heat_intensity_shader.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasTransparency", true); @@ -1284,18 +1284,18 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_WITHOUT_LIGHT: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/shader_without_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_without_light.vert" , ":/cgal/Lab/resources/shader_without_light.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_without_light.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_without_light.frag"); program->setProperty("hasFMatrix", true); return program; } case PROGRAM_NO_SELECTION: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/shader_no_light_no_selection.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_no_light_no_selection.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_without_light.vert" , ":/cgal/Lab/resources/shader_no_light_no_selection.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_without_light.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_no_light_no_selection.frag"); program->setProperty("hasFMatrix", true); program->setProperty("hasTransparency", true); return program; @@ -1303,9 +1303,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_WITH_TEXTURE: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_texture.vert" , ":/cgal/Polyhedron_3/resources/shader_with_texture.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_texture.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_texture.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_with_texture.vert" , ":/cgal/Lab/resources/shader_with_texture.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_with_texture.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_with_texture.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasFMatrix", true); @@ -1315,9 +1315,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_PLANE_TWO_FACES: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ?declare_program(name, ":/cgal/Polyhedron_3/resources/shader_without_light.vert" , ":/cgal/Polyhedron_3/resources/shader_plane_two_faces.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_plane_two_faces.frag"); + ?declare_program(name, ":/cgal/Lab/resources/shader_without_light.vert" , ":/cgal/Lab/resources/shader_plane_two_faces.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_without_light.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_plane_two_faces.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasFMatrix", true); @@ -1326,9 +1326,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_WITH_TEXTURED_EDGES: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_textured_edges.vert" , ":/cgal/Polyhedron_3/resources/shader_with_textured_edges.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_textured_edges.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_textured_edges.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_with_textured_edges.vert" , ":/cgal/Lab/resources/shader_with_textured_edges.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_with_textured_edges.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_with_textured_edges.frag"); program->setProperty("hasFMatrix", true); program->setProperty("hasTexture", true); return program; @@ -1336,9 +1336,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_INSTANCED: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_instanced.vert" , ":/cgal/Polyhedron_3/resources/shader_with_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_instanced.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_instanced.vert" , ":/cgal/Lab/resources/shader_with_light.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_instanced.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_with_light.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); @@ -1348,9 +1348,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_INSTANCED_WIRE: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_instanced.vert" , ":/cgal/Polyhedron_3/resources/shader_without_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_instanced.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_without_light.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_instanced.vert" , ":/cgal/Lab/resources/shader_without_light.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_instanced.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_without_light.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasCenter", true); @@ -1360,9 +1360,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_CUTPLANE_SPHERES: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_c3t3_spheres.vert" , ":/cgal/Polyhedron_3/resources/shader_c3t3_spheres.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_spheres.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_c3t3_spheres.frag"); + ? declare_program(name, ":/cgal/Lab/resources/shader_c3t3_spheres.vert" , ":/cgal/Lab/resources/shader_c3t3_spheres.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_c3t3_spheres.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_c3t3_spheres.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasCenter", true); @@ -1374,9 +1374,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_SPHERES: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ?declare_program(name, ":/cgal/Polyhedron_3/resources/shader_spheres.vert" , ":/cgal/Polyhedron_3/resources/shader_with_light.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_spheres.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.frag"); + ?declare_program(name, ":/cgal/Lab/resources/shader_spheres.vert" , ":/cgal/Lab/resources/shader_with_light.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_spheres.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_with_light.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasCenter", true); @@ -1389,9 +1389,9 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_DARK_SPHERES: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ?declare_program(name, ":/cgal/Polyhedron_3/resources/shader_dark_spheres.vert" , ":/cgal/Polyhedron_3/resources/shader_no_light_no_selection.frag") - : declare_program(name, ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_dark_spheres.vert" , - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_no_light_no_selection.frag"); + ?declare_program(name, ":/cgal/Lab/resources/shader_dark_spheres.vert" , ":/cgal/Lab/resources/shader_no_light_no_selection.frag") + : declare_program(name, ":/cgal/Lab/resources/compatibility_shaders/shader_dark_spheres.vert" , + ":/cgal/Lab/resources/compatibility_shaders/shader_no_light_no_selection.frag"); program->setProperty("hasCenter", true); program->setProperty("hasRadius", true); program->setProperty("isInstanced", true); @@ -1405,7 +1405,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const std::cerr<<"An OpenGL context of version 4.3 is required for the program ("<setProperty("hasLight", true); program->setProperty("hasNormals", true); return program; @@ -1413,10 +1413,10 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const case PROGRAM_OLD_FLAT: { QOpenGLShaderProgram* program = isOpenGL_4_3() - ? declare_program(name, ":/cgal/Polyhedron_3/resources/shader_with_light.vert", ":/cgal/Polyhedron_3/resources/shader_old_flat.frag") + ? declare_program(name, ":/cgal/Lab/resources/shader_with_light.vert", ":/cgal/Lab/resources/shader_old_flat.frag") : declare_program(name, - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_with_light.vert", - ":/cgal/Polyhedron_3/resources/compatibility_shaders/shader_old_flat.frag"); + ":/cgal/Lab/resources/compatibility_shaders/shader_with_light.vert", + ":/cgal/Lab/resources/compatibility_shaders/shader_old_flat.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); return program; @@ -1429,8 +1429,8 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const return nullptr; } QOpenGLShaderProgram* program = declare_program(name, - ":/cgal/Polyhedron_3/resources/solid_wireframe_shader.vert", - ":/cgal/Polyhedron_3/resources/solid_wireframe_shader.frag"); + ":/cgal/Lab/resources/solid_wireframe_shader.vert", + ":/cgal/Lab/resources/solid_wireframe_shader.frag"); program->setProperty("hasViewport", true); program->setProperty("hasWidth", true); program->setProperty("hasFMatrix", true); @@ -1444,8 +1444,8 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const return nullptr; } QOpenGLShaderProgram* program = declare_program(name, - ":/cgal/Polyhedron_3/resources/no_interpolation_shader.vert", - ":/cgal/Polyhedron_3/resources/no_interpolation_shader.frag"); + ":/cgal/Lab/resources/no_interpolation_shader.vert", + ":/cgal/Lab/resources/no_interpolation_shader.frag"); program->setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("drawLinesAdjacency", true); @@ -1458,7 +1458,7 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const std::cerr<<"An OpenGL context of version 4.3 is required for the program ("<setProperty("hasLight", true); program->setProperty("hasNormals", true); program->setProperty("hasDistanceValues", true); diff --git a/Polyhedron/demo/Polyhedron/Viewer.h b/Lab/demo/Lab/Viewer.h similarity index 100% rename from Polyhedron/demo/Polyhedron/Viewer.h rename to Lab/demo/Lab/Viewer.h diff --git a/Polyhedron/demo/Polyhedron/cgal_test_with_cmake b/Lab/demo/Lab/cgal_test_with_cmake similarity index 97% rename from Polyhedron/demo/Polyhedron/cgal_test_with_cmake rename to Lab/demo/Lab/cgal_test_with_cmake index 59eb5c1d021..db9893ba9c3 100755 --- a/Polyhedron/demo/Polyhedron/cgal_test_with_cmake +++ b/Lab/demo/Lab/cgal_test_with_cmake @@ -102,7 +102,7 @@ demo_framework \ gl_splat \ point_dialog \ Polyhedron_3 \ -polyhedron_demo \ +cgal_lab \ scene_basic_objects \ scene_color_ramp \ scene_c2t3_item \ @@ -129,7 +129,7 @@ basic_generator_plugin \ c3t3_io_plugin \ camera_positions_plugin \ classification_plugin \ -clip_polyhedron_plugin \ +clip_cgal_lab_plugin \ convex_hull_plugin \ corefinement_plugin \ create_bbox_mesh_plugin \ @@ -138,7 +138,7 @@ detect_sharp_edges_plugin \ detect_sharp_edges_sm_plugin \ distance_plugin \ distance_sm_plugin \ -edit_polyhedron_plugin \ +edit_cgal_lab_plugin \ edit_sm_plugin \ extrude_poly_plugin \ extrude_sm_plugin \ @@ -178,7 +178,7 @@ parameterization_plugin \ pca_plugin \ p_klein_function_plugin \ ply_to_xyz_plugin \ -point_inside_polyhedron_plugin \ +point_inside_cgal_lab_plugin \ point_set_average_spacing_plugin \ point_set_bilateral_smoothing_plugin \ point_set_from_vertices_plugin \ @@ -197,7 +197,7 @@ polylines_io_plugin \ p_sphere_function_plugin \ p_tanglecube_function_plugin \ random_perturbation_plugin \ -repair_polyhedron_plugin \ +repair_cgal_lab_plugin \ selection_io_plugin \ selection_sm_io_plugin \ selection_plugin \ @@ -210,7 +210,7 @@ subdivision_methods_plugin \ surface_mesh_io_plugin \ surface_reconstruction_plugin \ surf_to_sm_io_plugin \ -transform_polyhedron_plugin \ +transform_cgal_lab_plugin \ triangulate_facets_plugin \ trivial_plugin \ vtk_plugin \ diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp b/Lab/demo/Lab/cgallab.cpp similarity index 65% rename from Polyhedron/demo/Polyhedron/Polyhedron_3.cpp rename to Lab/demo/Lab/cgallab.cpp index 7376a475890..b071acb9817 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_3.cpp +++ b/Lab/demo/Lab/cgallab.cpp @@ -1,4 +1,4 @@ -#include "Polyhedron_demo.h" +#include "cgallab.h" /*! * \brief defines the entry point of the demo. @@ -6,8 +6,8 @@ */ int main(int argc, char **argv) { - Polyhedron_demo app(argc, argv, + CGAL_Lab app(argc, argv, "Polyhedron_3 demo", - "CGAL Polyhedron Demo"); + "CGAL Lab"); return app.try_exec(); } diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo.h b/Lab/demo/Lab/cgallab.h similarity index 63% rename from Polyhedron/demo/Polyhedron/Polyhedron_demo.h rename to Lab/demo/Lab/cgallab.h index c913249c7aa..82af7c6607d 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo.h +++ b/Lab/demo/Lab/cgallab.h @@ -1,30 +1,30 @@ -#ifndef POLYHEDRON_DEMO_H -#define POLYHEDRON_DEMO_H +#ifndef LAB_DEMO_H +#define LAB_DEMO_H #include -#include "Polyhedron_demo_config.h" +#include "cgallab_config.h" #include #include #include -struct Polyhedron_demo_impl; +struct CGAL_Lab_impl; -class POLYHEDRON_DEMO_EXPORT Polyhedron_demo : public QApplication +class LAB_DEMO_EXPORT CGAL_Lab : public QApplication { bool d_ptr_is_initialized; /// can be false during a call to `notify()` - QScopedPointer d_ptr; + QScopedPointer d_ptr; public: /*! * Constructor : calls the constructor of QApplication */ - Polyhedron_demo(int& argc, char **argv, + CGAL_Lab(int& argc, char **argv, QString application_name = "Polyhedron_3 demo", - QString main_window_title = "CGAL Polyhedron demo", + QString main_window_title = "CGAL Lab", QStringList input_keywords = QStringList()); - ~Polyhedron_demo(); + ~CGAL_Lab(); /*! * Catches unhandled exceptions from all the widgets @@ -39,6 +39,6 @@ public: /*! Call `QApplication::exec()` unless the main window is already closed */ int try_exec(); -}; // end class Polyhedron_demo +}; // end class CGAL_Lab -#endif // POLYHEDRON_DEMO_H +#endif // LAB_DEMO_H diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_3.qrc b/Lab/demo/Lab/cgallab.qrc similarity index 99% rename from Polyhedron/demo/Polyhedron/Polyhedron_3.qrc rename to Lab/demo/Lab/cgallab.qrc index 8b31d1ee17d..97c9edb5c68 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_3.qrc +++ b/Lab/demo/Lab/cgallab.qrc @@ -37,7 +37,7 @@ resources/pause.jpeg resources/reset.jpg - + resources/about.html resources/shader_with_light.vert resources/shader_with_light.frag diff --git a/Lab/demo/Lab/cgallabConfig.cmake.in b/Lab/demo/Lab/cgallabConfig.cmake.in new file mode 100644 index 00000000000..78f0634aa62 --- /dev/null +++ b/Lab/demo/Lab/cgallabConfig.cmake.in @@ -0,0 +1,7 @@ +set(CGAL_LAB_DEMO_CMAKE_MODULE_PATH "@CMAKE_CURRENT_SOURCE_DIR@;@CMAKE_CURRENT_BINARY_DIR@") +set(CGAL_LAB_DEMO_DEFINITIONS "@CGAL_LAB_DEMO_DEFINITIONS@") +set(CGAL_LAB_DEMO_HEADERS_DIRS "@CMAKE_CURRENT_SOURCE_DIR@;@CMAKE_CURRENT_SOURCE_DIR@/include;@CMAKE_CURRENT_SOURCE_DIR@/CGAL_demo") +set(CGAL_LAB_DEMO_DIR "@CMAKE_CURRENT_BINARY_DIR@") +set(CGAL_LAB_DEMO_PLUGINS_DIR "@CGAL_LAB_DEMO_PLUGINS_DIR@") +set(CGAL_LAB_DEMO_USE_FILE "@CMAKE_CURRENT_SOURCE_DIR@/UseCGAL_Lab.cmake") +set(cgal_lab_FOUND TRUE) diff --git a/Lab/demo/Lab/cgallab_config.h b/Lab/demo/Lab/cgallab_config.h new file mode 100644 index 00000000000..08ef409a90c --- /dev/null +++ b/Lab/demo/Lab/cgallab_config.h @@ -0,0 +1,10 @@ +#ifndef LAB_DEMO_CONFIG_H +#define LAB_DEMO_CONFIG_H + +#ifdef cgal_lab_EXPORTS +# define LAB_DEMO_EXPORT Q_DECL_EXPORT +#else +# define LAB_DEMO_EXPORT Q_DECL_IMPORT +#endif + +#endif // LAB_DEMO_CONFIG_H diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Lab/demo/Lab/cgallab_macros.cmake similarity index 91% rename from Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake rename to Lab/demo/Lab/cgallab_macros.cmake index aaea742ca1d..39bf0c6c7f7 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Lab/demo/Lab/cgallab_macros.cmake @@ -1,7 +1,7 @@ include(AddFileDependencies) include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) - macro(polyhedron_demo_plugin plugin_name plugin_implementation_base_name) + macro(cgal_lab_plugin plugin_name plugin_implementation_base_name) cmake_parse_arguments(ARG "" "" "KEYWORDS" ${ARGN}) list_split(option ARGN_TAIL ${ARG_UNPARSED_ARGUMENTS} ) if(NOT ${option} STREQUAL "EXCLUDE_FROM_ALL") @@ -26,7 +26,7 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) add_library(${plugin_name} MODULE ${option} ${moc_file_name} ${plugin_implementation_base_name}.cpp ${other_sources}) set_property(TARGET ${plugin_name} PROPERTY LIBRARY_OUTPUT_DIRECTORY - "${CGAL_POLYHEDRON_DEMO_PLUGINS_DIR}") + "${CGAL_LAB_DEMO_PLUGINS_DIR}") cgal_add_compilation_test(${plugin_name}) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${plugin_name} ) # Link with Qt @@ -36,8 +36,8 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) target_link_libraries( ${plugin_name} PUBLIC demo_framework) add_dependencies(${plugin_name} demo_framework) else() - target_link_libraries( ${plugin_name} PUBLIC Polyhedron_demo_framework) - add_dependencies(${plugin_name} Polyhedron_demo_framework) + target_link_libraries( ${plugin_name} PUBLIC CGAL_Lab_framework) + add_dependencies(${plugin_name} CGAL_Lab_framework) endif() if(TARGET "compilation_of__demo_framework" AND TEST "compilation of ${plugin_name}") set_property(TEST "compilation of ${plugin_name}" APPEND PROPERTY FIXTURES_REQUIRED demo_framework_SetupFixture) @@ -82,4 +82,4 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) file(APPEND ${filename} "\"ConfigDate\" : \"${VERSION}\" }") endif() CGAL_install_hooks() - endmacro(polyhedron_demo_plugin) + endmacro(cgal_lab_plugin) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp b/Lab/demo/Lab/cgallab_plugin_helper.cpp similarity index 93% rename from Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp rename to Lab/demo/Lab/cgallab_plugin_helper.cpp index 10d78ec8583..c98acbf62da 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_plugin_helper.cpp +++ b/Lab/demo/Lab/cgallab_plugin_helper.cpp @@ -1,11 +1,11 @@ -#include +#include #include #include #include #include -void CGAL::Three::Polyhedron_demo_plugin_helper::addDockWidget(QDockWidget* dock_widget) +void CGAL::Three::CGAL_Lab_plugin_helper::addDockWidget(QDockWidget* dock_widget) { mw->addDockWidget(::Qt::LeftDockWidgetArea, dock_widget); dock_widget->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); @@ -25,7 +25,7 @@ void CGAL::Three::Polyhedron_demo_plugin_helper::addDockWidget(QDockWidget* dock } -void CGAL::Three::Polyhedron_demo_plugin_helper::autoConnectActions() +void CGAL::Three::CGAL_Lab_plugin_helper::autoConnectActions() { QObject* thisObject = dynamic_cast(this); if(!thisObject) diff --git a/Polyhedron/demo/Polyhedron/concurrent_mesher_config.cfg b/Lab/demo/Lab/concurrent_mesher_config.cfg similarity index 100% rename from Polyhedron/demo/Polyhedron/concurrent_mesher_config.cfg rename to Lab/demo/Lab/concurrent_mesher_config.cfg diff --git a/Lab/demo/Lab/config.h b/Lab/demo/Lab/config.h new file mode 100644 index 00000000000..3014cb7519d --- /dev/null +++ b/Lab/demo/Lab/config.h @@ -0,0 +1,25 @@ +// #define CGAL_LAB_DEMO_NO_NEF +// #define CGAL_LAB_DEMO_NO_SURFACE_MESHER +// #define CGAL_LAB_DEMO_NO_PARAMETRIZATION + +#ifndef CGAL_LAB_DEMO_CONFIG_H +#define CGAL_LAB_DEMO_CONFIG_H + +#ifdef CGAL_USE_SSH +//to avoid clashing between windows.h and winsock2.h +#define _WINSOCKAPI_ +#endif + +#ifndef CGAL_LAB_DEMO_NO_PARAMETRIZATION +# define CGAL_LAB_DEMO_USE_PARAMETRIZATION +#endif + +#ifndef CGAL_LAB_DEMO_NO_NEF +# define CGAL_LAB_DEMO_USE_NEF +#endif + +#ifndef CGAL_LAB_DEMO_NO_SURFACE_MESHER +# define CGAL_LAB_DEMO_USE_SURFACE_MESHER +#endif + +#endif // CGAL_LAB_DEMO_CONFIG_H diff --git a/Polyhedron/demo/Polyhedron/create_sphere.h b/Lab/demo/Lab/create_sphere.h similarity index 98% rename from Polyhedron/demo/Polyhedron/create_sphere.h rename to Lab/demo/Lab/create_sphere.h index c2fd27266d1..ec74f49de88 100644 --- a/Polyhedron/demo/Polyhedron/create_sphere.h +++ b/Lab/demo/Lab/create_sphere.h @@ -1,5 +1,5 @@ -#ifndef POLYHEDRON_DEMO_CREATE_SPHERE_H -#define POLYHEDRON_DEMO_CREATE_SPHERE_H +#ifndef LAB_DEMO_CREATE_SPHERE_H +#define LAB_DEMO_CREATE_SPHERE_H #include #include @@ -363,4 +363,4 @@ void create_flat_and_wire_sphere(FLOAT R, } } -#endif //POLYHEDRON_DEMO_DRAW_SPHERE_H +#endif //LAB_DEMO_DRAW_SPHERE_H diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt b/Lab/demo/Lab/implicit_functions/CMakeLists.txt similarity index 87% rename from Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt rename to Lab/demo/Lab/implicit_functions/CMakeLists.txt index 174535ff5d5..80c86129ce6 100644 --- a/Polyhedron/demo/Polyhedron/implicit_functions/CMakeLists.txt +++ b/Lab/demo/Lab/implicit_functions/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1...3.23) -include(polyhedron_demo_macros) +include(cgallab_macros) if(NOT POLICY CMP0070 AND POLICY CMP0053) # Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning. @@ -36,11 +36,11 @@ if(CGAL_Qt6_FOUND AND Qt6_FOUND) include(AddFileDependencies) remove_definitions(-DQT_STATICPLUGIN) - polyhedron_demo_plugin(p_sphere_function_plugin Sphere_implicit_function + cgal_lab_plugin(p_sphere_function_plugin Sphere_implicit_function KEYWORDS Mesh_3) - polyhedron_demo_plugin(p_tanglecube_function_plugin + cgal_lab_plugin(p_tanglecube_function_plugin Tanglecube_implicit_function KEYWORDS Mesh_3) - polyhedron_demo_plugin(p_klein_function_plugin Klein_implicit_function + cgal_lab_plugin(p_klein_function_plugin Klein_implicit_function KEYWORDS Mesh_3) else(CGAL_Qt6_FOUND AND Qt6_FOUND) diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Implicit_function_interface.h b/Lab/demo/Lab/implicit_functions/Implicit_function_interface.h similarity index 100% rename from Polyhedron/demo/Polyhedron/implicit_functions/Implicit_function_interface.h rename to Lab/demo/Lab/implicit_functions/Implicit_function_interface.h diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp b/Lab/demo/Lab/implicit_functions/Klein_implicit_function.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/implicit_functions/Klein_implicit_function.cpp rename to Lab/demo/Lab/implicit_functions/Klein_implicit_function.cpp diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp b/Lab/demo/Lab/implicit_functions/Sphere_implicit_function.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/implicit_functions/Sphere_implicit_function.cpp rename to Lab/demo/Lab/implicit_functions/Sphere_implicit_function.cpp diff --git a/Polyhedron/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp b/Lab/demo/Lab/implicit_functions/Tanglecube_implicit_function.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/implicit_functions/Tanglecube_implicit_function.cpp rename to Lab/demo/Lab/implicit_functions/Tanglecube_implicit_function.cpp diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Dualizer.h b/Lab/demo/Lab/include/CGAL/Dualizer.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Dualizer.h rename to Lab/demo/Lab/include/CGAL/Dualizer.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Facet_with_id_pmap.h b/Lab/demo/Lab/include/CGAL/Facet_with_id_pmap.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Facet_with_id_pmap.h rename to Lab/demo/Lab/include/CGAL/Facet_with_id_pmap.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/IO/read_surf_trianglemesh.h b/Lab/demo/Lab/include/CGAL/IO/read_surf_trianglemesh.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/IO/read_surf_trianglemesh.h rename to Lab/demo/Lab/include/CGAL/IO/read_surf_trianglemesh.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Make_bar.h b/Lab/demo/Lab/include/CGAL/Make_bar.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Make_bar.h rename to Lab/demo/Lab/include/CGAL/Make_bar.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Make_quad_soup.h b/Lab/demo/Lab/include/CGAL/Make_quad_soup.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Make_quad_soup.h rename to Lab/demo/Lab/include/CGAL/Make_quad_soup.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Make_triangle_soup.h b/Lab/demo/Lab/include/CGAL/Make_triangle_soup.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Make_triangle_soup.h rename to Lab/demo/Lab/include/CGAL/Make_triangle_soup.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Polyhedron_kernel.h b/Lab/demo/Lab/include/CGAL/Polyhedron_kernel.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Polyhedron_kernel.h rename to Lab/demo/Lab/include/CGAL/Polyhedron_kernel.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Textured_polyhedron_builder.h b/Lab/demo/Lab/include/CGAL/Textured_polyhedron_builder.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Textured_polyhedron_builder.h rename to Lab/demo/Lab/include/CGAL/Textured_polyhedron_builder.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Use_ssh.h b/Lab/demo/Lab/include/CGAL/Use_ssh.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/Use_ssh.h rename to Lab/demo/Lab/include/CGAL/Use_ssh.h diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h b/Lab/demo/Lab/include/CGAL/statistics_helpers.h similarity index 98% rename from Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h rename to Lab/demo/Lab/include/CGAL/statistics_helpers.h index fcb98812e87..fb4785f3021 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/statistics_helpers.h +++ b/Lab/demo/Lab/include/CGAL/statistics_helpers.h @@ -1,5 +1,5 @@ -#ifndef POLYHEDRON_DEMO_STATISTICS_HELPERS_H -#define POLYHEDRON_DEMO_STATISTICS_HELPERS_H +#ifndef LAB_DEMO_STATISTICS_HELPERS_H +#define LAB_DEMO_STATISTICS_HELPERS_H #include #include @@ -275,4 +275,4 @@ void faces_aspect_ratio(Mesh* poly, { faces_aspect_ratio(poly, faces(*poly), min_altitude, mini, maxi, mean); } -#endif // POLYHEDRON_DEMO_STATISTICS_HELPERS_H +#endif // LAB_DEMO_STATISTICS_HELPERS_H diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/textured_polyhedron.h b/Lab/demo/Lab/include/CGAL/textured_polyhedron.h similarity index 99% rename from Polyhedron/demo/Polyhedron/include/CGAL/textured_polyhedron.h rename to Lab/demo/Lab/include/CGAL/textured_polyhedron.h index d4047adc199..df9b58a3986 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/textured_polyhedron.h +++ b/Lab/demo/Lab/include/CGAL/textured_polyhedron.h @@ -2,7 +2,7 @@ #define _TEXTURED_MESH_ #include -#include +#include #include diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/translate.h b/Lab/demo/Lab/include/CGAL/translate.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/CGAL/translate.h rename to Lab/demo/Lab/include/CGAL/translate.h diff --git a/Polyhedron/demo/Polyhedron/include/Point_set_3.h b/Lab/demo/Lab/include/Point_set_3.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/Point_set_3.h rename to Lab/demo/Lab/include/Point_set_3.h diff --git a/Polyhedron/demo/Polyhedron/include/Progress_bar_callback.h b/Lab/demo/Lab/include/Progress_bar_callback.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/Progress_bar_callback.h rename to Lab/demo/Lab/include/Progress_bar_callback.h diff --git a/Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h b/Lab/demo/Lab/include/QMultipleInputDialog.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/QMultipleInputDialog.h rename to Lab/demo/Lab/include/QMultipleInputDialog.h diff --git a/Polyhedron/demo/Polyhedron/include/Qt_progress_bar_callback.h b/Lab/demo/Lab/include/Qt_progress_bar_callback.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/Qt_progress_bar_callback.h rename to Lab/demo/Lab/include/Qt_progress_bar_callback.h diff --git a/Polyhedron/demo/Polyhedron/include/UI_point_3.h b/Lab/demo/Lab/include/UI_point_3.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/UI_point_3.h rename to Lab/demo/Lab/include/UI_point_3.h diff --git a/Polyhedron/demo/Polyhedron/include/id_printing.h b/Lab/demo/Lab/include/id_printing.h similarity index 99% rename from Polyhedron/demo/Polyhedron/include/id_printing.h rename to Lab/demo/Lab/include/id_printing.h index 2bf10a371c0..0c1bc5b0abb 100644 --- a/Polyhedron/demo/Polyhedron/include/id_printing.h +++ b/Lab/demo/Lab/include/id_printing.h @@ -1,5 +1,5 @@ -#ifndef CGAL_POLYHEDRON_DEMO_ID_PRINTING_H -#define CGAL_POLYHEDRON_DEMO_ID_PRINTING_H +#ifndef CGAL_LAB_DEMO_ID_PRINTING_H +#define CGAL_LAB_DEMO_ID_PRINTING_H #include #include @@ -762,5 +762,5 @@ int zoomToPoint(const PointSet& ps, return 0; } -#endif // CGAL_POLYHEDRON_DEMO_ID_PRINTING_H +#endif // CGAL_LAB_DEMO_ID_PRINTING_H diff --git a/Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h b/Lab/demo/Lab/include/run_with_qprogressdialog.h similarity index 100% rename from Polyhedron/demo/Polyhedron/include/run_with_qprogressdialog.h rename to Lab/demo/Lab/include/run_with_qprogressdialog.h diff --git a/Polyhedron/demo/Polyhedron/javascript/lib.js b/Lab/demo/Lab/javascript/lib.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/lib.js rename to Lab/demo/Lab/javascript/lib.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/bad/catch_and_retrow_cpp_exception.js b/Lab/demo/Lab/javascript/tests/bad/catch_and_retrow_cpp_exception.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/bad/catch_and_retrow_cpp_exception.js rename to Lab/demo/Lab/javascript/tests/bad/catch_and_retrow_cpp_exception.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/bad/include_missing_file.js b/Lab/demo/Lab/javascript/tests/bad/include_missing_file.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/bad/include_missing_file.js rename to Lab/demo/Lab/javascript/tests/bad/include_missing_file.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/bad/syntax_error.js b/Lab/demo/Lab/javascript/tests/bad/syntax_error.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/bad/syntax_error.js rename to Lab/demo/Lab/javascript/tests/bad/syntax_error.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/bad/throw_error.js b/Lab/demo/Lab/javascript/tests/bad/throw_error.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/bad/throw_error.js rename to Lab/demo/Lab/javascript/tests/bad/throw_error.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/bad/uncaught_cpp_exception.js b/Lab/demo/Lab/javascript/tests/bad/uncaught_cpp_exception.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/bad/uncaught_cpp_exception.js rename to Lab/demo/Lab/javascript/tests/bad/uncaught_cpp_exception.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/bad/uncaught_cpp_exception_in_an_include.js b/Lab/demo/Lab/javascript/tests/bad/uncaught_cpp_exception_in_an_include.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/bad/uncaught_cpp_exception_in_an_include.js rename to Lab/demo/Lab/javascript/tests/bad/uncaught_cpp_exception_in_an_include.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/good/catch_missing_file.js b/Lab/demo/Lab/javascript/tests/good/catch_missing_file.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/good/catch_missing_file.js rename to Lab/demo/Lab/javascript/tests/good/catch_missing_file.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/good/caught_cpp_exception_in_an_include.js b/Lab/demo/Lab/javascript/tests/good/caught_cpp_exception_in_an_include.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/good/caught_cpp_exception_in_an_include.js rename to Lab/demo/Lab/javascript/tests/good/caught_cpp_exception_in_an_include.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/good/cpp_exception.js b/Lab/demo/Lab/javascript/tests/good/cpp_exception.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/good/cpp_exception.js rename to Lab/demo/Lab/javascript/tests/good/cpp_exception.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/good/cpp_exception_from_a_function.js b/Lab/demo/Lab/javascript/tests/good/cpp_exception_from_a_function.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/good/cpp_exception_from_a_function.js rename to Lab/demo/Lab/javascript/tests/good/cpp_exception_from_a_function.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/good/cpp_exception_in_an_include.js b/Lab/demo/Lab/javascript/tests/good/cpp_exception_in_an_include.js similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/good/cpp_exception_in_an_include.js rename to Lab/demo/Lab/javascript/tests/good/cpp_exception_in_an_include.js diff --git a/Polyhedron/demo/Polyhedron/javascript/tests/run-tests.sh b/Lab/demo/Lab/javascript/tests/run-tests.sh similarity index 100% rename from Polyhedron/demo/Polyhedron/javascript/tests/run-tests.sh rename to Lab/demo/Lab/javascript/tests/run-tests.sh diff --git a/Polyhedron/demo/Polyhedron/properties.h b/Lab/demo/Lab/properties.h similarity index 70% rename from Polyhedron/demo/Polyhedron/properties.h rename to Lab/demo/Lab/properties.h index 15f1d1224a8..b6ceb7e6a01 100644 --- a/Polyhedron/demo/Polyhedron/properties.h +++ b/Lab/demo/Lab/properties.h @@ -1,5 +1,5 @@ -#ifndef CGAL_POLYHEDRON_DEMO_PROPERTIES_H -#define CGAL_POLYHEDRON_DEMO_PROPERTIES_H +#ifndef CGAL_LAB_DEMO_PROPERTIES_H +#define CGAL_LAB_DEMO_PROPERTIES_H namespace CGAL { diff --git a/Polyhedron/demo/Polyhedron/resources/about.html b/Lab/demo/Lab/resources/about.html similarity index 91% rename from Polyhedron/demo/Polyhedron/resources/about.html rename to Lab/demo/Lab/resources/about.html index b881e30bab7..8c32ab3cfd9 100644 --- a/Polyhedron/demo/Polyhedron/resources/about.html +++ b/Lab/demo/Lab/resources/about.html @@ -1,6 +1,6 @@ -

3D Polyhedral Surfaces

+

CGAL Lab

Copyright ©2008-2009 GeometryFactory and INRIA Sophia Antipolis - Mediterranee

diff --git a/Polyhedron/demo/Polyhedron/resources/add_facet1.png b/Lab/demo/Lab/resources/add_facet1.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/add_facet1.png rename to Lab/demo/Lab/resources/add_facet1.png diff --git a/Polyhedron/demo/Polyhedron/resources/add_facet2.png b/Lab/demo/Lab/resources/add_facet2.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/add_facet2.png rename to Lab/demo/Lab/resources/add_facet2.png diff --git a/Polyhedron/demo/Polyhedron/resources/back.png b/Lab/demo/Lab/resources/back.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/back.png rename to Lab/demo/Lab/resources/back.png diff --git a/Polyhedron/demo/Polyhedron/resources/boolean-diff.png b/Lab/demo/Lab/resources/boolean-diff.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/boolean-diff.png rename to Lab/demo/Lab/resources/boolean-diff.png diff --git a/Polyhedron/demo/Polyhedron/resources/boolean-intersection.png b/Lab/demo/Lab/resources/boolean-intersection.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/boolean-intersection.png rename to Lab/demo/Lab/resources/boolean-intersection.png diff --git a/Polyhedron/demo/Polyhedron/resources/boolean-union.png b/Lab/demo/Lab/resources/boolean-union.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/boolean-union.png rename to Lab/demo/Lab/resources/boolean-union.png diff --git a/Polyhedron/demo/Polyhedron/resources/bot.png b/Lab/demo/Lab/resources/bot.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/bot.png rename to Lab/demo/Lab/resources/bot.png diff --git a/Polyhedron/demo/Polyhedron/resources/cgal_logo.xpm b/Lab/demo/Lab/resources/cgal_logo.xpm similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/cgal_logo.xpm rename to Lab/demo/Lab/resources/cgal_logo.xpm diff --git a/Polyhedron/demo/Polyhedron/resources/check-off.png b/Lab/demo/Lab/resources/check-off.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/check-off.png rename to Lab/demo/Lab/resources/check-off.png diff --git a/Polyhedron/demo/Polyhedron/resources/check-off.svg b/Lab/demo/Lab/resources/check-off.svg similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/check-off.svg rename to Lab/demo/Lab/resources/check-off.svg diff --git a/Polyhedron/demo/Polyhedron/resources/check-on.png b/Lab/demo/Lab/resources/check-on.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/check-on.png rename to Lab/demo/Lab/resources/check-on.png diff --git a/Polyhedron/demo/Polyhedron/resources/check.svg b/Lab/demo/Lab/resources/check.svg similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/check.svg rename to Lab/demo/Lab/resources/check.svg diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/heat_intensity_shader.frag b/Lab/demo/Lab/resources/compatibility_shaders/heat_intensity_shader.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/heat_intensity_shader.frag rename to Lab/demo/Lab/resources/compatibility_shaders/heat_intensity_shader.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/heat_intensity_shader.vert b/Lab/demo/Lab/resources/compatibility_shaders/heat_intensity_shader.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/heat_intensity_shader.vert rename to Lab/demo/Lab/resources/compatibility_shaders/heat_intensity_shader.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_edges.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_edges.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_edges.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_edges.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_edges.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_edges.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_edges.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_edges.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_spheres.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_spheres.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_spheres.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_spheres.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_spheres.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_spheres.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_c3t3_spheres.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_c3t3_spheres.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_dark_spheres.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_dark_spheres.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_dark_spheres.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_dark_spheres.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_instanced.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_instanced.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_instanced.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_instanced.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_no_light_no_selection.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_no_light_no_selection.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_no_light_no_selection.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_no_light_no_selection.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_old_flat.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_old_flat.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_old_flat.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_old_flat.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_plane_two_faces.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_plane_two_faces.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_plane_two_faces.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_plane_two_faces.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_spheres.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_spheres.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_spheres.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_spheres.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_light.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_with_light.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_light.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_with_light.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_light.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_with_light.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_light.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_with_light.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_texture.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_with_texture.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_texture.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_with_texture.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_texture.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_with_texture.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_texture.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_with_texture.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_textured_edges.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_with_textured_edges.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_textured_edges.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_with_textured_edges.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_textured_edges.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_with_textured_edges.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_with_textured_edges.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_with_textured_edges.vert diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_without_light.frag b/Lab/demo/Lab/resources/compatibility_shaders/shader_without_light.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_without_light.frag rename to Lab/demo/Lab/resources/compatibility_shaders/shader_without_light.frag diff --git a/Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_without_light.vert b/Lab/demo/Lab/resources/compatibility_shaders/shader_without_light.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/compatibility_shaders/shader_without_light.vert rename to Lab/demo/Lab/resources/compatibility_shaders/shader_without_light.vert diff --git a/Polyhedron/demo/Polyhedron/resources/convex-hull.png b/Lab/demo/Lab/resources/convex-hull.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/convex-hull.png rename to Lab/demo/Lab/resources/convex-hull.png diff --git a/Polyhedron/demo/Polyhedron/resources/down.png b/Lab/demo/Lab/resources/down.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/down.png rename to Lab/demo/Lab/resources/down.png diff --git a/Polyhedron/demo/Polyhedron/resources/editcopy.png b/Lab/demo/Lab/resources/editcopy.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/editcopy.png rename to Lab/demo/Lab/resources/editcopy.png diff --git a/Polyhedron/demo/Polyhedron/resources/euler_center.png b/Lab/demo/Lab/resources/euler_center.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/euler_center.png rename to Lab/demo/Lab/resources/euler_center.png diff --git a/Polyhedron/demo/Polyhedron/resources/euler_facet.png b/Lab/demo/Lab/resources/euler_facet.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/euler_facet.png rename to Lab/demo/Lab/resources/euler_facet.png diff --git a/Polyhedron/demo/Polyhedron/resources/euler_vertex.png b/Lab/demo/Lab/resources/euler_vertex.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/euler_vertex.png rename to Lab/demo/Lab/resources/euler_vertex.png diff --git a/Polyhedron/demo/Polyhedron/resources/exit.png b/Lab/demo/Lab/resources/exit.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/exit.png rename to Lab/demo/Lab/resources/exit.png diff --git a/Polyhedron/demo/Polyhedron/resources/front.png b/Lab/demo/Lab/resources/front.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/front.png rename to Lab/demo/Lab/resources/front.png diff --git a/Polyhedron/demo/Polyhedron/resources/general_collapse.png b/Lab/demo/Lab/resources/general_collapse.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/general_collapse.png rename to Lab/demo/Lab/resources/general_collapse.png diff --git a/Polyhedron/demo/Polyhedron/resources/grid.png b/Lab/demo/Lab/resources/grid.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/grid.png rename to Lab/demo/Lab/resources/grid.png diff --git a/Polyhedron/demo/Polyhedron/resources/heat_intensity_shader.frag b/Lab/demo/Lab/resources/heat_intensity_shader.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/heat_intensity_shader.frag rename to Lab/demo/Lab/resources/heat_intensity_shader.frag diff --git a/Polyhedron/demo/Polyhedron/resources/heat_intensity_shader.vert b/Lab/demo/Lab/resources/heat_intensity_shader.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/heat_intensity_shader.vert rename to Lab/demo/Lab/resources/heat_intensity_shader.vert diff --git a/Polyhedron/demo/Polyhedron/resources/help_button.png b/Lab/demo/Lab/resources/help_button.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/help_button.png rename to Lab/demo/Lab/resources/help_button.png diff --git a/Polyhedron/demo/Polyhedron/resources/hexahedron.png b/Lab/demo/Lab/resources/hexahedron.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/hexahedron.png rename to Lab/demo/Lab/resources/hexahedron.png diff --git a/Polyhedron/demo/Polyhedron/resources/icosphere.png b/Lab/demo/Lab/resources/icosphere.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/icosphere.png rename to Lab/demo/Lab/resources/icosphere.png diff --git a/Polyhedron/demo/Polyhedron/resources/kernel.png b/Lab/demo/Lab/resources/kernel.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/kernel.png rename to Lab/demo/Lab/resources/kernel.png diff --git a/Polyhedron/demo/Polyhedron/resources/left.png b/Lab/demo/Lab/resources/left.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/left.png rename to Lab/demo/Lab/resources/left.png diff --git a/Polyhedron/demo/Polyhedron/resources/left_arrow.png b/Lab/demo/Lab/resources/left_arrow.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/left_arrow.png rename to Lab/demo/Lab/resources/left_arrow.png diff --git a/Polyhedron/demo/Polyhedron/resources/menu.png b/Lab/demo/Lab/resources/menu.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/menu.png rename to Lab/demo/Lab/resources/menu.png diff --git a/Polyhedron/demo/Polyhedron/resources/minus.png b/Lab/demo/Lab/resources/minus.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/minus.png rename to Lab/demo/Lab/resources/minus.png diff --git a/Polyhedron/demo/Polyhedron/resources/no_interpolation_shader.frag b/Lab/demo/Lab/resources/no_interpolation_shader.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/no_interpolation_shader.frag rename to Lab/demo/Lab/resources/no_interpolation_shader.frag diff --git a/Polyhedron/demo/Polyhedron/resources/no_interpolation_shader.geom b/Lab/demo/Lab/resources/no_interpolation_shader.geom similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/no_interpolation_shader.geom rename to Lab/demo/Lab/resources/no_interpolation_shader.geom diff --git a/Polyhedron/demo/Polyhedron/resources/no_interpolation_shader.vert b/Lab/demo/Lab/resources/no_interpolation_shader.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/no_interpolation_shader.vert rename to Lab/demo/Lab/resources/no_interpolation_shader.vert diff --git a/Polyhedron/demo/Polyhedron/resources/pause.jpeg b/Lab/demo/Lab/resources/pause.jpeg similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pause.jpeg rename to Lab/demo/Lab/resources/pause.jpeg diff --git a/Polyhedron/demo/Polyhedron/resources/play.jpeg b/Lab/demo/Lab/resources/play.jpeg similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/play.jpeg rename to Lab/demo/Lab/resources/play.jpeg diff --git a/Polyhedron/demo/Polyhedron/resources/plus.png b/Lab/demo/Lab/resources/plus.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/plus.png rename to Lab/demo/Lab/resources/plus.png diff --git a/Polyhedron/demo/Polyhedron/resources/prism-open.png b/Lab/demo/Lab/resources/prism-open.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/prism-open.png rename to Lab/demo/Lab/resources/prism-open.png diff --git a/Polyhedron/demo/Polyhedron/resources/prism.png b/Lab/demo/Lab/resources/prism.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/prism.png rename to Lab/demo/Lab/resources/prism.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_box.png b/Lab/demo/Lab/resources/pss_box.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_box.png rename to Lab/demo/Lab/resources/pss_box.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_diff.png b/Lab/demo/Lab/resources/pss_diff.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_diff.png rename to Lab/demo/Lab/resources/pss_diff.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_freeform.png b/Lab/demo/Lab/resources/pss_freeform.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_freeform.png rename to Lab/demo/Lab/resources/pss_freeform.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_inter.png b/Lab/demo/Lab/resources/pss_inter.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_inter.png rename to Lab/demo/Lab/resources/pss_inter.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_new.png b/Lab/demo/Lab/resources/pss_new.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_new.png rename to Lab/demo/Lab/resources/pss_new.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_rectangle.png b/Lab/demo/Lab/resources/pss_rectangle.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_rectangle.png rename to Lab/demo/Lab/resources/pss_rectangle.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_region.png b/Lab/demo/Lab/resources/pss_region.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_region.png rename to Lab/demo/Lab/resources/pss_region.png diff --git a/Polyhedron/demo/Polyhedron/resources/pss_union.png b/Lab/demo/Lab/resources/pss_union.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pss_union.png rename to Lab/demo/Lab/resources/pss_union.png diff --git a/Polyhedron/demo/Polyhedron/resources/pyramid-open.png b/Lab/demo/Lab/resources/pyramid-open.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pyramid-open.png rename to Lab/demo/Lab/resources/pyramid-open.png diff --git a/Polyhedron/demo/Polyhedron/resources/pyramid.png b/Lab/demo/Lab/resources/pyramid.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/pyramid.png rename to Lab/demo/Lab/resources/pyramid.png diff --git a/Polyhedron/demo/Polyhedron/resources/reset.jpg b/Lab/demo/Lab/resources/reset.jpg similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/reset.jpg rename to Lab/demo/Lab/resources/reset.jpg diff --git a/Polyhedron/demo/Polyhedron/resources/right.png b/Lab/demo/Lab/resources/right.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/right.png rename to Lab/demo/Lab/resources/right.png diff --git a/Polyhedron/demo/Polyhedron/resources/right_arrow.png b/Lab/demo/Lab/resources/right_arrow.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/right_arrow.png rename to Lab/demo/Lab/resources/right_arrow.png diff --git a/Polyhedron/demo/Polyhedron/resources/rotate_around_cursor.png b/Lab/demo/Lab/resources/rotate_around_cursor.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/rotate_around_cursor.png rename to Lab/demo/Lab/resources/rotate_around_cursor.png diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3.frag b/Lab/demo/Lab/resources/shader_c3t3.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_c3t3.frag rename to Lab/demo/Lab/resources/shader_c3t3.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3.vert b/Lab/demo/Lab/resources/shader_c3t3.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_c3t3.vert rename to Lab/demo/Lab/resources/shader_c3t3.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.frag b/Lab/demo/Lab/resources/shader_c3t3_edges.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.frag rename to Lab/demo/Lab/resources/shader_c3t3_edges.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.vert b/Lab/demo/Lab/resources/shader_c3t3_edges.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_c3t3_edges.vert rename to Lab/demo/Lab/resources/shader_c3t3_edges.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.frag b/Lab/demo/Lab/resources/shader_c3t3_spheres.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.frag rename to Lab/demo/Lab/resources/shader_c3t3_spheres.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.vert b/Lab/demo/Lab/resources/shader_c3t3_spheres.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_c3t3_spheres.vert rename to Lab/demo/Lab/resources/shader_c3t3_spheres.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_dark_spheres.vert b/Lab/demo/Lab/resources/shader_dark_spheres.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_dark_spheres.vert rename to Lab/demo/Lab/resources/shader_dark_spheres.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_flat.frag b/Lab/demo/Lab/resources/shader_flat.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_flat.frag rename to Lab/demo/Lab/resources/shader_flat.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_flat.geom b/Lab/demo/Lab/resources/shader_flat.geom similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_flat.geom rename to Lab/demo/Lab/resources/shader_flat.geom diff --git a/Polyhedron/demo/Polyhedron/resources/shader_flat.vert b/Lab/demo/Lab/resources/shader_flat.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_flat.vert rename to Lab/demo/Lab/resources/shader_flat.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_instanced.vert b/Lab/demo/Lab/resources/shader_instanced.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_instanced.vert rename to Lab/demo/Lab/resources/shader_instanced.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_no_light_no_selection.frag b/Lab/demo/Lab/resources/shader_no_light_no_selection.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_no_light_no_selection.frag rename to Lab/demo/Lab/resources/shader_no_light_no_selection.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_old_flat.frag b/Lab/demo/Lab/resources/shader_old_flat.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_old_flat.frag rename to Lab/demo/Lab/resources/shader_old_flat.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_plane_two_faces.frag b/Lab/demo/Lab/resources/shader_plane_two_faces.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_plane_two_faces.frag rename to Lab/demo/Lab/resources/shader_plane_two_faces.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_spheres.vert b/Lab/demo/Lab/resources/shader_spheres.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_spheres.vert rename to Lab/demo/Lab/resources/shader_spheres.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_tet_filter.frag b/Lab/demo/Lab/resources/shader_tet_filter.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_tet_filter.frag rename to Lab/demo/Lab/resources/shader_tet_filter.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_tet_filter.vert b/Lab/demo/Lab/resources/shader_tet_filter.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_tet_filter.vert rename to Lab/demo/Lab/resources/shader_tet_filter.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_light.frag b/Lab/demo/Lab/resources/shader_with_light.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_with_light.frag rename to Lab/demo/Lab/resources/shader_with_light.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_light.vert b/Lab/demo/Lab/resources/shader_with_light.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_with_light.vert rename to Lab/demo/Lab/resources/shader_with_light.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_texture.frag b/Lab/demo/Lab/resources/shader_with_texture.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_with_texture.frag rename to Lab/demo/Lab/resources/shader_with_texture.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_texture.vert b/Lab/demo/Lab/resources/shader_with_texture.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_with_texture.vert rename to Lab/demo/Lab/resources/shader_with_texture.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.frag b/Lab/demo/Lab/resources/shader_with_textured_edges.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.frag rename to Lab/demo/Lab/resources/shader_with_textured_edges.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.vert b/Lab/demo/Lab/resources/shader_with_textured_edges.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_with_textured_edges.vert rename to Lab/demo/Lab/resources/shader_with_textured_edges.vert diff --git a/Polyhedron/demo/Polyhedron/resources/shader_without_light.frag b/Lab/demo/Lab/resources/shader_without_light.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_without_light.frag rename to Lab/demo/Lab/resources/shader_without_light.frag diff --git a/Polyhedron/demo/Polyhedron/resources/shader_without_light.vert b/Lab/demo/Lab/resources/shader_without_light.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/shader_without_light.vert rename to Lab/demo/Lab/resources/shader_without_light.vert diff --git a/Polyhedron/demo/Polyhedron/resources/simplification.png b/Lab/demo/Lab/resources/simplification.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/simplification.png rename to Lab/demo/Lab/resources/simplification.png diff --git a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.frag b/Lab/demo/Lab/resources/solid_wireframe_shader.frag similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.frag rename to Lab/demo/Lab/resources/solid_wireframe_shader.frag diff --git a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.geom b/Lab/demo/Lab/resources/solid_wireframe_shader.geom similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.geom rename to Lab/demo/Lab/resources/solid_wireframe_shader.geom diff --git a/Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.vert b/Lab/demo/Lab/resources/solid_wireframe_shader.vert similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/solid_wireframe_shader.vert rename to Lab/demo/Lab/resources/solid_wireframe_shader.vert diff --git a/Polyhedron/demo/Polyhedron/resources/tetrahedron.png b/Lab/demo/Lab/resources/tetrahedron.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/tetrahedron.png rename to Lab/demo/Lab/resources/tetrahedron.png diff --git a/Polyhedron/demo/Polyhedron/resources/top.png b/Lab/demo/Lab/resources/top.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/top.png rename to Lab/demo/Lab/resources/top.png diff --git a/Polyhedron/demo/Polyhedron/resources/up.png b/Lab/demo/Lab/resources/up.png similarity index 100% rename from Polyhedron/demo/Polyhedron/resources/up.png rename to Lab/demo/Lab/resources/up.png diff --git a/Polyhedron/demo/Polyhedron/testing/data/camera.camera.txt b/Lab/demo/Lab/testing/data/camera.camera.txt similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/camera.camera.txt rename to Lab/demo/Lab/testing/data/camera.camera.txt diff --git a/Polyhedron/demo/Polyhedron/testing/data/mini.surf b/Lab/demo/Lab/testing/data/mini.surf similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/mini.surf rename to Lab/demo/Lab/testing/data/mini.surf diff --git a/Polyhedron/demo/Polyhedron/testing/data/oni.las b/Lab/demo/Lab/testing/data/oni.las similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/oni.las rename to Lab/demo/Lab/testing/data/oni.las diff --git a/Polyhedron/demo/Polyhedron/testing/data/poly.polylines.txt b/Lab/demo/Lab/testing/data/poly.polylines.txt similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/poly.polylines.txt rename to Lab/demo/Lab/testing/data/poly.polylines.txt diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.inr b/Lab/demo/Lab/testing/data/sphere.inr similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.inr rename to Lab/demo/Lab/testing/data/sphere.inr diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.inr.gz b/Lab/demo/Lab/testing/data/sphere.inr.gz similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.inr.gz rename to Lab/demo/Lab/testing/data/sphere.inr.gz diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.mesh b/Lab/demo/Lab/testing/data/sphere.mesh similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.mesh rename to Lab/demo/Lab/testing/data/sphere.mesh diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.nef3 b/Lab/demo/Lab/testing/data/sphere.nef3 similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.nef3 rename to Lab/demo/Lab/testing/data/sphere.nef3 diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.selection.txt b/Lab/demo/Lab/testing/data/sphere.selection.txt similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.selection.txt rename to Lab/demo/Lab/testing/data/sphere.selection.txt diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.ts b/Lab/demo/Lab/testing/data/sphere.ts similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.ts rename to Lab/demo/Lab/testing/data/sphere.ts diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.vtk b/Lab/demo/Lab/testing/data/sphere.vtk similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.vtk rename to Lab/demo/Lab/testing/data/sphere.vtk diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.vtp b/Lab/demo/Lab/testing/data/sphere.vtp similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.vtp rename to Lab/demo/Lab/testing/data/sphere.vtp diff --git a/Polyhedron/demo/Polyhedron/testing/data/sphere.vtu b/Lab/demo/Lab/testing/data/sphere.vtu similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/data/sphere.vtu rename to Lab/demo/Lab/testing/data/sphere.vtu diff --git a/Polyhedron/demo/Polyhedron/testing/test_demo.js b/Lab/demo/Lab/testing/test_demo.js similarity index 100% rename from Polyhedron/demo/Polyhedron/testing/test_demo.js rename to Lab/demo/Lab/testing/test_demo.js diff --git a/Polyhedron/demo/Polyhedron/texture.cpp b/Lab/demo/Lab/texture.cpp similarity index 100% rename from Polyhedron/demo/Polyhedron/texture.cpp rename to Lab/demo/Lab/texture.cpp diff --git a/Polyhedron/demo/Polyhedron/texture.h b/Lab/demo/Lab/texture.h similarity index 100% rename from Polyhedron/demo/Polyhedron/texture.h rename to Lab/demo/Lab/texture.h diff --git a/Polyhedron/demo/Polyhedron/triangulate_primitive.h b/Lab/demo/Lab/triangulate_primitive.h similarity index 100% rename from Polyhedron/demo/Polyhedron/triangulate_primitive.h rename to Lab/demo/Lab/triangulate_primitive.h diff --git a/Lab/package_info/Lab/copyright b/Lab/package_info/Lab/copyright new file mode 100644 index 00000000000..82b520cf64c --- /dev/null +++ b/Lab/package_info/Lab/copyright @@ -0,0 +1 @@ +GeometryFactory \ No newline at end of file diff --git a/Lab/package_info/Lab/dependencies b/Lab/package_info/Lab/dependencies new file mode 100644 index 00000000000..76331fefe0d --- /dev/null +++ b/Lab/package_info/Lab/dependencies @@ -0,0 +1,2 @@ +Installation +STL_Extension diff --git a/Lab/package_info/Lab/description.txt b/Lab/package_info/Lab/description.txt new file mode 100644 index 00000000000..58071f8283e --- /dev/null +++ b/Lab/package_info/Lab/description.txt @@ -0,0 +1 @@ +Application running 3D algorithms on 3D items. \ No newline at end of file diff --git a/Lab/package_info/Lab/license.txt b/Lab/package_info/Lab/license.txt new file mode 100644 index 00000000000..8bb8efcb72b --- /dev/null +++ b/Lab/package_info/Lab/license.txt @@ -0,0 +1 @@ +GPL (v3 or later) diff --git a/Lab/package_info/Lab/long_description.txt b/Lab/package_info/Lab/long_description.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Lab/package_info/Lab/maintainer b/Lab/package_info/Lab/maintainer new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui index d63b9d7c9b1..6a9f06c68d2 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui @@ -38,7 +38,7 @@
- &File + File @@ -55,7 +55,7 @@ - &Operations + Operations @@ -75,7 +75,7 @@ - &Creations + Creations @@ -88,7 +88,7 @@ - &View + View @@ -103,67 +103,67 @@ - &Import OFF + Import OFF - &Quit + Quit - &Subdivide all volumes + Subdivide all volumes - &Subdivide all volumes - by Pqq + Subdivide all volumes - by Pqq - Create &3 cubes + Create 3 cubes - Import 3D&TS + Import 3DTS - &Clear + Clear - Create &2 volumes + Create 2 volumes - &Dual + Dual - &Close all volumes + Close all volumes - Create &cube + Create cube - S&ew3 all same facets + Sew3 all same facets - Create &mesh + Create mesh @@ -173,22 +173,22 @@ - &Remove volumes + Remove volumes - &Triangulate facets + Triangulate facets - &Unsew3 volumes + Unsew3 volumes - Reverse &orientation + Reverse orientation @@ -201,12 +201,12 @@ - Extend &filled volumes + Extend filled volumes - Extend &hidden volumes + Extend hidden volumes @@ -216,7 +216,7 @@ - &Merge volumes + Merge volumes @@ -231,12 +231,12 @@ - &Load + Load - &Save + Save diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index dafcccb1695..e7ff28d2ef2 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -9,37 +9,73 @@ // // Author(s) : Guillaume Damiand // Contributor(s): Kumar Snehasish +// Mostafa Ashraf // #include "Viewer.h" #include -Viewer::Viewer(QWidget* parent) : - Base(parent, nullptr, ""), +Viewer::Viewer(QWidget *parent) + : Base(parent, m_graphic_buffer, ""), m_previous_scene_empty(true) -{} +{ + m_gs_options.face_color=[](const LCC & alcc, + Dart_const_descriptor dh)->CGAL::IO::Color + { + if(alcc.template is_free<3>(dh)) + { return alcc.template info<3>(dh).color(); } -void Viewer::setScene(Scene* scene_, bool doredraw) + if(!alcc.template info<3>(dh).is_visible() || + !alcc.template info<3>(dh).is_filled()) + { return alcc.template info<3>(alcc.template beta<3>(dh)).color(); } + + if(!alcc.template info<3>(alcc.template beta<3>(dh)).is_visible() || + !alcc.template info<3>(alcc.template beta<3>(dh)).is_filled()) + { return alcc.template info<3>(dh).color(); } + + const CGAL::IO::Color& c1=alcc.template info<3>(dh).color(); + const CGAL::IO::Color& c2=alcc.template info<3>(alcc.template beta<3>(dh)).color(); + return CGAL::IO::Color((c1[0]+c2[0])/2, (c1[1]+c2[1])/2, (c1[2]+c2[2])/2); + }; + + m_gs_options.colored_face=[](const LCC &, Dart_const_descriptor)->bool + { return true; }; + + m_gs_options.draw_volume=[](const LCC & alcc, Dart_const_descriptor dh)->bool + { return alcc.template info<3>(dh).is_visible(); }; + + m_gs_options.volume_wireframe=[](const LCC& alcc, Dart_const_descriptor dh)->bool + { return !(alcc.template info<3>(dh).is_filled()); }; +} + +void Viewer::setScene(Scene *scene_, bool doredraw) { scene = scene_; - set_lcc(scene->lcc, doredraw); + + if (scene->lcc!=nullptr) + { CGAL::add_to_graphics_scene(*scene->lcc, m_graphic_buffer, m_gs_options); } + + if (doredraw) + { Base::redraw(); } } void Viewer::sceneChanged() { - Base::compute_elements(); - this->camera()-> - setSceneBoundingBox(CGAL::qglviewer::Vec(m_bounding_box.xmin(), - m_bounding_box.ymin(), - m_bounding_box.zmin()), - CGAL::qglviewer::Vec(m_bounding_box.xmax(), - m_bounding_box.ymax(), - m_bounding_box.zmax())); + m_graphic_buffer.clear(); + CGAL::add_to_graphics_scene(*scene->lcc, m_graphic_buffer, m_gs_options); + + this->camera()->setSceneBoundingBox( + CGAL::qglviewer::Vec(gBuffer.bounding_box().xmin(), + gBuffer.bounding_box().ymin(), + gBuffer.bounding_box().zmin()), + CGAL::qglviewer::Vec(gBuffer.bounding_box().xmax(), + gBuffer.bounding_box().ymax(), + gBuffer.bounding_box().zmax())); Base::redraw(); if (m_previous_scene_empty) { this->showEntireScene(); } - m_previous_scene_empty = scene->lcc->is_empty(); // for the next call to sceneChanged + m_previous_scene_empty=scene->lcc->is_empty(); // for the next call to sceneChanged } void Viewer::keyPressEvent(QKeyEvent *e) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index ff1501ba2cd..95167205459 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -9,106 +9,20 @@ // // Author(s) : Guillaume Damiand // Kumar Snehasish +// Mostafa Ashraf // #ifndef VIEWER_H #define VIEWER_H #include "typedefs.h" #include +#include -// Functor used by SimpleLCCViewerQt to colorize of not elements. -struct MyDrawingFunctorLCC -{ - /// @return true iff the volume containing dh is drawn. - template - bool draw_volume(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { return alcc.template info<3>(dh).is_visible(); } - /// @return true iff the face containing dh is drawn. - template - bool draw_face(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the edge containing dh is drawn. - template - bool draw_edge(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the vertex containing dh is drawn. - template - bool draw_vertex(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - - /// @return true iff the volume containing dh is drawn in wireframe. - template - bool volume_wireframe(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { return !(alcc.template info<3>(dh).is_filled()); } - /// @return true iff the face containing dh is drawn in wireframe. - template - bool face_wireframe(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - - /// @return true iff the volume containing dh is colored. - template - bool colored_volume(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the face containing dh is colored. - /// if we have also colored_volume(alcc, dh), the volume color is - /// ignored and only the face color is considered. - template - bool colored_face(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - /// @return true iff the edge containing dh is colored. - template - bool colored_edge(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - /// @return true iff the vertex containing dh is colored. - template - bool colored_vertex(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - - /// @return the color of the volume containing dh - /// used only if colored_volume(alcc, dh) and !colored_face(alcc, dh) - template - CGAL::IO::Color volume_color(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { return alcc.template info<3>(dh).color(); } - /// @return the color of the face containing dh - /// used only if colored_face(alcc, dh) - template - CGAL::IO::Color face_color(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { - CGAL::Random random((unsigned int)(alcc.darts().index(dh))); - return get_random_color(random); - } - /// @return the color of the edge containing dh - /// used only if colored_edge(alcc, dh) - template - CGAL::IO::Color edge_color(const LCC&, - typename LCC::Dart_const_descriptor) const - { return CGAL::IO::Color(0, 0, 0); } - /// @return the color of the vertex containing dh - /// used only if colored_vertex(alcc, dh) - template - CGAL::IO::Color vertex_color(const LCC&, - typename LCC::Dart_const_descriptor) const - { return CGAL::IO::Color(0, 0, 0); } -}; - - -class Viewer : public CGAL::SimpleLCCViewerQt +class Viewer : public CGAL::Basic_viewer { Q_OBJECT - typedef CGAL::SimpleLCCViewerQt Base; + typedef CGAL::Basic_viewer Base; public: Viewer(QWidget* parent); @@ -120,6 +34,12 @@ public Q_SLOTS: void sceneChanged(); private: + CGAL::Graphics_scene_options m_gs_options; + CGAL::Graphics_scene m_graphic_buffer; Scene* scene; bool m_previous_scene_empty; }; diff --git a/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h b/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h index 31fde91f697..36bcfc807f7 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h @@ -165,8 +165,9 @@ public: }; typedef CGAL::Linear_cell_complex_for_combinatorial_map<3,3,Mytraits,Myitems> LCC; -typedef LCC::Dart_descriptor Dart_descriptor; -typedef LCC::Vertex_attribute Vertex; +typedef LCC::Dart_descriptor Dart_descriptor; +typedef LCC::Dart_const_descriptor Dart_const_descriptor; +typedef LCC::Vertex_attribute Vertex; typedef LCC::Point Point_3; typedef LCC::Vector Vector_3; diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h index 648d2c81ef3..6dc9b021133 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h @@ -3,14 +3,73 @@ namespace CGAL { /*! \ingroup PkgDrawLinearCellComplex -opens a new window and draws `alcc`, a model of the `LinearCellComplex` concept. A call to this function is blocking, that is the program continues as soon as the user closes the window. 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 LCC a model of the `LinearCellComplex` concept. -\param alcc the linear cell complex to draw. +opens a new window and draws a linear cell complex. 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 LCC which must be an instanciation of a `CGAL::Linear_cell_complex_for_combinatorial_map<...>` or `CGAL::Linear_cell_complex_for_generalized_map<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param lcc the linear cell complex to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Linear_cell_complex_base& lcc, const GSOptions& gso); + +\cgalAdvancedEnd +*/ + template + void draw(const LCC& lcc, const GSOptions& gso); + +/*! +\ingroup PkgDrawLinearCellComplex + +A shortcut to `CGAL::draw(lcc, Graphics_scene_options{})`. +*/ + template + void draw(const LCC& lcc); + +/*! +\ingroup PkgDrawLinearCellComplex + +adds the vertices, edges and faces of `lcc` 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 LCC which must be an instanciation of a `CGAL::Linear_cell_complex_for_combinatorial_map<...>` or `CGAL::Linear_cell_complex_for_generalized_map<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param lcc the linear cell complex 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::Linear_cell_complex_base& lcc, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const LCC& lcc, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawLinearCellComplex + +A shortcut to `CGAL::add_to_graphics_scene(lcc, gs, Graphics_scene_options{})`. */ template -void draw(const LCC& alcc); +void add_to_graphics_scene(const LCC& lcc, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt index ad0479d5128..a9ead2ceac0 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt @@ -72,5 +72,6 @@ \cgalCRPSubsection{Draw a Linear Cell Complex} - \link PkgDrawLinearCellComplex CGAL::draw() \endlink +- \link PkgDrawLinearCellComplex CGAL::add_in_graphics_scene() \endlink */ diff --git a/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h b/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h deleted file mode 100644 index f01ab8208f2..00000000000 --- a/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h +++ /dev/null @@ -1,1190 +0,0 @@ -// Copyright (c) 2011 CNRS and LIRIS' Establishments (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org) -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Guillaume Damiand - -#ifndef CGAL_BASIC_VIEWER_H -#define CGAL_BASIC_VIEWER_H - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define NB_VBO_BUFFERS 8 -#define NB_VAO_BUFFERS 4 - -typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; -typedef Local_kernel::Point_3 Local_point; -typedef Local_kernel::Vector_3 Local_vector; - -//Vertex source code -const char vertex_source_mono[] = - { - "#version 150 \n" - "in highp vec4 vertex;\n" - "in highp vec3 normal;\n" - - "uniform highp mat4 mvp_matrix;\n" - "uniform highp mat4 mv_matrix; \n" - - "out highp vec4 fP; \n" - "out highp vec3 fN; \n" - "void main(void)\n" - "{\n" - " fP = mv_matrix * vertex; \n" - " fN = mat3(mv_matrix)* normal; \n" - " gl_Position = mvp_matrix * vertex;\n" - "}" - }; - -const char vertex_source_color[] = - { - "#version 150 \n" - "in highp vec4 vertex;\n" - "in highp vec3 normal;\n" - "in highp vec3 color;\n" - - "uniform highp mat4 mvp_matrix;\n" - "uniform highp mat4 mv_matrix; \n" - - "out highp vec4 fP; \n" - "out highp vec3 fN; \n" - "out highp vec4 fColor; \n" - "void main(void)\n" - "{\n" - " fP = mv_matrix * vertex; \n" - " fN = mat3(mv_matrix)* normal; \n" - " fColor = vec4(color, 1.0); \n" - " gl_Position = mvp_matrix * vertex;\n" - "}" - }; - -//Vertex source code -const char fragment_source_mono[] = - { - "#version 150 \n" - "in highp vec4 fP; \n" - "in highp vec3 fN; \n" - "uniform highp vec4 color; \n" - "uniform highp vec4 light_pos; \n" - "uniform highp vec4 light_diff; \n" - "uniform highp vec4 light_spec; \n" - "uniform highp vec4 light_amb; \n" - "uniform float spec_power ; \n" - "out highp vec4 out_color; \n" - - "void main(void) { \n" - - " highp vec3 L = light_pos.xyz - fP.xyz; \n" - " highp vec3 V = -fP.xyz; \n" - - " highp vec3 N = normalize(fN); \n" - " L = normalize(L); \n" - " V = normalize(V); \n" - - " highp vec3 R = reflect(-L, N); \n" - " highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * color; \n" - " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" - - "out_color = light_amb*color + diffuse ; \n" - "} \n" - "\n" - }; - -const char fragment_source_color[] = - { - "#version 150 \n" - "in highp vec4 fP; \n" - "in highp vec3 fN; \n" - "in highp vec4 fColor; \n" - "uniform highp vec4 light_pos; \n" - "uniform highp vec4 light_diff; \n" - "uniform highp vec4 light_spec; \n" - "uniform highp vec4 light_amb; \n" - "uniform float spec_power ; \n" - "out highp vec4 out_color; \n" - - "void main(void) { \n" - - " highp vec3 L = light_pos.xyz - fP.xyz; \n" - " highp vec3 V = -fP.xyz; \n" - - " highp vec3 N = normalize(fN); \n" - " L = normalize(L); \n" - " V = normalize(V); \n" - - " highp vec3 R = reflect(-L, N); \n" - " highp vec4 diffuse = max(dot(N,L), 0.0) * light_diff * fColor; \n" - " highp vec4 specular = pow(max(dot(R,V), 0.0), spec_power) * light_spec; \n" - - "out_color = light_amb*fColor + diffuse ; \n" - "} \n" - "\n" - }; - -//Vertex source code -const char vertex_source_p_l[] = - { - "#version 150 \n" - "in highp vec4 vertex;\n" - "uniform highp mat4 mvp_matrix;\n" - "void main(void)\n" - "{\n" - " gl_Position = mvp_matrix * vertex;\n" - "}" - }; -//Vertex source code -const char fragment_source_p_l[] = - { - "#version 150 \n" - "uniform highp vec4 color; \n" - "out highp vec4 out_color; \n" - "void main(void) { \n" - "out_color = color; \n" - "} \n" - "\n" - }; - -namespace internal { - template - void newell_single_step_3(const Point& p, const Point& q, Vector& n) - { - // Compute normal of the face by using Newell's method: for each edge PQ - // Nx += (Py - Qy) * (Pz + Qz); - // Ny += (Pz - Qz) * (Px + Qx); - // Nz += (Px - Qx) * (Py + Qy); - n = Vector(n.x()+((p.y()-q.y())*(p.z()+q.z())), - n.y()+((p.z()-q.z())*(p.x()+q.x())), - n.z()+((p.x()-q.x())*(p.y()+q.y()))); - } -} // End namespace internal - -template -typename K::Vector_3 compute_normal_of_face(const std::vector& points) -{ - typename K::Vector_3 normal(CGAL::NULL_VECTOR); - unsigned int nb = 0; - for (std::size_t i=0; i0); - return (typename K::Construct_scaled_vector_3()(normal, 1.0/nb)); -} - -class Basic_viewer : public CGAL::QGLViewer, public QOpenGLFunctions -{ - struct Vertex_info - { - Local_vector v; - }; - - struct Face_info - { - bool exist_edge[3]; - bool is_external; - bool is_process; - }; - - typedef CGAL::Projection_traits_3 P_traits; - typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; - - typedef CGAL::Triangulation_face_base_with_info_2 Fb1; - - typedef CGAL::Constrained_triangulation_face_base_2 Fb; - typedef CGAL::Triangulation_data_structure_2 TDS; - typedef CGAL::Exact_predicates_tag Itag; - typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; - -public: - // Constructor/Destructor - Basic_viewer(const char* title="") : - CGAL::QGLViewer(CGAL::Qt::createOpenGLContext()), - m_draw_vertices(true), - m_draw_edges(true), - m_draw_faces(true), - m_flatShading(true), - m_use_mono_color(false), - m_inverse_normal(false), - m_empty(true), - m_size_points(7.), - m_size_edges(3.1), - m_vertices_mono_color(51, 51, 178), - m_edges_mono_color(51, 51, 148), - m_faces_mono_color(180, 125, 200), - m_ambient_color(0.6f, 0.5f, 0.5f, 0.5f), - m_are_buffers_initialized(false), - m_face_started(false) - { - if (title[0]==0) - setWindowTitle("CGAL Basic Viewer"); - else - setWindowTitle(title); - - resize(500, 450); - - if ( is_empty() ) - { - bb=Local_point(CGAL::ORIGIN).bbox(); - bb=bb + Local_point(1,1,1).bbox(); // To avoid a warning from Qglviewer - } - } - - ~Basic_viewer() - { - for (int i=0; i& point_vector) - { - point_vector.push_back(p.x()); - point_vector.push_back(p.y()); - point_vector.push_back(p.z()); - - if (is_empty()) - { bb=p.bbox(); m_empty=false; } - else - { bb=bb+p.bbox(); } - } - - void add_color(const CGAL::IO::Color& acolor, std::vector& color_vector) - { - color_vector.push_back((double)color_of_face.red()/(double)255); - color_vector.push_back((double)color_of_face.green()/(double)255); - color_vector.push_back((double)color_of_face.blue()/(double)255); - } - - void add_normal(const Local_vector& n, std::vector& normal_vector) - { - normal_vector.push_back(n.x()); - normal_vector.push_back(n.y()); - normal_vector.push_back(n.z()); - } - - void add_mono_point(const Local_point& p) - { add_point(p, arrays[POS_MONO_POINTS]); } - - void add_colored_point(const Local_point& p, const CGAL::IO::Color& acolor) - { - add_point(p, arrays[POS_COLORED_POINTS]); - add_color(acolor, arrays[COLOR_POINTS]); - } - - void add_mono_segment(const Local_point& p1, const Local_point& p2) - { - add_point(p1, arrays[POS_MONO_SEGMENTS]); - add_point(p2, arrays[POS_MONO_SEGMENTS]); - } - - void add_colored_segment(const Local_point& p1, const Local_point& p2, - const CGAL::IO::Color& acolor) - { - add_point(p1, arrays[POS_COLORED_SEGMENTS]); - add_point(p2, arrays[POS_COLORED_SEGMENTS]); - add_color(acolor, arrays[COLOR_SEGMENTS]); - } - - void face_begin() - { - if (m_face_started) - { - std::cerr<<"You cannot start a new face before to finish the previous one."<(points_of_face); - - if (points_of_face.size()==3) // Triangle: no need to triangulate - { - for (int i=0; i<3; ++i) - { - // The point - add_point(points_of_face[i], arrays[m_started_face_is_colored? - POS_COLORED_FACES: - POS_MONO_FACES]); - - // Its color - if (m_started_face_is_colored) - { add_color(color_of_face, arrays[COLOR_FACES]); } - - // Its flat normal - add_normal(normal, arrays[m_started_face_is_colored? - FLAT_NORMAL_COLORED_FACES: - FLAT_NORMAL_MONO_FACES]); - - // Its smoth normal (if given by the user) - if (vertex_normals_for_face.size()==3) - { // Here we have 3 vertex normals; we can use Gourod - add_normal(vertex_normals_for_face[i], arrays[m_started_face_is_colored? - SMOOTH_NORMAL_COLORED_FACES: - SMOOTH_NORMAL_MONO_FACES]); - } - else - { // Here user does not provide all vertex normals: we use face normal instead - // and thus we will not be able to use Gourod - add_normal(normal, arrays[m_started_face_is_colored? - SMOOTH_NORMAL_COLORED_FACES: - SMOOTH_NORMAL_MONO_FACES]); - } - } - } - // TODO CASE OF 4 POINTS ? PB HOW TO FIND (EASILY) THE TWO POINTS TO LINK ? - // else if (points_of_face.size()==4) - else - { // More than 3 points: we triangulate - try - { - P_traits cdt_traits(normal); - CDT cdt(cdt_traits); - - bool with_vertex_normal=(vertex_normals_for_face.size()==points_of_face.size()); - - // (1) We insert all the edges as constraint in the CDT. - typename CDT::Vertex_descriptor previous=NULL, first=NULL; - for (int i=0; iinfo().v=vertex_normals_for_face[i]; } - else - { vh->info().v=normal; } - - if(previous!=NULL && previous!=vh) - { cdt.insert_constraint(previous, vh); } - previous=vh; - } - - if (previous!=NULL && previous!=first) - cdt.insert_constraint(previous, first); - - // (2) We mark all external triangles - // (2.1) We initialize is_external and is_process values - for(typename CDT::All_faces_iterator fit = cdt.all_faces_begin(), - fitend = cdt.all_faces_end(); fit!=fitend; ++fit) - { - fit->info().is_external = true; - fit->info().is_process = false; - } - // (2.2) We check if the facet is external or internal - std::queue face_queue; - typename CDT::Face_descriptor face_internal = NULL; - if (cdt.infinite_vertex()->face()!=NULL) - face_queue.push(cdt.infinite_vertex()->face()); - while(! face_queue.empty() ) - { - typename CDT::Face_descriptor fh = face_queue.front(); - face_queue.pop(); - if(!fh->info().is_process) - { - fh->info().is_process = true; - for(int i=0; i<3; ++i) - { - if(!cdt.is_constrained(std::make_pair(fh, i))) - { - if (fh->neighbor(i)!=NULL) - face_queue.push(fh->neighbor(i)); - } - else if (face_internal==NULL) - { - face_internal = fh->neighbor(i); - } - } - } - } - - if ( face_internal!=NULL ) - face_queue.push(face_internal); - - while(! face_queue.empty() ) - { - typename CDT::Face_descriptor fh = face_queue.front(); - face_queue.pop(); - if(!fh->info().is_process) - { - fh->info().is_process = true; - fh->info().is_external = false; - for(int i=0; i<3; ++i) - { - if(!cdt.is_constrained(std::make_pair(fh, i))) - { - if (fh->neighbor(i)!=NULL) - face_queue.push(fh->neighbor(i)); - } - } - } - } - - // (3) Now we iterates on the internal faces to add the vertices to the - // positions and the normals to the appropriate vectors - for(typename CDT::Finite_faces_iterator ffit=cdt.finite_faces_begin(), - ffitend = cdt.finite_faces_end(); ffit!=ffitend; ++ffit) - { - if(!ffit->info().is_external) - { - for(int i=0; i<3; ++i) - { - // The point - add_point(ffit->vertex(i)->point(), arrays[m_started_face_is_colored? - POS_COLORED_FACES: - POS_MONO_FACES]); - - // Its color - if (m_started_face_is_colored) - { add_color(color_of_face, arrays[COLOR_FACES]); } - - // Its flat normal - add_normal(normal, arrays[m_started_face_is_colored? - FLAT_NORMAL_COLORED_FACES: - FLAT_NORMAL_MONO_FACES]); - - // Its smoth normal (if given by the user) - add_normal(ffit->vertex(i)->info().v, arrays[m_started_face_is_colored? - SMOOTH_NORMAL_COLORED_FACES: - SMOOTH_NORMAL_MONO_FACES]); - } - } - } - } - catch(...) - { // Triangulation crash: the face is not filled - std::cout<<"Catch: face not filled."<compileSourceCode(vertex_source_mono)) - { std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(fragment_source_mono)) - { std::cerr<<"Compiling fragmentsource FAILED"<compileSourceCode(vertex_source_mono)) - { std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(fragment_source_mono)) - { std::cerr<<"Compiling fragmentsource FAILED"<compileSourceCode(vertex_source_color)) - { std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(fragment_source_color)) - { std::cerr<<"Compiling fragmentsource FAILED"<compileSourceCode(vertex_source_p_l)) - { std::cerr<<"Compiling vertex source FAILED"<compileSourceCode(fragment_source_p_l)) - { std::cerr<<"Compiling fragmentsource FAILED"<(arrays[POS_MONO_FACES].size()*sizeof(float))); - vertexLocation[vaon] = rendering_program_mono.attributeLocation("vertex"); - rendering_program_mono.bind(); - rendering_program_mono.enableAttributeArray(vertexLocation[vaon]); - rendering_program_mono.setAttributeBuffer(vertexLocation[vaon],GL_FLOAT,0,3); - rendering_program_mono.release(); - - buffers[bufn].release(); - ++bufn; - - // 3.1.2) normals of the mono faces - assert(bufn(arrays[FLAT_NORMAL_MONO_FACES].size()* - sizeof(float))); - } - else - { - buffers[bufn].allocate(arrays[SMOOTH_NORMAL_MONO_FACES].data(), - static_cast(arrays[SMOOTH_NORMAL_MONO_FACES].size()* - sizeof(float))); - } - normalsLocation = rendering_program_mono.attributeLocation("normal"); - rendering_program_mono.bind(); - rendering_program_mono.enableAttributeArray(normalsLocation); - rendering_program_mono.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3); - rendering_program_mono.release(); - - buffers[bufn].release(); - ++bufn; - - vao[vaon].release(); - ++vaon; - - // 3.2) Color faces - assert(vaon(arrays[POS_COLORED_FACES].size()*sizeof(float))); - vertexLocation[vaon] = rendering_program_color.attributeLocation("vertex"); - rendering_program_color.bind(); - rendering_program_color.enableAttributeArray(vertexLocation[vaon]); - rendering_program_color.setAttributeBuffer(vertexLocation[vaon],GL_FLOAT,0,3); - rendering_program_color.release(); - - buffers[bufn].release(); - ++bufn; - - // 3.2.2) normals of the color faces - assert(bufn(arrays[FLAT_NORMAL_COLORED_FACES].size()* - sizeof(float))); - } - else - { - buffers[bufn].allocate(arrays[SMOOTH_NORMAL_COLORED_FACES].data(), - static_cast(arrays[SMOOTH_NORMAL_COLORED_FACES].size()* - sizeof(float))); - } - normalsLocation = rendering_program_color.attributeLocation("normal"); - rendering_program_color.bind(); - rendering_program_color.enableAttributeArray(normalsLocation); - rendering_program_color.setAttributeBuffer(normalsLocation,GL_FLOAT,0,3); - rendering_program_color.release(); - - buffers[bufn].release(); - ++bufn; - - // 3.2.3) colors of the faces - if (!m_use_mono_color) - { - assert(bufn(arrays[COLOR_FACES].size()*sizeof(float))); - colorsLocation = rendering_program_color.attributeLocation("color"); - rendering_program_color.bind(); - rendering_program_color.enableAttributeArray(colorsLocation); - rendering_program_color.setAttributeBuffer(colorsLocation,GL_FLOAT,0,3); - rendering_program_color.release(); - - buffers[bufn].release(); - ++bufn; - } - - vao[vaon].release(); - ++vaon; - - m_are_buffers_initialized = true; - } - - void attrib_buffers(CGAL::QGLViewer* viewer) - { - QMatrix4x4 mvpMatrix; - QMatrix4x4 mvMatrix; - double mat[16]; - viewer->camera()->getModelViewProjectionMatrix(mat); - for(int i=0; i < 16; i++) - { - mvpMatrix.data()[i] = (float)mat[i]; - } - viewer->camera()->getModelViewMatrix(mat); - for(int i=0; i < 16; i++) - { - mvMatrix.data()[i] = (float)mat[i]; - } - // define material - QVector4D diffuse( 0.9f, - 0.9f, - 0.9f, - 0.9f ); - - QVector4D specular( 0.0f, - 0.0f, - 0.0f, - 1.0f ); - - QVector4D position((bb.xmax()-bb.xmin())/2, (bb.ymax()-bb.ymin())/2,bb.zmax(), 0.0 ); - GLfloat shininess = 1.0f; - - rendering_program_mono.bind(); - mvpLocation[0] = rendering_program_mono.uniformLocation("mvp_matrix"); - mvLocation = rendering_program_mono.uniformLocation("mv_matrix"); - lightLocation[0] = rendering_program_mono.uniformLocation("light_pos"); - lightLocation[1] = rendering_program_mono.uniformLocation("light_diff"); - lightLocation[2] = rendering_program_mono.uniformLocation("light_spec"); - lightLocation[3] = rendering_program_mono.uniformLocation("light_amb"); - lightLocation[4] = rendering_program_mono.uniformLocation("spec_power"); - - rendering_program_mono.setUniformValue(lightLocation[0], position); - rendering_program_mono.setUniformValue(lightLocation[1], diffuse); - rendering_program_mono.setUniformValue(lightLocation[2], specular); - rendering_program_mono.setUniformValue(lightLocation[3], m_ambient_color); - rendering_program_mono.setUniformValue(lightLocation[4], shininess); - rendering_program_mono.setUniformValue(mvpLocation[0], mvpMatrix); - rendering_program_mono.setUniformValue(mvLocation, mvMatrix); - - colorLocation1 = rendering_program_mono.uniformLocation("color"); - rendering_program_mono.release(); - - rendering_program_color.bind(); - mvpLocation[0] = rendering_program_color.uniformLocation("mvp_matrix"); - mvLocation = rendering_program_color.uniformLocation("mv_matrix"); - lightLocation[0] = rendering_program_color.uniformLocation("light_pos"); - lightLocation[1] = rendering_program_color.uniformLocation("light_diff"); - lightLocation[2] = rendering_program_color.uniformLocation("light_spec"); - lightLocation[3] = rendering_program_color.uniformLocation("light_amb"); - lightLocation[4] = rendering_program_color.uniformLocation("spec_power"); - - rendering_program_color.setUniformValue(lightLocation[0], position); - rendering_program_color.setUniformValue(lightLocation[1], diffuse); - rendering_program_color.setUniformValue(lightLocation[2], specular); - rendering_program_color.setUniformValue(lightLocation[3], m_ambient_color); - rendering_program_color.setUniformValue(lightLocation[4], shininess); - rendering_program_color.setUniformValue(mvpLocation[0], mvpMatrix); - rendering_program_color.setUniformValue(mvLocation, mvMatrix); - - if (m_use_mono_color) - { colorLocation2 = rendering_program_color.uniformLocation("color"); } - rendering_program_color.release(); - - /* rendering_program_p_l_.bind(); - mvpLocation[1] = rendering_program_p_l.uniformLocation("mvp_matrix"); - colorLocation = rendering_program_p_l.uniformLocation("color"); - rendering_program.setUniformValue(mvpLocation[1], mvpMatrix); - rendering_program_p_l.release();*/ - } - - virtual void draw() - { - glEnable(GL_DEPTH_TEST); - if(!m_are_buffers_initialized) - initialize_buffers(); - - QColor color; - - if (m_draw_faces) - { - vao[0].bind(); - attrib_buffers(this); - rendering_program_mono.bind(); - color.setRgbF((double)m_faces_mono_color.red()/(double)255, - (double)m_faces_mono_color.green()/(double)255, - (double)m_faces_mono_color.blue()/(double)255); - rendering_program_mono.setUniformValue(colorLocation1,color); - glDrawArrays(GL_TRIANGLES, 0, static_cast(arrays[POS_MONO_FACES].size()/3)); - rendering_program_mono.release(); - vao[0].release(); - - vao[1].bind(); - attrib_buffers(this); - rendering_program_color.bind(); - if (m_use_mono_color) - { - color.setRgbF((double)m_faces_mono_color.red()/(double)255, - (double)m_faces_mono_color.green()/(double)255, - (double)m_faces_mono_color.blue()/(double)255); - rendering_program_color.setUniformValue(colorLocation2,color); - } - glDrawArrays(GL_TRIANGLES, 0, static_cast(arrays[POS_COLORED_FACES].size()/3)); - rendering_program_color.release(); - vao[1].release(); - } - } - - virtual void init() - { - // Restore previous viewer state. - initializeOpenGLFunctions(); - - // Define 'Control+Q' as the new exit shortcut (default was 'Escape') - setShortcut(EXIT_VIEWER, Qt::CTRL+Qt::Key_Q); - - // Add custom key description (see keyPressEvent). - setKeyDescription(Qt::Key_E, "Toggles edges display"); - setKeyDescription(Qt::Key_F, "Toggles faces display"); - setKeyDescription(Qt::Key_G, "Switch between flat/Gouraud shading display"); - setKeyDescription(Qt::Key_M, "Toggles mono color for all faces"); - setKeyDescription(Qt::Key_N, "Inverse direction of normals"); - setKeyDescription(Qt::Key_V, "Toggles vertices display"); - setKeyDescription(Qt::Key_Plus, "Increase size of edges"); - setKeyDescription(Qt::Key_Minus, "Decrease size of edges"); - setKeyDescription(Qt::Key_Plus+Qt::ShiftModifier, "Increase size of vertices"); - setKeyDescription(Qt::Key_Minus+Qt::ShiftModifier, "Decrease size of vertices"); - setKeyDescription(Qt::Key_PageDown, "Increase light (all colors, use shift/alt/ctrl for one rgb component)"); - setKeyDescription(Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)"); - - // Light default parameters - ::glLineWidth(m_size_edges); - ::glEnable(GL_POLYGON_OFFSET_FILL); - ::glPolygonOffset(1.f,1.f); - ::glClearColor(1.0f,1.0f,1.0f,0.0f); - ::glDisable(GL_BLEND); - ::glEnable(GL_LINE_SMOOTH); - ::glDisable(GL_POLYGON_SMOOTH_HINT); - ::glBlendFunc(GL_ONE, GL_ZERO); - ::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); - - compile_shaders(); - - this->camera()->setSceneBoundingBox(CGAL::qglviewer::Vec(bb.xmin(), - bb.ymin(), - bb.zmin()), - CGAL::qglviewer::Vec(bb.xmax(), - bb.ymax(), - bb.zmax())); - - this->showEntireScene(); - } - - void negate_all_normals() - { - for (unsigned int k=BEGIN_NORMAL; kmodifiers(); - - if ((e->key()==Qt::Key_E) && (modifiers==Qt::NoButton)) - { - m_draw_edges=!m_draw_edges; - displayMessage(QString("Draw edges=%1.").arg(m_draw_edges?"true":"false")); - updateGL(); - } - else if ((e->key()==Qt::Key_F) && (modifiers==Qt::NoButton)) - { - m_draw_faces=!m_draw_faces; - displayMessage(QString("Draw faces=%1.").arg(m_draw_faces?"true":"false")); - updateGL(); - } - else if ((e->key()==Qt::Key_G) && (modifiers==Qt::NoButton)) - { - m_flatShading=!m_flatShading; - if (m_flatShading) - displayMessage("Flat shading."); - else - displayMessage("Gouraud shading."); - compile_shaders(); - initialize_buffers(); - updateGL(); - } - else if ((e->key()==Qt::Key_M) && (modifiers==Qt::NoButton)) - { - m_use_mono_color=!m_use_mono_color; - displayMessage(QString("Mono color=%1.").arg(m_use_mono_color?"true":"false")); - compile_shaders(); - initialize_buffers(); - updateGL(); - } - else if ((e->key()==Qt::Key_N) && (modifiers==Qt::NoButton)) - { - m_inverse_normal=!m_inverse_normal; - negate_all_normals(); - compile_shaders(); - initialize_buffers(); - displayMessage(QString("Inverse normal=%1.").arg(m_inverse_normal?"true":"false")); - updateGL(); - } - else if ((e->key()==Qt::Key_V) && (modifiers==Qt::NoButton)) - { - m_draw_vertices=!m_draw_vertices; - displayMessage(QString("Draw vertices=%1.").arg(m_draw_vertices?"true":"false")); - updateGL(); - } - else if ((e->key()==Qt::Key_Plus) && (modifiers==Qt::KeypadModifier)) - { - m_size_edges+=.5; - displayMessage(QString("Size of edges=%1.").arg(m_size_edges)); - updateGL(); - } - else if ((e->key()==Qt::Key_Minus) && (modifiers==Qt::KeypadModifier)) - { - if (m_size_edges>.5) m_size_edges-=.5; - displayMessage(QString("Size of edges=%1.").arg(m_size_edges)); - updateGL(); - } - else if ((e->key()==Qt::Key_Plus) && (modifiers==(Qt::ShiftModifier|Qt::KeypadModifier))) - { - m_size_points+=.5; - displayMessage(QString("Size of points=%1.").arg(m_size_points)); - updateGL(); - } - else if ((e->key()==Qt::Key_Minus) && (modifiers==(Qt::ShiftModifier|Qt::KeypadModifier))) - { - if (m_size_points>.5) m_size_points-=.5; - displayMessage(QString("Size of points=%1.").arg(m_size_points)); - updateGL(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) - { - m_ambient_color.setX(m_ambient_color.x()+.1); - if (m_ambient_color.x()>1.) m_ambient_color.setX(1.); - m_ambient_color.setY(m_ambient_color.x()+.1); - if (m_ambient_color.y()>1.) m_ambient_color.setY(1.); - m_ambient_color.setZ(m_ambient_color.x()+.1); - if (m_ambient_color.z()>1.) m_ambient_color.setZ(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::NoButton)) - { - m_ambient_color.setX(m_ambient_color.x()-.1); - if (m_ambient_color.x()<0.) m_ambient_color.setX(0.); - m_ambient_color.setY(m_ambient_color.y()-.1); - if (m_ambient_color.y()<0.) m_ambient_color.setY(0.); - m_ambient_color.setZ(m_ambient_color.z()-.1); - if (m_ambient_color.z()<0.) m_ambient_color.setZ(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::ShiftModifier)) - { - m_ambient_color.setX(m_ambient_color.x()+.1); - if (m_ambient_color.x()>1.) m_ambient_color.setX(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::AltModifier)) - { - m_ambient_color.setY(m_ambient_color.y()+.1); - if (m_ambient_color.y()>1.) m_ambient_color.setY(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::ControlModifier)) - { - m_ambient_color.setZ(m_ambient_color.z()+.1); - if (m_ambient_color.z()>1.) m_ambient_color.setZ(1.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::ShiftModifier)) - { - m_ambient_color.setX(m_ambient_color.x()-.1); - if (m_ambient_color.x()<0.) m_ambient_color.setX(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::AltModifier)) - { - m_ambient_color.setY(m_ambient_color.y()-.1); - if (m_ambient_color.y()<0.) m_ambient_color.setY(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else if ((e->key()==Qt::Key_PageDown) && (modifiers==Qt::ControlModifier)) - { - m_ambient_color.setZ(m_ambient_color.z()-.1); - if (m_ambient_color.z()<0.) m_ambient_color.setZ(0.); - displayMessage(QString("Light color=(%1 %2 %3)."). - arg(m_ambient_color.x()).arg(m_ambient_color.y()).arg(m_ambient_color.z())); - updateGL(); - } - else - CGAL::QGLViewer::keyPressEvent(e); - } - - virtual QString helpString() const - { - QString text("

C G A L B a s i c V i e w e r

"); - text += "Use the mouse to move the camera around the object. "; - text += "You can respectively revolve around, zoom and translate with " - "the three mouse buttons. "; - text += "Left and middle buttons pressed together rotate around the " - "camera view direction axis

"; - text += "Pressing Alt and one of the function keys " - "(F1..F12) defines a camera keyFrame. "; - text += "Simply press the function key again to restore it. " - "Several keyFrames define a "; - text += "camera path. Paths are saved when you quit the application " - "and restored at next start.

"; - text += "Press F to display the frame rate, A for the " - "world axis, "; - text += "Alt+Return for full screen mode and Control+S " - "to save a snapshot. "; - text += "See the Keyboard tab in this window for a complete " - "shortcut list.

"; - text += "Double clicks automates single click actions: A left button " - "double click aligns the closer axis with the camera (if close enough). "; - text += "A middle button double click fits the zoom of the camera and " - "the right button re-centers the scene.

"; - text += "A left button double click while holding right button pressed " - "defines the camera Revolve Around Point. "; - text += "See the Mouse tab and the documentation web pages for " - "details.

"; - text += "Press Escape to exit the viewer."; - return text; - } - -private: - bool m_draw_vertices; - bool m_draw_edges; - bool m_draw_faces; - bool m_flatShading; - bool m_use_mono_color; - bool m_inverse_normal; - bool m_empty; - - double m_size_points; - double m_size_edges; - - CGAL::IO::Color m_vertices_mono_color; - CGAL::IO::Color m_edges_mono_color; - CGAL::IO::Color m_faces_mono_color; - QVector4D m_ambient_color; - - bool m_are_buffers_initialized; - CGAL::Bbox_3 bb; - - //Shaders elements - int vertexLocation[NB_VAO_BUFFERS]; - int normalsLocation; - int mvpLocation[2]; - int mvLocation; - int colorLocation1; - int colorLocation2; - int lightLocation[5]; - - enum - { POS_MONO_POINTS=0, - POS_COLORED_POINTS, - POS_MONO_SEGMENTS, - POS_COLORED_SEGMENTS, - POS_MONO_FACES, - POS_COLORED_FACES, - BEGIN_NORMAL, - SMOOTH_NORMAL_MONO_FACES=BEGIN_NORMAL, - FLAT_NORMAL_MONO_FACES, - SMOOTH_NORMAL_COLORED_FACES, - FLAT_NORMAL_COLORED_FACES, - END_NORMAL, - COLOR_POINTS=END_NORMAL, - COLOR_SEGMENTS, - COLOR_FACES, - LAST_INDEX - }; - - std::vector arrays[LAST_INDEX]; - - QGLBuffer buffers[NB_VBO_BUFFERS]; - QOpenGLVertexArrayObject vao[NB_VAO_BUFFERS]; - int colorsLocation; - - QOpenGLShaderProgram rendering_program_mono; - QOpenGLShaderProgram rendering_program_color; - QOpenGLShaderProgram rendering_program_p_l_mono; - QOpenGLShaderProgram rendering_program_p_l_color; - - // Local variables, used when we started a new face. - bool m_face_started; - bool m_started_face_is_colored; - std::vector points_of_face; - std::vector vertex_normals_for_face; - CGAL::IO::Color color_of_face; -}; - -#endif // CGAL_BASIC_VIEWER_H diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h index 4669765f493..6681a4bb8b3 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_base.h @@ -806,7 +806,7 @@ namespace CGAL { /** Compute the dual of a Linear_cell_complex. * @param alcc the lcc in which we build the dual of this lcc. - * @param adart a dart of the initial lcc, nullptr by default. + * @param adart a dart of the initial lcc, `nullptr` by default. * @return adart of the dual lcc, the dual of adart if adart!=nullptr, * any dart otherwise. * As soon as we don't modify this lcc and alcc lcc, we can iterate diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h index 84fc7564bf2..9034d419963 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex.h @@ -8,135 +8,45 @@ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_LCC_H #define CGAL_DRAW_LCC_H -#include - -#ifdef CGAL_USE_BASIC_VIEWER -#include - +#include +#include +#include +#include #include #include -namespace CGAL +namespace CGAL { + +namespace draw_function_for_lcc { -// Default color functor; user can change it to have its own face color -struct DefaultDrawingFunctorLCC -{ - /// @return true iff the volume containing dh is drawn. - template - bool draw_volume(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the face containing dh is drawn. - template - bool draw_face(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the edge containing dh is drawn. - template - bool draw_edge(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the vertex containing dh is drawn. - template - bool draw_vertex(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } +typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; +typedef Local_kernel::Point_3 Local_point; +typedef Local_kernel::Vector_3 Local_vector; - /// @return true iff the volume containing dh is drawn in wireframe. - template - bool volume_wireframe(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - /// @return true iff the face containing dh is drawn in wireframe. - template - bool face_wireframe(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - - /// @return true iff the volume containing dh is colored. - template - bool colored_volume(const LCC&, - typename LCC::Dart_const_descriptor) const - { return true; } - /// @return true iff the face containing dh is colored. - /// if we have also colored_volume(alcc, dh), the volume color is - /// ignored and only the face color is considered. - template - bool colored_face(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - /// @return true iff the edge containing dh is colored. - template - bool colored_edge(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - /// @return true iff the vertex containing dh is colored. - template - bool colored_vertex(const LCC&, - typename LCC::Dart_const_descriptor) const - { return false; } - - /// @return the color of the volume containing dh - /// used only if colored_volume(alcc, dh) and !colored_face(alcc, dh) - template - CGAL::IO::Color volume_color(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { - CGAL::Random random((unsigned int)(alcc.darts().index(dh))); - return get_random_color(random); - } - /// @return the color of the face containing dh - /// used only if colored_face(alcc, dh) - template - CGAL::IO::Color face_color(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { - CGAL::Random random((unsigned int)(alcc.darts().index(dh))); - return get_random_color(random); - } - /// @return the color of the edge containing dh - /// used only if colored_edge(alcc, dh) - template - CGAL::IO::Color edge_color(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { - CGAL::Random random((unsigned int)(alcc.darts().index(dh))); - return get_random_color(random); - } - /// @return the color of the vertex containing dh - /// used only if colored_vertex(alcc, dh) - template - CGAL::IO::Color vertex_color(const LCC& alcc, - typename LCC::Dart_const_descriptor dh) const - { - CGAL::Random random((unsigned int)(alcc.darts().index(dh))); - return get_random_color(random); - } -}; - -template +template struct LCC_geom_utils; -template +template struct LCC_geom_utils { static typename Local_kernel::Vector_3 get_vertex_normal(const LCC& lcc, typename LCC::Dart_const_descriptor dh) { - typename Local_kernel::Vector_3 n = internal::Geom_utils - :: - get_local_vector(CGAL::compute_normal_of_cell_0(lcc,dh)); - n = n/(CGAL::sqrt(n*n)); + typename Local_kernel::Vector_3 n = + internal::Geom_utils:: + get_local_vector(CGAL::compute_normal_of_cell_0(lcc, dh)); + n = n / (CGAL::sqrt(n * n)); return n; } }; -template +template struct LCC_geom_utils { static typename Local_kernel::Vector_3 @@ -147,181 +57,161 @@ struct LCC_geom_utils } }; -// Viewer class for LCC -template -class SimpleLCCViewerQt : public Basic_viewer_qt +template +void compute_face(const LCC& lcc, + typename LCC::Dart_const_handle dh, + typename LCC::Dart_const_handle voldh, + CGAL::Graphics_scene& graphics_scene, + const GSOptionsLCC& gso) { - typedef Basic_viewer_qt Base; - typedef typename LCC::Dart_const_descriptor Dart_const_descriptor; - typedef typename LCC::Traits Kernel; - typedef typename Kernel::Point Point; - typedef typename Kernel::Vector Vector; + if(!gso.are_faces_enabled() || !gso.draw_face(lcc, dh)) + { return; } -public: - /// Construct the viewer. - /// @param alcc the lcc to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big object where this time could be long) - SimpleLCCViewerQt(QWidget* parent, - const LCC* alcc=nullptr, - const char* title="Basic LCC Viewer", - bool anofaces=false, - const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) : - // First draw: vertices; edges, faces; multi-color; inverse normal - Base(parent, title, true, true, true, false, false), - lcc(alcc), - m_nofaces(anofaces), - m_random_face_color(false), - m_drawing_functor(drawing_functor) + // We fill only closed faces. + typename LCC::Dart_const_handle cur=dh; + do { - if (lcc!=nullptr) - { compute_elements(); } + if (!lcc.is_next_exist(cur)) + { return; } // open face=>not filled + cur = lcc.next(cur); } + while (cur!=dh); - ~SimpleLCCViewerQt() - {} + if (gso.colored_volume(lcc, voldh)) + { graphics_scene.face_begin(gso.volume_color(lcc, voldh)); } + else if (gso.colored_face(lcc, dh)) + { graphics_scene.face_begin(gso.face_color(lcc, dh)); } + else + { graphics_scene.face_begin(); } -protected: - void set_lcc(const LCC* alcc, bool doredraw=true) + cur=dh; + do { - if (lcc==alcc) - { return; } - - lcc=alcc; - if (lcc!=nullptr) - { compute_elements(); } - - if (doredraw) { redraw(); } + graphics_scene.add_point_in_face + (lcc.point(cur), + LCC_geom_utils::get_vertex_normal(lcc, cur)); + cur=lcc.next(cur); } + while (cur!=dh); - void compute_face(Dart_const_descriptor dh, Dart_const_descriptor voldh) + graphics_scene.face_end(); +} + +template +void compute_edge(const LCC& lcc, + typename LCC::Dart_const_handle dh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso) +{ + if(!gso.are_edges_enabled() || !gso.draw_edge(lcc, dh)) + { return; } + + const typename LCC::Point& p1=lcc.point(dh); + typename LCC::Dart_const_handle d2=lcc.other_extremity(dh); + if (d2!=LCC::null_descriptor) { - if (m_nofaces || !m_drawing_functor.draw_face(*lcc, dh)) return; - - // We fill only closed faces. - Dart_const_descriptor cur=dh; - Dart_const_descriptor min=dh; - do + if (gso.colored_edge(lcc, dh)) { - if (!lcc->is_next_exist(cur)) return; // open face=>not filled - if (curnext(cur); - } - while(cur!=dh); - - if (m_random_face_color) - { - CGAL::Random random((unsigned int)(lcc->darts().index(dh))); - CGAL::IO::Color c=get_random_color(random); - face_begin(c); - } - else if (m_drawing_functor.colored_face(*lcc, dh)) - { - CGAL::IO::Color c=m_drawing_functor.face_color(*lcc, dh); - face_begin(c); - } - else if (m_drawing_functor.colored_volume(*lcc, voldh)) - { - CGAL::IO::Color c=m_drawing_functor.volume_color(*lcc, voldh); - face_begin(c); + graphics_scene.add_segment(p1, lcc.point(d2), + gso.edge_color(lcc, dh)); } else - { face_begin(); } - - cur=dh; - do - { - add_point_in_face(lcc->point(cur), LCC_geom_utils:: - get_vertex_normal(*lcc, cur)); - cur=lcc->next(cur); - } - while(cur!=dh); - - face_end(); + { graphics_scene.add_segment(p1, lcc.point(d2)); } } +} - void compute_edge(Dart_const_descriptor dh) +template +void compute_vertex(const LCC& lcc, + typename LCC::Dart_const_handle dh, + CGAL::Graphics_scene& graphics_scene, + const GSOptionsLCC& gso) +{ + if (!gso.are_vertices_enabled() || !gso.draw_vertex(lcc, dh)) + { return; } + + if (gso.colored_vertex(lcc, dh)) { - if (!m_drawing_functor.draw_edge(*lcc, dh)) return; - - Point p1 = lcc->point(dh); - Dart_const_descriptor d2 = lcc->other_extremity(dh); - if (d2!=lcc->null_descriptor) - { - if (m_drawing_functor.colored_edge(*lcc, dh)) - { add_segment(p1, lcc->point(d2), m_drawing_functor.edge_color(*lcc, dh)); } - else - { add_segment(p1, lcc->point(d2)); } - } + graphics_scene.add_point(lcc.point(dh), + gso.vertex_color(lcc, dh)); } + else + { graphics_scene.add_point(lcc.point(dh)); } +} - void compute_vertex(Dart_const_descriptor dh) +template +struct Test_opposite_draw_lcc +{ + template + static bool run(const LCC& lcc, const GSOptions& gso, + typename LCC::Dart_const_descriptor dh) + { return (!lcc.template is_free<3>(dh) && + !gso.volume_wireframe(lcc, lcc.template opposite<3>(dh))); } +}; + +template +struct Test_opposite_draw_lcc +{ + template + static bool run(const LCC&, const GSOptions&, + typename LCC::Dart_const_descriptor) + { return true; } +}; + + +template +void compute_elements(const LCC& lcc, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso) +{ + typename LCC::size_type markvolumes = lcc.get_new_mark(); + typename LCC::size_type markfaces = lcc.get_new_mark(); + typename LCC::size_type markedges = lcc.get_new_mark(); + typename LCC::size_type markvertices = lcc.get_new_mark(); + typename LCC::size_type oriented_mark = lcc.get_new_mark(); + + lcc.orient(oriented_mark); + + for(typename LCC::Dart_range::const_iterator it=lcc.darts().begin(), + itend=lcc.darts().end(); it!=itend; ++it) { - if (!m_drawing_functor.draw_vertex(*lcc, dh)) return; - - if (m_drawing_functor.colored_vertex(*lcc, dh)) - { add_point(lcc->point(dh), m_drawing_functor.vertex_color(*lcc, dh)); } - else - { add_point(lcc->point(dh)); } - } - - void compute_elements() - { - clear(); - if (lcc==nullptr) return; - - typename LCC::size_type markvolumes =lcc->get_new_mark(); - typename LCC::size_type markfaces =lcc->get_new_mark(); - typename LCC::size_type markedges =lcc->get_new_mark(); - typename LCC::size_type markvertices =lcc->get_new_mark(); - typename LCC::size_type oriented_mark=lcc->get_new_mark(); - - lcc->orient(oriented_mark); - - for (typename LCC::Dart_range::const_iterator it=lcc->darts().begin(), - itend=lcc->darts().end(); it!=itend; ++it ) + if (!lcc.is_marked(it, markvolumes) && + gso.draw_volume(lcc, it)) { - if (!lcc->is_marked(it, markvolumes) && - m_drawing_functor.draw_volume(*lcc, it)) + for(typename LCC::template Dart_of_cell_basic_range<3>::const_iterator + itv=lcc.template darts_of_cell_basic<3>(it, markvolumes).begin(), + itvend=lcc.template darts_of_cell_basic<3>(it, markvolumes).end(); + itv!=itvend; ++itv) { - for (typename LCC::template Dart_of_cell_basic_range<3>:: - const_iterator itv=lcc->template darts_of_cell_basic<3>(it, markvolumes).begin(), - itvend=lcc->template darts_of_cell_basic<3>(it, markvolumes).end(); - itv!=itvend; ++itv) + lcc.mark(itv, markvolumes); + if (!lcc.is_marked(itv, markfaces) && + lcc.is_marked(itv, oriented_mark) && + gso.draw_face(lcc, itv)) { - lcc->mark(itv, markvolumes); // To be sure that all darts of the basic iterator will be marked - if (!lcc->is_marked(itv, markfaces) && - lcc->is_marked(itv, oriented_mark) && - m_drawing_functor.draw_face(*lcc, itv)) + if ((!gso.volume_wireframe(lcc, itv) || + Test_opposite_draw_lcc::run(lcc, gso, itv)) && + !gso.face_wireframe(lcc, itv)) + { compute_face(lcc, itv, it, graphics_scene, gso); } + for(typename LCC::template Dart_of_cell_basic_range<2>::const_iterator + itf=lcc.template darts_of_cell_basic<2>(itv, markfaces).begin(), + itfend=lcc.template darts_of_cell_basic<2>(itv, markfaces).end(); + itf!=itfend; ++itf) { - if (!m_drawing_functor.volume_wireframe(*lcc, itv) && - !m_drawing_functor.face_wireframe(*lcc, itv)) - { compute_face(itv, it); } - for (typename LCC::template Dart_of_cell_basic_range<2>:: - const_iterator itf=lcc->template darts_of_cell_basic<2>(itv, markfaces).begin(), - itfend=lcc->template darts_of_cell_basic<2>(itv, markfaces).end(); - itf!=itfend; ++itf) + lcc.mark(itf, markfaces); + if (!lcc.is_marked(itf, markedges) && + gso.draw_edge(lcc, itf)) { - if (!m_drawing_functor.volume_wireframe(*lcc, itv) && - !m_drawing_functor.face_wireframe(*lcc, itv)) - { lcc->mark(itf, markfaces); } // To be sure that all darts of the basic iterator will be marked - if ( !lcc->is_marked(itf, markedges) && - m_drawing_functor.draw_edge(*lcc, itf)) + compute_edge(lcc, itf, graphics_scene, gso); + for(typename LCC::template Dart_of_cell_basic_range<1>::const_iterator + ite=lcc.template darts_of_cell_basic<1>(itf, markedges).begin(), + iteend=lcc.template darts_of_cell_basic<1>(itf, markedges).end(); + ite!=iteend; ++ite) { - compute_edge(itf); - for (typename LCC::template Dart_of_cell_basic_range<1>:: - const_iterator ite=lcc->template darts_of_cell_basic<1>(itf, markedges).begin(), - iteend=lcc->template darts_of_cell_basic<1>(itf, markedges).end(); - ite!=iteend; ++ite) + lcc.mark(ite, markedges); + if (!lcc.is_marked(ite, markvertices) && + gso.draw_vertex(lcc, ite)) { - lcc->mark(ite, markedges); // To be sure that all darts of the basic iterator will be marked - if ( !lcc->is_marked(ite, markvertices) && - m_drawing_functor.draw_vertex(*lcc, ite)) - { - compute_vertex(ite); - CGAL::mark_cell(*lcc, ite, markvertices); - } + compute_vertex(lcc, ite, graphics_scene, gso); + CGAL::mark_cell(lcc, ite, markvertices); } } } @@ -329,99 +219,108 @@ protected: } } } - - for (typename LCC::Dart_range::const_iterator it=lcc->darts().begin(), - itend=lcc->darts().end(); it!=itend; ++it ) - { - lcc->unmark(it, markvertices); - lcc->unmark(it, markedges); - lcc->unmark(it, markfaces); - lcc->unmark(it, markvolumes); - lcc->unmark(it, oriented_mark); - } - - lcc->free_mark(markvolumes); - lcc->free_mark(markfaces); - lcc->free_mark(markedges); - lcc->free_mark(markvertices); - lcc->free_mark(oriented_mark); } - virtual void init() + for (typename LCC::Dart_range::const_iterator it = lcc.darts().begin(), + itend = lcc.darts().end(); it != itend; ++it) { - Base::init(); - setKeyDescription(::Qt::Key_R, "Toggles random face colors"); + lcc.unmark(it, markvertices); + lcc.unmark(it, markedges); + lcc.unmark(it, markfaces); + lcc.unmark(it, markvolumes); + lcc.unmark(it, oriented_mark); } - virtual void keyPressEvent(QKeyEvent *e) - { - const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - if ((e->key()==::Qt::Key_R) && (modifiers==::Qt::NoButton)) - { - m_random_face_color=!m_random_face_color; - displayMessage(QString("Random face color=%1.").arg(m_random_face_color?"true":"false")); - compute_elements(); - redraw(); - } - else - { Base::keyPressEvent(e); } // Call the base method to process others/classicals key - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - } - -protected: - const LCC* lcc; - bool m_nofaces; - bool m_random_face_color; - const DrawingFunctorLCC& m_drawing_functor; -}; - -// Specialization of draw function. -#define CGAL_LCC_TYPE CGAL::Linear_cell_complex_base \ - - -template < unsigned int d_, unsigned int ambient_dim, - class Traits_, - class Items_, - class Alloc_, - template - class Map, - class Refs, - class Storage_, - class DrawingFunctorLCC=DefaultDrawingFunctorLCC> -void draw(const CGAL_LCC_TYPE& alcc, - const char* title="LCC for CMap Basic Viewer", - bool nofill=false, - const DrawingFunctorLCC& drawing_functor=DrawingFunctorLCC()) -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"lccviewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimpleLCCViewerQt - mainwindow(app.activeWindow(), &alcc, title, nofill, drawing_functor); - mainwindow.show(); - app.exec(); - } + lcc.free_mark(markvolumes); + lcc.free_mark(markfaces); + lcc.free_mark(markedges); + lcc.free_mark(markvertices); + lcc.free_mark(oriented_mark); } -// Todo a function taking a const DrawingFunctorLCC& drawing_functor as parameter +} // namespace draw_function_for_lcc + +#define CGAL_LCC_TYPE \ + CGAL::Linear_cell_complex_base + +// add_to_graphics_scene: to add a LCC in the given graphic buffer, with a +// graphics scene options. +template class Map, + class Refs, class Storage_, + class GSOptions> +void add_to_graphics_scene(const CGAL_LCC_TYPE& alcc, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso) +{ + draw_function_for_lcc::compute_elements(static_cast(alcc), + graphics_scene, gso); +} + +// add_to_graphics_scene: to add a LCC in the given graphic buffer, without a +// graphics scene options. Use default drawing values. +template class Map, + class Refs, class Storage_> +void add_to_graphics_scene(const CGAL_LCC_TYPE& alcc, + CGAL::Graphics_scene& graphics_scene) +{ + CGAL::Graphics_scene_options + gso; + + gso.colored_volume = [](const CGAL_LCC_TYPE&, + typename CGAL_LCC_TYPE::Dart_const_handle) -> bool + { return true; }; + + gso.volume_color = [] (const CGAL_LCC_TYPE& alcc, + typename CGAL_LCC_TYPE::Dart_const_handle dh) -> CGAL::IO::Color + { + CGAL::Random random((unsigned int)(alcc.darts().index(dh))); + return get_random_color(random); + }; + + add_to_graphics_scene(alcc, graphics_scene, gso); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function for a LCC, with a drawing graphics scene options. +template class Map, + class Refs, class Storage_, + class GSOptions> +void draw(const CGAL_LCC_TYPE& alcc, const GSOptions& gso, + const char *title="LCC Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(alcc, buffer, gso); + draw_graphics_scene(buffer, title); +} + +// Specialization of draw function for a LCC, without a graphics scene options. +template class Map, + class Refs, class Storage_> +void draw(const CGAL_LCC_TYPE& alcc, const char *title="LCC Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(alcc, buffer); + draw_graphics_scene(buffer, title); +} + +#endif // CGAL_USE_BASIC_VIEWER + #undef CGAL_LCC_TYPE } // End namespace CGAL -#endif // CGAL_USE_BASIC_VIEWER - #endif // CGAL_DRAW_LCC_H diff --git a/Linear_cell_complex/package_info/Linear_cell_complex/dependencies b/Linear_cell_complex/package_info/Linear_cell_complex/dependencies index a3ecaf39ee2..817476384ef 100644 --- a/Linear_cell_complex/package_info/Linear_cell_complex/dependencies +++ b/Linear_cell_complex/package_info/Linear_cell_complex/dependencies @@ -1,6 +1,7 @@ Algebraic_foundations Arithmetic_kernel BGL +Basic_viewer CGAL_Core Cartesian_kernel Circulator @@ -9,7 +10,6 @@ Distance_2 Distance_3 Filtered_kernel Generalized_map -GraphicsView HalfedgeDS Hash_map Homogeneous_kernel @@ -22,8 +22,12 @@ Kernel_d Linear_cell_complex Modular_arithmetic Number_types +Polygon Profiling_tools Property_map Random_numbers STL_Extension +Spatial_sorting Stream_support +TDS_2 +Triangulation_2 diff --git a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h index b76bbf1d7e6..f22bd0a480a 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h +++ b/Linear_cell_complex/test/Linear_cell_complex/Linear_cell_complex_2_test.h @@ -17,6 +17,7 @@ #include #include #include +#include #include // #define LCC_TRACE_TEST_BEGIN 1 diff --git a/Mesh_2/examples/Mesh_2/mesh_marked_domain.cpp b/Mesh_2/examples/Mesh_2/mesh_marked_domain.cpp index 5313871f527..9649f2076e5 100644 --- a/Mesh_2/examples/Mesh_2/mesh_marked_domain.cpp +++ b/Mesh_2/examples/Mesh_2/mesh_marked_domain.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include diff --git a/Mesh_2/examples/Mesh_2/mesh_with_seeds.cpp b/Mesh_2/examples/Mesh_2/mesh_with_seeds.cpp index 2b30e792014..79a52e9034c 100644 --- a/Mesh_2/examples/Mesh_2/mesh_with_seeds.cpp +++ b/Mesh_2/examples/Mesh_2/mesh_with_seeds.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include diff --git a/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h b/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h index 380696549c1..d2df50df3fa 100644 --- a/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h +++ b/Mesh_2/include/CGAL/Mesh_2/Mesh_global_optimizer_2.h @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/Minkowski_sum_3/package_info/Minkowski_sum_3/dependencies b/Minkowski_sum_3/package_info/Minkowski_sum_3/dependencies index b60f37e8338..4be8408d049 100644 --- a/Minkowski_sum_3/package_info/Minkowski_sum_3/dependencies +++ b/Minkowski_sum_3/package_info/Minkowski_sum_3/dependencies @@ -29,7 +29,6 @@ Polygon Polyhedron Profiling_tools Property_map -Random_numbers STL_Extension Spatial_sorting Stream_support diff --git a/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h b/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h index d61f502cc4f..1d2528d6079 100644 --- a/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h +++ b/Nef_3/doc/Nef_3/CGAL/draw_nef_3.h @@ -3,14 +3,72 @@ namespace CGAL { /*! \ingroup PkgDrawNef3 -Open a new window and draws `anef3`, the `Nef_polyhedron_3`. A call to this function is blocking, that is the program continues as soon as the user closes the window. -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 Nef3 a model of the `Nef_polyhedron_3` concept. -\param anef3 the nef polyhedron to draw. +opens a new window and draws a nef polyhedron. 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 NP3 which must be an instanciation of a `CGAL::Nef_polyhedron_3<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param np3 the nef polyhedron to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Nef_polyhedron_3& np3, const GSOptions& gso); + +\cgalAdvancedEnd */ -template -void draw(const Nef3& anef3); + template + void draw(const NP3& np3, const GSOptions& gso); + +/*! +\ingroup PkgDrawNef3 + +A shortcut to `CGAL::draw(np3, Graphics_scene_options{})`. +*/ + template + void draw(const NP3& np3); + +/*! +\ingroup PkgDrawNef3 + +adds the vertices, edges and faces of `np3` 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 NP3 which must be an instanciation of a `CGAL::Nef_polyhedron_3<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param np3 the nef polyhedron 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::Nef_polyhedron_3& np3, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const NP3& np3, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawNef3 + +A shortcut to `CGAL::add_to_graphics_scene(np3, gs, Graphics_scene_options{})`. +*/ +template +void add_to_graphics_scene(const NP3& np3, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index a20a6643f50..d222d741100 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -27,6 +27,7 @@ #include #include #include +#include #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 29 diff --git a/Nef_3/include/CGAL/draw_nef_3.h b/Nef_3/include/CGAL/draw_nef_3.h index e561b3fef70..aac531bcd5d 100644 --- a/Nef_3/include/CGAL/draw_nef_3.h +++ b/Nef_3/include/CGAL/draw_nef_3.h @@ -9,16 +9,16 @@ // // // Author(s) : Jasmeet Singh +// Mostafa Ashraf #ifndef DRAW_NEF_3_H #define DRAW_NEF_3_H #include -#include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include +#include +#include +#include +#include #include #include #include @@ -28,274 +28,283 @@ namespace CGAL { -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorNefPolyhedron +namespace draw_function_for_nef_polyhedron { - template - static CGAL::IO::Color run(const NefPolyhedron&, - typename NefPolyhedron::Halffacet_const_handle fh) + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; +typedef Local_kernel::Vector_3 Local_vector; + +template +Local_vector get_face_normal(typename Nef_Polyhedron::SHalfedge_const_handle she) +{ + typename Nef_Polyhedron::SHalfedge_around_facet_const_circulator he(she), end(he); + Local_vector normal=CGAL::NULL_VECTOR; + unsigned int nb=0; + + using GU=internal::Geom_utils::Kernel, + Local_kernel>; + CGAL_For_all(he, end) { - if (fh == nullptr) // use to get the mono color - return CGAL::IO::Color(100, 125, 200); // R G B between 0-255 - - CGAL::Random random((unsigned int)(std::size_t)(&(*fh))); - return get_random_color(random); + internal::newell_single_step_3(GU::get_local_point(he->next()->source()-> + center_vertex()->point()), + GU::get_local_point(he->source()->center_vertex()-> + point()), normal); + ++nb; } -}; -// Viewer class for Nef Polyhedron -template -class SimpleNefPolyhedronViewerQt : public Basic_viewer_qt + CGAL_assertion(nb > 0); + return (typename Local_kernel::Construct_scaled_vector_3()(normal, 1.0/nb)); +} + +template +Local_vector get_vertex_normal(typename Nef_Polyhedron::Vertex_const_handle vh) { - typedef Basic_viewer_qt Base; - typedef typename Nef_Polyhedron::Kernel Kernel; + typename Nef_Polyhedron::SHalfedge_const_iterator it=vh->shalfedges_begin(); + typename Nef_Polyhedron::SHalfedge_const_handle end=it; + Local_vector normal=CGAL::NULL_VECTOR; + do + { + Local_vector n=get_face_normal(it); + normal=typename Local_kernel::Construct_sum_of_vectors_3()(normal, n); + it=it->snext(); + } + while(it!=end); - typedef typename Nef_Polyhedron::Halffacet_cycle_const_iterator Halffacet_cycle_const_iterator; - typedef typename Nef_Polyhedron::SHalfedge_around_facet_const_circulator SHalfedge_around_facet_const_circulator; + if (!typename Local_kernel::Equal_3()(normal, CGAL::NULL_VECTOR)) + { + normal=(typename Local_kernel::Construct_scaled_vector_3() + (normal, 1.0/CGAL::sqrt(normal.squared_length()))); + } - typedef typename Nef_Polyhedron::Shell_entry_const_iterator Shell_entry_const_iterator; - typedef typename Nef_Polyhedron::SHalfedge_const_iterator SHalfedge_const_iterator; - typedef typename Nef_Polyhedron::Volume_const_iterator Volume_const_iterator; + return normal; +} + +// Visitor class to iterate through shell objects +template +class Nef_Visitor { - typedef typename Nef_Polyhedron::Vertex_const_handle Vertex_const_handle; - typedef typename Nef_Polyhedron::SFace_const_handle SFace_const_handle; typedef typename Nef_Polyhedron::Halfedge_const_handle Halfedge_const_handle; typedef typename Nef_Polyhedron::Halffacet_const_handle Halffacet_const_handle; typedef typename Nef_Polyhedron::SHalfedge_const_handle SHalfedge_const_handle; + typedef typename Nef_Polyhedron::SHalfedge_around_facet_const_circulator SHalfedge_around_facet_const_circulator; + typedef typename Nef_Polyhedron::Vertex_const_handle Vertex_const_handle; + typedef typename Nef_Polyhedron::SFace_const_handle SFace_const_handle; typedef typename Nef_Polyhedron::SHalfloop_const_handle SHalfloop_const_handle; + typedef typename Nef_Polyhedron::Halffacet_cycle_const_iterator Halffacet_cycle_const_iterator; public: - /// Construct the viewer - /// @param anef the nef polyhedron to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not - /// computed: this can be useful for big objects) - SimpleNefPolyhedronViewerQt(QWidget* parent, - const Nef_Polyhedron& anef, - const char* title="Basic Nef Polyhedron Viewer", - bool anofaces=false, - const ColorFunctor& fcolor=ColorFunctor()) : - //First draw: vertex; edges, faces; mon-color; inverse normal - Base(parent, title, false, true, true, true, false), - nef(anef), - m_nofaces(anofaces), - m_fcolor(fcolor) - { - compute_elements(); - } -protected: - // Visitor class to iterate through shell objects - class Nef_Visitor { - public: - Nef_Visitor(SimpleNefPolyhedronViewerQt &v) - : n_faces(0), n_edges(0), viewer(v) {} + Nef_Visitor(const Nef_Polyhedron&_nef, + CGAL::Graphics_scene& _graphics_scene, + const GSOptions&_gs_options) : + n_faces(0), n_edges(0), + graphics_scene(_graphics_scene), + gs_options(_gs_options), + nef(_nef) + {} - void visit(Vertex_const_handle vh) { - viewer.add_point(vh->point()); + void visit(Vertex_const_handle vh) + { + if (!gs_options.are_vertices_enabled() || + !gs_options.draw_vertex(nef, vh)) + { return; } + + if(gs_options.colored_vertex(nef, vh)) + { graphics_scene.add_point(vh->point(), + gs_options.vertex_color(nef, vh)); } + else + { graphics_scene.add_point(vh->point()); } + } + + void visit(Halffacet_const_handle opposite_facet) + { + if (!gs_options.are_faces_enabled() || + !gs_options.draw_face(nef, opposite_facet)) + { return; } + + Halffacet_const_handle f=opposite_facet->twin(); + if (facets_done.find(f)!=facets_done.end() || + facets_done.find(opposite_facet)!=facets_done.end()) + { return; } + + SHalfedge_const_handle se; + Halffacet_cycle_const_iterator fc = f->facet_cycles_begin(); + + se = SHalfedge_const_handle(fc); // non-zero if shalfedge is returned + if(se==0) + { return; } //return if not-shalfedge + + if(gs_options.colored_face(nef, f)) + { graphics_scene.face_begin(gs_options.face_color(nef, f)); } + else + { graphics_scene.face_begin(); } + + SHalfedge_around_facet_const_circulator hc_start(se); + SHalfedge_around_facet_const_circulator hc_end(hc_start); + Vertex_const_handle lastvh; + CGAL_For_all(hc_start, hc_end) + { + Vertex_const_handle vh=hc_start->source()->center_vertex(); + lastvh=vh; + graphics_scene.add_point_in_face(vh->point(), + get_vertex_normal(vh)); } - void visit(Halffacet_const_handle opposite_facet) + // Now iterate through holes of the face + ++fc; + while(fc!=f->facet_cycles_end()) { - Halffacet_const_handle f = opposite_facet->twin(); - - if (facets_done.find(f) != facets_done.end() || - facets_done.find(opposite_facet) != facets_done.end()) { - return; - } - - - - SHalfedge_const_handle se; - Halffacet_cycle_const_iterator fc=f->facet_cycles_begin(); - - se = SHalfedge_const_handle(fc); // non-zero if shalfedge is returned - if(se == 0) - { //return if not-shalfedge - return; - } - - CGAL::IO::Color c = viewer.run_color(f); - viewer.face_begin(c); - - SHalfedge_around_facet_const_circulator hc_start(se); - SHalfedge_around_facet_const_circulator hc_end(hc_start); - Vertex_const_handle lastvh; - CGAL_For_all(hc_start, hc_end) { - Vertex_const_handle vh=hc_start->source()->center_vertex(); - lastvh=vh; - viewer.add_point_in_face(vh->point(), - viewer.get_vertex_normal(vh)); - } - - // Now iterate through holes of the face - ++fc; - while(fc!=f->facet_cycles_end()) + if(fc.is_shalfedge()) { - if(fc.is_shalfedge()) + se = SHalfedge_const_handle(fc); + hc_start=se; + hc_end=hc_start; + CGAL_For_all(hc_start, hc_end) { - se = SHalfedge_const_handle(fc); - hc_start=se; - hc_end=hc_start; - CGAL_For_all(hc_start, hc_end) { - Vertex_const_handle vh=hc_start->source()->center_vertex(); - viewer.add_point_in_face(vh->point(), - viewer.get_vertex_normal(vh)); - } - viewer.add_point_in_face(hc_start->source()->center_vertex()->point(), - viewer.get_vertex_normal(hc_start->source()->center_vertex())); - viewer.add_point_in_face(lastvh->point(), - viewer.get_vertex_normal(lastvh)); + Vertex_const_handle vh=hc_start->source()->center_vertex(); + graphics_scene.add_point_in_face(vh->point(), + get_vertex_normal(vh)); } - ++fc; + graphics_scene.add_point_in_face(hc_start->source()->center_vertex()->point(), + get_vertex_normal + (hc_start->source()->center_vertex())); + graphics_scene.add_point_in_face(lastvh->point(), + get_vertex_normal(lastvh)); } - viewer.face_end(); - facets_done[f]=true; - n_faces++; + ++fc; } - void visit(Halfedge_const_handle he) - { - Halfedge_const_handle twin = he->twin(); - if (edges_done.find(he) != edges_done.end() || - edges_done.find(twin) != edges_done.end()) - { - // Edge already added - return; - } - - viewer.add_segment(he->source()->point(), he->target()->point()); - edges_done[he] = true; - n_edges++; - } - - void visit(SHalfedge_const_handle ) {} - void visit(SHalfloop_const_handle ) {} - void visit(SFace_const_handle ) {} - int n_faces; - int n_edges; - protected: - std::unordered_map facets_done; - std::unordered_map edges_done; - SimpleNefPolyhedronViewerQt& viewer; - }; - - void compute_elements() - { - clear(); - - Volume_const_iterator c; - - Nef_Visitor V(*this); - CGAL_forall_volumes(c, nef) - { - Shell_entry_const_iterator it; - CGAL_forall_shells_of(it, c) - { - nef.visit_shell_objects(SFace_const_handle(it), V); - } - } - - negate_all_normals(); + graphics_scene.face_end(); + facets_done[f]=true; + ++n_faces; } - CGAL::IO::Color run_color(Halffacet_const_handle fh) + void visit(Halfedge_const_handle he) { - return m_fcolor.run(nef, fh); - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); + if (!gs_options.are_edges_enabled() || + !gs_options.draw_edge(nef, he)) + { return; } + + Halfedge_const_handle twin=he->twin(); + if (edges_done.find(he)!=edges_done.end() || + edges_done.find(twin)!=edges_done.end()) + { return; } // Edge already added + + if(gs_options.colored_edge(nef, he)) + { graphics_scene.add_segment(he->source()->point(), he->target()->point(), + gs_options.edge_color(nef, he)); } + else + { graphics_scene.add_segment(he->source()->point(), he->target()->point()); } + edges_done[he]=true; + ++n_edges; } + void visit(SHalfedge_const_handle ) {} + void visit(SHalfloop_const_handle ) {} + void visit(SFace_const_handle ) {} + int n_faces; + int n_edges; protected: - Local_vector get_face_normal(SHalfedge_const_handle she) - { - SHalfedge_around_facet_const_circulator he(she); - Local_vector normal = CGAL::NULL_VECTOR; - SHalfedge_around_facet_const_circulator end = he; - unsigned int nb = 0; - - CGAL_For_all(he, end) - { - internal::newell_single_step_3(this->get_local_point - (he->next()->source()->center_vertex()->point()), - this->get_local_point(he->source()->center_vertex()-> - point()), normal); - ++nb; - } - - CGAL_assertion(nb > 0); - return (typename Local_kernel::Construct_scaled_vector_3()(normal, 1.0 / nb)); - } - - Local_vector get_vertex_normal(Vertex_const_handle vh) - { - Local_vector normal = CGAL::NULL_VECTOR; - - SHalfedge_const_iterator it = vh->shalfedges_begin(); - SHalfedge_const_handle end = it; - do { - Local_vector n = get_face_normal(it); - normal = typename Local_kernel::Construct_sum_of_vectors_3()(normal, n); - it = it->snext(); - } while( it != end ); - - if (!typename Local_kernel::Equal_3()(normal, CGAL::NULL_VECTOR)) - { - normal = (typename Local_kernel::Construct_scaled_vector_3()( - normal, 1.0 / CGAL::sqrt(normal.squared_length()))); - } - - return normal; - } - -protected: - const Nef_Polyhedron &nef; - bool m_nofaces; - const ColorFunctor &m_fcolor; + std::unordered_map facets_done; + std::unordered_map edges_done; + CGAL::Graphics_scene& graphics_scene; + const GSOptions& gs_options; + const Nef_Polyhedron& nef; }; +template +void compute_elements(const Nef_Polyhedron &nef, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gs_options) +{ + + typedef typename Nef_Polyhedron::Volume_const_iterator Volume_const_iterator; + typedef typename Nef_Polyhedron::Shell_entry_const_iterator Shell_entry_const_iterator; + typedef typename Nef_Polyhedron::SFace_const_handle SFace_const_handle; + + Volume_const_iterator c; + Nef_Visitor V(nef, graphics_scene, gs_options); + CGAL_forall_volumes(c, nef) + { + Shell_entry_const_iterator it; + CGAL_forall_shells_of(it, c) + { nef.visit_shell_objects(SFace_const_handle(it), V); } + } + + graphics_scene.reverse_all_normals(); +} + +} // namespace draw_function_for_nef_polyhedron + #define CGAL_NEF3_TYPE Nef_polyhedron_3 -template -void draw(const CGAL_NEF3_TYPE &anef, - const char *title = "Nef Polyhedron Viewer", - bool nofill = false) { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite = true; -#else - bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc = 1; - const char *argv[2] = {"nef_polyhedron_viewer", nullptr}; - QApplication app(argc, const_cast(argv)); - DefaultColorFunctorNefPolyhedron fcolor; - SimpleNefPolyhedronViewerQt - mainwindow(app.activeWindow(), anef, title, nofill, fcolor); - mainwindow.show(); - app.exec(); - } +// add_to_graphics_scene +template +void add_to_graphics_scene(const CGAL_NEF3_TYPE &anef, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gs_options) +{ + draw_function_for_nef_polyhedron::compute_elements(anef, + graphics_scene, + gs_options); } -} // End namespace CGAL +template +void add_to_graphics_scene(const CGAL_NEF3_TYPE &anef, + CGAL::Graphics_scene &graphics_scene) +{ + // Default graphics view options. + Graphics_scene_options + gs_options; + + gs_options.colored_face=[](const CGAL_NEF3_TYPE&, + typename CGAL_NEF3_TYPE::Halffacet_const_handle) -> bool + { return true; }; + + gs_options.face_color=[](const CGAL_NEF3_TYPE&, + typename CGAL_NEF3_TYPE::Halffacet_const_handle fh) -> CGAL::IO::Color + { + if (fh==nullptr) // use to get the mono color + { return CGAL::IO::Color(100, 125, 200); } + + CGAL::Random random((unsigned int)(std::size_t)(&(*fh))); + return get_random_color(random); + }; + + add_to_graphics_scene(anef, graphics_scene, gs_options); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function +template +void draw(const CGAL_NEF3_TYPE &anef, + const GSOptions &gs_options, + const char *title="Nef Polyhedron Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(anef, buffer, gs_options); + draw_graphics_scene(buffer, title); +} + +template +void draw(const CGAL_NEF3_TYPE &anef, + const char *title="Nef Polyhedron Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(anef, buffer); + draw_graphics_scene(buffer, title); +} #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_NEF3_TYPE + +} // End namespace CGAL + #endif // DRAW_NEF_3_H diff --git a/Nef_3/package_info/Nef_3/dependencies b/Nef_3/package_info/Nef_3/dependencies index 92337ba55f1..6950244ddcd 100644 --- a/Nef_3/package_info/Nef_3/dependencies +++ b/Nef_3/package_info/Nef_3/dependencies @@ -1,6 +1,7 @@ Algebraic_foundations Arithmetic_kernel BGL +Basic_viewer Box_intersection_d CGAL_Core Cartesian_kernel @@ -8,7 +9,6 @@ Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView HalfedgeDS Hash_map Homogeneous_kernel diff --git a/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h b/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h index d29278219dc..bfc1d066f41 100644 --- a/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h +++ b/Number_types/include/CGAL/Number_types/internal/Exact_type_selector.h @@ -317,6 +317,25 @@ template < typename ET > struct Exact_type_selector : Exact_field_selector< ET > {}; #endif +constexpr const char* exact_nt_backend_string() +{ + switch(Default_exact_nt_backend) + { + case GMP_BACKEND: + return "GMP_BACKEND"; + case GMPXX_BACKEND: + return "GMPXX_BACKEND"; + case BOOST_GMP_BACKEND: + return "BOOST_GMP_BACKEND"; + case BOOST_BACKEND: + return "BOOST_BACKEND"; + case LEDA_BACKEND: + return "LEDA_BACKEND"; + default: + return "MP_FLOAT_BACKEND"; + } +} + } } // namespace CGAL::internal #undef CGAL_EXACT_SELECTORS_SPECS diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index 73488a8a819..f8ff8698b72 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -61,6 +61,7 @@ create_single_source_cgal_program("unsigned.cpp") create_single_source_cgal_program("utilities.cpp") create_single_source_cgal_program("Exact_rational.cpp") create_single_source_cgal_program("Mpzf_new.cpp") +create_single_source_cgal_program("check_exact_backend.cpp") if( CGAL_Core_FOUND ) create_single_source_cgal_program( "CORE_Expr_ticket_4296.cpp" ) diff --git a/Number_types/test/Number_types/check_exact_backend.cpp b/Number_types/test/Number_types/check_exact_backend.cpp new file mode 100644 index 00000000000..6aff3bf2d0a --- /dev/null +++ b/Number_types/test/Number_types/check_exact_backend.cpp @@ -0,0 +1,40 @@ +#include +#include +#include + +#include + +using namespace CGAL::internal; + +int main() +{ + static_assert( +#ifdef CGAL_USE_GMP + ( Default_exact_nt_backend!=GMP_BACKEND || (std::is_same_v && std::is_same_v) ) && +#endif +#ifdef CGAL_USE_GMPXX + ( Default_exact_nt_backend!=GMPXX_BACKEND || (std::is_same_v && std::is_same_v) ) && +#endif +#if defined(CGAL_USE_BOOST_MP) && defined(CGAL_USE_GMP) + ( Default_exact_nt_backend!=BOOST_GMP_BACKEND || (std::is_same_v && std::is_same_v) ) && +#endif +#if defined(CGAL_USE_BOOST_MP) + ( Default_exact_nt_backend!=BOOST_BACKEND || (std::is_same_v && std::is_same_v) ) && +#endif +#if defined(CGAL_USE_LEDA) + ( Default_exact_nt_backend!=LEDA_BACKEND || (std::is_same_v && std::is_same_v) ) && +#endif + ( Default_exact_nt_backend!=MP_FLOAT_BACKEND || (std::is_same_v && std::is_same_v>) ) + ); + + std::cout << "Exact backend is " << exact_nt_backend_string() << "\n"; +#ifdef CGAL_USE_CORE +#ifdef CGAL_CORE_USE_GMP_BACKEND + std::cout << "CGAL_CORE_USE_GMP_BACKEND is defined, using gmp backend in BigInt and BigRat\n"; +#else + std::cout << "CGAL_CORE_USE_GMP_BACKEND is NOT defined, using boost-mp backend in BigInt and BigRat\n"; +#endif +#else + std::cout << "CGAL_USE_CORE is not defined\n"; +#endif +} diff --git a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h index d64b73e699b..c867c190814 100644 --- a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h +++ b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/oriented_bounding_box.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/Orthtree/include/CGAL/Orthtree_traits.h b/Orthtree/include/CGAL/Orthtree_traits.h index cc1665622e7..7937afbe7fb 100644 --- a/Orthtree/include/CGAL/Orthtree_traits.h +++ b/Orthtree/include/CGAL/Orthtree_traits.h @@ -15,8 +15,6 @@ #include #include -#include -#include #include #include diff --git a/Orthtree/include/CGAL/Orthtree_traits_base.h b/Orthtree/include/CGAL/Orthtree_traits_base.h index 9750b2684ac..2d1ade67e92 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_base.h +++ b/Orthtree/include/CGAL/Orthtree_traits_base.h @@ -14,8 +14,6 @@ #include -#include -#include #include #include diff --git a/Orthtree/include/CGAL/Orthtree_traits_point.h b/Orthtree/include/CGAL/Orthtree_traits_point.h index 84e95bde81c..f05416b91db 100644 --- a/Orthtree/include/CGAL/Orthtree_traits_point.h +++ b/Orthtree/include/CGAL/Orthtree_traits_point.h @@ -15,8 +15,6 @@ #include #include -#include -#include #include #include diff --git a/Orthtree/package_info/Orthtree/dependencies b/Orthtree/package_info/Orthtree/dependencies index d8fbb010a7a..fee49d8d44b 100644 --- a/Orthtree/package_info/Orthtree/dependencies +++ b/Orthtree/package_info/Orthtree/dependencies @@ -1,10 +1,7 @@ Algebraic_foundations Cartesian_kernel -Circulator Distance_2 Distance_3 -Filtered_kernel -Hash_map Installation Intersections_2 Intersections_3 @@ -13,11 +10,7 @@ Kernel_23 Modular_arithmetic Number_types Orthtree -Point_set_2 Profiling_tools Property_map STL_Extension -Spatial_sorting Stream_support -TDS_2 -Triangulation_2 diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h index cbad54f1f7a..fafd9a4f5f1 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h @@ -3,14 +3,94 @@ namespace CGAL { /*! \ingroup PkgDrawPeriodic2Triangulation2 -opens a new window and draws `ap2t2`, the `Periodic_2_Triangulation_2`. A call to this function is blocking, that is the program continues as soon as the user closes the window. -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 P2T2 a model of the `Periodic_2TriangulationTraits_2` concept. -\param ap2t2 the 2D periodic trinagulation to draw. +The class `Graphics_scene_options_periodic_2_triangulation_2` defines data and methods used to tune the way that the cells of a `Periodic_2_triangulation_2` are considered for drawing or to be added into a graphics scene. +This class is a model of `GraphicsSceneOptionsPeriodic2Triangulation2`. + +\tparam DS a `CGAL::Periodic_2_triangulation_2`. +\tparam VertexDescriptor a descriptor of vertices of `DS`. +\tparam EdgeDescriptor a descriptor of edges of `DS`. +\tparam FaceDescriptor a descriptor of faces of `DS`. + +\cgalModels{GraphicsSceneOptionsPeriodic2Triangulation2} +*/ + +template +struct Graphics_scene_options_periodic_2_triangulation_2: public CGAL::Graphics_scene_options +{}; + +/*! +\ingroup PkgDrawPeriodic2Triangulation2 + +opens a new window and draws a periodic 2D triangulation. 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 P2T2 which must be an instanciation of a `CGAL::Periodic_2_triangulation_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptionsPeriodic2Triangulation2` concept. + +\param p2t2 the periodic triangulation to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Periodic_2_triangulation_2& p2t2, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void draw(const P2T2& p2t2, const GSOptions& gso); + +/*! +\ingroup PkgDrawPeriodic2Triangulation2 + +A shortcut to `CGAL::draw(p2t2, Graphics_scene_options_periodic_2_triangulation_2{})`. */ template -void draw(const P2T2& ap2t2); +void draw(const P2T2& p2t2); + +/*! +\ingroup PkgDrawPeriodic2Triangulation2 + +adds the vertices, edges and faces of `p2t2` 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 P2T2 which must be an instanciation of a `CGAL::Periodic_2_triangulation_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptionsPeriodic2Triangulation2` concept. + +\param p2t2 the periodic triangulation 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::Periodic_2_triangulation_2& p2t2, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const P2T2& p2t2, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawPeriodic2Triangulation2 + +A shortcut to `CGAL::add_to_graphics_scene(p2t2, gs, Graphics_scene_options_periodic_2_triangulation_2{})`. +*/ +template +void add_to_graphics_scene(const P2T2& p2t2, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Concepts/GraphicsSceneOptionsPeriodic2Triangulation2.h b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Concepts/GraphicsSceneOptionsPeriodic2Triangulation2.h new file mode 100644 index 00000000000..54b84e2d75a --- /dev/null +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/Concepts/GraphicsSceneOptionsPeriodic2Triangulation2.h @@ -0,0 +1,37 @@ +/*! +\ingroup PkgPeriodic2Triangulation2Concepts + +The concept `GraphicsSceneOptionsPeriodic2Triangulation2` defines data and methods used to tune the way that the cells of a `Periodic_2_triangulation_2` are considered for drawing or to be added into a graphics scene. + +\cgalRefines{GraphicsSceneOptions} + +\cgalHasModelsBegin +\cgalHasModelsBare{\link CGAL::Graphics_scene_options_periodic_2_triangulation_2 `CGAL::Graphics_scene_options_periodic_2_triangulation_2`\endlink} +\cgalHasModelsEnd + +*/ +class GraphicsSceneOptionsPeriodic2Triangulation2 +{ +public: + /// returns `true` if the domain of the Periodic_2_triangulation_2 must be drawn, `false` otherwise. + /// Returns `false` by default. + bool draw_domain() const; + + /// sets the draw domain value to `b`. + void draw_domain(bool b); + + /// toggles the draw domain value. + void toggle_draw_domain(); + + /// returns the type of the display (STORED, UNIQUE, STORED_COVER_DOMAIN or UNIQUE_COVER_DOMAIN). + typename DS::Iterator_type display_type() const; + + /// set the display type to the next type (in the ordered circular list STORED, UNIQUE, STORED_COVER_DOMAIN, UNIQUE_COVER_DOMAIN). + void increase_display_type(); + + /// returns the color used to draw the domain. + const CGAL::IO::Color& domain_color() const; + + /// sets the color used to draw the domain to `c`. + void domain_color(const CGAL::IO::Color& c) +}; diff --git a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt index 00c17ceec12..3c527f6fdd2 100644 --- a/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt +++ b/Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/PackageDescription.txt @@ -110,7 +110,9 @@ of the concept `Periodic_2Offset_2`. - `CGAL::Periodic_2_triangulation_2::Locate_type` \cgalCRPSection{Draw 2D Periodic Triangulation} - - \link PkgDrawPeriodic2Triangulation2 CGAL::draw() \endlink +- \link PkgDrawPeriodic2Triangulation2 CGAL::draw() \endlink +- `GraphicsSceneOptionsPeriodic2Triangulation2` +- `CGAL::Graphics_scene_options_periodic_2_triangulation_2` */ diff --git a/Periodic_2_triangulation_2/include/CGAL/draw_periodic_2_triangulation_2.h b/Periodic_2_triangulation_2/include/CGAL/draw_periodic_2_triangulation_2.h index 21d2156cd21..048494256b3 100644 --- a/Periodic_2_triangulation_2/include/CGAL/draw_periodic_2_triangulation_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/draw_periodic_2_triangulation_2.h @@ -8,274 +8,280 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Jasmeet Singh +// Mostafa Ashraf #ifndef DRAW_PERIODIC_2_TRIANGULATION_2_H #define DRAW_PERIODIC_2_TRIANGULATION_2_H #include -#include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include +#include +#include +#include #include -#include +#include namespace CGAL { -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorP2T2 { - template - static CGAL::IO::Color run(const P2T2 &, - const typename P2T2::Periodic_triangle_iterator /*ti*/) { - //CGAL::Random random((unsigned int)(std::size_t)(&*ti)); - //return get_random_color(random); - return CGAL::IO::Color(73, 250, 117); +// We need a specific graphics view options for periodic_2_triangulation_2 for the parameters +// of the domain. +template +struct Graphics_scene_options_periodic_2_triangulation_2 : + public CGAL::Graphics_scene_options +{ + Graphics_scene_options_periodic_2_triangulation_2(): + m_domain_color(CGAL::IO::Color(96, 104, 252)), + m_draw_domain(true), + m_display_type(DS::STORED) + {} + + bool draw_domain() const + { return m_draw_domain; } + void draw_domain(bool b) + { m_draw_domain=b; } + void toggle_draw_domain() + { m_draw_domain=!m_draw_domain; } + + typename DS::Iterator_type display_type() const + { return m_display_type; } + + void increase_display_type() + { + if(m_display_type==DS::UNIQUE_COVER_DOMAIN) + { m_display_type=DS::STORED; } + else + { m_display_type=typename DS::Iterator_type(static_cast(m_display_type)+1); } } + + const CGAL::IO::Color& domain_color() const + { return m_domain_color; } + void domain_color(const CGAL::IO::Color& c) + { m_domain_color=c; } + +protected: + CGAL::IO::Color m_domain_color; + bool m_draw_domain; + typename DS::Iterator_type m_display_type; }; -// Viewer class for P2T2 -template -class SimplePeriodic2Triangulation2ViewerQt : public Basic_viewer_qt +namespace draw_function_for_P2T2 { - typedef Basic_viewer_qt Base; - typedef typename P2T2::Iterator_type Iterator_type; +template +void compute_vertex(const P2T2 &p2t2, + typename P2T2::Periodic_point_iterator pi, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + // Construct the point in 9-sheeted covering space and add to viewer + if(!gs_options.draw_vertex(p2t2, pi)) + { return; } - // Vertex iterators - typedef typename P2T2::Periodic_point_iterator Periodic_point_iterator; + if(gs_options.colored_vertex(p2t2, pi)) + { graphics_scene.add_point(p2t2.point(*pi), + gs_options.vertex_color(p2t2, pi)); } + else + { graphics_scene.add_point(p2t2.point(*pi)); } +} - // Edge iterators - typedef typename P2T2::Periodic_segment_iterator Periodic_segment_iterator; - typedef typename P2T2::Segment Segment; +template +void compute_edge(const P2T2 &p2t2, + typename P2T2::Periodic_segment_iterator si, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if(!gs_options.draw_edge(p2t2, si)) + { return; } - // Face iterators - typedef typename P2T2::Periodic_triangle_iterator Periodic_triangle_iterator; - typedef typename P2T2::Triangle Triangle; + // Construct the segment in 9-sheeted covering space and add to viewer + typename P2T2::Segment s(p2t2.segment(*si)); + if(gs_options.colored_edge(p2t2, si)) + { graphics_scene.add_segment(s[0], s[1], + gs_options.edge_color(p2t2, si)); } + else + { graphics_scene.add_segment(s[0], s[1]); } +} +template +void compute_face(const P2T2 &p2t2, + typename P2T2::Periodic_triangle_iterator ti, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if(!gs_options.draw_face(p2t2, ti)) + { return; } + + // Construct the triangle in 9-sheeted covering space and add to viewer + typename P2T2::Triangle t(p2t2.triangle(*ti)); + + if(gs_options.colored_face(p2t2, ti)) + { graphics_scene.face_begin(gs_options.face_color(p2t2, ti)); } + else + { graphics_scene.face_begin(); } + + graphics_scene.add_point_in_face(t[0]); + graphics_scene.add_point_in_face(t[1]); + graphics_scene.add_point_in_face(t[2]); + graphics_scene.face_end(); +} + +template +void compute_domain(const P2T2& p2t2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; -public: - /// Construct the viewer. - /// @param ap2t2 the p2t2 to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big object where this time could be long) - SimplePeriodic2Triangulation2ViewerQt(QWidget* parent, const P2T2& ap2t2, - const char* title="Basic P2T2 Viewer", - bool anofaces=false, - const ColorFunctor& fcolor=ColorFunctor()) : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, true, true, true, false, false), - p2t2(ap2t2), - m_nofaces(anofaces), - m_fcolor(fcolor), - m_display_type(STORED_COVER_DOMAIN), - m_domain(true) + Kernel::Iso_rectangle_2 orig_domain = p2t2.domain(); + std::array covering_sheets = p2t2.number_of_sheets(); + + for(int i = 0; i < covering_sheets[0]; i++) { - // Add custom key description (see keyPressEvent). - setKeyDescription(::Qt::Key_1, "STORED: Display all geometric primitives as they are stored in " - "Triangulation_data_structure_2"); - setKeyDescription(::Qt::Key_2, "UNIQUE: Display only one representative of each geometric primitive even " - "if the triangulation is computed in multiply sheeted covering space."); - setKeyDescription(::Qt::Key_3, "STORED_COVER_DOMAIN: Same as STORED but also display " - "all primitives whose intersection with the original " - "domain of the current covering space is non-empty"); - setKeyDescription(::Qt::Key_4, "UNIQUE_COVER_DOMAIN: Same as UNIQUE but also display " - "all primitives whose intersection with the original " - "domain of the current covering space is non-empty"); - setKeyDescription(::Qt::Key_D, "Toggle 9-sheeted domain display"); + for(int j = 0; j < covering_sheets[1]; j++) + { + Kernel::Vector_2 shift(i * (orig_domain.xmax() - orig_domain.xmin()), + j * orig_domain.ymax() - orig_domain.ymin()); + Kernel::Point_2 p1((orig_domain.min)()); + Kernel::Point_2 p2(orig_domain.xmin(), orig_domain.ymax()); + Kernel::Point_2 p3(orig_domain.xmax(), orig_domain.ymin()); + Kernel::Point_2 p4((orig_domain.max)()); - compute_elements(); - } -protected: - void compute_vertex(Periodic_point_iterator pi) - { - // Construct the point in 9-sheeted covering space and add to viewer - add_point(p2t2.point(*pi)); - } - - void compute_edge(Periodic_segment_iterator si) - { - // Construct the segment in 9-sheeted covering space and add to viewer - Segment s(p2t2.segment(*si)); - add_segment(s[0], s[1]); - } - - void compute_face(Periodic_triangle_iterator ti) - { - // Construct the triangle in 9-sheeted covering space and add to viewer - Triangle t(p2t2.triangle(*ti)); - - CGAL::IO::Color c=m_fcolor.run(p2t2, ti); - face_begin(c); - add_point_in_face(t[0]); - add_point_in_face(t[1]); - add_point_in_face(t[2]); - face_end(); - - // Display the edges of the faces as segments with a - // light gray color for better visualization - add_segment(t[0], t[1], CGAL::IO::Color(207, 213, 211)); - add_segment(t[1], t[2], CGAL::IO::Color(207, 213, 211)); - add_segment(t[2], t[0], CGAL::IO::Color(207, 213, 211)); - } - - void compute_domain() - { - Kernel::Iso_rectangle_2 orig_domain = p2t2.domain(); - std::array covering_sheets = p2t2.number_of_sheets(); - - for(int i = 0; i < covering_sheets[0]; i++){ - for(int j = 0; j < covering_sheets[1]; j++){ - Kernel::Vector_2 shift(i * (orig_domain.xmax() - orig_domain.xmin()), - j * orig_domain.ymax() - orig_domain.ymin()); - Kernel::Point_2 p1((orig_domain.min)()); - Kernel::Point_2 p2(orig_domain.xmin(), orig_domain.ymax()); - Kernel::Point_2 p3(orig_domain.xmax(), orig_domain.ymin()); - Kernel::Point_2 p4((orig_domain.max)()); - - add_segment(p1 + shift, p2 + shift, CGAL::IO::Color(96, 104, 252)); - add_segment(p1 + shift, p3 + shift, CGAL::IO::Color(96, 104, 252)); - add_segment(p2 + shift, p4 + shift, CGAL::IO::Color(96, 104, 252)); - add_segment(p3 + shift, p4 + shift, CGAL::IO::Color(96, 104, 252)); - } + graphics_scene.add_segment(p1 + shift, p2 + shift, gs_options.domain_color()); + graphics_scene.add_segment(p1 + shift, p3 + shift, gs_options.domain_color()); + graphics_scene.add_segment(p2 + shift, p4 + shift, gs_options.domain_color()); + graphics_scene.add_segment(p3 + shift, p4 + shift, gs_options.domain_color()); } } - - void compute_elements() { - // Clear the buffers - clear(); - - // Get the display type, iterate through periodic elements according - // to the display type - Iterator_type it_type = (Iterator_type)m_display_type; - - // Iterate through vertices, edges and faces, add elements to buffer - for (Periodic_point_iterator it = - p2t2.periodic_points_begin(it_type); - it != p2t2.periodic_points_end(it_type); it++) - { - compute_vertex(it); - } - - for (Periodic_segment_iterator it = - p2t2.periodic_segments_begin(it_type); - it != p2t2.periodic_segments_end(it_type); it++) - { - compute_edge(it); - } - - for (Periodic_triangle_iterator it = - p2t2.periodic_triangles_begin(it_type); - it != p2t2.periodic_triangles_end(it_type); it++) - { - compute_face(it); - } - - if(m_domain){ - // Compute the (9-sheet covering space) domain of the periodic triangulation - compute_domain(); - } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - if (e->text()=="1") - { - m_display_type = Display_type::UNIQUE; - displayMessage(QString("Display type= UNIQUE")); - compute_elements(); - redraw(); - } else if (e->text()=="2") - { - m_display_type = Display_type::UNIQUE_COVER_DOMAIN; - displayMessage(QString("Display type= UNIQUE_COVER_DOMAIN")); - compute_elements(); - redraw(); - } else if (e->text()=="3") - { - m_display_type = Display_type::STORED; - displayMessage(QString("Display type= STORED")); - compute_elements(); - redraw(); - } else if (e->text()=="4") - { - m_display_type = Display_type::STORED_COVER_DOMAIN; - displayMessage(QString("Display type= STORED_COVER_DOMAIN")); - compute_elements(); - redraw(); - } else if ((e->key() == ::Qt::Key_D) && (modifiers == ::Qt::NoButton)) - { - m_domain=!m_domain; - displayMessage(QString("Draw domain=%1.").arg(m_domain?"true":"false")); - compute_elements(); - redraw(); - } else { - Base::keyPressEvent(e); - } - } - -protected: - const P2T2& p2t2; - bool m_nofaces; - const ColorFunctor& m_fcolor; - enum Display_type - { - STORED = 0, - UNIQUE, // 1 - STORED_COVER_DOMAIN, // 2 - UNIQUE_COVER_DOMAIN // 3 - }; - Display_type m_display_type; - bool m_domain; -}; - -// Specialization of draw function -#define CGAL_P2T2_TYPE CGAL::Periodic_2_triangulation_2 \ - - -template < class Gt, - class Tds > -void draw(const CGAL_P2T2_TYPE& ap2t2, - const char* title = "2D Periodic Triangulation Viewer", - bool nofill = false) -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"p2t2_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - DefaultColorFunctorP2T2 fcolor; - SimplePeriodic2Triangulation2ViewerQt - mainwindow(app.activeWindow(), ap2t2, title, nofill, fcolor); - mainwindow.show(); - app.exec(); - } } -} // namespace CGAL +template +void compute_elements(const P2T2& p2t2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + // Get the display type, iterate through periodic elements according + // to the display type + typedef typename P2T2::Iterator_type Iterator_type; + Iterator_type it_type = (Iterator_type)gs_options.display_type(); + + // Iterate through vertices, edges and faces, add elements to buffer + if(gs_options.are_vertices_enabled()) + { + for (typename P2T2::Periodic_point_iterator it=p2t2.periodic_points_begin(it_type); + it!=p2t2.periodic_points_end(it_type); ++it) + { compute_vertex(p2t2, it, graphics_scene, gs_options); } + } + + if(gs_options.are_edges_enabled()) + { + for (typename P2T2::Periodic_segment_iterator it=p2t2.periodic_segments_begin(it_type); + it!=p2t2.periodic_segments_end(it_type); ++it) + { compute_edge(p2t2, it, graphics_scene, gs_options); } + } + + if (gs_options.are_faces_enabled()) + { + for (typename P2T2::Periodic_triangle_iterator it=p2t2.periodic_triangles_begin(it_type); + it!=p2t2.periodic_triangles_end(it_type); ++it) + { compute_face(p2t2, it, graphics_scene, gs_options); } + } + + if(gs_options.draw_domain()) + { + // Compute the (9-sheet covering space) domain of the periodic triangulation + compute_domain(p2t2, graphics_scene, gs_options); + } +} + +} // namespace draw_function_for_P2T2 + +#define CGAL_P2T2_TYPE CGAL::Periodic_2_triangulation_2 + +template +void add_to_graphics_scene(const CGAL_P2T2_TYPE& p2t2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + draw_function_for_P2T2::compute_elements(p2t2, graphics_scene, gs_options); +} + +template +void add_to_graphics_scene(const CGAL_P2T2_TYPE& p2t2, + CGAL::Graphics_scene& graphics_scene) +{ + CGAL::Graphics_scene_options_periodic_2_triangulation_2 + gs_options; + + add_to_graphics_scene(p2t2, graphics_scene, gs_options); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function +template +void draw(const CGAL_P2T2_TYPE& ap2t2, + GSOptions& gs_options, + const char* title="2D Periodic Triangulation Viewer") +{ + CGAL::Graphics_scene gs; + add_to_graphics_scene(ap2t2, gs, gs_options); + CGAL::Qt::QApplication_and_basic_viewer app(gs, title); + if(app) + { + // Here we define the std::function to capture key pressed. + app.basic_viewer().on_key_pressed= + [&ap2t2, &gs, &gs_options] (QKeyEvent* e, CGAL::Qt::Basic_viewer* basic_viewer) -> bool + { + const ::Qt::KeyboardModifiers modifiers = e->modifiers(); + if ((e->key() == ::Qt::Key_D) && (modifiers == ::Qt::NoButton)) + { + gs_options.increase_display_type(); + basic_viewer->displayMessage + (QString("Display type=%1.").arg(gs_options.display_type()==0?"Stored": + (gs_options.display_type()==1?"Unique": + (gs_options.display_type()==2?"Stored cover": + "Unique cover")))); + gs.clear(); + add_to_graphics_scene(ap2t2, gs, gs_options); + basic_viewer->redraw(); + } + else + { + // Return false will call the base method to process others/classicals key + return false; + } + return true; // the key was captured + }; + + // Here we add shortcut descriptions + app.basic_viewer().setKeyDescription(::Qt::Key_D, "Next display type"); + + // Then we run the app + app.run(); + } +} + +template +void draw(const CGAL_P2T2_TYPE& ap2t2, + const char* title="2D Periodic Triangulation Viewer") +{ + CGAL::Graphics_scene_options_periodic_2_triangulation_2 + gs_options; + draw(ap2t2, gs_options, title); +} #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_P2T2_TYPE + +} // namespace CGAL + #endif // DRAW_PERIODIC_2_TRIANGULATION_2_H diff --git a/Periodic_2_triangulation_2/package_info/Periodic_2_triangulation_2/dependencies b/Periodic_2_triangulation_2/package_info/Periodic_2_triangulation_2/dependencies index 22f0ba917df..fa072ac6299 100644 --- a/Periodic_2_triangulation_2/package_info/Periodic_2_triangulation_2/dependencies +++ b/Periodic_2_triangulation_2/package_info/Periodic_2_triangulation_2/dependencies @@ -1,23 +1,30 @@ Algebraic_foundations +Arithmetic_kernel +BGL +Basic_viewer Cartesian_kernel Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView Hash_map +Homogeneous_kernel Installation Intersections_2 Intersections_3 Interval_support Kernel_23 +Kernel_d Modular_arithmetic Number_types Periodic_2_triangulation_2 +Polygon Profiling_tools Property_map +Random_numbers STL_Extension Spatial_sorting Stream_support TDS_2 Triangulation_2 +CGAL_Core diff --git a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/TriangulationGraphicsItem.h b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/TriangulationGraphicsItem.h index e6b56085125..71e38171d57 100644 --- a/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/TriangulationGraphicsItem.h +++ b/Periodic_4_hyperbolic_triangulation_2/demo/Periodic_4_hyperbolic_triangulation_2/include/internal/Qt/TriangulationGraphicsItem.h @@ -14,7 +14,6 @@ #define CGAL_QT_TRIANGULATION_GRAPHICS_ITEM_H #include -#include #include #include diff --git a/Point_set_3/examples/Point_set_3/CMakeLists.txt b/Point_set_3/examples/Point_set_3/CMakeLists.txt index 747ba9d7992..833fb509719 100644 --- a/Point_set_3/examples/Point_set_3/CMakeLists.txt +++ b/Point_set_3/examples/Point_set_3/CMakeLists.txt @@ -11,9 +11,7 @@ create_single_source_cgal_program("point_set.cpp") create_single_source_cgal_program("point_set_property.cpp") create_single_source_cgal_program("point_set_read_xyz.cpp") create_single_source_cgal_program("point_set_advanced.cpp") - -set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates) -create_single_source_cgal_program("point_set_read_ply.cpp" CXX_FEATURES ${needed_cxx_features}) +create_single_source_cgal_program("point_set_read_ply.cpp") find_package(Eigen3 3.1.0 QUIET) #(requires 3.1.0 or greater) include(CGAL_Eigen3_support) diff --git a/Point_set_3/include/CGAL/draw_point_set_3.h b/Point_set_3/include/CGAL/draw_point_set_3.h index ecd747b3cdf..6a8f671296d 100644 --- a/Point_set_3/include/CGAL/draw_point_set_3.h +++ b/Point_set_3/include/CGAL/draw_point_set_3.h @@ -9,12 +9,16 @@ // // // 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 +#include #ifdef DOXYGEN_RUNNING namespace CGAL { @@ -22,100 +26,151 @@ namespace CGAL { /*! \ingroup PkgDrawPointSet3D -opens a new window and draws `aps`, an instance of the `CGAL::Point_set_3` class. A call to this function is blocking, that is the program continues as soon as the user closes the window. 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 an instance of the `CGAL::Point_set_3` class. -\param aps the point set to draw. +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 instanciation 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 instanciation 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 draw(const PS& aps); +void add_to_graphics_scene(const PS& ps, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ #endif -#ifdef CGAL_USE_BASIC_VIEWER +namespace CGAL { -#include -#include -#include +namespace draw_function_for_PointSet { -namespace CGAL +template +void compute_elements(const PointSet& pointset, + Graphics_scene& graphics_scene, + const GSOptions& gs_options) { + if (!gs_options.are_vertices_enabled()) + { return; } -// Viewer class for Point_set -template -class SimplePointSetViewerQt : public Basic_viewer_qt -{ - typedef Basic_viewer_qt Base; - typedef typename PointSet::Point_map::value_type Point; - -public: - /// Construct the viewer. - /// @param apointset the point set to view - /// @param title the title of the window - SimplePointSetViewerQt(QWidget* parent, - const PointSet& apointset, const char* title="") : - // First draw: vertices; no-edge, no-face; mono-color; no inverse normal - Base(parent, title, true, false, false, true, false), - pointset(apointset) + for (typename PointSet::const_iterator it=pointset.begin(); + it!=pointset.end(); ++it) { - compute_elements(); - } - -protected: - void compute_vertex(const Point& p) - { - add_point(p); - // We can use add_point(p, c) with c a CGAL::IO::Color to add a colored point - } - - void compute_elements() - { - clear(); - - for (typename PointSet::const_iterator it=pointset.begin(); - it!=pointset.end(); ++it) - { compute_vertex(pointset.point(*it)); } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - Base::keyPressEvent(e); - } - -protected: - const PointSet& pointset; -}; - -// Specialization of draw function. -template -void draw(const Point_set_3& apointset, - const char* title="Point_set_3 Basic Viewer") -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"point_set_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimplePointSetViewerQt > mainwindow(app.activeWindow(), - apointset, - title); - mainwindow.show(); - app.exec(); + 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)); } + } } } -} // End namespace CGAL +} // 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); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// 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); +} #endif // CGAL_USE_BASIC_VIEWER +} // End namespace CGAL + #endif // CGAL_DRAW_POINT_SET_3_H diff --git a/Point_set_3/package_info/Point_set_3/dependencies b/Point_set_3/package_info/Point_set_3/dependencies index 6f0ec394588..5b0eb897d7e 100644 --- a/Point_set_3/package_info/Point_set_3/dependencies +++ b/Point_set_3/package_info/Point_set_3/dependencies @@ -1,16 +1,32 @@ Algebraic_foundations +Arithmetic_kernel BGL +Basic_viewer +Cartesian_kernel Circulator -GraphicsView +Distance_2 +Distance_3 +Filtered_kernel +Hash_map +Homogeneous_kernel Installation +Intersections_2 +Intersections_3 Interval_support Kernel_23 +Kernel_d Modular_arithmetic Number_types Point_set_3 Point_set_processing_3 +Polygon Profiling_tools Property_map +Random_numbers STL_Extension +Spatial_sorting Stream_support Surface_mesh +TDS_2 +Triangulation_2 +CGAL_Core diff --git a/Polygon/examples/Polygon/CMakeLists.txt b/Polygon/examples/Polygon/CMakeLists.txt index 1d559bbe210..d70f0d7df18 100644 --- a/Polygon/examples/Polygon/CMakeLists.txt +++ b/Polygon/examples/Polygon/CMakeLists.txt @@ -18,5 +18,6 @@ endforeach() if(CGAL_Qt6_FOUND) target_link_libraries(draw_polygon PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_polygon_with_holes PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(draw_polygon_with_holes_2 PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_multipolygon_with_holes PUBLIC CGAL::CGAL_Basic_viewer) endif() diff --git a/Polygon/examples/Polygon/draw_polygon_with_holes_2.cpp b/Polygon/examples/Polygon/draw_polygon_with_holes_2.cpp new file mode 100644 index 00000000000..3306655a135 --- /dev/null +++ b/Polygon/examples/Polygon/draw_polygon_with_holes_2.cpp @@ -0,0 +1,46 @@ +/*! \file draw_polygon_with_holes_2.cpp + */ + +#include +#include +#include +#include + +using K=CGAL::Exact_predicates_inexact_constructions_kernel; +using Point_2=K::Point_2; +using Polygon_2=CGAL::Polygon_2; +using Polygon_with_holes_2=CGAL::Polygon_with_holes_2; + +Polygon_2 triangle(double x, double y) +{ // Create a triangle (x, y) + Polygon_2 P; + P.push_back(Point_2(x, y)); + P.push_back(Point_2(x+0.5, y+1)); + P.push_back(Point_2(x+1, y)); + return P; +} + +Polygon_2 rectangle(double l) +{ // Create a rectangle with given side length. + Polygon_2 P; + P.push_back(Point_2(0, 0)); + P.push_back(Point_2(l, 0)); + P.push_back(Point_2(l, l)); + P.push_back(Point_2(0, l)); + return P; +} + +int main() +{ + // Create a large rectangle A, with 3 triangle holes + Polygon_with_holes_2 A(rectangle(4)); + Polygon_2 H1(triangle(1, 1)); + Polygon_2 H2(triangle(2, 1)); + Polygon_2 H3(triangle(1.5, 2)); + A.add_hole(H1); + A.add_hole(H2); + A.add_hole(H3); + CGAL::draw(A); + + return 0; +} diff --git a/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h b/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h index 909b4b29da8..8950956786e 100644 --- a/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h +++ b/Polygon/include/CGAL/draw_multipolygon_with_holes_2.h @@ -18,7 +18,7 @@ #ifndef CGAL_DRAW_MULTIPOLYGON_WITH_HOLES_2_H #define CGAL_DRAW_MULTIPOLYGON_WITH_HOLES_2_H -#include +#include #ifdef DOXYGEN_RUNNING namespace CGAL { @@ -53,8 +53,8 @@ namespace CGAL { // Viewer class for Multipolygon_with_holes_2 template -class Mpwh_2_basic_viewer_qt : public Basic_viewer_qt { - using Base = Basic_viewer_qt; +class Mpwh_2_basic_viewer_qt : public Qt::Basic_viewer { + using Base = Qt::Basic_viewer; using Mpwh = Multipolygon; using Pwh = typename Mpwh::Polygon_with_holes_2; using Pgn = typename Mpwh::Polygon_2; @@ -67,7 +67,7 @@ public: /// @param title the title of the window Mpwh_2_basic_viewer_qt(QWidget* parent, const Mpwh& mpwh, const char* title = "Basic Multipolygon_with_holes_2 Viewer") : - Base(parent, title, true, true, true, false, false), + Base(parent, gs, title, true, true, true, false, false), m_mpwh(mpwh) { if (mpwh.number_of_polygons_with_holes() == 0) return; @@ -109,11 +109,10 @@ public: /*! Compute the elements of a multipolygon with holes. */ void add_elements() { - clear(); + gs.clear(); for (auto const& p: m_mpwh.polygons_with_holes()) { - CGAL::IO::Color c(rand()%255,rand()%255,rand()%255); - face_begin(c); + gs.face_begin(get_random_color(get_default_random())); const Pnt* point_in_face; const auto& outer_boundary = p.outer_boundary(); @@ -122,10 +121,10 @@ public: for (auto it = p.holes_begin(); it != p.holes_end(); ++it) { compute_loop(*it, true); - add_point_in_face(*point_in_face); + gs.add_point_in_face(*point_in_face); } - face_end(); + gs.face_end(); } } @@ -133,21 +132,21 @@ protected: /*! Compute the face */ void compute_loop(const Pgn& p, bool hole) { - if (hole) add_point_in_face(p.vertex(p.size()-1)); + if (hole) gs.add_point_in_face(p.vertex(p.size()-1)); auto prev = p.vertices_begin(); auto it = prev; - add_point(*it); - add_point_in_face(*it); + gs.add_point(*it); + gs.add_point_in_face(*it); for (++it; it != p.vertices_end(); ++it) { - add_segment(*prev, *it); // add segment with previous point - add_point(*it); - add_point_in_face(*it); // add point in face + gs.add_segment(*prev, *it); // add segment with previous point + gs.add_point(*it); + gs.add_point_in_face(*it); // add point in face prev = it; } // Add the last segment between the last point and the first one - add_segment(*prev, *(p.vertices_begin())); + gs.add_segment(*prev, *(p.vertices_begin())); } virtual void keyPressEvent(QKeyEvent* e) { @@ -166,6 +165,8 @@ protected: } private: + Graphics_scene gs; + //! The window width in pixels. int m_width = CGAL_BASIC_VIEWER_INIT_SIZE_X; diff --git a/Polygon/include/CGAL/draw_polygon_2.h b/Polygon/include/CGAL/draw_polygon_2.h index 800e15e18a0..24acaaa7535 100644 --- a/Polygon/include/CGAL/draw_polygon_2.h +++ b/Polygon/include/CGAL/draw_polygon_2.h @@ -13,11 +13,15 @@ // // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_POLYGON_2_H #define CGAL_DRAW_POLYGON_2_H -#include +#include +#include +#include +#include #ifdef DOXYGEN_RUNNING namespace CGAL { @@ -25,117 +29,177 @@ namespace CGAL { /*! \ingroup PkgDrawPolygon2 -opens a new window and draws `ap`, an instance of the `CGAL::Polygon_2` class. A call to this function is blocking, that is the program continues as soon as the user closes the window. 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 P an instance of the `CGAL::Polygon_2` class. -\param ap the polygon to draw. +opens a new window and draws a 2D polygon. 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 P which must be an instanciation of a `CGAL::Polygon_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param p the polygon to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Polygon_2& p, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void draw(const P& p, const GSOptions& gso); + +/*! +\ingroup PkgDrawPolygon2 + +A shortcut to `CGAL::draw(p, Graphics_scene_options{})`. +*/ + template + void draw(const P& p); + +/*! +\ingroup PkgDrawPolygon2 + +adds the vertices, edges and faces of `p` 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 P which must be an instanciation of a `CGAL::Polygon_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param p the 2D polygon 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::Polygon_2& p, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const P& p, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawPolygon2 + +A shortcut to `CGAL::add_to_graphics_scene(p, gs, Graphics_scene_options{})`. */ template -void draw(const P& ap); - +void add_to_graphics_scene(const P& p, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ #endif -#ifdef CGAL_USE_BASIC_VIEWER -#include -#include -#include +namespace CGAL { -namespace CGAL +namespace draw_function_for_p2 { + +template +void compute_elements(const P2& p2, + CGAL::Graphics_scene &graphics_scene, + const GSOptions& gso) { + if (p2.is_empty()) + return; -// Viewer class for Polygon_2 -template -class SimplePolygon2ViewerQt : public Basic_viewer_qt -{ - typedef Basic_viewer_qt Base; - typedef typename P2::Point_2 Point; - -public: - /// Construct the viewer. - /// @param ap2 the polygon to view - /// @param title the title of the window - SimplePolygon2ViewerQt(QWidget* parent, const P2& ap2, - const char* title="Basic Polygon_2 Viewer") : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, true, true, true, false, false), - p2(ap2) + if (gso.are_faces_enabled()) { - compute_elements(); + if(gso.colored_face(p2, nullptr)) + { graphics_scene.face_begin(gso.face_color(p2, nullptr)); } + else + { graphics_scene.face_begin(); } } -protected: - void compute_elements() + typename P2::Vertex_const_iterator prev=p2.vertices_end(); --prev; + for (typename P2::Vertex_const_iterator i=p2.vertices_begin(); + i!=p2.vertices_end(); ++i) { - clear(); - - if (p2.is_empty()) return; - - Point prev=p2.vertex(p2.size()-1); - - CGAL::IO::Color c(75,160,255); - face_begin(c); - - for (typename P2::Vertex_const_iterator i=p2.vertices_begin(); - i!=p2.vertices_end(); ++i) - { - add_point(*i); // Add vertex - add_segment(prev, *i); // Add segment with previous point - add_point_in_face(*i); // Add point in face - prev=*i; + if(gso.are_vertices_enabled() && + gso.draw_vertex(p2, i)) + { // Add vertex + if(gso.colored_vertex(p2, i)) + { graphics_scene.add_point(*i, gso.vertex_color(p2, i)); } + else + { graphics_scene.add_point(*i); } } - face_end(); + if(gso.are_edges_enabled() && + gso.draw_edge(p2, prev)) + { // Add edge with previous point + if(gso.colored_edge(p2, prev)) + { graphics_scene.add_segment(*prev, *i, gso.edge_color(p2, prev)); } + else + { graphics_scene.add_segment(*prev, *i); } + } + + if(gso.are_faces_enabled()) + { graphics_scene.add_point_in_face(*i); } // Add point in face + + prev=i; } - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - -protected: - const P2& p2; -}; - -// Specialization of draw function. -template -void draw(const CGAL::Polygon_2& ap2, - const char* title="Polygon_2 Basic Viewer") -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"t2_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimplePolygon2ViewerQt > - mainwindow(app.activeWindow(), ap2, title); - mainwindow.show(); - app.exec(); - } + if (gso.are_faces_enabled()) + { graphics_scene.face_end(); } } -} // End namespace CGAL +} // namespace draw_function_for_p2 + +#define CGAL_P2_TYPE CGAL::Polygon_2 + +// Specializations of add_to_graphics_scene function +template +void add_to_graphics_scene(const CGAL_P2_TYPE& ap2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso) +{ draw_function_for_p2::compute_elements(ap2, graphics_scene, gso); } + +template +void add_to_graphics_scene(const CGAL_P2_TYPE& ap2, + CGAL::Graphics_scene &graphics_scene) +{ + CGAL::Graphics_scene_options gso; + draw_function_for_p2::compute_elements(ap2, graphics_scene, gso); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function. +template +void draw(const CGAL_P2_TYPE &ap2, + const char *title="Polygon_2 Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(ap2, buffer); + draw_graphics_scene(buffer, title); +} + +template +void draw(const CGAL_P2_TYPE &ap2, + const GSOptions& gso, + const char *title="Polygon_2 Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(ap2, buffer, gso); + draw_graphics_scene(buffer, title); +} #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_P2_TYPE + +} // End namespace CGAL + #endif // CGAL_DRAW_POLYGON_2_H diff --git a/Polygon/include/CGAL/draw_polygon_with_holes_2.h b/Polygon/include/CGAL/draw_polygon_with_holes_2.h index a530ad0a221..3be337aa157 100644 --- a/Polygon/include/CGAL/draw_polygon_with_holes_2.h +++ b/Polygon/include/CGAL/draw_polygon_with_holes_2.h @@ -13,209 +13,230 @@ // // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_POLYGON_WITH_HOLES_2_H #define CGAL_DRAW_POLYGON_WITH_HOLES_2_H -#include +#include +#include +#include +#include #ifdef DOXYGEN_RUNNING namespace CGAL { /*! - * \ingroup PkgDrawPolygonWithHoles2 - * - * opens a new window and draws `aph`, an instance of the - * `CGAL::Polygon_with_holes_2` class. A call to this function is blocking, that - * is the program continues as soon as the user closes the window. 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 PH an instance of the `CGAL::Polygon_with_holes_2` class. - * \param aph the polygon with holes to draw. - */ + \ingroup PkgDrawPolygonWithHoles2 -template -void draw(const PH& aph); +opens a new window and draws a 2D polygon with holes. 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 PH which must be an instanciation of a `CGAL::Polygon_with_holes_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param ph the polygon with holes to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Polygon_with_holes_2& ph, const GSOptions& gso); + +\cgalAdvancedEnd + */ +template +void draw(const PH& ph, const GSOptions& gso); + +/*! +\ingroup PkgDrawPolygonWithHoles2 + +A shortcut to `CGAL::draw(ph, Graphics_scene_options{})`. +*/ + template + void draw(const PH& ph); + +/*! +\ingroup PkgDrawPolygonWithHoles2 + +adds the vertices, edges and faces of `ph` 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 PH which must be an instanciation of a `CGAL::Polygon_with_holes_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param ph the polygon with holes 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::Polygon_with_holes_2& ph, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const PH& ph, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawPolygonWithHoles2 + +A shortcut to `CGAL::add_to_graphics_scene(ph, gs, Graphics_scene_options{})`. +*/ +template +void add_to_graphics_scene(const PH& ph, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ #endif -#ifdef CGAL_USE_BASIC_VIEWER - -#include -#include - -namespace CGAL { - -// Viewer class for Polygon_with_holes_2 -template -class Pwh_2_basic_viewer_qt : public Basic_viewer_qt { - using Base = Basic_viewer_qt; - using Pwh = PolygonWidthHoles_2; - using Pgn = typename Pwh::Polygon_2; - using Pnt = typename Pgn::Point_2; - -public: - /// Construct the viewer. - /// @param parent the active window to draw - /// @param pwh the polygon to view - /// @param title the title of the window - Pwh_2_basic_viewer_qt(QWidget* parent, const Pwh& pwh, - const char* title = "Basic Polygon_with_holes_2 Viewer") : - Base(parent, title, true, true, true, false, false), - m_pwh(pwh) - { - if (pwh.is_unbounded() && (0 == pwh.number_of_holes())) return; - - // mimic the computation of Camera::pixelGLRatio() - auto bbox = bounding_box(); - CGAL::qglviewer::Vec minv(bbox.xmin(), bbox.ymin(), 0); - CGAL::qglviewer::Vec maxv(bbox.xmax(), bbox.ymax(), 0); - auto diameter = (maxv - minv).norm(); - m_pixel_ratio = diameter / m_height; - } - - /*! Intercept the resizing of the window. - */ - virtual void resizeGL(int width, int height) { - CGAL::QGLViewer::resizeGL(width, height); - m_width = width; - m_height = height; - CGAL::qglviewer::Vec p; - auto ratio = camera()->pixelGLRatio(p); - m_pixel_ratio = ratio; - add_elements(); - } - - /*! Obtain the pixel ratio. - */ - double pixel_ratio() const { return m_pixel_ratio; } - - /*! Compute the bounding box. - */ - CGAL::Bbox_2 bounding_box() { - if (! m_pwh.is_unbounded()) return m_pwh.outer_boundary().bbox(); - - Bbox_2 bbox; - for (auto it = m_pwh.holes_begin(); it != m_pwh.holes_end(); ++it) - bbox += it->bbox(); - return bbox; - } - - /*! Compute the elements of a polygon with holes. - */ - void add_elements() { - clear(); - CGAL::IO::Color c(75,160,255); - face_begin(c); - - const Pnt* point_in_face; - if (m_pwh.outer_boundary().is_empty()) { - Pgn pgn; - - double x = (double)m_width * 0.5 * m_pixel_ratio; - double y = (double)m_height * 0.5 * m_pixel_ratio; - pgn.push_back(Pnt(-x, -y)); - pgn.push_back(Pnt(x, -y)); - pgn.push_back(Pnt(x, y)); - pgn.push_back(Pnt(-x, y)); - compute_loop(pgn, false); - point_in_face = &(pgn.vertex(pgn.size()-1)); - } - else { - const auto& outer_boundary = m_pwh.outer_boundary(); - compute_loop(outer_boundary, false); - point_in_face = &(outer_boundary.vertex(outer_boundary.size()-1)); - } - - for (auto it = m_pwh.holes_begin(); it != m_pwh.holes_end(); ++it) { - compute_loop(*it, true); - add_point_in_face(*point_in_face); - } - - face_end(); - } - -protected: - /*! Compute the face - */ - void compute_loop(const Pgn& p, bool hole) { - if (hole) add_point_in_face(p.vertex(p.size()-1)); - - auto prev = p.vertices_begin(); - auto it = prev; - add_point(*it); - add_point_in_face(*it); - for (++it; it != p.vertices_end(); ++it) { - add_segment(*prev, *it); // add segment with previous point - add_point(*it); - add_point_in_face(*it); // add point in face - prev = it; - } - - // Add the last segment between the last point and the first one - add_segment(*prev, *(p.vertices_begin())); - } - - virtual void keyPressEvent(QKeyEvent* e) { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * add_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - -private: - //! The window width in pixels. - int m_width = CGAL_BASIC_VIEWER_INIT_SIZE_X; - - //! The window height in pixels. - int m_height = CGAL_BASIC_VIEWER_INIT_SIZE_Y; - - //! The ratio between pixel and opengl units (in world coordinate system). - double m_pixel_ratio = 1; - - //! The polygon with holes to draw. - const Pwh& m_pwh; -}; - -// Specialization of draw function. -template -void draw(const CGAL::Polygon_with_holes_2& pwh, - const char* title = "Polygon_with_holes_2 Basic Viewer") +namespace CGAL { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite = true; -#else - bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - if (! cgal_test_suite) { - using Pwh = CGAL::Polygon_with_holes_2; - using Viewer = Pwh_2_basic_viewer_qt; - CGAL::Qt::init_ogl_context(4,3); - int argc = 1; - const char* argv[2] = {"t2_viewer", nullptr}; - QApplication app(argc, const_cast(argv)); - Viewer mainwindow(app.activeWindow(), pwh, title); - mainwindow.add_elements(); - mainwindow.show(); - app.exec(); +namespace draw_function_for_ph2_with_holes { + +template +void compute_one_loop_elements(const P2& ap2, + const typename P2::General_polygon_2& aloop, + Graphics_scene &graphics_scene, + bool hole, + const GSOptions& gs_options) +{ + if (hole && gs_options.are_faces_enabled()) + { graphics_scene.add_point_in_face(aloop.vertex(aloop.size()-1)); } + + typename P2::General_polygon_2::Vertex_const_iterator prev; + for(typename P2::General_polygon_2::Vertex_const_iterator i=aloop.vertices_begin(); + i!=aloop.vertices_end(); ++i) + { + if(gs_options.are_vertices_enabled() && + gs_options.draw_vertex(ap2, i)) + { // Add vertex + if(gs_options.colored_vertex(ap2, i)) + { graphics_scene.add_point(*i, gs_options.vertex_color(ap2, i)); } + else + { graphics_scene.add_point(*i); } + } + + if(i!=aloop.vertices_begin() && + gs_options.are_edges_enabled() && gs_options.draw_edge(ap2, prev)) + { // Add segment with previous point + if(gs_options.colored_edge(ap2, prev)) + { graphics_scene.add_segment(*prev, *i, gs_options.edge_color(ap2, prev)); } + else + { graphics_scene.add_segment(*prev, *i); } + } + + if(gs_options.are_faces_enabled()) + { graphics_scene.add_point_in_face(*i); } // Add point in face + + prev=i; + } + + // Add the last segment between the last point and the first one + if(gs_options.are_edges_enabled() && + gs_options.draw_edge(ap2, aloop.vertices_begin())) + { + if(gs_options.colored_edge(ap2, prev)) + { graphics_scene.add_segment(*prev, *(aloop.vertices_begin()), + gs_options.edge_color(ap2, prev)); } + else + { graphics_scene.add_segment(*prev, *(aloop.vertices_begin())); } } } -} // End namespace CGAL +template +void compute_elements(const P2& p2, Graphics_scene &graphics_scene, + const GSOptions& gs_options) +{ + if (p2.outer_boundary().is_empty()) return; + + if (gs_options.are_faces_enabled()) + { + if(gs_options.colored_face(p2, nullptr)) + { graphics_scene.face_begin(gs_options.face_color(p2, nullptr)); } + else + { graphics_scene.face_begin(); } + } + + compute_one_loop_elements(p2, p2.outer_boundary(), graphics_scene, + false, gs_options); + + for (typename P2::Hole_const_iterator it=p2.holes_begin(); it!=p2.holes_end(); ++it) + { + compute_one_loop_elements(p2, *it, graphics_scene, + true, gs_options); + if (gs_options.are_faces_enabled()) + { graphics_scene.add_point_in_face(p2.outer_boundary().vertex + (p2.outer_boundary().size()-1)); + } + } + + if (gs_options.are_faces_enabled()) + { graphics_scene.face_end(); } +} + +} // draw_function_for_ph2 + +#define CGAL_P2_WITH_HOLES_TYPE CGAL::Polygon_with_holes_2 + +template +void add_to_graphics_scene(const CGAL_P2_WITH_HOLES_TYPE& p2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions &gs_options) +{ + draw_function_for_ph2_with_holes::compute_elements(p2, graphics_scene, + gs_options); +} + +template +void add_to_graphics_scene(const CGAL_P2_WITH_HOLES_TYPE& p2, + CGAL::Graphics_scene& graphics_scene) +{ + Graphics_scene_options gs_options; + + add_to_graphics_scene(p2, graphics_scene, gs_options); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function. +template +void draw(const CGAL_P2_WITH_HOLES_TYPE& ap2, const GSOptions &gs_options, + const char* title="Polygon with Holes Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(ap2, buffer, gs_options); + draw_graphics_scene(buffer, title); +} + +template +void draw(const CGAL_P2_WITH_HOLES_TYPE& ap2, + const char* title="Polygon with Holes Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(ap2, buffer); + draw_graphics_scene(buffer, title); +} #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_P2_WITH_HOLES_TYPE + +} // End namespace CGAL + #endif // CGAL_DRAW_POLYGON_WITH_HOLES_2_H diff --git a/Polygon/package_info/Polygon/dependencies b/Polygon/package_info/Polygon/dependencies index 3312eb37e46..8533556ba08 100644 --- a/Polygon/package_info/Polygon/dependencies +++ b/Polygon/package_info/Polygon/dependencies @@ -1,10 +1,29 @@ Algebraic_foundations +Arithmetic_kernel +BGL +Basic_viewer +Cartesian_kernel Circulator -GraphicsView +Distance_2 +Distance_3 +Filtered_kernel +Hash_map +Homogeneous_kernel Installation +Intersections_2 +Intersections_3 +Interval_support Kernel_23 +Kernel_d +Modular_arithmetic Number_types Polygon Profiling_tools +Property_map +Random_numbers STL_Extension +Spatial_sorting Stream_support +TDS_2 +Triangulation_2 +CGAL_Core diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 455e1ce2be7..d66c727f73d 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -14,8 +14,8 @@ create_single_source_cgal_program("polyhedral_envelope_of_triangle_soup.cpp" ) create_single_source_cgal_program("polyhedral_envelope_mesh_containment.cpp" ) create_single_source_cgal_program("self_intersections_example.cpp" ) create_single_source_cgal_program("stitch_borders_example.cpp" ) -create_single_source_cgal_program("compute_normals_example_Polyhedron.cpp" CXX_FEATURES cxx_range_for ) -create_single_source_cgal_program("compute_normals_example.cpp" CXX_FEATURES cxx_range_for cxx_auto_type ) +create_single_source_cgal_program("compute_normals_example_Polyhedron.cpp") +create_single_source_cgal_program("compute_normals_example.cpp") create_single_source_cgal_program("point_inside_example.cpp") create_single_source_cgal_program("triangulate_faces_example.cpp") create_single_source_cgal_program("triangulate_faces_split_visitor_example.cpp") diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h index e8901ebd727..f2a522db1e1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Non_manifold_feature_map.h @@ -75,6 +75,7 @@ struct Non_manifold_feature_map halfedge_descriptor hd = halfedge(ed, pm); // an edge can be non-manifold only if both its vertices are non-manifold + // THIS IS NOT TRUE! if ( get(v_nm_id, source(hd, pm))==std::size_t(-1) || get(v_nm_id, target(hd, pm))==std::size_t(-1) ) continue; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h index e51999b9c54..0166c85e58f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/angle_and_area_smoothing.h @@ -134,7 +134,6 @@ void angle_and_area_smoothing(const FaceRange& faces, TriangleMesh& tmesh, const NamedParameters& np = parameters::default_values()) { - typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; @@ -209,14 +208,7 @@ void angle_and_area_smoothing(const FaceRange& faces, const bool use_Delaunay_flips = choose_parameter(get_parameter(np, internal_np::use_Delaunay_flips), true); VCMap vcmap = choose_parameter(get_parameter(np, internal_np::vertex_is_constrained), - get(Vertex_property_tag(), tmesh)); - - // If it's the default vcmap, manually set everything to false because the dynamic pmap has no default initialization - if((std::is_same::value)) - { - for(vertex_descriptor v : vertices(tmesh)) - put(vcmap, v, false); - } + get(Vertex_property_tag(), tmesh, false)); ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), Static_boolean_property_map()); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h index 96e61d7bb67..dd19ef4c685 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/bbox.h @@ -15,14 +15,16 @@ #include - #include -#include +#include +#include #include #include +#include + namespace CGAL { namespace Polygon_mesh_processing { @@ -54,6 +56,14 @@ namespace CGAL { * `Construct_bbox_3` must provide the functor `Bbox_3 operator()(Point_3)` * where `%Point_3` is the value type of the vertex point map.} * \cgalParamNEnd + * + * \cgalParamNBegin{bbox_scaling} + * \cgalParamDescription{a double used to scale the bounding box. + * The default value is 1 and the bounding box is the smallest possible + * axis-aligned bounding box.} + * \cgalParamDefault{1.} + * \cgalParamPrecondition{`bbox_scaling > 0`} + * \cgalParamNEnd * \cgalNamedParamsEnd * * @see `vertex_bbox()` @@ -75,6 +85,9 @@ namespace CGAL { GT gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); typename GT::Construct_bbox_3 get_bbox = gt.construct_bbox_3_object(); + const double factor = choose_parameter(get_parameter(np, internal_np::bbox_scaling), 1.); + CGAL_precondition(factor > 0); + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; CGAL::Bbox_3 bb; @@ -82,6 +95,8 @@ namespace CGAL { { bb += get_bbox( get(vpm, v) ); } + bb.scale(factor); + return bb; } @@ -255,6 +270,66 @@ namespace CGAL { } return bb; } + + /*! + * \ingroup PkgPolygonMeshProcessingRef + * + * adds an axis-aligned bounding box to a polygon mesh. + * + * @tparam PolygonMesh a model of `MutableFaceGraph` + * @tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * @param pmesh a polygon mesh + * @param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{bbox_scaling} + * \cgalParamDescription{a double used to scale the bounding box. + * The default value is 1 and the bounding box is the smallest possible + * axis-aligned bounding box.} + * \cgalParamDefault{1.} + * \cgalParamPrecondition{`bbox_scaling > 0`} + * \cgalParamNEnd + * \cgalParamNBegin{do_not_triangulate_faces} + * \cgalParamDescription{a Boolean used to specify whether the bounding box's faces + * should be triangulated or not. + * The default value is `true`, and faces are not triangulated.} + * \cgalParamDefault{true} + * \cgalParamNEnd + * \cgalParamNBegin{vertex_point_map} + * \cgalParamDescription{a property map associating points to the vertices of `pmesh`} + * \cgalParamType{a class model of `ReadWritePropertyMap` with `boost::graph_traits::%vertex_descriptor` + * as key type and `%Point_3` as value type} + * \cgalParamDefault{`boost::get(CGAL::vertex_point, pmesh)`} + * \cgalParamExtra{If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` + * must be available in `PolygonMesh`.} + * \cgalParamNEnd + * \cgalParamNBegin{geom_traits} + * \cgalParamDescription{an instance of a geometric traits class model of `Kernel`.} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * @see `bbox()` + */ + template + void add_bbox(PolygonMesh& pmesh, + const NamedParameters& np = parameters::default_values()) + { + using parameters::choose_parameter; + using parameters::get_parameter; + + using GT = typename GetGeomTraits::type; + using P = typename GT::Point_3; + GT gt = choose_parameter(get_parameter(np, internal_np::geom_traits)); + typename GT::Construct_iso_cuboid_3 + iso_cuboid = gt.construct_iso_cuboid_3_object(); + + const CGAL::Bbox_3 bb = bbox(pmesh, np); + CGAL::make_hexahedron(iso_cuboid(P(bb.xmin(), bb.ymin(), bb.zmin()), + P(bb.xmax(), bb.ymax(), bb.zmax())), + pmesh, np); + } } } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h index f37105cd6e6..9cf0e4b43a5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h @@ -566,7 +566,7 @@ generic_clip_impl( * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm` and `clipper` will be + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm` and `clipper` will be * checked for self-intersections and `Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} * \cgalParamType{Boolean} @@ -668,7 +668,7 @@ clip(TriangleMesh& tm, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm` + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm` * and `plane` will be checked for self-intersections * and `CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} @@ -778,7 +778,7 @@ bool clip(TriangleMesh& tm, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm` + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm` * and `iso_cuboid` will be checked for self-intersections * and `CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} @@ -980,7 +980,7 @@ void split(TriangleMesh& tm, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm` + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm` * and `plane` will be checked for self-intersections * and `CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} @@ -1069,7 +1069,7 @@ void split(TriangleMesh& tm, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm` + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm` * and `iso_cuboid` will be checked for self-intersections * and `CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index 8cad7f7227c..c955aa8bdc3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -138,7 +138,7 @@ enum Boolean_operation_type {UNION = 0, INTERSECTION=1, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm1` and `tm2` will be + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm1` and `tm2` will be * checked for self-intersections and `Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} * \cgalParamType{Boolean} @@ -477,7 +477,7 @@ corefine_and_compute_boolean_operations( * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true` the set of triangles closed to the intersection of `tm1` and `tm2` will be + * \cgalParamDescription{If `true` the set of triangles close to the intersection of `tm1` and `tm2` will be * checked for self-intersections and `Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} * \cgalParamType{Boolean} @@ -644,7 +644,7 @@ corefine_and_compute_difference( TriangleMesh& tm1, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true` the set of triangles closed to the intersection of `tm1` and `tm2` will be + * \cgalParamDescription{If `true` the set of triangles close to the intersection of `tm1` and `tm2` will be * checked for self-intersections and `Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} * \cgalParamType{Boolean} diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h index e15ae718823..54b15c7777a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h @@ -154,11 +154,8 @@ public: typedef typename boost::property_map::type Marked_edges_map; - Marked_edges_map marks = get(Edge_property_tag(), mesh_); + Marked_edges_map marks = get(Edge_property_tag(), mesh_, false); - // dynamic pmaps do not have default values... - for(edge_descriptor e : edges(mesh_)) - put(marks, e, false); for(edge_descriptor e : edge_range) put(marks, e, true); #ifdef CGAL_PMP_SMOOTHING_DEBUG diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h index b7c0d086c5c..6dd55b9fc62 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Snapping/snap.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -104,9 +105,7 @@ void simplify_range(HalfedgeRange& halfedge_range, typedef CGAL::dynamic_halfedge_property_t Halfedge_bool_tag; typedef typename boost::property_map::type Range_halfedges; - Range_halfedges range_halfedges = get(Halfedge_bool_tag(), tm); - for(halfedge_descriptor h : halfedge_range) - put(range_halfedges, h, true); + Range_halfedges range_halfedges = get(Halfedge_bool_tag(), tm, false); CGAL_postcondition_code(const std::size_t initial_n = halfedge_range.size();) @@ -1233,10 +1232,10 @@ std::size_t snap_non_conformal(HalfedgeRange& halfedge_range_A, // We keep in memory pairs of source/target edges that are stitchable after vertex-vertex snapping // --> these halfedges should not be considered as targets in non-conformal snapping // Similarly, matching vertices whose incident edges have matching directions are also locked - Locked_vertices locked_vertices_A = get(Vertex_bool_tag(), tm_A); - Locked_vertices locked_vertices_B = get(Vertex_bool_tag(), tm_B); - Locked_halfedges locked_halfedges_A = get(Halfedge_bool_tag(), tm_A); - Locked_halfedges locked_halfedges_B = get(Halfedge_bool_tag(), tm_B); + Locked_vertices locked_vertices_A = get(Vertex_bool_tag(), tm_A, false); + Locked_vertices locked_vertices_B = get(Vertex_bool_tag(), tm_B, false); + Locked_halfedges locked_halfedges_A = get(Halfedge_bool_tag(), tm_A, false); + Locked_halfedges locked_halfedges_B = get(Halfedge_bool_tag(), tm_B, false); std::vector > locked_vertices; std::vector locked_halfedges_A_vector, locked_halfedges_B_vector; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h index a996edae648..650268e1c40 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/intersection.h @@ -1711,7 +1711,7 @@ OutputIterator intersecting_meshes(const TriangleMeshRange& range, * \cgalParamNEnd * * \cgalParamNBegin{throw_on_self_intersection} - * \cgalParamDescription{If `true`, the set of triangles closed to the intersection of `tm1` and `tm2` will be + * \cgalParamDescription{If `true`, the set of triangles close to the intersection of `tm1` and `tm2` will be * checked for self-intersections and `Corefinement::Self_intersection_exception` * will be thrown if at least one self-intersection is found.} * \cgalParamType{Boolean} diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h index de45ca3150e..46ac4ed6cb6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/manifoldness.h @@ -58,9 +58,7 @@ bool is_non_manifold_vertex(typename boost::graph_traits::vertex_de typedef typename boost::property_map::const_type Visited_halfedge_map; // Dynamic pmaps do not have default initialization values (yet) - Visited_halfedge_map visited_halfedges = get(Halfedge_property_tag(), pm); - for(halfedge_descriptor h : halfedges(pm)) - put(visited_halfedges, h, false); + Visited_halfedge_map visited_halfedges = get(Halfedge_property_tag(), pm, false); std::size_t incident_null_faces_counter = 0; for(halfedge_descriptor h : halfedges_around_target(v, pm)) @@ -324,20 +322,11 @@ OutputIterator non_manifold_vertices(const PolygonMesh& pm, typedef CGAL::dynamic_halfedge_property_t Halfedge_property_tag; typedef typename boost::property_map::const_type Visited_halfedge_map; - Known_manifold_vertex_map known_nm_vertices = get(Vertex_bool_tag(), pm); - Visited_vertex_map visited_vertices = get(Vertex_halfedge_tag(), pm); - Visited_halfedge_map visited_halfedges = get(Halfedge_property_tag(), pm); - halfedge_descriptor null_h = boost::graph_traits::null_halfedge(); - // Dynamic pmaps do not have default initialization values (yet) - for(vertex_descriptor v : vertices(pm)) - { - put(known_nm_vertices, v, false); - put(visited_vertices, v, null_h); - } - for(halfedge_descriptor h : halfedges(pm)) - put(visited_halfedges, h, false); + Known_manifold_vertex_map known_nm_vertices = get(Vertex_bool_tag(), pm, false); + Visited_vertex_map visited_vertices = get(Vertex_halfedge_tag(), pm, null_h); + Visited_halfedge_map visited_halfedges = get(Halfedge_property_tag(), pm, false); for(halfedge_descriptor h : halfedges(pm)) { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index c71a5d4c806..1dde0a5b20d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -639,7 +639,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, // Vertex property map that combines the VCM and the fact that extremities of a constrained edge should be constrained typedef CGAL::dynamic_vertex_property_t Vertex_property_tag; typedef typename boost::property_map::type DVCM; - DVCM vcm = get(Vertex_property_tag(), tmesh); + DVCM vcm = get(Vertex_property_tag(), tmesh, false); // parameters const double cap_threshold = diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h index e30f95fd289..343007a83b2 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/stitch_borders.h @@ -190,7 +190,7 @@ struct Boundary_cycle_rep_maintainer Boundary_cycle_rep_maintainer(PolygonMesh& pmesh) : m_pmesh(pmesh) { - m_candidate_halfedges = get(Candidate_tag(), pmesh); + m_candidate_halfedges = get(Candidate_tag(), pmesh, false); } public: diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp index bff0cb6d083..f308a4ce35a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_transform.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_transform.cpp index 695d4862623..c45de576ffb 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_transform.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_transform.cpp @@ -1,7 +1,7 @@ #include +#include #include -#include #include diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp index d5d2fa63b9d..540aeb84639 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include diff --git a/Polygonal_surface_reconstruction/package_info/Polygonal_surface_reconstruction/dependencies b/Polygonal_surface_reconstruction/package_info/Polygonal_surface_reconstruction/dependencies index dfaa76af3a5..0c061fc6375 100644 --- a/Polygonal_surface_reconstruction/package_info/Polygonal_surface_reconstruction/dependencies +++ b/Polygonal_surface_reconstruction/package_info/Polygonal_surface_reconstruction/dependencies @@ -28,7 +28,6 @@ Principal_component_analysis Principal_component_analysis_LGPL Profiling_tools Property_map -Random_numbers STL_Extension Solver_interface Spatial_searching diff --git a/Polyhedron/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in b/Polyhedron/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in deleted file mode 100644 index d8e41b04f9c..00000000000 --- a/Polyhedron/demo/Polyhedron/CGAL_polyhedron_demoConfig.cmake.in +++ /dev/null @@ -1,7 +0,0 @@ -set(CGAL_POLYHEDRON_DEMO_CMAKE_MODULE_PATH "@CMAKE_CURRENT_SOURCE_DIR@;@CMAKE_CURRENT_BINARY_DIR@") -set(CGAL_POLYHEDRON_DEMO_DEFINITIONS "@CGAL_POLYHEDRON_DEMO_DEFINITIONS@") -set(CGAL_POLYHEDRON_DEMO_HEADERS_DIRS "@CMAKE_CURRENT_SOURCE_DIR@;@CMAKE_CURRENT_SOURCE_DIR@/include;@CMAKE_CURRENT_SOURCE_DIR@/CGAL_demo") -set(CGAL_POLYHEDRON_DEMO_DIR "@CMAKE_CURRENT_BINARY_DIR@") -set(CGAL_POLYHEDRON_DEMO_PLUGINS_DIR "@CGAL_POLYHEDRON_DEMO_PLUGINS_DIR@") -set(CGAL_POLYHEDRON_DEMO_USE_FILE "@CMAKE_CURRENT_SOURCE_DIR@/UseCGAL_polyhedron_demo.cmake") -set(CGAL_polyhedron_demoFOUND TRUE) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt deleted file mode 100644 index 338b6cfb52b..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_decomposition/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -include(polyhedron_demo_macros) - -polyhedron_demo_plugin(nef_plugin Nef_plugin) -target_link_libraries(nef_plugin PUBLIC scene_nef_polyhedron_item) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt deleted file mode 100644 index ff1ff484cde..00000000000 --- a/Polyhedron/demo/Polyhedron/Plugins/Subdivision_methods/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -include(polyhedron_demo_macros) - -polyhedron_demo_plugin(subdivision_methods_plugin Subdivision_methods_plugin) -target_link_libraries(subdivision_methods_plugin PUBLIC scene_surface_mesh_item) diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_config.h b/Polyhedron/demo/Polyhedron/Polyhedron_demo_config.h deleted file mode 100644 index 08a7d4eaf43..00000000000 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_config.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POLYHEDRON_DEMO_CONFIG_H -#define POLYHEDRON_DEMO_CONFIG_H - -#ifdef polyhedron_demo_EXPORTS -# define POLYHEDRON_DEMO_EXPORT Q_DECL_EXPORT -#else -# define POLYHEDRON_DEMO_EXPORT Q_DECL_IMPORT -#endif - -#endif // POLYHEDRON_DEMO_CONFIG_H diff --git a/Polyhedron/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake b/Polyhedron/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake deleted file mode 100644 index db009e36f33..00000000000 --- a/Polyhedron/demo/Polyhedron/UseCGAL_polyhedron_demo.cmake +++ /dev/null @@ -1,12 +0,0 @@ -message(STATUS "Using CGAL_polyhedron_demo from: ${CGAL_POLYHEDRON_DEMO_DIR}") - -list(INSERT CMAKE_MODULE_PATH 0 "${CGAL_POLYHEDRON_DEMO_CMAKE_MODULE_PATH}") - -message(STATUS "Now CMAKE_MODULE_PATH is: ${CMAKE_MODULE_PATH}") - -include( polyhedron_demo_macros ) -include( polyhedron_demo_targets ) - - -include_directories( ${CGAL_POLYHEDRON_DEMO_HEADERS_DIRS} ) -add_definitions(${CGAL_POLYHEDRON_DEMO_DEFINITIONS}) diff --git a/Polyhedron/demo/Polyhedron/config.h b/Polyhedron/demo/Polyhedron/config.h deleted file mode 100644 index c36e7e5e1ae..00000000000 --- a/Polyhedron/demo/Polyhedron/config.h +++ /dev/null @@ -1,25 +0,0 @@ -// #define CGAL_POLYHEDRON_DEMO_NO_NEF -// #define CGAL_POLYHEDRON_DEMO_NO_SURFACE_MESHER -// #define CGAL_POLYHEDRON_DEMO_NO_PARAMETRIZATION - -#ifndef CGAL_POLYHEDRON_DEMO_CONFIG_H -#define CGAL_POLYHEDRON_DEMO_CONFIG_H - -#ifdef CGAL_USE_SSH -//to avoid clashing between windows.h and winsock2.h -#define _WINSOCKAPI_ -#endif - -#ifndef CGAL_POLYHEDRON_DEMO_NO_PARAMETRIZATION -# define CGAL_POLYHEDRON_DEMO_USE_PARAMETRIZATION -#endif - -#ifndef CGAL_POLYHEDRON_DEMO_NO_NEF -# define CGAL_POLYHEDRON_DEMO_USE_NEF -#endif - -#ifndef CGAL_POLYHEDRON_DEMO_NO_SURFACE_MESHER -# define CGAL_POLYHEDRON_DEMO_USE_SURFACE_MESHER -#endif - -#endif // CGAL_POLYHEDRON_DEMO_CONFIG_H diff --git a/Polyhedron/doc/Polyhedron/CGAL/draw_polyhedron.h b/Polyhedron/doc/Polyhedron/CGAL/draw_polyhedron.h index 9ed56fe232c..6d30faa6562 100644 --- a/Polyhedron/doc/Polyhedron/CGAL/draw_polyhedron.h +++ b/Polyhedron/doc/Polyhedron/CGAL/draw_polyhedron.h @@ -3,14 +3,73 @@ namespace CGAL { /*! \ingroup PkgDrawPolyhedron -opens a new window and draws `apoly`, an instance of the `CGAL::Polyhedron_3` class. A call to this function is blocking, that is the program continues as soon as the user closes the window. 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 POLY an instance of the `CGAL::Polyhedron_3` class. -\param apoly the polyhedron to draw. +opens a new window and draws a polyhedron. 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 P which must be an instanciation of a `CGAL::Polyhedron_3<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param p the polyhedron to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Polyhedron_3& p, const GSOptions& gso); + +\cgalAdvancedEnd */ -template -void draw(const POLY& apoly); +template +void draw(const P& p, const GSOptions& gso); + +/*! +\ingroup PkgDrawPolyhedron + +A shortcut to `CGAL::draw(p, Graphics_scene_options{})`. +*/ + template + void draw(const P& p); + +/*! +\ingroup PkgDrawPolyhedron + +adds the vertices, edges and faces of `p` 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 P which must be an instanciation of a `CGAL::Polyhedron_3<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param p the polyhedron 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::Polyhedron_3& p, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const P& p, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawPolyhedron + +A shortcut to `CGAL::add_to_graphics_scene(p, gs, Graphics_scene_options{})`. +*/ +template +void add_to_graphics_scene(const P& p, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Polyhedron/include/CGAL/draw_polyhedron.h b/Polyhedron/include/CGAL/draw_polyhedron.h index 0866e27ebc0..c45ea4e0dd4 100644 --- a/Polyhedron/include/CGAL/draw_polyhedron.h +++ b/Polyhedron/include/CGAL/draw_polyhedron.h @@ -8,58 +8,79 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_POLYHEDRON_H #define CGAL_DRAW_POLYHEDRON_H #include -#include - -#ifdef CGAL_USE_BASIC_VIEWER -#include +#include +#include #include #include -#include +#include namespace CGAL { -// Specialization of draw function. #define CGAL_POLY_TYPE CGAL::Polyhedron_3 \ +// Specialization of add_to_graphics_scene function. +template + class T_HDS, + class Alloc, + class GSOptions> +void add_to_graphics_scene(const CGAL_POLY_TYPE& apoly, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gs_options) +{ add_to_graphics_scene_for_fg(apoly, graphics_scene, gs_options); } + +template + class T_HDS, + class Alloc> +void add_to_graphics_scene(const CGAL_POLY_TYPE& apoly, + CGAL::Graphics_scene &graphics_scene) +{ add_to_graphics_scene_for_fg(apoly, graphics_scene); } + +// Specialization of draw function: require Qt and the CGAL basic viewer. +#ifdef CGAL_USE_BASIC_VIEWER + template class T_HDS, class Alloc> void draw(const CGAL_POLY_TYPE& apoly, - const char* title="Polyhedron Basic Viewer", - bool nofill=false) + const char* title="Polyhedron Basic Viewer") { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"polyhedron_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimpleFaceGraphViewerQt - mainwindow(app.activeWindow(), apoly, title, nofill); - mainwindow.show(); - app.exec(); - } + CGAL::Graphics_scene buffer; + add_to_graphics_scene_for_fg(apoly, buffer); + draw_graphics_scene(buffer, title); } +template + class T_HDS, + class Alloc, + class GSOptions> +void draw(const CGAL_POLY_TYPE& apoly, + const GSOptions &gs_options, + const char* title="Polyhedron Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene_for_fg(apoly, buffer, gs_options); + draw_graphics_scene(buffer, title); +} +#endif // CGAL_USE_BASIC_VIEWER + #undef CGAL_POLY_TYPE } // End namespace CGAL -#endif // CGAL_USE_BASIC_VIEWER - #endif // CGAL_DRAW_POLYHEDRON_H diff --git a/Polyhedron/package_info/Polyhedron/dependencies b/Polyhedron/package_info/Polyhedron/dependencies index 53bd7918c4d..7ab360cb471 100644 --- a/Polyhedron/package_info/Polyhedron/dependencies +++ b/Polyhedron/package_info/Polyhedron/dependencies @@ -1,10 +1,12 @@ Algebraic_foundations +Arithmetic_kernel BGL +Basic_viewer Cartesian_kernel Circulator Distance_2 Distance_3 -GraphicsView +Filtered_kernel HalfedgeDS Hash_map Homogeneous_kernel @@ -13,12 +15,18 @@ Intersections_2 Intersections_3 Interval_support Kernel_23 +Kernel_d Modifier Modular_arithmetic Number_types +Polygon Polyhedron Profiling_tools Property_map Random_numbers STL_Extension +Spatial_sorting Stream_support +TDS_2 +Triangulation_2 +CGAL_Core diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h index fd4648fa01d..5c8b0e6e207 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/Stop_above_cost_threshold.h @@ -36,7 +36,7 @@ public : /// Initializes it with the given threshold value. Stop_above_cost_threshold( double threshold ) : mThres(threshold) {} - /// Returns `true` when `cost` is smaller or equal than the threshold. + /// Returns `true` when `cost` is greater or equal than the threshold. /// \tparam CDT must be `CGAL::Constrained_Delaunay_triangulation_2` with a vertex type that /// is model of `PolylineSimplificationVertexBase_2`. @@ -61,4 +61,3 @@ private: } //namespace CGAL #endif // CGAL_POLYLINE_SIMPLIFICATION_2_STOP_ABOVE_COST_THRESHOLD_H - diff --git a/Property_map/examples/Property_map/dynamic_properties.cpp b/Property_map/examples/Property_map/dynamic_properties.cpp index 6edbd4cfb9a..3a3f0ee9f54 100644 --- a/Property_map/examples/Property_map/dynamic_properties.cpp +++ b/Property_map/examples/Property_map/dynamic_properties.cpp @@ -1,6 +1,7 @@ #include #include +#include #include @@ -14,16 +15,24 @@ int main() CGAL::make_triangle(Point_3(0,0,0),Point_3(1,0,0),Point_3(1,1,0), mesh); typedef boost::property_map >::type VertexNameMap; - VertexNameMap vnm = get(CGAL::dynamic_vertex_property_t(), mesh); + VertexNameMap vnm = get(CGAL::dynamic_vertex_property_t(), mesh, std::string("default")); put(vnm, *(vertices(mesh).first), "Paris"); + assert(get(vnm, *(vertices(mesh).first))=="Paris"); + assert(get(vnm, *(std::next(vertices(mesh).first)))=="default"); + std::cout << get(vnm, *(vertices(mesh).first)) << std::endl; + std::cout << get(vnm, *(std::next(vertices(mesh).first))) << std::endl; typedef boost::property_map >::type TrafficDensityMap; - TrafficDensityMap tdm = get(CGAL::dynamic_halfedge_property_t(), mesh); + TrafficDensityMap tdm = get(CGAL::dynamic_halfedge_property_t(), mesh, -1.); put(tdm, *(halfedges(mesh).first), 0.7); + assert(get(tdm, *(halfedges(mesh).first))==0.7); + assert(get(tdm, *(std::next(halfedges(mesh).first)))==-1.); + std::cout << get(tdm, *(halfedges(mesh).first)) << std::endl; + std::cout << get(tdm, *(std::next(halfedges(mesh).first))) << std::endl; return 0; } diff --git a/Property_map/include/CGAL/Dynamic_property_map.h b/Property_map/include/CGAL/Dynamic_property_map.h index bca414e19b0..949eed33382 100644 --- a/Property_map/include/CGAL/Dynamic_property_map.h +++ b/Property_map/include/CGAL/Dynamic_property_map.h @@ -135,8 +135,8 @@ struct Dynamic_with_index : m_values() {} - Dynamic_with_index(std::size_t num_features) - : m_values( new std::vector(num_features) ) + Dynamic_with_index(std::size_t num_features, Value default_value = Value()) + : m_values( new std::vector(num_features, default_value) ) {} friend reference get(const Dynamic_with_index& m, const key_type& k) @@ -228,34 +228,34 @@ namespace CGAL { template typename boost::property_map >::const_type -get(const CGAL::dynamic_vertex_property_t&, const G&) +get(const CGAL::dynamic_vertex_property_t&, const G&, const T& default_value = T()) { typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - return internal::Dynamic_property_map(); + return internal::Dynamic_property_map(default_value); } template typename boost::property_map >::const_type -get(const CGAL::dynamic_halfedge_property_t&, const G&) +get(const CGAL::dynamic_halfedge_property_t&, const G&, const T& default_value = T()) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - return internal::Dynamic_property_map(); + return internal::Dynamic_property_map(default_value); } template typename boost::property_map >::const_type -get(const CGAL::dynamic_edge_property_t&, const G&) +get(const CGAL::dynamic_edge_property_t&, const G&, const T& default_value = T()) { typedef typename boost::graph_traits::edge_descriptor edge_descriptor; - return internal::Dynamic_property_map(); + return internal::Dynamic_property_map(default_value); } template typename boost::property_map >::const_type -get(const CGAL::dynamic_face_property_t&, const G&) +get(const CGAL::dynamic_face_property_t&, const G&, const T& default_value = T()) { typedef typename boost::graph_traits::face_descriptor face_descriptor; - return internal::Dynamic_property_map(); + return internal::Dynamic_property_map(default_value); } template diff --git a/Property_map/test/Property_map/dynamic_properties_test.cpp b/Property_map/test/Property_map/dynamic_properties_test.cpp index 41a4ea8abce..07fd4751c4c 100644 --- a/Property_map/test/Property_map/dynamic_properties_test.cpp +++ b/Property_map/test/Property_map/dynamic_properties_test.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #if defined(CGAL_USE_OPENMESH) #include diff --git a/Property_map/test/Property_map/kernel_converter_properties_test.cpp b/Property_map/test/Property_map/kernel_converter_properties_test.cpp index ebe871bc3e3..05cf177b325 100644 --- a/Property_map/test/Property_map/kernel_converter_properties_test.cpp +++ b/Property_map/test/Property_map/kernel_converter_properties_test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include diff --git a/Ridges_3/package_info/Ridges_3/dependencies b/Ridges_3/package_info/Ridges_3/dependencies index 3d5486b85be..f4b40909932 100644 --- a/Ridges_3/package_info/Ridges_3/dependencies +++ b/Ridges_3/package_info/Ridges_3/dependencies @@ -9,7 +9,6 @@ Number_types Principal_component_analysis_LGPL Profiling_tools Property_map -Random_numbers Ridges_3 STL_Extension Stream_support diff --git a/SMDS_3/package_info/SMDS_3/dependencies b/SMDS_3/package_info/SMDS_3/dependencies index 749f4764b55..cc7e6969e77 100644 --- a/SMDS_3/package_info/SMDS_3/dependencies +++ b/SMDS_3/package_info/SMDS_3/dependencies @@ -20,7 +20,6 @@ Number_types Polygon_mesh_processing Profiling_tools Property_map -Random_numbers SMDS_3 STL_Extension Spatial_sorting diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 1736eb65a33..b29c4043093 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -163,6 +163,7 @@ CGAL_add_named_parameter(patch_normal_map_t, patch_normal_map, patch_normal_map) CGAL_add_named_parameter(region_primitive_map_t, region_primitive_map, region_primitive_map) CGAL_add_named_parameter(postprocess_regions_t, postprocess_regions, postprocess_regions) CGAL_add_named_parameter(sizing_function_t, sizing_function, sizing_function) +CGAL_add_named_parameter(bbox_scaling_t, bbox_scaling, bbox_scaling) // List of named parameters that we use in the package 'Surface Mesh Simplification' CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost) diff --git a/Shape_detection/package_info/Shape_detection/dependencies b/Shape_detection/package_info/Shape_detection/dependencies index 23bbe655dfa..26fdaaadd2f 100644 --- a/Shape_detection/package_info/Shape_detection/dependencies +++ b/Shape_detection/package_info/Shape_detection/dependencies @@ -7,7 +7,6 @@ Circulator Distance_2 Distance_3 Filtered_kernel -Hash_map Homogeneous_kernel Installation Intersections_2 @@ -18,7 +17,6 @@ Kernel_d Modular_arithmetic Number_types Orthtree -Point_set_2 Principal_component_analysis Principal_component_analysis_LGPL Profiling_tools @@ -28,7 +26,4 @@ STL_Extension Shape_detection Solver_interface Spatial_searching -Spatial_sorting Stream_support -TDS_2 -Triangulation_2 \ No newline at end of file diff --git a/Shape_regularization/package_info/Shape_regularization/dependencies b/Shape_regularization/package_info/Shape_regularization/dependencies index b07b869d715..353a79ca562 100644 --- a/Shape_regularization/package_info/Shape_regularization/dependencies +++ b/Shape_regularization/package_info/Shape_regularization/dependencies @@ -15,7 +15,6 @@ Kernel_d Modular_arithmetic Number_types Orthtree -Point_set_2 Principal_component_analysis_LGPL Profiling_tools Property_map diff --git a/Skin_surface_3/package_info/Skin_surface_3/dependencies b/Skin_surface_3/package_info/Skin_surface_3/dependencies index e04beb03945..c65e98b4cf0 100644 --- a/Skin_surface_3/package_info/Skin_surface_3/dependencies +++ b/Skin_surface_3/package_info/Skin_surface_3/dependencies @@ -22,7 +22,6 @@ Number_types Polyhedron Profiling_tools Property_map -Random_numbers STL_Extension Skin_surface_3 Spatial_sorting diff --git a/Straight_skeleton_2/include/CGAL/draw_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/draw_straight_skeleton_2.h index 3238ea1e0b1..8ff502ba5e3 100644 --- a/Straight_skeleton_2/include/CGAL/draw_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/draw_straight_skeleton_2.h @@ -8,176 +8,202 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_SS2_H #define CGAL_DRAW_SS2_H #include -#include - -#ifdef CGAL_USE_BASIC_VIEWER - +#include +#include +#include #include -#include - #include namespace CGAL { -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorSS2 +namespace draw_function_for_ss2 { + +template +void compute_edge(const SS2& ss2, typename SS2::Halfedge_const_handle eh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) { - template - static CGAL::IO::Color run(const SS2&, - const typename SS2::Finite_faces_iterator fh) - { - CGAL::Random random((unsigned int)(std::size_t)(&*fh)); - return get_random_color(random); - } -}; + if (!gs_options.draw_edge(ss2, eh)) + { return; } -// Viewer class for SS2 -template -class SimpleStraightSkeleton2ViewerQt : public Basic_viewer_qt + if (gs_options.colored_edge(ss2, eh)) + { + graphics_scene.add_segment(eh->opposite()->vertex()->point(), + eh->vertex()->point(), + gs_options.edge_color(ss2, eh)); + } + else + { + graphics_scene.add_segment(eh->opposite()->vertex()->point(), + eh->vertex()->point()); + } +} + +template +void print_halfedge_labels(const SS2& ss2, + typename SS2::Halfedge_const_handle h, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) { - typedef Basic_viewer_qt Base; - typedef typename SS2::Vertex_const_handle Vertex_const_handle; - typedef typename SS2::Halfedge_const_handle Halfedge_const_handle; + // TODO? an option different from draw_edge to allow to show only some labels ?? + if(!gs_options.draw_edge(ss2, h)) + { return; } - // typedef typename SS2::Point Point; + std::stringstream label; + label << "H" << h->id() << " (V" << h->vertex()->id() << ") "; + label << "H" << h->opposite()->id() << " (V" << h->opposite()->vertex()->id() + << ") "; -public: - /// Construct the viewer. - /// @param ass2 the ss2 to view - /// @param title the title of the window - SimpleStraightSkeleton2ViewerQt(QWidget* parent, const SS2& ass2, - const char* title="Basic SS2 Viewer", - const ColorFunctor& fcolor=ColorFunctor()) : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, true, true, true, false, false), - ss2(ass2), - m_fcolor(fcolor) + graphics_scene.add_text( + CGAL::midpoint(h->opposite()->vertex()->point(), h->vertex()->point()), + label.str()); +} + +template +void compute_vertex(const SS2& ss2, typename SS2::Vertex_const_handle vh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (!gs_options.draw_vertex(ss2, vh)) + { return; } + + if (gs_options.colored_vertex(ss2, vh)) { - compute_elements(); + graphics_scene.add_point(vh->point(), gs_options.vertex_color(ss2, vh)); } + else + { graphics_scene.add_point(vh->point()); } +} -protected: - /* - void compute_face(Facet_const_handle fh) - { - CGAL::IO::Color c=m_fcolor.run(ss2, fh); - face_begin(c); - - add_point_in_face(fh->vertex(0)->point()); - add_point_in_face(fh->vertex(1)->point()); - add_point_in_face(fh->vertex(2)->point()); - - face_end(); - } - */ - void compute_edge(Halfedge_const_handle eh) - { - if(eh->is_bisector()) - add_segment(eh->opposite()->vertex()->point(), eh->vertex()->point(), CGAL::IO::red()); - else - add_segment(eh->opposite()->vertex()->point(), eh->vertex()->point(), CGAL::IO::black()); - } - void print_halfedge_labels(Halfedge_const_handle h) - { - std::stringstream label; - label << "H" << h->id() << " (V" << h->vertex()->id() << ") "; - label << "H" << h->opposite()->id() << " (V" << h->opposite()->vertex()->id() << ") "; - add_text(CGAL::midpoint(h->opposite()->vertex()->point(), h->vertex()->point()), label.str()); - } - - void compute_vertex(Vertex_const_handle vh) - { - if(vh->is_split()) - add_point(vh->point(), CGAL::IO::Color(10,10,180)); // blue, but not flashy - else if(vh->has_infinite_time()) - add_point(vh->point(), CGAL::IO::orange()); - else if(vh->is_contour()) - add_point(vh->point(), CGAL::IO::black()); - else - add_point(vh->point(), CGAL::IO::Color(10,180,10)); // green, but not flashy - } - void print_vertex_label(Vertex_const_handle vh) +template +void print_vertex_label(const SS2& ss2, + typename SS2::Vertex_const_handle vh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + // TODO? an option different from draw_vertex to allow to show only some labels ?? + if (gs_options.draw_vertex(ss2, vh)) { std::stringstream label; label << "V" << vh->id() << std::ends; - add_text(vh->point(), label.str()); - } - - void compute_elements() - { - clear(); - - for (typename SS2::Halfedge_const_iterator it=ss2.halfedges_begin(); it!=ss2.halfedges_end(); ++it) - { - if(it->id() < it->opposite()->id()) - { - compute_edge(it); - print_halfedge_labels(it); - } - } - for (typename SS2::Vertex_const_iterator it=ss2.vertices_begin(); it!=ss2.vertices_end(); ++it) - { - compute_vertex(it); - print_vertex_label(it); - } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - -protected: - const SS2& ss2; - const ColorFunctor& m_fcolor; -}; - -// Specialization of draw function. -#define CGAL_SS_TYPE CGAL::Straight_skeleton_2 - -template -void draw(const CGAL_SS_TYPE& ass2, - const char* title="Straight Skeleton Basic Viewer") -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - int argc=1; - const char* argv[2]={"ss2_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - DefaultColorFunctorSS2 fcolor; - SimpleStraightSkeleton2ViewerQt - mainwindow(app.activeWindow(), ass2, title, fcolor); - mainwindow.show(); - app.exec(); + graphics_scene.add_text(vh->point(), label.str()); } } +template +void compute_elements(const SS2& ss2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (gs_options.are_edges_enabled()) + { + for (typename SS2::Halfedge_const_iterator it=ss2.halfedges_begin(); + it != ss2.halfedges_end(); ++it) + { + if (it->id()opposite()->id()) + { + compute_edge(ss2, it, graphics_scene, gs_options); + print_halfedge_labels(ss2, it, graphics_scene, gs_options); + } + } + } + + if (gs_options.are_vertices_enabled()) + { + for (typename SS2::Vertex_const_iterator it=ss2.vertices_begin(); + it!=ss2.vertices_end(); ++it) + { + compute_vertex(ss2, it, graphics_scene, gs_options); + print_vertex_label(ss2, it, graphics_scene, gs_options); + } + } +} + +} // namespace draw_function_for_ss2 + +#define CGAL_SS_TYPE CGAL::Straight_skeleton_2 + +template +void add_to_graphics_scene(const CGAL_SS_TYPE &ass2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + draw_function_for_ss2::compute_elements(ass2, graphics_scene, + gs_options); +} + +template +void add_to_graphics_scene(const CGAL_SS_TYPE& ass2, + CGAL::Graphics_scene& graphics_scene) +{ + Graphics_scene_options + drawingFunctor; + + drawingFunctor.colored_edge = [] + (const CGAL_SS_TYPE&, typename CGAL_SS_TYPE::Halfedge_const_handle) -> bool + { return true; }; + + drawingFunctor.colored_vertex = [] + (const CGAL_SS_TYPE&, typename CGAL_SS_TYPE::Vertex_const_handle) -> bool + { return true; }; + + drawingFunctor.edge_color = [] + (const CGAL_SS_TYPE&, typename CGAL_SS_TYPE::Halfedge_const_handle eh) -> CGAL::IO::Color + { + if (eh->is_bisector()) + { return CGAL::IO::red(); } + + return CGAL::IO::black(); + }; + + drawingFunctor.vertex_color = [] + (const CGAL_SS_TYPE&, typename CGAL_SS_TYPE::Vertex_const_handle vh) -> CGAL::IO::Color + { + if (vh->is_split()) + { return CGAL::IO::Color(10, 10, 180); } // blue, but not flashy + else if (vh->has_infinite_time()) + { return CGAL::IO::orange(); } + + return CGAL::IO::Color(10, 180, 10); // green, but not flashy + }; + + add_to_graphics_scene(ass2, graphics_scene, drawingFunctor); +} + +// Specialization of draw function. +#ifdef CGAL_USE_BASIC_VIEWER + +template +void draw(const CGAL_SS_TYPE &ass2, const GSOptions &gs_options, + const char *title="Straight Skeleton Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(ass2, buffer, gs_options); + draw_graphics_scene(buffer, title); +} + +template +void draw(const CGAL_SS_TYPE &ass2, + const char *title="Straight Skeleton Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(ass2, buffer); + draw_graphics_scene(buffer, title); +} + +#endif // CGAL_USE_BASIC_VIEWER + #undef CGAL_SS_TYPE } // End namespace CGAL -#endif // CGAL_USE_BASIC_VIEWER - #endif // CGAL_DRAW_SS2_H diff --git a/Straight_skeleton_2/package_info/Straight_skeleton_2/dependencies b/Straight_skeleton_2/package_info/Straight_skeleton_2/dependencies index ca2e964a173..0fb898c6ec4 100644 --- a/Straight_skeleton_2/package_info/Straight_skeleton_2/dependencies +++ b/Straight_skeleton_2/package_info/Straight_skeleton_2/dependencies @@ -1,13 +1,13 @@ Algebraic_foundations Arithmetic_kernel BGL +Basic_viewer CGAL_Core Cartesian_kernel Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView HalfedgeDS Hash_map Homogeneous_kernel @@ -22,6 +22,10 @@ Number_types Polygon Profiling_tools Property_map +Random_numbers STL_Extension +Spatial_sorting Straight_skeleton_2 Stream_support +TDS_2 +Triangulation_2 diff --git a/Straight_skeleton_extrusion_2/package_info/Straight_skeleton_extrusion_2/dependencies b/Straight_skeleton_extrusion_2/package_info/Straight_skeleton_extrusion_2/dependencies index eafd536cd0a..354e1eb0c02 100644 --- a/Straight_skeleton_extrusion_2/package_info/Straight_skeleton_extrusion_2/dependencies +++ b/Straight_skeleton_extrusion_2/package_info/Straight_skeleton_extrusion_2/dependencies @@ -22,7 +22,6 @@ Polygon Polygon_mesh_processing Profiling_tools Property_map -Random_numbers STL_Extension Spatial_sorting Straight_skeleton_2 diff --git a/Subdivision_method_3/package_info/Subdivision_method_3/dependencies b/Subdivision_method_3/package_info/Subdivision_method_3/dependencies index b42b51ec6d8..95d535dc571 100644 --- a/Subdivision_method_3/package_info/Subdivision_method_3/dependencies +++ b/Subdivision_method_3/package_info/Subdivision_method_3/dependencies @@ -9,7 +9,6 @@ Modular_arithmetic Number_types Profiling_tools Property_map -Random_numbers STL_Extension Stream_support Subdivision_method_3 diff --git a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt index 87cdd52e06c..896c0d7b275 100644 --- a/Surface_mesh/examples/Surface_mesh/CMakeLists.txt +++ b/Surface_mesh/examples/Surface_mesh/CMakeLists.txt @@ -23,7 +23,6 @@ create_single_source_cgal_program("sm_iterators.cpp") create_single_source_cgal_program("sm_kruskal.cpp") create_single_source_cgal_program("sm_memory.cpp") create_single_source_cgal_program("sm_properties.cpp") -create_single_source_cgal_program("sm_draw_small_faces.cpp") create_single_source_cgal_program("check_orientation.cpp") #create the executable of the application @@ -33,7 +32,6 @@ if(CGAL_Qt6_FOUND) #link it with the required CGAL libraries target_link_libraries(draw_surface_mesh PUBLIC CGAL::CGAL_Basic_viewer) - target_link_libraries(sm_draw_small_faces PUBLIC CGAL::CGAL_Basic_viewer) endif() #end of the file diff --git a/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp b/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp index 488282915ba..21f7bf4e51c 100644 --- a/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp +++ b/Surface_mesh/examples/Surface_mesh/draw_surface_mesh.cpp @@ -1,8 +1,6 @@ #include #include - #include - #include typedef CGAL::Simple_cartesian Kernel; @@ -16,7 +14,7 @@ int main(int argc, char* argv[]) Mesh sm; if(!CGAL::IO::read_polygon_mesh(filename, sm)) { - std::cerr << "Invalid input file." << std::endl; + std::cerr << "Invalid input file: " << filename << std::endl; return EXIT_FAILURE; } @@ -28,15 +26,15 @@ int main(int argc, char* argv[]) for(auto v : vertices(sm)) { if(v.idx()%2) - put(vcm, v, CGAL::IO::black()); + { put(vcm, v, CGAL::IO::black()); } else - put(vcm, v, CGAL::IO::blue()); + { put(vcm, v, CGAL::IO::blue()); } } for(auto e : edges(sm)) - put(ecm, e, CGAL::IO::gray()); + { put(ecm, e, CGAL::IO::gray()); } - CGAL_USE(fcm); + put(fcm, *(sm.faces().begin()), CGAL::IO::red()); // Draw! CGAL::draw(sm); diff --git a/Surface_mesh/examples/Surface_mesh/draw_surface_mesh_small_faces.h b/Surface_mesh/examples/Surface_mesh/draw_surface_mesh_small_faces.h deleted file mode 100644 index b8eeac5b008..00000000000 --- a/Surface_mesh/examples/Surface_mesh/draw_surface_mesh_small_faces.h +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) 2018 GeometryFactory (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 - -#ifndef CGAL_DRAW_SURFACE_MESH_SMALL_FACES_H -#define CGAL_DRAW_SURFACE_MESH_SMALL_FACES_H - -#include -#include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include -#include - -#include - -template -class SimpleSurfaceMeshWithSmallFacesViewerQt : public CGAL::Basic_viewer_qt -{ - typedef CGAL::Basic_viewer_qt Base; - typedef typename SM::Point Point; - typedef typename CGAL::Kernel_traits::Kernel Kernel; - typedef typename SM::Vertex_index vertex_descriptor; - typedef typename SM::Face_index face_descriptor; - typedef typename SM::Edge_index edge_descriptor; - typedef typename SM::Halfedge_index halfedge_descriptor; - typedef typename Kernel::FT FT; - -public: - /// Construct the viewer. - /// @param amesh the surface mesh to view - SimpleSurfaceMeshWithSmallFacesViewerQt(QWidget* parent, - SM& amesh) : - // First draw: no vertex; no edge, faces; multi-color; inverse normal - Base(parent, "Surface mesh viewer with small faces", false, false, true, false, false), - sm(amesh), - m_threshold(85), - m_draw_small_faces(true), - m_draw_big_faces(true) - { - // Add custom key description (see keyPressEvent). - setKeyDescription(Qt::Key_I, "Increment threshold for small faces"); - setKeyDescription(Qt::Key_D, "Decrement threshold for small faces"); - setKeyDescription(Qt::Key_S, "Draw small faces only , big faces only, both"); - - if (sm.faces().begin()!=sm.faces().end()) - { - bool exist; - typename SM::template Property_map faces_size; - boost::tie(faces_size, exist)=sm.template property_map("f:size"); - assert(exist); - - m_min_size=faces_size[*(sm.faces().begin())]; - m_max_size=m_min_size; - FT cur_size; - - for (typename SM::Face_range::iterator f=sm.faces().begin(); f!=sm.faces().end(); ++f) - { - cur_size=faces_size[*f]; - if (cur_sizem_max_size) m_max_size=cur_size; - } - } - - compute_elements(); - } - -protected: - void compute_face(face_descriptor fh) - { - // [Face creation] - bool issmall=false; - - // Default color of faces - CGAL::IO::Color c(75,160,255); - - // Compare the size of the face with the % m_threshold - bool exist; - typename SM::template Property_map faces_size; - boost::tie(faces_size, exist)=sm.template property_map("f:size"); - assert(exist); - - // It it is smaller, color the face in red. - if (get(faces_size, fh)::null_face()) - { compute_face(*f); } - } - - for (typename SM::Edge_range::iterator e=sm.edges().begin(); - e!=sm.edges().end(); ++e) - { compute_edge(*e); } - - for (typename SM::Vertex_range::iterator v=sm.vertices().begin(); - v!=sm.vertices().end(); ++v) - { compute_vertex(*v); } - } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - virtual void keyPressEvent(QKeyEvent *e) - { - /// [Keypress] - const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - if ((e->key()==Qt::Key_I) && (modifiers==Qt::NoButton)) - { - if (m_threshold<100) { ++m_threshold; } - displayMessage(QString("Threshold percent=%1%.").arg(m_threshold)); - compute_elements(); - redraw(); - } - else if ((e->key()==Qt::Key_D) && (modifiers==Qt::NoButton)) - { - if (m_threshold>0) { --m_threshold; } - displayMessage(QString("Threshold percent=%1%.").arg(m_threshold)); - compute_elements(); - redraw(); - } - else if ((e->key()==Qt::Key_S) && (modifiers==Qt::NoButton)) - { - QString msg; - if (m_draw_small_faces) - { - if (m_draw_big_faces) - { - m_draw_big_faces=false; - msg=QString("Draw small faces only."); - } - else - { - m_draw_big_faces=true; m_draw_small_faces=false; - msg=QString("Draw big faces only."); - } - } - else - { - assert(m_draw_big_faces); - m_draw_small_faces=true; - msg=QString("Draw small and big faces."); - } - - displayMessage(msg); - compute_elements(); - redraw(); - } - else - { - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - /// [Keypress] - } - -protected: - typename Kernel::Vector_3 get_face_normal(halfedge_descriptor he) - { - typename Kernel::Vector_3 normal=CGAL::NULL_VECTOR; - halfedge_descriptor end=he; - unsigned int nb=0; - do - { - CGAL::internal::newell_single_step_3(sm.point(sm.source(he)), - sm.point(sm.target(he)), normal); - ++nb; - he=sm.next(he); - } - while (he!=end); - assert(nb>0); - return (typename Kernel::Construct_scaled_vector_3()(normal, 1.0/nb)); - } - - typename Kernel::Vector_3 get_vertex_normal(halfedge_descriptor he) - { - typename Kernel::Vector_3 normal=CGAL::NULL_VECTOR; - halfedge_descriptor end=he; - do - { - if (!sm.is_border(he)) - { - typename Kernel::Vector_3 n=get_face_normal(he); - normal=typename Kernel::Construct_sum_of_vectors_3()(normal, n); - } - he=sm.next(sm.opposite(he)); - } - while (he!=end); - - if (!typename Kernel::Equal_3()(normal, CGAL::NULL_VECTOR)) - { normal=(typename Kernel::Construct_scaled_vector_3() - (normal, 1.0/CGAL::sqrt(normal.squared_length()))); } - - return normal; - } - -protected: - SM& sm; - unsigned int m_threshold; - FT m_min_size, m_max_size; - bool m_draw_small_faces; - bool m_draw_big_faces; -}; - -template -void draw_surface_mesh_with_small_faces(CGAL::Surface_mesh& amesh) -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - int argc=1; - const char* argv[2]={"surface_mesh_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimpleSurfaceMeshWithSmallFacesViewerQt> - mainwindow(app.activeWindow(), amesh); - mainwindow.show(); - app.exec(); - } -} - -#else // CGAL_USE_BASIC_VIEWER - -template -void draw_surface_mesh_with_small_faces(CGAL::Surface_mesh&) -{ - std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."< #include #include +#include typedef CGAL::Simple_cartesian K; typedef K::Point_3 Point; diff --git a/Surface_mesh/examples/Surface_mesh/sm_draw_small_faces.cpp b/Surface_mesh/examples/Surface_mesh/sm_draw_small_faces.cpp deleted file mode 100644 index 5d6c3b3d54e..00000000000 --- a/Surface_mesh/examples/Surface_mesh/sm_draw_small_faces.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "draw_surface_mesh_small_faces.h" - -typedef CGAL::Simple_cartesian K; -typedef CGAL::Surface_mesh Mesh; -typedef Mesh::Vertex_index vertex_descriptor; -typedef Mesh::Face_index face_descriptor; -typedef K::FT FT; - -int main(int argc, char* argv[]) -{ - const std::string filename = (argc>1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off"); - - Mesh sm; - if(!CGAL::IO::read_polygon_mesh(filename, sm)) - { - std::cerr << "Invalid input file." << std::endl; - return EXIT_FAILURE; - } - - CGAL::Polygon_mesh_processing::triangulate_faces(sm); - - Mesh::Property_map faces_size; - bool created; - boost::tie(faces_size, created)=sm.add_property_map("f:size",0.); - assert(created); - - for(face_descriptor fd : sm.faces()) - { faces_size[fd]=CGAL::Polygon_mesh_processing::face_area(fd, sm); } - - draw_surface_mesh_with_small_faces(sm); - - sm.remove_property_map(faces_size); - - return EXIT_SUCCESS; -} diff --git a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h index 785cec65003..fc6ea9d8b9f 100644 --- a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h +++ b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h @@ -353,67 +353,67 @@ namespace CGAL { // get functions for dynamic properties of mutable Surface_mesh template typename boost::property_map, dynamic_vertex_property_t >::type -get(dynamic_vertex_property_t, Surface_mesh& sm) +get(dynamic_vertex_property_t, Surface_mesh& sm, const T& default_value = T()) { typedef typename boost::property_map, dynamic_vertex_property_t >::SMPM SMPM; typedef typename boost::property_map, dynamic_vertex_property_t >::type DPM; - return DPM(sm, new SMPM(sm.template add_property_map::Vertex_index, T>(std::string()).first)); + return DPM(sm, new SMPM(sm.template add_property_map::Vertex_index, T>(std::string(), default_value).first)); } template typename boost::property_map, dynamic_face_property_t >::type -get(dynamic_face_property_t, Surface_mesh& sm) +get(dynamic_face_property_t, Surface_mesh& sm, const T& default_value = T()) { typedef typename boost::property_map, dynamic_face_property_t >::SMPM SMPM; typedef typename boost::property_map, dynamic_face_property_t >::type DPM; - return DPM(sm, new SMPM(sm.template add_property_map::Face_index, T>(std::string()).first)); + return DPM(sm, new SMPM(sm.template add_property_map::Face_index, T>(std::string(), default_value).first)); } template typename boost::property_map, dynamic_edge_property_t >::type -get(dynamic_edge_property_t, Surface_mesh& sm) +get(dynamic_edge_property_t, Surface_mesh& sm, const T& default_value = T()) { typedef typename boost::property_map, dynamic_edge_property_t >::SMPM SMPM; typedef typename boost::property_map, dynamic_edge_property_t >::type DPM; - return DPM(sm, new SMPM(sm.template add_property_map::Edge_index, T>(std::string()).first)); + return DPM(sm, new SMPM(sm.template add_property_map::Edge_index, T>(std::string(), default_value).first)); } template typename boost::property_map, dynamic_halfedge_property_t >::type -get(dynamic_halfedge_property_t, Surface_mesh& sm) +get(dynamic_halfedge_property_t, Surface_mesh& sm, const T& default_value = T()) { typedef typename boost::property_map, dynamic_halfedge_property_t >::SMPM SMPM; typedef typename boost::property_map, dynamic_halfedge_property_t >::type DPM; - return DPM(sm, new SMPM(sm.template add_property_map::Halfedge_index, T>(std::string()).first)); + return DPM(sm, new SMPM(sm.template add_property_map::Halfedge_index, T>(std::string(), default_value).first)); } // get functions for dynamic properties of const Surface_mesh template typename boost::property_map, dynamic_vertex_property_t >::const_type -get(dynamic_vertex_property_t, const Surface_mesh& sm) +get(dynamic_vertex_property_t, const Surface_mesh& sm, const T& default_value = T()) { - return CGAL::internal::Dynamic_with_index::Vertex_index, T>(num_vertices(sm)); + return CGAL::internal::Dynamic_with_index::Vertex_index, T>(num_vertices(sm), default_value); } template typename boost::property_map, dynamic_face_property_t >::const_type -get(dynamic_face_property_t, const Surface_mesh& sm) +get(dynamic_face_property_t, const Surface_mesh& sm, const T& default_value = T()) { - return CGAL::internal::Dynamic_with_index::Face_index, T>(num_faces(sm)); + return CGAL::internal::Dynamic_with_index::Face_index, T>(num_faces(sm), default_value); } template typename boost::property_map, dynamic_halfedge_property_t >::const_type -get(dynamic_halfedge_property_t, const Surface_mesh& sm) +get(dynamic_halfedge_property_t, const Surface_mesh& sm, const T& default_value = T()) { - return CGAL::internal::Dynamic_with_index::Halfedge_index, T>(num_halfedges(sm)); + return CGAL::internal::Dynamic_with_index::Halfedge_index, T>(num_halfedges(sm), default_value); } template typename boost::property_map, dynamic_edge_property_t >::const_type -get(dynamic_edge_property_t, const Surface_mesh& sm) +get(dynamic_edge_property_t, const Surface_mesh& sm, const T& default_value = T()) { - return CGAL::internal::Dynamic_with_index::Edge_index, T>(num_edges(sm)); + return CGAL::internal::Dynamic_with_index::Edge_index, T>(num_edges(sm), default_value); } // implementation detail: required by Dynamic_property_map_deleter diff --git a/Surface_mesh/include/CGAL/draw_surface_mesh.h b/Surface_mesh/include/CGAL/draw_surface_mesh.h index 72158e05836..776aa5097b2 100644 --- a/Surface_mesh/include/CGAL/draw_surface_mesh.h +++ b/Surface_mesh/include/CGAL/draw_surface_mesh.h @@ -8,6 +8,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_SURFACE_MESH_H #define CGAL_DRAW_SURFACE_MESH_H @@ -17,107 +18,179 @@ /*! \ingroup PkgDrawSurfaceMesh -Open a new window and draw `asm`, an instance of the `CGAL::Surface_mesh` class. The function is blocking, that is the program continues as soon as the user closes the window. 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 SM an instance of the `CGAL::Surface_mesh` class. -\param asm the surface mesh to draw. +opens a new window and draws a surface mesh. 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 SM which must be an instanciation of a `CGAL::Surface_mesh<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param sm the surface mesh to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Surface_mesh& sm, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void draw(const SM& sm, const GSOptions& gso); + +/*! +\ingroup PkgDrawSurfaceMesh + +A shortcut to `CGAL::draw(sm, Graphics_scene_options{})`. +*/ + template + void draw(const SM& sm); + +/*! +\ingroup PkgDrawSurfaceMesh + +adds the vertices, edges and faces of `sm` 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 SM which must be an instanciation of a `CGAL::Surface_mesh<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param sm the surface mesh 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::Surface_mesh& sm, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const SM& sm, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawSurfaceMesh + +A shortcut to `CGAL::add_to_graphics_scene(sm, gs, Graphics_scene_options{})`. */ template -void draw(const SM& asm); +void add_to_graphics_scene(const SM& sm, + CGAL::Graphics_scene& gs); #else // DOXYGEN_RUNNING #include -#include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include +#include +#include #include #include -#include +#include namespace CGAL { -// Check if there are any color maps that could be used, random otherwise +// Check if there are any color maps that could be used template -struct Surface_mesh_basic_viewer_color_map - : DefaultColorFunctorFaceGraph +struct Graphics_scene_options_surface_mesh + : public Graphics_scene_options, + typename boost::graph_traits<::CGAL::Surface_mesh>::vertex_descriptor, + typename boost::graph_traits<::CGAL::Surface_mesh>::edge_descriptor, + typename boost::graph_traits<::CGAL::Surface_mesh>::face_descriptor> { - using Base = DefaultColorFunctorFaceGraph; - using SM = ::CGAL::Surface_mesh; using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using edge_descriptor = typename boost::graph_traits::edge_descriptor; using face_descriptor = typename boost::graph_traits::face_descriptor; - using vertex_colors = typename SM::template Property_map; - using edge_colors = typename SM::template Property_map; - using face_colors = typename SM::template Property_map; - - Surface_mesh_basic_viewer_color_map(const SM& amesh) + Graphics_scene_options_surface_mesh(const SM& amesh) { - bool found = false; - std::tie(vcolors, found) = amesh.template property_map("v:color"); - std::tie(ecolors, found) = amesh.template property_map("e:color"); - std::tie(fcolors, found) = amesh.template property_map("f:color"); - CGAL_USE(found); - } + bool found=false; + std::tie(vcolors, found)= + amesh.template property_map("v:color"); + if(found) + { + this->colored_vertex=[](const SM &, vertex_descriptor)->bool { return true; }; + this->vertex_color=[this](const SM &, vertex_descriptor v)->CGAL::IO::Color + { return get(vcolors, v); }; + } + else + { this->colored_vertex=[](const SM &, vertex_descriptor)->bool { return false; }; } - CGAL::IO::Color operator()(const Surface_mesh& amesh, - const vertex_descriptor v) const - { - return vcolors ? get(vcolors, v) : Base::operator()(amesh, v); - } + std::tie(ecolors, found)= + amesh.template property_map("e:color"); + if(found) + { + this->colored_edge=[](const SM &, edge_descriptor)->bool { return true; }; + this->edge_color=[this](const SM &, edge_descriptor e)->CGAL::IO::Color + { return get(ecolors, e); }; + } + else + { this->colored_edge=[](const SM &, edge_descriptor)->bool { return false; }; } - CGAL::IO::Color operator()(const Surface_mesh& amesh, - const edge_descriptor e) const - { - return ecolors ? get(ecolors, e) : Base::operator()(amesh, e); - } - - CGAL::IO::Color operator()(const Surface_mesh& amesh, - const face_descriptor f) const - { - return fcolors ? get(fcolors, f) : Base::operator()(amesh, f); + std::tie(fcolors, found)= + amesh.template property_map("f:color"); + if(found) + { + this->colored_face=[](const SM &, face_descriptor)->bool { return true; }; + this->face_color=[this](const SM &, face_descriptor f)->CGAL::IO::Color + { return get(fcolors, f); }; + } + else + { this->colored_face=[](const SM &, face_descriptor)->bool { return false; }; } } private: - vertex_colors vcolors; - edge_colors ecolors; - face_colors fcolors; + typename SM::template Property_map vcolors; + typename SM::template Property_map ecolors; + typename SM::template Property_map fcolors; }; -// Specialization of draw function. +template +void add_to_graphics_scene(const Surface_mesh& amesh, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gs_options) +{ add_to_graphics_scene_for_fg(amesh, graphics_scene, gs_options); } + +template +void add_to_graphics_scene(const Surface_mesh& amesh, + CGAL::Graphics_scene &graphics_scene) +{ add_to_graphics_scene_for_fg(amesh, graphics_scene, + Graphics_scene_options_surface_mesh(amesh)); } + +#ifdef CGAL_USE_BASIC_VIEWER + + // Specialization of draw function. template void draw(const Surface_mesh& amesh, - const char* title="Surface_mesh Basic Viewer", - bool nofill=false) + const char* title="Surface_mesh Basic Viewer") { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"surface_mesh_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimpleFaceGraphViewerQt mainwindow(app.activeWindow(), amesh, title, nofill, - Surface_mesh_basic_viewer_color_map(amesh)); - mainwindow.show(); - app.exec(); - } + CGAL::Graphics_scene buffer; + add_to_graphics_scene(amesh, buffer); + draw_graphics_scene(buffer, title); } -} // End namespace CGAL +template +void draw(const Surface_mesh& amesh, + const GSOptions &gs_options, + const char* title="Surface_mesh Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(amesh, buffer, gs_options); + draw_graphics_scene(buffer, title); +} #endif // CGAL_USE_BASIC_VIEWER +} // End namespace CGAL + #endif // DOXYGEN_RUNNING #endif // CGAL_DRAW_SURFACE_MESH_H diff --git a/Surface_mesh/package_info/Surface_mesh/dependencies b/Surface_mesh/package_info/Surface_mesh/dependencies index bb41a0ba625..1e1a85b5e66 100644 --- a/Surface_mesh/package_info/Surface_mesh/dependencies +++ b/Surface_mesh/package_info/Surface_mesh/dependencies @@ -1,19 +1,30 @@ Algebraic_foundations +Arithmetic_kernel BGL +Basic_viewer Cartesian_kernel Circulator Distance_2 Distance_3 -GraphicsView +Filtered_kernel Hash_map +Homogeneous_kernel Installation +Intersections_2 +Intersections_3 Interval_support Kernel_23 +Kernel_d Modular_arithmetic Number_types +Polygon Profiling_tools Property_map Random_numbers STL_Extension +Spatial_sorting Stream_support Surface_mesh +TDS_2 +Triangulation_2 +CGAL_Core diff --git a/Surface_mesh_approximation/package_info/Surface_mesh_approximation/dependencies b/Surface_mesh_approximation/package_info/Surface_mesh_approximation/dependencies index b1ab146c636..aaf95de7e9d 100644 --- a/Surface_mesh_approximation/package_info/Surface_mesh_approximation/dependencies +++ b/Surface_mesh_approximation/package_info/Surface_mesh_approximation/dependencies @@ -14,7 +14,6 @@ Principal_component_analysis Principal_component_analysis_LGPL Profiling_tools Property_map -Random_numbers STL_Extension Solver_interface Stream_support diff --git a/Surface_mesh_deformation/package_info/Surface_mesh_deformation/dependencies b/Surface_mesh_deformation/package_info/Surface_mesh_deformation/dependencies index e4abdd72dbd..2019eca3e76 100644 --- a/Surface_mesh_deformation/package_info/Surface_mesh_deformation/dependencies +++ b/Surface_mesh_deformation/package_info/Surface_mesh_deformation/dependencies @@ -13,7 +13,6 @@ Modular_arithmetic Number_types Profiling_tools Property_map -Random_numbers STL_Extension Solver_interface Stream_support diff --git a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies index 8acc07edef0..d2906b564b4 100644 --- a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies +++ b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies @@ -19,7 +19,6 @@ Number_types Polygon_mesh_processing Profiling_tools Property_map -Random_numbers STL_Extension Solver_interface Spatial_sorting diff --git a/Surface_mesh_shortest_path/package_info/Surface_mesh_shortest_path/dependencies b/Surface_mesh_shortest_path/package_info/Surface_mesh_shortest_path/dependencies index 0acb32e8813..5336f29d3b6 100644 --- a/Surface_mesh_shortest_path/package_info/Surface_mesh_shortest_path/dependencies +++ b/Surface_mesh_shortest_path/package_info/Surface_mesh_shortest_path/dependencies @@ -14,7 +14,6 @@ Modular_arithmetic Number_types Profiling_tools Property_map -Random_numbers STL_Extension Spatial_searching Stream_support diff --git a/Surface_mesh_simplification/package_info/Surface_mesh_simplification/dependencies b/Surface_mesh_simplification/package_info/Surface_mesh_simplification/dependencies index 27dd31f34e6..e6a49c552eb 100644 --- a/Surface_mesh_simplification/package_info/Surface_mesh_simplification/dependencies +++ b/Surface_mesh_simplification/package_info/Surface_mesh_simplification/dependencies @@ -14,7 +14,6 @@ Modular_arithmetic Number_types Profiling_tools Property_map -Random_numbers STL_Extension Spatial_searching Stream_support diff --git a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h index df9bde13a6f..b09424dbecd 100644 --- a/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h +++ b/Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h @@ -3,28 +3,100 @@ namespace CGAL { /*! \ingroup PkgDrawFaceGraphWithPaths -opens a new window and draws `amesh`, either a 2D linear cell complex or a model of the FaceGraph concept, plus the paths lying on this mesh given in `apaths`. -A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires `CGAL_Qt6`, and is only available if the flag `CGAL_USE_BASIC_VIEWER` is defined at compile time. +opens a new window and draws `amesh`, either a 2D linear cell complex or a model of the FaceGraph concept, plus the paths lying on this mesh given in `apaths`. 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 Mesh either a 2D linear cell complex or a model of the FaceGraph concept. +\tparam GSOptions a model of `GraphicsSceneOptionsFaceGraphWithPaths` concept. + \param amesh the mesh to draw. \param apaths the paths to draw, which should lie on `amesh`. +\param gso the graphics scene options parameter. */ -template +template void draw(const Mesh& amesh, - const std::vector >& apaths); + const std::vector >& apaths, + const GSOptions& gso); /*! \ingroup PkgDrawFaceGraphWithPaths -opens a new window and draws `amesh`, either a 2D linear cell complex or a model of the FaceGraph concept, plus the paths lying on this mesh given in `apaths`. -A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires `CGAL_Qt6`, and is only available if the flag `CGAL_USE_BASIC_VIEWER` is defined at compile time. -\tparam Mesh either a 2D linear cell complex or a model of the FaceGraph concept. -\param amesh the mesh to draw. -\param apaths the paths to draw, which should lie on `amesh`. +A shortcut to `CGAL::draw(amesh, apaths, Graphics_scene_options_face_graph_with_paths{})`. */ template void draw(const Mesh& amesh, - std::initializer_list >& apaths); + const std::vector >& apaths); + +/*! +\ingroup PkgDrawFaceGraphWithPaths + +Same function than
draw() but taking the paths from a list instead from an std::vector. +*/ +template +void draw(const Mesh& amesh, + std::initializer_list > apaths, + const GSOptions& gso); + +/*! +\ingroup PkgDrawFaceGraphWithPaths + +A shortcut to `CGAL::draw(amesh, apaths, Graphics_scene_options_face_graph_with_paths{})`. +*/ +template +void draw(const Mesh& amesh, + std::initializer_list > apaths); + +/*! +\ingroup PkgDrawFaceGraphWithPaths + +adds the vertices, edges and faces of `amesh`, either a 2D linear cell complex or a model of the FaceGraph concept, plus the paths lying on this mesh given in `apaths`, 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 Mesh either a 2D linear cell complex or a model of the FaceGraph concept. +\tparam GSOptions a model of `GraphicsSceneOptionsFaceGraphWithPaths` concept. + +\param amesh the mesh to draw. +\param gs the graphic scene to fill. +\param gso the graphics scene options parameter. +\param apaths the paths to draw, which should lie on `amesh`. +*/ +template +void add_to_graphics_scene(const Mesh& amesh, + CGAL::Graphics_scene& gs, + const GSOptions& gso, + const std::vector>& apaths); + +/*! +\ingroup PkgDrawFaceGraphWithPaths + +A shortcut to `CGAL::add_to_graphics_scene(amesh, gs, Graphics_scene_options_face_graph_with_paths{}, apaths)`. +*/ +template +void add_to_graphics_scene(const Mesh& amesh, + CGAL::Graphics_scene& gs, + const std::vector>& apaths); + +/*! +\ingroup PkgDrawFaceGraphWithPaths + +Same function than add_to_graphics_scene() but taking the paths from a list instead from an std::vector. +*/ +template +void add_to_graphics_scene(const Mesh& amesh, + CGAL::Graphics_scene& gs, + const GSOptions& gso, + std::initializer_list > apaths); + +/*! +\ingroup PkgDrawFaceGraphWithPaths + +A shortcut to `CGAL::add_to_graphics_scene(amesh, gs, Graphics_scene_options_face_graph_with_paths{}, apaths)`. +*/ +template +void add_to_graphics_scene(const Mesh& amesh, + CGAL::Graphics_scene& gs, + std::initializer_list > apaths); } /* namespace CGAL */ diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h b/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h index 4a489b19ff1..5883d7d32d7 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h @@ -1,51 +1,33 @@ #ifndef DRAW_FACEWIDTH_H #define DRAW_FACEWIDTH_H -#include - #ifdef CGAL_USE_BASIC_VIEWER #include +#include template -struct Facewidth_draw_functor : public CGAL::DefaultDrawingFunctorLCC +struct Facewidth_graphics_scene_options: + public CGAL::Graphics_scene_options { - Facewidth_draw_functor(typename ALCC::size_type amark1, typename ALCC::size_type amark2) : + Facewidth_graphics_scene_options(typename ALCC::size_type amark1, typename ALCC::size_type amark2) : m_vertex_mark(amark1), m_face_mark(amark2) - {} + { + this->colored_vertex=[this](const ALCC& alcc, typename ALCC::Dart_const_handle dh)->bool + { return alcc.is_marked(dh, m_vertex_mark); }; + this->vertex_color=[](const ALCC&, typename ALCC::Dart_const_handle)->CGAL::IO::Color + { return CGAL::IO::Color(0, 255, 0); }; - template - bool colored_vertex(const LCC& alcc, typename LCC::Dart_const_descriptor dh) const - { return alcc.is_marked(dh, m_vertex_mark); } - - template - CGAL::IO::Color vertex_color(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* dh */) const - { return CGAL::IO::Color(0, 255, 0); } - - template - bool colored_edge(const LCC& /*alcc*/, typename LCC::Dart_const_descriptor /*dh*/) const - { return false; } - - template - CGAL::IO::Color edge_color(const LCC& /* alcc*/, - typename LCC::Dart_const_descriptor /* dh */) const - { return CGAL::IO::Color(0, 0, 255); } - - template - bool colored_face(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* dh */) const - {return true;} - - template - CGAL::IO::Color face_color(const LCC& alcc, typename LCC::Dart_const_descriptor dh) const - { return alcc.is_marked(dh, m_face_mark)?CGAL::IO::Color(255, 0, 0) - :CGAL::IO::Color(211, 211, 211); } - - template - bool colored_volume(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* dh */) const - { return false; } + this->colored_face=[](const ALCC&, typename ALCC::Dart_const_handle)->bool + { return true; }; + this->face_color=[this](const ALCC& alcc, typename ALCC::Dart_const_handle dh)->CGAL::IO::Color + { return alcc.is_marked(dh, m_face_mark)?CGAL::IO::Color(255, 0, 0) + :CGAL::IO::Color(211, 211, 211); }; + } typename ALCC::size_type m_vertex_mark, m_face_mark; }; @@ -58,30 +40,21 @@ void draw_facewidth(const LCC& lcc, typename LCC::size_type face_mark = lcc.get_new_mark(); for (std::size_t i=0; i(cycle[i], vertex_mark); } - // Color the face + // Color the faces if (!lcc.is_marked(cycle[i], face_mark)) { lcc.template mark_cell<2>(cycle[i], face_mark); } } - Facewidth_draw_functor df(vertex_mark, face_mark); - CGAL::draw(lcc, "Face width", false, df); + Facewidth_graphics_scene_options df(vertex_mark, face_mark); + CGAL::draw(lcc, df, "Face width"); lcc.free_mark(vertex_mark); lcc.free_mark(face_mark); } -#else // CGAL_USE_BASIC_VIEWER - -template -void draw_facewidth(const LCC&, - const std::vector&) -{ - std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."<=3 && std::string(argv[2])=="-draw") + { draw_facewidth(lcc, cycle); } +#endif } return EXIT_SUCCESS; diff --git a/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp b/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp index b8340e878a5..28e3c4b439b 100644 --- a/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp +++ b/Surface_mesh_topology/examples/Surface_mesh_topology/open_path_homotopy.cpp @@ -63,7 +63,10 @@ int main(int argc, char* argv[]) <<" base point homotopic with path p3 (orange)."< { Draw_functor(LCC_3::size_type am1, LCC_3::size_type am2) : is_root(am1), belong_to_cycle(am2) - {} + { + this->colored_vertex=[this](const LCC_3& alcc, typename LCC_3::Dart_const_handle dh)->bool + { return alcc.is_marked(dh, is_root); }; + this->vertex_color=[](const LCC_3&, typename LCC_3::Dart_const_handle)->CGAL::IO::Color + { return CGAL::IO::Color(0, 255, 0); }; - template - bool colored_vertex(const LCC& alcc, typename LCC::Dart_const_descriptor d) const - { return alcc.is_marked(d, is_root); } + this->colored_edge=[this](const LCC_3& alcc, typename LCC_3::Dart_const_handle dh)->bool + { return alcc.is_marked(dh, belong_to_cycle); }; + this->edge_color=[](const LCC_3&, typename LCC_3::Dart_const_handle)->CGAL::IO::Color + { return CGAL::IO::Color(0, 0, 255); }; - template - CGAL::IO::Color vertex_color(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* d */) const - { return CGAL::IO::Color(0,255,0); } - - template - bool colored_edge(const LCC& alcc, typename LCC::Dart_const_descriptor d) const - { return alcc.is_marked(d, belong_to_cycle); } - - template - CGAL::IO::Color edge_color(const LCC& /* alcc*/, - typename LCC::Dart_const_descriptor /* d */) const - { return CGAL::IO::Color(0, 0, 255); } - - template - bool colored_face(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* d */) const {return true;} - - template - CGAL::IO::Color face_color(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* d */) const - {return CGAL::IO::Color(211, 211, 211);} - - template - bool colored_volume(const LCC& /* alcc */, - typename LCC::Dart_const_descriptor /* d */) const { return false; } + this->colored_face=[](const LCC_3&, typename LCC_3::Dart_const_handle)->bool + { return true; }; + this->face_color=[](const LCC_3&, typename LCC_3::Dart_const_handle)->CGAL::IO::Color + { return CGAL::IO::Color(211, 211, 211); }; + } LCC_3::size_type is_root; LCC_3::size_type belong_to_cycle; @@ -159,7 +147,7 @@ int main(int argc, char* argv[]) if (draw) { Draw_functor df(is_root, belong_to_cycle); - CGAL::draw(lccoriginal, "Unsew edge width repeatdly", false, df); + CGAL::draw(lccoriginal, df, "Unsew edge width repeatdly"); } #endif // CGAL_USE_BASIC_VIEWER diff --git a/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h b/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h index f76c4846d3c..79ba01fedd0 100644 --- a/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h +++ b/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h @@ -8,25 +8,65 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf // #ifndef CGAL_DRAW_FACE_GRAPH_WITH_PATHS_H #define CGAL_DRAW_FACE_GRAPH_WITH_PATHS_H #include +#include +#include + #include #include +#include + #include #include #include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include #include namespace CGAL { +// Specific graphics scene options +template +struct Graphics_scene_options_face_graph_with_paths : + public CGAL::Graphics_scene_options +{ + Graphics_scene_options_face_graph_with_paths() + { + color_of_path=[](std::size_t i)->CGAL::IO::Color + { + CGAL::Random random(static_cast(i)); + return get_random_color(random); + }; + + draw_path=[](std::size_t)->bool + { return true; }; + } + + const CGAL::IO::Color& color_of_marked_edges() const + { return m_color_of_marked_edges; } + void color_of_marked_edges(const CGAL::IO::Color& c) + { m_color_of_marked_edges=c; } + + std::function color_of_path; + std::function draw_path; +protected: + CGAL::IO::Color m_color_of_marked_edges=CGAL::IO::Color(0, 0, 255); +}; + +namespace draw_function_for_lcc +{ + // We need to re-use the namespace draw_function_for_lcc because we want to specialize + // the previous struct LCC_geom_utils +// template +// struct LCC_geom_utils; + // Specialisation for face graph; otherwise use the LCC_geom_utils of LCC. template struct LCC_geom_utils, Local_kernel, 3> @@ -84,401 +124,320 @@ struct LCC_geom_utils, Local_kernel, 3> } }; -// Viewer class for Face_graph with paths. -template -class Face_graph_with_path_viewer : public Basic_viewer_qt +} // namespace draw_function_for_lcc + +namespace draw_function_for_face_graph_with_paths { - typedef Basic_viewer_qt Base; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; +typedef Local_kernel::Point_3 Local_point; +typedef Local_kernel::Vector_3 Local_vector; + +template +const typename CGAL::Get_traits::Point& get_point +(const Mesh &mesh, typename Get_map::type::Dart_const_descriptor dh) +{ return CGAL::Get_traits::get_point(mesh, dh); } + +template +void compute_face(const Mesh& mesh, + const typename Get_map::storage_type& lcc, + typename Get_map::type::Dart_const_descriptor dh, + CGAL::Graphics_scene& graphics_scene, + GSOptions& gso) +{ + if(!gso.are_faces_enabled() || !gso.draw_face(mesh, dh)) + { return; } + + typedef typename Get_map::type LCC; + typedef typename LCC::Dart_const_descriptor Dart_const_descriptor; + + // We fill only closed faces. + Dart_const_descriptor cur=dh; + Dart_const_descriptor min=dh; + do + { + if (!lcc.is_next_exist(cur)) return; // open face=>not filled + if (cur:: + get_vertex_normal(lcc, cur)); + cur=lcc.next(cur); + } + while(cur!=dh); + + graphics_scene.face_end(); +} + +template +void compute_edge(const Mesh &mesh, + const typename Get_map::storage_type& lcc, + typename Get_map::type::Dart_const_descriptor dh, + CGAL::Graphics_scene& graphics_scene, + GSOptions& gso, + bool colored=false, + const CGAL::IO::Color& color=CGAL::IO::black()) +{ + if(!gso.are_edges_enabled() || !gso.draw_edge(mesh, dh)) + { return; } + typedef typename Get_map::type LCC; - typedef typename LCC::Dart_const_descriptor Dart_const_descriptor; - typedef typename LCC::size_type size_type; - typedef typename CGAL::Get_traits::Kernel Kernel; + typedef typename LCC::Dart_const_descriptor Dart_const_descriptor; typedef typename CGAL::Get_traits::Point Point; - typedef typename CGAL::Get_traits::Vector Vector; -public: - /// Construct the viewer. - /// @param alcc the lcc to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; - /// this can be useful for very big object where this time could be long) - Face_graph_with_path_viewer(QWidget* parent, - const Mesh& amesh, - const std::vector - > - *paths=nullptr, - size_type amark=LCC::INVALID_MARK, - const char* title="", bool anofaces=false, - const DrawingFunctorLCC& - drawing_functor=DrawingFunctorLCC()) : - Base(parent, title, true, true, true, false, true), - mesh(amesh), - lcc(amesh), - m_oriented_mark(lcc.get_new_mark()), - m_nofaces(anofaces), - m_drawing_functor(drawing_functor), - m_paths(paths), - m_current_path(m_paths->size()), - m_current_dart(lcc.darts().end()), - m_draw_marked_darts(true), - m_amark(amark==(std::numeric_limits::max)()? - LCC::INVALID_MARK:amark) + Point p1=get_point(mesh, dh); + Dart_const_descriptor d2=lcc.other_extremity(dh); + if (d2!=LCC::null_descriptor) { - lcc.orient(m_oriented_mark); - compute_elements(); - } - - ~Face_graph_with_path_viewer() - { - lcc.free_mark(m_oriented_mark); - } - -protected: - - const Point& get_point(Dart_const_descriptor dh) const - { return CGAL::Get_traits::get_point(mesh, dh); } - - void compute_elements() - { - clear(); - - typename LCC::size_type markfaces = lcc.get_new_mark(); - typename LCC::size_type markedges = lcc.get_new_mark(); - typename LCC::size_type markvertices = lcc.get_new_mark(); - - if (m_current_dart!=lcc.darts().end()) - { // We want to draw only one dart - Dart_const_descriptor selected_dart=m_current_dart; //lcc.dart_descriptor(m_current_dart); - compute_edge(selected_dart, CGAL::IO::Color(255,0,0)); - lcc.template mark_cell<1>(selected_dart, markedges); - compute_vertex(selected_dart); - - if ( !m_nofaces ) - { compute_face(selected_dart); } - - for (typename LCC::Dart_range::const_iterator it=lcc.darts().begin(), - itend=lcc.darts().end(); it!=itend; ++it ) - { - if ( !lcc.is_marked(it, markedges) ) - { - compute_edge(it); - lcc.template mark_cell<1>(it, markedges); - } - } - } + if(colored) + { graphics_scene.add_segment(p1, get_point(mesh, d2), color); } else - { - if (m_current_path==m_paths->size()) - { - for (std::size_t i=0; isize(); ++i) - { compute_path(i, markedges); } - } - else if (m_current_path!=m_paths->size()+1) - { compute_path(m_current_path, markedges); } - - for (typename LCC::Dart_range::const_iterator it=lcc.darts().begin(), - itend=lcc.darts().end(); it!=itend; ++it ) - { - if (!m_nofaces && !lcc.is_marked(it, markfaces) && - !lcc.is_perforated(it) && lcc.is_marked(it, m_oriented_mark)) - { - compute_face(it); - lcc.template mark_cell<2>(it, markfaces); - } - - if ( !lcc.is_marked(it, markedges) ) - { - compute_edge(it); - lcc.template mark_cell<1>(it, markedges); - } - - if ( !lcc.is_marked(it, markvertices) ) - { - compute_vertex(it); - lcc.template mark_cell<0>(it, markvertices); - } - } - } - - lcc.free_mark(markfaces); - lcc.free_mark(markedges); - lcc.free_mark(markvertices); - } - - void compute_face(Dart_const_descriptor dh) - { - // We fill only closed faces. - Dart_const_descriptor cur=dh; - Dart_const_descriptor min=dh; - do - { - if (!lcc.is_next_exist(cur)) return; // open face=>not filled - if (cur:: - get_vertex_normal(lcc, cur)); - cur=lcc.next(cur); - } - while(cur!=dh); - - face_end(); - } - - void compute_edge(Dart_const_descriptor dh) - { - Point p1 = get_point(dh); - Dart_const_descriptor d2 = lcc.other_extremity(dh); - if (d2!=LCC::null_descriptor) - { - if (m_draw_marked_darts && m_amark!=LCC::INVALID_MARK && - (lcc.is_marked(dh, m_amark) || lcc.is_marked(lcc.opposite2(dh), m_amark))) - { add_segment(p1, get_point(d2), CGAL::IO::Color(0, 0, 255)); } - else - { add_segment(p1, get_point(d2)); } - } - } - - void compute_edge(Dart_const_descriptor dh, const CGAL::IO::Color& color) - { - Point p1 = get_point(dh); - Dart_const_descriptor d2 = lcc.other_extremity(dh); - if (d2!=LCC::null_descriptor) - { add_segment(p1, get_point(d2), color); } - } - - void compute_vertex(Dart_const_descriptor dh) - { add_point(get_point(dh)); } - - virtual void init() - { - Base::init(); - setKeyDescription(::Qt::Key_D, "Increase current dart drawing"); - setKeyDescription(::Qt::ControlModifier, ::Qt::Key_D, "Decrease current dart drawing"); - setKeyDescription(::Qt::ShiftModifier, ::Qt::Key_D, "Draw all darts"); - - setKeyDescription(::Qt::Key_X, "Toggles marked darts display"); - - setKeyDescription(::Qt::Key_P, "Increase current path drawing"); - setKeyDescription(::Qt::ControlModifier, ::Qt::Key_P, "Decrease current path drawing"); - setKeyDescription(::Qt::ShiftModifier, ::Qt::Key_P, "Draw all paths"); - } - - virtual void keyPressEvent(QKeyEvent *e) - { - const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - - if ((e->key()==::Qt::Key_D) && (modifiers==::Qt::NoButton)) - { - if (m_current_dart==lcc.darts().end()) - { m_current_dart=lcc.darts().begin(); } - else - { ++m_current_dart; } - if (m_current_dart==lcc.darts().end()) - { displayMessage(QString("Draw all darts.")); } - else - { displayMessage(QString("Draw dart=%1.").arg(lcc.darts().index(m_current_dart))); } - compute_elements(); - redraw(); - } - else if ((e->key()==::Qt::Key_D) && (modifiers==::Qt::ControlModifier)) - { - if (m_current_dart==lcc.darts().begin()) - { m_current_dart=lcc.darts().end(); } - else - { --m_current_dart; } - if (m_current_dart==lcc.darts().end()) - { displayMessage(QString("Draw all darts.")); } - else - { displayMessage(QString("Draw dart=%1.").arg(lcc.darts().index(m_current_dart))); } - compute_elements(); - redraw(); - } - else if ((e->key()==::Qt::Key_D) && (modifiers==::Qt::ShiftModifier)) - { - m_current_dart=lcc.darts().end(); - displayMessage(QString("Draw all darts.")); - compute_elements(); - redraw(); - } - else if ((e->key()==::Qt::Key_P) && (modifiers==::Qt::NoButton)) - { - m_current_path=(m_current_path+1)%(m_paths->size()+2); - if (m_current_path==m_paths->size()) - { displayMessage(QString("Draw all paths.")); } - else if (m_current_path==m_paths->size()+1) - { displayMessage(QString("Do not draw paths.")); } - else - { displayMessage(QString("Draw path=%1, nb_darts=%2."). - arg(m_current_path). - arg((*m_paths)[m_current_path].length())); } - compute_elements(); - redraw(); - } - else if ((e->key()==::Qt::Key_P) && (modifiers==::Qt::ControlModifier)) - { - m_current_path=(m_current_path==0?m_paths->size()+1:m_current_path-1); - if (m_current_path==m_paths->size()) - { displayMessage(QString("Draw all paths.")); } - else if (m_current_path==m_paths->size()+1) - { displayMessage(QString("Do not draw paths.")); } - else - { displayMessage(QString("Draw path=%1, nb_darts=%2."). - arg(m_current_path). - arg((*m_paths)[m_current_path].length())); } - compute_elements(); - redraw(); - } - else if ((e->key()==::Qt::Key_P) && (modifiers==::Qt::ShiftModifier)) - { - m_current_path=m_paths->size(); - displayMessage(QString("Draw all paths.")); - compute_elements(); - redraw(); - } - else if ((e->key()==::Qt::Key_X) && (modifiers==::Qt::NoButton)) - { - m_draw_marked_darts=!m_draw_marked_darts; - - if (m_draw_marked_darts) - { displayMessage(QString("Draw marked darts in blue.")); } - else - { - displayMessage(QString("Do not draw marked darts in different color.")); - } - compute_elements(); - redraw(); - } - else - { Base::keyPressEvent(e); } - } - - void compute_path(std::size_t i, typename LCC::size_type amark) - { - if ((*m_paths)[i].is_empty()) - { return; } - - CGAL::Random random(static_cast(i)); - CGAL::IO::Color color=get_random_color(random); - - add_point(get_point((*m_paths)[i].get_ith_dart(0)), color); - for (std::size_t j=0; j<(*m_paths)[i].length(); ++j) - { - if ( !lcc.is_marked( (*m_paths)[i].get_ith_dart(j), amark) ) - { - compute_edge((*m_paths)[i].get_ith_dart(j), color); - lcc.template mark_cell<1>((*m_paths)[i].get_ith_dart(j), amark); - } - } - } - -protected: - const Mesh& mesh; - const typename Get_map::storage_type lcc; - typename LCC::size_type m_oriented_mark; - bool m_nofaces; - const DrawingFunctorLCC& m_drawing_functor; - const std::vector >* m_paths; - std::size_t m_current_path; - typename LCC::Dart_range::const_iterator m_current_dart; - bool m_draw_marked_darts; - typename LCC::size_type m_amark; // If !=INVALID_MARK, show darts marked with this mark -}; - -template -void draw(const Mesh& alcc, - const std::vector >& paths, - const char* title="Mesh Viewer With Path", - typename Get_map::type::size_type amark= - (std::numeric_limits::type::size_type>::max)(), - bool nofill=false, - const DrawingFunctor& drawing_functor=DrawingFunctor()) -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[1]={"lccviewer"}; - QApplication app(argc,const_cast(argv)); - Face_graph_with_path_viewer mainwindow(app.activeWindow(), - alcc, &paths, amark, - title, nofill, - drawing_functor); - mainwindow.show(); - app.exec(); + { graphics_scene.add_segment(p1, get_point(mesh, d2)); } } } -template -void draw(const Mesh& alcc, +template +void compute_edge(const Mesh &mesh, + const typename Get_map::storage_type& lcc, + typename Get_map::type::Dart_const_descriptor dh, + CGAL::Graphics_scene& graphics_scene, + GSOptions& gso, + typename Get_map::type::size_type amark) +{ + if(!gso.are_edges_enabled() || !gso.draw_edge(mesh, dh)) + { return; } + + if (amark!=Get_map::type::INVALID_MARK && + (lcc.is_marked(dh, amark) || lcc.is_marked(lcc.opposite2(dh), amark))) + { compute_edge(mesh, lcc, dh, graphics_scene, gso, true, gso.color_of_marked_edges()); } + else + { + if(gso.colored_edge(mesh, dh)) + { compute_edge(mesh, lcc, dh, graphics_scene, gso, true, + gso.edge_color(mesh, dh)); } + else + { compute_edge(mesh, lcc, dh, graphics_scene, gso, false); } + } +} + +template +void compute_vertex(const Mesh &mesh, + typename Get_map::type::Dart_const_descriptor dh, + CGAL::Graphics_scene& graphics_scene, + GSOptions& gso) +{ + if(gso.are_vertices_enabled() && gso.draw_vertex(mesh, dh)) + { + if (gso.colored_vertex(mesh, dh)) + { + graphics_scene.add_point(get_point(mesh, dh), + gso.vertex_color(mesh, dh)); + } + else + { graphics_scene.add_point(get_point(mesh, dh)); } + } +} + +template +void compute_path(const Mesh &mesh, + const typename Get_map::storage_type& lcc, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gso, + const std::vector>& paths, + std::size_t i, + typename Get_map::type::size_type amark) +{ + + if (paths[i].is_empty() || !gso.draw_path(i)) + { return; } + + CGAL::IO::Color color=gso.color_of_path(i); + graphics_scene.add_point(get_point(mesh, paths[i].get_ith_dart(0)), color); + for (std::size_t j=0; j(paths[i].get_ith_dart(j), amark); + } + } +} + +template +void compute_elements(const Mesh &mesh, + CGAL::Graphics_scene &graphics_scene, + const GSOptions &gso, + const std::vector>& paths, + typename Get_map::type::size_type mark) +{ + typedef typename Get_map::type LCC; + typedef typename LCC::size_type size_type; + + typename Get_map::storage_type lcc(mesh); + size_type oriented_mark = lcc.get_new_mark(); + std::size_t current_path = paths.size(); + typename LCC::size_type amark=mark==(std::numeric_limits::max)()? + LCC::INVALID_MARK:mark; // If !=INVALID_MARK, show darts marked with this mark + + lcc.orient(oriented_mark); + + size_type markfaces = lcc.get_new_mark(); + size_type markedges = lcc.get_new_mark(); + size_type markvertices = lcc.get_new_mark(); + + if (current_path==paths.size()) + { + for (std::size_t i=0; i(it, markfaces); + } + + if ( !lcc.is_marked(it, markedges) ) + { + compute_edge(mesh, lcc, it, graphics_scene, gso, amark); + lcc.template mark_cell<1>(it, markedges); + } + + if ( !lcc.is_marked(it, markvertices) ) + { + compute_vertex(mesh, it, graphics_scene, gso); + lcc.template mark_cell<0>(it, markvertices); + } + } + + lcc.free_mark(markfaces); + lcc.free_mark(markedges); + lcc.free_mark(markvertices); +} + +} // namespace draw_function_for_face_graph_with_paths + +template +void add_to_graphics_scene(const Mesh& mesh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso, + const std::vector>& paths, + typename Get_map::type::size_type amark= + Get_map::type::INVALID_MARK) +{ + draw_function_for_face_graph_with_paths::compute_elements(mesh, graphics_scene, + gso, paths, amark); +} + +template +void add_to_graphics_scene(const Mesh& mesh, + CGAL::Graphics_scene& graphics_scene, + const std::vector>& paths, + typename Get_map::type::size_type amark= + Get_map::type::INVALID_MARK) +{ + // Default graphics view options. + Graphics_scene_options_face_graph_with_paths::type::Dart_const_descriptor /*vh*/, + typename Get_map::type::Dart_const_descriptor /*eh*/, + typename Get_map::type::Dart_const_descriptor /*fh*/> + gso; + + add_to_graphics_scene(mesh, graphics_scene, gso, paths, amark); +} + +template +void add_to_graphics_scene(const Mesh& mesh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gso, + std::initializer_list> l, + typename Get_map::type::size_type amark= + Get_map::type::INVALID_MARK) +{ + std::vector> paths=l; + add_to_graphics_scene(mesh, graphics_scene, gso, paths, amark); +} + +template +void add_to_graphics_scene(const Mesh& mesh, + CGAL::Graphics_scene& graphics_scene, + std::initializer_list> l, + typename Get_map::type::size_type amark= + Get_map::type::INVALID_MARK) +{ + std::vector> paths=l; + add_to_graphics_scene(mesh, graphics_scene, paths, amark); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +template +void draw(const Mesh& mesh, + const std::vector >& paths, + const GSOptions& gso, + const char* title="Mesh Viewer With Path", + typename Get_map::type::size_type amark= + (std::numeric_limits::type::size_type>::max)()) +{ + CGAL::Graphics_scene graphics_scene; + add_to_graphics_scene(mesh, graphics_scene, paths, gso, amark); + draw_graphics_scene(graphics_scene, title); +} + +template +void draw(const Mesh& mesh, const std::vector >& paths, const char* title="Mesh Viewer With Path", typename Get_map::type::size_type amark= - (std::numeric_limits::type::size_type>::max)(), - bool nofill=false) + (std::numeric_limits::type::size_type>::max)()) { - DefaultDrawingFunctorLCC f; - draw(alcc, paths, title, amark, nofill, f); + CGAL::Graphics_scene graphics_scene; + add_to_graphics_scene(mesh, graphics_scene, paths, amark); + draw_graphics_scene(graphics_scene, title); +} + +template +void draw(const Mesh& mesh, + std::initializer_list> l, + const GSOptions& gso, + const char* title="Mesh Viewer With Path", + typename Get_map::type::size_type amark= + (std::numeric_limits::type::size_type>::max)()) +{ + std::vector> paths=l; + draw(mesh, paths, gso, title, amark); } template -void draw(const Mesh& alcc, +void draw(const Mesh& mesh, std::initializer_list> l, const char* title="Mesh Viewer With Path", typename Get_map::type::size_type amark= - (std::numeric_limits::type::size_type>::max)(), - bool nofill=false) + (std::numeric_limits::type::size_type>::max)()) { - std::vector > paths=l; - draw(alcc, paths, title, amark, nofill); + std::vector> paths=l; + draw(mesh, paths, title, amark); } -} // End namespace CGAL - -#else // CGAL_USE_BASIC_VIEWER - -namespace CGAL -{ - - template - void draw(const Mesh&, - const std::vector >& , - const char* ="", - typename Get_map::type::size_type= - (std::numeric_limits::type::size_type>::max)(), - bool=false) - { - std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."< - void draw(const Mesh&, - std::initializer_list>, - const char* ="", - typename Get_map::type::size_type= - (std::numeric_limits::type::size_type>::max)(), - bool=false) - { - std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."< +#include +#include /*! \file * * Member-function definitions of the Surface_sweep_2 class-template. */ +#include +#include + namespace CGAL { namespace Surface_sweep_2 { diff --git a/Tetrahedral_remeshing/package_info/Tetrahedral_remeshing/dependencies b/Tetrahedral_remeshing/package_info/Tetrahedral_remeshing/dependencies index f9c578d62a2..adf468cfd1b 100644 --- a/Tetrahedral_remeshing/package_info/Tetrahedral_remeshing/dependencies +++ b/Tetrahedral_remeshing/package_info/Tetrahedral_remeshing/dependencies @@ -20,7 +20,6 @@ Number_types Polygon_mesh_processing Profiling_tools Property_map -Random_numbers SMDS_3 STL_Extension Spatial_sorting diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing.cpp index fffb560ac88..0d09480d987 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/Three/doc/Three/Doxyfile.in b/Three/doc/Three/Doxyfile.in index 60caa240a41..ceb1270502e 100644 --- a/Three/doc/Three/Doxyfile.in +++ b/Three/doc/Three/Doxyfile.in @@ -1,9 +1,9 @@ @INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS} PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Three" -INPUT += ${CGAL_Polyhedron_DEMO_DIR}/Polyhedron/Scene.h \ - ${CGAL_Polyhedron_DEMO_DIR}/Polyhedron/Polyhedron_demo.h \ +INPUT += ${CGAL_Lab_DEMO_DIR}/Lab/Scene.h \ + ${CGAL_Lab_DEMO_DIR}/Lab/cgallab.h \ -EXAMPLE_PATH = ${CGAL_Polyhedron_DEMO_DIR}/Polyhedron/Plugins/ +EXAMPLE_PATH = ${CGAL_Lab_DEMO_DIR}/Lab/Plugins/ IMAGE_PATH = ${CGAL_PACKAGE_DIR}/doc/Three/fig/ EXTRACT_ALL = false diff --git a/Three/doc/Three/PackageDescription.txt b/Three/doc/Three/PackageDescription.txt index f04d3ec8473..067d3fa3763 100644 --- a/Three/doc/Three/PackageDescription.txt +++ b/Three/doc/Three/PackageDescription.txt @@ -20,8 +20,8 @@ \cgalCRPSection{Interfaces} - `CGAL::Three::Viewer_interface` - `CGAL::Three::Scene_interface` -- `CGAL::Three::Polyhedron_demo_plugin_interface` -- `CGAL::Three::Polyhedron_demo_io_plugin_interface` +- `CGAL::Three::CGAL_Lab_plugin_interface` +- `CGAL::Three::CGAL_Lab_io_plugin_interface` \cgalCRPSection{Classes} - `TextRenderer` diff --git a/Three/doc/Three/Three.txt b/Three/doc/Three/Three.txt index 2afe5f4d27c..ba0cc0946aa 100644 --- a/Three/doc/Three/Three.txt +++ b/Three/doc/Three/Three.txt @@ -6,8 +6,8 @@ namespace CGAL { \cgalAutoToc \author Laurent Rineau, Sebastien Loriot, Andreas Fabri, Maxime Gimeno -This package regroups the files making the API for creating and adding a new plugin to the Polyhedron_demo. \n -\section intro Understanding the Polyhedron Demo +This package regroups the files making the API for creating and adding a new plugin to the CGAL_Lab. \n +\section intro Understanding the Lab There are several levels in this demo. @@ -24,22 +24,22 @@ A plugin usually make use of objects that inherit from `CGAL::Three::Scene_item` \subsection examplePluginItself The Plugin Itself -A basic plugin will inherit from `CGAL::Three::Polyhedron_demo_plugin_interface`. +A basic plugin will inherit from `CGAL::Three::CGAL_Lab_plugin_interface`. It must be created in the corresponding folder named after its package, and containing all the files created for the plugin, and a CMakeLists.txt file. Its name must be of the form Xxxx_yyyy_plugin. \n - [init()]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#init(QMainWindow*,CGAL::Three::Scene_interface*,Messages_interface*) - [applicable()]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#applicable() - [actions()]: @ref CGAL::Three::Polyhedron_demo_plugin_interface#actions() + [init()]: @ref CGAL::Three::CGAL_Lab_plugin_interface#init(QMainWindow*,CGAL::Three::Scene_interface*,Messages_interface*) + [applicable()]: @ref CGAL::Three::CGAL_Lab_plugin_interface#applicable() + [actions()]: @ref CGAL::Three::CGAL_Lab_plugin_interface#actions() The class must contain the following lines :\n ~~~~~~~~~~~~~{.cpp} Q_OBJECT - Q_INTERFACES(CGAL::Three::Polyhedron_demo_plugin_interface) - Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") + Q_INTERFACES(CGAL::Three::CGAL_Lab_plugin_interface) + Q_PLUGIN_METADATA(IID "com.geometryfactory.CGALLab.PluginInterface/1.0") ~~~~~~~~~~~~~ -Your plugin must override the three pure virtual functions inherited from Polyhedron_demo_plugin_interface : \n +Your plugin must override the three pure virtual functions inherited from CGAL_Lab_plugin_interface : \n - [actions()] that will hold the actions of the plugin - [applicable()] that will decide if the plugin can be used with the current selection of items - [init()] that will declare and link the actions of the plugin @@ -64,8 +64,8 @@ If you created your plugin in an existing directory, the CMakeLists.txt file alr The CMakeLists.txt file : - include( polyhedron_demo_macros ) - polyhedron_demo_plugin(basic_plugin Basic_plugin) + include( cgal_lab_macros ) + cgal_lab_plugin(basic_plugin Basic_plugin) \subsection basicPluginDialog Adding a Dialog to Your Plugin @@ -85,7 +85,7 @@ Then select among the template/form choices. Name it Xxxx_yyyy_dialog.ui (you may have to rename it once it is created as QtCreator tends to forget the capital letters), and add it to the project in the CMakeLists : qt6_wrap_ui( basicUI_FILES Basic_dialog.ui ) - polyhedron_demo_plugin(basic_plugin Basic_plugin ${basicUI_FILES}) + cgal_lab_plugin(basic_plugin Basic_plugin ${basicUI_FILES}) Add a layout to the dialog with a drag and drop and lay it out. * \image html menu_4.png @@ -115,14 +115,14 @@ It is really simple to add a pop-up box with Qt. Use a QMessageBox and give it s \subsection examplePluginDockWidget Adding a Dock Widget This section describes how to add a dock widget to the application.\n -You can make your plugin inherit from CGAL::Three::Polyhedron_demo_plugin_helper, which gives access to the function CGAL::Three::Polyhedron_demo_plugin_helper#addDockWidget. +You can make your plugin inherit from CGAL::Three::CGAL_Lab_plugin_helper, which gives access to the function CGAL::Three::CGAL_Lab_plugin_helper#addDockWidget. This will manage automatically the position and tabification of a dock widget. \n Just like with the Dialog, create a new Qt Designer form (file->New file or Project->Qt->Qt Designer Form), choose `QDockWidget` in Widgets * \image html menu_6.png Add it to the project in the CMakeLists.txt : qt6_wrap_ui( dockUI_FILES Basic_dock_widget.ui ) - polyhedron_demo_plugin(dock_widget_plugin Dock_widget_plugin ${dockUI_FILES}) + cgal_lab_plugin(dock_widget_plugin Dock_widget_plugin ${dockUI_FILES}) Edit the ui file with the editor, then add the following line to your plugin file: ~~~~~~~~~~~~~{.cpp} @@ -197,7 +197,7 @@ Simply create a new instance of the item you want and call the function CGAL::Th Once your code is written, you will need to link the item's library to your plugin thanks to the CMakeLists, using the command target_link_library : - polyhedron_demo_plugin(basic_item_plugin Basic_item_plugin) + cgal_lab_plugin(basic_item_plugin Basic_item_plugin) # links the library containing the scene_plane_item with the plugin target_link_libraries(basic_item_plugin PUBLIC scene_basic_objects) @@ -249,7 +249,7 @@ All the initialization and containers handling happen in the drawing function, b We start by checking all the switches and call the right initialization functions accordingly. After that, we can set the uniform values and actually draw the content of the containers.\n -If you created your item in a specific file and you need to use it outside your plugin (like in another plugin), it is recommended to put it in the demo's root directory, and you will have to define your item in the general Polyhedron_demo's CMakeLists.txt by using the macro add_item : +If you created your item in a specific file and you need to use it outside your plugin (like in another plugin), it is recommended to put it in the demo's root directory, and you will have to define your item in the general CGAL_Lab's CMakeLists.txt by using the macro add_item : add_item(scene_trivial_item Scene_trivial_item.cpp) target_link_libraries(scene_trivial_item PUBLIC scene_dependances_item) @@ -275,20 +275,20 @@ You also have the possibility to "lock" a child of a group with `CGAL::Three::Sc \section exampleIOPlugin Creating an I/O Plugin An I/O plugin is a plugin desined to load from and save to a certain type of file. Its name is generally of the form Xxxx_yyyy_io_plugin \n -It inherits from the CGAL::Three::Polyhedron_demo_io_plugin_interface. It must implement the following functions : -- CGAL::Three::Polyhedron_demo_io_plugin_interface#name which returns the plugin's name. +It inherits from the CGAL::Three::CGAL_Lab_io_plugin_interface. It must implement the following functions : +- CGAL::Three::CGAL_Lab_io_plugin_interface#name which returns the plugin's name. ~~~~~~~~~~~~~{.cpp} QString name() const { return "Xxxx_yyyy_io_plugin"; } ~~~~~~~~~~~~~ -- CGAL::Three::Polyhedron_demo_io_plugin_interface#nameFilters which returns a list of extensions of the files the plugin can read : +- CGAL::Three::CGAL_Lab_io_plugin_interface#nameFilters which returns a list of extensions of the files the plugin can read : ~~~~~~~~~~~~~{.cpp} QString nameFilters() const { return "Text files (*.txt)"; } ~~~~~~~~~~~~~ -- CGAL::Three::Polyhedron_demo_io_plugin_interface#canLoad which returns true if the plugin is able to load : +- CGAL::Three::CGAL_Lab_io_plugin_interface#canLoad which returns true if the plugin is able to load : ~~~~~~~~~~~~~{.cpp} bool canLoad() const { return true; } ~~~~~~~~~~~~~ -- CGAL::Three::Polyhedron_demo_io_plugin_interface#load : which fills the data of an object from a file : +- CGAL::Three::CGAL_Lab_io_plugin_interface#load : which fills the data of an object from a file : ~~~~~~~~~~~~~{.cpp} CGAL::Three::Scene_item* load(QFileInfo fileinfo) { if(fileinfo.suffix().toLower() != "txt") return 0; @@ -300,13 +300,13 @@ CGAL::Three::Scene_item* load(QFileInfo fileinfo) { return item; } ~~~~~~~~~~~~~ -- CGAL::Three::Polyhedron_demo_io_plugin_interface#canSave which returns true if the plugin is able to save : +- CGAL::Three::CGAL_Lab_io_plugin_interface#canSave which returns true if the plugin is able to save : ~~~~~~~~~~~~~{.cpp} bool canSave(const CGAL::Three::Scene_item* scene_item) { return qobject_cast(scene_item); } ~~~~~~~~~~~~~ -- CGAL::Three::Polyhedron_demo_io_plugin_interface#save which fills a file with the data of an item +- CGAL::Three::CGAL_Lab_io_plugin_interface#save which fills a file with the data of an item ~~~~~~~~~~~~~{.cpp} bool save(const CGAL::Three::Scene_item* scene_item, QFileInfo fileinfo) { const Scene_trivial_item* item = qobject_cast(scene_item); @@ -338,24 +338,24 @@ Configure CMake as you desire and fetch the right Qt6 packages : COMPONENTS OpenGLWidgets Svg OPTIONAL_COMPONENTS WebSockets) -You will probably have to fetch the libraries exported by the Polyhedron_demo, like the Scene_items. +You will probably have to fetch the libraries exported by the CGAL_Lab, like the Scene_items. - find_package(CGAL_polyhedron_demo - HINTS "${CGAL_DIR}" "${CGAL_DIR}/Polyhedron/demo/Polyhedron-build" + find_package(CGAL_cgal_lab + HINTS "${CGAL_DIR}" "${CGAL_DIR}/Lab/demo/Lab-build" ) - include( ${CGAL_POLYHEDRON_DEMO_USE_FILE} ) + include( ${CGAL_LAB_DEMO_USE_FILE} ) -Be careful, the polyhedron_demo build directory must contain a build of the demo that comes from the same CGAL version than the one of your CGAL_DIR. +Be careful, the cgal_lab build directory must contain a build of the demo that comes from the same CGAL version than the one of your CGAL_DIR. Finally, you can declare your plugin - polyhedron_demo_plugin(example_plugin Example_plugin) + cgal_lab_plugin(example_plugin Example_plugin) -If you need targets from the Polyhedron_demo, you will have to add the prefix 'Polyhedron_' to the target's name, as the exported targets belong to the namespace Polyhedron_ +If you need targets from the CGAL_Lab, you will have to add the prefix 'Lab_' to the target's name, as the exported targets belong to the namespace Lab_ - polyhedron_demo_plugin(basic_item_plugin Basic_item_plugin) - target_link_libraries(basic_item_plugin PUBLIC Polyhedron_scene_basic_objects) + cgal_lab_plugin(basic_item_plugin Basic_item_plugin) + target_link_libraries(basic_item_plugin PUBLIC Lab_scene_basic_objects) -Notice that an external plugin will not be automatically loaded in the Polyhedron demo. It must be built in its own project. +Notice that an external plugin will not be automatically loaded in the Lab. It must be built in its own project. Complete CMakeLists : @@ -376,14 +376,14 @@ Notice that an external plugin will not be automatically loaded in the Polyhedro OPTIONAL_COMPONENTS WebSockets) if(Qt6_FOUND AND CGAL_FOUND) - find_package(CGAL_polyhedron_demo) + find_package(CGAL_cgal_lab) - include( ${CGAL_POLYHEDRON_DEMO_USE_FILE} ) + include( ${CGAL_LAB_DEMO_USE_FILE} ) # Let plugins be compiled in the same directory as the executable. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") - polyhedron_demo_plugin(example_plugin Example_plugin) + cgal_lab_plugin(example_plugin Example_plugin) endif() diff --git a/Three/doc/Three/dependencies b/Three/doc/Three/dependencies index a01021f28b7..5860fb8c516 100644 --- a/Three/doc/Three/dependencies +++ b/Three/doc/Three/dependencies @@ -4,4 +4,4 @@ STL_Extension Algebraic_foundations Circulator Stream_support -Polyhedron +Lab diff --git a/Three/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h b/Three/include/CGAL/Three/CGAL_Lab_io_plugin_interface.h similarity index 88% rename from Three/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h rename to Three/include/CGAL/Three/CGAL_Lab_io_plugin_interface.h index 7ab42e87c81..bfad4ad6206 100644 --- a/Three/include/CGAL/Three/Polyhedron_demo_io_plugin_interface.h +++ b/Three/include/CGAL/Three/CGAL_Lab_io_plugin_interface.h @@ -9,9 +9,9 @@ // // // Author(s) : Laurent RINEAU -//! \file Polyhedron_demo_io_plugin_interface.h -#ifndef POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H -#define POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H +//! \file CGAL_Lab_io_plugin_interface.h +#ifndef LAB_DEMO_IO_PLUGIN_INTERFACE_H +#define LAB_DEMO_IO_PLUGIN_INTERFACE_H #include @@ -28,7 +28,7 @@ class Scene_interface; /*! * This class provides a base for creating a new IO plugin. */ -class Polyhedron_demo_io_plugin_interface +class CGAL_Lab_io_plugin_interface { public: //! \brief initializes the plugin @@ -39,7 +39,7 @@ public: //!Returns the name of the plugin //!It is used by the loading system. virtual QString name() const = 0; - virtual ~Polyhedron_demo_io_plugin_interface() {} + virtual ~CGAL_Lab_io_plugin_interface() {} /*! The filters for the names of the files that can be used * by the plugin. * Example : to filter OFF files : return "OFF files (*.off)" @@ -86,7 +86,7 @@ public: }; } } -Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_io_plugin_interface, - "com.geometryfactory.PolyhedronDemo.IOPluginInterface/1.90") +Q_DECLARE_INTERFACE(CGAL::Three::CGAL_Lab_io_plugin_interface, + "com.geometryfactory.CGALLab.IOPluginInterface/1.90") -#endif // POLYHEDRON_DEMO_IO_PLUGIN_INTERFACE_H +#endif // LAB_DEMO_IO_PLUGIN_INTERFACE_H diff --git a/Three/include/CGAL/Three/Polyhedron_demo_plugin_helper.h b/Three/include/CGAL/Three/CGAL_Lab_plugin_helper.h similarity index 88% rename from Three/include/CGAL/Three/Polyhedron_demo_plugin_helper.h rename to Three/include/CGAL/Three/CGAL_Lab_plugin_helper.h index dd04a031e81..7c5f99e3f50 100644 --- a/Three/include/CGAL/Three/Polyhedron_demo_plugin_helper.h +++ b/Three/include/CGAL/Three/CGAL_Lab_plugin_helper.h @@ -10,9 +10,9 @@ // // Author(s) : Laurent RINEAU -//! \file Polyhedron_demo_plugin_helper.h -#ifndef POLYHEDRON_DEMO_OPERATION_HELPER_H -#define POLYHEDRON_DEMO_OPERATION_HELPER_H +//! \file CGAL_Lab_plugin_helper.h +#ifndef LAB_DEMO_OPERATION_HELPER_H +#define LAB_DEMO_OPERATION_HELPER_H #include @@ -28,7 +28,7 @@ struct QMetaObject; class QMainWindow; class QDockWidget; -#include +#include #include namespace CGAL { namespace Three { @@ -36,8 +36,8 @@ namespace Three { * This class provides convenient functions to manage dock_widgets and to access a certain type of items in the scene. * It also provides member variables for a Scene_interface and a QMainWindow. */ -class SCENE_ITEM_EXPORT Polyhedron_demo_plugin_helper - : public Polyhedron_demo_plugin_interface +class SCENE_ITEM_EXPORT CGAL_Lab_plugin_helper + : public CGAL_Lab_plugin_interface { public: @@ -86,4 +86,4 @@ protected: }; } } -#endif // POLYHEDRON_DEMO_OPERATION_HELPER_H +#endif // LAB_DEMO_OPERATION_HELPER_H diff --git a/Three/include/CGAL/Three/Polyhedron_demo_plugin_interface.h b/Three/include/CGAL/Three/CGAL_Lab_plugin_interface.h similarity index 81% rename from Three/include/CGAL/Three/Polyhedron_demo_plugin_interface.h rename to Three/include/CGAL/Three/CGAL_Lab_plugin_interface.h index c0478ae29a8..0ed985acb0a 100644 --- a/Three/include/CGAL/Three/Polyhedron_demo_plugin_interface.h +++ b/Three/include/CGAL/Three/CGAL_Lab_plugin_interface.h @@ -10,9 +10,9 @@ // // Author(s) : Laurent RINEAU -//! \file Polyhedron_demo_plugin_interface.h -#ifndef POLYHEDRON_DEMO_PLUGIN_INTERFACE_H -#define POLYHEDRON_DEMO_PLUGIN_INTERFACE_H +//! \file CGAL_Lab_plugin_interface.h +#ifndef LAB_DEMO_PLUGIN_INTERFACE_H +#define LAB_DEMO_PLUGIN_INTERFACE_H #include @@ -31,7 +31,7 @@ class Scene_interface; /*! * This virtual class provides the basic functions used for making a plugin. */ -class Polyhedron_demo_plugin_interface +class CGAL_Lab_plugin_interface { public: //! \brief initializes the plugin @@ -57,7 +57,7 @@ protected : }; } } -Q_DECLARE_INTERFACE(CGAL::Three::Polyhedron_demo_plugin_interface, - "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") +Q_DECLARE_INTERFACE(CGAL::Three::CGAL_Lab_plugin_interface, + "com.geometryfactory.CGALLab.PluginInterface/1.0") -#endif // POLYHEDRON_DEMO_PLUGIN_INTERFACE_H +#endif // LAB_DEMO_PLUGIN_INTERFACE_H diff --git a/Three/include/CGAL/Three/Scene_interface.h b/Three/include/CGAL/Three/Scene_interface.h index 64441fe197d..e246abdf2de 100644 --- a/Three/include/CGAL/Three/Scene_interface.h +++ b/Three/include/CGAL/Three/Scene_interface.h @@ -87,7 +87,7 @@ public: * @returns -1 if the list is empty.*/ virtual Item_id erase(Item_id) = 0; /*! Deletes the items with the target indices. - * @returns the index of the polyhedron just before the + * @returns the index of the item just before the * one that is erased, or just after. Returns -1 if * the list is empty. */ diff --git a/Three/include/CGAL/Three/Scene_print_item_interface.h b/Three/include/CGAL/Three/Scene_print_item_interface.h index 7a36ee942a4..0960a1e447a 100644 --- a/Three/include/CGAL/Three/Scene_print_item_interface.h +++ b/Three/include/CGAL/Three/Scene_print_item_interface.h @@ -61,6 +61,6 @@ public: } } -Q_DECLARE_INTERFACE(CGAL::Three::Scene_print_item_interface, "com.geometryfactory.PolyhedronDemo.PrintInterface/1.0") +Q_DECLARE_INTERFACE(CGAL::Three::Scene_print_item_interface, "com.geometryfactory.CGALLab.PrintInterface/1.0") #endif // SCENE_PRINT_ITEM_INTERFACE_H diff --git a/Three/include/CGAL/Three/Scene_transparent_interface.h b/Three/include/CGAL/Three/Scene_transparent_interface.h index 3b93c01faf7..5b68d29926f 100644 --- a/Three/include/CGAL/Three/Scene_transparent_interface.h +++ b/Three/include/CGAL/Three/Scene_transparent_interface.h @@ -31,5 +31,5 @@ public: }; } } -Q_DECLARE_INTERFACE(CGAL::Three::Scene_transparent_interface, "com.geometryfactory.PolyhedronDemo.TransparentInterface/1.0") +Q_DECLARE_INTERFACE(CGAL::Three::Scene_transparent_interface, "com.geometryfactory.CGALLab.TransparentInterface/1.0") #endif // SCENE_TRANSPARENT_INTERFACE_H diff --git a/Three/include/CGAL/Three/Scene_zoomable_item_interface.h b/Three/include/CGAL/Three/Scene_zoomable_item_interface.h index a9d864b927b..71221ac911c 100644 --- a/Three/include/CGAL/Three/Scene_zoomable_item_interface.h +++ b/Three/include/CGAL/Three/Scene_zoomable_item_interface.h @@ -31,5 +31,5 @@ public: } } -Q_DECLARE_INTERFACE(CGAL::Three::Scene_zoomable_item_interface, "com.geometryfactory.PolyhedronDemo.ZoomInterface/1.0") +Q_DECLARE_INTERFACE(CGAL::Three::Scene_zoomable_item_interface, "com.geometryfactory.CGALLab.ZoomInterface/1.0") #endif // SCENE_ZOOMABLE_ITEM_INTERFACE_H diff --git a/Three/include/CGAL/Three/Three.h b/Three/include/CGAL/Three/Three.h index 1faa93b3ec0..3dac95792a3 100644 --- a/Three/include/CGAL/Three/Three.h +++ b/Three/include/CGAL/Three/Three.h @@ -40,7 +40,7 @@ namespace CGAL{ namespace Three{ //define enum depending on Qt version -class Polyhedron_demo_plugin_interface; +class CGAL_Lab_plugin_interface; class THREE_EXPORT Three{ public: @@ -84,7 +84,7 @@ public: * a corresponding slot named `on_ActionsName_triggered()` * in the plugin. */ - static void autoConnectActions(CGAL::Three::Polyhedron_demo_plugin_interface* plugin); + static void autoConnectActions(CGAL::Three::CGAL_Lab_plugin_interface* plugin); /*! * Displays in the console a blue text preceded by the mention * "INFO: ". diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/draw_constrained_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/draw_constrained_triangulation_2.h new file mode 100644 index 00000000000..d714a6c5961 --- /dev/null +++ b/Triangulation_2/doc/Triangulation_2/CGAL/draw_constrained_triangulation_2.h @@ -0,0 +1,56 @@ +namespace CGAL { + + /*! +\ingroup PkgDrawConstrainedTriangulation2 + +opens a new window and draws a constrained triangulation. If the triangulation has constraints they are drawn. The faces inside and outside of the domain, based on the property map, are drawn in different colors. + +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 CT2 which must be an instanciation of a `CGAL::Constrained_triangulation_2<...>`. +\tparam InDomainPMap a class model of `ReadablePropertyMap` with `CT2::Face_handle` as key type and `bool` as value type. + +\param ct2 the constrained triangulation to draw. +\param ipm the property map defining the faces which are in the domain. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Constrained_triangulation_2& ct2, InDomainPMap ipm); + +\cgalAdvancedEnd +*/ + template + void draw(const CT2& ct2, InDomainPMap ipm); + +/*! +\ingroup PkgDrawConstrainedTriangulation2 + +adds the vertices, edges and faces of `ct2` into the given graphic scene `gs`. If the triangulation has constraints they are drawn. The faces inside and outside of the domain, based on the property map, are drawn in different colors. Note that `gs` is not cleared before being filled (to enable to draw several data structures in the same basic viewer). + +\tparam CT2 which must be an instanciation of a `CGAL::Constrained_triangulation_2<...>`. +\tparam InDomainPMap a class model of `ReadablePropertyMap` with `CT2::Face_handle` as key type and `bool` as value type. + +\param ct2 the constrained triangulation to draw. +\param ipm the property map defining the faces which are in the domain. +\param gs the graphic scene to fill. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::add_to_graphics_scene(const CGAL::Constrained_triangulation_2& ct2, InDomainPMap ipm, CGAL::Graphics_scene& gs); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const CT2& ct2, InDomainPMap ipm, + CGAL::Graphics_scene& gs); + +} /* namespace CGAL */ diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/draw_triangulation_2.h b/Triangulation_2/doc/Triangulation_2/CGAL/draw_triangulation_2.h index 6ca50c894cf..a7567db9b0a 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/draw_triangulation_2.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/draw_triangulation_2.h @@ -3,41 +3,72 @@ namespace CGAL { /*! \ingroup PkgDrawTriangulation2 -opens a new window and draws a triangulation. If the triangulation -has constraints they are drawn. If the face type has a member -function `bool is_in_domain()` the faces inside and outside of the -domain are drawn in different colors. +opens a new window and draws a triangulation. Parameters of the drawing are taken from the optional graphics scene options parameter. -A call to this function is blocking, that is the program continues as soon as the user closes the window. 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 T2 a triangulation class derived from `Triangulation_2` or `Constrained_triangulation_2` -\param at2 the triangulation to draw. - -*/ -template -void draw(const T2& at2); - - /*! -\ingroup PkgDrawTriangulation2 - -opens a new window and draws a constrained triangulation. If the triangulation -has constraints they are drawn. The faces inside and outside of the -domain, based on the property map, are drawn in different colors. - -A call to this function is blocking, that is the program continues as soon as the user closes the window. This function requires `CGAL_Qt6`, and is only available if the macro `CGAL_USE_BASIC_VIEWER` is defined. +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 CT2 a triangulation class derived from `Constrained_triangulation_2` -\tparam InDomainPMap a class model of `ReadWritePropertyMap` with -`CT::Face_handle` as key type and `bool` as value type. +\tparam T2 which must be an instanciation of a `CGAL::Triangulation_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. -\param act2 the constrained triangulation to draw. -\param ipm the property map defining the faces which are in the domain. +\param at2 the triangulation to draw. +\param gso the graphics scene options parameter. +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Triangulation_2& at2, const GSOptions& gso); + +\cgalAdvancedEnd */ - template - void draw(const CT2& act2, InDomainPMap ipm); + template + void draw(const T2& at2, const GSOptions& gso); + +/*! +\ingroup PkgDrawTriangulation2 + +A shortcut to `CGAL::draw(at2, Graphics_scene_options{})`. +*/ + template + void draw(const T2& at2); + +/*! +\ingroup PkgDrawTriangulation2 + +adds the vertices, edges and faces of `at2` 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 T2 which must be an instanciation of a `CGAL::Triangulation_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param at2 the triangulation 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::Triangulation_2& at2, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const T2& at2, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawTriangulation2 + +A shortcut to `CGAL::add_to_graphics_scene(at2, gs, Graphics_scene_options{})`. +*/ +template +void add_to_graphics_scene(const T2& at2, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt index 2f10c201757..f84ffe376ba 100644 --- a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt +++ b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt @@ -19,6 +19,12 @@ /// \defgroup PkgDrawTriangulation2 Draw a Triangulation 2 /// \ingroup PkgTriangulation2Ref +/*! +\cgalInclude{CGAL/draw_constrained_triangulation_2.h} +*/ +/// \defgroup PkgDrawConstrainedTriangulation2 Draw a Constrained Triangulation 2 +/// \ingroup PkgTriangulation2Ref + /*! \addtogroup PkgTriangulation2Ref \todo check generated documentation diff --git a/Triangulation_2/doc/Triangulation_2/dependencies b/Triangulation_2/doc/Triangulation_2/dependencies index 22ae69dcfef..db6625f491c 100644 --- a/Triangulation_2/doc/Triangulation_2/dependencies +++ b/Triangulation_2/doc/Triangulation_2/dependencies @@ -10,3 +10,4 @@ Triangulation_3 Spatial_sorting Polygon Polyline_simplification_2 +Basic_viewer diff --git a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt index 47374a85998..8f399fa86da 100644 --- a/Triangulation_2/examples/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/examples/Triangulation_2/CMakeLists.txt @@ -16,8 +16,9 @@ foreach(cppfile ${cppfiles}) endforeach() if(CGAL_Qt6_FOUND) - target_link_libraries(polygon_triangulation PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(constrained PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(draw_triangulation_2 PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(polygon_triangulation PUBLIC CGAL::CGAL_Basic_viewer) target_link_libraries(star_conflict_zone PUBLIC CGAL::CGAL_Basic_viewer) else() message(STATUS "NOTICE: Several examples require Qt6 and will not be compiled.") diff --git a/Triangulation_2/examples/Triangulation_2/constrained.cpp b/Triangulation_2/examples/Triangulation_2/constrained.cpp index 9901ec05fd3..3ed1b19a880 100644 --- a/Triangulation_2/examples/Triangulation_2/constrained.cpp +++ b/Triangulation_2/examples/Triangulation_2/constrained.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -27,5 +28,8 @@ main( ) ++count; std::cout << "The number of resulting constrained edges is "; std::cout << count << std::endl; + + CGAL::draw(cdt); + return 0; } diff --git a/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp b/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp index 405f7eb5516..698ff58b99b 100644 --- a/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp +++ b/Triangulation_2/examples/Triangulation_2/polygon_triangulation.cpp @@ -1,8 +1,9 @@ #include #include -#include #include #include +#include +#include "polygon_triangulation_graphics_scene_options.h" #include #include @@ -57,6 +58,7 @@ int main( ) assert(count > 0); assert(count < cdt.number_of_faces()); - CGAL::draw(cdt, in_domain); + Polygon_triangulation_gs_options gso(in_domain); + CGAL::draw(cdt, gso); return 0; } diff --git a/Triangulation_2/examples/Triangulation_2/polygon_triangulation_graphics_scene_options.h b/Triangulation_2/examples/Triangulation_2/polygon_triangulation_graphics_scene_options.h new file mode 100644 index 00000000000..4768211fdfa --- /dev/null +++ b/Triangulation_2/examples/Triangulation_2/polygon_triangulation_graphics_scene_options.h @@ -0,0 +1,54 @@ +// Copyright(c) 2022 GeometryFactory (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) : Andreas Fabri + +#ifndef CGAL_POLYGON_TRIANGULATION_GRAPHICS_SCENE_OPTIONS_H +#define CGAL_POLYGON_TRIANGULATION_GRAPHICS_SCENE_OPTIONS_H + +#include +#include + +template +struct Polygon_triangulation_gs_options : + public CGAL::Graphics_scene_options +{ + using T2=typename PT::Triangulation; + template + Polygon_triangulation_gs_options(IPM ipm) + { + this->colored_face = + [](const T2&, const typename PT::Finite_faces_iterator) -> bool + { return true; }; + + this->face_color = + [](const T2&, const typename PT::Finite_faces_iterator fh) -> CGAL::IO::Color + { + CGAL::Random random((unsigned int)(std::size_t)(&*fh)); + return get_random_color(random); + }; + + this->draw_face= + [ipm](const T2&, const typename PT::Finite_faces_iterator fh) -> bool + { return get(ipm, fh); }; + + this->draw_edge= + [ipm](const T2& pt, const typename PT::Finite_edges_iterator eh) -> bool + { + typename PT::Face_handle fh1=eh->first; + typename PT::Face_handle fh2=pt.mirror_edge(*eh).first; + return get(ipm, fh1) || get(ipm, fh2); + }; + } +}; + +#endif // CGAL_POLYGON_TRIANGULATION_GRAPHICS_SCENE_OPTIONS_H diff --git a/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h b/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h index 322f4837f4e..05d933f92e9 100644 --- a/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h +++ b/Triangulation_2/include/CGAL/draw_constrained_triangulation_2.h @@ -13,168 +13,98 @@ #define CGAL_DRAW_CT2_H #include -#include #include #include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include +#include namespace CGAL { -// Viewer class for T2 - template -class SimpleConstrainedTriangulation2ViewerQt : public Basic_viewer_qt +template +struct Graphics_scene_options_constrained_triangulation_2: + public CGAL::Graphics_scene_options { - typedef Basic_viewer_qt Base; - typedef typename T2::Vertex_handle Vertex_const_handle; - typedef typename T2::Finite_edges_iterator Edge_const_handle; - typedef typename T2::Finite_faces_iterator Facet_const_handle; - typedef typename T2::Point Point; + using BASET2=typename CDT::Triangulation; -public: - /// Construct the viewer. - /// @param at2 the t2 to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big object where this time could be long) - SimpleConstrainedTriangulation2ViewerQt(QWidget* parent, const T2& at2, - InDomainPmap ipm, - const char* title="Basic CDT2 Viewer", - bool anofaces=false) : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, true, true, true, false, false), - t2(at2), - ipm(ipm), - m_nofaces(anofaces) + Graphics_scene_options_constrained_triangulation_2(const CDT& cdt) { - compute_elements(); - } + this->colored_edge = + [&cdt](const BASET2&, typename CDT::Finite_edges_iterator eh) -> bool + { return cdt.is_constrained(*eh); }; -protected: - void compute_face(Facet_const_handle fh) + this->edge_color = + [&cdt](const BASET2&, typename CDT::Finite_edges_iterator eh) -> CGAL::IO::Color + { return cdt.is_constrained(*eh)? CGAL::IO::green() : CGAL::IO::black(); }; + }; + + template + Graphics_scene_options_constrained_triangulation_2(const CDT& cdt, InDomainPmap ipm) { - CGAL::IO::Color c = get(ipm, fh)? CGAL::IO::yellow() : CGAL::IO::white(); - face_begin(c); + this->colored_edge = + [&cdt](const BASET2&, typename CDT::Finite_edges_iterator eh) -> bool + { return cdt.is_constrained(*eh); }; - add_point_in_face(fh->vertex(0)->point()); - add_point_in_face(fh->vertex(1)->point()); - add_point_in_face(fh->vertex(2)->point()); + this->edge_color = + [&cdt](const BASET2&, typename CDT::Finite_edges_iterator eh) -> CGAL::IO::Color + { return cdt.is_constrained(*eh)? CGAL::IO::green() : CGAL::IO::black(); }; - face_end(); - } + this->colored_face = + [](const BASET2&, typename CDT::Finite_faces_iterator) -> bool + { return true; }; - void compute_edge(Edge_const_handle eh) - { - CGAL::IO::Color c = t2.is_constrained(*eh)? CGAL::IO::green() : CGAL::IO::black(); - add_segment(eh->first->vertex(eh->first->cw(eh->second))->point(), - eh->first->vertex(eh->first->ccw(eh->second))->point(), - c); - } - - void compute_vertex(Vertex_const_handle vh) - { add_point(vh->point()); } - - void compute_elements() - { - clear(); - - if (!m_nofaces) - { - for (typename T2::Finite_faces_iterator it=t2.finite_faces_begin(); - it!=t2.finite_faces_end(); ++it) - { compute_face(it); } - } - - for (typename T2::Finite_edges_iterator it=t2.finite_edges_begin(); - it!=t2.finite_edges_end(); ++it) - { compute_edge(it); } - - for (typename T2::Finite_vertices_iterator it=t2.finite_vertices_begin(); - it!=t2.finite_vertices_end(); ++it) - { compute_vertex(it); } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - -protected: - const T2& t2; - InDomainPmap ipm; - bool m_nofaces; + this->face_color = + [ipm](const BASET2&, typename CDT::Finite_faces_iterator fh) -> CGAL::IO::Color + { return get(ipm, fh)? CGAL::IO::blue() : CGAL::IO::white(); }; + }; }; // Specialization of draw function. #define CGAL_T2_TYPE CGAL::Constrained_triangulation_2 -template -void draw(const CGAL_T2_TYPE& at2, - InDomainPmap ipm) +template +void add_to_graphics_scene(const CGAL_T2_TYPE& at2, InDomainPmap ipm, + CGAL::Graphics_scene& graphics_scene) { - const char* title="Constrained_triangulation_2 Basic Viewer"; - bool nofill=false; - -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"t2_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - SimpleConstrainedTriangulation2ViewerQt - mainwindow(app.activeWindow(), at2, ipm, title, nofill); - mainwindow.show(); - app.exec(); - } + Graphics_scene_options_constrained_triangulation_2 gso(at2, ipm); + draw_function_for_t2::compute_elements(at2, graphics_scene, gso); } +template +void add_to_graphics_scene(const CGAL_T2_TYPE& at2, + CGAL::Graphics_scene& graphics_scene) +{ + Graphics_scene_options_constrained_triangulation_2 gso(at2); + draw_function_for_t2::compute_elements(at2, graphics_scene, gso); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +template +void draw(const CGAL_T2_TYPE& at2, InDomainPmap ipm, + const char *title="Constrained Triangulation_2 Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(at2, ipm, buffer); + draw_graphics_scene(buffer, title); +} template -void draw(const CGAL_T2_TYPE& at2) +void draw(const CGAL_T2_TYPE& at2, + const char *title="Constrained Triangulation_2 Basic Viewer") { - internal::In_domain in_domain; - draw(at2, in_domain); + CGAL::Graphics_scene buffer; + add_to_graphics_scene(at2, buffer); + draw_graphics_scene(buffer, title); } -#undef CGAL_T2_TYPE - -} // End namespace CGAL - -#else - -namespace CGAL { -// Specialization of draw function. -#define CGAL_T2_TYPE CGAL::Constrained_triangulation_2 - -template -void draw(const CGAL_T2_TYPE& , - InDomainPmap ) -{} -#undef CGAL_T2_TYPE - -} // End namespace CGAL - #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_T2_TYPE + +} // End namespace CGAL + #endif // CGAL_DRAW_CT2_H diff --git a/Triangulation_2/include/CGAL/draw_triangulation_2.h b/Triangulation_2/include/CGAL/draw_triangulation_2.h index 4c194f40dd4..32a42879ae4 100644 --- a/Triangulation_2/include/CGAL/draw_triangulation_2.h +++ b/Triangulation_2/include/CGAL/draw_triangulation_2.h @@ -8,162 +8,168 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_T2_H #define CGAL_DRAW_T2_H #include -#include - -#include - +#include +#include +#include #include +#include + +namespace CGAL { + +namespace draw_function_for_t2 { + +template +void compute_face(const T2& t2, + typename T2::Finite_faces_iterator fh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (!gs_options.draw_face(t2, fh)) + { return; } + + if (gs_options.colored_face(t2, fh)) + { graphics_scene.face_begin(gs_options.face_color(t2, fh)); } + else + { graphics_scene.face_begin(); } + + graphics_scene.add_point_in_face(fh->vertex(0)->point()); + graphics_scene.add_point_in_face(fh->vertex(1)->point()); + graphics_scene.add_point_in_face(fh->vertex(2)->point()); + + graphics_scene.face_end(); +} + +template +void compute_edge(const T2& t2, typename T2::Finite_edges_iterator eh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (!gs_options.draw_edge(t2, eh)) + { return; } + + if (gs_options.colored_edge(t2, eh)) + { + graphics_scene.add_segment + (eh->first->vertex(eh->first->cw(eh->second))->point(), + eh->first->vertex(eh->first->ccw(eh->second))->point(), + gs_options.edge_color(t2, eh)); + } + else + { + graphics_scene.add_segment + (eh->first->vertex(eh->first->cw(eh->second))->point(), + eh->first->vertex(eh->first->ccw(eh->second))->point()); + } +} + +template +void compute_vertex(const T2& t2, typename T2::Vertex_handle vh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (!gs_options.draw_vertex(t2, vh)) + { return; } + + if (gs_options.colored_vertex(t2, vh)) + { graphics_scene.add_point(vh->point(), gs_options.vertex_color(t2, vh)); } + else + { graphics_scene.add_point(vh->point()); } +} + +template +void compute_elements(const T2& t2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (gs_options.are_faces_enabled()) + { + for (typename T2::Finite_faces_iterator it=t2.finite_faces_begin(); + it!=t2.finite_faces_end(); ++it) + { compute_face(t2, it, graphics_scene, gs_options); } + } + + if (gs_options.are_edges_enabled()) + { + for (typename T2::Finite_edges_iterator it=t2.finite_edges_begin(); + it!=t2.finite_edges_end(); ++it) + { compute_edge(t2, it, graphics_scene, gs_options); } + } + + if (gs_options.are_vertices_enabled()) + { + for (typename T2::Finite_vertices_iterator it=t2.finite_vertices_begin(); + it!=t2.finite_vertices_end(); ++it) + { compute_vertex(t2, it, graphics_scene, gs_options); } + } +} + +} // namespace draw_function_for_t2 + +#define CGAL_T2_TYPE CGAL::Triangulation_2 + +template +void add_to_graphics_scene(const CGAL_T2_TYPE& at2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + draw_function_for_t2::compute_elements(at2, graphics_scene, gs_options); +} + +template +void add_to_graphics_scene(const CGAL_T2_TYPE& at2, + CGAL::Graphics_scene& graphics_scene) +{ + Graphics_scene_options + drawingFunctor; + + drawingFunctor.colored_face = + [](const CGAL_T2_TYPE&, const typename CGAL_T2_TYPE::Finite_faces_iterator) -> bool + { return true; }; + + drawingFunctor.face_color = + [](const CGAL_T2_TYPE&, const typename CGAL_T2_TYPE::Finite_faces_iterator fh) -> CGAL::IO::Color + { + CGAL::Random random((unsigned int)(std::size_t)(&*fh)); + return get_random_color(random); + }; + + add_to_graphics_scene(at2, graphics_scene, drawingFunctor); +} #ifdef CGAL_USE_BASIC_VIEWER -#include -#include - -namespace CGAL -{ - -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorT2 -{ - template - static CGAL::IO::Color run(const T2&, - const typename T2::Finite_faces_iterator fh) - { - CGAL::Random random((unsigned int)(std::size_t)(&*fh)); - return get_random_color(random); - } -}; - -// Viewer class for T2 -template -class SimpleTriangulation2ViewerQt : public Basic_viewer_qt -{ - typedef Basic_viewer_qt Base; - typedef typename T2::Vertex_handle Vertex_const_handle; - typedef typename T2::Finite_edges_iterator Edge_const_handle; - typedef typename T2::Finite_faces_iterator Facet_const_handle; - typedef typename T2::Point Point; - -public: - /// Construct the viewer. - /// @param at2 the t2 to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big object where this time could be long) - SimpleTriangulation2ViewerQt(QWidget* parent, const T2& at2, - const char* title="Basic T2 Viewer", - bool anofaces=false, - const ColorFunctor& fcolor=ColorFunctor()) : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, true, true, true, false, false), - t2(at2), - m_nofaces(anofaces), - m_fcolor(fcolor) - { - compute_elements(); - } - -protected: - void compute_face(Facet_const_handle fh) - { - CGAL::IO::Color c=m_fcolor.run(t2, fh); - face_begin(c); - - add_point_in_face(fh->vertex(0)->point()); - add_point_in_face(fh->vertex(1)->point()); - add_point_in_face(fh->vertex(2)->point()); - - face_end(); - } - - void compute_edge(Edge_const_handle eh) - { - add_segment(eh->first->vertex(eh->first->cw(eh->second))->point(), - eh->first->vertex(eh->first->ccw(eh->second))->point()); - } - - void compute_vertex(Vertex_const_handle vh) - { add_point(vh->point()); } - - void compute_elements() - { - clear(); - - if (!m_nofaces) - { - for (typename T2::Finite_faces_iterator it=t2.finite_faces_begin(); - it!=t2.finite_faces_end(); ++it) - { compute_face(it); } - } - - for (typename T2::Finite_edges_iterator it=t2.finite_edges_begin(); - it!=t2.finite_edges_end(); ++it) - { compute_edge(it); } - - for (typename T2::Finite_vertices_iterator it=t2.finite_vertices_begin(); - it!=t2.finite_vertices_end(); ++it) - { compute_vertex(it); } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - -protected: - const T2& t2; - bool m_nofaces; - const ColorFunctor& m_fcolor; -}; - // Specialization of draw function. -#define CGAL_T2_TYPE CGAL::Triangulation_2 - -template -void draw(const CGAL_T2_TYPE& at2) +template +void draw(const CGAL_T2_TYPE &at2, const GSOptions &gs_options, + const char *title="Triangulation_2 Basic Viewer") { - const char* title="Triangulation_2 Basic Viewer"; - bool nofill=false; -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"t2_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - DefaultColorFunctorT2 fcolor; - SimpleTriangulation2ViewerQt - mainwindow(app.activeWindow(), at2, title, nofill, fcolor); - mainwindow.show(); - app.exec(); - } + CGAL::Graphics_scene buffer; + add_to_graphics_scene(at2, buffer, gs_options); + draw_graphics_scene(buffer, title); } +template +void draw(const CGAL_T2_TYPE& at2, + const char *title="Triangulation_2 Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(at2, buffer); + draw_graphics_scene(buffer, title); +} + +#endif // CGAL_USE_BASIC_VIEWER + #undef CGAL_T2_TYPE } // End namespace CGAL -#endif // CGAL_USE_BASIC_VIEWER - #endif // CGAL_DRAW_T2_H diff --git a/Triangulation_2/package_info/Triangulation_2/dependencies b/Triangulation_2/package_info/Triangulation_2/dependencies index e5682c45523..c023330d6ae 100644 --- a/Triangulation_2/package_info/Triangulation_2/dependencies +++ b/Triangulation_2/package_info/Triangulation_2/dependencies @@ -1,13 +1,13 @@ Algebraic_foundations Arithmetic_kernel BGL +Basic_viewer CGAL_Core Cartesian_kernel Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView Hash_map Homogeneous_kernel Installation @@ -21,6 +21,7 @@ Number_types Polygon Profiling_tools Property_map +Random_numbers STL_Extension Spatial_sorting Stream_support diff --git a/Triangulation_3/demo/Triangulation_3/MainWindow.cpp b/Triangulation_3/demo/Triangulation_3/MainWindow.cpp index 030948e7a2c..aad061f5e44 100644 --- a/Triangulation_3/demo/Triangulation_3/MainWindow.cpp +++ b/Triangulation_3/demo/Triangulation_3/MainWindow.cpp @@ -137,6 +137,7 @@ void MainWindow::on_actionLoad_Points_triggered() // update viewer Q_EMIT( sceneChanged() ); + viewer->changed(); } void MainWindow::on_actionSave_Points_triggered() diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/draw_triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/draw_triangulation_3.h index 82d1caf9124..5c8c0d041c1 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/draw_triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/draw_triangulation_3.h @@ -3,14 +3,72 @@ namespace CGAL { /*! \ingroup PkgDrawTriangulation3 -opens a new window and draws `at3`, a model of the `TriangulationDataStructure_3` concept. A call to this function is blocking, that is the program continues as soon as the user closes the window. 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 T3 a model of the `TriangulationDataStructure_3` concept. -\param at3 the triangulation to draw. +opens a new window and draws a 3D triangulation. 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 T3 which must be an instanciation of a `CGAL::Triangulation_3<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param at3 the triangulation to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Triangulation_3& at3, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void draw(const T3& at3, const GSOptions& gso); + +/*! +\ingroup PkgDrawTriangulation3 + A shortcut to `CGAL::draw(at3, Graphics_scene_options{})`. +*/ + template + void draw(const T3& at3); + +/*! +\ingroup PkgDrawTriangulation3 + +adds the vertices, edges and faces of `at3` 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 T3 which must be an instanciation of a `CGAL::Triangulation_3<...>`. +\tparam GSOptions a model of `GraphicsSceneOptions` concept. + +\param at3 the triangulation 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::Triangulation_3& at3, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const T3& at3, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawTriangulation3 + +A shortcut to `CGAL::add_to_graphics_scene(at3, gs, Graphics_scene_options{})`. */ template -void draw(const T3& at3); +void add_to_graphics_scene(const T3& at3, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Triangulation_3/include/CGAL/draw_triangulation_3.h b/Triangulation_3/include/CGAL/draw_triangulation_3.h index ddea4548d1b..376b73b8c53 100644 --- a/Triangulation_3/include/CGAL/draw_triangulation_3.h +++ b/Triangulation_3/include/CGAL/draw_triangulation_3.h @@ -8,165 +8,176 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand +// Mostafa Ashraf #ifndef CGAL_DRAW_T3_H #define CGAL_DRAW_T3_H #include -#include +#include +#include +#include +#include +#include + +namespace CGAL { + +namespace draw_function_for_t3 +{ + +template +void compute_face(typename T3::Finite_facets_iterator fh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options, const T3 *t3) +{ + if(!gs_options.draw_face(*t3, fh)) + { return; } + + if(gs_options.colored_face(*t3, fh)) + { graphics_scene.face_begin(gs_options.face_color(*t3, fh)); } + else + { graphics_scene.face_begin(); } + + graphics_scene.add_point_in_face(fh->first->vertex((fh->second + 1) % 4)-> + point()); + graphics_scene.add_point_in_face(fh->first->vertex((fh->second + 2) % 4)-> + point()); + graphics_scene.add_point_in_face(fh->first->vertex((fh->second + 3) % 4)-> + point()); + + graphics_scene.face_end(); +} + +template +void compute_edge(typename T3::Finite_edges_iterator eh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options, const T3* t3) +{ + if(!gs_options.draw_edge(*t3, eh)) + { return; } + + if(gs_options.colored_edge(*t3, eh)) + { + graphics_scene.add_segment(eh->first->vertex(eh->second)->point(), + eh->first->vertex(eh->third)->point(), + gs_options.edge_color(*t3, eh)); + } + else + { + graphics_scene.add_segment(eh->first->vertex(eh->second)->point(), + eh->first->vertex(eh->third)->point()); + } +} + +template +void compute_vertex(typename T3::Vertex_handle vh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options, const T3* t3) +{ + if(!gs_options.draw_vertex(*t3, vh)) + { return; } + + if(gs_options.colored_vertex(*t3, vh)) + { + graphics_scene.add_point(vh->point(), gs_options.vertex_color(*t3, vh)); + } + else + { graphics_scene.add_point(vh->point()); } +} + +template +void compute_elements(const T3* t3, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if (gs_options.are_faces_enabled()) + { + for (typename T3::Finite_facets_iterator it=t3->finite_facets_begin(); + it!=t3->finite_facets_end(); ++it) + { compute_face(it, graphics_scene, gs_options, t3); } + } + + if (gs_options.are_edges_enabled()) + { + for (typename T3::Finite_edges_iterator it=t3->finite_edges_begin(); + it!=t3->finite_edges_end(); ++it) + { compute_edge(it, graphics_scene, gs_options, t3); } + } + + if (gs_options.are_vertices_enabled()) + { + for (typename T3::Finite_vertices_iterator it=t3->finite_vertices_begin(); + it!=t3->finite_vertices_end(); ++it) + { compute_vertex(it, graphics_scene, gs_options, t3); } + } +} + +} // namespace draw_function_for_t3 + +#define CGAL_T3_TYPE CGAL::Triangulation_3 + +template +void add_to_graphics_scene(const CGAL_T3_TYPE& at3, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + draw_function_for_t3::compute_elements(&at3, graphics_scene, gs_options); +} + +template +void add_to_graphics_scene(const CGAL_T3_TYPE& at3, + CGAL::Graphics_scene& graphics_scene) +{ + CGAL::Graphics_scene_options + gs_options; + + gs_options.colored_face = + [](const CGAL_T3_TYPE &, const typename CGAL_T3_TYPE::Finite_facets_iterator) -> bool + { return true; }; + + gs_options.face_color = + [](const CGAL_T3_TYPE &at3, const typename CGAL_T3_TYPE::Finite_facets_iterator fh) -> CGAL::IO::Color + { + if (fh==at3.finite_facets_end()) // use to get the mono color + return CGAL::IO::Color(100, 125, 200); // R G B between 0-255 + + CGAL::Random random((unsigned int)((std::size_t)(&*(fh->first)) + + (std::size_t)(fh->second))); + + return get_random_color(random); + }; + + add_to_graphics_scene(at3, graphics_scene, gs_options); +} #ifdef CGAL_USE_BASIC_VIEWER -#include -#include -#include - -namespace CGAL -{ - -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorT3 -{ - template - static CGAL::IO::Color run(const T3&, - const typename T3::Finite_facets_iterator* fh) - { - if (fh==nullptr) // use to get the mono color - return CGAL::IO::Color(100, 125, 200); // R G B between 0-255 - - CGAL::Random random((unsigned int)((std::size_t)(&*((*fh)->first))+ - (std::size_t)((*fh)->second))); - return get_random_color(random); - } -}; - -// Viewer class for T3 -template -class SimpleTriangulation3ViewerQt : public Basic_viewer_qt -{ - typedef Basic_viewer_qt Base; - typedef typename T3::Vertex_handle Vertex_const_handle; - typedef typename T3::Finite_edges_iterator Edge_const_handle; - typedef typename T3::Finite_facets_iterator Facet_const_handle; - typedef typename T3::Cell_handle Cell_handle; - typedef typename T3::Point Point; - -public: - /// Construct the viewer. - /// @param at3 the t3 to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this can be - /// useful for very big object where this time could be long) - SimpleTriangulation3ViewerQt(QWidget* parent, - const T3& at3, - const char* title="Basic T3 Viewer", - bool anofaces=false, - const ColorFunctor& fcolor=ColorFunctor()) : - // First draw: vertices; edges, faces; multi-color; no inverse normal - Base(parent, title, true, true, true, false, false), - t3(at3), - m_nofaces(anofaces), - m_fcolor(fcolor) - { - compute_elements(); - } - -protected: - void compute_face(Facet_const_handle fh) - { - CGAL::IO::Color c=m_fcolor.run(t3, &fh); - face_begin(c); - - add_point_in_face(fh->first->vertex((fh->second+1)%4)->point()); - add_point_in_face(fh->first->vertex((fh->second+2)%4)->point()); - add_point_in_face(fh->first->vertex((fh->second+3)%4)->point()); - - face_end(); - } - - void compute_edge(Edge_const_handle eh) - { - add_segment(eh->first->vertex(eh->second)->point(), - eh->first->vertex(eh->third)->point()); - } - - void compute_vertex(Vertex_const_handle vh) - { add_point(vh->point()); } - - void compute_elements() - { - clear(); - - if (!m_nofaces) - { - for (typename T3::Finite_facets_iterator it=t3.finite_facets_begin(); - it!=t3.finite_facets_end(); ++it) - { compute_face(it); } - } - - for (typename T3::Finite_edges_iterator it=t3.finite_edges_begin(); - it!=t3.finite_edges_end(); ++it) - { compute_edge(it); } - - for (typename T3::Finite_vertices_iterator it=t3.finite_vertices_begin(); - it!=t3.finite_vertices_end(); ++it) - { compute_vertex(it); } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - // Test key pressed: - // const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - // if ((e->key()==Qt::Key_PageUp) && (modifiers==Qt::NoButton)) { ... } - - // Call: * compute_elements() if the model changed, followed by - // * redraw() if some viewing parameters changed that implies some - // modifications of the buffers - // (eg. type of normal, color/mono) - // * update() just to update the drawing - - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - -protected: - const T3& t3; - bool m_nofaces; - const ColorFunctor& m_fcolor; -}; - // Specialization of draw function. -#define CGAL_T3_TYPE CGAL::Triangulation_3 - -template -void draw(const CGAL_T3_TYPE& at3, - const char* title="T3 Basic Viewer", - bool nofill=false) +template +void draw(const CGAL_T3_TYPE &at3, const GSOptions &gs_options, + const char *title="T3 Basic Viewer") { -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite=true; -#else - bool cgal_test_suite=qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) - { - CGAL::Qt::init_ogl_context(4,3); - int argc=1; - const char* argv[2]={"t3_viewer", nullptr}; - QApplication app(argc,const_cast(argv)); - DefaultColorFunctorT3 fcolor; - SimpleTriangulation3ViewerQt - mainwindow(app.activeWindow(), at3, title, nofill, fcolor); - mainwindow.show(); - app.exec(); - } + CGAL::Graphics_scene buffer; + add_to_graphics_scene(at3, buffer, gs_options); + draw_graphics_scene(buffer, title); } +template +void draw(const CGAL_T3_TYPE &at3, const char *title="T3 Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(at3, buffer); + draw_graphics_scene(buffer, title); +} + +#endif // CGAL_USE_BASIC_VIEWER + #undef CGAL_T3_TYPE } // End namespace CGAL -#endif // CGAL_USE_BASIC_VIEWER - #endif // CGAL_DRAW_T3_H diff --git a/Triangulation_3/package_info/Triangulation_3/dependencies b/Triangulation_3/package_info/Triangulation_3/dependencies index 15e6860497e..2f40be389e2 100644 --- a/Triangulation_3/package_info/Triangulation_3/dependencies +++ b/Triangulation_3/package_info/Triangulation_3/dependencies @@ -1,13 +1,13 @@ Algebraic_foundations Arithmetic_kernel BGL +Basic_viewer CGAL_Core Cartesian_kernel Circulator Distance_2 Distance_3 Filtered_kernel -GraphicsView Hash_map Homogeneous_kernel Installation @@ -18,11 +18,14 @@ Kernel_23 Kernel_d Modular_arithmetic Number_types +Polygon Profiling_tools Property_map Random_numbers STL_Extension Spatial_sorting Stream_support +TDS_2 TDS_3 +Triangulation_2 Triangulation_3 diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index 4998791123e..85fff794a2f 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -23,17 +23,8 @@ create_single_source_cgal_program("test_RT_cell_base_with_weighted_circumcenter_ create_single_source_cgal_program("test_robust_weighted_circumcenter.cpp") create_single_source_cgal_program("test_simplex_3.cpp") create_single_source_cgal_program("test_segment_simplex_traverser_3.cpp" ) -if(cxx_std_17 IN_LIST CMAKE_CXX_COMPILE_FEATURES) - create_single_source_cgal_program("test_simplex_iterator_3.cpp" ) - create_single_source_cgal_program("test_segment_cell_traverser_3.cpp" ) - target_compile_features(test_simplex_iterator_3 PRIVATE cxx_std_17) - target_compile_features(test_segment_simplex_traverser_3 PRIVATE cxx_std_17) -else() - message( - STATUS - "NOTICE: test_simplex_iterator_3.cpp and test_segment_simplex_traverser_3.cpp require C++17 and will not be compiled." - ) -endif() +create_single_source_cgal_program("test_simplex_iterator_3.cpp" ) +create_single_source_cgal_program("test_segment_cell_traverser_3.cpp" ) create_single_source_cgal_program("test_static_filters.cpp") create_single_source_cgal_program("test_triangulation_3.cpp") create_single_source_cgal_program("test_io_triangulation_3.cpp") diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h b/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h index 530bcaf5dda..8298b7b1a52 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h @@ -3,16 +3,94 @@ namespace CGAL { /*! \ingroup PkgDrawVoronoiDiagram2 -opens a new window and draws `av2`, the `Voronoi_diagram_2` constructed from a Delaunay Graph which is a model of `DelaunayGraph_2` concept. -The class `Voronoi_diagram_2` provides an adaptor to view a triangulated Delaunay graph as their dual subdivision, the -Voronoi diagram. A call to this function is blocking, that is the program continues as soon as the user closes the window. -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 V2 a model of the `AdaptationTraits_2` concept. -\param av2 the voronoi diagram to draw. +The class `Graphics_scene_options_voronoi_diagram_2` defines data and methods used to tune the way that the cells of a `Voronoi_diagram_2` are considered for drawing or to be added into a graphics scene. +This class is a model of `GraphicsSceneOptionsVoronoiDiagram2`. + +\tparam DS a `CGAL::Voronoi_diagram_2`. +\tparam VertexDescriptor a descriptor of vertices of `DS`. +\tparam EdgeDescriptor a descriptor of edges of `DS`. +\tparam FaceDescriptor a descriptor of faces of `DS`. + +\cgalModels{GraphicsSceneOptionsVoronoiDiagram2} */ -template -void draw(const V2& av2); + +template +struct Graphics_scene_options_voronoi_diagram_2: public CGAL::Graphics_scene_options +{}; + +/*! +\ingroup PkgDrawVoronoiDiagram2 + +opens a new window and draws a 2D voronoi diagram. 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 VD2 which must be an instanciation of a `CGAL::Voronoi_diagram_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptionsVoronoiDiagram2` concept. + +\param vd2 the voronoi diagram to draw. +\param gso the graphics scene options parameter. + +\cgalAdvancedBegin +The real declaration of this function template is: + + + template + + void CGAL::draw(const CGAL::Voronoi_diagram_2& vd2, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void draw(const VD2& vd2, const GSOptions& gso); + +/*! +\ingroup PkgDrawVoronoiDiagram2 + +A shortcut to `CGAL::draw(vd2, Graphics_scene_options_voronoi_diagram_2{})`. +*/ +template +void draw(const VD2& vd2); + +/*! +\ingroup PkgDrawVoronoiDiagram2 + +adds the vertices, edges and faces of `vd2` 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 VD2 which must be an instanciation of a `CGAL::Voronoi_diagram_2<...>`. +\tparam GSOptions a model of `GraphicsSceneOptionsVoronoiDiagram2` concept. + +\param vd2 the voronoi diagram 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::Voronoi_diagram_2& vd2, CGAL::Graphics_scene& gs, const GSOptions& gso); + +\cgalAdvancedEnd +*/ +template +void add_to_graphics_scene(const VD2& vd2, + CGAL::Graphics_scene& gs, + const GSOptions& gso); + +/*! +\ingroup PkgDrawVoronoiDiagram2 + +A shortcut to `CGAL::add_to_graphics_scene(vd2, gs, Graphics_scene_options_voronoi_diagram_2{})`. +*/ +template +void add_to_graphics_scene(const VD2& vd2, + CGAL::Graphics_scene& gs); } /* namespace CGAL */ diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/GraphicsSceneOptionsVoronoiDiagram2.h b/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/GraphicsSceneOptionsVoronoiDiagram2.h new file mode 100644 index 00000000000..42c8baee972 --- /dev/null +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/Concepts/GraphicsSceneOptionsVoronoiDiagram2.h @@ -0,0 +1,46 @@ +/*! +\ingroup PkgVoronoiDiagram2Concepts + +The concept `GraphicsSceneOptionsVoronoiDiagram2` defines data and methods used to tune the way that the cells of a `Voronoi_diagram_2` are considered for drawing or to be added into a graphics scene. + +\cgalRefines{GraphicsSceneOptions} + +\cgalHasModelsBegin +\cgalHasModelsBare{\link CGAL::Graphics_scene_options_voronoi_diagram_2 `CGAL::Graphics_scene_options_voronoi_diagram_2`\endlink} +\cgalHasModelsEnd + +*/ +class GraphicsSceneOptionsVoronoiDiagram2 +{ +public: + /// returns the color of the dual vertices. + const CGAL::IO::Color& dual_vertex_color() const; + /// sets the color of dual vertices to `c`. + void dual_vertex_color(const CGAL::IO::Color& c); + + /// returns the color of rays. + const CGAL::IO::Color& ray_color() const; + /// sets the color of rays to `c`. + void ray_color(const CGAL::IO::Color& c); + + /// returns the color of the bisectors. + const CGAL::IO::Color& bisector_color() const; + /// sets the color of bisectors to `c`. + void bisector_color(const CGAL::IO::Color& c); + + /// returns `true` if the voronoi vertices must be drawn, `false` otherwise. + /// Returns `false` by default. + bool draw_voronoi_vertices() const; + /// sets the draw of voronoi vertices to `b`. + void draw_voronoi_vertices(bool b); + /// toggles the draw voronoi vertices value. + void toggle_draw_voronoi_vertices(); + + /// returns `true` if the dual vertices must be drawn, `false` otherwise. + /// Returns `false` by default. + bool draw_dual_vertices() const; + /// sets the draw of dual vertices to `b`. + void draw_dual_vertices(); + /// toggles the draw dual vertices value. + void toggle_draw_dual_vertices(); +}; diff --git a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt index b109a0213d9..58edde2ec5a 100644 --- a/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt +++ b/Voronoi_diagram_2/doc/Voronoi_diagram_2/PackageDescription.txt @@ -90,6 +90,7 @@ performing this adaptation. \cgalCRPSection{Draw Voronoi Diagram} - \link PkgDrawVoronoiDiagram2 CGAL::draw() \endlink - +- `GraphicsSceneOptionsVoronoiDiagram2` +- `CGAL::Graphics_scene_options_voronoi_2` */ diff --git a/Voronoi_diagram_2/examples/Voronoi_diagram_2/draw_voronoi_diagram_2.cpp b/Voronoi_diagram_2/examples/Voronoi_diagram_2/draw_voronoi_diagram_2.cpp index 2cd8f4a7ef3..54c1e8c9b54 100644 --- a/Voronoi_diagram_2/examples/Voronoi_diagram_2/draw_voronoi_diagram_2.cpp +++ b/Voronoi_diagram_2/examples/Voronoi_diagram_2/draw_voronoi_diagram_2.cpp @@ -23,15 +23,15 @@ int main(int argc, char* argv[]) { VD vd; std::ifstream ifs((argc>1)?argv[1]:"data/data4.dt.cin"); - assert(ifs); + if(ifs) + { + Site_2 t; + while ( ifs >> t ) { vd.insert(t); } + ifs.close(); + assert( vd.is_valid() ); - Site_2 t; - while ( ifs >> t ) { vd.insert(t); } - ifs.close(); - - assert( vd.is_valid() ); - - CGAL::draw(vd); + CGAL::draw(vd); + } return EXIT_SUCCESS; } diff --git a/Voronoi_diagram_2/include/CGAL/draw_voronoi_diagram_2.h b/Voronoi_diagram_2/include/CGAL/draw_voronoi_diagram_2.h index f92e9af630e..534d5aa47c3 100644 --- a/Voronoi_diagram_2/include/CGAL/draw_voronoi_diagram_2.h +++ b/Voronoi_diagram_2/include/CGAL/draw_voronoi_diagram_2.h @@ -8,18 +8,17 @@ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Jasmeet Singh +// Mostafa Ashraf #ifndef CGAL_DRAW_VORONOI_DIAGRAM_2_H #define CGAL_DRAW_VORONOI_DIAGRAM_2_H -#include #include - -#ifdef CGAL_USE_BASIC_VIEWER - -#include -#include +#include +#include +#include #include +#include #include #include #include @@ -28,310 +27,432 @@ namespace CGAL { -// Default color functor; user can change it to have its own face color -struct DefaultColorFunctorV2 +// We need a specific graphics scene option for voronoi2 in order to allow +// to differentiate voronoi and dual vertices, and to manage rays. +template +struct Graphics_scene_options_voronoi_2 : + public CGAL::Graphics_scene_options { - template - static CGAL::IO::Color run(const V2 &, const typename V2::Face_iterator /*fh*/) { - //CGAL::Random random((unsigned int)(std::size_t)(&*fh)); - //return get_random_color(random); - return CGAL::IO::Color(73, 250, 117); - } -}; + Graphics_scene_options_voronoi_2() : m_dual_vertex_color(50, 100, 180), + m_ray_color(100, 0, 0), + m_bisector_color(0, 100, 0), + m_draw_voronoi_vertices(true), + m_draw_dual_vertices(true) + {} -// Viewer for Voronoi diagram -template -class SimpleVoronoiDiagram2ViewerQt : public Basic_viewer_qt -{ - typedef Basic_viewer_qt Base; - typedef typename V2::Vertex_iterator Vertex_const_handle; - typedef typename V2::Delaunay_vertex_handle Delaunay_vertex_const_handle; - typedef typename V2::Delaunay_graph::Finite_vertices_iterator Dual_vertices_iterator; + const CGAL::IO::Color& dual_vertex_color() const + { return m_dual_vertex_color; } + const CGAL::IO::Color& ray_color() const + { return m_ray_color; } + const CGAL::IO::Color& bisector_color() const + { return m_bisector_color; } - typedef typename V2::Halfedge_iterator Halfedge_const_handle; - typedef typename V2::Ccb_halfedge_circulator Ccb_halfedge_circulator; - typedef typename V2::Halfedge_handle Halfedge_handle; + void dual_vertex_color(const CGAL::IO::Color& c) + { m_dual_vertex_color=c; } + void ray_color(const CGAL::IO::Color& c) + { m_ray_color=c; } + void bisector_color(const CGAL::IO::Color& c) + { m_bisector_color=c; } - typedef typename V2::Face_iterator Face_const_handle; + void draw_voronoi_vertices(bool b) { m_draw_voronoi_vertices=b; } + bool draw_voronoi_vertices() const { return m_draw_voronoi_vertices; } + void toggle_draw_voronoi_vertices() { m_draw_voronoi_vertices=!m_draw_voronoi_vertices; } - typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; - -public: - /// Construct the viewer. - /// @param av2 the voronoi diagram to view - /// @param title the title of the window - /// @param anofaces if true, do not draw faces (faces are not computed; this - /// can be useful for very big object where this time could be long) - SimpleVoronoiDiagram2ViewerQt(QWidget *parent, const V2 &av2, - const char *title = "Basic Voronoi Viewer", - bool anofaces = false, - bool draw_voronoi_vertices = true, - bool draw_delaunay_vertices = true, - const ColorFunctor &fcolor = ColorFunctor()) - : // First draw: vertices; half-edges; faces; multi-color; no inverse - // normal - Base(parent, title, true, true, true, false, false, true, true), - v2(av2), m_nofaces(anofaces), - m_draw_voronoi_vertices(draw_voronoi_vertices), - m_draw_dual_vertices(draw_delaunay_vertices), m_fcolor(fcolor) { - // Add custom key description (see keyPressEvent) - setKeyDescription(::Qt::Key_R, "Toggles rays display"); - setKeyDescription(::Qt::Key_D, "Toggles dual vertices display"); - setKeyDescription(::Qt::Key_V, "Toggles voronoi vertices display"); - - compute_elements(); - } + void draw_dual_vertices(bool b) { m_draw_dual_vertices=b; } + bool draw_dual_vertices() const { return m_draw_dual_vertices; } + void toggle_draw_dual_vertices() { m_draw_dual_vertices=!m_draw_dual_vertices; } protected: + CGAL::IO::Color m_dual_vertex_color; + CGAL::IO::Color m_ray_color; + CGAL::IO::Color m_bisector_color; + bool m_draw_voronoi_vertices; + bool m_draw_dual_vertices; +}; - void compute_vertex(Vertex_const_handle vh) { add_point(vh->point()); } +namespace draw_function_for_v2 +{ - void compute_dual_vertex(Dual_vertices_iterator vi) +typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; +typedef Local_kernel::Point_3 Local_point; +typedef Local_kernel::Vector_3 Local_vector; + +template +void compute_vertex(const V2& v2, + typename V2::Vertex_iterator vh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if(!gs_options.draw_vertex(v2, vh)) + { return; } + + if(gs_options.colored_vertex(v2, vh)) + { graphics_scene.add_point(vh->point(), gs_options.vertex_color(v2, vh)); } + else + { graphics_scene.add_point(vh->point()); } +} + +template +void compute_dual_vertex(const V2& /*v2*/, + typename V2::Delaunay_graph::Finite_vertices_iterator vi, + CGAL::Graphics_scene &graphics_scene, + const GSOptions& gs_options) +{ graphics_scene.add_point(vi->point(), gs_options.dual_vertex_color()); } + +template +void add_segments_and_update_bounding_box(const V2& v2, + typename V2::Halfedge_iterator he, + CGAL::Graphics_scene& graphics_scene, + GSOptions& gs_options) +{ + typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; + typedef typename V2::Delaunay_vertex_handle Delaunay_vertex_const_handle; + + if (he->is_segment()) { - add_point(vi->point(), CGAL::IO::Color(50, 100, 180)); - } - - void add_segments_and_update_bounding_box(Halfedge_handle he) - { - if (he->is_segment()) { - add_segment(he->source()->point(), he->target()->point()); - } else { - Delaunay_vertex_const_handle v1 = he->up(); - Delaunay_vertex_const_handle v2 = he->down(); - - Kernel::Vector_2 direction(v1->point().y() - v2->point().y(), - v2->point().x() - v1->point().x()); - if (he->is_ray()) { - Kernel::Point_2 end_point; - if (he->has_source()) { - end_point = he->source()->point(); - update_bounding_box_for_ray(end_point, direction); - } - } else if (he->is_bisector()) { - Kernel::Point_2 pointOnLine((v1->point().x() + v2->point().x()) / 2, - (v1->point().y() + v2->point().y()) / 2); - Kernel::Vector_2 perpendicularDirection( - v2->point().x() - v1->point().x(), - v2->point().y() - v1->point().y()); - update_bounding_box_for_line(pointOnLine, direction, - perpendicularDirection); + if(gs_options.draw_edge(v2, he)) + { + if(gs_options.colored_edge(v2, he)) + { + graphics_scene.add_segment(he->source()->point(), he->target()->point(), + gs_options.edge_color(v2, he)); + } + else + { + graphics_scene.add_segment(he->source()->point(), he->target()->point()); } } } - - Local_kernel::Point_2 get_second_point(Halfedge_handle ray) - { - Delaunay_vertex_const_handle v1 = ray->up(); - Delaunay_vertex_const_handle v2 = ray->down(); - - // calculate direction of ray and its inverse - Kernel::Vector_2 v(v1->point().y() - v2->point().y(), - v2->point().x() - v1->point().x()); - Local_kernel::Vector_2 inv(1 / v.x(), 1 / v.y()); - - // origin of the ray - Kernel::Point_2 p; - if (ray->has_source()) { - p = ray->source()->point(); - } else { - p = ray->target()->point(); - } - - // get the bounding box of the viewer - Local_kernel::Vector_2 boundsMin(m_bounding_box.xmin(), - m_bounding_box.zmin()); - Local_kernel::Vector_2 boundsMax(m_bounding_box.xmax(), - m_bounding_box.zmax()); - // calculate intersection - double txmax, txmin, tymax, tymin; - - if (inv.x() >= 0) { - txmax = (boundsMax.x() - p.x()) * inv.x(); - txmin = (boundsMin.x() - p.x()) * inv.x(); - } else { - txmax = (boundsMin.x() - p.x()) * inv.x(); - txmin = (boundsMax.x() - p.x()) * inv.x(); - } - - if (inv.y() >= 0) { - tymax = (boundsMax.y() - p.y()) * inv.y(); - tymin = (boundsMin.y() - p.y()) * inv.y(); - } else { - tymax = (boundsMin.y() - p.y()) * inv.y(); - tymin = (boundsMax.y() - p.y()) * inv.y(); - } - - if (tymin > txmin) - txmin = tymin; - if (tymax < txmax) - txmax = tymax; - - Local_kernel::Point_2 p1; - if (v.x() == 0) { - p1 = Local_kernel::Point_2(p.x(), p.y() + tymax * v.y()); - } else if (v.y() == 0) { - p1 = Local_kernel::Point_2(p.x() + txmax * v.x(), p.y()); - } else { - p1 = Local_kernel::Point_2(p.x() + txmax * v.x(), p.y() + tymax * v.y()); - } - return p1; - } - - void compute_rays_and_bisectors(Halfedge_const_handle he) + else { Delaunay_vertex_const_handle v1 = he->up(); Delaunay_vertex_const_handle v2 = he->down(); Kernel::Vector_2 direction(v1->point().y() - v2->point().y(), v2->point().x() - v1->point().x()); - if (he->is_ray()) { - if (he->has_source()) { - // add_ray_segment(he->source()->point(), get_second_point(he)); - add_ray(he->source()->point(), direction, CGAL::IO::Color(100, 0, 0)); + if (he->is_ray()) + { + Kernel::Point_2 end_point; + if (he->has_source()) + { + end_point = he->source()->point(); + + // update_bounding_box_for_ray(end_point, direction); + Local_point lp = graphics_scene.get_local_point(end_point); + Local_vector lv = graphics_scene.get_local_vector(direction); + CGAL::Bbox_3 b = (lp + lv).bbox(); + graphics_scene.update_bounding_box(b); } - } else if (he->is_bisector()) { + } + else if (he->is_bisector()) + { Kernel::Point_2 pointOnLine((v1->point().x() + v2->point().x()) / 2, (v1->point().y() + v2->point().y()) / 2); - add_line(pointOnLine, direction); + Kernel::Vector_2 perpendicularDirection( + v2->point().x() - v1->point().x(), + v2->point().y() - v1->point().y()); + + // update_bounding_box_for_line(pointOnLine, direction, + // perpendicularDirection); + Local_point lp = graphics_scene.get_local_point(pointOnLine); + Local_vector lv = graphics_scene.get_local_vector(direction); + Local_vector lpv = graphics_scene.get_local_vector(perpendicularDirection); + + CGAL::Bbox_3 b = lp.bbox() + (lp + lv).bbox() + (lp + lpv).bbox(); + graphics_scene.update_bounding_box(b); } } - - void compute_face(Face_const_handle fh) - { - CGAL::IO::Color c = m_fcolor.run(v2, fh); - - Ccb_halfedge_circulator ec_start = fh->ccb(); - Ccb_halfedge_circulator ec = ec_start; - - if (!fh->is_unbounded()) { - face_begin(c); - do { - add_point_in_face(ec->source()->point()); - } while (++ec != ec_start); - face_end(); - } - // Test: for unbounded faces - // else { - // do{ - // if( ec->has_source() ){ - // add_point_in_face(ec->source()->point()); - // } - // else{ - // add_point_in_face(get_second_point(ec->twin())); - // } - // } while(++ec != ec_start); - // } - } - - void compute_elements() - { - clear(); - - // Draw the voronoi vertices - if (m_draw_voronoi_vertices) { - for (typename V2::Vertex_iterator it = v2.vertices_begin(); - it != v2.vertices_end(); ++it) { - compute_vertex(it); - } - } - - // Draw the dual vertices - if (m_draw_dual_vertices) { - for (Dual_vertices_iterator it = v2.dual().finite_vertices_begin(); - it != v2.dual().finite_vertices_end(); ++it) { - compute_dual_vertex(it); - } - } - - // Add segments and update bounding box - for (typename V2::Halfedge_iterator it = v2.halfedges_begin(); - it != v2.halfedges_end(); ++it) { - add_segments_and_update_bounding_box(it); - } - - for (typename V2::Halfedge_iterator it = v2.halfedges_begin(); - it != v2.halfedges_end(); ++it) { - compute_rays_and_bisectors(it); - } - - if (!m_nofaces) { - for (typename V2::Face_iterator it = v2.faces_begin(); - it != v2.faces_end(); ++it) { - compute_face(it); - } - } - } - - virtual void keyPressEvent(QKeyEvent *e) - { - /// [Keypress] - const ::Qt::KeyboardModifiers modifiers = e->modifiers(); - if ((e->key() == ::Qt::Key_R) && (modifiers == ::Qt::NoButton)) { - m_draw_rays = !m_draw_rays; - displayMessage( - QString("Draw rays=%1.").arg(m_draw_rays ? "true" : "false")); - update(); - } else if ((e->key() == ::Qt::Key_V) && (modifiers == ::Qt::NoButton)) { - m_draw_voronoi_vertices = !m_draw_voronoi_vertices; - displayMessage( - QString("Voronoi vertices=%1.").arg(m_draw_voronoi_vertices? "true" : "false")); - compute_elements(); - redraw(); - } else if ((e->key() == ::Qt::Key_D) && (modifiers == ::Qt::NoButton)) { - m_draw_dual_vertices = !m_draw_dual_vertices; - displayMessage(QString("Dual vertices=%1.") - .arg(m_draw_dual_vertices ? "true" : "false")); - compute_elements(); - redraw(); - } else { - // Call the base method to process others/classicals key - Base::keyPressEvent(e); - } - /// [Keypress] - } - -protected: - const V2 &v2; - bool m_nofaces; - bool m_draw_voronoi_vertices; - bool m_draw_dual_vertices; - const ColorFunctor &m_fcolor; -}; - -// Specialization of draw function. -#define CGAL_VORONOI_TYPE CGAL::Voronoi_diagram_2 - -template -void draw(const CGAL_VORONOI_TYPE &av2, - const char *title="2D Voronoi Diagram Basic Viewer", - bool nofill = false, - bool draw_voronoi_vertices = true, - bool draw_dual_vertices = true) -{ -#if defined(CGAL_TEST_SUITE) - bool cgal_test_suite = true; -#else - bool cgal_test_suite = qEnvironmentVariableIsSet("CGAL_TEST_SUITE"); -#endif - - if (!cgal_test_suite) { - CGAL::Qt::init_ogl_context(4,3); - int argc = 1; - const char *argv[2] = {"voronoi_2_viewer", nullptr}; - QApplication app(argc, const_cast(argv)); - DefaultColorFunctorV2 fcolor; - SimpleVoronoiDiagram2ViewerQt - mainwindow(app.activeWindow(), av2, title, nofill, - draw_voronoi_vertices, draw_dual_vertices, fcolor); - mainwindow.show(); - app.exec(); - } } -} // End namespace CGAL +template +Local_kernel::Point_2 get_second_point(typename V2::Halfedge_handle ray, + const CGAL::Bbox_3 & m_bounding_box) +{ + typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; + typedef typename V2::Delaunay_vertex_handle Delaunay_vertex_const_handle; + + Delaunay_vertex_const_handle v1 = ray->up(); + Delaunay_vertex_const_handle v2 = ray->down(); + + // calculate direction of ray and its inverse + Kernel::Vector_2 v(v1->point().y() - v2->point().y(), + v2->point().x() - v1->point().x()); + Local_kernel::Vector_2 inv(1 / v.x(), 1 / v.y()); + + // origin of the ray + Kernel::Point_2 p; + if (ray->has_source()) + { p = ray->source()->point(); } + else + { p = ray->target()->point(); } + + // get the bounding box of the viewer + Local_kernel::Vector_2 boundsMin(m_bounding_box.xmin(), + m_bounding_box.zmin()); + Local_kernel::Vector_2 boundsMax(m_bounding_box.xmax(), + m_bounding_box.zmax()); + // calculate intersection + double txmax, txmin, tymax, tymin; + + if (inv.x() >= 0) + { + txmax = (boundsMax.x() - p.x()) * inv.x(); + txmin = (boundsMin.x() - p.x()) * inv.x(); + } + else + { + txmax = (boundsMin.x() - p.x()) * inv.x(); + txmin = (boundsMax.x() - p.x()) * inv.x(); + } + + if (inv.y() >= 0) + { + tymax = (boundsMax.y() - p.y()) * inv.y(); + tymin = (boundsMin.y() - p.y()) * inv.y(); + } + else + { + tymax = (boundsMin.y() - p.y()) * inv.y(); + tymin = (boundsMax.y() - p.y()) * inv.y(); + } + + if (tymin > txmin) + txmin = tymin; + if (tymax < txmax) + txmax = tymax; + + Local_kernel::Point_2 p1; + if (v.x() == 0) + { p1 = Local_kernel::Point_2(p.x(), p.y() + tymax * v.y()); } + else if (v.y() == 0) + { p1 = Local_kernel::Point_2(p.x() + txmax * v.x(), p.y()); } + else + { p1 = Local_kernel::Point_2(p.x() + txmax * v.x(), p.y() + tymax * v.y()); } + return p1; +} + +// Halfedge_const_handle +template +void compute_rays_and_bisectors(const V2&, + typename V2::Halfedge_iterator he, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; + typedef typename V2::Delaunay_vertex_handle Delaunay_vertex_const_handle; + + Delaunay_vertex_const_handle v1 = he->up(); + Delaunay_vertex_const_handle v2 = he->down(); + + Kernel::Vector_2 direction(v1->point().y() - v2->point().y(), + v2->point().x() - v1->point().x()); + if (he->is_ray()) + { + if (he->has_source()) + { + // add_ray_segment(he->source()->point(), get_second_point(he, graphics_scene.get_bounding_box())); + graphics_scene.add_ray(he->source()->point(), direction, gs_options.ray_color()); + } + } + else if (he->is_bisector()) + { + Kernel::Point_2 pointOnLine((v1->point().x() + v2->point().x()) / 2, + (v1->point().y() + v2->point().y()) / 2); + graphics_scene.add_line(pointOnLine, direction, gs_options.bisector_color()); + } +} + +template +void compute_face(const V2& v2, + typename V2::Face_iterator fh, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& m_gs_options) +{ + if(fh->is_unbounded() || !m_gs_options.draw_face(v2, fh)) + { return; } + + if(m_gs_options.colored_face(v2, fh)) + { graphics_scene.face_begin(m_gs_options.face_color(v2, fh)); } + else { graphics_scene.face_begin(); } + + typename V2::Ccb_halfedge_circulator ec_start=fh->ccb(); + typename V2::Ccb_halfedge_circulator ec=ec_start; + do + { + graphics_scene.add_point_in_face(ec->source()->point()); + } + while (++ec!=ec_start); + graphics_scene.face_end(); + + // Test: for unbounded faces (??) + // else { + // do{ + // if( ec->has_source() ){ + // add_point_in_face(ec->source()->point()); + // } + // else{ + // add_point_in_face(get_second_point(ec->twin(), graphics_scene.get_bounding_box())); + // } + // } while(++ec != ec_start); + // } +} + +template +void compute_elements(const V2& v2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& gs_options) +{ + if(gs_options.are_vertices_enabled()) + { + // Draw the voronoi vertices + if (gs_options.draw_voronoi_vertices()) + { + for (typename V2::Vertex_iterator it=v2.vertices_begin(); + it!=v2.vertices_end(); ++it) + { compute_vertex(v2, it, graphics_scene, gs_options); } + } + + // Draw the dual vertices + if (gs_options.draw_dual_vertices()) + { + for (typename V2::Delaunay_graph::Finite_vertices_iterator + it=v2.dual().finite_vertices_begin(); + it!=v2.dual().finite_vertices_end(); ++it) + { compute_dual_vertex(v2, it, graphics_scene, gs_options); } + } + } + + if(gs_options.are_edges_enabled()) + { + // Add segments and update bounding box + for (typename V2::Halfedge_iterator it=v2.halfedges_begin(); + it!=v2.halfedges_end(); ++it) + { add_segments_and_update_bounding_box(v2, it, + graphics_scene, gs_options); } + } + + for (typename V2::Halfedge_iterator it=v2.halfedges_begin(); + it!=v2.halfedges_end(); ++it) + { compute_rays_and_bisectors(v2, it, graphics_scene, gs_options); } + + if (gs_options.are_faces_enabled()) + { + for (typename V2::Face_iterator it=v2.faces_begin(); it!=v2.faces_end(); ++it) + { compute_face(v2, it, graphics_scene, gs_options); } + } +} + +} // namespace draw_function_for_v2 + +#define CGAL_VORONOI_TYPE CGAL::Voronoi_diagram_2 + +template +void add_to_graphics_scene(const CGAL_VORONOI_TYPE &v2, + CGAL::Graphics_scene& graphics_scene, + const GSOptions& m_gs_options) +{ + draw_function_for_v2::compute_elements(v2, graphics_scene, m_gs_options); +} + +template +void add_to_graphics_scene(const CGAL_VORONOI_TYPE& v2, + CGAL::Graphics_scene& graphics_scene) +{ + // Default graphics view options. + CGAL::Graphics_scene_options_voronoi_2 + gs_options; + + add_to_graphics_scene(v2, graphics_scene, gs_options); +} + +#ifdef CGAL_USE_BASIC_VIEWER + +// Specialization of draw function. +template +void draw(const CGAL_VORONOI_TYPE& av2, + GSOptions& gs_options, + const char *title="2D Voronoi Diagram Basic Viewer") +{ + CGAL::Graphics_scene buffer; + add_to_graphics_scene(av2, buffer, gs_options); + + CGAL::Qt::QApplication_and_basic_viewer app(buffer, title); + if(app) + { + // Here we define the std::function to capture key pressed. + app.basic_viewer().on_key_pressed= + [&av2, &buffer, &gs_options] (QKeyEvent* e, CGAL::Qt::Basic_viewer* basic_viewer) -> bool + { + const ::Qt::KeyboardModifiers modifiers = e->modifiers(); + if ((e->key() == ::Qt::Key_R) && (modifiers == ::Qt::NoButton)) + { + basic_viewer->toggle_draw_rays(); + basic_viewer->displayMessage + (QString("Draw rays=%1.").arg(basic_viewer->draw_rays()?"true":"false")); + + basic_viewer->redraw(); + } + else if ((e->key() == ::Qt::Key_V) && (modifiers == ::Qt::ShiftModifier)) + { + gs_options.toggle_draw_voronoi_vertices(); + basic_viewer->displayMessage + (QString("Voronoi vertices=%1."). + arg(gs_options.draw_voronoi_vertices()?"true":"false")); + + buffer.clear(); + draw_function_for_v2::compute_elements(av2, buffer, gs_options); + basic_viewer->redraw(); + } + else if ((e->key() == ::Qt::Key_D) && (modifiers == ::Qt::NoButton)) + { + gs_options.toggle_draw_dual_vertices(); + basic_viewer->displayMessage(QString("Dual vertices=%1."). + arg(gs_options.draw_dual_vertices()?"true":"false")); + + buffer.clear(); + draw_function_for_v2::compute_elements(av2, buffer, gs_options); + basic_viewer->redraw(); + } + else + { + // Return false will call the base method to process others/classicals key + return false; + } + return true; // the key was captured + }; + + // Here we add shortcut descriptions + app.basic_viewer().setKeyDescription(::Qt::Key_R, "Toggles rays display"); + app.basic_viewer().setKeyDescription(::Qt::Key_D, "Toggles dual vertices display"); + app.basic_viewer().setKeyDescription(::Qt::ShiftModifier, ::Qt::Key_V, "Toggles voronoi vertices display"); + + // Then we run the app + app.run(); + } +} + +template +void draw(const CGAL_VORONOI_TYPE& av2, + const char *title="2D Voronoi Diagram Basic Viewer") +{ + CGAL::Graphics_scene_options_voronoi_2 + gs_options; + draw(av2, gs_options, title); +} #endif // CGAL_USE_BASIC_VIEWER +#undef CGAL_VORONOI_TYPE + +} // End namespace CGAL + #endif // CGAL_DRAW_VORONOI_DIAGRAM_2_H diff --git a/Voronoi_diagram_2/package_info/Voronoi_diagram_2/dependencies b/Voronoi_diagram_2/package_info/Voronoi_diagram_2/dependencies index 47ba473b701..b92af4a0b3b 100644 --- a/Voronoi_diagram_2/package_info/Voronoi_diagram_2/dependencies +++ b/Voronoi_diagram_2/package_info/Voronoi_diagram_2/dependencies @@ -1,15 +1,31 @@ Algebraic_foundations Apollonius_graph_2 +Arithmetic_kernel +BGL +Basic_viewer +Cartesian_kernel Circulator -GraphicsView +Distance_2 +Distance_3 +Filtered_kernel Hash_map +Homogeneous_kernel Installation +Intersections_2 +Intersections_3 Interval_support Kernel_23 +Kernel_d Modular_arithmetic Number_types +Polygon Profiling_tools +Property_map +Random_numbers STL_Extension +Spatial_sorting Stream_support TDS_2 +Triangulation_2 Voronoi_diagram_2 +CGAL_Core diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index dc070c5c493..7bd3f706a4b 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/Weights/package_info/Weights/dependencies b/Weights/package_info/Weights/dependencies index 4ff65640789..63d9e7ce133 100644 --- a/Weights/package_info/Weights/dependencies +++ b/Weights/package_info/Weights/dependencies @@ -9,7 +9,6 @@ Number_types Polygon Profiling_tools Property_map -Random_numbers STL_Extension Stream_support Weights