Package org.openstreetmap.josm.command
Class AddPrimitivesCommand
- java.lang.Object
-
- org.openstreetmap.josm.command.Command
-
- org.openstreetmap.josm.command.AddPrimitivesCommand
-
- All Implemented Interfaces:
PseudoCommand
public class AddPrimitivesCommand extends Command
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
Fields Modifier and Type Field Description private java.util.List<OsmPrimitive>
createdPrimitives
private java.util.List<PrimitiveData>
preExistingData
private java.util.List<PrimitiveData>
primitiveData
private java.util.Collection<PrimitiveData>
toSelect
-
Fields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE
-
-
Constructor Summary
Constructors Constructor Description AddPrimitivesCommand(java.util.List<PrimitiveData> data, java.util.List<PrimitiveData> toSelect, DataSet ds)
Constructs a newAddPrimitivesCommand
to add data to the given data set.AddPrimitivesCommand(java.util.List<PrimitiveData> data, DataSet ds)
Constructs a newAddPrimitivesCommand
to add data to the given data set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
boolean
executeCommand()
Executes the command on the dataset.private void
executeRealCommand(DataSet ds)
void
fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
Fill in the changed data this command operates on.java.lang.String
getDescriptionText()
Provides a description text representing this command.java.util.Collection<? extends OsmPrimitive>
getParticipatingPrimitives()
Return the primitives that take part in this command.int
hashCode()
private void
init(java.util.List<PrimitiveData> data, java.util.List<PrimitiveData> toSelect)
void
undoCommand()
Undoes the command.-
Methods inherited from class org.openstreetmap.josm.command.Command
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrig
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.command.PseudoCommand
getChildren, getDescriptionIcon
-
-
-
-
Field Detail
-
primitiveData
private java.util.List<PrimitiveData> primitiveData
-
toSelect
private java.util.Collection<PrimitiveData> toSelect
-
preExistingData
private java.util.List<PrimitiveData> preExistingData
-
createdPrimitives
private java.util.List<OsmPrimitive> createdPrimitives
-
-
Constructor Detail
-
AddPrimitivesCommand
public AddPrimitivesCommand(java.util.List<PrimitiveData> data, java.util.List<PrimitiveData> toSelect, DataSet ds)
Constructs a newAddPrimitivesCommand
to add data to the given data set.- Parameters:
data
- The OSM primitives data to add. Must not benull
toSelect
- The OSM primitives to select at the end. Can benull
ds
- The target data set. Must not benull
- Since:
- 12718
-
AddPrimitivesCommand
public AddPrimitivesCommand(java.util.List<PrimitiveData> data, DataSet ds)
Constructs a newAddPrimitivesCommand
to add data to the given data set.- Parameters:
data
- The OSM primitives data to add and select. Must not benull
ds
- The target data set. Must not benull
- Since:
- 12726
-
-
Method Detail
-
init
private void init(java.util.List<PrimitiveData> data, java.util.List<PrimitiveData> toSelect)
-
executeCommand
public boolean executeCommand()
Description copied from class:Command
Executes 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:
executeCommand
in classCommand
- Returns:
- true
-
executeRealCommand
private void executeRealCommand(DataSet ds)
-
undoCommand
public void undoCommand()
Description copied from class:Command
Undoes 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:
undoCommand
in classCommand
-
getDescriptionText
public java.lang.String getDescriptionText()
Description copied from interface:PseudoCommand
Provides a description text representing this command.- Returns:
- description text representing this command
-
fillModifiedData
public void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
Description copied from class:Command
Fill in the changed data this command operates on. Add to the lists, don't clear them.- Specified by:
fillModifiedData
in classCommand
- Parameters:
modified
- The modified primitivesdeleted
- The deleted primitivesadded
- The added primitives
-
getParticipatingPrimitives
public java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
Description copied from class:Command
Return the primitives that take part in this command. The collection is computed during execution.- Specified by:
getParticipatingPrimitives
in interfacePseudoCommand
- Overrides:
getParticipatingPrimitives
in classCommand
- Returns:
- primitives that take part in this command
-
-