Class SourceInfo<T extends ISourceCategory<?>,U extends ISourceType<?>,V extends SourceBounds,W extends SourcePreferenceEntry<?>>
java.lang.Object
org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
org.openstreetmap.josm.data.sources.SourceInfo<T,U,V,W>
- Type Parameters:
T- The SourceCategory The categories enum for the sourceU- The SourceType The type enum of the sourceV- The SourceBounds The bound type for the entryW- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected StringImage of a graphical attribution displayed when using the imageryprotected StringLink behind the graphical attribution displayed when using the imageryprotected StringLink behind the text attribution displayed when using the imageryprotected StringText of a text attribution displayed when using the imageryprotected Vdisplay bounds of imagery, displayed in prefs and used for automatic imagery selectionprotected Tcategory of the imageryprotected Stringcategory of the imagery (input string, not saved, copied or used otherwise except for error checks)protected Stringcountry code of the imagery (for country specific imagery)HTTP headersprotected Stringcreation 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).protected booleanwhether this is a entry activated by default or notprotected List<DefaultLayer>which layers should be activated by default on layer addition.protected Stringdescription of the imagery entry, should contain notes what type of data it isprotected StringWhether this service requires a explicit EULA acceptance before it can be activatedprotected Stringicon used in menuprotected Stringlanguage of the description entryprotected String(original) language of the translated name entryprotected Collection<String>list of old IDs, only for loading, not handled anywhere elseprotected Stringoriginal name of the source entry in case of translation call, for multiple languages English when possibleprotected StringLink to a reference stating the permission for OSM usageprotected StringLink to the privacy policy of the operatorprotected Utype of the services - WMS, TMS, ...protected StringText with usage terms displayed when using the imageryprotected StringLink behind the text with usage terms displayed when using the imageryFields inherited from class org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
cookies, id, maxZoom, metadataHeaders, minZoom, modTileFeatures, name, noTileChecksums, noTileHeaders, tileSize, url -
Constructor Summary
ConstructorsConstructorDescriptionCreates empty SourceInfo classSourceInfo(String name) Create a SourceInfo classSourceInfo(String name, String url, String id) Create a SourceInfo class -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an old Id.voidclearId()Store the id of this info to the preferences and clear it afterwards.intvoidcopyAttribution(SourceInfo<T, U, V, W> i) Copies attribution from anotherSourceInfo.booleanbooleanequalsBaseValues(SourceInfo<T, U, V, W> in) Determines if URL is equal to given source info.booleanequalsPref(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.static <W extends SourceInfo<?,?, ?, ?>>
Collection<String>getActiveIds(Class<W> clazz) Return the sorted list of activated source IDs.Return the raw attribution logo information (an URL to the image).getAttributionText(int zoom, org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate topLeft, org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate botRight) Returns the source polygonal bounds.Returns the ISO 3166-1-alpha-2 country code.Returns custom HTTP headers that should be sent with request towards imagery providergetDate()Returns the date information.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 onReturns the description text when existing.Returns the EULA acceptance URL, if any.getIcon()Returns the entry icon.static StringgetLocalizedCountry(String countryCode) Returns a localized name for the given country code, or "Worldwide" if empty.Get old Ids.Returns the entry name.Return the permission reference URL.Return the privacy policy URL.Returns the source category.Returns the source category original string (don't use except for error checks).Returns the source type.Returns a tool tip text for display.booleanDetermines if this entry requires attribution.inthashCode()booleanReturns true if this layer's URL is matched by one of the regular expressions kept by the current OsmApi instance.booleanDetermines if this entry is enabled by default.booleanvoidsetAttribution(org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource s) Applies the attribution from this object to a tile source.voidSet the image for the attributionvoidSet the attribution imagevoidSets the URL the attribution should link to.voidsetAttributionText(String text) Set the attribution textvoidSets the source polygonal bounds.voidsetCountryCode(String countryCode) Sets the ISO 3166-1-alpha-2 country code.voidsetCustomHttpHeaders(Map<String, String> customHttpHeaders) Sets custom HTTP headers that should be sent with request towards imagery providervoidSets the date information.voidsetDefaultEntry(boolean defaultEntry) Sets the default state of this entry.voidsetDefaultLayers(List<DefaultLayer> layers) Sets the default layers that user will work withvoidsetDescription(String language, String description) Sets the description text when existing.voidsetEulaAcceptanceRequired(String eulaAcceptanceRequired) Sets the EULA acceptance URL.voidSets the entry icon.voidsetMetadataHeaders(Map<String, String> metadataHeaders) Returns the map of <header name, metadata key> indicating, which HTTP headers should be moved to metadatavoidSets the entry name and handle translation.voidsetNoTileChecksums(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"voidsetNoTileHeaders(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"voidSets the permission reference URL.voidSets the privacy policy URL.voidsetSourceCategory(T category) Sets the source category.voidsetSourceCategoryOriginalString(String categoryOriginalString) Sets the source category original string (don't use except for error checks).voidsetSourceType(U imageryType) Sets the source type.voidsetTermsOfUseText(String text) Sets the text to display to the user as terms of use.voidsetTermsOfUseURL(String text) Sets a url that links to the terms of use text.toString()Methods inherited from class org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
getCookies, getId, getMaxZoom, getMetadataHeaders, getMinZoom, getName, getTileSize, getUrl, isModTileFeatures, setCookies, setId, setModTileFeatures, setName, setTileSize, setUrl
-
Field Details
-
origName
original name of the source entry in case of translation call, for multiple languages English when possible -
langName
(original) language of the translated name entry -
defaultEntry
whether this is a entry activated by default or not -
eulaAcceptanceRequired
Whether this service requires a explicit EULA acceptance before it can be activated -
sourceType
type of the services - WMS, TMS, ... -
bounds
display bounds of imagery, displayed in prefs and used for automatic imagery selection -
description
description of the imagery entry, should contain notes what type of data it is -
langDescription
language of the description entry -
attributionText
Text of a text attribution displayed when using the imagery -
privacyPolicyURL
Link to the privacy policy of the operator -
permissionReferenceURL
Link to a reference stating the permission for OSM usage -
attributionLinkURL
Link behind the text attribution displayed when using the imagery -
attributionImage
Image of a graphical attribution displayed when using the imagery -
attributionImageURL
Link behind the graphical attribution displayed when using the imagery -
termsOfUseText
Text with usage terms displayed when using the imagery -
termsOfUseURL
Link behind the text with usage terms displayed when using the imagery -
countryCode
country code of the imagery (for country specific imagery) -
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
list of old IDs, only for loading, not handled anywhere else- Since:
- 13536
-
icon
icon used in menu -
defaultLayers
which layers should be activated by default on layer addition. -
customHttpHeaders
HTTP headers -
category
category of the imagery -
categoryOriginalString
category of the imagery (input string, not saved, copied or used otherwise except for error checks) -
localizedCountriesCache
-
-
Constructor Details
-
SourceInfo
public SourceInfo()Creates empty SourceInfo class -
SourceInfo
Create a SourceInfo class- Parameters:
name- name
-
SourceInfo
Create a SourceInfo class- Parameters:
name- nameurl- base URLid- unique id
-
-
Method Details
-
hashCode
-
equalsPref
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
-
equals
-
getLocalizedCountry
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:
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<T extends ISourceCategory<?>>
-
equalsBaseValues
Determines if URL is equal to given source info.- Parameters:
in- source info- Returns:
trueif URL is equal to given source info
-
setBounds
Sets the source polygonal bounds.- Parameters:
b- The source bounds (non-rectangular)
-
getBounds
Returns the source polygonal bounds.- Returns:
- The source bounds (non-rectangular)
-
requiresAttribution
- Specified by:
requiresAttributionin interfaceorg.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:
getAttributionTextin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.Attributed
-
getAttributionLinkURL
- Specified by:
getAttributionLinkURLin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.Attributed
-
getPermissionReferenceURL
Return the permission reference URL.- Returns:
- The url
- Since:
- 11975
- See Also:
-
getPrivacyPolicyURL
Return the privacy policy URL.- Returns:
- The url
- Since:
- 16127
- See Also:
-
getAttributionImage
- Specified by:
getAttributionImagein interfaceorg.openstreetmap.gui.jmapviewer.interfaces.Attributed
-
getAttributionImageRaw
Return the raw attribution logo information (an URL to the image).- Returns:
- The url text
- Since:
- 12257
-
getAttributionImageURL
- Specified by:
getAttributionImageURLin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.Attributed
-
getTermsOfUseText
- Specified by:
getTermsOfUseTextin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.Attributed
-
getTermsOfUseURL
- Specified by:
getTermsOfUseURLin interfaceorg.openstreetmap.gui.jmapviewer.interfaces.Attributed
-
setAttributionText
Set the attribution text- Parameters:
text- The text- See Also:
-
setAttributionImageURL
Set the attribution image- Parameters:
url- The url of the image.- See Also:
-
setAttributionImage
Set the image for the attribution- Parameters:
res- The image resource- See Also:
-
setAttributionLinkURL
Sets the URL the attribution should link to.- Parameters:
url- The url.- See Also:
-
setPermissionReferenceURL
Sets the permission reference URL.- Parameters:
url- The url.- Since:
- 11975
- See Also:
-
setPrivacyPolicyURL
Sets the privacy policy URL.- Parameters:
url- The url.- Since:
- 16127
- See Also:
-
setTermsOfUseText
Sets the text to display to the user as terms of use.- Parameters:
text- The text- See Also:
-
setTermsOfUseURL
Sets a url that links to the terms of use text.- Parameters:
text- The url.- See Also:
-
getOriginalName
Returns the entry name.- Returns:
- The entry name
- Since:
- 6968
-
setName
Sets the entry name and handle translation.- Parameters:
language- The used languagename- The entry name- Since:
- 8091
-
clearId
Store the id of this info to the preferences and clear it afterwards. -
isDefaultEntry
Determines if this entry is enabled by default.- Returns:
trueif this entry is enabled by default,falseotherwise
-
setDefaultEntry
Sets the default state of this entry.- Parameters:
defaultEntry-trueif this entry has to be enabled by default,falseotherwise
-
getDescription
Returns the description text when existing.- Returns:
- The description
- Since:
- 8065
-
setDescription
Sets the description text when existing.- Parameters:
language- The used languagedescription- the imagery description text- Since:
- 8091
-
getActiveIds
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
Returns a tool tip text for display.- Returns:
- The text
- Since:
- 8065
-
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
Sets the EULA acceptance URL.- Parameters:
eulaAcceptanceRequired- The URL to an EULA text that has to be accepted before use
-
getCountryCode
Returns the ISO 3166-1-alpha-2 country code.- Returns:
- The country code (2 letters)
-
setCountryCode
Sets the ISO 3166-1-alpha-2 country code.- Parameters:
countryCode- The country code (2 letters)
-
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
Sets the date information.- Parameters:
date- The date information- Since:
- 11570
-
getIcon
Returns the entry icon.- Returns:
- The entry icon
-
setIcon
Sets the entry icon.- Parameters:
icon- The entry icon
-
hasAttribution
Determines if this entry requires attribution.- Returns:
trueif some attribution text has to be displayed,falseotherwise
-
copyAttribution
Copies attribution from anotherSourceInfo.- Parameters:
i- The other source info to get attribution from
-
setAttribution
Applies the attribution from this object to a tile source.- Parameters:
s- The tile source
-
getSourceType
Returns the source type.- Returns:
- The source type
-
setSourceType
Sets the source type.- Parameters:
imageryType- The source type
-
getSourceCategory
Returns the source category.- Returns:
- The source category
-
setSourceCategory
Sets the source category.- Parameters:
category- The source category
-
getSourceCategoryOriginalString
Returns the source category original string (don't use except for error checks).- Returns:
- The source category original string
-
setSourceCategoryOriginalString
Sets the source category original string (don't use except for error checks).- Parameters:
categoryOriginalString- The source category original string
-
isBlacklisted
Returns true if this layer's URL is matched by one of the regular expressions kept by the current OsmApi instance.- Returns:
trueis this entry is blacklisted,falseotherwise
-
setNoTileHeaders
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
- Overrides:
getNoTileHeadersin classorg.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
-
setNoTileChecksums
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
-
getNoTileChecksums
- Overrides:
getNoTileChecksumsin classorg.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo
-
setMetadataHeaders
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
Adds an old Id.- Parameters:
id- the Id to be added- Since:
- 13536
-
getOldIds
Get old Ids.- Returns:
- collection of ids
- Since:
- 13536
-
getDefaultLayers
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
Sets the default layers that user will work with- Parameters:
layers- set the list of default layers
-
getCustomHttpHeaders
Returns custom HTTP headers that should be sent with request towards imagery provider- Returns:
- headers
-
setCustomHttpHeaders
Sets custom HTTP headers that should be sent with request towards imagery provider- Parameters:
customHttpHeaders- http headers
-