From 974a4accf10c7633843a013941111950571b6c5a Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Mon, 12 Sep 2022 15:42:07 +0200 Subject: [PATCH] Update drawing functor and lcc demo --- .../demo/Linear_cell_complex/Viewer.cpp | 50 +- .../demo/Linear_cell_complex/Viewer.h | 94 +--- .../demo/Linear_cell_complex/typedefs.h | 5 +- .../CGAL/draw_linear_cell_complex_function.h | 512 +++++++----------- 4 files changed, 238 insertions(+), 423 deletions(-) diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp index a41f174d92a..bd48145e3a4 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.cpp @@ -17,26 +17,37 @@ Viewer::Viewer(QWidget *parent) : Base(parent, m_graphic_buffer, ""), - m_nofaces_(false), m_random_face_color_(false), - m_previous_scene_empty(true) {} + m_previous_scene_empty(true) +{ + m_drawing_functor.volume_color=[](const LCC & alcc, + Dart_const_handle dh)->CGAL::IO::Color + { return alcc.template info<3>(dh).color(); }; -void Viewer::setScene(Scene *scene_, bool doredraw) { - scene = scene_; + m_drawing_functor.colored_volume=[](const LCC &, Dart_const_handle)->bool + { return true; }; - if (scene->lcc != nullptr) { - CGAL::add_in_graphic_buffer_lcc(gBuffer, m_drawing_functor_, scene->lcc, m_nofaces_, - m_random_face_color_); - } + m_drawing_functor.draw_volume=[](const LCC & alcc, Dart_const_handle dh)->bool + { return alcc.template info<3>(dh).is_visible(); }; - if (doredraw) { - Base::redraw(); - } + m_drawing_functor.volume_wireframe=[](const LCC& alcc, Dart_const_handle dh)->bool + { return !(alcc.template info<3>(dh).is_filled()); }; } -void Viewer::sceneChanged() { +void Viewer::setScene(Scene *scene_, bool doredraw) +{ + scene = scene_; + + if (scene->lcc!=nullptr) + { CGAL::add_in_graphic_buffer_lcc(gBuffer, m_drawing_functor, scene->lcc); } + + if (doredraw) + { Base::redraw(); } +} + +void Viewer::sceneChanged() +{ gBuffer.clear(); - CGAL::add_in_graphic_buffer_lcc(gBuffer, m_drawing_functor_, scene->lcc, - m_nofaces_, m_random_face_color_); + CGAL::add_in_graphic_buffer_lcc(gBuffer, m_drawing_functor, scene->lcc); this->camera()->setSceneBoundingBox( CGAL::qglviewer::Vec(gBuffer.get_bounding_box().xmin(), @@ -46,15 +57,14 @@ void Viewer::sceneChanged() { gBuffer.get_bounding_box().ymax(), gBuffer.get_bounding_box().zmax())); Base::redraw(); - if (m_previous_scene_empty) { - this->showEntireScene(); - } + 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) { +void Viewer::keyPressEvent(QKeyEvent *e) +{ // const Qt::KeyboardModifiers modifiers = e->modifiers(); Base::keyPressEvent(e); } diff --git a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h index f7473cff8d7..e4e834e0a7e 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/Viewer.h @@ -21,93 +21,6 @@ #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_handle 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_handle) const - { return true; } - /// @return true iff the edge containing dh is drawn. - template - bool draw_edge(const LCC&, - typename LCC::Dart_const_handle) const - { return true; } - /// @return true iff the vertex containing dh is drawn. - template - bool draw_vertex(const LCC&, - typename LCC::Dart_const_handle) 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_handle 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_handle) const - { return false; } - - /// @return true iff the volume containing dh is colored. - template - bool colored_volume(const LCC&, - typename LCC::Dart_const_handle) 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_handle) const - { return false; } - /// @return true iff the edge containing dh is colored. - template - bool colored_edge(const LCC&, - typename LCC::Dart_const_handle) const - { return false; } - /// @return true iff the vertex containing dh is colored. - template - bool colored_vertex(const LCC&, - typename LCC::Dart_const_handle) 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_handle 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_handle 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_handle) 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_handle) const - { return CGAL::IO::Color(0, 0, 0); } -}; - class Viewer : public CGAL::Basic_viewer_qt { Q_OBJECT @@ -124,9 +37,12 @@ public Q_SLOTS: void sceneChanged(); private: - MyDrawingFunctorLCC m_drawing_functor_; + CGAL::DefaultDrawingFunctorXWithVolume m_drawing_functor; CGAL::GraphicBuffer m_graphic_buffer; - bool m_nofaces_, m_random_face_color_; 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 787b5a48aac..5955485c8e4 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h @@ -158,8 +158,9 @@ typedef CGAL::Linear_cell_complex_traits <3,CGAL::Exact_predicates_inexact_constructions_kernel> Mytraits; typedef CGAL::Linear_cell_complex_for_combinatorial_map<3,3,Mytraits,Myitems> LCC; -typedef LCC::Dart_handle Dart_handle; -typedef LCC::Vertex_attribute Vertex; +typedef LCC::Dart_handle Dart_handle; +typedef LCC::Dart_const_handle Dart_const_handle; +typedef LCC::Vertex_attribute Vertex; typedef LCC::Point Point_3; typedef LCC::Vector Vector_3; diff --git a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex_function.h b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex_function.h index 4b218c7431d..856c5a8783b 100644 --- a/Linear_cell_complex/include/CGAL/draw_linear_cell_complex_function.h +++ b/Linear_cell_complex/include/CGAL/draw_linear_cell_complex_function.h @@ -15,6 +15,7 @@ #include #include +#include #ifdef CGAL_USE_BASIC_VIEWER @@ -23,195 +24,94 @@ namespace CGAL { -// This functor draws all faces, edges, and vertices. -// 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_handle) const { - return true; - } - /// @return true iff the face containing dh is drawn. - template - bool draw_face(const LCC &, typename LCC::Dart_const_handle) const { - return true; - } - /// @return true iff the edge containing dh is drawn. - template - bool draw_edge(const LCC &, typename LCC::Dart_const_handle) const { - return true; - } - /// @return true iff the vertex containing dh is drawn. - template - bool draw_vertex(const LCC &, typename LCC::Dart_const_handle) const { - return true; - } + + // CGAL::IO::Color face_color(const DS &aVal, face_handle dh) const { + // CGAL::Random random((unsigned int)(aVal.darts().index(dh))); + // return get_random_color(random); + // } - /// @return true iff the volume containing dh is drawn in wireframe. - template - bool volume_wireframe(const LCC &, typename LCC::Dart_const_handle) const { - return false; - } - /// @return true iff the face containing dh is drawn in wireframe. - template - bool face_wireframe(const LCC &, typename LCC::Dart_const_handle) const { - return false; - } - /// @return true iff the volume containing dh is colored. - template - bool colored_volume(const LCC &, typename LCC::Dart_const_handle) 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_handle) const { - return false; - } - /// @return true iff the edge containing dh is colored. - template - bool colored_edge(const LCC &, typename LCC::Dart_const_handle) const { - return false; - } - /// @return true iff the vertex containing dh is colored. - template - bool colored_vertex(const LCC &, typename LCC::Dart_const_handle) const { - return false; - } +template +struct DefaultDrawingFunctorX +{ + DefaultDrawingFunctorX(): m_enabled_vertices(true), + m_enabled_edges(true), + m_enabled_faces(true) + { + draw_vertex=[](const DS &, vertex_handle)->bool { return true; }; + draw_edge=[](const DS &, edge_handle)->bool { return true; }; + draw_face=[](const DS &, face_handle)->bool { return true; }; + + colored_vertex=[](const DS &, vertex_handle)->bool { return false; }; + colored_edge=[](const DS &, edge_handle)->bool { return false; }; + colored_face=[](const DS &, face_handle)->bool { 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_handle 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_handle 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_handle 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_handle dh) const { - CGAL::Random random((unsigned int)(alcc.darts().index(dh))); - return get_random_color(random); + face_wireframe=[](const DS &, face_handle)->bool { return false; }; } + + 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; + + 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; }; -// TODO: these functors will modify a specific face, edge, and vertex. -struct DefaultDrawingFunctorX { - - template - bool draw_face(const DS &, face_handle handle) const { - return true; +template +struct DefaultDrawingFunctorXWithVolume : + public DefaultDrawingFunctorX +{ + DefaultDrawingFunctorXWithVolume() : m_enabled_volumes(true) + { + draw_volume=[](const DS &, volume_handle)->bool { return true; }; + colored_volume=[](const DS &, volume_handle)->bool { return false; }; + volume_wireframe=[](const DS &, volume_handle)->bool { return false; }; } - template - bool draw_edge(const DS &, edge_handle handle) const { - return true; - } + std::function draw_volume; + std::function colored_volume; + std::function volume_wireframe; + std::function volume_color; - template - bool draw_vertex(const DS &, vertex_handle handle) const { - return true; - } + void disable_volumes() { m_enabled_volumes=false; } + void enable_volumes() { m_enabled_volumes=true; } + bool are_volumes_enabled() const { return m_enabled_volumes; } - template - bool face_wireframe(const DS &, typename DS::Dart_const_handle) const { - return false; - } - - template - bool colored_face(const DS &, face_handle handle) const { - return false; - } - - template - bool colored_edge(const DS &, edge_handle handle) const { - return false; - } - - template - bool colored_vertex(const DS &, vertex_handle handle) const { - return false; - } - - template - CGAL::IO::Color face_color(const DS &aVal, face_handle dh) const { - CGAL::Random random((unsigned int)(aVal.darts().index(dh))); - return get_random_color(random); - } - - template - CGAL::IO::Color edge_color(const DS &aVal, edge_handle dh) const { - CGAL::Random random((unsigned int)(aVal.darts().index(dh))); - return get_random_color(random); - } - - template - CGAL::IO::Color vertex_color(const DS &aVal, vertex_handle dh) const { - CGAL::Random random((unsigned int)(aVal.darts().index(dh))); - return get_random_color(random); - } +protected: + bool m_enabled_volumes; }; -struct DefaultDrawingFunctorXWithVoulume : public DefaultDrawingFunctorX { - - template - bool draw_volume(const DS &, volume_handle) const { - return true; - } - - template - CGAL::IO::Color volume_color(const DS &aVal, - volume_handle dh) const { - CGAL::Random random((unsigned int)(aVal.darts().index(dh))); - return get_random_color(random); - } - - template - bool volume_wireframe(const DS &, volume_handle) const { - return false; - } - - template - bool colored_volume(const DS &, volume_handle) const { - return true; - } -}; - -namespace draw_function { +namespace draw_function_for_lcc +{ typedef CGAL::Exact_predicates_inexact_constructions_kernel Local_kernel; typedef Local_kernel::Point_3 Local_point; @@ -221,9 +121,11 @@ template struct LCC_geom_utils; template -struct LCC_geom_utils { +struct LCC_geom_utils +{ static typename Local_kernel::Vector_3 - get_vertex_normal(const LCC &lcc, typename LCC::Dart_const_handle dh) { + get_vertex_normal(const LCC &lcc, typename LCC::Dart_const_handle dh) + { typename Local_kernel::Vector_3 n = internal::Geom_utils:: get_local_vector(CGAL::compute_normal_of_cell_0(lcc, dh)); @@ -233,110 +135,109 @@ struct LCC_geom_utils { }; template -struct LCC_geom_utils { +struct LCC_geom_utils +{ static typename Local_kernel::Vector_3 - get_vertex_normal(const LCC &, typename LCC::Dart_const_handle) { - typename Local_kernel::Vector_3 n = CGAL::NULL_VECTOR; + get_vertex_normal(const LCC &, typename LCC::Dart_const_handle) + { + typename Local_kernel::Vector_3 n=CGAL::NULL_VECTOR; return n; } }; -template +template void compute_face(typename LCC::Dart_const_handle dh, typename LCC::Dart_const_handle voldh, const LCC *lcc, - bool m_nofaces, bool m_random_face_color, const DrawingFunctorLCC &m_drawing_functor, - GraphicBuffer &graphic_buffer) { - - typedef typename LCC::Dart_const_handle Dart_const_handle; - typedef typename LCC::Traits Kernel; - typedef typename Kernel::Point Point; - typedef typename Kernel::Vector Vector; - - if (m_nofaces || !m_drawing_functor.draw_face(*lcc, dh)) - return; + GraphicBuffer &graphic_buffer) +{ + if (!m_drawing_functor.are_faces_enabled() || + !m_drawing_functor.draw_face(*lcc, dh)) + { return; } // We fill only closed faces. - Dart_const_handle cur = dh; - Dart_const_handle min = dh; - do { + typename LCC::Dart_const_handle cur=dh; + do + { if (!lcc->is_next_exist(cur)) - return; // open face=>not filled - if (cur < min) - min = cur; + { return; } // open face=>not filled cur = lcc->next(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); - graphic_buffer.face_begin(c); - } else if (m_drawing_functor.colored_face(*lcc, dh)) { - CGAL::IO::Color c = m_drawing_functor.face_color(*lcc, dh); - graphic_buffer.face_begin(c); - } else if (m_drawing_functor.colored_volume(*lcc, voldh)) { - CGAL::IO::Color c = m_drawing_functor.volume_color(*lcc, voldh); - graphic_buffer.face_begin(c); - } else { - graphic_buffer.face_begin(); } + while (cur!=dh); - cur = dh; - do { - graphic_buffer.add_point_in_face( - lcc->point(cur), - LCC_geom_utils::get_vertex_normal(*lcc, cur)); - cur = lcc->next(cur); - } while (cur != dh); + if (m_drawing_functor.colored_volume(*lcc, voldh)) + { + CGAL::IO::Color c=m_drawing_functor.volume_color(*lcc, voldh); + graphic_buffer.face_begin(c); + } + else if (m_drawing_functor.colored_face(*lcc, dh)) + { + CGAL::IO::Color c=m_drawing_functor.face_color(*lcc, dh); + graphic_buffer.face_begin(c); + } + else + { graphic_buffer.face_begin(); } + + cur=dh; + do + { + graphic_buffer.add_point_in_face + (lcc->point(cur), + LCC_geom_utils::get_vertex_normal(*lcc, cur)); + cur=lcc->next(cur); + } + while (cur!=dh); graphic_buffer.face_end(); } -template +template void compute_edge(typename LCC::Dart_const_handle dh, const LCC *lcc, - const DrawingFunctorLCC &m_drawing_functor, - GraphicBuffer &graphic_buffer) { - typedef typename LCC::Dart_const_handle Dart_const_handle; - typedef typename LCC::Traits Kernel; - typedef typename Kernel::Point Point; + const DrawingFunctor &m_drawing_functor, + GraphicBuffer &graphic_buffer) +{ + if (!m_drawing_functor.are_edges_enabled() || + !m_drawing_functor.draw_edge(*lcc, dh)) + { return; } - if (!m_drawing_functor.draw_edge(*lcc, dh)) - return; - - Point p1 = lcc->point(dh); - Dart_const_handle d2 = lcc->other_extremity(dh); - if (d2 != nullptr) { - if (m_drawing_functor.colored_edge(*lcc, dh)) { + const typename LCC::Point& p1=lcc->point(dh); + typename LCC::Dart_const_handle d2=lcc->other_extremity(dh); + if (d2!=nullptr) + { + if (m_drawing_functor.colored_edge(*lcc, dh)) + { graphic_buffer.add_segment(p1, lcc->point(d2), m_drawing_functor.edge_color(*lcc, dh)); - } else { - graphic_buffer.add_segment(p1, lcc->point(d2)); } + else + { graphic_buffer.add_segment(p1, lcc->point(d2)); } } } template void compute_vertex(typename LCC::Dart_const_handle dh, const LCC *lcc, const DrawingFunctorLCC &m_drawing_functor, - GraphicBuffer &graphic_buffer) { - if (!m_drawing_functor.draw_vertex(*lcc, dh)) - return; + GraphicBuffer &graphic_buffer) +{ + if (!m_drawing_functor.are_vertices_enabled() || + !m_drawing_functor.draw_vertex(*lcc, dh)) + { return; } - if (m_drawing_functor.colored_vertex(*lcc, dh)) { + if (m_drawing_functor.colored_vertex(*lcc, dh)) + { graphic_buffer.add_point(lcc->point(dh), m_drawing_functor.vertex_color(*lcc, dh)); - } else { - graphic_buffer.add_point(lcc->point(dh)); } + else + { graphic_buffer.add_point(lcc->point(dh)); } } -template +template void compute_elements(GraphicBuffer &graphic_buffer, const LCC *lcc, - const DrawingFunctorLCC &m_drawing_functor, - bool m_nofaces, bool m_random_face_color) { - - if (lcc == nullptr) - return; + const DrawingFunctor &m_drawing_functor) +{ + if (lcc==nullptr) + { return; } typename LCC::size_type markvolumes = lcc->get_new_mark(); typename LCC::size_type markfaces = lcc->get_new_mark(); @@ -346,54 +247,44 @@ void compute_elements(GraphicBuffer &graphic_buffer, const LCC *lcc, lcc->orient(oriented_mark); - for (typename LCC::Dart_range::const_iterator it = lcc->darts().begin(), - itend = lcc->darts().end(); - it != itend; ++it) { + for(typename LCC::Dart_range::const_iterator it=lcc->darts().begin(), + itend=lcc->darts().end(); it!=itend; ++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) { - lcc->mark(itv, markvolumes); // To be sure that all darts of the basic - // iterator will be marked + 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) + { + lcc->mark(itv, markvolumes); if (!lcc->is_marked(itv, markfaces) && lcc->is_marked(itv, oriented_mark) && - m_drawing_functor.draw_face(*lcc, itv)) { + m_drawing_functor.draw_face(*lcc, itv)) + { if (!m_drawing_functor.volume_wireframe(*lcc, itv) && - !m_drawing_functor.face_wireframe(*lcc, itv)) { - compute_face(itv, it, lcc, m_nofaces, m_random_face_color, - m_drawing_functor, graphic_buffer); - } - 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)) { - lcc->mark(itf, markfaces); - } // To be sure that all darts of the basic iterator will be marked + !m_drawing_functor.face_wireframe(*lcc, itv)) + { compute_face(itv, it, lcc, m_drawing_functor, graphic_buffer); } + 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) && - m_drawing_functor.draw_edge(*lcc, itf)) { + m_drawing_functor.draw_edge(*lcc, itf)) + { compute_edge(itf, lcc, m_drawing_functor, graphic_buffer); - 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); // To be sure that all darts of the - // basic iterator will be marked + 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) && - m_drawing_functor.draw_vertex(*lcc, ite)) { + m_drawing_functor.draw_vertex(*lcc, ite)) + { compute_vertex(ite, lcc, m_drawing_functor, graphic_buffer); CGAL::mark_cell(*lcc, ite, markvertices); } @@ -406,8 +297,8 @@ void compute_elements(GraphicBuffer &graphic_buffer, const LCC *lcc, } for (typename LCC::Dart_range::const_iterator it = lcc->darts().begin(), - itend = lcc->darts().end(); - it != itend; ++it) { + itend = lcc->darts().end(); it != itend; ++it) + { lcc->unmark(it, markvertices); lcc->unmark(it, markedges); lcc->unmark(it, markfaces); @@ -431,17 +322,15 @@ void compute_elements(GraphicBuffer &graphic_buffer, const LCC *lcc, * @param graphic_buffer * @param m_drawing_functor * @param alcc - * @param anofaces if true, do not draw faces. */ -template +template void add_in_graphic_buffer_lcc(GraphicBuffer &graphic_buffer, - const DrawingFunctorLCC &m_drawing_functor, - const LCC *alcc = nullptr, bool nofaces = false, - bool m_random_face_color = false) { - - if (alcc != nullptr) { - draw_function::compute_elements(graphic_buffer, alcc, m_drawing_functor, - nofaces, m_random_face_color); + const DrawingFunctor &m_drawing_functor, + const LCC *alcc = nullptr) +{ + if (alcc!=nullptr) + { + draw_function_for_lcc::compute_elements(graphic_buffer, alcc, m_drawing_functor); } } @@ -450,25 +339,24 @@ void add_in_graphic_buffer_lcc(GraphicBuffer &graphic_buffer, CGAL::Linear_cell_complex_base -template class Map, - class Refs, class Storage_, - class DrawingFunctorLCC = DefaultDrawingFunctorLCC> - // TODO: I'll add it again after done LCC demo. - // class DrawingFunctorLCC = DefaultDrawingFunctorXWithVoulume> +template class Map, + class Refs, class Storage_, + class DrawingFunctor=DefaultDrawingFunctorXWithVolume> void draw(const CGAL_LCC_TYPE &alcc, const char *title = "LCC for CMap Basic Viewer", - const DrawingFunctorLCC &drawing_functor = DrawingFunctorLCC()) { - // TODO: I'll add it again after done LCC demo. - // const DrawingFunctorLCC &drawing_functor = DefaultDrawingFunctorXWithVoulume()) { + const DrawingFunctor &drawing_functor=DrawingFunctor()) +{ GraphicBuffer buffer; - add_in_graphic_buffer_lcc(buffer, drawing_functor, &alcc, false); + add_in_graphic_buffer_lcc(buffer, drawing_functor, &alcc); draw_buffer(buffer); } -// Todo a function taking a const DrawingFunctorLCC& drawing_functor as -// parameter #undef CGAL_LCC_TYPE } // End namespace CGAL