azure-maps-control 2.1.17 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "azure-maps-control",
3
3
  "author": "Microsoft Corporation",
4
- "version": "2.1.17",
4
+ "version": "2.2.1",
5
5
  "description": "Map SDK for Azure Maps",
6
6
  "keywords": [
7
7
  "azure",
@@ -14,15 +14,15 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "build": "node ./bin/build.js",
17
+ "build-snrOnly": "node ./bin/build.js --snrOnly",
17
18
  "docs": "(if exist \"./docs/\" rmdir \"./docs/\" /S /Q) && tsc --declaration --declarationDir ./docs --emitDeclarationOnly --stripInternal",
18
19
  "lessc": "node_modules/.bin/lessc",
19
- "pretest": "npm run updatePackageVersionForTests -- --isPreTest true",
20
- "posttest": "npm run updatePackageVersionForTests -- --isPreTest false",
21
- "test": "set \"TS_NODE_PROJECT=./test/tsconfig.json\" && mocha --reporter cypress-multi-reporters --reporter-options configFile=mochaReporters.json --parallel --exit --timeout 30000 --require ts-node/register test/**/*.ts",
22
- "coverage": "nyc --reporter cobertura --reporter text -t coverage npm run test",
23
- "pretest-filter": "npm run updatePackageVersionForTests -- --isPreTest true",
24
- "posttest-filter": "npm run updatePackageVersionForTests -- --isPreTest false",
25
- "test-filter": "set \"TS_NODE_PROJECT=./test/tsconfig.json\" && mocha --parallel --exit --timeout 30000 --require ts-node/register",
20
+ "test": "npm run test:unit && npm run test:func",
21
+ "test:unit": "jest -c test/unit/jest.config.js",
22
+ "test:func": "jest -c test/func/jest.config.js",
23
+ "pretest:func": "npm run updatePackageVersionForTests -- --isPreTest true",
24
+ "posttest:func": "npm run updatePackageVersionForTests -- --isPreTest false",
25
+ "coverage": "npm run test:unit -- --collectCoverage && npm run test:func",
26
26
  "thirdPartyNotices": "node ./bin/thirdPartyNotices.js",
27
27
  "lint": "eslint -c .eslintrc.json --ext .ts,.js src/",
28
28
  "updateEnvVariables": "node ./bin/updateEnvVariables.js",
@@ -37,32 +37,33 @@
37
37
  "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
38
38
  "@microsoft/applicationinsights-web": "^2.5.9",
39
39
  "@turf/intersect": "^6.3.0",
40
+ "@types/jest": "^27.5.1",
40
41
  "@types/jwt-decode": "^2.2.0",
41
42
  "@types/lodash": "4.14.136",
42
43
  "@types/mapbox-gl": "^1.13.0",
43
- "@types/mocha": "^5.2.7",
44
+ "@types/node": "^18.11.10",
44
45
  "@types/puppeteer": "^1.20.7",
45
46
  "@typescript-eslint/eslint-plugin": "^5.33.0",
46
47
  "@typescript-eslint/parser": "^5.33.0",
47
48
  "adal-angular": "^1.0.18",
48
49
  "atob": "^2.1.2",
49
50
  "azuremaps-maplibre-gl": "^1.14.0-rc4",
50
- "cypress-multi-reporters": "^1.5.0",
51
+ "canvas": "^2.10.1",
51
52
  "es-abstract": "^1.17.1",
52
53
  "eslint": "^8.22.0",
53
54
  "eslint-plugin-security": "^1.5.0",
54
55
  "estree-walker": "^1.0.1",
55
56
  "fs-extra": "^8.1.0",
57
+ "gl": "^6.0.1",
56
58
  "glob": "^7.1.6",
57
59
  "grunt": "^1.3.0",
60
+ "jest": "^27.5.1",
61
+ "jest-trx-results-processor": "^3.0.1",
58
62
  "jwt-decode": "^2.2.0",
59
63
  "less": "^3.12.2",
60
64
  "less-plugin-clean-css": "^1.5.1",
61
65
  "lodash": "4.17.15",
62
- "mocha": "^9.0.3",
63
- "mocha-trx-reporter": "^3.3.1",
64
66
  "node-fetch": "^2.6.1",
65
- "nyc": "^15.1.0",
66
67
  "puppeteer": "^10.2.0",
67
68
  "rollup": "^1.32.1",
68
69
  "rollup-plugin-commonjs": "^10.1.0",
@@ -71,8 +72,9 @@
71
72
  "rollup-plugin-sourcemaps": "^0.6.3",
72
73
  "rollup-plugin-uglify": "^6.0.4",
73
74
  "simplify-ts": "^1.0.2",
75
+ "ts-jest": "^27.1.5",
74
76
  "ts-node": "^8.10.2",
75
- "typescript": "^3.7.2",
77
+ "typescript": "^4.3.5",
76
78
  "utf-8-validate": "^5.0.2",
77
79
  "uuid-random": "^1.3.2",
78
80
  "yargs": "^13.3.2"
@@ -84,16 +86,5 @@
84
86
  "thirdpartynotices.txt"
85
87
  ],
86
88
  "types": "./typings/index.d.ts",
87
- "main": "./dist/atlas.min.js",
88
- "nyc": {
89
- "all": true,
90
- "exclude": [
91
- "bin",
92
- "dist",
93
- "test",
94
- "examples"
95
- ],
96
- "check-coverage": false,
97
- "exclude-after-remap": false
98
- }
89
+ "main": "./dist/atlas.min.js"
99
90
  }
Binary file
@@ -516,6 +516,78 @@ declare namespace atlas {
516
516
  constructor(geometries: Geometry[]);
517
517
  }
518
518
 
519
+ /**
520
+ * A `MercatorPoint` object represents a projected three dimensional position.
521
+ *
522
+ * `MercatorPoint` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
523
+ * - the size of 1 unit is the width of the projected world instead of the "mercator meter"
524
+ * - the origin of the coordinate space is at the north-west corner instead of the middle.
525
+ *
526
+ * For example, `MercatorPoint(0, 0, 0)` is the north-west corner of the mercator world and
527
+ * `MercatorPoint(1, 1, 0)` is the south-east corner. If you are familiar with
528
+ * [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think
529
+ * of the coordinate space as the `0/0/0` tile with an extent of `1`.
530
+ *
531
+ * The `z` dimension of `MercatorPoint` is conformal. A cube in the mercator coordinate space would be rendered as a cube.
532
+ */
533
+ export class MercatorPoint extends Array<number> {
534
+ /**
535
+ * Constructs a MercatorPoint.
536
+ * @param x A points x position in mercator units.
537
+ * @param y A points y position in mercator units.
538
+ * @param z A points z position in mercator units.
539
+ */
540
+ constructor(x: number, y: number, z?: number);
541
+ /**
542
+ * Converts a position into a mercator point.
543
+ * @param position Position to convert.
544
+ * @returns A mercator point.
545
+ */
546
+ static fromPosition(position: Position): MercatorPoint;
547
+ /**
548
+ * Converts an array of positions into an array of mercator points.
549
+ * @param positions Array of positions to convert.
550
+ * @returns An array of mercator points.
551
+ */
552
+ static fromPositions(positions: Position[]): MercatorPoint[];
553
+ /**
554
+ * Converts an array of positions into a Float32Array of mercator xyz values.
555
+ * @param positions Array of positions to convert.
556
+ * @returns A Float32Array of mercator xyz values.
557
+ */
558
+ static toFloat32Array(positions: Position[]): Float32Array;
559
+ /**
560
+ * Converts a mercator point into a map position.
561
+ * @param mercator Mercator point to convert.
562
+ * @returns A map position.
563
+ */
564
+ static toPosition(mercator: MercatorPoint): Position;
565
+ /**
566
+ * Converts an array of mercator points into an array of map positions.
567
+ * @param mercators Mercator points to convert.
568
+ * @returns An array of map positions.
569
+ */
570
+ static toPositions(mercators: MercatorPoint[]): Position[];
571
+ /**
572
+ * Determine the Mercator scale factor for a given latitude, see
573
+ * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
574
+ *
575
+ * At the equator the scale factor will be 1, which increases at higher latitudes.
576
+ *
577
+ * @param latitude Latitude
578
+ * @returns The mercator scale factor.
579
+ */
580
+ static mercatorScale(latitude: number): number;
581
+ /**
582
+ * Returns the distance of 1 meter in `MercatorPoint` units at this latitude.
583
+ *
584
+ * For coordinates in real world units using meters, this naturally provides the scale
585
+ * to transform into `MercatorPoint`s.
586
+ *
587
+ * @returns {number} Distance of 1 meter in `MercatorPoint` units.
588
+ */
589
+ static meterInMercatorUnits(latitude: number): number;
590
+ }
519
591
  }
520
592
 
521
593
  //control classes
@@ -817,7 +889,6 @@ declare namespace atlas {
817
889
  * @param newOptions The new options of the bubble layer.
818
890
  */
819
891
  setOptions(options: BubbleLayerOptions): void;
820
-
821
892
  }
822
893
 
823
894
  export interface LayerEvents {
@@ -1072,6 +1143,27 @@ declare namespace atlas {
1072
1143
  */
1073
1144
  setOptions(options: TileLayerOptions): void;
1074
1145
  }
1146
+
1147
+ /**
1148
+ * Enables custom rendering logic with access to the WebGL context of the map.
1149
+ */
1150
+ export class WebGLLayer extends Layer {
1151
+ /**
1152
+ * Constructs a new WebGLLayer.
1153
+ * @param id The id of the layer. If not specified a random one will be generated.
1154
+ * @param options The options of the WebGL layer.
1155
+ */
1156
+ constructor(id?: string, options?: WebGLLayerOptions);
1157
+ /**
1158
+ * Gets the options of the WebGL layer.
1159
+ */
1160
+ getOptions(): WebGLLayerOptions;
1161
+ /**
1162
+ * Sets the options of the WebGL layer.
1163
+ * @param options The new options of the WebGL layer.
1164
+ */
1165
+ setOptions(options: WebGLLayerOptions): void;
1166
+ }
1075
1167
  }
1076
1168
 
1077
1169
  //source classes
@@ -1971,6 +2063,14 @@ declare namespace atlas {
1971
2063
  * Stops any animated transition that is currently underway.
1972
2064
  */
1973
2065
  stop(): void;
2066
+ /**
2067
+ * Trigger the rendering of a single frame.
2068
+ * Use this method with WebGL layers to repaint the map when the layer's
2069
+ * properties or properties associated with the layer's source change.
2070
+ * Calling this multiple times before the next frame is rendered will still
2071
+ * result in only a single frame being rendered.
2072
+ */
2073
+ triggerRepaint(): void;
1974
2074
  /**
1975
2075
  * The callback used when styleOptions.autoResize is true.
1976
2076
  */
@@ -3524,6 +3624,16 @@ declare namespace atlas {
3524
3624
  tileUrl?: string;
3525
3625
  }
3526
3626
 
3627
+ /**
3628
+ * Options used to render graphics in a WebGLLayer.
3629
+ */
3630
+ export interface WebGLLayerOptions extends LayerOptions {
3631
+ /**
3632
+ * An object that contains the rendering logic.
3633
+ */
3634
+ renderer?: WebGLRenderer;
3635
+ }
3636
+
3527
3637
  /**
3528
3638
  * Available styles for a Control.
3529
3639
  */
@@ -4131,6 +4241,10 @@ declare namespace atlas {
4131
4241
  * The options for the map's style.
4132
4242
  */
4133
4243
  export interface StyleOptions extends Options {
4244
+ /**
4245
+ * If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
4246
+ */
4247
+ antialias?: boolean;
4134
4248
  /**
4135
4249
  * If true the map will automatically resize whenever the window's size changes.
4136
4250
  * Otherwise map.resize() must be called.
@@ -4156,6 +4270,20 @@ declare namespace atlas {
4156
4270
  * @default false
4157
4271
  */
4158
4272
  preserveDrawingBuffer?: boolean;
4273
+ /**
4274
+ * If true, the map will try to defer non-essential map layers and show essential layers as early as possible.
4275
+ * This option may only be set when initializing the map.
4276
+ * Default `false`
4277
+ * @default false
4278
+ */
4279
+ progressiveLoading?: boolean;
4280
+ /**
4281
+ * The list of layer groups to be loaded at the initial stage. Passing an empty array will disable the progressive loading.
4282
+ * This option may only be set when initializing the map.
4283
+ * Default `['base']`
4284
+ * @default ['base']
4285
+ */
4286
+ progressiveLoadingInitialLayerGroups?: string[];
4159
4287
  /**
4160
4288
  * Specifies if multiple copies of the world should be rendered when zoomed out.
4161
4289
  * Default `true`
@@ -4467,21 +4595,21 @@ declare namespace atlas {
4467
4595
  | 'Thumbnail';
4468
4596
 
4469
4597
  /**
4470
- * Represents the contents of the style set.
4598
+ * Represents the contents of map configuration holding a list of styles available to them.
4471
4599
  */
4472
- export interface StyleSet {
4600
+ export interface MapConfiguration {
4473
4601
  created?: string;
4474
- defaultStyle: string;
4602
+ defaultConfiguration: string;
4475
4603
  description?: string;
4476
4604
  id?: string;
4477
- styles: StyleSetStyle[];
4605
+ configurations: MapConfigurationStyle[];
4478
4606
  version?: number;
4479
4607
  }
4480
4608
 
4481
4609
  /**
4482
4610
  * Represents the info for a single style.
4483
4611
  */
4484
- export interface StyleSetStyle {
4612
+ export interface MapConfigurationStyle {
4485
4613
  copyright?: string;
4486
4614
  displayName?: string;
4487
4615
  name: string;
@@ -4517,10 +4645,9 @@ declare namespace atlas {
4517
4645
  */
4518
4646
  domain?: string;
4519
4647
  /**
4520
- * The style set of the map. Determines which styles are available to be picked
4521
- * and what do they consist of (style names, thumbnails, URLs, etc).
4648
+ * The map configuration defines the set of styles available to the map.
4522
4649
  */
4523
- styleSet?: StyleSet;
4650
+ mapConfiguration?: string | MapConfiguration;
4524
4651
  /**
4525
4652
  * Enable accessibility
4526
4653
  * default: true
@@ -4608,6 +4735,75 @@ declare namespace atlas {
4608
4735
  export interface AggregateExpression extends Array<any> {
4609
4736
  }
4610
4737
 
4738
+ /**
4739
+ * Interface for rendering WebGL graphics in a WebGLLayer.
4740
+ */
4741
+ export interface WebGLRenderer {
4742
+ /**
4743
+ * Either "2d" or "3d". Defaults to "2d".
4744
+ */
4745
+ renderingMode?: "2d" | "3d";
4746
+
4747
+ /**
4748
+ * Optional method called when the layer has been added to the Map.
4749
+ * This gives the layer a chance to initialize gl resources and register event listeners.
4750
+ * @param map The Map this WebGL layer was just added to.
4751
+ * @param gl The gl context for the map.
4752
+ */
4753
+ onAdd?(map: Map, gl: WebGLRenderingContext): void;
4754
+
4755
+ /**
4756
+ * Optional method called when the layer has been removed from the Map.
4757
+ * This gives the layer a chance to clean up gl resources and event listeners.
4758
+ * @param map The Map this WebGL layer was just added to.
4759
+ * @param gl The gl context for the map.
4760
+ */
4761
+ onRemove?(map: Map, gl: WebGLRenderingContext): void;
4762
+
4763
+ /**
4764
+ * Optional method called during a render frame to allow a layer to prepare resources
4765
+ * or render into a texture.
4766
+ *
4767
+ * The layer cannot make any assumptions about the current GL state and must bind a framebuffer
4768
+ * before rendering.
4769
+ * @param gl The map's gl context.
4770
+ * @param matrix The map's camera matrix. It projects spherical mercator coordinates to gl
4771
+ * coordinates. The mercator coordinate [0, 0] represents the top left corner of
4772
+ * the mercator world and [1, 1] represents the bottom right corner. When the
4773
+ * renderingMode is "3d" , the z coordinate is conformal. A box with identical
4774
+ * x, y, and z lengths in mercator units would be rendered as a cube.
4775
+ * MercatorCoordinate .fromLatLng can be used to project a LngLat to a mercator
4776
+ * coordinate.
4777
+ */
4778
+ prerender?(gl: WebGLRenderingContext, matrix: number[]): void;
4779
+
4780
+ /**
4781
+ * Called during a render frame allowing the layer to draw into the GL context.
4782
+ *
4783
+ * The layer can assume blending and depth state is set to allow the layer to properly blend
4784
+ * and clip other layers. The layer cannot make any other assumptions about the current GL state.
4785
+ *
4786
+ * If the layer needs to render to a texture, it should implement the prerender method to do this
4787
+ * and only use the render method for drawing directly into the main framebuffer.
4788
+ *
4789
+ * The blend function is set to gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA). This expects
4790
+ * colors to be provided in premultiplied alpha form where the r, g and b values are already
4791
+ * multiplied by the a value. If you are unable to provide colors in premultiplied form you may
4792
+ * want to change the blend function to
4793
+ * gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).
4794
+ *
4795
+ * @param gl The map's gl context.
4796
+ * @param matrix The map's camera matrix. It projects spherical mercator coordinates to gl
4797
+ * coordinates. The mercator coordinate [0, 0] represents the top left corner of
4798
+ * the mercator world and [1, 1] represents the bottom right corner. When the
4799
+ * renderingMode is "3d" , the z coordinate is conformal. A box with identical
4800
+ * x, y, and z lengths in mercator units would be rendered as a cube.
4801
+ * MercatorCoordinate .fromLatLng can be used to project a LngLat to a mercator
4802
+ * coordinate.
4803
+ */
4804
+ render(gl: WebGLRenderingContext, matrix: number[]): void;
4805
+ }
4806
+
4611
4807
  /**
4612
4808
  * A manager for the map control's authentication.
4613
4809
  * Exposed through the authentication property of the atlas.Map class.
@@ -4707,11 +4903,11 @@ declare namespace atlas {
4707
4903
  */
4708
4904
  add(eventType: "stylechanged", callback: (e: StyleChangedEvent) => void): void;
4709
4905
  /**
4710
- * Adds a styleset change event to the map.
4711
- * @param eventType A styleset changed event name
4906
+ * Adds a mapConfiguration change event to the map.
4907
+ * @param eventType A mapConfiguration changed event name
4712
4908
  * @param callback The event handler callback
4713
4909
  */
4714
- add(eventType: "stylesetchanged", callback: (e: StyleSet) => void): void;
4910
+ add(eventType: "mapconfigurationchanged", callback: (e: MapConfiguration) => void): void;
4715
4911
  /**
4716
4912
  * Adds a wheel event to the map.
4717
4913
  * @param eventType The wheel event name.
@@ -4988,7 +5184,7 @@ declare namespace atlas {
4988
5184
  * @param eventType The event name.
4989
5185
  * @param callback The event handler callback.
4990
5186
  */
4991
- remove(eventType: string, callback: (e: void | atlas.layer.Layer | MapEvent | MapDataEvent | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | atlas.source.Source | string | StyleSet) => void): void;
5187
+ remove(eventType: string, callback: (e: void | atlas.layer.Layer | MapEvent | MapDataEvent | MapMouseEvent | MapTouchEvent | MapMouseWheelEvent | atlas.source.Source | string | MapConfiguration) => void): void;
4992
5188
  /**
4993
5189
  * Removes an event listener from the DataSource(s).
4994
5190
  * @param eventType The event name.