Patrick Brosi 4 år sedan
förälder
incheckning
b305ed4cba
5 ändrade filer med 157 tillägg och 32 borttagningar
  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 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 149
     assert(_stations[i].group < _groups.size());
146 150
     if (_stations[i].group != _stations[i].origGroup &&
147 151
         _groups[_stations[i].group].osmid == 1) {
@@ -478,14 +482,28 @@ void StatIdx::initSuggestions() {
478 482
           b.setX(b.getX() + 50);
479 483
           b.setY(b.getY() + 50);
480 484
 
481
-          std::cout << util::geo::getWKT(b) << std::endl;
482
-
483 485
           sug.arrow = getGroupArrow(i, b);
484 486
 
485 487
           _suggestions.push_back(sug);
486 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 26
   uint16_t type;
27 27
   size_t station;
28 28
   size_t target_gid, orig_gid, target_osm_rel_id, orig_osm_rel_id;
29
+  std::string attrErrName;
29 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 411
   json << ",\"su\":[";
412 412
 
413
+  char seper = ' ';
414
+
413 415
   // suggestions
414 416
   if (stat->group != stat->origGroup ||
415 417
       _idx->getGroup(stat->group)->osmid == 1) {
416 418
     if (_idx->getGroup(stat->origGroup)->osmid < 2) {
417 419
       if (_idx->getGroup(stat->group)->osmid == 1) {
418 420
         json << "{\"type\": 1, \"target_gid\":" << stat->group << "}";
421
+        seper = ',';
419 422
       } else if (_idx->getGroup(stat->group)->osmid > 1) {
420 423
         json << "{\"type\": 2, \"target_gid\":" << stat->group
421 424
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
422 425
              << "}";
426
+        seper = ',';
423 427
       }
424 428
     } else {
425 429
       if (_idx->getGroup(stat->group)->osmid == 1 &&
@@ -428,6 +432,7 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
428 432
              << ",\"orig_osm_rel_id\":"
429 433
              << _idx->getGroup(stat->origGroup)->osmid
430 434
              << ",\"target_gid\":" << stat->group << "}";
435
+        seper = ',';
431 436
       } else if (_idx->getGroup(stat->group)->osmid > 1) {
432 437
         json << "{\"type\": 4,\"orig_gid\":" << stat->origGroup
433 438
              << ",\"orig_osm_rel_id\":"
@@ -435,6 +440,7 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
435 440
              << ",\"target_gid\":" << stat->group
436 441
              << ",\"target_osm_rel_id\":" << _idx->getGroup(stat->group)->osmid
437 442
              << "}";
443
+        seper = ',';
438 444
       } else {
439 445
         json << "{\"type\": 5,\"orig_gid\":" << stat->origGroup
440 446
              << ",\"orig_osm_rel_id\":"
@@ -442,10 +448,21 @@ util::http::Answer StatServer::handleStatReq(const Params& pars) const {
442 448
              << ",\"target_gid\":" << stat->group
443 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 466
   json << "]";
450 467
 
451 468
   json << "}";

+ 81 - 12
web/index.html

@@ -12,18 +12,24 @@
12 12
     <script src="leaflet-heat.js"></script>
13 13
 
14 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 18
     <style>
17 19
         body {
18 20
             padding: 0;
19 21
             margin: 0;
20
-            font-family: sans-serif;
22
+            font-family: 'Roboto', sans-serif;
21 23
         }
22 24
         html, body {
23 25
             height: 100%;
24 26
             width: 100%;
25 27
         }
26 28
 
29
+        tt {
30
+            font-family: Inconsolata, monospace;
31
+        }
32
+
27 33
         #attr-tbl tr {
28 34
             background-color: #c0f7c0;
29 35
         }
@@ -70,15 +76,16 @@
70 76
 
71 77
         #attr-tbl {
72 78
             margin-top: 10px;
79
+            width: 100%;
73 80
         }
74 81
 
75
-        #sugg .sugtit, .oldmemberstit, .newmemberstit {
82
+        .sugtit, .oldmemberstit, .newmemberstit {
76 83
             font-style: normal;
77 84
             font-weight: bold;
78 85
         }
79 86
 
80 87
         #group-stations-new, #group-stations-old {
81
-                        margin-top: 8px;
88
+             margin-top: 8px;
82 89
             padding-top: 4px;
83 90
             border-top: solid 1px #AAA;
84 91
         }
@@ -103,14 +110,21 @@
103 110
             margin-top: 8px;
104 111
             padding-top: 4px;
105 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 122
         #logo {
123
+            text-decoration: none;
124
+            font-weight:600;
111 125
             font-family: 'Nunito', sans-serif;
112
-            font-size: 50px;
113
-                position: absolute;
126
+            font-size: 60px;
127
+            position: absolute;
114 128
     z-index:1000;
115 129
     top: 0.3em;
116 130
     right: 1em;
@@ -119,15 +133,44 @@
119 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 167
         .leaflet-control-zoom-in,
127 168
         .leaflet-control-zoom-out {
128 169
             border-radius: 25px !important;
129
-            border: 1px solid #333;
170
+            border: 1px solid #333 !important;
130 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 176
         .leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
@@ -159,14 +202,40 @@
159 202
 
160 203
 .grouplink {
161 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 234
     </style>
166 235
 </head>
167 236
 <body>
168 237
 
169
-    <div id="logo">staty</div>
238
+    <a id="logo" class="noselect"href="/">staty</a>
170 239
 
171 240
 <div id="map" style="width: 100%;height: 100%;"></div>
172 241
 <script src="script.js">

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 38 - 18
web/script.js