2023-10-12 16:55:26 +02:00
import { MinimalTagRenderingConfigJson , TagRenderingConfigJson } from "./TagRenderingConfigJson"
2022-07-18 00:10:41 +02:00
import { TagConfigJson } from "./TagConfigJson"
2021-10-19 02:31:32 +02:00
2023-10-06 23:56:50 +02:00
export interface IconConfigJson {
2023-10-07 03:07:32 +02:00
/ * *
* question : What icon should be used ?
* type : icon
2024-01-12 23:19:31 +01:00
* suggestions : return Constants . defaultPinIcons . map ( i = > ( { if : "value=" + i , then : i , icon : i } ) )
2023-10-07 03:07:32 +02:00
* /
2023-10-12 16:55:26 +02:00
icon : string | MinimalTagRenderingConfigJson | { builtin : string ; override : any }
2023-10-07 03:07:32 +02:00
/ * *
* question : What colour should the icon be ?
* This will only work for the default icons such as ` pin ` , ` circle ` , . . .
* type : color
* /
2023-10-12 16:55:26 +02:00
color? : string | MinimalTagRenderingConfigJson | { builtin : string ; override : any }
2023-10-06 23:56:50 +02:00
}
2021-10-19 02:31:32 +02:00
/ * *
* The PointRenderingConfig gives all details onto how to render a single point of a feature .
2021-11-07 16:34:51 +01:00
*
2021-10-19 02:31:32 +02:00
* This can be used if :
2021-11-07 16:34:51 +01:00
*
2021-10-19 02:31:32 +02:00
* - The feature is a point
* - To render something at the centroid of an area , or at the start , end or projected centroid of a way
* /
export default interface PointRenderingConfigJson {
/ * *
2023-10-06 23:56:50 +02:00
* question : At what location should this icon be shown ?
* multianswer : true
2024-04-23 21:42:35 +02:00
* suggestions : return [ { if : "value=point" , then : "Show an icon for point (node) objects" } , { if : "value=centroid" , then : "Show an icon for line or polygon (way) objects at their centroid location" } , { if : "value=start" , then : "Show an icon for line (way) objects at the start" } , { if : "value=end" , then : "Show an icon for line (way) object at the end" } , { if : "value=projected_centerpoint" , then : "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons" } , { if : "value=polygon_centroid" , then : "Show an icon at a polygon centroid (but not if it is a way)" } ]
2021-10-19 02:31:32 +02:00
* /
2024-02-20 13:33:38 +01:00
location : (
| "point"
| "centroid"
| "start"
| "end"
| "projected_centerpoint"
| "polygon_centroid"
| string
) [ ]
2021-11-07 16:34:51 +01:00
2021-10-19 02:31:32 +02:00
/ * *
2023-10-07 03:07:32 +02:00
* The marker for an element .
* Note that this also defines the icon for this layer ( rendered with the overpass - tags ) < i > and < / i > the icon in the presets .
*
* The result of the icon is rendered as follows :
* - The first icon is rendered on the map
* - The second entry is overlayed on top of it
* - . . .
*
* As a result , on could use a generic icon ( ` pin ` , ` circle ` , ` square ` ) with a color , then overlay it with a specific icon .
* /
2023-10-06 23:56:50 +02:00
marker? : IconConfigJson [ ]
2021-10-19 02:31:32 +02:00
/ * *
2021-10-21 21:41:45 +02:00
* A list of extra badges to show next to the icon as small badge
* They will be added as a 25 % height icon at the bottom right of the icon , with all the badges in a flex layout .
2021-10-19 02:31:32 +02:00
*
2021-10-21 21:41:45 +02:00
* Note : strings are interpreted as icons , so layering and substituting is supported . You can use ` circle:white;./my_icon.svg ` to add a background circle
2023-11-09 15:42:15 +01:00
* group : hidden
2021-10-19 02:31:32 +02:00
* /
2022-02-04 15:48:26 +01:00
iconBadges ? : {
2022-07-18 00:10:41 +02:00
if : TagConfigJson
2022-01-31 00:39:54 +01:00
/ * *
* Badge to show
* Type : icon
* /
2023-10-12 16:55:26 +02:00
then : string | MinimalTagRenderingConfigJson
2022-01-31 00:39:54 +01:00
} [ ]
2021-10-19 02:31:32 +02:00
/ * *
2023-10-07 03:07:32 +02:00
* question : What size should the marker be on the map ?
* A string containing "<width>,<height>" in pixels
* ifunset : Use the default size ( < b > 40 , 40 < / b > px )
2021-10-19 02:31:32 +02:00
* /
iconSize? : string | TagRenderingConfigJson
2023-06-20 02:02:45 +02:00
/ * *
* question : What is the anchorpoint of the icon ?
*
* This matches the geographical point with a location on the icon .
*
2023-10-06 23:56:50 +02:00
* ifunset : Use MapComplete - default ( < b > center < / b > )
* suggestions : return [ { if : "value=center" , then : "Place the <b>center</b> of the icon on the geographical location" } , { if : "value=top" , then : "Place the <b>top</b> of the icon on the geographical location" } , { if : "value=bottom" , then : "Place the <b>bottom</b> of the icon on the geographical location" } , { if : "value=left" , then : "Place the <b>left</b> of the icon on the geographical location" } , { if : "value=right" , then : "Place the <b>right</b> of the icon on the geographical location" } ]
2023-06-20 02:02:45 +02:00
* /
2023-06-20 02:47:20 +02:00
anchor ? : "center" | "top" | "bottom" | "left" | "right" | string | TagRenderingConfigJson
2023-06-20 02:02:45 +02:00
2021-10-19 02:31:32 +02:00
/ * *
2023-10-07 03:07:32 +02:00
* question : What rotation should be applied on the icon ?
* This is mostly useful for items that face a specific direction , such as surveillance cameras
* This is interpreted as css property for 'rotate' , thus has to end with 'deg' , e . g . ` 90deg ` , ` {direction}deg ` , ` calc(90deg - {camera:direction}deg) ` `
* ifunset : Do not rotate
2021-10-19 02:31:32 +02:00
* /
rotation? : string | TagRenderingConfigJson
/ * *
2023-10-06 23:56:50 +02:00
* question : What label should be shown beneath the marker ?
2023-10-07 03:07:32 +02:00
* For example : ` <div style="background: white">{name}</div> `
2021-10-19 02:31:32 +02:00
*
* If the icon is undefined , then the label is shown in the center of the feature .
2023-11-05 12:05:00 +01:00
* types : Dynamic value based on the attributes ; string
2023-10-06 23:56:50 +02:00
* inline : Always show label < b > { value } < / b > beneath the marker
2023-10-13 18:46:56 +02:00
* ifunset : Do not show a label beneath the marker
2021-10-19 02:31:32 +02:00
* /
label? : string | TagRenderingConfigJson
2022-12-09 13:58:41 +01:00
/ * *
2023-11-09 15:42:15 +01:00
* question : What CSS should be applied to the label ?
2023-10-06 23:56:50 +02:00
* You can set the css - properties here , e . g . ` background: red; font-size: 12px; `
2023-11-09 15:42:15 +01:00
* inline : Apply CSS - style < b > { value } < / b > to the label
2023-10-06 23:56:50 +02:00
* types : Dynamic value ; string
2023-11-09 15:42:15 +01:00
* ifunset : Do not apply extra CSS - labels to the label
* group : expert
2022-12-09 13:58:41 +01:00
* /
2023-11-09 15:42:15 +01:00
labelCss? : TagRenderingConfigJson | string
2022-12-09 13:58:41 +01:00
/ * *
2023-11-09 15:42:15 +01:00
* question : Which CSS - classes should be applied to the label ?
2023-10-06 23:56:50 +02:00
*
* The classes should be separated by a space ( ` ` )
* You can use most Tailwind - css classes , see https : //tailwindcss.com/ for more information
* For example : ` center bg-gray-500 mx-2 my-1 rounded-full `
2023-11-09 15:42:15 +01:00
* inline : Apply CSS - classes < b > { value } < / b > to the label
2023-10-06 23:56:50 +02:00
* types : Dynamic value ; string
2023-11-09 15:42:15 +01:00
* ifunset : Do not apply extra CSS - classes to the label
* suggestions : return [ { if : "value=bg-white rounded px-2" , then : "Draw on a white background" } ]
2022-12-09 13:58:41 +01:00
* /
2023-11-09 15:42:15 +01:00
labelCssClasses? : string | TagRenderingConfigJson
2023-03-25 02:48:24 +01:00
2023-04-02 02:59:20 +02:00
/ * *
2023-11-09 15:42:15 +01:00
* question : What CSS should be applied to the entire marker ?
2023-10-06 23:56:50 +02:00
* You can set the css - properties here , e . g . ` background: red; font-size: 12px; `
2023-11-09 15:42:15 +01:00
* This will be applied to the _container_ containing both the marker and the label
* inline : Apply CSS - style < b > { value } < / b > to the _entire marker_
2023-10-06 23:56:50 +02:00
* types : Dynamic value ; string
2023-11-09 15:42:15 +01:00
* ifunset : Do not apply extra CSS element to the entire marker
* group : expert
2023-04-02 02:59:20 +02:00
* /
2023-11-09 15:42:15 +01:00
css? : string | TagRenderingConfigJson
2023-04-02 02:59:20 +02:00
/ * *
2023-11-09 15:42:15 +01:00
* question : Which CSS - classes should be applied to the entire marker ?
* This will be applied to the _container_ containing both the marker and the label
2023-10-06 23:56:50 +02:00
*
* The classes should be separated by a space ( ` ` )
* You can use most Tailwind - css classes , see https : //tailwindcss.com/ for more information
* For example : ` center bg-gray-500 mx-2 my-1 rounded-full `
2023-11-09 15:42:15 +01:00
* inline : Apply CSS - classes < b > { value } < / b > to the entire container
2023-10-13 18:46:56 +02:00
* ifunset : Do not apply extra CSS - classes to the label
2023-11-09 15:42:15 +01:00
* types : Dynamic value ; string
* ifunset : Do not apply extra CSS - classes to the entire marker
* group : expert
2023-04-02 02:59:20 +02:00
* /
2023-11-09 15:42:15 +01:00
cssClasses? : string | TagRenderingConfigJson
2023-04-02 02:59:20 +02:00
2023-03-25 02:48:24 +01:00
/ * *
2023-10-07 03:07:32 +02:00
* question : If the map is pitched , should the icon stay parallel to the screen or to the groundplane ?
* suggestions : return [ { if : "value=canvas" , then : "The icon will stay upward and not be transformed as if it sticks to the screen" } , { if : "value=map" , then : "The icon will be transformed as if it were painted onto the ground. (Automatically sets rotationAlignment)" } ]
2023-11-09 15:42:15 +01:00
* group : expert
2023-03-25 02:48:24 +01:00
* /
pitchAlignment ? : "canvas" | "map" | TagRenderingConfigJson
/ * *
2023-10-07 03:07:32 +02:00
* question : Should the icon be rotated if the map is rotated ?
2023-10-06 23:56:50 +02:00
* ifunset : Do not rotate or tilt icons . Always keep the icons straight
2023-10-07 03:07:32 +02:00
* suggestions : return [ { if : "value=canvas" , then : "Never rotate the icon" } , { if : "value=map" , then : "If the map is rotated, rotate the icon as well. This gives the impression of an icon that floats perpendicular above the ground." } ]
2023-11-09 15:42:15 +01:00
* group : expert
2023-03-25 02:48:24 +01:00
* /
rotationAlignment ? : "map" | "canvas" | TagRenderingConfigJson
2021-10-19 02:31:32 +02:00
}