2296: Update line graph elementary neighborhood and window.

* mln/core/image/line_graph_elt_neighborhood.hh, * mln/core/image/line_graph_elt_window.hh (mln::line_graph_elt_neighborhood<P>::site) (mln::line_graph_elt_window<P>::site): Deduce these typedefs from their respective psites. (mln::line_graph_elt_neighborhood<P>::compute_sites_) (mln::line_graph_elt_window<P>::compute_sites_): Adjust to the new psite interface. s/pref()/center()/. s/plg()/center().site_set()/. --- milena/ChangeLog | 15 +++++++++++++++ .../mln/core/image/line_graph_elt_neighborhood.hh | 19 ++++++++++--------- milena/mln/core/image/line_graph_elt_window.hh | 16 +++++++++------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 763076d..f41074f 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,20 @@ 2008-09-17 Roland Levillain <roland@lrde.epita.fr> + Update line graph elementary neighborhood and window. + + * mln/core/image/line_graph_elt_neighborhood.hh, + * mln/core/image/line_graph_elt_window.hh + (mln::line_graph_elt_neighborhood<P>::site) + (mln::line_graph_elt_window<P>::site): + Deduce these typedefs from their respective psites. + (mln::line_graph_elt_neighborhood<P>::compute_sites_) + (mln::line_graph_elt_window<P>::compute_sites_): + Adjust to the new psite interface. + s/pref()/center()/. + s/plg()/center().site_set()/. + +2008-09-17 Roland Levillain <roland@lrde.epita.fr> + Add a site_set accessor on site_relative_iterator_base. * mln/core/internal/site_relative_iterator_base.hh diff --git a/milena/mln/core/image/line_graph_elt_neighborhood.hh b/milena/mln/core/image/line_graph_elt_neighborhood.hh index 80dc0f3..38b7d8f 100644 --- a/milena/mln/core/image/line_graph_elt_neighborhood.hh +++ b/milena/mln/core/image/line_graph_elt_neighborhood.hh @@ -38,7 +38,9 @@ - mln::graph_elt_window - mln::graph_elt_neighborhood - mln::line_graph_elt_window - - mln::line_graph_elt_neighborhood. */ + - mln::line_graph_elt_neighborhood. + + See https://trac.lrde.org/olena/ticket/139. */ /* FIXME: Due to the poor interface of mln::p_line_graph and mln::util::graph, we show to much implementation details here. @@ -70,10 +72,10 @@ namespace mln public: /// Associated types. /// \{ - /// The type of site corresponding to the neighborhood. - typedef P site; /// The type of psite corresponding to the neighborhood. typedef line_graph_psite<P> psite; + /// The type of site corresponding to the neighborhood. + typedef mln_site(psite) site; // The type of the set of neighbors (edge ids adjacent to the // reference psite). typedef std::set<util::edge_id> sites_t; @@ -98,7 +100,6 @@ namespace mln window to_window() const; /// \} - /// Services for iterators. /// \{ /// Compute the set of sites for this neighborhood around \a piter. @@ -126,15 +127,15 @@ namespace mln line_graph_elt_neighborhood<P>::compute_sites_(Site_Iterator<Piter>& piter_) const { Piter& piter = exact(piter_); - util::edge_id ref_edge_id = piter.p_ref().id(); + util::edge_id ref_edge_id = piter.center().edge_id(); sites_t& sites = piter.sites(); sites.clear(); /* 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 vertex 1. - util::vertex_id id1 = piter.p_ref().first_id(); - const util::vertex<P>& vertex1 = piter.plg().gr_->vertex(id1); + util::vertex_id id1 = piter.center().first_id(); + const util::vertex<P>& vertex1 = piter.center().site_set().gr_->vertex(id1); for (std::vector<util::edge_id>::const_iterator e = vertex1.edges.begin(); e != vertex1.edges.end(); ++e) // We explicitly enforce that the reference piter edge id is @@ -142,8 +143,8 @@ namespace mln if (*e != ref_edge_id) sites.insert(*e); // Ajacent edges connected through vertex 2. - util::vertex_id id2 = piter.p_ref().second_id(); - const util::vertex<P>& vertex2 = piter.plg().gr_->vertex(id2); + util::vertex_id id2 = piter.center().second_id(); + const util::vertex<P>& vertex2 = piter.center().site_set().gr_->vertex(id2); for (std::vector<util::edge_id>::const_iterator e = vertex2.edges.begin(); e != vertex2.edges.end(); ++e) // Same remark as above. diff --git a/milena/mln/core/image/line_graph_elt_window.hh b/milena/mln/core/image/line_graph_elt_window.hh index 04bc542..8649372 100644 --- a/milena/mln/core/image/line_graph_elt_window.hh +++ b/milena/mln/core/image/line_graph_elt_window.hh @@ -38,7 +38,9 @@ - mln::graph_elt_window - mln::graph_elt_neighborhood - mln::line_graph_elt_window - - mln::line_graph_elt_neighborhood. */ + - mln::line_graph_elt_neighborhood. + + See https://trac.lrde.org/olena/ticket/139. */ /* FIXME: Due to the poor interface of mln::p_line_graph and mln::util::graph, we show to much implementation details here. @@ -65,10 +67,10 @@ namespace mln public: /// Associated types. /// \{ - /// The type of site corresponding to the window. - typedef P site; /// The type of psite corresponding to the window. typedef line_graph_psite<P> psite; + /// The type of site corresponding to the window. + typedef mln_site(psite) site; // The type of the set of window sites (edge ids adjacent to the // reference psite). typedef std::set<util::edge_id> sites_t; @@ -142,14 +144,14 @@ namespace mln id) itself into SITES, since it is part of the set of edges adjacent to VERTEX1 and VERTEX2, and will therefore be automatically added. */ - util::vertex_id id1 = piter.p_ref().first_id(); - const util::vertex<P>& vertex1 = piter.plg().gr_->vertex(id1); + util::vertex_id id1 = piter.center().first_id(); + const util::vertex<P>& vertex1 = piter.center().site_set().gr_->vertex(id1); for (std::vector<util::edge_id>::const_iterator e = vertex1.edges.begin(); e != vertex1.edges.end(); ++e) sites.insert(*e); // Ajacent edges connected through vertex 2. - util::vertex_id id2 = piter.p_ref().second_id(); - const util::vertex<P>& vertex2 = piter.plg().gr_->vertex(id2); + util::vertex_id id2 = piter.center().second_id(); + const util::vertex<P>& vertex2 = piter.center().site_set().gr_->vertex(id2); for (std::vector<util::edge_id>::const_iterator e = vertex2.edges.begin(); e != vertex2.edges.end(); ++e) sites.insert(*e); -- 1.6.0.1
participants (1)
-
Roland Levillain