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

jumpinjackie / mapguide-react-layout / 15160437878

21 May 2025 11:00AM UTC coverage: 21.631% (-42.6%) from 64.24%
15160437878

Pull #1552

github

web-flow
Merge 8b7153d9e into 236e2ea07
Pull Request #1552: Feature/package updates 2505

839 of 1165 branches covered (72.02%)

11 of 151 new or added lines in 25 files covered. (7.28%)

1332 existing lines in 50 files now uncovered.

4794 of 22163 relevant lines covered (21.63%)

6.89 hits per line

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

82.29
/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;
1✔
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 {
1✔
50
    /**
51
     * An unknown unit
52
     */
53
    Unknown = 0,
1✔
54
    /**
55
     * Inch unit
56
     */
57
    Inches = 1,
1✔
58
    /**
59
     * Feet unit
60
     */
61
    Feet = 2,
1✔
62
    /**
63
     * Yard unit
64
     */
65
    Yards = 3,
1✔
66
    /**
67
     * Mile unit
68
     */
69
    Miles = 4,
1✔
70
    /**
71
     * Nautical Mile unit
72
     */
73
    NauticalMiles = 5,
1✔
74
    /**
75
     * Millimeter unit
76
     */
77
    Millimeters = 6,
1✔
78
    /**
79
     * Centimeter unit
80
     */
81
    Centimeters = 7,
1✔
82
    /**
83
     * Meter unit
84
     */
85
    Meters = 8,
1✔
86
    /**
87
     * Kilometer unit
88
     */
89
    Kilometers = 9,
1✔
90
    /**
91
     * Degree unit
92
     */
93
    Degrees = 10,
1✔
94
    /**
95
     * Decimal Degree unit
96
     */
97
    DecimalDegrees = 11,
1✔
98
    /**
99
     * DMS unit
100
     */
101
    DMS = 12,
1✔
102
    /**
103
     * Pixel unit
104
     */
105
    Pixels = 13,
1✔
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
 * @export
122
 * @interface IMapView
123
 */
124
export interface IMapView {
125
    /**
126
     * The x coordinate
127
     *
128
     * @type {number}
129
     * @memberof IMapView
130
     */
131
    x: number;
132
    /**
133
     * The Y coordinate
134
     *
135
     * @type {number}
136
     * @memberof IMapView
137
     */
138
    y: number;
139
    /**
140
     * The scale
141
     *
142
     * @type {number}
143
     * @memberof IMapView
144
     */
145
    scale: number;
146
    /**
147
     * The view resolution
148
     * 
149
     * @type {number | undefined}
150
     * @memberof IMapView
151
     */
152
    resolution?: number;
153
}
154

155
/**
156
 * Describes a function that is called when a command is invoked
157
 */
158
export type DispatcherFunc = (dispatch: ReduxDispatch, getState: () => Readonly<IApplicationState>, viewer?: IMapViewer, parameters?: any) => any;
159

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

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

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

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

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

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

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

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

361
/**
362
 * A size quantity
363
 * @since 0.13
364
 */
365
export type Size2 = [number, number];
366

367
/**
368
 * A bounding box array
369
 */
370
export type Bounds = [number, number, number, number];
371

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

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

434

435
/**
436
 * Describes a menu entry on the Map Menu component
437
 *
438
 * @export
439
 * @interface IMapMenuEntry
440
 */
441
export interface IMapMenuEntry {
442
    /**
443
     * The runtime map name
444
     *
445
     * @type {string}
446
     * @memberof IMapMenuEntry
447
     */
448
    mapName: string;
449
    /**
450
     * The menu entry label
451
     *
452
     * @type {string}
453
     * @memberof IMapMenuEntry
454
     */
455
    label: string;
456
}
457

458
/**
459
 * A bit mask indicating how a map viewer should refresh
460
 *
461
 * @export
462
 * @enum {number}
463
 */
464
export enum RefreshMode {
1✔
465
    /**
466
     * Refresh only the layers
467
     */
468
    LayersOnly = 1,
1✔
469
    /**
470
     * Refresh only the selection
471
     */
472
    SelectionOnly = 2
1✔
473
}
474

475
/**
476
 * The spatial operator to use for selection operations
477
 */
478
export type SelectionVariant = "INTERSECTS" | "TOUCHES" | "WITHIN" | "ENVELOPEINTERSECTS";
479

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

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

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

915
    toastSuccess(icon: string, message: string | JSX.Element): string | undefined;
916
    toastWarning(icon: string, message: string | JSX.Element): string | undefined;
917
    toastError(icon: string, message: string | JSX.Element): string | undefined;
918
    toastPrimary(icon: string, message: string | JSX.Element): string | undefined;
919
    dismissToast(key: string): void;
920
    updateSize(): void;
921

922
    /**
923
     * Returns the collection of selected client-side vector features. This collection
924
     * is observable, so you may hold onto a reference to this collection and subscribe
925
     * to events on this collection for when new features are added or removed from this collection
926
     * 
927
     * @returns {Collection<Feature>}
928
     * @memberof IMapViewer
929
     * @since 0.13
930
     * @since 0.14 - The return value may be undefined if called when the map viewer is detached/disposed/destroyed
931
     */
932
    getSelectedFeatures(): Collection<Feature<Geometry>> | undefined;
933

934
    /**
935
     * INTERNAL API. Not for public use
936
     * @hidden
937
     */
938
    addImageLoading(): void;
939
    /**
940
     * INTERNAL API. Not for public use
941
     * @hidden
942
     */
943
    addImageLoaded(): void;
944
    /**
945
     * EXPERIMENTAL:
946
     * Adds the given application state subscribers
947
     * 
948
     * NOTE: Calling this method will trigger a re-render of the component. Due to this quirk, 
949
     * calling this method again while a re-render is taking place may cause the subscriber to
950
     * not actually be registered. Calling this method multiple times in succession is therefore
951
     * not advised. If you need to add multiple subscribers, pass an array of the subscribers to
952
     * register in a single method call.
953
     * 
954
     * @param props 
955
     * @since 0.13
956
     */
957
    addSubscribers(props: ISubscriberProps[]): string[];
958
    /**
959
     * EXPERIMENTAL:
960
     * Removes application state subscribers of the given names
961
     * 
962
     * @param name 
963
     * @since 0.13
964
     */
965
    removeSubscribers(names: string[]): boolean;
966
    /**
967
     * EXPERIMENTAL:
968
     * Gets all application state subscriber names
969
     * 
970
     * @since 0.13
971
     */
972
    getSubscribers(): string[];
973
    /**
974
     * Dispatches the given action
975
     * 
976
     * @remarks Usage outside of the react component context (eg. Plain HTML Task Pane content) should be used sparingly. In particular
977
     * you should avoid trying to call this method multiple times in succession. You should call this method once in response to a DOM element
978
     * event (eg. A button click)
979
     * @alpha
980
     * @since 0.13
981
     */
982
    dispatch(action: any): void;
983

984
    /**
985
     * Gets the default point circle style
986
     * @since 0.13
987
     */
988
    getDefaultPointCircleStyle(): IBasicPointCircleStyle;
989

990
    /**
991
     * Gets the default point icon style
992
     * @since 0.13
993
     */
994
    getDefaultPointIconStyle(): IPointIconStyle;
995

996
    /**
997
     * Gets the default line style
998
     * @since 0.13
999
     */
1000
    getDefaultLineStyle(): IBasicVectorLineStyle;
1001

1002
    /**
1003
     * Gets the default polygon style
1004
     * @since 0.13
1005
     */
1006
    getDefaultPolygonStyle(): IBasicVectorPolygonStyle;
1007

1008
    /**
1009
     * Exports an image of the current map view
1010
     *
1011
     * @param {IMapImageExportOptions} options
1012
     * @memberof IMapViewer
1013
     * @since 0.14
1014
     */
1015
    exportImage(options: IMapImageExportOptions): void;
1016
}
1017

1018
/**
1019
 * WMS layer extension data
1020
 * 
1021
 * @since 0.13
1022
 */
1023
export interface IWmsLayerExtensions {
1024
    type: "WMS";
1025
    getLegendUrl?: (resolution?: number) => string;
1026
}
1027

1028
/**
1029
 * Layer extension data
1030
 * 
1031
 * @since 0.13
1032
 */
1033
export type LayerExtensions = IWmsLayerExtensions;
1034

1035
export interface ILayerInfo {
1036
    /**
1037
     * The name of the layer
1038
     * 
1039
     * @type {string}
1040
     * @memberof ILayerInfo
1041
    * */
1042
    name: string;
1043
    /**
1044
     * The display name of this layer
1045
     *
1046
     * @type {string}
1047
     * @memberof ILayerInfo
1048
     * @since 0.14
1049
     */
1050
    displayName: string;
1051
    /**
1052
     * The type of layer
1053
     * 
1054
     * @type {string}
1055
     * @memberof ILayerInfo
1056
     */
1057
    type: string;
1058
    /**
1059
     * An optional description for the layer
1060
     *
1061
     * @type {string}
1062
     * @memberof ILayerInfo
1063
     * @since 0.14
1064
     */
1065
    description?: string;
1066
    /**
1067
     * Indicates if this layer is an external layer
1068
     * 
1069
     * @since 0.13
1070
     */
1071
    isExternal: boolean;
1072
    /** 
1073
     * Indicates if this layer is visible
1074
     * 
1075
     * @since 0.13
1076
     */
1077
    visible: boolean;
1078
    /**
1079
     * Indicates if this layer is selectable by the select tool
1080
     * 
1081
     * @since 0.13
1082
     */
1083
    selectable: boolean;
1084
    /**
1085
     * The opacity of this layer
1086
     * 
1087
     * @since 0.13
1088
     * @type {number}
1089
     * @memberof ILayerInfo
1090
     */
1091
    opacity: number;
1092
    /**
1093
     * Extension data for this layer
1094
     * 
1095
     * @since 0.13
1096
     */
1097
    extensions?: LayerExtensions;
1098
    /**
1099
     * The vector style for this layer. Not applicable for raster layers.
1100
     * 
1101
     * @since 0.13
1102
     * @since 0.14 Changed to IVectorLayerStyle
1103
     */
1104
    vectorStyle?: IVectorLayerStyle;
1105
    /**
1106
     * Cluster style settings
1107
     * @since 0.14
1108
     */
1109
    cluster?: IClusterSettings;
1110
    /**
1111
     * Heatmap settings
1112
     * @since 0.14
1113
     */
1114
    heatmap?: IHeatmapSettings;
1115
    /**
1116
     * The busy worker count of this layer. If greater than 0, the layer
1117
     * is considered to be in the process of loading
1118
     * 
1119
     * @since 0.13
1120
     */
1121
    busyWorkerCount: number;
1122
    /**
1123
     * Metadata attached to the layer
1124
     * 
1125
     * @since 0.14
1126
     * @memberof ILayerInfo
1127
     */
1128
    metadata?: any;
1129
}
1130

1131
/**
1132
 * Point layer clustering options
1133
 * 
1134
 * @since 0.14
1135
 */
1136
export interface AddVectorLayerClusteringOptions {
1137
    kind: "Cluster";
1138
    /**
1139
     * The distance to use for clustering. Setting this value will create a clustered layer.
1140
     * 
1141
     *  * If {@see clusterDistance} is set, but {@see clusterStyle} is not set, the {@see IAddLayerFromParsedFeaturesOptions.defaultStyle} will be used if set, otherwise the default vector style will be used
1142
     */
1143
    clusterDistance: number;
1144
    /**
1145
     * The style to use for this clustered layer. 
1146
     * 
1147
     *  * If {@see clusterDistance} is not set, this has no effect
1148
     *  * If {@see clusterDistance} is set but this is not set, the {@see IAddLayerFromParsedFeaturesOptions.defaultStyle} will be used if set, otherwise the default vector style will be used
1149
     */
1150
    clusterStyle?: IVectorLayerStyle;
1151
    /**
1152
     * The action to perform when the cluster is clicked
1153
     */
1154
    onClusterClickAction?: ClusterClickAction;
1155
}
1156

1157
/**
1158
 * Theming options
1159
 * @since 0.14
1160
 */
1161
export interface AddVectorLayerThemeOptions {
1162
    kind: "Theme";
1163
    /**
1164
     * Generate a thematic ramp based on the given property
1165
     */
1166
    themeOnProperty: string;
1167
    /**
1168
     * The colorbrewer theme to apply
1169
     */
1170
    colorBrewerTheme: string;
1171
}
1172

1173
/**
1174
 * Heatmap options
1175
 * @since 0.14
1176
 */
1177
export interface AddVectorLayerHeatmapOptions {
1178
    kind: "Heatmap",
1179
    /**
1180
     * The weight property
1181
     */
1182
    weightProperty?: string;
1183
}
1184

1185
export type AddVectorLayerExtraOptions = AddVectorLayerClusteringOptions | AddVectorLayerThemeOptions | AddVectorLayerHeatmapOptions;
1186

1187
/**
1188
 * Options to add a new layer from parsed features
1189
 * 
1190
 * @export
1191
 * @interface IAddLayerFromParsedFeaturesOptions
1192
 * @since 0.13
1193
 */
1194
export interface IAddLayerFromParsedFeaturesOptions {
1195
    /**
1196
     * The projection to assign for this layer. If not specified, the map's projection
1197
     * is assumed
1198
     */
1199
    projection?: ProjectionLike;
1200
    /**
1201
     * The parsed features to add the layer with
1202
     */
1203
    features: IParsedFeatures;
1204
    /**
1205
     * The style to use for this layer. If not specified, a default style will be assigned
1206
     * to this layer
1207
     * 
1208
     * @since 0.13
1209
     * @since 0.14 changed to IVectorLayerStyle
1210
     */
1211
    defaultStyle?: IVectorLayerStyle;
1212
    /**
1213
     * Extra options for the layer to be added
1214
     * @since 0.14
1215
     */
1216
    extraOptions?: AddVectorLayerExtraOptions;
1217
    /**
1218
     * The property to use for labeling
1219
     * @since 0.14
1220
     */
1221
    labelOnProperty?: string;
1222
    /**
1223
     * The popup template to use when features are selected on this layer
1224
     * @since 0.14
1225
     */
1226
    selectedPopupTemplate?: ISelectedFeaturePopupTemplateConfiguration;
1227
    /**
1228
     * Metadata for this layer
1229
     * @since 0.14
1230
     */
1231
    metadata?: any;
1232
    /**
1233
     * A definition to attach to this layer. This definition is application-defined and is primarily to
1234
     * assist the application in implementing persistence/restoration of this layer on an application-defined
1235
     * basis 
1236
     * @since 0.14.3
1237
     */
1238
    defn?: any;
1239
}
1240

1241
/**
1242
 * Options for parsing features from a file
1243
 * 
1244
 * @export
1245
 * @interface IParseFeaturesFromFileOptions
1246
 * @since 0.13
1247
 */
1248
export interface IParseFeaturesFromFileOptions {
1249
    file: File;
1250
    name: string;
1251
    locale: string;
1252
}
1253

1254
/**
1255
 * Manages custom layers for a map
1256
 * 
1257
 * @export
1258
 * @interface ILayerManager
1259
 */
1260
export interface ILayerManager {
1261
    /**
1262
     * Get the active subject layer if present on the current map. In a MapGuide-specific context, subject layers do not exist
1263
     * and this method will always return undefined in such cases
1264
     *
1265
     * @returns {olLayerBase}
1266
     * @memberof ILayerManager
1267
     * @since 0.14
1268
     */
1269
    tryGetSubjectLayer(): olLayerBase | undefined;
1270
    /**
1271
     * Gets all custom layers on this map, sorted by draw order (First item is top-most layer. Last item is bottom-most layer.)
1272
     * 
1273
     * @returns {ILayerInfo[]} 
1274
     * @memberof ILayerManager
1275
    * */
1276
    getLayers(): ILayerInfo[];
1277
    /**
1278
     * Gets whether the specified custom layer exists on the map
1279
     */
1280
    hasLayer(name: string): boolean;
1281
    /**
1282
     * Adds a layer to the map
1283
     * 
1284
     * @template T 
1285
     * @param {string} name The name of the layer
1286
     * @param {T} layer The layer object
1287
     * @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
1288
     * @returns {T} The added layer
1289
     * @memberof ILayerManager
1290
     */
1291
    addLayer<T extends olLayerBase>(name: string, layer: T, allowReplace?: boolean): ILayerInfo;
1292
    /**
1293
     * Removes a layer by the given name
1294
     *
1295
     * @param {string} name
1296
     * @returns {(olLayerBase | undefined)}
1297
     *
1298
     * @memberof IMapViewer
1299
     */
1300
    removeLayer(name: string): olLayerBase | undefined;
1301
    /**
1302
     * Gets a layer by the given name
1303
     *
1304
     * @template T
1305
     * @param {string} name
1306
     * @returns {T}
1307
     *
1308
     * @memberof IMapViewer
1309
     */
1310
    getLayer<T extends olLayerBase>(name: string): T | undefined;
1311

1312
    /**
1313
     * Attempts to parse features for the given input file. A failed attempt is when
1314
     * calling hasFeatures() on the returned parsed features returns false.
1315
     * 
1316
     * @param {IParseFeaturesFromFileOptions} options
1317
     * @returns {Promise<IParsedFeatures>}
1318
     * @memberof ILayerManager
1319
     * @since 0.13
1320
     */
1321
    parseFeaturesFromFile(options: IParseFeaturesFromFileOptions): Promise<IParsedFeatures>;
1322

1323
    /**
1324
     * Adds the given parsed features as a new external layer
1325
     * 
1326
     * @param {IAddLayerFromParsedFeaturesOptions} options
1327
     * @returns {Promise<ILayerInfo>}
1328
     * @memberof ILayerManager
1329
     * @since 0.13
1330
     * @since 0.14 Styles for geometry types not found in the parsed features will be deleted
1331
     */
1332
    addLayerFromParsedFeatures(options: IAddLayerFromParsedFeaturesOptions): Promise<ILayerInfo>;
1333

1334
    /**
1335
     * Applies draw order/opacity/visibility
1336
     * @hidden
1337
     */
1338
    apply(layers: ILayerInfo[]): void;
1339
}
1340

1341
/**
1342
 * Function signature for a digitization callback
1343
 */
1344
export type DigitizerCallback<T extends olGeometry> = (geom: T) => void;
1345

1346
/**
1347
 * Valid image formats
1348
 */
1349
export type ImageFormat = "PNG" | "PNG8" | "JPG" | "GIF";
1350

1351
/**
1352
 * The type of client
1353
 */
1354
export type ClientKind = "mapagent" | "mapguide-rest";
1355

1356
export interface IModalParameters {
1357
    title: string;
1358
    backdrop: boolean;
1359
    /**
1360
     * @since 0.14.8 Now optional
1361
     */
1362
    size?: [number, number];
1363
    overflowYScroll?: boolean;
1364
    /**
1365
     * @since 0.14.8
1366
     */
1367
    position?: [number, number];
1368
}
1369

1370
/**
1371
 * The default modal dialog size
1372
 */
1373
export const DEFAULT_MODAL_SIZE: [number, number] = [350, 500];
1✔
1374

1375
/**
1376
 * The default modal dialog position
1377
 * @since 0.14.8
1378
 */
1379
export const DEFAULT_MODAL_POSITION: [number, number] = [500, 80];
1✔
1380

1381
/**
1382
 * Base modal display options
1383
 *
1384
 * @export
1385
 * @interface IModalDisplayOptionsBase
1386
 */
1387
export interface IModalDisplayOptionsBase {
1388
    modal: IModalParameters;
1389
    name: string;
1390
}
1391

1392
/**
1393
 * Modal display options for URL content
1394
 *
1395
 * @export
1396
 * @interface IModalDisplayOptions
1397
 * @extends {IModalDisplayOptionsBase}
1398
 */
1399
export interface IModalDisplayOptions extends IModalDisplayOptionsBase {
1400
    /**
1401
     * The URL of the content to load in the modal dialog
1402
     *
1403
     * @type {string}
1404
     * @memberof IModalDisplayOptions
1405
     */
1406
    url: string;
1407
}
1408

1409
export interface IModalComponentDisplayOptions extends IModalDisplayOptionsBase {
1410
    /**
1411
     * The id of the component to display
1412
     *
1413
     * @type {string}
1414
     * @memberof IModalComponentDisplayOptions
1415
     */
1416
    component: string;
1417
    /**
1418
     * Component properties
1419
     *
1420
     * @type {*}
1421
     * @memberof IModalComponentDisplayOptions
1422
     */
1423
    componentProps?: any;
1424
}
1425

1426
export interface IToolbarReducerState {
1427
    toolbars: any;
1428
    flyouts: any;
1429
}
1430

1431
/**
1432
 * Describes the reducer state branch for Task Pane component
1433
 *
1434
 * @export
1435
 * @interface ITaskPaneReducerState
1436
 */
1437
export interface ITaskPaneReducerState {
1438
    /**
1439
     * The current navigation index
1440
     *
1441
     * @type {number}
1442
     * @memberof ITaskPaneReducerState
1443
     */
1444
    navIndex: number;
1445
    /**
1446
     * The current navigation history stack
1447
     *
1448
     * @type {string[]}
1449
     * @memberof ITaskPaneReducerState
1450
     */
1451
    navigation: string[];
1452
    /**
1453
     * The initial URL
1454
     *
1455
     * @type {(string | undefined)}
1456
     * @memberof ITaskPaneReducerState
1457
     */
1458
    initialUrl: string | undefined;
1459
    /**
1460
     * The last pushed URL
1461
     *
1462
     * @type {boolean}
1463
     * @memberof ITaskPaneReducerState
1464
     */
1465
    lastUrlPushed: boolean;
1466
}
1467

1468
export type IModalReducerState = {
1469
    /**
1470
     * Gets the modal parameters for the given key
1471
     * 
1472
     * @since 0.14.8 all modal sub-properties now optional
1473
     */
1474
    [key: string]: Omit<IModalDisplayOptions | IModalComponentDisplayOptions, "modal"> & {
1475
        modal: Partial<IModalParameters>;
1476
    }
1477
};
1478

1479
/*
1480
export interface IModalReducerState {
1481

1482
}
1483
*/
1484

1485
/**
1486
 * A set of layer transpareny values by layer name
1487
 */
1488
export type LayerTransparencySet = { [layerName: string]: number };
1489

1490
/**
1491
 * Selection key of an active selected feature
1492
 */
1493
export interface ActiveSelectedFeature {
1494
    /**
1495
     * The selected layer id
1496
     * 
1497
     * @type {string}
1498
     */
1499
    layerId: string;
1500
    /**
1501
     * The selection key of the feature
1502
     * 
1503
     * @type {string}
1504
     */
1505
    selectionKey: string;
1506
}
1507

1508
/**
1509
 * Generic layer sub-state
1510
 *
1511
 * @export
1512
 * @interface IGenericLayerSubState
1513
 * @since 0.14
1514
 */
1515
export interface IGenericLayerSubState {
1516
    /**
1517
     * The subject layer
1518
     *
1519
     * @type {IGenericSubjectMapLayer}
1520
     * @memberof IGenericLayerSubState
1521
     */
1522
    subject: IGenericSubjectMapLayer;
1523
}
1524

1525
/**
1526
 * MapGuide-specific map sub-state
1527
 *
1528
 * @export
1529
 * @interface IMapGuideSubState
1530
 * @since 0.14
1531
 */
1532
export interface IMapGuideSubState {
1533
    /**
1534
     * The runtime map state
1535
     *
1536
     * @type {(RuntimeMap | undefined)}
1537
     * @memberof IBranchedMapSubState
1538
     */
1539
    runtimeMap: RuntimeMap | undefined;
1540
    /**
1541
     * Indicates if this map is based on an arbitrary coordinate system
1542
     * @since 0.14.3
1543
     */
1544
    isArbitraryCs: boolean;
1545
    /**
1546
     * A set of selectable layer ids
1547
     *
1548
     * @type {*}
1549
     * @memberof IBranchedMapSubState
1550
     */
1551
    selectableLayers: any;
1552
    /**
1553
     * A set of expanded group ids
1554
     *
1555
     * @type {*}
1556
     * @memberof IBranchedMapSubState
1557
     */
1558
    expandedGroups: any;
1559
    /**
1560
     * The current MapGuide selection state
1561
     *
1562
     * @type {(QueryMapFeaturesResponse | undefined)}
1563
     * @memberof IBranchedMapSubState
1564
     */
1565
    selectionSet: QueryMapFeaturesResponse | undefined;
1566
    /**
1567
     * The array of ids of layers to show
1568
     *
1569
     * @type {string[]}
1570
     * @memberof IBranchedMapSubState
1571
     */
1572
    showLayers: string[];
1573
    /**
1574
     * The array of ids of groups to show
1575
     *
1576
     * @type {string[]}
1577
     * @memberof IBranchedMapSubState
1578
     */
1579
    showGroups: string[];
1580
    /**
1581
     * The array of ids of layers to hide
1582
     *
1583
     * @type {string[]}
1584
     * @memberof IBranchedMapSubState
1585
     */
1586
    hideLayers: string[];
1587
    /**
1588
     * The array of ids of groups to hide
1589
     *
1590
     * @type {string[]}
1591
     * @memberof IBranchedMapSubState
1592
     */
1593
    hideGroups: string[];
1594
    /**
1595
     * Layer transparency settings
1596
     * 
1597
     * @type {{ [layerName: string]: number }}
1598
     * @memberof IBranchedMapSubState
1599
     */
1600
    layerTransparency: LayerTransparencySet;
1601
    /**
1602
     * The active selected feature to highlight
1603
     * 
1604
     * @type {(ActiveSelectedFeature | undefined)}
1605
     * @memberof IBranchedMapSubState
1606
     */
1607
    activeSelectedFeature: ActiveSelectedFeature | undefined;
1608
}
1609

1610
/**
1611
 * Describes the reducer state branch for a particular map group
1612
 *
1613
 * @export
1614
 * @interface IBranchedMapSubState
1615
 */
1616
export interface IBranchedMapSubState {
1617
    /**
1618
     * The external base layers for the map group
1619
     *
1620
     * @type {IExternalBaseLayer[]}
1621
     * @memberof IBranchedMapSubState
1622
     */
1623
    externalBaseLayers: IExternalBaseLayer[];
1624
    /**
1625
     * Initial external layers. This does not reflect the current state of external layers added. This merely instructs what external layers
1626
     * to pre-load on viewer startup.
1627
     *
1628
     * @type {IInitialExternalLayer[]}
1629
     * @memberof IBranchedMapSubState
1630
     * @since 0.14
1631
     */
1632
    initialExternalLayers: IInitialExternalLayer[];
1633
    /**
1634
     * The layers in this viewer. First item is top-most layer. Last item is bottom-most layer.
1635
     * @since 0.13
1636
     */
1637
    layers: ILayerInfo[] | undefined;
1638
    /**
1639
     * The current map view
1640
     *
1641
     * @type {(IMapView | undefined)}
1642
     * @memberof IBranchedMapSubState
1643
     */
1644
    currentView: IMapView | undefined;
1645
    /**
1646
     * The initial map view
1647
     *
1648
     * @type {(IMapView | undefined)}
1649
     * @memberof IBranchedMapSubState
1650
     */
1651
    initialView: IMapView | undefined;
1652
    /**
1653
     * The view navigation history stack
1654
     *
1655
     * @type {IMapView[]}
1656
     * @memberof IBranchedMapSubState
1657
     */
1658
    history: IMapView[];
1659
    /**
1660
     * The current position in the view navigation history stack
1661
     *
1662
     * @type {number}
1663
     * @memberof IBranchedMapSubState
1664
     */
1665
    historyIndex: number;
1666
    /**
1667
     * MapGuide-specific sub-state
1668
     *
1669
     * @type {IMapGuideSubState}
1670
     * @memberof IBranchedMapSubState
1671
     * @since 0.14
1672
     */
1673
    mapguide: IMapGuideSubState | undefined;
1674
    /**
1675
     * The current client-side selection state
1676
     * 
1677
     * @since 0.14
1678
     */
1679
    clientSelection: ClientSelectionSet | undefined;
1680
    /**
1681
     * Generic layer sub-state
1682
     *
1683
     * @type {(IGenericLayerSubState | undefined)}
1684
     * @memberof IBranchedMapSubState
1685
     * @since 0.14
1686
     */
1687
    generic: IGenericLayerSubState | undefined;
1688
}
1689

1690
/**
1691
 * The reducer state branch for runtime map state. Map-specific state is keyed on
1692
 * their respective runtime map name as sub-branches on this branch
1693
 *
1694
 * @export
1695
 * @interface IBranchedMapState
1696
 */
1697
export interface IBranchedMapState {
1698
    [mapName: string]: IBranchedMapSubState;
1699
}
1700

1701
/**
1702
 * Coordinate display configuration
1703
 *
1704
 * @export
1705
 * @interface ICoordinateConfiguration
1706
 */
1707
export interface ICoordinateConfiguration {
1708
    /**
1709
     * The number of decimal places to show
1710
     *
1711
     * @type {number}
1712
     * @memberof ICoordinateConfiguration
1713
     */
1714
    decimals: number;
1715
    /**
1716
     * The display projection for these coordinates
1717
     * 
1718
     * @type {string}
1719
     * @memberof ICoordinateConfiguration
1720
     */
1721
    projection: string;
1722
    /**
1723
     * Display format string
1724
     * 
1725
     * @type {string}
1726
     * @memberof ICoordinateConfiguration
1727
     */
1728
    format?: string;
1729
}
1730

1731
/**
1732
 * Describes the capabilities of the current view
1733
 *
1734
 * @export
1735
 * @interface IViewerCapabilities
1736
 */
1737
export interface IViewerCapabilities {
1738
    /**
1739
     * Indicates if this viewer as a Task Pane component mounted
1740
     *
1741
     * @type {boolean}
1742
     * @memberof IViewerCapabilities
1743
     */
1744
    hasTaskPane: boolean;
1745
    /**
1746
     * Indicates if the Task Pane on this viewer has a Task Bar
1747
     *
1748
     * @type {boolean}
1749
     * @memberof IViewerCapabilities
1750
     */
1751
    hasTaskBar: boolean;
1752
    /**
1753
     * Indicates if this viewer has a status bar
1754
     *
1755
     * @type {boolean}
1756
     * @memberof IViewerCapabilities
1757
     */
1758
    hasStatusBar: boolean;
1759
    /**
1760
     * Indicates if this viewer has a zoom slider
1761
     *
1762
     * @type {boolean}
1763
     * @memberof IViewerCapabilities
1764
     */
1765
    hasNavigator: boolean;
1766
    /**
1767
     * Indicates if this viewer has a selection panel component mounted
1768
     *
1769
     * @type {boolean}
1770
     * @memberof IViewerCapabilities
1771
     */
1772
    hasSelectionPanel: boolean;
1773
    /**
1774
     * Indicates if this viewer has a legend component mounted
1775
     *
1776
     * @type {boolean}
1777
     * @memberof IViewerCapabilities
1778
     */
1779
    hasLegend: boolean;
1780
    /**
1781
     * Indicates if this viewer has a primary toolbar mounted
1782
     *
1783
     * @type {boolean}
1784
     * @memberof IViewerCapabilities
1785
     */
1786
    hasToolbar: boolean;
1787
    /**
1788
     * Indicates if this viewer has the view size mounted
1789
     * 
1790
     * @type {boolean}
1791
     * @memberof IViewerCapabilities
1792
     */
1793
    hasViewSize: boolean;
1794
}
1795

1796
/**
1797
 * Describes a name/value pair
1798
 *
1799
 * @export
1800
 * @interface INameValuePair
1801
 */
1802
export interface INameValuePair {
1803
    /**
1804
     * The name
1805
     *
1806
     * @type {string}
1807
     * @memberof INameValuePair
1808
     */
1809
    name: string;
1810
    /**
1811
     * The value
1812
     *
1813
     * @type {string}
1814
     * @memberof INameValuePair
1815
     */
1816
    value: string;
1817
}
1818

1819
/**
1820
 * Describes a redux reducer function
1821
 */
1822
export type ReducerFunction<TState> = (state: TState, action: ViewerAction) => TState;
1823

1824
/**
1825
 * Describes the reducer state branch for the current viewer template
1826
 *
1827
 * @export
1828
 * @interface ITemplateReducerState
1829
 */
1830
export interface ITemplateReducerState {
1831
    /**
1832
     * The initial width of the information pane. Only certain templates will recognise this setting
1833
     * 
1834
     * @type {number}
1835
     * @memberof ITemplateReducerState
1836
     */
1837
    initialInfoPaneWidth: number;
1838
    /**
1839
     * The initial width of the task pane. Only certain templates will recognise this setting
1840
     * 
1841
     * @type {number}
1842
     * @memberof ITemplateReducerState
1843
     */
1844
    initialTaskPaneWidth: number;
1845
    /**
1846
     * Indicates if the task pane is visible
1847
     *
1848
     * @type {boolean}
1849
     * @memberof ITemplateReducerState
1850
     */
1851
    taskPaneVisible: boolean;
1852
    /**
1853
     * Indicates if the legend is visible
1854
     *
1855
     * @type {boolean}
1856
     * @memberof ITemplateReducerState
1857
     */
1858
    legendVisible: boolean;
1859
    /**
1860
     * Indicates if the selection panel is visible
1861
     *
1862
     * @type {boolean}
1863
     * @memberof ITemplateReducerState
1864
     */
1865
    selectionPanelVisible: boolean;
1866
    /**
1867
     * If true, the selection panel will auto-display when a selection is made
1868
     * and there are results to show
1869
     * 
1870
     * @since 0.13
1871
     */
1872
    autoDisplaySelectionPanelOnSelection: boolean;
1873

1874
    /**
1875
     * Template-specific data
1876
     * @since 0.14.8
1877
     */
1878
    templateData: Dictionary<any>;
1879
}
1880

1881
/**
1882
 * Signature for a template state reducer function
1883
 * 
1884
 * @since 0.13
1885
 */
1886
export type TemplateReducerFunction = (origState: ITemplateReducerState, currentState: ITemplateReducerState, action: ViewerAction) => ITemplateReducerState;
1887

1888
/**
1889
 * Keyboard code for ESCAPE
1890
 */
1891
export const KC_ESCAPE = 27;
1✔
1892

1893
/**
1894
 * Keyboard code for the letter U
1895
 */
1896
export const KC_U = 85;
1✔
1897

1898
/**
1899
 * The positioning of the map load indicator
1900
 */
1901
export type MapLoadIndicatorPositioning = "top" | "bottom";
1902

1903
/**
1904
 * Describes the reducer state branch for various configuration properties
1905
 *
1906
 * @export
1907
 * @interface IConfigurationReducerState
1908
 */
1909
export interface IConfigurationReducerState {
1910
    /**
1911
     * The agent URI
1912
     *
1913
     * @type {(string | undefined)}
1914
     * @memberof IConfigurationReducerState
1915
     */
1916
    agentUri: string | undefined;
1917
    /**
1918
     * The type of agent
1919
     *
1920
     * @type {ClientKind}
1921
     * @memberof IConfigurationReducerState
1922
     */
1923
    agentKind: ClientKind;
1924
    /**
1925
     * The current locale
1926
     *
1927
     * @type {string}
1928
     * @memberof IConfigurationReducerState
1929
     */
1930
    locale: string;
1931
    /**
1932
     * The current active map name
1933
     *
1934
     * @type {(string | undefined)}
1935
     * @memberof IConfigurationReducerState
1936
     */
1937
    activeMapName: string | undefined;
1938
    /**
1939
     * The array of available runtime maps
1940
     *
1941
     * @type {(INameValuePair[] | undefined)}
1942
     * @memberof IConfigurationReducerState
1943
     */
1944
    availableMaps: INameValuePair[] | undefined;
1945
    /**
1946
     * Coordinate display configuration
1947
     *
1948
     * @type {ICoordinateConfiguration}
1949
     * @memberof IConfigurationReducerState
1950
     */
1951
    coordinates: ICoordinateConfiguration;
1952
    /**
1953
     * Viewer capabilities
1954
     *
1955
     * @type {IViewerCapabilities}
1956
     * @memberof IConfigurationReducerState
1957
     */
1958
    capabilities: IViewerCapabilities;
1959
    /**
1960
     * A dictionary of arbitrary app settings
1961
     * 
1962
     * @since 0.14
1963
     */
1964
    appSettings?: Dictionary<string>;
1965
    /**
1966
     * Viewer configuration
1967
     * 
1968
     * @memberof IConfigurationReducerState
1969
     */
1970
    viewer: {
1971
        /**
1972
         * Whether this viewer will use stateless MapGuide rendering operations
1973
         * 
1974
         * @since 0.14
1975
         */
1976
        isStateless: boolean;
1977
        /**
1978
         * The current image format
1979
         *
1980
         * @type {ImageFormat}
1981
         */
1982
        imageFormat: ImageFormat;
1983
        /**
1984
         * The current selection image format
1985
         *
1986
         * @type {ImageFormat}
1987
         */
1988
        selectionImageFormat: ImageFormat;
1989
        /**
1990
         * The current selection color
1991
         *
1992
         * @type {string}
1993
         */
1994
        selectionColor: string;
1995
        /**
1996
         * The color to use for highlighting active selected features
1997
         * 
1998
         * @type {string}
1999
         */
2000
        activeSelectedFeatureColor: string;
2001
        /**
2002
         * The current point selection pixel tolerance
2003
         *
2004
         * @type {number}
2005
         */
2006
        pointSelectionBuffer: number;
2007
        /**
2008
         * The position of the map loading indicator
2009
         * 
2010
         * @type {MapLoadIndicatorPositioning}
2011
         */
2012
        loadIndicatorPositioning: MapLoadIndicatorPositioning;
2013
        /**
2014
         * The color of the map loading indicator. This is an valid CSS color expression
2015
         * 
2016
         * @type {string}
2017
         */
2018
        loadIndicatorColor: string;
2019
    },
2020
    /**
2021
     * Indicates if view rotation is enabled
2022
     * 
2023
     * @type {boolean}
2024
     * @memberof IConfigurationReducerState
2025
     */
2026
    viewRotationEnabled: boolean;
2027
    /**
2028
     * The current view rotation
2029
     * 
2030
     * @type {number}
2031
     * @memberof IConfigurationReducerState
2032
     */
2033
    viewRotation: number;
2034
    /**
2035
     * The unit to display view size in
2036
     * 
2037
     * @type {UnitOfMeasure}
2038
     * @memberof IConfigurationReducerState
2039
     */
2040
    viewSizeUnits: UnitOfMeasure;
2041
    /**
2042
     * @since 0.14.2
2043
     */
2044
    selectCanDragPan: boolean;
2045
    /**
2046
     * If specified and true and the MapTip component is active, then feature tooltips are activated
2047
     * by mouse click instead of idle mouse cursor at a given point on the map for a certain period of time. 
2048
     * 
2049
     * An active MapTip component with this setting enabled will override normal click-based selection.
2050
     * 
2051
     * @type {boolean}
2052
     * @memberof IConfigurationReducerState
2053
     */
2054
    manualFeatureTooltips: boolean;
2055
    /**
2056
     * The key code to listen for cancelling an active digitization
2057
     * 
2058
     * @type {number}
2059
     * @memberof IKeyBindingConfiguration
2060
     */
2061
    cancelDigitizationKey: number;
2062
    /**
2063
     * The key code to listen for undoing the last drawn point of an active digitization
2064
     * 
2065
     * @type {number}
2066
     * @memberof IKeyBindingConfiguration
2067
     */
2068
    undoLastPointKey: number;
2069
}
2070

2071
/**
2072
 * Describes an error thrown during initialization
2073
 *
2074
 * @export
2075
 * @interface InitError
2076
 */
2077
export interface InitError {
2078
    /**
2079
     * The error message
2080
     *
2081
     * @type {string}
2082
     * @memberof InitError
2083
     */
2084
    message: string;
2085
    /**
2086
     * The error stack trace
2087
     *
2088
     * @type {string[]}
2089
     * @memberof InitError
2090
     */
2091
    stack: string[];
2092
}
2093

2094
/**
2095
 * Describes the reducer state branch for initialization errors
2096
 *
2097
 * @export
2098
 * @interface IInitErrorReducerState
2099
 */
2100
export interface IInitErrorReducerState {
2101
    /**
2102
     * The caught initialization error
2103
     *
2104
     * @type {(InitError | undefined)}
2105
     * @memberof IInitErrorReducerState
2106
     */
2107
    error: InitError | undefined;
2108
    /**
2109
     * The initialization options
2110
     *
2111
     * @type {*}
2112
     * @memberof IInitErrorReducerState
2113
     */
2114
    options: any;
2115
    /**
2116
     * Indicates if the stack trace should be shown
2117
     *
2118
     * @type {boolean}
2119
     * @memberof IInitErrorReducerState
2120
     */
2121
    includeStack: boolean;
2122
    /**
2123
     * Any warnings that were encountered during initialization
2124
     * 
2125
     * @type {string[]}
2126
     * @memberof IInitErrorReducerState
2127
     */
2128
    warnings: string[];
2129
}
2130

2131
/**
2132
 * Describes the reducer state branch for viewer state
2133
 *
2134
 * @export
2135
 * @interface IViewerReducerState
2136
 */
2137
export interface IViewerReducerState {
2138
    /**
2139
     * The current size of the map viewport (in pixels)
2140
     * 
2141
     * @type {([number, number] | undefined)}
2142
     * @memberof IViewerReducerState
2143
     */
2144
    size: [number, number] | undefined;
2145
    /**
2146
     * The number of active busy actions. Zero indicates no busy activity. One or more
2147
     * indicates busy activity.
2148
     *
2149
     * @type {number}
2150
     * @memberof IViewerReducerState
2151
     */
2152
    busyCount: number;
2153
    /**
2154
     * The active map tool
2155
     *
2156
     * @type {ActiveMapTool}
2157
     * @memberof IViewerReducerState
2158
     */
2159
    tool: ActiveMapTool;
2160
    /**
2161
     * Indicates if feature tooltips are enabled
2162
     *
2163
     * @type {boolean}
2164
     * @memberof IViewerReducerState
2165
     */
2166
    featureTooltipsEnabled: boolean;
2167
}
2168

2169
/**
2170
 * Describes the reducer state branch for tracked mouse coordinates
2171
 *
2172
 * @export
2173
 * @interface IMouseReducerState
2174
 */
2175
export interface IMouseReducerState {
2176
    /**
2177
     * The last tracked mouse coordinate
2178
     *
2179
     * @type {(Coordinate2D | undefined)}
2180
     * @memberof IMouseReducerState
2181
     */
2182
    coords: Coordinate2D | undefined;
2183
}
2184

2185
/**
2186
 * Describes the full application state tree. Redux-aware components can connect and subscribe to
2187
 * various properties and branches of this tree and be automatically notified of any changes and
2188
 * update and re-render themselves accordingly
2189
 *
2190
 * @export
2191
 * @interface IApplicationState
2192
 */
2193
export interface IApplicationState {
2194
    /**
2195
     * Initialization errors
2196
     *
2197
     * @type {Readonly<IInitErrorReducerState>}
2198
     * @memberof IApplicationState
2199
     */
2200
    initError: Readonly<IInitErrorReducerState>;
2201
    /**
2202
     * Viewer configuration
2203
     *
2204
     * @type {Readonly<IConfigurationReducerState>}
2205
     * @memberof IApplicationState
2206
     */
2207
    config: Readonly<IConfigurationReducerState>;
2208
    /**
2209
     * Current template state
2210
     *
2211
     * @type {Readonly<ITemplateReducerState>}
2212
     * @memberof IApplicationState
2213
     */
2214
    template: Readonly<ITemplateReducerState>;
2215
    /**
2216
     * Viewer state
2217
     *
2218
     * @type {Readonly<IViewerReducerState>}
2219
     * @memberof IApplicationState
2220
     */
2221
    viewer: Readonly<IViewerReducerState>;
2222
    /**
2223
     * Runtime map state
2224
     *
2225
     * @type {Readonly<IBranchedMapState>}
2226
     * @memberof IApplicationState
2227
     */
2228
    mapState: Readonly<IBranchedMapState>;
2229
    /**
2230
     * Toolbar state
2231
     *
2232
     * @type {Readonly<IToolbarReducerState>}
2233
     * @memberof IApplicationState
2234
     */
2235
    toolbar: Readonly<IToolbarReducerState>;
2236
    /**
2237
     * Task Pane component state
2238
     *
2239
     * @type {Readonly<ITaskPaneReducerState>}
2240
     * @memberof IApplicationState
2241
     */
2242
    taskpane: Readonly<ITaskPaneReducerState>;
2243
    /**
2244
     * Modal dialog state
2245
     *
2246
     * @type {Readonly<IModalReducerState>}
2247
     * @memberof IApplicationState
2248
     */
2249
    modal: Readonly<IModalReducerState>;
2250
    /**
2251
     * Tracked mouse coordinate state
2252
     *
2253
     * @type {Readonly<IMouseReducerState>}
2254
     * @memberof IApplicationState
2255
     */
2256
    mouse: Readonly<IMouseReducerState>;
2257
    /**
2258
     * Tracks the last dispatched action
2259
     *
2260
     * @type {*}
2261
     * @memberof IApplicationState
2262
     */
2263
    lastaction: any;
2264
}
2265

2266
// Redux typedefs to tighten up our redux code
2267

2268
/**
2269
 * Describes the redux store
2270
 *
2271
 * @export
2272
 * @interface ReduxStore
2273
 */
2274
export interface ReduxStore {
2275
    /**
2276
     * Gets the application state
2277
     *
2278
     * @returns {Readonly<IApplicationState>}
2279
     *
2280
     * @memberof ReduxStore
2281
     */
2282
    getState(): Readonly<IApplicationState>;
2283
}
2284

2285
/**
2286
 * Describes a thunked redux action. Thunked redux actions are generally used for actions that push state
2287
 * asynchronously (eg. In response to an AJAX request)
2288
 */
2289
export type ReduxThunkedAction = (dispatch: ReduxDispatch, getState: () => Readonly<IApplicationState>) => any;
2290

2291
/**
2292
 * Describes a redux dispatcher function. A redux dispatch pushes new state to the redux store
2293
 */
2294
export type ReduxDispatch = (action: ViewerAction | ReduxThunkedAction) => void;
2295

2296
/**
2297
 * A function that does nothing
2298
 *
2299
 * @export
2300
 */
2301
export function NOOP() { }
1✔
2302

2303
/**
2304
 * A function that always returns false
2305
 *
2306
 * @export
2307
 * @returns false
2308
 */
2309
export function ALWAYS_FALSE() { return false; }
1✔
2310

2311
/**
2312
 * A function that always returns true
2313
 *
2314
 * @export
2315
 * @returns true
2316
 */
2317
export function ALWAYS_TRUE() { return true; }
1✔
2318

2319
/**
2320
 * Describe the size/dimensions of a DOM element in a toolbar or flyout menu
2321
 *
2322
 * @export
2323
 * @interface IDOMElementMetrics
2324
 */
2325
export interface IDOMElementMetrics {
2326
    /**
2327
     * The X position of this element
2328
     *
2329
     * @type {number}
2330
     * @memberof IDOMElementMetrics
2331
     */
2332
    posX: number;
2333
    /**
2334
     * The Y position of this element
2335
     *
2336
     * @type {number}
2337
     * @memberof IDOMElementMetrics
2338
     */
2339
    posY: number;
2340
    /**
2341
     * The width of this element
2342
     *
2343
     * @type {number}
2344
     * @memberof IDOMElementMetrics
2345
     */
2346
    width: number;
2347
    /**
2348
     * The height of this element
2349
     *
2350
     * @type {number}
2351
     * @memberof IDOMElementMetrics
2352
     */
2353
    height: number;
2354
    /**
2355
     * Indicates of this toolbar is vertically-oriented
2356
     *
2357
     * @type {boolean}
2358
     * @memberof IDOMElementMetrics
2359
     */
2360
    vertical?: boolean;
2361
}
2362

2363
/**
2364
 * Helper function to get the initial map view from the application state
2365
 *
2366
 * @export
2367
 * @param {Readonly<IApplicationState>} state
2368
 * @returns {(IMapView | undefined)}
2369
 */
2370
export function getInitialView(state: Readonly<IApplicationState>): IMapView | undefined {
1✔
2371
    if (state.config.activeMapName) {
×
2372
        return state.mapState[state.config.activeMapName].initialView;
×
UNCOV
2373
    }
×
2374
    return undefined;
×
UNCOV
2375
}
×
2376

2377
/**
2378
 * Helper function to get the mapguide-specific sub state of the current map group
2379
 *
2380
 * @export
2381
 * @param {Readonly<IApplicationState>} state
2382
 * @returns {(IMapGuideSubState | undefined)}
2383
 * @since 0.14
2384
 */
2385
export function getMapGuideSubState(state: Readonly<IApplicationState>): IMapGuideSubState | undefined {
1✔
2386
    if (state.config.activeMapName) {
23✔
2387
        return state.mapState[state.config.activeMapName].mapguide;
10✔
2388
    }
10✔
2389
    return undefined;
13✔
2390
}
13✔
2391

2392
/**
2393
 * Helper function to get the current selection set from the application state
2394
 *
2395
 * @export
2396
 * @param {Readonly<IApplicationState>} state
2397
 * @returns {(QueryMapFeaturesResponse | undefined)}
2398
 */
2399
export function getSelectionSet(state: Readonly<IApplicationState>): QueryMapFeaturesResponse | undefined {
1✔
2400
    return getMapGuideSubState(state)?.selectionSet;
23✔
2401
}
23✔
2402

2403
/**
2404
 * Helper function to get the current runtime map state from the application state
2405
 *
2406
 * @export
2407
 * @param {Readonly<IApplicationState>} state
2408
 * @returns {(RuntimeMap | undefined)}
2409
 */
2410
export function getRuntimeMap(state: Readonly<IApplicationState>): RuntimeMap | undefined {
1✔
2411
    return getMapGuideSubState(state)?.runtimeMap;
×
UNCOV
2412
}
×
2413

2414
/**
2415
 * Helper function to get the current view from the application state
2416
 *
2417
 * @export
2418
 * @param {Readonly<IApplicationState>} state
2419
 * @returns {(IMapView | undefined)}
2420
 */
2421
export function getCurrentView(state: Readonly<IApplicationState>): IMapView | undefined {
1✔
2422
    if (state.config.activeMapName) {
×
2423
        return state.mapState[state.config.activeMapName].currentView;
×
UNCOV
2424
    }
×
2425
    return undefined;
×
UNCOV
2426
}
×
2427

2428
/**
2429
 * Determines if the given external base layer is one with a visual representation
2430
 * 
2431
 * @param layer 
2432
 * @returns 
2433
 * @since 0.14.9
2434
 */
2435
export function isVisualBaseLayer(layer: IExternalBaseLayer) {
1✔
2436
    return layer.kind != "UTFGrid";
4✔
2437
}
4✔
2438

2439
/**
2440
 * Helper function to get the current set of available external base layers from the application state
2441
 *
2442
 * @remarks This does not include "non-visual" base layers such as UTFGrid tilesets
2443
 * 
2444
 * @export
2445
 * @param {Readonly<IApplicationState>} state
2446
 * @returns {(IExternalBaseLayer[] | undefined)}
2447
 * 
2448
 * @since 0.14.9 Removed includeNonVisual parameter
2449
 */
2450
export function getExternalBaseLayers(state: Readonly<IApplicationState>): IExternalBaseLayer[] | undefined {
1✔
2451
    if (state.config.activeMapName) {
×
2452
        return state.mapState[state.config.activeMapName].externalBaseLayers;
×
UNCOV
2453
    }
×
2454
    return undefined;
×
UNCOV
2455
}
×
2456

2457
/**
2458
 * Defines the visibility of flyout menus
2459
 */
2460
export type FlyoutVisibilitySet = { [flyoutId: string]: boolean | undefined };
2461

2462
/**
2463
 * Defines the capabilities of a WMS service
2464
 * 
2465
 * @since 0.11
2466
 */
2467
export interface WmsCapabilitiesDocument {
2468
    /**
2469
     * WMS service version
2470
     * 
2471
     * @type {string}
2472
     * @memberof WmsCapabilitiesDocument
2473
     */
2474
    version: string;
2475
    Service: WMSServiceDescription;
2476
    Capability: WMSServiceCapabilities;
2477
}
2478

2479
/**
2480
 * @since 0.11
2481
 */
2482
export interface WMSServiceCapabilities {
2483
    Request: any;
2484
    Exception: string[];
2485
    Layer: WMSRootPublishedLayer;
2486
}
2487

2488
/**
2489
 * @since 0.12
2490
 */
2491
export interface WMSLayerBoundingBox {
2492
    crs: string;
2493
    extent: [number, number, number, number],
2494
    res: [any, any]
2495
}
2496

2497
/**
2498
 * @since 0.11
2499
 */
2500
export interface WMSPublishedLayer {
2501
    Name: string;
2502
    Title: string;
2503
    Abstract: string;
2504
    KeywordList: string;
2505
    CRS: string[];
2506
    EX_GeographicBoundingBox: [number, number, number, number];
2507
    BoundingBox: WMSLayerBoundingBox[];
2508
    Style: WMSLayerStyle[];
2509
    queryable: boolean;
2510
    opaque: boolean;
2511
    noSubsets: boolean;
2512
}
2513

2514
/**
2515
 * @since 0.11
2516
 */
2517
export interface WMSRootPublishedLayer extends WMSPublishedLayer {
2518
    Layer: WMSPublishedLayer[];
2519
}
2520

2521
/**
2522
 * @since 0.12
2523
 */
2524
export interface WMSLegendURLDefinition {
2525
    Format: string;
2526
    OnlineResource: string;
2527
    size: [number, number];
2528
}
2529

2530
/**
2531
 * @since 0.11
2532
 */
2533
export interface WMSLayerStyle {
2534
    Name: string;
2535
    Title: string;
2536
    Abstract: string;
2537
    LegendURL: WMSLegendURLDefinition[];
2538
}
2539

2540
/**
2541
 * @since 0.12
2542
 */
2543
export interface WMSContactAddress {
2544
    AddressType: string,
2545
    Address: string,
2546
    City: string,
2547
    StateOrProvince: string,
2548
    PostCode: string,
2549
    Country: string
2550
}
2551

2552
/**
2553
 * @since 0.12
2554
 */
2555
export interface WMSContact {
2556
    ContactPerson: string;
2557
    ContactOrganization: string;
2558
}
2559

2560
/**
2561
 * @since 0.12
2562
 */
2563
export interface WMSContactInformation {
2564
    ContactPersonPrimary: WMSContact,
2565
    ContactPosition: string,
2566
    ContactAddress: WMSContactAddress,
2567
    ContactVoiceTelephone: string,
2568
    ContactFacsimileTelephone: string,
2569
    ContactElectronicMailAddress: string
2570
}
2571

2572
/**
2573
 * @since 0.11
2574
 */
2575
export interface WMSServiceDescription {
2576
    Name: string;
2577
    Title: string;
2578
    Abstract: string;
2579
    KeywordList: string[];
2580
    OnlineResource: string;
2581
    ContactInformation: WMSContactInformation,
2582
    Fees: string;
2583
    AccessConstraints: string;
2584
}
2585

2586
export interface IMapGuideImageSource {
2587
    on(event: string, handler: Function): void;
2588
    updateParams(params: any): void;
2589
}
2590

2591
/**
2592
 * Custom properties that can be attached to OpenLayers layer instances
2593
 * 
2594
 * @since 0.13
2595
 */
2596
export enum LayerProperty {
1✔
2597
    LAYER_TYPE = "layer_type",
1✔
2598
    LAYER_NAME = "name",
1✔
2599
    /**
2600
     * @since 0.14
2601
     */
2602
    LAYER_DISPLAY_NAME = "display_name",
1✔
2603
    IS_GROUP = "is_group",
1✔
2604
    IS_EXTERNAL = "is_external",
1✔
2605
    IS_SELECTABLE = "is_selectable",
1✔
2606
    /**
2607
     * @since 0.14.5
2608
     */
2609
    DISABLE_HOVER = "disable_hover",
1✔
2610
    IS_SCRATCH = "is_scratch",
1✔
2611
    HAS_WMS_LEGEND = "has_wms_legend",
1✔
2612
    VECTOR_STYLE = "vector_style",
1✔
2613
    WGS84_BBOX = "wgs84_bbox",
1✔
2614
    BUSY_WORKER_COUNT = "busy_worker_count",
1✔
2615
    /**
2616
     * @since 0.14
2617
     */
2618
    SELECTED_POPUP_CONFIGURATION = "popup_config",
1✔
2619
    /**
2620
     * @since 0.14
2621
     */
2622
    LAYER_DESCRIPTION = "layer_description",
1✔
2623
    /**
2624
     * @since 0.14
2625
     */
2626
    LAYER_METADATA = "layer_metadata",
1✔
2627
    /**
2628
     * @since 0.14
2629
     */
2630
    IS_HOVER_HIGHLIGHT = "is_hover_highlight",
1✔
2631
    /**
2632
     * @since 0.14
2633
     */
2634
    IS_MEASURE = "is_measure",
1✔
2635
    /**
2636
     * @since 0.14
2637
     */
2638
    IS_WMS_SELECTION_OVERLAY = "is_wms_selection_overlay",
1✔
2639
    /**
2640
     * @since 0.14
2641
     */
2642
    IS_HEATMAP = "is_heatmap",
1✔
2643
    /**
2644
     * A source definition to attach to the layer. This is to assist in persistence of this layer for easy
2645
     * restoration on an application-defined basis
2646
     * 
2647
     * @since 0.14.3
2648
     */
2649
    LAYER_DEFN = "layer_defn"
1✔
2650
}
2651

2652
/**
2653
 * Custom properties that can be attached to OpenLayers image source instances
2654
 * 
2655
 * @since 0.13
2656
 */
2657
export enum SourceProperty {
1✔
2658
    SUPPRESS_LOAD_EVENTS = "suppress_load_events"
1✔
2659
}
2660

2661
/**
2662
 * MapGuide layer types
2663
 * 
2664
 * @since 0.13
2665
 */
2666
export enum MgLayerType {
1✔
2667
    Untiled = "MapGuide_Untiled",
1✔
2668
    Tiled = "MapGuide_Tiled"
1✔
2669
}
2670

2671
/**
2672
 * The type name for a MapGuide layer
2673
 * 
2674
 * @since 0.13
2675
 */
2676
export const MG_LAYER_TYPE_NAME = "MapGuide";
1✔
2677

2678
/**
2679
 * The default group name for MapGuide tiled layers. This value
2680
 * is not meant for localized display
2681
 * 
2682
 * @since 0.13
2683
 */
2684
export const MG_BASE_LAYER_GROUP_NAME = "Base Tile Layers";
1✔
2685

2686
/**
2687
 * Default names for MapGuide built-in layer types. These value
2688
 * are not meant for localized display
2689
 * 
2690
 * @since 0.13
2691
 */
2692
export enum MgBuiltInLayers {
1✔
2693
    Overlay = "MapGuide Dynamic Overlay",
1✔
2694
    SelectionOverlay = "MapGuide Selection Overlay",
1✔
2695
    ActiveFeatureSelectionOverlay = "MapGuide Active Feature Selection Overlay"
1✔
2696
}
2697

2698
/**
2699
 * A layer of a {@link ICompositeSelection}
2700
 * 
2701
 * @since 0.14
2702
 */
2703
export interface ICompositeSelectionLayer {
2704
    /**
2705
     * The id of this selection layer
2706
     */
2707
    getLayerId(): string | undefined;
2708
    /**
2709
     * The name of this layer
2710
     */
2711
    getName(): string;
2712
    /**
2713
     * The metadata of this layer
2714
     */
2715
    getLayerMetadata(): LayerMetadata | undefined;
2716
    /**
2717
     * Gets the feature at the given index
2718
     */
2719
    getFeatureAt(featureIndex: number): SelectedFeature;
2720
    /**
2721
     * Gets the total number of features in this layer
2722
     */
2723
    getFeatureCount(): number;
2724
}
2725

2726
/**
2727
 * A composition of a MapGuide selection set and a client-side vector feature selection
2728
 * 
2729
 * @since 0.14
2730
 */
2731
export interface ICompositeSelection {
2732
    /**
2733
     * Gets the number of layers in this selection set
2734
     */
2735
    getLayerCount(): number;
2736
    /**
2737
     * Gets the array of layers in this selection set
2738
     */
2739
    getLayers(): ICompositeSelectionLayer[];
2740
    /**
2741
     * Gets the layer at the specified index
2742
     * 
2743
     * @param layerIndex The selection layer index
2744
     */
2745
    getLayerAt(layerIndex: number): ICompositeSelectionLayer | undefined;
2746
    /**
2747
     * Gets the feature for the given layer at the specified indices
2748
     * 
2749
     * @param layerIndex The selection layer index
2750
     * @param featureIndex The feature index
2751
     */
2752
    getFeatureAt(layerIndex: number, featureIndex: number): SelectedFeature | undefined;
2753
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc