Changes between Version 251 and Version 268 of Help/Styles/MapCSSImplementation
- Timestamp:
- (multiple changes)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSImplementation
v251 v268 8 8 * [wikitr:/Help/Action/Search Search dialog] 9 9 10 Consider installing the [https://marketplace.visualstudio.com/items?itemName=whammo.mapcss-syntax MapCSS Syntax Highlighter] in VS Code to add visual highlighting for MapCSS paint and validator syntax. 10 11 11 12 == General Structure == … … 20 21 set: class; 21 22 set: .class; 23 /* note that validator rules do not use the colon after set */ 22 24 } 23 25 }}} … … 250 252 way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ 251 253 node[name="My name"] /* use quotes if key or value includes spaces */ 252 node["name: ru"="Калининград"]/* use quotes if key or value includes special characters like colons or unicode characters */254 node["name:pl"="Królewiec"] /* use quotes if key or value includes special characters like colons or unicode characters */ 253 255 }}} 254 256 }}} … … 265 267 way[highway!=residential] 266 268 node[name!="My name"] 267 node["name: ru"!="Калининград"]269 node["name:pl"!="Królewiec"] 268 270 }}} 269 271 }}} … … 341 343 }}} 342 344 {{{#!td align=left valign=top 343 [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match345 [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match 344 346 345 347 }}} … … 350 352 /* Note, that reqular expressions have to be enclosed in /.../ */ 351 353 }}} 352 Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/ javase/7/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]).354 Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]). 353 355 {{{ 354 356 #!mapcss … … 362 364 }}} 363 365 {{{#!td align=left valign=top 364 negated [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match366 negated [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match 365 367 366 368 }}} … … 506 508 |------------------------------------------------------------------------------- 507 509 {{{#!td align=left valign=top 508 Presence of tag by [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match (since r6547)510 Presence of tag by [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match (since r6547) 509 511 }}} 510 512 {{{#!td align=left valign=top … … 724 726 way::A { a; } 725 727 way::B { b; } 726 way::* { c; } 728 way::* { c; } /* overrides all existing subparts */ 727 729 }}} 728 730 is equivalent to … … 731 733 way::A { a; } 732 734 way::B { b; } 733 way::A { c; } 734 way::B { c; } 735 way::A { c; } /* overrides a with c all existing subparts */ 736 way::B { c; } /* overrides b with c all existing subparts */ 735 737 }}} 736 738 And it initializes new subparts. In other words: … … 1020 1022 }}} 1021 1023 1022 Settings groups are displayed as sub-menus from the style settings menu. If at least two settings belong to a group, a special "Toggle all settings" menu item allows to quickly switch on/off all settings from this group at once. Usage example: [wiki:/Styles/MapWithAI MapWithAI]. 1024 Settings groups are displayed as sub-menus from the style settings menu. If at least two settings belong to a group, a special "Toggle all settings" menu item allows to quickly switch on/off all settings from this group at once. Usage example: [wikitr:/Styles/MapWithAI MapWithAI]. 1023 1025 1024 1026 … … 1043 1045 || `icon-offset-x` || Shift the icon in horizontal direction (positive values to the right) (since r8085) || ''Number'' || 0 || 1044 1046 || `icon-offset-y` || Shift the icon in vertical direction (positive values downwards) (since r8085) || ''Number'' || 0 || 1045 || `icon-rotation` || Rotate the icon clockwise or anti clockwise (negative value)(since r8260) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) \\ or a cardinal direction (e.g. `northeast` or `sw`); \\ or `way` to rotate the icon in the direction of the parent way. \\ See also the functions `degree_to_radians`, `cardinal_to_radians`. || - || 1047 || `icon-rotation` || Rotate the icon clockwise or anti clockwise (negative value)(since r8260) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) \\ or a cardinal direction (e.g. `northeast` or `sw`); \\ or `way` to rotate the icon in the direction of the parent way. \\ See also the functions `degree_to_radians`, `cardinal_to_radians`. \\Since version 18678 function parent_way_angle() is an alternativ to way: e.g. {{{ way > node[...]::layer_x { ... icon-rotation: parent_way_angle(); ... } }}} || - || 1046 1048 || `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || `center`, `inside`, `line` || `center` || 1047 1049 || `symbol-shape` || Display a symbol at the position of the node || `square`, `circle`, `triangle`, `pentagon`, `hexagon`, `heptagon`, `octagon`, `nonagon`, `decagon` || - || … … 1149 1151 || `text-anchor-horizontal` || horizontal text label placement || `left`, `center`, `right` || `right` || 1150 1152 || `text-anchor-vertical` || vertical text label placement || `above`, `top`, `center`, `bottom`, `below` || `bottom` || 1151 || `text-rotation` || Rotate the text clockwise or anti clockwise (negative value)\\(since r16253) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` \\([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); \\ or `way` to rotate the text in the direction of the parent way. \\See also the functions `degree_to_radians`, `cardinal_to_radians`. \\(Note that the direction means where the upper edge of the text faces.\\That means with the default direction of north the text flows to east\\(with a left to right language). \\So if you want to flow it to e.g. south you need to set east.) || - || 1153 || `text-rotation` || Rotate the text clockwise or anti clockwise (negative value)\\(since r16253) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` \\([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); \\ or `way` to rotate the text in the direction of the parent way. \\See also the functions `degree_to_radians`, `cardinal_to_radians`. \\Since version 18678 function parent_way_angle() is an alternativ to way: e.g. {{{ way > node[...]::layer_x { ... text-rotation: parent_way_angle(); ... } }}} \\(Note that the direction means where the upper edge of the text faces.\\That means with the default direction of north the text flows to east\\(with a left to right language). \\So if you want to flow it to e.g. south you need to set east.) || - || 1152 1154 || `text-position` |||||| see [#AreaStyles Area styles] and [#LineStyles Line styles] || 1153 1155 || `font-family` || font family || ''String'' || "Droid Sans" \\(JOSM preference "`mappaint.font`") || … … 1176 1178 * '''`rgba(/*r*/, /*g*/, /*b*/, /*alpha*/)`''' - rgb value with alpha 1177 1179 * '''`hsb_color(/*hue*/, /*saturation*/, /*brightness*/)`''' - color from HSB color space 1180 * if the color is prefixed with a name and #, e.g. `color: highway_track#6e541c;` it will appear in the [wikitr:/Help/Preferences/ColorPreference Color Preference] and end users can adjust the color there themself 1178 1181 1179 1182 '' '''Opacity''' '' … … 1198 1201 comparison operators 1199 1202 asin, atan, atan2, ceil, cos, cosh, exp, floor, log, max, min, mod (since r17759), random, round, signum, sin, sinh, sqrt, tan, tanh:: 1200 the usual meaning, [https://do wnload.oracle.com/javase/8/docs/api/java/lang/Math.html details]1203 the usual meaning, [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html details] 1201 1204 cond(b, fst, snd):: 1202 1205 b ? fst : snd:: … … 1271 1274 return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since r6534''] 1272 1275 substring(str, start, end):: 1273 return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since r6534''] 1276 return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since r6534''], a negative end index counts from the string end [''since r19259''] 1274 1277 replace(string, old, new):: 1275 1278 Replaces any occurrence of the substring ''old'' within the string ''string'' with the text ''new'' … … 1296 1299 CRC32_checksum(''str''):: 1297 1300 calculate the CRC32 checksum of a string (result is an integer from 0 to 2^32^-1) [''since r6908''] 1301 siunit_length(''str''):: 1302 convert length units to meter (fault tolerant, ignoring white space) [''since r19089''] 1298 1303 is_right_hand_traffic():: 1299 1304 Check if there is left-hand or right-hand traffic at the current location. [''since r7193''] … … 1326 1331 sort(''str1'', ''str2'', ''str3'', ''...''):: 1327 1332 sorts an array of strings [''since r15279''] 1328 sort_list():: 1333 sort_list(''list_name''):: 1329 1334 sorts a list of strings [''since r15279''] 1330 1335 tag_regex(''regex''):: 1331 returns a list of values that match the regex [''since r15317'']1336 returns a list containing the values of keys that match the regex [''since r15317''] 1332 1337 to_boolean(''str''):: 1333 1338 returns the string argument as a boolean [''since r16110''] … … 1346 1351 uniq(''str1'', ''str2'', ''str3'', ''...''):: 1347 1352 returns a list of strings that only have unique values from an array of strings [''since r15323''] 1348 uniq_list():: 1349 returns a list of strings that only have unique values from a list of strings [''since r15353''] 1353 uniq_list(''list_name''):: 1354 returns a list of strings that only have unique values from a list of strings [''since r15323''] 1355 parent_way_angle():: 1356 returns the angle of the parent way as a double in rad [''since r18664''] (see: text-rotation or icon-rotation) 1357 convert_primitive_to_string(''PrimitiveId''):: 1358 returns the primitive id as a string [''since r18829''] 1359 convert_primitives_to_string(''PrimitiveId'', ''PrimitiveId'', ''...''):: 1360 returns a list of primitive ids converted to strings [''since r18829''] 1361 parent_osm_primitives(''optional key'', ''optional value''):: 1362 returns a list of primitive ids which match the key and value (if present) [''since r18829''] 1350 1363 1351 1364 === Examples ===
