org.openstreetmap.josm.gui.mappaint.xml
Class XmlStyleSource

java.lang.Object
  extended by org.openstreetmap.josm.gui.preferences.SourceEntry
      extended by org.openstreetmap.josm.gui.mappaint.StyleSource
          extended by org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource
All Implemented Interfaces:
StyleKeys

public class XmlStyleSource
extends StyleSource
implements StyleKeys


Nested Class Summary
private static class XmlStyleSource.WayPrototypesRecord
           
 
Field Summary
protected  java.util.HashMap<java.lang.String,AreaPrototype> areas
           
protected  java.util.LinkedList<AreaPrototype> areasList
           
protected  java.util.HashMap<java.lang.String,IconPrototype> icons
           
protected  java.util.LinkedList<IconPrototype> iconsList
           
protected  java.util.HashMap<java.lang.String,LinePrototype> lines
           
protected  java.util.LinkedList<LinePrototype> linesList
           
protected  java.util.HashMap<java.lang.String,LinemodPrototype> modifiers
           
protected  java.util.LinkedList<LinemodPrototype> modifiersList
           
 
Fields inherited from class org.openstreetmap.josm.gui.mappaint.StyleSource
icon, zipIcons
 
Fields inherited from class org.openstreetmap.josm.gui.preferences.SourceEntry
active, name, title, url
 
Fields inherited from interface org.openstreetmap.josm.gui.mappaint.StyleKeys
COLOR, DASHES, DASHES_BACKGROUND_COLOR, DASHES_BACKGROUND_OPACITY, DASHES_OFFSET, FILL_COLOR, FILL_IMAGE, FILL_OPACITY, ICON_IMAGE, MODIFIER, OBJECT_Z_INDEX, OFFSET, OPACITY, REAL_WIDTH, TEXT, TEXT_POSITION, WIDTH, Z_INDEX
 
Constructor Summary
XmlStyleSource(SourceEntry entry)
           
XmlStyleSource(java.lang.String url, java.lang.String name, java.lang.String shortdescription)
           
 
Method Summary
 void add(XmlCondition c, java.util.Collection<XmlCondition> conditions, Prototype prot)
           
 void apply(MultiCascade mc, OsmPrimitive osm, double scale, OsmPrimitive multipolyOuterWay, boolean pretendWayIsClosed)
           
private  void get(OsmPrimitive primitive, boolean closed, XmlStyleSource.WayPrototypesRecord p, java.lang.Double scale, MultiCascade mc)
           
private  IconPrototype getNode(OsmPrimitive primitive, java.lang.Double scale, MultiCascade mc)
           
 java.io.InputStream getSourceInputStream()
           
protected  void init()
           
 void loadStyleSource()
           
private  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>
T
update(T current, T candidate, java.lang.Double scale, MultiCascade mc)
           
 
Methods inherited from class org.openstreetmap.josm.gui.mappaint.StyleSource
getBackgroundColorOverride, getErrors, getIcon, getLastMTime, getSourceIcon, getToolTipText, logError, setLastMTime
 
Methods inherited from class org.openstreetmap.josm.gui.preferences.SourceEntry
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, hashCode, isLocal, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

icons

protected final java.util.HashMap<java.lang.String,IconPrototype> icons

lines

protected final java.util.HashMap<java.lang.String,LinePrototype> lines

modifiers

protected final java.util.HashMap<java.lang.String,LinemodPrototype> modifiers

areas

protected final java.util.HashMap<java.lang.String,AreaPrototype> areas

iconsList

protected final java.util.LinkedList<IconPrototype> iconsList

linesList

protected final java.util.LinkedList<LinePrototype> linesList

modifiersList

protected final java.util.LinkedList<LinemodPrototype> modifiersList

areasList

protected final java.util.LinkedList<AreaPrototype> areasList
Constructor Detail

XmlStyleSource

public XmlStyleSource(java.lang.String url,
                      java.lang.String name,
                      java.lang.String shortdescription)

XmlStyleSource

public XmlStyleSource(SourceEntry entry)
Method Detail

init

protected void init()
Overrides:
init in class StyleSource

loadStyleSource

public void loadStyleSource()
Specified by:
loadStyleSource in class StyleSource

getSourceInputStream

public java.io.InputStream getSourceInputStream()
                                         throws java.io.IOException
Specified by:
getSourceInputStream in class StyleSource
Throws:
java.io.IOException

update

private <T extends Prototype> T update(T current,
                                       T candidate,
                                       java.lang.Double scale,
                                       MultiCascade mc)

requiresUpdate

private boolean requiresUpdate(Prototype current,
                               Prototype candidate,
                               java.lang.Double scale,
                               MultiCascade mc)
checks whether a certain match is better than the current match

Parameters:
current - can be null
candidate - the new Prototype that could be used instead
scale - ignored if null, otherwise checks if scale is within the range of candidate
mc - side effect: update the valid region for the current MultiCascade

getNode

private IconPrototype getNode(OsmPrimitive primitive,
                              java.lang.Double scale,
                              MultiCascade mc)

get

private void get(OsmPrimitive primitive,
                 boolean closed,
                 XmlStyleSource.WayPrototypesRecord p,
                 java.lang.Double scale,
                 MultiCascade mc)
Parameters:
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.

add

public void add(XmlCondition c,
                java.util.Collection<XmlCondition> conditions,
                Prototype prot)

apply

public void apply(MultiCascade mc,
                  OsmPrimitive osm,
                  double scale,
                  OsmPrimitive multipolyOuterWay,
                  boolean pretendWayIsClosed)
Specified by:
apply in class StyleSource


JOSM