Class MapCSSStyleSource
java.lang.Object
org.openstreetmap.josm.data.preferences.sources.SourceEntry
org.openstreetmap.josm.gui.mappaint.StyleSource
org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource
This is a mappaint style that is based on MapCSS rules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Colorprivate Stringstatic final StringThe accepted MIME types sent in the HTTP Accept header.private booleanprivate final MapCSSStyleIndexIndex of rules in this style filefinal List<MapCSSRule>all rules in this style filestatic final ReadWriteLockThis lock prevents concurrent execution ofMapCSSRuleIndex.clear()/MapCSSRuleIndex.initIndex()andMapCSSRuleIndex.getRuleCandidates(org.openstreetmap.josm.data.osm.IPrimitive).Set of all supported MapCSS keys.private ZipFileFields inherited from class org.openstreetmap.josm.gui.mappaint.StyleSource
icon, loaded, settingGroups, settings, settingValues, zipIconsFields inherited from class org.openstreetmap.josm.data.preferences.sources.SourceEntry
active, isZip, name, title, type, url, zipEntryPath -
Constructor Summary
ConstructorsConstructorDescriptionMapCSSStyleSource(String css) Creates a new style source from the MapCSS styles supplied incssMapCSSStyleSource(String url, String name, String shortdescription) Constructs a new, activeMapCSSStyleSource.MapCSSStyleSource(SourceEntry entry) Constructs a newMapCSSStyleSource -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(MultiCascade mc, IPrimitive osm, double scale, boolean pretendWayIsClosed) Apply style to osm primitive.voidCloses the source input stream previously returned byStyleSource.getSourceInputStream()and other linked resources, if applicable.private CascadeconstructSpecial(String type) booleanevalSupportsDeclCondition(String feature, Object val) Evaluate a supports conditionGets the background color that was set in this styleReturns a newCachedFileto the local file containing style source (can be a text file or an archive).Returns a newInputStreamto the style source.booleanWhether to remove "areaStyle" pseudo classes.private voidprivate voidloadMeta()load meta info from a selector "meta"private voidprivate static voidloadSettings(MapCSSRule r, Selector.GeneralSelector gs, Environment env) voidloadStyleSource(boolean metadataOnly) Loads the style source.voidRemoves "meta" rules.toString()Methods inherited from class org.openstreetmap.josm.gui.mappaint.StyleSource
getErrors, getIcon, getIconProvider, getSourceIconProvider, getToolTipText, getWarnings, init, isLoaded, isValid, loadStyleSource, logError, logWarningMethods inherited from class org.openstreetmap.josm.data.preferences.sources.SourceEntry
equals, getDisplayString, getFileNamePart, getLocalSourceDir, getPrefName, getZipEntryDirName, hashCode, isLocal
-
Field Details
-
MAPCSS_STYLE_MIME_TYPES
The accepted MIME types sent in the HTTP Accept header.- Since:
- 6867
- See Also:
-
rules
all rules in this style file -
ruleIndex
Index of rules in this style file -
backgroundColorOverride
-
css
-
zipFile
-
removeAreaStylePseudoClass
-
STYLE_SOURCE_LOCK
This lock prevents concurrent execution ofMapCSSRuleIndex.clear()/MapCSSRuleIndex.initIndex()andMapCSSRuleIndex.getRuleCandidates(org.openstreetmap.josm.data.osm.IPrimitive). For efficiency reasons, these methods are synchronized higher up the stack trace. -
SUPPORTED_KEYS
Set of all supported MapCSS keys.
-
-
Constructor Details
-
MapCSSStyleSource
Constructs a new, activeMapCSSStyleSource.- Parameters:
url- URL thatCachedFileunderstandsname- The name for this StyleSourceshortdescription- The title for that source.
-
MapCSSStyleSource
Constructs a newMapCSSStyleSource- Parameters:
entry- The entry to copy the data (url, name, ...) from.
-
MapCSSStyleSource
Creates a new style source from the MapCSS styles supplied in
css- Parameters:
css- the MapCSS style declaration. Must not be null.- Throws:
IllegalArgumentException- ifcssis null
-
-
Method Details
-
loadStyleSource
Description copied from class:StyleSourceLoads the style source.- Specified by:
loadStyleSourcein classStyleSource- Parameters:
metadataOnly- iftrue, only metadata are loaded
-
getSourceInputStream
Description copied from class:StyleSourceReturns a newInputStreamto the style source. When finished,StyleSource.closeSourceInputStream(InputStream)must be called.- Specified by:
getSourceInputStreamin classStyleSource- Returns:
- A new
InputStreamto the style source that must be closed by the caller - Throws:
IOException- if any I/O error occurs.- See Also:
-
getCachedFile
Description copied from class:StyleSourceReturns a newCachedFileto the local file containing style source (can be a text file or an archive).- Specified by:
getCachedFilein classStyleSource- Returns:
- A new
CachedFileto the local file containing style source - Throws:
IOException- if any I/O error occurs.
-
closeSourceInputStream
Description copied from class:StyleSourceCloses the source input stream previously returned byStyleSource.getSourceInputStream()and other linked resources, if applicable.- Overrides:
closeSourceInputStreamin classStyleSource- Parameters:
is- The source input stream that must be closed- See Also:
-
loadMeta
load meta info from a selector "meta" -
loadCanvas
-
loadSettings
-
loadSettings
-
constructSpecial
-
getBackgroundColorOverride
Description copied from class:StyleSourceGets the background color that was set in this style- Overrides:
getBackgroundColorOverridein classStyleSource- Returns:
- The color or
nullif it was not set
-
apply
Description copied from class:StyleSourceApply style to osm primitive. Adds properties to a MultiCascade. All activeStyleSources add their properties on after the other. At a later stage, concrete painting primitives (lines, icons, text, ...) are derived from the MultiCascade.- Specified by:
applyin classStyleSource- Parameters:
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.
-
evalSupportsDeclCondition
Evaluate a supports condition- Parameters:
feature- The feature to evaluate forval- The additional parameter passed to evaluate- Returns:
trueif JSOM supports that feature
-
removeMetaRules
Removes "meta" rules. Not needed for validator.- Since:
- 13633
-
isRemoveAreaStylePseudoClass
Whether to remove "areaStyle" pseudo classes. Only for use in MapCSSParser!- Returns:
- whether to remove "areaStyle" pseudo classes
-
toString
- Overrides:
toStringin classSourceEntry
-