wiki:Styles/MapWithAI

Version 17 (modified by taylor.smock, 4 years ago) ( diff )

Add option of programatic colors

MapWithAI

This style highlights probable MapWithAI objects. The color was adjustable via the Color Preferences. It is currently not adjustable via Color Preferences, but it can be changed in Advanced Preferences (search for mapwithai.mappaint and change the appropriate settings -- defaults are #FF00FF). This is due to programmatically using the source tag to get the color preference.

meta
{
    title: "MapWithAI";
    description: "Visualization of MapWithAI data";
    icon: "mapwithai.svg";
    author: "Taylor Smock";
    version: "1.19_2021-03-23";
    min-josm-version: "15229";
}

/********************************
 * Settings for the paint style *
 ********************************/
@supports (min-josm-version: 15289) {
    settings::show_all {
        label: tr("Show possible MapWithAI objects");
    }
}

setting::show_new {
    type: boolean;
    label: tr("New");
    default: true;
    group: "show_all";
}
setting::show_modified {
    type: boolean;
    label: tr("Modified");
    default: false;
    group: "show_all";
}
setting::show_old {
    type: boolean;
    label: tr("Pre-existing");
    default: false;
    group: "show_all";
}

setting::decemberHolidayStyle {
    type: boolean;
    label: tr("Mappy Holidays!");
    default: false;
}

/* This requires support in the plugin (will read key for mapwithai.mapcss:boolean:toggle_with_layer) */
setting::toggle_with_layer {
    type: boolean;
    label: tr("Toggle paintstyle on/off with layer");
    default: true;
}

/************************************
 * End Settings for the paint style *
 ************************************/

/***************************************************
 * Set .mapwithai for all known MapWithAI datasets *
 ***************************************************/

way["source"][regexp_test(concat("^(", JOSM_pref("mapwithai.mappaint.sources", "microsoft/.*|digitalglobe|maxar|esri/.*"), ")$"), tag("source"))][setting("show_new")]:new,
way["mapwithai:source"][setting("show_new")] {
    set .mapwithai;
    set_color: JOSM_pref(concat("mapwithai.mappaint.", any(tag("source"), tag("mapwithai:source")), "_new"), #FF00FF);
}
way["source"][regexp_test(concat("^(", JOSM_pref("mapwithai.mappaint.sources", "microsoft/.*|digitalglobe|maxar|esri/.*"), ")$"), tag("source"))][setting("show_old")]!:new!:modified,
way["mapwithai:source"][setting("show_old")]!:new!:modified {
    set .mapwithai;
    set_color: JOSM_pref(concat("mapwithai.mappaint.", any(tag("source"), tag("mapwithai:source")), "_old"), #FF00FF);
}
way[regexp_test(concat("^(", JOSM_pref("mapwithai.mappaint.sources", "microsoft/.*|digitalglobe|maxar|esri/.*"), ")$"), tag("source"))][setting("show_modified")]:modified,
way["mapwithai:source"][setting("show_modified")]:modified {
    set .mapwithai;
    set_color: JOSM_pref(concat("mapwithai.mappaint.", any(tag("source"), tag("mapwithai:source")), "_modified"), #FF00FF);
}

way.mapwithai {
    color: any(prop("set_color_programatic"), prop("set_color"));
}

way.mapwithai:closed2 {
    fill-color: any(prop("set_color_programatic"), prop("set_color"));
}

way.mapwithai[setting("decemberHolidayStyle")] {
    holidayColour: CRC32_checksum(osm_id()) > 2147483647.5
}


/*****************
 * Holiday Theme *
 *****************/
way.mapwithai[is_prop_set("holidayColour") && prop("holidayColour")] {
    color: mapwithaiDecemberGreen#00FF00;
    dashes: 20;
    dashes-background-color: mapwithaiDecemberWhite#FFFFFF;
}
way.mapwithai[is_prop_set("holidayColour") && !prop("holidayColour")] {
    color: mapwithaiDecemberRed#FC6262;
    dashes: 20;
    dashes-background-color: mapwithaiDecemberWhite#FFFFFF;
}
way.mapwithai[is_prop_set("holidayColour") && prop("holidayColour")]:closed2 {
    fill-color: mapwithaiDecemberGreen#00FF00;
}
way.mapwithai[is_prop_set("holidayColour") && !prop("holidayColour")]:closed2 {
    fill-color: mapwithaiDecemberRed#FC6262;
}

way.mapwithai[is_prop_set("holidayColour")]:selected {
    color: mapWithAIDecemberSelected#FF0000;
    dashes: 0;
}
/*********************
 * End Holiday Theme *
 *********************/

Styles_MapWithAI-style.mapcss, Styles_MapWithAI.zip

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.