220 bool firstItem =
true;
222 double lastLon = 0.0;
223 double lastLat = 0.0;
230 for (
unsigned i=0; i < way.second.size(); ++i) {
231 Key ref = way.second[way.second.size()-1 - i];
234 if (nptr ==
nullptr)
continue;
235 if (nptr->first._lon == 0 && nptr->first._lat == 0)
continue;
237 if (nptr->first._used == 0) {
238 if (firstItem == false) {
239 dist += calcDist(nptr->first._lon, nptr->first._lat, lastLon, lastLat);
240 lastLon = nptr->first._lon;
241 lastLat = nptr->first._lat;
249 if (vptr ==
nullptr) {
252 vertex.first._way = wayosmid;
253 vertex.first._lon = nptr->first._lon;
254 vertex.first._lat = nptr->first._lat;
258 dist +=
calcDist(vertex.first._lon, vertex.first._lat, lastLon, lastLat);
259 vertex.second.push_back(last);
260 distance.second.push_back(dist);
262 lastLon = nptr->first._lon;
263 lastLat = nptr->first._lat;
270 dist +=
calcDist(vptr->first._lon, vptr->first._lat, lastLon, lastLat);
271 vptr->second.push_back(last);
272 dptr->second.push_back(dist);
274 lastLon = nptr->first._lon;
275 lastLat = nptr->first._lat;
291 if (way.first._oneway ==
false) {
292 for (
unsigned i=0; i < way.second.size(); ++i) {
293 Key ref = way.second[i];
296 if (nptr ==
nullptr)
continue;
297 if (nptr->first._lon == 0 && nptr->first._lat == 0)
continue;
299 if (nptr->first._used == 0) {
300 if (firstItem ==
false) {
301 dist +=
calcDist(nptr->first._lon, nptr->first._lat, lastLon, lastLat);
302 lastLon = nptr->first._lon;
303 lastLat = nptr->first._lat;
311 if (vptr ==
nullptr) {
314 vertex.first._way = wayosmid;
315 vertex.first._lon = nptr->first._lon;
316 vertex.first._lat = nptr->first._lat;
320 dist +=
calcDist(vertex.first._lon, vertex.first._lat, lastLon, lastLat);
321 vertex.second.push_back(last);
322 distance.second.push_back(dist);
324 lastLon = nptr->first._lon;
325 lastLat = nptr->first._lat;
332 dist +=
calcDist(vptr->first._lon, vptr->first._lat, lastLon, lastLat);
333 vptr->second.push_back(last);
334 dptr->second.push_back(dist);
336 lastLon = nptr->first._lon;
337 lastLat = nptr->first._lat;
353 printf(
"%ld (%f,%f) part of way %ld\n",
id, v.first._lon, v.first._lat, v.first._way);
354 for (
Key r : v.second) {
355 printf(
" %" PRId64, r);
359 for (
Key r : dptr->second) {
360 printf(
" %" PRId64, r);
std::pair< TVALUE, std::vector< TKEY > > Data
Definition: SwappyItems.hpp:52
Data * get(const TKEY &key)
Definition: SwappyItems.hpp:188
bool each(Data &back, std::function< bool(TKEY, Data &)> foo)
Definition: SwappyItems.hpp:790
bool set(TKEY key, TVALUE value)
Definition: SwappyItems.hpp:123
void read_osm_pbf(const std::string &filename, Visitor &visitor, bool wayOnly)
Definition: osmpbfreader.hpp:359
uint64_t Key
Definition: osm2graph.cpp:48
Definition: osm2graph.cpp:120