@cesium/engine 20.0.1 → 21.0.0
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/Build/ThirdParty/Workers/zip-web-worker.js +637 -0
- package/Build/Workers/{chunk-7P7R7ERW.js → chunk-2T4WAVWX.js} +6 -6
- package/Build/Workers/{chunk-DNMSVJ4S.js → chunk-3G5XEUPY.js} +1 -1
- package/Build/Workers/{chunk-O7KDJVRH.js → chunk-3MSNTCHW.js} +9 -9
- package/Build/Workers/{chunk-7MCEUVPM.js → chunk-3OPG2FGI.js} +4 -4
- package/Build/Workers/{chunk-M4FSVD3C.js → chunk-3PUG3T2H.js} +12 -12
- package/Build/Workers/{chunk-CTU7LCVZ.js → chunk-4PH27XAL.js} +2 -2
- package/Build/Workers/{chunk-ZBLPNAYB.js → chunk-4VJYMLR6.js} +8 -8
- package/Build/Workers/{chunk-DAZVD3AH.js → chunk-5B3PGBQW.js} +11 -11
- package/Build/Workers/{chunk-UXIZVXIR.js → chunk-5GHCWGC4.js} +1 -1
- package/Build/Workers/{chunk-HZ22ZI3Q.js → chunk-5PEQUMCB.js} +12 -12
- package/Build/Workers/{chunk-HSVZWLJD.js → chunk-64WSG7AT.js} +4 -4
- package/Build/Workers/{chunk-ZJGO7T2S.js → chunk-6J6WGCWP.js} +4 -4
- package/Build/Workers/{chunk-OWV4L2GH.js → chunk-75B34CC6.js} +5 -5
- package/Build/Workers/{chunk-4MCKK5XE.js → chunk-7PLX65MV.js} +5 -5
- package/Build/Workers/{chunk-YVAOKOKX.js → chunk-AR2FUSG6.js} +1 -1
- package/Build/Workers/{chunk-JVNWWKXF.js → chunk-ARYRHDEB.js} +6 -6
- package/Build/Workers/{chunk-DAGWF5MM.js → chunk-B7INTBBB.js} +13 -13
- package/Build/Workers/{chunk-WNEY4A5P.js → chunk-BDPSQXLX.js} +5 -5
- package/Build/Workers/{chunk-LYKXQPGW.js → chunk-BU4CGMHO.js} +6 -6
- package/Build/Workers/{chunk-ECGKCTPM.js → chunk-BUBVUXDO.js} +6 -6
- package/Build/Workers/{chunk-LSYTMSIQ.js → chunk-CF72FAKC.js} +4 -4
- package/Build/Workers/{chunk-LZZA3PAR.js → chunk-DJ4ROETJ.js} +5 -5
- package/Build/Workers/{chunk-YNRRVRHO.js → chunk-E5XCZVIY.js} +1 -1
- package/Build/Workers/{chunk-RP4KKY2E.js → chunk-EAYW4CFP.js} +16 -16
- package/Build/Workers/{chunk-YW2UXIBU.js → chunk-EHFMZFVC.js} +4 -4
- package/Build/Workers/{chunk-HKHD5FDM.js → chunk-FFCKCQPK.js} +5 -5
- package/Build/Workers/{chunk-VQLQAENU.js → chunk-GKCZ2G36.js} +7 -7
- package/Build/Workers/{chunk-DJCPJJSP.js → chunk-HJ7IZBEI.js} +4 -4
- package/Build/Workers/{chunk-7FEVXX5D.js → chunk-JJZWDROM.js} +2 -2
- package/Build/Workers/{chunk-SLPWFCXZ.js → chunk-JUOEBO4F.js} +10 -10
- package/Build/Workers/{chunk-LHZKPI55.js → chunk-K4IDXMIZ.js} +9 -9
- package/Build/Workers/{chunk-D4VFVSGU.js → chunk-LL6HN3W4.js} +10 -10
- package/Build/Workers/{chunk-CZGSJ6ZG.js → chunk-LNTUIO55.js} +2 -2
- package/Build/Workers/{chunk-QFMJIXCL.js → chunk-LWOCFJEH.js} +9 -9
- package/Build/Workers/{chunk-2K5PKWLP.js → chunk-MMUISYW4.js} +16 -16
- package/Build/Workers/{chunk-IQKHPQNT.js → chunk-MXYW4BQ3.js} +2 -2
- package/Build/Workers/{chunk-XMIVNU5H.js → chunk-N6DVKXZD.js} +12 -12
- package/Build/Workers/{chunk-E2533KCN.js → chunk-NP46ZIBY.js} +3 -3
- package/Build/Workers/{chunk-O4DA3KRB.js → chunk-OW6F6CPZ.js} +7 -7
- package/Build/Workers/{chunk-QWHUQ4B7.js → chunk-P6OAOFBU.js} +8 -8
- package/Build/Workers/{chunk-4Z7AGRTU.js → chunk-PXDMWXO5.js} +2 -2
- package/Build/Workers/{chunk-WJ5THCIZ.js → chunk-QS7623NH.js} +6 -6
- package/Build/Workers/{chunk-OYFINQQA.js → chunk-ROH45IXJ.js} +7 -7
- package/Build/Workers/{chunk-2MEON5V4.js → chunk-S2P6LCIB.js} +4 -4
- package/Build/Workers/{chunk-JIXKGUWR.js → chunk-S4NZVXU6.js} +2 -2
- package/Build/Workers/{chunk-JHTZDMN6.js → chunk-SGGO5WVA.js} +5 -5
- package/Build/Workers/{chunk-UUXKGCBU.js → chunk-TG7N7TPY.js} +47 -50
- package/Build/Workers/{chunk-PFUF2QIK.js → chunk-TUZQG4RW.js} +14 -14
- package/Build/Workers/{chunk-LF74EILW.js → chunk-UHVE7V65.js} +12 -12
- package/Build/Workers/{chunk-L7PWWHKM.js → chunk-UY2HVPDL.js} +5 -5
- package/Build/Workers/{chunk-V65LOTF3.js → chunk-YNLPRFUQ.js} +6 -6
- package/Build/Workers/{chunk-RB3XS7EZ.js → chunk-ZYOHBCCE.js} +1 -1
- package/Build/Workers/combineGeometry.js +21 -21
- package/Build/Workers/createBoxGeometry.js +15 -15
- package/Build/Workers/createBoxOutlineGeometry.js +13 -13
- package/Build/Workers/createCircleGeometry.js +23 -23
- package/Build/Workers/createCircleOutlineGeometry.js +16 -16
- package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
- package/Build/Workers/createCorridorGeometry.js +26 -26
- package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
- package/Build/Workers/createCylinderGeometry.js +17 -17
- package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
- package/Build/Workers/createEllipseGeometry.js +23 -23
- package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
- package/Build/Workers/createEllipsoidGeometry.js +16 -16
- package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
- package/Build/Workers/createFrustumGeometry.js +15 -15
- package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
- package/Build/Workers/createGeometry.js +21 -21
- package/Build/Workers/createGroundPolylineGeometry.js +19 -19
- package/Build/Workers/createPlaneGeometry.js +13 -13
- package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
- package/Build/Workers/createPolygonGeometry.js +29 -29
- package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
- package/Build/Workers/createPolylineGeometry.js +22 -22
- package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
- package/Build/Workers/createRectangleGeometry.js +24 -24
- package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
- package/Build/Workers/createSimplePolylineGeometry.js +20 -20
- package/Build/Workers/createSphereGeometry.js +16 -16
- package/Build/Workers/createSphereOutlineGeometry.js +15 -15
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
- package/Build/Workers/createVectorTileGeometries.js +21 -21
- package/Build/Workers/createVectorTilePoints.js +11 -11
- package/Build/Workers/createVectorTilePolygons.js +19 -19
- package/Build/Workers/createVectorTilePolylines.js +12 -12
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
- package/Build/Workers/createVerticesFromHeightmap.js +19 -19
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
- package/Build/Workers/createWallGeometry.js +21 -21
- package/Build/Workers/createWallOutlineGeometry.js +20 -20
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +9 -9
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
- package/Source/Core/Event.js +41 -49
- package/Source/Core/GoogleMaps.js +2 -2
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +30 -4
- package/Source/Core/Resource.js +5 -1
- package/Source/DataSources/KmlDataSource.js +62 -63
- package/Source/DataSources/exportKml.js +27 -30
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Azure2DImageryProvider.js +308 -0
- package/Source/Scene/BatchTableHierarchy.js +2 -50
- package/Source/Scene/Billboard.js +4 -0
- package/Source/Scene/BillboardCollection.js +9 -2
- package/Source/Scene/ClippingPlaneCollection.js +3 -3
- package/Source/Scene/ClippingPolygon.js +91 -2
- package/Source/Scene/CreditDisplay.js +1 -1
- package/Source/Scene/GaussianSplat3DTileContent.js +54 -9
- package/Source/Scene/GaussianSplatPrimitive.js +49 -50
- package/Source/Scene/Google2DImageryProvider.js +614 -0
- package/Source/Scene/IonImageryProvider.js +22 -1
- package/Source/Scene/LabelCollection.js +1 -0
- package/Source/Scene/Material.js +248 -80
- package/Source/Scene/PntsParser.js +65 -0
- package/Source/Scene/Primitive.js +6 -0
- package/Source/Scene/PrimitiveState.js +123 -0
- package/Source/Scene/Scene.js +2 -2
- package/Source/Scene/VoxelBoundsCollection.js +494 -0
- package/Source/Scene/VoxelBoxShape.js +236 -101
- package/Source/Scene/VoxelCylinderShape.js +315 -204
- package/Source/Scene/VoxelEllipsoidShape.js +402 -119
- package/Source/Scene/VoxelPrimitive.js +119 -84
- package/Source/Scene/VoxelRenderResources.js +17 -10
- package/Source/Scene/VoxelShape.js +21 -6
- package/Source/Scene/buildVoxelDrawCommands.js +61 -20
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
- package/Source/Scene/getClippingFunction.js +79 -88
- package/Source/Shaders/BillboardCollectionVS.glsl +2 -0
- package/Source/Shaders/BillboardCollectionVS.js +2 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +20 -33
- package/Source/Shaders/Voxels/IntersectBox.js +20 -33
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +28 -32
- package/Source/Shaders/Voxels/IntersectCylinder.js +28 -32
- package/Source/Shaders/Voxels/IntersectDepth.glsl +1 -4
- package/Source/Shaders/Voxels/IntersectDepth.js +1 -4
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +12 -20
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +12 -20
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +21 -9
- package/Source/Shaders/Voxels/IntersectLongitude.js +21 -9
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.glsl → IntersectPlane.glsl} +5 -3
- package/Source/Shaders/Voxels/{IntersectClippingPlanes.js → IntersectPlane.js} +5 -3
- package/Source/Shaders/Voxels/Intersection.glsl +3 -3
- package/Source/Shaders/Voxels/Intersection.js +3 -3
- package/Source/Shaders/Voxels/Octree.glsl +46 -51
- package/Source/Shaders/Voxels/Octree.js +46 -51
- package/Source/Shaders/Voxels/VoxelFS.glsl +50 -48
- package/Source/Shaders/Voxels/VoxelFS.js +50 -48
- package/Source/Shaders/Voxels/VoxelUtils.glsl +0 -19
- package/Source/Shaders/Voxels/VoxelUtils.js +0 -19
- package/Source/Shaders/Voxels/convertLocalToBoxUv.glsl +30 -0
- package/Source/Shaders/Voxels/convertLocalToBoxUv.js +32 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.glsl +97 -0
- package/Source/Shaders/Voxels/convertLocalToCylinderUv.js +99 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.glsl +193 -0
- package/Source/Shaders/Voxels/convertLocalToEllipsoidUv.js +195 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/index.d.ts +340 -14
- package/index.js +116 -114
- package/package.json +2 -2
- package/Build/ThirdParty/Workers/pako_deflate.min.js +0 -503
- package/Build/ThirdParty/Workers/pako_inflate.min.js +0 -698
- package/Build/ThirdParty/Workers/z-worker-pako.js +0 -601
- package/Source/Core/defaultValue.js +0 -48
- package/Source/Shaders/Voxels/convertUvToBox.glsl +0 -45
- package/Source/Shaders/Voxels/convertUvToBox.js +0 -46
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +0 -99
- package/Source/Shaders/Voxels/convertUvToCylinder.js +0 -101
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +0 -139
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +0 -141
- package/Source/ThirdParty/Workers/pako_deflate.min.js +0 -2
- package/Source/ThirdParty/Workers/pako_inflate.min.js +0 -2
- package/Source/ThirdParty/Workers/z-worker-pako.js +0 -1
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
import Credit from "../Core/Credit.js";
|
|
2
|
+
import Frozen from "../Core/Frozen.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
5
|
+
import Resource from "../Core/Resource.js";
|
|
6
|
+
import IonResource from "../Core/IonResource.js";
|
|
7
|
+
import Check from "../Core/Check.js";
|
|
8
|
+
import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js";
|
|
9
|
+
import GoogleMaps from "../Core/GoogleMaps.js";
|
|
10
|
+
|
|
11
|
+
const trailingSlashRegex = /\/$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} Google2DImageryProvider.ConstructorOptions
|
|
15
|
+
*
|
|
16
|
+
* Initialization options for the Google2DImageryProvider constructor
|
|
17
|
+
*
|
|
18
|
+
* @property {object} options Object with the following properties:
|
|
19
|
+
* @property {string} options.key The Google api key to send with tile requests.
|
|
20
|
+
* @property {string} options.session The Google session token that tracks the current state of your map and viewport.
|
|
21
|
+
* @property {string|Resource|IonResource} options.url The Google 2D maps endpoint.
|
|
22
|
+
* @property {string} options.tileWidth The width of each tile in pixels.
|
|
23
|
+
* @property {string} options.tileHeight The height of each tile in pixels.
|
|
24
|
+
* @property {Ellipsoid} [options.ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
|
|
25
|
+
* @property {number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
|
|
26
|
+
* this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
|
|
27
|
+
* to result in rendering problems.
|
|
28
|
+
* @property {number} [options.maximumLevel=22] The maximum level-of-detail supported by the imagery provider.
|
|
29
|
+
* @property {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* <div class="notice">
|
|
34
|
+
* This object is normally not instantiated directly, use {@link Google2DImageryProvider.fromIonAssetId} or {@link Google2DImageryProvider.fromUrl}.
|
|
35
|
+
* </div>
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* Provides 2D image tiles from {@link https://developers.google.com/maps/documentation/tile/2d-tiles-overview|Google 2D Tiles}.
|
|
39
|
+
*
|
|
40
|
+
* Google 2D Tiles can only be used with the Google geocoder.
|
|
41
|
+
*
|
|
42
|
+
* @alias Google2DImageryProvider
|
|
43
|
+
* @constructor
|
|
44
|
+
*
|
|
45
|
+
* @param {Google2DImageryProvider.ConstructorOptions} options Object describing initialization options
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Google 2D imagery provider
|
|
49
|
+
* const googleTilesProvider = Cesium.Google2DImageryProvider.fromIonAssetId({
|
|
50
|
+
* assetId: 3830184
|
|
51
|
+
* });
|
|
52
|
+
* @example
|
|
53
|
+
* // Use your own Google api key
|
|
54
|
+
* Cesium.GoogleMaps.defaultApiKey = "your-api-key";
|
|
55
|
+
*
|
|
56
|
+
* const googleTilesProvider = Cesium.Google2DImageryProvider.fromUrl({
|
|
57
|
+
* mapType: "SATELLITE"
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
|
|
61
|
+
*
|
|
62
|
+
* @see {@link https://developers.google.com/maps/documentation/tile/2d-tiles-overview}
|
|
63
|
+
* @see {@link https://developers.google.com/maps/documentation/tile/session_tokens}
|
|
64
|
+
* @see {@link https://en.wikipedia.org/wiki/IETF_language_tag|IETF Language Tags}
|
|
65
|
+
* @see {@link https://cldr.unicode.org/|Common Locale Data Repository region identifiers}
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
function Google2DImageryProvider(options) {
|
|
69
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
70
|
+
this._maximumLevel = options.maximumLevel ?? 22;
|
|
71
|
+
this._minimumLevel = options.minimumLevel ?? 0;
|
|
72
|
+
|
|
73
|
+
//>>includeStart("debug", pragmas.debug);
|
|
74
|
+
Check.defined("options.session", options.session);
|
|
75
|
+
Check.defined("options.tileWidth", options.tileWidth);
|
|
76
|
+
Check.defined("options.tileHeight", options.tileHeight);
|
|
77
|
+
Check.defined("options.key", options.key);
|
|
78
|
+
//>>includeEnd("debug");
|
|
79
|
+
|
|
80
|
+
this._session = options.session;
|
|
81
|
+
this._key = options.key;
|
|
82
|
+
this._tileWidth = options.tileWidth;
|
|
83
|
+
this._tileHeight = options.tileHeight;
|
|
84
|
+
|
|
85
|
+
const resource =
|
|
86
|
+
options.url instanceof IonResource
|
|
87
|
+
? options.url
|
|
88
|
+
: Resource.createIfNeeded(options.url ?? GoogleMaps.mapTilesApiEndpoint);
|
|
89
|
+
|
|
90
|
+
let templateUrl = resource.getUrlComponent();
|
|
91
|
+
if (!trailingSlashRegex.test(templateUrl)) {
|
|
92
|
+
templateUrl += "/";
|
|
93
|
+
}
|
|
94
|
+
const tilesUrl = `${templateUrl}v1/2dtiles/{z}/{x}/{y}`;
|
|
95
|
+
this._viewportUrl = `${templateUrl}tile/v1/viewport`;
|
|
96
|
+
|
|
97
|
+
resource.url = tilesUrl;
|
|
98
|
+
|
|
99
|
+
resource.setQueryParameters({
|
|
100
|
+
session: encodeURIComponent(options.session),
|
|
101
|
+
key: encodeURIComponent(options.key),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
let credit;
|
|
105
|
+
if (defined(options.credit)) {
|
|
106
|
+
credit = options.credit;
|
|
107
|
+
if (typeof credit === "string") {
|
|
108
|
+
credit = new Credit(credit);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const provider = new UrlTemplateImageryProvider({
|
|
113
|
+
url: resource,
|
|
114
|
+
credit: credit,
|
|
115
|
+
tileWidth: options.tileWidth,
|
|
116
|
+
tileHeight: options.tileHeight,
|
|
117
|
+
ellipsoid: options.ellipsoid,
|
|
118
|
+
rectangle: options.rectangle,
|
|
119
|
+
maximumLevel: this._maximumLevel,
|
|
120
|
+
minimumLevel: this._minimumLevel,
|
|
121
|
+
});
|
|
122
|
+
provider._resource = resource;
|
|
123
|
+
this._imageryProvider = provider;
|
|
124
|
+
|
|
125
|
+
// This will be defined for ion resources
|
|
126
|
+
this._tileCredits = resource.credits;
|
|
127
|
+
this._attributionsByLevel = undefined;
|
|
128
|
+
// Asynchronously request and populate _attributionsByLevel
|
|
129
|
+
this.getViewportCredits();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
Object.defineProperties(Google2DImageryProvider.prototype, {
|
|
133
|
+
/**
|
|
134
|
+
* Gets the URL of the Google 2D Imagery server.
|
|
135
|
+
* @memberof Google2DImageryProvider.prototype
|
|
136
|
+
* @type {string}
|
|
137
|
+
* @readonly
|
|
138
|
+
*/
|
|
139
|
+
url: {
|
|
140
|
+
get: function () {
|
|
141
|
+
return this._imageryProvider.url;
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Gets the rectangle, in radians, of the imagery provided by the instance.
|
|
147
|
+
* @memberof Google2DImageryProvider.prototype
|
|
148
|
+
* @type {Rectangle}
|
|
149
|
+
* @readonly
|
|
150
|
+
*/
|
|
151
|
+
rectangle: {
|
|
152
|
+
get: function () {
|
|
153
|
+
return this._imageryProvider.rectangle;
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Gets the width of each tile, in pixels.
|
|
159
|
+
* @memberof Google2DImageryProvider.prototype
|
|
160
|
+
* @type {number}
|
|
161
|
+
* @readonly
|
|
162
|
+
*/
|
|
163
|
+
tileWidth: {
|
|
164
|
+
get: function () {
|
|
165
|
+
return this._imageryProvider.tileWidth;
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Gets the height of each tile, in pixels.
|
|
171
|
+
* @memberof Google2DImageryProvider.prototype
|
|
172
|
+
* @type {number}
|
|
173
|
+
* @readonly
|
|
174
|
+
*/
|
|
175
|
+
tileHeight: {
|
|
176
|
+
get: function () {
|
|
177
|
+
return this._imageryProvider.tileHeight;
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Gets the maximum level-of-detail that can be requested.
|
|
183
|
+
* @memberof Google2DImageryProvider.prototype
|
|
184
|
+
* @type {number|undefined}
|
|
185
|
+
* @readonly
|
|
186
|
+
*/
|
|
187
|
+
maximumLevel: {
|
|
188
|
+
get: function () {
|
|
189
|
+
return this._imageryProvider.maximumLevel;
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Gets the minimum level-of-detail that can be requested. Generally,
|
|
195
|
+
* a minimum level should only be used when the rectangle of the imagery is small
|
|
196
|
+
* enough that the number of tiles at the minimum level is small. An imagery
|
|
197
|
+
* provider with more than a few tiles at the minimum level will lead to
|
|
198
|
+
* rendering problems.
|
|
199
|
+
* @memberof Google2DImageryProvider.prototype
|
|
200
|
+
* @type {number}
|
|
201
|
+
* @readonly
|
|
202
|
+
*/
|
|
203
|
+
minimumLevel: {
|
|
204
|
+
get: function () {
|
|
205
|
+
return this._imageryProvider.minimumLevel;
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Gets the tiling scheme used by the provider.
|
|
211
|
+
* @memberof Google2DImageryProvider.prototype
|
|
212
|
+
* @type {TilingScheme}
|
|
213
|
+
* @readonly
|
|
214
|
+
*/
|
|
215
|
+
tilingScheme: {
|
|
216
|
+
get: function () {
|
|
217
|
+
return this._imageryProvider.tilingScheme;
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Gets the tile discard policy. If not undefined, the discard policy is responsible
|
|
223
|
+
* for filtering out "missing" tiles via its shouldDiscardImage function. If this function
|
|
224
|
+
* returns undefined, no tiles are filtered.
|
|
225
|
+
* @memberof Google2DImageryProvider.prototype
|
|
226
|
+
* @type {TileDiscardPolicy}
|
|
227
|
+
* @readonly
|
|
228
|
+
*/
|
|
229
|
+
tileDiscardPolicy: {
|
|
230
|
+
get: function () {
|
|
231
|
+
return this._imageryProvider.tileDiscardPolicy;
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Gets an event that is raised when the imagery provider encounters an asynchronous error. By subscribing
|
|
237
|
+
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
238
|
+
* are passed an instance of {@link TileProviderError}.
|
|
239
|
+
* @memberof Google2DImageryProvider.prototype
|
|
240
|
+
* @type {Event}
|
|
241
|
+
* @readonly
|
|
242
|
+
*/
|
|
243
|
+
errorEvent: {
|
|
244
|
+
get: function () {
|
|
245
|
+
return this._imageryProvider.errorEvent;
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Gets the credit to display when this imagery provider is active. Typically this is used to credit
|
|
251
|
+
* the source of the imagery.
|
|
252
|
+
* @memberof Google2DImageryProvider.prototype
|
|
253
|
+
* @type {Credit}
|
|
254
|
+
* @readonly
|
|
255
|
+
*/
|
|
256
|
+
credit: {
|
|
257
|
+
get: function () {
|
|
258
|
+
return this._imageryProvider.credit;
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Gets the proxy used by this provider.
|
|
264
|
+
* @memberof Google2DImageryProvider.prototype
|
|
265
|
+
* @type {Proxy}
|
|
266
|
+
* @readonly
|
|
267
|
+
*/
|
|
268
|
+
proxy: {
|
|
269
|
+
get: function () {
|
|
270
|
+
return this._imageryProvider.proxy;
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Gets a value indicating whether or not the images provided by this imagery provider
|
|
276
|
+
* include an alpha channel. If this property is false, an alpha channel, if present, will
|
|
277
|
+
* be ignored. If this property is true, any images without an alpha channel will be treated
|
|
278
|
+
* as if their alpha is 1.0 everywhere. When this property is false, memory usage
|
|
279
|
+
* and texture upload time are reduced.
|
|
280
|
+
* @memberof Google2DImageryProvider.prototype
|
|
281
|
+
* @type {boolean}
|
|
282
|
+
* @readonly
|
|
283
|
+
*/
|
|
284
|
+
hasAlphaChannel: {
|
|
285
|
+
get: function () {
|
|
286
|
+
return this._imageryProvider.hasAlphaChannel;
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Creates an {@link ImageryProvider} which provides 2D global tiled imagery from {@link https://developers.google.com/maps/documentation/tile/2d-tiles-overview|Google 2D Tiles}, streamed using the Cesium ion REST API.
|
|
293
|
+
* @param {object} options Object with the following properties:
|
|
294
|
+
* @param {string} options.assetId The Cesium ion asset id.
|
|
295
|
+
* @param {"satellite" | "terrain" | "roadmap"} [options.mapType="satellite"] The map type of the Google map imagery. Valid options are satellite, terrain, and roadmap. If overlayLayerType is set, mapType is ignored and a transparent overlay is returned. If overlayMapType is undefined, then a basemap of mapType is returned. layerRoadmap overlayLayerType is included in terrain and roadmap mapTypes.
|
|
296
|
+
* @param {string} [options.language="en_US"] an IETF language tag that specifies the language used to display information on the tiles
|
|
297
|
+
* @param {string} [options.region="US"] A Common Locale Data Repository region identifier (two uppercase letters) that represents the physical location of the user.
|
|
298
|
+
* @param {"layerRoadmap" | "layerStreetview" | "layerTraffic"} [options.overlayLayerType] Returns a transparent overlay map with the specified layerType. If no value is provided, a basemap of mapType is returned. Use multiple instances of Google2DImageryProvider to add multiple Google Maps overlays to a scene. layerRoadmap is included in terrain and roadmap mapTypes, so adding as overlay to terrain or roadmap has no effect.
|
|
299
|
+
* @param {Object} [options.styles] An array of JSON style objects that specify the appearance and detail level of map features such as roads, parks, and built-up areas. Styling is used to customize the standard Google base map. The styles parameter is valid only if the mapType is roadmap. For the complete style syntax, see the ({@link https://developers.google.com/maps/documentation/tile/style-reference|Google Style Reference}).
|
|
300
|
+
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
|
|
301
|
+
* @param {number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
|
|
302
|
+
* this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
|
|
303
|
+
* to result in rendering problems.
|
|
304
|
+
* @param {number} [options.maximumLevel=22] The maximum level-of-detail supported by the imagery provider.
|
|
305
|
+
* @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image.
|
|
306
|
+
* @param {Credit|string} [options.credit] A credit for the data source, which is displayed on the canvas.
|
|
307
|
+
*
|
|
308
|
+
* @returns {Promise<Google2DImageryProvider>} A promise that resolves to the created Google2DImageryProvider.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* // Google 2D imagery provider
|
|
312
|
+
* const googleTilesProvider = Cesium.Google2DImageryProvider.fromIonAssetId({
|
|
313
|
+
* assetId: 3830184
|
|
314
|
+
* });
|
|
315
|
+
* @example
|
|
316
|
+
* // Google 2D roadmap overlay with custom styles
|
|
317
|
+
* const googleTileProvider = Cesium.Google2DImageryProvider.fromIonAssetId({
|
|
318
|
+
* assetId: 3830184,
|
|
319
|
+
* overlayLayerType: "layerRoadmap",
|
|
320
|
+
* styles: [
|
|
321
|
+
* {
|
|
322
|
+
* stylers: [{ hue: "#00ffe6" }, { saturation: -20 }],
|
|
323
|
+
* },
|
|
324
|
+
* {
|
|
325
|
+
* featureType: "road",
|
|
326
|
+
* elementType: "geometry",
|
|
327
|
+
* stylers: [{ lightness: 100 }, { visibility: "simplified" }],
|
|
328
|
+
* },
|
|
329
|
+
* ],
|
|
330
|
+
* });
|
|
331
|
+
*/
|
|
332
|
+
Google2DImageryProvider.fromIonAssetId = async function (options) {
|
|
333
|
+
options = options ?? {};
|
|
334
|
+
options.mapType = options.mapType ?? "satellite";
|
|
335
|
+
options.language = options.language ?? "en_US";
|
|
336
|
+
options.region = options.region ?? "US";
|
|
337
|
+
|
|
338
|
+
const overlayLayerType = options.overlayLayerType;
|
|
339
|
+
//>>includeStart("debug", pragmas.debug);
|
|
340
|
+
if (defined(overlayLayerType)) {
|
|
341
|
+
Check.typeOf.string("options.overlayLayerType", overlayLayerType);
|
|
342
|
+
}
|
|
343
|
+
Check.defined("options.assetId", options.assetId);
|
|
344
|
+
//>>includeEnd("debug");
|
|
345
|
+
|
|
346
|
+
const queryOptions = buildQueryOptions(options);
|
|
347
|
+
|
|
348
|
+
const endpointResource = IonResource._createEndpointResource(
|
|
349
|
+
options.assetId,
|
|
350
|
+
{
|
|
351
|
+
queryParameters: {
|
|
352
|
+
options: JSON.stringify(queryOptions),
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
const endpoint = await endpointResource.fetchJson();
|
|
358
|
+
const endpointOptions = { ...endpoint.options };
|
|
359
|
+
delete endpointOptions.url;
|
|
360
|
+
|
|
361
|
+
const providerOptions = {
|
|
362
|
+
language: options.language,
|
|
363
|
+
region: options.region,
|
|
364
|
+
ellipsoid: options.ellipsoid,
|
|
365
|
+
minimumLevel: options.minimumLevel,
|
|
366
|
+
maximumLevel: options.maximumLevel,
|
|
367
|
+
rectangle: options.rectangle,
|
|
368
|
+
credit: options.credit,
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
return new Google2DImageryProvider({
|
|
372
|
+
...endpointOptions,
|
|
373
|
+
...providerOptions,
|
|
374
|
+
url: new IonResource(endpoint, endpointResource),
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Creates an {@link ImageryProvider} which provides 2D global tiled imagery from {@link https://developers.google.com/maps/documentation/tile/2d-tiles-overview|Google 2D Tiles}.
|
|
380
|
+
* @param {object} options Object with the following properties:
|
|
381
|
+
* @param {string} [options.key=GoogleMaps.defaultApiKey] Your API key to access Google 2D Tiles. See {@link https://developers.google.com/maps/documentation/javascript/get-api-key} for instructions on how to create your own key.
|
|
382
|
+
* @param {"satellite" | "terrain" | "roadmap"} [options.mapType="satellite"] The map type of the Google map imagery. Valid options are satellite, terrain, and roadmap. If overlayLayerType is set, mapType is ignored and a transparent overlay is returned. If overlayMapType is undefined, then a basemap of mapType is returned. layerRoadmap overlayLayerType is included in terrain and roadmap mapTypes.
|
|
383
|
+
* @param {string} [options.language="en_US"] an IETF language tag that specifies the language used to display information on the tiles
|
|
384
|
+
* @param {string} [options.region="US"] A Common Locale Data Repository region identifier (two uppercase letters) that represents the physical location of the user.
|
|
385
|
+
* @param {"layerRoadmap" | "layerStreetview" | "layerTraffic"} [options.overlayLayerType] Returns a transparent overlay map with the specified layerType. If no value is provided, a basemap of mapType is returned. Use multiple instances of Google2DImageryProvider to add multiple Google Maps overlays to a scene. layerRoadmap is included in terrain and roadmap mapTypes, so adding as overlay to terrain or roadmap has no effect.
|
|
386
|
+
* @param {Object} [options.styles] An array of JSON style objects that specify the appearance and detail level of map features such as roads, parks, and built-up areas. Styling is used to customize the standard Google base map. The styles parameter is valid only if the mapType is roadmap. For the complete style syntax, see the ({@link https://developers.google.com/maps/documentation/tile/style-reference|Google Style Reference}).
|
|
387
|
+
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.default] The ellipsoid. If not specified, the default ellipsoid is used.
|
|
388
|
+
* @param {number} [options.minimumLevel=0] The minimum level-of-detail supported by the imagery provider. Take care when specifying
|
|
389
|
+
* this that the number of tiles at the minimum level is small, such as four or less. A larger number is likely
|
|
390
|
+
* to result in rendering problems.
|
|
391
|
+
* @param {number} [options.maximumLevel=22] The maximum level-of-detail supported by the imagery provider.
|
|
392
|
+
* @param {Rectangle} [options.rectangle=Rectangle.MAX_VALUE] The rectangle, in radians, covered by the image.
|
|
393
|
+
* @param {Credit|string} [options.credit] A credit for the data source, which is displayed on the canvas.
|
|
394
|
+
*
|
|
395
|
+
* @returns {Promise<Google2DImageryProvider>} A promise that resolves to the created Google2DImageryProvider.
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* // Use your own Google api key
|
|
399
|
+
* Cesium.GoogleMaps.defaultApiKey = "your-api-key";
|
|
400
|
+
*
|
|
401
|
+
* const googleTilesProvider = Cesium.Google2DImageryProvider.fromUrl({
|
|
402
|
+
* mapType: "satellite"
|
|
403
|
+
* });
|
|
404
|
+
* @example
|
|
405
|
+
* // Google 2D roadmap overlay with custom styles
|
|
406
|
+
* Cesium.GoogleMaps.defaultApiKey = "your-api-key";
|
|
407
|
+
*
|
|
408
|
+
* const googleTileProvider = Cesium.Google2DImageryProvider.fromUrl({
|
|
409
|
+
* overlayLayerType: "layerRoadmap",
|
|
410
|
+
* styles: [
|
|
411
|
+
* {
|
|
412
|
+
* stylers: [{ hue: "#00ffe6" }, { saturation: -20 }],
|
|
413
|
+
* },
|
|
414
|
+
* {
|
|
415
|
+
* featureType: "road",
|
|
416
|
+
* elementType: "geometry",
|
|
417
|
+
* stylers: [{ lightness: 100 }, { visibility: "simplified" }],
|
|
418
|
+
* },
|
|
419
|
+
* ],
|
|
420
|
+
* });
|
|
421
|
+
*/
|
|
422
|
+
Google2DImageryProvider.fromUrl = async function (options) {
|
|
423
|
+
options = options ?? {};
|
|
424
|
+
options.mapType = options.mapType ?? "satellite";
|
|
425
|
+
options.language = options.language ?? "en_US";
|
|
426
|
+
options.region = options.region ?? "US";
|
|
427
|
+
options.url = options.url ?? GoogleMaps.mapTilesApiEndpoint;
|
|
428
|
+
options.key = options.key ?? GoogleMaps.defaultApiKey;
|
|
429
|
+
|
|
430
|
+
const overlayLayerType = options.overlayLayerType;
|
|
431
|
+
//>>includeStart("debug", pragmas.debug);
|
|
432
|
+
if (defined(overlayLayerType)) {
|
|
433
|
+
Check.typeOf.string("overlayLayerType", overlayLayerType);
|
|
434
|
+
}
|
|
435
|
+
if (!defined(options.key) && !defined(GoogleMaps.defaultApiKey)) {
|
|
436
|
+
throw new DeveloperError(
|
|
437
|
+
"options.key or GoogleMaps.defaultApiKey is required.",
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
//>>includeEnd("debug");
|
|
441
|
+
|
|
442
|
+
const sessionJson = await createGoogleImagerySession(options);
|
|
443
|
+
return new Google2DImageryProvider({
|
|
444
|
+
...sessionJson,
|
|
445
|
+
...options,
|
|
446
|
+
credit: options.credit ?? GoogleMaps.getDefaultCredit(),
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Gets the credits to be displayed when a given tile is displayed.
|
|
452
|
+
*
|
|
453
|
+
* @param {number} x The tile X coordinate.
|
|
454
|
+
* @param {number} y The tile Y coordinate.
|
|
455
|
+
* @param {number} level The tile level;
|
|
456
|
+
* @returns {Credit[]|undefined} The credits to be displayed when the tile is displayed.
|
|
457
|
+
*/
|
|
458
|
+
Google2DImageryProvider.prototype.getTileCredits = function (x, y, level) {
|
|
459
|
+
const hasAttributions = defined(this._attributionsByLevel);
|
|
460
|
+
|
|
461
|
+
if (!hasAttributions || !defined(this._tileCredits)) {
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const innerCredits = this._attributionsByLevel.get(level);
|
|
466
|
+
if (!defined(this._tileCredits)) {
|
|
467
|
+
return innerCredits;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return this._tileCredits.concat(innerCredits);
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Requests the image for a given tile.
|
|
475
|
+
*
|
|
476
|
+
* @param {number} x The tile X coordinate.
|
|
477
|
+
* @param {number} y The tile Y coordinate.
|
|
478
|
+
* @param {number} level The tile level.
|
|
479
|
+
* @param {Request} [request] The request object. Intended for internal use only.
|
|
480
|
+
* @returns {Promise<ImageryTypes>|undefined} A promise for the image that will resolve when the image is available, or
|
|
481
|
+
* undefined if there are too many active requests to the server, and the request should be retried later.
|
|
482
|
+
*/
|
|
483
|
+
Google2DImageryProvider.prototype.requestImage = function (
|
|
484
|
+
x,
|
|
485
|
+
y,
|
|
486
|
+
level,
|
|
487
|
+
request,
|
|
488
|
+
) {
|
|
489
|
+
return this._imageryProvider.requestImage(x, y, level, request);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Picking features is not currently supported by this imagery provider, so this function simply returns
|
|
494
|
+
* undefined.
|
|
495
|
+
*
|
|
496
|
+
* @param {number} x The tile X coordinate.
|
|
497
|
+
* @param {number} y The tile Y coordinate.
|
|
498
|
+
* @param {number} level The tile level.
|
|
499
|
+
* @param {number} longitude The longitude at which to pick features.
|
|
500
|
+
* @param {number} latitude The latitude at which to pick features.
|
|
501
|
+
* @return {undefined} Undefined since picking is not supported.
|
|
502
|
+
*/
|
|
503
|
+
Google2DImageryProvider.prototype.pickFeatures = function (
|
|
504
|
+
x,
|
|
505
|
+
y,
|
|
506
|
+
level,
|
|
507
|
+
longitude,
|
|
508
|
+
latitude,
|
|
509
|
+
) {
|
|
510
|
+
return undefined;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Get attribution for imagery from Google Maps to display in the credits
|
|
515
|
+
* @private
|
|
516
|
+
* @return {Promise<Map<Credit[]>>} The list of attribution sources to display in the credits.
|
|
517
|
+
*/
|
|
518
|
+
Google2DImageryProvider.prototype.getViewportCredits = async function () {
|
|
519
|
+
const maximumLevel = this._maximumLevel;
|
|
520
|
+
|
|
521
|
+
const promises = [];
|
|
522
|
+
for (let level = 0; level < maximumLevel + 1; level++) {
|
|
523
|
+
promises.push(
|
|
524
|
+
fetchViewportAttribution(
|
|
525
|
+
this._viewportUrl,
|
|
526
|
+
this._key,
|
|
527
|
+
this._session,
|
|
528
|
+
level,
|
|
529
|
+
),
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
const results = await Promise.all(promises);
|
|
533
|
+
|
|
534
|
+
const attributionsByLevel = new Map();
|
|
535
|
+
for (let level = 0; level < maximumLevel + 1; level++) {
|
|
536
|
+
const credits = [];
|
|
537
|
+
const attributions = results[level];
|
|
538
|
+
if (attributions) {
|
|
539
|
+
const levelCredits = new Credit(attributions);
|
|
540
|
+
credits.push(levelCredits);
|
|
541
|
+
}
|
|
542
|
+
attributionsByLevel.set(level, credits);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
this._attributionsByLevel = attributionsByLevel;
|
|
546
|
+
|
|
547
|
+
return attributionsByLevel;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
async function fetchViewportAttribution(url, key, session, level) {
|
|
551
|
+
const viewport = await Resource.fetch({
|
|
552
|
+
url: url,
|
|
553
|
+
queryParameters: {
|
|
554
|
+
key,
|
|
555
|
+
session,
|
|
556
|
+
zoom: level,
|
|
557
|
+
north: 90,
|
|
558
|
+
south: -90,
|
|
559
|
+
east: 180,
|
|
560
|
+
west: -180,
|
|
561
|
+
},
|
|
562
|
+
data: JSON.stringify(Frozen.EMPTY_OBJECT),
|
|
563
|
+
});
|
|
564
|
+
const viewportJson = JSON.parse(viewport);
|
|
565
|
+
return viewportJson.copyright;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function buildQueryOptions(options) {
|
|
569
|
+
const { mapType, overlayLayerType, styles } = options;
|
|
570
|
+
|
|
571
|
+
const queryOptions = {
|
|
572
|
+
mapType,
|
|
573
|
+
overlay: false,
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
if (mapType === "terrain" && !defined(overlayLayerType)) {
|
|
577
|
+
queryOptions.layerTypes = ["layerRoadmap"];
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (defined(overlayLayerType)) {
|
|
581
|
+
queryOptions.mapType = "satellite";
|
|
582
|
+
queryOptions.overlay = true;
|
|
583
|
+
queryOptions.layerTypes = [overlayLayerType];
|
|
584
|
+
}
|
|
585
|
+
if (defined(styles)) {
|
|
586
|
+
queryOptions.styles = styles;
|
|
587
|
+
}
|
|
588
|
+
return queryOptions;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
async function createGoogleImagerySession(options) {
|
|
592
|
+
const { language, region, key, url } = options;
|
|
593
|
+
|
|
594
|
+
const queryOptions = buildQueryOptions(options);
|
|
595
|
+
|
|
596
|
+
let baseUrl = url.url ?? url;
|
|
597
|
+
if (!trailingSlashRegex.test(baseUrl)) {
|
|
598
|
+
baseUrl += "/";
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const response = await Resource.post({
|
|
602
|
+
url: `${baseUrl}v1/createSession`,
|
|
603
|
+
queryParameters: { key: key },
|
|
604
|
+
data: JSON.stringify({
|
|
605
|
+
...queryOptions,
|
|
606
|
+
language,
|
|
607
|
+
region,
|
|
608
|
+
}),
|
|
609
|
+
});
|
|
610
|
+
const responseJson = JSON.parse(response);
|
|
611
|
+
return responseJson;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export default Google2DImageryProvider;
|
|
@@ -13,6 +13,8 @@ import SingleTileImageryProvider from "./SingleTileImageryProvider.js";
|
|
|
13
13
|
import UrlTemplateImageryProvider from "./UrlTemplateImageryProvider.js";
|
|
14
14
|
import WebMapServiceImageryProvider from "./WebMapServiceImageryProvider.js";
|
|
15
15
|
import WebMapTileServiceImageryProvider from "./WebMapTileServiceImageryProvider.js";
|
|
16
|
+
import Google2DImageryProvider from "./Google2DImageryProvider.js";
|
|
17
|
+
import Azure2DImageryProvider from "./Azure2DImageryProvider.js";
|
|
16
18
|
|
|
17
19
|
// These values are the list of supported external imagery
|
|
18
20
|
// assets in the Cesium ion beta. They are subject to change.
|
|
@@ -52,6 +54,18 @@ const ImageryProviderAsyncMapping = {
|
|
|
52
54
|
...options,
|
|
53
55
|
});
|
|
54
56
|
},
|
|
57
|
+
GOOGLE_2D_MAPS: (ionResource, options) => {
|
|
58
|
+
return new Google2DImageryProvider({
|
|
59
|
+
...options,
|
|
60
|
+
url: ionResource,
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
AZURE_MAPS: (ionResource, options) => {
|
|
64
|
+
return new Azure2DImageryProvider({
|
|
65
|
+
...options,
|
|
66
|
+
url: ionResource,
|
|
67
|
+
});
|
|
68
|
+
},
|
|
55
69
|
};
|
|
56
70
|
|
|
57
71
|
/**
|
|
@@ -308,7 +322,14 @@ IonImageryProvider.fromAssetId = async function (assetId, options) {
|
|
|
308
322
|
const options = { ...endpoint.options };
|
|
309
323
|
const url = options.url;
|
|
310
324
|
delete options.url;
|
|
311
|
-
|
|
325
|
+
if (["GOOGLE_2D_MAPS", "AZURE_MAPS"].includes(endpoint.externalType)) {
|
|
326
|
+
imageryProvider = await factory(
|
|
327
|
+
new IonResource(endpoint, endpointResource),
|
|
328
|
+
options,
|
|
329
|
+
);
|
|
330
|
+
} else {
|
|
331
|
+
imageryProvider = await factory(url, options);
|
|
332
|
+
}
|
|
312
333
|
}
|
|
313
334
|
|
|
314
335
|
const provider = new IonImageryProvider(options);
|