Ignore:
Timestamp:
2009-07-19T19:46:30+02:00 (15 years ago)
Author:
jttt
Message:

Made plug-in work with JOSM new ProgressMonitor API

Location:
applications/editors/josm/plugins/waydownloader
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/waydownloader/.classpath

    r15412 r16590  
    33        <classpathentry kind="src" path="src"/>
    44        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    5         <classpathentry combineaccessrules="false" kind="src" path="/josm"/>
     5        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    66        <classpathentry kind="output" path="bin"/>
    77</classpath>
  • applications/editors/josm/plugins/waydownloader/build.xml

    r16290 r16590  
    9191                <attribute name="Plugin-Description" value="Easy downloading along a long set of interconnected ways"/>
    9292                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WayDownloaderPlugin"/>
    93                 <attribute name="Plugin-Mainversion" value="1722"/>
     93                <attribute name="Plugin-Mainversion" value="1813"/>
    9494                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    9595            </manifest>
  • applications/editors/josm/plugins/waydownloader/src/WayDownloaderPlugin.java

    r16290 r16590  
    55import java.util.ArrayList;
    66import java.util.Collection;
    7 import java.util.Iterator;
    87import java.util.LinkedList;
    98
     
    1211import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.actions.JosmAction;
     13import org.openstreetmap.josm.actions.MergeNodesAction;
    1414import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
    15 import org.openstreetmap.josm.actions.MergeNodesAction;
    1615import org.openstreetmap.josm.data.Bounds;
    1716import org.openstreetmap.josm.data.osm.DataSource;
     
    2019import org.openstreetmap.josm.data.osm.Way;
    2120import org.openstreetmap.josm.gui.MainMenu;
     21import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
    2222import org.openstreetmap.josm.plugins.Plugin;
    2323import org.openstreetmap.josm.tools.Shortcut;
     
    9292                        errMsg = tr("Select a starting node on the end of a way");
    9393                    } else {
    94                         priorConnectedWay =(Way) connectedWays.get(0);
     94                        priorConnectedWay =connectedWays.get(0);
    9595
    9696                        //Download a little rectangle around the selected node
     
    102102                                               selectedNode.getCoor().lon()-lonbuffer,
    103103                                               selectedNode.getCoor().lat()+latbuffer,
    104                                                selectedNode.getCoor().lon()+lonbuffer);
     104                                               selectedNode.getCoor().lon()+lonbuffer,
     105                                               new PleaseWaitProgressMonitor());
    105106
    106107                        //The download is scheduled to be executed.
     
    157158                //Figure out which of the two is new.
    158159                System.out.println("connectedWays.toString()=" + connectedWays.toString());
    159                 Way wayA = (Way) connectedWays.get(0);
    160                 Way wayB = (Way) connectedWays.get(1);
     160                Way wayA = connectedWays.get(0);
     161                Way wayB = connectedWays.get(1);
    161162                Way nextWay = wayA;
    162163                if (priorConnectedWay.equals(wayA)) nextWay = wayB;
     
    176177    /** See if there's another node at the same coordinates. If so return it. Otherwise null */
    177178    private Node duplicateNode() {
    178         Iterator nodesIter = Main.ds.nodes.iterator();
    179         while (nodesIter.hasNext()) {
    180             Node onNode = (Node) nodesIter.next();
     179        for (Node onNode:Main.ds.nodes) {
    181180            if (!onNode.equals(this.selectedNode)
    182181                    && onNode.getCoor().lat()==selectedNode.getCoor().lat()
     
    200199
    201200        //loop through every way
    202         Iterator waysIter = Main.ds.ways.iterator();
    203         while (waysIter.hasNext()) {
    204             Way onWay = (Way) waysIter.next();
    205 
    206 
     201        for (Way onWay:Main.ds.ways) {
    207202            Object[] nodes = onWay.nodes.toArray();
    208203            if (nodes.length<2) {
     
    233228        } else {
    234229            Way selectedWay = (Way) selection.toArray()[0];
    235             selectedNode = (Node) selectedWay.nodes.get(0);
     230            selectedNode = selectedWay.nodes.get(0);
    236231
    237232            if (isDownloaded(selectedNode)) {
     
    246241
    247242    private boolean isDownloaded(Node node) {
    248         Iterator downloadedAreasIter = Main.ds.dataSources.iterator();
    249         while (downloadedAreasIter.hasNext()) {
    250             DataSource datasource = (DataSource) downloadedAreasIter.next();
     243        for (DataSource datasource:Main.ds.dataSources) {
    251244            Bounds bounds = datasource.bounds;
    252245
Note: See TracChangeset for help on using the changeset viewer.