Ticket #15408: perf-v2.patch
| File perf-v2.patch, 5.2 KB (added by , 8 years ago) |
|---|
-
plugins/download_along/build.xml
3 3 <!-- enter the SVN commit message --> 4 4 <property name="commit.message" value="Changed the constructor signature of the plugin main class"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 0657"/>6 <property name="plugin.main.version" value="12643"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). 9 9 See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins -
plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlong.java
1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugin.download_along; 3 3 4 import org.openstreetmap.josm. Main;4 import org.openstreetmap.josm.gui.MainApplication; 5 5 import org.openstreetmap.josm.gui.MainMenu; 6 6 import org.openstreetmap.josm.plugins.Plugin; 7 7 import org.openstreetmap.josm.plugins.PluginInformation; … … 10 10 11 11 public DownloadAlong(PluginInformation info) { 12 12 super(info); 13 MainMenu.add(Main .main.menu.moreToolsMenu, new DownloadAlongWayAction());13 MainMenu.add(MainApplication.getMenu().moreToolsMenu, new DownloadAlongWayAction()); 14 14 } 15 15 } -
plugins/download_along/src/org/openstreetmap/josm/plugin/download_along/DownloadAlongWayAction.java
6 6 import java.awt.event.ActionEvent; 7 7 import java.awt.event.KeyEvent; 8 8 import java.awt.geom.Area; 9 import java.awt.geom.Path2D; 9 10 import java.awt.geom.Rectangle2D; 10 11 import java.util.ArrayList; 11 12 import java.util.Collection; … … 22 23 import org.openstreetmap.josm.gui.help.HelpUtil; 23 24 import org.openstreetmap.josm.gui.layer.gpx.DownloadAlongPanel; 24 25 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 26 import org.openstreetmap.josm.tools.Logging; 25 27 import org.openstreetmap.josm.tools.Shortcut; 26 28 27 29 class DownloadAlongWayAction extends DownloadAlongAction { … … 83 85 double buffer_y = buffer_dist / 100000.0; 84 86 double buffer_x = buffer_y / scale; 85 87 double max_area = panel.getArea() / 10000.0 / scale; 86 Area a = new Area();88 Path2D path = new Path2D.Double(); 87 89 Rectangle2D r = new Rectangle2D.Double(); 88 90 89 91 /* … … 100 102 if (previous != null && c.greatCircleDistance(previous) > buffer_dist) { 101 103 Double d = c.greatCircleDistance(previous) / buffer_dist; 102 104 int nbNodes = d.intValue(); 103 Main.info(tr("{0} intermediate nodes to download.", nbNodes)); 104 Main.info(tr("between {0} {1} and {2} {3}", c.lat(), c.lon(), previous.lat(), 105 106 Logging.info(tr("{0} intermediate nodes to download.", nbNodes)); 107 Logging.info(tr("between {0} {1} and {2} {3}", c.lat(), c.lon(), previous.lat(), 105 108 previous.lon())); 106 109 for (int i = 1; i < nbNodes; i++) { 107 110 intermediateNodes.add(new LatLon(previous.lat() 108 111 + (i * (c.lat() - previous.lat()) / (nbNodes + 1)), previous.lon() 109 112 + (i * (c.lon() - previous.lon()) / (nbNodes + 1)))); 110 Main.info(tr(" adding {0} {1}", previous.lat()113 Logging.info(tr(" adding {0} {1}", previous.lat() 111 114 + (i * (c.lat() - previous.lat()) / (nbNodes + 1)), previous.lon() 112 115 + (i * (c.lon() - previous.lon()) / (nbNodes + 1)))); 113 116 } … … 117 120 if (previous == null || d.greatCircleDistance(previous) > buffer_dist) { 118 121 // we add a buffer around the point. 119 122 r.setRect(d.lon() - buffer_x, d.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y); 120 a.add(new Area(r)); 123 // a.add(new Area(r)); 124 path.append(r, false); 121 125 previous = d; 122 126 } 123 127 } … … 124 128 previous = c; 125 129 } 126 130 } 127 131 Area a = new Area(path); 128 132 confirmAndDownloadAreas(a, max_area, panel.isDownloadOsmData(), panel.isDownloadGpxData(), 129 133 tr("Download from OSM along selected ways"), NullProgressMonitor.INSTANCE); 130 134 }
