Skip to content

Commit

Permalink
fix(trip-planner): Define structure of mapClicked event
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacura committed Jun 12, 2024
1 parent 607fd47 commit 76541fa
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class HsTripPlannerService {
features: this.movable_features,
});

this.HsEventBusService.mapClicked.subscribe((coordinates) => {
this.HsEventBusService.mapClicked.subscribe(({coordinates}) => {
if (this.HsLayoutService.mainpanel != 'tripPlanner') {
return;
}
Expand Down
6 changes: 4 additions & 2 deletions projects/hslayers/services/event-bus/event-bus.service.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {BehaviorSubject, ReplaySubject, Subject} from 'rxjs';
import {Injectable} from '@angular/core';

import {Feature, Map} from 'ol';
import {Feature, Map, MapBrowserEvent} from 'ol';
import {Geometry} from 'ol/geom';
import {Layer} from 'ol/layer';
import {Select} from 'ol/interaction';
import {Source} from 'ol/source';

import {
ClickedCoordinates,
HsBaseLayerDescriptor,
HsLayerDescriptor,
HsLayerLoadProgress,
Expand Down Expand Up @@ -155,7 +156,8 @@ export class HsEventBusService {
/**
* replaces 'mapClicked'
*/
mapClicked: Subject<any> = new Subject();
mapClicked: Subject<MapBrowserEvent<any> & ClickedCoordinates> =
new Subject();
/**
* Fires when layerSelected parameter is found in the URL
*/
Expand Down
2 changes: 0 additions & 2 deletions projects/hslayers/services/query/query-base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {Injectable, NgZone} from '@angular/core';
import {Subject} from 'rxjs';

import {Circle as CircleStyle, Fill, Stroke, Style} from 'ol/style';
// eslint-disable-next-line import/named
import {Coordinate, createStringXY, toStringHDMS} from 'ol/coordinate';
import {Feature, Map} from 'ol';
// eslint-disable-next-line import/named
import {FeatureLike} from 'ol/Feature';
import {Geometry, Point} from 'ol/geom';
import {Select} from 'ol/interaction';
Expand Down
10 changes: 10 additions & 0 deletions projects/hslayers/types/clicked-coordinates.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Coordinate} from 'ol/coordinate';

export type ClickedCoordinates = {
coordinates: {
name: string;
mapProjCoordinate: Coordinate;
epsg4326Coordinate: Coordinate;
projections: {name: string; value: any}[];
};
};
7 changes: 4 additions & 3 deletions projects/hslayers/types/public-api.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export * from './dom-feature-link.type';
export * from './type-intersection.type';
export * from './access-rights.model';
export * from './bounding-box-object.type';
export * from './endpoint.interface';
export * from './button.interface';
export * from './clicked-coordinates.type';
export * from './dom-feature-link.type';
export * from './endpoint.interface';
export * from './map-swipe.type';
export * from './type-intersection.type';

export * from './layer-manager/base-layer-descriptor.interface';
export * from './layer-manager/layer-descriptor.interface';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export class HslayersAppComponent {
draw: true,
mapSwipe: true,
language: true,
tripPlanner: true,
},
componentsEnabled: {
basemapGallery: true,
Expand Down

0 comments on commit 76541fa

Please sign in to comment.