This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch
3481-marker-type-car-in-map-not-available-and-tooltip-filter-for-map-does-not-work
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/3481-marker-type-car-in-map-not-available-and-tooltip-filter-for-map-does-not-work
by this push:
new 3146eadf9f fix(#3481): Various bug fixes in map visualization
3146eadf9f is described below
commit 3146eadf9fb0811c8c284fad39d570cde7350113
Author: Dominik Riemer <[email protected]>
AuthorDate: Tue Mar 18 18:55:15 2025 +0100
fix(#3481): Various bug fixes in map visualization
---
.../map/config/map-widget-config.component.html | 3 +-
.../map/config/map-widget-config.component.ts | 9 ++--
.../components/charts/map/map-widget.component.ts | 52 ++++++++-------------
ui/src/assets/img/car.png | Bin 0 -> 7166 bytes
4 files changed, 26 insertions(+), 38 deletions(-)
diff --git
a/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.html
b/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.html
index 58063ae49f..69d611d582 100644
---
a/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.html
+++
b/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.html
@@ -101,7 +101,7 @@
currentlyConfiguredWidget.visualizationConfig
.useLastEventCoordinates
"
- (change)="setUseLastEventCoordinations($event)"
+ (change)="setUseLastEventCoordinates($event)"
>{{ 'Focus map on last event' | translate }}
</mat-checkbox>
</div>
@@ -116,7 +116,6 @@
'Marker or Trace' | translate
}}</small>
<mat-form-field color="accent" appearance="outline" fxFlex>
- <!-- <mat-label>Marker or Trace</mat-label> -->
<mat-select
[(value)]="
currentlyConfiguredWidget.visualizationConfig
diff --git
a/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.ts
b/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.ts
index 3f6a2312d0..72c1e5d6ca 100644
---
a/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.ts
+++
b/ui/src/app/data-explorer-shared/components/charts/map/config/map-widget-config.component.ts
@@ -22,6 +22,7 @@ import { ChartConfigurationService } from
'../../../../services/chart-configurat
import { DataExplorerFieldProviderService } from
'../../../../services/data-explorer-field-provider-service';
import { MapVisConfig, MapWidgetModel } from '../model/map-widget.model';
import { DataExplorerField } from '@streampipes/platform-services';
+import { MatCheckboxChange } from '@angular/material/checkbox';
@Component({
selector: 'sp-data-explorer-map-widget-config',
@@ -60,16 +61,16 @@ export class MapWidgetConfigComponent extends
BaseWidgetConfig<
this.triggerDataRefresh();
}
- setUseLastEventCoordinations(field: DataExplorerField) {
+ setUseLastEventCoordinates(event: MatCheckboxChange) {
this.currentlyConfiguredWidget.visualizationConfig.useLastEventCoordinates =
- field['checked'];
- this.triggerDataRefresh();
+ event.checked;
+ this.triggerViewRefresh();
}
setSelectedToolTipContent(fields: DataExplorerField[]) {
this.currentlyConfiguredWidget.visualizationConfig.selectedToolTipContent =
fields;
- this.triggerDataRefresh();
+ this.triggerViewRefresh();
}
protected applyWidgetConfig(config: MapVisConfig): void {
diff --git
a/ui/src/app/data-explorer-shared/components/charts/map/map-widget.component.ts
b/ui/src/app/data-explorer-shared/components/charts/map/map-widget.component.ts
index fabef33b78..073f72fea5 100644
---
a/ui/src/app/data-explorer-shared/components/charts/map/map-widget.component.ts
+++
b/ui/src/app/data-explorer-shared/components/charts/map/map-widget.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, inject, OnInit } from '@angular/core';
import {
Content,
icon,
@@ -35,6 +35,7 @@ import { BaseDataExplorerWidgetDirective } from
'../base/base-data-explorer-widg
import { MapWidgetModel } from './model/map-widget.model';
import {
DataExplorerField,
+ LocationConfigService,
SpQueryResult,
} from '@streampipes/platform-services';
@@ -47,15 +48,9 @@ export class MapWidgetComponent
extends BaseDataExplorerWidgetDirective<MapWidgetModel>
implements OnInit
{
- item: any;
-
- selectedLatitudeField: string;
- selectedLongitudeField: string;
- selectedMarkerIcon: string;
- idsToDisplay: string[];
- additionalItemsToDisplay: string[];
- centerMap: boolean;
+ private locationConfigService = inject(LocationConfigService);
+ item: any;
showMarkers = false;
layers: Marker[] & Polyline[];
@@ -71,20 +66,22 @@ export class MapWidgetComponent
defaultCenter = latLng(46.879966, -121.726909);
- options = {
- layers: [
- tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- maxZoom: 18,
- attribution:
- "© <a
href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> Contributors",
- }),
- ],
- zoom: 1,
- center: this.defaultCenter,
- };
+ options = {};
ngOnInit(): void {
super.ngOnInit();
+ this.locationConfigService.getLocationConfig().subscribe(config => {
+ this.options = {
+ layers: [
+ tileLayer(config.tileServerUrl, {
+ maxZoom: 18,
+ attribution: config.attributionText,
+ }),
+ ],
+ zoom: 1,
+ center: this.defaultCenter,
+ };
+ });
this.layers = [];
this.markerIds = [];
this.showMarkers = true;
@@ -93,7 +90,7 @@ export class MapWidgetComponent
markerImage(selectedMarker: string): string {
return selectedMarker === 'Default'
? 'assets/img/marker-icon.png'
- : 'assets/img/pe_icons/car.png';
+ : 'assets/img/car.png';
}
onMapReady(map: Map) {
@@ -236,11 +233,7 @@ export class MapWidgetComponent
.selectedMarkerType,
);
- let text =
- '<b>Time</b>' +
- ': ' +
- result.rows[index][0] +
- '<br>';
+ let text = `<b>Time:</b>${new
Date(result.rows[index][0])}<br/>`;
this.dataExplorerWidget.visualizationConfig.selectedToolTipContent.forEach(
item => {
const subIndex = this.getColumnIndex(
@@ -248,12 +241,7 @@ export class MapWidgetComponent
spQueryResult,
);
text = text.concat(
- '<b>' +
- item.fullDbName +
- '</b>' +
- ': ' +
- result.rows[index][subIndex] +
- '<br>',
+ `<b>${item.fullDbName}:</b>
${result.rows[index][subIndex]}<br/>`,
);
},
);
diff --git a/ui/src/assets/img/car.png b/ui/src/assets/img/car.png
new file mode 100644
index 0000000000..cf9168522b
Binary files /dev/null and b/ui/src/assets/img/car.png differ