Changeset 34525 in osm for applications/editors/josm/plugins/junctionchecking/src
- Timestamp:
- 2018-08-18T18:35:34+02:00 (6 years ago)
- 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 16 16 import javax.swing.Icon; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.Bounds; 20 19 import org.openstreetmap.josm.data.coor.LatLon; 21 20 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 21 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 22 22 import org.openstreetmap.josm.gui.MapView; 23 23 import org.openstreetmap.josm.gui.layer.Layer; … … 142 142 143 143 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()))); 145 145 } 146 146 -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java
r33778 r34525 9 9 import javax.swing.JOptionPane; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.Bounds; 13 12 import org.openstreetmap.josm.data.DataSource; … … 75 74 if (MainApplication.getMap() == null 76 75 || !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")); 78 77 return; 79 78 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java
r33778 r34525 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.gui.MainApplication; 14 13 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 29 28 private final int n; //Grad der Kreuzung 30 29 private final HashSet<Channel> subset; //Teilmge der zu prüfenden Channel 31 private final boolean produce relation;30 private final boolean produceRelation; 32 31 private boolean canceled; 33 32 … … 37 36 this.n = n; 38 37 this.subset = subset; 39 this.produce relation = produceRelation;38 this.produceRelation = produceRelation; 40 39 jc = new JunctionChecker(plugin.getChannelDigraph(), n); 41 40 } … … 55 54 if (jc.isSmallerJunction()) { 56 55 showjunction(); 57 JOptionPane.showMessageDialog(Main .parent,56 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 58 57 tr("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again.")); 59 58 } else if (jc.getCheck()) { 60 59 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)); 62 61 plugin.getChannelDigraph().ereaseJunctioncandidate(); 63 62 for (int i = 0; i < jc.getSubJunction().size(); i++) { 64 63 plugin.getChannelDigraph().addJunctioncandidateChannel(jc.getSubJunction().get(i)); 65 64 } 66 if (produce relation) {65 if (produceRelation) { 67 66 this.plugin.getRelationProducer().produceRelation(subset, n); 68 67 } 69 68 } 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()); 71 70 } 72 71 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java
r33778 r34525 11 11 import java.awt.event.MouseEvent; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.mapmode.MapMode; 15 14 import org.openstreetmap.josm.data.coor.LatLon; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java
r33778 r34525 6 6 import java.io.File; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.actions.mapmode.MapMode; 10 9 import org.openstreetmap.josm.gui.MainApplication; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionSearchTask.java
r32596 r34525 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm. Main;12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 14 14 import org.openstreetmap.josm.io.OsmTransferException; … … 54 54 } 55 55 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())); 57 57 if (produceRelation) { 58 58 for (int i = 0; i < junctions.size(); i++) { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/PrepareJunctionCheckorSearch.java
r33778 r34525 6 6 import javax.swing.JOptionPane; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.gui.MainApplication; 10 9 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; … … 22 21 private final boolean produceRelation; 23 22 24 public PrepareJunctionCheckorSearch(JunctionCheckerPlugin plugin, int n, boolean produce relation) {23 public PrepareJunctionCheckorSearch(JunctionCheckerPlugin plugin, int n, boolean produceRelation) { 25 24 this.plugin = plugin; 26 25 this.n = n; 27 26 this.subset = new HashSet<>(); 28 this.produceRelation = produce relation;27 this.produceRelation = produceRelation; 29 28 } 30 29 … … 44 43 private boolean prepareSubset() { 45 44 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"); 47 46 return false; 48 47 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/commandlineinterface/CLI.java
r32596 r34525 16 16 import org.openstreetmap.josm.plugins.JunctionChecker.reader.XMLFilterReader; 17 17 import org.openstreetmap.josm.plugins.JunctionChecker.writing.OSMXMLWriter; 18 import org.openstreetmap.josm.tools.Logging; 18 19 19 20 public final class CLI { … … 71 72 StrongConnectednessCalculator scc = new StrongConnectednessCalculator(cdgb.getDigraph()); 72 73 scc.calculateSCC(); 73 //System.out.println(scc.showNotstronglyConnectednessParts());74 74 75 75 if (maxchannelsearch == 0) { … … 77 77 try { 78 78 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); 85 81 } 86 ;87 88 System.out.println("OSMXML erzeugt, breche an dieser Stelle ab");89 82 return; 90 83 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/ChannelDiGraph.java
r32596 r34525 15 15 private final ArrayList<LeadsTo> leadsTos = new ArrayList<>(); 16 16 private final HashSet<Channel> selectedChannels = new HashSet<>(); 17 private HashSet<Channel> junction candidate = new HashSet<>();17 private HashSet<Channel> junctionCandidate = new HashSet<>(); 18 18 19 19 public void setChannels(ArrayList<Channel> channels) { … … 271 271 272 272 public HashSet<Channel> getJunctionCandidate() { 273 return junction candidate;273 return junctionCandidate; 274 274 } 275 275 276 276 public void ereaseJunctioncandidate() { 277 Iterator<Channel> it = junction candidate.iterator();277 Iterator<Channel> it = junctionCandidate.iterator(); 278 278 while (it.hasNext()) { 279 279 it.next().setPartOfJunction(false); 280 280 } 281 junction candidate.clear();281 junctionCandidate.clear(); 282 282 } 283 283 … … 287 287 */ 288 288 public void setJunctioncandidate(HashSet<Channel> junctionCandidate) { 289 this.junction candidate.clear();290 this.junction candidate = junctionCandidate;289 this.junctionCandidate.clear(); 290 this.junctionCandidate = junctionCandidate; 291 291 Iterator<Channel> it = junctionCandidate.iterator(); 292 292 while (it.hasNext()) { … … 296 296 297 297 public void addJunctioncandidateChannel(Channel channel) { 298 junction candidate.add(channel);298 junctionCandidate.add(channel); 299 299 channel.setPartOfJunction(true); 300 300 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/Combination.java
r32596 r34525 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 3 4 import org.openstreetmap.josm.tools.Logging; 3 5 4 6 public class Combination { … … 10 12 public Combination(long n, long k) { 11 13 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"); 18 15 this.n = n; 19 16 this.k = k; … … 26 23 public static long Choose(long n, long k) { 27 24 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()"); 34 26 if (n < k) return 0; 35 27 if (n == k) return 1; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/OSMXMLReader.java
r32692 r34525 13 13 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMRelation; 14 14 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMWay; 15 import org.openstreetmap.josm.tools.Logging; 15 16 16 17 /** … … 175 176 } 176 177 } catch (XMLStreamException e) { 177 e.printStackTrace();178 Logging.error(e); 178 179 } 179 180 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLFilterReader.java
r32596 r34525 8 8 9 9 import org.openstreetmap.josm.plugins.JunctionChecker.filter.Filter; 10 import org.openstreetmap.josm.tools.Logging; 10 11 11 12 /** … … 52 53 } 53 54 } catch (XMLStreamException e) { 54 e.printStackTrace();55 Logging.error(e); 55 56 } 56 57 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLReader.java
r32596 r34525 9 9 import javax.xml.stream.XMLStreamException; 10 10 import javax.xml.stream.XMLStreamReader; 11 12 import org.openstreetmap.josm.tools.Logging; 11 13 12 14 public abstract class XMLReader { … … 21 23 .createXMLStreamReader(this.getClass().getResourceAsStream(filename)); 22 24 } catch (XMLStreamException e) { 23 e.printStackTrace();25 Logging.error(e); 24 26 } 25 27 } … … 29 31 parser = factory 30 32 .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); 35 35 } 36 36 }
Note:
See TracChangeset
for help on using the changeset viewer.