Repository navigation
Expand file tree
/
Copy pathDoor.ts
More file actions
302 lines (279 loc) · 9.37 KB
/
Copy pathDoor.ts
File metadata and controls
302 lines (279 loc) · 9.37 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
import { SchemaDefinition } from '@sozialhelden/simpl-schema';
import { AccessType, AccessTypes } from './AccessType.js';
import BooleanField from './BooleanField.js';
import { getGrabBarsSchemaDefinition, GrabBars } from './GrabBars.js';
import htmlColorSchemaDefinition from './htmlColorSchemaDefinition.js';
import { getInteractableSchemaDefinition, Interactable } from './Interactable.js';
import { getIntercomSchemaDefinition, Intercom } from './Intercom.js';
import getPrefixedSchemaDefinition from './lib/getPrefixedSchemaDefinition.js';
import {
ForceSchema,
getPrefixedQuantitySchemaDefinition,
Length,
LengthSchema,
SpeedSchema,
} from './Quantity.js';
export const DoorInteractions = ['ringDoorbell', 'open', 'close', 'unlock', 'lock', 'unlockAndLock', 'openAndClose'] as const;
export type DoorInteraction = typeof DoorInteractions[number];
export const DoorInteractionsSet = new Set(DoorInteractions);
/**
* Describes the door of a place's entrance or to one of its facilities (e.g. to a shower, or to
* an elevator)
*/
export interface Door extends Interactable<DoorInteraction> {
/**
* Turning space in front of the door.
*/
turningSpaceInFront?: Length;
/**
* `true` if the door opens to the outside, `false` if it opens to the inside.
*/
doorOpensToOutside?: boolean;
/**
* `true` if the door is always open or automatic, `false` if it has to be opened manually.
* @deprecated Use `isAutomatic`, `isAlwaysOpen` or `isManual` instead.
*/
isAutomaticOrAlwaysOpen?: boolean;
/**
* `true` if the door opens automatically, `false` if not. The mechanism for opening the door is
* defined in other attributes.
*/
isAutomatic?: boolean;
/**
* `true` if the door is there, but always open, `false` if not.
*/
isAlwaysOpen?: boolean;
/**
* `true` if the door has a proximity sensor that triggers the opening mechanism, `false` if not.
*/
hasProximitySensor?: boolean;
/**
* `true` if the door has a switch that triggers the opening mechanism, `false` if not.
*/
hasSwitch?: boolean;
/**
* `true` if the door needs pressing a switch to open, `false` if not.
*/
needsSwitchToOpen?: boolean;
/**
* Width of the door.
*/
width?: Length;
/**
* Height of the door’s threshold / sill / step inside the door frame.
*/
thresholdHeight?: Length;
/**
* `true` if the threshold has rounded edges, `false` if not.
*/
thresholdIsRounded?: boolean;
/**
* `true` if the door is a sliding door, `false` if not.
*/
isSliding?: boolean;
/**
* `true` if the door is a glass door, `false` if not.
*/
isGlassDoor?: boolean;
/**
* `true` if the door is a glass door, but is marked, `false` if the door is an unmarked glass
* door, `undefined` if it is no glass door or the condition is unknown.
*/
hasClearMarkingOnGlassDoor?: boolean;
/**
* `true` if the door is easy to hold open (subjectively by the assessor), `false` if not.
*/
isEasyToHoldOpen?: boolean;
/**
* `true` if the door's handle is easy to use (subjectively by the assessor), `false` if not.
*/
hasErgonomicDoorHandle?: boolean;
/**
* `true` if the door is revolving (like a carousel), `false` if not.
*/
isRevolving?: boolean;
/**
* `true` if the door is a turnstile, `false` if not.
*/
isTurnstile?: boolean;
/**
* `true` if you need a [RADAR key](https://en.wikipedia.org/wiki/Disability_Rights_UK#National_Key_Scheme)
* to open the door, `false` if it's in the UK but you need no key
* or needs a different key.
*/
needsRadarKey?: boolean;
/**
* `true` if you need a [Euro key](https://en.wikipedia.org/wiki/Euro_key) to open the door,
* `false` if it's in Europe outside UK and works without a key, `undefined` if it is unknown or
* needs a different key.
*/
needsEuroKey?: boolean;
/**
* `true` if you need to use a keycard to pass the entrance, `false` if not.
*/
needsKeyCard?: boolean;
/**
* `true` if you need to use a key pad to pass this door, `false` if not.
*/
needsKeyPad?: boolean;
/**
* `true` if you need to ring a doorbell to pass the entrance, `false` if not.
*/
needsDoorbell?: boolean;
/**
* Height of the door bell's top button. If there is a lowered extra door bell (often marked with
* a wheelchair user symbol), use the height of this one's top button.
*/
doorbellTopButtonHeight?: Length;
/**
* `true` if the door has an intercom system, `false` if not.
*/
hasIntercom?: boolean;
/**
* `true` if you need to use the intercom to pass this door, `false` if not.
*/
needsIntercom?: boolean;
/**
* Describes the intercom system of the door.
*/
intercom?: Intercom;
/**
* Describes grab bars in front of the door.
*/
grabBars?: GrabBars;
/**
* Defines who this door is for. See https://wiki.openstreetmap.org/wiki/Key:access for more
* information.
*/
access?: AccessType[];
/**
* `true` if the door is visually contrasted to its surrounding wall, `false` if not.
*/
isVisuallyContrasted?: boolean;
/**
* `true` if the door frame is visually contrasted to its surrounding wall, `false` if not.
*/
hasVisuallyContrastedFrame?: boolean;
/**
* Describes the colors of the door itself, as HTML color strings. Don't include the door frame or
* door marking colors in this attribute, but use `markingColors` and `doorFrameColors` instead.
*
* This can make the door easier to find.
*
* If there are multiple colors, it might be enough to describe the most dominant one.
*
* If there are multiple colors, but there is no predominant color, describe all of them.
*
* This allows to determine the contrast to the wall and the door frame.
*
* Its best to determine the color at daylight.
*
* For glass doors, you can use 'transparent' as color.
*/
colors?: string[];
/**
* Describes the colors of a door marking, if existent, as HTML color strings.
*
* This can make the door easier to find.
*
* If there are multiple colors, it might be enough to describe the most dominant one.
*
* If there are multiple colors, but there is no predominant color, describe all of them.
*
* Its best to determine the color at daylight.
*
*/
markingColors?: string[];
/**
* Describes the colors of the door frame, if existent. If they are similar, describe only one
* color. Use HTML color strings here.
*
* This can make the door easier to find, and allows to determine the contrast to the door and
* the wall.
*
* If there are multiple colors, it might be enough to describe the most dominant one.
*
* If there are multiple colors, but there is no predominant color, describe all of them.
*
* Its best to determine the color at daylight.
*/
doorFrameColors?: string[];
/**
* Describes the colors of the walls right next the door. Use HTML color strings here.
*
* This can make the door easier to find, and allows to determine the contrast to the door frame
* and the door.
*
* - If there are multiple colors, it might be enough to describe the most dominant one.
* - If there are multiple colors, but there is no predominant color, describe all of them.
*
* Its best to determine the color at daylight.
*/
nearbyWallColors?: string[];
}
export const getDoorSchemaDefinition: () => SchemaDefinition = () => ({
doorOpensToOutside: BooleanField,
isAutomaticOrAlwaysOpen: BooleanField,
isAutomatic: BooleanField,
isAlwaysOpen: BooleanField,
hasProximitySensor: BooleanField,
hasSwitch: BooleanField,
needsSwitchToOpen: BooleanField,
isTurnstile: BooleanField,
...getPrefixedQuantitySchemaDefinition('width', LengthSchema),
...getPrefixedQuantitySchemaDefinition('thresholdHeight', LengthSchema),
thresholdIsRounded: BooleanField,
...getPrefixedQuantitySchemaDefinition('turningSpaceInFront', LengthSchema),
hasClearMarkingOnGlassDoor: BooleanField,
isEasyToHoldOpen: BooleanField,
hasErgonomicDoorHandle: BooleanField,
isRevolving: BooleanField,
needsRadarKey: BooleanField,
needsEuroKey: BooleanField,
isSliding: BooleanField,
isGlassDoor: BooleanField,
needsKeyCard: BooleanField,
needsKeyPad: BooleanField,
needsDoorbell: BooleanField,
...getPrefixedQuantitySchemaDefinition('doorbellTopButtonHeight', LengthSchema),
hasIntercom: BooleanField,
needsIntercom: BooleanField,
access: {
type: Array,
optional: true,
},
'access.$': {
type: String,
allowedValues: (AccessTypes as any) as any[],
},
...getPrefixedSchemaDefinition('intercom', getIntercomSchemaDefinition()),
...getPrefixedSchemaDefinition('grabBars', getGrabBarsSchemaDefinition()),
...getPrefixedQuantitySchemaDefinition('openingForce', ForceSchema),
...getPrefixedQuantitySchemaDefinition('closingSpeed', SpeedSchema),
...getPrefixedQuantitySchemaDefinition('latchingSpeed', SpeedSchema),
isVisuallyContrasted: BooleanField,
hasVisuallyContrastedFrame: BooleanField,
colors: {
type: Array,
optional: true,
},
'colors.$': {
type: String,
},
markingColors: {
type: Array,
optional: true,
},
'markingColors.$': htmlColorSchemaDefinition,
doorFrameColors: {
type: Array,
optional: true,
},
'doorFrameColors.$': htmlColorSchemaDefinition,
nearbyWallColors: {
type: Array,
optional: true,
},
'nearbyWallColors.$': htmlColorSchemaDefinition,
...getInteractableSchemaDefinition(DoorInteractionsSet),
});