-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathView.ts
52 lines (42 loc) · 1.38 KB
/
View.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (C) 2017-2019 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE
* SPDX-License-Identifier: Apache-2.0
*/
import { Theme } from "@here/harp-datasource-protocol";
import { MapControls } from "@here/harp-map-controls";
import { CopyrightElementHandler, MapView } from "@here/harp-mapview";
const defaultTheme = "resources/berlin_tilezen_base.json";
export interface ViewParameters {
theme?: string | Theme;
canvas: HTMLCanvasElement;
}
export class View {
readonly canvas: HTMLCanvasElement;
readonly theme: string | Theme;
readonly mapView: MapView;
constructor(args: ViewParameters) {
this.canvas = args.canvas;
this.theme = args.theme === undefined ? defaultTheme : args.theme;
this.mapView = this.initialize();
}
protected initialize(): MapView {
const mapView = new MapView({
canvas: this.canvas,
theme: this.theme,
decoderUrl: "decoder.bundle.js"
});
CopyrightElementHandler.install("copyrightNotice")
.attach(mapView)
.setDefaults([
{
id: "here.com",
label: "HERE",
link: "https://legal.here.com/terms",
year: 2019
}
]);
MapControls.create(mapView);
return mapView;
}
}