Class GpxImageEntry

    • Field Detail

      • file

        private java.io.File file
      • exifTime

        private java.time.Instant exifTime
      • isNewGpsData

        private boolean isNewGpsData
        Flag isNewGpsData indicates that the GPS data of the image is new or has changed. GPS data includes the position, speed, elevation, time (e.g. as extracted from the GPS track). The flag can used to decide for which image file the EXIF GPS data is (re-)written.
      • exifGpsTime

        private java.time.Instant exifGpsTime
        Temporary source of GPS time if not correlated with GPX track.
      • iptcKeywords

        private java.util.List<java.lang.String> iptcKeywords
      • pos

        private CachedLatLon pos
        The following values are computed from the correlation with the gpx track or extracted from the image EXIF data.
      • speed

        private java.lang.Double speed
        Speed in kilometer per hour
      • elevation

        private java.lang.Double elevation
        Elevation (altitude) in meters
      • gpsTime

        private java.time.Instant gpsTime
        The time after correlation with a gpx track
      • width

        private int width
      • tmp

        private GpxImageEntry tmp
        When the correlation dialog is open, we like to show the image position for the current time offset on the map in real time. On the other hand, when the user aborts this operation, the old values should be restored. We have a temporary copy, that overrides the normal values if it is not null. (This may be not the most elegant solution for this, but it works.)
    • Constructor Detail

      • GpxImageEntry

        public GpxImageEntry()
        Constructs a new GpxImageEntry.
      • GpxImageEntry

        public GpxImageEntry​(GpxImageEntry other)
        Constructs a new GpxImageEntry from an existing instance.
        Parameters:
        other - existing instance
        Since:
        14624
      • GpxImageEntry

        public GpxImageEntry​(java.io.File file)
        Constructs a new GpxImageEntry.
        Parameters:
        file - Path to image file on disk
    • Method Detail

      • getWidth

        public int getWidth()
        Returns width of the image this GpxImageEntry represents.
        Specified by:
        getWidth in interface ImageMetadata
        Returns:
        width of the image this GpxImageEntry represents
        Since:
        13220
      • getHeight

        public int getHeight()
        Returns height of the image this GpxImageEntry represents.
        Specified by:
        getHeight in interface ImageMetadata
        Returns:
        height of the image this GpxImageEntry represents
        Since:
        13220
      • getPos

        public CachedLatLon getPos()
        Returns the position value. The position value from the temporary copy is returned if that copy exists.
        Specified by:
        getPos in interface ImageMetadata
        Returns:
        the position value
      • getSpeed

        public java.lang.Double getSpeed()
        Returns the speed value. The speed value from the temporary copy is returned if that copy exists.
        Specified by:
        getSpeed in interface ImageMetadata
        Returns:
        the speed value
      • getElevation

        public java.lang.Double getElevation()
        Returns the elevation value. The elevation value from the temporary copy is returned if that copy exists.
        Specified by:
        getElevation in interface ImageMetadata
        Returns:
        the elevation value
      • getGpsTime

        @Deprecated
        public java.util.Date getGpsTime()
        Deprecated.
        Returns the GPS time value. The GPS time value from the temporary copy is returned if that copy exists.
        Returns:
        the GPS time value
      • getGpsInstant

        public java.time.Instant getGpsInstant()
        Returns the GPS time value. The GPS time value from the temporary copy is returned if that copy exists.
        Specified by:
        getGpsInstant in interface ImageMetadata
        Returns:
        the GPS time value
      • hasGpsTime

        public boolean hasGpsTime()
        Convenient way to determine if this entry has a GPS time, without the cost of building a defensive copy.
        Specified by:
        hasGpsTime in interface ImageMetadata
        Returns:
        true if this entry has a GPS time
        Since:
        6450
      • getFile

        public java.io.File getFile()
        Returns associated file.
        Returns:
        associated file
      • hasExifTime

        public boolean hasExifTime()
        Convenient way to determine if this entry has a EXIF time, without the cost of building a defensive copy.
        Specified by:
        hasExifTime in interface ImageMetadata
        Returns:
        true if this entry has a EXIF time
        Since:
        6450
      • getExifGpsTime

        @Deprecated
        public java.util.Date getExifGpsTime()
        Deprecated.
        Returns the EXIF GPS time.
        Returns:
        the EXIF GPS time
        Since:
        6392
      • hasExifGpsTime

        public boolean hasExifGpsTime()
        Convenient way to determine if this entry has a EXIF GPS time, without the cost of building a defensive copy.
        Specified by:
        hasExifGpsTime in interface ImageMetadata
        Returns:
        true if this entry has a EXIF GPS time
        Since:
        6450
      • getDefensiveDate

        private static java.util.Date getDefensiveDate​(java.time.Instant date)
      • setWidth

        public void setWidth​(int width)
        Sets the width of this GpxImageEntry.
        Specified by:
        setWidth in interface ImageMetadata
        Parameters:
        width - set the width of this GpxImageEntry
        Since:
        13220
      • setHeight

        public void setHeight​(int height)
        Sets the height of this GpxImageEntry.
        Specified by:
        setHeight in interface ImageMetadata
        Parameters:
        height - set the height of this GpxImageEntry
        Since:
        13220
      • setPos

        public void setPos​(CachedLatLon pos)
        Sets the position.
        Parameters:
        pos - cached position
      • setPos

        public void setPos​(LatLon pos)
        Sets the position.
        Parameters:
        pos - position (will be cached)
      • setSpeed

        public void setSpeed​(java.lang.Double speed)
        Sets the speed.
        Specified by:
        setSpeed in interface ImageMetadata
        Parameters:
        speed - speed
      • setFile

        public void setFile​(java.io.File file)
        Sets associated file.
        Parameters:
        file - associated file
      • setExifTime

        public void setExifTime​(java.time.Instant exifTime)
        Sets EXIF time.
        Specified by:
        setExifTime in interface ImageMetadata
        Parameters:
        exifTime - EXIF time
        Since:
        17715
      • setExifGpsTime

        public void setExifGpsTime​(java.time.Instant exifGpsTime)
        Sets the EXIF GPS time.
        Specified by:
        setExifGpsTime in interface ImageMetadata
        Parameters:
        exifGpsTime - the EXIF GPS time
        Since:
        17715
      • setGpsTime

        public void setGpsTime​(java.time.Instant gpsTime)
        Sets the GPS time.
        Specified by:
        setGpsTime in interface ImageMetadata
        Parameters:
        gpsTime - the GPS time
        Since:
        17715
      • setIptcCaption

        public void setIptcCaption​(java.lang.String iptcCaption)
        Sets the IPTC caption.
        Specified by:
        setIptcCaption in interface ImageMetadata
        Parameters:
        iptcCaption - the IPTC caption
        Since:
        15219
      • setIptcHeadline

        public void setIptcHeadline​(java.lang.String iptcHeadline)
        Sets the IPTC headline.
        Specified by:
        setIptcHeadline in interface ImageMetadata
        Parameters:
        iptcHeadline - the IPTC headline
        Since:
        15219
      • setIptcKeywords

        public void setIptcKeywords​(java.util.List<java.lang.String> iptcKeywords)
        Sets the IPTC keywords.
        Specified by:
        setIptcKeywords in interface ImageMetadata
        Parameters:
        iptcKeywords - the IPTC keywords
        Since:
        15219
      • setIptcObjectName

        public void setIptcObjectName​(java.lang.String iptcObjectName)
        Sets the IPTC object name.
        Specified by:
        setIptcObjectName in interface ImageMetadata
        Parameters:
        iptcObjectName - the IPTC object name
        Since:
        15219
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

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

        public GpxImageEntry getTmp()
        Get temporary variable that is used for real time parameter adjustments. The temporary variable is created if it does not exist yet. Use applyTmp() or discardTmp() if the temporary variable is not needed anymore.
        Returns:
        temporary variable
      • applyTmp

        public void applyTmp()
        Copy the values from the temporary variable to the main instance. The temporary variable is deleted.
        See Also:
        discardTmp()
      • discardTmp

        public void discardTmp()
        Delete the temporary variable. Temporary modifications are lost.
        See Also:
        applyTmp()
      • isTagged

        public boolean isTagged()
        If it has been tagged i.e. matched to a gpx track or retrieved lat/lon from exif
        Returns:
        true if it has been tagged
      • toString

        public java.lang.String toString()
        String representation. (only partial info)
        Overrides:
        toString in class java.lang.Object
      • flagNewGpsData

        public void flagNewGpsData()
        Indicates that the image has new GPS data. That flag is set by new GPS data providers. It is used e.g. by the photo_geotagging plugin to decide for which image file the EXIF GPS data needs to be (re-)written.
        Since:
        6392
      • tmpUpdated

        protected void tmpUpdated()
        Indicate that the temporary copy has been updated. Mostly used to prevent UI issues. By default, this is a no-op. Override when needed in subclasses.
        Since:
        17579
      • unflagNewGpsData

        public void unflagNewGpsData()
        Remove the flag that indicates new GPS data. The flag is cleared by a new GPS data consumer.
      • hasNewGpsData

        public boolean hasNewGpsData()
        Queries whether the GPS data changed. The flag value from the temporary copy is returned if that copy exists.
        Returns:
        true if GPS data changed, false otherwise
        Since:
        6392
      • extractExif

        public void extractExif()
        Extract GPS metadata from image EXIF. Has no effect if the image file is not set If successful, fills in the LatLon, speed, elevation, image direction, and other attributes
        Specified by:
        extractExif in interface ImageMetadata
        Since:
        9270
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Description copied from interface: ImageMetadata
        Get the image input stream
        Specified by:
        getInputStream in interface ImageMetadata
        Returns:
        The input stream of the image
        Throws:
        java.io.IOException - If something happens during image read. See implementation for details.
      • read

        public java.awt.image.BufferedImage read​(java.awt.Dimension target)
                                          throws java.io.IOException
        Reads the image represented by this entry in the given target dimension.
        Parameters:
        target - the desired dimension used for subsampling or null
        Returns:
        the read image, or null
        Throws:
        java.io.IOException - if any I/O error occurs
        Since:
        18246
      • asWayPoint

        public WayPoint asWayPoint()
        Returns a WayPoint representation of this GPX image entry.
        Returns:
        a WayPoint representation of this GPX image entry (containing position, instant and elevation)
        Since:
        18065