Changes between Version 172 and Version 173 of Help/Styles/MapCSSImplementation
- Timestamp:
- 2020-03-16T11:28:22+01:00 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSImplementation
v172 v173 3 3 This page documents details on JOSM's [osmwiki:MapCSS/0.2 MapCSS] implementation. This is used for the following features in JOSM: 4 4 5 * [wiki :Styles Mappaint styles]6 * [wiki :Rules Validator rules] ([[Help/Validator/MapCSSTagChecker|Tag checker]])7 * [Help/Action/Search Search dialog] 5 * [wikitr:/Styles Mappaint styles] 6 * [wikitr:/Rules Validator rules] ([wikitr:/Help/Validator/MapCSSTagChecker Tag checker]) 7 * [wikitr:/Help/Action/Search Search dialog] 8 8 9 9 == General Structure == … … 568 568 === Territory selector === 569 569 570 You can test whether an object is located inside or outside of a specific territory. JOSM has an internal database for this. The territories file is an osm file and can be downloaded [/export/HEAD/josm/trunk/data/boundaries.osm here] and opened in JOSM to investigate it [attachment:boundaries.png (screenshot preview)]. It contains borders of all countries of the world. Due to performance reasons the borders are simplified. They can be refined for special cases on request. The territories are "tagged" with their [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO_3166-1_alpha-2 codes]. USA, Canada, China, India and Australia have additional boundaries for their subdivisions. See the following examples on how to use the territory selectors. Territory selectors are less useful in mappaint styles and can be very resource heavy there. However they are much more useful for [wiki :Help/Validator/MapCSSTagChecker mapcss based validator rules]. To select territories with left-hand-traffic or right-hand-traffic, there is a simpler way, see [#PseudoClasses]. See #10387 for main implementation of this feature.570 You can test whether an object is located inside or outside of a specific territory. JOSM has an internal database for this. The territories file is an osm file and can be downloaded [/export/HEAD/josm/trunk/data/boundaries.osm here] and opened in JOSM to investigate it [attachment:boundaries.png (screenshot preview)]. It contains borders of all countries of the world. Due to performance reasons the borders are simplified. They can be refined for special cases on request. The territories are "tagged" with their [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO_3166-1_alpha-2 codes]. USA, Canada, China, India and Australia have additional boundaries for their subdivisions. See the following examples on how to use the territory selectors. Territory selectors are less useful in mappaint styles and can be very resource heavy there. However they are much more useful for [wikitr:/Help/Validator/MapCSSTagChecker mapcss based validator rules]. To select territories with left-hand-traffic or right-hand-traffic, there is a simpler way, see [#PseudoClasses]. See #10387 for main implementation of this feature. 571 571 572 572 {{{ … … 670 670 || {{{:unconnected}}} || true for nodes that are not used by any way (since r6687) || 671 671 || {{{:tagged}}} || What JOSM considers tagged, i.e. an object that with a tag key other than the following: {{{source*, source_ref, note, comment, converted_by, created_by, watch*, fixme, FIXME, description, attribution}}} (version r4008; in this list, {{{*}}} is a glob) 672 || {{{:righthandtraffic}}} || true if there is right-hand traffic at the current location (since r7193); see [ [left-right-hand-traffic]] for screenshot of areas ||672 || {{{:righthandtraffic}}} || true if there is right-hand traffic at the current location (since r7193); see [wikitr:/left-right-hand-traffic left-right-hand-traffic] for screenshot of areas || 673 673 || {{{:clockwise}}} || Whether the way is closed and oriented clockwise, or non-closed and the 1st, 2nd and last node are in clockwise order. || 674 674 || {{{:anticlockwise}}} || Whether the way is closed and oriented anticlockwise, or non-closed and the 1st, 2nd and last node are in anticlockwise order. || … … 919 919 == Style settings == 920 920 921 [ [Help/Dialog/MapPaint/StyleSettings|Styles settings]] are used to provide the user settings to customize a mappaint style. The user can use them in the MapPaint dialog. The following `type` of settings are available:921 [wikitr:/Help/Dialog/MapPaint/StyleSettings Styles settings] are used to provide the user settings to customize a mappaint style. The user can use them in the [wikitr:/Help/Dialog/MapPaint MapPaint dialog]. The following `type` of settings are available: 922 922 * `boolean` (since r7450) 923 923 * `double` (since r15731, see #10435) … … 1029 1029 1030 1030 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1031 || {{{icon-image}}} || The icon at node position. See also [wiki :Help/Styles/Images Images]. || ''Image'' || - ||1031 || {{{icon-image}}} || The icon at node position. See also [wikitr:/Help/Styles/Images Images]. || ''Image'' || - || 1032 1032 || {{{icon-opacity}}} || Opacity of the icon image || ''Opacity'' || 1.0 || 1033 1033 || {{{icon-width}}} || Width of the icon. If only one of the properties {{{icon-width}}} and {{{icon-height}}} is given, the image will be scaled proportionally. The icon will keep the original size, if neither {{{icon-width}}} nor {{{icon-height}}} is set. || ''Number'' || - || … … 1162 1162 1163 1163 '' '''Image''' '' 1164 See [wiki :Help/Styles/Images].1164 See [wikitr:/Help/Styles/Images]. 1165 1165 1166 1166 '' '''Color''' '' … … 1300 1300 Get value from the JOSM advanced preferences. This way you can offer certain options to the user and make the style customizable. It works with strings, numbers, colors and boolean values. [[br]][This function exists since version 3856, but with some restrictions. `JOSM_pref` always returns a string, but in version 7237 and earlier, the automatic conversion of string to boolean and color was not working. You can use the following workarounds for boolean values and color in version 7237 and earlier: `cond(JOSM_pref("myprefkey", "true")="true", "X", "O")` and `html2color(JOSM_pref("mycolor", "#FF345611"))`. These explicit conversions should be no longer necessary in version 7238 and later. Automatic conversion to a number works in any version.] 1301 1301 setting():: 1302 to use a [ [Help/Styles/MapCSSImplementation#Stylesettings|style setting]] [''since 7450'']1302 to use a [wikitr:/Help/Styles/MapCSSImplementation#Stylesettings style setting] [''since 7450''] 1303 1303 degree_to_radians():: 1304 1304 returns a in degree given direction in radians [''since 8260'']
