Class GpxLayer

    • Constructor Detail

      • GpxLayer

        public GpxLayer​(GpxData d)
        Constructs a new GpxLayer without name.
        Parameters:
        d - GPX data
      • GpxLayer

        public GpxLayer​(GpxData d,
                        java.lang.String name)
        Constructs a new GpxLayer with a given name.
        Parameters:
        d - GPX data
        name - layer name
      • GpxLayer

        public GpxLayer​(GpxData d,
                        java.lang.String name,
                        boolean isLocal)
        Constructs a new GpxLayer with a given name, that can be attached to a local file.
        Parameters:
        d - GPX data
        name - layer name
        isLocal - whether data is attached to a local file
    • Method Detail

      • getColor

        public java.awt.Color getColor()
        Description copied from class: Layer
        Return the current color of the layer
        Overrides:
        getColor in class Layer
        Returns:
        null when not present or not supported
      • setColor

        public void setColor​(java.awt.Color color)
        Description copied from class: Layer
        Sets the color for this layer. Nothing happens if not supported by the layer
        Overrides:
        setColor in class Layer
        Parameters:
        color - the color to be set, null for default
      • hasColor

        public boolean hasColor()
        Description copied from class: Layer
        Determines whether the layer has / can handle colors.
        Overrides:
        hasColor in class Layer
        Returns:
        whether the layer has / can handle colors.
      • getTimespanForTrack

        public static java.lang.String getTimespanForTrack​(IGpxTrack trk)
        Returns a human readable string that shows the timespan of the given track
        Parameters:
        trk - The GPX track for which timespan is displayed
        Returns:
        The timespan as a string
      • getIcon

        public javax.swing.Icon getIcon()
        Description copied from class: Layer
        Return a representative small image for this layer. The image must not be larger than 64 pixel in any dimension.
        Specified by:
        getIcon in class Layer
        Returns:
        layer icon
      • getInfoComponent

        public java.lang.Object getInfoComponent()
        Description copied from class: Layer
        Gets the layer information to display to the user. This is used if the user requests information about this layer. It should display a description of the layer content.
        Specified by:
        getInfoComponent in class Layer
        Returns:
        Either a String or a Component describing the layer.
      • isInfoResizable

        public boolean isInfoResizable()
        Description copied from class: Layer
        Determines if info dialog can be resized (false by default).
        Overrides:
        isInfoResizable in class Layer
        Returns:
        true if the info dialog can be resized, false otherwise
      • getMenuEntries

        public javax.swing.Action[] getMenuEntries()
        Description copied from class: Layer
        Returns list of actions. Action can implement LayerAction interface when it needs to be represented by other menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also have correct equals implementation.

        Use Layer.SeparatorLayerAction.INSTANCE instead of new JSeparator

        Specified by:
        getMenuEntries in class Layer
        Returns:
        menu actions for this layer
      • isLocalFile

        public boolean isLocalFile()
        Determines if data is attached to a local file.
        Returns:
        true if data is attached to a local file, false otherwise
      • getToolTipText

        public java.lang.String getToolTipText()
        Description copied from class: Layer
        Returns a small tooltip hint about some statistics for this layer.
        Specified by:
        getToolTipText in class Layer
        Returns:
        A small tooltip hint about some statistics for this layer.
      • isMergable

        public boolean isMergable​(Layer other)
        Description copied from class: Layer
        Determines if the other layer can be merged into this layer.
        Specified by:
        isMergable in class Layer
        Parameters:
        other - The other layer that is tested to be mergable with this.
        Returns:
        Whether the other layer can be merged into this layer.
      • filterTracksByDate

        public void filterTracksByDate​(java.time.Instant fromDate,
                                       java.time.Instant toDate,
                                       boolean showWithoutDate)
        Shows/hides all tracks of a given date range by setting them to visible/invisible.
        Parameters:
        fromDate - The min date
        toDate - The max date
        showWithoutDate - Include tracks that don't have any date set..
      • mergeFrom

        public void mergeFrom​(Layer from)
        Description copied from class: Layer
        Merges the given layer into this layer. Throws if the layer types are incompatible.
        Specified by:
        mergeFrom in class Layer
        Parameters:
        from - The layer that get merged into this one. After the merge, the other layer is not usable anymore and passing to one others mergeFrom should be one of the last things to do with a layer.
      • mergeFrom

        public void mergeFrom​(GpxLayer from,
                              boolean cutOverlapping,
                              boolean connect)
        Merges the given GpxLayer into this layer and can remove timewise overlapping parts of the given track
        Parameters:
        from - The GpxLayer that gets merged into this one
        cutOverlapping - whether overlapping parts of the given track should be removed
        connect - whether the tracks should be connected on cuts
        Since:
        14338
      • getLabel

        public java.lang.String getLabel()
        Description copied from class: Layer
        Replies a label for this layer useful for UI elements. Defaults to the layer name
        Overrides:
        getLabel in class Layer
        Returns:
        a label for this layer
      • visitBoundingBox

        public void visitBoundingBox​(BoundingXYVisitor v)
        Description copied from class: Layer
        Visits the content bounds of this layer. The behavior of this method depends on the layer, but each implementation should attempt to cover the relevant content of the layer in this method.
        Specified by:
        visitBoundingBox in class Layer
        Parameters:
        v - The visitor that gets notified about the contents of this layer.
      • setAssociatedFile

        public void setAssociatedFile​(java.io.File file)
        Description copied from class: Layer
        Sets the associated file for this layer.

        The associated file might be the one that the user opened.

        Overrides:
        setAssociatedFile in class Layer
        Parameters:
        file - The file, may be null
      • getLinkedMarkerLayer

        public MarkerLayer getLinkedMarkerLayer()
        Returns the linked MarkerLayer.
        Returns:
        the linked MarkerLayer (imported from the same file)
        Since:
        15496
      • setLinkedMarkerLayer

        public void setLinkedMarkerLayer​(MarkerLayer linkedMarkerLayer)
        Sets the linked MarkerLayer.
        Parameters:
        linkedMarkerLayer - the linked MarkerLayer
        Since:
        15496
      • isSavable

        public boolean isSavable()
        Description copied from class: Layer
        Replies the savable state of this layer (i.e., if it can be saved through a "File → Save" dialog).
        Specified by:
        isSavable in interface SaveToFile
        Overrides:
        isSavable in class Layer
        Returns:
        true if this layer can be saved to a file
      • checkSaveConditions

        public boolean checkSaveConditions()
        Description copied from class: Layer
        Checks whether it is ok to launch a save (whether we have data, there is no conflict etc.)
        Overrides:
        checkSaveConditions in class Layer
        Returns:
        true, if it is safe to save.
      • paint

        public void paint​(java.awt.Graphics2D g,
                          MapView mv,
                          Bounds bbox)
        Description copied from interface: MapViewPaintable
        Paint the dataset using the engine set.
        Specified by:
        paint in interface MapViewPaintable
        Parameters:
        g - Graphics
        mv - The object that can translate GeoPoints to screen coordinates.
        bbox - Bounding box
      • requiresSaveToFile

        public boolean requiresSaveToFile()
        Description copied from interface: SaveToFile
        Determines if the data managed by this layer needs to be saved to a file. Only replies true if a file is assigned to this layer and if the data managed by this layer has been modified since the last save operation to the file.
        Specified by:
        requiresSaveToFile in interface SaveToFile
        Overrides:
        requiresSaveToFile in class AbstractModifiableLayer
        Returns:
        true if the data managed by this layer needs to be saved to a file; false, otherwise
      • destroy

        public void destroy()
        Description copied from class: Layer
        Called, when the layer is removed from the mapview and is going to be destroyed.

        This is because the Layer constructor cannot add itself safely as a listener to the layerlist dialog, because there may be no such dialog yet (loaded via command line parameter).

        Specified by:
        destroy in interface Destroyable
        Overrides:
        destroy in class Layer