return edge;
}
@Override
public void propagatePosition() {
final EdgeLocationModel location = (EdgeLocationModel) getModelElement().getLocation();
// search the edge at our position
final Ellipse2D rect = new Ellipse2D.Double(getPosition().getX(), getPosition().getY(), 2*SOME_WEIRD_MAGIC_EPSILON, 2*SOME_WEIRD_MAGIC_EPSILON);
final List<WayView> ways = GraphUtils.getWaysIn(graphController, rect);
EdgeModel foundForwardEdge = null;
EdgeModel foundBackwardEdge = null;
EdgeModel chosenEdge = null;
for (final WayView view : ways) {
final List<EdgeModel> forwardEdges = ((WayView) view).getModelElement().getForwardEdges();
foundForwardEdge = findAffectedEdges(view, forwardEdges);
final List<EdgeModel> backwardEdges = ((WayView) view).getModelElement().getBackwardEdges();
foundBackwardEdge = findAffectedEdges(view, backwardEdges);
}
chosenEdge = foundBackwardEdge;
if (foundBackwardEdge == null) {
if (foundForwardEdge == null){
// no edge found, do nothing
return;
}
chosenEdge = foundForwardEdge;
}
location.resetEdges();
location.addEdge(chosenEdge);
location.setDistance(GlobalPosition.from(getPosition()).distanceTo(chosenEdge.getFromNode().getPosition()));
getModelElement().setLocation(location);
}