forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenlayers.d.ts
3450 lines (2784 loc) · 117 KB
/
openlayers.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for OpenLayers v3.6.0
// Project: http://openlayers.org/
// Definitions by: Wouter Goedhart <https://github.com/woutergd>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module olx {
interface AttributionOptions {
/** HTML markup for this attribution. */
html: string;
}
interface DeviceOrientationOptions {
/**
* Start tracking. Default is false.
*/
tracking?: boolean;
}
interface FrameState {
/**
*
*/
pixelRatio: number;
/**
*
*/
time: number;
/**
*
*/
viewState: olx.ViewState;
}
interface FeatureOverlayOptions {
/**
* Features
*/
features?: Array<ol.Feature> | ol.Collection<ol.Feature> | ol.style.StyleFunction;
/**
* Map
*/
map: ol.Map;
/**
* Style
*/
style: ol.style.Style | Array<ol.style.Style>;
}
interface GeolocationOptions {
/**
* Start Tracking. Default is false.
*/
tracking?: boolean;
/**
* Tracking options. See http://www.w3.org/TR/geolocation-API/#position_options_interface.
*/
trackingOptions?: PositionOptions;
/**
* The projection the position is reported in.
*/
projection?: ol.proj.ProjectionLike | ol.proj.Projection;
}
interface GraticuleOptions {
/** Reference to an ol.Map object. */
map?: ol.Map;
/** The maximum number of meridians and parallels from the center of the map. The default value is 100, which means that at most 200 meridians and 200 parallels will be displayed. The default value is appropriate for conformal projections like Spherical Mercator. If you increase the value more lines will be drawn and the drawing performance will decrease. */
maxLines?: number;
/** The stroke style to use for drawing the graticule. If not provided, the lines will be drawn with rgba(0,0,0,0.2), a not fully opaque black. */
strokeStyle?: ol.style.Stroke;
/** The target size of the graticule cells, in pixels. Default value is 100 pixels. */
targetSize?: number;
}
interface MapOptions {
/** Controls initially added to the map. If not specified, ol.control.defaults() is used. */
controls?: any;
/** The ratio between physical pixels and device-independent pixels (dips) on the device. If undefined then it gets set by using window.devicePixelRatio. */
pixelRatio?: number;
/** Interactions that are initially added to the map. If not specified, ol.interaction.defaults() is used. */
interactions?: any;
/** The element to listen to keyboard events on. This determines when the KeyboardPan and KeyboardZoom interactions trigger. For example, if this option is set to document the keyboard interactions will always trigger. If this option is not specified, the element the library listens to keyboard events on is the map target (i.e. the user-provided div for the map). If this is not document the target element needs to be focused for key events to be emitted, requiring that the target element has a tabindex attribute. */
keyboardEventTarget?: any;
/** Layers. If this is not defined, a map with no layers will be rendered. Note that layers are rendered in the order supplied, so if you want, for example, a vector layer to appear on top of a tile layer, it must come after the tile layer. */
layers?: Array<any>
/** When set to true, tiles will be loaded during animations. This may improve the user experience, but can also make animations stutter on devices with slow memory. Default is false. */
loadTilesWhileAnimating?: boolean;
/** When set to true, tiles will be loaded while interacting with the map. This may improve the user experience, but can also make map panning and zooming choppy on devices with slow memory. Default is false. */
loadTilesWhileInteracting?: boolean;
/** The map logo. A logo to be displayed on the map at all times. If a string is provided, it will be set as the image source of the logo. If an object is provided, the src property should be the URL for an image and the href property should be a URL for creating a link. To disable the map logo, set the option to false. By default, the OpenLayers 3 logo is shown. */
logo?: any;
/** Overlays initially added to the map. By default, no overlays are added. */
overlays?: any;
/** Renderer. By default, Canvas, DOM and WebGL renderers are tested for support in that order, and the first supported used. Specify a ol.RendererType here to use a specific renderer. Note that at present only the Canvas renderer supports vector data. */
renderer?: any;
/** The container for the map, either the element itself or the id of the element. If not specified at construction time, ol.Map#setTarget must be called for the map to be rendered. */
target?: any;
/** The map's view. No layer sources will be fetched unless this is specified at construction time or through ol.Map#setView. */
view?: ViewOptions;
}
interface OverlayOptions {
/**
* The overlay element.
*/
element?: Element;
/**
* Offsets in pixels used when positioning the overlay. The fist element in the array is the horizontal offset. A positive value shifts the overlay right. The second element in the array is the vertical offset. A positive value shifts the overlay down. Default is [0, 0].
*/
offset?: Array<number>;
/**
* The overlay position in map projection.
*/
position?: ol.Coordinate;
/**
* Defines how the overlay is actually positioned with respect to its position property. Possible values are 'bottom-left', 'bottom-center', 'bottom-right', 'center-left', 'center-center', 'center-right', 'top-left', 'top-center', and 'top-right'. Default is 'top-left'.
*/
positioning?: ol.OverlayPositioning;
/**
* Whether event propagation to the map viewport should be stopped. Default is true. If true the overlay is placed in the same container as that of the controls (CSS class name ol-overlaycontainer-stopevent); if false it is placed in the container with CSS class name ol-overlaycontainer.
*/
stopEvent?: boolean;
/**
* Whether the overlay is inserted first in the overlay container, or appended. Default is true. If the overlay is placed in the same container as that of the controls (see the stopEvent option) you will probably set insertFirst to true so the overlay is displayed below the controls.
*/
insertFirst?: boolean;
/**
* If set to true the map is panned when calling setPosition, so that the overlay is entirely visible in the current viewport. The default is false.
*/
autoPan?: boolean;
/**
* The options used to create a ol.animation.pan animation. This animation is only used when autoPan is enabled. By default the default options for ol.animation.pan are used. If set to null the panning is not animated.
*/
autoPanAnimation?: olx.animation.PanOptions;
/**
* The margin (in pixels) between the overlay and the borders of the map when autopanning. The default is 20.
*/
autoPanMargin?: number;
}
interface ViewOptions {
/** The initial center for the view. The coordinate system for the center is specified with the projection option. Default is undefined, and layer sources will not be fetched if this is not set. */
center?: ol.Coordinate;
/** Rotation constraint. false means no constraint. true means no constraint, but snap to zero near zero. A number constrains the rotation to that number of values. For example, 4 will constrain the rotation to 0, 90, 180, and 270 degrees. The default is true. */
constrainRotation?: boolean;
/** Enable rotation. Default is true. If false a rotation constraint that always sets the rotation to zero is used. The constrainRotation option has no effect if enableRotation is false. */
enableRotation?: boolean;
/**The extent that constrains the center, in other words, center cannot be set outside this extent. Default is undefined. */
extent?: ol.Extent;
/** The maximum resolution used to determine the resolution constraint. It is used together with minResolution (or maxZoom) and zoomFactor. If unspecified it is calculated in such a way that the projection's validity extent fits in a 256x256 px tile. If the projection is Spherical Mercator (the default) then maxResolution defaults to 40075016.68557849 / 256 = 156543.03392804097. */
maxResolution?: number;
/** The minimum resolution used to determine the resolution constraint. It is used together with maxResolution (or minZoom) and zoomFactor. If unspecified it is calculated assuming 29 zoom levels (with a factor of 2). If the projection is Spherical Mercator (the default) then minResolution defaults to 40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253. */
minResolution?: number;
/** The maximum zoom level used to determine the resolution constraint. It is used together with minZoom (or maxResolution) and zoomFactor. Default is 28. Note that if minResolution is also provided, it is given precedence over maxZoom. */
maxZoom?: number;
/** The minimum zoom level used to determine the resolution constraint. It is used together with maxZoom (or minResolution) and zoomFactor. Default is 0. Note that if maxResolution is also provided, it is given precedence over minZoom. */
minZoom?: number;
/** The projection. Default is EPSG:3857 (Spherical Mercator). */
projection?: ol.proj.ProjectionLike | ol.proj.Projection;
/** The initial resolution for the view. The units are projection units per pixel (e.g. meters per pixel). An alternative to setting this is to set zoom. Default is undefined, and layer sources will not be fetched if neither this nor zoom are defined. */
resolution?: number;
/** Resolutions to determine the resolution constraint. If set the maxResolution, minResolution, minZoom, maxZoom, and zoomFactor options are ignored. */
resolutions?: Array<number>;
/** The initial rotation for the view in radians (positive rotation clockwise). Default is 0. */
rotation?: number;
/** Only used if resolution is not defined. Zoom level used to calculate the initial resolution for the view. The initial resolution is determined using the ol.View#constrainResolution method. */
zoom?: number;
/** The zoom factor used to determine the resolution constraint. Default is 2. */
zoomFactor?: number;
}
interface ViewState {
/**
*
*/
center: ol.Coordinate;
/**
*
*/
projection: ol.proj.Projection;
/**
*
*/
resolution: number;
/**
*
*/
rotation: number;
}
module animation {
interface BounceOptions {
/**
* The resolution to start the bounce from, typically map.getView().getResolution().
*/
resolution: number;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number;
}
interface PanOptions {
/**
* The resolution to start the bounce from, typically map.getView().getResolution().
*/
source: ol.Coordinate;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number;
}
interface RotateOptions {
/**
* The rotation value (in radians) to begin rotating from, typically map.getView().getRotation(). If undefined then 0 is assumed.
*/
rotation?: number;
/**
* The rotation center/anchor. The map rotates around the center of the view if unspecified.
*/
anchor?: ol.Coordinate;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number
}
interface ZoomOptions {
/**
* The resolution to begin zooming from, typically map.getView().getResolution().
*/
resolution: number;
/**
* The start time of the animation. Default is immediately.
*/
start?: number;
/**
* The duration of the animation in milliseconds. Default is 1000.
*/
duration?: number;
/**
* The easing function to use. Can be an ol.easing or a custom function. Default is ol.easing.upAndDown.
*/
easing?: (t: number) => number
}
}
module control {
interface DefaultsOptions {
/**
* Attribution. Default is true.
*/
attribution?: boolean;
/**
* Attribution options.
*/
//TODO: Replace with olx.control.AttributionOptions
attributionOptions?: any;
/**
* Rotate. Default is true;
*/
rotate?: boolean;
/**
* Rotate options
*/
//TODO: Replace with olx.control.RotateOptions
rotateOptions?: any;
/**
* Zoom. Default is true
*/
zoom?: boolean;
/**
*
*/
//TODO: Replace with olx.control.ZoomOptions
zoomOptions?: any;
}
}
module layer {
interface BaseOptions {
/**
* Brightness. Default is 0.
*/
brightness?: number;
/**
* Contrast. Default is 1.
*/
contrast?: number;
/**
* Hue. Default is 0.
*/
hue?: number;
/**
* Opacity (0, 1). Default is 1.
*/
opacity?: number;
/**
* Saturation. Default is 1.
*/
saturation?: number;
/**
* Visibility. Default is true.
*/
visible?: boolean;
/**
* The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
*/
extent?: ol.Extent;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
*/
minResolution?: number;
/**
* The maximum resolution (exclusive) below which this layer will be visible.
*/
maxResolution?: number;
}
interface GroupOptions extends BaseOptions {
/**
* Child layers
*/
layers?: Array<ol.layer.Base> | ol.Collection<ol.layer.Base>;
}
interface HeatmapOptions extends VectorOptions {
/**
* The color gradient of the heatmap, specified as an array of CSS color strings. Default is ['#00f', '#0ff', '#0f0', '#ff0', '#f00'].
*/
gradient?: Array<String>;
/**
* Radius size in pixels. Default is 8.
*/
radius?: number;
/**
* Blur size in pixels. Default is 15.
*/
blur?: number;
/**
* Shadow size in pixels. Default is 250.
*/
shadow?: number;
}
interface ImageOptions extends LayerOptions {
}
interface LayerOptions extends BaseOptions {
/**
* The layer source (or null if not yet set).
*/
source?: ol.source.Source;
}
interface TileOptions extends LayerOptions {
/**
* Preload. Load low-resolution tiles up to preload levels. By default preload is 0, which means no preloading.
*/
preload?: number;
/**
* Source for this layer.
*/
source?: ol.source.Tile;
/**
* Use interim tiles on error. Default is true.
*/
useInterimTilesOnError?: boolean;
}
interface VectorOptions extends LayerOptions {
/**
* When set to true, feature batches will be recreated during animations. This means that no vectors will be shown clipped, but the setting will have a performance impact for large amounts of vector data. When set to false, batches will be recreated when no animation is active. Default is false.
*/
updateWhileAnimating?: boolean;
/**
* When set to true, feature batches will be recreated during interactions. See also updateWhileInteracting. Default is false.
*/
updateWhileInteracting?: boolean;
/**
* Render order. Function to be used when sorting features before rendering. By default features are drawn in the order that they are created. Use null to avoid the sort, but get an undefined draw order.
*/
// TODO: replace any with the expected function, unclear in documentation what the parameters are
renderOrder?: any;
/**
* The buffer around the viewport extent used by the renderer when getting features from the vector source for the rendering or hit-detection. Recommended value: the size of the largest symbol, line width or label. Default is 100 pixels.
*/
renderBuffer?: number;
/**
* Source.
*/
source?: ol.source.Vector;
/**
* Layer style. See ol.style for default style which will be used if this is not defined.
*/
style?: ol.style.Style | Array<ol.style.Style> | any;
}
}
module tilegrid {
interface TileGridOptions {
/**
* Extent for the tile grid. No tiles outside this extent will be requested by ol.source.Tile sources. When no origin or origins are configured, the origin will be set to the bottom-left corner of the extent. When no sizes are configured, they will be calculated from the extent.
*/
extent?: ol.Extent;
/**
* Minimum zoom. Default is 0.
*/
minZoom?: number;
/**
* Origin, i.e. the bottom-left corner of the grid. Default is null.
*/
origin?: ol.Coordinate;
/**
* Origins, i.e. the bottom-left corners of the grid for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin.
*/
origins?: Array<ol.Coordinate>;
/**
* Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1.
*/
resolutions?: Array<number>;
/**
* Tile size. Default is [256, 256].
*/
tileSize?: number | ol.Size;
/**
* Tile sizes. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different tile size.
*/
tileSizes?: Array<number | ol.Size>;
}
interface WMTSOptions {
/**
* Extent for the tile grid. No tiles outside this extent will be requested by ol.source.WMTS sources. When no origin or origins are configured, the origin will be calculated from the extent. When no sizes are configured, they will be calculated from the extent.
*/
extent?: ol.Extent;
/**
* Origin, i.e. the top-left corner of the grid.
*/
origin?: ol.Coordinate;
/**
* Origins, i.e. the top-left corners of the grid for each zoom level. The length of this array needs to match the length of the resolutions array.
*/
origins?: Array<ol.Coordinate>;
/**
* Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1
*/
resolutions?: Array<number>;
/**
* matrix IDs. The length of this array needs to match the length of the resolutions array.
*/
matrixIds?: Array<string>;
/**
* Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define the grid's extent together with the origin. An extent can be configured in addition, and will further limit the extent for which tile requests are made by sources.
*/
sizes?: Array<ol.Size>;
/**
* Tile size.
*/
tileSize?: number | ol.Size;
/**
* Tile sizes. The length of this array needs to match the length of the resolutions array.
*/
tileSizes?: Array<number | ol.Size>;
/**
* Number of tile columns that cover the grid's extent for each zoom level. Only required when used with a source that has wrapX set to true, and only when the grid's origin differs from the one of the projection's extent. The array length has to match the length of the resolutions array, i.e. each resolution will have a matching entry here.
*/
widths?: Array<number>;
}
interface XYZOptions {
/**
* Extent for the tile grid. The origin for an XYZ tile grid is the top-left corner of the extent. The zero level of the grid is defined by the resolution at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used.
*/
extent?: ol.Extent;
/**
* Maximum zoom. The default is ol.DEFAULT_MAX_ZOOM. This determines the number of levels in the grid set. For example, a maxZoom of 21 means there are 22 levels in the grid set.
*/
maxZoom?: number;
/**
* Minimum zoom. Default is 0.
*/
minZoom?: number;
/**
* Tile size in pixels. Default is [256, 256].
*/
tileSize?: number | ol.Size;
}
interface ZoomifyOptions {
/**
* Resolutions
*/
resolutions: Array<number>;
}
}
module view {
interface FitGeometryOptions {
/**
* Padding (in pixels) to be cleared inside the view. Values in the array are top, right, bottom and left padding. Default is [0, 0, 0, 0].
*/
padding?: Array<number>;
/**
* Constrain the resolution. Default is true.
*/
constrainResolution?: boolean;
/**
* Get the nearest extent. Default is false.
*/
nearest?: boolean;
/**
* Minimum resolution that we zoom to. Default is 0.
*/
minResolution?: number;
/**
* Maximum zoom level that we zoom to. If minResolution is given, this property is ignored.
*/
maxZoom?: number;
}
}
module format {
interface GeoJSONOptions {
/**
* Default data projection.
*/
defaultDataProjection?: ol.proj.ProjectionLike | ol.proj.Projection;
/**
* Geometry name to use when creating features
*/
geometryName?: string;
}
interface ReadOptions {
/**
* Projection of the data we are reading. If not provided, the projection will be derived from the data (where possible) or the defaultDataProjection of the format is assigned (where set). If the projection can not be derived from the data and if no defaultDataProjection is set for a format, the features will not be reprojected.
*/
dataProjection?: ol.proj.ProjectionLike | ol.proj.Projection;
/**
* Projection of the feature geometries created by the format reader. If not provided, features will be returned in the dataProjection.
*/
featureProjection?: ol.proj.ProjectionLike | ol.proj.Projection;
}
interface WriteOptions {
/**
* Projection of the data we are writing. If not provided, the defaultDataProjection of the format is assigned (where set). If no defaultDataProjection is set for a format, the features will be returned in the featureProjection.
*/
dataProjection?: ol.proj.ProjectionLike | ol.proj.Projection;
/**
* Projection of the feature geometries that will be serialized by the format writer.
*/
featureProjection?: ol.proj.ProjectionLike | ol.proj.Projection;
/**
* When writing geometries, follow the right-hand rule for linear ring orientation. This means that polygons will have counter-clockwise exterior rings and clockwise interior rings. By default, coordinates are serialized as they are provided at construction. If true, the right-hand rule will be applied. If false, the left-hand rule will be applied (clockwise for exterior and counter-clockwise for interior rings). Note that not all formats support this. The GeoJSON format does use this property when writing geometries.
*/
rightHanded?: boolean;
}
}
}
/**
* A high-performance, feature-packed library for all your mapping needs.
*/
declare module ol {
/**
* An attribution for a layer source.
*/
class Attribution {
/**
* @constructor
* @param options Attribution options.
*/
constructor(options: olx.AttributionOptions);
/**
* Get the attribution markup.
* @returns The attribution HTML.
*/
getHTML(): string;
}
/**
* An expanded version of standard JS Array, adding convenience methods for manipulation. Add and remove changes to the Collection trigger a Collection event. Note that this does not cover changes to the objects within the Collection; they trigger events on the appropriate object, not on the Collection as a whole.
*/
class Collection<T> extends ol.Object {
/**
* @constructor
* @param values Array.
*/
constructor(values: Array<T>)
/**
* Remove all elements from the collection.
*/
clear(): void;
/**
* Add elements to the collection. This pushes each item in the provided array to the end of the collection.
* @param arr Array.
* @returns This collection.
*/
extend(arr: Array<T>): Collection<T>;
/**
* Iterate over each element, calling the provided callback.
* @param f The function to call for every element. This function takes 3 arguments (the element, the index and the array).
* @param ref The object to use as this in f.
*/
forEach(f: (element: T, index: number, array: Array<T>) => void, ref?: any): void;
/**
* Get a reference to the underlying Array object. Warning: if the array is mutated, no events will be dispatched by the collection, and the collection's "length" property won't be in sync with the actual length of the array.
* @returns Array.
*/
getArray(): Array<T>;
/**
* Get the length of this collection.
* @returns The length of the array.
*/
getLength(): number;
/**
* Insert an element at the provided index.
* @param index Index.
* @param elem Element.
*/
insertAt(index: number, elem: T): void;
/**
* Get the element at the provided index.
* @param index Index.
* @returns Element.
*/
item(index: number): T;
/**
* Remove the last element of the collection and return it. Return undefined if the collection is empty.
* @returns Element
*/
pop(): T;
/**
* Insert the provided element at the end of the collection.
* @param Element.
* @returns Length.
*/
push(elem: T): number;
/**
* Remove the first occurrence of an element from the collection.
* @param elem Element.
* @returns The removed element or undefined if none found.
*/
remove(elem: T): T;
/**
* Remove the element at the provided index and return it. Return undefined if the collection does not contain this index.
* @param index Index.
* @returns Value.
*/
removeAt(index: number): T;
/**
* Set the element at the provided index.
* @param index Index.
* @param elem Element.
*/
setAt(index: number, elem: T): void;
}
/**
* Events emitted by ol.Collection instances are instances of this type.
*/
class CollectionEvent<T> {
/**
* The element that is added to or removed from the collection.
*/
element: T;
}
/**
* The ol.DeviceOrientation class provides access to information from DeviceOrientation events.
*/
class DeviceOrientation extends ol.Object {
/**
* @constructor
* @param options Options.
*/
constructor(options?: olx.DeviceOrientationOptions);
/**
* Rotation around the device z-axis (in radians).
* @returns The euler angle in radians of the device from the standard Z axis.
*/
getAlpha(): number;
/**
* Rotation around the device x-axis (in radians).
* @returns The euler angle in radians of the device from the planar X axis.
*/
getBeta(): number;
/**
* Rotation around the device y-axis (in radians).
* @returns The euler angle in radians of the device from the planar Y axis.
*/
getGamma(): number;
/**
* The heading of the device relative to north (in radians).
* @returns The heading of the device relative to north, in radians, normalizing for different browser behavior.
*/
getHeading(): number;
/**
* Determine if orientation is being tracked.
* @returns Changes in device orientation are being tracked.
*/
getTracking(): boolean;
/**
* Enable or disable tracking of device orientation events.
* @param tracking The status of tracking changes to alpha, beta and gamma. If true, changes are tracked and reported immediately.
*/
setTracking(tracking: boolean): void;
}
/**
* Events emitted by ol.interaction.DragBox instances are instances of this type.
*/
class DragBoxEvent {
/**
* The coordinate of the drag event.
*/
coordinate: ol.Coordinate;
}
/**
* A vector object for geographic features with a geometry and other attribute properties, similar to the features in vector file formats like GeoJSON.
*/
class Feature extends ol.Object {
/**
* @constructor
* @param geometry Geometry.
*/
// TODO: replace any with Object <string, *>
constructor(geometryOrProperties?: ol.geom.Geometry | any);
/**
* Clone this feature. If the original feature has a geometry it is also cloned. The feature id is not set in the clone.
* @returns The clone.
*/
clone(): Feature;
/**
* Get the feature's default geometry. A feature may have any number of named geometries. The "default" geometry (the one that is rendered by default) is set when calling ol.Feature#setGeometry.
* @returns The default geometry for the feature.
*/
getGeometry(): ol.geom.Geometry;
/**
* Get the name of the feature's default geometry. By default, the default geometry is named geometry.
* @returns Get the property name associated with the default geometry for this feature.
*/
getGeometryName(): string;
/**
* @returns Id.
*/
getId(): string | number;
/**
* Get the feature's style. This return for this method depends on what was provided to the ol.Feature#setStyle method.
* The feature style.
*/
getStyle(): ol.style.Style | Array<ol.style.Style> | ol.FeatureStyleFunction;
/**
* Get the feature's style function.
* @returns Return a function representing the current style of this feature.
*/
getStyleFunction(): ol.FeatureStyleFunction;
/**
* Set the default geometry for the feature. This will update the property with the name returned by ol.Feature#getGeometryName.
* @param geometry The new geometry.
*/
setGeometry(geometry: ol.geom.Geometry): void;
/**
* Set the property name to be used when getting the feature's default geometry. When calling ol.Feature#getGeometry, the value of the property with this name will be returned.
* @param name The property name of the default geometry.
*/
setGeometryName(name: string): void;
/**
* Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the ol.source.Vector#getFeatureById method.
* @param id The feature id.
*/
setId(id: number): void;
/**
* Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the ol.source.Vector#getFeatureById method.
* @param id The feature id.
*/
setId(id: string): void;
/**
* Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is null the feature has no style (a null style).
* @param style Style for this feature.
*/
setStyle(style: ol.style.Style): void;
/**
* Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is null the feature has no style (a null style).
* @param style Style for this feature.
*/
setStyle(style: Array<ol.style.Style>): void;
/**
* Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is null the feature has no style (a null style).
* @param style Style for this feature.
*/
setStyle(style: ol.FeatureStyleFunction): void;
}