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

View file

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

View file

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