| 238 | } |
| 239 | |
| 240 | std::vector<std::size_t> getEdgeIndex(const std::vector<RTreeLeaf> &edges) |
| 241 | { |
| 242 | // In order to ensure consistent tile encoding, we need to process |
| 243 | // all edges in the same order. Differences in OSX/Linux/Windows |
| 244 | // sorting methods mean that GetEdgesInBox doesn't return the same |
| 245 | // ordered array on all platforms. |
| 246 | // GetEdgesInBox is marked `const`, so we can't sort the array itself, |
| 247 | // instead we create an array of indexes and sort that instead. |
| 248 | std::vector<std::size_t> sorted_edge_indexes(edges.size(), 0); |
| 249 | std::iota( |
| 250 | sorted_edge_indexes.begin(), sorted_edge_indexes.end(), 0); // fill with 0,1,2,3,...N-1 |
| 251 | |
| 252 | // Now, sort that array based on the edges list, using the u/v node IDs |
| 253 | // as the sort condition |
| 254 | std::sort(sorted_edge_indexes.begin(), |
| 255 | sorted_edge_indexes.end(), |
| 256 | [&edges](const std::size_t &left, const std::size_t &right) -> bool |
| 257 | { |
| 258 | return (edges[left].u != edges[right].u) ? edges[left].u < edges[right].u |
| 259 | : edges[left].v < edges[right].v; |
| 260 | }); |
| 261 | |
| 262 | return sorted_edge_indexes; |
| 263 | } |
| 264 | |
| 265 | std::vector<NodeID> getSegregatedNodes(const DataFacadeBase &facade, |
| 266 | const std::vector<RTreeLeaf> &edges) |
no test coverage detected