Ticket #3833: osmdatalayer-translation-cleanup-2.patch
File osmdatalayer-translation-cleanup-2.patch, 4.2 KB (added by , 13 years ago) |
---|
-
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
111 111 } 112 112 113 113 public final static class DataCountVisitor extends AbstractVisitor { 114 public final int[] normal = new int[3]; 115 public final int[] deleted = new int[3]; 116 public final String[] names = { 117 OsmPrimitiveType.NODE.getAPIName(), 118 OsmPrimitiveType.WAY.getAPIName(), 119 OsmPrimitiveType.RELATION.getAPIName() 120 }; 114 public int nodes; 115 public int ways; 116 public int relations; 117 public int deletedNodes; 118 public int deletedWays; 119 public int deletedRelations; 121 120 122 p rivate void inc(final OsmPrimitive osm, final int i) {123 no rmal[i]++;124 if ( osm.isDeleted()) {125 deleted [i]++;121 public void visit(final Node n) { 122 nodes++; 123 if (n.isDeleted()) { 124 deletedNodes++; 126 125 } 127 126 } 128 127 129 public void visit(final Node n) { 130 inc(n, 0); 128 public void visit(final Way w) { 129 ways++; 130 if (w.isDeleted()) { 131 deletedWays++; 132 } 131 133 } 132 134 133 public void visit(final Way w) { 134 inc(w, 1); 135 public void visit(final Relation r) { 136 relations++; 137 if (r.isDeleted()) { 138 deletedRelations++; 139 } 135 140 } 136 public void visit(final Relation w) {137 inc(w, 2);138 }139 141 } 140 142 141 143 public interface CommandQueueListener { … … 248 250 } 249 251 250 252 @Override public String getToolTipText() { 251 String tool = ""; 252 tool += undeletedSize(data.getNodes())+" "+trn("node", "nodes", undeletedSize(data.getNodes()))+", "; 253 tool += undeletedSize(data.getWays())+" "+trn("way", "ways", undeletedSize(data.getWays())); 253 int nodes = undeletedSize(data.getNodes()); 254 int ways = undeletedSize(data.getWays()); 255 256 String tool = trn("{0} node", "{0} nodes", nodes, nodes)+", "; 257 tool += trn("{0} way", "{0} ways", ways, ways); 258 254 259 if (data.version != null) { 255 260 tool += ", " + tr("version {0}", data.version); 256 261 } … … 499 504 osm.visit(counter); 500 505 } 501 506 final JPanel p = new JPanel(new GridBagLayout()); 507 508 String nodeText = trn("{0} node", "{0} nodes", counter.nodes, counter.nodes); 509 if (counter.deletedNodes > 0) 510 nodeText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedNodes, counter.deletedNodes)+")"; 511 512 String wayText = trn("{0} way", "{0} ways", counter.ways, counter.ways); 513 if (counter.deletedWays > 0) 514 wayText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedWays, counter.deletedWays)+")"; 515 516 String relationText = trn("{0} relation", "{0} relations", counter.relations, counter.relations); 517 if (counter.deletedRelations > 0) 518 relationText += " ("+trn("{0} deleted", "{0} deleted", counter.deletedRelations, counter.deletedRelations)+")"; 519 502 520 p.add(new JLabel(tr("{0} consists of:", getName())), GBC.eol()); 503 for (int i = 0; i < counter.normal.length; ++i) { 504 String s = counter.normal[i]+" "+trn(counter.names[i],counter.names[i]+"s",counter.normal[i]); 505 if (counter.deleted[i] > 0) { 506 s += tr(" ({0} deleted.)",counter.deleted[i]); 507 } 508 p.add(new JLabel(s, ImageProvider.get("data", counter.names[i]), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 509 } 521 p.add(new JLabel(nodeText, ImageProvider.get("data", "node"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 522 p.add(new JLabel(wayText, ImageProvider.get("data", "way"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 523 p.add(new JLabel(relationText, ImageProvider.get("data", "relation"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0)); 510 524 p.add(new JLabel(tr("API version: {0}", (data.version != null) ? data.version : tr("unset")))); 511 525 512 526 return p;