Class SplitMode

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, PreferenceChangedListener, Destroyable

    public class SplitMode
    extends MapMode
    Map mode for splitting ways.
    Since:
    18759
    See Also:
    Serialized Form
    • Constructor Detail

      • SplitMode

        public SplitMode()
        Construct a new SplitMode object
    • Method Detail

      • layerIsSupported

        public boolean layerIsSupported​(Layer l)
        Description copied from class: MapMode
        Determines if layer l is supported by this map mode. By default, all tools will work with all layers. Can be overwritten to require a special type of layer
        Overrides:
        layerIsSupported in class MapMode
        Parameters:
        l - layer
        Returns:
        true if the layer is supported by this map mode
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
        Overrides:
        mousePressed in class MapMode
      • addNodeAndSplit

        private void addNodeAndSplit​(MapView mv,
                                     java.awt.Point mousePos,
                                     Way way)
        Add a node to a way and then split it
        Parameters:
        mv - The current mapview
        mousePos - The mouse position
        way - The nearest way
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent e)
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
        Overrides:
        mouseMoved in class MapMode
      • getModeHelpText

        public java.lang.String getModeHelpText()
        Description copied from class: MapMode
        Returns a short translated help message describing how this map mode can be used, to be displayed in status line.
        Overrides:
        getModeHelpText in class MapMode
        Returns:
        a short translated help message describing how this map mode can be used
      • getApplicableWays

        private static java.util.List<WaygetApplicableWays​(Node n,
                                                             java.util.Collection<Way> preferredWays)
        Get a list of potential ways to be split for a given node
        Parameters:
        n - The node at which ways should be split
        preferredWays - List of ways that should be prioritized over others. If one or more potential preferred ways are found, other ways are disregarded.
        Returns:
        List of potential ways to be split
      • createPopup

        private javax.swing.JPopupMenu createPopup​(Node n,
                                                   java.util.Collection<Way> applicableWays)
        Create a new split way selection popup
        Parameters:
        n - Node at which ways should be split
        applicableWays - Potential split ways to select from
        Returns:
        A new popup object
      • updateUserFeedback

        private boolean updateUserFeedback​(java.awt.event.MouseEvent e)
        Determine objects to highlight and update highlight
        Parameters:
        e - MouseEvent that triggered the update
        Returns:
        true if repaint is required
      • removeHighlighting

        private boolean removeHighlighting()
        Removes all existing highlights.
        Returns:
        true if a repaint is required
      • addHoverHighlightListener

        private void addHoverHighlightListener​(java.awt.Component c,
                                               java.util.Collection<OsmPrimitive> prims)
        Add a mouse listener to the component c which highlights prims when the mouse pointer is hovering over the component
        Parameters:
        c - The component to add the hover mouse listener to
        prims - The primitives to highlight when the component is hovered