Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shields of Kentucky #119

Merged
merged 16 commits into from
Feb 17, 2022
Merged
65 changes: 65 additions & 0 deletions style/icons/shield40_us_ky_parkway.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions style/js/shield.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function textColor(shieldDef) {
return "black";
}

function drawShield(network, ref) {
function drawShield(network, ref, wayName) {
var shieldDef = ShieldDef.shields[network];
var ctx = null;
var bannerCount = 0;
Expand Down Expand Up @@ -137,6 +137,10 @@ function drawShield(network, ref) {
bannerCount = ShieldDef.getBannerCount(shieldDef);
padding = shieldDef.padding;

if (shieldDef.refsByWayName) {
ref = shieldDef.refsByWayName[wayName];
}

var shieldArtwork = getRasterShieldBlank(network, ref);
var compoundBounds = null;
var shieldBounds = null;
Expand Down Expand Up @@ -227,14 +231,15 @@ export function missingIconLoader(map, e) {
return;
}

var network_ref = id.split("_")[1];
var network_ref = id.split("\n")[1];
var network_ref_parts = network_ref.split("=");
var network = network_ref_parts[0];
var ref = network_ref_parts[1];
var wayName = id.split("\n")[2];

var colorLighten = ShieldDef.shieldLighten(network, ref);

var ctx = drawShield(network, ref);
var ctx = drawShield(network, ref, wayName);

if (ctx == null) {
//Does not meet the criteria to draw a shield
Expand Down
26 changes: 26 additions & 0 deletions style/js/shield_defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,32 @@ export function loadShields(shieldImages) {
},
};

shields["US:KY"] = circleShield("white", "black");
shields["US:KY:AA"] = {
backgroundImage: shieldImages.shield40_us_ky_parkway,
textColor: "#003f87",
padding: {
left: 2,
right: 2,
top: 2,
bottom: 6,
},
};
shields["US:KY:Parkway"] = Object.assign(
{
refsByWayName: {
"Audobon Parkway": "AU",
"Bluegrass Pkwy": "BG",
"Cumberland Pkwy": "LN",
"Hal Rogers Pkwy": "HR",
"Mountain Pkwy": "MP",
"Purchase Pkwy": "JC",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted these initialisms from KYTC’s internal alphanumeric route numbers. Some of them are pretty recognizable, but some like “JC” are more obscure. (It’s from the namesake in the official name.) For the benefit of non-locals who don’t remember the older, more usable shields, I’d be open to changing it to something more intuitive, like “P”, but such ad-hoc abbreviations definitely shouldn’t go into OSM.

"Western Kentucky Pkwy": "WK",
},
},
shields["US:KY:AA"]
);

shields["US:MI"] = diamondShield;

shields["US:MN"] = {
Expand Down
5 changes: 4 additions & 1 deletion style/layer/highway_shield.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ function routeConcurrency(num) {
return [
"case",
["!=", ["get", "route_" + num], null],
["image", ["concat", "shield_", ["get", "route_" + num]]],
[
"image",
["concat", "shield\n", ["get", "route_" + num], "\n", ["get", "name"]],
],
["literal", ""],
];
}
Expand Down