kopia lustrzana https://github.com/JOSM/MapWithAI
Commands: Override getParticipatingPrimitives for better error reports
Signed-off-by: Taylor Smock <tsmock@fb.com>pull/1/head
rodzic
b5f6eae7f3
commit
2b9c88040c
|
@ -161,6 +161,12 @@ public abstract class AbstractConflationCommand extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
|
||||
// This is used for debugging. Default to anything that might be affected.
|
||||
return Collections.unmodifiableCollection(this.possiblyAffectedPrimitives);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to ensure that something that cannot be undone without errors isn't
|
||||
* undone.
|
||||
|
|
|
@ -94,6 +94,11 @@ public class AddNodeToWayCommand extends Command {
|
|||
modified.addAll(Arrays.asList(getToAddNode(), getWay()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
|
||||
return changeCommand.getParticipatingPrimitives();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the node that will be added to a way
|
||||
*
|
||||
|
|
|
@ -141,6 +141,11 @@ public class CreateConnectionsCommand extends Command {
|
|||
command.fillModifiedData(modified, deleted, added);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
|
||||
return command.getParticipatingPrimitives();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add third-party commands that are run when conflating data.
|
||||
*
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.openstreetmap.josm.command.Command;
|
||||
import org.openstreetmap.josm.command.SequenceCommand;
|
||||
|
@ -152,6 +153,12 @@ public class MapWithAIAddCommand extends Command implements Runnable {
|
|||
modified.addAll(primitives);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
|
||||
return Stream.of(command.getParticipatingPrimitives(), primitives).flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the number of objects added in this command that are not deleted
|
||||
* (may not count significantly modified objects as well).
|
||||
|
|
|
@ -371,4 +371,10 @@ public class MergeDuplicateWays extends Command {
|
|||
currentCommand.fillModifiedData(modified, deleted, added);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
|
||||
return commands.stream().flatMap(currentCommand -> currentCommand.getParticipatingPrimitives().stream())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,4 +178,9 @@ public class MovePrimitiveDataSetCommand extends Command {
|
|||
Collection<OsmPrimitive> added) {
|
||||
command.fillModifiedData(modified, deleted, added);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends OsmPrimitive> getParticipatingPrimitives() {
|
||||
return command.getParticipatingPrimitives();
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue