-
Notifications
You must be signed in to change notification settings - Fork 3
/
Application.ts
129 lines (117 loc) · 3.29 KB
/
Application.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import {
CrsDefinition
} from '@terrestris/ol-util/dist/ProjectionUtil/ProjectionUtil';
import BaseEntity, {
BaseEntityArgs
} from './BaseEntity';
import {
DefaultLayerClientConfig,
DefaultLayerSourceConfig
} from './Layer';
export type MapInteraction = 'DragRotate' |
'DragRotateAndZoom' |
'DblClickDragZoom' |
'DoubleClickZoom' |
'DragPan' |
'PinchRotate' |
'PinchZoom' |
'KeyboardPan' |
'KeyboardZoom' |
'MouseWheelZoom' |
'DragZoom';
export interface DefaultApplicationTheme {
primaryColor?: string;
secondaryColor?: string;
complementaryColor?: string;
logoPath?: string;
faviconPath?: string;
}
export interface DefaultApplicationToolConfig {
name: string;
config: any;
}
export interface DefaultApplicationLayerConfig<
ClientConfig extends DefaultLayerClientConfig = DefaultLayerClientConfig,
SourceConfig extends DefaultLayerSourceConfig = DefaultLayerSourceConfig
> {
layerId: number;
clientConfig?: ClientConfig;
sourceConfig?: SourceConfig;
}
export interface DefaultLayerTree {
title: string;
checked: boolean;
layerId: number;
children: DefaultLayerTree[];
}
export interface DefaultMapView {
zoom?: number;
center?: [number, number];
extent?: [number, number, number, number];
projection?: string;
resolutions?: number[];
crsDefinitions?: CrsDefinition[];
}
export interface DefaultLegalConfig {
contact?: string;
imprint?: string;
privacy?: string;
}
export interface DefaultApplicationClientConfig<
MapView extends DefaultMapView = DefaultMapView,
LegalConfig extends DefaultLegalConfig = DefaultLegalConfig,
ApplicationTheme extends DefaultApplicationTheme = DefaultApplicationTheme
> {
mapView: MapView;
mapInteractions?: MapInteraction[];
description?: string;
legal?: LegalConfig;
theme?: ApplicationTheme;
defaultLanguage?: string;
printApp?: string;
}
export interface ApplicationArgs<
ClientConfig extends DefaultApplicationClientConfig = DefaultApplicationClientConfig,
LayerTree extends DefaultLayerTree = DefaultLayerTree,
LayerConfig extends DefaultApplicationLayerConfig = DefaultApplicationLayerConfig,
ToolConfig extends DefaultApplicationToolConfig = DefaultApplicationToolConfig
> extends BaseEntityArgs {
name?: string;
stateOnly?: boolean;
clientConfig?: ClientConfig;
layerTree?: LayerTree;
layerConfig?: LayerConfig[];
toolConfig?: ToolConfig[];
}
export default class Application<
ClientConfig extends DefaultApplicationClientConfig = DefaultApplicationClientConfig,
LayerTree extends DefaultLayerTree = DefaultLayerTree,
LayerConfig extends DefaultApplicationLayerConfig = DefaultApplicationLayerConfig,
ToolConfig extends DefaultApplicationToolConfig = DefaultApplicationToolConfig
> extends BaseEntity {
name?: string;
stateOnly?: boolean;
clientConfig?: ClientConfig;
layerTree?: LayerTree;
layerConfig?: LayerConfig[];
toolConfig?: ToolConfig[];
constructor({
id,
created,
modified,
name,
stateOnly,
clientConfig,
layerTree,
layerConfig,
toolConfig
}: ApplicationArgs<ClientConfig, LayerTree, LayerConfig, ToolConfig>) {
super({id, created, modified});
this.name = name;
this.stateOnly = stateOnly;
this.clientConfig = clientConfig;
this.layerTree = layerTree;
this.layerConfig = layerConfig;
this.toolConfig = toolConfig;
}
}