Changeset 5991 in josm for trunk/src/org/openstreetmap/josm/gui/MapStatus.java
- Timestamp:
- 2013-06-06T01:48:06+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.