Ignore:
Timestamp:
2009-08-30T16:36:16+02:00 (15 years ago)
Author:
guggis
Message:

updated to JOSM 2005
cleanup for @deprecated OptionPaneUtil
cleanup for @deprecated data APIs

Location:
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java

    r16788 r17351  
    175175        {
    176176            Node lastN = null;
    177             for (Node n : w.nodes) {
     177            for (Node n : w.getNodes()) {
    178178                if (lastN == null) {
    179179                    lastN = n;
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java

    r16788 r17351  
    3131import org.openstreetmap.josm.data.projection.Mercator;
    3232import org.openstreetmap.josm.gui.MapFrame;
    33 import org.openstreetmap.josm.gui.OptionPaneUtil;
    3433import org.openstreetmap.josm.gui.layer.Layer;
    3534import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    276275            } catch (InvocationTargetException ite) {
    277276                ite.getCause().printStackTrace();
    278                 OptionPaneUtil.showMessageDialog(Main.parent,
     277                JOptionPane.showMessageDialog(Main.parent,
    279278                                tr("Error initializing test {0}:\n {1}", test.getClass()
    280279                        .getSimpleName(), ite.getCause().getMessage()),
     
    283282            } catch (Exception e) {
    284283                e.printStackTrace();
    285                 OptionPaneUtil.showMessageDialog(Main.parent,
     284                JOptionPane.showMessageDialog(Main.parent,
    286285                                tr("Error initializing test {0}:\n {1}", test.getClass()
    287286                        .getSimpleName(), e),
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/TestError.java

    r16294 r17351  
    334334        public void visit(Way w) {
    335335            Node lastN = null;
    336             for (Node n : w.nodes) {
     336            for (Node n : w.getNodes()) {
    337337                if (lastN == null) {
    338338                    lastN = n;
     
    347347
    348348        public void visit(WaySegment ws) {
    349             if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way.nodes.size())
     349            if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way.getNodesCount())
    350350                return;
    351             Node a = ws.way.nodes.get(ws.lowerIndex), b = ws.way.nodes.get(ws.lowerIndex + 1);
     351            Node a = ws.way.getNodes().get(ws.lowerIndex), b = ws.way.getNodes().get(ws.lowerIndex + 1);
    352352            if (isSegmentVisible(a, b)) {
    353353                drawSegment(a, b, severity.getColor());
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java

    r16788 r17351  
    1616import org.openstreetmap.josm.data.osm.DataSet;
    1717import org.openstreetmap.josm.data.osm.OsmPrimitive;
    18 import org.openstreetmap.josm.gui.OptionPaneUtil;
    1918import org.openstreetmap.josm.plugins.validator.util.AgregatePrimitivesVisitor;
    2019import org.openstreetmap.josm.tools.GBC;
     
    115114        p.add(new JScrollPane(errorPanel), GBC.eol());
    116115
    117         int res  = OptionPaneUtil.showConfirmationDialog(Main.parent, p,
     116        int res  = JOptionPane.showConfirmDialog(Main.parent, p,
    118117        tr("Data with errors. Upload anyway?"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    119118        if(res == JOptionPane.NO_OPTION)
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java

    r16788 r17351  
    3333import org.openstreetmap.josm.data.osm.WaySegment;
    3434import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    35 import org.openstreetmap.josm.gui.OptionPaneUtil;
    3635import org.openstreetmap.josm.gui.SideButton;
    3736import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    38 import org.openstreetmap.josm.tools.ImageProvider;
    3937import org.openstreetmap.josm.tools.Shortcut;
    4038
     
    119117        if (tree != null)
    120118            tree.setVisible(v);
    121         if (action != null && action.button != null)
    122             action.button.setSelected(v);
    123119        super.setVisible(v);
    124120        Main.map.repaint();
     
    191187                if (asked == JOptionPane.DEFAULT_OPTION) {
    192188                    String[] a = new String[] { tr("Whole group"), tr("Single elements"), tr("Nothing") };
    193                     asked = OptionPaneUtil.showOptionDialog(Main.parent, tr("Ignore whole group or individual elements?"),
    194                             tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE,
     189                    asked = JOptionPane.showOptionDialog(Main.parent, tr("Ignore whole group or individual elements?"),
     190                            tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null,
    195191                            a, a[1]);
    196192                }
     
    425421
    426422        public void visit(WaySegment ws) {
    427             if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way.nodes.size())
     423            if (ws.lowerIndex < 0 || ws.lowerIndex + 1 >= ws.way.getNodesCount())
    428424                return;
    429             visit(ws.way.nodes.get(ws.lowerIndex));
    430             visit(ws.way.nodes.get(ws.lowerIndex + 1));
     425            visit(ws.way.getNodes().get(ws.lowerIndex));
     426            visit(ws.way.getNodes().get(ws.lowerIndex + 1));
    431427        }
    432428    }
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java

    r16629 r17351  
    5151        if (!super.executeCommand()) return false; // save old
    5252        for (OsmPrimitive osm : objects) {
    53             if(osm.keys != null)
     53            if(osm.hasKeys())
    5454            {
    5555                osm.modified = true;
    56                 osm.put(newKey, osm.keys.remove(key) );
     56                String oldValue= osm.get(key);
     57                osm.put(newKey, oldValue );
     58                osm.remove(key);
    5759            }
    5860        }
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/Coastlines.java

    r13497 r17351  
    7373                    continue;
    7474
    75                 if( w.nodes.get(0).equals(w2.nodes.get(0)) || w.nodes.get(w.nodes.size() - 1).equals(w2.nodes.get(w2.nodes.size() - 1)))
     75                if( w.getNodes().get(0).equals(w2.getNodes().get(0)) || w.getNodes().get(w.getNodesCount() - 1).equals(w2.getNodes().get(w2.getNodesCount() - 1)))
    7676                {
    7777                    List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/CrossingWays.java

    r17313 r17351  
    8383        String layer1 = w.get("layer");
    8484
    85         int nodesSize = w.nodes.size();
     85        int nodesSize = w.getNodesCount();
    8686        for (int i = 0; i < nodesSize - 1; i++) {
    8787            WaySegment ws = new WaySegment(w, i);
     
    188188        {
    189189            this.ws = ws;
    190             this.n1 = ws.way.nodes.get(ws.lowerIndex);
    191             this.n2 = ws.way.nodes.get(ws.lowerIndex + 1);
     190            this.n1 = ws.way.getNodes().get(ws.lowerIndex);
     191            this.n2 = ws.way.getNodes().get(ws.lowerIndex + 1);
    192192            this.layer = layer;
    193193            this.railway = railway;
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicatedWayNodes.java

    r16735 r17351  
    2828
    2929        Node lastN = null;
    30         for (Node n : w.nodes) {
     30        for (Node n : w.getNodes()) {
    3131            if (lastN == null) {
    3232                lastN = n;
     
    4545        Way w = (Way) testError.getPrimitives().iterator().next();
    4646        Way wnew = new Way(w);
    47         wnew.nodes.clear();
     47        wnew.setNodes(null);
    4848        Node lastN = null;
    49         for (Node n : w.nodes) {
     49        for (Node n : w.getNodes()) {
    5050            if (lastN == null) {
    51                 wnew.nodes.add(n);
     51                wnew.addNode(n);
    5252            } else if (n == lastN) {
    5353                // Skip this node
    5454            } else {
    55                 wnew.nodes.add(n);
     55                wnew.addNode(n);
    5656            }
    5757            lastN = n;
    5858        }
    59         if (wnew.nodes.size() < 2) {
     59        if (wnew.getNodesCount() < 2) {
    6060            // Empty way, delete
    6161            return DeleteCommand.delete(Main.map.mapView.getEditLayer(), Collections.singleton(w));
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/OverlappingWays.java

    r13497 r17351  
    157157        Node lastN = null;
    158158        int i = -2;
    159         for (Node n : w.nodes) {
     159        for (Node n : w.getNodes()) {
    160160            i++;
    161161            if (lastN == null) {
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/SelfIntersectingWay.java

    r13497 r17351  
    2727        HashSet<Node> nodes = new HashSet<Node>();
    2828
    29         for (int i = 1; i < w.nodes.size() - 1; i++) {
    30             Node n = w.nodes.get(i);
     29        for (int i = 1; i < w.getNodesCount() - 1; i++) {
     30            Node n = w.getNode(i);
    3131            if (nodes.contains(n)) {
    3232                errors.add(new TestError(this,
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java

    r16788 r17351  
    4444import org.openstreetmap.josm.data.osm.Relation;
    4545import org.openstreetmap.josm.data.osm.Way;
    46 import org.openstreetmap.josm.gui.OptionPaneUtil;
    4746import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference;
    4847import org.openstreetmap.josm.gui.tagging.TaggingPreset;
     
    390389        if(checkComplex)
    391390        {
    392             Map<String, String> props = (p.keys == null) ? Collections.<String, String>emptyMap() : p.keys;
     391            Map<String, String> props = (p.getKeys() == null) ? Collections.<String, String>emptyMap() : p.getKeys();
    393392            for(Entry<String, String> prop: props.entrySet() )
    394393            {
     
    452451        }
    453452
    454         Map<String, String> props = (p.keys == null) ? Collections.<String, String>emptyMap() : p.keys;
     453        Map<String, String> props = (p.getKeys() == null) ? Collections.<String, String>emptyMap() : p.getKeys();
    455454        for(Entry<String, String> prop: props.entrySet() )
    456455        {
     
    620619        addSrcButton.addActionListener(new ActionListener(){
    621620            public void actionPerformed(ActionEvent e) {
    622                 String source = OptionPaneUtil.showInputDialog(
     621                String source = JOptionPane.showInputDialog(
    623622                                Main.parent,
    624623                                tr("TagChecker source"),
     
    645644                    if(Sources.getModel().getSize() == 0)
    646645                    {
    647                         String source = OptionPaneUtil.showInputDialog(Main.parent, tr("TagChecker source"), tr("TagChecker source"), JOptionPane.QUESTION_MESSAGE);
     646                        String source = JOptionPane.showInputDialog(Main.parent, tr("TagChecker source"), tr("TagChecker source"), JOptionPane.QUESTION_MESSAGE);
    648647                        if (source != null)
    649648                            ((DefaultListModel)Sources.getModel()).addElement(source);
     
    651650                    else
    652651                    {
    653                         OptionPaneUtil.showMessageDialog(
     652                        JOptionPane.showMessageDialog(
    654653                                        Main.parent,
    655654                                        tr("Please select the row to edit."),
     
    660659                }
    661660                else {
    662                         String source = (String)OptionPaneUtil.showInputDialog(Main.parent,
     661                        String source = (String)JOptionPane.showInputDialog(Main.parent,
    663662                                        tr("TagChecker source"),
    664663                                        tr("TagChecker source"),
     
    676675            public void actionPerformed(ActionEvent e) {
    677676                if (Sources.getSelectedIndex() == -1)
    678                     OptionPaneUtil.showMessageDialog(Main.parent, tr("Please select the row to delete."), tr("Information"), JOptionPane.QUESTION_MESSAGE);
     677                    JOptionPane.showMessageDialog(Main.parent, tr("Please select the row to delete."), tr("Information"), JOptionPane.QUESTION_MESSAGE);
    679678                else {
    680679                    ((DefaultListModel)Sources.getModel()).remove(Sources.getSelectedIndex());
     
    800799        {
    801800            i++;
    802             Map<String, String> tags = p.keys;
     801            Map<String, String> tags = p.getKeys();
    803802            if( tags == null || tags.size() == 0 )
    804803                continue;
     
    922921            public Boolean match(OsmPrimitive osm)
    923922            {
    924                 for(Entry<String, String> prop: osm.keys.entrySet())
     923                for(Entry<String, String> prop: osm.getKeys().entrySet())
    925924                {
    926925                    String key = prop.getKey();
     
    995994        public Boolean match(OsmPrimitive osm)
    996995        {
    997             if(osm.keys == null || (type == NODE && !(osm instanceof Node))
     996            if(osm.getKeys() == null || (type == NODE && !(osm instanceof Node))
    998997            || (type == RELATION && !(osm instanceof Relation)) || (type == WAY && !(osm instanceof Way)))
    999998                return false;
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnclosedWays.java

    r16159 r17351  
    105105        if (type != null && !w.isClosed())
    106106        {
    107             Node f = w.nodes.get(0);
    108             Node l = w.nodes.get(w.nodes.size() - 1);
     107            Node f = w.getNode(0);
     108            Node l = w.getNode(w.getNodesCount() - 1);
    109109            if(force || f.getCoor().greatCircleDistance(l.getCoor()) < 10000)
    110110            {
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java

    r16629 r17351  
    176176        public boolean nearby(Node n, double dist)
    177177        {
    178             return !w.nodes.contains(n)
     178            return !w.containsNode(n)
    179179            && line.ptSegDist(n.getEastNorth().east(), n.getEastNorth().north()) < dist;
    180180        }
     
    192192        if( w.deleted || w.incomplete )
    193193            return;
    194         int size = w.nodes.size();
     194        int size = w.getNodesCount();
    195195        if(size < 2)
    196196            return;
     
    198198        {
    199199            if(i < size-1)
    200                 addNode(w.nodes.get(i), middlenodes);
    201             ways.add(new MyWaySegment(w, w.nodes.get(i-1), w.nodes.get(i)));
     200                addNode(w.getNode(i), middlenodes);
     201            ways.add(new MyWaySegment(w, w.getNode(i-1), w.getNode(i)));
    202202        }
    203203        Set<Node> set = endnodes;
    204204        if(w.get("highway") != null || w.get("railway") != null)
    205205            set = endnodes_highway;
    206         addNode(w.nodes.get(0), set);
    207         addNode(w.nodes.get(size-1), set);
     206        addNode(w.getNode(0), set);
     207        addNode(w.getNode(size-1), set);
    208208    }
    209209    private void addNode(Node n, Set<Node> s)
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java

    r16735 r17351  
    7878    public void visit(Way w)
    7979    {
    80         for (Node n : w.nodes) {
     80        for (Node n : w.getNodes()) {
    8181            emptyNodes.remove(n);
    8282        }
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java

    r16735 r17351  
    6565        if (w.deleted || w.incomplete) return;
    6666
    67         Map<String, String> tags = w.keys;
     67        Map<String, String> tags = w.getKeys();
    6868        if( tags != null )
    6969        {
     
    100100        }
    101101
    102         if( w.nodes.size() == 0 )
     102        if( w.getNodesCount() == 0 )
    103103        {
    104104            errors.add( new TestError(this, Severity.ERROR, tr("Empty ways"), EMPTY_WAY, w) );
    105105        }
    106         else if( w.nodes.size() == 1 )
     106        else if( w.getNodesCount() == 1 )
    107107        {
    108108            errors.add( new TestError(this, Severity.ERROR, tr("One node ways"), ONE_NODE_WAY, w) );
     
    117117        for (final Relation r : Main.main.getCurrentDataSet().relations)
    118118        {
    119             if(!r.deleted && !r.incomplete && r.keys != null
    120             && "multipolygon".equals(r.keys.get("type")))
     119            if(!r.deleted && !r.incomplete && r.getKeys() != null
     120            && "multipolygon".equals(r.get("type")))
    121121            {
    122122                for (RelationMember m : r.members)
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/WronglyOrderedWays.java

    r16438 r17351  
    8888         */
    8989
    90         if(w.nodes.get(0) == w.nodes.get(w.nodes.size()-1))
     90        if(w.getNode(0) == w.getNode(w.getNodesCount()-1))
    9191        {
    9292            double area2 = 0;
    9393
    94             for (int node = 1; node < w.nodes.size(); node++)
     94            for (int node = 1; node < w.getNodesCount(); node++)
    9595            {
    96                 area2 += (w.nodes.get(node-1).getCoor().lon() * w.nodes.get(node).getCoor().lat()
    97                 - w.nodes.get(node).getCoor().lon() * w.nodes.get(node-1).getCoor().lat());
     96                area2 += (w.getNode(node-1).getCoor().lon() * w.getNode(node).getCoor().lat()
     97                - w.getNode(node).getCoor().lon() * w.getNode(node-1).getCoor().lat());
    9898            }
    9999
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/AgregatePrimitivesVisitor.java

    r16159 r17351  
    5757        {
    5858            aggregatedData.add(w);
    59             for (Node n : w.nodes)
     59            for (Node n : w.getNodes())
    6060                visit(n);
    6161        }
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java

    r16159 r17351  
    3939    public static List<List<Way>> getWaysInCell(Way w, Map<Point2D,List<Way>> cellWays)
    4040    {
    41         if (w.nodes.size() == 0)
     41        if (w.getNodesCount() == 0)
    4242            return Collections.emptyList();
    4343
    44         Node n1 = w.nodes.get(0);
    45         Node n2 = w.nodes.get(w.nodes.size() - 1);
     44        Node n1 = w.getNode(0);
     45        Node n2 = w.getNode(w.getNodesCount() - 1);
    4646
    4747        List<List<Way>> cells = new ArrayList<List<Way>>(2);
Note: See TracChangeset for help on using the changeset viewer.