Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(map): layer groups #2571

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 76 additions & 70 deletions src/app/shared/components/template/components/map/map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,92 @@
<div class="map-and-legend-container">
<div id="mapElement" #mapElement class="map"></div>
<div class="legend">
@for (mapLayer of mapLayers; track $index) {
@if (mapLayer.getVisible() && mapLayer.get("gradientFill")) {
<div class="legend-item">
<div class="title">
{{ mapLayer.get("scaleTitle") }}
</div>
<div class="scale-container">
@if (mapLayer.get("scaleSlider")) {
<ion-range
[dualKnobs]="true"
[value]="{ lower: 0, upper: 100 }"
[ngStyle]="{ '--bar-background': mapLayer.get('gradientFill') }"
(ionChange)="handleSliderChange($event, mapLayer)"
></ion-range>
} @else {
<div
class="colour-scale"
[ngStyle]="{ 'background-image': mapLayer.get('gradientFill') }"
></div>
}
<div class="scale-labels">
<div class="scale-label max">
{{ mapLayer.get("scaleMax") }}
</div>
<div class="scale-label min">
{{ mapLayer.get("scaleMin") }}
@for (layerGroup of mapLayerGroupsSorted; track $index) {
@for (mapLayer of layerGroup.layers; track $index) {
@if (mapLayer.getVisible() && mapLayer.get("gradientFill")) {
<div class="legend-item">
<div class="title">
{{ mapLayer.get("scaleTitle") }}
</div>
<div class="scale-container">
@if (mapLayer.get("scaleSlider")) {
<ion-range
[dualKnobs]="true"
[value]="{ lower: 0, upper: 100 }"
[ngStyle]="{ '--bar-background': mapLayer.get('gradientFill') }"
(ionChange)="handleSliderChange($event, mapLayer)"
></ion-range>
} @else {
<div
class="colour-scale"
[ngStyle]="{ 'background-image': mapLayer.get('gradientFill') }"
></div>
}
<div class="scale-labels">
<div class="scale-label max">
{{ mapLayer.get("scaleMax") }}
</div>
<div class="scale-label min">
{{ mapLayer.get("scaleMin") }}
</div>
</div>
</div>
</div>
</div>
}
}
}
</div>
</div>
<div class="map-controls">
@if (params.controlsStyle === "dropdown") {
@if (mapLayers.length > 0) {
<ion-select
label="Visible Layers:"
interface="modal"
fill="outline"
placeholder="Select map layers to view"
[multiple]="true"
(ionChange)="handleDropdownChange($event)"
[value]="visibleLayerNames"
>
@for (mapLayer of mapLayersReversed; track $index) {
<ion-select-option [value]="mapLayer.get('name')">
<ion-item>
<ion-label>
{{
mapLayer.get("name") +
(mapLayer.get("description") ? " – " + mapLayer.get("description") : "")
}}
</ion-label>
</ion-item>
</ion-select-option>
}
</ion-select>
}
} @else if (params.controlsStyle === "list") {
<ion-list>
@for (mapLayer of mapLayersReversed; track $index) {
<ion-item>
<ion-label>
<ion-toggle
[checked]="mapLayer.getVisible()"
(ionChange)="handleToggleChange($event, mapLayer)"
>
{{ mapLayer.get("name") }}
</ion-toggle>
@if (mapLayer.get("description")) {
<p>
{{ mapLayer.get("description") }}
</p>
@for (layerGroup of mapLayerGroupsSorted; track $index) {
@if (!layerGroup.controls_style || layerGroup.controls_style === "dropdown") {
@if (layerGroup.layers.length > 0) {
<div class="map-control-container">
<p>{{ (layerGroup.name || "Visible layers") + ":" }}</p>
<ion-select
interface="modal"
fill="outline"
placeholder="Select map layers to view"
[multiple]="!layerGroup.single_selection"
(ionChange)="handleDropdownChange($event, layerGroup.id)"
[value]="getVisibleLayerNames(layerGroup.id)"
>
@for (mapLayer of layerGroup.layers; track $index) {
<ion-select-option [value]="mapLayer.get('name')">
<ion-item>
<ion-label>
{{
mapLayer.get("name") +
(mapLayer.get("description") ? " – " + mapLayer.get("description") : "")
}}
</ion-label>
</ion-item>
</ion-select-option>
}
</ion-label>
</ion-item>
</ion-select>
</div>
}
</ion-list>
} @else if (params.controlsStyle === "list") {
<ion-list>
@for (mapLayer of layerGroup.layers; track $index) {
<ion-item>
<ion-label>
<ion-toggle
[checked]="mapLayer.getVisible()"
(ionChange)="handleToggleChange($event, mapLayer)"
>
{{ mapLayer.get("name") }}
</ion-toggle>
@if (mapLayer.get("description")) {
<p>
{{ mapLayer.get("description") }}
</p>
}
</ion-label>
</ion-item>
}
</ion-list>
}
}
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ $map-height: 70vh;

ion-range {
width: 100%;
// position: absolute;
bottom: 0px;
--bar-background: none;
--bar-background-active: none;
Expand All @@ -77,7 +76,14 @@ $map-height: 70vh;
}

.map-controls {
margin-top: 10px;
width: 100%;
display: flex;
justify-content: space-between;
gap: 1rem;
.map-control-container {
flex: 1;
min-width: 0;
}

.layer-control {
display: flex;
Expand Down
Loading
Loading