Changeset 5991 in josm
- Timestamp:
- 2013-06-06T01:48:06+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r5909 r5991 711 711 startEN = currentEN; // drag can continue after scaling/rotation 712 712 713 if (mode != Mode.rotate && mode != Mode.scale) { 714 return false; 715 } 716 717 getCurrentDataSet().beginUpdate(); 718 713 719 if (mode == Mode.rotate) { 714 getCurrentDataSet().beginUpdate();715 720 if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand) c).getTransformedNodes())) { 716 721 ((RotateCommand) c).handleEvent(currentEN); … … 719 724 } 720 725 } else if (mode == Mode.scale) { 721 getCurrentDataSet().beginUpdate();722 726 if (c instanceof ScaleCommand && affectedNodes.equals(((ScaleCommand) c).getTransformedNodes())) { 723 727 ((ScaleCommand) c).handleEvent(currentEN); … … 725 729 Main.main.undoRedo.add(new ScaleCommand(selection, currentEN)); 726 730 } 727 } else { 728 return false; 731 } 732 733 Collection<Way> ways = getCurrentDataSet().getSelectedWays(); 734 if (doesImpactStatusLine(affectedNodes, ways)) { 735 Main.map.statusLine.setDist(ways); 729 736 } 730 737 } 731 738 getCurrentDataSet().endUpdate(); 732 739 return true; 740 } 741 742 private boolean doesImpactStatusLine(Collection<Node> affectedNodes, Collection<Way> selectedWays) { 743 for (Way w : selectedWays) { 744 for (Node n : w.getNodes()) { 745 if (affectedNodes.contains(n)) { 746 return true; 747 } 748 } 749 } 750 return false; 733 751 } 734 752 -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r5966 r5991 31 31 import javax.swing.AbstractAction; 32 32 import javax.swing.BorderFactory; 33 import javax.swing.JButton;34 33 import javax.swing.JCheckBoxMenuItem; 35 34 import javax.swing.JLabel; … … 50 49 import org.openstreetmap.josm.data.osm.DataSet; 51 50 import org.openstreetmap.josm.data.osm.OsmPrimitive; 51 import org.openstreetmap.josm.data.osm.Way; 52 52 import org.openstreetmap.josm.gui.help.Helpful; 53 53 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; … … 835 835 headingText.setText(h < 0 ? "--" : Math.round(h*10)/10.0 + " \u00B0"); 836 836 } 837 /** 838 * Sets the distance text to the given value 839 * @param dist The distance value to display, in meters 840 */ 837 841 public void setDist(double dist) { 838 842 distText.setText(dist < 0 ? "--" : NavigatableComponent.getDistText(dist)); 839 843 } 844 /** 845 * Sets the distance text to the total sum of given ways length 846 * @param ways The ways to consider for the total distance 847 * @since 5991 848 */ 849 public void setDist(Collection<Way> ways) { 850 double dist = -1; 851 // Compute total length of selected way(s) until an arbitrary limit set to 250 ways 852 // in order to prevent performance issue if a large number of ways are selected (old behaviour kept in that case, see #8403) 853 int maxWays = Math.max(1, Main.pref.getInteger("selection.max-ways-for-statusline", 250)); 854 if (!ways.isEmpty() && ways.size() <= maxWays) { 855 dist = 0.0; 856 for (Way w : ways) { 857 dist += w.getLength(); 858 } 859 } 860 setDist(dist); 861 } 840 862 public void activateAnglePanel(boolean activeFlag) { 841 863 angleText.setBackground(activeFlag ? ImageLabel.backColorActive : ImageLabel.backColor); -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r5984 r5991 530 530 if (selection != null) { 531 531 remember(selection); 532 double dist = -1; 533 SubclassFilteredCollection<OsmPrimitive, Way> ways = new SubclassFilteredCollection<OsmPrimitive, Way>(selection, OsmPrimitive.wayPredicate); 534 // Compute total length of selected way(s) until an arbitrary limit set to 250 ways 535 // in order to prevent performance issue if a large number of ways are selected (old behaviour kept in that case, see #8403) 536 int maxWays = Math.max(1, Main.pref.getInteger("selection.max-ways-for-statusline", 250)); 537 if (!ways.isEmpty() && ways.size() <= maxWays) { 538 dist = 0.0; 539 for (Way w : ways) { 540 dist += w.getLength(); 541 } 542 } 543 Main.map.statusLine.setDist(dist); 532 Main.map.statusLine.setDist(new SubclassFilteredCollection<OsmPrimitive, Way>(selection, OsmPrimitive.wayPredicate)); 544 533 } 545 534 }
Note:
See TracChangeset
for help on using the changeset viewer.