1
+ import { AmdbLayerName , LineColor , LineStyle , PolygonalStructureType , StopbarCategory } from "@navigraph/amdb" ;
2
+ import { CircleOptions , PathOptions , StyleFunction } from "leaflet" ;
3
+
4
+ // Top to bottom like rendering, not render order
5
+ export const layerOrder : Record < AmdbLayerName , number > = {
6
+ 'aerodromereferencepoint' : 0 ,
7
+ 'verticalpointstructure' : 0 ,
8
+ 'runwaythreshold' : 0 ,
9
+ 'parkingstandlocation' : 0 ,
10
+ 'frequencyarea' : 1 ,
11
+ 'taxiwayholdingposition' : 1 ,
12
+ 'taxiwayintersectionmarking' : 1 ,
13
+ 'taxiwayguidanceline' : 2 ,
14
+ 'standguidanceline' : 2 ,
15
+ 'runwayexitline' : 2 ,
16
+ 'serviceroad' : 3 ,
17
+ 'deicingarea' : 4 ,
18
+ 'parkingstandarea' : 5 ,
19
+ 'taxiwayelement' : 5 ,
20
+ 'apronelement' : 6 ,
21
+ 'runwaymarking' : 7 ,
22
+ 'runwayelement' : 8 ,
23
+ 'runwayintersection' : 8 ,
24
+ 'runwaydisplacedarea' : 8 ,
25
+ 'stopway' : 8 ,
26
+ 'blastpad' : 8 ,
27
+ 'arrestinggearlocation' : 9 ,
28
+ 'constructionarea' : 10 ,
29
+ 'finalapproachandtakeoffarea' : 11 ,
30
+ 'helipadthreshold' : 12 ,
31
+ 'hotspot' : 13 ,
32
+ 'landandholdshortoperationlocation' : 14 ,
33
+ 'paintedcenterline' : 15 ,
34
+ 'runwayshoulder' : 17 ,
35
+ 'taxiwayshoulder' : 17 ,
36
+ 'touchdownliftoffarea' : 19 ,
37
+ 'verticallinestructure' : 20 ,
38
+ 'verticalpolygonalstructure' : 21 ,
39
+ 'water' : 22
40
+ }
41
+
42
+ export default function amdbStyle ( layerName : AmdbLayerName ) : StyleFunction {
43
+ return ( feature ) : PathOptions | CircleOptions => {
44
+ switch ( layerName ) {
45
+ case "apronelement" :
46
+ return {
47
+ fillOpacity : 1 ,
48
+ fillColor : 'hsl(0, 0%, 52%)' ,
49
+ stroke : false
50
+ }
51
+ case "stopway" :
52
+ case "blastpad" :
53
+ return {
54
+ fillOpacity : 1 ,
55
+ fillColor : 'hsl(0, 0%, 40%)' ,
56
+ stroke : false
57
+ }
58
+ case "deicingarea" :
59
+ return {
60
+ fillOpacity : 1 ,
61
+ stroke : false ,
62
+ fillColor : 'hsl(200, 60%, 75%)'
63
+ }
64
+ case "parkingstandarea" :
65
+ return {
66
+ fillOpacity : 1 ,
67
+ fillColor : 'hsl(0, 0%, 47%)' ,
68
+ stroke : false ,
69
+ }
70
+ case "runwaydisplacedarea" :
71
+ case "runwayintersection" :
72
+ case "runwayelement" :
73
+ return {
74
+ fillOpacity : 1 ,
75
+ fillColor : 'hsl(0, 0%, 33%)' ,
76
+ stroke : false
77
+ }
78
+ case "runwaymarking" :
79
+ return {
80
+ fillOpacity : 1 ,
81
+ fillColor : '#fefefe' ,
82
+ stroke : false ,
83
+ }
84
+ case "serviceroad" :
85
+ return {
86
+ fillOpacity : 1 ,
87
+ fillColor : 'hsl(240, 5%, 55%)' ,
88
+ stroke : false ,
89
+ }
90
+ case "taxiwayelement" :
91
+ return {
92
+ fillOpacity : 1 ,
93
+ fillColor : 'hsl(0, 0%, 50%)' ,
94
+ stroke : false ,
95
+ }
96
+ case 'taxiwayshoulder' :
97
+ case "runwayshoulder" :
98
+ return {
99
+ fillOpacity : 0.5 ,
100
+ fillColor : 'hsl(0, 0%, 65%)' ,
101
+ stroke : false ,
102
+ }
103
+ case "standguidanceline" :
104
+ case "taxiwayguidanceline" :
105
+ case "runwayexitline" :
106
+ return {
107
+ stroke : true ,
108
+ fill : false ,
109
+ weight : 1.8 ,
110
+ dashArray : {
111
+ [ LineStyle . Solid ] : undefined ,
112
+ [ LineStyle . Unknown ] : undefined ,
113
+ [ LineStyle . Dashed ] : [ 3 , 3 ] ,
114
+ [ LineStyle . Dotted ] : [ 3 , 1 ] ,
115
+ } [ feature ?. properties . style as LineStyle ] ,
116
+ color : {
117
+ [ LineColor . Yellow ] : 'yellow' ,
118
+ [ LineColor . Unknown ] : 'yellow' ,
119
+ [ LineColor . Orange ] : 'orange' ,
120
+ [ LineColor . Blue ] : 'white' ,
121
+ [ LineColor . White ] : 'white' ,
122
+ } [ feature ?. properties . color as LineColor ]
123
+ }
124
+ case "arrestinggearlocation" :
125
+ return {
126
+ stroke : true ,
127
+ fill : false ,
128
+ color : '#ff00ff'
129
+ }
130
+ case "landandholdshortoperationlocation" :
131
+ return {
132
+ stroke : true ,
133
+ fill : false ,
134
+ color : '#00ff00'
135
+ }
136
+ case "verticalpolygonalstructure" :
137
+ return {
138
+ stroke : false ,
139
+ fill : true ,
140
+ fillOpacity : 1 ,
141
+ fillColor : feature ?. properties . plysttyp === PolygonalStructureType . TerminalBuilding ? 'hsl(240, 25%, 30%)' : 'hsl(0, 0%, 30%)'
142
+ }
143
+ case "taxiwayholdingposition" :
144
+ return {
145
+ color : {
146
+ [ StopbarCategory . None ] : 'yellow' ,
147
+ [ StopbarCategory . NotApplicable ] : 'yellow' ,
148
+ [ StopbarCategory . Unknown ] : 'yellow' ,
149
+ [ StopbarCategory . Cat1 ] : 'hsl(25, 100%, 50%)' ,
150
+ [ StopbarCategory . Cat2Or3 ] : 'hsl(0, 100%, 50%)' ,
151
+ } [ feature ?. properties . catstop as StopbarCategory ]
152
+ }
153
+ case "taxiwayintersectionmarking" :
154
+ return {
155
+ color : '#fefefe' ,
156
+ dashArray : [ 2 , 2 ]
157
+ }
158
+ case "hotspot" :
159
+ return {
160
+ fill : true ,
161
+ stroke : true ,
162
+ color : '#ff00ff' ,
163
+ fillColor : '#89259D' ,
164
+ fillOpacity : 0.3
165
+ }
166
+ case "constructionarea" :
167
+ return {
168
+ stroke : false ,
169
+ fillColor : '#ff0000' ,
170
+ fillOpacity : 0.1
171
+ }
172
+ case "frequencyarea" :
173
+ return {
174
+ fill : false ,
175
+ color : 'green'
176
+ }
177
+ case "water" :
178
+ return {
179
+ color : '#004a61' ,
180
+ fillColor : '#003264' ,
181
+ fillOpacity : 1 ,
182
+ }
183
+ case "aerodromereferencepoint" : return {
184
+ radius : 15 ,
185
+ color : 'white' ,
186
+ }
187
+ case "runwaythreshold" :
188
+ case "finalapproachandtakeoffarea" :
189
+ case "helipadthreshold" :
190
+ case "paintedcenterline" :
191
+ case "parkingstandlocation" :
192
+ case "touchdownliftoffarea" :
193
+ case "verticallinestructure" :
194
+ case "verticalpointstructure" :
195
+ return {
196
+ radius : 10
197
+ }
198
+ }
199
+
200
+ }
201
+ }
0 commit comments