Class MergeNodesAction

    • Constructor Detail

      • MergeNodesAction

        public MergeNodesAction()
        Constructs a new MergeNodesAction.
    • Method Detail

      • selectTargetLocationNode

        public static Node selectTargetLocationNode​(List<Node> candidates)
        Select the location of the target node after merge.
        Parameters:
        candidates - the collection of candidate nodes
        Returns:
        the coordinates of this node are later used for the target node
      • selectTargetNode

        public static Node selectTargetNode​(Collection<Node> candidates)
        Find which node to merge into (i.e. which one will be left)
        Parameters:
        candidates - the collection of candidate nodes
        Returns:
        the selected target node
      • fixParentWays

        protected static List<CommandfixParentWays​(Collection<Node> nodesToDelete,
                                                     Node targetNode)
        Fixes the parent ways referring to one of the nodes. Replies null, if the ways could not be fixed, i.e. because a way would have to be deleted which is referred to by a relation.
        Parameters:
        nodesToDelete - the collection of nodes to be deleted
        targetNode - the target node the other nodes are merged to
        Returns:
        a list of commands; null, if the ways could not be fixed
      • doMergeNodes

        public static void doMergeNodes​(OsmDataLayer layer,
                                        Collection<Node> nodes,
                                        Node targetLocationNode)
        Merges the nodes in nodes at the specified node's location. Uses the dataset managed by layer as reference.
        Parameters:
        layer - layer the reference data layer. Must not be null
        nodes - the collection of nodes. Ignored if null
        targetLocationNode - this node's location will be used for the target node
        Throws:
        IllegalArgumentException - if layer is null
      • mergeNodes

        public static Command mergeNodes​(Collection<Node> nodes,
                                         Node targetLocationNode)
        Merges the nodes in nodes at the specified node's location.
        Parameters:
        nodes - the collection of nodes. Ignored if null.
        targetLocationNode - this node's location will be used for the targetNode.
        Returns:
        The command necessary to run in order to perform action, or null if there is nothing to do
        Throws:
        IllegalArgumentException - if layer is null
        Since:
        12689
      • mergeNodes

        public static Command mergeNodes​(Collection<Node> nodes,
                                         Node targetNode,
                                         Node targetLocationNode)
        Merges the nodes in nodes onto one of the nodes.
        Parameters:
        nodes - the collection of nodes. Ignored if null.
        targetNode - the target node the collection of nodes is merged to. Must not be null.
        targetLocationNode - this node's location will be used for the targetNode.
        Returns:
        The command necessary to run in order to perform action, or null if there is nothing to do
        Throws:
        IllegalArgumentException - if layer is null