
meta {
  title: "Health Boundaries";
  version: "1.10_2021-05-28";
  description: "Colors Health Boundary Polygons and nodes. It Helps monitor and edit Boundaries. Parameter options let select Health levels to show.";
  icon: "health_boundaries_icon.svg";
  author: "pierzen";
  link: "https://josm.openstreetmap.de/wiki/Styles/HealthBoundary";
}

canvas {
    fill-color: #ffffea;
	default-points: false;
	default-lines: false;
}

/* Setting Options - Select Territory layers (boolean value yes/no) */

setting::allow_health_level_4 {
  type: boolean;
  label: tr("allow health_level=4");
  default: false;
}
setting::allow_health_level_5 {
  type: boolean;
  label: tr("allow health_level=5");
  default: true;
}
setting::allow_health_level_6 {
  type: boolean;
  label: tr("allow health_level=6");
  default: false;
}
setting::allow_health_level_8 {
  type: boolean;
  label: tr("allow health_level=8");
  default: true;
}
setting::allow_health_level_10 {
  type: boolean;
  label: tr("allow health_level=10");
  default: false;
}

/*------------------------------------------------------------------------
 First: minimize appearance for areas, ways and nodes
 ------------------------------------------------------------------------*/

area {
	z-index: -1;
	fill-color: #FFFFAA; fill-opacity:0;
	text-color: #FFBBAA; opacity: 0; text-opacity: 0;
}
way {
	z-index: -1;
    width: 0.1; casing-width:0; casing-opacity: 0; 
	color: #FFFFAA; opacity:0;
}
node {
	z-index: -1;
    symbol-shape: square; symbol-size: 0; symbol-stroke-width:0.1 ; 
	symbol-stroke-color: #FFFFAA; symbol-stroke-opacity:0; 
	symbol-fill-opacity:0; icon-opacity: 0;
}

/*------------------------------------------------------------------------
 defines health boundaries pseudo-layer ::layer
 + distinct colors for each health_level 
 + set health_way_selected
 ------------------------------------------------------------------------*/

area[boundary][setting("allow_health_level_10")][health_level=10]::health_level,
area[boundary][setting("allow_health_level_10")][health_level=10] >way::health_level
{	
   set health_area_selected;
   z-index: 11;
   fill-color:green; fill-opacity:0.2;
   font-size: 1;
   text-color: white;
   text: name;
   text-position: center;
   font-size:1;
   width:2;
   color:green;
   opacity: 1; text-opacity: 1;
  }  
area|z12-[health_level=10]::health_level { 	font-size: 14; opacity: 1;} 

area[boundary][setting("allow_health_level_8")][health_level=8]::health_level,
area[boundary][setting("allow_health_level_8")][health_level=8] > way::health_level
{
   set health_area_selected;
   z-index: 13;
   fill-color:blue; fill-opacity:0.2;
   font-size: 1;
   text-color: navy;
   text: name;
   text-position: center;
   width:3;
   color:navy;
   opacity: 1; text-opacity: 1;
 }  
area|z10-[health_layer=8]::health_level { 	font-size: 14;} 
  
area[boundary][setting("allow_health_level_6")][health_level=6]::health_level,
area[boundary][setting("allow_health_level_6")][health_level=6] > way::health_level
{
    set health_area_selected;
	z-index: 15;
   fill-color:darkcyan; fill-opacity:0.2;
   font-size: 15;
   text-color: blue;
   text: name;
   text-position: center;
   width: 3;
   color:blue;
   opacity: 1; text-opacity: 1;
   }
area[boundary][setting("allow_health_level_5")][health_level=5]::health_level,
area[boundary][setting("allow_health_level_5")][health_level=5] > way::health_level
{
   set health_area_selected;
   z-index: 16;
   fill-color:lightcoral; fill-opacity:0.2;
   font-size: 18;
   text-color: brown;
   text: name;
   text-position: center;
   width: 4;
   color: brown;
   opacity: 1; text-opacity: 1;
  }

area[boundary][setting("allow_health_level_4")][health_level=4]::health_level,
area[boundary][setting("allow_health_level_4")][health_level=4]> way::health_level
{
   set health_area_selected;
   z-index: 20;
   fill-color:crimson; fill-opacity:0.2;
   font-size: 20;
   text-color: rose;
   text: name;
   text-position: center;
   width:  5;
   color: crimson;
   opacity: 1; text-opacity: 1;
}

/*------------------------------------------------------------------------
 ways - defines health boundaries pseudo-layer ::layer
 + distinct colors for each health_level 
 + set health_way_selected
 ------------------------------------------------------------------------*/

way[boundary][setting("allow_health_level_10")][health_level=10]::health_level {	
   set health_way_selected;
	width:2;
	color:green;
	opacity: 1;
	casing-color: yellow;
	casing-width: 3;
	casing-opacity: 0.7;
  }  

way[boundary][setting("allow_health_level_8")][health_level=8]::health_level
{
   set health_way_selected;
	width:3;
	color:navy;
	opacity: 1;
	casing-color: yellow;
	casing-width: 3;
	casing-opacity: 0.7;
  }  
  
way[boundary][setting("allow_health_level_6")][health_level=6]::health_level
{
   set health_way_selected;
   text-position: center;
   width: 3;
   color:blue;
	opacity: 1;
   casing-color: yellow;
   casing-width: 3;
   casing-opacity: 0.7;
   }

way[boundary][setting("allow_health_level_5")][health_level=5]::health_level
{
   set health_way_selected;
	width: 4;
	color: brown;
	opacity: 1;
	opacity:0.3;
	casing-color: yellow;
	casing-width: 3;
	casing-opacity: 0.7;
  }

way[boundary][setting("allow_health_level_4")][health_level=4]::health_level
{
    set health_way_selected;
	width:  5;
	color: crimson;
	opacity: 1;
	casing-color: yellow;
	casing-width: 3;
	casing-opacity: 0.7;
}

/*------------------------------------------------------------------------
 nodes - add to health boundaries pseudo-layer ::layer
 + set health_nodes_selected 
 ------------------------------------------------------------------------*/

area[boundary][setting("allow_health_level_10")][health_level=10] > node::health_level, 
area[boundary][setting("allow_health_level_8")][health_level=8] > node::health_level, 
area[boundary][setting("allow_health_level_6")][health_level=6] > node::health_level, 
area[boundary][setting("allow_health_level_5")][health_level=5] > node::health_level, 
area[boundary][setting("allow_health_level_4")][health_level=4] > node::health_level {	
   set health_nodes_selected;
  }  

/*------------------------------------------------------------------------
 health boundaries pseudo-layer ::layer
 areas - ways   ------------------------------------------------------------------------*/
	
area[boundary=health][!name]:closed::health_level 
{
	text-color:yellow;
	text: eval("name ?");
	text-opacity: 1;
	font-opacity: 1;
	fill-opacity: 0.4;
	}

area[boundary=health]:selected::health_level
{
  casing-width: 6; casing-color:red; casing-opacity:0.8;
} 	


area|z12-[boundary=health]:unclosed_multipolygon::health_level
{
  text: name;
  text-halo-radius: 10;
  text-halo-color: yellow;
  text-halo-opacity: 0.3;
  font-size: 14;
  text-opacity: 1;
	}

area[boundary=health]:unclosed_multipolygon::health_level > way	
{
  text:"";
  casing-width:6;
  casing-dashes: 10,10;
  casing-color:yellow;
  casing-opacity:1;  
	}
	
/*------------------------------------------------------------------------
 health boundaries 
 colorize
 ------------------------------------------------------------------------*/

area::health_layer > node|z1-13 {
	symbol-size:0.01;
	symbol-shape: square;
	symbol-stroke-color: #00ffff;
	symbol-stroke-width: 0.01;
	symbol-fill-color: #00FFFF;
	symbol-fill-opacity:0;
	symbol-stroke-opacity: 0;
}

node|z14-[(parent_tag(health_level))]::health_level
{
	symbol-size:4;
	symbol-shape: square;
	symbol-stroke-color: #00ffff;
	symbol-stroke-width: 1;
	symbol-fill-color: #FFAAFF;
	symbol-fill-opacity:0.8;
	symbol-stroke-opacity: 0.8;
}


node|z12-[(parent_tag(health_level))]:connection::health_level {
	symbol-size:10;
	symbol-shape: circle;
	symbol-stroke-color: #00ffff;
	symbol-stroke-width: 2;
	symbol-stroke-opacity: 1;
	symbol-fill-color: crimson;
	symbol-fill-opacity:1;
	opacity: 1;
}

/* connection nodes - unclosed areas */

area|z11-!:closed[boundary=health]::health_level >[index=1] node!:connection,
area|z11-!:closed[boundary=health]::health_level >[index=-1] node!:connection 
{ 
	symbol-fill-color: yellow;
	symbol-stroke-color: crimson;
	symbol-stroke-width: 4;
	symbol-shape: triangle;
	symbol-size: 30;
	symbol-stroke-opacity:1; 
	symbol-fill-opacity:1;
}
