public class XmlStyleSource extends StyleSource implements StyleKeys
Modifier and Type | Class and Description |
---|---|
private static class |
XmlStyleSource.WayPrototypesRecord |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,AreaPrototype> |
areas |
protected java.util.List<AreaPrototype> |
areasList |
protected java.util.Map<java.lang.String,IconPrototype> |
icons |
protected java.util.List<IconPrototype> |
iconsList |
protected java.util.Map<java.lang.String,LinePrototype> |
lines |
protected java.util.List<LinePrototype> |
linesList |
protected java.util.Map<java.lang.String,LinemodPrototype> |
modifiers |
protected java.util.List<LinemodPrototype> |
modifiersList |
static java.lang.String |
XML_STYLE_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.
|
icon, settings, settingValues, zipIcons
active, isZip, name, title, url, zipEntryPath
COLOR, DASHES, DASHES_BACKGROUND_COLOR, DASHES_BACKGROUND_OPACITY, DASHES_OFFSET, FILL_COLOR, FILL_EXTENT, FILL_EXTENT_THRESHOLD, FILL_IMAGE, FILL_OPACITY, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_WEIGHT, ICON_HEIGHT, ICON_IMAGE, ICON_OFFSET_X, ICON_OFFSET_Y, ICON_OPACITY, ICON_ROTATION, ICON_WIDTH, LINECAP, LINEJOIN, MAJOR_Z_INDEX, MITERLIMIT, MODIFIER, OBJECT_Z_INDEX, OFFSET, OPACITY, REAL_WIDTH, REPEAT_IMAGE, REPEAT_IMAGE_ALIGN, REPEAT_IMAGE_HEIGHT, REPEAT_IMAGE_OFFSET, REPEAT_IMAGE_OPACITY, REPEAT_IMAGE_PHASE, REPEAT_IMAGE_SPACING, REPEAT_IMAGE_WIDTH, TEXT, TEXT_ANCHOR_HORIZONTAL, TEXT_ANCHOR_VERTICAL, TEXT_COLOR, TEXT_HALO_COLOR, TEXT_HALO_OPACITY, TEXT_HALO_RADIUS, TEXT_OFFSET, TEXT_OFFSET_X, TEXT_OFFSET_Y, TEXT_OPACITY, TEXT_POSITION, WIDTH, Z_INDEX
Constructor and Description |
---|
XmlStyleSource(SourceEntry entry) |
XmlStyleSource(java.lang.String url,
java.lang.String name,
java.lang.String shortdescription) |
Modifier and Type | Method and Description |
---|---|
void |
add(XmlCondition c,
java.util.Collection<XmlCondition> conditions,
Prototype prot) |
void |
apply(MultiCascade mc,
OsmPrimitive osm,
double scale,
boolean pretendWayIsClosed)
Apply style to osm primitive.
|
private void |
get(OsmPrimitive primitive,
boolean closed,
XmlStyleSource.WayPrototypesRecord p,
java.lang.Double scale,
MultiCascade mc) |
CachedFile |
getCachedFile()
Returns a new
CachedFile to the local file containing style source (can be a text file or an archive). |
private IconPrototype |
getNode(OsmPrimitive primitive,
java.lang.Double scale,
MultiCascade mc) |
java.io.InputStream |
getSourceInputStream()
Returns a new
InputStream to the style source. |
protected void |
init()
Initialize the class.
|
void |
loadStyleSource()
Loads the style source.
|
private static boolean |
requiresUpdate(Prototype current,
Prototype candidate,
java.lang.Double scale,
MultiCascade mc)
checks whether a certain match is better than the current match
|
private <T extends Prototype> |
update(T current,
T candidate,
java.lang.Double scale,
MultiCascade mc) |
closeSourceInputStream, getBackgroundColorOverride, getErrors, getIcon, getIconProvider, getSourceIconProvider, getToolTipText, logError
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, getZipEntryDirName, hashCode, isLocal, toString
public static final java.lang.String XML_STYLE_MIME_TYPES
protected final java.util.Map<java.lang.String,IconPrototype> icons
protected final java.util.Map<java.lang.String,LinePrototype> lines
protected final java.util.Map<java.lang.String,LinemodPrototype> modifiers
protected final java.util.Map<java.lang.String,AreaPrototype> areas
protected final java.util.List<IconPrototype> iconsList
protected final java.util.List<LinePrototype> linesList
protected final java.util.List<LinemodPrototype> modifiersList
protected final java.util.List<AreaPrototype> areasList
public XmlStyleSource(java.lang.String url, java.lang.String name, java.lang.String shortdescription)
public XmlStyleSource(SourceEntry entry)
protected void init()
StyleSource
init
in class StyleSource
public 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.private <T extends Prototype> T update(T current, T candidate, java.lang.Double scale, MultiCascade mc)
private static boolean requiresUpdate(Prototype current, Prototype candidate, java.lang.Double scale, MultiCascade mc)
current
- can be nullcandidate
- the new Prototype that could be used insteadscale
- ignored if null, otherwise checks if scale is within the range of candidatemc
- side effect: update the valid region for the current MultiCascadetrue
if candidate
is better than the current matchprivate IconPrototype getNode(OsmPrimitive primitive, java.lang.Double scale, MultiCascade mc)
private void get(OsmPrimitive primitive, boolean closed, XmlStyleSource.WayPrototypesRecord p, java.lang.Double scale, MultiCascade mc)
primitive
- OSM primitiveclosed
- The primitive is a closed way or we pretend it is closed.
This is useful for multipolygon relations and outer ways of untagged
multipolygon relations.p
- helperscale
- scalemc
- multi cascadepublic void add(XmlCondition c, java.util.Collection<XmlCondition> conditions, Prototype prot)
public void apply(MultiCascade mc, OsmPrimitive osm, double scale, 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 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.