• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jumpinjackie / mapguide-react-layout / 29921515611

22 Jul 2026 12:53PM UTC coverage: 62.625% (+1.5%) from 61.081%
29921515611

push

github

web-flow
Update to React 18 + other package updates (#1683)

* Update to React 18 and other assorted package updates

* More package updates

* Update react-redux

* Fix TS error

3301 of 6236 branches covered (52.93%)

1 of 2 new or added lines in 2 files covered. (50.0%)

145 existing lines in 29 files now uncovered.

6910 of 11034 relevant lines covered (62.62%)

15.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.1
/src/api/common.ts
1
import { ResultColumnSet } from "./contracts/weblayout";
2
import { RuntimeMap } from "./contracts/runtime-map";
3
import { FeatureSet, LayerMetadata, QueryMapFeaturesResponse, SelectedFeature } from "./contracts/query";
4
import { IQueryMapFeaturesOptions } from './request-builder';
5

6
import olPoint from "ol/geom/Point";
7
import olLineString from "ol/geom/LineString";
8
import olCircle from "ol/geom/Circle";
9
import olPolygon from "ol/geom/Polygon";
10
import olGeometry from "ol/geom/Geometry";
11

12
import olLayerBase from "ol/layer/Base";
13
import olInteraction from "ol/interaction/Interaction";
14
import olOverlay from "ol/Overlay";
15

16
import { IOLFactory } from "./ol-factory";
17
import { ViewerAction, IGenericSubjectMapLayer, IInitialExternalLayer, ISelectedFeaturePopupTemplateConfiguration } from '../actions/defs';
18
import { ProjectionLike } from 'ol/proj';
19
import { IParsedFeatures } from './layer-manager/parsed-features';
20
import Collection from 'ol/Collection';
21
import Feature from 'ol/Feature';
22
import { ISubscriberProps } from '../containers/subscriber';
23
import Geometry from 'ol/geom/Geometry';
24
import { IBasicPointCircleStyle, IPointIconStyle, IBasicVectorLineStyle, IBasicVectorPolygonStyle, IVectorLayerStyle, IClusterSettings, ClusterClickAction, IHeatmapSettings } from './ol-style-contracts';
25
import { IToolbarAppState } from './registry/command';
26
import { ClientSelectionSet } from "./contracts/common";
27

28
// Event boilerplate
29
export type GenericEvent = any;
30

31
export type GenericEventHandler = (e: GenericEvent) => void;
32

33
/**
34
 * Defines a size
35
 */
36
export type Size = { w: number, h: number };
37

38
/**
39
 * The default blank size
40
 */
41
export const BLANK_SIZE: Size = { w: 1, h: 1 } as const;
49✔
42

43
/**
44
 * @deprecated Use UnitOfMeasure enum instead
45
 */
46
export type UnitName = 'Unknown' | 'Inches' | 'Feet' | 'Yards' | 'Miles' | 'Nautical Miles'
47
    | 'Millimeters' | 'Centimeters' | 'Meters' | 'Kilometers'
48
    | 'Degrees' | 'Decimal Degrees' | 'Degrees Minutes Seconds' | 'Pixels';
49
export enum UnitOfMeasure {
49✔
50
    /**
51
     * An unknown unit
52
     */
53
    Unknown = 0,
49✔
54
    /**
55
     * Inch unit
56
     */
57
    Inches = 1,
49✔
58
    /**
59
     * Feet unit
60
     */
61
    Feet = 2,
49✔
62
    /**
63
     * Yard unit
64
     */
65
    Yards = 3,
49✔
66
    /**
67
     * Mile unit
68
     */
69
    Miles = 4,
49✔
70
    /**
71
     * Nautical Mile unit
72
     */
73
    NauticalMiles = 5,
49✔
74
    /**
75
     * Millimeter unit
76
     */
77
    Millimeters = 6,
49✔
78
    /**
79
     * Centimeter unit
80
     */
81
    Centimeters = 7,
49✔
82
    /**
83
     * Meter unit
84
     */
85
    Meters = 8,
49✔
86
    /**
87
     * Kilometer unit
88
     */
89
    Kilometers = 9,
49✔
90
    /**
91
     * Degree unit
92
     */
93
    Degrees = 10,
49✔
94
    /**
95
     * Decimal Degree unit
96
     */
97
    DecimalDegrees = 11,
49✔
98
    /**
99
     * DMS unit
100
     */
101
    DMS = 12,
49✔
102
    /**
103
     * Pixel unit
104
     */
105
    Pixels = 13,
49✔
106
}
107

108
export interface UnitInfo {
109
    unitsPerMeter: number;
110
    metersPerUnit: number;
111
    name: UnitName;
112
    /**
113
     * @since 0.12.2
114
     */
115
    localizedName: (locale?: string) => string;
116
    abbreviation: (locale?: string) => string;
117
}
118

119
/**
120
 * Describes a map view
121
 * 
122
 * @interface IMapView
123
 */
124
export interface IMapView {
125
    /**
126
     * The x coordinate
127
     *
128
     * @type {number}
129
     *
130
     */
131
    x: number;
132
    /**
133
     * The Y coordinate
134
     *
135
     * @type {number}
136
     *
137
     */
138
    y: number;
139
    /**
140
     * The scale
141
     *
142
     * @type {number}
143
     *
144
     */
145
    scale: number;
146
    /**
147
     * The view resolution
148
     * 
149
     * @type {number | undefined}
150
     *
151
     */
152
    resolution?: number;
153
}
154

155
/**
156
 * Describes a function that is called when a command is invoked
157
 * 
158
 * @since 0.15 stronger-typed parameters
159
 */
160
export type DispatcherFunc = (dispatch: ReduxDispatch, getState: () => Readonly<IApplicationState>, viewer?: IMapViewer, parameters?: Record<string, unknown>) => any;
161

162
/**
163
 * Describes a viewer command
164
 *
165
 * @interface ICommand
166
 */
167
export interface ICommand {
168
    /**
169
     * The icon for this command
170
     *
171
     * @type {string}
172
     *
173
     */
174
    icon?: string;
175
    iconClass?: string;
176
    //tooltip?: string;
177
    /**
178
     * @since 0.12.8
179
     */
180
    title?: string;
181
    /**
182
     * Indicates if this command is enabled based on the given application state
183
     *
184
     *
185
     *
186
     */
187
    enabled: (state: Readonly<IToolbarAppState>, parameters?: any) => boolean;
188
    /**
189
     * Indicates if this command is enabled based on the given application state
190
     *
191
     *
192
     *
193
     */
194
    selected: (state: Readonly<IToolbarAppState>) => boolean;
195
    /**
196
     * Invokes the command
197
     *
198
     * @type {DispatcherFunc}
199
     *
200
     */
201
    invoke: DispatcherFunc;
202
}
203

204
/**
205
 * Valid command targets for an InvokeURL command
206
 */
207
export type CommandTarget = "TaskPane" | "NewWindow" | "SpecifiedFrame";
208

209
/**
210
 * An InvokeURL command parameter
211
 *
212
 * @interface IInvokeUrlCommandParameter
213
 */
214
export interface IInvokeUrlCommandParameter {
215
    /**
216
     * The name of the parameter
217
     *
218
     * @type {string}
219
     *Parameter
220
     */
221
    name: string;
222
    /**
223
     * The value of the parameter
224
     *
225
     * @type {string}
226
     *Parameter
227
     */
228
    value: string;
229
}
230

231
/**
232
 * Describes a command that will run in a pre-defined target frame or window
233
 *
234
 * @interface ITargetedCommand
235
 */
236
export interface ITargetedCommand {
237
    /**
238
     * Specifies the target which the URL should be invoked in
239
     *
240
     * @type {CommandTarget}
241
     *
242
     */
243
    target: CommandTarget;
244
    /**
245
     * The name of the frame to run this command in. Only applies if the target is
246
     * "SpecifiedFrame"
247
     */
248
    targetFrame?: string;
249
}
250

251
/**
252
 * Describes a command that invokes a URL into a specified target
253
 *
254
 * @interface IInvokeUrlCommand
255
 */
256
export interface IInvokeUrlCommand extends ITargetedCommand {
257
    /**
258
     * The icon for this command
259
     *
260
     * @type {string}
261
     *
262
     */
263
    icon?: string;
264
    iconClass?: string;
265
    /**
266
     * @since 0.12.8
267
     */
268
    title?: string;
269
    /**
270
     * The URL to invoke
271
     *
272
     * @type {string}
273
     *
274
     */
275
    url: string;
276
    /**
277
     * Indicates whether to disable this command if there is no map selection
278
     *
279
     * @type {boolean}
280
     *
281
     */
282
    disableIfSelectionEmpty?: boolean;
283
    /**
284
     * Additional command parameters
285
     *
286
     */
287
    parameters: IInvokeUrlCommandParameter[];
288
}
289

290
/**
291
 * Describes a search command
292
 *
293
 * @interface ISearchCommand
294
 */
295
export interface ISearchCommand extends ITargetedCommand {
296
    /**
297
     * The icon for this command
298
     *
299
     * @type {string}
300
     *
301
     */
302
    icon?: string;
303
    iconClass?: string;
304
    /**
305
     * The name of the map layer this commmand applies to
306
     *
307
     * @type {string}
308
     *
309
     */
310
    layer: string;
311
    /**
312
     * The prompt to display in the search command UI
313
     *
314
     * @type {string}
315
     *
316
     */
317
    prompt: string;
318
    /**
319
     * The title to display in the search command UI
320
     *
321
     * @type {string}
322
     *
323
     */
324
    title: string;
325
    /**
326
     * The set of feature properties to show in the search results
327
     *
328
     * @type {ResultColumnSet}
329
     *
330
     */
331
    resultColumns: ResultColumnSet;
332
    /**
333
     * The search filter to apply based on user input
334
     *
335
     * @type {string}
336
     *
337
     */
338
    filter?: string;
339
    /**
340
     * The maximum number of results to return
341
     *
342
     * @type {number}
343
     *
344
     */
345
    matchLimit: number;
346
}
347

348
/**
349
 * Type alias for a dictionary-like structure
350
 */
351
export type Dictionary<T> = { [key: string]: T };
352

353
/**
354
 * A 2d coordinate (renamed to Coordinate2D from Coordinate in 0.13)
355
 */
356
export type Coordinate2D = [number, number];
357

358
/**
359
 * A size quantity
360
 * @since 0.13
361
 */
362
export type Size2 = [number, number];
363

364
/**
365
 * A bounding box array
366
 */
367
export type Bounds = [number, number, number, number];
368

369
/**
370
 * An active map viewer tool
371
 *
372
 * @enum {number}
373
 */
374
export enum ActiveMapTool {
49✔
375
    /**
376
     * Zoom tool
377
     */
378
    Zoom,
49✔
379
    /**
380
     * Selection tool
381
     */
382
    Select,
49✔
383
    /**
384
     * Pan tool
385
     */
386
    Pan,
49✔
387
    /**
388
     * None
389
     */
390
    None
49✔
391
}
392

393
/**
394
 * Describes an external base layer
395
 * 
396
 * @interface IExternalBaseLayer
397
 */
398
export interface IExternalBaseLayer {
399
    /**
400
     * The name of the external base layer
401
     *
402
     * @type {string}
403
     *
404
     */
405
    name: string;
406
    /**
407
     * The kind of external base layer
408
     *
409
     * @type {string}
410
     *
411
     */
412
    kind: string;
413
    /**
414
     * Indicates if this external base layer is visible
415
     *
416
     * @type {boolean}
417
     *
418
     */
419
    visible?: boolean;
420
    /**
421
     * Additional options for initializing the external base layer
422
     *
423
     * @type {*}
424
     *
425
     */
426
    options?: any;
427
}
428

429

430
/**
431
 * Describes a menu entry on the Map Menu component
432
 * 
433
 * @interface IMapMenuEntry
434
 */
435
export interface IMapMenuEntry {
436
    /**
437
     * The runtime map name
438
     *
439
     * @type {string}
440
     *
441
     */
442
    mapName: string;
443
    /**
444
     * The menu entry label
445
     *
446
     * @type {string}
447
     *
448
     */
449
    label: string;
450
}
451

452
/**
453
 * A bit mask indicating how a map viewer should refresh
454
 *
455
 * @enum {number}
456
 */
457
export enum RefreshMode {
49✔
458
    /**
459
     * Refresh only the layers
460
     */
461
    LayersOnly = 1,
49✔
462
    /**
463
     * Refresh only the selection
464
     */
465
    SelectionOnly = 2
49✔
466
}
467

468
/**
469
 * The spatial operator to use for selection operations
470
 */
471
export type SelectionVariant = "INTERSECTS" | "TOUCHES" | "WITHIN" | "ENVELOPEINTERSECTS";
472

473
/**
474
 * MapGuide-specific viewer functionality
475
 *
476
 * @interface IMapGuideViewerSupport
477
 * @since 0.14
478
 */
479
export interface IMapGuideViewerSupport {
480
    /**
481
     * Sets the selection XML
482
     *
483
     * @param {string} xml
484
     * @param {IQueryMapFeaturesOptions} [queryOpts]
485
     * @param {(res: QueryMapFeaturesResponse) => void} [success]
486
     * @param {(err: Error) => void} [failure]
487
     *
488
     *er
489
     */
490
    setSelectionXml(xml: string, queryOpts?: Partial<IQueryMapFeaturesOptions>, success?: (res: QueryMapFeaturesResponse) => void, failure?: (err: Error) => void): void;
491
    /**
492
     * Clears the map selection
493
     *
494
     *
495
     *er
496
     */
497
    clearSelection(): void;
498
    /**
499
     * Performs a map selection by the given geometry
500
     *
501
     * @param {olGeometry} geom The geometry to select with
502
     * @param {SelectionVariant} selectionMethod The selection method
503
     *er
504
     */
505
    selectByGeometry(geom: olGeometry, selectionMethod?: SelectionVariant): void;
506
    /**
507
     * Performs a map selection by the given query options
508
     *
509
     * @param {IQueryMapFeaturesOptions} options
510
     * @param {(res: QueryMapFeaturesResponse) => void} [success]
511
     * @param {(err: Error) => void} [failure]
512
     *
513
     *er
514
     */
515
    queryMapFeatures(options: IQueryMapFeaturesOptions, success?: (res: QueryMapFeaturesResponse) => void, failure?: (err: Error) => void): void;
516
    /**
517
     * Gets the current selection model
518
     *
519
     * @returns {QueryMapFeaturesResponse}
520
     *
521
     *er
522
     */
523
    getSelection(): QueryMapFeaturesResponse | null;
524
    /**
525
     * Gets the current selection model as a selection XML string
526
     *
527
     * @param {FeatureSet} selection
528
     * @param {string[]} [layerIds]
529
     * @returns {string}
530
     *
531
     *er
532
     */
533
    getSelectionXml(selection: FeatureSet, layerIds?: string[]): string;
534
    /**
535
     * Gets the current session id
536
     * 
537
     * @returns {string}
538
     *er
539
     */
540
    getSessionId(): string;
541
    /**
542
     * Gets whether feature tooltips are enabled
543
     *
544
     * @returns {boolean}
545
     *
546
     *er
547
     */
548
    isFeatureTooltipEnabled(): boolean;
549
    /**
550
     * Enables/disables feature tooltips
551
     *
552
     * @param {boolean} enabled
553
     *
554
     *er
555
     */
556
    setFeatureTooltipEnabled(enabled: boolean): void;
557
}
558

559
/**
560
 * Map image export options
561
 *
562
 * @interface IMapImageExportOptions
563
 * @since 0.14
564
 */
565
export interface IMapImageExportOptions {
566
    /**
567
     * The size of the image to export. If not specified, it will use the map's current size
568
     *
569
     * @type {Size2}
570
     *
571
     */
572
    size?: Size2;
573
    /**
574
     * The type to export the mime type as. If not specified, it will default to PNG (image/png)
575
     *
576
     * @type {string}
577
     *
578
     */
579
    exportMimeType?: string;
580
    /**
581
     * The callback that will receive the content of the exported map image
582
     *
583
     *
584
     */
585
    callback: (imageBase64: string) => void;
586
}
587

588
/**
589
 * Options for capturing a map image at specific print dimensions
590
 *
591
 * @interface IMapPrintCaptureOptions
592
 * @since 0.15
593
 */
594
export interface IMapPrintCaptureOptions {
595
    /**
596
     * The paper width in millimeters
597
     */
598
    paperWidthMm: number;
599
    /**
600
     * The paper height in millimeters
601
     */
602
    paperHeightMm: number;
603
    /**
604
     * The DPI to render at
605
     */
606
    dpi: number;
607
    /**
608
     * Optional background color in ARGB hex format (e.g. "FFCCD5E0").
609
     * If provided, the canvas is filled with this color before compositing layer canvases.
610
     *
611
     * @since 0.15
612
     */
613
    backgroundColor?: string;
614
    /**
615
     * Optional extent to fit the map view to before capturing, as [minX, minY, maxX, maxY].
616
     * If provided, the view is centered on this extent at the given scale and rotation,
617
     * then restored after capture.
618
     *
619
     * @since 0.15
620
     */
621
    fitExtent?: [number, number, number, number];
622
    /**
623
     * Optional rotation in degrees to apply before capture. Only used when fitExtent is set.
624
     *
625
     * @since 0.15
626
     */
627
    rotation?: number;
628
    /**
629
     * Optional scale denominator for the capture. Only used when fitExtent is set.
630
     *
631
     * @since 0.15
632
     */
633
    scale?: number;
634
    /**
635
     * The callback that will receive the captured image data URL
636
     */
637
    callback: (imageBase64: string) => void;
638
}
639

640
/**
641
 * Describes the API for interacting with the map viewer
642
 *
643
 * @interface IMapViewer
644
 */
645
export interface IMapViewer {
646
    /**
647
     * Gets MapGuide-specific viewer functionality. If this viewer was not set up with MapGuide support, this is undefined
648
     *
649
     * @returns {(IMapGuideViewerSupport | undefined)}
650
     *er
651
     * @since 0.14
652
     */
653
    mapguideSupport(): IMapGuideViewerSupport | undefined;
654
    /**
655
     * Gets the projection of the map
656
     *
657
     * @returns {ol.ProjectionLike}
658
     *
659
     *er
660
     */
661
    getProjection(): ProjectionLike;
662
    /**
663
     * Gets the view for the given extent
664
     *
665
     * @param {Bounds} extent
666
     * @returns {IMapView}
667
     *
668
     *er
669
     * @since 0.14 If given an extent with zero-width or zero-height, the view will be computed off of an "inflated" version of this extent. If inflation is required, it will be inflated by 30 meters
670
     */
671
    getViewForExtent(extent: Bounds): IMapView;
672
    /**
673
     * Gets the current extent
674
     *
675
     * @returns {Bounds}
676
     *
677
     *er
678
     */
679
    getCurrentExtent(): Bounds;
680
    /**
681
     * Gets the current map view
682
     *
683
     * @returns {IMapView}
684
     *
685
     *er
686
     */
687
    getCurrentView(): IMapView;
688
    /**
689
     * Gets the current physical size of the map
690
     *
691
     * @returns {[number, number]}
692
     *
693
     *er
694
     */
695
    getSize(): [number, number];
696
    /**
697
     * Zooms to the specified map view
698
     *
699
     * @param {number} x
700
     * @param {number} y
701
     * @param {number} scale
702
     *
703
     *er
704
     */
705
    zoomToView(x: number, y: number, scale: number): void;
706
    /**
707
     * Refreshes the map
708
     *
709
     * @param {RefreshMode} [mode]
710
     *
711
     *er
712
     */
713
    refreshMap(mode?: RefreshMode): void;
714
    /**
715
     * Gets the meters per unit value
716
     *
717
     * @returns {number}
718
     *
719
     *er
720
     */
721
    getMetersPerUnit(): number;
722
    /**
723
     * Sets the active tool
724
     *
725
     * @param {ActiveMapTool} tool
726
     *
727
     *er
728
     */
729
    setActiveTool(tool: ActiveMapTool): void;
730
    /**
731
     * Gets the active tool
732
     *
733
     * @returns {ActiveMapTool}
734
     *
735
     *er
736
     */
737
    getActiveTool(): ActiveMapTool;
738
    /**
739
     * Sets the initial map view
740
     *
741
     *
742
     *er
743
     */
744
    initialView(): void;
745
    /**
746
     * Zooms in or out by the specified delta
747
     *
748
     * @param {number} delta
749
     *
750
     *er
751
     */
752
    zoomDelta(delta: number): void;
753
    /**
754
     * Gets whether the viewer is currently in the state of digitizing
755
     *
756
     * @returns {boolean}
757
     *
758
     *er
759
     */
760
    isDigitizing(): boolean;
761
    /**
762
     * Cancels active digitization
763
     *
764
     *er
765
     */
766
    cancelDigitization(): void;
767
    /**
768
     * Starts the digitization process for a point
769
     *
770
     * @param {DigitizerCallback<olPoint>} handler
771
     * @param {string} [prompt]
772
     *
773
     *er
774
     */
775
    digitizePoint(handler: DigitizerCallback<olPoint>, prompt?: string): void;
776
    /**
777
     * Starts the digitization process for a line
778
     *
779
     * @param {DigitizerCallback<olLineString>} handler
780
     * @param {string} [prompt]
781
     *
782
     *er
783
     */
784
    digitizeLine(handler: DigitizerCallback<olLineString>, prompt?: string): void;
785
    /**
786
     * Starts the digitization process for a line string
787
     *
788
     * @param {DigitizerCallback<olLineString>} handler
789
     * @param {string} [prompt]
790
     *
791
     *er
792
     */
793
    digitizeLineString(handler: DigitizerCallback<olLineString>, prompt?: string): void;
794
    /**
795
     * Starts the digitization process for a circle
796
     *
797
     * @param {DigitizerCallback<olCircle>} handler
798
     * @param {string} [prompt]
799
     *
800
     *er
801
     */
802
    digitizeCircle(handler: DigitizerCallback<olCircle>, prompt?: string): void;
803
    /**
804
     * Starts the digitization process for a rectangle
805
     *
806
     * @param {DigitizerCallback<olPolygon>} handler
807
     * @param {string} [prompt]
808
     *
809
     *er
810
     */
811
    digitizeRectangle(handler: DigitizerCallback<olPolygon>, prompt?: string): void;
812
    /**
813
     * Starts the digitization process for a polygon
814
     *
815
     * @param {DigitizerCallback<olPolygon>} handler
816
     * @param {string} [prompt]
817
     *
818
     *er
819
     */
820
    digitizePolygon(handler: DigitizerCallback<olPolygon>, prompt?: string): void;
821
    /**
822
     * Zooms to the specified extent
823
     *
824
     * @param {Bounds} extent
825
     *
826
     *er
827
     */
828
    zoomToExtent(extent: Bounds): void;
829
    /**
830
     * Gets the layer manager for the given map. If map name is not specifed
831
     * it will get the layer manager for the currently active map.
832
     *
833
     * @param {string} [mapName]
834
     * @returns {ILayerManager}
835
     *er
836
     * @since 0.12
837
     */
838
    getLayerManager(mapName?: string): ILayerManager;
839
    /**
840
     * Adds an OpenLayers interaction
841
     *
842
     * @template T
843
     * @param {T} interaction
844
     * @returns {T}
845
     *
846
     *er
847
     */
848
    addInteraction<T extends olInteraction>(interaction: T): T;
849
    /**
850
     * Removes the given OpenLayers interaction
851
     *
852
     * @template T
853
     * @param {T} interaction
854
     *
855
     *er
856
     */
857
    removeInteraction<T extends olInteraction>(interaction: T): void;
858
    /**
859
     * Adds an OpenLayers overlay
860
     *
861
     * @param {olOverlay} overlay
862
     *
863
     *er
864
     */
865
    addOverlay(overlay: olOverlay): void;
866
    /**
867
     * Removes the given OpenLayers overlay
868
     *
869
     * @param {olOverlay} overlay
870
     *
871
     *er
872
     */
873
    removeOverlay(overlay: olOverlay): void;
874
    /**
875
     * Adds an event handler for the specified event
876
     *
877
     * @param {string} eventName
878
     * @param {Function} handler
879
     *
880
     *er
881
     */
882
    addHandler(eventName: string, handler: Function): void;
883
    /**
884
     * Removes an event handler for the specified event
885
     *
886
     * @param {string} eventName
887
     * @param {Function} handler
888
     *
889
     *er
890
     */
891
    removeHandler(eventName: string, handler: Function): void;
892
    /**
893
     * Gets the OL object factory
894
     */
895
    getOLFactory(): IOLFactory;
896
    /**
897
     * Gets the view resolution
898
     *
899
     * @returns {number}
900
     *
901
     *er
902
     */
903
    getResolution(): number | undefined;
904
    /**
905
     * Gets the resolution for the given scale
906
     *
907
     * @returns {number}
908
     *
909
     *er
910
     */
911
    scaleToResolution(scale: number): number;
912
    /**
913
     * Gets the name of the current runtime map
914
     * 
915
     * @returns {string} 
916
     *er
917
     */
918
    getMapName(): string;
919
    /**
920
     * Sets the current view rotation
921
     * 
922
     * @param {number} rotation 
923
     *er
924
     */
925
    setViewRotation(rotation: number): void;
926
    /**
927
     * Gets the current view rotation
928
     * 
929
     * @returns {number} 
930
     *er
931
     */
932
    getViewRotation(): number;
933
    /**
934
     * Gets whether view rotation is enabled
935
     * 
936
     * @returns {boolean} 
937
     *er
938
     */
939
    isViewRotationEnabled(): boolean;
940
    /**
941
     * Sets whether view rotation is enabled or not
942
     * 
943
     * @param {boolean} enabled 
944
     *er
945
     */
946
    setViewRotationEnabled(enabled: boolean): void;
947
    /**
948
     * 
949
     * @since 0.11
950
     * @param {number} x 
951
     * @param {number} y 
952
     * @returns {[number, number]} 
953
     *er
954
     */
955
    screenToMapUnits(x: number, y: number): [number, number];
956

957
    toastSuccess(icon: string, message: string | JSX.Element): string | undefined;
958
    toastWarning(icon: string, message: string | JSX.Element): string | undefined;
959
    toastError(icon: string, message: string | JSX.Element): string | undefined;
960
    toastPrimary(icon: string, message: string | JSX.Element): string | undefined;
961
    dismissToast(key: string): void;
962
    updateSize(): void;
963

964
    /**
965
     * Returns the collection of selected client-side vector features. This collection
966
     * is observable, so you may hold onto a reference to this collection and subscribe
967
     * to events on this collection for when new features are added or removed from this collection
968
     * 
969
     * @returns {Collection<Feature>}
970
     *er
971
     * @since 0.13
972
     * @since 0.14 - The return value may be undefined if called when the map viewer is detached/disposed/destroyed
973
     */
974
    getSelectedFeatures(): Collection<Feature<Geometry>> | undefined;
975

976
    /**
977
     * INTERNAL API. Not for public use
978
     * @hidden
979
     */
980
    addImageLoading(): void;
981
    /**
982
     * INTERNAL API. Not for public use
983
     * @hidden
984
     */
985
    addImageLoaded(): void;
986
    /**
987
     * EXPERIMENTAL:
988
     * Adds the given application state subscribers
989
     * 
990
     * NOTE: Calling this method will trigger a re-render of the component. Due to this quirk, 
991
     * calling this method again while a re-render is taking place may cause the subscriber to
992
     * not actually be registered. Calling this method multiple times in succession is therefore
993
     * not advised. If you need to add multiple subscribers, pass an array of the subscribers to
994
     * register in a single method call.
995
     * 
996
     * @param props 
997
     * @since 0.13
998
     */
999
    addSubscribers(props: ISubscriberProps[]): string[];
1000
    /**
1001
     * EXPERIMENTAL:
1002
     * Removes application state subscribers of the given names
1003
     * 
1004
     * @param names
1005
     * @since 0.13
1006
     */
1007
    removeSubscribers(names: string[]): boolean;
1008
    /**
1009
     * EXPERIMENTAL:
1010
     * Gets all application state subscriber names
1011
     * 
1012
     * @since 0.13
1013
     */
1014
    getSubscribers(): string[];
1015
    /**
1016
     * Dispatches the given action
1017
     * 
1018
     * @remarks Usage outside of the react component context (eg. Plain HTML Task Pane content) should be used sparingly. In particular
1019
     * you should avoid trying to call this method multiple times in succession. You should call this method once in response to a DOM element
1020
     * event (eg. A button click)
1021
     * @alpha
1022
     * @since 0.13
1023
     */
1024
    dispatch(action: any): void;
1025

1026
    /**
1027
     * Gets the default point circle style
1028
     * @since 0.13
1029
     */
1030
    getDefaultPointCircleStyle(): IBasicPointCircleStyle;
1031

1032
    /**
1033
     * Gets the default point icon style
1034
     * @since 0.13
1035
     */
1036
    getDefaultPointIconStyle(): IPointIconStyle;
1037

1038
    /**
1039
     * Gets the default line style
1040
     * @since 0.13
1041
     */
1042
    getDefaultLineStyle(): IBasicVectorLineStyle;
1043

1044
    /**
1045
     * Gets the default polygon style
1046
     * @since 0.13
1047
     */
1048
    getDefaultPolygonStyle(): IBasicVectorPolygonStyle;
1049

1050
    /**
1051
     * Exports an image of the current map view
1052
     *
1053
     * @param {IMapImageExportOptions} options
1054
     *er
1055
     * @since 0.14
1056
     */
1057
    exportImage(options: IMapImageExportOptions): void;
1058
    /**
1059
     * Captures the map at the specified print dimensions and DPI by temporarily resizing
1060
     * the map and adjusting the view resolution. After capture, the original map size and
1061
     * resolution are restored.
1062
     *
1063
     * @param {IMapPrintCaptureOptions} options
1064
     *er
1065
     * @since 0.15
1066
     */
1067
    captureMapPrintImage(options: IMapPrintCaptureOptions): void;
1068
}
1069

1070
/**
1071
 * WMS layer extension data
1072
 * 
1073
 * @since 0.13
1074
 */
1075
export interface IWmsLayerExtensions {
1076
    type: "WMS";
1077
    getLegendUrl?: (resolution?: number) => string;
1078
}
1079

1080
/**
1081
 * Layer extension data
1082
 * 
1083
 * @since 0.13
1084
 */
1085
export type LayerExtensions = IWmsLayerExtensions;
1086

1087
export interface ILayerInfo {
1088
    /**
1089
     * The name of the layer
1090
     * 
1091
     * @type {string}
1092
     *
1093
    * */
1094
    name: string;
1095
    /**
1096
     * The display name of this layer
1097
     *
1098
     * @type {string}
1099
     *
1100
     * @since 0.14
1101
     */
1102
    displayName: string;
1103
    /**
1104
     * The type of layer
1105
     * 
1106
     * @type {string}
1107
     *
1108
     */
1109
    type: string;
1110
    /**
1111
     * An optional description for the layer
1112
     *
1113
     * @type {string}
1114
     *
1115
     * @since 0.14
1116
     */
1117
    description?: string;
1118
    /**
1119
     * Indicates if this layer is an external layer
1120
     * 
1121
     * @since 0.13
1122
     */
1123
    isExternal: boolean;
1124
    /** 
1125
     * Indicates if this layer is visible
1126
     * 
1127
     * @since 0.13
1128
     */
1129
    visible: boolean;
1130
    /**
1131
     * Indicates if this layer is selectable by the select tool
1132
     * 
1133
     * @since 0.13
1134
     */
1135
    selectable: boolean;
1136
    /**
1137
     * The opacity of this layer
1138
     * 
1139
     * @since 0.13
1140
     * @type {number}
1141
     *
1142
     */
1143
    opacity: number;
1144
    /**
1145
     * Extension data for this layer
1146
     * 
1147
     * @since 0.13
1148
     */
1149
    extensions?: LayerExtensions;
1150
    /**
1151
     * The vector style for this layer. Not applicable for raster layers.
1152
     * 
1153
     * @since 0.13
1154
     * @since 0.14 Changed to IVectorLayerStyle
1155
     */
1156
    vectorStyle?: IVectorLayerStyle;
1157
    /**
1158
     * Cluster style settings
1159
     * @since 0.14
1160
     */
1161
    cluster?: IClusterSettings;
1162
    /**
1163
     * Heatmap settings
1164
     * @since 0.14
1165
     */
1166
    heatmap?: IHeatmapSettings;
1167
    /**
1168
     * The busy worker count of this layer. If greater than 0, the layer
1169
     * is considered to be in the process of loading
1170
     * 
1171
     * @since 0.13
1172
     */
1173
    busyWorkerCount: number;
1174
    /**
1175
     * Metadata attached to the layer
1176
     * 
1177
     * @since 0.14
1178
     *
1179
     */
1180
    metadata?: any;
1181
}
1182

1183
/**
1184
 * Point layer clustering options
1185
 * 
1186
 * @since 0.14
1187
 */
1188
export interface AddVectorLayerClusteringOptions {
1189
    kind: "Cluster";
1190
    /**
1191
     * The distance to use for clustering. Setting this value will create a clustered layer.
1192
     * 
1193
     *  * If {@link clusterDistance} is set, but {@link clusterStyle} is not set, the {@link IAddLayerFromParsedFeaturesOptions.defaultStyle} will be used if set, otherwise the default vector style will be used
1194
     */
1195
    clusterDistance: number;
1196
    /**
1197
     * The style to use for this clustered layer. 
1198
     * 
1199
     *  * If {@link clusterDistance} is not set, this has no effect
1200
     *  * If {@link clusterDistance} is set but this is not set, the {@link IAddLayerFromParsedFeaturesOptions.defaultStyle} will be used if set, otherwise the default vector style will be used
1201
     */
1202
    clusterStyle?: IVectorLayerStyle;
1203
    /**
1204
     * The action to perform when the cluster is clicked
1205
     */
1206
    onClusterClickAction?: ClusterClickAction;
1207
}
1208

1209
/**
1210
 * Theming options
1211
 * @since 0.14
1212
 */
1213
export interface AddVectorLayerThemeOptions {
1214
    kind: "Theme";
1215
    /**
1216
     * Generate a thematic ramp based on the given property
1217
     */
1218
    themeOnProperty: string;
1219
    /**
1220
     * The colorbrewer theme to apply
1221
     */
1222
    colorBrewerTheme: string;
1223
}
1224

1225
/**
1226
 * Heatmap options
1227
 * @since 0.14
1228
 */
1229
export interface AddVectorLayerHeatmapOptions {
1230
    kind: "Heatmap",
1231
    /**
1232
     * The weight property
1233
     */
1234
    weightProperty?: string;
1235
}
1236

1237
export type AddVectorLayerExtraOptions = AddVectorLayerClusteringOptions | AddVectorLayerThemeOptions | AddVectorLayerHeatmapOptions;
1238

1239
/**
1240
 * Options to add a new layer from parsed features
1241
 *
1242
 * @interface IAddLayerFromParsedFeaturesOptions
1243
 * @since 0.13
1244
 */
1245
export interface IAddLayerFromParsedFeaturesOptions {
1246
    /**
1247
     * The projection to assign for this layer. If not specified, the map's projection
1248
     * is assumed
1249
     */
1250
    projection?: ProjectionLike;
1251
    /**
1252
     * The parsed features to add the layer with
1253
     */
1254
    features: IParsedFeatures;
1255
    /**
1256
     * The style to use for this layer. If not specified, a default style will be assigned
1257
     * to this layer
1258
     * 
1259
     * @since 0.13
1260
     * @since 0.14 changed to IVectorLayerStyle
1261
     */
1262
    defaultStyle?: IVectorLayerStyle;
1263
    /**
1264
     * Extra options for the layer to be added
1265
     * @since 0.14
1266
     */
1267
    extraOptions?: AddVectorLayerExtraOptions;
1268
    /**
1269
     * The property to use for labeling
1270
     * @since 0.14
1271
     */
1272
    labelOnProperty?: string;
1273
    /**
1274
     * The popup template to use when features are selected on this layer
1275
     * @since 0.14
1276
     */
1277
    selectedPopupTemplate?: ISelectedFeaturePopupTemplateConfiguration;
1278
    /**
1279
     * Metadata for this layer
1280
     * @since 0.14
1281
     */
1282
    metadata?: any;
1283
    /**
1284
     * A definition to attach to this layer. This definition is application-defined and is primarily to
1285
     * assist the application in implementing persistence/restoration of this layer on an application-defined
1286
     * basis 
1287
     * @since 0.14.3
1288
     */
1289
    defn?: any;
1290
}
1291

1292
/**
1293
 * Options for parsing features from a file
1294
 *
1295
 * @interface IParseFeaturesFromFileOptions
1296
 * @since 0.13
1297
 */
1298
export interface IParseFeaturesFromFileOptions {
1299
    file: File;
1300
    name: string;
1301
    locale: string;
1302
}
1303

1304
/**
1305
 * Manages custom layers for a map
1306
 *
1307
 * @interface ILayerManager
1308
 */
1309
export interface ILayerManager {
1310
    /**
1311
     * Get the active subject layer if present on the current map. In a MapGuide-specific context, subject layers do not exist
1312
     * and this method will always return undefined in such cases
1313
     *
1314
     * @returns {olLayerBase}
1315
     *
1316
     * @since 0.14
1317
     */
1318
    tryGetSubjectLayer(): olLayerBase | undefined;
1319
    /**
1320
     * Gets all custom layers on this map, sorted by draw order (First item is top-most layer. Last item is bottom-most layer.)
1321
     * 
1322
     * @returns {ILayerInfo[]} 
1323
     *
1324
    * */
1325
    getLayers(): ILayerInfo[];
1326
    /**
1327
     * Gets whether the specified custom layer exists on the map
1328
     */
1329
    hasLayer(name: string): boolean;
1330
    /**
1331
     * Adds a layer to the map
1332
     * 
1333
     * @template T 
1334
     * @param {string} name The name of the layer
1335
     * @param {T} layer The layer object
1336
     * @param {boolean} [allowReplace] If false or not set, this method will throw an error if a layer of the specified name already exists. Otherwise that layer will be replaced with the given layer
1337
     * @returns {T} The added layer
1338
     *
1339
     */
1340
    addLayer<T extends olLayerBase>(name: string, layer: T, allowReplace?: boolean): ILayerInfo;
1341
    /**
1342
     * Removes a layer by the given name
1343
     *
1344
     * @param {string} name
1345
     * @returns {(olLayerBase | undefined)}
1346
     *
1347
     *er
1348
     */
1349
    removeLayer(name: string): olLayerBase | undefined;
1350
    /**
1351
     * Gets a layer by the given name
1352
     *
1353
     * @template T
1354
     * @param {string} name
1355
     * @returns {T}
1356
     *
1357
     *er
1358
     */
1359
    getLayer<T extends olLayerBase>(name: string): T | undefined;
1360

1361
    /**
1362
     * Attempts to parse features for the given input file. A failed attempt is when
1363
     * calling hasFeatures() on the returned parsed features returns false.
1364
     * 
1365
     * @param {IParseFeaturesFromFileOptions} options
1366
     * @returns {Promise<IParsedFeatures>}
1367
     *
1368
     * @since 0.13
1369
     */
1370
    parseFeaturesFromFile(options: IParseFeaturesFromFileOptions): Promise<IParsedFeatures>;
1371

1372
    /**
1373
     * Adds the given parsed features as a new external layer
1374
     * 
1375
     * @param {IAddLayerFromParsedFeaturesOptions} options
1376
     * @returns {Promise<ILayerInfo>}
1377
     *
1378
     * @since 0.13
1379
     * @since 0.14 Styles for geometry types not found in the parsed features will be deleted
1380
     */
1381
    addLayerFromParsedFeatures(options: IAddLayerFromParsedFeaturesOptions): Promise<ILayerInfo>;
1382

1383
    /**
1384
     * Applies draw order/opacity/visibility
1385
     * @hidden
1386
     */
1387
    apply(layers: ILayerInfo[]): void;
1388
}
1389

1390
/**
1391
 * Function signature for a digitization callback
1392
 */
1393
export type DigitizerCallback<T extends olGeometry> = (geom: T) => void;
1394

1395
/**
1396
 * Valid image formats
1397
 */
1398
export type ImageFormat = "PNG" | "PNG8" | "JPG" | "GIF";
1399

1400
/**
1401
 * The type of client
1402
 */
1403
export type ClientKind = "mapagent" | "mapguide-rest";
1404

1405
export interface IModalParameters {
1406
    title: string;
1407
    backdrop: boolean;
1408
    /**
1409
     * @since 0.14.8 Now optional
1410
     */
1411
    size?: [number, number];
1412
    overflowYScroll?: boolean;
1413
    /**
1414
     * @since 0.14.8
1415
     */
1416
    position?: [number, number];
1417
}
1418

1419
/**
1420
 * The default modal dialog size
1421
 */
1422
export const DEFAULT_MODAL_SIZE: [number, number] = [350, 500];
49✔
1423

1424
/**
1425
 * The default modal dialog position
1426
 * @since 0.14.8
1427
 */
1428
export const DEFAULT_MODAL_POSITION: [number, number] = [500, 80];
49✔
1429

1430
/**
1431
 * Base modal display options
1432
 *
1433
 * @interface IModalDisplayOptionsBase
1434
 */
1435
export interface IModalDisplayOptionsBase {
1436
    modal: IModalParameters;
1437
    name: string;
1438
}
1439

1440
/**
1441
 * Modal display options for URL content
1442
 *
1443
 * @interface IModalDisplayOptions
1444
 * @extends {IModalDisplayOptionsBase}
1445
 */
1446
export interface IModalDisplayOptions extends IModalDisplayOptionsBase {
1447
    /**
1448
     * The URL of the content to load in the modal dialog
1449
     *
1450
     * @type {string}
1451
     */
1452
    url: string;
1453
}
1454

1455
export interface IModalComponentDisplayOptions extends IModalDisplayOptionsBase {
1456
    /**
1457
     * The id of the component to display
1458
     *
1459
     * @type {string}
1460
     *
1461
     */
1462
    component: string;
1463
    /**
1464
     * Component properties
1465
     *
1466
     * @type {*}
1467
     *
1468
     */
1469
    componentProps?: any;
1470
}
1471

1472
export interface IToolbarReducerState {
1473
    toolbars: any;
1474
    flyouts: any;
1475
}
1476

1477
/**
1478
 * Describes the reducer state branch for Task Pane component
1479
 *
1480
 *
1481
 * @interface ITaskPaneReducerState
1482
 */
1483
export interface ITaskPaneReducerState {
1484
    /**
1485
     * The current navigation index
1486
     *
1487
     * @type {number}
1488
     *
1489
     */
1490
    navIndex: number;
1491
    /**
1492
     * The current navigation history stack
1493
     *
1494
     * @type {string[]}
1495
     *
1496
     */
1497
    navigation: string[];
1498
    /**
1499
     * The initial URL
1500
     *
1501
     * @type {(string | undefined)}
1502
     *
1503
     */
1504
    initialUrl: string | undefined;
1505
    /**
1506
     * The last pushed URL
1507
     *
1508
     * @type {boolean}
1509
     *
1510
     */
1511
    lastUrlPushed: boolean;
1512
}
1513

1514
export type IModalReducerState = {
1515
    /**
1516
     * Gets the modal parameters for the given key
1517
     * 
1518
     * @since 0.14.8 all modal sub-properties now optional
1519
     */
1520
    [key: string]: Omit<IModalDisplayOptions | IModalComponentDisplayOptions, "modal"> & {
1521
        modal: Partial<IModalParameters>;
1522
    }
1523
};
1524

1525
/*
1526
export interface IModalReducerState {
1527

1528
}
1529
*/
1530

1531
/**
1532
 * A set of layer transpareny values by layer name
1533
 */
1534
export type LayerTransparencySet = { [layerName: string]: number };
1535

1536
/**
1537
 * Selection key of an active selected feature
1538
 */
1539
export interface ActiveSelectedFeature {
1540
    /**
1541
     * The selected layer id
1542
     * 
1543
     * @type {string}
1544
     */
1545
    layerId: string;
1546
    /**
1547
     * The selection key of the feature
1548
     * 
1549
     * @type {string}
1550
     */
1551
    selectionKey: string;
1552
}
1553

1554
/**
1555
 * Generic layer sub-state
1556
 *
1557
 *
1558
 * @interface IGenericLayerSubState
1559
 * @since 0.14
1560
 */
1561
export interface IGenericLayerSubState {
1562
    /**
1563
     * The subject layer
1564
     *
1565
     * @type {IGenericSubjectMapLayer}
1566
     */
1567
    subject: IGenericSubjectMapLayer;
1568
}
1569

1570
/**
1571
 * MapGuide-specific map sub-state
1572
 *
1573
 *
1574
 * @interface IMapGuideSubState
1575
 * @since 0.14
1576
 */
1577
export interface IMapGuideSubState {
1578
    /**
1579
     * The runtime map state
1580
     *
1581
     * @type {(RuntimeMap | undefined)}
1582
     *
1583
     */
1584
    runtimeMap: RuntimeMap | undefined;
1585
    /**
1586
     * Indicates if this map is based on an arbitrary coordinate system
1587
     * @since 0.14.3
1588
     */
1589
    isArbitraryCs: boolean;
1590
    /**
1591
     * A set of selectable layer ids
1592
     *
1593
     * @type {*}
1594
     *
1595
     */
1596
    selectableLayers: any;
1597
    /**
1598
     * A set of expanded group ids
1599
     *
1600
     * @type {*}
1601
     *
1602
     */
1603
    expandedGroups: any;
1604
    /**
1605
     * The current MapGuide selection state
1606
     *
1607
     * @type {(QueryMapFeaturesResponse | undefined)}
1608
     *
1609
     */
1610
    selectionSet: QueryMapFeaturesResponse | undefined;
1611
    /**
1612
     * The array of ids of layers to show
1613
     *
1614
     * @type {string[]}
1615
     *
1616
     */
1617
    showLayers: string[];
1618
    /**
1619
     * The array of ids of groups to show
1620
     *
1621
     * @type {string[]}
1622
     *
1623
     */
1624
    showGroups: string[];
1625
    /**
1626
     * The array of ids of layers to hide
1627
     *
1628
     * @type {string[]}
1629
     *
1630
     */
1631
    hideLayers: string[];
1632
    /**
1633
     * The array of ids of groups to hide
1634
     *
1635
     * @type {string[]}
1636
     *
1637
     */
1638
    hideGroups: string[];
1639
    /**
1640
     * Layer transparency settings
1641
     * 
1642
     * @type {{ [layerName: string]: number }}
1643
     *
1644
     */
1645
    layerTransparency: LayerTransparencySet;
1646
    /**
1647
     * The active selected feature to highlight
1648
     * 
1649
     * @type {(ActiveSelectedFeature | undefined)}
1650
     *
1651
     */
1652
    activeSelectedFeature: ActiveSelectedFeature | undefined;
1653
}
1654

1655
/**
1656
 * Describes the reducer state branch for a particular map group
1657
 *
1658
 *
1659
 * @interface IBranchedMapSubState
1660
 */
1661
export interface IBranchedMapSubState {
1662
    /**
1663
     * The external base layers for the map group
1664
     *
1665
     * @type {IExternalBaseLayer[]}
1666
     *
1667
     */
1668
    externalBaseLayers: IExternalBaseLayer[];
1669
    /**
1670
     * Initial external layers. This does not reflect the current state of external layers added. This merely instructs what external layers
1671
     * to pre-load on viewer startup.
1672
     *
1673
     * @type {IInitialExternalLayer[]}
1674
     *
1675
     * @since 0.14
1676
     */
1677
    initialExternalLayers: IInitialExternalLayer[];
1678
    /**
1679
     * The layers in this viewer. First item is top-most layer. Last item is bottom-most layer.
1680
     * @since 0.13
1681
     */
1682
    layers: ILayerInfo[] | undefined;
1683
    /**
1684
     * The current map view
1685
     *
1686
     * @type {(IMapView | undefined)}
1687
     *
1688
     */
1689
    currentView: IMapView | undefined;
1690
    /**
1691
     * The initial map view
1692
     *
1693
     * @type {(IMapView | undefined)}
1694
     *
1695
     */
1696
    initialView: IMapView | undefined;
1697
    /**
1698
     * The view navigation history stack
1699
     *
1700
     * @type {IMapView[]}
1701
     *
1702
     */
1703
    history: IMapView[];
1704
    /**
1705
     * The current position in the view navigation history stack
1706
     *
1707
     * @type {number}
1708
     *
1709
     */
1710
    historyIndex: number;
1711
    /**
1712
     * MapGuide-specific sub-state
1713
     *
1714
     * @type {IMapGuideSubState}
1715
     *
1716
     * @since 0.14
1717
     */
1718
    mapguide: IMapGuideSubState | undefined;
1719
    /**
1720
     * The current client-side selection state
1721
     * 
1722
     * @since 0.14
1723
     */
1724
    clientSelection: ClientSelectionSet | undefined;
1725
    /**
1726
     * Generic layer sub-state
1727
     *
1728
     * @type {(IGenericLayerSubState | undefined)}
1729
     *
1730
     * @since 0.14
1731
     */
1732
    generic: IGenericLayerSubState | undefined;
1733
    /**
1734
     * Optional coordinate display format override for this map.
1735
     *
1736
     * @since 0.15
1737
     */
1738
    coordinateFormat?: string;
1739
}
1740

1741
/**
1742
 * The reducer state branch for runtime map state. Map-specific state is keyed on
1743
 * their respective runtime map name as sub-branches on this branch
1744
 *
1745
 *
1746
 * @interface IBranchedMapState
1747
 */
1748
export interface IBranchedMapState {
1749
    [mapName: string]: IBranchedMapSubState;
1750
}
1751

1752
/**
1753
 * Coordinate display configuration
1754
 *
1755
 *
1756
 * @interface ICoordinateConfiguration
1757
 */
1758
export interface ICoordinateConfiguration {
1759
    /**
1760
     * The number of decimal places to show
1761
     *
1762
     * @type {number}
1763
     *
1764
     */
1765
    decimals: number;
1766
    /**
1767
     * The display projection for these coordinates
1768
     * 
1769
     * @type {string}
1770
     *
1771
     */
1772
    projection: string;
1773
    /**
1774
     * Display format string
1775
     * 
1776
     * @type {string}
1777
     *
1778
     */
1779
    format?: string;
1780
}
1781

1782
/**
1783
 * Describes the capabilities of the current view
1784
 *
1785
 *
1786
 * @interface IViewerCapabilities
1787
 */
1788
export interface IViewerCapabilities {
1789
    /**
1790
     * Indicates if this viewer as a Task Pane component mounted
1791
     *
1792
     * @type {boolean}
1793
     *
1794
     */
1795
    hasTaskPane: boolean;
1796
    /**
1797
     * Indicates if the Task Pane on this viewer has a Task Bar
1798
     *
1799
     * @type {boolean}
1800
     *
1801
     */
1802
    hasTaskBar: boolean;
1803
    /**
1804
     * Indicates if this viewer has a status bar
1805
     *
1806
     * @type {boolean}
1807
     *
1808
     */
1809
    hasStatusBar: boolean;
1810
    /**
1811
     * Indicates if this viewer has a zoom slider
1812
     *
1813
     * @type {boolean}
1814
     *
1815
     */
1816
    hasNavigator: boolean;
1817
    /**
1818
     * Indicates if this viewer has a selection panel component mounted
1819
     *
1820
     * @type {boolean}
1821
     *
1822
     */
1823
    hasSelectionPanel: boolean;
1824
    /**
1825
     * Indicates if this viewer has a legend component mounted
1826
     *
1827
     * @type {boolean}
1828
     *
1829
     */
1830
    hasLegend: boolean;
1831
    /**
1832
     * Indicates if this viewer has a primary toolbar mounted
1833
     *
1834
     * @type {boolean}
1835
     *
1836
     */
1837
    hasToolbar: boolean;
1838
    /**
1839
     * Indicates if this viewer has the view size mounted
1840
     * 
1841
     * @type {boolean}
1842
     *
1843
     */
1844
    hasViewSize: boolean;
1845
}
1846

1847
/**
1848
 * Describes a name/value pair
1849
 *
1850
 *
1851
 * @interface INameValuePair
1852
 */
1853
export interface INameValuePair {
1854
    /**
1855
     * The name
1856
     *
1857
     * @type {string}
1858
     *
1859
     */
1860
    name: string;
1861
    /**
1862
     * The value
1863
     *
1864
     * @type {string}
1865
     *
1866
     */
1867
    value: string;
1868
}
1869

1870
/**
1871
 * Describes a redux reducer function
1872
 */
1873
export type ReducerFunction<TState> = (state: TState, action: ViewerAction) => TState;
1874

1875
/**
1876
 * Describes the reducer state branch for the current viewer template
1877
 *
1878
 *
1879
 * @interface ITemplateReducerState
1880
 */
1881
export interface ITemplateReducerState {
1882
    /**
1883
     * The initial width of the information pane. Only certain templates will recognise this setting
1884
     * 
1885
     * @type {number}
1886
     *
1887
     */
1888
    initialInfoPaneWidth: number;
1889
    /**
1890
     * The initial width of the task pane. Only certain templates will recognise this setting
1891
     * 
1892
     * @type {number}
1893
     *
1894
     */
1895
    initialTaskPaneWidth: number;
1896
    /**
1897
     * Indicates if the task pane is visible
1898
     *
1899
     * @type {boolean}
1900
     *
1901
     */
1902
    taskPaneVisible: boolean;
1903
    /**
1904
     * Indicates if the legend is visible
1905
     *
1906
     * @type {boolean}
1907
     *
1908
     */
1909
    legendVisible: boolean;
1910
    /**
1911
     * Indicates if the selection panel is visible
1912
     *
1913
     * @type {boolean}
1914
     *
1915
     */
1916
    selectionPanelVisible: boolean;
1917
    /**
1918
     * If true, the selection panel will auto-display when a selection is made
1919
     * and there are results to show
1920
     * 
1921
     * @since 0.13
1922
     */
1923
    autoDisplaySelectionPanelOnSelection: boolean;
1924

1925
    /**
1926
     * Template-specific data
1927
     * @since 0.14.8
1928
     */
1929
    templateData: Dictionary<any>;
1930
}
1931

1932
/**
1933
 * Signature for a template state reducer function
1934
 * 
1935
 * @since 0.13
1936
 */
1937
export type TemplateReducerFunction = (origState: ITemplateReducerState, currentState: ITemplateReducerState, action: ViewerAction) => ITemplateReducerState;
1938

1939
/**
1940
 * Keyboard code for ESCAPE
1941
 */
1942
export const KC_ESCAPE = 27;
49✔
1943

1944
/**
1945
 * Keyboard code for the letter U
1946
 */
1947
export const KC_U = 85;
49✔
1948

1949
/**
1950
 * The positioning of the map load indicator
1951
 */
1952
export type MapLoadIndicatorPositioning = "top" | "bottom";
1953

1954
/**
1955
 * Supported comparison renderers for a configured comparison pair.
1956
 *
1957
 * @since 0.15
1958
 */
1959
export type ComparisonMode = "none" | "swipe" | "spy";
1960

1961
/**
1962
 * Describes a primary/secondary map pair that can be rendered using one of the
1963
 * supported comparison modes.
1964
 *
1965
 * @interface IComparisonPair
1966
 * @since 0.15
1967
 */
1968
export interface IComparisonPair {
1969
    /**
1970
     * The name of the primary map in the swipe pair. This is the map shown
1971
     * in non-swipe mode.
1972
     *
1973
     * @type {string}
1974
     */
1975
    primaryMapName: string;
1976
    /**
1977
     * The name of the secondary map in the swipe pair.
1978
     *
1979
     * @type {string}
1980
     */
1981
    secondaryMapName: string;
1982
    /**
1983
     * Optional display label for the primary side of the comparison pair. Defaults
1984
     * to the "MAP_SWIPE_PRIMARY_LABEL" i18n string ("Primary") when not set.
1985
     *
1986
     * @type {string | undefined}
1987
     * @since 0.15
1988
     */
1989
    primaryLabel?: string;
1990
    /**
1991
     * Optional display label for the secondary side of the comparison pair. Defaults
1992
     * to the "MAP_SWIPE_SECONDARY_LABEL" i18n string ("Secondary") when not set.
1993
     *
1994
     * @type {string | undefined}
1995
     * @since 0.15
1996
     */
1997
    secondaryLabel?: string;
1998
}
1999

2000
export type IMapSwipePair = IComparisonPair;
2001

2002
/**
2003
 * Describes the reducer state branch for various configuration properties
2004
 *
2005
 *
2006
 * @interface IConfigurationReducerState
2007
 */
2008
export interface IConfigurationReducerState {
2009
    /**
2010
     * The agent URI
2011
     *
2012
     * @type {(string | undefined)}
2013
     *
2014
     */
2015
    agentUri: string | undefined;
2016
    /**
2017
     * The type of agent
2018
     *
2019
     * @type {ClientKind}
2020
     *
2021
     */
2022
    agentKind: ClientKind;
2023
    /**
2024
     * The current locale
2025
     *
2026
     * @type {string}
2027
     *
2028
     */
2029
    locale: string;
2030
    /**
2031
     * The current active map name
2032
     *
2033
     * @type {(string | undefined)}
2034
     *
2035
     */
2036
    activeMapName: string | undefined;
2037
    /**
2038
     * The array of available runtime maps
2039
     *
2040
     * @type {(INameValuePair[] | undefined)}
2041
     *
2042
     */
2043
    availableMaps: INameValuePair[] | undefined;
2044
    /**
2045
     * Coordinate display configuration
2046
     *
2047
     * @type {ICoordinateConfiguration}
2048
     *
2049
     */
2050
    coordinates: ICoordinateConfiguration;
2051
    /**
2052
     * Viewer capabilities
2053
     *
2054
     * @type {IViewerCapabilities}
2055
     *
2056
     */
2057
    capabilities: IViewerCapabilities;
2058
    /**
2059
     * A dictionary of arbitrary app settings
2060
     * 
2061
     * @since 0.14
2062
     */
2063
    appSettings?: Dictionary<string>;
2064
    /**
2065
     * Maps that have been deferred for lazy creation. When a user first switches to one of these maps,
2066
     * the runtime map will be created on demand.
2067
     *
2068
     * @type {(Dictionary<{mapDef: string, metadata: any}> | undefined)}
2069
     * @since 0.15
2070
     */
2071
    pendingMaps?: Dictionary<{mapDef: string, metadata: any}>;
2072
    /**
2073
     * Indicates whether initialization reused an existing MapGuide session.
2074
     *
2075
     * @since 0.15
2076
     */
2077
    sessionWasReused?: boolean;
2078
    /**
2079
     * Viewer configuration
2080
     * 
2081
     *
2082
     */
2083
    viewer: {
2084
        /**
2085
         * Whether this viewer will use stateless MapGuide rendering operations
2086
         * 
2087
         * @since 0.14
2088
         */
2089
        isStateless: boolean;
2090
        /**
2091
         * The current image format
2092
         *
2093
         * @type {ImageFormat}
2094
         */
2095
        imageFormat: ImageFormat;
2096
        /**
2097
         * The current selection image format
2098
         *
2099
         * @type {ImageFormat}
2100
         */
2101
        selectionImageFormat: ImageFormat;
2102
        /**
2103
         * The current selection color
2104
         *
2105
         * @type {string}
2106
         */
2107
        selectionColor: string;
2108
        /**
2109
         * The color to use for highlighting active selected features
2110
         * 
2111
         * @type {string}
2112
         */
2113
        activeSelectedFeatureColor: string;
2114
        /**
2115
         * The current point selection pixel tolerance
2116
         *
2117
         * @type {number}
2118
         */
2119
        pointSelectionBuffer: number;
2120
        /**
2121
         * The position of the map loading indicator
2122
         * 
2123
         * @type {MapLoadIndicatorPositioning}
2124
         */
2125
        loadIndicatorPositioning: MapLoadIndicatorPositioning;
2126
        /**
2127
         * The color of the map loading indicator. This is an valid CSS color expression
2128
         * 
2129
         * @type {string}
2130
         */
2131
        loadIndicatorColor: string;
2132
    },
2133
    /**
2134
     * Indicates if view rotation is enabled
2135
     * 
2136
     * @type {boolean}
2137
     *
2138
     */
2139
    viewRotationEnabled: boolean;
2140
    /**
2141
     * The current view rotation
2142
     * 
2143
     * @type {number}
2144
     *
2145
     */
2146
    viewRotation: number;
2147
    /**
2148
     * The unit to display view size in
2149
     * 
2150
     * @type {UnitOfMeasure}
2151
     *
2152
     */
2153
    viewSizeUnits: UnitOfMeasure;
2154
    /**
2155
     * @since 0.14.2
2156
     */
2157
    selectCanDragPan: boolean;
2158
    /**
2159
     * If specified and true and the MapTip component is active, then feature tooltips are activated
2160
     * by mouse click instead of idle mouse cursor at a given point on the map for a certain period of time. 
2161
     * 
2162
     * An active MapTip component with this setting enabled will override normal click-based selection.
2163
     * 
2164
     * @type {boolean}
2165
     *
2166
     */
2167
    manualFeatureTooltips: boolean;
2168
    /**
2169
     * The key code to listen for cancelling an active digitization
2170
     * 
2171
     * @type {number}
2172
     *
2173
     */
2174
    cancelDigitizationKey: number;
2175
    /**
2176
     * The key code to listen for undoing the last drawn point of an active digitization
2177
     * 
2178
     * @type {number}
2179
     *
2180
     */
2181
    undoLastPointKey: number;
2182
    /**
2183
     * The comparison pairs declared in the application definition.
2184
     *
2185
     * @type {IComparisonPair[]}
2186
     * @since 0.15
2187
     */
2188
    comparisonPairs?: IComparisonPair[];
2189
    /**
2190
     * Compatibility alias for comparisonPairs.
2191
     *
2192
     * @since 0.15
2193
     */
2194
    mapSwipePairs?: IComparisonPair[];
2195
    /**
2196
     * The currently active comparison mode.
2197
     *
2198
     * @type {ComparisonMode}
2199
     * @since 0.15
2200
     */
2201
    comparisonMode?: ComparisonMode;
2202
    /**
2203
     * Compatibility alias for whether swipe comparison is active.
2204
     *
2205
     * @since 0.15
2206
     */
2207
    swipeActive?: boolean;
2208
    /**
2209
     * The last non-off comparison mode used in this session.
2210
     *
2211
     * @type {ComparisonMode | undefined}
2212
     * @since 0.15
2213
     */
2214
    lastComparisonMode?: Exclude<ComparisonMode, "none">;
2215
    /**
2216
     * The current swipe position as a percentage (0-100). 
2217
     * 50 means the slider is in the center.
2218
     *
2219
     * @type {number}
2220
     * @since 0.15
2221
     */
2222
    swipePosition?: number;
2223
    /**
2224
     * The current spy cursor radius in CSS pixels.
2225
     *
2226
     * @type {number}
2227
     * @since 0.15
2228
     */
2229
    spyCursorRadius?: number;
2230
}
2231

2232
/**
2233
 * Describes an error thrown during initialization
2234
 *
2235
 *
2236
 * @interface InitError
2237
 */
2238
export interface InitError {
2239
    /**
2240
     * The error message
2241
     *
2242
     * @type {string}
2243
     *
2244
     */
2245
    message: string;
2246
    /**
2247
     * The error stack trace
2248
     *
2249
     * @type {string[]}
2250
     *
2251
     */
2252
    stack: string[];
2253
}
2254

2255
/**
2256
 * Describes the reducer state branch for initialization errors
2257
 *
2258
 *
2259
 * @interface IInitErrorReducerState
2260
 */
2261
export interface IInitErrorReducerState {
2262
    /**
2263
     * The caught initialization error
2264
     *
2265
     * @type {(InitError | undefined)}
2266
     *
2267
     */
2268
    error: InitError | undefined;
2269
    /**
2270
     * The initialization options
2271
     *
2272
     * @type {*}
2273
     *
2274
     */
2275
    options: any;
2276
    /**
2277
     * Indicates if the stack trace should be shown
2278
     *
2279
     * @type {boolean}
2280
     *
2281
     */
2282
    includeStack: boolean;
2283
    /**
2284
     * Any warnings that were encountered during initialization
2285
     * 
2286
     * @type {string[]}
2287
     *
2288
     */
2289
    warnings: string[];
2290
}
2291

2292
/**
2293
 * Describes the reducer state branch for viewer state
2294
 *
2295
 *
2296
 * @interface IViewerReducerState
2297
 */
2298
export interface IViewerReducerState {
2299
    /**
2300
     * The current size of the map viewport (in pixels)
2301
     * 
2302
     * @type {([number, number] | undefined)}
2303
     *
2304
     */
2305
    size: [number, number] | undefined;
2306
    /**
2307
     * The number of active busy actions. Zero indicates no busy activity. One or more
2308
     * indicates busy activity.
2309
     *
2310
     * @type {number}
2311
     *
2312
     */
2313
    busyCount: number;
2314
    /**
2315
     * The active map tool
2316
     *
2317
     * @type {ActiveMapTool}
2318
     *
2319
     */
2320
    tool: ActiveMapTool;
2321
    /**
2322
     * Indicates if feature tooltips are enabled
2323
     *
2324
     * @type {boolean}
2325
     *
2326
     */
2327
    featureTooltipsEnabled: boolean;
2328
}
2329

2330
/**
2331
 * Describes the reducer state branch for tracked mouse coordinates
2332
 *
2333
 *
2334
 * @interface IMouseReducerState
2335
 */
2336
export interface IMouseReducerState {
2337
    /**
2338
     * The last tracked mouse coordinate
2339
     *
2340
     * @type {(Coordinate2D | undefined)}
2341
     */
2342
    coords: Coordinate2D | undefined;
2343
}
2344

2345
/**
2346
 * Describes the full application state tree. Redux-aware components can connect and subscribe to
2347
 * various properties and branches of this tree and be automatically notified of any changes and
2348
 * update and re-render themselves accordingly
2349
 *
2350
 *
2351
 * @interface IApplicationState
2352
 */
2353
export interface IApplicationState {
2354
    /**
2355
     * Initialization errors
2356
     *
2357
     * @type {Readonly<IInitErrorReducerState>}
2358
     *
2359
     */
2360
    initError: Readonly<IInitErrorReducerState>;
2361
    /**
2362
     * Viewer configuration
2363
     *
2364
     * @type {Readonly<IConfigurationReducerState>}
2365
     *
2366
     */
2367
    config: Readonly<IConfigurationReducerState>;
2368
    /**
2369
     * Current template state
2370
     *
2371
     * @type {Readonly<ITemplateReducerState>}
2372
     *
2373
     */
2374
    template: Readonly<ITemplateReducerState>;
2375
    /**
2376
     * Viewer state
2377
     *
2378
     * @type {Readonly<IViewerReducerState>}
2379
     *
2380
     */
2381
    viewer: Readonly<IViewerReducerState>;
2382
    /**
2383
     * Runtime map state
2384
     *
2385
     * @type {Readonly<IBranchedMapState>}
2386
     *
2387
     */
2388
    mapState: Readonly<IBranchedMapState>;
2389
    /**
2390
     * Toolbar state
2391
     *
2392
     * @type {Readonly<IToolbarReducerState>}
2393
     *
2394
     */
2395
    toolbar: Readonly<IToolbarReducerState>;
2396
    /**
2397
     * Task Pane component state
2398
     *
2399
     * @type {Readonly<ITaskPaneReducerState>}
2400
     *
2401
     */
2402
    taskpane: Readonly<ITaskPaneReducerState>;
2403
    /**
2404
     * Modal dialog state
2405
     *
2406
     * @type {Readonly<IModalReducerState>}
2407
     *
2408
     */
2409
    modal: Readonly<IModalReducerState>;
2410
    /**
2411
     * Tracked mouse coordinate state
2412
     *
2413
     * @type {Readonly<IMouseReducerState>}
2414
     *
2415
     */
2416
    mouse: Readonly<IMouseReducerState>;
2417
    /**
2418
     * Tracks the last dispatched action
2419
     *
2420
     * @type {*}
2421
     *
2422
     */
2423
    lastaction: any;
2424
}
2425

2426
// Redux typedefs to tighten up our redux code
2427

2428
/**
2429
 * Describes the redux store
2430
 *
2431
 *
2432
 * @interface ReduxStore
2433
 */
2434
export interface ReduxStore {
2435
    /**
2436
     * Gets the application state
2437
     *
2438
     * @returns {Readonly<IApplicationState>}
2439
     */
2440
    getState(): Readonly<IApplicationState>;
2441
}
2442

2443
/**
2444
 * Describes a thunked redux action. Thunked redux actions are generally used for actions that push state
2445
 * asynchronously (eg. In response to an AJAX request)
2446
 */
2447
export type ReduxThunkedAction = (dispatch: ReduxDispatch, getState: () => Readonly<IApplicationState>) => any;
2448

2449
/**
2450
 * Describes a redux dispatcher function. A redux dispatch pushes new state to the redux store
2451
 */
2452
export type ReduxDispatch = (action: ViewerAction | ReduxThunkedAction) => void;
2453

2454
/**
2455
 * A function that does nothing
2456
 *
2457
 *
2458
 */
2459
export function NOOP() { }
2460

2461
/**
2462
 * A function that always returns false
2463
 *
2464
 *
2465
 * @returns false
2466
 */
UNCOV
2467
export function ALWAYS_FALSE() { return false; }
×
2468

2469
/**
2470
 * A function that always returns true
2471
 *
2472
 *
2473
 * @returns true
2474
 */
UNCOV
2475
export function ALWAYS_TRUE() { return true; }
×
2476

2477
/**
2478
 * Describe the size/dimensions of a DOM element in a toolbar or flyout menu
2479
 *
2480
 *
2481
 * @interface IDOMElementMetrics
2482
 */
2483
export interface IDOMElementMetrics {
2484
    /**
2485
     * The X position of this element
2486
     *
2487
     * @type {number}
2488
     *
2489
     */
2490
    posX: number;
2491
    /**
2492
     * The Y position of this element
2493
     *
2494
     * @type {number}
2495
     *
2496
     */
2497
    posY: number;
2498
    /**
2499
     * The width of this element
2500
     *
2501
     * @type {number}
2502
     *
2503
     */
2504
    width: number;
2505
    /**
2506
     * The height of this element
2507
     *
2508
     * @type {number}
2509
     *
2510
     */
2511
    height: number;
2512
    /**
2513
     * Indicates of this toolbar is vertically-oriented
2514
     *
2515
     * @type {boolean}
2516
     *
2517
     */
2518
    vertical?: boolean;
2519
}
2520

2521
/**
2522
 * Helper function to get the initial map view from the application state
2523
 *
2524
 *
2525
 * @param {Readonly<IApplicationState>} state
2526
 * @returns {(IMapView | undefined)}
2527
 */
2528
export function getInitialView(state: Readonly<IApplicationState>): IMapView | undefined {
2529
    if (state.config.activeMapName) {
2✔
2530
        return state.mapState[state.config.activeMapName].initialView;
1✔
2531
    }
2532
    return undefined;
1✔
2533
}
2534

2535
/**
2536
 * Helper function to get the mapguide-specific sub state of the current map group
2537
 *
2538
 *
2539
 * @param {Readonly<IApplicationState>} state
2540
 * @returns {(IMapGuideSubState | undefined)}
2541
 * @since 0.14
2542
 */
2543
export function getMapGuideSubState(state: Readonly<IApplicationState>): IMapGuideSubState | undefined {
2544
    if (state.config.activeMapName) {
70✔
2545
        return state.mapState[state.config.activeMapName].mapguide;
54✔
2546
    }
2547
    return undefined;
16✔
2548
}
2549

2550
/**
2551
 * Helper function to get the current selection set from the application state
2552
 *
2553
 *
2554
 * @param {Readonly<IApplicationState>} state
2555
 * @returns {(QueryMapFeaturesResponse | undefined)}
2556
 */
2557
export function getSelectionSet(state: Readonly<IApplicationState>): QueryMapFeaturesResponse | undefined {
2558
    return getMapGuideSubState(state)?.selectionSet;
45✔
2559
}
2560

2561
/**
2562
 * Helper function to get the current runtime map state from the application state
2563
 *
2564
 *
2565
 * @param {Readonly<IApplicationState>} state
2566
 * @returns {(RuntimeMap | undefined)}
2567
 */
2568
export function getRuntimeMap(state: Readonly<IApplicationState>): RuntimeMap | undefined {
2569
    return getMapGuideSubState(state)?.runtimeMap;
25✔
2570
}
2571

2572
/**
2573
 * Helper function to get the current view from the application state
2574
 *
2575
 *
2576
 * @param {Readonly<IApplicationState>} state
2577
 * @returns {(IMapView | undefined)}
2578
 */
2579
export function getCurrentView(state: Readonly<IApplicationState>): IMapView | undefined {
2580
    if (state.config.activeMapName) {
9✔
2581
        return state.mapState[state.config.activeMapName].currentView;
7✔
2582
    }
2583
    return undefined;
2✔
2584
}
2585

2586
/**
2587
 * Determines if the given external base layer is one with a visual representation
2588
 * 
2589
 * @param layer 
2590
 * @returns 
2591
 * @since 0.14.9
2592
 */
2593
export function isVisualBaseLayer(layer: IExternalBaseLayer) {
2594
    return layer.kind != "UTFGrid";
20✔
2595
}
2596

2597
/**
2598
 * Helper function to get the current set of available external base layers from the application state
2599
 *
2600
 * @remarks This does not include "non-visual" base layers such as UTFGrid tilesets
2601
 * 
2602
 *
2603
 * @param {Readonly<IApplicationState>} state
2604
 * @returns {(IExternalBaseLayer[] | undefined)}
2605
 * 
2606
 * @since 0.14.9 Removed includeNonVisual parameter
2607
 */
2608
export function getExternalBaseLayers(state: Readonly<IApplicationState>): IExternalBaseLayer[] | undefined {
2609
    if (state.config.activeMapName) {
2!
2610
        return state.mapState[state.config.activeMapName].externalBaseLayers;
×
2611
    }
2612
    return undefined;
2✔
2613
}
2614

2615
/**
2616
 * Defines the visibility of flyout menus
2617
 */
2618
export type FlyoutVisibilitySet = { [flyoutId: string]: boolean | undefined };
2619

2620
/**
2621
 * Defines the capabilities of a WMS service
2622
 * 
2623
 * @since 0.11
2624
 */
2625
export interface WmsCapabilitiesDocument {
2626
    /**
2627
     * WMS service version
2628
     * 
2629
     * @type {string}
2630
     *
2631
     */
2632
    version: string;
2633
    Service: WMSServiceDescription;
2634
    Capability: WMSServiceCapabilities;
2635
}
2636

2637
/**
2638
 * @since 0.11
2639
 */
2640
export interface WMSServiceCapabilities {
2641
    Request: any;
2642
    Exception: string[];
2643
    Layer: WMSRootPublishedLayer;
2644
}
2645

2646
/**
2647
 * @since 0.12
2648
 */
2649
export interface WMSLayerBoundingBox {
2650
    crs: string;
2651
    extent: [number, number, number, number],
2652
    res: [any, any]
2653
}
2654

2655
/**
2656
 * @since 0.11
2657
 */
2658
export interface WMSPublishedLayer {
2659
    Name: string;
2660
    Title: string;
2661
    Abstract: string;
2662
    KeywordList: string;
2663
    CRS: string[];
2664
    EX_GeographicBoundingBox: [number, number, number, number];
2665
    BoundingBox: WMSLayerBoundingBox[];
2666
    Style: WMSLayerStyle[];
2667
    queryable: boolean;
2668
    opaque: boolean;
2669
    noSubsets: boolean;
2670
}
2671

2672
/**
2673
 * @since 0.11
2674
 */
2675
export interface WMSRootPublishedLayer extends WMSPublishedLayer {
2676
    Layer: WMSPublishedLayer[];
2677
}
2678

2679
/**
2680
 * @since 0.12
2681
 */
2682
export interface WMSLegendURLDefinition {
2683
    Format: string;
2684
    OnlineResource: string;
2685
    size: [number, number];
2686
}
2687

2688
/**
2689
 * @since 0.11
2690
 */
2691
export interface WMSLayerStyle {
2692
    Name: string;
2693
    Title: string;
2694
    Abstract: string;
2695
    LegendURL: WMSLegendURLDefinition[];
2696
}
2697

2698
/**
2699
 * @since 0.12
2700
 */
2701
export interface WMSContactAddress {
2702
    AddressType: string,
2703
    Address: string,
2704
    City: string,
2705
    StateOrProvince: string,
2706
    PostCode: string,
2707
    Country: string
2708
}
2709

2710
/**
2711
 * @since 0.12
2712
 */
2713
export interface WMSContact {
2714
    ContactPerson: string;
2715
    ContactOrganization: string;
2716
}
2717

2718
/**
2719
 * @since 0.12
2720
 */
2721
export interface WMSContactInformation {
2722
    ContactPersonPrimary: WMSContact,
2723
    ContactPosition: string,
2724
    ContactAddress: WMSContactAddress,
2725
    ContactVoiceTelephone: string,
2726
    ContactFacsimileTelephone: string,
2727
    ContactElectronicMailAddress: string
2728
}
2729

2730
/**
2731
 * @since 0.11
2732
 */
2733
export interface WMSServiceDescription {
2734
    Name: string;
2735
    Title: string;
2736
    Abstract: string;
2737
    KeywordList: string[];
2738
    OnlineResource: string;
2739
    ContactInformation: WMSContactInformation,
2740
    Fees: string;
2741
    AccessConstraints: string;
2742
}
2743

2744
export interface IMapGuideImageSource {
2745
    on(event: string, handler: Function): void;
2746
    updateParams(params: any): void;
2747
}
2748

2749
/**
2750
 * Custom properties that can be attached to OpenLayers layer instances
2751
 * 
2752
 * @since 0.13
2753
 */
2754
export enum LayerProperty {
49✔
2755
    LAYER_TYPE = "layer_type",
49✔
2756
    LAYER_NAME = "name",
49✔
2757
    /**
2758
     * @since 0.14
2759
     */
2760
    LAYER_DISPLAY_NAME = "display_name",
49✔
2761
    IS_GROUP = "is_group",
49✔
2762
    IS_EXTERNAL = "is_external",
49✔
2763
    IS_SELECTABLE = "is_selectable",
49✔
2764
    /**
2765
     * @since 0.14.5
2766
     */
2767
    DISABLE_HOVER = "disable_hover",
49✔
2768
    IS_SCRATCH = "is_scratch",
49✔
2769
    HAS_WMS_LEGEND = "has_wms_legend",
49✔
2770
    VECTOR_STYLE = "vector_style",
49✔
2771
    WGS84_BBOX = "wgs84_bbox",
49✔
2772
    BUSY_WORKER_COUNT = "busy_worker_count",
49✔
2773
    /**
2774
     * @since 0.14
2775
     */
2776
    SELECTED_POPUP_CONFIGURATION = "popup_config",
49✔
2777
    /**
2778
     * @since 0.14
2779
     */
2780
    LAYER_DESCRIPTION = "layer_description",
49✔
2781
    /**
2782
     * @since 0.14
2783
     */
2784
    LAYER_METADATA = "layer_metadata",
49✔
2785
    /**
2786
     * @since 0.14
2787
     */
2788
    IS_HOVER_HIGHLIGHT = "is_hover_highlight",
49✔
2789
    /**
2790
     * @since 0.14
2791
     */
2792
    IS_MEASURE = "is_measure",
49✔
2793
    /**
2794
     * @since 0.14
2795
     */
2796
    IS_WMS_SELECTION_OVERLAY = "is_wms_selection_overlay",
49✔
2797
    /**
2798
     * @since 0.14
2799
     */
2800
    IS_HEATMAP = "is_heatmap",
49✔
2801
    /**
2802
     * A source definition to attach to the layer. This is to assist in persistence of this layer for easy
2803
     * restoration on an application-defined basis
2804
     * 
2805
     * @since 0.14.3
2806
     */
2807
    LAYER_DEFN = "layer_defn"
49✔
2808
}
2809

2810
/**
2811
 * Custom properties that can be attached to OpenLayers image source instances
2812
 * 
2813
 * @since 0.13
2814
 */
2815
export enum SourceProperty {
49✔
2816
    SUPPRESS_LOAD_EVENTS = "suppress_load_events"
49✔
2817
}
2818

2819
/**
2820
 * MapGuide layer types
2821
 * 
2822
 * @since 0.13
2823
 */
2824
export enum MgLayerType {
49✔
2825
    Untiled = "MapGuide_Untiled",
49✔
2826
    Tiled = "MapGuide_Tiled"
49✔
2827
}
2828

2829
/**
2830
 * The type name for a MapGuide layer
2831
 * 
2832
 * @since 0.13
2833
 */
2834
export const MG_LAYER_TYPE_NAME = "MapGuide";
49✔
2835

2836
/**
2837
 * The default group name for MapGuide tiled layers. This value
2838
 * is not meant for localized display
2839
 * 
2840
 * @since 0.13
2841
 */
2842
export const MG_BASE_LAYER_GROUP_NAME = "Base Tile Layers";
49✔
2843

2844
/**
2845
 * Default names for MapGuide built-in layer types. These value
2846
 * are not meant for localized display
2847
 * 
2848
 * @since 0.13
2849
 */
2850
export enum MgBuiltInLayers {
49✔
2851
    Overlay = "MapGuide Dynamic Overlay",
49✔
2852
    SelectionOverlay = "MapGuide Selection Overlay",
49✔
2853
    ActiveFeatureSelectionOverlay = "MapGuide Active Feature Selection Overlay"
49✔
2854
}
2855

2856
/**
2857
 * A layer of a {@link ICompositeSelection}
2858
 * 
2859
 * @since 0.14
2860
 */
2861
export interface ICompositeSelectionLayer {
2862
    /**
2863
     * The id of this selection layer
2864
     */
2865
    getLayerId(): string | undefined;
2866
    /**
2867
     * The name of this layer
2868
     */
2869
    getName(): string;
2870
    /**
2871
     * The metadata of this layer
2872
     */
2873
    getLayerMetadata(): LayerMetadata | undefined;
2874
    /**
2875
     * Gets the feature at the given index
2876
     */
2877
    getFeatureAt(featureIndex: number): SelectedFeature;
2878
    /**
2879
     * Gets the total number of features in this layer
2880
     */
2881
    getFeatureCount(): number;
2882
}
2883

2884
/**
2885
 * A composition of a MapGuide selection set and a client-side vector feature selection
2886
 * 
2887
 * @since 0.14
2888
 */
2889
export interface ICompositeSelection {
2890
    /**
2891
     * Gets the number of layers in this selection set
2892
     */
2893
    getLayerCount(): number;
2894
    /**
2895
     * Gets the array of layers in this selection set
2896
     */
2897
    getLayers(): ICompositeSelectionLayer[];
2898
    /**
2899
     * Gets the layer at the specified index
2900
     * 
2901
     * @param layerIndex The selection layer index
2902
     */
2903
    getLayerAt(layerIndex: number): ICompositeSelectionLayer | undefined;
2904
    /**
2905
     * Gets the feature for the given layer at the specified indices
2906
     * 
2907
     * @param layerIndex The selection layer index
2908
     * @param featureIndex The feature index
2909
     */
2910
    getFeatureAt(layerIndex: number, featureIndex: number): SelectedFeature | undefined;
2911
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc