Changeset 33778 in osm for applications
- Timestamp:
- 2017-11-05T19:24:23+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/junctionchecking
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/junctionchecking/build.xml
r33249 r33778 3 3 <property name="commit.message" value="Changed the constructor signature of the plugin main class"/> 4 4 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 5 <property name="plugin.main.version" value="1 1713"/>5 <property name="plugin.main.version" value="12636"/> 6 6 7 7 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java
r33248 r33778 12 12 import org.openstreetmap.josm.data.Bounds; 13 13 import org.openstreetmap.josm.data.DataSource; 14 import org.openstreetmap.josm.data.osm.DataSet; 14 15 import org.openstreetmap.josm.data.osm.Node; 15 16 import org.openstreetmap.josm.data.osm.Relation; 16 17 import org.openstreetmap.josm.data.osm.Way; 18 import org.openstreetmap.josm.gui.MainApplication; 17 19 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 18 20 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 62 64 private void removeDigraphLayer() { 63 65 ChannelDiGraphLayer layer = plugin.getChannelDigraphLayer(); 64 if (Main .getLayerManager().containsLayer(layer)) {65 Main .getLayerManager().removeLayer(layer);66 if (MainApplication.getLayerManager().containsLayer(layer)) { 67 MainApplication.getLayerManager().removeLayer(layer); 66 68 } 67 69 } … … 71 73 OsmTransferException { 72 74 //Prüfen, ob der ausgewählte Layer ein OSMDataLayer ist 73 if (Main .map== null74 || !Main .map.isVisible() || !(Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) {75 if (MainApplication.getMap() == null 76 || !MainApplication.getMap().isVisible() || !(MainApplication.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) { 75 77 JOptionPane.showMessageDialog(Main.parent, tr("this layer is no osm data layer")); 76 78 return; … … 91 93 OSMGraph graph = new OSMGraph(); 92 94 //Der vom Benutzer in JOSM ausgewählte, zur Zeit aktive Layer wird der PLugin-OSM-Layer 93 plugin.setOsmlayer((OsmDataLayer) Main.getLayerManager().getActiveLayer()); 94 Iterator<Node> it = Main.getLayerManager().getEditDataSet().getNodes().iterator(); 95 plugin.setOsmlayer((OsmDataLayer) MainApplication.getLayerManager().getActiveLayer()); 96 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 97 Iterator<Node> it = ds.getNodes().iterator(); 95 98 while (it.hasNext()) { 96 99 graph.addNode(it.next()); 97 100 } 98 99 Iterator<Way> itway = Main.getLayerManager().getEditDataSet().getWays() 100 .iterator(); 101 Iterator<Way> itway = ds.getWays().iterator(); 101 102 while (itway.hasNext()) { 102 103 graph.addWay(itway.next()); 103 104 } 104 Iterator<Relation> itrel = Main.getLayerManager().getEditDataSet().getRelations() 105 .iterator(); 105 Iterator<Relation> itrel = ds.getRelations().iterator(); 106 106 while (itrel.hasNext()) { 107 107 graph.addRelation(itrel.next()); 108 108 } 109 Iterator<DataSource> itdata = Main.getLayerManager().getEditDataSet().getDataSources().iterator();109 Iterator<DataSource> itdata = ds.getDataSources().iterator(); 110 110 while (itdata.hasNext()) { 111 111 Bounds b = itdata.next().bounds; … … 151 151 plugin.setChannelDigraph(cdgb.getDigraph()); 152 152 plugin.getJcMapMode().setDigraph(cdgb.getDigraph()); 153 plugin.setNormalMapMode(Main .map.mapMode);154 Main .map.selectMapMode(plugin.getJcMapMode());155 Main .getLayerManager().addLayer(plugin.getChannelDigraphLayer());156 Main .getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer());153 plugin.setNormalMapMode(MainApplication.getMap().mapMode); 154 MainApplication.getMap().selectMapMode(plugin.getJcMapMode()); 155 MainApplication.getLayerManager().addLayer(plugin.getChannelDigraphLayer()); 156 MainApplication.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer()); 157 157 } 158 158 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckDialog.java
r33397 r33778 19 19 import javax.swing.border.TitledBorder; 20 20 21 import org.openstreetmap.josm. Main;21 import org.openstreetmap.josm.gui.MainApplication; 22 22 import org.openstreetmap.josm.gui.SideButton; 23 23 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; … … 95 95 @Override 96 96 public void actionPerformed(ActionEvent e) { 97 DigraphCreationTask dct = new DigraphCreationTask(plugin, digraphsealcb.isSelected(), sccCB.isSelected()); 98 Main.worker.submit(dct); 99 setActivateJunctionCheckOrSearch(true); 97 MainApplication.worker.submit(new DigraphCreationTask(plugin, digraphsealcb.isSelected(), sccCB.isSelected())); 98 setActivateJunctionCheckOrSearch(true); 100 99 } 101 100 }); … … 108 107 @Override 109 108 public void actionPerformed(ActionEvent e) { 110 PrepareJunctionCheckorSearch pjc = new PrepareJunctionCheckorSearch(plugin, smodel.getNumber().intValue(), produceRelation.isSelected()); 111 pjc.prepareJunctionCheck(); 109 new PrepareJunctionCheckorSearch(plugin, smodel.getNumber().intValue(), produceRelation.isSelected()).prepareJunctionCheck(); 112 110 } 113 111 }); … … 121 119 @Override 122 120 public void actionPerformed(ActionEvent e) { 123 PrepareJunctionCheckorSearch pjc = new PrepareJunctionCheckorSearch(plugin, smodel.getNumber().intValue(), produceRelation.isSelected()); 124 pjc.prepareJunctionSearch(); 121 new PrepareJunctionCheckorSearch(plugin, smodel.getNumber().intValue(), produceRelation.isSelected()).prepareJunctionSearch(); 125 122 } 126 123 }); … … 131 128 })); 132 129 } 133 134 130 135 131 /** -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java
r33248 r33778 11 11 12 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.gui.MainApplication; 13 14 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 14 15 import org.openstreetmap.josm.io.OsmTransferException; … … 89 90 plugin.getChannelDigraph().addJunctioncandidateChannel(jc.getSubJunction().get(i)); 90 91 } 91 Main .getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer());92 MainApplication.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer()); 92 93 } 93 94 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java
r33249 r33778 14 14 import org.openstreetmap.josm.actions.mapmode.MapMode; 15 15 import org.openstreetmap.josm.data.coor.LatLon; 16 import org.openstreetmap.josm.gui.MainApplication; 16 17 import org.openstreetmap.josm.gui.MapFrame; 17 18 import org.openstreetmap.josm.gui.layer.Layer; … … 40 41 @Override public void enterMode() { 41 42 super.enterMode(); 42 Main .map.mapView.addMouseListener(this);43 Main .map.mapView.addMouseMotionListener(this);44 Main .getLayerManager().addActiveLayerChangeListener(this);43 MainApplication.getMap().mapView.addMouseListener(this); 44 MainApplication.getMap().mapView.addMouseMotionListener(this); 45 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 45 46 } 46 47 47 48 @Override public void exitMode() { 48 49 super.exitMode(); 49 Main .map.mapView.removeMouseListener(this);50 Main .map.mapView.removeMouseMotionListener(this);50 MainApplication.getMap().mapView.removeMouseListener(this); 51 MainApplication.getMap().mapView.removeMouseMotionListener(this); 51 52 } 52 53 53 54 @Override 54 55 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 55 Layer newLayer = Main .getLayerManager().getActiveLayer();56 Layer newLayer = MainApplication.getLayerManager().getActiveLayer(); 56 57 if (newLayer instanceof ChannelDiGraphLayer) { 57 58 layer = (ChannelDiGraphLayer) newLayer; … … 91 92 //go through nodes and mark the ones in the selection rect as deleted 92 93 if (layer != null && digraph != null) { 93 LatLon lefttop = Main .map.mapView.getLatLon(r.x + r.width, r.y + r.height);94 LatLon rightbottom = Main .map.mapView.getLatLon(r.x, r.y);94 LatLon lefttop = MainApplication.getMap().mapView.getLatLon(r.x + r.width, r.y + r.height); 95 LatLon rightbottom = MainApplication.getMap().mapView.getLatLon(r.x, r.y); 95 96 digraph.detectSelectedChannels(rightbottom.lon(), rightbottom.lat(), lefttop.lon(), lefttop.lat()); 96 97 } 97 98 oldRect = null; 98 Main .map.mapView.repaint();99 MainApplication.getMap().mapView.repaint(); 99 100 100 101 } … … 164 165 public void destroy() { 165 166 super.destroy(); 166 Main .getLayerManager().removeActiveLayerChangeListener(this);167 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 167 168 } 168 169 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java
r33249 r33778 8 8 import org.openstreetmap.josm.Main; 9 9 import org.openstreetmap.josm.actions.mapmode.MapMode; 10 import org.openstreetmap.josm.gui.MainApplication; 10 11 import org.openstreetmap.josm.gui.MapFrame; 11 12 import org.openstreetmap.josm.gui.layer.Layer; … … 54 55 junctionCheckDialog = new JunctionCheckDialog(this); 55 56 newFrame.addToggleDialog(junctionCheckDialog); 56 Main .getLayerManager().addLayerChangeListener(this);57 MainApplication.getLayerManager().addLayerChangeListener(this); 57 58 } else 58 Main .getLayerManager().removeLayerChangeListener(this);59 MainApplication.getLayerManager().removeLayerChangeListener(this); 59 60 } 60 61 … … 64 65 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false); 65 66 if (normalMapMode != null) { 66 Main .map.selectMapMode(normalMapMode);67 MainApplication.getMap().selectMapMode(normalMapMode); 67 68 } 68 69 } else if (newLayer instanceof ChannelDiGraphLayer) { 69 70 this.getJunctionCheckDialog().setActivateCreateDigraph(false); 70 71 this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(true); 71 Main .map.selectMapMode(jcMapMode);72 MainApplication.getMap().selectMapMode(jcMapMode); 72 73 } 73 74 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/PrepareJunctionCheckorSearch.java
r32596 r33778 7 7 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.gui.MainApplication; 9 10 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; 10 11 … … 31 32 if (prepareSubset()) { 32 33 jct = new JunctionCheckTask(plugin, n, subset, produceRelation); 33 Main .worker.submit(jct);34 MainApplication.worker.submit(jct); 34 35 } 35 36 } … … 37 38 protected void prepareJunctionSearch() { 38 39 if (prepareSubset()) { 39 JunctionSearchTask jst = new JunctionSearchTask(plugin, n, subset, produceRelation); 40 Main.worker.submit(jst); 40 MainApplication.worker.submit(new JunctionSearchTask(plugin, n, subset, produceRelation)); 41 41 } 42 42 } -
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/util/RelationProducer.java
r32596 r33778 6 6 import java.util.LinkedList; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.osm.OsmPrimitive; 10 9 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 11 10 import org.openstreetmap.josm.data.osm.Relation; 12 11 import org.openstreetmap.josm.data.osm.RelationMember; 12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.plugins.JunctionChecker.JunctionCheckerPlugin; 14 14 import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel; … … 43 43 } 44 44 } 45 Main .getLayerManager().setActiveLayer(plugin.getOsmlayer());45 MainApplication.getLayerManager().setActiveLayer(plugin.getOsmlayer()); 46 46 plugin.getOsmlayer().data.setSelected(ways); 47 47
Note:
See TracChangeset
for help on using the changeset viewer.