-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start detangling funding programme. Irrelevant for LCWIP layer, and can
remove some options from ATF. Current milestone is never set for LCWIPs. Keep the empty color radio for now; we might have more ideas later
- Loading branch information
1 parent
58f0fea
commit f3ad5e8
Showing
5 changed files
with
148 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,19 @@ | ||
import { constructMatchExpression } from "lib/maplibre"; | ||
import type { DataDrivenPropertyValueSpecification } from "maplibre-gl"; | ||
import { fundingProgrammesForColouringAndFiltering } from "./data"; | ||
import { colors } from "../colors"; | ||
export let atfFundingProgrammes = { | ||
ATF2: "#66c2a5", | ||
"ATF2 or ATF3": "#fc8d62", | ||
ATF3: "#8da0cb", | ||
ATF4: "#e78ac3", | ||
ATF4E: "#a6d854", | ||
}; | ||
|
||
export function styleByFundingProgramme(): [ | ||
DataDrivenPropertyValueSpecification<string>, | ||
[string, string][], | ||
] { | ||
let [colorMapping, legendRows] = getColorMappingAndLegend( | ||
fundingProgrammesForColouringAndFiltering, | ||
colors.funding_programmes, | ||
); | ||
|
||
let color = constructMatchExpression( | ||
["get", "funding_programme"], | ||
colorMapping, | ||
"grey", | ||
); | ||
return [color, legendRows]; | ||
} | ||
|
||
export function styleByCurrentMilestone(): [ | ||
DataDrivenPropertyValueSpecification<string>, | ||
[string, string][], | ||
] { | ||
let stageGates = [ | ||
"removed", | ||
"no data", | ||
"not progressed", | ||
"superseded", | ||
"preliminary design completed", | ||
"feasability design completed", | ||
"detailed design completed", | ||
"consruction started", | ||
"construction completed", | ||
]; | ||
|
||
let [colorMapping, legendRows] = getColorMappingAndLegend( | ||
stageGates, | ||
colors.current_milestone, | ||
); | ||
|
||
let color = constructMatchExpression( | ||
["get", "current_milestone"], | ||
colorMapping, | ||
"grey", | ||
); | ||
return [color, legendRows]; | ||
} | ||
|
||
function getColorMappingAndLegend( | ||
keys: string[], | ||
colorList: string[], | ||
): [{ [key: string]: string }, [string, string][]] { | ||
let legendRows: [string, string][] = []; | ||
let colorMapping: { [key: string]: string } = {}; | ||
let i = 0; | ||
for (let x of keys) { | ||
let color = colorList[i++ % colorList.length]; | ||
colorMapping[x] = color; | ||
legendRows.push([x, color]); | ||
} | ||
|
||
return [colorMapping, legendRows]; | ||
} | ||
export let currentMilestones = { | ||
removed: "grey", | ||
"no data": "grey", | ||
"not progressed": "red", | ||
superseded: "red", | ||
"preliminary design completed": "#fbb862", | ||
"feasability design completed": "#eddc76", | ||
"detailed design completed": "#dafd9d", | ||
"consruction started": "#76c384", | ||
"construction completed": "#488f31", | ||
}; |
Oops, something went wrong.