public class MapCSSStyleSource extends StyleSource
Modifier and Type | Class and Description |
---|---|
static class |
MapCSSStyleSource.MapCSSRuleIndex
A collection of
MapCSSRule s, that are indexed by tag key and value. |
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
backgroundColorOverride |
MapCSSStyleSource.MapCSSRuleIndex |
canvasRules |
private java.lang.String |
css |
static java.lang.String |
MAPCSS_STYLE_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.
|
MapCSSStyleSource.MapCSSRuleIndex |
multipolygonRules |
MapCSSStyleSource.MapCSSRuleIndex |
nodeRules |
MapCSSStyleSource.MapCSSRuleIndex |
relationRules |
java.util.List<MapCSSRule> |
rules |
MapCSSStyleSource.MapCSSRuleIndex |
wayNoAreaRules |
MapCSSStyleSource.MapCSSRuleIndex |
wayRules |
private java.util.zip.ZipFile |
zipFile |
icon, zipIcons
active, isZip, name, title, url, zipEntryPath
Constructor and Description |
---|
MapCSSStyleSource(SourceEntry entry) |
MapCSSStyleSource(java.lang.String css)
Creates a new style source from the MapCSS styles supplied in
css |
MapCSSStyleSource(java.lang.String url,
java.lang.String name,
java.lang.String shortdescription) |
Modifier and Type | Method and Description |
---|---|
void |
apply(MultiCascade mc,
OsmPrimitive osm,
double scale,
OsmPrimitive multipolyOuterWay,
boolean pretendWayIsClosed)
Apply style to osm primitive.
|
void |
closeSourceInputStream(java.io.InputStream is)
Closes the source input stream previously returned by
StyleSource.getSourceInputStream() and other linked resources, if applicable. |
private Cascade |
constructSpecial(java.lang.String type) |
boolean |
evalMediaExpression(java.lang.String feature,
java.lang.Object val) |
java.awt.Color |
getBackgroundColorOverride() |
CachedFile |
getCachedFile()
Returns a new
CachedFile to the local file containing style source (can be a text file or an archive). |
java.io.InputStream |
getSourceInputStream()
Returns a new
InputStream to the style source. |
private void |
loadCanvas() |
private void |
loadMeta()
load meta info from a selector "meta"
|
void |
loadStyleSource()
Loads the style source.
|
java.lang.String |
toString() |
getErrors, getIcon, getSourceIcon, getToolTipText, init, logError
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, getZipEntryDirName, hashCode, isLocal
public static final java.lang.String MAPCSS_STYLE_MIME_TYPES
public final java.util.List<MapCSSRule> rules
public final MapCSSStyleSource.MapCSSRuleIndex nodeRules
public final MapCSSStyleSource.MapCSSRuleIndex wayRules
public final MapCSSStyleSource.MapCSSRuleIndex wayNoAreaRules
public final MapCSSStyleSource.MapCSSRuleIndex relationRules
public final MapCSSStyleSource.MapCSSRuleIndex multipolygonRules
public final MapCSSStyleSource.MapCSSRuleIndex canvasRules
private java.awt.Color backgroundColorOverride
private java.lang.String css
private java.util.zip.ZipFile zipFile
public MapCSSStyleSource(java.lang.String url, java.lang.String name, java.lang.String shortdescription)
public MapCSSStyleSource(SourceEntry entry)
public MapCSSStyleSource(java.lang.String css) throws java.lang.IllegalArgumentException
Creates a new style source from the MapCSS styles supplied in
css
css
- the MapCSS style declaration. Must not be null.java.lang.IllegalArgumentException
- thrown if css
is nullpublic void loadStyleSource()
StyleSource
loadStyleSource
in class StyleSource
public java.io.InputStream getSourceInputStream() throws java.io.IOException
StyleSource
InputStream
to the style source. When finished, StyleSource.closeSourceInputStream(InputStream)
must be called.getSourceInputStream
in class StyleSource
InputStream
to the style source that must be closed by the callerjava.io.IOException
- if any I/O error occurs.StyleSource.closeSourceInputStream(InputStream)
public CachedFile getCachedFile() throws java.io.IOException
StyleSource
CachedFile
to the local file containing style source (can be a text file or an archive).getCachedFile
in class StyleSource
CachedFile
to the local file containing style sourcejava.io.IOException
- if any I/O error occurs.public void closeSourceInputStream(java.io.InputStream is)
StyleSource
StyleSource.getSourceInputStream()
and other linked resources, if applicable.closeSourceInputStream
in class StyleSource
is
- The source input stream that must be closedStyleSource.getSourceInputStream()
private void loadMeta()
private void loadCanvas()
private Cascade constructSpecial(java.lang.String type)
public java.awt.Color getBackgroundColorOverride()
getBackgroundColorOverride
in class StyleSource
public void apply(MultiCascade mc, OsmPrimitive osm, double scale, OsmPrimitive multipolyOuterWay, boolean pretendWayIsClosed)
StyleSource
StyleSource
s add
their properties on after the other. At a later stage, concrete painting
primitives (lines, icons, text, ...) are derived from the MultiCascade.apply
in class StyleSource
mc
- the current MultiCascade, empty for the first StyleSourceosm
- the primitivescale
- the map scalemultipolyOuterWay
- support for a very old multipolygon tagging style
where you add the tags both to the outer and the inner way.
However, independent inner way style is also possible.pretendWayIsClosed
- 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 boolean evalMediaExpression(java.lang.String feature, java.lang.Object val)
public java.lang.String toString()
toString
in class SourceEntry