itowns 2.45.1-next.0 → 2.45.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/455.js +2 -0
- package/dist/455.js.map +1 -0
- package/dist/debug.js +3 -0
- package/dist/debug.js.LICENSE.txt +13 -0
- package/dist/debug.js.map +1 -0
- package/dist/itowns.js +3 -0
- package/dist/itowns.js.LICENSE.txt +5 -0
- package/dist/itowns.js.map +1 -0
- package/dist/itowns_lasparser.js +2 -0
- package/dist/itowns_lasparser.js.map +1 -0
- package/dist/itowns_lasworker.js +2 -0
- package/dist/itowns_lasworker.js.map +1 -0
- package/dist/itowns_potree2worker.js +2 -0
- package/dist/itowns_potree2worker.js.map +1 -0
- package/dist/itowns_widgets.js +2 -0
- package/dist/itowns_widgets.js.map +1 -0
- package/lib/Controls/FirstPersonControls.js +308 -0
- package/lib/Controls/FlyControls.js +175 -0
- package/lib/Controls/GlobeControls.js +1178 -0
- package/lib/Controls/PlanarControls.js +1025 -0
- package/lib/Controls/StateControl.js +432 -0
- package/lib/Controls/StreetControls.js +392 -0
- package/lib/Converter/Feature2Mesh.js +612 -0
- package/lib/Converter/Feature2Texture.js +174 -0
- package/lib/Converter/convertToTile.js +70 -0
- package/lib/Converter/textureConverter.js +43 -0
- package/lib/Core/3DTiles/C3DTBatchTable.js +131 -0
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +96 -0
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +156 -0
- package/lib/Core/3DTiles/C3DTExtensions.js +97 -0
- package/lib/Core/3DTiles/C3DTFeature.js +110 -0
- package/lib/Core/3DTiles/C3DTilesEnums.js +20 -0
- package/lib/Core/3DTiles/C3DTileset.js +99 -0
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +100 -0
- package/lib/Core/AnimationPlayer.js +142 -0
- package/lib/Core/CopcNode.js +174 -0
- package/lib/Core/Deprecated/Undeprecator.js +74 -0
- package/lib/Core/EntwinePointTileNode.js +126 -0
- package/lib/Core/Feature.js +488 -0
- package/lib/Core/Geographic/GeoidGrid.js +108 -0
- package/lib/Core/Label.js +222 -0
- package/lib/Core/MainLoop.js +209 -0
- package/lib/Core/Picking.js +255 -0
- package/lib/Core/PointCloudNode.js +42 -0
- package/lib/Core/Potree2Node.js +206 -0
- package/lib/Core/Potree2PointAttributes.js +139 -0
- package/lib/Core/PotreeNode.js +101 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +293 -0
- package/lib/Core/Prefab/Globe/GlobeLayer.js +152 -0
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.js +110 -0
- package/lib/Core/Prefab/Globe/SkyShader.js +78 -0
- package/lib/Core/Prefab/GlobeView.js +155 -0
- package/lib/Core/Prefab/Planar/PlanarLayer.js +59 -0
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +71 -0
- package/lib/Core/Prefab/PlanarView.js +62 -0
- package/lib/Core/Prefab/TileBuilder.js +82 -0
- package/lib/Core/Prefab/computeBufferTileGeometry.js +248 -0
- package/lib/Core/Scheduler/Cache.js +17 -0
- package/lib/Core/Scheduler/CancelledCommandException.js +15 -0
- package/lib/Core/Scheduler/Scheduler.js +294 -0
- package/lib/Core/Style.js +660 -0
- package/lib/Core/StyleOptions.js +486 -0
- package/lib/Core/System/Capabilities.js +63 -0
- package/lib/Core/Tile/Tile.js +205 -0
- package/lib/Core/Tile/TileGrid.js +49 -0
- package/lib/Core/TileGeometry.js +124 -0
- package/lib/Core/TileMesh.js +108 -0
- package/lib/Core/View.js +1115 -0
- package/lib/Layer/C3DTilesLayer.js +459 -0
- package/lib/Layer/ColorLayer.js +154 -0
- package/lib/Layer/CopcLayer.js +63 -0
- package/lib/Layer/ElevationLayer.js +139 -0
- package/lib/Layer/EntwinePointTileLayer.js +71 -0
- package/lib/Layer/FeatureGeometryLayer.js +77 -0
- package/lib/Layer/GeoidLayer.js +80 -0
- package/lib/Layer/GeometryLayer.js +233 -0
- package/lib/Layer/InfoLayer.js +64 -0
- package/lib/Layer/LabelLayer.js +469 -0
- package/lib/Layer/Layer.js +335 -0
- package/lib/Layer/LayerUpdateState.js +89 -0
- package/lib/Layer/LayerUpdateStrategy.js +80 -0
- package/lib/Layer/OGC3DTilesLayer.js +543 -0
- package/lib/Layer/OrientedImageLayer.js +227 -0
- package/lib/Layer/PointCloudLayer.js +405 -0
- package/lib/Layer/Potree2Layer.js +171 -0
- package/lib/Layer/PotreeLayer.js +72 -0
- package/lib/Layer/RasterLayer.js +37 -0
- package/lib/Layer/ReferencingLayerProperties.js +62 -0
- package/lib/Layer/TiledGeometryLayer.js +459 -0
- package/lib/Loader/LASLoader.js +193 -0
- package/lib/Loader/Potree2BrotliLoader.js +261 -0
- package/lib/Loader/Potree2Loader.js +207 -0
- package/lib/Main.js +113 -0
- package/lib/MainBundle.js +4 -0
- package/lib/Parser/B3dmParser.js +174 -0
- package/lib/Parser/CameraCalibrationParser.js +94 -0
- package/lib/Parser/GDFParser.js +72 -0
- package/lib/Parser/GTXParser.js +75 -0
- package/lib/Parser/GeoJsonParser.js +212 -0
- package/lib/Parser/GpxParser.js +25 -0
- package/lib/Parser/ISGParser.js +71 -0
- package/lib/Parser/KMLParser.js +25 -0
- package/lib/Parser/LASParser.js +137 -0
- package/lib/Parser/MapBoxUrlParser.js +83 -0
- package/lib/Parser/PntsParser.js +131 -0
- package/lib/Parser/Potree2BinParser.js +92 -0
- package/lib/Parser/PotreeBinParser.js +106 -0
- package/lib/Parser/PotreeCinParser.js +29 -0
- package/lib/Parser/ShapefileParser.js +78 -0
- package/lib/Parser/VectorTileParser.js +215 -0
- package/lib/Parser/XbilParser.js +120 -0
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +1386 -0
- package/lib/Parser/iGLTFLoader.js +168 -0
- package/lib/Process/3dTilesProcessing.js +304 -0
- package/lib/Process/FeatureProcessing.js +76 -0
- package/lib/Process/LayeredMaterialNodeProcessing.js +229 -0
- package/lib/Process/ObjectRemovalHelper.js +97 -0
- package/lib/Process/handlerNodeError.js +23 -0
- package/lib/Provider/3dTilesProvider.js +149 -0
- package/lib/Provider/DataSourceProvider.js +24 -0
- package/lib/Provider/Fetcher.js +233 -0
- package/lib/Provider/PointCloudProvider.js +45 -0
- package/lib/Provider/TileProvider.js +16 -0
- package/lib/Provider/URLBuilder.js +116 -0
- package/lib/Renderer/Camera.js +281 -0
- package/lib/Renderer/Color.js +56 -0
- package/lib/Renderer/ColorLayersOrdering.js +115 -0
- package/lib/Renderer/CommonMaterial.js +31 -0
- package/lib/Renderer/Label2DRenderer.js +192 -0
- package/lib/Renderer/LayeredMaterial.js +243 -0
- package/lib/Renderer/OBB.js +150 -0
- package/lib/Renderer/OrientedImageCamera.js +118 -0
- package/lib/Renderer/OrientedImageMaterial.js +167 -0
- package/lib/Renderer/PointsMaterial.js +485 -0
- package/lib/Renderer/RasterTile.js +243 -0
- package/lib/Renderer/RenderMode.js +31 -0
- package/lib/Renderer/Shader/ShaderChunk.js +160 -0
- package/lib/Renderer/Shader/ShaderUtils.js +47 -0
- package/lib/Renderer/SphereHelper.js +17 -0
- package/lib/Renderer/WebXR.js +51 -0
- package/lib/Renderer/c3DEngine.js +214 -0
- package/lib/Source/C3DTilesGoogleSource.js +74 -0
- package/lib/Source/C3DTilesIonSource.js +54 -0
- package/lib/Source/C3DTilesSource.js +30 -0
- package/lib/Source/CopcSource.js +126 -0
- package/lib/Source/EntwinePointTileSource.js +72 -0
- package/lib/Source/FileSource.js +188 -0
- package/lib/Source/OGC3DTilesGoogleSource.js +29 -0
- package/lib/Source/OGC3DTilesIonSource.js +34 -0
- package/lib/Source/OGC3DTilesSource.js +21 -0
- package/lib/Source/OrientedImageSource.js +59 -0
- package/lib/Source/Potree2Source.js +167 -0
- package/lib/Source/PotreeSource.js +82 -0
- package/lib/Source/Source.js +202 -0
- package/lib/Source/TMSSource.js +144 -0
- package/lib/Source/VectorTilesSource.js +182 -0
- package/lib/Source/WFSSource.js +170 -0
- package/lib/Source/WMSSource.js +167 -0
- package/lib/Source/WMTSSource.js +92 -0
- package/lib/ThreeExtended/capabilities/WebGL.js +69 -0
- package/lib/ThreeExtended/libs/ktx-parse.module.js +506 -0
- package/lib/ThreeExtended/libs/zstddec.module.js +29 -0
- package/lib/ThreeExtended/loaders/DDSLoader.js +200 -0
- package/lib/ThreeExtended/loaders/DRACOLoader.js +400 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.js +2879 -0
- package/lib/ThreeExtended/loaders/KTX2Loader.js +709 -0
- package/lib/ThreeExtended/math/ColorSpaces.js +59 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +846 -0
- package/lib/ThreeExtended/utils/WorkerPool.js +70 -0
- package/lib/Utils/CameraUtils.js +554 -0
- package/lib/Utils/DEMUtils.js +350 -0
- package/lib/Utils/FeaturesUtils.js +156 -0
- package/lib/Utils/Gradients.js +16 -0
- package/lib/Utils/ThreeUtils.js +115 -0
- package/lib/Utils/gui/C3DTilesStyle.js +218 -0
- package/lib/Utils/gui/Main.js +7 -0
- package/lib/Utils/gui/Minimap.js +152 -0
- package/lib/Utils/gui/Navigation.js +245 -0
- package/lib/Utils/gui/Scale.js +104 -0
- package/lib/Utils/gui/Searchbar.js +234 -0
- package/lib/Utils/gui/Widget.js +80 -0
- package/lib/Utils/placeObjectOnGround.js +136 -0
- package/lib/Worker/LASLoaderWorker.js +19 -0
- package/lib/Worker/Potree2Worker.js +21 -0
- package/package.json +2 -2
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import { LRUCache } from 'lru-cache';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An object defining the source of a single resource to get from a direct
|
|
6
|
+
* access. It inherits from {@link Source}. There is multiple ways of adding a
|
|
7
|
+
* resource here:
|
|
8
|
+
* <ul>
|
|
9
|
+
* <li>add the file like any other sources, using the `url` property.</li>
|
|
10
|
+
* <li>fetch the file, and give the data to the source using the `fetchedData`
|
|
11
|
+
* property.</li>
|
|
12
|
+
* <li>fetch the file, parse it and git the parsed data to the source using the
|
|
13
|
+
* `features` property.</li>
|
|
14
|
+
* </ul>
|
|
15
|
+
* See the examples below for real use cases.
|
|
16
|
+
*
|
|
17
|
+
* @extends Source
|
|
18
|
+
*
|
|
19
|
+
* @property {boolean} isFileSource - Used to checkout whether this source is a
|
|
20
|
+
* FileSource. Default is true. You should not change this, as it is used
|
|
21
|
+
* internally for optimisation.
|
|
22
|
+
* @property {*} fetchedData - Once the file has been loaded, the resulting data
|
|
23
|
+
* is stored in this property.
|
|
24
|
+
* @property {*} features - Once the file has been loaded and parsed, the
|
|
25
|
+
* resulting data is stored in this property.
|
|
26
|
+
*
|
|
27
|
+
* @example <caption>Simple: create a source, a layer, and let iTowns taking
|
|
28
|
+
* care of everything.</caption>
|
|
29
|
+
* const kmlSource = new itowns.FileSource({
|
|
30
|
+
* url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/croquis.kml',
|
|
31
|
+
* crs: 'EPSG:4326',
|
|
32
|
+
* fetcher: itowns.Fetcher.xml,
|
|
33
|
+
* parser: itowns.KMLParser.parse,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const kmlLayer = new itowns.ColorLayer('Kml', {
|
|
37
|
+
* name: 'kml',
|
|
38
|
+
* transparent: true,
|
|
39
|
+
* crs: view.tileLayer.extent.crs,
|
|
40
|
+
* source: kmlSource,
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* view.addLayer(kmlLayer);
|
|
44
|
+
*
|
|
45
|
+
* @example <caption>Advanced: fetch some data, create a source, a layer, and
|
|
46
|
+
* let iTowns do the parsing and converting.</caption>
|
|
47
|
+
* // Parse and Convert by iTowns
|
|
48
|
+
* itowns.Fetcher.xml('https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/ULTRA2009.gpx')
|
|
49
|
+
* .then(function _(gpx) {
|
|
50
|
+
* const gpxSource = new itowns.FileSource({
|
|
51
|
+
* data: gpx,
|
|
52
|
+
* crs: 'EPSG:4326',
|
|
53
|
+
* parser: itowns.GpxParser.parse,
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* const gpxLayer = new itowns.ColorLayer('Gpx', {
|
|
57
|
+
* name: 'Ultra 2009',
|
|
58
|
+
* transparent: true,
|
|
59
|
+
* source: gpxSource,
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* return view.addLayer(gpxLayer);
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* @example <caption>More advanced: create a layer, fetch some data, parse the
|
|
66
|
+
* data, append a source to the layer and add the layer to iTowns.</caption>
|
|
67
|
+
* // Create a layer
|
|
68
|
+
* const ariege = new itowns.GeometryLayer('ariege', new itowns.THREE.Group());
|
|
69
|
+
*
|
|
70
|
+
* // Specify update method and conversion
|
|
71
|
+
* ariege.update = itowns.FeatureProcessing.update;
|
|
72
|
+
* ariege.convert = itowns.Feature2Mesh.convert({
|
|
73
|
+
* color: () => new itowns.THREE.Color(0xffcc00),
|
|
74
|
+
* extrude: () => 5000,
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* itowns.Fetcher.json('https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/09-ariege/departement-09-ariege.geojson')
|
|
78
|
+
* .then(function _(geojson) {
|
|
79
|
+
* return itowns.GeoJsonParser.parse(geojson, {
|
|
80
|
+
* in: { crs: 'EPSG:4326' },
|
|
81
|
+
* out: { crs: view.tileLayer.extent.crs,
|
|
82
|
+
* style: new itowns.Style({
|
|
83
|
+
* fill: {
|
|
84
|
+
* color: new itowns.THREE.Color(0xffcc00),
|
|
85
|
+
* extrusion_height: () => 5000,
|
|
86
|
+
* }),
|
|
87
|
+
* },
|
|
88
|
+
* },
|
|
89
|
+
* });
|
|
90
|
+
* }).then(function _(features) {
|
|
91
|
+
* ariege.source = new itowns.FileSource({
|
|
92
|
+
* crs: 'EPSG:4326',
|
|
93
|
+
* features,
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* return view.addLayer(ariegeLayer);
|
|
97
|
+
* });
|
|
98
|
+
*/
|
|
99
|
+
class FileSource extends Source {
|
|
100
|
+
/**
|
|
101
|
+
* @param {Object} source - An object that can contain all properties of a
|
|
102
|
+
* FileSource and {@link Source}. Only `crs` is mandatory, but if it
|
|
103
|
+
* presents in `features` under the property `crs`, it is fine.
|
|
104
|
+
*/
|
|
105
|
+
constructor(source) {
|
|
106
|
+
if (source.parsedData) {
|
|
107
|
+
console.warn('FileSource parsedData parameter is deprecated, use features instead of.');
|
|
108
|
+
source.features = source.features || source.parsedData;
|
|
109
|
+
}
|
|
110
|
+
if (source.projection) {
|
|
111
|
+
console.warn('FileSource projection parameter is deprecated, use crs instead.');
|
|
112
|
+
source.crs = source.crs || source.projection;
|
|
113
|
+
}
|
|
114
|
+
if (!source.crs) {
|
|
115
|
+
if (source.features && source.features.crs) {
|
|
116
|
+
source.crs = source.features.crs;
|
|
117
|
+
} else {
|
|
118
|
+
throw new Error('source.crs is required in FileSource');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (!source.url && !source.fetchedData && !source.features) {
|
|
122
|
+
throw new Error(`url, fetchedData and features are not set in
|
|
123
|
+
FileSource; at least one needs to be present`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// the fake url is for when we use the fetchedData or features mode
|
|
127
|
+
source.url = source.url || 'none';
|
|
128
|
+
super(source);
|
|
129
|
+
this.isFileSource = true;
|
|
130
|
+
this.fetchedData = source.fetchedData;
|
|
131
|
+
if (!this.fetchedData && !source.features) {
|
|
132
|
+
this.whenReady = this.fetcher(this.urlFromExtent(), this.networkOptions).then(f => {
|
|
133
|
+
this.fetchedData = f;
|
|
134
|
+
});
|
|
135
|
+
} else if (source.features) {
|
|
136
|
+
this._featuresCaches[source.features.crs] = new LRUCache({
|
|
137
|
+
max: 500
|
|
138
|
+
});
|
|
139
|
+
this._featuresCaches[source.features.crs].set(0, Promise.resolve(source.features));
|
|
140
|
+
}
|
|
141
|
+
this.whenReady.then(() => this.fetchedData);
|
|
142
|
+
this.zoom = {
|
|
143
|
+
min: 0,
|
|
144
|
+
max: Infinity
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
urlFromExtent() {
|
|
148
|
+
return this.url;
|
|
149
|
+
}
|
|
150
|
+
onLayerAdded(options) {
|
|
151
|
+
options.in = this;
|
|
152
|
+
super.onLayerAdded(options);
|
|
153
|
+
let features = this._featuresCaches[options.out.crs].get(0);
|
|
154
|
+
if (!features) {
|
|
155
|
+
options.out.buildExtent = this.crs != 'EPSG:4978';
|
|
156
|
+
if (options.out.buildExtent) {
|
|
157
|
+
options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs : this.crs;
|
|
158
|
+
}
|
|
159
|
+
features = this.parser(this.fetchedData, options);
|
|
160
|
+
this._featuresCaches[options.out.crs].set(0, features);
|
|
161
|
+
}
|
|
162
|
+
features.then(data => {
|
|
163
|
+
if (data.extent) {
|
|
164
|
+
this.extent = data.extent.clone();
|
|
165
|
+
// Transform local extent to data.crs projection.
|
|
166
|
+
if (this.extent.crs == data.crs) {
|
|
167
|
+
this.extent.applyMatrix4(data.matrixWorld);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* load data from cache or Fetch/Parse data.
|
|
175
|
+
* The loaded data is a Feature or Texture.
|
|
176
|
+
*
|
|
177
|
+
* @param {Extent} extent extent requested parsed data.
|
|
178
|
+
* @param {FeatureBuildingOptions|Layer} out The feature returned options
|
|
179
|
+
* @return {FeatureCollection|Texture} The parsed data.
|
|
180
|
+
*/
|
|
181
|
+
loadData(extent, out) {
|
|
182
|
+
return this._featuresCaches[out.crs].get(0);
|
|
183
|
+
}
|
|
184
|
+
extentInsideLimit(extent) {
|
|
185
|
+
return this.extent.intersectsExtent(extent);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export default FileSource;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import OGC3DTilesSource from "./OGC3DTilesSource.js";
|
|
2
|
+
class OGC3DTilesGoogleSource extends OGC3DTilesSource {
|
|
3
|
+
/**
|
|
4
|
+
* An object defining the source connection to a 3D Tiles asset from [Google Tiles API](https://tile.googleapis.com).
|
|
5
|
+
*
|
|
6
|
+
* @extends OGC3DTilesSource
|
|
7
|
+
*
|
|
8
|
+
* @property {boolean} isOGC3DTilesGoogleSource - Used to check if this source is an OGC3DTilesGoogleSource. Set to true.
|
|
9
|
+
* You should not change this, as it is used internally for optimisation.
|
|
10
|
+
* @property {string} url - The URL to the tileset json.
|
|
11
|
+
* @property {string} baseUrl - The base URL to access tiles.
|
|
12
|
+
*
|
|
13
|
+
* @property {boolean} isOGC3DTilesGoogleSource - Used to check if this source is an OGC3DTilesGoogleSource. Set to
|
|
14
|
+
* true. You should not change this, as it is used internally for optimisation.
|
|
15
|
+
* @param {Object} source An object that can contain all properties of an OGC3DTilesGoogleSource and {@link Source}.
|
|
16
|
+
* @param {String} source.key Your google tiles map API access key
|
|
17
|
+
*/
|
|
18
|
+
constructor(source) {
|
|
19
|
+
if (!source.key) {
|
|
20
|
+
throw new Error('[OGC3DTilesGoogleSource]: A API key for the google map tiles API is required');
|
|
21
|
+
}
|
|
22
|
+
// URL to the root tileset
|
|
23
|
+
source.url = `https://tile.googleapis.com/v1/3dtiles/root.json?key=${source.key}`;
|
|
24
|
+
super(source);
|
|
25
|
+
this.isOGC3DTilesGoogleSource = true;
|
|
26
|
+
this.key = source.key;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export default OGC3DTilesGoogleSource;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import OGC3DTilesSource from "./OGC3DTilesSource.js";
|
|
2
|
+
class OGC3DTilesIonSource extends OGC3DTilesSource {
|
|
3
|
+
/**
|
|
4
|
+
* An object defining the source connection to a 3DTiles asset of a [Cesium ion server](https://cesium.com/learn/ion/).
|
|
5
|
+
*
|
|
6
|
+
* @extends Source
|
|
7
|
+
*
|
|
8
|
+
* @property {boolean} isOGC3DTilesIonSource - Used to check if this source is an OGC3DTilesIonSource. Set to true.
|
|
9
|
+
* You should not change this, as it is used internally for optimisation.
|
|
10
|
+
* @property {string} accessToken - The Cesium ion access token used to retrieve the resource.
|
|
11
|
+
* @property {string} assetId - The id of the asset on Cesium ion.
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} source An object that can contain all properties of an OGC3DTilesIonSource and {@link Source}.
|
|
14
|
+
* Only `accessToken` and `assetId` are mandatory.
|
|
15
|
+
* @param {string} source.accessToken - The Cesium ion access token used to retrieve the resource.
|
|
16
|
+
* @param {string} source.assetId - The id of the asset on Cesium ion.
|
|
17
|
+
*/
|
|
18
|
+
constructor(source) {
|
|
19
|
+
if (!source.accessToken) {
|
|
20
|
+
throw new Error('[OGC3DTilesIonSource]: accessToken is required');
|
|
21
|
+
}
|
|
22
|
+
if (!source.assetId) {
|
|
23
|
+
throw new Error('[OGC3DTilesIonSource]: assetId is required');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Url to query cesium ion the first time to retrieve metadata of the asset with assetId
|
|
27
|
+
source.url = `https://api.cesium.com/v1/assets/${source.assetId}/endpoint?access_token=${source.accessToken}`;
|
|
28
|
+
super(source);
|
|
29
|
+
this.isOGC3DTilesIonSource = true;
|
|
30
|
+
this.accessToken = source.accessToken;
|
|
31
|
+
this.assetId = source.assetId;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export default OGC3DTilesIonSource;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
class OGC3DTilesSource extends Source {
|
|
3
|
+
/**
|
|
4
|
+
* An object defining the source connection to a 3DTiles dataset from a web server.
|
|
5
|
+
*
|
|
6
|
+
* @extends Source
|
|
7
|
+
*
|
|
8
|
+
* @property {boolean} isOGC3DTilesSource - Used to check if this source is an isOGC3DTilesSource. Set to true.
|
|
9
|
+
* You should not change this, as it is used internally for optimisation.
|
|
10
|
+
* @property {string} url - The URL of the tileset json.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} source An object that can contain all properties of OGC3DTilesSource and of {@link Source}.
|
|
13
|
+
* Only `url` is mandatory.
|
|
14
|
+
* @param {string} source.url - The URL of the tileset json.
|
|
15
|
+
*/
|
|
16
|
+
constructor(source) {
|
|
17
|
+
super(source);
|
|
18
|
+
this.isOGC3DTilesSource = true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export default OGC3DTilesSource;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* OrientedImageSource is a specific source used to load oriented images.
|
|
6
|
+
* @extends Source
|
|
7
|
+
*/
|
|
8
|
+
class OrientedImageSource extends Source {
|
|
9
|
+
/**
|
|
10
|
+
* @param { Object } source - Configuration object
|
|
11
|
+
* @param { string } source.url - Url for all the textures.
|
|
12
|
+
* @param { string } source.orientationsUrl - Json Url, using GeoJSon format to represent points,
|
|
13
|
+
* it's a set of panoramic position and orientation.
|
|
14
|
+
* @param { string } source.calibrationUrl - Json url, representing a set of camera.
|
|
15
|
+
* see {@link CameraCalibrationParser}
|
|
16
|
+
* This Url must contains {sensorId} and {cameraId}, and these pattern will be replaced to build the Url,
|
|
17
|
+
* to find the good texture for each camera for each panoramic.
|
|
18
|
+
*/
|
|
19
|
+
constructor(source) {
|
|
20
|
+
super(source);
|
|
21
|
+
this.isOrientedImageSource = true;
|
|
22
|
+
|
|
23
|
+
// Fetch the two files
|
|
24
|
+
const promises = [];
|
|
25
|
+
promises.push(source.orientationsUrl ? Fetcher.json(source.orientationsUrl, this.networkOptions) : Promise.resolve());
|
|
26
|
+
promises.push(source.calibrationUrl ? Fetcher.json(source.calibrationUrl, this.networkOptions) : Promise.resolve());
|
|
27
|
+
this.whenReady = Promise.all(promises).then(data => ({
|
|
28
|
+
orientation: data[0],
|
|
29
|
+
calibration: data[1]
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Build the url of the texture, but not from extent.
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} imageInfo - Information about the texture
|
|
37
|
+
* @param {string} imageInfo.camera - Id of the camera
|
|
38
|
+
* @param {string} imageInfo.pano - Id of the panoramic
|
|
39
|
+
* @return {string} Url of the image
|
|
40
|
+
*/
|
|
41
|
+
urlFromExtent(imageInfo) {
|
|
42
|
+
return this.imageUrl(imageInfo.cameraId, imageInfo.panoId);
|
|
43
|
+
}
|
|
44
|
+
getDataKey(image) {
|
|
45
|
+
return `c${image.cameraId}p${image.panoId}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Build the url of the image, for a given panoramic id, and a given camera id.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} cameraId Id of the camera
|
|
52
|
+
* @param {string} panoId Id of the panoramic
|
|
53
|
+
* @return {string} Url of the image
|
|
54
|
+
*/
|
|
55
|
+
imageUrl(cameraId, panoId) {
|
|
56
|
+
return this.url.replace('{cameraId}', cameraId).replace('{panoId}', panoId);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export default OrientedImageSource;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
3
|
+
import Potree2BinParser from "../Parser/Potree2BinParser.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Potree2Source are object containing informations on how to fetch potree 2.0 points cloud resources.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
class Potree2Source extends Source {
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} source - An object that can contain all properties of a
|
|
12
|
+
* Potree2Source
|
|
13
|
+
* @param {string} source.url - folder url.
|
|
14
|
+
* @param {string} source.file - metadata file name.
|
|
15
|
+
*
|
|
16
|
+
* This `metadata` file stores information about the potree cloud 2.0 in JSON format. the structure is :
|
|
17
|
+
*
|
|
18
|
+
* * __`version`__ - The metadata.json format may change over time. The version number is
|
|
19
|
+
* necessary so that parsers know how to interpret the data.
|
|
20
|
+
* * __`name`__ - Point cloud name.
|
|
21
|
+
* * __`description`__ - Point cloud description.
|
|
22
|
+
* * __`points`__ - Total number of points.
|
|
23
|
+
* * __`projection`__ - Point cloud geographic projection system.
|
|
24
|
+
* * __`hierarchy`__ - Information about point cloud hierarchy (first chunk size, step size, octree depth).
|
|
25
|
+
* * __`offset`__ - Position offset used to determine the global point position.
|
|
26
|
+
* * __`scale`__ - Point cloud scale.
|
|
27
|
+
* * __`spacing`__ - The minimum distance between points at root level.
|
|
28
|
+
* * __`boundingBox`__ - Contains the minimum and maximum of the axis aligned bounding box. This bounding box is cubic and aligned to fit to the octree root.
|
|
29
|
+
* * __`encoding`__ - Encoding type: BROTLI or DEFAULT (uncompressed).
|
|
30
|
+
* * __`attributes`__ - Array of attributes (position, intensity, return number, number of returns, classification, scan angle rank, user data, point source id, gps-time, rgb).
|
|
31
|
+
* ```
|
|
32
|
+
* {
|
|
33
|
+
* version: '2.0',
|
|
34
|
+
* name: "sample",
|
|
35
|
+
* description: "",
|
|
36
|
+
* points: 534909153,
|
|
37
|
+
* projection: "",
|
|
38
|
+
* hierarchy: {
|
|
39
|
+
* firstChunkSize: 1276,
|
|
40
|
+
* stepSize: 4,
|
|
41
|
+
* depth: 16
|
|
42
|
+
* },
|
|
43
|
+
* offset: [1339072.07, 7238866.339, 85.281],
|
|
44
|
+
* scale: [0.001, 0.001, 0.002],
|
|
45
|
+
* spacing: 24.476062500005355,
|
|
46
|
+
* boundingBox: {
|
|
47
|
+
* min: [1339072.07, 7238866.339, 85.281],
|
|
48
|
+
* max: [1342205.0060000008, 7241999.275, 3218.2170000006854]
|
|
49
|
+
* },
|
|
50
|
+
* encoding: "BROTLI",
|
|
51
|
+
* attributes: [
|
|
52
|
+
* {
|
|
53
|
+
* name: "position",
|
|
54
|
+
* description: "",
|
|
55
|
+
* size: 12,
|
|
56
|
+
* numElements: 3,
|
|
57
|
+
* elementSize: 4,
|
|
58
|
+
* type: "int32",
|
|
59
|
+
* min: [-0.74821299314498901, -2.7804059982299805, 2.5478212833404541],
|
|
60
|
+
* max: [2.4514148223438199, 1.4893437627414672, 7.1957106576508663]
|
|
61
|
+
* },
|
|
62
|
+
* {
|
|
63
|
+
* name: "intensity",
|
|
64
|
+
* description: "",
|
|
65
|
+
* size: 2,
|
|
66
|
+
* numElements: 1,
|
|
67
|
+
* elementSize: 2,
|
|
68
|
+
* type: "uint16",
|
|
69
|
+
* min: [0],
|
|
70
|
+
* max: [0]
|
|
71
|
+
* },{
|
|
72
|
+
* name: "return number",
|
|
73
|
+
* description: "",
|
|
74
|
+
* size: 1,
|
|
75
|
+
* numElements: 1,
|
|
76
|
+
* elementSize: 1,
|
|
77
|
+
* type: "uint8",
|
|
78
|
+
* min: [0],
|
|
79
|
+
* max: [0]
|
|
80
|
+
* },{
|
|
81
|
+
* name: "number of returns",
|
|
82
|
+
* description: "",
|
|
83
|
+
* size: 1,
|
|
84
|
+
* numElements: 1,
|
|
85
|
+
* elementSize: 1,
|
|
86
|
+
* type: "uint8",
|
|
87
|
+
* min: [0],
|
|
88
|
+
* max: [0]
|
|
89
|
+
* },{
|
|
90
|
+
* name: "classification",
|
|
91
|
+
* description: "",
|
|
92
|
+
* size: 1,
|
|
93
|
+
* numElements: 1,
|
|
94
|
+
* elementSize: 1,
|
|
95
|
+
* type: "uint8",
|
|
96
|
+
* min: [0],
|
|
97
|
+
* max: [0]
|
|
98
|
+
* },{
|
|
99
|
+
* name: "scan angle rank",
|
|
100
|
+
* description: "",
|
|
101
|
+
* size: 1,
|
|
102
|
+
* numElements: 1,
|
|
103
|
+
* elementSize: 1,
|
|
104
|
+
* type: "uint8",
|
|
105
|
+
* min: [0],
|
|
106
|
+
* max: [0]
|
|
107
|
+
* },{
|
|
108
|
+
* name: "user data",
|
|
109
|
+
* description: "",
|
|
110
|
+
* size: 1,
|
|
111
|
+
* numElements: 1,
|
|
112
|
+
* elementSize: 1,
|
|
113
|
+
* type: "uint8",
|
|
114
|
+
* min: [0],
|
|
115
|
+
* max: [0]
|
|
116
|
+
* },{
|
|
117
|
+
* name: "point source id",
|
|
118
|
+
* description: "",
|
|
119
|
+
* size: 2,
|
|
120
|
+
* numElements: 1,
|
|
121
|
+
* elementSize: 2,
|
|
122
|
+
* type: "uint16",
|
|
123
|
+
* min: [0],
|
|
124
|
+
* max: [0]
|
|
125
|
+
* },{
|
|
126
|
+
* name: "gps-time",
|
|
127
|
+
* description: "",
|
|
128
|
+
* size: 8,
|
|
129
|
+
* numElements: 1,
|
|
130
|
+
* elementSize: 8,
|
|
131
|
+
* type: "double",
|
|
132
|
+
* min: [0],
|
|
133
|
+
* max: [0]
|
|
134
|
+
* },{
|
|
135
|
+
* name: "rgb",
|
|
136
|
+
* description: "",
|
|
137
|
+
* size: 6,
|
|
138
|
+
* numElements: 3,
|
|
139
|
+
* elementSize: 2,
|
|
140
|
+
* type: "uint16",
|
|
141
|
+
* min: [5632, 5376, 4864],
|
|
142
|
+
* max: [65280, 65280, 65280]
|
|
143
|
+
* }
|
|
144
|
+
* ]
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @extends Source
|
|
149
|
+
*/
|
|
150
|
+
constructor(source) {
|
|
151
|
+
if (!source.file) {
|
|
152
|
+
throw new Error('New Potree2Source: file is required');
|
|
153
|
+
}
|
|
154
|
+
super(source);
|
|
155
|
+
this.file = source.file;
|
|
156
|
+
this.fetcher = Fetcher.arrayBuffer;
|
|
157
|
+
this.whenReady = (source.metadata ? Promise.resolve(source.metadata) : Fetcher.json(`${this.url}/${this.file}`, this.networkOptions)).then(metadata => {
|
|
158
|
+
this.metadata = metadata;
|
|
159
|
+
this.pointAttributes = metadata.attributes;
|
|
160
|
+
this.baseurl = `${this.url}`;
|
|
161
|
+
this.extension = 'bin';
|
|
162
|
+
this.parser = Potree2BinParser.parse;
|
|
163
|
+
return metadata;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export default Potree2Source;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import Source from "./Source.js";
|
|
2
|
+
import Fetcher from "../Provider/Fetcher.js";
|
|
3
|
+
import PotreeBinParser from "../Parser/PotreeBinParser.js";
|
|
4
|
+
import PotreeCinParser from "../Parser/PotreeCinParser.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* PotreeSource are object containing informations on how to fetch points cloud resources.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
class PotreeSource extends Source {
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} source - An object that can contain all properties of a
|
|
13
|
+
* PotreeSource
|
|
14
|
+
* @param {string} source.url - folder url.
|
|
15
|
+
* @param {string} source.file - cloud file name.
|
|
16
|
+
*
|
|
17
|
+
* This `cloud` file stores information about the potree cloud in JSON format. the structure is :
|
|
18
|
+
*
|
|
19
|
+
* * __`version`__ - The cloud.js format may change over time. The version number is
|
|
20
|
+
* necessary so that parsers know how to interpret the data.
|
|
21
|
+
* * __`octreeDir`__ - Directory or URL where node data is stored. Usually points to
|
|
22
|
+
* "data".
|
|
23
|
+
* * __`boundingBox`__ - Contains the minimum and maximum of the axis aligned bounding box. This bounding box is cubic and aligned to fit to the octree root.
|
|
24
|
+
* * __`tightBoundingBox`__ - This bounding box thightly fits the point data.
|
|
25
|
+
* * __`pointAttributes`__ - Declares the point data format. May be 'LAS', 'LAZ' or in case if the BINARY format an array of attributes like
|
|
26
|
+
* `['POSITION_CARTESIAN', 'COLOR_PACKED', 'INTENSITY']`
|
|
27
|
+
* * __`POSITION_CARTESIAN`__ - 3 x 32bit signed integers for x/y/z coordinates
|
|
28
|
+
* * __`COLOR_PACKED`__ - 4 x unsigned byte for r,g,b,a colors.
|
|
29
|
+
* * __`spacing`__ - The minimum distance between points at root level.
|
|
30
|
+
* ```
|
|
31
|
+
* {
|
|
32
|
+
* version: '1.6',
|
|
33
|
+
* octreeDir: 'data',
|
|
34
|
+
* boundingBox: {
|
|
35
|
+
* lx: -4.9854,
|
|
36
|
+
* ly: 1.0366,
|
|
37
|
+
* lz: -3.4494,
|
|
38
|
+
* ux: 0.702300000000001,
|
|
39
|
+
* uy: 6.7243,
|
|
40
|
+
* uz: 2.2383
|
|
41
|
+
* },
|
|
42
|
+
* tightBoundingBox: {
|
|
43
|
+
* lx: -4.9854,
|
|
44
|
+
* ly: 1.0375,
|
|
45
|
+
* lz: -3.4494,
|
|
46
|
+
* ux: -0.7889,
|
|
47
|
+
* uy: 6.7243,
|
|
48
|
+
* uz: 1.1245
|
|
49
|
+
* },
|
|
50
|
+
* pointAttributes: [
|
|
51
|
+
* 'POSITION_CARTESIAN',
|
|
52
|
+
* 'COLOR_PACKED'
|
|
53
|
+
* ],
|
|
54
|
+
* spacing: 0.03,
|
|
55
|
+
* scale: 0.001,
|
|
56
|
+
* hierarchyStepSize: 5
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @extends Source
|
|
61
|
+
*/
|
|
62
|
+
constructor(source) {
|
|
63
|
+
if (!source.file) {
|
|
64
|
+
throw new Error('New PotreeSource: file is required');
|
|
65
|
+
}
|
|
66
|
+
super(source);
|
|
67
|
+
this.file = source.file;
|
|
68
|
+
this.fetcher = Fetcher.arrayBuffer;
|
|
69
|
+
this.extensionOctree = 'hrc';
|
|
70
|
+
|
|
71
|
+
// For cloud specification visit:
|
|
72
|
+
// https://github.com/PropellerAero/potree-propeller-private/blob/master/docs/file_format.md#cloudjs
|
|
73
|
+
this.whenReady = (source.cloud ? Promise.resolve(source.cloud) : Fetcher.json(`${this.url}/${this.file}`, this.networkOptions)).then(cloud => {
|
|
74
|
+
this.pointAttributes = cloud.pointAttributes;
|
|
75
|
+
this.baseurl = `${this.url}/${cloud.octreeDir}/r`;
|
|
76
|
+
this.extension = cloud.pointAttributes === 'CIN' ? 'cin' : 'bin';
|
|
77
|
+
this.parse = this.extension === 'cin' ? PotreeCinParser.parse : PotreeBinParser.parse;
|
|
78
|
+
return cloud;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export default PotreeSource;
|