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
|
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.
|
java.io.File |
zipIcons |
active, isZip, name, title, 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,
OsmPrimitive 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() |
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() |
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.
|
protected void |
init()
Initialize the class.
|
abstract void |
loadStyleSource()
Loads the style source.
|
void |
logError(java.lang.Throwable e) |
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, getZipEntryDirName, hashCode, isLocal, toString
private java.util.List<java.lang.Throwable> errors
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, OsmPrimitive 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 abstract void loadStyleSource()
public 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)
public java.util.Collection<java.lang.Throwable> getErrors()
protected 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()