public abstract class StyleSource extends SourceEntry
Modifier and Type | Field and Description |
---|---|
private static ImageProvider |
defaultIconProvider
image provider returning the default icon
|
private java.util.List<java.lang.Throwable> |
errors |
java.lang.String |
icon
The following fields is additional information found in the header of the source file.
|
private ImageProvider |
imageIconProvider
image provider returning the icon for this style
|
protected boolean |
loaded |
java.util.List<StyleSetting> |
settings
List of settings for user customization.
|
java.util.Map<java.lang.String,java.lang.Object> |
settingValues
Values of the settings for efficient lookup.
|
private java.util.Set<java.lang.String> |
warnings |
java.io.File |
zipIcons
The zip file containing the icons for this style
|
active, isZip, name, title, type, url, zipEntryPath
Constructor and Description |
---|
StyleSource(SourceEntry entry)
Constructs a new
StyleSource |
StyleSource(java.lang.String url,
java.lang.String name,
java.lang.String title)
Constructs a new, active
StyleSource . |
Modifier and Type | Method and Description |
---|---|
abstract void |
apply(MultiCascade mc,
IPrimitive osm,
double scale,
boolean pretendWayIsClosed)
Apply style to osm primitive.
|
void |
closeSourceInputStream(java.io.InputStream is)
Closes the source input stream previously returned by
getSourceInputStream() and other linked resources, if applicable. |
java.awt.Color |
getBackgroundColorOverride()
Gets the background color that was set in this style
|
abstract CachedFile |
getCachedFile()
Returns a new
CachedFile to the local file containing style source (can be a text file or an archive). |
private static ImageProvider |
getDefaultIconProvider()
Image provider for default icon.
|
java.util.Collection<java.lang.Throwable> |
getErrors()
Replies the collection of errors that occured with this style.
|
javax.swing.ImageIcon |
getIcon()
Image for source icon.
|
ImageProvider |
getIconProvider()
Image provider for source icon.
|
protected ImageProvider |
getSourceIconProvider()
Image provider for source icon.
|
abstract java.io.InputStream |
getSourceInputStream()
Returns a new
InputStream to the style source. |
java.lang.String |
getToolTipText()
Return text to display as ToolTip.
|
java.util.Collection<java.lang.String> |
getWarnings()
Replies the collection of warnings that occured with this style.
|
protected void |
init()
Initialize the class.
|
boolean |
isLoaded()
Determines if the style has been loaded (initialized).
|
boolean |
isValid()
Determines if this style is valid (no error, no warning).
|
void |
loadStyleSource()
Loads the complete style source.
|
abstract void |
loadStyleSource(boolean metadataOnly)
Loads the style source.
|
void |
logError(java.lang.Throwable e)
Log an error that occured with this style.
|
void |
logWarning(java.lang.String w)
Log a warning that occured with this style.
|
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, getZipEntryDirName, hashCode, isLocal, toString
private final java.util.List<java.lang.Throwable> errors
private final java.util.Set<java.lang.String> warnings
protected boolean loaded
public java.io.File zipIcons
private ImageProvider imageIconProvider
private static ImageProvider defaultIconProvider
public java.lang.String icon
public final java.util.List<StyleSetting> settings
public java.util.Map<java.lang.String,java.lang.Object> settingValues
public StyleSource(java.lang.String url, java.lang.String name, java.lang.String title)
StyleSource
.url
- URL that CachedFile
understandsname
- The name for this StyleSourcetitle
- The title that can be used as menu entrypublic StyleSource(SourceEntry entry)
StyleSource
entry
- The entry to copy the data (url, name, ...) from.public abstract void apply(MultiCascade mc, IPrimitive osm, double scale, boolean pretendWayIsClosed)
StyleSource
s add
their properties on after the other. At a later stage, concrete painting
primitives (lines, icons, text, ...) are derived from the MultiCascade.mc
- the current MultiCascade, empty for the first StyleSourceosm
- the primitivescale
- the map scalepretendWayIsClosed
- For styles that require the way to be closed,
we pretend it is. This is useful for generating area styles from the (segmented)
outer ways of a multipolygon.public void loadStyleSource()
public abstract void loadStyleSource(boolean metadataOnly)
metadataOnly
- if true
, only metadata are loadedpublic abstract java.io.InputStream getSourceInputStream() throws java.io.IOException
InputStream
to the style source. When finished, closeSourceInputStream(InputStream)
must be called.InputStream
to the style source that must be closed by the callerjava.io.IOException
- if any I/O error occurs.closeSourceInputStream(InputStream)
public abstract CachedFile getCachedFile() throws java.io.IOException
CachedFile
to the local file containing style source (can be a text file or an archive).CachedFile
to the local file containing style sourcejava.io.IOException
- if any I/O error occurs.public void closeSourceInputStream(java.io.InputStream is)
getSourceInputStream()
and other linked resources, if applicable.is
- The source input stream that must be closedgetSourceInputStream()
public void logError(java.lang.Throwable e)
e
- errorpublic void logWarning(java.lang.String w)
w
- warningspublic java.util.Collection<java.lang.Throwable> getErrors()
public java.util.Collection<java.lang.String> getWarnings()
public boolean isValid()
true
if this style has 0 errors and 0 warningsprotected void init()
private static ImageProvider getDefaultIconProvider()
getIconProvider()
protected ImageProvider getSourceIconProvider()
getIconProvider()
public final ImageProvider getIconProvider()
public final javax.swing.ImageIcon getIcon()
public java.lang.String getToolTipText()
public java.awt.Color getBackgroundColorOverride()
null
if it was not setpublic final boolean isLoaded()
true
if the style has been loaded