Skip to content
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
5 changes: 2 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ yarn-error.log
.dockerignore
docker-compose.yml

# Ignore Json files
./src/assets/leaflet/region-map.json
./src/assets/leaflet/street-map.json
# Ignore Grid Json files
/src/assets/maplibre
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ Thumbs.db
.nx/workspace-data

.angular

# Ignore Grid Json files
/src/assets/maplibre
11 changes: 6 additions & 5 deletions k6s/backend-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import { sleep, check } from 'k6';

export const options = {
vus: 5,
duration: '40s',
duration: '20s',
};

export default function () {
let res = http.get('http://konsumpi:8081/api/streets/grid?lat=52.523232122212534&lng=13.47329869&zoom=9&year=2024');
res = http.get('http://konsumpi:8081/api/safety-metrics/simra-regions/Berlin-Potsdam');
res = http.get('http://konsumpi:8081/api/safety-metrics/streets?size=20&minNumberOfRides=2&page=0&weekDay=ALL_WEEK&trafficTime=ALL_DAY&year=2000&sort=dangerousScore,DESC');
// let res = http.get('http://konsumpi:8081/api/streets/grid?lat=52.523232122212534&lng=13.47329869&zoom=9&year=2024');
// res = http.get('http://konsumpi:8081/api/safety-metrics/simra-regions/Berlin-Potsdam');
const res = http.get('http://konsumpi:8081/api/safety-metrics/streets-grid?weekDay=ALL_WEEK&year=2000&trafficTime=ALL_DAY');
// res = http.get('http://konsumpi:8081/api/safety-metrics/regions?size=20&minNumberOfRides=100&page=0&weekDay=ALL_WEEK&trafficTime=ALL_DAY&year=2000&sort=dangerousScore,DESC');

check(res, {
'Status ist 200': (r) => r.status === 200,
'Antwortzeit < 300': (r) => r.timings.duration < 300,
'Status ist 200': (r) => r.status === 200,
});

}
4 changes: 2 additions & 2 deletions k6s/frontend-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import http from 'k6/http';
import { sleep, check } from 'k6';

export const options = {
vus: 10,
vus: 100,
duration: '30s',
};

export default function () {
const res = http.get('https://konsumpi:8081/streets/map?lat=52.522&lng=13.413&zoom=14');
const res = http.get('http://konsumpi:4200/streets/map');

check(res, {
'Status ist 200': (r) => r.status === 200,
Expand Down
12 changes: 11 additions & 1 deletion libs/common/models/src/lib/enums/cycleway-lanes.enum.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/**
* Types of cycleway lanes
* @see https://wiki.openstreetmap.org/wiki/Key:cycleway:lane
* @see https://wiki.openstreetmap.org/wiki/Key:cycleway:right
*/
export enum ECyclewayType {
ADVISORY = 'advisory',
EXCLUSIVE = 'exclusive',
PICTOGRAM = 'pictogram',
NO = 'no'

SHARED_LANE = 'shared_lane',
LANE = 'lane',
TRACK = 'track',
SHARED_BUSWAY = 'shared_busway',
SEPARATE = 'separate',

NO = 'no',

UNKNOWN = 'unknown'
}
1 change: 1 addition & 0 deletions libs/common/models/src/lib/enums/street-parking.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export enum EParking {
SHOULDER = 'shoulder',
SEPARATE = 'separate',
NO = 'no',
YES = 'yes',
}
6 changes: 2 additions & 4 deletions libs/common/ui/components/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"MORNING_RUSH_HOUR": "Beinhaltet Stunden zwischen 7:30 und 9:59 Uhr",
"MID_DAY": "Beinhaltet Stunden zwischen 10:00 und 15:29 Uhr",
"EVENING_RUSH_HOUR": "Beinhaltet Stunden zwischen 15:30 und 18:59 Uhr",
"EVENING_NIGHT_MORNING": "Beinhaltet Stunden zwischen 19:00 und 5:59 Uhr"
"EVENING_NIGHT_MORNING": "Beinhaltet Stunden zwischen 19:00 und 7:29 Uhr"
}
},
"YEAR": {
Expand All @@ -66,9 +66,7 @@
}
}
},
"ATOMS": {

},
"ATOMS": {},
"MOLECULES": {
"DANGEROUS_SCORE_BAR": {
"BAR_LABEL": {
Expand Down
6 changes: 3 additions & 3 deletions libs/common/ui/components/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"MORNING_RUSH_HOUR": "Includes hours between 7:30 and 9:59",
"MID_DAY": "Includes hours between 10:00 and 15:29",
"EVENING_RUSH_HOUR": "Includes hours between 15:30 and 18:59",
"EVENING_NIGHT_MORNING": "Includes hours between 19:00 and 5:59"
"EVENING_NIGHT_MORNING": "Includes hours between 19:00 and 7:29"
}
},
"STREET_PARKING": {
Expand All @@ -125,8 +125,8 @@
"MOLECULES": {
"DANGEROUS_SCORE_BAR": {
"BAR_LABEL": {
"LOW_RISK": "High Risk",
"HIGH_RISK": "Low Risk"
"LOW_RISK": "Low Risk",
"HIGH_RISK": "High Risk"
}
},
"SAFETY_METRICS_DIGIT_PANEL": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<div pTooltip="{{'STREETS.EXPLORER.GENERAL.TABLE.HEADER.COLUMNS.SCORE' | translate}}: {{color() | rangePipe}}"></div>
<div pTooltip="Score: {{color() | rangePipe}}"></div>

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChangeDetectionStrategy, Component, HostBinding, input, ViewEncapsulation } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslatePipe } from '@ngx-translate/core';
import { EDangerousColors } from '@simra/common-models';
import { Tooltip } from 'primeng/tooltip';
import { RangePipe } from '../pipes/range.pipe';
Expand All @@ -10,7 +9,7 @@ import { RangePipe } from '../pipes/range.pipe';
*/
@Component({
selector: 'a-color-block',
imports: [CommonModule, RangePipe, Tooltip, TranslatePipe],
imports: [CommonModule, RangePipe, Tooltip],
templateUrl: './color-block.component.html',
styleUrl: './color-block.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
2 changes: 1 addition & 1 deletion libs/common/ui/components/src/lib/models/chart-colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export class ChartColors {
];
static INCIDENT_TYPES_WITH_SCORE = [ChartColors.SCORE, ...ChartColors.INCIDENT_TYPES];
static RIDE_METRICS_DISTRIBUTION = ['#fef9c2', '#ffd6a7', '#ffc9c9'];
static RIDE_METRICS_DISTRIBUTION_WITH_SCORE = [ChartColors.SCORE, '#ddd6ff', '#e9d4ff', ...ChartColors.RIDE_METRICS_DISTRIBUTION];
static RIDE_METRICS_DISTRIBUTION_WITH_SCORE = [ChartColors.SCORE, '#ddd6ff', '#ecfcca', ...ChartColors.RIDE_METRICS_DISTRIBUTION]; // '#ddd6ff', '#e9d4ff',
static PROFILE_METRICS_DISTRIBUTION_WITH_SCORE = [ChartColors.SCORE, ...ChartColors.RIDE_METRICS_DISTRIBUTION];
}
40 changes: 25 additions & 15 deletions libs/common/ui/components/src/lib/models/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,39 @@ import { ISafetyMetrics } from '@simra/common-models';

export function safetyMetricsDisplayArray<T extends ISafetyMetrics>(
safetyMetrics: T,
): { label: string; data: any, link?: string }[] {
): { label: string; data: any, link?: string, tooltip?: string }[] {
const specificAttributes = [];

if ('osmId' in safetyMetrics) {
specificAttributes.push({
label: 'COMPONENTS.GENERAL.TABLE.HEADER.COLUMNS.OSM_ID',
data: safetyMetrics.osmId,
link: `/streets/${safetyMetrics.osmId}`,
});
specificAttributes.push(
{
label: 'COMPONENTS.GENERAL.TABLE.HEADER.COLUMNS.OSM_ID',
data: safetyMetrics.osmId,
link: `/streets/${safetyMetrics.osmId}`,
},
{
label: 'STREETS.EXPLORER.GENERAL.TABLE.HEADER.COLUMNS.SCORE',
data: safetyMetrics.dangerousScore,
tooltip: 'STREETS.EXPLORER.GENERAL.TABLE.HEADER.COLUMNS.SCORE_FORMULA'
},
);
}
if ('name' in safetyMetrics) {
specificAttributes.push({
label: 'COMPONENTS.GENERAL.TABLE.HEADER.COLUMNS.NAME',
data: safetyMetrics.name,
link: `/administrative-districts/${safetyMetrics.name}`,
});
specificAttributes.push(
{
label: 'COMPONENTS.GENERAL.TABLE.HEADER.COLUMNS.NAME',
data: safetyMetrics.name,
link: `/administrative-districts/${safetyMetrics.name}`,
},
{
label: 'REGIONS.BROWSE.GENERAL.ENTITY_ATTRIBUTES.REGION.SCORE.LABEL',
data: safetyMetrics.dangerousScore,
tooltip: 'REGIONS.BROWSE.GENERAL.ENTITY_ATTRIBUTES.REGION.SCORE.FORMULA'
},
);
}

const generalAttributes = [
{
label: 'STREETS.EXPLORER.GENERAL.TABLE.HEADER.COLUMNS.SCORE',
data: safetyMetrics.dangerousScore,
},
{
label: 'STREETS.EXPLORER.GENERAL.TABLE.HEADER.COLUMNS.RIDES',
data: safetyMetrics.numberOfRides,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<tr>
<td>
@if(metric.label.includes('SCORE')) {
<div [pTooltip]="scoreFormula" [tooltipStyleClass]="'security-tooltip'">
<div class="truncate" [pTooltip]="scoreFormula" [tooltipStyleClass]="'security-tooltip'">
{{ metric.label | translate }}
</div>
<ng-template #scoreFormula>
<markdown
katex
[data]="'STREETS.EXPLORER.GENERAL.TABLE.HEADER.COLUMNS.SCORE_FORMULA' | translate">
[data]="metric?.tooltip | translate">
</markdown>
</ng-template>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

.maplibregl-popup-content {
@apply rounded-lg p-5;
min-width: 200px;
min-width: 14rem;

.maplibregl-popup-close-button {
@apply p-2 text-xl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class MapPage implements OnDestroy, OnInit {
private readonly _activatedRoute = inject(ActivatedRoute);

public readonly lastRun = input<Date>();
public readonly isSearchable = input<boolean>(false);
public readonly isNavigable = input<boolean>(false);

@Output()
Expand Down
13 changes: 0 additions & 13 deletions libs/common/ui/components/src/lib/templates/map/models/const.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
<t-map-component [isSearchable]="true" [isNavigable]="true" [lastRun]="_lastRun$()" (mapReady)="onMapReady($event)"></t-map-component>
<t-map-component [isNavigable]="true" [lastRun]="_lastRun$()" (mapReady)="onMapReady($event)"></t-map-component>
27 changes: 25 additions & 2 deletions libs/incidents/map/src/lib/exploring-map/incidents-map.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { CommonModule } from '@angular/common';
import { toSignal } from '@angular/core/rxjs-interop';
import { Store } from '@ngxs/store';
import { IncidentsMapFacade, IncidentsState} from '@simra/incidents-domain';
import { IIncidentMarker } from '@simra/incidents-models';
import { IIncident, IIncidentMarker } from '@simra/incidents-models';
import { createIncidentMarker } from '@simra/incidents-ui';
import { FeatureCollection, Geometry } from 'geojson';
import * as maplibregl from 'maplibre-gl';
import { firstValueFrom } from 'rxjs';
import { ChartColors, EPin, MapPage } from '@simra/common-components';
import { ChartColors, EPin, MapPage, MapUtils } from '@simra/common-components';
import { incidentsLayer, incidentsLayerCluster, incidentsLayerClusterCount, incidentsSource } from '../models/const';

@Component({
Expand Down Expand Up @@ -67,6 +68,12 @@ export class IncidentsMapPage {
})),
} as FeatureCollection<Geometry, IIncidentMarker>;

const source = mlMap.getSource(incidentsSource) as maplibregl.GeoJSONSource;
if (source) {
source.setData(markerCollection);
return;
}

mlMap.addSource(incidentsSource, {
type: 'geojson',
data: markerCollection,
Expand Down Expand Up @@ -100,6 +107,22 @@ export class IncidentsMapPage {
'icon-opacity': 1
}
});

MapUtils.changeCursor(mlMap, incidentsLayer);
mlMap.on('click', incidentsLayer, async (evt) => {
const f = evt.features?.[0];
if (f?.properties) {
await createIncidentMarker(
f.properties as IIncident,
this._injector,
this._appRef,
this._incidentsMapFacade.getIncidentDetails.bind(this._incidentsMapFacade),
mlMap,
);
}
});


mlMap.addLayer({
id: incidentsLayerCluster,
type: 'circle',
Expand Down
20 changes: 10 additions & 10 deletions libs/incidents/ui/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"ELECTRIC_SCOOTER": "Elektroroller"
},
"INCIDENT_TYPES": {
"DUMMY_INCIDENT": "Dummy Vorfall",
"NOTHING": "Nichts",
"CLOSE_PASS": "Knappes Überholen",
"PULLING_IN_OUT": "Ein- und Ausfahren",
"NEAR_LEFT_RIGHT_HOOK": "Beinahe-Linker-Rechts-Haken",
"HEAD_ON_APPROACH": "Kopf-an-Kopf Annäherung",
"TAILGATING": "Heckauffahren",
"NEAR_DOORING": "Türöffnung",
"DODGING_OBSTACLE": "Ausweichen vor Hindernis",
"OTHER": "Andere"
"DUMMY_INCIDENT": "Platzhalter-Vorfall",
"NOTHING": "Kein Vorfall",
"CLOSE_PASS": "Gefährliches Überholen",
"PULLING_IN_OUT": "Ein-/Ausscherkonflikt",
"NEAR_LEFT_RIGHT_HOOK": "Abbiegekonflikt",
"HEAD_ON_APPROACH": "Gegenverkehrsgefahr",
"TAILGATING": "Auffahrvorfall",
"NEAR_DOORING": "Beinahe-Türkollision",
"DODGING_OBSTACLE": "Hindernis-Ausweichung",
"OTHER": "Sonstiger Vorfall"
},
"BIKE_TYPES": {
"NOT_CHOSEN": "Nicht gewählt",
Expand Down
52 changes: 0 additions & 52 deletions libs/incidents/ui/src/lib/functions/incident-marker.ts

This file was deleted.

Loading
Loading