|
@@ -85,9 +85,6 @@ void StatIdx::readFromFile(const std::string& path) {
|
85
|
rec >> conf;
|
85
|
rec >> conf;
|
86
|
rec >> otherId;
|
86
|
rec >> otherId;
|
87
|
|
87
|
|
88
|
- std::cout << id << " " << attr << " " << otherAttr << " " << conf << " "
|
|
|
89
|
- << otherId << std::endl;
|
|
|
90
|
-
|
|
|
91
|
_stations[id].attrErrs.push_back({attr, otherAttr, conf, otherId});
|
88
|
_stations[id].attrErrs.push_back({attr, otherAttr, conf, otherId});
|
92
|
}
|
89
|
}
|
93
|
|
90
|
|
|
@@ -99,7 +96,6 @@ void StatIdx::readFromFile(const std::string& path) {
|
99
|
// _____________________________________________________________________________
|
96
|
// _____________________________________________________________________________
|
100
|
void StatIdx::addStation(size_t osmid, double lat, double lng, size_t origGroup,
|
97
|
void StatIdx::addStation(size_t osmid, double lat, double lng, size_t origGroup,
|
101
|
size_t group, const OsmAttrs& attrs) {
|
98
|
size_t group, const OsmAttrs& attrs) {
|
102
|
- std::cout << "Record: " << osmid << " " << lat << " " << lng << std::endl;
|
|
|
103
|
auto point = util::geo::latLngToWebMerc<double>(lat, lng);
|
99
|
auto point = util::geo::latLngToWebMerc<double>(lat, lng);
|
104
|
|
100
|
|
105
|
_stations.emplace_back(
|
101
|
_stations.emplace_back(
|
|
@@ -111,7 +107,6 @@ void StatIdx::addStation(size_t osmid, double lat, double lng, size_t origGroup,
|
111
|
|
107
|
|
112
|
// _____________________________________________________________________________
|
108
|
// _____________________________________________________________________________
|
113
|
void StatIdx::addGroup(size_t osmid, const OsmAttrs& attrs) {
|
109
|
void StatIdx::addGroup(size_t osmid, const OsmAttrs& attrs) {
|
114
|
- std::cout << osmid << std::endl;
|
|
|
115
|
Group g;
|
110
|
Group g;
|
116
|
g.id = _groups.size();
|
111
|
g.id = _groups.size();
|
117
|
g.osmid = osmid;
|
112
|
g.osmid = osmid;
|
|
@@ -129,7 +124,6 @@ void StatIdx::initGroups() {
|
129
|
assert(_stations[i].group < _groups.size());
|
124
|
assert(_stations[i].group < _groups.size());
|
130
|
if (_stations[i].group != _stations[i].origGroup &&
|
125
|
if (_stations[i].group != _stations[i].origGroup &&
|
131
|
_groups[_stations[i].group].osmid == 1) {
|
126
|
_groups[_stations[i].group].osmid == 1) {
|
132
|
- std::cout << "MURR" << std::endl;
|
|
|
133
|
// only add non-orig groups to polygons of new (non-osm) groups
|
127
|
// only add non-orig groups to polygons of new (non-osm) groups
|
134
|
_groups[_stations[i].group].stations.push_back(i);
|
128
|
_groups[_stations[i].group].stations.push_back(i);
|
135
|
}
|
129
|
}
|
|
@@ -311,10 +305,14 @@ util::geo::DLine StatIdx::getGroupArrow(size_t stat, size_t group) const {
|
311
|
auto pl = util::geo::PolyLine<double>(a, b);
|
305
|
auto pl = util::geo::PolyLine<double>(a, b);
|
312
|
auto bb = pl.getPointAtDist(fmax(pl.getLength() / 2, pl.getLength() - 20)).p;
|
306
|
auto bb = pl.getPointAtDist(fmax(pl.getLength() / 2, pl.getLength() - 20)).p;
|
313
|
|
307
|
|
|
|
308
|
+ if (util::geo::dist(a, bb) < 0.0001) {
|
|
|
309
|
+ bb = a;
|
|
|
310
|
+ bb.setX(bb.getX() + 10);
|
|
|
311
|
+ }
|
|
|
312
|
+
|
314
|
int side = rand() % 2;
|
313
|
int side = rand() % 2;
|
315
|
if (!side) side = -1;
|
314
|
if (!side) side = -1;
|
316
|
|
315
|
|
317
|
-
|
|
|
318
|
auto rot1 = util::geo::rotate(util::geo::DLine{a, bb}, 45 * side, a);
|
316
|
auto rot1 = util::geo::rotate(util::geo::DLine{a, bb}, 45 * side, a);
|
319
|
auto rot2 = util::geo::rotate(util::geo::DLine{a, bb}, -20 * side, bb);
|
317
|
auto rot2 = util::geo::rotate(util::geo::DLine{a, bb}, -20 * side, bb);
|
320
|
|
318
|
|
|
@@ -324,11 +322,13 @@ util::geo::DLine StatIdx::getGroupArrow(size_t stat, size_t group) const {
|
324
|
util::geo::intersection(util::geo::LineSegment<double>{rot1[0], rot1[1]},
|
322
|
util::geo::intersection(util::geo::LineSegment<double>{rot1[0], rot1[1]},
|
325
|
util::geo::LineSegment<double>{rot2[0], rot2[1]});
|
323
|
util::geo::LineSegment<double>{rot2[0], rot2[1]});
|
326
|
|
324
|
|
327
|
- auto line = util::geo::BezierCurve<double>(a, i, rot3[0], bb).render(1).getLine();
|
|
|
|
|
325
|
+ auto line =
|
|
|
326
|
+ util::geo::BezierCurve<double>(a, i, rot3[0], bb).render(1).getLine();
|
328
|
|
327
|
|
329
|
// arrowhead
|
328
|
// arrowhead
|
330
|
auto pl2 = util::geo::PolyLine<double>(line);
|
329
|
auto pl2 = util::geo::PolyLine<double>(line);
|
331
|
- util::geo::LineSegment<double> headSeg(pl2.getPointAtDist(pl2.getLength() - 5).p, line.back());
|
|
|
|
|
330
|
+ util::geo::LineSegment<double> headSeg(
|
|
|
331
|
+ pl2.getPointAtDist(pl2.getLength() - 5).p, line.back());
|
332
|
auto arrHeadLeft = util::geo::rotate(headSeg, -45, line.back()).first;
|
332
|
auto arrHeadLeft = util::geo::rotate(headSeg, -45, line.back()).first;
|
333
|
auto arrHeadRight = util::geo::rotate(headSeg, 45, line.back()).first;
|
333
|
auto arrHeadRight = util::geo::rotate(headSeg, 45, line.back()).first;
|
334
|
|
334
|
|