Package org.openstreetmap.josm.command
Class AddPrimitivesCommand
java.lang.Object
org.openstreetmap.josm.command.Command
org.openstreetmap.josm.command.AddPrimitivesCommand
- All Implemented Interfaces:
PseudoCommand
Add primitives to a data layer.
- Since:
- 2305
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.command.Command
Command.OldNodeState -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<OsmPrimitive>private List<PrimitiveData>private List<PrimitiveData>private Collection<PrimitiveData>Fields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE -
Constructor Summary
ConstructorsConstructorDescriptionAddPrimitivesCommand(List<PrimitiveData> data, List<PrimitiveData> toSelect, DataSet ds) Constructs a newAddPrimitivesCommandto add data to the given data set.AddPrimitivesCommand(List<PrimitiveData> data, DataSet ds) Constructs a newAddPrimitivesCommandto add data to the given data set. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanExecutes the command on the dataset.private voidvoidfillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) Fill in the changed data this command operates on.Provides a description text representing this command.Collection<? extends OsmPrimitive>Return the primitives that take part in this command.inthashCode()private voidinit(List<PrimitiveData> data, List<PrimitiveData> toSelect) 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, getDescriptionIcon
-
Field Details
-
primitiveData
-
toSelect
-
preExistingData
-
createdPrimitives
-
-
Constructor Details
-
AddPrimitivesCommand
Constructs a newAddPrimitivesCommandto add data to the given data set.- Parameters:
data- The OSM primitives data to add. Must not benulltoSelect- The OSM primitives to select at the end. Can benullds- The target data set. Must not benull- Since:
- 12718
-
AddPrimitivesCommand
Constructs a newAddPrimitivesCommandto add data to the given data set.- Parameters:
data- The OSM primitives data to add and select. Must not benullds- The target data set. Must not benull- Since:
- 12726
-
-
Method Details
-
init
-
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
-
executeRealCommand
-
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
-
getDescriptionText
Description copied from interface:PseudoCommandProvides a description text representing this command.- Returns:
- description text representing 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
-
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
-
hashCode
-
equals
-