Changeset 2381 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2009-11-02T07:51:28+01:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 7 edited
-
CombineWayAction.java (modified) (1 diff)
-
SplitWayAction.java (modified) (8 diffs)
-
UnGlueAction.java (modified) (6 diffs)
-
UpdateSelectionAction.java (modified) (1 diff)
-
UploadSelectionAction.java (modified) (1 diff)
-
downloadtasks/DownloadOsmTaskList.java (modified) (8 diffs)
-
mapmode/DrawAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r2356 r2381 250 250 */ 251 251 public void build(DataSet ds) { 252 for (Relation r : ds.relations) {252 for (Relation r : ds.getRelations()) { 253 253 if (!r.isUsable()) { 254 254 continue; -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r2323 r2381 103 103 HashMap<Way, Integer> wayOccurenceCounter = new HashMap<Way, Integer>(); 104 104 for (Node n : selectedNodes) { 105 for (Way w : getCurrentDataSet(). ways) {105 for (Way w : getCurrentDataSet().getWays()) { 106 106 if (!w.isUsable()) { 107 107 continue; 108 108 } 109 int last = w.getNodesCount() -1;110 if(last <= 0) { 109 int last = w.getNodesCount() - 1; 110 if (last <= 0) { 111 111 continue; // zero or one node ways 112 112 } … … 116 116 if ((circular || (i > 0 && i < last)) && n.equals(wn)) { 117 117 Integer old = wayOccurenceCounter.get(w); 118 wayOccurenceCounter.put(w, (old == null) ? 1 : old +1);118 wayOccurenceCounter.put(w, (old == null) ? 1 : old + 1); 119 119 break; 120 120 } … … 248 248 249 249 if (wayChunks.size() < 2) { 250 if(wayChunks.get(0).get(0) == wayChunks.get(0).get(wayChunks.get(0).size() -1)) {250 if (wayChunks.get(0).get(0) == wayChunks.get(0).get(wayChunks.get(0).size() - 1)) { 251 251 JOptionPane.showMessageDialog( 252 252 Main.parent, … … 290 290 291 291 } 292 Boolean warnmerole =false;293 Boolean warnme =false;292 Boolean warnmerole = false; 293 Boolean warnme = false; 294 294 // now copy all relations to new way also 295 295 296 for (Relation r : getCurrentDataSet(). relations) {296 for (Relation r : getCurrentDataSet().getRelations()) { 297 297 if (!r.isUsable()) { 298 298 continue; … … 307 307 for (RelationMember rm : r.getMembers()) { 308 308 if (rm.isWay()) { 309 if (rm.getMember() == selectedWay) 310 { 311 if(!("route".equals(type)) && !("multipolygon".equals(type))) { 309 if (rm.getMember() == selectedWay) { 310 if (!("route".equals(type)) && !("multipolygon".equals(type))) { 312 311 warnme = true; 313 312 } … … 318 317 int j = i; 319 318 boolean backwards = "backward".equals(rm.getRole()); 320 for(Way wayToAdd : newWays) 321 { 319 for (Way wayToAdd : newWays) { 322 320 RelationMember em = new RelationMember(rm.getRole(), wayToAdd); 323 if(em.hasRole() && !("multipolygon".equals(type))) { 321 if (em.hasRole() && !("multipolygon".equals(type))) { 324 322 warnmerole = true; 325 323 } … … 342 340 } 343 341 } 344 if(warnmerole) { 342 if (warnmerole) { 345 343 JOptionPane.showMessageDialog( 346 344 Main.parent, … … 348 346 tr("Warning"), 349 347 JOptionPane.WARNING_MESSAGE); 350 } else if(warnme) { 348 } else if (warnme) { 351 349 JOptionPane.showMessageDialog( 352 350 Main.parent, -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r2323 r2381 67 67 if (checkSelection(selection)) { 68 68 int count = 0; 69 for (Way w : getCurrentDataSet(). ways) {69 for (Way w : getCurrentDataSet().getWays()) { 70 70 if (!w.isUsable() || w.getNodesCount() < 1) { 71 71 continue; … … 79 79 // If there aren't enough ways, maybe the user wanted to unglue the nodes 80 80 // (= copy tags to a new node) 81 if(checkForUnglueNode(selection)) { 81 if (checkForUnglueNode(selection)) { 82 82 unglueNode(e); 83 83 } else { … … 92 92 for (Node n : selectedNodes) { 93 93 int count = 0; 94 for (Way w : getCurrentDataSet(). ways) {94 for (Way w : getCurrentDataSet().getWays()) { 95 95 if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) { 96 96 continue; … … 185 185 */ 186 186 private boolean checkForUnglueNode(Collection<? extends OsmPrimitive> selection) { 187 if(selection.size() != 1) 187 if (selection.size() != 1) 188 188 return false; 189 189 OsmPrimitive n = (OsmPrimitive) selection.toArray()[0]; 190 if(!(n instanceof Node)) 190 if (!(n instanceof Node)) 191 191 return false; 192 192 boolean isPartOfWay = false; 193 for(Way w : getCurrentDataSet(). ways) {194 if(w.containsNode((Node)n)) { 193 for (Way w : getCurrentDataSet().getWays()) { 194 if (w.containsNode((Node) n)) { 195 195 isPartOfWay = true; 196 196 break; 197 197 } 198 198 } 199 if(!isPartOfWay) 200 return false; 201 202 selectedNode = (Node)n; 203 return selectedNode.isTagged();199 if (!isPartOfWay) 200 return false; 201 202 selectedNode = (Node) n; 203 return selectedNode.isTagged(); 204 204 } 205 205 … … 322 322 Relation newRel = null; 323 323 HashSet<String> rolesToReAdd = null; 324 for (Relation r : getCurrentDataSet(). relations) {324 for (Relation r : getCurrentDataSet().getRelations()) { 325 325 if (r.isDeleted() || r.incomplete) { 326 326 continue; … … 367 367 boolean firstway = true; 368 368 // modify all ways containing the nodes 369 for (Way w : getCurrentDataSet(). ways) {369 for (Way w : getCurrentDataSet().getWays()) { 370 370 if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) { 371 371 continue; -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r2323 r2381 219 219 // incomplete ways. 220 220 // 221 for (Way w : ds.ways) {221 for (Way w : ds.getWays()) { 222 222 if (w.incomplete) { 223 223 OsmServerObjectReader reader = new OsmServerObjectReader(w.getId(), OsmPrimitiveType.WAY, true /* full */); -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r2323 r2381 68 68 protected Set<OsmPrimitive> getDeletedPrimitives(DataSet ds) { 69 69 HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 70 for (OsmPrimitive p : ds. nodes) {70 for (OsmPrimitive p : ds.getNodes()) { 71 71 if (p.isDeleted() && !p.isNew() && p.isVisible() && p.isModified()) { 72 72 ret.add(p); 73 73 } 74 74 } 75 for (OsmPrimitive p : ds. ways) {75 for (OsmPrimitive p : ds.getWays()) { 76 76 if (p.isDeleted() && !p.isNew() && p.isVisible() && p.isModified()) { 77 77 ret.add(p); 78 78 } 79 79 } 80 for (OsmPrimitive p : ds. relations) {80 for (OsmPrimitive p : ds.getRelations()) { 81 81 if (p.isDeleted() && !p.isNew() && p.isVisible() && p.isModified()) { 82 82 ret.add(p); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java
r2336 r2381 2 2 package org.openstreetmap.josm.actions.downloadtasks; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 7 7 import java.awt.EventQueue; … … 106 106 protected Set<OsmPrimitive> getCompletePrimitives(DataSet ds) { 107 107 HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>(); 108 for (OsmPrimitive primitive : ds. nodes) {108 for (OsmPrimitive primitive : ds.getNodes()) { 109 109 if (!primitive.incomplete && !primitive.isNew()) { 110 110 ret.add(primitive); 111 111 } 112 112 } 113 for (OsmPrimitive primitive : ds. ways) {113 for (OsmPrimitive primitive : ds.getWays()) { 114 114 if (!primitive.incomplete && !primitive.isNew()) { 115 115 ret.add(primitive); 116 116 } 117 117 } 118 for (OsmPrimitive primitive : ds. relations) {118 for (OsmPrimitive primitive : ds.getRelations()) { 119 119 if (!primitive.incomplete && !primitive.isNew()) { 120 120 ret.add(primitive); … … 155 155 ButtonSpec[] options = new ButtonSpec[] { 156 156 new ButtonSpec( 157 tr("Check on the server"), 157 tr("Check on the server"), 158 158 ImageProvider.get("ok"), 159 tr("Click to check whether objects in your local dataset are deleted on the server"), 159 tr("Click to check whether objects in your local dataset are deleted on the server"), 160 160 null /* no specific help topic */ 161 ), 161 ), 162 162 new ButtonSpec( 163 tr("Ignore"), 164 ImageProvider.get("cancel"), 165 tr("Click to abort and to resume editing"), 163 tr("Ignore"), 164 ImageProvider.get("cancel"), 165 tr("Click to abort and to resume editing"), 166 166 null /* no specific help topic */ 167 167 ), … … 172 172 + "update them the server is likely to report a<br>" + "conflict.<br>" + "<br>" 173 173 + "Click <strong>{1}</strong> to check the state of these primitives<br>" + "on the server.<br>" 174 + "Click <strong>{2}</strong> to ignore.<br>" + "</html>", 175 potentiallyDeleted.size(), 174 + "Click <strong>{2}</strong> to ignore.<br>" + "</html>", 175 potentiallyDeleted.size(), 176 176 options[0].text, 177 177 options[1].text 178 );178 ); 179 179 180 180 int ret = HelpAwareOptionPane.showOptionDialog( 181 Main.parent, 182 message, 181 Main.parent, 182 message, 183 183 tr("Deleted or moved primitives"), 184 JOptionPane.WARNING_MESSAGE, 185 null, 186 options, 184 JOptionPane.WARNING_MESSAGE, 185 null, 186 options, 187 187 options[0], 188 188 ht("/Action/UpdateData#SyncPotentiallyDeletedObjects") … … 190 190 if (ret != 0 /* OK */) 191 191 return; 192 193 updatePotentiallyDeletedPrimitives(potentiallyDeleted); 192 193 updatePotentiallyDeletedPrimitives(potentiallyDeleted); 194 194 } 195 195 … … 205 205 DataSet ds = ((DownloadOsmTask) task).getDownloadedData(); 206 206 if (ds != null) { 207 ret.addAll(ds. nodes);208 ret.addAll(ds. ways);209 ret.addAll(ds. relations);207 ret.addAll(ds.getNodes()); 208 ret.addAll(ds.getWays()); 209 ret.addAll(ds.getRelations()); 210 210 } 211 211 } … … 242 242 } else if (error instanceof Exception) { 243 243 sb.append("<li>").append(ExceptionUtil.explainException((Exception) error)).append("</li>") 244 .append("<br>");244 .append("<br>"); 245 245 } 246 246 } … … 272 272 DataSet ds = ((DownloadOsmTask) task).getDownloadedData(); 273 273 if (ds != null) { 274 myPrimitives.removeAll(ds. nodes);275 myPrimitives.removeAll(ds. ways);276 myPrimitives.removeAll(ds. relations);274 myPrimitives.removeAll(ds.getNodes()); 275 myPrimitives.removeAll(ds.getWays()); 276 myPrimitives.removeAll(ds.getRelations()); 277 277 } 278 278 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r2351 r2381 779 779 public Way getWayForNode(Node n) { 780 780 Way way = null; 781 for (Way w : getCurrentDataSet(). ways) {781 for (Way w : getCurrentDataSet().getWays()) { 782 782 if (!w.isUsable() || w.getNodesCount() < 1) { 783 783 continue;
Note:
See TracChangeset
for help on using the changeset viewer.
