Ignore:
Timestamp:
2016-06-28T23:08:27+02:00 (9 years ago)
Author:
donvip
Message:

remove calls to deprecated methods

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  
    2222import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2323import org.openstreetmap.josm.gui.MapView;
    24 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    2524import org.openstreetmap.josm.gui.layer.Layer;
     25import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     26import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     27import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     28import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
    2629import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    2730import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
     
    3437 *
    3538 */
    36 public class ChannelDiGraphLayer extends Layer implements LayerChangeListener, PropertyChangeListener{
     39public class ChannelDiGraphLayer extends Layer implements LayerChangeListener, PropertyChangeListener {
    3740
    3841    private ChannelDiGraph digraph;
     
    6164    public ChannelDiGraphLayer(ColorSchemeXMLReader cXMLReader){
    6265        super("ChannelDiGraphLayer");
    63         MapView.addLayerChangeListener(this);
     66        Main.getLayerManager().addLayerChangeListener(this);
    6467        this.cXMLReader = cXMLReader;
    6568        initColors();
     
    180183    }
    181184
    182 
    183185    @Override
    184186    public void visitBoundingBox(BoundingXYVisitor v) {
     
    189191    }
    190192
    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);
    201205        }
    202206    }
     
    210214    }
    211215
     216    @Override
    212217    public void propertyChange(PropertyChangeEvent evt) {
    213218    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/DigraphCreationTask.java

    r32329 r32423  
    5555    protected void finish() {
    5656        if (canceled) {
    57             Main.main.removeLayer(plugin.getChannelDigraphLayer());
     57            Main.getLayerManager().removeLayer(plugin.getChannelDigraphLayer());
    5858            return;
    5959        }
     
    6969            return;
    7070        }
    71         Main.main.removeLayer(plugin.getChannelDigraphLayer());
     71        Main.getLayerManager().removeLayer(plugin.getChannelDigraphLayer());
    7272        int tickscounter = 4;
    7373        if (sealGraph) {
     
    8585        //Der vom Benutzer in JOSM ausgewählte, zur Zeit aktive Layer wird der PLugin-OSM-Layer
    8686        plugin.setOsmlayer((OsmDataLayer)Main.getLayerManager().getActiveLayer());
    87         Iterator<Node> it = Main.main.getCurrentDataSet().getNodes().iterator();
     87        Iterator<Node> it = Main.getLayerManager().getEditDataSet().getNodes().iterator();
    8888        while (it.hasNext()) {
    8989            graph.addNode(it.next());
    9090        }
    9191
    92         Iterator<Way> itway = Main.main.getCurrentDataSet().getWays()
     92        Iterator<Way> itway = Main.getLayerManager().getEditDataSet().getWays()
    9393        .iterator();
    9494        while (itway.hasNext()) {
    9595            graph.addWay(itway.next());
    9696        }
    97         Iterator<Relation> itrel = Main.main.getCurrentDataSet().getRelations()
     97        Iterator<Relation> itrel = Main.getLayerManager().getEditDataSet().getRelations()
    9898        .iterator();
    9999        while (itrel.hasNext()) {
    100100            graph.addRelation(itrel.next());
    101101        }
    102         Iterator<DataSource> itdata = Main.main.getCurrentDataSet().dataSources.iterator();
     102        Iterator<DataSource> itdata = Main.getLayerManager().getEditDataSet().dataSources.iterator();
    103103        while (itdata.hasNext()) {
    104104            Bounds b = itdata.next().bounds;
     
    146146        plugin.setNormalMapMode(Main.map.mapMode);
    147147        Main.map.selectMapMode(plugin.getJcMapMode());
    148         Main.main.addLayer(plugin.getChannelDigraphLayer());
     148        Main.getLayerManager().addLayer(plugin.getChannelDigraphLayer());
    149149        Main.getLayerManager().setActiveLayer(plugin.getChannelDigraphLayer());
    150150    }
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java

    r30725 r32423  
    99import java.awt.event.InputEvent;
    1010import java.awt.event.MouseEvent;
     11
    1112import org.openstreetmap.josm.Main;
    1213import org.openstreetmap.josm.actions.mapmode.MapMode;
    1314import org.openstreetmap.josm.data.coor.LatLon;
    1415import org.openstreetmap.josm.gui.MapFrame;
    15 import org.openstreetmap.josm.gui.MapView;
    16 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    1716import org.openstreetmap.josm.gui.layer.Layer;
     17import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent;
     18import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener;
    1819import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
    1920
     
    2223 * die eigenen Bedürfnisse angepaßt
    2324 */
    24 public class JunctionCheckerMapMode extends MapMode implements LayerChangeListener{
     25public class JunctionCheckerMapMode extends MapMode implements ActiveLayerChangeListener {
    2526
    2627    MapFrame frame;
     
    4041        Main.map.mapView.addMouseListener(this);
    4142        Main.map.mapView.addMouseMotionListener(this);
    42         MapView.addLayerChangeListener(this);
     43        Main.getLayerManager().addActiveLayerChangeListener(this);
    4344    }
    4445
     
    4950    }
    5051
    51 
    52     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
     52    @Override
     53    public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
     54        Layer newLayer = Main.getLayerManager().getActiveLayer();
    5355        if (newLayer instanceof ChannelDiGraphLayer) {
    5456            layer = (ChannelDiGraphLayer) newLayer;
    5557        }
    5658    }
    57 
    58     public void layerAdded(Layer newLayer) {
    59     }
    60 
    61     public void layerRemoved(Layer oldLayer) {
    62     }
    63 
    6459
    6560    public void setFrame(MapFrame newFrame) {
     
    169164    public void destroy() {
    170165        super.destroy();
    171         MapView.removeLayerChangeListener(this);
     166        Main.getLayerManager().removeActiveLayerChangeListener(this);
    172167    }
    173168}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java

    r28626 r32423  
    77
    88import java.io.File;
     9
    910import org.openstreetmap.josm.Main;
    1011import org.openstreetmap.josm.actions.mapmode.MapMode;
    1112import org.openstreetmap.josm.gui.MapFrame;
    12 import org.openstreetmap.josm.gui.MapView;
    13 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    1413import org.openstreetmap.josm.gui.layer.Layer;
     14import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;
     15import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener;
     16import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent;
     17import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;
    1518import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1619import org.openstreetmap.josm.plugins.Plugin;
     
    2629 *
    2730 */
    28 public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener{
     31public class JunctionCheckerPlugin extends Plugin implements LayerChangeListener {
    2932
    3033    private static final String COLORSCHEMEFILTERFILE = "/resources/xml/colorscheme.xml";
     
    5356            junctionCheckDialog = new JunctionCheckDialog(this);
    5457            newFrame.addToggleDialog(junctionCheckDialog);
    55             MapView.addLayerChangeListener(this);
     58            Main.getLayerManager().addLayerChangeListener(this);
    5659        } else
    57             MapView.removeLayerChangeListener(this);
     60            Main.getLayerManager().removeLayerChangeListener(this);
    5861    }
    5962
     
    7275    }
    7376
    74     public void layerAdded(Layer newLayer) {
     77    @Override
     78    public void layerOrderChanged(LayerOrderChangeEvent e) {
    7579    }
    7680
    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) {
    7988            channelDigraphLayer = null;
    8089            this.getJunctionCheckDialog().setActivateJunctionCheckOrSearch(false);
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/JMinimality.java

    r30737 r32423  
    1313import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    1414import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
    15 
    16 
    1715
    1816/**
     
    2927    private final int n;
    3028    private final List<List<Object>> L = new ArrayList<>(); //The list of columns to be sorted
    31     private long EEovern = 0;
    3229    private final HashSet<Channel> subgraph = new HashSet<>();//The candidate subgraph to be tested
    3330    private ProgressMonitor pm;
     
    3936    private boolean Check = false;
    4037    private Iterator<int[]> it;
    41 
    4238
    4339    public JMinimality(int[][] Grid, int n,
     
    8480
    8581        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);
    8783        long ans = c.Choose(); //This is the number of subcolumns to be generated
    8884        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  
    22
    33import java.util.ArrayList;
     4
    45import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    56import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
     
    1415    private final ArrayList<Channel> exits;
    1516    private ArrayList<Channel> vertices;
    16     private final ChannelDiGraph digraph;
    1717
    1818    public JPrepare(ChannelDiGraph digraph) {
    1919        entries = new ArrayList<>();
    2020        exits = new ArrayList<>();
    21         this.digraph = digraph;
    2221    }
    2322
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/junctionchecking/TRDFS.java

    r30737 r32423  
    22
    33import java.util.ArrayList;
     4
    45import org.openstreetmap.josm.plugins.JunctionChecker.connectedness.BacktrackingColors;
    56import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.Channel;
    67import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.ChannelDiGraph;
    78import org.openstreetmap.josm.plugins.JunctionChecker.datastructure.LeadsTo;
    8 
    99
    1010/**
     
    1313public class TRDFS {
    1414
    15     private final ArrayList<Channel> vertices;
    16     private Channel startNode;
    1715    private final ArrayList<LeadsTo> cycleEdges;
    1816    private final ChannelDiGraph digraph;
     
    2422     */
    2523    public TRDFS(ArrayList<Channel> adnodes, ChannelDiGraph digraph) {
    26         this.vertices = adnodes;
    2724        this.digraph = digraph;
    2825        this.cycleEdges = new ArrayList<>();
    2926    }
    30 
    3127
    3228    public void trdfs(Channel startNode) {
Note: See TracChangeset for help on using the changeset viewer.