Ignore:
Timestamp:
2017-11-05T19:24:23+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12636

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/DigraphCreationTask.java

    r33248 r33778  
    1212import org.openstreetmap.josm.data.Bounds;
    1313import org.openstreetmap.josm.data.DataSource;
     14import org.openstreetmap.josm.data.osm.DataSet;
    1415import org.openstreetmap.josm.data.osm.Node;
    1516import org.openstreetmap.josm.data.osm.Relation;
    1617import org.openstreetmap.josm.data.osm.Way;
     18import org.openstreetmap.josm.gui.MainApplication;
    1719import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    1820import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    6264    private void removeDigraphLayer() {
    6365        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);
    6668        }
    6769    }
     
    7173    OsmTransferException {
    7274        //Prüfen, ob der ausgewählte Layer ein OSMDataLayer ist
    73         if (Main.map == null
    74                 || !Main.map.isVisible() || !(Main.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) {
     75        if (MainApplication.getMap() == null
     76                || !MainApplication.getMap().isVisible() || !(MainApplication.getLayerManager().getActiveLayer() instanceof OsmDataLayer)) {
    7577            JOptionPane.showMessageDialog(Main.parent, tr("this layer is no osm data layer"));
    7678            return;
     
    9193        OSMGraph graph = new OSMGraph();
    9294        //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();
    9598        while (it.hasNext()) {
    9699            graph.addNode(it.next());
    97100        }
    98 
    99         Iterator<Way> itway = Main.getLayerManager().getEditDataSet().getWays()
    100         .iterator();
     101        Iterator<Way> itway = ds.getWays().iterator();
    101102        while (itway.hasNext()) {
    102103            graph.addWay(itway.next());
    103104        }
    104         Iterator<Relation> itrel = Main.getLayerManager().getEditDataSet().getRelations()
    105         .iterator();
     105        Iterator<Relation> itrel = ds.getRelations().iterator();
    106106        while (itrel.hasNext()) {
    107107            graph.addRelation(itrel.next());
    108108        }
    109         Iterator<DataSource> itdata = Main.getLayerManager().getEditDataSet().getDataSources().iterator();
     109        Iterator<DataSource> itdata = ds.getDataSources().iterator();
    110110        while (itdata.hasNext()) {
    111111            Bounds b = itdata.next().bounds;
     
    151151        plugin.setChannelDigraph(cdgb.getDigraph());
    152152        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());
    157157    }
    158158}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckDialog.java

    r33397 r33778  
    1919import javax.swing.border.TitledBorder;
    2020
    21 import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.gui.MainApplication;
    2222import org.openstreetmap.josm.gui.SideButton;
    2323import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     
    9595            @Override
    9696            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);
    10099            }
    101100        });
     
    108107            @Override
    109108            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();
    112110            }
    113111        });
     
    121119            @Override
    122120            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();
    125122            }
    126123        });
     
    131128        }));
    132129    }
    133 
    134130
    135131    /**
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckTask.java

    r33248 r33778  
    1111
    1212import org.openstreetmap.josm.Main;
     13import org.openstreetmap.josm.gui.MainApplication;
    1314import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    1415import org.openstreetmap.josm.io.OsmTransferException;
     
    8990            plugin.getChannelDigraph().addJunctioncandidateChannel(jc.getSubJunction().get(i));
    9091        }
    91         Main.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer());
     92        MainApplication.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer());
    9293    }
    9394}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java

    r33249 r33778  
    1414import org.openstreetmap.josm.actions.mapmode.MapMode;
    1515import org.openstreetmap.josm.data.coor.LatLon;
     16import org.openstreetmap.josm.gui.MainApplication;
    1617import org.openstreetmap.josm.gui.MapFrame;
    1718import org.openstreetmap.josm.gui.layer.Layer;
     
    4041    @Override public void enterMode() {
    4142        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);
    4546    }
    4647
    4748    @Override public void exitMode() {
    4849        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);
    5152    }
    5253
    5354    @Override
    5455    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
    55         Layer newLayer = Main.getLayerManager().getActiveLayer();
     56        Layer newLayer = MainApplication.getLayerManager().getActiveLayer();
    5657        if (newLayer instanceof ChannelDiGraphLayer) {
    5758            layer = (ChannelDiGraphLayer) newLayer;
     
    9192        //go through nodes and mark the ones in the selection rect as deleted
    9293        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);
    9596            digraph.detectSelectedChannels(rightbottom.lon(), rightbottom.lat(), lefttop.lon(), lefttop.lat());
    9697        }
    9798        oldRect = null;
    98         Main.map.mapView.repaint();
     99        MainApplication.getMap().mapView.repaint();
    99100
    100101    }
     
    164165    public void destroy() {
    165166        super.destroy();
    166         Main.getLayerManager().removeActiveLayerChangeListener(this);
     167        MainApplication.getLayerManager().removeActiveLayerChangeListener(this);
    167168    }
    168169}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java

    r33249 r33778  
    88import org.openstreetmap.josm.Main;
    99import org.openstreetmap.josm.actions.mapmode.MapMode;
     10import org.openstreetmap.josm.gui.MainApplication;
    1011import org.openstreetmap.josm.gui.MapFrame;
    1112import org.openstreetmap.josm.gui.layer.Layer;
     
    5455            junctionCheckDialog = new JunctionCheckDialog(this);
    5556            newFrame.addToggleDialog(junctionCheckDialog);
    56             Main.getLayerManager().addLayerChangeListener(this);
     57            MainApplication.getLayerManager().addLayerChangeListener(this);
    5758        } else
    58             Main.getLayerManager().removeLayerChangeListener(this);
     59            MainApplication.getLayerManager().removeLayerChangeListener(this);
    5960    }
    6061
     
    6465            this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false);
    6566            if (normalMapMode != null) {
    66                 Main.map.selectMapMode(normalMapMode);
     67                MainApplication.getMap().selectMapMode(normalMapMode);
    6768            }
    6869        } else if (newLayer instanceof ChannelDiGraphLayer) {
    6970            this.getJunctionCheckDialog().setActivateCreateDigraph(false);
    7071            this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(true);
    71             Main.map.selectMapMode(jcMapMode);
     72            MainApplication.getMap().selectMapMode(jcMapMode);
    7273        }
    7374    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/PrepareJunctionCheckorSearch.java

    r32596 r33778  
    77
    88import org.openstreetmap.josm.Main;
     9import org.openstreetmap.josm.gui.MainApplication;
    910import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    1011
     
    3132        if (prepareSubset()) {
    3233            jct = new JunctionCheckTask(plugin, n, subset, produceRelation);
    33             Main.worker.submit(jct);
     34            MainApplication.worker.submit(jct);
    3435        }
    3536    }
     
    3738    protected void prepareJunctionSearch() {
    3839        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));
    4141        }
    4242    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/util/RelationProducer.java

    r32596 r33778  
    66import java.util.LinkedList;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.data.osm.OsmPrimitive;
    109import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1110import org.openstreetmap.josm.data.osm.Relation;
    1211import org.openstreetmap.josm.data.osm.RelationMember;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.plugins.JunctionChecker.JunctionCheckerPlugin;
    1414import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
     
    4343            }
    4444        }
    45         Main.getLayerManager().setActiveLayer(plugin.getOsmlayer());
     45        MainApplication.getLayerManager().setActiveLayer(plugin.getOsmlayer());
    4646        plugin.getOsmlayer().data.setSelected(ways);
    4747
Note: See TracChangeset for help on using the changeset viewer.