Patrick Brosi 4 years ago
parent
commit
b305ed4cba
5 changed files with 157 additions and 32 deletions
  1. 20 2
      src/osmfixer/index/StatIdx.cpp
  2. 1 0
      src/osmfixer/index/StatIdx.h
  3. 17 0
      src/osmfixer/server/StatServer.cpp
  4. 81 12
      web/index.html
  5. 38 18
      web/script.js

+ 20 - 2
src/osmfixer/index/StatIdx.cpp

@@ -142,6 +142,10 @@ void StatIdx::initGroups() {
142
 
142
 
143
     _groups[_stations[i].group].stations.push_back(i);
143
     _groups[_stations[i].group].stations.push_back(i);
144
 
144
 
145
+    if (_stations[i].group != _stations[i].origGroup) {
146
+      _groups[_stations[i].origGroup].stations.push_back(i);
147
+    }
148
+
145
     assert(_stations[i].group < _groups.size());
149
     assert(_stations[i].group < _groups.size());
146
     if (_stations[i].group != _stations[i].origGroup &&
150
     if (_stations[i].group != _stations[i].origGroup &&
147
         _groups[_stations[i].group].osmid == 1) {
151
         _groups[_stations[i].group].osmid == 1) {
@@ -478,14 +482,28 @@ void StatIdx::initSuggestions() {
478
           b.setX(b.getX() + 50);
482
           b.setX(b.getX() + 50);
479
           b.setY(b.getY() + 50);
483
           b.setY(b.getY() + 50);
480
 
484
 
481
-          std::cout << util::geo::getWKT(b) << std::endl;
482
-
483
           sug.arrow = getGroupArrow(i, b);
485
           sug.arrow = getGroupArrow(i, b);
484
 
486
 
485
           _suggestions.push_back(sug);
487
           _suggestions.push_back(sug);
486
           stat.suggestions.push_back(_suggestions.size() - 1);
488
           stat.suggestions.push_back(_suggestions.size() - 1);
487
         }
489
         }
488
       }
490
       }
491
+
492
+      for (auto attrErr : stat.attrErrs) {
493
+        const auto otherStat = getStation(attrErr.otherId);
494
+        if (otherStat->osmid == stat.osmid) {
495
+          // fix attributes
496
+          sug.type = 6;
497
+          sug.orig_gid = 0;
498
+          sug.orig_osm_rel_id = 0;
499
+          sug.target_gid = 0;
500
+          sug.target_osm_rel_id = 0;
501
+          sug.attrErrName = attrErr.attr;
502
+
503
+          _suggestions.push_back(sug);
504
+          stat.suggestions.push_back(_suggestions.size() - 1);
505
+        }
506
+      }
489
     }
507
     }
490
   }
508
   }
491
 }
509
 }

+ 1 - 0
src/osmfixer/index/StatIdx.h

@@ -26,6 +26,7 @@ struct Suggestion {
26
   uint16_t type;
26
   uint16_t type;
27
   size_t station;
27
   size_t station;
28
   size_t target_gid, orig_gid, target_osm_rel_id, orig_osm_rel_id;
28
   size_t target_gid, orig_gid, target_osm_rel_id, orig_osm_rel_id;
29
+  std::string attrErrName;
29
   util::geo::DLine arrow;
30
   util::geo::DLine arrow;
30
 };
31
 };
31
 
32
 

+ 17 - 0
src/osmfixer/server/StatServer.cpp

@@ -410,16 +410,20 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
410
 
410
 
411
   json << ",\"su\":[";
411
   json << ",\"su\":[";
412
 
412
 
413
+  char seper = ' ';
414
+
413
   // suggestions
415
   // suggestions
414
   if (stat->group != stat->origGroup ||
416
   if (stat->group != stat->origGroup ||
415
       _idx->getGroup(stat->group)->osmid == 1) {
417
       _idx->getGroup(stat->group)->osmid == 1) {
416
     if (_idx->getGroup(stat->origGroup)->osmid < 2) {
418
     if (_idx->getGroup(stat->origGroup)->osmid < 2) {
417
       if (_idx->getGroup(stat->group)->osmid == 1) {
419
       if (_idx->getGroup(stat->group)->osmid == 1) {
418
         json << "{\"type\": 1, \"target_gid\":" << stat->group << "}";
420
         json << "{\"type\": 1, \"target_gid\":" << stat->group << "}";
421
+        seper = ',';
419
       } else if (_idx->getGroup(stat->group)->osmid > 1) {
422
       } else if (_idx->getGroup(stat->group)->osmid > 1) {
420
         json << "{\"type\": 2, \"target_gid\":" << stat->group
423
         json << "{\"type\": 2, \"target_gid\":" << stat->group
421
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
424
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
422
              << "}";
425
              << "}";
426
+        seper = ',';
423
       }
427
       }
424
     } else {
428
     } else {
425
       if (_idx->getGroup(stat->group)->osmid == 1 &&
429
       if (_idx->getGroup(stat->group)->osmid == 1 &&
@@ -428,6 +432,7 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
428
              << ",\"orig_osm_rel_id\":"
432
              << ",\"orig_osm_rel_id\":"
429
              << _idx->getGroup(stat->origGroup)->osmid
433
              << _idx->getGroup(stat->origGroup)->osmid
430
              << ",\"target_gid\":" << stat->group << "}";
434
              << ",\"target_gid\":" << stat->group << "}";
435
+        seper = ',';
431
       } else if (_idx->getGroup(stat->group)->osmid > 1) {
436
       } else if (_idx->getGroup(stat->group)->osmid > 1) {
432
         json << "{\"type\": 4,\"orig_gid\":" << stat->origGroup
437
         json << "{\"type\": 4,\"orig_gid\":" << stat->origGroup
433
              << ",\"orig_osm_rel_id\":"
438
              << ",\"orig_osm_rel_id\":"
@@ -435,6 +440,7 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
435
              << ",\"target_gid\":" << stat->group
440
              << ",\"target_gid\":" << stat->group
436
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
441
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
437
              << "}";
442
              << "}";
443
+        seper = ',';
438
       } else {
444
       } else {
439
         json << "{\"type\": 5,\"orig_gid\":" << stat->origGroup
445
         json << "{\"type\": 5,\"orig_gid\":" << stat->origGroup
440
              << ",\"orig_osm_rel_id\":"
446
              << ",\"orig_osm_rel_id\":"
@@ -442,10 +448,21 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
442
              << ",\"target_gid\":" << stat->group
448
              << ",\"target_gid\":" << stat->group
443
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
449
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
444
              << "}";
450
              << "}";
451
+        seper = ',';
445
       }
452
       }
446
     }
453
     }
447
   }
454
   }
448
 
455
 
456
+  for (auto attrErr : stat->attrErrs) {
457
+    const auto otherStat = _idx->getStation(attrErr.otherId);
458
+    if (otherStat->osmid == stat->osmid) {
459
+      // fix attributes
460
+      json << seper << "{\"type\": 6,\"attr\":\"" << attrErr.attr << "\""
461
+           << "}";
462
+      seper = ',';
463
+    }
464
+  }
465
+
449
   json << "]";
466
   json << "]";
450
 
467
 
451
   json << "}";
468
   json << "}";

+ 81 - 12
web/index.html

@@ -12,18 +12,24 @@
12
     <script src="leaflet-heat.js"></script>
12
     <script src="leaflet-heat.js"></script>
13
 
13
 
14
     <link href="https://fonts.googleapis.com/css?family=Nunito:600&display=swap" rel="stylesheet">
14
     <link href="https://fonts.googleapis.com/css?family=Nunito:600&display=swap" rel="stylesheet">
15
+    <link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
16
+    <link href="https://fonts.googleapis.com/css?family=Inconsolata&display=swap" rel="stylesheet">
15
 
17
 
16
     <style>
18
     <style>
17
         body {
19
         body {
18
             padding: 0;
20
             padding: 0;
19
             margin: 0;
21
             margin: 0;
20
-            font-family: sans-serif;
22
+            font-family: 'Roboto', sans-serif;
21
         }
23
         }
22
         html, body {
24
         html, body {
23
             height: 100%;
25
             height: 100%;
24
             width: 100%;
26
             width: 100%;
25
         }
27
         }
26
 
28
 
29
+        tt {
30
+            font-family: Inconsolata, monospace;
31
+        }
32
+
27
         #attr-tbl tr {
33
         #attr-tbl tr {
28
             background-color: #c0f7c0;
34
             background-color: #c0f7c0;
29
         }
35
         }
@@ -70,15 +76,16 @@
70
 
76
 
71
         #attr-tbl {
77
         #attr-tbl {
72
             margin-top: 10px;
78
             margin-top: 10px;
79
+            width: 100%;
73
         }
80
         }
74
 
81
 
75
-        #sugg .sugtit, .oldmemberstit, .newmemberstit {
82
+        .sugtit, .oldmemberstit, .newmemberstit {
76
             font-style: normal;
83
             font-style: normal;
77
             font-weight: bold;
84
             font-weight: bold;
78
         }
85
         }
79
 
86
 
80
         #group-stations-new, #group-stations-old {
87
         #group-stations-new, #group-stations-old {
81
-                        margin-top: 8px;
88
+             margin-top: 8px;
82
             padding-top: 4px;
89
             padding-top: 4px;
83
             border-top: solid 1px #AAA;
90
             border-top: solid 1px #AAA;
84
         }
91
         }
@@ -103,14 +110,21 @@
103
             margin-top: 8px;
110
             margin-top: 8px;
104
             padding-top: 4px;
111
             padding-top: 4px;
105
             border-top: solid 1px #AAA;
112
             border-top: solid 1px #AAA;
106
-            color: blue;
107
-            font-style: italic;
113
+            color: #0000c3;
114
+        }
115
+
116
+        #sugg ul {
117
+            padding: 5px;
118
+            margin: 5px;
119
+            padding-top: 0;
108
         }
120
         }
109
 
121
 
110
         #logo {
122
         #logo {
123
+            text-decoration: none;
124
+            font-weight:600;
111
             font-family: 'Nunito', sans-serif;
125
             font-family: 'Nunito', sans-serif;
112
-            font-size: 50px;
113
-                position: absolute;
126
+            font-size: 60px;
127
+            position: absolute;
114
     z-index:1000;
128
     z-index:1000;
115
     top: 0.3em;
129
     top: 0.3em;
116
     right: 1em;
130
     right: 1em;
@@ -119,15 +133,44 @@
119
     opacity: 0.7;
133
     opacity: 0.7;
120
         }
134
         }
121
 
135
 
122
-        .leaflet-control-zoom {
123
-            font-family: 'Nunito', sans-serif;
136
+        .leaflet-control-zoom a {
137
+            font-family: 'Nunito', sans-serif !important;
138
+            font-weight: bold !important;
139
+            font-size: 38px !important;
140
+        }
141
+
142
+        .leaflet-touch .leaflet-bar a {
143
+            width: 40px;
144
+            height: 40px;
145
+            line-height: 38px;
146
+            overflow:hidden;
147
+            display: block;
148
+        }
149
+
150
+        .leaflet-control-zoom-out {
151
+            margin-top: 10px;
152
+        }
153
+
154
+        .leaflet-container {
155
+
156
+font-family: 'Roboto', sans-serif !important;
157
+font-size: 14px;
158
+        }
159
+
160
+        .leaflet-control-attribution a {
161
+font-family: 'Roboto', sans-serif !important;
162
+            
163
+    color: #666 !important;
164
+    font-size: 12px;
124
         }
165
         }
125
 
166
 
126
         .leaflet-control-zoom-in,
167
         .leaflet-control-zoom-in,
127
         .leaflet-control-zoom-out {
168
         .leaflet-control-zoom-out {
128
             border-radius: 25px !important;
169
             border-radius: 25px !important;
129
-            border: 1px solid #333;
170
+            border: 1px solid #333 !important;
130
             opacity: 0.7;
171
             opacity: 0.7;
172
+            text-shadow: -1px -1px 0 #333, 1px -1px 0 #333, -1px 1px 0 #333, 1px 1px 0 #333;
173
+    color: #fff !important;
131
         }
174
         }
132
 
175
 
133
         .leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
176
         .leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
@@ -159,14 +202,40 @@
159
 
202
 
160
 .grouplink {
203
 .grouplink {
161
     cursor: pointer;
204
     cursor: pointer;
162
-    text-decoration: underline
205
+    text-decoration: underline;
206
+    z-index: 1000;
207
+}
208
+
209
+.noselect {
210
+  -webkit-touch-callout: none; /* iOS Safari */
211
+    -webkit-user-select: none; /* Safari */
212
+     -khtml-user-select: none; /* Konqueror HTML */
213
+       -moz-user-select: none; /* Old versions of Firefox */
214
+        -ms-user-select: none; /* Internet Explorer/Edge */
215
+            user-select: none; /* Non-prefixed version, currently
216
+                                  supported by Chrome, Opera and Firefox */
217
+}
218
+
219
+#group-stations-old div.del-stat:before {
220
+    content: "❌";
221
+    position: relative;
222
+    width: 0;
223
+    color: #880000;
224
+    margin-left: -1.15em;
225
+    left: -0.6em;
226
+    padding-right: 0.5em;
227
+}
228
+
229
+#group-stations-old div.del-stat {
230
+    background-color: #F44336;
231
+    border-left: solid 4px #880000;
163
 }
232
 }
164
 
233
 
165
     </style>
234
     </style>
166
 </head>
235
 </head>
167
 <body>
236
 <body>
168
 
237
 
169
-    <div id="logo">staty</div>
238
+    <a id="logo" class="noselect"href="/">staty</a>
170
 
239
 
171
 <div id="map" style="width: 100%;height: 100%;"></div>
240
 <div id="map" style="width: 100%;height: 100%;"></div>
172
 <script src="script.js">
241
 <script src="script.js">

File diff suppressed because it is too large
+ 38 - 18
web/script.js