else
via = w;
} else
r.putError(tr("Unknown role ''{0}''.", m.role), true);
} else if (m.member instanceof Node) {
Node n = (Node) m.member;
if ("via".equals(m.role)) {
if (via != null)
r
.putError(
tr("More than one \"via\" found."),
true);
else
via = n;
} else
r.putError(tr("Unknown role ''{0}''.", m.role), true);
} else
r.putError(tr("Unknown member type for ''{0}''.", m.member
.getName()), true);
}
}
if (fromWay == null) {
r.putError(tr("No \"from\" way found."), true);
return;
}
if (toWay == null) {
r.putError(tr("No \"to\" way found."), true);
return;
}
if (via == null) {
r.putError(tr("No \"via\" node or way found."), true);
return;
}
Node viaNode;
if (via instanceof Node) {
viaNode = (Node) via;
if (!fromWay.isFirstLastNode(viaNode)) {
r
.putError(
tr("The \"from\" way doesn't start or end at a \"via\" node."),
true);
return;
}
if (!toWay.isFirstLastNode(viaNode))
r
.putError(
tr("The \"to\" way doesn't start or end at a \"via\" node."),
true);
} else {
Way viaWay = (Way) via;
Node firstNode = viaWay.firstNode();
Node lastNode = viaWay.lastNode();
if (fromWay.isFirstLastNode(firstNode))
viaNode = firstNode;
else if (fromWay.isFirstLastNode(lastNode))
viaNode = firstNode;
else {
r
.putError(
tr("The \"from\" way doesn't start or end at the \"via\" way."),
true);
return;
}
if (!toWay.isFirstLastNode(viaNode == firstNode ? lastNode
: firstNode))
r
.putError(
tr("The \"to\" way doesn't start or end at the \"via\" way."),
true);
}
/* find the "direct" nodes before the via node */
Node fromNode = null;
if (fromWay.firstNode() == via) {
// System.out.println("From way heading away from via");
fromNode = fromWay.nodes.get(1);
} else {
// System.out.println("From way heading towards via");
fromNode = fromWay.nodes.get(fromWay.nodes.size() - 2);
}
Point pFrom = nc.getPoint(fromNode.getEastNorth());
Point pVia = nc.getPoint(viaNode.getEastNorth());
// if(restrictionDebug) {
/* find the "direct" node after the via node */
// Node toNode = null;