Changeset 34976 in osm


Ignore:
Timestamp:
2019-04-13T15:12:48+02:00 (6 years ago)
Author:
donvip
Message:

see #josm17598 #josm17599 #josm17600 #josm17601 #josm17602 - remove deprecated api (patches by taylor.smock)

Location:
applications/editors/josm/plugins
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tracer2/src/org/openstreetmap/josm/plugins/tracer2/ConnectWays.java

    r33700 r34976  
    2525import org.openstreetmap.josm.plugins.tracer2.preferences.ServerParam;
    2626import org.openstreetmap.josm.tools.Pair;
     27import org.openstreetmap.josm.tools.Utils;
    2728
    2829public final class ConnectWays {
     
    7071    private static List<Way> getWaysOfNode(Node node) {
    7172        List<Way> ways;
    72         ways = OsmPrimitive.getFilteredList(node.getReferrers(), Way.class);
     73        ways = new LinkedList<>(Utils.filteredCollection(node.getReferrers(), Way.class));
    7374        return ways;
    7475    }
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/RoadGui.java

    r34926 r34976  
    3939import org.openstreetmap.josm.plugins.turnlanes.model.Lane;
    4040import org.openstreetmap.josm.plugins.turnlanes.model.Road;
    41 import org.openstreetmap.josm.plugins.turnlanes.model.Utils;
     41import org.openstreetmap.josm.plugins.turnlanes.model.TurnlanesUtils;
    4242
    4343class RoadGui {
     
    629629        final Node n = end.getJunction().getNode();
    630630        for (Way w : org.openstreetmap.josm.tools.Utils.filteredCollection(n.getReferrers(), Way.class)) {
    631             if (w.getNodesCount() > 1 && !end.getWay().equals(w) && w.isFirstLastNode(n) && Utils.isRoad(w)) {
     631            if (w.getNodesCount() > 1 && !end.getWay().equals(w) && w.isFirstLastNode(n) && TurnlanesUtils.isRoad(w)) {
    632632                final Node nextNode = w.firstNode().equals(n) ? w.getNode(1) : w.getNode(w.getNodesCount() - 2);
    633633                final Point2D nextNodeLoc = getContainer().translateAndScale(loc(nextNode));
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Lane.java

    r34566 r34976  
    6969
    7070    static int getRegularCount(Way w, Node end) {
    71         final int count = Utils.parseIntTag(w, "lanes");
     71        final int count = TurnlanesUtils.parseIntTag(w, "lanes");
    7272        final boolean forward = w.lastNode().equals(end);
    7373
     
    8989    private static int getRegularCountTwoWay(Way w, boolean forward, final int count) {
    9090        if (w.get("lanes:backward") != null) {
    91             final int backwardCount = Utils.parseIntTag(w, "lanes:backward");
     91            final int backwardCount = TurnlanesUtils.parseIntTag(w, "lanes:backward");
    9292            return forward ? count - backwardCount : backwardCount;
    9393        }
    9494
    9595        if (w.get("lanes:forward") != null) {
    96             final int forwardCount = Utils.parseIntTag(w, "lanes:forward");
     96            final int forwardCount = TurnlanesUtils.parseIntTag(w, "lanes:forward");
    9797            return forward ? forwardCount : count - forwardCount;
    9898        }
     
    205205                r.addMember(new RelationMember(Constants.TURN_ROLE_VIA, getOutgoingJunction().getNode()));
    206206            } else {
    207                 for (Way w : Utils.flattenVia(getOutgoingJunction().getNode(), via, to.getJunction().getNode())) {
     207                for (Way w : TurnlanesUtils.flattenVia(getOutgoingJunction().getNode(), via, to.getJunction().getNode())) {
    208208                    r.addMember(new RelationMember(Constants.TURN_ROLE_VIA, w));
    209209                }
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/ModelContainer.java

    r34926 r34976  
    4545
    4646            for (Node n : new ArrayList<>(closedNodes)) {
    47                 for (Way w : Utils.filterRoads(n.getReferrers())) {
     47                for (Way w : TurnlanesUtils.filterRoads(n.getReferrers())) {
    4848                    if (w.isFirstLastNode(n)) {
    4949                        closed &= close(closedNodes, closedWays, w);
     
    8080
    8181        final List<Way> via = new ArrayList<>();
    82         for (RelationMember m : Utils.getMembers(r, Constants.TURN_ROLE_VIA)) {
     82        for (RelationMember m : TurnlanesUtils.getMembers(r, Constants.TURN_ROLE_VIA)) {
    8383            if (m.isWay()) {
    8484                closed &= !closedWays.add(m.getWay());
     
    9090
    9191        if (!via.isEmpty()) {
    92             final Way from = Utils.getMemberWay(r, Constants.TURN_ROLE_FROM);
    93             final Way to = Utils.getMemberWay(r, Constants.TURN_ROLE_TO);
    94 
    95             closed &= !closedNodes.add(Utils.lineUp(from, via.get(0)));
    96             closed &= !closedNodes.add(Utils.lineUp(via.get(via.size() - 1), to));
     92            final Way from = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_FROM);
     93            final Way to = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_TO);
     94
     95            closed &= !closedNodes.add(TurnlanesUtils.lineUp(from, via.get(0)));
     96            closed &= !closedNodes.add(TurnlanesUtils.lineUp(via.get(via.size() - 1), to));
    9797        }
    9898
     
    142142            }
    143143
    144             for (Route r : Utils.orderWays(this.primaryWays, this.primaryNodes)) {
     144            for (Route r : TurnlanesUtils.orderWays(this.primaryWays, this.primaryNodes)) {
    145145                addRoad(new Road(this, r));
    146146            }
     
    159159        for (Node n : primaryNodes) {
    160160            final List<Way> ws = new ArrayList<>();
    161             for (Way w : Utils.filterRoads(n.getReferrers())) {
     161            for (Way w : TurnlanesUtils.filterRoads(n.getReferrers())) {
    162162                if (w.isFirstLastNode(n)) {
    163163                    ws.add(w);
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Road.java

    r34566 r34976  
    124124            final Relation target;
    125125            if (rel == null) {
    126                 if (other == null || !Utils.getMemberNode(other, "end").equals(n)) {
     126                if (other == null || !TurnlanesUtils.getMemberNode(other, "end").equals(n)) {
    127127                    target = createLengthsRelation();
    128128                } else {
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Route.java

    r33085 r34976  
    9898
    9999    public static Route load(Relation r) {
    100         final Node end = Utils.getMemberNode(r, Constants.LENGTHS_ROLE_END);
    101         final List<Way> ws = Utils.getMemberWays(r, Constants.LENGTHS_ROLE_WAYS);
     100        final Node end = TurnlanesUtils.getMemberNode(r, Constants.LENGTHS_ROLE_END);
     101        final List<Way> ws = TurnlanesUtils.getMemberWays(r, Constants.LENGTHS_ROLE_WAYS);
    102102
    103103        return create(ws, end);
     
    143143            }
    144144
    145             final Node start = Utils.getOppositeEnd(w, end);
     145            final Node start = TurnlanesUtils.getOppositeEnd(w, end);
    146146            segments.add(0, new Segment(start, w, end));
    147147            end = start;
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Turn.java

    r34926 r34976  
    5454
    5555    private static Set<Turn> loadWithViaWays(ModelContainer c, Relation r) {
    56         final Way from = Utils.getMemberWay(r, Constants.TURN_ROLE_FROM);
    57         final Way to = Utils.getMemberWay(r, Constants.TURN_ROLE_TO);
     56        final Way from = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_FROM);
     57        final Way to = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_TO);
    5858
    5959        if (!c.hasRoad(from) || !c.hasRoad(to)) {
     
    6161        }
    6262
    63         final List<Way> tmp = Utils.getMemberWays(r, Constants.TURN_ROLE_VIA);
     63        final List<Way> tmp = TurnlanesUtils.getMemberWays(r, Constants.TURN_ROLE_VIA);
    6464        final LinkedList<Road> via = new LinkedList<>();
    6565
    66         final Road.End fromRoadEnd = c.getJunction(Utils.lineUp(from, tmp.get(0))).getRoadEnd(from);
     66        final Road.End fromRoadEnd = c.getJunction(TurnlanesUtils.lineUp(from, tmp.get(0))).getRoadEnd(from);
    6767
    6868        Node n = fromRoadEnd.getJunction().getNode();
     
    7676            final Road v = c.getRoad(w);
    7777            via.add(v);
    78             n = Utils.getOppositeEnd(w, n);
     78            n = TurnlanesUtils.getOppositeEnd(w, n);
    7979
    8080            if (!v.isPrimary()) {
     
    8888            while (it2.hasNext()) {
    8989                final Way w2 = it2.next().getWay();
    90                 n = Utils.getOppositeEnd(w2, n);
     90                n = TurnlanesUtils.getOppositeEnd(w2, n);
    9191
    9292                if (!it.hasNext() || !w2.equals(it.next())) {
     
    9696        }
    9797        final Road.End toRoadEnd = c.getJunction(n).getRoadEnd(to);
    98         n = Utils.getOppositeEnd(to, n);
     98        n = TurnlanesUtils.getOppositeEnd(to, n);
    9999
    100100        final Set<Turn> result = new HashSet<>();
     
    124124
    125125    private static Set<Turn> loadWithViaNode(ModelContainer c, Relation r) {
    126         final Way from = Utils.getMemberWay(r, Constants.TURN_ROLE_FROM);
    127         final Node via = Utils.getMemberNode(r, Constants.TURN_ROLE_VIA);
    128         final Way to = Utils.getMemberWay(r, Constants.TURN_ROLE_TO);
     126        final Way from = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_FROM);
     127        final Node via = TurnlanesUtils.getMemberNode(r, Constants.TURN_ROLE_VIA);
     128        final Way to = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_TO);
    129129
    130130        if (!c.hasRoad(from) || !c.hasJunction(via) || !c.hasRoad(to)) {
  • applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/model/Validator.java

    r33085 r34976  
    1717import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.data.osm.Node;
    19 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2019import org.openstreetmap.josm.data.osm.Relation;
    2120import org.openstreetmap.josm.data.osm.RelationMember;
    2221import org.openstreetmap.josm.data.osm.Way;
    2322import org.openstreetmap.josm.plugins.turnlanes.model.Issue.QuickFix;
     23import org.openstreetmap.josm.tools.Utils;
    2424
    2525public class Validator {
     
    109109        final List<Relation> turns = new ArrayList<>();
    110110
    111         for (Relation r : OsmPrimitive.getFilteredList(dataSet.allPrimitives(), Relation.class)) {
     111        for (Relation r : Utils.filteredCollection(dataSet.allPrimitives(), Relation.class)) {
    112112            if (!r.isUsable()) {
    113113                continue;
     
    152152
    153153        try {
    154             final Node end = Utils.getMemberNode(r, Constants.LENGTHS_ROLE_END);
     154            final Node end = TurnlanesUtils.getMemberNode(r, Constants.LENGTHS_ROLE_END);
    155155            final Route route = validateLengthsWays(r, end, issues);
    156156
     
    207207
    208208    private Route validateLengthsWays(Relation r, Node end, List<Issue> issues) {
    209         final List<Way> ways = Utils.getMemberWays(r, Constants.LENGTHS_ROLE_WAYS);
     209        final List<Way> ways = TurnlanesUtils.getMemberWays(r, Constants.LENGTHS_ROLE_WAYS);
    210210
    211211        if (ways.isEmpty()) {
     
    221221            }
    222222
    223             current = Utils.getOppositeEnd(w, current);
     223            current = TurnlanesUtils.getOppositeEnd(w, current);
    224224        }
    225225
     
    247247                    it.remove();
    248248                    ordered.add(w);
    249                     current = Utils.getOppositeEnd(w, current);
     249                    current = TurnlanesUtils.getOppositeEnd(w, current);
    250250                    continue findNext;
    251251                }
     
    294294
    295295        try {
    296             final Way from = Utils.getMemberWay(r, Constants.TURN_ROLE_FROM);
    297             final Way to = Utils.getMemberWay(r, Constants.TURN_ROLE_TO);
     296            final Way from = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_FROM);
     297            final Way to = TurnlanesUtils.getMemberWay(r, Constants.TURN_ROLE_TO);
    298298
    299299            if (from.firstNode().equals(from.lastNode())) {
     
    308308
    309309            final Node fromJunctionNode;
    310             final List<RelationMember> viaMembers = Utils.getMembers(r, Constants.TURN_ROLE_VIA);
     310            final List<RelationMember> viaMembers = TurnlanesUtils.getMembers(r, Constants.TURN_ROLE_VIA);
    311311            if (viaMembers.isEmpty()) {
    312312                throw UnexpectedDataException.Kind.NO_MEMBER.chuck(Constants.TURN_ROLE_VIA);
    313313            } else if (viaMembers.get(0).isWay()) {
    314                 final List<Way> vias = Utils.getMemberWays(r, Constants.TURN_ROLE_VIA);
    315 
    316                 fromJunctionNode = Utils.lineUp(from, vias.get(0));
     314                final List<Way> vias = TurnlanesUtils.getMemberWays(r, Constants.TURN_ROLE_VIA);
     315
     316                fromJunctionNode = TurnlanesUtils.lineUp(from, vias.get(0));
    317317                Node current = fromJunctionNode;
    318318                for (Way via : vias) {
     
    322322                    }
    323323
    324                     current = Utils.getOppositeEnd(via, current);
     324                    current = TurnlanesUtils.getOppositeEnd(via, current);
    325325                }
    326326            } else {
    327                 final Node via = Utils.getMemberNode(r, Constants.TURN_ROLE_VIA);
     327                final Node via = TurnlanesUtils.getMemberNode(r, Constants.TURN_ROLE_VIA);
    328328
    329329                if (!from.isFirstLastNode(via)) {
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java

    r32519 r34976  
    1717import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionType;
    1818import org.openstreetmap.josm.tools.CheckParameterUtil;
     19import org.openstreetmap.josm.tools.Utils;
    1920
    2021/**
     
    313314
    314315        // we need exactly one node and one way in the selection ...
    315         List<Node> nodes = OsmPrimitive.getFilteredList(primitives, Node.class);
    316         List<Way> ways = OsmPrimitive.getFilteredList(primitives, Way.class);
     316        List<Node> nodes = new ArrayList<>(Utils.filteredCollection(primitives, Node.class));
     317        List<Way> ways = new ArrayList<>(Utils.filteredCollection(primitives, Way.class));
    317318        if (nodes.size() != 1 || ways.size() != 1) return null;
    318319
     
    374375            // See initNoUTurnRestriction() for the case where we have a selected way
    375376            // and a selected node
    376             List<Way> selWays = OsmPrimitive.getFilteredList(primitives, Way.class);
     377            List<Way> selWays = new ArrayList<>(Utils.filteredCollection(primitives, Way.class));
    377378            if (selWays.size() != 2) return null;
    378379            w1 = selWays.get(0);
     
    382383            // if we have exactly three selected primitives, we need two ways and a
    383384            // node, which should be an acceptable via node
    384             List<Way> selWays = OsmPrimitive.getFilteredList(primitives, Way.class);
    385             List<Node> selNodes = OsmPrimitive.getFilteredList(primitives, Node.class);
     385            List<Way> selWays = new ArrayList<>(Utils.filteredCollection(primitives, Way.class));
     386            List<Node> selNodes = new ArrayList<>(Utils.filteredCollection(primitives, Node.class));
    386387            if (selWays.size() != 2) return null;
    387388            if (selNodes.size() != 1) return null;
     
    449450        case 1:
    450451            tr = initEmptyTurnRestriction();
    451             if (OsmPrimitive.getFilteredList(primitives, Way.class).size() == 1) {
     452            if (Utils.filteredCollection(primitives, Way.class).size() == 1) {
    452453                // we have exactly one selected way? -> init the "from" leg
    453454                // of the turn restriction with it
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java

    r33537 r34976  
    2020import java.awt.event.MouseMotionAdapter;
    2121import java.io.IOException;
     22import java.util.ArrayList;
    2223import java.util.Collections;
    2324import java.util.HashSet;
     
    5556import org.openstreetmap.josm.tools.ImageProvider;
    5657import org.openstreetmap.josm.tools.Shortcut;
     58import org.openstreetmap.josm.tools.Utils;
    5759
    5860/**
     
    293295         @Override
    294296        public void actionPerformed(ActionEvent e) {
    295              List<Way> selWays = OsmPrimitive.getFilteredList(model.getJosmSelectionListModel().getSelected(), Way.class);
     297             List<Way> selWays = new ArrayList<>(Utils.filteredCollection(model.getJosmSelectionListModel().getSelected(), Way.class));
    296298             if (selWays.size() != 1) return;
    297299             Way w = selWays.get(0);
     
    300302
    301303         public void updateEnabledState() {
    302             setEnabled(OsmPrimitive.getFilteredList(model.getJosmSelectionListModel().getSelected(), Way.class).size() == 1);
     304            setEnabled(Utils.filteredCollection(model.getJosmSelectionListModel().getSelected(), Way.class).size() == 1);
    303305         }
    304306
  • applications/editors/josm/plugins/waydownloader/src/org/openstreetmap/josm/plugins/waydownloader/WayDownloaderPlugin.java

    r34569 r34976  
    3838import org.openstreetmap.josm.tools.Logging;
    3939import org.openstreetmap.josm.tools.Shortcut;
     40import org.openstreetmap.josm.tools.Utils;
    4041
    4142/**
     
    271272     */
    272273    private List<Way> findConnectedWays(Node referenceNode) {
    273         List<Way> referers = OsmPrimitive.getFilteredList(referenceNode.getReferrers(), Way.class);
     274        List<Way> referers = new ArrayList<>(Utils.filteredCollection(referenceNode.getReferrers(), Way.class));
    274275        ArrayList<Way> connectedWays = new ArrayList<>(referers.size());
    275276
Note: See TracChangeset for help on using the changeset viewer.