-
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.
Fix legend title and inactive updates, move legend utils to lib
- Loading branch information
1 parent
7c7c609
commit 8d95429
Showing
3 changed files
with
57 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { | ||
Style, | ||
GetLegendGraphicResponse, | ||
} from '@deltares/fews-wms-requests' | ||
import type { ColourMap } from '@deltares/fews-web-oc-charts' | ||
import type { Range } from '@/stores/colourScales' | ||
|
||
export function rangeToString(range: Range): string { | ||
return `${range.min},${range.max}` | ||
} | ||
|
||
export function getLegendTitle( | ||
layerTitle: string, | ||
legendGraphic: GetLegendGraphicResponse, | ||
) { | ||
const unitString = legendGraphic.unit ? ` [${legendGraphic.unit}]` : '' | ||
return `${layerTitle}${unitString}` | ||
} | ||
|
||
export function styleToId(style: Style) { | ||
return style.name ?? style.title | ||
} | ||
|
||
export function legendToRange(legend: ColourMap): Range { | ||
return { | ||
min: legend[0].lowerValue, | ||
max: legend[legend.length - 1].lowerValue, | ||
} | ||
} |
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