Changeset 32596 in osm for applications/editors/josm/plugins/junctionchecking/src/org
- Timestamp:
- 2016-07-06T23:33:59+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/ChannelDiGraphLayer.java
r32423 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 40 41 41 42 private ChannelDiGraph digraph; 42 private static final int POINTSIZE = 5; //original 343 private static final int POINTSIZE = 5; //original 3 43 44 private static final float LINEWIDTH = 4; //original 2 44 45 private final ColorSchemeXMLReader cXMLReader; … … 47 48 static { 48 49 Polygon head = new Polygon(); 49 head.addPoint( 0,0);50 head.addPoint(0, 0); 50 51 head.addPoint(-15, +4); 51 52 head.addPoint(-15, -4); … … 62 63 private Color partOfJunctionColor; 63 64 64 public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader) {65 public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader) { 65 66 super("ChannelDiGraphLayer"); 66 67 Main.getLayerManager().addLayerChangeListener(this); … … 97 98 @Override 98 99 public String getToolTipText() { 99 return tr 100 return tr("Channel-Digraph created from the active OSM-Layer"); 100 101 } 101 102 … … 128 129 if (channel.isPartOfJunction()) { 129 130 c = partOfJunctionColor; 130 } 131 else if (channel.isSelected() == true) { 131 } else if (channel.isSelected() == true) { 132 132 c = selectedChannelColor; 133 } 134 else if (channel.isStrongConnected() == false) { 135 c= nsccChannelColor; 136 } 137 else if (channel.getBackChannelID() != -100) { 133 } else if (channel.isStrongConnected() == false) { 134 c = nsccChannelColor; 135 } else if (channel.getBackChannelID() != -100) { 138 136 c = twoWayChannelColor; 139 } 140 else { 137 } else { 141 138 c = oneWayChannelColor; 142 139 } … … 149 146 head = AffineTransform.getTranslateInstance(toPoint.x, toPoint.y).createTransformedShape(head); 150 147 g.fill(head); 151 152 148 } 153 149 … … 168 164 final float vecY = p2.y - p1.y; 169 165 170 final float vecLength = (float) Math.sqrt(vecX*vecX + vecY*vecY);166 final float vecLength = (float) Math.sqrt(vecX*vecX + vecY*vecY); 171 167 172 168 final float dotProductVecAxis = vecX; 173 169 174 float angle = (float) Math.acos(dotProductVecAxis / vecLength);170 float angle = (float) Math.acos(dotProductVecAxis / vecLength); 175 171 176 172 if (p2.y < p1.y) { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java
r32423 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 40 41 41 42 public DigraphCreationTask(JunctionCheckerPlugin plugin, boolean sealGraph, boolean calculateSCC) { 42 super(tr 43 super(tr("Create Channel Digraph"), false); 43 44 this.plugin = plugin; 44 45 this.sealGraph = sealGraph; … … 79 80 getProgressMonitor().setTicksCount(tickscounter); 80 81 tickscounter = 1; 81 getProgressMonitor().subTask(tr 82 getProgressMonitor().subTask(tr("Converting OSM graph into Channel Digraph")); 82 83 getProgressMonitor().setTicks(tickscounter++); 83 84 84 85 OSMGraph graph = new OSMGraph(); 85 86 //Der vom Benutzer in JOSM ausgewählte, zur Zeit aktive Layer wird der PLugin-OSM-Layer 86 plugin.setOsmlayer((OsmDataLayer) Main.getLayerManager().getActiveLayer());87 plugin.setOsmlayer((OsmDataLayer) Main.getLayerManager().getActiveLayer()); 87 88 Iterator<Node> it = Main.getLayerManager().getEditDataSet().getNodes().iterator(); 88 89 while (it.hasNext()) { … … 117 118 ExecuteFilter ef = new ExecuteFilter(reader.getFilters(), graph); 118 119 ef.filter(); 119 getProgressMonitor().subTask(tr 120 getProgressMonitor().subTask(tr("creating Channel-Digraph")); 120 121 getProgressMonitor().setTicks(tickscounter++); 121 122 // ChannelDiGraphen erzeugen … … 125 126 // DiGraph "versiegeln" 126 127 if (sealGraph) { 127 getProgressMonitor().subTask(tr 128 getProgressMonitor().subTask(tr("sealing Digraph")); 128 129 getProgressMonitor().setTicks(tickscounter++); 129 130 DiGraphSealer sealer = new DiGraphSealer(cdgb.getDigraph(), cdgb … … 133 134 //Digraph starke Zusammenhangskomponenten berechnen 134 135 if (calculateSCC) { 135 getProgressMonitor().subTask(tr 136 getProgressMonitor().subTask(tr("calculating Strong Connectedness")); 136 137 getProgressMonitor().setTicks(tickscounter++); 137 138 scc.calculateSCC(); 138 139 } 139 getProgressMonitor().subTask(tr 140 getProgressMonitor().subTask(tr("creating DigraphLayer")); 140 141 getProgressMonitor().setTicks(tickscounter++); 141 142 plugin.setChannelDigraph(cdgb.getDigraph()); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckDialog.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 31 32 * @author joerg 32 33 */ 33 public class JunctionCheckDialog extends ToggleDialog implements SelectionChangedListener {34 public class JunctionCheckDialog extends ToggleDialog implements SelectionChangedListener { 34 35 35 36 private final JunctionCheckerPlugin plugin; … … 67 68 68 69 //Elemente für Grad-Auswahl der Kreuzung 69 JPanel spinnerpanel = new JPanel(new GridLayout(1, 2));70 JPanel spinnerpanel = new JPanel(new GridLayout(1, 2)); 70 71 smodel = new SpinnerNumberModel(3, 1, 20, 1); 71 72 nways = new JSpinner(smodel); … … 137 138 /** 138 139 * (de)aktiviert Buttons zum JunctionCheck oder Suche 139 * @param activate140 140 */ 141 141 public void setActivateJunctionCheckOrSearch(boolean activate) { … … 149 149 /** 150 150 * (de)aktiviert Buttons zur Channel Digraph Erstellung 151 * @param activate152 151 */ 153 152 public void setActivateCreateDigraph(final boolean activate) { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java
r32329 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 21 22 * @author joerg 22 23 */ 23 public class JunctionCheckTask extends PleaseWaitRunnable {24 public class JunctionCheckTask extends PleaseWaitRunnable { 24 25 25 26 private final JunctionChecker jc; … … 36 37 this.subset = subset; 37 38 this.producerelation = produceRelation; 38 jc = new JunctionChecker(plugin.getChannelDigraph() 39 jc = new JunctionChecker(plugin.getChannelDigraph(), n); 39 40 } 40 41 … … 51 52 } 52 53 progressMonitor.finishTask(); 53 if (jc.isSmallerJunction() 54 if (jc.isSmallerJunction()) { 54 55 showjunction(); 55 JOptionPane.showMessageDialog(Main.parent, tr ("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again."));56 }57 else if (jc.getCheck()) {56 JOptionPane.showMessageDialog(Main.parent, 57 tr("The marked channels contains a junctioncandidate (white). To test this candidat mark these channel and press the \"Check\" button again.")); 58 } else if (jc.getCheck()) { 58 59 showjunction(); 59 JOptionPane.showMessageDialog(Main.parent, tr 60 JOptionPane.showMessageDialog(Main.parent, tr("The marked channels are a {0}-ways junction", n)); 60 61 plugin.getChannelDigraph().ereaseJunctioncandidate(); 61 62 for (int i = 0; i < jc.getSubJunction().size(); i++) { … … 65 66 this.plugin.getRelationProducer().produceRelation(subset, n); 66 67 } 68 } else if (!jc.getCheck()) { 69 JOptionPane.showMessageDialog(Main.parent, tr("The marked channels are not a junction:") + jc.getJCheckResult()); 67 70 } 68 else if (!jc.getCheck()) {69 JOptionPane.showMessageDialog(Main.parent, tr ("The marked channels are not a junction:") + jc.getJCheckResult());70 71 }72 73 71 } 74 72 -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java
r32423 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 66 67 } 67 68 68 69 69 @Override public void mouseDragged(MouseEvent e) { 70 if ( (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) ==InputEvent.BUTTON1_DOWN_MASK) {70 if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) { 71 71 //if button1 is hold, draw the rectangle. 72 72 paintRect(pointPressed, e.getPoint()); … … 79 79 } 80 80 requestFocusInMapView(); 81 digraph.ereaseJunctioncandidate(); //um zu verhindern, dass gefundene Kreuzungen/Kandidaten weiterhin weiß gezeichnet werden81 digraph.ereaseJunctioncandidate(); //um zu verhindern, dass gefundene Kreuzungen/Kandidaten weiterhin weiß gezeichnet werden 82 82 Point pointReleased = e.getPoint(); 83 83 … … 104 104 */ 105 105 public Rectangle createRect(Point p1, Point p2) { 106 int x, y,w,h;106 int x, y, w, h; 107 107 if (p1.x == p2.x && p1.y == p2.y) { 108 108 //if p1 and p2 same points draw a small rectangle around them … … 112 112 h = 3; 113 113 } else { 114 if (p1.x < p2.x) {114 if (p1.x < p2.x) { 115 115 x = p1.x; 116 116 w = p2.x-p1.x; … … 127 127 } 128 128 } 129 return new Rectangle(x, y,w,h);129 return new Rectangle(x, y, w, h); 130 130 } 131 131 … … 136 136 if (frame != null) { 137 137 Graphics g = frame.getGraphics(); 138 138 139 139 Rectangle r = oldRect; 140 140 if (r != null) { … … 142 142 g.setXORMode(Color.BLACK); 143 143 g.setColor(Color.WHITE); 144 g.drawRect(r.x, r.y,r.width,r.height);144 g.drawRect(r.x, r.y, r.width, r.height); 145 145 } 146 146 147 147 g.setXORMode(Color.BLACK); 148 148 g.setColor(Color.WHITE); 149 r = createRect(p1, p2);150 g.drawRect(r.x, r.y,r.width,r.height);149 r = createRect(p1, p2); 150 g.drawRect(r.x, r.y, r.width, r.height); 151 151 oldRect = r; 152 152 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java
r32423 r32596 1 /** 2 * License: GPL. Copyright 2011. Jörg Possin (joerg.possin@uni-muenster.de) 3 */ 1 // License: GPL. For details, see LICENSE file. 4 2 package org.openstreetmap.josm.plugins.JunctionChecker; 5 3 … … 24 22 25 23 /** 26 * 27 * This plugins helps to create a channel digraph und check channels in this network if it is a 24 * 25 * This plugins helps to create a channel digraph und check channels in this network if it is a 28 26 * junction or searches in a subgraph after junctions. 29 * 27 * @author Jörg Possin (joerg.possin@uni-muenster.de) 30 28 */ 31 29 public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener { … … 89 87 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false); 90 88 return; 91 } 92 else { 89 } else { 93 90 this.getJunctionCheckDialog().setActivateCreateDigraph(false); 94 91 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionSearchTask.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 20 21 * @author joerg 21 22 */ 22 public class JunctionSearchTask extends PleaseWaitRunnable {23 public class JunctionSearchTask extends PleaseWaitRunnable { 23 24 24 25 private final JunctionChecker jc; … … 32 33 HashSet<Channel> subset, 33 34 boolean produceRelation) { 34 super("JunctionSearch", false);35 super("JunctionSearch", false); 35 36 this.plugin = plugin; 36 37 this.n = n; … … 56 57 if (produceRelation) { 57 58 for (int i = 0; i < junctions.size(); i++) { 58 plugin.getRelationProducer().produceRelation(junctions.get(i) 59 plugin.getRelationProducer().produceRelation(junctions.get(i), n); 59 60 } 60 61 } … … 66 67 jc.junctionSearch(new ArrayList<>(subset), getProgressMonitor()); 67 68 } 68 69 69 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/PrepareJunctionCheckorSearch.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker; 2 3 … … 27 28 } 28 29 29 30 30 protected void prepareJunctionCheck() { 31 31 if (prepareSubset()) { … … 42 42 } 43 43 44 private boolean prepareSubset() {44 private boolean prepareSubset() { 45 45 if (plugin.getChannelDigraph().getSelectedChannels().size() < 6) { 46 46 JOptionPane.showMessageDialog(Main.parent, "Less then 6 channels are selected"); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/commandlineinterface/CLI.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.commandlineinterface; 2 3 … … 16 17 import org.openstreetmap.josm.plugins.JunctionChecker.writing.OSMXMLWriter; 17 18 18 public class CLI {19 public final class CLI { 19 20 20 21 /** 21 22 * Die Klasse ist zum Erstellen statistischer Tests, oder zur Erzeugung einer Channel-Digraph-XML-Datei 22 * @param args23 23 */ 24 24 public static void main(String[] args) { … … 136 136 measuredIterateThroughTime = 0; 137 137 measuredGenerateSubColumnTime = 0; 138 measuredTime = 0;138 measuredTime = 0; 139 139 jcf = 0; 140 140 //System.out.println("maxchannel: " + i); … … 148 148 .size()) * Math.random())); 149 149 } 150 while (!seed.isStrongConnected());150 while (!seed.isStrongConnected()); 151 151 subset.add(seed); 152 152 //System.out.println("Seed: " + seed.getNewid()); … … 161 161 seed = tempChannel; 162 162 isIn = true; 163 } 164 else { 163 } else { 165 164 vorChannel = tempChannel; 166 165 isIn = false; 167 166 } 168 } while (isIn == false);167 } while (isIn == false); 169 168 } 170 169 start = System.currentTimeMillis(); … … 176 175 jcf = jcf + jc.getJunctions().size(); 177 176 } 178 System.out.println("Channels: " + (i) + " Time(Iterate): " + (measuredIterateThroughTime/runs) + " Time(Generate): " + (measuredGenerateSubColumnTime/runs) +" Time(overall): "+ (measuredTime/runs) + " junctionsfound: " + jcf); 177 System.out.println("Channels: " + (i) + 178 " Time(Iterate): " + (measuredIterateThroughTime/runs) + 179 " Time(Generate): " + (measuredGenerateSubColumnTime/runs) + 180 " Time(overall): "+ (measuredTime/runs) + " junctionsfound: " + jcf); 179 181 } 180 182 } … … 182 184 private static Channel getNeighbourChannel(Channel seedChannel) { 183 185 if (Math.random() < 0.5) { 184 if (seedChannel.getPredChannels().size() >= 1) {186 if (seedChannel.getPredChannels().size() >= 1) { 185 187 return seedChannel.getPredChannels().get((int) (seedChannel.getPredChannels().size() * Math.random())); 186 } 187 else return seedChannel; 188 } 189 else { 190 if (seedChannel.getLeadsTo().size() >=1 ) { 188 } else return seedChannel; 189 } else { 190 if (seedChannel.getLeadsTo().size() >= 1) { 191 191 return seedChannel.getLeadsTo().get((int) (seedChannel.getLeadsTo().size() * Math.random())).getToChannel(); 192 } 193 else return seedChannel; 192 } else return seedChannel; 194 193 } 195 194 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/connectedness/BacktrackingColors.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.connectedness; 2 3 … … 4 5 * @author joerg 5 6 */ 6 public class BacktrackingColors {7 7 public final class BacktrackingColors { 8 8 9 public static final int WHITE = -1; 9 10 public static final int GREY = 0; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/connectedness/DiGraphSealer.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.connectedness; 2 3 … … 6 7 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; 7 8 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.LeadsTo; 8 9 9 10 10 /** … … 105 105 this.deleteDuplicateChannels(); 106 106 } 107 107 108 108 /* 109 109 private void showLeadsTo() { … … 135 135 } 136 136 137 /* 137 /** 138 138 * setzt Wert für IDs für neu angelegte Ways 139 */140 /**141 * @param newID142 139 */ 143 140 public void setNewID(int newID) { … … 146 143 147 144 /** 148 * @return149 145 * @uml.property name="newID" 150 146 */ -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/connectedness/StrongConnectednessCalculator.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.connectedness; 2 3 3 4 import java.util.ArrayList; 5 4 6 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 5 7 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; … … 96 98 * gibt eine Arraylist mit all den Channels zurück, welche nicht 97 99 * im größten zusammenhägendem Teil des Channel-Digraphen sind 98 * @return99 100 */ 100 101 public ArrayList<Channel> getNotConnectedChannels() { … … 116 117 tarjan(n); 117 118 v.setLowlink(Math.min(v.getLowlink(), n.getLowlink())); 118 } 119 else if (stack.contains(n)) { 119 } else if (stack.contains(n)) { 120 120 //log.trace("setze lowlink von n auf: " + v.getLowlink()); 121 121 v.setLowlink(Math.min(v.getLowlink(), n.getLowlink())); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/ChannelDigraphBuilder.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.converting; 2 3 … … 49 50 * @param toNode toNode des zu erstellnenden Channels 50 51 * @param way ein zu dem Channel gehörender Way 51 * @return52 52 */ 53 53 private Channel createChannel(OSMNode fromNode, OSMNode toNode, OSMWay way) { … … 95 95 } 96 96 lastUsedNode = nodes[i]; 97 }98 97 // wenn der betrachtete Knoten keine Nachfolger hat, ist ein 99 98 // Straßenende erreicht. Auch in diesem Fall muß ein Channel erzeugt werden 100 else if (nodes[i].getSuccNodeList().size() == 0) {99 } else if (nodes[i].getSuccNodeList().size() == 0) { 101 100 tempChannel = createChannel(lastUsedNode, nodes[i], way); 102 101 // Rückrichtung wird nur erzeugt, wenn der OSM-Way keine Einbahnstraße ist … … 104 103 createBackChannel(nodes[i], lastUsedNode, way, tempChannel); 105 104 } 106 }107 105 // eine Straße besteht aus 2 Ways, obwohl eigentlich eine reicht 108 106 // tritt z.b. bei einer brücke auf, brücke wird neuer channel … … 110 108 // Idee: speichern eines flags, um diese erzeugten Channels zu markieren. aus diesen informationen 111 109 // später den CHannel löschen!!! 112 else if (i == nodes.length - 1110 } else if (i == nodes.length - 1 113 111 && nodes[i].getSuccNodeList().size() == 1) { 114 112 // damit ist ein Channel gefunden, und wird mit Werten gefüllt … … 120 118 } 121 119 lastUsedNode = nodes[i]; 122 123 120 } 124 125 121 } 126 122 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/NodesConnectionProducer.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.converting; 2 3 … … 11 12 */ 12 13 public class NodesConnectionProducer { 13 14 14 15 private OSMGraph osmgraph; 15 16 private OSMWay[] osmways; … … 19 20 osmways = this.osmgraph.getWays(); 20 21 } 21 22 22 23 public void produceNodesConnections() { 23 24 OSMNode[] waynodes; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/PseudoChannelRemover.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.converting; 2 3 3 4 import java.util.ArrayList; 5 4 6 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 5 7 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; … … 48 50 49 51 //TODO: quick'n'dirty 50 ArrayList< 52 ArrayList<LeadsTo> tls = succChannel.getLeadsTo(); 51 53 for (int i = 0; i < tls.size(); i++) { 52 54 digraph.removeLeadsTo(tls.get(i)); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/converting/TurnRestrictionChecker.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.converting; 2 3 3 4 import java.util.ArrayList; 5 4 6 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 5 7 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; … … 13 15 * Channels des aus dem OSMGraphen erzeugten ChannelDigraphen dementsprechend 14 16 * an. wird vom ChannelDigraphBuilder aufgerufen 15 * 17 * 16 18 * @author Jörg Possin 17 19 */ … … 62 64 channelDigraph.addLeadsTo(tempLeadsTo); 63 65 toChannel.addPredChannel(fromChannel); 64 }65 66 /* 66 67 * der no_* Fall: wie oben, nur das hier nichts geschieht 67 68 */ 68 else if (turnrestrictionsrelations.get(relationpointer).getValue(69 } else if (turnrestrictionsrelations.get(relationpointer).getValue( 69 70 "restriction").startsWith("no")) { 70 71 for (int i = 0; i < fromChannel.getToNode() -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/BasicChannel.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 32 33 /** 33 34 * setzt den ToNode 34 * @param toNode35 35 */ 36 36 public void setToNode(OSMNode toNode) { … … 61 61 /** 62 62 * fügt eine LeadsTo-Beziehung hinzu 63 * @param leadsTo64 63 */ 65 64 public void addLeadsTo(LeadsTo leadsTo) { … … 83 82 /** 84 83 * gibt alle leadsTo zurück 85 * @return86 84 */ 87 85 public ArrayList<LeadsTo> getLeadsTo() { … … 92 90 * fügt einen Way hinzu, aus dem der Channel enstanden ist 93 91 * es gibt immer mind. einen Way, es können aber auch mehr sein 94 * @param way95 92 */ 96 93 public void addWay(OSMWay way) { … … 100 97 /** 101 98 * gibt alle Ways zurück 102 * @return103 99 */ 104 100 public ArrayList<OSMWay> getWays() { … … 111 107 * mit Werten zu füllen dabei gehen Informationen verloren, da ein Channel 112 108 * aus mehr als einem Way bestehen kann 113 *114 * @return115 109 */ 116 110 public OSMWay getWay() { … … 119 113 120 114 /** 121 * setzt die ID des Channels. es kann nicht die ID des Ways übernommen werden, da aus einem Way oftmals mehrere Channels entstehen (z.B. bei jeder Nichteinbahnstraße mind. 2) 115 * setzt die ID des Channels. 116 * es kann nicht die ID des Ways übernommen werden, da aus einem Way oftmals mehrere Channels entstehen (z.B. bei jeder Nichteinbahnstraße mind. 2) 122 117 */ 123 118 public void setNewid(int newid) { … … 134 129 /** 135 130 * gibt alle VorgängerChannels zurück 136 * @return137 131 */ 138 132 public ArrayList<Channel> getPredChannels() { … … 145 139 @Override 146 140 public String toString() { 147 String lt = "";141 String lt = ""; 148 142 for (int i = 0; i < leadsTo.size(); i++) { 149 143 lt += leadsTo.get(i).getToChannel().getNewid() + ", "; … … 153 147 predch += predChannels.get(i).getNewid() + ", "; 154 148 } 155 return "[ChannelID: "+ newid + ":AnzahlPredCH: " + predChannels.size() + ":PredCh: " + predch + ":AnzahlSuccCH: " + leadsTo.size() +":LeadsTo: " + lt+ ":backCHID: " + backChannelID + "]"; 149 return "[ChannelID: "+ newid + ":AnzahlPredCH: " + predChannels.size() + ":PredCh: " + predch + 150 ":AnzahlSuccCH: " + leadsTo.size() +":LeadsTo: " + lt+ ":backCHID: " + backChannelID + "]"; 156 151 } 157 152 … … 173 168 way.addNode(this.fromNode); 174 169 way.addNode(this.toNode); 175 way.setId((long) this.newid);170 way.setId((long) this.newid); 176 171 if (this.getWay() != null) { 177 172 way.setHashmap(this.getWay().getHashmap()); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/Channel.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 10 11 * @author joerg 11 12 */ 12 public class Channel extends BasicChannel {13 public class Channel extends BasicChannel { 13 14 14 15 //für den Junctioncheck … … 22 23 private boolean isSelected = false; //wird für den eigenen Layer benötigt, um markierte Channels zu erhalten 23 24 private boolean isPartOfJunction = false; //wird für den eigenen Layer benötigt, um Teile einer Kreuzung farbig repräsentieren zu können 24 25 private final HashMap<Channel , ArrayList<Channel>> paths2 = new HashMap<>(); 26 25 26 private final HashMap<Channel, ArrayList<Channel>> paths2 = new HashMap<>(); 27 27 28 28 public Channel(OSMNode fromNode, OSMNode toNode) { … … 35 35 } 36 36 37 public Channel() {37 public Channel() { 38 38 super(); 39 39 //this.insidenodes = new ArrayList<OSMNode>(); … … 45 45 /** 46 46 * gibt die Anzahl der auf diesen Channel verweisenden leadsTo zurück 47 * @return48 47 */ 49 48 public int getIndegree() { … … 53 52 /** 54 53 * gibt die Anzahl der aus diesem Channel gehenden leadsTo zurück 55 * @return56 54 */ 57 55 public int getOutdegree() { … … 63 61 } 64 62 65 public void setOutdegree(int i) {63 public void setOutdegree(int i) { 66 64 this.outdegree = i; 67 65 } … … 91 89 /** 92 90 * gibt die von diesem Channel zu erreichenden anderen CHannels zurück 93 * @return94 91 */ 95 92 public ArrayList<Channel> getReachableNodes() { … … 99 96 /** 100 97 * setzt die zu erreichenden Channels alle anderen werden gelöscht 101 * @param reachableNodes102 98 */ 103 99 public int getEnnr() { … … 107 103 /** 108 104 * setzt die Anzahl der EingangsChannel 109 * @param ennr110 105 */ 111 106 public void setEnnr(int ennr) { … … 129 124 /** 130 125 * fügt einen erreichbaren Channel hinzu 131 * @param node132 126 */ 133 127 public void addReachableNode(Channel node) { … … 140 134 /** 141 135 * gibt den an der Position i gespeicherten erreichbaren Channel zurück 142 * @param i143 * @return144 136 */ 145 137 public Channel getReachableNodeAt(int i) { … … 168 160 } 169 161 170 171 162 /** 172 163 * fügt einen Pfad den Pfaden zu 173 * @param path174 164 */ 175 165 public void appendPath(Channel node, ArrayList<Channel> path) { … … 188 178 if (!paths2.get(node).contains(channel)) { 189 179 paths2.get(node).add(channel); 190 191 180 } 192 181 } … … 194 183 /** 195 184 * gibt alle Pfade zurück 196 * @return197 185 */ 198 186 public ArrayList<ArrayList<Channel>> getPaths() { … … 205 193 if (paths2.containsKey(node)) { 206 194 return paths2.get(node); 207 } 208 else { 195 } else { 209 196 //log.error("das darf nicht bei Channel: " + this.getNewid() + ", kein Node " + node.getNewid()); 210 197 return null; 211 198 } 212 213 199 } 214 200 … … 236 222 this.isPartOfJunction = isPartOfJunction; 237 223 } 238 239 240 224 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/ChannelDiGraph.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 42 43 /** 43 44 * löscht den übergebenden Channel im Digraphen 44 *45 * @param channel46 45 */ 47 46 public void removeChannel(Channel channel) { … … 51 50 /** 52 51 * fügt einen Channel des ChannelDigraphen hinzu 53 * 52 * 54 53 * @param channel 55 54 * hinzuzufügender Channel … … 61 60 /** 62 61 * Anzahl der innerhalb des DiGraphen gespeicherten Channels 63 * 62 * 64 63 * @return Anzahl der Channels 65 64 */ … … 70 69 /** 71 70 * gibt Channel i an der Position i in der ArrayList zurück 72 * 71 * 73 72 * @param i 74 73 * Position innerhalb der ArrayList … … 96 95 * gibt alle From und To OSMNodes eines Graphen zurück (nicht die 97 96 * ZWischenknoten) 98 * 97 * 99 98 * @return alle From und To Nodes aller Channels des Digraphen 100 99 */ … … 136 135 /** 137 136 * fügt eine leadsto-relation dem digraphen und dem entsprechendem Channel hinzu 138 * @param leadsTo139 137 */ 140 138 public void addLeadsTo(LeadsTo leadsTo) { … … 161 159 * gibt den Channel zurück, der paßt. Sind Channel doppelt vorhanden, wird 162 160 * nur der erste passende zurückgegeben! 163 *164 * @param fromChannel165 * @param toChannel166 * @return167 161 */ 168 162 public LeadsTo getLeadsTo(Channel fromChannel, Channel toChannel) { … … 181 175 /** 182 176 * gibt alle Channels zurück, die von diesen OSM-Knoten abgehen/hingehen 183 * @param nodes 184 * @return 185 */ 186 public ArrayList<Channel> getChannelsTouchingOSMNodes (ArrayList<OSMNode> nodes) { 177 */ 178 public ArrayList<Channel> getChannelsTouchingOSMNodes(ArrayList<OSMNode> nodes) { 187 179 ArrayList<Channel> touchingChannel = new ArrayList<>(); 188 180 for (int i = 0; i < nodes.size(); i++) { … … 192 184 touchingChannel.add(channels.get(j)); 193 185 } 194 } 195 else if (channels.get(j).getToNode().getId() == nodes.get(i).getId()) { 186 } else if (channels.get(j).getToNode().getId() == nodes.get(i).getId()) { 196 187 if (!touchingChannel.contains(channels.get(j))) { 197 188 touchingChannel.add(channels.get(j)); … … 218 209 /** 219 210 * gibt den oder die Channels twischen diesen OSM-Punkten zurück 220 * @param idfrom221 * @param idto222 * @return223 211 */ 224 212 public ArrayList<Channel> getChannelsBetween(int idfrom, int idto) { … … 229 217 channelsresult.add(channels.get(i)); 230 218 } 231 } 232 else if (channels.get(i).getFromNode().getId() == idto) { 219 } else if (channels.get(i).getFromNode().getId() == idto) { 233 220 if (channels.get(i).getToNode().getId() == idfrom) { 234 221 channelsresult.add(channels.get(i)); … … 252 239 for (int i = 0; i < channels.size(); i++) { 253 240 //log.trace(channels.get(i).getFromNode().toString()); 254 if ( 255 && (channels.get(i).getFromNode().getLongitude() >= left) && (channels.get(i).getFromNode().getLongitude() <= right)) {241 if ((channels.get(i).getFromNode().getLatitude() <= top) && (channels.get(i).getFromNode().getLatitude() >= bottom) 242 && (channels.get(i).getFromNode().getLongitude() >= left) && (channels.get(i).getFromNode().getLongitude() <= right)) { 256 243 channels.get(i).setSelected(true); 257 244 selectedChannels.add(channels.get(i)); 258 245 } 259 if ( 260 && (channels.get(i).getToNode().getLongitude() >= left) && (channels.get(i).getToNode().getLongitude() <= right)) {246 if ((channels.get(i).getToNode().getLatitude() <= top) && (channels.get(i).getToNode().getLatitude() >= bottom) 247 && (channels.get(i).getToNode().getLongitude() >= left) && (channels.get(i).getToNode().getLongitude() <= right)) { 261 248 channels.get(i).setSelected(true); 262 249 selectedChannels.add(channels.get(i)); … … 298 285 * setzt die Channels eines Kreuzungskandidaten 299 286 * falls in im Hashset vorher Channels gespeichert waren, werden diese vorher gelöscht! 300 * @param junctionCandidate301 287 */ 302 288 public void setJunctioncandidate(HashSet<Channel> junctionCandidate) { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/Graph.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 5 6 */ 6 7 public class Graph { 7 8 8 9 //Boundingbox 9 10 private double bbleft; … … 11 12 private double bbbottom; 12 13 private double bbtop; 13 14 14 15 15 public double getBbleft() { 16 16 return bbleft; 17 17 } 18 18 19 public void setBbleft(double bbleft) { 19 20 this.bbleft = bbleft; 20 21 } 22 21 23 public double getBbright() { 22 24 return bbright; 23 25 } 26 24 27 public void setBbright(double bbright) { 25 28 this.bbright = bbright; 26 29 } 30 27 31 public double getBbbottom() { 28 32 return bbbottom; 29 33 } 34 30 35 public void setBbbottom(double bbbottom) { 31 36 this.bbbottom = bbbottom; 32 37 } 38 33 39 public double getBbtop() { 34 40 return bbtop; 35 41 } 42 36 43 public void setBbtop(double bbtop) { 37 44 this.bbtop = bbtop; 38 45 } 46 39 47 public boolean isInBBox(OSMNode node) { 40 if ( 41 && (node.getLongitude() >= bbleft) && (node.getLongitude() <= bbright)) {48 if ((node.getLatitude() <= bbtop) && (node.getLatitude() >= bbbottom) 49 && (node.getLongitude() >= bbleft) && (node.getLongitude() <= bbright)) { 42 50 return true; 43 } 44 else { 51 } else { 45 52 return false; 46 53 } 47 54 } 48 49 50 55 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/LeadsTo.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 46 47 @Override 47 48 public String toString() { 48 return "fromChannel:::" + fromChannel.getNewid() 49 return "fromChannel:::" + fromChannel.getNewid() + ", toChannel:::" + toChannel.getNewid() + " über Node " + toChannel.getFromNode().getId(); 49 50 } 50 51 52 51 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMEntity.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 8 9 */ 9 10 public class OSMEntity { 10 11 11 12 //TODO Idee: alle Wertestandardmäßig auf -1 setzen, so muß 12 13 //man bei der Umwandlung nicht auf null-Werte prüfen … … 43 44 */ 44 45 private int version; 45 46 46 47 public void setversion(int version) { 47 48 this.version = version; 48 49 } 49 50 50 51 /** 51 * @return52 52 * @uml.property name="version" 53 53 */ … … 55 55 return version; 56 56 } 57 57 58 58 /** 59 * @return60 59 * @uml.property name="id" 61 60 */ … … 63 62 return id; 64 63 } 64 65 65 public void setId(Long id) { 66 66 this.id = id; 67 67 } 68 68 69 /** 69 * @return70 70 * @uml.property name="visible" 71 71 */ … … 73 73 return visible; 74 74 } 75 75 76 /** 76 * @param visible77 77 * @uml.property name="visible" 78 78 */ … … 80 80 this.visible = visible; 81 81 } 82 82 83 /** 83 * @return84 84 * @uml.property name="timestamp" 85 85 */ … … 87 87 return timestamp; 88 88 } 89 89 90 /** 90 * @param timestamp91 91 * @uml.property name="timestamp" 92 92 */ … … 94 94 this.timestamp = timestamp; 95 95 } 96 96 97 /** 97 * @return98 98 * @uml.property name="user" 99 99 */ … … 101 101 return user; 102 102 } 103 103 104 /** 104 * @param user105 105 * @uml.property name="user" 106 106 */ … … 108 108 this.user = user; 109 109 } 110 110 111 /** 111 * @return112 112 * @uml.property name="uid" 113 113 */ … … 115 115 return uid; 116 116 } 117 117 118 /** 118 * @param uid119 119 * @uml.property name="uid" 120 120 */ … … 122 122 this.uid = uid; 123 123 } 124 124 125 /** 125 * @return126 126 * @uml.property name="changeset" 127 127 */ … … 129 129 return changeset; 130 130 } 131 131 132 /** 132 * @param changeset133 133 * @uml.property name="changeset" 134 134 */ … … 136 136 this.changeset = changeset; 137 137 } 138 138 139 /** 139 * @return140 140 * @uml.property name="hashmap" 141 141 */ … … 143 143 return hashmap; 144 144 } 145 145 146 /** 146 * @param hashmap147 147 * @uml.property name="hashmap" 148 148 */ … … 150 150 this.hashmap = hashmap; 151 151 } 152 153 public void setKeyValue(String key, String value) {152 153 public void setKeyValue(String key, String value) { 154 154 hashmap.put(key, value); 155 155 } 156 157 public String getValue(String key) {156 157 public String getValue(String key) { 158 158 return hashmap.get(key); 159 159 } 160 160 161 public boolean hasKey(String key) {161 public boolean hasKey(String key) { 162 162 return hashmap.containsKey(key); 163 163 } 164 164 165 165 /** 166 166 * prüft, ob der übergebene String als Wert existiert 167 * @param value168 * @return169 167 */ 170 public boolean hasValue(String value) {168 public boolean hasValue(String value) { 171 169 return hashmap.containsValue(value); 172 170 } 173 171 174 172 protected String valuestoString() { 175 173 return ("ID: " + (id) + "\n" + "User: " + user + "\n"); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMGraph.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 5 6 import java.util.HashMap; 6 7 import java.util.Iterator; 8 7 9 import org.openstreetmap.josm.data.osm.Node; 8 10 import org.openstreetmap.josm.data.osm.Relation; … … 10 12 import org.openstreetmap.josm.data.osm.Way; 11 13 12 13 14 /** 14 15 * @author joerg 15 16 */ 16 public class OSMGraph extends Graph {17 public class OSMGraph extends Graph { 17 18 18 19 private final HashMap<Long, OSMWay> ways = new HashMap<>(); … … 27 28 * gibt den Knoten mit der gesuchten OSM-ID zurück 28 29 * @param id OSM-iD des Knotens! 29 * @return30 30 */ 31 31 public OSMNode getNode(long id) { … … 37 37 } 38 38 39 public OSMNode[] getNodes() {40 OSMNode[] nodearray = new OSMNode[nodes.size()];39 public OSMNode[] getNodes() { 40 OSMNode[] nodearray = new OSMNode[nodes.size()]; 41 41 return nodes.values().toArray(nodearray); 42 42 } … … 54 54 } 55 55 56 public 56 public HashMap<Long, OSMRelation> getRelationsAshashmap() { 57 57 return relations; 58 58 } 59 59 60 public void setRelations( 60 public void setRelations(HashMap<Long, OSMRelation> relations) { 61 61 this.relations = relations; 62 62 } 63 63 64 64 public OSMWay[] getWays() { 65 OSMWay[] wayarray = new OSMWay[ways.size()];65 OSMWay[] wayarray = new OSMWay[ways.size()]; 66 66 return ways.values().toArray(wayarray); 67 67 } … … 71 71 } 72 72 73 public OSMRelation[] getRelations() {73 public OSMRelation[] getRelations() { 74 74 OSMRelation[] relationarray = new OSMRelation[relations.size()]; 75 75 return relations.values().toArray(relationarray); … … 86 86 public ArrayList<Long> getIDsfromWay(int id) { 87 87 OSMWay w = ways.get(id); 88 ArrayList<Long> ids 88 ArrayList<Long> ids = new ArrayList<>(); 89 89 ids.add(w.getToNode().getId()); 90 90 ids.add(w.getFromNode().getId()); … … 121 121 if (rmember.getMember() instanceof Node) { 122 122 osmrelation.addMember(getNode(rmember.getMember().getId()), rmember.getRole()); 123 } 124 else if (rmember.getMember() instanceof Way) { 123 } else if (rmember.getMember() instanceof Way) { 125 124 osmrelation.addMember(getWay(rmember.getMember().getId()), rmember.getRole()); 126 125 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMNode.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 3 4 import java.util.ArrayList; 4 5 5 6 6 /** … … 8 8 */ 9 9 public class OSMNode extends OSMEntity { 10 10 11 11 private double latitude; 12 12 private double longitude; … … 14 14 private ArrayList<OSMNode> succNodeList = new ArrayList<>(); 15 15 private ArrayList<OSMNode> predNodeList = new ArrayList<>(); 16 16 17 17 public void addOutgoingChannel(Channel channel) { 18 18 outgoingChannels.add(channel); 19 19 } 20 20 21 21 public ArrayList<Channel> getOutgoingChannels() { 22 22 return outgoingChannels; 23 23 } 24 24 25 25 public double getLatitude() { 26 26 return latitude; 27 27 } 28 28 29 public void setLatitude(double latitude) { 29 30 this.latitude = latitude; 30 31 } 32 31 33 public double getLongitude() { 32 34 return longitude; 33 35 } 36 34 37 public void setLongitude(double longitude) { 35 38 this.longitude = longitude; 36 39 } 37 38 public String toString(){ 40 41 @Override 42 public String toString() { 39 43 return valuestoString() + "Lat: " + latitude + "\n" + "Lon: " + longitude; 40 44 } … … 47 51 return predNodeList; 48 52 } 49 53 50 54 public void addSuccNode(OSMNode node) { 51 55 succNodeList.add(node); 52 56 } 53 57 54 58 public void addPredNode(OSMNode node) { 55 59 predNodeList.add(node); 56 60 } 57 58 59 60 61 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMRelation.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 3 4 import java.util.ArrayList; 4 5 5 6 6 /** … … 18 18 return members; 19 19 } 20 20 21 21 /** 22 22 * gibt den Member mit der Rolle zurück, wenn vorhanden. Sonst null 23 * @param role24 * @return25 23 */ 26 24 public OSMEntity getMember(String role) { … … 32 30 return null; 33 31 } 34 32 35 33 public void addMember(OSMEntity member, String role) { 36 34 members.add(new Member(member, role)); 37 35 } 38 36 39 37 public String getRelationType(String key) { 40 38 return this.getValue(key); 41 39 } 42 40 41 @Override 43 42 public String toString() { 44 43 String s = ("Relation-ID: " + this.getId() + " Relation-Type: " + this.getRelationType("type") +"\n"); 45 44 for (int i = 0; i < members.size(); i++) { 46 s += ("Member: " + members.get(i).getRole() + ", ref:" + members.get(i).getId() + ", type:" + members.get(i).getType().getClass().getName() 45 s += ("Member: " + members.get(i).getRole() + ", ref:" + members.get(i).getId() + ", type:" + members.get(i).getType().getClass().getName()); 47 46 } 48 47 return s; 49 48 } 50 49 51 50 52 51 /** … … 59 58 private String role; 60 59 61 publicMember(OSMEntity member, String role) {60 Member(OSMEntity member, String role) { 62 61 this.member = member; 63 62 this.setRole(role); 64 63 } 65 64 66 65 public Class<? extends OSMEntity> getType() { 67 66 return member.getClass(); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/datastructure/OSMWay.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.datastructure; 2 3 … … 12 13 public OSMNode[] getNodes() { 13 14 OSMNode[] nodearray = new OSMNode[nodes.size()]; 14 return (OSMNode[])nodes.toArray(nodearray);15 return nodes.toArray(nodearray); 15 16 } 16 17 … … 36 37 /** 37 38 * ist der OSMWay eine Einbahnstraße? 38 * 39 * 39 40 * @return true wenn ja, sonst nein 40 41 */ … … 52 53 if (t.equals("motorway") || t.equals("motorway_link")) { 53 54 return true; 54 } 55 56 else { 55 } else { 57 56 return false; 58 57 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/filter/ExecuteFilter.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.filter; 2 3 … … 9 10 */ 10 11 public class ExecuteFilter { 11 12 12 13 private Filter[] filter; 13 14 private XMLFilterReader xmlfilterreader; 14 15 private OSMGraph incominggraph; 15 16 private OSMGraph outgoinggraph; 16 17 public ExecuteFilter(Filter[] filter, OSMGraph incoming) {17 18 public ExecuteFilter(Filter[] filter, OSMGraph incoming) { 18 19 this.filter = filter; 19 20 this.incominggraph = incoming; … … 25 26 outgoinggraph.setRelations(incoming.getRelationsAshashmap()); 26 27 } 27 28 28 29 public ExecuteFilter() { 29 30 } 30 31 public void filter() {31 32 public void filter() { 32 33 OSMWay[] tempWays = incominggraph.getWays(); 33 34 String key; … … 49 50 outgoinggraph.addNode(tempWays[j].getNodes()[j2]); 50 51 } 51 52 52 53 } 53 54 } … … 56 57 } 57 58 } 58 59 59 60 public Filter[] getFilter() { 60 61 return filter; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/filter/Filter.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.filter; 2 3 … … 8 9 */ 9 10 public class Filter { 10 11 11 12 private HashSet<String> tagValues = new HashSet<>(); 12 13 private String keyValue; 13 14 14 15 public Filter(String keyname, ArrayList<String> values) { 15 16 this.keyValue = keyname; 16 17 tagValues.addAll(values); 17 18 } 18 19 19 20 public boolean hasTagValue(String value) { 20 21 return tagValues.contains(value); 21 22 } 22 23 public Filter() { 23 24 public Filter() { 24 25 } 25 26 26 27 public String[] getTagValues() { 27 28 return tagValues.toArray(new String[tagValues.size()]); … … 31 32 this.tagValues = tagValues; 32 33 } 33 34 34 35 public void setTagValue(String value) { 35 36 tagValues.add(value); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/BackPropagation.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 3 4 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 4 5 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; 5 6 6 7 7 /** … … 18 18 19 19 /** 20 * 20 * 21 21 * @param y fromNode 22 22 * @param z toNode -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/Combination.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 3 4 public class Combination { 4 5 5 6 private long n = 0; 6 7 private long k = 0; 7 8 long[] data = null; 8 9 public Combination(long n, long k) {9 10 public Combination(long n, long k) { 10 11 if (n < 0 || k < 0) 11 12 try { … … 14 15 // TODO Auto-generated catch block 15 16 e.printStackTrace(); 16 } 17 } 17 18 this.n = n; 18 19 this.k = k; 19 this.data = new long[(int)k]; 20 for (long i = 0; i < k; ++i) 21 this.data[(int)i] = i; 20 this.data = new long[(int) k]; 21 for (long i = 0; i < k; ++i) { 22 this.data[(int) i] = i; 23 } 22 24 } 23 24 public static long Choose(long n, long k) 25 { 25 26 public static long Choose(long n, long k) { 26 27 if (n < 0 || k < 0) 27 28 try { … … 30 31 // TODO Auto-generated catch block 31 32 e.printStackTrace(); 32 } 33 } 33 34 if (n < k) return 0; 34 35 if (n == k) return 1; … … 36 37 long delta, iMax; 37 38 38 if (k < n-k) // ex: Choose(100,3) 39 { 39 if (k < n-k) { // ex: Choose(100,3) 40 40 delta = n-k; 41 41 iMax = k; 42 } 43 else // ex: Choose(100,97) 44 { 42 } else { // ex: Choose(100,97) 45 43 delta = k; 46 44 iMax = n-k; … … 49 47 long ans = delta + 1; 50 48 51 for (long i = 2; i <= iMax; ++i) 52 { 53 ans = (ans * (delta + i)) / i; 49 for (long i = 2; i <= iMax; ++i) { 50 ans = (ans * (delta + i)) / i; 54 51 } 55 52 56 53 return ans; 57 54 } 58 public long Choose() 59 {60 55 56 public long Choose() { 57 61 58 if (n < k) return 0; 62 59 if (n == k) return 1; … … 64 61 long delta, iMax; 65 62 66 if (k < n-k) // ex: Choose(100,3) 67 { 63 if (k < n-k) { // ex: Choose(100,3) 68 64 delta = n-k; 69 65 iMax = k; 70 } 71 else // ex: Choose(100,97) 72 { 66 } else { // ex: Choose(100,97) 73 67 delta = k; 74 68 iMax = n-k; … … 77 71 long ans = delta + 1; 78 72 79 for (long i = 2; i <= iMax; ++i) 80 { 81 ans = (ans * (delta + i)) / i; 73 for (long i = 2; i <= iMax; ++i) { 74 ans = (ans * (delta + i)) / i; 82 75 } 83 76 … … 85 78 } 86 79 87 88 public Combination Successor() 89 { 80 public Combination Successor() { 90 81 if (this.data.length == 0 || 91 82 this.data[0] == this.n - this.k) … … 95 86 96 87 long i; 97 for (i = 0; i < this.k; ++i) {98 ans.data[(int) i] = this.data[(int)i];88 for (i = 0; i < this.k; ++i) { 89 ans.data[(int) i] = this.data[(int) i]; 99 90 } 100 for (i = this.k - 1; i > 0 && ans.data[(int) i] == this.n - this.k + i; --i) {};101 102 ++ans.data[(int)i];91 for (i = this.k - 1; i > 0 && ans.data[(int) i] == this.n - this.k + i; --i) { 92 // Count 93 } 103 94 104 for (long j = i; j < this.k - 1; ++j){ 105 ans.data[(int)j+1] = ans.data[(int)j] + 1; 106 } 95 ++ans.data[(int) i]; 96 97 for (long j = i; j < this.k - 1; ++j) { 98 ans.data[(int) j+1] = ans.data[(int) j] + 1; 99 } 107 100 return ans; 108 101 } 109 110 public String ToString() 111 { 102 103 public String ToString() { 112 104 StringBuilder sb = new StringBuilder(); 113 105 sb.append("{"); 114 for (long i = 0; i < this.k; ++i) {115 sb.append(this.data[(int) i]);116 if (i <this.k-1) sb.append(", ");106 for (long i = 0; i < this.k; ++i) { 107 sb.append(this.data[(int) i]); 108 if (i < this.k-1) sb.append(", "); 117 109 } 118 110 sb.append("}"); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JCheck.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 3 4 import java.util.ArrayList; 5 4 6 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 5 7 … … 18 20 } 19 21 if (!(entries.size() == exits.size() && exits.size() == n)) { 20 result ="Rule 1 broken: " + entries.size() + " entries but "22 result = "Rule 1 broken: " + entries.size() + " entries but " 21 23 + exits.size() + " exits and n=" + n; 22 24 return false; … … 24 26 for (int i = 0; i < entries.size(); i++) { 25 27 if (!(entries.get(i).getIndegree() + entries.get(i).getOutdegree() >= 2)) { 26 result ="rule 4 broken: indegree from entrynode with ID: "28 result = "rule 4 broken: indegree from entrynode with ID: " 27 29 + entries.get(i).getNewid() + ": " 28 30 + entries.get(i).getIndegree() + " OutDegree: " … … 33 35 for (int j = 0; j < exits.size(); j++) { 34 36 if (!(exits.get(j).getIndegree() + exits.get(j).getOutdegree() >= 2)) { 35 result ="Rule 4 broken, indegree from exitnode with ID: "37 result = "Rule 4 broken, indegree from exitnode with ID: " 36 38 + exits.get(j).getNewid() + ": " 37 39 + exits.get(j).getIndegree() + " and outdegree: " … … 45 47 } 46 48 if (exits.get(j).equals(entries.get(i))) { 47 result ="Rule 2 broken: node with ID: "49 result = "Rule 2 broken: node with ID: " 48 50 + "entries.get(i).getNode().getId()" 49 51 + "is both entry and exit node"; … … 54 56 } 55 57 if (!(exnr >= n - 1)) { 56 result ="Rule 1 broken";58 result = "Rule 1 broken"; 57 59 return false; 58 60 } 59 61 for (int i = 0; i < exits.size(); i++) { 60 62 if (!(exits.get(i).getEnnr() >= (n - 1))) { 61 result ="Rule 1 broken, exit node with ID "63 result = "Rule 1 broken, exit node with ID " 62 64 + exits.get(i).getNewid() + "can only reached from " 63 65 + exits.get(i).getEnnr() + " entries."; … … 68 70 return true; 69 71 } 70 72 71 73 /** 72 74 * gibt das Ergebnis des JChecks in Form als Satz mit Informationen zurück 73 * @return74 75 */ 75 76 public String getResult() { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JMinimality.java
r32423 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 … … 22 23 private boolean CheckMinimal = true; 23 24 private final ArrayList<Channel> E; 24 private final int Grid[][];25 private final int[][] Grid; 25 26 private final ArrayList<Channel> OrEn; 26 27 private final ArrayList<Channel> OrEx; 27 28 private final int n; 28 29 private final List<List<Object>> L = new ArrayList<>(); //The list of columns to be sorted 29 private final HashSet<Channel> subgraph = new HashSet<>(); //The candidate subgraph to be tested30 private final HashSet<Channel> subgraph = new HashSet<>(); //The candidate subgraph to be tested 30 31 private ProgressMonitor pm; 31 32 private final boolean pmenabled; … … 74 75 } 75 76 76 public void GenerateSubcolumns () {/*Generates all combinations of subcolumns in the grid*/77 public void GenerateSubcolumns() { //Generates all combinations of subcolumns in the grid 77 78 if (pmenabled) { 78 pm.setCustomText(tr 79 pm.setCustomText(tr("generate all combinations from entrie/exit candidates")); 79 80 } 80 81 … … 84 85 int[][] v; // this is a column variable containing n y-index entries plus true false values (0/1) 85 86 List<Object> C; //The column is packed together with 2 indices into this variable 86 for (int i = 0; i < Grid.length; i++) {87 for (int i = 0; i < Grid.length; i++) { 87 88 int h = 0; //this is the index denoting the "n out of Grid.length"- combination, indicating a subcolumn of length n 88 89 do { … … 90 91 C = new ArrayList<>(3); 91 92 v = new int[n][2]; 92 C.add(i); //the first position of column variable C is the column index93 C.add(h); //the second is the entry-subset index94 for (int t = 0; t < c.data.length; t++){95 if (Grid[(int) c.data[t]][i] == 0){93 C.add(i); //the first position of column variable C is the column index 94 C.add(h); //the second is the entry-subset index 95 for (int t = 0; t < c.data.length; t++) { 96 if (Grid[(int) c.data[t]][i] == 0) { 96 97 missing++; 97 v[t][1]= 0; //false 98 } 99 else{ 100 v[t][1]= 1; 98 v[t][1] = 0; //false 99 } else { 100 v[t][1] = 1; 101 101 } //true 102 v[t][0] =(int)c.data[t]; //Write a y index of the combination into column103 } 104 if (missing <= 1){//If column has at most one missing entry105 C.add(v); //insert column as the third position of column variable C102 v[t][0] = (int) c.data[t]; //Write a y index of the combination into column 103 } 104 if (missing <= 1) { //If column has at most one missing entry 105 C.add(v); //insert column as the third position of column variable C 106 106 L.add(C); //Insert C in list to be ordered 107 107 } 108 108 h++; //Iterate through all subcolumns 109 if (h < ans){c = c.Successor();}//generate the next combination 110 }while(h < ans); 109 if (h < ans) { 110 c = c.Successor(); //generate the next combination 111 } 112 } while (h < ans); 111 113 c = new Combination(Grid.length, n); //For each original column in the grid, generate new subcolumns 112 114 } 113 115 Collections.sort(L, new Comparator<List<Object>>() { 114 116 @Override 115 116 return (Integer) o1.get(1) - (Integer)o2.get(1); //sort according to h index in each column117 } });118 } 119 120 public boolean IterateThroughKn() { //Iterates through all K_{n-1} subgrids of the Grid and tests them121 if (L.size() ==0) {117 public int compare(List<Object> o1, List<Object> o2) { 118 return (Integer) o1.get(1) - (Integer) o2.get(1); //sort according to h index in each column 119 } }); 120 } 121 122 public boolean IterateThroughKn() { //Iterates through all K_{n-1} subgrids of the Grid and tests them 123 if (L.size() == 0) { 122 124 return true; 123 125 } … … 130 132 List<Object> C; 131 133 ArrayList<int[]> CandidateK = new ArrayList<>(n*n); //saves the candidate K_{n-1} in entry-exit pairs 132 long lindex = 0;134 long lindex = 0; 133 135 int h = 0; 134 136 int m = 0; … … 140 142 boolean hchanged = false; 141 143 C = l.next(); 142 do { //Loop over list of columns L143 if (mchanged) {144 do { //Loop over list of columns L 145 if (mchanged) { 144 146 C = l.next(); //Iterator in L 145 147 lindex++; //Index in L 146 148 if (hchanged) { 147 m =1;149 m = 1; 148 150 hchanged = false; 149 151 } 150 152 } 151 if ((Integer) C.get(1)==h && l.hasNext()){ //m counts the set of columns with index h153 if ((Integer) C.get(1) == h && l.hasNext()) { //m counts the set of columns with index h 152 154 m++; 153 155 mchanged = true; 154 } 155 else{156 if (l.hasNext()==false){157 m++;lindex++;156 } else { 157 if (l.hasNext() == false) { 158 m++; 159 lindex++; 158 160 } //At the end of L, counter are set one up 159 161 c = new Combination(m, n); … … 161 163 int missing = 0; 162 164 boolean smallerjunction = false; 163 for (int k = 0; k<ans;k++){ //Makes sure that subset of m columns contains an n*n subgrid, because ans = m over n would be 0 otherwise164 for (int y = 0; y < n; y++) {//Iterates over all rows of subgrid k165 missing = 0; //test = "";166 for (int x = 0; x < c.data.length;x++) { //Iterates over all columns of subgrid k167 x_i =((Integer)L.get((int)(lindex-m+c.data[x])).get(0));//columnindex in grid168 v =((int[][])(L.get((int)(lindex-m+c.data[x])).get(2))); //subcolumn of grid169 y_j = v[y][0]; //rowindex in grid170 if (v[y][1] ==0){165 for (int k = 0; k < ans; k++) { //Makes sure that subset of m columns contains an n*n subgrid, because ans = m over n would be 0 otherwise 166 for (int y = 0; y < n; y++) { //Iterates over all rows of subgrid k 167 missing = 0; //test = ""; 168 for (int x = 0; x < c.data.length; x++) { //Iterates over all columns of subgrid k 169 x_i = ((Integer) L.get((int) (lindex-m+c.data[x])).get(0)); //columnindex in grid 170 v = ((int[][]) (L.get((int) (lindex-m+c.data[x])).get(2))); //subcolumn of grid 171 y_j = v[y][0]; //rowindex in grid 172 if (v[y][1] == 0) { 171 173 missing++; 172 }else{ 173 CandidateK.add(new int[]{y_j,x_i}); 174 }//save entry/exit tuple 175 if (smallerjunction == false && ((!OrEn.contains(E.get(v[y][0]))) &&(!OrEx.contains(E.get(x_i))))){ // Tests, whether y or x is not an original entry/exit 174 } else { 175 CandidateK.add(new int[]{y_j, x_i}); 176 } //save entry/exit tuple 177 if (!smallerjunction && ((!OrEn.contains(E.get(v[y][0]))) 178 && (!OrEx.contains(E.get(x_i))))) { // Tests, whether y or x is not an original entry/exit 176 179 smallerjunction = true; //Then k identifies a different junction than the original one 177 180 } 178 181 //test = test+" ("+y_j+", "+x_i+", "+v[y][1]+")"; 179 182 } 180 if (missing > 1) {183 if (missing > 1) { 181 184 break; 182 } //If a row has more than one missing value, break185 } //If a row has more than one missing value, break 183 186 } 184 if (missing <= 1 && smallerjunction == true){//The k-subgrid is a different junction candidate satisfying total reachability185 CheckMinimal = CheckSmallJunction(CandidateK)==false;// If the candidate is a smaller junction, then minimality is false187 if (missing <= 1 && smallerjunction) { //The k-subgrid is a different junction candidate satisfying total reachability 188 CheckMinimal = !CheckSmallJunction(CandidateK); // If the candidate is a smaller junction, then minimality is false 186 189 //log.info("durchlauf: " + durchlauf + " Wert von CheckMinimal: " + CheckMinimal); 187 190 if (!CheckMinimal) { … … 190 193 } 191 194 CandidateK.clear(); 192 if (k+1 < ans){c = c.Successor();} //Produces the m over n combinations 193 } 194 m=1; //Sets m to the first column with next index h+1 195 if (k+1 < ans) { 196 c = c.Successor(); 197 } //Produces the m over n combinations 198 } 199 m = 1; //Sets m to the first column with next index h+1 195 200 h++; 196 201 mchanged = false; … … 202 207 } 203 208 } 204 while (l.hasNext() && CheckMinimal);209 while (l.hasNext() && CheckMinimal); 205 210 return CheckMinimal; 206 211 } … … 208 213 /** 209 214 * gibt true zurück, wenn Kandidat eine Kreuzung ist, aber nicht, wenn junctionsearch auf true gesetzt ist 210 * @param CandidateK211 * @return212 215 */ 213 public boolean CheckSmallJunction(ArrayList<int[]> CandidateK) {216 public boolean CheckSmallJunction(ArrayList<int[]> CandidateK) { 214 217 Check = false; 215 subgraph.clear(); //Zu konstruierender Subgraph218 subgraph.clear(); //Zu konstruierender Subgraph 216 219 it = CandidateK.iterator(); 217 220 //Reconstruct small Junction from paths 218 while (it.hasNext()) {221 while (it.hasNext()) { 219 222 int[]point = it.next(); 220 223 for (int j = 0; j < E.get(point[0]).getReachableNodes().size(); j++) { 221 if (E.get(point[0]).getReachableNodeAt(j).equals(E.get(point[1]))){224 if (E.get(point[0]).getReachableNodeAt(j).equals(E.get(point[1]))) { 222 225 subgraph.addAll(E.get(point[0]).getPathsAt(E.get(point[0]).getReachableNodeAt(j))); 223 226 subgraph.add(E.get(point[0])); … … 260 263 /** 261 264 * enthält alle Channels des zuletzt durchlaufenden Kreuzungskandidaten (muß keine gültige Kreuzung sein) 262 * @return263 265 */ 264 public ArrayList<Channel> getSubJunctionCandidate() {266 public ArrayList<Channel> getSubJunctionCandidate() { 265 267 return new ArrayList<>(subgraph); 266 268 } … … 268 270 /** 269 271 * gibt alle gefundenen Kreuzungskandidaten zurück (ist leer, wenn junctionsearch auf true gesetzt wurde) 270 * @return271 272 */ 272 273 public ArrayList<HashSet<Channel>> getJunctionCandidates() { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JPrepare.java
r32423 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 … … 21 22 } 22 23 23 public void jPrepare 24 public void jPrepare(ArrayList<Channel> vertices) { 24 25 this.vertices = vertices; 25 26 entries.clear(); … … 36 37 for (int i = 0; i < vertices.size(); i++) { 37 38 for (int j = 0; j < vertices.get(i).getPredChannels().size(); j++) { 38 if (vertices.get(i).getPredChannels().get(j).isSubgraph() == false 39 if (vertices.get(i).getPredChannels().get(j).isSubgraph() == false) { 39 40 if (!entries.contains(vertices.get(i))) { 40 41 entries.add(vertices.get(i)); 41 42 } 42 } 43 else { 43 } else { 44 44 vertices.get(i).countupIndegree(); 45 45 //log.trace(vertices.get(i).toString()); … … 51 51 exits.add(vertices.get(i)); 52 52 } 53 } 54 else { 53 } else { 55 54 vertices.get(i).countupOutdegree(); 56 55 } … … 59 58 } 60 59 61 public void resetSubgraph() {60 public void resetSubgraph() { 62 61 for (int i = 0; i < vertices.size(); i++) { 63 62 vertices.get(i).setSubgraph(false); … … 69 68 /** 70 69 * gibt die Anzahl der gefundenen Eingänge zurück 71 * @return72 70 */ 73 71 public ArrayList<Channel> getEntries() { … … 77 75 /** 78 76 * gibt die Anzahl der gefundenen Ausgänge zurück 79 * @return80 77 */ 81 78 public ArrayList<Channel> getExits() { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JProcess.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 3 4 import java.util.ArrayList; 5 4 6 import org.openstreetmap.josm.plugins.JunctionChecker.connectedness.BacktrackingColors; 5 7 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 6 8 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; 7 9 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.LeadsTo; 8 9 10 10 11 /** … … 30 31 * ruft den TR-DFS und danach den Backpropagation-Algorithmus auf jPrepare 31 32 * muß vorher durchgelaufen sein (die Eingänge müssen bekannt sein) 32 *33 * @param entries34 33 */ 35 34 public void jProcess(ArrayList<Channel> entries) { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JunctionChecker.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 … … 28 29 private final JCheck jCheck; 29 30 private ArrayList<Channel> E; 30 private int Grid[][];31 private int[][] Grid; 31 32 private boolean Check; 32 33 private boolean smallerJunction; … … 50 51 /** 51 52 * startet das Überprüfen einer Teilmenge auf die Kreuzungskriterien 52 * @param subgraph53 * @param pm54 53 */ 55 54 public void checkjunctions(ArrayList<Channel> subgraph, ProgressMonitor pm) { … … 81 80 * gesucht werden soll 82 81 * 83 * @param subgraph84 82 * @param firstjunction soll nur die erste mögliche Kreuzung ausgegeben werden oder alle 85 83 */ … … 121 119 * darf keine weiteren Kreuzungen enthalten) 122 120 */ 123 private ArrayList<HashSet<Channel>> checkJunctionCandidates(ArrayList<HashSet<Channel>> junctioncandidates) {121 private ArrayList<HashSet<Channel>> checkJunctionCandidates(ArrayList<HashSet<Channel>> junctioncandidates) { 124 122 @SuppressWarnings("unchecked") 125 123 ArrayList<HashSet<Channel>> junctions = (ArrayList<HashSet<Channel>>) junctioncandidates.clone(); … … 129 127 junctions.removeAll(junctioncandidates.get(i)); 130 128 } 131 else {132 }133 129 } 134 130 } 135 131 return junctions; 136 132 } 137 138 133 139 134 private void collectECandidates(ArrayList<Channel> subgraph) { … … 216 211 /** 217 212 * gibt die kleinere, gefundene Kreuzung zurück (wenn es sie gibt) 218 *219 * @return220 213 */ 221 214 public ArrayList<Channel> getSubJunction() { … … 247 240 /** 248 241 * das Ergebnis des JCheck als String 249 *250 * @return251 242 */ 252 243 public String getJCheckResult() { … … 257 248 * gitb die bei der Kruezungssuche gefundenen Kreuzungen zurück, sonst 258 249 * nichts 259 *260 * @return261 250 */ 262 251 public ArrayList<HashSet<Channel>> getJunctions() { -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/TRDFS.java
r32423 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.junctionchecking; 2 3 … … 16 17 private final ChannelDiGraph digraph; 17 18 18 /**19 *20 *21 * @param adnodes22 */23 19 public TRDFS(ArrayList<Channel> adnodes, ChannelDiGraph digraph) { 24 20 this.digraph = digraph; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/ColorSchemeXMLReader.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.reader; 2 3 3 4 import java.awt.Color; 4 5 import java.util.HashMap; 6 5 7 import javax.xml.stream.XMLStreamConstants; 6 8 import javax.xml.stream.XMLStreamException; 7 9 8 public class ColorSchemeXMLReader extends XMLReader {10 public class ColorSchemeXMLReader extends XMLReader { 9 11 10 12 private HashMap<String, Color> colorScheme; … … 23 25 if (colorScheme.containsKey(s)) { 24 26 return colorScheme.get(s); 25 } 26 else { 27 } else { 27 28 return Color.GRAY; 28 29 } … … 43 44 String[] erg = tempValue.split(","); 44 45 Color c = new Color(Integer.parseInt(erg[0]), Integer.parseInt(erg[1]), Integer.parseInt(erg[2])); 45 colorScheme.put(parser.getLocalName(), c);46 colorScheme.put(parser.getLocalName(), c); 46 47 } 47 48 break; -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/OSMXMLReader.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.reader; 2 3 3 4 import java.io.File; 4 5 import java.util.HashMap; 6 5 7 import javax.xml.stream.XMLStreamConstants; 6 8 import javax.xml.stream.XMLStreamException; 9 7 10 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMEntity; 8 11 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.OSMGraph; … … 63 66 .getAttributeValue(null, "ref"))), parser 64 67 .getAttributeValue(null, "role")); 65 } 66 else if (parser.getAttributeValue(null, "type").equals("way")) { 68 } else if (parser.getAttributeValue(null, "type").equals("way")) { 67 69 relation.addMember(osmgraph.getWay(Long.parseLong(parser 68 70 .getAttributeValue(null, "ref"))), parser 69 71 .getAttributeValue(null, "role")); 70 } 71 else if (parser.getAttributeValue(null, "type").equals("relation")) { 72 } else if (parser.getAttributeValue(null, "type").equals("relation")) { 72 73 relation.addMember(osmgraph.getRelation(Integer.parseInt(parser 73 74 .getAttributeValue(null, "ref"))), parser -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLFilterReader.java
r30737 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.reader; 2 3 3 4 import java.util.Vector; 5 4 6 import javax.xml.stream.XMLStreamConstants; 5 7 import javax.xml.stream.XMLStreamException; 8 6 9 import org.openstreetmap.josm.plugins.JunctionChecker.filter.Filter; 7 10 … … 9 12 * @author joerg 10 13 */ 11 public class XMLFilterReader extends XMLReader {14 public class XMLFilterReader extends XMLReader { 12 15 13 16 Vector<Filter> filters; … … 21 24 @Override 22 25 public void parseXML() { 23 String tempValue = "";24 String tempKeyValue = "";26 String tempValue = ""; 27 String tempKeyValue = ""; 25 28 try { 26 29 while (parser.hasNext()) { … … 54 57 55 58 public Filter[] getFilters() { 56 Filter[] filterarray = new Filter[filters.size()];59 Filter[] filterarray = new Filter[filters.size()]; 57 60 return filters.toArray(filterarray); 58 61 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/reader/XMLReader.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.reader; 2 3 … … 4 5 import java.io.FileInputStream; 5 6 import java.io.FileNotFoundException; 7 6 8 import javax.xml.stream.XMLInputFactory; 7 9 import javax.xml.stream.XMLStreamException; 8 10 import javax.xml.stream.XMLStreamReader; 9 11 10 public 11 12 public abstract class XMLReader { 13 12 14 protected String filename; 13 15 protected XMLInputFactory factory = XMLInputFactory.newInstance(); 14 16 protected XMLStreamReader parser; 15 17 16 18 public XMLReader(String filename) { 17 19 try { … … 22 24 } 23 25 } 24 26 25 27 public XMLReader(File file) { 26 28 try { … … 33 35 } 34 36 } 35 37 36 38 public abstract void parseXML(); 37 39 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/util/RelationProducer.java
r32329 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.util; 2 3 -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/writing/OSMXMLWriter.java
r30725 r32596 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.JunctionChecker.writing; 2 3 … … 34 35 XMLOutputFactory factory = XMLOutputFactory.newInstance(); 35 36 writer = factory.createXMLStreamWriter( 36 new FileOutputStream( filename ));37 new FileOutputStream(filename)); 37 38 // Der XML-Header wird erzeugt 38 39 writer.writeStartDocument("utf-8", "1.0"); 39 40 // Zuerst wird das Wurzelelement mit Attribut geschrieben 40 writer.writeStartElement( "osm");41 writer.writeAttribute( "version", "0.6");41 writer.writeStartElement("osm"); 42 writer.writeAttribute("version", "0.6"); 42 43 writer.writeAttribute("generator", "channelGenerator"); 43 44 … … 85 86 if (ways.get(i).isStrongConnected()) { 86 87 writer.writeAttribute("v", "true"); 87 } 88 else { 88 } else { 89 89 writer.writeAttribute("v", "false"); 90 90 } … … 97 97 } 98 98 99 private void writeAttributes(OSMEntity ent) throws FileNotFoundException, XMLStreamException {99 private void writeAttributes(OSMEntity ent) throws FileNotFoundException, XMLStreamException { 100 100 if (ent instanceof OSMNode) { 101 writer.writeAttribute("id", Long.toString(ent.getId()) 101 writer.writeAttribute("id", Long.toString(ent.getId())); 102 102 writer.writeAttribute("lat", Double.toString(((OSMNode) ent).getLatitude())); 103 103 writer.writeAttribute("lon", Double.toString(((OSMNode) ent).getLongitude())); 104 104 } 105 105 106 if (ent.getTimestamp() !=null) {106 if (ent.getTimestamp() != null) { 107 107 writer.writeAttribute("timestamp", ent.getTimestamp()); 108 108 }
Note:
See TracChangeset
for help on using the changeset viewer.