287 bool firstItem =
true;
289 double lastLon = 0.0;
290 double lastLat = 0.0;
297 for (
unsigned i=0; i < way.second.size(); ++i) {
298 Key ref = way.second[way.second.size()-1 - i];
301 if (nptr ==
nullptr)
continue;
302 if (nptr->first._lon == 0 && nptr->first._lat == 0)
continue;
304 if (nptr->first._used == 0) {
305 if (firstItem == false) {
306 dist += calcDist(nptr->first._lon, nptr->first._lat, lastLon, lastLat);
307 lastLon = nptr->first._lon;
308 lastLat = nptr->first._lat;
316 if (vptr ==
nullptr) {
319 vertex.first._way = wayosmid;
320 vertex.first._lon = nptr->first._lon;
321 vertex.first._lat = nptr->first._lat;
325 dist +=
calcDist(vertex.first._lon, vertex.first._lat, lastLon, lastLat);
326 vertex.second.push_back(last);
327 distance.second.push_back(dist);
329 lastLon = nptr->first._lon;
330 lastLat = nptr->first._lat;
337 dist +=
calcDist(vptr->first._lon, vptr->first._lat, lastLon, lastLat);
338 vptr->second.push_back(last);
339 dptr->second.push_back(dist);
341 lastLon = nptr->first._lon;
342 lastLat = nptr->first._lat;
358 if (way.first._oneway ==
false) {
359 for (
unsigned i=0; i < way.second.size(); ++i) {
360 Key ref = way.second[i];
363 if (nptr ==
nullptr)
continue;
364 if (nptr->first._lon == 0 && nptr->first._lat == 0)
continue;
366 if (nptr->first._used == 0) {
367 if (firstItem ==
false) {
368 dist +=
calcDist(nptr->first._lon, nptr->first._lat, lastLon, lastLat);
369 lastLon = nptr->first._lon;
370 lastLat = nptr->first._lat;
378 if (vptr ==
nullptr) {
381 vertex.first._way = wayosmid;
382 vertex.first._lon = nptr->first._lon;
383 vertex.first._lat = nptr->first._lat;
387 dist +=
calcDist(vertex.first._lon, vertex.first._lat, lastLon, lastLat);
388 vertex.second.push_back(last);
389 distance.second.push_back(dist);
391 lastLon = nptr->first._lon;
392 lastLat = nptr->first._lat;
399 dist +=
calcDist(vptr->first._lon, vptr->first._lat, lastLon, lastLat);
400 vptr->second.push_back(last);
401 dptr->second.push_back(dist);
403 lastLon = nptr->first._lon;
404 lastLat = nptr->first._lat;
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
Color c
Definition: osm2graph_bitmap.cpp:123
Ways_t * ways
Definition: osm2graph_bitmap.cpp:86
Color toColor(double id)
Definition: osm2graph_bitmap.cpp:127
SwappyItems< Key, Vertex, FILE_ITEMS, FILE_MULTI, RAM_MULTI, BBITS, BMASK > Vertices_t
Definition: osm2graph_bitmap.cpp:90
#define LAT_BOUND
Definition: osm2graph_bitmap.cpp:42
#define IMAGE_HEIGHT
Definition: osm2graph_bitmap.cpp:15
#define LON_BOUND_DIF
Definition: osm2graph_bitmap.cpp:41
SwappyItems< Key, Distance, FILE_ITEMS, FILE_MULTI, RAM_MULTI, BBITS, BMASK > Distance_t
Definition: osm2graph_bitmap.cpp:92
#define LON_BOUND
Definition: osm2graph_bitmap.cpp:40
double pos
Definition: osm2graph_bitmap.cpp:125
SwappyItems< Key, WayData, FILE_ITEMS, FILE_MULTI, RAM_MULTI, BBITS, BMASK > Ways_t
Definition: osm2graph_bitmap.cpp:84
Nodes_t * nodes
Definition: osm2graph_bitmap.cpp:87
#define IMAGE_WIDTH
Definition: osm2graph_bitmap.cpp:14
Distance_t * distances
Definition: osm2graph_bitmap.cpp:93
SwappyItems< Key, NodeData, FILE_ITEMS, FILE_MULTI, RAM_MULTI, BBITS, BMASK > Nodes_t
Definition: osm2graph_bitmap.cpp:85
Key calcDist(double lon1, double lat1, double lon2, double lat2)
Definition: osm2graph_bitmap.cpp:99
Bmp bild
Definition: osm2graph_bitmap.cpp:122
Vertices_t * verticies
Definition: osm2graph_bitmap.cpp:91
#define LAT_BOUND_DIF
Definition: osm2graph_bitmap.cpp:43
void init(int pwidth, int pheight)
Definition: Bmp.hpp:60
Color & get(int x, int y)
Definition: Bmp.hpp:34
void write(const char *filename)
Definition: Bmp.hpp:97
BMP_byte blue
Definition: Bmp.hpp:12
BMP_byte red
Definition: Bmp.hpp:14
BMP_byte green
Definition: Bmp.hpp:13
Definition: osm2graph.cpp:120