This commit is contained in:
phil 2024-05-12 01:40:47 +02:00
parent af9f8d1909
commit 3b59249531
3 changed files with 54 additions and 48 deletions

View file

@ -9,64 +9,64 @@ import { MapService, MaplibreStyle } from '../openapi'
export class MapboxDataAndStyle { export class MapboxDataAndStyle {
constructor( constructor(
public data: object, public data: object,
public style: MaplibreStyle, public style: MaplibreStyle,
) {} ) { }
} }
@Injectable() @Injectable()
export class GeoJsonService { export class GeoJsonService {
constructor( constructor(
private _http: HttpClient, private _http: HttpClient,
// private apollo: Apollo, // private apollo: Apollo,
public mapService: MapService, public mapService: MapService,
) {} ) { }
getLayer(url: string, params?: object): Observable<object> { getLayer(url: string, params?: object): Observable<object> {
if (!params) { if (!params) {
params = {} params = {}
}
return this._http.get<object>(url, {
headers: <HttpHeaders>params,
})
} }
return this._http.get<object>(url, {
headers: <HttpHeaders>params,
})
}
getStyle(store: string): Observable<MaplibreStyle> { getStyle(store: string): Observable<MaplibreStyle> {
return this.mapService.getLayerStyleApiMapLayerStyleStoreGet({store: store}) return this.mapService.getLayerStyleApiMapLayerStyleStoreGet({ store: store })
} }
getAll(url: string, store: string, params?: object): Observable<MapboxDataAndStyle> { getAll(url: string, store: string, params?: object): Observable<MapboxDataAndStyle> {
return forkJoin([ return forkJoin([
this.getLayer(url, params), this.getLayer(url, params),
this.getStyle(store), this.getStyle(store),
]).pipe(map( ]).pipe(map(
res => new MapboxDataAndStyle(res[0], res[1]) res => new MapboxDataAndStyle(res[0], res[1])
)) ))
} }
} }
@Injectable() @Injectable()
export class LiveGeoJsonService { export class LiveGeoJsonService {
messages = {} messages = {}
ws: any ws: any
constructor( constructor(
private wsService: WebsocketService private wsService: WebsocketService
) {} ) { }
connect(channel: string) { connect(channel: string) {
const hostname = window.location.hostname const hostname = window.location.hostname
const port = window.location.port const port = window.location.port
let protocol = window.location.protocol == 'https:' ? 'wss:' : 'ws:' let protocol = window.location.protocol == 'https:' ? 'wss:' : 'ws:'
this.wsService.connect( this.wsService.connect(
protocol + '//' + hostname + ':' + port + '/gj/live/' + channel protocol + '//' + hostname + ':' + port + '/gj/live/' + channel
) )
return this.wsService.ws return this.wsService.ws
} }
disconnect() { disconnect() {
this.wsService.disconnect() this.wsService.disconnect()
} }
} }

View file

@ -47,7 +47,7 @@ export const OpenAPI: OpenAPIConfig = {
PASSWORD: undefined, PASSWORD: undefined,
TOKEN: undefined, TOKEN: undefined,
USERNAME: undefined, USERNAME: undefined,
VERSION: '0.1.dev70+g53c2e35.d20240422', VERSION: '0.1.dev85+g41e92fa.d20240509',
WITH_CREDENTIALS: false, WITH_CREDENTIALS: false,
interceptors: {response: new Interceptors(), interceptors: {response: new Interceptors(),
}, },

View file

@ -515,7 +515,7 @@ export const $BootstrapData = {
version: { version: {
type: 'string', type: 'string',
title: 'Version', title: 'Version',
default: '0.1.dev70+g53c2e35.d20240422' default: '0.1.dev85+g41e92fa.d20240509'
}, },
title: { title: {
type: 'string', type: 'string',
@ -542,7 +542,7 @@ export const $BootstrapData = {
opacity: 0.4, opacity: 0.4,
pitch: 0, pitch: 0,
status: ['E', 'F', 'D'], status: ['E', 'F', 'D'],
style: 'osm', style: 'No base map',
tagKeys: ['source'], tagKeys: ['source'],
tileServer: { tileServer: {
baseDir: '/home/phil/gisaf_misc/map', baseDir: '/home/phil/gisaf_misc/map',
@ -1713,6 +1713,9 @@ export const $MaplibreStyle = {
}, },
{ {
type: 'string' type: 'string'
},
{
type: 'boolean'
} }
] ]
}, },
@ -1744,6 +1747,9 @@ export const $MaplibreStyle = {
}, },
{ {
type: 'string' type: 'string'
},
{
type: 'boolean'
} }
] ]
}, },