Skip to content

Commit

Permalink
Merge pull request #1042 from ZeLonewolf/clay-shields-us-mn-countyfix
Browse files Browse the repository at this point in the history
change shields of Lincoln and Rock Counties, Minnesota
  • Loading branch information
claysmalley authored Apr 18, 2024
2 parents 9cf4cdd + 7e65cca commit 2e9ca98
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 21 deletions.
39 changes: 25 additions & 14 deletions src/js/shield_defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,6 @@ export function loadShields() {
"Lake",
"Lake_of_the_Woods",
"Le_Sueur",
"Lincoln",
"Lyon",
"Mahnomen",
"Marshall",
Expand All @@ -1305,7 +1304,6 @@ export function loadShields() {
"Redwood",
"Renville",
"Rice",
"Rock",
"Roseau",
"Saint_Louis",
"Scott",
Expand All @@ -1328,11 +1326,7 @@ export function loadShields() {
"Yellow_Medicine",
].forEach(
(county) =>
([
shields[`US:MN:${county}:CSAH`],
shields[`US:MN:${county}:CR`],
shields[`US:MN:${county}:Park_Access`],
] = [
([shields[`US:MN:${county}:CSAH`], shields[`US:MN:${county}:CR`]] = [
pentagonUpShield(
3,
15,
Expand All @@ -1341,15 +1335,32 @@ export function loadShields() {
Color.shields.white
),
roundedRectShield(Color.shields.white, Color.shields.black),
trapezoidDownShield(
10,
Color.shields.brown,
Color.shields.white,
Color.shields.white,
2
),
])
);
["CSAH", "CR"].forEach(
(network) =>
(shields[`US:MN:Lincoln:${network}`] = pentagonUpShield(
3,
15,
Color.shields.blue,
Color.shields.yellow,
Color.shields.white
))
);
["CSAH", "CR"].forEach(
(network) =>
(shields[`US:MN:Rock:${network}`] = roundedRectShield(
Color.shields.white,
Color.shields.black
))
);
shields[`US:MN:Hennepin:Park_Access`] = trapezoidDownShield(
10,
Color.shields.brown,
Color.shields.white,
Color.shields.white,
2
);

// Missouri
shields["US:MO"] = {
Expand Down
8 changes: 5 additions & 3 deletions src/layer/highway_shield.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function routeConcurrency(routeIndex) {
"case",
[
"any",
...orderedRouteAttributes.map(a => ["has", `route_${routeIndex}_${a}`]),
...orderedRouteAttributes.map((a) => ["has", `route_${routeIndex}_${a}`]),
],
["image", getImageNameExpression(routeIndex)],
["literal", ""],
Expand All @@ -32,7 +32,9 @@ function routeConcurrency(routeIndex) {
export function parseImageName(imageName) {
let lines = imageName.split("\n");
lines.shift(); // "shield"
let parsed = Object.fromEntries(orderedRouteAttributes.map((a, i) => [a, lines[i]]));
let parsed = Object.fromEntries(
orderedRouteAttributes.map((a, i) => [a, lines[i]])
);
parsed.imageName = imageName;
return parsed;
}
Expand Down Expand Up @@ -105,6 +107,6 @@ export const shield = {
},
filter: [
"any",
...orderedRouteAttributes.map(a => ["has", `route_1_${a}`]),
...orderedRouteAttributes.map((a) => ["has", `route_1_${a}`]),
],
};
32 changes: 28 additions & 4 deletions test/spec/highway_shield.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,29 @@ describe("highway_shield", function () {
};

it("parses an image name for a numbered route", function () {
expectImageName("NET", "REF", undefined, undefined, "shield\nNET\nREF\n\n");
expectImageName("NET", "REF", "NAME", undefined, "shield\nNET\nREF\nNAME\n");
expectImageName(
"NET",
"REF",
undefined,
undefined,
"shield\nNET\nREF\n\n"
);
expectImageName(
"NET",
"REF",
"NAME",
undefined,
"shield\nNET\nREF\nNAME\n"
);
});
it("parses an image name for an unnumbered route", function () {
expectImageName("NET", undefined, undefined, undefined, "shield\nNET\n\n\n");
expectImageName(
"NET",
undefined,
undefined,
undefined,
"shield\nNET\n\n\n"
);
});
it("parses an image name for a named route", function () {
expectImageName(
Expand All @@ -61,7 +79,13 @@ describe("highway_shield", function () {
);
});
it("parses an image name for a network-independent route", function () {
expectImageName(undefined, "REF", "NAME", undefined, "shield\n\nREF\nNAME\n");
expectImageName(
undefined,
"REF",
"NAME",
undefined,
"shield\n\nREF\nNAME\n"
);
});
});
});

0 comments on commit 2e9ca98

Please sign in to comment.