From de09a4e3bb70676dc44f0110301880a73f5518aa Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Wed, 29 May 2024 21:04:38 -0400 Subject: [PATCH 1/3] Refactor all special case shield definitions inline --- src/js/shield_defs.js | 383 ++++++++++++++++++++---------------------- 1 file changed, 180 insertions(+), 203 deletions(-) diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index 322a8d340..8172f8718 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -105,12 +105,33 @@ export function loadShields() { // NORTH AMERICA shields["GLCT"] = { notext: true, + overrideByRef: { + LECT: { + spriteBlank: "shield_glct_lect", + }, + LHCT: { + spriteBlank: "shield_glct_lhct", + }, + LMCT: { + spriteBlank: "shield_glct_lmct", + colorLighten: Color.shields.green, + }, + LSCT: { + spriteBlank: "shield_glct_lsct", + }, + }, + }; + shields["GLCT:Loop"] = { + ...shields["GLCT"], + banners: ["LOOP"], + bannerColor: Color.shields.brown, + overrideByRef: { + LMCT: { + spriteBlank: "shield_glct_lmct", + colorLighten: Color.shields.brown, + }, + }, }; - shields["GLCT:Loop"] = banneredShield( - shields["GLCT"], - ["LOOP"], - Color.shields.brown - ); // Canada shields["CA:transcanada"] = { @@ -214,6 +235,50 @@ export function loadShields() { ); shields["CA:NS:S"] = { notext: true, + overrideByName: { + "A. Murray MacKay Bridge": { + spriteBlank: "shield_ca_ns_s_mkb", + }, + "Angus L. MacDonald Bridge": { + spriteBlank: "shield_ca_ns_s_mdb", + }, + "Bras d'Or Lakes Scenic Drive": { + spriteBlank: "shield_ca_ns_s_bdolsd", + }, + "Ceilidh Trail": { + spriteBlank: "shield_ca_ns_s_cet", + }, + "Cabot Trail": { + spriteBlank: "shield_ca_ns_s_ct", + }, + "Digby Neck and Islands Scenic Drive": { + spriteBlank: "shield_ca_ns_s_dnisd", + }, + "Evangeline Trail": { + spriteBlank: "shield_ca_ns_s_et", + }, + "Fleur-de-lis Trail": { + spriteBlank: "shield_ca_ns_s_fdlt", + }, + "Glooscap Trail": { + spriteBlank: "shield_ca_ns_s_gt", + }, + "Kejimkujik Scenic Drive": { + spriteBlank: "shield_ca_ns_s_ksd", + }, + "Lighthouse Route": { + spriteBlank: "shield_ca_ns_s_lr", + }, + "Marine Drive": { + spriteBlank: "shield_ca_ns_s_md", + }, + "Marconi Trail": { + spriteBlank: "shield_ca_ns_s_mt", + }, + "Sunrise Trail": { + spriteBlank: "shield_ca_ns_s_st", + }, + }, }; // Northwest Territories @@ -238,6 +303,13 @@ export function loadShields() { top: 6, bottom: 2, }, + overrideByRef: { + QEW: { + textColor: Color.shields.blue, + colorLighten: Color.shields.blue, + colorDarken: Color.shields.yellow, + }, + }, }; shields["CA:ON:primary:Toll"] = { ...shields["CA:ON:primary"], @@ -446,6 +518,13 @@ export function loadShields() { // Yukon shields["CA:YT"] = roundedRectShield(Color.shields.white, Color.shields.red); + shields["CA:YT"].overrideByRef = { + 2: roundedRectShield(Color.shields.white, "#ce9d00"), + 3: roundedRectShield(Color.shields.white, "#ce9d00"), + 5: roundedRectShield(Color.shields.white, Color.shields.blue), + 6: roundedRectShield(Color.shields.white, Color.shields.green), + 11: roundedRectShield(Color.shields.white, Color.shields.blue), + }; // Haiti shields["HT:RN-road"] = shields["HT:RD-road"] = roundedRectShield( @@ -719,6 +798,13 @@ export function loadShields() { top: 4, bottom: 5, }, + overrideByRef: { + 980: { + textColor: Color.shields.white, + colorLighten: Color.shields.white, + colorDarken: Color.shields.blue, + }, + }, }; [ "Calhoun", @@ -913,9 +999,13 @@ export function loadShields() { Color.shields.white, Color.shields.black ); - shields["US:CT:Parkway"] = { notext: true, + overrideByName: { + "Merritt Parkway": { + spriteBlank: "shield_us_ct_parkway_merritt", + }, + }, }; // Washington, D.C. @@ -981,6 +1071,16 @@ export function loadShields() { top: 5, bottom: 4, }, + overrideByRef: { + 515: { + textColor: Color.shields.blue, + colorLighten: Color.shields.blue, + }, + 520: { + textColor: Color.shields.green, + colorLighten: Color.shields.green, + }, + }, }; shields["US:GA:Truck:Bypass"] = banneredShield(shields["US:GA"], [ "TRK", @@ -1161,6 +1261,15 @@ export function loadShields() { top: 2, bottom: 6, }, + refsByName: { + "Audubon Parkway": "AU", + "Bluegrass Parkway": "BG", + "Cumberland Parkway": "LN", + "Hal Rogers Parkway": "HR", + "Mountain Parkway": "MP", + "Purchase Parkway": "JC", + "Western Kentucky Parkway": "WK", + }, }; // Louisiana @@ -1257,6 +1366,15 @@ export function loadShields() { // Michigan shields["US:MI"] = diamondShield(Color.shields.white, Color.shields.black); + shields["US:MI"].overrideByRef = { + 185: diamondShield( + Color.shields.brown, + Color.shields.white, + Color.shields.white, + 0, + 24 + ), + }; shields["US:MI:Business"] = banneredShield(shields["US:MI"], ["BUS"]); shields["US:MI:Connector"] = banneredShield(shields["US:MI"], ["CONN"]); ["CR", "Benzie", "Gogebic", "Kalkaska", "Montcalm", "Roscommon"].forEach( @@ -1477,7 +1595,16 @@ export function loadShields() { Color.shields.brown, Color.shields.white ); - shields["US:MO:Taney:Branson"] = {}; // See ref-specific cases below + shields["US:MO:Taney:Branson"] = { + overrideByRef: { + "Red Route": bransonRouteShield(Color.shields.red, Color.shields.white), + "Yellow Route": bransonRouteShield( + Color.shields.yellow, + Color.shields.green + ), + "Blue Route": bransonRouteShield(Color.shields.blue, Color.shields.white), + }, + }; // Northern Mariana Islands shields["US:MP"] = { @@ -1664,6 +1791,16 @@ export function loadShields() { shields["US:NH:Bypass"] = banneredShield(shields["US:NH"], ["BYP"]); shields["US:NH:Turnpike"] = { notext: true, + overrideByName: { + "Everett Turnpike": { + spriteBlank: "shield_us_nh_turnpike", + colorLighten: Color.shields.green, + }, + "Spaulding Turnpike": { + spriteBlank: "shield_us_nh_turnpike", + colorLighten: Color.shields.blue, + }, + }, }; // New Jersey @@ -1845,6 +1982,18 @@ export function loadShields() { textColor: Color.shields.white, colorLighten: Color.shields.white, colorDarken: Color.shields.green, + refsByName: { + "Bear Mountain State Parkway": "BMP", + "Bronx River Parkway": "BRP", + "Cross County Parkway": "CCP", + "Hutchinson River Parkway": "HRP", + "Korean War Veterans Parkway": "KWVP", + "Mosholu Parkway": "MP", + "Niagara Scenic Parkway": "NSP", + "Saw Mill River Parkway": "SMP", + "Sprain Brook Parkway": "SBP", + "Taconic State Parkway": "TSP", + }, }; shields["US:NY:Parkway:LI"] = { spriteBlank: "shield_us_ny_parkway_li", @@ -2213,7 +2362,16 @@ export function loadShields() { colorDarken: Color.shields.green, }, }; - shields["US:PA:Allegheny:Belt"] = {}; // See ref-specific cases below + shields["US:PA:Allegheny:Belt"] = { + overrideByRef: { + "Red Belt": paBeltShield(Color.shields.red, Color.shields.black), + "Orange Belt": paBeltShield(Color.shields.orange, Color.shields.black), + "Yellow Belt": paBeltShield(Color.shields.yellow, Color.shields.black), + "Green Belt": paBeltShield(Color.shields.green, Color.shields.white), + "Blue Belt": paBeltShield(Color.shields.blue, Color.shields.white), + "Purple Belt": paBeltShield(Color.shields.purple, Color.shields.white), + }, + }; // Puerto Rico shields["US:PR:primary"] = escutcheonDownShield( @@ -2481,17 +2639,21 @@ export function loadShields() { top: 2, bottom: 8, }, + refsByName: { + "Fort Bend Parkway Toll Road": "FBP", + "Fort Bend Westpark Tollway": "WPT", + }, + }; + shields["US:TX:Harris:HCTRA"] = { + ...pentagonUpShield(3, 15, Color.shields.purple, Color.shields.yellow), + refsByName: { + "Sam Houston Tollway": "SHT", + "Fort Bend Toll Road": "FBTR", + "Hardy Toll Road": "HTR", + "Tomball Tollway": "TBT", + "Westpark Tollway": "WPT", + }, }; - shields["US:TX:Harris:HCTRA"] = pentagonUpShield( - 3, - 15, - Color.shields.purple, - Color.shields.yellow, - Color.shields.yellow, - 2, - 0, - 28 - ); // Texas county roads [ @@ -3754,191 +3916,6 @@ export function loadShields() { ); shields["NZ:WRR"] = circleShield(Color.shields.white, Color.shields.black); - // Ref-specific cases. Each entry should be documented in CONTRIBUTE.md - - shields["CA:NS:S"].overrideByName = { - "A. Murray MacKay Bridge": { - spriteBlank: "shield_ca_ns_s_mkb", - }, - "Angus L. MacDonald Bridge": { - spriteBlank: "shield_ca_ns_s_mdb", - }, - "Bras d'Or Lakes Scenic Drive": { - spriteBlank: "shield_ca_ns_s_bdolsd", - }, - "Ceilidh Trail": { - spriteBlank: "shield_ca_ns_s_cet", - }, - "Cabot Trail": { - spriteBlank: "shield_ca_ns_s_ct", - }, - "Digby Neck and Islands Scenic Drive": { - spriteBlank: "shield_ca_ns_s_dnisd", - }, - "Evangeline Trail": { - spriteBlank: "shield_ca_ns_s_et", - }, - "Fleur-de-lis Trail": { - spriteBlank: "shield_ca_ns_s_fdlt", - }, - "Glooscap Trail": { - spriteBlank: "shield_ca_ns_s_gt", - }, - "Kejimkujik Scenic Drive": { - spriteBlank: "shield_ca_ns_s_ksd", - }, - "Lighthouse Route": { - spriteBlank: "shield_ca_ns_s_lr", - }, - "Marine Drive": { - spriteBlank: "shield_ca_ns_s_md", - }, - "Marconi Trail": { - spriteBlank: "shield_ca_ns_s_mt", - }, - "Sunrise Trail": { - spriteBlank: "shield_ca_ns_s_st", - }, - }; - - shields["CA:ON:primary"].overrideByRef = { - QEW: { - textColor: Color.shields.blue, - colorLighten: Color.shields.blue, - colorDarken: Color.shields.yellow, - }, - }; - - shields["CA:YT"].overrideByRef = { - 2: roundedRectShield(Color.shields.white, "#ce9d00"), - 3: roundedRectShield(Color.shields.white, "#ce9d00"), - 5: roundedRectShield(Color.shields.white, Color.shields.blue), - 6: roundedRectShield(Color.shields.white, Color.shields.green), - 11: roundedRectShield(Color.shields.white, Color.shields.blue), - }; - - shields["US:AR"].overrideByRef = { - 980: { - textColor: Color.shields.white, - colorLighten: Color.shields.white, - colorDarken: Color.shields.blue, - }, - }; - - shields["US:GA"].overrideByRef = { - 515: { - textColor: Color.shields.blue, - colorLighten: Color.shields.blue, - }, - 520: { - textColor: Color.shields.green, - colorLighten: Color.shields.green, - }, - }; - - shields["US:KY:Parkway"].refsByName = { - "Audubon Parkway": "AU", - "Bluegrass Parkway": "BG", - "Cumberland Parkway": "LN", - "Hal Rogers Parkway": "HR", - "Mountain Parkway": "MP", - "Purchase Parkway": "JC", - "Western Kentucky Parkway": "WK", - }; - - shields["US:CT:Parkway"].overrideByName = { - "Merritt Parkway": { - spriteBlank: "shield_us_ct_parkway_merritt", - }, - }; - - shields["US:MI"].overrideByRef = { - 185: diamondShield( - Color.shields.brown, - Color.shields.white, - Color.shields.white, - 0, - 24 - ), - }; - - shields["US:MO:Taney:Branson"].overrideByRef = { - "Red Route": bransonRouteShield(Color.shields.red, Color.shields.white), - "Yellow Route": bransonRouteShield( - Color.shields.yellow, - Color.shields.green - ), - "Blue Route": bransonRouteShield(Color.shields.blue, Color.shields.white), - }; - - shields["US:NH:Turnpike"].overrideByName = { - "Everett Turnpike": { - spriteBlank: "shield_us_nh_turnpike", - colorLighten: "#006747", - }, - "Spaulding Turnpike": { - spriteBlank: "shield_us_nh_turnpike", - colorLighten: "#003F87", - }, - }; - - shields["US:NY:Parkway"].refsByName = { - "Bear Mountain State Parkway": "BMP", - "Bronx River Parkway": "BRP", - "Cross County Parkway": "CCP", - "Hutchinson River Parkway": "HRP", - "Korean War Veterans Parkway": "KWVP", - "Mosholu Parkway": "MP", - "Niagara Scenic Parkway": "NSP", - "Saw Mill River Parkway": "SMP", - "Sprain Brook Parkway": "SBP", - "Taconic State Parkway": "TSP", - }; - - shields["US:PA:Allegheny:Belt"].overrideByRef = { - "Red Belt": paBeltShield(Color.shields.red, Color.shields.black), - "Orange Belt": paBeltShield(Color.shields.orange, Color.shields.black), - "Yellow Belt": paBeltShield(Color.shields.yellow, Color.shields.black), - "Green Belt": paBeltShield(Color.shields.green, Color.shields.white), - "Blue Belt": paBeltShield(Color.shields.blue, Color.shields.white), - "Purple Belt": paBeltShield(Color.shields.purple, Color.shields.white), - }; - - shields["US:TX:Fort_Bend:FBCTRA"].refsByName = { - "Fort Bend Parkway Toll Road": "FBP", - "Fort Bend Westpark Tollway": "WPT", - }; - shields["US:TX:Harris:HCTRA"].refsByName = { - "Sam Houston Tollway": "SHT", - "Fort Bend Toll Road": "FBTR", - "Hardy Toll Road": "HTR", - "Tomball Tollway": "TBT", - "Westpark Tollway": "WPT", - }; - - shields["GLCT"].overrideByRef = { - LECT: { - spriteBlank: "shield_glct_lect", - }, - LHCT: { - spriteBlank: "shield_glct_lhct", - }, - LMCT: { - spriteBlank: "shield_glct_lmct", - colorLighten: Color.shields.green, - }, - LSCT: { - spriteBlank: "shield_glct_lsct", - }, - }; - - shields["GLCT:Loop"].overrideByRef = { - LMCT: { - spriteBlank: "shield_glct_lmct", - colorLighten: Color.shields.brown, - }, - }; - return { networks: shields, options: { From 8073dfdb62d8a5a16e70e6751c7be36782b51522 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Mon, 3 Jun 2024 11:10:13 -0400 Subject: [PATCH 2/3] fix bannerTextColor typo --- src/js/shield_defs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index e35e0207a..bae18b684 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -124,7 +124,7 @@ export function loadShields() { shields["GLCT:Loop"] = { ...shields["GLCT"], banners: ["LOOP"], - bannerColor: Color.shields.brown, + bannerTextColor: Color.shields.brown, overrideByRef: { LMCT: { spriteBlank: "shield_glct_lmct", From 97cf3de7406d640626f0c93bb6f9bb266a4eb40e Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Mon, 3 Jun 2024 11:14:29 -0400 Subject: [PATCH 3/3] combine Yukon shields into one declaration --- src/js/shield_defs.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/js/shield_defs.js b/src/js/shield_defs.js index bae18b684..b2bfa3673 100644 --- a/src/js/shield_defs.js +++ b/src/js/shield_defs.js @@ -517,13 +517,15 @@ export function loadShields() { ); // Yukon - shields["CA:YT"] = roundedRectShield(Color.shields.white, Color.shields.red); - shields["CA:YT"].overrideByRef = { - 2: roundedRectShield(Color.shields.white, "#ce9d00"), - 3: roundedRectShield(Color.shields.white, "#ce9d00"), - 5: roundedRectShield(Color.shields.white, Color.shields.blue), - 6: roundedRectShield(Color.shields.white, Color.shields.green), - 11: roundedRectShield(Color.shields.white, Color.shields.blue), + shields["CA:YT"] = { + ...roundedRectShield(Color.shields.white, Color.shields.red), + overrideByRef: { + 2: roundedRectShield(Color.shields.white, "#ce9d00"), + 3: roundedRectShield(Color.shields.white, "#ce9d00"), + 5: roundedRectShield(Color.shields.white, Color.shields.blue), + 6: roundedRectShield(Color.shields.white, Color.shields.green), + 11: roundedRectShield(Color.shields.white, Color.shields.blue), + }, }; // Haiti