Skip to content

Commit

Permalink
Combine light rail and tram dash layers
Browse files Browse the repository at this point in the history
  • Loading branch information
claysmalley committed Jul 30, 2022
1 parent 1067395 commit 345e67b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 87 deletions.
Binary file removed scripts/.taginfo.js.swp
Binary file not shown.
21 changes: 6 additions & 15 deletions src/americana.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ americanaLayers.push(
lyrRail.preservedTunnel.dashes(),
lyrRail.preservedServiceTunnel.dashes(),

lyrRail.lightRailTunnel.dashes(),
lyrRail.lightRailServiceTunnel.dashes(),

lyrRail.tramTunnel.dashes(),
lyrRail.tramServiceTunnel.dashes(),
lyrRail.lightRailTramTunnel.dashes(),
lyrRail.lightRailTramServiceTunnel.dashes(),

lyrRail.funicularTunnel.dashes(),

Expand Down Expand Up @@ -251,11 +248,8 @@ americanaLayers.push(
lyrRail.preserved.dashes(),
lyrRail.preservedService.dashes(),

lyrRail.lightRail.dashes(),
lyrRail.lightRailService.dashes(),

lyrRail.tram.dashes(),
lyrRail.tramService.dashes(),
lyrRail.lightRailTram.dashes(),
lyrRail.lightRailTramService.dashes(),

lyrRail.funicular.dashes(),

Expand Down Expand Up @@ -360,11 +354,8 @@ var bridgeLayers = [
lyrRail.preservedBridge.dashes(),
lyrRail.preservedServiceBridge.dashes(),

lyrRail.lightRailBridge.dashes(),
lyrRail.lightRailServiceBridge.dashes(),

lyrRail.tramBridge.dashes(),
lyrRail.tramServiceBridge.dashes(),
lyrRail.lightRailTramBridge.dashes(),
lyrRail.lightRailTramServiceBridge.dashes(),

lyrRail.funicularBridge.dashes(),

Expand Down
94 changes: 22 additions & 72 deletions src/layer/rail.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,32 +279,14 @@ class PreservedService extends Preserved {
}
}

class LightRail extends Railway {
class LightRailTram extends Railway {
constructor() {
super();
this.constraints = ["all", ["==", "subclass", "light_rail"], isNotService];
this.brunnel = "surface";

this.minZoom = 14;
this.dashWidthFactor = 2;
this.dashArray = [1, 6];
}
}

class LightRailService extends LightRail {
constructor() {
super();
this.constraints = ["all", ["==", "subclass", "light_rail"], isService];

this.dashWidthFactor = 3;
this.dashArray = [1, 12];
}
}

class Tram extends Railway {
constructor() {
super();
this.constraints = ["all", ["==", "subclass", "tram"], isNotService];
this.constraints = [
"all",
["in", "subclass", "light_rail", "tram"],
isNotService,
];
this.brunnel = "surface";

this.minZoom = 14;
Expand All @@ -313,10 +295,14 @@ class Tram extends Railway {
}
}

class TramService extends Tram {
class LightRailTramService extends LightRailTram {
constructor() {
super();
this.constraints = ["all", ["==", "subclass", "tram"], isService];
this.constraints = [
"all",
["in", "subclass", "light_rail", "tram"],
isService,
];

this.dashWidthFactor = 3;
this.dashArray = [1, 12];
Expand Down Expand Up @@ -384,35 +370,21 @@ class PreservedServiceBridge extends PreservedService {
}
}

class LightRailBridge extends LightRail {
constructor() {
super();
this.brunnel = "bridge";
}
}

class LightRailServiceBridge extends LightRailService {
constructor() {
super();
this.brunnel = "bridge";
}
}

class FunicularBridge extends Funicular {
constructor() {
super();
this.brunnel = "bridge";
}
}

class TramBridge extends Tram {
class LightRailTramBridge extends LightRailTram {
constructor() {
super();
this.brunnel = "bridge";
}
}

class TramServiceBridge extends TramService {
class LightRailTramServiceBridge extends LightRailTramService {
constructor() {
super();
this.brunnel = "bridge";
Expand Down Expand Up @@ -463,35 +435,21 @@ class PreservedServiceTunnel extends PreservedService {
}
}

class LightRailTunnel extends LightRail {
constructor() {
super();
this.brunnel = "tunnel";
}
}

class LightRailServiceTunnel extends LightRailService {
constructor() {
super();
this.brunnel = "tunnel";
}
}

class FunicularTunnel extends Funicular {
constructor() {
super();
this.brunnel = "tunnel";
}
}

class TramTunnel extends Tram {
class LightRailTramTunnel extends LightRailTram {
constructor() {
super();
this.brunnel = "tunnel";
}
}

class TramServiceTunnel extends TramService {
class LightRailTramServiceTunnel extends LightRailTramService {
constructor() {
super();
this.brunnel = "tunnel";
Expand Down Expand Up @@ -526,21 +484,13 @@ export const preservedService = new PreservedService();
export const preservedServiceBridge = new PreservedServiceBridge();
export const preservedServiceTunnel = new PreservedServiceTunnel();

export const lightRail = new LightRail();
export const lightRailBridge = new LightRailBridge();
export const lightRailTunnel = new LightRailTunnel();

export const lightRailService = new LightRailService();
export const lightRailServiceBridge = new LightRailServiceBridge();
export const lightRailServiceTunnel = new LightRailServiceTunnel();

export const tram = new Tram();
export const tramBridge = new TramBridge();
export const tramTunnel = new TramTunnel();
export const lightRailTram = new LightRailTram();
export const lightRailTramBridge = new LightRailTramBridge();
export const lightRailTramTunnel = new LightRailTramTunnel();

export const tramService = new TramService();
export const tramServiceBridge = new TramServiceBridge();
export const tramServiceTunnel = new TramServiceTunnel();
export const lightRailTramService = new LightRailTramService();
export const lightRailTramServiceBridge = new LightRailTramServiceBridge();
export const lightRailTramServiceTunnel = new LightRailTramServiceTunnel();

export const funicular = new Funicular();
export const funicularBridge = new FunicularBridge();
Expand Down

0 comments on commit 345e67b

Please sign in to comment.