itowns 2.45.1 → 2.45.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/455.js +1 -1
- package/dist/455.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +8 -2
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.LICENSE.txt +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_lasparser.js +1 -1
- package/dist/itowns_lasparser.js.map +1 -1
- package/dist/itowns_lasworker.js +1 -1
- package/dist/itowns_lasworker.js.map +1 -1
- package/dist/itowns_potree2worker.js +1 -1
- package/dist/itowns_potree2worker.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/copc_simple_loader.html +3 -3
- package/examples/entwine_3d_loader.html +2 -2
- package/examples/entwine_simple_loader.html +10 -6
- package/examples/view_3d_map_webxr.html +2 -5
- package/lib/Controls/FirstPersonControls.d.ts +90 -0
- package/lib/Controls/FlyControls.d.ts +36 -0
- package/lib/Controls/GlobeControls.d.ts +274 -0
- package/lib/Controls/PlanarControls.d.ts +339 -0
- package/lib/Controls/StateControl.d.ts +140 -0
- package/lib/Controls/StreetControls.d.ts +134 -0
- package/lib/Controls/VRControls.d.ts +56 -0
- package/lib/Controls/VRControls.js +409 -0
- package/lib/Converter/Feature2Mesh.d.ts +42 -0
- package/lib/Converter/Feature2Texture.d.ts +5 -0
- package/lib/Converter/convertToTile.d.ts +5 -0
- package/lib/Converter/convertToTile.js +2 -2
- package/lib/Converter/textureConverter.d.ts +4 -0
- package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
- package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
- package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
- package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
- package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
- package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
- package/lib/Core/AnimationPlayer.d.ts +53 -0
- package/lib/Core/CopcNode.d.ts +67 -0
- package/lib/Core/CopcNode.js +50 -69
- package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
- package/lib/Core/EntwinePointTileNode.d.ts +58 -0
- package/lib/Core/EntwinePointTileNode.js +6 -34
- package/lib/Core/Feature.d.ts +323 -0
- package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
- package/lib/Core/Label.d.ts +86 -0
- package/lib/Core/MainLoop.d.ts +23 -0
- package/lib/Core/Picking.d.ts +6 -0
- package/lib/Core/Picking.js +4 -0
- package/lib/Core/PointCloudNode.d.ts +14 -0
- package/lib/Core/PointCloudNode.js +28 -0
- package/lib/Core/Potree2Node.d.ts +11 -0
- package/lib/Core/Potree2Node.js +3 -57
- package/lib/Core/Potree2PointAttributes.d.ts +97 -0
- package/lib/Core/PotreeNode.d.ts +13 -0
- package/lib/Core/PotreeNode.js +17 -17
- package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
- package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
- package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
- package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
- package/lib/Core/Prefab/GlobeView.d.ts +65 -0
- package/lib/Core/Prefab/GlobeView.js +9 -0
- package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
- package/lib/Core/Prefab/PlanarView.d.ts +33 -0
- package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
- package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
- package/lib/Core/Scheduler/Cache.d.ts +25 -0
- package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
- package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
- package/lib/Core/Style.d.ts +248 -0
- package/lib/Core/StyleOptions.d.ts +455 -0
- package/lib/Core/System/Capabilities.d.ts +9 -0
- package/lib/Core/Tile/Tile.d.ts +70 -0
- package/lib/Core/Tile/TileGrid.d.ts +12 -0
- package/lib/Core/TileGeometry.d.ts +46 -0
- package/lib/Core/TileMesh.d.ts +50 -0
- package/lib/Core/TileMesh.js +2 -4
- package/lib/Core/View.d.ts +403 -0
- package/lib/Core/View.js +1 -7
- package/lib/Layer/C3DTilesLayer.d.ts +140 -0
- package/lib/Layer/ColorLayer.d.ts +128 -0
- package/lib/Layer/ColorLayer.js +4 -4
- package/lib/Layer/CopcLayer.d.ts +42 -0
- package/lib/Layer/CopcLayer.js +3 -6
- package/lib/Layer/ElevationLayer.d.ts +96 -0
- package/lib/Layer/ElevationLayer.js +3 -3
- package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
- package/lib/Layer/EntwinePointTileLayer.js +4 -3
- package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
- package/lib/Layer/GeoidLayer.d.ts +41 -0
- package/lib/Layer/GeometryLayer.d.ts +120 -0
- package/lib/Layer/InfoLayer.d.ts +24 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/LabelLayer.d.ts +93 -0
- package/lib/Layer/LabelLayer.js +2 -2
- package/lib/Layer/Layer.d.ts +185 -0
- package/lib/Layer/LayerUpdateState.d.ts +24 -0
- package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
- package/lib/Layer/LayerUpdateStrategy.js +2 -7
- package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
- package/lib/Layer/OGC3DTilesLayer.js +21 -0
- package/lib/Layer/OrientedImageLayer.d.ts +53 -0
- package/lib/Layer/PointCloudLayer.d.ts +103 -0
- package/lib/Layer/PointCloudLayer.js +1 -1
- package/lib/Layer/Potree2Layer.d.ts +56 -0
- package/lib/Layer/PotreeLayer.d.ts +55 -0
- package/lib/Layer/RasterLayer.d.ts +8 -0
- package/lib/Layer/RasterLayer.js +2 -2
- package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
- package/lib/Layer/ReferencingLayerProperties.js +0 -12
- package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
- package/lib/Layer/TiledGeometryLayer.js +4 -3
- package/lib/Main.d.ts +89 -0
- package/lib/Main.js +3 -1
- package/lib/Parser/B3dmParser.d.ts +26 -0
- package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
- package/lib/Parser/GDFParser.d.ts +24 -0
- package/lib/Parser/GTXParser.d.ts +28 -0
- package/lib/Parser/GeoJsonParser.d.ts +12 -0
- package/lib/Parser/GpxParser.d.ts +12 -0
- package/lib/Parser/ISGParser.d.ts +23 -0
- package/lib/Parser/KMLParser.d.ts +12 -0
- package/lib/Parser/LASParser.d.ts +61 -0
- package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
- package/lib/Parser/PntsParser.d.ts +4 -0
- package/lib/Parser/Potree2BinParser.d.ts +8 -0
- package/lib/Parser/PotreeBinParser.d.ts +4 -0
- package/lib/Parser/PotreeCinParser.d.ts +4 -0
- package/lib/Parser/ShapefileParser.d.ts +25 -0
- package/lib/Parser/VectorTileParser.d.ts +34 -0
- package/lib/Parser/XbilParser.d.ts +18 -0
- package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
- package/lib/Parser/iGLTFLoader.d.ts +104 -0
- package/lib/Process/3dTilesProcessing.d.ts +43 -0
- package/lib/Process/FeatureProcessing.d.ts +4 -0
- package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
- package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
- package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
- package/lib/Process/handlerNodeError.d.ts +1 -0
- package/lib/Provider/3dTilesProvider.d.ts +7 -0
- package/lib/Provider/DataSourceProvider.d.ts +4 -0
- package/lib/Provider/Fetcher.d.ts +101 -0
- package/lib/Provider/PointCloudProvider.d.ts +4 -0
- package/lib/Provider/TileProvider.d.ts +4 -0
- package/lib/Provider/URLBuilder.d.ts +28 -0
- package/lib/Renderer/Camera.d.ts +95 -0
- package/lib/Renderer/Color.d.ts +3 -0
- package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
- package/lib/Renderer/ColorLayersOrdering.js +2 -2
- package/lib/Renderer/CommonMaterial.d.ts +6 -0
- package/lib/Renderer/Label2DRenderer.d.ts +31 -0
- package/lib/Renderer/LayeredMaterial.d.ts +121 -0
- package/lib/Renderer/LayeredMaterial.js +221 -141
- package/lib/Renderer/OBB.d.ts +65 -0
- package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
- package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
- package/lib/Renderer/PointsMaterial.d.ts +226 -0
- package/lib/Renderer/PointsMaterial.js +60 -22
- package/lib/Renderer/RasterTile.d.ts +53 -0
- package/lib/Renderer/RasterTile.js +8 -9
- package/lib/Renderer/RenderMode.d.ts +11 -0
- package/lib/Renderer/RenderMode.js +1 -0
- package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
- package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
- package/lib/Renderer/WebXR.d.ts +33 -0
- package/lib/Renderer/WebXR.js +128 -47
- package/lib/Renderer/c3DEngine.d.ts +55 -0
- package/lib/Renderer/c3DEngine.js +5 -1
- package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
- package/lib/Source/C3DTilesIonSource.d.ts +31 -0
- package/lib/Source/C3DTilesSource.d.ts +17 -0
- package/lib/Source/CopcSource.d.ts +79 -0
- package/lib/Source/EntwinePointTileSource.d.ts +40 -0
- package/lib/Source/EntwinePointTileSource.js +0 -5
- package/lib/Source/FileSource.d.ts +118 -0
- package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
- package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
- package/lib/Source/OGC3DTilesSource.d.ts +21 -0
- package/lib/Source/OrientedImageSource.d.ts +48 -0
- package/lib/Source/Potree2Source.d.ts +157 -0
- package/lib/Source/PotreeSource.d.ts +69 -0
- package/lib/Source/Source.d.ts +122 -0
- package/lib/Source/TMSSource.d.ts +77 -0
- package/lib/Source/VectorTilesSource.d.ts +56 -0
- package/lib/Source/WFSSource.d.ts +110 -0
- package/lib/Source/WMSSource.d.ts +85 -0
- package/lib/Source/WMTSSource.d.ts +65 -0
- package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
- package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
- package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
- package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
- package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
- package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
- package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
- package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
- package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
- package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
- package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
- package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
- package/lib/Utils/CameraUtils.d.ts +132 -0
- package/lib/Utils/DEMUtils.d.ts +84 -0
- package/lib/Utils/DEMUtils.js +2 -2
- package/lib/Utils/FeaturesUtils.d.ts +17 -0
- package/lib/Utils/Gradients.d.ts +13 -0
- package/lib/Utils/ThreeUtils.d.ts +14 -0
- package/lib/Utils/placeObjectOnGround.d.ts +28 -0
- package/lib/global.d.js +0 -0
- package/package.json +18 -15
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { TileGeometry } from '../../Core/TileGeometry';
|
|
3
|
+
import type { Extent } from '@itowns/geographic';
|
|
4
|
+
import { Coordinates } from '@itowns/geographic';
|
|
5
|
+
export type GpuBufferAttributes = {
|
|
6
|
+
index: THREE.BufferAttribute | null;
|
|
7
|
+
position: THREE.BufferAttribute;
|
|
8
|
+
normal: THREE.BufferAttribute;
|
|
9
|
+
uvs: THREE.BufferAttribute[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Reference to a tile's extent with rigid transformations.
|
|
13
|
+
* Enables reuse of geometry, saving a bit of memory.
|
|
14
|
+
*/
|
|
15
|
+
export type ShareableExtent = {
|
|
16
|
+
shareableExtent: Extent;
|
|
17
|
+
quaternion: THREE.Quaternion;
|
|
18
|
+
position: THREE.Vector3;
|
|
19
|
+
};
|
|
20
|
+
export interface TileBuilderParams {
|
|
21
|
+
/** Whether to build the skirt. */
|
|
22
|
+
disableSkirt: boolean;
|
|
23
|
+
/** Whether to render the skirt. */
|
|
24
|
+
hideSkirt: boolean;
|
|
25
|
+
/** Number of segments (edge loops) inside tiles. */
|
|
26
|
+
segments: number;
|
|
27
|
+
/** Buffer for projected points. */
|
|
28
|
+
coordinates: Coordinates;
|
|
29
|
+
extent: Extent;
|
|
30
|
+
level: number;
|
|
31
|
+
center: THREE.Vector3;
|
|
32
|
+
}
|
|
33
|
+
export interface TileBuilder<SpecializedParams extends TileBuilderParams> {
|
|
34
|
+
crs: string;
|
|
35
|
+
/** Convert builder-agnostic params to specialized ones. */
|
|
36
|
+
prepare(params: TileBuilderParams): SpecializedParams;
|
|
37
|
+
/**
|
|
38
|
+
* Computes final offset of the second texture set.
|
|
39
|
+
* Only relevant in the case of more than one texture sets.
|
|
40
|
+
*/
|
|
41
|
+
computeExtraOffset?: (params: SpecializedParams) => number;
|
|
42
|
+
/** Get the center of the current tile as a 3D vector. */
|
|
43
|
+
center(extent: Extent): THREE.Vector3;
|
|
44
|
+
/** Converts an x/y tile-space position to its equivalent in 3D space. */
|
|
45
|
+
vertexPosition(coordinates: Coordinates): THREE.Vector3;
|
|
46
|
+
/** Gets the geodesic normal of the last processed vertex. */
|
|
47
|
+
vertexNormal(): THREE.Vector3;
|
|
48
|
+
/** Project horizontal texture coordinate to world space. */
|
|
49
|
+
uProject(u: number, extent: Extent): number;
|
|
50
|
+
/** Project vertical texture coordinate to world space. */
|
|
51
|
+
vProject(v: number, extent: Extent): number;
|
|
52
|
+
/**
|
|
53
|
+
* Compute shareable extent to pool geometries together.
|
|
54
|
+
* The geometry of tiles on the same latitude is the same with an added
|
|
55
|
+
* rigid transform.
|
|
56
|
+
*/
|
|
57
|
+
computeShareableExtent(extent: Extent): ShareableExtent;
|
|
58
|
+
}
|
|
59
|
+
export declare function newTileGeometry(builder: TileBuilder<TileBuilderParams>, params: TileBuilderParams): Promise<{
|
|
60
|
+
geometry: TileGeometry;
|
|
61
|
+
quaternion: THREE.Quaternion;
|
|
62
|
+
position: THREE.Vector3;
|
|
63
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TileBuilder, TileBuilderParams } from '../../Core/Prefab/TileBuilder';
|
|
2
|
+
export declare function getBufferIndexSize(segments: number, noSkirt: boolean): number;
|
|
3
|
+
type Option<T> = T | undefined;
|
|
4
|
+
type IndexArray = Option<Uint8Array | Uint16Array | Uint32Array>;
|
|
5
|
+
export type Buffers = {
|
|
6
|
+
index: IndexArray;
|
|
7
|
+
position: Float32Array;
|
|
8
|
+
normal: Float32Array;
|
|
9
|
+
uvs: [Option<Float32Array>, Option<Float32Array>];
|
|
10
|
+
};
|
|
11
|
+
type BufferCache = {
|
|
12
|
+
index: Exclude<IndexArray, undefined>;
|
|
13
|
+
uv: Float32Array;
|
|
14
|
+
};
|
|
15
|
+
/** Compute buffers describing a tile according to a builder and its params. */
|
|
16
|
+
export declare function computeBuffers(builder: TileBuilder<TileBuilderParams>, params: TileBuilderParams, cache?: BufferCache): Buffers;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache policies for flushing. Those policies can be used when something is
|
|
3
|
+
* [set]{@link Cache.set} into the Cache, as the lifetime property.
|
|
4
|
+
*/
|
|
5
|
+
export type CACHE_POLICIES = {
|
|
6
|
+
/**
|
|
7
|
+
* - The entry is never flushed, except when the
|
|
8
|
+
* `all` flag is set to `true` when calling {@link Cache.flush}.
|
|
9
|
+
*/
|
|
10
|
+
INFINITE: number;
|
|
11
|
+
/**
|
|
12
|
+
* - Shortcut for texture resources. Time is 15 minutes.
|
|
13
|
+
*/
|
|
14
|
+
TEXTURE: number;
|
|
15
|
+
/**
|
|
16
|
+
* - Shortcut for geometry resources. Time is 15 minutes.
|
|
17
|
+
* minutes.
|
|
18
|
+
*/
|
|
19
|
+
GEOMETRY: number;
|
|
20
|
+
};
|
|
21
|
+
export namespace CACHE_POLICIES {
|
|
22
|
+
let INFINITE: number;
|
|
23
|
+
let TEXTURE: number;
|
|
24
|
+
let GEOMETRY: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default CancelledCommandException;
|
|
2
|
+
/**
|
|
3
|
+
* Custom error thrown when cancelling commands. Allows the caller to act differently if needed.
|
|
4
|
+
* @class
|
|
5
|
+
* @param {Command} command
|
|
6
|
+
*/
|
|
7
|
+
declare class CancelledCommandException {
|
|
8
|
+
constructor(command: any);
|
|
9
|
+
command: any;
|
|
10
|
+
isCancelledCommandException: boolean;
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export default Scheduler;
|
|
2
|
+
/**
|
|
3
|
+
* The Scheduler is in charge of managing the [Providers]{@link Provider} that
|
|
4
|
+
* are used to gather resources needed to display the layers on a {@link View}.
|
|
5
|
+
* There is only one instance of a Scheduler per webview, and it is instanciated
|
|
6
|
+
* with the creation of the first view.
|
|
7
|
+
*
|
|
8
|
+
* @constructor
|
|
9
|
+
*/
|
|
10
|
+
declare function Scheduler(): void;
|
|
11
|
+
declare class Scheduler {
|
|
12
|
+
defaultQueue: {
|
|
13
|
+
queue(command: any): void;
|
|
14
|
+
storages: Map<any, any>;
|
|
15
|
+
counters: {
|
|
16
|
+
executing: number;
|
|
17
|
+
executed: number;
|
|
18
|
+
failed: number;
|
|
19
|
+
cancelled: number;
|
|
20
|
+
pending: number;
|
|
21
|
+
};
|
|
22
|
+
execute(cmd: any, provider: any): any;
|
|
23
|
+
};
|
|
24
|
+
hostQueues: Map<any, any>;
|
|
25
|
+
providers: {};
|
|
26
|
+
maxCommandsPerHost: number;
|
|
27
|
+
initDefaultProviders(): void;
|
|
28
|
+
runCommand(command: any, queue: any, executingCounterUpToDate: any): void;
|
|
29
|
+
execute(command: any): any;
|
|
30
|
+
/**
|
|
31
|
+
* A Provider has the responsability to handle protocols and datablobs. Given a
|
|
32
|
+
* data request (see {@link Provider#executeCommand} for details about this
|
|
33
|
+
* request), it fetches serialized datasets, file content or even file chunks.
|
|
34
|
+
*
|
|
35
|
+
* @interface Provider
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* When adding a layer to a view, some preprocessing can be done on it, before
|
|
39
|
+
* fetching or creating resources attached to it. For example, in the WMTS and
|
|
40
|
+
* WFS providers (included in iTowns), default options to the layer are added if
|
|
41
|
+
* some are missing.
|
|
42
|
+
*
|
|
43
|
+
* @param {Layer} layer
|
|
44
|
+
* @param {View} [view]
|
|
45
|
+
* @param {Scheduler} [scheduler]
|
|
46
|
+
* @param {Layer} [parentLayer]
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* In the {@link Scheduler} loop, this function is called every time the layer
|
|
50
|
+
* needs new information about itself. For tiled layers, it gets the necessary
|
|
51
|
+
* tiles, given the current position of the camera on the map. For simple layers
|
|
52
|
+
* like a GPX trace, it gets the data once.
|
|
53
|
+
* <br><br>
|
|
54
|
+
* It passes a `command` object as a parameter, with the `view` and the `layer`
|
|
55
|
+
* always present. The other parameters are optional.
|
|
56
|
+
*
|
|
57
|
+
* @function
|
|
58
|
+
* @name Provider#executeCommand
|
|
59
|
+
*
|
|
60
|
+
* @param {Object} command
|
|
61
|
+
* @param {View} command.view
|
|
62
|
+
* @param {Layer} command.layer
|
|
63
|
+
* @param {TileMesh} [command.requester] - Every layer is attached to a tile.
|
|
64
|
+
* @param {number} [command.targetLevel] - The target level is used when there
|
|
65
|
+
* is a tiled layer, such as WMTS or TMS, but not in case like a GPX layer.
|
|
66
|
+
*
|
|
67
|
+
* @return {Promise} The {@link Scheduler} always expect a Promise as a result,
|
|
68
|
+
* resolving to an object containing sufficient information for the associated
|
|
69
|
+
* processing to the current layer. For example, see the
|
|
70
|
+
* [LayeredMaterialNodeProcessing#updateLayeredMaterialNodeElevation]{@link
|
|
71
|
+
* https://github.com/iTowns/itowns/blob/master/src/Process/LayeredMaterialNodeProcessing.js}
|
|
72
|
+
* class or other processing class.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Adds a provider for a specified protocol. The provider will be used when
|
|
76
|
+
* executing the queue to provide resources. See {@link Provider} for more
|
|
77
|
+
* informations.
|
|
78
|
+
* By default, some protocols are already set in iTowns: WMTS, WMS, WFS, TMS,
|
|
79
|
+
* XYZ, PotreeConverter, Rasterizer, 3D-Tiles and Static.
|
|
80
|
+
* <br><br>
|
|
81
|
+
* Warning: if the specified protocol has already a provider attached to it, the
|
|
82
|
+
* current provider will be overwritten by the given provider.
|
|
83
|
+
*
|
|
84
|
+
* @param {string} protocol - The name of the protocol to add. This is the
|
|
85
|
+
* `protocol` parameter put inside the configuration when adding a layer. The
|
|
86
|
+
* capitalization of the name is not taken into account here.
|
|
87
|
+
* @param {Provider} provider - The provider to link to the protocol, that must
|
|
88
|
+
* respect the {@link Provider} interface description.
|
|
89
|
+
*
|
|
90
|
+
* @throws {Error} an error if any method of the {@link Provider} is not present
|
|
91
|
+
* in the provider.
|
|
92
|
+
*/
|
|
93
|
+
addProtocolProvider(protocol: string, provider: Provider): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get a specific {@link Provider} given a particular protocol.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} protocol
|
|
98
|
+
*
|
|
99
|
+
* @return {Provider}
|
|
100
|
+
*/
|
|
101
|
+
getProtocolProvider(protocol: string): Provider;
|
|
102
|
+
commandsWaitingExecutionCount(): number;
|
|
103
|
+
commandsRunningCount(): number;
|
|
104
|
+
resetCommandsCount(type: any): any;
|
|
105
|
+
deQueue(queue: any): any;
|
|
106
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
export function readExpression(property: any, ctx: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* StyleContext stores metadata of one FeatureGeometry that are needed for its style computation:
|
|
4
|
+
* type of feature and what is needed (fill, stroke or draw a point, etc.) as well as where to get its
|
|
5
|
+
* properties and its coordinates (for base_altitude).
|
|
6
|
+
*
|
|
7
|
+
* @property {number} zoom Current zoom to display the FeatureGeometry.
|
|
8
|
+
* @property {Object} collection The FeatureCollection to which the FeatureGeometry is attached.
|
|
9
|
+
* @property {Object} properties Properties of the FeatureGeometry.
|
|
10
|
+
* @property {string} type Geometry type of the feature. Can be `point`, `line`, or `polygon`.
|
|
11
|
+
* @property {StyleOptions|Function}featureStyle StyleOptions object (or a function returning one) to get style
|
|
12
|
+
* information at feature and FeatureGeometry level from the data parsed.
|
|
13
|
+
* @property {Coordinates} coordinates The coordinates (in world space) of the last vertex (x, y, z) set with
|
|
14
|
+
* setLocalCoordinatesFromArray().
|
|
15
|
+
* private properties:
|
|
16
|
+
* @property {Coordinates} worldCoord @private Coordinates object to store coordinates in world space.
|
|
17
|
+
* @property {Coordinates} localCoordinates @private Coordinates object to store coordinates in local space.
|
|
18
|
+
* @property {boolean} worldCoordsComputed @private Have the world coordinates already been computed
|
|
19
|
+
* from the local coordinates?
|
|
20
|
+
* @property {Feature} feature @private The itowns feature of interest.
|
|
21
|
+
* @property {FeatureGeometry} geometry @private The FeatureGeometry to compute the style.
|
|
22
|
+
*/
|
|
23
|
+
export class StyleContext {
|
|
24
|
+
setZoom(zoom: any): void;
|
|
25
|
+
zoom: any;
|
|
26
|
+
setFeature(f: any): void;
|
|
27
|
+
setGeometry(g: any): void;
|
|
28
|
+
setCollection(c: any): void;
|
|
29
|
+
collection: any;
|
|
30
|
+
setLocalCoordinatesFromArray(vertices: any, offset: any): Coordinates;
|
|
31
|
+
get properties(): any;
|
|
32
|
+
get type(): any;
|
|
33
|
+
get featureStyle(): any;
|
|
34
|
+
get coordinates(): Coordinates;
|
|
35
|
+
#private;
|
|
36
|
+
}
|
|
37
|
+
export default Style;
|
|
38
|
+
import { Coordinates } from '@itowns/geographic';
|
|
39
|
+
/**
|
|
40
|
+
* A Style is a class that defines the visual appearance of {@link
|
|
41
|
+
* FeatureCollection} and {@link Feature}. It is taken into account when drawing
|
|
42
|
+
* them in textures that will be placed onto tiles.
|
|
43
|
+
*
|
|
44
|
+
* As there are five basic elements present in `Features`, there are also five
|
|
45
|
+
* main components in a `Style` object:
|
|
46
|
+
* - `fill` is for all fillings and polygons
|
|
47
|
+
* - `stroke` is for all lines and polygons edges
|
|
48
|
+
* - `point` is for all points
|
|
49
|
+
* - `text` contains all {@link Label} related things
|
|
50
|
+
* - `icon` defines the appearance of icons attached to label.
|
|
51
|
+
*
|
|
52
|
+
* Many style property can be set to functions. When that is the case, the function's
|
|
53
|
+
* return type must necessarily be the same as the types (other than function) of the property.
|
|
54
|
+
* For instance, if the `fill.pattern` property is set to a function, this function must return
|
|
55
|
+
* an `Image`, a `Canvas`, or `String`.
|
|
56
|
+
* The first parameter of functions used to set `Style` properties is always an object containing
|
|
57
|
+
* the properties of the features displayed with the current `Style` instance.
|
|
58
|
+
*
|
|
59
|
+
* @property {Object} fill - Polygons and fillings style.
|
|
60
|
+
* @property {String|Function|THREE.Color} fill.color - Defines the main color of the filling. Can be
|
|
61
|
+
* any [valid color
|
|
62
|
+
* string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
63
|
+
* Default is no value, indicating that no filling needs to be done.
|
|
64
|
+
* If the `Layer` is a `GeometryLayer` you can use `THREE.Color`.
|
|
65
|
+
* @property {Image|Canvas|String|Object|Function} [fill.pattern] - Defines a pattern to fill the
|
|
66
|
+
* surface with. It can be an `Image` to use directly, an url to fetch the pattern or an object containing
|
|
67
|
+
* the url of the image to fetch and the transformation to apply.
|
|
68
|
+
* from. See [this example] (http://www.itowns-project.org/itowns/examples/#source_file_geojson_raster)
|
|
69
|
+
* for how to use.
|
|
70
|
+
* @property {Image|String} [fill.pattern.source] - The image or the url to fetch the pattern image
|
|
71
|
+
* @property {Object} [fill.pattern.cropValues] - The x, y, width and height (in pixel) of the sub image to use.
|
|
72
|
+
* @property {THREE.Color} [fill.pattern.color] - Can be any [valid color string]
|
|
73
|
+
* @property {Number|Function} fill.opacity - The opacity of the color or of the
|
|
74
|
+
* pattern. Can be between `0.0` and `1.0`. Default is `1.0`.
|
|
75
|
+
* For a `GeometryLayer`, this opacity property isn't used.
|
|
76
|
+
* @property {Number|Function} fill.base_altitude - Only for {@link GeometryLayer}, defines altitude
|
|
77
|
+
* for each coordinate.
|
|
78
|
+
* If `base_altitude` is `undefined`, the original altitude is kept, and if it doesn't exist
|
|
79
|
+
* then the altitude value is set to 0.
|
|
80
|
+
* @property {Number|Function} [fill.extrusion_height] - Only for {@link GeometryLayer} and if user sets it.
|
|
81
|
+
* If defined, polygons will be extruded by the specified amount.
|
|
82
|
+
* @property {Object} stroke - Lines and polygons edges.
|
|
83
|
+
* @property {String|Function|THREE.Color} stroke.color The color of the line. Can be any [valid
|
|
84
|
+
* color string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
85
|
+
* Default is no value, indicating that no stroke needs to be done.
|
|
86
|
+
* If the `Layer` is a `GeometryLayer` you can use `THREE.Color`.
|
|
87
|
+
* @property {Number|Function} stroke.opacity - The opacity of the line. Can be between
|
|
88
|
+
* `0.0` and `1.0`. Default is `1.0`.
|
|
89
|
+
* For a `GeometryLayer`, this opacity property isn't used.
|
|
90
|
+
* @property {Number|Function} stroke.width - The width of the line. Default is `1.0`.
|
|
91
|
+
* @property {Number|Function} stroke.base_altitude - Only for {@link GeometryLayer}, defines altitude
|
|
92
|
+
* for each coordinate.
|
|
93
|
+
* If `base_altitude` is `undefined`, the original altitude is kept, and if it doesn't exist
|
|
94
|
+
* then the altitude value is set to 0.
|
|
95
|
+
*
|
|
96
|
+
* @property {Object} point - Point style.
|
|
97
|
+
* @property {String|Function} point.color - The color of the point. Can be any [valid
|
|
98
|
+
* color string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
99
|
+
* Default is no value, indicating that no point will be shown.
|
|
100
|
+
* @property {Number|Function} point.radius - The radius of the point, in pixel. Default
|
|
101
|
+
* is `2.0`.
|
|
102
|
+
* @property {String|Function} point.line - The color of the border of the point. Can be
|
|
103
|
+
* any [valid color
|
|
104
|
+
* string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
105
|
+
* Not supported for `GeometryLayer`.
|
|
106
|
+
* @property {Number|Function} point.width - The width of the border, in pixel. Default
|
|
107
|
+
* is `0.0` (no border).
|
|
108
|
+
* @property {Number|Function} point.opacity - The opacity of the point. Can be between
|
|
109
|
+
* `0.0` and `1.0`. Default is `1.0`.
|
|
110
|
+
* Not supported for `GeometryLayer`.
|
|
111
|
+
* @property {Number|Function} point.base_altitude - Only for {@link GeometryLayer}, defines altitude
|
|
112
|
+
* for each coordinate.
|
|
113
|
+
* If `base_altitude` is `undefined`, the original altitude is kept, and if it doesn't exist
|
|
114
|
+
* then the altitude value is set to 0.
|
|
115
|
+
* @property {Object} point.model - 3D model to instantiate at each point position
|
|
116
|
+
|
|
117
|
+
*
|
|
118
|
+
* @property {Object} text - All things {@link Label} related.
|
|
119
|
+
* @property {String|Function} text.field - A string representing a property key of
|
|
120
|
+
* a `FeatureGeometry` enclosed in brackets, that will be replaced by the value of the
|
|
121
|
+
* property for each geometry. For example, if each geometry contains a `name` property,
|
|
122
|
+
* `text.field` can be set to `{name}`. Default is no value, indicating that no
|
|
123
|
+
* text will be displayed.
|
|
124
|
+
*
|
|
125
|
+
* It's also possible to create more complex expressions. For example, you can combine
|
|
126
|
+
* text that will always be displayed (e.g. `foo`) and variable properties (e.g. `{bar}`)
|
|
127
|
+
* like the following: `foo {bar}`. You can also use multiple variables in one field.
|
|
128
|
+
* Let's say for instance that you have two properties latin name and local name of a
|
|
129
|
+
* place, you can write something like `{name_latin} - {name_local}` which can result
|
|
130
|
+
* in `Marrakesh - مراكش` for example.
|
|
131
|
+
* @property {String|Function} text.color - The color of the text. Can be any [valid
|
|
132
|
+
* color string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
133
|
+
* Default is `#000000`.
|
|
134
|
+
* @property {String|Number[]|Function} text.anchor - The anchor of the text relative to its
|
|
135
|
+
* position (see {@link Label} for the position). Can be one of the following values: `top`,
|
|
136
|
+
* `left`, `bottom`, `right`, `center`, `top-left`, `top-right`, `bottom-left`
|
|
137
|
+
* or `bottom-right`. Default is `center`.
|
|
138
|
+
*
|
|
139
|
+
* It can also be defined as an Array of two numbers. Each number defines an offset (in
|
|
140
|
+
* fraction of the label width and height) between the label position and the top-left
|
|
141
|
+
* corner of the text. The first value is the horizontal offset, and the second is the
|
|
142
|
+
* vertical offset. For example, `[-0.5, -0.5]` will be equivalent to `center`.
|
|
143
|
+
* @property {Array|Function} text.offset - The offset of the text, depending on its
|
|
144
|
+
* anchor, in pixels. First value is from `left`, second is from `top`. Default
|
|
145
|
+
* is `[0, 0]`.
|
|
146
|
+
* @property {Number|Function} text.padding - The padding outside the text, in pixels.
|
|
147
|
+
* Default is `2`.
|
|
148
|
+
* @property {Number|Function} text.size - The size of the font, in pixels. Default is
|
|
149
|
+
* `16`.
|
|
150
|
+
* @property {Number|Function} text.wrap - The maximum width, in pixels, before the text
|
|
151
|
+
* is wrapped, because the string is too long. Default is `10`.
|
|
152
|
+
* @property {Number|Function} text.spacing - The spacing between the letters, in `em`.
|
|
153
|
+
* Default is `0`.
|
|
154
|
+
* @property {String|Function} text.transform - A value corresponding to the [CSS
|
|
155
|
+
* property
|
|
156
|
+
* `text-transform`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform).
|
|
157
|
+
* Default is `none`.
|
|
158
|
+
* @property {String|Function} text.justify - A value corresponding to the [CSS property
|
|
159
|
+
* `text-align`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align).
|
|
160
|
+
* Default is `center`.
|
|
161
|
+
* @property {Number|Function} text.opacity - The opacity of the text. Can be between
|
|
162
|
+
* `0.0` and `1.0`. Default is `1.0`.
|
|
163
|
+
* @property {Array|Function} text.font - A list (as an array of string) of font family
|
|
164
|
+
* names, prioritized in the order it is set. Default is `Open Sans Regular,
|
|
165
|
+
* Arial Unicode MS Regular, sans-serif`.
|
|
166
|
+
* @property {String|Function} text.haloColor - The color of the halo. Can be any [valid
|
|
167
|
+
* color string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
168
|
+
* Default is `#000000`.
|
|
169
|
+
* @property {Number|Function} text.haloWidth - The width of the halo, in pixels.
|
|
170
|
+
* Default is `0`.
|
|
171
|
+
* @property {Number|Function} text.haloBlur - The blur value of the halo, in pixels.
|
|
172
|
+
* Default is `0`.
|
|
173
|
+
*
|
|
174
|
+
* @property {Object} icon - Defines the appearance of icons attached to label.
|
|
175
|
+
* @property {String} icon.source - The url of the icons' image file.
|
|
176
|
+
* @property {String} icon.id - The id of the icons' sub-image in a vector tile data set.
|
|
177
|
+
* @property {String} icon.cropValues - the x, y, width and height (in pixel) of the sub image to use.
|
|
178
|
+
* @property {String} icon.anchor - The anchor of the icon compared to the label position.
|
|
179
|
+
* Can be `left`, `bottom`, `right`, `center`, `top-left`, `top-right`, `bottom-left`
|
|
180
|
+
* or `bottom-right`. Default is `center`.
|
|
181
|
+
* @property {Number} icon.size - If the icon's image is passed with `icon.source` and/or
|
|
182
|
+
* `icon.id`, its size when displayed on screen is multiplied by `icon.size`. Default is `1`.
|
|
183
|
+
* @property {String|Function} icon.color - The color of the icon. Can be any [valid
|
|
184
|
+
* color string](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
185
|
+
* It will change the color of the white pixels of the icon source image.
|
|
186
|
+
* @property {Number|Function} icon.opacity - The opacity of the icon. Can be between
|
|
187
|
+
* `0.0` and `1.0`. Default is `1.0`.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* const style = new itowns.Style({
|
|
191
|
+
* stroke: { color: 'red' },
|
|
192
|
+
* point: { color: 'white', line: 'red' },
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* const source = new itowns.FileSource(...);
|
|
196
|
+
*
|
|
197
|
+
* const layer = new itowns.ColorLayer('foo', {
|
|
198
|
+
* source: source,
|
|
199
|
+
* style: style,
|
|
200
|
+
* });
|
|
201
|
+
*
|
|
202
|
+
* view.addLayer(layer);
|
|
203
|
+
*/
|
|
204
|
+
declare class Style {
|
|
205
|
+
/**
|
|
206
|
+
* @param {StyleOptions} [params={}] An object that contain any properties
|
|
207
|
+
* (zoom, fill, stroke, point, text or/and icon)
|
|
208
|
+
* and sub properties of a Style ({@link StyleOptions}).
|
|
209
|
+
*/
|
|
210
|
+
constructor(params?: StyleOptions);
|
|
211
|
+
isStyle: boolean;
|
|
212
|
+
context: StyleContext;
|
|
213
|
+
zoom: {};
|
|
214
|
+
fill: {};
|
|
215
|
+
stroke: {};
|
|
216
|
+
point: {};
|
|
217
|
+
text: {};
|
|
218
|
+
icon: {};
|
|
219
|
+
setContext(ctx: any): void;
|
|
220
|
+
/**
|
|
221
|
+
* Applies the style.fill to a polygon of the texture canvas.
|
|
222
|
+
* @param {CanvasRenderingContext2D} txtrCtx The Context 2D of the texture canvas.
|
|
223
|
+
* @param {Path2D} polygon The current texture canvas polygon.
|
|
224
|
+
* @param {Number} invCtxScale The ratio to scale line width and radius circle.
|
|
225
|
+
* @param {Boolean} canBeFilled - true if feature.type == FEATURE_TYPES.POLYGON.
|
|
226
|
+
*/
|
|
227
|
+
applyToCanvasPolygon(txtrCtx: CanvasRenderingContext2D, polygon: Path2D, invCtxScale: number, canBeFilled: boolean): void;
|
|
228
|
+
_applyStrokeToPolygon(txtrCtx: any, invCtxScale: any, polygon: any): void;
|
|
229
|
+
_applyFillToPolygon(txtrCtx: any, invCtxScale: any, polygon: any): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Applies this style to a DOM element. Limited to the `text` and `icon`
|
|
232
|
+
* properties of this style.
|
|
233
|
+
*
|
|
234
|
+
* @param {Element} domElement - The element to set the style to.
|
|
235
|
+
*
|
|
236
|
+
* @returns {undefined|Promise<HTMLImageElement>}
|
|
237
|
+
* for a text label: undefined.
|
|
238
|
+
* for an icon: a Promise resolving with the HTMLImageElement containing the image.
|
|
239
|
+
*/
|
|
240
|
+
applyToHTML(domElement: Element, ...args: any[]): undefined | Promise<HTMLImageElement>;
|
|
241
|
+
/**
|
|
242
|
+
* Gets the values corresponding to the anchor of the text. It is
|
|
243
|
+
* proportions, to use with a `translate()` and a `transform` property.
|
|
244
|
+
*
|
|
245
|
+
* @return {Number[]} Two percentage values, for x and y respectively.
|
|
246
|
+
*/
|
|
247
|
+
getTextAnchorPosition(): number[];
|
|
248
|
+
}
|