Patrick Brosi 4 év óta
szülő
commit
ff29ea156d
3 módosított fájl, 83 hozzáadás és 6 törlés
  1. 52 2
      src/osmfixer/index/StatIdx.cpp
  2. 28 1
      src/osmfixer/index/StatIdx.h
  3. 3 3
      web/script.js

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

@@ -186,6 +186,8 @@ void StatIdx::readFromFile(const std::string& path) {
186 186
     addGroupToMeta(gid, osmid);
187 187
   }
188 188
 
189
+  _numOSMMetaGroups = _metaGroups.size();
190
+
189 191
   LOG(INFO) << "Done.";
190 192
 
191 193
   LOG(INFO) << "Init groups";
@@ -201,6 +203,23 @@ void StatIdx::readFromFile(const std::string& path) {
201 203
   LOG(INFO) << "Building indices...";
202 204
   initIndex();
203 205
   LOG(INFO) << "Done.";
206
+
207
+  LOG(INFO) << "Input Stats:";
208
+  LOG(INFO) << _numOSMStations << " OSM stations";
209
+  LOG(INFO) << _numOSMGroups << " OSM groups";
210
+  LOG(INFO) << _numOSMMetaGroups << " OSM meta groups";
211
+
212
+  LOG(INFO) << "Suggestion Stats:";
213
+  LOG(INFO) << _numOK << " objects OK";
214
+  LOG(INFO) << _numDL << " stations should be removed from their group (DL)";
215
+  LOG(INFO) << _numMV << " stations should be moved into another group (MV)";
216
+  LOG(INFO) << _numGR << " stations should be moved into a group (GR)";
217
+  LOG(INFO) << _numCR
218
+            << " stations should be moved into newly created groups (CR)";
219
+  LOG(INFO) << _numER << " tags were marked as erroneous (ER)";
220
+  LOG(INFO) << _numMG << " relations should be merged (MG)";
221
+  LOG(INFO) << _numNM << " objects should be outfitted with a name (NM)";
222
+  LOG(INFO) << _numTR << " station names are most likely track numbers";
204 223
 }
205 224
 
206 225
 // _____________________________________________________________________________
@@ -214,6 +233,7 @@ void StatIdx::addGroupToMeta(size_t gid, size_t metaId) {
214 233
 void StatIdx::addStation(int64_t osmid, const util::geo::DLine& geom,
215 234
                          const util::geo::DLine& latLngs, size_t origGroup,
216 235
                          size_t group, const OsmAttrs& attrs) {
236
+  _numOSMStations++;
217 237
   auto centroid = util::geo::centroid(latLngs);
218 238
   _stations.emplace_back(Station{_stations.size(),
219 239
                                  osmid,
@@ -232,6 +252,7 @@ void StatIdx::addStation(int64_t osmid, const util::geo::DLine& geom,
232 252
 
233 253
 // _____________________________________________________________________________
234 254
 void StatIdx::addGroup(size_t osmid, const OsmAttrs& attrs) {
255
+  if (osmid > 1) _numOSMGroups++;
235 256
   Group g;
236 257
   g.id = _groups.size();
237 258
   g.osmid = osmid;
@@ -254,7 +275,6 @@ void StatIdx::initMetaGroups() {
254 275
     mg.poly = hull(mp, 11);
255 276
     assert(mg.poly.getOuter().size());
256 277
 
257
-
258 278
     for (auto p : mg.poly.getOuter()) {
259 279
       mg.llPoly.getOuter().push_back(
260 280
           util::geo::webMercToLatLng<double>(p.getX(), p.getY()));
@@ -680,6 +700,8 @@ void StatIdx::initSuggestions() {
680 700
       sug.type = 7;
681 701
       _suggestions.push_back(sug);
682 702
       group.suggestions.push_back(_suggestions.size() - 1);
703
+
704
+      if (group.osmid > 2) _numNM++;
683 705
     }
684 706
 
685 707
     Suggestion sug;
@@ -699,6 +721,8 @@ void StatIdx::initSuggestions() {
699 721
         auto b = util::geo::centroid(
700 722
             getMetaGroup(getGroup(group.mergeId)->metaGroupId)->poly);
701 723
         sug.arrow = getGroupArrow(a, b);
724
+
725
+        _numMG++;
702 726
       } else {
703 727
         // merge two groups
704 728
         sug.type = 9;
@@ -710,6 +734,8 @@ void StatIdx::initSuggestions() {
710 734
         auto a = util::geo::centroid(group.poly);
711 735
         auto b = util::geo::centroid(getGroup(group.mergeId)->poly);
712 736
         sug.arrow = getGroupArrow(a, b);
737
+
738
+        _numMG++;
713 739
       }
714 740
 
715 741
       _suggestions.push_back(sug);
@@ -734,6 +760,9 @@ void StatIdx::initSuggestions() {
734 760
 
735 761
         _suggestions.push_back(sug);
736 762
         group.suggestions.push_back(_suggestions.size() - 1);
763
+
764
+        _numTR++;
765
+        _numER++;
737 766
       } else if (otherGrp->osmid == group.osmid) {
738 767
         if (suggested.count({attrErr.attr, 6})) continue;
739 768
         // fix attributes
@@ -747,8 +776,12 @@ void StatIdx::initSuggestions() {
747 776
 
748 777
         _suggestions.push_back(sug);
749 778
         group.suggestions.push_back(_suggestions.size() - 1);
779
+
780
+        _numER++;
750 781
       }
751 782
     }
783
+
784
+    if (group.suggestions.size() + group.attrErrs.size() == 0) _numOK++;
752 785
   }
753 786
 
754 787
   // station suggestions
@@ -763,6 +796,8 @@ void StatIdx::initSuggestions() {
763 796
       sug.type = 7;
764 797
       _suggestions.push_back(sug);
765 798
       stat.suggestions.push_back(_suggestions.size() - 1);
799
+
800
+      _numNM++;
766 801
     }
767 802
 
768 803
     Suggestion sug;
@@ -789,6 +824,9 @@ void StatIdx::initSuggestions() {
789 824
 
790 825
         _suggestions.push_back(sug);
791 826
         stat.suggestions.push_back(_suggestions.size() - 1);
827
+
828
+        _numTR++;
829
+        _numER++;
792 830
       } else if (otherStat->osmid == stat.osmid) {
793 831
         if (suggested.count({attrErr.attr, 6})) continue;
794 832
         suggested.insert({attrErr.attr, 6});
@@ -802,6 +840,8 @@ void StatIdx::initSuggestions() {
802 840
 
803 841
         _suggestions.push_back(sug);
804 842
         stat.suggestions.push_back(_suggestions.size() - 1);
843
+
844
+        _numER++;
805 845
       }
806 846
     }
807 847
 
@@ -819,6 +859,7 @@ void StatIdx::initSuggestions() {
819 859
           _suggestions.push_back(sug);
820 860
           stat.suggestions.push_back(_suggestions.size() - 1);
821 861
 
862
+          _numCR++;
822 863
         } else if (getGroup(stat.group)->osmid > 1) {
823 864
           // move orphan into existing group
824 865
           sug.type = 2;
@@ -830,6 +871,8 @@ void StatIdx::initSuggestions() {
830 871
 
831 872
           _suggestions.push_back(sug);
832 873
           stat.suggestions.push_back(_suggestions.size() - 1);
874
+
875
+          _numGR++;
833 876
         }
834 877
       } else {
835 878
         if (getGroup(stat.group)->osmid == 1 &&
@@ -845,6 +888,8 @@ void StatIdx::initSuggestions() {
845 888
 
846 889
           _suggestions.push_back(sug);
847 890
           stat.suggestions.push_back(_suggestions.size() - 1);
891
+
892
+          _numCR++;
848 893
         } else if (getGroup(stat.group)->osmid > 1) {
849 894
           if (stat.group != getGroup(stat.origGroup)->mergeId) {
850 895
             // move station from relation into existing group
@@ -852,9 +897,10 @@ void StatIdx::initSuggestions() {
852 897
             sug.target_gid = stat.group;
853 898
             sug.target_osm_rel_id = getGroup(stat.group)->osmid;
854 899
 
855
-            // dont output arrow if move is part of a group merge
856 900
             auto b = util::geo::centroid(getGroup(stat.group)->poly);
857 901
             sug.arrow = getGroupArrow(centroid, b);
902
+
903
+            _numMV++;
858 904
           } else {
859 905
             continue;
860 906
             // size_t metaId =
@@ -893,9 +939,13 @@ void StatIdx::initSuggestions() {
893 939
 
894 940
           _suggestions.push_back(sug);
895 941
           stat.suggestions.push_back(_suggestions.size() - 1);
942
+
943
+          _numDL++;
896 944
         }
897 945
       }
898 946
     }
947
+
948
+    if (stat.suggestions.size() + stat.attrErrs.size() == 0) _numOK++;
899 949
   }
900 950
 }
901 951
 

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

@@ -105,7 +105,19 @@ struct Cluster {
105 105
 
106 106
 class StatIdx {
107 107
  public:
108
-  StatIdx() {}
108
+  StatIdx()
109
+      : _numOSMStations(0),
110
+        _numOSMGroups(0),
111
+        _numOSMMetaGroups(0),
112
+        _numOK(0),
113
+        _numDL(0),
114
+        _numMV(0),
115
+        _numGR(0),
116
+        _numCR(0),
117
+        _numER(0),
118
+        _numMG(0),
119
+        _numNM(0),
120
+        _numTR(0) {}
109 121
 
110 122
   void readFromFile(const std::string& path);
111 123
 
@@ -171,6 +183,21 @@ class StatIdx {
171 183
   std::vector<util::geo::Grid<Cluster, util::geo::Point, double>>
172 184
       _heatGridsSugg;
173 185
   std::vector<util::geo::Grid<Cluster, util::geo::Point, double>> _heatGridsErr;
186
+
187
+  size_t _numOSMStations;
188
+  size_t _numOSMGroups;
189
+  size_t _numOSMMetaGroups;
190
+  size_t _numOK;
191
+  size_t _numDL;
192
+  size_t _numMV;
193
+  size_t _numGR;
194
+  size_t _numCR;
195
+  size_t _numER;
196
+
197
+  size_t _numMG;
198
+
199
+  size_t _numNM;
200
+  size_t _numTR;
174 201
 };
175 202
 }  // namespace osmfixer
176 203
 

+ 3 - 3
web/script.js

@@ -145,7 +145,7 @@ function rndrSt(stat) {
145 145
 
146 146
     if (stat.attrs.name) con.innerHTML += " (<b>\"" + stat.attrs.name + "\"</b>)";
147 147
 
148
-    con.innerHTML += "<a class='ebut' target='_blank' href='" + osmUrl + ident.toLowerCase() + "=" + osmid +"'>&#9998;</a>";
148
+    con.innerHTML += "<a class='ebut' target='_blank' href='" + osmUrl + "edit?" + ident.toLowerCase() + "=" + osmid +"'>&#9998;</a>";
149 149
 
150 150
     var attrTbl = $$('table');
151 151
     attrTbl.setAttribute("id", "attr-tbl")
@@ -242,7 +242,7 @@ function rndrGr(grp) {
242 242
 
243 243
         if (grp.attrs.name) con.innerHTML += " (<b>\"" + grp.attrs.name + "\"</b>)";
244 244
 
245
-        con.innerHTML += "<a class='ebut' target='_blank' href='https://www.openstreetmap.org/edit?relation=" + grp.osmid +"'>&#9998;</a>";
245
+        con.innerHTML += "<a class='ebut' target='_blank' href='" + osmUrl + "edit?relation=" + grp.osmid +"'>&#9998;</a>";
246 246
     }
247 247
 
248 248
     var attrTbl = $$('table');
@@ -355,7 +355,7 @@ function rndrMGr(grp) {
355 355
     oldMembers.innerHTML = "<span class='oldmemberstit'>Members</span>";
356 356
 
357 357
     con.innerHTML = "OSM relation <a target='_blank' href='https://www.openstreetmap.org/relation/" + grp.osmid + "'>" + grp.osmid + " </a> (<tt>public_transport=stop_area_group</tt>)";
358
-    con.innerHTML += "<a class='ebut' target='_blank' href='https://www.openstreetmap.org/edit?relation=" + grp.osmid +"'>&#9998;</a>";
358
+    con.innerHTML += "<a class='ebut' target='_blank' href='" + osmUrl + "edit?relation=" + grp.osmid +"'>&#9998;</a>";
359 359
 
360 360
     con.appendChild(oldMembers);
361 361