jmapcloud-ng-core-types 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,622 @@
1
+ // ALL_MAP_MODIFICATION_TYPES in all-enum.ts
2
+ declare const enum JMAP_MODIFICATION_TYPES {
3
+ NONE = "",
4
+ CENTER = "center",
5
+ SCALE = "scale"
6
+ }
7
+
8
+ // ALL_MAP_POSITIONS in all-enum.ts
9
+ declare const enum JMAP_POSITIONS {
10
+ TOP_LEFT = "top-left",
11
+ TOP_RIGHT = "top-right",
12
+ BOTTOM_LEFT = "bottom-left",
13
+ BOTTOM_RIGHT = "bottom-right"
14
+ }
15
+
16
+ // ALL_MAP_DISTANCE_UNITS in all-enum.ts
17
+ declare const enum JMAP_DISTANCE_UNITS {
18
+ MILLIMETERS = "millimeters",
19
+ CENTIMETERS = "centimeters",
20
+ METERS = "meters",
21
+ KILOMETERS = "kilometers",
22
+ INCHES = "inches",
23
+ FEETS = "feet",
24
+ YARDS = "yards",
25
+ MILES = "miles",
26
+ NAUTICAL_MILES = "nauticalmiles"
27
+ }
28
+
29
+ // ALL_MAP_RASTER_SCHEME_TYPES in all-enum.ts
30
+ declare const enum JMAP_RASTER_SCHEME_TYPES {
31
+ TMS = "tms",
32
+ XYZ = "xyz"
33
+ }
34
+
35
+ declare interface JMapInteractor {
36
+ init(map: mapboxgl.Map): void
37
+ activate(): void
38
+ deactivate(): void
39
+ terminate(): void
40
+ }
41
+
42
+ declare interface JLatitudeAndZoom {
43
+ zoom?: number
44
+ latitude?: number
45
+ }
46
+
47
+ /**
48
+ * includeClusterFeatures and includeLabelFeatures are mainly used for internal NG methods, you should not have to use them.
49
+ */
50
+ declare interface JGetRenderedFeaturesParams {
51
+ geoFilter?: JLocation | JBoundaryBox | JCircle
52
+ keepAllTiles?: boolean
53
+ includeClusterFeatures?: boolean
54
+ includeLabelFeatures?: boolean
55
+ }
56
+
57
+ declare interface JGetSourceFeaturesParams {
58
+ viewport?: GeoJSON.Feature<GeoJSON.Polygon>
59
+ keepAllTiles?: boolean
60
+ }
61
+
62
+ declare interface JDisplayExtentParams {
63
+ moveToExtent: boolean
64
+ }
65
+
66
+ declare interface JMapEventParams {
67
+ map: mapboxgl.Map
68
+ mapEvent: any
69
+ }
70
+
71
+ declare interface JMapEventLocationParams extends JMapEventParams {
72
+ location: JLocation
73
+ }
74
+
75
+ declare interface JMapEventZoomParams extends JMapEventParams {
76
+ zoom: number
77
+ }
78
+
79
+ declare interface JMapEventRotateParams extends JMapEventParams {
80
+ bearing: number
81
+ }
82
+
83
+ declare interface JMapEventPitchParams extends JMapEventParams {
84
+ pitch: number
85
+ }
86
+
87
+ declare interface JMapEventLayerParams extends JMapEventLocationParams {
88
+ layerId: JId
89
+ }
90
+
91
+ declare interface JMapEventFeaturesParams extends JMapEventLayerParams {
92
+ features: any[]
93
+ }
94
+
95
+ declare interface JMapEventContainerReadyParams {
96
+ container: HTMLElement
97
+ }
98
+
99
+ declare interface JMapEventContainerResizedParams {
100
+ width: number
101
+ height: number
102
+ container: HTMLElement
103
+ }
104
+
105
+ declare interface JMapLayerSelectionChanges {
106
+ hasChanged: boolean
107
+ addedFeatures: GeoJSON.Feature[]
108
+ removedFeatures: GeoJSON.Feature[]
109
+ }
110
+
111
+ declare interface JMapEventSelectionChangedParams {
112
+ oldSelection: JMapSelection
113
+ newSelection: JMapSelection
114
+ changesByLayerId: { [layerId: string]: JMapLayerSelectionChanges }
115
+ }
116
+
117
+ declare interface JMapEventBasemapChangedParams {
118
+ currentActiveBasemapId: string
119
+ newActiveBasemapId: string
120
+ }
121
+
122
+ declare type JMapSelection = {
123
+ [key in JId]: GeoJSON.Feature[]
124
+ }
125
+
126
+ declare interface JMapLayerVisibilityStatus {
127
+ layerId: JId
128
+ layerName: string
129
+ isRendered: boolean
130
+ visibilityProperty: boolean
131
+ parentVisibility: boolean
132
+ scaleVisibility: boolean
133
+ extentVisibility: boolean
134
+ }
135
+
136
+ declare type JMapLayersVisibilityStatus = {
137
+ [key in JId]: JMapLayerVisibilityStatus
138
+ }
139
+
140
+ declare interface JProjection {
141
+ code: string
142
+ name: string
143
+ }
144
+
145
+ declare interface JMapFeatureAttributeValues {
146
+ featureId: JId
147
+ [attributeId: string]: any
148
+ }
149
+
150
+ declare interface JMapAttributeSearch {
151
+ layerId: JId
152
+ attributeName: string
153
+ attributeValue: any | any[]
154
+ showMapPopup?: boolean
155
+ }
156
+
157
+ declare interface JMapNavigationStep {
158
+ center: JLocation
159
+ zoom: number
160
+ bearing: number
161
+ pitch: number
162
+ }
163
+
164
+ /**
165
+ * **JMapBoxEventData**
166
+ *
167
+ * This interface describe optionnal data we can pass to MapBox events
168
+ * in order to transport useful information while consuming the events in your application
169
+ *
170
+ *
171
+ */
172
+ declare interface JMapBoxEventData {
173
+ /**
174
+ * **stopJMapEventPropagation**
175
+ *
176
+ * if true will prevent JMap event to be fired
177
+ *
178
+ */
179
+ stopJMapEventPropagation?: boolean
180
+ /**
181
+ * **preventNavigationStepPush**
182
+ *
183
+ * Used in the context of programmatic navigation (ex: while stepping back in the navigation history)
184
+ * if true it will prevent navigation destination to be pushed in the Navigation History stack
185
+ *
186
+ */
187
+ preventNavigationStepPush?: boolean
188
+ }
189
+
190
+ declare interface JMapMapboxLayerStyleDefinition {
191
+ styleLayer: mapboxgl.Layer
192
+ borderStyleLayer?: mapboxgl.Layer
193
+ }
194
+
195
+ declare interface JMapNavigateToParams extends JPanAndZoomOptions {
196
+ center: JLocation
197
+ zoom: number
198
+ bearing: number
199
+ pitch: number
200
+ }
201
+
202
+ declare interface JMapPulsingDotColor {
203
+ red: number
204
+ green: number
205
+ blue: number
206
+ alpha?: number
207
+ }
208
+
209
+ declare interface JMapFlashLocationParams {
210
+ dotColor?: JMapPulsingDotColor
211
+ haloColor?: JMapPulsingDotColor
212
+ size?: number
213
+ delay?: number
214
+ fitFeatures?: boolean
215
+ panAndZoomOptions?: JPanAndZoomOptions
216
+ }
217
+
218
+ declare interface JBasemap {
219
+ id: string
220
+ label: string
221
+ tileUrls: string[]
222
+ previewImageAsUrlOrBase64?: string
223
+ scheme?: JMAP_RASTER_SCHEME_TYPES
224
+ minzoom?: number
225
+ maxzoom?: number
226
+ tileSize?: number
227
+ extent?: JBoundaryBox
228
+ attributions?: JMapAttribution[]
229
+ }
230
+
231
+ declare interface JMapAttribution {
232
+ id: string
233
+ text: string | undefined // text and/or imageUrl param(s) must be set
234
+ imageUrl: string | undefined // imageUrl and/or text param(s) must be set
235
+ href?: string
236
+ }
237
+
238
+ declare interface JZoomOptions {
239
+ /**
240
+ * If true will animate the change
241
+ */
242
+ animate: boolean
243
+ /**
244
+ * Zoom padding top in pixel
245
+ */
246
+ paddingTop: number
247
+ /**
248
+ * Zoom padding left in pixel
249
+ */
250
+ paddingLeft: number
251
+ /**
252
+ * Zoom padding right in pixel
253
+ */
254
+ paddingRight: number
255
+ /**
256
+ * Zoom padding bottom in pixel
257
+ */
258
+ paddingBottom: number
259
+ /**
260
+ * Zoom max zoom level
261
+ */
262
+ maxZoom?: number
263
+ }
264
+
265
+ declare interface JPanAndZoomOptions extends Partial<JZoomOptions> {
266
+ /**
267
+ * Event related options
268
+ */
269
+ mapBoxEventData?: JMapBoxEventData
270
+ }
271
+
272
+ declare interface JCoreMapOptions {
273
+ /**
274
+ * When the JMap Cloud NG Core library start it will create or use an existing div container in which the map will be inserted into.
275
+ *
276
+ * By default the div container id is "***jmap-map***", but you can set the id of your choice like that :
277
+ * ```html
278
+ * <html>
279
+ * ...
280
+ * <body>
281
+ * <script type="text/javascript">
282
+ * window.JMAP_OPTIONS = {
283
+ * ...
284
+ * map: {
285
+ * containerId: "my-custom-container-id"
286
+ * }
287
+ * }
288
+ * </script>
289
+ * <div id="my-custom-container-id"></div>
290
+ * </body>
291
+ * </html>
292
+ * ```
293
+ *
294
+ * In the above example the map will be inserted in the div having "my-custom-container-id" as id. You need to set the width and the height of this div by yourself.
295
+ *
296
+ * If no container is found in the DOM with the specified id, JMap Cloud NG Core library will create and append it automatically in the body element of the web page.
297
+ */
298
+ containerId?: string
299
+
300
+ /**
301
+ * If a mapbox token is set through the JMap Admin interface,
302
+ * the JMap Cloud NG Core library will use it automatically, nothing else to do for you.
303
+ *
304
+ * The Mapbox token is used by JMap in order to fully use Mapbox capabilities
305
+ * like displaying a mapbox base maps.
306
+ *
307
+ * But if no token is set in JMap Admin, or if you want to use
308
+ * the mapbox token of your choice, you have to set the "***mapboxToken***" parameter :
309
+ *
310
+ * ```html
311
+ * <html>
312
+ * ...
313
+ * <body>
314
+ * <script type="text/javascript">
315
+ * window.JMAP_OPTIONS = {
316
+ * ...
317
+ * map: {
318
+ * mapboxToken: "dfqwdhjgqdhdh4567sjdvhbh"
319
+ * }
320
+ * }
321
+ * </script>
322
+ * ...
323
+ * </body>
324
+ * </html>
325
+ * ```
326
+ */
327
+ mapboxToken?: string
328
+
329
+ /**
330
+ * By default the Map Rotation control is not visible.
331
+ *
332
+ * But if ***mapRotationControlVisible*** is true, it will be displayed on the map.
333
+ *
334
+ * ```html
335
+ * <html>
336
+ * ...
337
+ * <body>
338
+ * <script type="text/javascript">
339
+ * window.JMAP_OPTIONS = {
340
+ * ...
341
+ * map: {
342
+ * mapRotationControlVisible: true,
343
+ * }
344
+ * }
345
+ * </script>
346
+ * ...
347
+ * </body>
348
+ * </html>
349
+ * ```
350
+ */
351
+ mapRotationControlVisible?: boolean
352
+
353
+ /**
354
+ * You can set the initial rotation of the map by setting the ***rotation*** parameter. This parameter will have the priority over bearing if both parameters are specified.
355
+ * By example if you want the map to open with a clockwise rotation of 90 degree :
356
+ *
357
+ * ```html
358
+ * <html>
359
+ * ...
360
+ * <body>
361
+ * <script type="text/javascript">
362
+ * window.JMAP_OPTIONS = {
363
+ * ...
364
+ * map: {
365
+ * rotation: 90,
366
+ * }
367
+ * }
368
+ * </script>
369
+ * ...
370
+ * </body>
371
+ * </html>
372
+ * ```
373
+ */
374
+ rotation?: number
375
+
376
+ /**
377
+ * You can set the initial rotation of the map by setting the ***bearing*** parameter. This parameter will be ignored if rotation is specified.
378
+ * By example if you want the map to open with a anticlockwise rotation of 90 degree :
379
+ *
380
+ * ```html
381
+ * <html>
382
+ * ...
383
+ * <body>
384
+ * <script type="text/javascript">
385
+ * window.JMAP_OPTIONS = {
386
+ * ...
387
+ * map: {
388
+ * bearing: 90,
389
+ * }
390
+ * }
391
+ * </script>
392
+ * ...
393
+ * </body>
394
+ * </html>
395
+ * ```
396
+ */
397
+ bearing?: number
398
+
399
+ /**
400
+ * By default the Navigation History control is not visible.
401
+ *
402
+ * But if ***navigationHistoryControlVisible*** is true, it will be displayed on the map.
403
+ *
404
+ * ```html
405
+ * <html>
406
+ * ...
407
+ * <body>
408
+ * <script type="text/javascript">
409
+ * window.JMAP_OPTIONS = {
410
+ * ...
411
+ * map: {
412
+ * navigationHistoryControlVisible: true,
413
+ * }
414
+ * }
415
+ * </script>
416
+ * ...
417
+ * </body>
418
+ * </html>
419
+ * ```
420
+ */
421
+ navigationHistoryControlVisible?: boolean
422
+
423
+ /**
424
+ * By default the scale control panel it is not visible.
425
+ *
426
+ * But if ***scaleControlVisible*** is true, it will be displayed on the map.
427
+ *
428
+ * ```html
429
+ * <html>
430
+ * ...
431
+ * <body>
432
+ * <script type="text/javascript">
433
+ * window.JMAP_OPTIONS = {
434
+ * ...
435
+ * map: {
436
+ * scaleControlVisible: true,
437
+ * }
438
+ * }
439
+ * </script>
440
+ * ...
441
+ * </body>
442
+ * </html>
443
+ * ```
444
+ */
445
+ scaleControlVisible?: boolean
446
+
447
+ /**
448
+ * You can choose the position of the scale control on the map.
449
+ *
450
+ * Use a value in : "**top-left**", "**top-right**", "**bottom-left**", or "**bottom-right**"
451
+ *
452
+ * ```html
453
+ * <html>
454
+ * ...
455
+ * <body>
456
+ * <script type="text/javascript">
457
+ * window.JMAP_OPTIONS = {
458
+ * ...
459
+ * map: {
460
+ * scaleControlPosition: "bottom-right"
461
+ * }
462
+ * }
463
+ * </script>
464
+ * ...
465
+ * </body>
466
+ * </html>
467
+ * ```
468
+ */
469
+ scaleControlPosition?: JMAP_POSITIONS
470
+
471
+ /**
472
+ * This is the unit in which the scale control panel will display the data.
473
+ *
474
+ * ```html
475
+ * <html>
476
+ * ...
477
+ * <body>
478
+ * <script type="text/javascript">
479
+ * window.JMAP_OPTIONS = {
480
+ * ...
481
+ * map: {
482
+ * scaleControlUnit: "imperial"
483
+ * }
484
+ * }
485
+ * </script>
486
+ * ...
487
+ * </body>
488
+ * </html>
489
+ * ```
490
+ */
491
+ scaleControlUnit?: "imperial" | "metric" | "nautical"
492
+
493
+ /**
494
+ * You can set the location of the center of the map by setting the ***center*** parameter. By example if you want to center the map on the city of Ottawa :
495
+ *
496
+ * ```html
497
+ * <html>
498
+ * ...
499
+ * <body>
500
+ * <script type="text/javascript">
501
+ * window.JMAP_OPTIONS = {
502
+ * ...
503
+ * map: {
504
+ * center: {
505
+ * x: -75.6981200,
506
+ * y: 45.4111700
507
+ * }
508
+ * }
509
+ * }
510
+ * </script>
511
+ * ...
512
+ * </body>
513
+ * </html>
514
+ * ```
515
+ */
516
+ center?: JLocation
517
+
518
+ /**
519
+ * You can zoom to a custom level by setting the "***zoom***" variable. Here an example :
520
+ *
521
+ * ```html
522
+ * <html>
523
+ * ...
524
+ * <body>
525
+ * <script type="text/javascript">
526
+ * window.JMAP_OPTIONS = {
527
+ * ...
528
+ * map: {
529
+ * zoom: 4.32
530
+ * }
531
+ * }
532
+ * </script>
533
+ * ...
534
+ * </body>
535
+ * </html>
536
+ * ```
537
+ */
538
+ zoom?: number
539
+
540
+ /**
541
+ * The map will zoom and pan to fit exactly the extent :
542
+ *
543
+ * ```html
544
+ * <html>
545
+ * ...
546
+ * <body>
547
+ * <script type="text/javascript">
548
+ * window.JMAP_OPTIONS = {
549
+ * ...
550
+ * map: {
551
+ * extent: {
552
+ * sw: { x: 12.4, y: 45.34 },
553
+ * ne: { x: 24.4, y: 55.34 }
554
+ * }
555
+ * }
556
+ * }
557
+ * </script>
558
+ * ...
559
+ * </body>
560
+ * </html>
561
+ * ```
562
+ */
563
+ extent?: JBoundaryBox
564
+
565
+ /**
566
+ * Will execute a search by attribute on the layer, then pan and zoom to display the result.
567
+ * Check for features having the property equals to the value. If showMapPopup is true and that
568
+ * only one __attributeValue__ is specified and that only __one__ feature is found,
569
+ * the feature's Mouseover info will be displayed if defined
570
+ *
571
+ * ```html
572
+ * <html>
573
+ * ...
574
+ * <body>
575
+ * <script type="text/javascript">
576
+ * window.JMAP_OPTIONS = {
577
+ * ...
578
+ * map: {
579
+ * search: {
580
+ * layerId: 2,
581
+ * attributeName: "PEC",
582
+ * attributeValue: "RT 2012",
583
+ * showMapPopup: true
584
+ * }
585
+ * }
586
+ * }
587
+ * </script>
588
+ * ...
589
+ * </body>
590
+ * </html>
591
+ * ```
592
+ */
593
+ search?: JMapAttributeSearch
594
+
595
+ /**
596
+ * You can execute a custom piece of code at runtime, after the map is ready,
597
+ * and only one time at JMap Cloud NG Core library startup.
598
+ *
599
+ * For that you have to set the "***onStartupMapReadyFn***" parameter which is a function.
600
+ * Here an example that will display a message "Hello the map is ready !" in the console :
601
+ *
602
+ * ```html
603
+ * <html>
604
+ * ...
605
+ * <body>
606
+ * <script type="text/javascript">
607
+ * window.JMAP_OPTIONS = {
608
+ * ...
609
+ * map: {
610
+ * onStartupMapReadyFn: map => {
611
+ * console.log("Hello the map is ready !", map)
612
+ * }
613
+ * }
614
+ * }
615
+ * </script>
616
+ * ...
617
+ * </body>
618
+ * </html>
619
+ * ```
620
+ */
621
+ onStartupMapReadyFn?: (map: mapboxgl.Map) => void
622
+ }
@@ -0,0 +1,62 @@
1
+ declare interface JMapMouseOver {
2
+ text: string
3
+ preventTextDuplication: boolean
4
+ backgroundColor: string
5
+ maximumVisibleMapboxZoom: number
6
+ minimumVisibleMapboxZoom: number
7
+ }
8
+
9
+ declare interface JMouseOverContent {
10
+ html: string
11
+ pendingPhotoFeatureIdsByLayerId: { [key in JId]: JId[] }
12
+ pendingLineLengthFeatureIdsByLayerId: { [key in JId]: JId[] }
13
+ pendingPolygonAreaFeatureIdsByLayerId: { [key in JId]: JId[] }
14
+ pendingCentroidFeatureIdsByLayerId: { [key in JId]: JId[] }
15
+ toEvalJS: string[]
16
+ }
17
+
18
+ declare interface JMouseOverOpenPopupParams {
19
+ location: JLocation
20
+ html: string
21
+ toEvalJS?: string[]
22
+ panToLocation?: boolean
23
+ }
24
+
25
+ declare interface JMouseOverOpenPopupForSelectionParams {
26
+ selection: JMapSelection
27
+ location?: JLocation
28
+ panToLocation?: boolean
29
+ }
30
+
31
+ declare interface JMouseOverSelectionParams {
32
+ selection: JMapSelection
33
+ popup: mapboxgl.Popup
34
+ map: mapboxgl.Map | undefined
35
+ location: JLocation
36
+ }
37
+
38
+ declare interface JMouseOverEventParams {
39
+ content: JMouseOverContent
40
+ }
41
+
42
+ declare interface JMouseOverContentEventParams extends JMouseOverSelectionParams {
43
+ // if called will stop the current mouse over to be displayed
44
+ cancelMouseOver(): void
45
+ }
46
+
47
+ declare interface JMouseOverBeforeEventParams extends JMouseOverContentEventParams {
48
+ addFeaturesToLayerSelection(layerId: JId, features: GeoJSON.Feature[]): void
49
+ removeFeaturesFromLayerSelection(layerId: JId, featureIds: JId[]): void
50
+ getFeaturesByLayerId(layerId: JId): GeoJSON.Feature[]
51
+ // you can add some html at the beginning of the mouseover
52
+ addHtmlContentAtTheBeginning(html: string): void
53
+ // you can add some html at the end of the mouseover
54
+ addHtmlContentAtTheEnd(html: string): void
55
+ // by default html content added at the beginning or the end are displayed only if a mouseover is found.
56
+ // By calling this method it will display even if no mouseover found
57
+ displayHtmlContentEvenIfNoMouseOver(): void
58
+ }
59
+
60
+ declare interface JMouseOverAfterEventParams extends JMouseOverContentEventParams, JMouseOverEventParams {
61
+ // nothing to add
62
+ }
@@ -0,0 +1,43 @@
1
+ // ALL_PHOTO_PROJECTION_TYPES in all-enum.ts
2
+ declare const enum JPHOTO_PROJECTION_TYPES {
3
+ NONE = "none",
4
+ EQUIRECTANGULAR = "equirectangular"
5
+ }
6
+
7
+ declare interface JPhoto {
8
+ id: JId
9
+ url: string
10
+ title: string
11
+ fileName: string
12
+ comment: string | undefined
13
+ metadata: JPhotoMetadata
14
+ imageBase64: string
15
+ hasChanged?: boolean
16
+ isNewPhoto?: boolean
17
+ isRemoved?: boolean
18
+ canDelete?: boolean
19
+ canUpdate?: boolean
20
+ initialTitle?: string
21
+ initialComment?: string | undefined
22
+ /**
23
+ * Used to store the generated id (the one used when creating photo that are not yet saved).
24
+ * Required to replace in the store photo list, after the photo has been successfully
25
+ * created on the server.
26
+ */
27
+ oldTempCreationId?: JId
28
+ }
29
+
30
+ declare interface JPhotoOpenPopupParams {
31
+ selectedPhotoId?: JId
32
+ keepSameSelectedPhotoId?: boolean
33
+ onDelete?: (photo: JPhoto) => boolean
34
+ onUpdate?: (photo: JPhoto, title: string, comment: string | undefined) => boolean
35
+ }
36
+
37
+ declare interface JPhotoEventContainerCreatedParams {
38
+ container: HTMLElement
39
+ }
40
+
41
+ declare interface JPhotoMetadata {
42
+ projectionType: JPHOTO_PROJECTION_TYPES
43
+ }