| 1 | Index: src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java (revision 2083) |
|---|
| 4 | +++ src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java (working copy) |
|---|
| 5 | @@ -30,6 +30,7 @@ |
|---|
| 6 | import org.openstreetmap.josm.data.osm.DataSet; |
|---|
| 7 | import org.openstreetmap.josm.data.osm.Node; |
|---|
| 8 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
|---|
| 9 | +import org.openstreetmap.josm.data.osm.OsmUtils; |
|---|
| 10 | import org.openstreetmap.josm.data.osm.Relation; |
|---|
| 11 | import org.openstreetmap.josm.data.osm.RelationMember; |
|---|
| 12 | import org.openstreetmap.josm.data.osm.Way; |
|---|
| 13 | @@ -658,6 +659,7 @@ |
|---|
| 14 | } |
|---|
| 15 | if(!toWay.isFirstLastNode(viaNode)) { |
|---|
| 16 | r.putError(tr("The \"to\" way doesn't start or end at a \"via\" node."), true); |
|---|
| 17 | + return; |
|---|
| 18 | } |
|---|
| 19 | } |
|---|
| 20 | else |
|---|
| 21 | @@ -665,17 +667,40 @@ |
|---|
| 22 | Way viaWay = (Way) via; |
|---|
| 23 | Node firstNode = viaWay.firstNode(); |
|---|
| 24 | Node lastNode = viaWay.lastNode(); |
|---|
| 25 | - if(fromWay.isFirstLastNode(firstNode)) { |
|---|
| 26 | - viaNode = firstNode; |
|---|
| 27 | - } else if(fromWay.isFirstLastNode(lastNode)) { |
|---|
| 28 | - viaNode = firstNode; |
|---|
| 29 | - } else { |
|---|
| 30 | - r.putError(tr("The \"from\" way doesn't start or end at the \"via\" way."), true); |
|---|
| 31 | - return; |
|---|
| 32 | + String oneway = viaWay.get("oneway"); |
|---|
| 33 | + if (oneway == null) { |
|---|
| 34 | + oneway = OsmUtils.falseval; |
|---|
| 35 | + } else if (oneway.equals("-1")) { |
|---|
| 36 | + oneway = OsmUtils.trueval; |
|---|
| 37 | } |
|---|
| 38 | - if(!toWay.isFirstLastNode(viaNode == firstNode ? lastNode : firstNode)) { |
|---|
| 39 | - r.putError(tr("The \"to\" way doesn't start or end at the \"via\" way."), true); |
|---|
| 40 | + if (OsmUtils.getOsmBoolean(oneway)) { |
|---|
| 41 | + if (fromWay.isFirstLastNode(firstNode)) { |
|---|
| 42 | + viaNode = firstNode; |
|---|
| 43 | + } else { |
|---|
| 44 | + r.putError(tr("The \"from\" way doesn't start or end at the \"via\" way."), true); |
|---|
| 45 | + return; |
|---|
| 46 | + } |
|---|
| 47 | + |
|---|
| 48 | + if (!toWay.isFirstLastNode(lastNode)) { |
|---|
| 49 | + r.putError(tr("The \"to\" way doesn't start or end at the \"via\" way."), true); |
|---|
| 50 | + return; |
|---|
| 51 | + } |
|---|
| 52 | + } else { |
|---|
| 53 | + if (fromWay.isFirstLastNode(firstNode)) { |
|---|
| 54 | + viaNode = firstNode; |
|---|
| 55 | + } else if (fromWay.isFirstLastNode(lastNode)) { |
|---|
| 56 | + viaNode = lastNode; |
|---|
| 57 | + } else { |
|---|
| 58 | + r.putError(tr("The \"from\" way doesn't start or end at the \"via\" way."), true); |
|---|
| 59 | + return; |
|---|
| 60 | + } |
|---|
| 61 | + |
|---|
| 62 | + if (!toWay.isFirstLastNode(viaNode == firstNode ? lastNode : firstNode)) { |
|---|
| 63 | + r.putError(tr("The \"to\" way doesn't start or end at the \"via\" way."), true); |
|---|
| 64 | + return; |
|---|
| 65 | + } |
|---|
| 66 | } |
|---|
| 67 | + via = viaNode; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | /* find the "direct" nodes before the via node */ |
|---|