Class SourceInfo<T extends ISourceCategory<?>,​U extends ISourceType<?>,​V extends SourceBounds,​W extends SourcePreferenceEntry<?>>

  • Type Parameters:
    T - The SourceCategory The categories enum for the source
    U - The SourceType The type enum of the source
    V - The SourceBounds The bound type for the entry
    W - The storage for the entry
    All Implemented Interfaces:
    Comparable<SourceInfo<T,​U,​V,​W>>, org.openstreetmap.gui.jmapviewer.interfaces.Attributed
    Direct Known Subclasses:
    ImageryInfo

    public class SourceInfo<T extends ISourceCategory<?>,​U extends ISourceType<?>,​V extends SourceBounds,​W extends SourcePreferenceEntry<?>>
    extends org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
    implements Comparable<SourceInfo<T,​U,​V,​W>>, org.openstreetmap.gui.jmapviewer.interfaces.Attributed
    This class is an abstraction for source information to be used in a panel like ImageryProvidersPanel.
    Since:
    16545
    • Field Detail

      • origName

        protected String origName
        original name of the source entry in case of translation call, for multiple languages English when possible
      • langName

        protected String langName
        (original) language of the translated name entry
      • defaultEntry

        protected boolean defaultEntry
        whether this is a entry activated by default or not
      • eulaAcceptanceRequired

        protected String eulaAcceptanceRequired
        Whether this service requires a explicit EULA acceptance before it can be activated
      • bounds

        protected V extends SourceBounds bounds
        display bounds of imagery, displayed in prefs and used for automatic imagery selection
      • description

        protected String description
        description of the imagery entry, should contain notes what type of data it is
      • attributionText

        protected String attributionText
        Text of a text attribution displayed when using the imagery
      • attributionLinkURL

        protected String attributionLinkURL
        Link behind the text attribution displayed when using the imagery
      • attributionImage

        protected String attributionImage
        Image of a graphical attribution displayed when using the imagery
      • attributionImageURL

        protected String attributionImageURL
        Link behind the graphical attribution displayed when using the imagery
      • termsOfUseText

        protected String termsOfUseText
        Text with usage terms displayed when using the imagery
      • termsOfUseURL

        protected String termsOfUseURL
        Link behind the text with usage terms displayed when using the imagery
      • countryCode

        protected String countryCode
        country code of the imagery (for country specific imagery)
      • date

        protected String date
        creation date of the source (in the form YYYY-MM-DD;YYYY-MM-DD, where DD and MM as well as a second date are optional). Also used as time filter for WMS time={time} parameter (such as Sentinel-2)
        Since:
        11570
      • oldIds

        protected Collection<String> oldIds
        list of old IDs, only for loading, not handled anywhere else
        Since:
        13536
      • categoryOriginalString

        protected String categoryOriginalString
        category of the imagery (input string, not saved, copied or used otherwise except for error checks)
    • Constructor Detail

      • SourceInfo

        public SourceInfo()
        Creates empty SourceInfo class
      • SourceInfo

        public SourceInfo​(String name)
        Create a SourceInfo class
        Parameters:
        name - name
      • SourceInfo

        public SourceInfo​(String name,
                          String url,
                          String id)
        Create a SourceInfo class
        Parameters:
        name - name
        url - base URL
        id - unique id
    • Method Detail

      • equalsPref

        public boolean equalsPref​(SourceInfo<T,​U,​V,​W> other)
        Check if this object equals another SourceInfo with respect to the properties that get written to the preference file. This should be overridden and called in subclasses.
        Parameters:
        other - the SourceInfo object to compare to
        Returns:
        true if they are equal
      • getLocalizedCountry

        public static String getLocalizedCountry​(String countryCode)
        Returns a localized name for the given country code, or "Worldwide" if empty. This function falls back on the English name, and uses the ISO code as a last-resortvalue.
        Parameters:
        countryCode - An ISO 3166 alpha-2 country code or a UN M.49 numeric-3 area code
        Returns:
        The name of the country appropriate to the current locale.
        Since:
        15158
        See Also:
        Locale.getDisplayCountry()
      • equalsBaseValues

        public boolean equalsBaseValues​(SourceInfo<T,​U,​V,​W> in)
        Determines if URL is equal to given source info.
        Parameters:
        in - source info
        Returns:
        true if URL is equal to given source info
      • setBounds

        public void setBounds​(V b)
        Sets the source polygonal bounds.
        Parameters:
        b - The source bounds (non-rectangular)
      • getBounds

        public V getBounds()
        Returns the source polygonal bounds.
        Returns:
        The source bounds (non-rectangular)
      • requiresAttribution

        public boolean requiresAttribution()
        Specified by:
        requiresAttribution in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getAttributionText

        public String getAttributionText​(int zoom,
                                         org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate topLeft,
                                         org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate botRight)
        Specified by:
        getAttributionText in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getAttributionLinkURL

        public String getAttributionLinkURL()
        Specified by:
        getAttributionLinkURL in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getAttributionImage

        public Image getAttributionImage()
        Specified by:
        getAttributionImage in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getAttributionImageRaw

        public String getAttributionImageRaw()
        Return the raw attribution logo information (an URL to the image).
        Returns:
        The url text
        Since:
        12257
      • getAttributionImageURL

        public String getAttributionImageURL()
        Specified by:
        getAttributionImageURL in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getTermsOfUseText

        public String getTermsOfUseText()
        Specified by:
        getTermsOfUseText in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getTermsOfUseURL

        public String getTermsOfUseURL()
        Specified by:
        getTermsOfUseURL in interface org.openstreetmap.gui.jmapviewer.interfaces.Attributed
      • getOriginalName

        public String getOriginalName()
        Returns the entry name.
        Returns:
        The entry name
        Since:
        6968
      • setName

        public void setName​(String language,
                            String name)
        Sets the entry name and handle translation.
        Parameters:
        language - The used language
        name - The entry name
        Since:
        8091
      • clearId

        public void clearId()
        Store the id of this info to the preferences and clear it afterwards.
      • isDefaultEntry

        public boolean isDefaultEntry()
        Determines if this entry is enabled by default.
        Returns:
        true if this entry is enabled by default, false otherwise
      • setDefaultEntry

        public void setDefaultEntry​(boolean defaultEntry)
        Sets the default state of this entry.
        Parameters:
        defaultEntry - true if this entry has to be enabled by default, false otherwise
      • getDescription

        public String getDescription()
        Returns the description text when existing.
        Returns:
        The description
        Since:
        8065
      • setDescription

        public void setDescription​(String language,
                                   String description)
        Sets the description text when existing.
        Parameters:
        language - The used language
        description - the imagery description text
        Since:
        8091
      • getActiveIds

        public static <W extends SourceInfo<?,​?,​?,​?>> Collection<StringgetActiveIds​(Class<W> clazz)
        Return the sorted list of activated source IDs.
        Type Parameters:
        W - The type of active id to get
        Parameters:
        clazz - The class of the type of id
        Returns:
        sorted list of activated source IDs
        Since:
        13536, 16545 (extracted)
      • getToolTipText

        public String getToolTipText()
        Returns a tool tip text for display.
        Returns:
        The text
        Since:
        8065
      • getEulaAcceptanceRequired

        public String getEulaAcceptanceRequired()
        Returns the EULA acceptance URL, if any.
        Returns:
        The URL to an EULA text that has to be accepted before use, or null
      • setEulaAcceptanceRequired

        public void setEulaAcceptanceRequired​(String eulaAcceptanceRequired)
        Sets the EULA acceptance URL.
        Parameters:
        eulaAcceptanceRequired - The URL to an EULA text that has to be accepted before use
      • getCountryCode

        public String getCountryCode()
        Returns the ISO 3166-1-alpha-2 country code.
        Returns:
        The country code (2 letters)
      • setCountryCode

        public void setCountryCode​(String countryCode)
        Sets the ISO 3166-1-alpha-2 country code.
        Parameters:
        countryCode - The country code (2 letters)
      • getDate

        public String getDate()
        Returns the date information.
        Returns:
        The date (in the form YYYY-MM-DD;YYYY-MM-DD, where DD and MM as well as a second date are optional)
        Since:
        11570
      • setDate

        public void setDate​(String date)
        Sets the date information.
        Parameters:
        date - The date information
        Since:
        11570
      • getIcon

        public String getIcon()
        Returns the entry icon.
        Returns:
        The entry icon
      • setIcon

        public void setIcon​(String icon)
        Sets the entry icon.
        Parameters:
        icon - The entry icon
      • hasAttribution

        public boolean hasAttribution()
        Determines if this entry requires attribution.
        Returns:
        true if some attribution text has to be displayed, false otherwise
      • copyAttribution

        public void copyAttribution​(SourceInfo<T,​U,​V,​W> i)
        Copies attribution from another SourceInfo.
        Parameters:
        i - The other source info to get attribution from
      • setAttribution

        public void setAttribution​(org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource s)
        Applies the attribution from this object to a tile source.
        Parameters:
        s - The tile source
      • getSourceType

        public U getSourceType()
        Returns the source type.
        Returns:
        The source type
      • setSourceType

        public void setSourceType​(U imageryType)
        Sets the source type.
        Parameters:
        imageryType - The source type
      • getSourceCategory

        public T getSourceCategory()
        Returns the source category.
        Returns:
        The source category
      • setSourceCategory

        public void setSourceCategory​(T category)
        Sets the source category.
        Parameters:
        category - The source category
      • getSourceCategoryOriginalString

        public String getSourceCategoryOriginalString()
        Returns the source category original string (don't use except for error checks).
        Returns:
        The source category original string
      • setSourceCategoryOriginalString

        public void setSourceCategoryOriginalString​(String categoryOriginalString)
        Sets the source category original string (don't use except for error checks).
        Parameters:
        categoryOriginalString - The source category original string
      • isBlacklisted

        public boolean isBlacklisted()
        Returns true if this layer's URL is matched by one of the regular expressions kept by the current OsmApi instance.
        Returns:
        true is this entry is blacklisted, false otherwise
      • setNoTileHeaders

        public void setNoTileHeaders​(MultiMap<String,​String> noTileHeaders)
        Sets the map of <header name, header value> that if any of this header will be returned, then this tile will be treated as "no tile at this zoom level"
        Parameters:
        noTileHeaders - Map of <header name, header value> which will be treated as "no tile at this zoom level"
        Since:
        9613
      • getNoTileHeaders

        public Map<String,​Set<String>> getNoTileHeaders()
        Overrides:
        getNoTileHeaders in class org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
      • setNoTileChecksums

        public void setNoTileChecksums​(MultiMap<String,​String> noTileChecksums)
        Sets the map of <checksum type, checksum value> that if any tile with that checksum will be returned, then this tile will be treated as "no tile at this zoom level"
        Parameters:
        noTileChecksums - Map of <checksum type, checksum value> which will be treated as "no tile at this zoom level"
        Since:
        9613
      • setMetadataHeaders

        public void setMetadataHeaders​(Map<String,​String> metadataHeaders)
        Returns the map of <header name, metadata key> indicating, which HTTP headers should be moved to metadata
        Parameters:
        metadataHeaders - map of <header name, metadata key> indicating, which HTTP headers should be moved to metadata
        Since:
        8418
      • addOldId

        public void addOldId​(String id)
        Adds an old Id.
        Parameters:
        id - the Id to be added
        Since:
        13536
      • getDefaultLayers

        public List<DefaultLayergetDefaultLayers()
        Returns default layers that should be shown for this Imagery (if at all supported by imagery provider) If no layer is set to default and there is more than one imagery available, then user will be asked to choose the layer to work on
        Returns:
        Collection of the layer names
      • setDefaultLayers

        public void setDefaultLayers​(List<DefaultLayer> layers)
        Sets the default layers that user will work with
        Parameters:
        layers - set the list of default layers
      • getCustomHttpHeaders

        public Map<String,​StringgetCustomHttpHeaders()
        Returns custom HTTP headers that should be sent with request towards imagery provider
        Returns:
        headers
      • setCustomHttpHeaders

        public void setCustomHttpHeaders​(Map<String,​String> customHttpHeaders)
        Sets custom HTTP headers that should be sent with request towards imagery provider
        Parameters:
        customHttpHeaders - http headers