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 Map<String,AreaPrototype> |
areas |
protected List<AreaPrototype> |
areasList |
protected Map<String,IconPrototype> |
icons |
protected List<IconPrototype> |
iconsList |
protected Map<String,LinePrototype> |
lines |
protected List<LinePrototype> |
linesList |
protected Map<String,LinemodPrototype> |
modifiers |
protected List<LinemodPrototype> |
modifiersList |
static 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_IMAGE, FILL_OPACITY, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_WEIGHT, ICON_HEIGHT, ICON_IMAGE, ICON_OFFSET_X, ICON_OFFSET_Y, ICON_OPACITY, 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(String url,
String name,
String shortdescription) |
Modifier and Type | Method and Description |
---|---|
void |
add(XmlCondition c,
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,
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,
Double scale,
MultiCascade mc) |
InputStream |
getSourceInputStream()
Returns a new
InputStream to the style source. |
protected void |
init()
Initialize the class.
|
void |
loadStyleSource()
Loads the style source.
|
private boolean |
requiresUpdate(Prototype current,
Prototype candidate,
Double scale,
MultiCascade mc)
checks whether a certain match is better than the current match
|
private <T extends Prototype> |
update(T current,
T candidate,
Double scale,
MultiCascade mc) |
closeSourceInputStream, getBackgroundColorOverride, getErrors, getIcon, getIconProvider, getSourceIconProvider, getToolTipText, logError
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, getZipEntryDirName, hashCode, isLocal, toString
public static final String XML_STYLE_MIME_TYPES
protected final Map<String,IconPrototype> icons
protected final Map<String,LinePrototype> lines
protected final Map<String,LinemodPrototype> modifiers
protected final Map<String,AreaPrototype> areas
protected final List<IconPrototype> iconsList
protected final List<LinePrototype> linesList
protected final List<LinemodPrototype> modifiersList
protected final List<AreaPrototype> areasList
public XmlStyleSource(String url, String name, String shortdescription)
public XmlStyleSource(SourceEntry entry)
protected void init()
StyleSource
init
in class StyleSource
public void loadStyleSource()
StyleSource
loadStyleSource
in class StyleSource
public InputStream getSourceInputStream() throws 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 callerIOException
- if any I/O error occurs.StyleSource.closeSourceInputStream(InputStream)
public CachedFile getCachedFile() throws 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 sourceIOException
- if any I/O error occurs.private <T extends Prototype> T update(T current, T candidate, Double scale, MultiCascade mc)
private boolean requiresUpdate(Prototype current, Prototype candidate, 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 MultiCascadeprivate IconPrototype getNode(OsmPrimitive primitive, Double scale, MultiCascade mc)
private void get(OsmPrimitive primitive, boolean closed, XmlStyleSource.WayPrototypesRecord p, Double scale, MultiCascade mc)
closed
- 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.public void add(XmlCondition c, 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.