Changeset 32423 in osm for applications/editors/josm/plugins/junctionchecking/src
- Timestamp:
- 2016-06-28T23:08:27+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/ChannelDiGraphLayer.java
r30725 r32423 22 22 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 23 23 import org.openstreetmap.josm.gui.MapView; 24 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;25 24 import org.openstreetmap.josm.gui.layer.Layer; 25 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 26 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; 27 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 28 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 26 29 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 27 30 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; … … 34 37 * 35 38 */ 36 public class ChannelDiGraphLayer extends Layer implements LayerChangeListener, PropertyChangeListener {39 public class ChannelDiGraphLayer extends Layer implements LayerChangeListener, PropertyChangeListener { 37 40 38 41 private ChannelDiGraph digraph; … … 61 64 public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader){ 62 65 super("ChannelDiGraphLayer"); 63 Ma pView.addLayerChangeListener(this);66 Main.getLayerManager().addLayerChangeListener(this); 64 67 this.cXMLReader = cXMLReader; 65 68 initColors(); … … 180 183 } 181 184 182 183 185 @Override 184 186 public void visitBoundingBox(BoundingXYVisitor v) { … … 189 191 } 190 192 191 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 192 193 } 194 195 public void layerAdded(Layer newLayer) { 196 } 197 198 public void layerRemoved(Layer oldLayer) { 199 if (oldLayer == this) { 200 MapView.removeLayerChangeListener(this); 193 @Override 194 public void layerOrderChanged(LayerOrderChangeEvent e) { 195 } 196 197 @Override 198 public void layerAdded(LayerAddEvent e) { 199 } 200 201 @Override 202 public void layerRemoving(LayerRemoveEvent e) { 203 if (e.getRemovedLayer() == this) { 204 Main.getLayerManager().removeLayerChangeListener(this); 201 205 } 202 206 } … … 210 214 } 211 215 216 @Override 212 217 public void propertyChange(PropertyChangeEvent evt) { 213 218 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java
r32329 r32423 55 55 protected void finish() { 56 56 if (canceled) { 57 Main. main.removeLayer(plugin.getChannelDigraphLayer());57 Main.getLayerManager().removeLayer(plugin.getChannelDigraphLayer()); 58 58 return; 59 59 } … … 69 69 return; 70 70 } 71 Main. main.removeLayer(plugin.getChannelDigraphLayer());71 Main.getLayerManager().removeLayer(plugin.getChannelDigraphLayer()); 72 72 int tickscounter = 4; 73 73 if (sealGraph) { … … 85 85 //Der vom Benutzer in JOSM ausgewählte, zur Zeit aktive Layer wird der PLugin-OSM-Layer 86 86 plugin.setOsmlayer((OsmDataLayer)Main.getLayerManager().getActiveLayer()); 87 Iterator<Node> it = Main. main.getCurrentDataSet().getNodes().iterator();87 Iterator<Node> it = Main.getLayerManager().getEditDataSet().getNodes().iterator(); 88 88 while (it.hasNext()) { 89 89 graph.addNode(it.next()); 90 90 } 91 91 92 Iterator<Way> itway = Main. main.getCurrentDataSet().getWays()92 Iterator<Way> itway = Main.getLayerManager().getEditDataSet().getWays() 93 93 .iterator(); 94 94 while (itway.hasNext()) { 95 95 graph.addWay(itway.next()); 96 96 } 97 Iterator<Relation> itrel = Main. main.getCurrentDataSet().getRelations()97 Iterator<Relation> itrel = Main.getLayerManager().getEditDataSet().getRelations() 98 98 .iterator(); 99 99 while (itrel.hasNext()) { 100 100 graph.addRelation(itrel.next()); 101 101 } 102 Iterator<DataSource> itdata = Main. main.getCurrentDataSet().dataSources.iterator();102 Iterator<DataSource> itdata = Main.getLayerManager().getEditDataSet().dataSources.iterator(); 103 103 while (itdata.hasNext()) { 104 104 Bounds b = itdata.next().bounds; … … 146 146 plugin.setNormalMapMode(Main.map.mapMode); 147 147 Main.map.selectMapMode(plugin.getJcMapMode()); 148 Main. main.addLayer(plugin.getChannelDigraphLayer());148 Main.getLayerManager().addLayer(plugin.getChannelDigraphLayer()); 149 149 Main.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer()); 150 150 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java
r30725 r32423 9 9 import java.awt.event.InputEvent; 10 10 import java.awt.event.MouseEvent; 11 11 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.actions.mapmode.MapMode; 13 14 import org.openstreetmap.josm.data.coor.LatLon; 14 15 import org.openstreetmap.josm.gui.MapFrame; 15 import org.openstreetmap.josm.gui.MapView;16 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;17 16 import org.openstreetmap.josm.gui.layer.Layer; 17 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; 18 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 18 19 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; 19 20 … … 22 23 * die eigenen Bedürfnisse angepaßt 23 24 */ 24 public class JunctionCheckerMapMode extends MapMode implements LayerChangeListener{25 public class JunctionCheckerMapMode extends MapMode implements ActiveLayerChangeListener { 25 26 26 27 MapFrame frame; … … 40 41 Main.map.mapView.addMouseListener(this); 41 42 Main.map.mapView.addMouseMotionListener(this); 42 Ma pView.addLayerChangeListener(this);43 Main.getLayerManager().addActiveLayerChangeListener(this); 43 44 } 44 45 … … 49 50 } 50 51 51 52 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 52 @Override 53 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 54 Layer newLayer = Main.getLayerManager().getActiveLayer(); 53 55 if (newLayer instanceof ChannelDiGraphLayer) { 54 56 layer = (ChannelDiGraphLayer) newLayer; 55 57 } 56 58 } 57 58 public void layerAdded(Layer newLayer) {59 }60 61 public void layerRemoved(Layer oldLayer) {62 }63 64 59 65 60 public void setFrame(MapFrame newFrame) { … … 169 164 public void destroy() { 170 165 super.destroy(); 171 Ma pView.removeLayerChangeListener(this);166 Main.getLayerManager().removeActiveLayerChangeListener(this); 172 167 } 173 168 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java
r28626 r32423 7 7 8 8 import java.io.File; 9 9 10 import org.openstreetmap.josm.Main; 10 11 import org.openstreetmap.josm.actions.mapmode.MapMode; 11 12 import org.openstreetmap.josm.gui.MapFrame; 12 import org.openstreetmap.josm.gui.MapView;13 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;14 13 import org.openstreetmap.josm.gui.layer.Layer; 14 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 15 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; 16 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 17 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 15 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 19 import org.openstreetmap.josm.plugins.Plugin; … … 26 29 * 27 30 */ 28 public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener {31 public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener { 29 32 30 33 private static final String COLORSCHEMEFILTERFILE = "/resources/xml/colorscheme.xml"; … … 53 56 junctionCheckDialog = new JunctionCheckDialog(this); 54 57 newFrame.addToggleDialog(junctionCheckDialog); 55 Ma pView.addLayerChangeListener(this);58 Main.getLayerManager().addLayerChangeListener(this); 56 59 } else 57 Ma pView.removeLayerChangeListener(this);60 Main.getLayerManager().removeLayerChangeListener(this); 58 61 } 59 62 … … 72 75 } 73 76 74 public void layerAdded(Layer newLayer) { 77 @Override 78 public void layerOrderChanged(LayerOrderChangeEvent e) { 75 79 } 76 80 77 public void layerRemoved(Layer oldLayer) { 78 if (oldLayer == channelDigraphLayer) { 81 @Override 82 public void layerAdded(LayerAddEvent e) { 83 } 84 85 @Override 86 public void layerRemoving(LayerRemoveEvent e) { 87 if (e.getRemovedLayer() == channelDigraphLayer) { 79 88 channelDigraphLayer = null; 80 89 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false); -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JMinimality.java
r30737 r32423 13 13 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 14 14 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; 15 16 17 15 18 16 /** … … 29 27 private final int n; 30 28 private final List<List<Object>> L = new ArrayList<>(); //The list of columns to be sorted 31 private long EEovern = 0;32 29 private final HashSet<Channel> subgraph = new HashSet<>();//The candidate subgraph to be tested 33 30 private ProgressMonitor pm; … … 39 36 private boolean Check = false; 40 37 private Iterator<int[]> it; 41 42 38 43 39 public JMinimality(int[][] Grid, int n, … … 84 80 85 81 Combination c = new Combination(Grid.length, n); 86 EEovern = (int) Combination.Choose(Grid.length*Grid.length, n*n);82 //EEovern = (int) Combination.Choose(Grid.length*Grid.length, n*n); 87 83 long ans = c.Choose(); //This is the number of subcolumns to be generated 88 84 int[][] v; // this is a column variable containing n y-index entries plus true false values (0/1) -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JPrepare.java
r30737 r32423 2 2 3 3 import java.util.ArrayList; 4 4 5 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 5 6 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph; … … 14 15 private final ArrayList<Channel> exits; 15 16 private ArrayList<Channel> vertices; 16 private final ChannelDiGraph digraph;17 17 18 18 public JPrepare(ChannelDiGraph digraph) { 19 19 entries = new ArrayList<>(); 20 20 exits = new ArrayList<>(); 21 this.digraph = digraph;22 21 } 23 22 -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/TRDFS.java
r30737 r32423 2 2 3 3 import java.util.ArrayList; 4 4 5 import org.openstreetmap.josm.plugins.JunctionChecker.connectedness.BacktrackingColors; 5 6 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 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 /** … … 13 13 public class TRDFS { 14 14 15 private final ArrayList<Channel> vertices;16 private Channel startNode;17 15 private final ArrayList<LeadsTo> cycleEdges; 18 16 private final ChannelDiGraph digraph; … … 24 22 */ 25 23 public TRDFS(ArrayList<Channel> adnodes, ChannelDiGraph digraph) { 26 this.vertices = adnodes;27 24 this.digraph = digraph; 28 25 this.cycleEdges = new ArrayList<>(); 29 26 } 30 31 27 32 28 public void trdfs(Channel startNode) {
Note:
See TracChangeset
for help on using the changeset viewer.