itowns 2.42.1-next.2 → 2.42.1-next.21

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 (180) hide show
  1. package/dist/debug.js +1 -1
  2. package/dist/debug.js.map +1 -1
  3. package/dist/itowns.js +1 -1
  4. package/dist/itowns.js.map +1 -1
  5. package/dist/itowns_widgets.js +1 -1
  6. package/dist/itowns_widgets.js.map +1 -1
  7. package/examples/{.eslintrc.js → .eslintrc.cjs} +1 -1
  8. package/examples/effects_stereo.html +2 -2
  9. package/examples/entwine_simple_loader.html +24 -8
  10. package/examples/misc_collada.html +2 -2
  11. package/examples/misc_instancing.html +1 -1
  12. package/examples/source_file_gpx_3d.html +2 -2
  13. package/examples/source_stream_wfs_25d.html +11 -11
  14. package/examples/source_stream_wfs_3d.html +1 -1
  15. package/examples/vector_tile_3d_mesh.html +2 -2
  16. package/examples/vector_tile_raster_2d.html +1 -1
  17. package/examples/vector_tile_raster_3d.html +1 -1
  18. package/examples/view_25d_map.html +2 -2
  19. package/examples/view_3d_map.html +3 -3
  20. package/examples/view_3d_map_webxr.html +1 -1
  21. package/examples/view_3d_mns_map.html +3 -3
  22. package/examples/view_immersive.html +1 -1
  23. package/examples/view_multi_25d.html +2 -2
  24. package/examples/widgets_minimap.html +1 -1
  25. package/examples/widgets_searchbar.html +2 -2
  26. package/lib/Controls/FirstPersonControls.js +5 -12
  27. package/lib/Controls/FlyControls.js +4 -13
  28. package/lib/Controls/GlobeControls.js +33 -43
  29. package/lib/Controls/PlanarControls.js +9 -20
  30. package/lib/Controls/StateControl.js +2 -11
  31. package/lib/Controls/StreetControls.js +14 -24
  32. package/lib/Converter/Feature2Mesh.js +77 -70
  33. package/lib/Converter/Feature2Texture.js +15 -25
  34. package/lib/Converter/convertToTile.js +16 -26
  35. package/lib/Converter/textureConverter.js +9 -19
  36. package/lib/Core/3DTiles/C3DTBatchTable.js +5 -13
  37. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +1 -8
  38. package/lib/Core/3DTiles/C3DTBoundingVolume.js +17 -27
  39. package/lib/Core/3DTiles/C3DTExtensions.js +1 -8
  40. package/lib/Core/3DTiles/C3DTFeature.js +3 -10
  41. package/lib/Core/3DTiles/C3DTilesEnums.js +3 -11
  42. package/lib/Core/3DTiles/C3DTileset.js +7 -16
  43. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +5 -11
  44. package/lib/Core/AnimationPlayer.js +2 -11
  45. package/lib/Core/Deprecated/Undeprecator.js +9 -20
  46. package/lib/Core/EntwinePointTileNode.js +6 -16
  47. package/lib/Core/Feature.js +16 -30
  48. package/lib/Core/Geographic/CoordStars.js +3 -12
  49. package/lib/Core/Geographic/Coordinates.js +12 -22
  50. package/lib/Core/Geographic/Crs.js +7 -15
  51. package/lib/Core/Geographic/Extent.js +36 -47
  52. package/lib/Core/Geographic/GeoidGrid.js +6 -16
  53. package/lib/Core/Label.js +7 -17
  54. package/lib/Core/MainLoop.js +7 -16
  55. package/lib/Core/Math/Ellipsoid.js +6 -17
  56. package/lib/Core/Picking.js +10 -20
  57. package/lib/Core/PointCloudNode.js +2 -11
  58. package/lib/Core/PotreeNode.js +4 -13
  59. package/lib/Core/Prefab/Globe/Atmosphere.js +17 -26
  60. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +6 -16
  61. package/lib/Core/Prefab/Globe/GlobeLayer.js +19 -28
  62. package/lib/Core/Prefab/Globe/SkyShader.js +2 -11
  63. package/lib/Core/Prefab/GlobeView.js +27 -45
  64. package/lib/Core/Prefab/Planar/PlanarLayer.js +11 -20
  65. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +6 -16
  66. package/lib/Core/Prefab/PlanarView.js +10 -25
  67. package/lib/Core/Prefab/TileBuilder.js +13 -22
  68. package/lib/Core/Prefab/computeBufferTileGeometry.js +12 -16
  69. package/lib/Core/Scheduler/Cache.js +2 -10
  70. package/lib/Core/Scheduler/CancelledCommandException.js +1 -8
  71. package/lib/Core/Scheduler/Scheduler.js +15 -23
  72. package/lib/Core/Style.js +26 -40
  73. package/lib/Core/System/Capabilities.js +2 -13
  74. package/lib/Core/TileGeometry.js +13 -15
  75. package/lib/Core/TileMesh.js +6 -15
  76. package/lib/Core/View.js +43 -58
  77. package/lib/Layer/C3DTilesLayer.js +29 -41
  78. package/lib/Layer/ColorLayer.js +10 -16
  79. package/lib/Layer/ElevationLayer.js +7 -14
  80. package/lib/Layer/EntwinePointTileLayer.js +11 -18
  81. package/lib/Layer/FeatureGeometryLayer.js +9 -16
  82. package/lib/Layer/GeoidLayer.js +6 -15
  83. package/lib/Layer/GeometryLayer.js +11 -17
  84. package/lib/Layer/InfoLayer.js +5 -14
  85. package/lib/Layer/LabelLayer.js +22 -32
  86. package/lib/Layer/Layer.js +16 -26
  87. package/lib/Layer/LayerUpdateState.js +1 -8
  88. package/lib/Layer/LayerUpdateStrategy.js +7 -18
  89. package/lib/Layer/OrientedImageLayer.js +15 -25
  90. package/lib/Layer/PointCloudLayer.js +27 -24
  91. package/lib/Layer/PotreeLayer.js +8 -18
  92. package/lib/Layer/RasterLayer.js +9 -17
  93. package/lib/Layer/ReferencingLayerProperties.js +1 -8
  94. package/lib/Layer/TiledGeometryLayer.js +37 -33
  95. package/lib/Main.js +86 -707
  96. package/lib/MainBundle.js +4 -34
  97. package/lib/Parser/B3dmParser.js +80 -131
  98. package/lib/Parser/CameraCalibrationParser.js +5 -14
  99. package/lib/Parser/GDFParser.js +11 -22
  100. package/lib/Parser/GLTFParser.js +88 -0
  101. package/lib/Parser/GTXParser.js +9 -21
  102. package/lib/Parser/GeoJsonParser.js +14 -22
  103. package/lib/Parser/GpxParser.js +7 -14
  104. package/lib/Parser/ISGParser.js +19 -28
  105. package/lib/Parser/KMLParser.js +7 -14
  106. package/lib/Parser/LASLoader.js +31 -21
  107. package/lib/Parser/LASParser.js +10 -17
  108. package/lib/Parser/MapBoxUrlParser.js +2 -9
  109. package/lib/Parser/PntsParser.js +4 -14
  110. package/lib/Parser/PotreeBinParser.js +8 -16
  111. package/lib/Parser/PotreeCinParser.js +3 -12
  112. package/lib/Parser/ShapefileParser.js +11 -18
  113. package/lib/Parser/VectorTileParser.js +23 -31
  114. package/lib/Parser/XbilParser.js +5 -13
  115. package/lib/Parser/deprecated/LegacyGLTFLoader.js +2 -12
  116. package/lib/Process/3dTilesProcessing.js +14 -27
  117. package/lib/Process/FeatureProcessing.js +14 -22
  118. package/lib/Process/LayeredMaterialNodeProcessing.js +19 -28
  119. package/lib/Process/ObjectRemovalHelper.js +2 -9
  120. package/lib/Process/handlerNodeError.js +1 -7
  121. package/lib/Provider/3dTilesProvider.js +32 -29
  122. package/lib/Provider/DataSourceProvider.js +2 -9
  123. package/lib/Provider/Fetcher.js +40 -22
  124. package/lib/Provider/PointCloudProvider.js +7 -19
  125. package/lib/Provider/TileProvider.js +4 -12
  126. package/lib/Provider/URLBuilder.js +4 -12
  127. package/lib/Renderer/Camera.js +7 -17
  128. package/lib/Renderer/Color.js +3 -11
  129. package/lib/Renderer/ColorLayersOrdering.js +14 -22
  130. package/lib/Renderer/CommonMaterial.js +3 -12
  131. package/lib/Renderer/Label2DRenderer.js +5 -16
  132. package/lib/Renderer/LayeredMaterial.js +33 -53
  133. package/lib/Renderer/OBB.js +12 -21
  134. package/lib/Renderer/OrientedImageCamera.js +2 -11
  135. package/lib/Renderer/OrientedImageMaterial.js +17 -35
  136. package/lib/Renderer/PointsMaterial.js +224 -94
  137. package/lib/Renderer/RasterTile.js +18 -30
  138. package/lib/Renderer/RenderMode.js +2 -9
  139. package/lib/Renderer/Shader/ShaderChunk.js +5 -23
  140. package/lib/Renderer/Shader/ShaderUtils.js +2 -9
  141. package/lib/Renderer/SphereHelper.js +2 -11
  142. package/lib/Renderer/WebXR.js +2 -11
  143. package/lib/Renderer/c3DEngine.js +20 -53
  144. package/lib/Source/C3DTilesGoogleSource.js +76 -0
  145. package/lib/Source/C3DTilesIonSource.js +6 -13
  146. package/lib/Source/C3DTilesSource.js +5 -12
  147. package/lib/Source/EntwinePointTileSource.js +12 -19
  148. package/lib/Source/FileSource.js +7 -14
  149. package/lib/Source/OrientedImageSource.js +6 -14
  150. package/lib/Source/PotreeSource.js +9 -16
  151. package/lib/Source/Source.js +26 -39
  152. package/lib/Source/TMSSource.js +11 -22
  153. package/lib/Source/VectorTilesSource.js +75 -34
  154. package/lib/Source/WFSSource.js +7 -14
  155. package/lib/Source/WMSSource.js +5 -12
  156. package/lib/Source/WMTSSource.js +3 -10
  157. package/lib/ThreeExtended/capabilities/WebGL.js +1 -8
  158. package/lib/ThreeExtended/libs/ktx-parse.module.js +2 -256
  159. package/lib/ThreeExtended/libs/zstddec.module.js +2 -8
  160. package/lib/ThreeExtended/loaders/DDSLoader.js +10 -16
  161. package/lib/ThreeExtended/loaders/DRACOLoader.js +14 -19
  162. package/lib/ThreeExtended/loaders/GLTFLoader.js +124 -129
  163. package/lib/ThreeExtended/loaders/KTX2Loader.js +73 -78
  164. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +40 -59
  165. package/lib/ThreeExtended/utils/WorkerPool.js +2 -9
  166. package/lib/Utils/CameraUtils.js +32 -44
  167. package/lib/Utils/DEMUtils.js +8 -19
  168. package/lib/Utils/FeaturesUtils.js +8 -16
  169. package/lib/Utils/Gradients.js +16 -0
  170. package/lib/Utils/OrientationUtils.js +8 -18
  171. package/lib/Utils/ThreeUtils.js +2 -9
  172. package/lib/Utils/gui/C3DTilesStyle.js +7 -15
  173. package/lib/Utils/gui/Main.js +7 -48
  174. package/lib/Utils/gui/Minimap.js +12 -20
  175. package/lib/Utils/gui/Navigation.js +6 -14
  176. package/lib/Utils/gui/Scale.js +11 -19
  177. package/lib/Utils/gui/Searchbar.js +5 -13
  178. package/lib/Utils/gui/Widget.js +1 -8
  179. package/lib/Utils/placeObjectOnGround.js +13 -23
  180. package/package.json +13 -8
@@ -1,12 +1,5 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _BinaryPropertyAccessor = _interopRequireDefault(require("./utils/BinaryPropertyAccessor"));
9
- var _C3DTilesEnums = require("./C3DTilesEnums");
1
+ import binaryPropertyAccessor from "./utils/BinaryPropertyAccessor.js";
2
+ import { C3DTilesTypes } from "./C3DTilesEnums.js";
10
3
  const utf8Decoder = new TextDecoder();
11
4
 
12
5
  /** @classdesc
@@ -43,7 +36,7 @@ class C3DTBatchTable {
43
36
  if (jsonLength + binaryLength !== buffer.byteLength) {
44
37
  console.error('3DTiles batch table json length and binary length are not consistent with total buffer' + ' length. The batch table may be wrong.');
45
38
  }
46
- this.type = _C3DTilesEnums.C3DTilesTypes.batchtable;
39
+ this.type = C3DTilesTypes.batchtable;
47
40
  this.batchLength = batchLength;
48
41
  const jsonBuffer = buffer.slice(0, jsonLength);
49
42
  const decodedJsonBuffer = utf8Decoder.decode(new Uint8Array(jsonBuffer));
@@ -60,7 +53,7 @@ class C3DTBatchTable {
60
53
  continue;
61
54
  }
62
55
  if (typeof (propVal === null || propVal === void 0 ? void 0 : propVal.byteOffset) !== 'undefined' && typeof (propVal === null || propVal === void 0 ? void 0 : propVal.componentType) !== 'undefined' && typeof (propVal === null || propVal === void 0 ? void 0 : propVal.type) !== 'undefined') {
63
- jsonContent[propKey] = (0, _BinaryPropertyAccessor.default)(binaryBuffer, this.batchLength, propVal.byteOffset, propVal.componentType, propVal.type);
56
+ jsonContent[propKey] = binaryPropertyAccessor(binaryBuffer, this.batchLength, propVal.byteOffset, propVal.componentType, propVal.type);
64
57
  } else {
65
58
  console.error('Invalid 3D Tiles batch table property that is neither a JSON array nor a valid ' + 'accessor to a binary body');
66
59
  }
@@ -135,5 +128,4 @@ class C3DTBatchTable {
135
128
  return featureDisplayableInfo;
136
129
  }
137
130
  }
138
- var _default = C3DTBatchTable;
139
- exports.default = _default;
131
+ export default C3DTBatchTable;
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
1
  /**
8
2
  * @classdesc
9
3
  * Batch Table part of the 3D Tiles
@@ -100,5 +94,4 @@ class C3DTBatchTableHierarchyExtension {
100
94
  return pickingInfo;
101
95
  }
102
96
  }
103
- var _default = C3DTBatchTableHierarchyExtension;
104
- exports.default = _default;
97
+ export default C3DTBatchTableHierarchyExtension;
@@ -1,26 +1,17 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var THREE = _interopRequireWildcard(require("three"));
9
- var _Ellipsoid = _interopRequireDefault(require("../Math/Ellipsoid"));
10
- var _Coordinates = _interopRequireDefault(require("../Geographic/Coordinates"));
11
- var _C3DTilesEnums = require("./C3DTilesEnums");
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- const ellipsoid = new _Ellipsoid.default();
1
+ import * as THREE from 'three';
2
+ import Ellipsoid from "../Math/Ellipsoid.js";
3
+ import Coordinates from "../Geographic/Coordinates.js";
4
+ import { C3DTilesTypes, C3DTilesBoundingVolumeTypes } from "./C3DTilesEnums.js";
5
+ const ellipsoid = new Ellipsoid();
15
6
 
16
7
  // bounding box scratch variables
17
8
  const boxSize = new THREE.Vector3();
18
9
  const boxCenter = new THREE.Vector3();
19
10
 
20
11
  // Bounding region scratch variables
21
- const southEastUpCarto = new _Coordinates.default('EPSG:4326');
12
+ const southEastUpCarto = new Coordinates('EPSG:4326');
22
13
  const southEastUpVec3 = new THREE.Vector3();
23
- const northWestBottomCarto = new _Coordinates.default('EPSG:4326');
14
+ const northWestBottomCarto = new Coordinates('EPSG:4326');
24
15
  const northWestBottomVec3 = new THREE.Vector3();
25
16
  const radiusScratch = new THREE.Vector3();
26
17
 
@@ -105,15 +96,15 @@ function initFromSphere(sphere) {
105
96
  */
106
97
  class C3DTBoundingVolume {
107
98
  constructor(json, tileMatrixInverse, registeredExtensions) {
108
- this.type = _C3DTilesEnums.C3DTilesTypes.boundingVolume;
99
+ this.type = C3DTilesTypes.boundingVolume;
109
100
  if (json.region) {
110
- this.initialVolumeType = _C3DTilesEnums.C3DTilesBoundingVolumeTypes.region;
101
+ this.initialVolumeType = C3DTilesBoundingVolumeTypes.region;
111
102
  this.volume = initFromRegion(json.region, tileMatrixInverse);
112
103
  } else if (json.box) {
113
- this.initialVolumeType = _C3DTilesEnums.C3DTilesBoundingVolumeTypes.box;
104
+ this.initialVolumeType = C3DTilesBoundingVolumeTypes.box;
114
105
  this.volume = initFromBox(json.box);
115
106
  } else if (json.sphere) {
116
- this.initialVolumeType = _C3DTilesEnums.C3DTilesBoundingVolumeTypes.sphere;
107
+ this.initialVolumeType = C3DTilesBoundingVolumeTypes.sphere;
117
108
  this.volume = initFromSphere(json.sphere);
118
109
  } else {
119
110
  throw new Error(`Unknown bounding volume type: ${json}. 3D Tiles nodes must have a bounding volume of type
@@ -131,9 +122,9 @@ class C3DTBoundingVolume {
131
122
  * @returns {boolean} true if the tile should be culled out (bounding volume not in camera frustum), false otherwise.
132
123
  */
133
124
  boundingVolumeCulling(camera, tileMatrixWorld) {
134
- if (this.initialVolumeType === _C3DTilesEnums.C3DTilesBoundingVolumeTypes.box) {
125
+ if (this.initialVolumeType === C3DTilesBoundingVolumeTypes.box) {
135
126
  return !camera.isBox3Visible(this.volume, tileMatrixWorld);
136
- } else if (this.initialVolumeType === _C3DTilesEnums.C3DTilesBoundingVolumeTypes.sphere || this.initialVolumeType === _C3DTilesEnums.C3DTilesBoundingVolumeTypes.region) {
127
+ } else if (this.initialVolumeType === C3DTilesBoundingVolumeTypes.sphere || this.initialVolumeType === C3DTilesBoundingVolumeTypes.region) {
137
128
  return !camera.isSphereVisible(this.volume, tileMatrixWorld);
138
129
  } else {
139
130
  throw new Error('Unknown bounding volume type.');
@@ -147,15 +138,15 @@ class C3DTBoundingVolume {
147
138
  * @returns {boolean} true if the camera is outside the viewer request volume, false otherwise.
148
139
  */
149
140
  viewerRequestVolumeCulling(camera, tileMatrixWorld) {
150
- if (this.initialVolumeType === _C3DTilesEnums.C3DTilesBoundingVolumeTypes.region) {
141
+ if (this.initialVolumeType === C3DTilesBoundingVolumeTypes.region) {
151
142
  console.warn('Region viewerRequestVolume not yet supported');
152
143
  return true;
153
144
  }
154
- if (this.initialVolumeType === _C3DTilesEnums.C3DTilesBoundingVolumeTypes.box) {
145
+ if (this.initialVolumeType === C3DTilesBoundingVolumeTypes.box) {
155
146
  console.warn('Bounding box viewerRequestVolume not yet supported');
156
147
  return true;
157
148
  }
158
- if (this.initialVolumeType === _C3DTilesEnums.C3DTilesBoundingVolumeTypes.sphere) {
149
+ if (this.initialVolumeType === C3DTilesBoundingVolumeTypes.sphere) {
159
150
  worldCoordinateCenter.copy(this.volume.center);
160
151
  worldCoordinateCenter.applyMatrix4(tileMatrixWorld);
161
152
  // To check the distance between the center sphere and the camera
@@ -164,5 +155,4 @@ class C3DTBoundingVolume {
164
155
  return false;
165
156
  }
166
157
  }
167
- var _default = C3DTBoundingVolume;
168
- exports.default = _default;
158
+ export default C3DTBoundingVolume;
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
1
  /** @classdesc
8
2
  * Class for managing
9
3
  * [3D Tiles extensions](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/extensions).
@@ -100,5 +94,4 @@ class C3DTExtensions {
100
94
  return parsedExtensions;
101
95
  }
102
96
  }
103
- var _default = C3DTExtensions;
104
- exports.default = _default;
97
+ export default C3DTExtensions;
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _three = require("three");
8
1
  // eslint-disable-next-line no-unused-vars
2
+ import { Object3D, Box3 } from 'three';
9
3
 
10
4
  /**
11
5
  * Finds the batch table of an object in a 3D Tiles layer. This is
@@ -69,7 +63,7 @@ class C3DTFeature {
69
63
  * @returns {Box3}
70
64
  */
71
65
  computeWorldBox3() {
72
- let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _three.Box3();
66
+ let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Box3();
73
67
  // reset
74
68
  target.max.x = -Infinity;
75
69
  target.max.y = -Infinity;
@@ -114,5 +108,4 @@ class C3DTFeature {
114
108
  return this.#info;
115
109
  }
116
110
  }
117
- var _default = C3DTFeature;
118
- exports.default = _default;
111
+ export default C3DTFeature;
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.C3DTilesTypes = exports.C3DTilesBoundingVolumeTypes = void 0;
7
1
  /**
8
2
  * Enumeration of implemented 3D Tiles classes. Used in C3DTExtensions to
9
3
  * now which classes ask for extension parsing.
@@ -14,15 +8,13 @@ exports.C3DTilesTypes = exports.C3DTilesBoundingVolumeTypes = void 0;
14
8
  * @property {String} batchtable - value: 'batchtable'
15
9
  * @property {String} boundingVolume - value: 'bounding volume'
16
10
  */
17
- const C3DTilesTypes = {
11
+ export const C3DTilesTypes = {
18
12
  tileset: 'tileset',
19
13
  batchtable: 'batchtable',
20
14
  boundingVolume: 'boundingVolume'
21
15
  };
22
- exports.C3DTilesTypes = C3DTilesTypes;
23
- const C3DTilesBoundingVolumeTypes = {
16
+ export const C3DTilesBoundingVolumeTypes = {
24
17
  region: 'region',
25
18
  box: 'box',
26
19
  sphere: 'sphere'
27
- };
28
- exports.C3DTilesBoundingVolumeTypes = C3DTilesBoundingVolumeTypes;
20
+ };
@@ -1,15 +1,7 @@
1
- "use strict";
1
+ import * as THREE from 'three';
2
+ import C3DTBoundingVolume from "./C3DTBoundingVolume.js";
3
+ import { C3DTilesTypes } from "./C3DTilesEnums.js";
2
4
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var THREE = _interopRequireWildcard(require("three"));
9
- var _C3DTBoundingVolume = _interopRequireDefault(require("./C3DTBoundingVolume"));
10
- var _C3DTilesEnums = require("./C3DTilesEnums");
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
5
  // Inverse transform of a tile, computed from the tile transform and used when parsing the bounding volume of a tile
14
6
  // if the bounding volume is a region (https://github.com/CesiumGS/3d-tiles/tree/main/specification#region) which is
15
7
  // in global coordinates and other bounding volumes are not. To harmonize, we transform back the bounding volume region
@@ -40,7 +32,7 @@ const tileMatrixInverse = new THREE.Matrix4();
40
32
  */
41
33
  class C3DTileset {
42
34
  constructor(json, baseURL, registeredExtensions) {
43
- this.type = _C3DTilesEnums.C3DTilesTypes.tileset;
35
+ this.type = C3DTilesTypes.tileset;
44
36
  this.asset = json.asset;
45
37
  this.properties = json.properties;
46
38
  this.geometricError = json.geometricError;
@@ -87,8 +79,8 @@ class C3DTileset {
87
79
  tileMatrixInverse.identity();
88
80
  }
89
81
  }
90
- tile.viewerRequestVolume = tile.viewerRequestVolume ? new _C3DTBoundingVolume.default(tile.viewerRequestVolume, tileMatrixInverse, registeredExtensions) : null;
91
- tile.boundingVolume = tile.boundingVolume ? new _C3DTBoundingVolume.default(tile.boundingVolume, tileMatrixInverse, registeredExtensions) : null;
82
+ tile.viewerRequestVolume = tile.viewerRequestVolume ? new C3DTBoundingVolume(tile.viewerRequestVolume, tileMatrixInverse, registeredExtensions) : null;
83
+ tile.boundingVolume = tile.boundingVolume ? new C3DTBoundingVolume(tile.boundingVolume, tileMatrixInverse, registeredExtensions) : null;
92
84
  this.tiles.push(tile);
93
85
  tile.tileId = this.tiles.length - 1;
94
86
  tile.baseURL = baseURL;
@@ -104,5 +96,4 @@ class C3DTileset {
104
96
  this.tiles[nodeId].isTileset = true;
105
97
  }
106
98
  }
107
- var _default = C3DTileset;
108
- exports.default = _default;
99
+ export default C3DTileset;
@@ -1,10 +1,5 @@
1
- "use strict";
1
+ import { Vector2, Vector3, Vector4 } from 'three';
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _three = require("three");
8
3
  /**
9
4
  * @enum {Object} componentTypeBytesSize - Size in byte of a component type.
10
5
  */
@@ -49,9 +44,9 @@ const typeComponentsNumber = {
49
44
  */
50
45
  const typeConstructor = {
51
46
  // SCALAR: no constructor, just create a value (int, float, etc. depending on componentType)
52
- VEC2: _three.Vector2,
53
- VEC3: _three.Vector3,
54
- VEC4: _three.Vector4
47
+ VEC2: Vector2,
48
+ VEC3: Vector3,
49
+ VEC4: Vector4
55
50
  };
56
51
 
57
52
  /**
@@ -102,5 +97,4 @@ function binaryPropertyAccessor(buffer, batchLength, byteOffset, componentType,
102
97
  return array;
103
98
  }
104
99
  }
105
- var _default = binaryPropertyAccessor;
106
- exports.default = _default;
100
+ export default binaryPropertyAccessor;
@@ -1,12 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var THREE = _interopRequireWildcard(require("three"));
8
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1
+ import * as THREE from 'three';
10
2
  const FRAMERATE = 60;
11
3
  const FRAME_DURATION = 1000 / FRAMERATE;
12
4
 
@@ -147,5 +139,4 @@ class AnimationPlayer extends THREE.EventDispatcher {
147
139
  }
148
140
  }
149
141
  }
150
- var _default = AnimationPlayer;
151
- exports.default = _default;
142
+ export default AnimationPlayer;
@@ -1,25 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.deprecatedParsingOptionsToNewOne = exports.deprecatedFeature2MeshOptions = exports.deprecatedColorLayerOptions = exports.deprecatedC3DEngineWebGLOptions = exports.default = void 0;
7
- var _LayeredMaterial = require("../../Renderer/LayeredMaterial");
8
- const deprecatedColorLayerOptions = options => {
1
+ import { colorLayerEffects } from "../../Renderer/LayeredMaterial.js";
2
+ export const deprecatedColorLayerOptions = options => {
9
3
  if (options.fx) {
10
4
  console.warn('ColorLayer fx is deprecated, use ColorLayer.effect_type and ColorLayer.effect_parameter instead.');
11
5
  if (options.fx > 2.0) {
12
6
  options.effect_parameter = options.fx;
13
- options.effect_type = _LayeredMaterial.colorLayerEffects.removeLightColor;
7
+ options.effect_type = colorLayerEffects.removeLightColor;
14
8
  } else if (options.fx > 0.0) {
15
9
  options.effect_parameter = options.fx;
16
- options.effect_type = _LayeredMaterial.colorLayerEffects.removeWhiteColor;
10
+ options.effect_type = colorLayerEffects.removeWhiteColor;
17
11
  }
18
12
  }
19
13
  return options;
20
14
  };
21
- exports.deprecatedColorLayerOptions = deprecatedColorLayerOptions;
22
- const deprecatedParsingOptionsToNewOne = options => {
15
+ export const deprecatedParsingOptionsToNewOne = options => {
23
16
  /* istanbul ignore next */
24
17
  if (options.crsOut || options.crsIn) {
25
18
  console.warn('Parsing options with crsIn and crsOut are deprecated, use { in, out } structure.');
@@ -63,8 +56,7 @@ const deprecatedParsingOptionsToNewOne = options => {
63
56
  }
64
57
  return options;
65
58
  };
66
- exports.deprecatedParsingOptionsToNewOne = deprecatedParsingOptionsToNewOne;
67
- const deprecatedFeature2MeshOptions = options => {
59
+ export const deprecatedFeature2MeshOptions = options => {
68
60
  if (options.color) {
69
61
  console.error('Color convert option is removed, use Style.xxx.color');
70
62
  }
@@ -75,12 +67,9 @@ const deprecatedFeature2MeshOptions = options => {
75
67
  console.error('altitude convert option is removed, use Style.xxx.base_altitude instead');
76
68
  }
77
69
  };
78
- exports.deprecatedFeature2MeshOptions = deprecatedFeature2MeshOptions;
79
- const deprecatedC3DEngineWebGLOptions = options => {
70
+ export const deprecatedC3DEngineWebGLOptions = options => {
80
71
  if (options.isWebGL2 === false) {
81
- console.warn('WebGL1 support (isWebGL2=false) is deprecated and will be removed in iTowns 2.43. This follows its deprecation by three.js. If you are impacted by this change, please discuss in the following issue: https://github.com/iTowns/itowns/issues/2152.');
72
+ console.error('WebGL1 support ended in 2.43.0. Falling-back to the WebGL2 renderer.');
82
73
  }
83
74
  };
84
- exports.deprecatedC3DEngineWebGLOptions = deprecatedC3DEngineWebGLOptions;
85
- var _default = {};
86
- exports.default = _default;
75
+ export default {};
@@ -1,15 +1,6 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var THREE = _interopRequireWildcard(require("three"));
9
- var _Fetcher = _interopRequireDefault(require("../Provider/Fetcher"));
10
- var _PointCloudNode = _interopRequireDefault(require("./PointCloudNode"));
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1
+ import * as THREE from 'three';
2
+ import Fetcher from "../Provider/Fetcher.js";
3
+ import PointCloudNode from "./PointCloudNode.js";
13
4
  const size = new THREE.Vector3();
14
5
  const position = new THREE.Vector3();
15
6
  const translation = new THREE.Vector3();
@@ -38,7 +29,7 @@ function buildId(depth, x, y, z) {
38
29
  * @property {string} id - The id of the node, constituted of the four
39
30
  * components: `depth-x-y-z`.
40
31
  */
41
- class EntwinePointTileNode extends _PointCloudNode.default {
32
+ class EntwinePointTileNode extends PointCloudNode {
42
33
  /**
43
34
  * Constructs a new instance of EntwinePointTileNode.
44
35
  *
@@ -101,7 +92,7 @@ class EntwinePointTileNode extends _PointCloudNode.default {
101
92
  return this.numPoints >= 0;
102
93
  }
103
94
  loadOctree() {
104
- return _Fetcher.default.json(`${this.layer.source.url}/ept-hierarchy/${this.id}.json`, this.layer.source.networkOptions).then(hierarchy => {
95
+ return Fetcher.json(`${this.layer.source.url}/ept-hierarchy/${this.id}.json`, this.layer.source.networkOptions).then(hierarchy => {
105
96
  this.numPoints = hierarchy[this.id];
106
97
  const stack = [];
107
98
  stack.push(this);
@@ -132,5 +123,4 @@ class EntwinePointTileNode extends _PointCloudNode.default {
132
123
  }
133
124
  }
134
125
  }
135
- var _default = EntwinePointTileNode;
136
- exports.default = _default;
126
+ export default EntwinePointTileNode;
@@ -1,19 +1,10 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.FeatureGeometry = exports.FeatureCollection = exports.FeatureBuildingOptions = exports.FEATURE_TYPES = void 0;
8
- var THREE = _interopRequireWildcard(require("three"));
9
- var _Extent = _interopRequireDefault(require("./Geographic/Extent"));
10
- var _Coordinates = _interopRequireDefault(require("./Geographic/Coordinates"));
11
- var _Crs = _interopRequireDefault(require("./Geographic/Crs"));
12
- var _Style = _interopRequireDefault(require("./Style"));
13
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1
+ import * as THREE from 'three';
2
+ import Extent from "./Geographic/Extent.js";
3
+ import Coordinates from "./Geographic/Coordinates.js";
4
+ import CRS from "./Geographic/Crs.js";
5
+ import Style from "./Style.js";
15
6
  function defaultExtent(crs) {
16
- return new _Extent.default(crs, Infinity, -Infinity, Infinity, -Infinity);
7
+ return new Extent(crs, Infinity, -Infinity, Infinity, -Infinity);
17
8
  }
18
9
  function _extendBuffer(feature, size) {
19
10
  feature.vertices.length += size * feature.size;
@@ -27,8 +18,8 @@ function _setGeometryValues(feature, coord) {
27
18
  }
28
19
  feature._pushValues(coord.x, coord.y, coord.z);
29
20
  }
30
- const coordOut = new _Coordinates.default('EPSG:4326', 0, 0, 0);
31
- const FEATURE_TYPES = {
21
+ const coordOut = new Coordinates('EPSG:4326', 0, 0, 0);
22
+ export const FEATURE_TYPES = {
32
23
  POINT: 0,
33
24
  LINE: 1,
34
25
  POLYGON: 2
@@ -52,8 +43,7 @@ const FEATURE_TYPES = {
52
43
  * style for all new features.
53
44
  *
54
45
  */
55
- exports.FEATURE_TYPES = FEATURE_TYPES;
56
- class FeatureBuildingOptions {}
46
+ export class FeatureBuildingOptions {}
57
47
 
58
48
  /**
59
49
  * @property {Extent} extent - The 2D extent containing all the points
@@ -65,8 +55,7 @@ class FeatureBuildingOptions {}
65
55
  * @property {Object} properties - Properties of the geometry. It can be
66
56
  * anything specified in the GeoJSON under the `properties` property.
67
57
  */
68
- exports.FeatureBuildingOptions = FeatureBuildingOptions;
69
- class FeatureGeometry {
58
+ export class FeatureGeometry {
70
59
  #currentExtent;
71
60
  /**
72
61
  * @param {Feature} feature geometry
@@ -188,7 +177,6 @@ class FeatureGeometry {
188
177
  }
189
178
  }
190
179
  }
191
- exports.FeatureGeometry = FeatureGeometry;
192
180
  function push2DValues(value0, value1) {
193
181
  this.vertices[this._pos++] = value0;
194
182
  this.vertices[this._pos++] = value1;
@@ -260,7 +248,7 @@ class Feature {
260
248
  }
261
249
  this._pos = 0;
262
250
  this._pushValues = (this.size === 3 ? push3DValues : push2DValues).bind(this);
263
- this.style = _Style.default.setFromProperties;
251
+ this.style = Style.setFromProperties;
264
252
  }
265
253
  /**
266
254
  * Instance a new {@link FeatureGeometry} and push in {@link Feature}.
@@ -288,8 +276,7 @@ class Feature {
288
276
  return this.geometries.length;
289
277
  }
290
278
  }
291
- var _default = Feature;
292
- exports.default = _default;
279
+ export default Feature;
293
280
  const doNothing = () => {};
294
281
  const transformToLocalSystem3D = (coord, collection) => {
295
282
  coord.geodesicNormal.applyNormalMatrix(collection.normalMatrixInverse);
@@ -344,7 +331,7 @@ const alignYtoEast = new THREE.Quaternion();
344
331
  *
345
332
  */
346
333
 
347
- class FeatureCollection extends THREE.Object3D {
334
+ export class FeatureCollection extends THREE.Object3D {
348
335
  #transformToLocalSystem = transformToLocalSystem2D;
349
336
  #setLocalSystem = doNothing;
350
337
  /**
@@ -354,7 +341,7 @@ class FeatureCollection extends THREE.Object3D {
354
341
  var _options$source;
355
342
  super();
356
343
  this.isFeatureCollection = true;
357
- this.crs = _Crs.default.formatToEPSG(options.accurate || !((_options$source = options.source) !== null && _options$source !== void 0 && _options$source.crs) ? options.crs : options.source.crs);
344
+ this.crs = CRS.formatToEPSG(options.accurate || !((_options$source = options.source) !== null && _options$source !== void 0 && _options$source.crs) ? options.crs : options.source.crs);
358
345
  this.features = [];
359
346
  this.mergeFeatures = options.mergeFeatures === undefined ? true : options.mergeFeatures;
360
347
  this.size = options.structure == '3d' ? 3 : 2;
@@ -362,7 +349,7 @@ class FeatureCollection extends THREE.Object3D {
362
349
  this.style = options.style;
363
350
  this.isInverted = false;
364
351
  this.matrixWorldInverse = new THREE.Matrix4();
365
- this.center = new _Coordinates.default('EPSG:4326', 0, 0);
352
+ this.center = new Coordinates('EPSG:4326', 0, 0);
366
353
  if (this.size == 2) {
367
354
  this.extent = options.buildExtent === false ? undefined : defaultExtent(options.forcedExtentCrs || this.crs);
368
355
  this.#setLocalSystem = center => {
@@ -501,5 +488,4 @@ class FeatureCollection extends THREE.Object3D {
501
488
  this.features.push(ref);
502
489
  return ref;
503
490
  }
504
- }
505
- exports.FeatureCollection = FeatureCollection;
491
+ }
@@ -1,17 +1,9 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _Coordinates = _interopRequireDefault(require("./Coordinates"));
9
1
  /**
10
2
  * Generated On: 2016-02-25
11
3
  * Class: CoordStars
12
4
  * Description: get coord of stars like earth...
13
5
  */
14
-
6
+ import Coordinates from "./Coordinates.js";
15
7
  const CoordStars = {
16
8
  getSunPosition() {
17
9
  const m = Math;
@@ -82,9 +74,8 @@ const CoordStars = {
82
74
  const sun = CoordStars.getSunPosition()(date, lat, lon);
83
75
  const dayMilliSec = 24 * 3600000;
84
76
  const longitude = sun.ascension + date % dayMilliSec / dayMilliSec * -360 + 180; // cause midday
85
- const coSunCarto = new _Coordinates.default('EPSG:4326', longitude, lat, 50000000).as('EPSG:4978').toVector3();
77
+ const coSunCarto = new Coordinates('EPSG:4326', longitude, lat, 50000000).as('EPSG:4978').toVector3();
86
78
  return coSunCarto;
87
79
  }
88
80
  };
89
- var _default = CoordStars;
90
- exports.default = _default;
81
+ export default CoordStars;
@@ -1,18 +1,9 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var THREE = _interopRequireWildcard(require("three"));
9
- var _proj = _interopRequireDefault(require("proj4"));
10
- var _Crs = _interopRequireDefault(require("./Crs"));
11
- var _Ellipsoid = _interopRequireDefault(require("../Math/Ellipsoid"));
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
- _proj.default.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
15
- const ellipsoid = new _Ellipsoid.default();
1
+ import * as THREE from 'three';
2
+ import proj4 from 'proj4';
3
+ import CRS from "./Crs.js";
4
+ import Ellipsoid from "../Math/Ellipsoid.js";
5
+ proj4.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
6
+ const ellipsoid = new Ellipsoid();
16
7
  const projectionCache = {};
17
8
  const v0 = new THREE.Vector3();
18
9
  const v1 = new THREE.Vector3();
@@ -23,7 +14,7 @@ function proj4cache(crsIn, crsOut) {
23
14
  projectionCache[crsIn] = {};
24
15
  }
25
16
  if (!projectionCache[crsIn][crsOut]) {
26
- projectionCache[crsIn][crsOut] = (0, _proj.default)(crsIn, crsOut);
17
+ projectionCache[crsIn][crsOut] = proj4(crsIn, crsOut);
27
18
  }
28
19
  return projectionCache[crsIn][crsOut];
29
20
  }
@@ -77,7 +68,7 @@ class Coordinates {
77
68
  let v1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
78
69
  let v2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
79
70
  this.isCoordinates = true;
80
- _Crs.default.isValid(crs);
71
+ CRS.isValid(crs);
81
72
  this.crs = crs;
82
73
 
83
74
  // Storing the coordinates as is, not in arrays, as it is
@@ -103,7 +94,7 @@ class Coordinates {
103
94
  * @param {String} crs Coordinate Reference System (e.g. 'EPSG:4978')
104
95
  */
105
96
  setCrs(crs) {
106
- _Crs.default.isValid(crs);
97
+ CRS.isValid(crs);
107
98
  this.crs = crs;
108
99
  }
109
100
 
@@ -191,7 +182,7 @@ class Coordinates {
191
182
  get geodesicNormal() {
192
183
  if (this._normalNeedsUpdate) {
193
184
  this._normalNeedsUpdate = false;
194
- if (_Crs.default.is4326(this.crs)) {
185
+ if (CRS.is4326(this.crs)) {
195
186
  ellipsoid.geodeticSurfaceNormalCartographic(this, this._normal);
196
187
  } else if (this.crs == 'EPSG:4978') {
197
188
  ellipsoid.geodeticSurfaceNormal(this, this._normal);
@@ -315,7 +306,7 @@ class Coordinates {
315
306
  if (this.crs == crs) {
316
307
  target.copy(this);
317
308
  } else {
318
- if (_Crs.default.is4326(this.crs) && crs == 'EPSG:3857') {
309
+ if (CRS.is4326(this.crs) && crs == 'EPSG:3857') {
319
310
  this.y = THREE.MathUtils.clamp(this.y, -89.999999, 89.999999);
320
311
  }
321
312
  target.setFromArray(proj4cache(this.crs, crs).forward([this.x, this.y, this.z]));
@@ -326,5 +317,4 @@ class Coordinates {
326
317
  }
327
318
  coord0 = new Coordinates('EPSG:4326', 0, 0, 0);
328
319
  coord1 = new Coordinates('EPSG:4326', 0, 0, 0);
329
- var _default = Coordinates;
330
- exports.default = _default;
320
+ export default Coordinates;