Changes between Version 8 and Version 9 of Ru:Help/Styles/MapCSSImplementation
- Timestamp:
- 2018-04-04T14:48:12+02:00 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ru:Help/Styles/MapCSSImplementation
v8 v9 406 406 }}} 407 407 408 Sincer6554,it is possible to prefix the "value" (i.e., expression after the operator) with a `*` in order to "de-reference" it (i.e., obtain consider it as another key and obtain its value). Thus, `[key1 = *key2]` or`[key1=*key2]`compares the value of`key1`with the value of`key2`,and`[key =~ */pattern/]`considers the value of the key `pattern` as a regular expression and matches it against the value of`key`.408 Начиная с r6554, возможно предварить "значение" (т.е. выражение после оператора) символом `*` для его "разыменования" (i.e., obtain consider it as another key and obtain its value). Таким образом, `[key1 = *key2]` или `[key1=*key2]` сравнивает значение `key1` со значением `key2`, а `[key =~ */pattern/]` рассматривает значение ключа `pattern` как регулярное выражение и сравнивает его со значением ключа `key`. 409 409 410 410 In addition, you can test whether a tag is present or not: 411 411 412 412 {{{#!th align=left valign=top 413 ''' Condition'''413 '''Условие''' 414 414 }}} 415 415 {{{#!th align=left valign=top 416 ''' Example'''417 }}} 418 |------------------------------------------------------------------------------- 419 {{{#!td align=left valign=top 420 Presence of tag 416 '''Пример''' 417 }}} 418 |------------------------------------------------------------------------------- 419 {{{#!td align=left valign=top 420 Наличие тега 421 421 }}} 422 422 {{{#!td align=left valign=top … … 430 430 |------------------------------------------------------------------------------- 431 431 {{{#!td align=left valign=top 432 Absence of tag 432 Отсутствие тега 433 433 }}} 434 434 {{{#!td align=left valign=top … … 457 457 {{{ 458 458 #!mapcss 459 way[!/^addr:/] /* matches any way which does not have a tag'addr:*' */459 way[!/^addr:/] /* соответствует любой линии, не имеющей тега 'addr:*' */ 460 460 }}} 461 461 }}} … … 465 465 466 466 {{{#!th align=left valign=top 467 ''' Condition'''467 '''Условие''' 468 468 }}} 469 469 {{{#!th align=left valign=top 470 ''' Example'''470 '''Пример''' 471 471 }}} 472 472 |------------------------------------------------------------------------------- … … 491 491 }}} 492 492 493 === Territory selector===494 495 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-2codes]. 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.493 === Селектор территории === 494 495 Можно проверить, располагается объект внутри некоторой территории, или за её пределами. В JOSM есть встроенная база данных для этого. Файл территорий — это osm-файл, его можно скачать [/export/HEAD/josm/trunk/data/boundaries.osm здесь] и открыть в JOSM для исследования [attachment:wiki:Help/Styles/MapCSSImplementation:boundaries.png (снимок экрана)]. Он содержит границы всех стран мира. Для повышения производительности границы упрощены. В особых случаях они могут быть уточнены по запросу. Территории "тегированы" их [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 кодами ISO_3166-1_alpha-2]. Для США, Канада, Китай, Индия и Австралия имеются дополнительные границы их территориального деления. Смотрите следующие примеры, как использовать селекторы территории. 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. 496 496 497 497 {{{