Changeset 2381 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2009-11-02T07:51:28+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r2327 r2381 304 304 Node minPrimitive = null; 305 305 DataSet ds = getCurrentDataSet(); 306 if (ds == null)306 if (ds == null) 307 307 return null; 308 for (Node n : ds. nodes) {308 for (Node n : ds.getNodes()) { 309 309 if (!n.isUsable()) { 310 310 continue; … … 317 317 } 318 318 // when multiple nodes on one point, prefer new or selected nodes 319 else if (dist == minDistanceSq && minPrimitive != null319 else if (dist == minDistanceSq && minPrimitive != null 320 320 && ((n.isNew() && ds.isSelected(n)) 321 321 || (!ds.isSelected(minPrimitive) && (ds.isSelected(n) || n.isNew())))) { 322 322 minPrimitive = n; 323 323 } … … 335 335 TreeMap<Double, List<WaySegment>> nearest = new TreeMap<Double, List<WaySegment>>(); 336 336 DataSet ds = getCurrentDataSet(); 337 if (ds == null)337 if (ds == null) 338 338 return null; 339 for (Way w : ds. ways) {339 for (Way w : ds.getWays()) { 340 340 if (!w.isUsable()) { 341 341 continue; … … 358 358 double a = p.distanceSq(B); 359 359 double b = p.distanceSq(A); 360 double perDist = a -(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared361 if (perDist < snapDistance && a < c +snapDistance && b < c+snapDistance) {362 if (ds.isSelected(w)) {360 double perDist = a - (a - b + c) * (a - b + c) / 4 / c; // perpendicular distance squared 361 if (perDist < snapDistance && a < c + snapDistance && b < c + snapDistance) { 362 if (ds.isSelected(w)) { 363 363 perDist -= 0.00001; 364 364 } … … 459 459 Collection<OsmPrimitive> nearest = new HashSet<OsmPrimitive>(); 460 460 DataSet ds = getCurrentDataSet(); 461 if (ds == null)461 if (ds == null) 462 462 return null; 463 for (Way w : ds. ways) {463 for (Way w : ds.getWays()) { 464 464 if (!w.isUsable()) { 465 465 continue; … … 479 479 double a = p.distanceSq(B); 480 480 double b = p.distanceSq(A); 481 double perDist = a -(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared482 if (perDist < snapDistance && a < c +snapDistance && b < c+snapDistance) {481 double perDist = a - (a - b + c) * (a - b + c) / 4 / c; // perpendicular distance squared 482 if (perDist < snapDistance && a < c + snapDistance && b < c + snapDistance) { 483 483 nearest.add(w); 484 484 break; … … 487 487 } 488 488 } 489 for (Node n : ds. nodes) {489 for (Node n : ds.getNodes()) { 490 490 if (n.isUsable() 491 491 && getPoint(n).distanceSq(p) < snapDistance) { … … 507 507 Collection<Node> nearest = new HashSet<Node>(); 508 508 DataSet ds = getCurrentDataSet(); 509 if (ds == null)509 if (ds == null) 510 510 return null; 511 for (Node n : ds. nodes) {511 for (Node n : ds.getNodes()) { 512 512 if (n.isUsable() 513 513 && getPoint(n).distanceSq(p) < snapDistance) { -
trunk/src/org/openstreetmap/josm/gui/SelectionManager.java
r2120 r2381 285 285 } else { 286 286 // nodes 287 for (Node n : nc.getCurrentDataSet(). nodes) {287 for (Node n : nc.getCurrentDataSet().getNodes()) { 288 288 if (n.isUsable() && r.contains(nc.getPoint(n))) { 289 289 selection.add(n); … … 292 292 293 293 // ways 294 for (Way w : nc.getCurrentDataSet(). ways) {295 if (!w.isUsable() || w.getNodesCount() == 0) {294 for (Way w : nc.getCurrentDataSet().getWays()) { 295 if (!w.isUsable() || w.getNodesCount() == 0) { 296 296 continue; 297 297 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r2348 r2381 754 754 Map<Relation, Collection<RelationMember>> roles = new HashMap<Relation, Collection<RelationMember>>(); 755 755 if (Main.main.getCurrentDataSet() != null) { 756 for (Relation r : Main.main.getCurrentDataSet(). relations) {756 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 757 757 if (!r.isFiltered() && !r.incomplete && !r.isDeleted()) { 758 758 for (RelationMember m : r.getMembers()) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r2348 r2381 147 147 protected int getNumRelations() { 148 148 if (Main.main.getCurrentDataSet() == null) return 0; 149 return Main.main.getCurrentDataSet(). relations.size();149 return Main.main.getCurrentDataSet().getRelations().size(); 150 150 } 151 151 … … 158 158 */ 159 159 protected ArrayList<Relation> getDisplayedRelationsInSortOrder(DataSet ds) { 160 ArrayList<Relation> relations = new ArrayList<Relation>(ds. relations.size());161 for (Relation r : ds.relations ){160 ArrayList<Relation> relations = new ArrayList<Relation>(ds.getRelations().size()); 161 for (Relation r : ds.getRelations()) { 162 162 if (!r.isUsable() || !r.isVisible()) { 163 163 continue; … … 170 170 new Comparator<Relation>() { 171 171 NameFormatter formatter = DefaultNameFormatter.getInstance(); 172 172 173 public int compare(Relation r1, Relation r2) { 173 174 return r1.getDisplayName(formatter).compareTo(r2.getDisplayName(formatter)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r2273 r2381 258 258 return; 259 259 HashSet<Relation> relations = new HashSet<Relation>(); 260 for ( int i=0; i < selection.length;i++) {261 relations.add((Relation) selection[i].getLastPathComponent());260 for (TreePath aSelection : selection) { 261 relations.add((Relation) aSelection.getLastPathComponent()); 262 262 } 263 263 Main.worker.submit(new DownloadRelationSetTask(getParentDialog(),relations)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r2378 r2381 138 138 //this.tagEditorModel.initFromPrimitive(relation); 139 139 this.memberTableModel.populate(relation); 140 if (!getLayer().data. relations.contains(relation)) {140 if (!getLayer().data.getRelations().contains(relation)) { 141 141 // treat it as a new relation if it doesn't exist in the 142 142 // data set yet. … … 597 597 ); 598 598 switch(ret) { 599 600 601 602 603 604 599 case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION: return; 600 case JOptionPane.CLOSED_OPTION: return; 601 case JOptionPane.NO_OPTION: return; 602 case JOptionPane.YES_OPTION: 603 memberTableModel.removeMembersReferringTo(toCheck); 604 break; 605 605 } 606 606 } … … 633 633 ); 634 634 switch(ret) { 635 636 637 638 639 635 case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION : return true; 636 case JOptionPane.YES_OPTION: return true; 637 case JOptionPane.NO_OPTION: return false; 638 case JOptionPane.CLOSED_OPTION: return false; 639 case JOptionPane.CANCEL_OPTION: throw new AddAbortException(); 640 640 } 641 641 // should not happen … … 1255 1255 ); 1256 1256 switch(ret) { 1257 1258 1259 1260 1257 case JOptionPane.YES_OPTION: return true; 1258 case ConditionalOptionPaneUtil.DIALOG_DISABLED_OPTION: return true; 1259 default: 1260 return false; 1261 1261 } 1262 1262 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java
r2273 r2381 150 150 } 151 151 parents.clear(); 152 for (Relation parent : referrers. relations) {153 parents.add((Relation) getLayer().data.getPrimitiveById(parent.getId(),OsmPrimitiveType.RELATION));152 for (Relation parent : referrers.getRelations()) { 153 parents.add((Relation) getLayer().data.getPrimitiveById(parent.getId(), OsmPrimitiveType.RELATION)); 154 154 } 155 155 if (continuation != null) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserModel.java
r2273 r2381 79 79 return; 80 80 } 81 for (Relation parent : ds. relations) {81 for (Relation parent : ds.getRelations()) { 82 82 if (isReferringRelation(parent)) { 83 83 referrers.add(parent); -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r2322 r2381 776 776 n.setTimestamp(DateUtils.fromString(timestr)); 777 777 } 778 ds. nodes.add(n);778 ds.addPrimitive(n); 779 779 nodes.add(n); 780 780 } 781 781 Way w = new Way(); 782 782 w.setNodes(nodes); 783 ds. ways.add(w);783 ds.addPrimitive(w); 784 784 } 785 785 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r2327 r2381 3 3 package org.openstreetmap.josm.gui.layer; 4 4 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 5 6 import static org.openstreetmap.josm.tools.I18n.marktr; 6 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;7 7 import static org.openstreetmap.josm.tools.I18n.tr; 8 8 import static org.openstreetmap.josm.tools.I18n.trn; … … 19 19 import java.awt.TexturePaint; 20 20 import java.awt.event.ActionEvent; 21 import java.awt.event.ActionListener;22 21 import java.awt.geom.Area; 23 22 import java.awt.image.BufferedImage; … … 32 31 import javax.swing.AbstractAction; 33 32 import javax.swing.Icon; 34 import javax.swing.JButton;35 import javax.swing.JDialog;36 33 import javax.swing.JLabel; 37 34 import javax.swing.JMenuItem; … … 68 65 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 69 66 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 70 import org.openstreetmap.josm.gui.help.HelpBrowser;71 import org.openstreetmap.josm.gui.help.HelpUtil;72 67 import org.openstreetmap.josm.tools.DateUtils; 73 68 import org.openstreetmap.josm.tools.GBC; 74 69 import org.openstreetmap.josm.tools.ImageProvider; 75 import org.openstreetmap.josm.tools.WindowGeometry;76 70 77 71 /** … … 256 250 @Override public String getToolTipText() { 257 251 String tool = ""; 258 tool += undeletedSize(data. nodes)+" "+trn("node", "nodes", undeletedSize(data.nodes))+", ";259 tool += undeletedSize(data. ways)+" "+trn("way", "ways", undeletedSize(data.ways));252 tool += undeletedSize(data.getNodes())+" "+trn("node", "nodes", undeletedSize(data.getNodes()))+", "; 253 tool += undeletedSize(data.getWays())+" "+trn("way", "ways", undeletedSize(data.getWays())); 260 254 if (data.version != null) { 261 255 tool += ", " + tr("version {0}", data.version); … … 350 344 numRemainingConflicts, 351 345 numRemainingConflicts 352 ); 353 } 354 346 ); 347 } 348 355 349 StringBuffer sb = new StringBuffer(); 356 350 sb.append("<html>").append(msg1); … … 369 363 tr("Click to close this dialog and continue editing"), 370 364 null /* no specific help */ 371 365 ) 372 366 }; 373 367 HelpAwareOptionPane.showOptionDialog( … … 380 374 options[0], 381 375 ht("/Concepts/Conflict#WarningAboutDetectedConflicts") 382 );376 ); 383 377 } 384 378 } … … 435 429 436 430 @Override public void visitBoundingBox(final BoundingXYVisitor v) { 437 for (final Node n : data.nodes)431 for (final Node n: data.getNodes()) { 438 432 if (n.isUsable()) { 439 433 v.visit(n); 440 434 } 435 } 441 436 } 442 437 … … 558 553 gpxData.storageFile = file; 559 554 HashSet<Node> doneNodes = new HashSet<Node>(); 560 for (Way w : data. ways) {555 for (Way w : data.getWays()) { 561 556 if (!w.isUsable()) { 562 557 continue; … … 583 578 } 584 579 WayPoint wpt = new WayPoint(n.getCoor()); 585 if (!n.isTimestampEmpty()) 586 { 580 if (!n.isTimestampEmpty()) { 587 581 wpt.attr.put("time", DateUtils.fromDate(n.getTimestamp())); 588 582 wpt.setTime(); … … 594 588 // what is this loop meant to do? it creates waypoints but never 595 589 // records them? 596 for (Node n : data. nodes) {590 for (Node n : data.getNodes()) { 597 591 if (n.incomplete || n.isDeleted() || doneNodes.contains(n)) { 598 592 continue; … … 607 601 wpt.attr.put("name", name); 608 602 } 603 ; 609 604 } 610 605 return gpxData; -
trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r2179 r2381 78 78 for (GpsPoint p : c) { 79 79 Node n = new Node(p.latlon); 80 ds. nodes.add(n);80 ds.addPrimitive(n); 81 81 nodes.add(n); 82 82 } 83 83 Way w = new Way(); 84 84 w.setNodes(nodes); 85 ds. ways.add(w);85 ds.addPrimitive(w); 86 86 } 87 87 Main.main.addLayer(new OsmDataLayer(ds, tr("Converted from: {0}", RawGpsLayer.this.getName()), null)); -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionCache.java
r2088 r2381 150 150 cachePrimitive(primitive); 151 151 } 152 for (Relation relation : layer.data. relations) {152 for (Relation relation : layer.data.getRelations()) { 153 153 if (relation.incomplete || relation.isDeleted()) { 154 154 continue;
Note:
See TracChangeset
for help on using the changeset viewer.