Class ChangeMembersCommand

  • All Implemented Interfaces:
    PseudoCommand

    public class ChangeMembersCommand
    extends Command
    Command that changes the members of a relation. The same can be done with ChangeCommand, but this is more efficient.
    Since:
    17199
    • Constructor Detail

      • ChangeMembersCommand

        public ChangeMembersCommand​(DataSet data,
                                    Relation relation,
                                    java.util.List<RelationMember> newMembers)
        Constructs a new ChangeMembersCommand in the context of a given data set.
        Parameters:
        data - the data set. Must not be null.
        relation - the relation
        newMembers - the new member list, must not be empty
      • ChangeMembersCommand

        public ChangeMembersCommand​(Relation relation,
                                    java.util.List<RelationMember> newMembers)
        Constructs a new ChangeMembersCommand in the context of r data set.
        Parameters:
        relation - the relation. It must belong to a data set
        newMembers - the new member list, must not be empty
    • Method Detail

      • 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 class Command
        Returns:
        true
      • 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 class Command
        Parameters:
        modified - The modified primitives
        deleted - The deleted primitives
        added - The added primitives
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Command