Class PurgeCommand

    • Constructor Detail

      • PurgeCommand

        public PurgeCommand​(DataSet data,
                            java.util.Collection<OsmPrimitive> toPurge,
                            java.util.Collection<OsmPrimitive> makeIncomplete)
        Constructs a new PurgeCommand (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 set
        toPurge - primitives to purge
        makeIncomplete - primitives to make incomplete
        Since:
        11240
    • 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
      • 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 class Command
      • topoSort

        public static java.util.List<OsmPrimitivetopoSort​(java.util.Collection<OsmPrimitive> sel)
        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

        public java.lang.String getDescriptionText()
        Description copied from interface: PseudoCommand
        Provides a description text representing this command.
        Returns:
        description text representing this command
      • getDescriptionIcon

        public javax.swing.Icon getDescriptionIcon()
        Description copied from interface: PseudoCommand
        Provides a descriptive icon of this command.
        Returns:
        descriptive icon of 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
      • build

        public static PurgeCommand build​(java.util.Collection<OsmPrimitive> sel,
                                         java.util.List<OsmPrimitive> toPurgeAdditionally)
        Creates a new PurgeCommand to purge selected OSM primitives.
        Parameters:
        sel - selected OSM primitives
        toPurgeAdditionally - 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