Commit 6dde5b26 authored by Kevin Linne's avatar Kevin Linne

Toggle tag visibility independantly

parent cb0a5534
Pipeline #17539 passed with stages
in 7 minutes and 35 seconds
......@@ -21,6 +21,13 @@
{{mapRendererService.poisShown ? 'Hide POIs' : 'Show POIs'}}
</button>
</div>
<div class="col">
<button class="btn btn-outline-primary btn-sm" (click)="toggleTags()">
<span class="fa fa-wifi mr-1">
</span>
{{mapRendererService.tagsShown ? 'Hide Tags' : 'Show Tags'}}
</button>
</div>
<div class="col">
<button class="btn btn-outline-primary btn-sm" (click)="centerViewButtonClicked()">
<span class="fa fa-location-arrow mr-1">
......
......@@ -42,6 +42,10 @@ export class MapViewComponent implements AfterViewInit {
this.mapRendererService.togglePois();
}
toggleTags(): void {
this.mapRendererService.toggleTags();
}
centerViewButtonClicked(): void {
this.mapRendererService.setCenterView();
}
......
......@@ -82,10 +82,10 @@ export const toolTipOptionsRoom: () => TooltipOptions = () => {
};
/**
* The tooltip, that will be shown when the user hovers overn an POI marker.
* The tooltip, that will be shown when the user hovers over an POI marker.
* @returns {TooltipOptions}
*/
export const toolTipOptionsPOI: () => TooltipOptions = () => {
export const toolTipOptionsMarker: () => TooltipOptions = () => {
return {
direction: 'top',
};
......
......@@ -10,7 +10,7 @@ import {
startLocationView,
startZoomSelected,
startZoomView,
toolTipOptionsPOI,
toolTipOptionsMarker,
toolTipOptionsRoom,
} from '../../data/map-renderer.data';
import {buildingModelDefinition} from '../../model-definitions/BuildingModelDefinition';
......@@ -35,6 +35,7 @@ export class MapRendererService {
public selectedBuilding: BuildingModel = null;
public selectedLevel: Level = null;
public poisShown = true;
public tagsShown = true;
public error: string = '';
private polygons: Polygon[] = [];
private polygonLayers: L.Polygon[] = [];
......@@ -121,14 +122,14 @@ export class MapRendererService {
}
async drawTags(): Promise<void> {
this.poisShown = true;
this.tagsShown = true;
try {
const tags = await this.dataService.get(tagModelDefinition);
tags.forEach((tag: TagModel) => {
if (!this.selectedLevel) {
if (!this.selectedLevel && tag.floor === 0) {
this.addTagToMap(tag); // general pois like A20, THM
} else if (this.selectedLevel.level === tag.floor) {
} else if (this.selectedLevel && this.selectedLevel.level === tag.floor) {
this.addTagToMap(tag);
}
});
......@@ -140,9 +141,15 @@ export class MapRendererService {
togglePois() {
if (this.poisShown) {
this.removePois();
this.removeTags();
} else {
this.drawPois();
}
}
toggleTags() {
if (this.tagsShown) {
this.removeTags();
} else {
this.drawTags();
}
}
......@@ -156,7 +163,7 @@ export class MapRendererService {
}
removeTags() {
this.poisShown = false;
this.tagsShown = false;
this.tagMarkers.forEach((tuple) => {
tuple[0].removeFrom(this.map);
});
......@@ -188,7 +195,9 @@ export class MapRendererService {
this.drawBuildings();
}
this.removePois();
this.removeTags();
this.drawPois();
this.drawTags();
}
public isBuildingClicked(): boolean {
......@@ -220,7 +229,7 @@ export class MapRendererService {
}
});
marker.addTo(this.map);
marker.bindTooltip(poi.name, toolTipOptionsPOI());
marker.bindTooltip(poi.name, toolTipOptionsMarker());
this.poiMarkers.push([marker, poi]);
}
......@@ -237,7 +246,7 @@ export class MapRendererService {
}
});
marker.addTo(this.map);
marker.bindTooltip(tag.name, toolTipOptionsPOI());
marker.bindTooltip(tag.name, toolTipOptionsMarker());
this.tagMarkers.push([marker, tag]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment