kopia lustrzana https://github.com/JOSM/MapWithAI
FIXUP: Readd the check for whether or not a node pair exists as a segment
Signed-off-by: Taylor Smock <tsmock@fb.com>pull/1/head
rodzic
a142ded362
commit
7cf36357d2
|
@ -11,6 +11,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import org.openstreetmap.josm.command.ChangeCommand;
|
||||
import org.openstreetmap.josm.command.Command;
|
||||
import org.openstreetmap.josm.data.osm.IWaySegment;
|
||||
import org.openstreetmap.josm.data.osm.Node;
|
||||
import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
||||
import org.openstreetmap.josm.data.osm.Way;
|
||||
|
@ -44,6 +45,9 @@ public class AddNodeToWayCommand extends Command {
|
|||
public boolean executeCommand() {
|
||||
int index = Integer.MIN_VALUE;
|
||||
try {
|
||||
// IWaySegment#forNodePair throws an IllegalArgumentException when the node pair
|
||||
// doesn't exist as a segment in the way.
|
||||
IWaySegment.forNodePair(getWay(), getFirstNode(), getSecondNode());
|
||||
index = Math.max(getWay().getNodes().indexOf(getFirstNode()), getWay().getNodes().indexOf(getSecondNode()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
// OK, someone has added a node between the two nodes since calculation
|
||||
|
|
|
@ -126,7 +126,8 @@ public class MapWithAITestRules extends JOSMTestRules {
|
|||
.extensions(new WireMockUrlTransformer()).dynamicPort());
|
||||
wireMock.start();
|
||||
}
|
||||
// Sometimes this is called twice, the second time resetting the config but not resetting the urls.
|
||||
// Sometimes this is called twice, the second time resetting the config but not
|
||||
// resetting the urls.
|
||||
if (wiremock && wireMock != null) {
|
||||
MapPaintUtils.setPaintStyleUrl(replaceUrl(wireMock, MapPaintUtils.getPaintStyleUrl()));
|
||||
// Avoid cases where tests could write the wiremock url to some fields.
|
||||
|
|
Ładowanie…
Reference in New Issue