Patrick Brosi преди 4 години
родител
ревизия
299327db71
променени са 5 файла, в които са добавени 49 реда и са изтрити 7 реда
  1. 2 0
      src/osmfixer/index/StatIdx.cpp
  2. 6 0
      src/osmfixer/index/StatIdx.h
  3. 9 7
      src/osmfixer/server/StatServer.cpp
  4. 31 0
      web/index.html
  5. 1 0
      web/script.js

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

@@ -477,6 +477,8 @@ std::vector<const Station*> StatIdx::getStations(
477 477
     }
478 478
   }
479 479
 
480
+  std::sort(ret.begin(), ret.end(), byErr);
481
+
480 482
   return ret;
481 483
 }
482 484
 

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

@@ -54,6 +54,12 @@ struct Station {
54 54
   std::vector<size_t> suggestions;
55 55
 };
56 56
 
57
+inline bool byErr(const Station* lh, const Station* rh) {
58
+  size_t a = lh->attrErrs.size() ? 2 : lh->suggestions.size() ? 1 : 0;
59
+  size_t b = rh->attrErrs.size() ? 2 : rh->suggestions.size() ? 1 : 0;
60
+  return a < b;
61
+}
62
+
57 63
 struct Group {
58 64
   size_t id;
59 65
   int64_t osmid;

+ 9 - 7
src/osmfixer/server/StatServer.cpp

@@ -207,14 +207,16 @@ util::http::Answer StatServer::handleMapReq(const Params& pars) const {
207 207
 
208 208
   json << "], \"groups\":[";
209 209
   sep = ' ';
210
-  for (size_t did = 0; did < _idxs.size(); did++) {
211
-    const auto& idx = _idxs[did].second;
210
+  if (z > 13) {
211
+    for (size_t did = 0; did < _idxs.size(); did++) {
212
+      const auto& idx = _idxs[did].second;
212 213
 
213
-    const auto& gret = idx.getGroups(bbox);
214
-    for (const auto& group : gret) {
215
-      json << sep;
216
-      sep = ',';
217
-      printGroup(group, did, z < 15, false, &json);
214
+      const auto& gret = idx.getGroups(bbox);
215
+      for (const auto& group : gret) {
216
+        json << sep;
217
+        sep = ',';
218
+        printGroup(group, did, z < 15, false, &json);
219
+      }
218 220
     }
219 221
   }
220 222
 

+ 31 - 0
web/index.html

@@ -571,6 +571,37 @@ padding-left:20px;}
571 571
     line-height: 3.4;
572 572
 }
573 573
 
574
+.z14 .leaflet-overlay-pane {
575
+    opacity: 0.85;
576
+}
577
+
578
+.z13 .leaflet-overlay-pane {
579
+    opacity: 0.7;
580
+}
581
+
582
+.z12 .leaflet-overlay-pane {
583
+    opacity: 0.58;
584
+}
585
+
586
+.z11 .leaflet-overlay-pane {
587
+    opacity: 0.5;
588
+}
589
+
590
+.z10 .leaflet-overlay-pane,
591
+.z9 .leaflet-overlay-pane,
592
+.z8 .leaflet-overlay-pane,
593
+.z7 .leaflet-overlay-pane,
594
+.z6 .leaflet-overlay-pane,
595
+.z5 .leaflet-overlay-pane,
596
+.z4 .leaflet-overlay-pane,
597
+.z3 .leaflet-overlay-pane,
598
+.z2 .leaflet-overlay-pane,
599
+.z1 .leaflet-overlay-pane,
600
+.z0 .leaflet-overlay-pane
601
+ {
602
+    opacity: 0.5;
603
+}
604
+
574 605
 main, #m { width: 100%;height:100%; }
575 606
 
576 607
 #sres.res-open + #del { opacity: 1; }

+ 1 - 0
web/script.js

@@ -392,6 +392,7 @@ var l = L.featureGroup().addTo(map);
392 392
 
393 393
 map.on("moveend", function() {render();});
394 394
 map.on("click", function() {s()});
395
+map.on("zoomend", function() {$("main")[0].className = '';addCl($("main")[0], "z"+map.getZoom())});
395 396
 
396 397
 function render() {
397 398
     if (map.getZoom() < 11) {