@cesium/engine 12.0.0 → 13.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.
Files changed (152) hide show
  1. package/Build/Workers/{chunk-2RHMHHJH.js → chunk-22NU5WU5.js} +2 -2
  2. package/Build/Workers/{chunk-3OM5QZSI.js → chunk-2IIE2UZ3.js} +2 -2
  3. package/Build/Workers/{chunk-WQCX7U65.js → chunk-2OD54CUD.js} +7 -7
  4. package/Build/Workers/{chunk-IT6AWHFV.js → chunk-2TSF7N76.js} +2 -2
  5. package/Build/Workers/{chunk-AL7BHP36.js → chunk-3VHIUS7I.js} +6 -6
  6. package/Build/Workers/{chunk-MSY2AAW2.js → chunk-3ZMTG4X5.js} +4 -4
  7. package/Build/Workers/{chunk-GZG526CC.js → chunk-4HS475MU.js} +14 -14
  8. package/Build/Workers/{chunk-4IQPX22D.js → chunk-4IM6WQEI.js} +6 -6
  9. package/Build/Workers/{chunk-7DSVCRFD.js → chunk-6HWW6KNV.js} +6 -6
  10. package/Build/Workers/{chunk-GUW6BS72.js → chunk-6ZOS2ACR.js} +7 -7
  11. package/Build/Workers/{chunk-7OISMGQF.js → chunk-BFNZUP2C.js} +7 -41
  12. package/Build/Workers/{chunk-WW5RTJ72.js → chunk-BLTSMJIP.js} +1 -1
  13. package/Build/Workers/{chunk-ES6Q5HWK.js → chunk-BZMHXDKV.js} +13 -13
  14. package/Build/Workers/{chunk-5YKJKOFE.js → chunk-CQDSGG3R.js} +7 -7
  15. package/Build/Workers/{chunk-ZZNBFQL5.js → chunk-CUMDCSMT.js} +11 -11
  16. package/Build/Workers/{chunk-BQNTN4CC.js → chunk-D3VPMNUR.js} +13 -13
  17. package/Build/Workers/{chunk-4ESQ3DN2.js → chunk-DIAH2ZTB.js} +9 -9
  18. package/Build/Workers/{chunk-VQZNBD3T.js → chunk-EXDSJZ7J.js} +4 -4
  19. package/Build/Workers/{chunk-T6FZFMTF.js → chunk-FANORJU6.js} +2 -2
  20. package/Build/Workers/{chunk-US3L7FXC.js → chunk-FLPIQK2R.js} +6 -6
  21. package/Build/Workers/{chunk-J64XIF5C.js → chunk-GBXJIWAZ.js} +34 -8
  22. package/Build/Workers/{chunk-TQK4D4AR.js → chunk-GJZQSAES.js} +7 -7
  23. package/Build/Workers/{chunk-X67KKHI7.js → chunk-GNG3V432.js} +4 -4
  24. package/Build/Workers/{chunk-B4AZL6Q4.js → chunk-H4Y7ADFL.js} +5 -5
  25. package/Build/Workers/{chunk-SXJ37VUC.js → chunk-H7BML7HH.js} +6 -6
  26. package/Build/Workers/{chunk-5FSKL7US.js → chunk-HMMPNR4Z.js} +12 -12
  27. package/Build/Workers/{chunk-ARTM66DL.js → chunk-JISDBAYP.js} +5 -5
  28. package/Build/Workers/{chunk-6DYMJ57Z.js → chunk-KCCTLUKK.js} +10 -10
  29. package/Build/Workers/{chunk-X7VRF25X.js → chunk-KKVKSTWC.js} +5 -5
  30. package/Build/Workers/{chunk-JGGZ3H4W.js → chunk-KRCUHV7P.js} +1 -1
  31. package/Build/Workers/{chunk-AOCENJVH.js → chunk-MMILY4S7.js} +11 -11
  32. package/Build/Workers/{chunk-GYHHNFW5.js → chunk-MSKD73KW.js} +10 -10
  33. package/Build/Workers/{chunk-C4IAULHW.js → chunk-NVFEDMX4.js} +15 -15
  34. package/Build/Workers/{chunk-YANQEHO5.js → chunk-OUIF26MQ.js} +6 -6
  35. package/Build/Workers/{chunk-GKBICLGC.js → chunk-OZZD3VY4.js} +17 -17
  36. package/Build/Workers/{chunk-56LALJCU.js → chunk-PD2MCNV7.js} +2 -2
  37. package/Build/Workers/{chunk-62YGXNGC.js → chunk-PMNQULFU.js} +7 -7
  38. package/Build/Workers/{chunk-3OHDXGFC.js → chunk-Q4MTXEB7.js} +6 -6
  39. package/Build/Workers/{chunk-4XPGN5Y7.js → chunk-RC5N5SJL.js} +7 -7
  40. package/Build/Workers/{chunk-IL6SMMDD.js → chunk-RGZWZ4PP.js} +4 -4
  41. package/Build/Workers/{chunk-GMGUR5GM.js → chunk-RIQGQMS4.js} +4 -4
  42. package/Build/Workers/{chunk-VUCVRDLD.js → chunk-RR4M3ZGF.js} +7 -7
  43. package/Build/Workers/{chunk-3UJV3W4Y.js → chunk-S4SCKDK4.js} +1 -1
  44. package/Build/Workers/{chunk-VGT4ONMC.js → chunk-T5H7YWC7.js} +17 -17
  45. package/Build/Workers/{chunk-QXBRZZQS.js → chunk-W2DVQETH.js} +10 -10
  46. package/Build/Workers/{chunk-HYUTWUXN.js → chunk-W2E67GLE.js} +13 -13
  47. package/Build/Workers/{chunk-3X2LXRHU.js → chunk-WXJY6NDI.js} +13 -13
  48. package/Build/Workers/{chunk-W2Q2F7JS.js → chunk-XQP37R5E.js} +5 -5
  49. package/Build/Workers/{chunk-VJVTWBXB.js → chunk-YBDL7YPF.js} +1 -1
  50. package/Build/Workers/{chunk-HILBDZUP.js → chunk-YDEZMDB7.js} +2 -2
  51. package/Build/Workers/{chunk-JRULXFCC.js → chunk-Z7OYBX6P.js} +5 -5
  52. package/Build/Workers/{chunk-2B5H7KIN.js → chunk-ZIWULRRD.js} +1 -1
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +31 -32
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +11 -11
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +7 -7
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/BingMapsGeocoderService.js +2 -0
  102. package/Source/Core/GoogleGeocoderService.js +110 -0
  103. package/Source/Core/ITwinPlatform.js +359 -0
  104. package/Source/Core/Ion.js +1 -1
  105. package/Source/Core/IonGeocodeProviderType.js +33 -0
  106. package/Source/Core/IonGeocoderService.js +72 -0
  107. package/Source/Core/Rectangle.js +0 -20
  108. package/Source/Core/TrackingReferenceFrame.js +45 -0
  109. package/Source/DataSources/Entity.js +15 -1
  110. package/Source/DataSources/EntityView.js +55 -4
  111. package/Source/DataSources/SampledProperty.js +24 -0
  112. package/Source/Renderer/ContextLimits.js +1 -1
  113. package/Source/Renderer/Texture.js +104 -92
  114. package/Source/Scene/ArcGisMapService.js +1 -1
  115. package/Source/Scene/Cesium3DTilesetStatistics.js +109 -42
  116. package/Source/Scene/DerivedCommand.js +109 -16
  117. package/Source/Scene/DynamicEnvironmentMapManager.js +130 -8
  118. package/Source/Scene/GltfTextureLoader.js +16 -1
  119. package/Source/Scene/ITwinData.js +138 -0
  120. package/Source/Scene/Label.js +17 -3
  121. package/Source/Scene/MetadataClassProperty.js +26 -0
  122. package/Source/Scene/MetadataPicking.js +108 -17
  123. package/Source/Scene/MetadataType.js +20 -0
  124. package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +6 -11
  125. package/Source/Scene/Model/Model3DTileContent.js +23 -1
  126. package/Source/Scene/Model/ModelStatistics.js +33 -5
  127. package/Source/Scene/Model/PointCloudStylingPipelineStage.js +2 -1
  128. package/Source/Scene/PickedMetadataInfo.js +21 -3
  129. package/Source/Scene/Picking.js +7 -1
  130. package/Source/Scene/PostProcessStage.js +14 -17
  131. package/Source/Scene/PostProcessStageCollection.js +4 -16
  132. package/Source/Scene/PostProcessStageLibrary.js +13 -51
  133. package/Source/Scene/PropertyAttributeProperty.js +15 -3
  134. package/Source/Scene/PropertyTextureProperty.js +12 -0
  135. package/Source/Scene/Scene.js +17 -2
  136. package/Source/Scene/SkyBox.js +23 -4
  137. package/Source/Scene/UrlTemplateImageryProvider.js +5 -5
  138. package/Source/Scene/createGooglePhotorealistic3DTileset.js +55 -16
  139. package/Source/Scene/getMetadataProperty.js +48 -0
  140. package/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl +1 -1
  141. package/Source/Shaders/Builtin/Functions/reverseLogDepth.js +1 -1
  142. package/Source/Shaders/ConvolveSpecularMapFS.glsl +1 -1
  143. package/Source/Shaders/ConvolveSpecularMapFS.js +1 -1
  144. package/Source/Shaders/Model/ModelFS.glsl +7 -0
  145. package/Source/Shaders/Model/ModelFS.js +7 -0
  146. package/Source/Shaders/Model/ModelVS.glsl +9 -1
  147. package/Source/Shaders/Model/ModelVS.js +9 -1
  148. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +66 -37
  149. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +66 -37
  150. package/index.d.ts +286 -40
  151. package/index.js +59 -53
  152. package/package.json +1 -1
@@ -0,0 +1,359 @@
1
+ import Check from "./Check.js";
2
+ import defined from "./defined.js";
3
+ import DeveloperError from "./DeveloperError.js";
4
+ import Resource from "./Resource.js";
5
+ import RuntimeError from "./RuntimeError.js";
6
+
7
+ /**
8
+ * Default settings for accessing the iTwin platform.
9
+ *
10
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
11
+ *
12
+ * @see ITwinData
13
+ * @namespace ITwinPlatform
14
+ */
15
+ const ITwinPlatform = {};
16
+
17
+ /**
18
+ * Status states for a mesh-export export.
19
+ * Valid values are: <code>NotStarted</code>, <code>InProgress</code>, <code>Complete</code>, <code>Invalid</code>
20
+ * @enum {string}
21
+ */
22
+ ITwinPlatform.ExportStatus = Object.freeze({
23
+ NotStarted: "NotStarted",
24
+ InProgress: "InProgress",
25
+ Complete: "Complete",
26
+ Invalid: "Invalid",
27
+ });
28
+
29
+ /**
30
+ * Types of mesh-export exports. CesiumJS only supports loading <code>3DTILES</code> type exports.
31
+ * Valid values are: <code>IMODEL</code>, <code>CESIUM</code>, <code>3DTILES</code>
32
+ * @enum {string}
33
+ */
34
+ ITwinPlatform.ExportType = Object.freeze({
35
+ IMODEL: "IMODEL",
36
+ CESIUM: "CESIUM",
37
+ "3DTILES": "3DTILES",
38
+ });
39
+
40
+ /**
41
+ * Types of Reality data
42
+ * @see https://developer.bentley.com/apis/reality-management/rm-rd-details/#types
43
+ * @enum {string}
44
+ */
45
+ ITwinPlatform.RealityDataType = Object.freeze({
46
+ Cesium3DTiles: "Cesium3DTiles",
47
+ PNTS: "PNTS",
48
+ OPC: "OPC",
49
+ RealityMesh3DTiles: "RealityMesh3DTiles",
50
+ Terrain3DTiles: "Terrain3DTiles",
51
+ "3MX": "3MX",
52
+ "3SM": "3SM",
53
+ CCCloudProject: "CCCloudProject",
54
+ CCImageCollection: "CCImageCollection",
55
+ CCOrientations: "CCOrientations",
56
+ ContextCaptureInputs: "ContextCaptureInputs",
57
+ ContextDetector: "ContextDetector",
58
+ ContextScene: "ContextScene",
59
+ DAE: "DAE",
60
+ DGN: "DGN",
61
+ DSM: "DSM",
62
+ FBX: "FBX",
63
+ GLB: "GLB",
64
+ GLTF: "GLTF",
65
+ KML: "KML",
66
+ LAS: "LAS",
67
+ LAZ: "LAZ",
68
+ LOD: "LOD",
69
+ LodTree: "LodTree",
70
+ OBJ: "OBJ",
71
+ OMI: "OMI",
72
+ OMR: "OMR",
73
+ Orthophoto: "Orthophoto",
74
+ OrthophotoDSM: "OrthophotoDSM",
75
+ OSGB: "OSGB",
76
+ OVF: "OVF",
77
+ OBT: "OBT",
78
+ PLY: "PLY",
79
+ PointCloud: "PointCloud",
80
+ S3C: "S3C",
81
+ ScanCollection: "ScanCollection",
82
+ SHP: "SHP",
83
+ SLPK: "SLPK",
84
+ SpaceEyes3D: "SpaceEyes3D",
85
+ STL: "STL",
86
+ TSM: "TSM",
87
+ Unstructured: "Unstructured",
88
+ Other: "Other",
89
+ });
90
+
91
+ /**
92
+ * Gets or sets the default iTwin access token. This token should have the <code>itwin-platform</code> scope.
93
+ *
94
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
95
+ *
96
+ * @type {string|undefined}
97
+ */
98
+ ITwinPlatform.defaultAccessToken = undefined;
99
+
100
+ /**
101
+ * Gets or sets the default iTwin API endpoint.
102
+ *
103
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
104
+ *
105
+ * @type {string|Resource}
106
+ * @default "https://api.bentley.com"
107
+ */
108
+ ITwinPlatform.apiEndpoint = new Resource({
109
+ url: "https://api.bentley.com",
110
+ });
111
+
112
+ /**
113
+ * @typedef {Object} ExportRequest
114
+ * @private
115
+ * @property {string} iModelId
116
+ * @property {string} changesetId
117
+ * @property {ITwinPlatform.ExportType} exportType Type of the export. CesiumJS only supports the 3DTILES type
118
+ */
119
+
120
+ /**
121
+ * @typedef {Object} Link
122
+ * @private
123
+ * @property {string} href
124
+ */
125
+
126
+ /**
127
+ * @typedef {Object} ExportRepresentation
128
+ * The export objects from get-exports when using return=representation
129
+ * @private
130
+ * @property {string} id Export id
131
+ * @property {string} displayName Name of the iModel
132
+ * @property {ITwinPlatform.ExportStatus} status Status of this export
133
+ * @property {string} lastModified
134
+ * @property {ExportRequest} request Object containing info about the export itself
135
+ * @property {{mesh: Link}} _links Object containing relevant links. For Exports this includes the access url for the mesh itself
136
+ */
137
+
138
+ /**
139
+ * @typedef {Object} GetExportsResponse
140
+ * @private
141
+ * @property {ExportRepresentation[]} exports The list of exports for the current page
142
+ * @property {{self: Link, next: Link | undefined, prev: Link | undefined}} _links Pagination links
143
+ */
144
+
145
+ /**
146
+ * Get the list of exports for the specified iModel at it's most current version.
147
+ * This will only return the top 5 exports with {@link ITwinPlatform.ExportType} of <code>3DTILES</code>.
148
+ *
149
+ * @private
150
+ *
151
+ * @param {string} iModelId iModel id
152
+ * @returns {Promise<GetExportsResponse>}
153
+ *
154
+ * @throws {RuntimeError} If the iTwin API request is not successful
155
+ */
156
+ ITwinPlatform.getExports = async function (iModelId) {
157
+ //>>includeStart('debug', pragmas.debug);
158
+ Check.typeOf.string("iModelId", iModelId);
159
+ if (!defined(ITwinPlatform.defaultAccessToken)) {
160
+ throw new DeveloperError("Must set ITwinPlatform.defaultAccessToken first");
161
+ }
162
+ //>>includeEnd('debug')
163
+
164
+ const resource = new Resource({
165
+ url: `${ITwinPlatform.apiEndpoint}mesh-export`,
166
+ headers: {
167
+ Authorization: `Bearer ${ITwinPlatform.defaultAccessToken}`,
168
+ Accept: "application/vnd.bentley.itwin-platform.v1+json",
169
+ Prefer: "return=representation",
170
+ },
171
+ queryParameters: {
172
+ iModelId: iModelId,
173
+ exportType: ITwinPlatform.ExportType["3DTILES"],
174
+ // With the export auto-generation it will auto-delete the 6th export so
175
+ // there should never be more than 5 results. Just request them all and parse
176
+ // for ones that are COMPLETE
177
+ $top: "5",
178
+ client: "CesiumJS",
179
+ },
180
+ });
181
+ /* global CESIUM_VERSION */
182
+ if (typeof CESIUM_VERSION !== "undefined") {
183
+ resource.appendQueryParameters({ clientVersion: CESIUM_VERSION });
184
+ }
185
+
186
+ try {
187
+ const response = await resource.fetchJson();
188
+ return response;
189
+ } catch (error) {
190
+ const result = JSON.parse(error.response);
191
+ if (error.statusCode === 401) {
192
+ throw new RuntimeError(
193
+ `Unauthorized, bad token, wrong scopes or headers bad. ${result.error.details[0].code}`,
194
+ );
195
+ } else if (error.statusCode === 403) {
196
+ console.error(result.error.code, result.error.message);
197
+ throw new RuntimeError("Not allowed, forbidden");
198
+ } else if (error.statusCode === 422) {
199
+ throw new RuntimeError(
200
+ `Unprocessable Entity:${result.error.code} ${result.error.message}`,
201
+ );
202
+ } else if (error.statusCode === 429) {
203
+ throw new RuntimeError("Too many requests");
204
+ }
205
+ throw new RuntimeError(`Unknown request failure ${error.statusCode}`);
206
+ }
207
+ };
208
+
209
+ /**
210
+ * @typedef {Object} RealityDataExtent
211
+ * @private
212
+ * @property {{latitude: number, longitude: number}} southWest
213
+ * @property {{latitude: number, longitude: number}} northEast
214
+ */
215
+
216
+ /**
217
+ * @typedef {Object} RealityDataRepresentation
218
+ * @private
219
+ * @property {string} id "95d8dccd-d89e-4287-bb5f-3219acbc71ae",
220
+ * @property {string} displayName "Name of reality data",
221
+ * @property {string} dataset "Dataset",
222
+ * @property {string} group "73d09423-28c3-4fdb-ab4a-03a47a5b04f8",
223
+ * @property {string} description "Description of reality data",
224
+ * @property {string} rootDocument "Directory/SubDirectory/realityData.3mx",
225
+ * @property {number} size 6521212,
226
+ * @property {string} classification "Model",
227
+ * @property {ITwinPlatform.RealityDataType} type "3MX",
228
+ * @property {{startDateTime: string, endDateTime: string, acquirer: string}} acquisition
229
+ * @property {RealityDataExtent} extent
230
+ * @property {boolean} authoring false,
231
+ * @property {string} dataCenterLocation "North Europe",
232
+ * @property {string} modifiedDateTime "2021-04-09T19:03:12Z",
233
+ * @property {string} lastAccessedDateTime "2021-04-09T00:00:00Z",
234
+ * @property {string} createdDateTime "2021-02-22T20:03:40Z",
235
+ * @property {string} ownerId "f1d49cc7-f9b3-494f-9c67-563ea5597063",
236
+ */
237
+
238
+ /**
239
+ * Load the full metadata for the given iTwin id and reality data id.
240
+ *
241
+ * @private
242
+ *
243
+ * @param {string} iTwinId The id of the iTwin to load data from
244
+ * @param {string} realityDataId The id of the reality data to load
245
+ * @returns {Promise<RealityDataRepresentation>}
246
+ */
247
+ ITwinPlatform.getRealityDataMetadata = async function (iTwinId, realityDataId) {
248
+ //>>includeStart('debug', pragmas.debug);
249
+ Check.typeOf.string("iTwinId", iTwinId);
250
+ Check.typeOf.string("realityDataId", realityDataId);
251
+ if (!defined(ITwinPlatform.defaultAccessToken)) {
252
+ throw new DeveloperError("Must set ITwinPlatform.defaultAccessToken first");
253
+ }
254
+ //>>includeEnd('debug')
255
+
256
+ const resource = new Resource({
257
+ url: `${ITwinPlatform.apiEndpoint}reality-management/reality-data/${realityDataId}`,
258
+ headers: {
259
+ Authorization: `Bearer ${ITwinPlatform.defaultAccessToken}`,
260
+ Accept: "application/vnd.bentley.itwin-platform.v1+json",
261
+ },
262
+ queryParameters: { iTwinId: iTwinId },
263
+ });
264
+
265
+ try {
266
+ const response = await resource.fetchJson();
267
+ return response.realityData;
268
+ } catch (error) {
269
+ const result = JSON.parse(error.response);
270
+ if (error.statusCode === 401) {
271
+ throw new RuntimeError(
272
+ `Unauthorized, bad token, wrong scopes or headers bad. ${result.error.details[0].code}`,
273
+ );
274
+ } else if (error.statusCode === 403) {
275
+ console.error(result.error.code, result.error.message);
276
+ throw new RuntimeError("Not allowed, forbidden");
277
+ } else if (error.statusCode === 404) {
278
+ throw new RuntimeError(
279
+ `Reality data not found: ${iTwinId}, ${realityDataId}`,
280
+ );
281
+ } else if (error.statusCode === 422) {
282
+ throw new RuntimeError(
283
+ `Unprocessable Entity:${result.error.code} ${result.error.message}`,
284
+ );
285
+ } else if (error.statusCode === 429) {
286
+ throw new RuntimeError("Too many requests");
287
+ }
288
+ throw new RuntimeError(`Unknown request failure ${error.statusCode}`);
289
+ }
290
+ };
291
+
292
+ /**
293
+ * Request the access url for the given iTwin id, reality data id and root document.
294
+ * The root document can be requested from the list using <code>return=representation</code>
295
+ * or the metadata route from {@link ITwinPlatform.getRealityDataMetadata}
296
+ *
297
+ * @private
298
+ *
299
+ * @param {string} iTwinId The id of the iTwin to load data from
300
+ * @param {string} realityDataId The id of the reality data to load
301
+ * @param {string} rootDocument The path of the root document for this reality data
302
+ * @returns {Promise<string>}
303
+ */
304
+ ITwinPlatform.getRealityDataURL = async function (
305
+ iTwinId,
306
+ realityDataId,
307
+ rootDocument,
308
+ ) {
309
+ //>>includeStart('debug', pragmas.debug);
310
+ Check.typeOf.string("iTwinId", iTwinId);
311
+ Check.typeOf.string("realityDataId", realityDataId);
312
+ Check.typeOf.string("rootDocument", rootDocument);
313
+ if (!defined(ITwinPlatform.defaultAccessToken)) {
314
+ throw new DeveloperError("Must set ITwinPlatform.defaultAccessToken first");
315
+ }
316
+ //>>includeEnd('debug')
317
+
318
+ const resource = new Resource({
319
+ url: `${ITwinPlatform.apiEndpoint}reality-management/reality-data/${realityDataId}/readaccess`,
320
+ headers: {
321
+ Authorization: `Bearer ${ITwinPlatform.defaultAccessToken}`,
322
+ Accept: "application/vnd.bentley.itwin-platform.v1+json",
323
+ },
324
+ queryParameters: { iTwinId: iTwinId },
325
+ });
326
+
327
+ try {
328
+ const result = await resource.fetchJson();
329
+
330
+ const containerUrl = result._links.containerUrl.href;
331
+ const tilesetUrl = new URL(containerUrl);
332
+ tilesetUrl.pathname = `${tilesetUrl.pathname}/${rootDocument}`;
333
+
334
+ return tilesetUrl.toString();
335
+ } catch (error) {
336
+ const result = JSON.parse(error.response);
337
+ if (error.statusCode === 401) {
338
+ throw new RuntimeError(
339
+ `Unauthorized, bad token, wrong scopes or headers bad. ${result.error.details[0].code}`,
340
+ );
341
+ } else if (error.statusCode === 403) {
342
+ console.error(result.error.code, result.error.message);
343
+ throw new RuntimeError("Not allowed, forbidden");
344
+ } else if (error.statusCode === 404) {
345
+ throw new RuntimeError(
346
+ `Reality data not found: ${iTwinId}, ${realityDataId}`,
347
+ );
348
+ } else if (error.statusCode === 422) {
349
+ throw new RuntimeError(
350
+ `Unprocessable Entity:${result.error.code} ${result.error.message}`,
351
+ );
352
+ } else if (error.statusCode === 429) {
353
+ throw new RuntimeError("Too many requests");
354
+ }
355
+ throw new RuntimeError(`Unknown request failure ${error.statusCode}`);
356
+ }
357
+ };
358
+
359
+ export default ITwinPlatform;
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiZjBmMDE4Ny05M2JlLTRlMzgtYjIxYi05YmJjM2QwMzJkYWMiLCJpZCI6MjU5LCJpYXQiOjE3MzA0NjY3MDl9.t-7gCGPUe-oGCyCoeXPtYmlMVdgqUQD9mn-Da23yUoI";
7
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0ZDdmNWJiNy0wMmNlLTQ1MWUtODM2YS02NGM1MTBlOGMwMWQiLCJpZCI6MjU5LCJpYXQiOjE3MzMxNTc4OTV9.B3URHf0VdHDtGckb-hv7uqATdn8KfvkiuoAFZUq8tAo";
8
8
  /**
9
9
  * Default settings for accessing the Cesium ion API.
10
10
  *
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Underlying geocoding services that can be used via Cesium ion.
3
+ *
4
+ * @enum {string}
5
+ */
6
+ const IonGeocodeProviderType = {
7
+ /**
8
+ * Google geocoder, for use with Google data.
9
+ *
10
+ * @type {string}
11
+ * @constant
12
+ */
13
+ GOOGLE: "GOOGLE",
14
+
15
+ /**
16
+ * Bing geocoder, for use with Bing data.
17
+ *
18
+ * @type {string}
19
+ * @constant
20
+ */
21
+ BING: "BING",
22
+
23
+ /**
24
+ * Use the default geocoder as set on the server. Used when neither Bing or
25
+ * Google data is used.
26
+ *
27
+ * @type {string}
28
+ * @constant
29
+ */
30
+ DEFAULT: "DEFAULT",
31
+ };
32
+
33
+ export default Object.freeze(IonGeocodeProviderType);
@@ -2,10 +2,45 @@ import Check from "./Check.js";
2
2
  import Credit from "./Credit.js";
3
3
  import defaultValue from "./defaultValue.js";
4
4
  import defined from "./defined.js";
5
+ import DeveloperError from "./DeveloperError.js";
5
6
  import Ion from "./Ion.js";
7
+ import IonGeocodeProviderType from "./IonGeocodeProviderType.js";
6
8
  import PeliasGeocoderService from "./PeliasGeocoderService.js";
7
9
  import Resource from "./Resource.js";
8
10
 
11
+ /**
12
+ * @param {*} geocodeProviderType
13
+ * @throws {DeveloperError}
14
+ * @private
15
+ */
16
+ function validateIonGeocodeProviderType(geocodeProviderType) {
17
+ if (
18
+ !Object.values(IonGeocodeProviderType).some(
19
+ (value) => value === geocodeProviderType,
20
+ )
21
+ ) {
22
+ throw new DeveloperError(
23
+ `Invalid geocodeProviderType: "${geocodeProviderType}"`,
24
+ );
25
+ }
26
+ }
27
+
28
+ const providerToParameterMap = Object.freeze({
29
+ [IonGeocodeProviderType.GOOGLE]: "google",
30
+ [IonGeocodeProviderType.BING]: "bing",
31
+ [IonGeocodeProviderType.DEFAULT]: undefined,
32
+ });
33
+
34
+ function providerToQueryParameter(provider) {
35
+ return providerToParameterMap[provider];
36
+ }
37
+
38
+ function queryParameterToProvider(parameter) {
39
+ return Object.entries(providerToParameterMap).find(
40
+ (entry) => entry[1] === parameter,
41
+ )[0];
42
+ }
43
+
9
44
  /**
10
45
  * Provides geocoding through Cesium ion.
11
46
  * @alias IonGeocoderService
@@ -15,6 +50,7 @@ import Resource from "./Resource.js";
15
50
  * @param {Scene} options.scene The scene
16
51
  * @param {string} [options.accessToken=Ion.defaultAccessToken] The access token to use.
17
52
  * @param {string|Resource} [options.server=Ion.defaultServer] The resource to the Cesium ion API server.
53
+ * @param {IonGeocodeProviderType} [options.geocodeProviderType=IonGeocodeProviderType.DEFAULT] The geocoder the Cesium ion API server should use to fulfill this request.
18
54
  *
19
55
  * @see Ion
20
56
  */
@@ -25,6 +61,14 @@ function IonGeocoderService(options) {
25
61
  Check.typeOf.object("options.scene", options.scene);
26
62
  //>>includeEnd('debug');
27
63
 
64
+ const geocodeProviderType = defaultValue(
65
+ options.geocodeProviderType,
66
+ IonGeocodeProviderType.DEFAULT,
67
+ );
68
+ //>>includeStart('debug', pragmas.debug);
69
+ validateIonGeocodeProviderType(geocodeProviderType);
70
+ //>>includeEnd('debug');
71
+
28
72
  const accessToken = defaultValue(options.accessToken, Ion.defaultAccessToken);
29
73
  const server = Resource.createIfNeeded(
30
74
  defaultValue(options.server, Ion.defaultServer),
@@ -49,6 +93,9 @@ function IonGeocoderService(options) {
49
93
  this._accessToken = accessToken;
50
94
  this._server = server;
51
95
  this._pelias = new PeliasGeocoderService(searchEndpoint);
96
+ // geocoderProviderType isn't stored here directly but instead relies on the
97
+ // query parameters of this._pelias.url. Use the setter logic to update value.
98
+ this.geocodeProviderType = geocodeProviderType;
52
99
  }
53
100
 
54
101
  Object.defineProperties(IonGeocoderService.prototype, {
@@ -64,6 +111,31 @@ Object.defineProperties(IonGeocoderService.prototype, {
64
111
  return undefined;
65
112
  },
66
113
  },
114
+ /**
115
+ * The geocoding service that Cesium ion API server should use to fulfill geocding requests.
116
+ * @memberof IonGeocoderService.prototype
117
+ * @type {IonGeocodeProviderType}
118
+ * @default IonGeocodeProviderType.DEFAULT
119
+ */
120
+ geocodeProviderType: {
121
+ get: function () {
122
+ return queryParameterToProvider(
123
+ this._pelias.url.queryParameters["geocoder"],
124
+ );
125
+ },
126
+ set: function (geocodeProviderType) {
127
+ validateIonGeocodeProviderType(geocodeProviderType);
128
+ const query = {
129
+ ...this._pelias.url.queryParameters,
130
+ geocoder: providerToQueryParameter(geocodeProviderType),
131
+ };
132
+ // Delete the geocoder parameter to prevent sending &geocoder=undefined in the query
133
+ if (!defined(query.geocoder)) {
134
+ delete query.geocoder;
135
+ }
136
+ this._pelias.url.setQueryParameters(query);
137
+ },
138
+ },
67
139
  });
68
140
 
69
141
  /**
@@ -7,7 +7,6 @@ import Ellipsoid from "./Ellipsoid.js";
7
7
  import CesiumMath from "./Math.js";
8
8
  import Transforms from "./Transforms.js";
9
9
  import Matrix4 from "./Matrix4.js";
10
- import deprecationWarning from "./deprecationWarning.js";
11
10
 
12
11
  /**
13
12
  * A two dimensional region specified as longitude and latitude coordinates.
@@ -533,25 +532,6 @@ Rectangle.prototype.equalsEpsilon = function (other, epsilon) {
533
532
  return Rectangle.equalsEpsilon(this, other, epsilon);
534
533
  };
535
534
 
536
- /**
537
- * Checks a Rectangle's properties and throws if they are not in valid ranges.
538
- *
539
- * @param {Rectangle} rectangle The rectangle to validate
540
- *
541
- * @exception {DeveloperError} <code>north</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
542
- * @exception {DeveloperError} <code>south</code> must be in the interval [<code>-Pi/2</code>, <code>Pi/2</code>].
543
- * @exception {DeveloperError} <code>east</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
544
- * @exception {DeveloperError} <code>west</code> must be in the interval [<code>-Pi</code>, <code>Pi</code>].
545
- * @deprecated This function is deprecated and will be removed in Cesium 1.124. See <a href="https://github.com/CesiumGS/cesium/issues/4921">Issue 4921</a>
546
- */
547
- Rectangle.validate = function (rectangle) {
548
- deprecationWarning(
549
- "Rectangle.validate",
550
- "Rectangle.validate is a no-op and has been deprecated. It will be removed in Cesium 1.124.",
551
- );
552
- return Rectangle._validate(rectangle);
553
- };
554
-
555
535
  /**
556
536
  * Checks a Rectangle's properties and throws if they are not in valid ranges.
557
537
  *
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Constants for identifying well-known tracking reference frames.
3
+ *
4
+ * @enum {number}
5
+ */
6
+ const TrackingReferenceFrame = {
7
+ /**
8
+ * Auto-detect algorithm. The reference frame used to track the Entity will
9
+ * be automatically selected based on its trajectory: near-surface slow moving
10
+ * objects will be tracked in the entity's local east-north-up reference
11
+ * frame, while faster objects like satellites will use VVLH (Vehicle Velocity,
12
+ * Local Horizontal).
13
+ *
14
+ * @type {number}
15
+ * @constant
16
+ */
17
+ AUTODETECT: 0,
18
+
19
+ /**
20
+ * The entity's local East-North-Up reference frame.
21
+ *
22
+ * @type {number}
23
+ * @constant
24
+ */
25
+ ENU: 1,
26
+
27
+ /**
28
+ * The entity's inertial reference frame. If entity has no defined orientation
29
+ * property, it falls back to auto-detect algorithm.
30
+ *
31
+ * @type {number}
32
+ * @constant
33
+ */
34
+ INERTIAL: 2,
35
+
36
+ /**
37
+ * The entity's inertial reference frame with orientation fixed to its
38
+ * {@link VelocityOrientationProperty}, ignoring its own orientation.
39
+ *
40
+ * @type {number}
41
+ * @constant
42
+ */
43
+ VELOCITY: 3,
44
+ };
45
+ export default Object.freeze(TrackingReferenceFrame);
@@ -10,6 +10,7 @@ import CesiumMath from "../Core/Math.js";
10
10
  import Matrix3 from "../Core/Matrix3.js";
11
11
  import Matrix4 from "../Core/Matrix4.js";
12
12
  import Quaternion from "../Core/Quaternion.js";
13
+ import TrackingReferenceFrame from "../Core/TrackingReferenceFrame.js";
13
14
  import Transforms from "../Core/Transforms.js";
14
15
  import GroundPolylinePrimitive from "../Scene/GroundPolylinePrimitive.js";
15
16
  import GroundPrimitive from "../Scene/GroundPrimitive.js";
@@ -73,8 +74,9 @@ function createPropertyTypeDescriptor(name, Type) {
73
74
  * @property {string} [name] A human readable name to display to users. It does not have to be unique.
74
75
  * @property {TimeIntervalCollection} [availability] The availability, if any, associated with this object.
75
76
  * @property {boolean} [show] A boolean value indicating if the entity and its children are displayed.
77
+ * @property {TrackingReferenceFrame} [trackingReferenceFrame=TrackingReferenceFrame.AUTODETECT] The reference frame used when this entity is being tracked. <br/> If <code>undefined</code>, reference frame is determined based on entity velocity: near-surface slow moving entities are tracked using the local east-north-up reference frame, whereas fast moving entities such as satellites are tracked using VVLH (Vehicle Velocity, Local Horizontal).
76
78
  * @property {Property | string} [description] A string Property specifying an HTML description for this entity.
77
- * @property {PositionProperty | Cartesian3 | CallbackProperty} [position] A Property specifying the entity position.
79
+ * @property {PositionProperty | Cartesian3 | CallbackPositionProperty} [position] A Property specifying the entity position.
78
80
  * @property {Property | Quaternion} [orientation=Transforms.eastNorthUpToFixedFrame(position)] A Property specifying the entity orientation in respect to Earth-fixed-Earth-centered (ECEF). If undefined, east-north-up at entity position is used.
79
81
  * @property {Property | Cartesian3} [viewFrom] A suggested initial offset for viewing this object.
80
82
  * @property {Entity} [parent] A parent entity to associate with this entity.
@@ -122,6 +124,10 @@ function Entity(options) {
122
124
  this._definitionChanged = new Event();
123
125
  this._name = options.name;
124
126
  this._show = defaultValue(options.show, true);
127
+ this._trackingReferenceFrame = defaultValue(
128
+ options.trackingReferenceFrame,
129
+ TrackingReferenceFrame.AUTODETECT,
130
+ );
125
131
  this._parent = undefined;
126
132
  this._propertyNames = [
127
133
  "billboard",
@@ -296,6 +302,14 @@ Object.defineProperties(Entity.prototype, {
296
302
  this._definitionChanged.raiseEvent(this, "show", value, !value);
297
303
  },
298
304
  },
305
+ /**
306
+ * Gets or sets the entity's tracking reference frame.
307
+ * @demo {@link https://sandcastle.cesium.com/index.html?src=Entity tracking.html|Cesium Sandcastle Entity tracking Demo}
308
+ *
309
+ * @memberof Entity.prototype
310
+ * @type {TrackingReferenceFrame}
311
+ */
312
+ trackingReferenceFrame: createRawPropertyDescriptor("trackingReferenceFrame"),
299
313
  /**
300
314
  * Gets whether this entity is being displayed, taking into account
301
315
  * the visibility of any ancestor entities.