diff --git a/include/property.hpp b/include/property.hpp index 62cfff92cf65ddc41efb840bf91009bf3b3b0883..7a070938b3d63dd897b27a3cc9a0099fb5232aa9 100644 --- a/include/property.hpp +++ b/include/property.hpp @@ -267,6 +267,20 @@ public: } } + //! \brief Retourne les coordonées comme un Neighborhood, les cellules voisines étant d'état 1 + Neighborhood to_neighborhood() const + { + Neighborhood n; + for (const auto& ptr : contents) + { + Property& prop = *ptr; + CoordinateProperty& coord_p = static_cast<CoordinateProperty&>(prop); + n.addNeighbor(coord_p.c, 1); + } + + return n; + } + public: //! \brief Vrai si la liste est extensible, faux si elle est fixe. const bool dynamic;