Package org.openstreetmap.josm.command
Class PurgeCommand
java.lang.Object
org.openstreetmap.josm.command.Command
org.openstreetmap.josm.command.PurgeCommand
- All Implemented Interfaces:
PseudoCommand
Command, to purge a list of primitives.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.command.Command
Command.OldNodeState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Storage<PrimitiveData>protected Map<PrimitiveId,PrimitiveData> protected final ConflictCollectionprotected List<OsmPrimitive>Fields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE -
Constructor Summary
ConstructorsConstructorDescriptionPurgeCommand(DataSet data, Collection<OsmPrimitive> toPurge, Collection<OsmPrimitive> makeIncomplete) Constructs a newPurgeCommand(does not handle conflicts). -
Method Summary
Modifier and TypeMethodDescriptionstatic PurgeCommandbuild(Collection<OsmPrimitive> sel, List<OsmPrimitive> toPurgeAdditionally) Creates a newPurgeCommandto purge selected OSM primitives.booleanbooleanExecutes the command on the dataset.voidfillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) Fill in the changed data this command operates on.Provides a descriptive icon of this command.Provides a description text representing this command.Collection<? extends OsmPrimitive>Return the primitives that take part in this command.inthashCode()private static booleanhasOnlyIncompleteMembers(Relation r, Collection<OsmPrimitive> toPurge, Collection<? extends OsmPrimitive> moreToPurge) private voidinit(Collection<OsmPrimitive> toPurge, Collection<OsmPrimitive> makeIncomplete) protected final voidsaveIncomplete(Collection<OsmPrimitive> makeIncomplete) static List<OsmPrimitive>topoSort(Collection<OsmPrimitive> sel) Sorts a collection of primitives such that for each object its referrers come later in the sorted collection.voidUndoes the command.Methods inherited from class org.openstreetmap.josm.command.Command
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrigMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.command.PseudoCommand
getChildren
-
Field Details
-
toPurge
-
makeIncompleteData
-
makeIncompleteDataByPrimId
-
purgedConflicts
-
-
Constructor Details
-
PurgeCommand
public PurgeCommand(DataSet data, Collection<OsmPrimitive> toPurge, Collection<OsmPrimitive> makeIncomplete) Constructs a newPurgeCommand(does not handle conflicts). This command relies on a number of consistency conditions: - makeIncomplete must be a subset of toPurge. - Each primitive, that is in toPurge but not in makeIncomplete, must have all its referrers in toPurge. - Each element of makeIncomplete must not be new and must have only referrers that are either a relation or included in toPurge.- Parameters:
data- OSM data settoPurge- primitives to purgemakeIncomplete- primitives to make incomplete- Since:
- 11240
-
-
Method Details
-
init
-
saveIncomplete
-
executeCommand
Description copied from class:CommandExecutes the command on the dataset. This implementation will remember all primitives returned by fillModifiedData for restoring them on undo.The layer should be invalidated after execution so that it can be re-painted.
- Overrides:
executeCommandin classCommand- Returns:
- true
-
undoCommand
Description copied from class:CommandUndoes the command. It can be assumed that all objects are in the same state they were before. It can also be assumed that executeCommand was called exactly once before. This implementation undoes all objects stored by a former call to executeCommand.- Overrides:
undoCommandin classCommand
-
topoSort
Sorts a collection of primitives such that for each object its referrers come later in the sorted collection.- Parameters:
sel- collection of primitives to sort- Returns:
- sorted list
-
getDescriptionText
Description copied from interface:PseudoCommandProvides a description text representing this command.- Returns:
- description text representing this command
-
getDescriptionIcon
Description copied from interface:PseudoCommandProvides a descriptive icon of this command.- Returns:
- descriptive icon of this command
-
getParticipatingPrimitives
Description copied from class:CommandReturn the primitives that take part in this command. The collection is computed during execution.- Specified by:
getParticipatingPrimitivesin interfacePseudoCommand- Overrides:
getParticipatingPrimitivesin classCommand- Returns:
- primitives that take part in this command
-
fillModifiedData
public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) Description copied from class:CommandFill in the changed data this command operates on. Add to the lists, don't clear them.- Specified by:
fillModifiedDatain classCommand- Parameters:
modified- The modified primitivesdeleted- The deleted primitivesadded- The added primitives
-
hashCode
-
equals
-
build
public static PurgeCommand build(Collection<OsmPrimitive> sel, List<OsmPrimitive> toPurgeAdditionally) Creates a newPurgeCommandto purge selected OSM primitives.- Parameters:
sel- selected OSM primitivestoPurgeAdditionally- optional list that will be filled with primitives to be purged that have not been in the selection- Returns:
- command to purge selected OSM primitives
- Since:
- 12718
-
hasOnlyIncompleteMembers
private static boolean hasOnlyIncompleteMembers(Relation r, Collection<OsmPrimitive> toPurge, Collection<? extends OsmPrimitive> moreToPurge)
-