Skip to content

Commit

Permalink
Simplify railroad bridge casing
Browse files Browse the repository at this point in the history
  • Loading branch information
claysmalley committed Jul 17, 2022
1 parent 97e8de6 commit 9606556
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 64 deletions.
6 changes: 0 additions & 6 deletions src/americana.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,6 @@ var bridgeLayers = [
lyrRail.narrowGaugeBridge.bridgeCasing(),
lyrRail.narrowGaugeServiceBridge.bridgeCasing(),

lyrRail.railBridge.bridgeFill(),
lyrRail.railServiceBridge.bridgeFill(),

lyrRail.narrowGaugeBridge.bridgeFill(),
lyrRail.narrowGaugeServiceBridge.bridgeFill(),

lyrRoad.tertiaryLinkBridge.casing(),
lyrRoad.secondaryLinkBridge.casing(),
lyrRoad.primaryLinkBridge.casing(),
Expand Down
84 changes: 26 additions & 58 deletions src/layer/rail.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,10 @@ class Railway {
visibility: "visible",
};
layer.paint = {
"line-color": "hsl(0, 0%, 50%)",
"line-color": Color.backgroundFill,
"line-width": {
base: railExp,
stops: this.bridgeCasingWidth,
},
};
if (this.constraints != null) {
layer.filter.push(this.constraints);
}
return layer;
};
bridgeFill = function () {
var layer = baseRailLayer(
this.railClass,
"bridgeFill",
this.brunnel,
this.minZoomBridge,
this.service,
this.constraints
);
layer.layout = {
"line-cap": "butt",
"line-join": "bevel",
visibility: "visible",
};
layer.paint = {
"line-color": "white",
"line-width": {
base: railExp,
stops: this.bridgeFillWidth,
stops: Util.zoomMultiply(this.fillWidth, 1.5),
},
};
if (this.constraints != null) {
Expand Down Expand Up @@ -150,9 +124,9 @@ class Railway {
"line-color": this.fillColor,
"line-width": {
base: railExp,
stops: this.dashWidth,
stops: Util.zoomMultiply(this.fillWidth, this.dashWidthFactor),
},
"line-dasharray": this.dashArray,
"line-dasharray": [1 / 2 / this.dashWidthFactor, 4],
};
if (this.constraints != null) {
layer.filter.push(this.constraints);
Expand All @@ -172,18 +146,13 @@ class Rail extends Railway {

this.minZoom = 10;
this.minZoomBridge = 13;
this.lineWeight = 0.4;
this.dashWidthFactor = 2.5;

this.dashWidth = [
[8, 1.6],
[12, 4.8],
[20, 20],
this.fillWidth = [
[8, 0.6],
[12, 2],
[20, 8],
];
this.fillWidth = Util.zoomMultiply(this.dashWidth, this.lineWeight);
this.bridgeFillWidth = Util.zoomMultiply(this.dashWidth, 1.1);
this.bridgeCasingWidth = Util.zoomMultiply(this.dashWidth, 1.3);

this.dashArray = [this.lineWeight / 2, 4];

this.fillColor = [
"interpolate",
Expand All @@ -202,11 +171,13 @@ class RailService extends Rail {
super();
this.service = true;

this.lineWeight = 0.2;
this.dashWidthFactor = 5;

this.fillWidth = Util.zoomMultiply(this.dashWidth, this.lineWeight);

this.dashArray = [this.lineWeight / 2, 4];
this.fillWidth = [
[8, 0.3],
[12, 1],
[20, 4],
];

this.constraints = null;
}
Expand All @@ -221,18 +192,13 @@ class NarrowGauge extends Railway {

this.minZoom = 10;
this.minZoomBridge = 13;
this.lineWeight = 0.4;
this.dashWidthFactor = 2.5;

this.dashWidth = [
[8, 1.2],
[12, 3.6],
[20, 15],
this.fillWidth = [
[8, 0.45],
[12, 1.5],
[20, 6],
];
this.fillWidth = Util.zoomMultiply(this.dashWidth, this.lineWeight);
this.bridgeFillWidth = Util.zoomMultiply(this.dashWidth, 1.1);
this.bridgeCasingWidth = Util.zoomMultiply(this.dashWidth, 1.3);

this.dashArray = [this.lineWeight / 2, 4];

this.fillColor = [
"interpolate",
Expand All @@ -251,11 +217,13 @@ class NarrowGaugeService extends NarrowGauge {
super();
this.service = true;

this.lineWeight = 0.2;

this.fillWidth = Util.zoomMultiply(this.dashWidth, this.lineWeight);
this.dashWidthFactor = 5;

this.dashArray = [this.lineWeight / 2, 4];
this.fillWidth = [
[8, 0.25],
[12, 0.75],
[20, 3],
];

this.constraints = null;
}
Expand Down

0 comments on commit 9606556

Please sign in to comment.