Changeset 17351 in osm for applications
- Timestamp:
- 2009-08-30T16:36:16+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java
r16788 r17351 175 175 { 176 176 Node lastN = null; 177 for (Node n : w. nodes) {177 for (Node n : w.getNodes()) { 178 178 if (lastN == null) { 179 179 lastN = n; -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
r16788 r17351 31 31 import org.openstreetmap.josm.data.projection.Mercator; 32 32 import org.openstreetmap.josm.gui.MapFrame; 33 import org.openstreetmap.josm.gui.OptionPaneUtil;34 33 import org.openstreetmap.josm.gui.layer.Layer; 35 34 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 276 275 } catch (InvocationTargetException ite) { 277 276 ite.getCause().printStackTrace(); 278 OptionPaneUtil.showMessageDialog(Main.parent,277 JOptionPane.showMessageDialog(Main.parent, 279 278 tr("Error initializing test {0}:\n {1}", test.getClass() 280 279 .getSimpleName(), ite.getCause().getMessage()), … … 283 282 } catch (Exception e) { 284 283 e.printStackTrace(); 285 OptionPaneUtil.showMessageDialog(Main.parent,284 JOptionPane.showMessageDialog(Main.parent, 286 285 tr("Error initializing test {0}:\n {1}", test.getClass() 287 286 .getSimpleName(), e), -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/TestError.java
r16294 r17351 334 334 public void visit(Way w) { 335 335 Node lastN = null; 336 for (Node n : w. nodes) {336 for (Node n : w.getNodes()) { 337 337 if (lastN == null) { 338 338 lastN = n; … … 347 347 348 348 public void visit(WaySegment ws) { 349 if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way. nodes.size())349 if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way.getNodesCount()) 350 350 return; 351 Node a = ws.way. nodes.get(ws.lowerIndex), b = ws.way.nodes.get(ws.lowerIndex + 1);351 Node a = ws.way.getNodes().get(ws.lowerIndex), b = ws.way.getNodes().get(ws.lowerIndex + 1); 352 352 if (isSegmentVisible(a, b)) { 353 353 drawSegment(a, b, severity.getColor()); -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java
r16788 r17351 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.OptionPaneUtil;19 18 import org.openstreetmap.josm.plugins.validator.util.AgregatePrimitivesVisitor; 20 19 import org.openstreetmap.josm.tools.GBC; … … 115 114 p.add(new JScrollPane(errorPanel), GBC.eol()); 116 115 117 int res = OptionPaneUtil.showConfirmationDialog(Main.parent, p,116 int res = JOptionPane.showConfirmDialog(Main.parent, p, 118 117 tr("Data with errors. Upload anyway?"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); 119 118 if(res == JOptionPane.NO_OPTION) -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java
r16788 r17351 33 33 import org.openstreetmap.josm.data.osm.WaySegment; 34 34 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 35 import org.openstreetmap.josm.gui.OptionPaneUtil;36 35 import org.openstreetmap.josm.gui.SideButton; 37 36 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 38 import org.openstreetmap.josm.tools.ImageProvider;39 37 import org.openstreetmap.josm.tools.Shortcut; 40 38 … … 119 117 if (tree != null) 120 118 tree.setVisible(v); 121 if (action != null && action.button != null)122 action.button.setSelected(v);123 119 super.setVisible(v); 124 120 Main.map.repaint(); … … 191 187 if (asked == JOptionPane.DEFAULT_OPTION) { 192 188 String[] a = new String[] { tr("Whole group"), tr("Single elements"), tr("Nothing") }; 193 asked = OptionPaneUtil.showOptionDialog(Main.parent, tr("Ignore whole group or individual elements?"),194 tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, 189 asked = JOptionPane.showOptionDialog(Main.parent, tr("Ignore whole group or individual elements?"), 190 tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, 195 191 a, a[1]); 196 192 } … … 425 421 426 422 public void visit(WaySegment ws) { 427 if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way. nodes.size())423 if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way.getNodesCount()) 428 424 return; 429 visit(ws.way. nodes.get(ws.lowerIndex));430 visit(ws.way. nodes.get(ws.lowerIndex + 1));425 visit(ws.way.getNodes().get(ws.lowerIndex)); 426 visit(ws.way.getNodes().get(ws.lowerIndex + 1)); 431 427 } 432 428 } -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java
r16629 r17351 51 51 if (!super.executeCommand()) return false; // save old 52 52 for (OsmPrimitive osm : objects) { 53 if(osm. keys != null)53 if(osm.hasKeys()) 54 54 { 55 55 osm.modified = true; 56 osm.put(newKey, osm.keys.remove(key) ); 56 String oldValue= osm.get(key); 57 osm.put(newKey, oldValue ); 58 osm.remove(key); 57 59 } 58 60 } -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/Coastlines.java
r13497 r17351 73 73 continue; 74 74 75 if( w. nodes.get(0).equals(w2.nodes.get(0)) || w.nodes.get(w.nodes.size() - 1).equals(w2.nodes.get(w2.nodes.size() - 1)))75 if( w.getNodes().get(0).equals(w2.getNodes().get(0)) || w.getNodes().get(w.getNodesCount() - 1).equals(w2.getNodes().get(w2.getNodesCount() - 1))) 76 76 { 77 77 List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(); -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java
r17313 r17351 83 83 String layer1 = w.get("layer"); 84 84 85 int nodesSize = w. nodes.size();85 int nodesSize = w.getNodesCount(); 86 86 for (int i = 0; i < nodesSize - 1; i++) { 87 87 WaySegment ws = new WaySegment(w, i); … … 188 188 { 189 189 this.ws = ws; 190 this.n1 = ws.way. nodes.get(ws.lowerIndex);191 this.n2 = ws.way. nodes.get(ws.lowerIndex + 1);190 this.n1 = ws.way.getNodes().get(ws.lowerIndex); 191 this.n2 = ws.way.getNodes().get(ws.lowerIndex + 1); 192 192 this.layer = layer; 193 193 this.railway = railway; -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicatedWayNodes.java
r16735 r17351 28 28 29 29 Node lastN = null; 30 for (Node n : w. nodes) {30 for (Node n : w.getNodes()) { 31 31 if (lastN == null) { 32 32 lastN = n; … … 45 45 Way w = (Way) testError.getPrimitives().iterator().next(); 46 46 Way wnew = new Way(w); 47 wnew. nodes.clear();47 wnew.setNodes(null); 48 48 Node lastN = null; 49 for (Node n : w. nodes) {49 for (Node n : w.getNodes()) { 50 50 if (lastN == null) { 51 wnew.nodes.add(n);51 wnew.addNode(n); 52 52 } else if (n == lastN) { 53 53 // Skip this node 54 54 } else { 55 wnew.nodes.add(n);55 wnew.addNode(n); 56 56 } 57 57 lastN = n; 58 58 } 59 if (wnew. nodes.size() < 2) {59 if (wnew.getNodesCount() < 2) { 60 60 // Empty way, delete 61 61 return DeleteCommand.delete(Main.map.mapView.getEditLayer(), Collections.singleton(w)); -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/OverlappingWays.java
r13497 r17351 157 157 Node lastN = null; 158 158 int i = -2; 159 for (Node n : w. nodes) {159 for (Node n : w.getNodes()) { 160 160 i++; 161 161 if (lastN == null) { -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SelfIntersectingWay.java
r13497 r17351 27 27 HashSet<Node> nodes = new HashSet<Node>(); 28 28 29 for (int i = 1; i < w. nodes.size() - 1; i++) {30 Node n = w. nodes.get(i);29 for (int i = 1; i < w.getNodesCount() - 1; i++) { 30 Node n = w.getNode(i); 31 31 if (nodes.contains(n)) { 32 32 errors.add(new TestError(this, -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
r16788 r17351 44 44 import org.openstreetmap.josm.data.osm.Relation; 45 45 import org.openstreetmap.josm.data.osm.Way; 46 import org.openstreetmap.josm.gui.OptionPaneUtil;47 46 import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference; 48 47 import org.openstreetmap.josm.gui.tagging.TaggingPreset; … … 390 389 if(checkComplex) 391 390 { 392 Map<String, String> props = (p. keys == null) ? Collections.<String, String>emptyMap() : p.keys;391 Map<String, String> props = (p.getKeys() == null) ? Collections.<String, String>emptyMap() : p.getKeys(); 393 392 for(Entry<String, String> prop: props.entrySet() ) 394 393 { … … 452 451 } 453 452 454 Map<String, String> props = (p. keys == null) ? Collections.<String, String>emptyMap() : p.keys;453 Map<String, String> props = (p.getKeys() == null) ? Collections.<String, String>emptyMap() : p.getKeys(); 455 454 for(Entry<String, String> prop: props.entrySet() ) 456 455 { … … 620 619 addSrcButton.addActionListener(new ActionListener(){ 621 620 public void actionPerformed(ActionEvent e) { 622 String source = OptionPaneUtil.showInputDialog(621 String source = JOptionPane.showInputDialog( 623 622 Main.parent, 624 623 tr("TagChecker source"), … … 645 644 if(Sources.getModel().getSize() == 0) 646 645 { 647 String source = OptionPaneUtil.showInputDialog(Main.parent, tr("TagChecker source"), tr("TagChecker source"), JOptionPane.QUESTION_MESSAGE);646 String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"), tr("TagChecker source"), JOptionPane.QUESTION_MESSAGE); 648 647 if (source != null) 649 648 ((DefaultListModel)Sources.getModel()).addElement(source); … … 651 650 else 652 651 { 653 OptionPaneUtil.showMessageDialog(652 JOptionPane.showMessageDialog( 654 653 Main.parent, 655 654 tr("Please select the row to edit."), … … 660 659 } 661 660 else { 662 String source = (String) OptionPaneUtil.showInputDialog(Main.parent,661 String source = (String)JOptionPane.showInputDialog(Main.parent, 663 662 tr("TagChecker source"), 664 663 tr("TagChecker source"), … … 676 675 public void actionPerformed(ActionEvent e) { 677 676 if (Sources.getSelectedIndex() == -1) 678 OptionPaneUtil.showMessageDialog(Main.parent, tr("Please select the row to delete."), tr("Information"), JOptionPane.QUESTION_MESSAGE);677 JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."), tr("Information"), JOptionPane.QUESTION_MESSAGE); 679 678 else { 680 679 ((DefaultListModel)Sources.getModel()).remove(Sources.getSelectedIndex()); … … 800 799 { 801 800 i++; 802 Map<String, String> tags = p. keys;801 Map<String, String> tags = p.getKeys(); 803 802 if( tags == null || tags.size() == 0 ) 804 803 continue; … … 922 921 public Boolean match(OsmPrimitive osm) 923 922 { 924 for(Entry<String, String> prop: osm. keys.entrySet())923 for(Entry<String, String> prop: osm.getKeys().entrySet()) 925 924 { 926 925 String key = prop.getKey(); … … 995 994 public Boolean match(OsmPrimitive osm) 996 995 { 997 if(osm. keys== null || (type == NODE && !(osm instanceof Node))996 if(osm.getKeys() == null || (type == NODE && !(osm instanceof Node)) 998 997 || (type == RELATION && !(osm instanceof Relation)) || (type == WAY && !(osm instanceof Way))) 999 998 return false; -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnclosedWays.java
r16159 r17351 105 105 if (type != null && !w.isClosed()) 106 106 { 107 Node f = w. nodes.get(0);108 Node l = w. nodes.get(w.nodes.size() - 1);107 Node f = w.getNode(0); 108 Node l = w.getNode(w.getNodesCount() - 1); 109 109 if(force || f.getCoor().greatCircleDistance(l.getCoor()) < 10000) 110 110 { -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java
r16629 r17351 176 176 public boolean nearby(Node n, double dist) 177 177 { 178 return !w. nodes.contains(n)178 return !w.containsNode(n) 179 179 && line.ptSegDist(n.getEastNorth().east(), n.getEastNorth().north()) < dist; 180 180 } … … 192 192 if( w.deleted || w.incomplete ) 193 193 return; 194 int size = w. nodes.size();194 int size = w.getNodesCount(); 195 195 if(size < 2) 196 196 return; … … 198 198 { 199 199 if(i < size-1) 200 addNode(w. nodes.get(i), middlenodes);201 ways.add(new MyWaySegment(w, w. nodes.get(i-1), w.nodes.get(i)));200 addNode(w.getNode(i), middlenodes); 201 ways.add(new MyWaySegment(w, w.getNode(i-1), w.getNode(i))); 202 202 } 203 203 Set<Node> set = endnodes; 204 204 if(w.get("highway") != null || w.get("railway") != null) 205 205 set = endnodes_highway; 206 addNode(w. nodes.get(0), set);207 addNode(w. nodes.get(size-1), set);206 addNode(w.getNode(0), set); 207 addNode(w.getNode(size-1), set); 208 208 } 209 209 private void addNode(Node n, Set<Node> s) -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java
r16735 r17351 78 78 public void visit(Way w) 79 79 { 80 for (Node n : w. nodes) {80 for (Node n : w.getNodes()) { 81 81 emptyNodes.remove(n); 82 82 } -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java
r16735 r17351 65 65 if (w.deleted || w.incomplete) return; 66 66 67 Map<String, String> tags = w. keys;67 Map<String, String> tags = w.getKeys(); 68 68 if( tags != null ) 69 69 { … … 100 100 } 101 101 102 if( w. nodes.size() == 0 )102 if( w.getNodesCount() == 0 ) 103 103 { 104 104 errors.add( new TestError(this, Severity.ERROR, tr("Empty ways"), EMPTY_WAY, w) ); 105 105 } 106 else if( w. nodes.size() == 1 )106 else if( w.getNodesCount() == 1 ) 107 107 { 108 108 errors.add( new TestError(this, Severity.ERROR, tr("One node ways"), ONE_NODE_WAY, w) ); … … 117 117 for (final Relation r : Main.main.getCurrentDataSet().relations) 118 118 { 119 if(!r.deleted && !r.incomplete && r. keys!= null120 && "multipolygon".equals(r. keys.get("type")))119 if(!r.deleted && !r.incomplete && r.getKeys() != null 120 && "multipolygon".equals(r.get("type"))) 121 121 { 122 122 for (RelationMember m : r.members) -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/WronglyOrderedWays.java
r16438 r17351 88 88 */ 89 89 90 if(w. nodes.get(0) == w.nodes.get(w.nodes.size()-1))90 if(w.getNode(0) == w.getNode(w.getNodesCount()-1)) 91 91 { 92 92 double area2 = 0; 93 93 94 for (int node = 1; node < w. nodes.size(); node++)94 for (int node = 1; node < w.getNodesCount(); node++) 95 95 { 96 area2 += (w. nodes.get(node-1).getCoor().lon() * w.nodes.get(node).getCoor().lat()97 - w. nodes.get(node).getCoor().lon() * w.nodes.get(node-1).getCoor().lat());96 area2 += (w.getNode(node-1).getCoor().lon() * w.getNode(node).getCoor().lat() 97 - w.getNode(node).getCoor().lon() * w.getNode(node-1).getCoor().lat()); 98 98 } 99 99 -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java
r16159 r17351 57 57 { 58 58 aggregatedData.add(w); 59 for (Node n : w. nodes)59 for (Node n : w.getNodes()) 60 60 visit(n); 61 61 } -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java
r16159 r17351 39 39 public static List<List<Way>> getWaysInCell(Way w, Map<Point2D,List<Way>> cellWays) 40 40 { 41 if (w. nodes.size() == 0)41 if (w.getNodesCount() == 0) 42 42 return Collections.emptyList(); 43 43 44 Node n1 = w. nodes.get(0);45 Node n2 = w. nodes.get(w.nodes.size() - 1);44 Node n1 = w.getNode(0); 45 Node n2 = w.getNode(w.getNodesCount() - 1); 46 46 47 47 List<List<Way>> cells = new ArrayList<List<Way>>(2);
Note:
See TracChangeset
for help on using the changeset viewer.