Ignore:
Timestamp:
2018-08-18T18:35:34+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/ChannelDiGraphLayer.java

    r33248 r34525  
    1616import javax.swing.Icon;
    1717
    18 import org.openstreetmap.josm.Main;
    1918import org.openstreetmap.josm.data.Bounds;
    2019import org.openstreetmap.josm.data.coor.LatLon;
    2120import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     21import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    2222import org.openstreetmap.josm.gui.MapView;
    2323import org.openstreetmap.josm.gui.layer.Layer;
     
    142142
    143143    private Point getCoord(OSMNode node, MapView mv) {
    144         return mv.getPoint(Main.getProjection().latlon2eastNorth(new LatLon(node.getLatitude(), node.getLongitude())));
     144        return mv.getPoint(ProjectionRegistry.getProjection().latlon2eastNorth(new LatLon(node.getLatitude(), node.getLongitude())));
    145145    }
    146146
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java

    r33778 r34525  
    99import javax.swing.JOptionPane;
    1010
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.data.Bounds;
    1312import org.openstreetmap.josm.data.DataSource;
     
    7574        if (MainApplication.getMap() == null
    7675                || !MainApplication.getMap().isVisible() || !(MainApplication.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) {
    77             JOptionPane.showMessageDialog(Main.parent, tr("this layer is no osm data layer"));
     76            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("this layer is no osm data layer"));
    7877            return;
    7978        }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java

    r33778 r34525  
    1010import javax.swing.JOptionPane;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.gui.MainApplication;
    1413import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    2928    private final int n; //Grad der Kreuzung
    3029    private final HashSet<Channel> subset; //Teilmge der zu prüfenden Channel
    31     private final boolean producerelation;
     30    private final boolean produceRelation;
    3231    private boolean canceled;
    3332
     
    3736        this.n = n;
    3837        this.subset = subset;
    39         this.producerelation = produceRelation;
     38        this.produceRelation = produceRelation;
    4039        jc = new JunctionChecker(plugin.getChannelDigraph(), n);
    4140    }
     
    5554        if (jc.isSmallerJunction()) {
    5655            showjunction();
    57             JOptionPane.showMessageDialog(Main.parent,
     56            JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    5857                tr("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again."));
    5958        } else if (jc.getCheck()) {
    6059            showjunction();
    61             JOptionPane.showMessageDialog(Main.parent, tr("The marked channels are a {0}-ways junction", n));
     60            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("The marked channels are a {0}-ways junction", n));
    6261            plugin.getChannelDigraph().ereaseJunctioncandidate();
    6362            for (int i = 0; i < jc.getSubJunction().size(); i++) {
    6463                plugin.getChannelDigraph().addJunctioncandidateChannel(jc.getSubJunction().get(i));
    6564            }
    66             if (producerelation) {
     65            if (produceRelation) {
    6766                this.plugin.getRelationProducer().produceRelation(subset, n);
    6867            }
    6968        } else if (!jc.getCheck()) {
    70             JOptionPane.showMessageDialog(Main.parent, tr("The marked channels are not a junction:") + jc.getJCheckResult());
     69            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("The marked channels are not a junction:") + jc.getJCheckResult());
    7170        }
    7271    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java

    r33778 r34525  
    1111import java.awt.event.MouseEvent;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.actions.mapmode.MapMode;
    1514import org.openstreetmap.josm.data.coor.LatLon;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java

    r33778 r34525  
    66import java.io.File;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.actions.mapmode.MapMode;
    109import org.openstreetmap.josm.gui.MainApplication;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionSearchTask.java

    r32596 r34525  
    1010import javax.swing.JOptionPane;
    1111
    12 import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    1414import org.openstreetmap.josm.io.OsmTransferException;
     
    5454        }
    5555        ArrayList<HashSet<Channel>> junctions = jc.getJunctions();
    56         JOptionPane.showMessageDialog(Main.parent, tr("Number of {0}-ways junctions found: {1}", n, junctions.size()));
     56        JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Number of {0}-ways junctions found: {1}", n, junctions.size()));
    5757        if (produceRelation) {
    5858            for (int i = 0; i < junctions.size(); i++) {
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/PrepareJunctionCheckorSearch.java

    r33778 r34525  
    66import javax.swing.JOptionPane;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.gui.MainApplication;
    109import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
     
    2221    private final boolean produceRelation;
    2322
    24     public PrepareJunctionCheckorSearch(JunctionCheckerPlugin plugin, int n, boolean producerelation) {
     23    public PrepareJunctionCheckorSearch(JunctionCheckerPlugin plugin, int n, boolean produceRelation) {
    2524        this.plugin = plugin;
    2625        this.n = n;
    2726        this.subset = new HashSet<>();
    28         this.produceRelation = producerelation;
     27        this.produceRelation = produceRelation;
    2928    }
    3029
     
    4443    private boolean prepareSubset() {
    4544        if (plugin.getChannelDigraph().getSelectedChannels().size() < 6) {
    46             JOptionPane.showMessageDialog(Main.parent, "Less then 6 channels are selected");
     45            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "Less then 6 channels are selected");
    4746            return false;
    4847        }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/commandlineinterface/CLI.java

    r32596 r34525  
    1616import org.openstreetmap.josm.plugins.JunctionChecker.reader.XMLFilterReader;
    1717import org.openstreetmap.josm.plugins.JunctionChecker.writing.OSMXMLWriter;
     18import org.openstreetmap.josm.tools.Logging;
    1819
    1920public final class CLI {
     
    7172        StrongConnectednessCalculator scc = new StrongConnectednessCalculator(cdgb.getDigraph());
    7273        scc.calculateSCC();
    73         //System.out.println(scc.showNotstronglyConnectednessParts());
    7474
    7575        if (maxchannelsearch == 0) {
     
    7777            try {
    7878                oxw.writeXML();
    79             } catch (FileNotFoundException e) {
    80                 // TODO Auto-generated catch block
    81                 e.printStackTrace();
    82             } catch (XMLStreamException e) {
    83                 // TODO Auto-generated catch block
    84                 e.printStackTrace();
     79            } catch (FileNotFoundException | XMLStreamException e) {
     80                Logging.error(e);
    8581            }
    86             ;
    87 
    88             System.out.println("OSMXML erzeugt, breche an dieser Stelle ab");
    8982            return;
    9083        }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/ChannelDiGraph.java

    r32596 r34525  
    1515    private final ArrayList<LeadsTo> leadsTos = new ArrayList<>();
    1616    private final HashSet<Channel> selectedChannels = new HashSet<>();
    17     private HashSet<Channel> junctioncandidate = new HashSet<>();
     17    private HashSet<Channel> junctionCandidate = new HashSet<>();
    1818
    1919    public void setChannels(ArrayList<Channel> channels) {
     
    271271
    272272    public HashSet<Channel> getJunctionCandidate() {
    273         return junctioncandidate;
     273        return junctionCandidate;
    274274    }
    275275
    276276    public void ereaseJunctioncandidate() {
    277         Iterator<Channel> it = junctioncandidate.iterator();
     277        Iterator<Channel> it = junctionCandidate.iterator();
    278278        while (it.hasNext()) {
    279279            it.next().setPartOfJunction(false);
    280280        }
    281         junctioncandidate.clear();
     281        junctionCandidate.clear();
    282282    }
    283283
     
    287287     */
    288288    public void setJunctioncandidate(HashSet<Channel> junctionCandidate) {
    289         this.junctioncandidate.clear();
    290         this.junctioncandidate = junctionCandidate;
     289        this.junctionCandidate.clear();
     290        this.junctionCandidate = junctionCandidate;
    291291        Iterator<Channel> it = junctionCandidate.iterator();
    292292        while (it.hasNext()) {
     
    296296
    297297    public void addJunctioncandidateChannel(Channel channel) {
    298         junctioncandidate.add(channel);
     298        junctionCandidate.add(channel);
    299299        channel.setPartOfJunction(true);
    300300    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/Combination.java

    r32596 r34525  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking;
     3
     4import org.openstreetmap.josm.tools.Logging;
    35
    46public class Combination {
     
    1012    public Combination(long n, long k) {
    1113        if (n < 0 || k < 0)
    12             try {
    13                 throw new Exception("Negative parameter in constructor");
    14             } catch (Exception e) {
    15                 // TODO Auto-generated catch block
    16                 e.printStackTrace();
    17             }
     14            Logging.error("Negative parameter in constructor");
    1815        this.n = n;
    1916        this.k = k;
     
    2623    public static long Choose(long n, long k) {
    2724      if (n < 0 || k < 0)
    28         try {
    29             throw new Exception("Invalid negative parameter in Choose()");
    30         } catch (Exception e) {
    31             // TODO Auto-generated catch block
    32             e.printStackTrace();
    33         }
     25          Logging.error("Invalid negative parameter in Choose()");
    3426      if (n < k) return 0;
    3527      if (n == k) return 1;
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/OSMXMLReader.java

    r32692 r34525  
    1313import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMRelation;
    1414import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMWay;
     15import org.openstreetmap.josm.tools.Logging;
    1516
    1617/**
     
    175176            }
    176177        } catch (XMLStreamException e) {
    177             e.printStackTrace();
     178            Logging.error(e);
    178179        }
    179180    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLFilterReader.java

    r32596 r34525  
    88
    99import org.openstreetmap.josm.plugins.JunctionChecker.filter.Filter;
     10import org.openstreetmap.josm.tools.Logging;
    1011
    1112/**
     
    5253            }
    5354        } catch (XMLStreamException e) {
    54             e.printStackTrace();
     55            Logging.error(e);
    5556        }
    5657    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLReader.java

    r32596 r34525  
    99import javax.xml.stream.XMLStreamException;
    1010import javax.xml.stream.XMLStreamReader;
     11
     12import org.openstreetmap.josm.tools.Logging;
    1113
    1214public abstract class XMLReader {
     
    2123                .createXMLStreamReader(this.getClass().getResourceAsStream(filename));
    2224        } catch (XMLStreamException e) {
    23             e.printStackTrace();
     25            Logging.error(e);
    2426        }
    2527    }
     
    2931            parser = factory
    3032                    .createXMLStreamReader(new FileInputStream(file));
    31         } catch (FileNotFoundException e) {
    32             e.printStackTrace();
    33         } catch (XMLStreamException e) {
    34             e.printStackTrace();
     33        } catch (FileNotFoundException | XMLStreamException e) {
     34            Logging.error(e);
    3535        }
    3636    }
Note: See TracChangeset for help on using the changeset viewer.