
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Misc. clean-up in line graph-related entities. * mln/core/line_graph_elt_window.hh: Don't insert the reference piter itself into the set of window sites. * mln/core/line_graph_window_piter.hh, * mln/core/line_graph_elt_neighborhood.hh, * tests/core/line_graph_image.cc: Typo, aesthetics changes. mln/core/line_graph_elt_neighborhood.hh | 9 ++++----- mln/core/line_graph_elt_window.hh | 13 +++++++++---- tests/core/line_graph_image.cc | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) Index: mln/core/line_graph_elt_window.hh --- mln/core/line_graph_elt_window.hh (revision 1908) +++ mln/core/line_graph_elt_window.hh (working copy) @@ -40,6 +40,10 @@ - mln::line_graph_elt_window - mln::line_graph_elt_neighborhood. */ +/* FIXME: Due to the poor interface of mln::p_line_graph and + mln::util::graph, we show to much implementation details here. + Enrich their interfaces to avoid that. */ + # include <mln/core/concept/window.hh> # include <mln/core/line_graph_psite.hh> # include <mln/core/line_graph_window_piter.hh> @@ -86,6 +90,7 @@ /// Services for iterators. /// \{ + /// Compute the set of sites for this window around \a piter. template <typename Piter> void compute_sites_(Point_Iterator<Piter>& piter) const; /// \} @@ -132,17 +137,17 @@ /* FIXME: Move this computation out of the window. In fact, this should be a service of the graph, also proposed by the p_line_graph. */ - // Add the reference piter itself. - sites.insert(piter.p_ref().id()); // Ajacent edges connected through node 1. - // FIXME: Far too low-level. + /* We don't need to explicitely insert the reference piter (edge + id) itself into SITES, since it is part of the set of edges + adjacent to NODE1 and NODE2, and will therefore be + automatically added. */ util::node_id id1 = piter.p_ref().first_id(); const util::node<P>& node1 = piter.plg().gr_->node(id1); for (std::vector<util::edge_id>::const_iterator e = node1.edges.begin(); e != node1.edges.end(); ++e) sites.insert(*e); // Ajacent edges connected through node 2. - // FIXME: Likewise. util::node_id id2 = piter.p_ref().second_id(); const util::node<P>& node2 = piter.plg().gr_->node(id2); for (std::vector<util::edge_id>::const_iterator e = Index: mln/core/line_graph_window_piter.hh Index: mln/core/line_graph_elt_neighborhood.hh --- mln/core/line_graph_elt_neighborhood.hh (revision 1908) +++ mln/core/line_graph_elt_neighborhood.hh (working copy) @@ -93,6 +93,7 @@ /// Services for iterators. /// \{ + /// Compute the set of sites for this neighborhood around \a piter. template <typename Piter> void compute_sites_(Point_Iterator<Piter>& piter) const; /// \} @@ -112,21 +113,19 @@ util::edge_id ref_edge_id = piter.p_ref().id(); sites_t& sites = piter.sites(); sites.clear(); - /* FIXME: Move this computation out of the window. In fact, + /* FIXME: Move this computation out of the neighborhood. In fact, this should be a service of the graph, also proposed by the p_line_graph. */ // Ajacent edges connected through node 1. - // FIXME: Far too low-level. util::node_id id1 = piter.p_ref().first_id(); const util::node<P>& node1 = piter.plg().gr_->node(id1); for (std::vector<util::edge_id>::const_iterator e = node1.edges.begin(); e != node1.edges.end(); ++e) - /* We explicitely enforce that the reference piter edge id is - not inserted into SITES. */ + // We explicitly enforce that the reference piter edge id is + // *not* inserted into SITES. if (*e != ref_edge_id) sites.insert(*e); // Ajacent edges connected through node 2. - // FIXME: Likewise. util::node_id id2 = piter.p_ref().second_id(); const util::node<P>& node2 = piter.plg().gr_->node(id2); for (std::vector<util::edge_id>::const_iterator e = Index: tests/core/line_graph_image.cc --- tests/core/line_graph_image.cc (revision 1908) +++ tests/core/line_graph_image.cc (working copy) @@ -110,7 +110,7 @@ mln_qiter_(win_t) q(win, p); for_all (p) { - std::cout << "neighbors of " << p << " (" << ima(p) << "), " + std::cout << "sites adjacent to " << p << " (" << ima(p) << "), " << "including the site itself:" << std::endl; for_all (q) std::cout << " " << q << " (level = " << ima(q) << ")"