static inline void discard_clusters(Turns& turns, Clusters const& clusters, Geometry0 const& geometry0, Geometry1 const& geometry1) { for (typename Clusters::const_iterator cit = clusters.begin(); cit != clusters.end(); ++cit) { signed_size_type cluster_id = cit->first; // If there are only self-turns in the cluster, the cluster should // be located within the other geometry, for intersection if (is_self_cluster(cluster_id, turns, clusters)) { cluster_info const& cinfo = cit->second; if (! within(turns[*cinfo.turn_indices.begin()], geometry0, geometry1)) { // Discard all turns in cluster for (std::set<signed_size_type>::const_iterator sit = cinfo.turn_indices.begin(); sit != cinfo.turn_indices.end(); ++sit) { turns[*sit].discarded = true; } } } } }
void visit_clusters(Clusters const& clusters, Turns const& turns) { typedef typename boost::range_value<Turns>::type turn_type; int index = 0; BOOST_FOREACH(turn_type const& turn, turns) { if (turn.cluster_id >= 0) { std::cout << " TURN: " << index << " part of cluster " << turn.cluster_id << std::endl; } index++; } for (typename Clusters::const_iterator it = clusters.begin(); it != clusters.end(); ++it) { std::cout << " CLUSTER " << it->first << ": "; for (typename std::set<bg::signed_size_type>::const_iterator sit = it->second.turn_indices.begin(); sit != it->second.turn_indices.end(); ++sit) { std::cout << " " << *sit; } std::cout << std::endl; } std::cout << std::endl; }