@cesium/engine 7.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/z-worker-pako.js +1 -5
- package/Build/Workers/{chunk-7XEAYGZK.js → chunk-24YTYWNB.js} +10 -10
- package/Build/Workers/{chunk-IQBYFRVW.js → chunk-2632RVPI.js} +7 -7
- package/Build/Workers/chunk-2KACWKS4.js +501 -0
- package/Build/Workers/{chunk-QZAD5O7I.js → chunk-2XPLH3JY.js} +7 -7
- package/Build/Workers/{chunk-JY5YEZFA.js → chunk-2ZBL3MVO.js} +8 -8
- package/Build/Workers/{chunk-ZK5JOS3D.js → chunk-3NCVAGDA.js} +14 -14
- package/Build/Workers/{chunk-AR5DNBJ4.js → chunk-5R6VWLMH.js} +6 -6
- package/Build/Workers/{chunk-PTQQUQC3.js → chunk-5TIV3L26.js} +13 -13
- package/Build/Workers/{chunk-BZP4T2JJ.js → chunk-6WF3KIF5.js} +10 -10
- package/Build/Workers/{chunk-5WQ523AW.js → chunk-73FKKY52.js} +5 -5
- package/Build/Workers/{chunk-F6SE42BK.js → chunk-7COR472O.js} +15 -472
- package/Build/Workers/{chunk-72SANQJV.js → chunk-ADOVHYWO.js} +9 -5
- package/Build/Workers/{chunk-5YLJ77FF.js → chunk-BCU2LH5T.js} +12 -11
- package/Build/Workers/{chunk-4EBHOMFX.js → chunk-C3XBUYBO.js} +17 -17
- package/Build/Workers/{chunk-IX2JCCNM.js → chunk-C6OI26DR.js} +1 -1
- package/Build/Workers/{chunk-2HJWSU7B.js → chunk-CO35JNNE.js} +4 -4
- package/Build/Workers/{chunk-OVLG3FRS.js → chunk-DGDUKCJJ.js} +6 -6
- package/Build/Workers/{chunk-DTAIXKTO.js → chunk-DPUSFA7S.js} +6 -6
- package/Build/Workers/{chunk-R5X4OQT4.js → chunk-E6WXPSJS.js} +7 -7
- package/Build/Workers/{chunk-VK3EJHWI.js → chunk-EOXYZ34O.js} +2 -2
- package/Build/Workers/{chunk-RAEV7K66.js → chunk-EPKE7GE3.js} +5 -5
- package/Build/Workers/{chunk-GV56Q4LU.js → chunk-GFA4SMXV.js} +11 -11
- package/Build/Workers/{chunk-NKPBIX7F.js → chunk-GXUXEOE2.js} +1 -1
- package/Build/Workers/{chunk-NY3K4IM3.js → chunk-HBQPB6IH.js} +12 -12
- package/Build/Workers/{chunk-6HZQPRUS.js → chunk-I37B3MZ2.js} +1 -1
- package/Build/Workers/{chunk-VRGFV2UO.js → chunk-L4BW3RUA.js} +10 -10
- package/Build/Workers/{chunk-6VJVYK2V.js → chunk-LAQP3SCC.js} +2 -2
- package/Build/Workers/{chunk-PNBGBETF.js → chunk-LQJ5FFFR.js} +10 -10
- package/Build/Workers/{chunk-UAEW6HKG.js → chunk-M2AYBTNH.js} +13 -13
- package/Build/Workers/{chunk-YUCVWAY6.js → chunk-MWV7IZK4.js} +7 -7
- package/Build/Workers/{chunk-JXDC723O.js → chunk-N4KXMWQU.js} +2 -2
- package/Build/Workers/{chunk-XWXM2O2R.js → chunk-NP2GYYE5.js} +6 -6
- package/Build/Workers/{chunk-GEJTYLCO.js → chunk-NZWNZA6S.js} +5 -5
- package/Build/Workers/{chunk-LZGHD6NY.js → chunk-P2YAAMT2.js} +15 -15
- package/Build/Workers/{chunk-S6SKF6DT.js → chunk-P4XKB3QZ.js} +5 -5
- package/Build/Workers/{chunk-U2VCRRQW.js → chunk-PXB7T27O.js} +6 -6
- package/Build/Workers/{chunk-RV7ZYPFT.js → chunk-QCQUZGXI.js} +4 -4
- package/Build/Workers/{chunk-JJ4VBOQ3.js → chunk-QKBGRKKG.js} +4 -4
- package/Build/Workers/{chunk-ODW7WYM4.js → chunk-RMOEYCZW.js} +2 -2
- package/Build/Workers/{chunk-ZUA2UUNV.js → chunk-RSJXEO2A.js} +2 -2
- package/Build/Workers/{chunk-UDO6BFSF.js → chunk-RV7ZOSS6.js} +13 -13
- package/Build/Workers/{chunk-LZ7JIV3K.js → chunk-SE4PXOEA.js} +17 -17
- package/Build/Workers/{chunk-S4MAZ3SS.js → chunk-SS4ESNE3.js} +2 -2
- package/Build/Workers/{chunk-AIPU2VSX.js → chunk-TJBU6GML.js} +6 -6
- package/Build/Workers/{chunk-5M3U6ZMA.js → chunk-TZORKRNK.js} +1 -1
- package/Build/Workers/{chunk-MY3VNFGQ.js → chunk-VR5RBW52.js} +7 -7
- package/Build/Workers/{chunk-FP6GYBFX.js → chunk-WHUSTDIB.js} +10 -10
- package/Build/Workers/{chunk-5HDYHG3F.js → chunk-X2F6BEPY.js} +13 -13
- package/Build/Workers/{chunk-WZU2YLWG.js → chunk-X6XOMPWL.js} +3 -3
- package/Build/Workers/{chunk-UGK3FCDY.js → chunk-YDVSBWEO.js} +1 -1
- package/Build/Workers/{chunk-46UD5ABS.js → chunk-YV4H2Y7M.js} +4 -4
- package/Build/Workers/{chunk-WBQCVXR3.js → chunk-Z7FQLK6N.js} +4 -4
- package/Build/Workers/{chunk-L2ZN645J.js → chunk-ZNVSKMQ2.js} +6 -6
- package/Build/Workers/{chunk-JCNXK6EL.js → chunk-ZYPTP7GS.js} +11 -11
- package/Build/Workers/combineGeometry.js +24 -23
- package/Build/Workers/createBoxGeometry.js +18 -17
- package/Build/Workers/createBoxOutlineGeometry.js +16 -15
- package/Build/Workers/createCircleGeometry.js +26 -25
- package/Build/Workers/createCircleOutlineGeometry.js +19 -18
- package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
- package/Build/Workers/createCorridorGeometry.js +29 -28
- package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
- package/Build/Workers/createCylinderGeometry.js +20 -19
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
- package/Build/Workers/createEllipseGeometry.js +26 -25
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
- package/Build/Workers/createEllipsoidGeometry.js +19 -18
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
- package/Build/Workers/createFrustumGeometry.js +18 -17
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
- package/Build/Workers/createGeometry.js +54 -33
- package/Build/Workers/createGroundPolylineGeometry.js +22 -21
- package/Build/Workers/createPlaneGeometry.js +16 -15
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
- package/Build/Workers/createPolygonGeometry.js +33 -32
- package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
- package/Build/Workers/createPolylineGeometry.js +25 -24
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -30
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
- package/Build/Workers/createRectangleGeometry.js +27 -26
- package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
- package/Build/Workers/createSimplePolylineGeometry.js +23 -22
- package/Build/Workers/createSphereGeometry.js +19 -18
- package/Build/Workers/createSphereOutlineGeometry.js +18 -17
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -23
- package/Build/Workers/createVectorTilePoints.js +12 -12
- package/Build/Workers/createVectorTilePolygons.js +22 -21
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
- package/Build/Workers/createVerticesFromHeightmap.js +22 -21
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
- package/Build/Workers/createWallGeometry.js +24 -23
- package/Build/Workers/createWallOutlineGeometry.js +23 -22
- package/Build/Workers/decodeDraco.js +11 -11
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +601 -92
- package/Build/Workers/transcodeKTX2.js +7 -7
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
- package/Source/Core/Check.d.ts +127 -0
- package/Source/Core/Check.js +0 -1
- package/Source/Core/Ellipsoid.js +6 -0
- package/Source/Core/Geometry.js +1 -1
- package/Source/Core/IntersectionTests.js +6 -3
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/PixelFormat.js +5 -0
- package/Source/Core/PolygonGeometry.js +1 -1
- package/Source/Core/Transforms.js +3 -0
- package/Source/Core/VerticalExaggeration.js +2 -1
- package/Source/Core/srgbToLinear.js +32 -0
- package/Source/DataSources/CzmlDataSource.js +51 -23
- package/Source/DataSources/DataSourceDisplay.js +27 -0
- package/Source/DataSources/Entity.js +20 -2
- package/Source/DataSources/GeometryUpdaterSet.js +114 -0
- package/Source/DataSources/GeometryVisualizer.js +19 -83
- package/Source/Renderer/Context.js +10 -0
- package/Source/Renderer/ContextLimits.js +2 -0
- package/Source/Renderer/demodernizeShader.js +4 -1
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Axis.js +12 -7
- package/Source/Scene/Billboard.js +32 -0
- package/Source/Scene/BillboardCollection.js +1 -1
- package/Source/Scene/BingMapsImageryProvider.js +4 -0
- package/Source/Scene/Camera.js +46 -4
- package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
- package/Source/Scene/Cesium3DTileset.js +10 -7
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
- package/Source/Scene/FrameState.js +5 -0
- package/Source/Scene/Globe.js +0 -67
- package/Source/Scene/GlobeTranslucencyState.js +1 -1
- package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
- package/Source/Scene/I3SDataProvider.js +270 -53
- package/Source/Scene/I3SDecoder.js +8 -1
- package/Source/Scene/I3SFeature.js +2 -5
- package/Source/Scene/I3SField.js +136 -31
- package/Source/Scene/I3SGeometry.js +70 -2
- package/Source/Scene/I3SLayer.js +55 -10
- package/Source/Scene/I3SNode.js +175 -18
- package/Source/Scene/I3SStatistics.js +94 -0
- package/Source/Scene/I3SSublayer.js +176 -0
- package/Source/Scene/I3SSymbology.js +337 -0
- package/Source/Scene/KeyframeNode.js +1 -1
- package/Source/Scene/Label.js +33 -0
- package/Source/Scene/LabelCollection.js +2 -1
- package/Source/Scene/Model/pickModel.js +25 -7
- package/Source/Scene/PickFramebuffer.js +37 -2
- package/Source/Scene/Picking.js +113 -39
- package/Source/Scene/Primitive.js +6 -5
- package/Source/Scene/Scene.js +126 -42
- package/Source/Scene/ScreenSpaceCameraController.js +21 -7
- package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
- package/Source/Scene/SpatialNode.js +12 -19
- package/Source/Scene/StructuralMetadata.js +1 -1
- package/Source/Scene/VoxelBoxShape.js +67 -6
- package/Source/Scene/VoxelCell.js +273 -0
- package/Source/Scene/VoxelCylinderShape.js +117 -163
- package/Source/Scene/VoxelEllipsoidShape.js +255 -304
- package/Source/Scene/VoxelPrimitive.js +109 -15
- package/Source/Scene/VoxelRenderResources.js +12 -3
- package/Source/Scene/VoxelShape.js +7 -4
- package/Source/Scene/VoxelTraversal.js +76 -54
- package/Source/Scene/buildVoxelDrawCommands.js +23 -0
- package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
- package/Source/Scene/processVoxelProperties.js +3 -0
- package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
- package/Source/Shaders/Voxels/IntersectBox.js +21 -47
- package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
- package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
- package/Source/Shaders/Voxels/IntersectCylinder.glsl +76 -203
- package/Source/Shaders/Voxels/IntersectCylinder.js +76 -203
- package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +220 -229
- package/Source/Shaders/Voxels/IntersectEllipsoid.js +220 -229
- package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
- package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
- package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
- package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
- package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
- package/Source/Shaders/Voxels/Megatexture.js +1 -2
- package/Source/Shaders/Voxels/Octree.glsl +14 -9
- package/Source/Shaders/Voxels/Octree.js +14 -9
- package/Source/Shaders/Voxels/VoxelFS.glsl +128 -40
- package/Source/Shaders/Voxels/VoxelFS.js +128 -40
- package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
- package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
- package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
- package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
- package/Source/Shaders/Voxels/convertUvToCylinder.glsl +64 -40
- package/Source/Shaders/Voxels/convertUvToCylinder.js +64 -40
- package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +100 -91
- package/Source/Shaders/Voxels/convertUvToEllipsoid.js +100 -91
- package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
- package/Source/Workers/createGeometry.js +40 -11
- package/Source/Workers/decodeI3S.js +720 -94
- package/index.d.ts +542 -40
- package/index.js +75 -66
- package/package.json +2 -2
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import Color from "../Core/Color.js";
|
|
2
|
+
import defaultValue from "../Core/defaultValue.js";
|
|
3
|
+
import defined from "../Core/defined.js";
|
|
4
|
+
import srgbToLinear from "../Core/srgbToLinear.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This class implements an I3S symbology for I3S Layers.
|
|
8
|
+
* <p>
|
|
9
|
+
* Do not construct this directly, instead access symbology through {@link I3SLayer}.
|
|
10
|
+
* </p>
|
|
11
|
+
* @alias I3SSymbology
|
|
12
|
+
* @internalConstructor
|
|
13
|
+
*/
|
|
14
|
+
function I3SSymbology(layer) {
|
|
15
|
+
this._layer = layer;
|
|
16
|
+
this._defaultSymbology = undefined;
|
|
17
|
+
this._valueFields = [];
|
|
18
|
+
this._uniqueValueHash = undefined;
|
|
19
|
+
this._classBreaksHash = undefined;
|
|
20
|
+
|
|
21
|
+
this._parseLayerSymbology();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Object.defineProperties(I3SSymbology.prototype, {
|
|
25
|
+
/**
|
|
26
|
+
* Gets the default symbology data.
|
|
27
|
+
* @memberof I3SSymbology.prototype
|
|
28
|
+
* @type {object}
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
defaultSymbology: {
|
|
32
|
+
get: function () {
|
|
33
|
+
return this._defaultSymbology;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function convertColor(color, transparency) {
|
|
39
|
+
// color is represented as a three or four-element array, values range from 0 through 255.
|
|
40
|
+
// transparency value has to lie between 100 (full transparency) and 0 (full opacity).
|
|
41
|
+
const convertedColor = [];
|
|
42
|
+
for (let i = 0; i < color.length; i++) {
|
|
43
|
+
const floatColor = Color.byteToFloat(color[i]);
|
|
44
|
+
if (i < 3) {
|
|
45
|
+
convertedColor.push(srgbToLinear(floatColor));
|
|
46
|
+
} else {
|
|
47
|
+
convertedColor.push(floatColor);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (convertedColor.length === 3) {
|
|
51
|
+
if (defined(transparency)) {
|
|
52
|
+
convertedColor.push(1.0 - transparency / 100.0);
|
|
53
|
+
} else {
|
|
54
|
+
convertedColor.push(1.0);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return convertedColor;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function parseSymbol(symbol, isColorCaptured) {
|
|
61
|
+
const symbology = {
|
|
62
|
+
edges: undefined,
|
|
63
|
+
material: undefined,
|
|
64
|
+
};
|
|
65
|
+
if (defined(symbol) && defined(symbol.symbolLayers)) {
|
|
66
|
+
for (let i = 0; i < symbol.symbolLayers.length; i++) {
|
|
67
|
+
const symbolLayer = symbol.symbolLayers[i];
|
|
68
|
+
if (symbolLayer.type === "Fill") {
|
|
69
|
+
const edges = symbolLayer.edges;
|
|
70
|
+
const outline = symbolLayer.outline;
|
|
71
|
+
if (defined(edges)) {
|
|
72
|
+
symbology.edges = {};
|
|
73
|
+
if (defined(edges.color)) {
|
|
74
|
+
symbology.edges.color = convertColor(
|
|
75
|
+
edges.color,
|
|
76
|
+
edges.transparency
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
} else if (defined(outline)) {
|
|
80
|
+
symbology.edges = {};
|
|
81
|
+
if (defined(outline.color)) {
|
|
82
|
+
symbology.edges.color = convertColor(
|
|
83
|
+
outline.color,
|
|
84
|
+
outline.transparency
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!isColorCaptured) {
|
|
90
|
+
const material = symbolLayer.material;
|
|
91
|
+
if (defined(material)) {
|
|
92
|
+
symbology.material = {
|
|
93
|
+
colorMixMode: material.colorMixMode,
|
|
94
|
+
};
|
|
95
|
+
if (defined(material.color)) {
|
|
96
|
+
symbology.material.color = convertColor(
|
|
97
|
+
material.color,
|
|
98
|
+
material.transparency
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return symbology;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function buildUniqueValueHash(renderer, isColorCaptured) {
|
|
111
|
+
if (defined(renderer.uniqueValueGroups)) {
|
|
112
|
+
const valueHash = {};
|
|
113
|
+
for (
|
|
114
|
+
let groupIndex = 0;
|
|
115
|
+
groupIndex < renderer.uniqueValueGroups.length;
|
|
116
|
+
groupIndex++
|
|
117
|
+
) {
|
|
118
|
+
const classes = renderer.uniqueValueGroups[groupIndex].classes;
|
|
119
|
+
if (defined(classes)) {
|
|
120
|
+
for (let classIndex = 0; classIndex < classes.length; classIndex++) {
|
|
121
|
+
const classSymbology = parseSymbol(
|
|
122
|
+
classes[classIndex].symbol,
|
|
123
|
+
isColorCaptured
|
|
124
|
+
);
|
|
125
|
+
const values = classes[classIndex].values;
|
|
126
|
+
for (let valueIndex = 0; valueIndex < values.length; valueIndex++) {
|
|
127
|
+
const fieldValues = values[valueIndex];
|
|
128
|
+
let hash = valueHash;
|
|
129
|
+
for (
|
|
130
|
+
let fieldIndex = 0;
|
|
131
|
+
fieldIndex < fieldValues.length;
|
|
132
|
+
fieldIndex++
|
|
133
|
+
) {
|
|
134
|
+
const fieldValue = fieldValues[fieldIndex];
|
|
135
|
+
if (fieldIndex === fieldValues.length - 1) {
|
|
136
|
+
hash[fieldValue] = classSymbology;
|
|
137
|
+
} else {
|
|
138
|
+
if (!defined(hash[fieldValue])) {
|
|
139
|
+
hash[fieldValue] = {};
|
|
140
|
+
}
|
|
141
|
+
hash = hash[fieldValue];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return valueHash;
|
|
149
|
+
}
|
|
150
|
+
if (defined(renderer.uniqueValueInfos)) {
|
|
151
|
+
const valueHash = {};
|
|
152
|
+
for (
|
|
153
|
+
let infoIndex = 0;
|
|
154
|
+
infoIndex < renderer.uniqueValueInfos.length;
|
|
155
|
+
infoIndex++
|
|
156
|
+
) {
|
|
157
|
+
const info = renderer.uniqueValueInfos[infoIndex];
|
|
158
|
+
valueHash[info.value] = parseSymbol(info.symbol, isColorCaptured);
|
|
159
|
+
}
|
|
160
|
+
return valueHash;
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function buildClassBreaksHash(renderer, isColorCaptured) {
|
|
166
|
+
if (defined(renderer.classBreakInfos)) {
|
|
167
|
+
const classBreakInfos = [...renderer.classBreakInfos];
|
|
168
|
+
classBreakInfos.sort(function (a, b) {
|
|
169
|
+
const aMax = defaultValue(a.classMaxValue, a.classMinValue);
|
|
170
|
+
const bMax = defaultValue(b.classMaxValue, b.classMinValue);
|
|
171
|
+
return aMax - bMax;
|
|
172
|
+
});
|
|
173
|
+
const valueHash = {
|
|
174
|
+
ranges: [],
|
|
175
|
+
symbols: [],
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
if (defined(renderer.minValue)) {
|
|
179
|
+
valueHash.ranges.push(renderer.minValue);
|
|
180
|
+
valueHash.symbols.push(undefined);
|
|
181
|
+
}
|
|
182
|
+
for (let infoIndex = 0; infoIndex < classBreakInfos.length; infoIndex++) {
|
|
183
|
+
const info = classBreakInfos[infoIndex];
|
|
184
|
+
if (defined(info.classMinValue)) {
|
|
185
|
+
if (
|
|
186
|
+
valueHash.ranges.length === 0 ||
|
|
187
|
+
info.classMinValue > valueHash.ranges[valueHash.ranges.length - 1]
|
|
188
|
+
) {
|
|
189
|
+
valueHash.ranges.push(info.classMinValue);
|
|
190
|
+
valueHash.symbols.push(undefined);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (defined(info.classMaxValue)) {
|
|
194
|
+
if (
|
|
195
|
+
valueHash.ranges.length === 0 ||
|
|
196
|
+
info.classMaxValue > valueHash.ranges[valueHash.ranges.length - 1]
|
|
197
|
+
) {
|
|
198
|
+
valueHash.ranges.push(info.classMaxValue);
|
|
199
|
+
valueHash.symbols.push(parseSymbol(info.symbol, isColorCaptured));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
valueHash.symbols.push(undefined);
|
|
204
|
+
|
|
205
|
+
return valueHash;
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
I3SSymbology.prototype._parseLayerSymbology = function () {
|
|
214
|
+
const drawingInfo = this._layer.data.drawingInfo;
|
|
215
|
+
if (defined(drawingInfo) && defined(drawingInfo.renderer)) {
|
|
216
|
+
const cachedDrawingInfo = this._layer.data.cachedDrawingInfo;
|
|
217
|
+
const isColorCaptured =
|
|
218
|
+
defined(cachedDrawingInfo) && cachedDrawingInfo.color === true;
|
|
219
|
+
const renderer = drawingInfo.renderer;
|
|
220
|
+
if (renderer.type === "simple") {
|
|
221
|
+
this._defaultSymbology = parseSymbol(renderer.symbol, isColorCaptured);
|
|
222
|
+
} else if (renderer.type === "uniqueValue") {
|
|
223
|
+
this._defaultSymbology = parseSymbol(
|
|
224
|
+
renderer.defaultSymbol,
|
|
225
|
+
isColorCaptured
|
|
226
|
+
);
|
|
227
|
+
this._valueFields.push(renderer.field1);
|
|
228
|
+
if (defined(renderer.field2)) {
|
|
229
|
+
this._valueFields.push(renderer.field2);
|
|
230
|
+
}
|
|
231
|
+
if (defined(renderer.field3)) {
|
|
232
|
+
this._valueFields.push(renderer.field3);
|
|
233
|
+
}
|
|
234
|
+
this._uniqueValueHash = buildUniqueValueHash(renderer, isColorCaptured);
|
|
235
|
+
} else if (renderer.type === "classBreaks") {
|
|
236
|
+
this._defaultSymbology = parseSymbol(
|
|
237
|
+
renderer.defaultSymbol,
|
|
238
|
+
isColorCaptured
|
|
239
|
+
);
|
|
240
|
+
this._valueFields.push(renderer.field);
|
|
241
|
+
this._classBreaksHash = buildClassBreaksHash(renderer, isColorCaptured);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
function findHashForUniqueValues(hash, values, hashLevel, valueIndex) {
|
|
247
|
+
const levelValues = values[hashLevel];
|
|
248
|
+
if (valueIndex < levelValues.length) {
|
|
249
|
+
const hashValue = levelValues[valueIndex];
|
|
250
|
+
const innerHash = hash[hashValue];
|
|
251
|
+
if (defined(innerHash) && ++hashLevel < values.length) {
|
|
252
|
+
return findHashForUniqueValues(innerHash, values, hashLevel, valueIndex);
|
|
253
|
+
}
|
|
254
|
+
return innerHash;
|
|
255
|
+
}
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function bisect(array, value) {
|
|
260
|
+
let low = 0;
|
|
261
|
+
let high = array.length;
|
|
262
|
+
if (low < high) {
|
|
263
|
+
do {
|
|
264
|
+
const mid = (low + high) >>> 1;
|
|
265
|
+
if (array[mid] < value) {
|
|
266
|
+
low = mid + 1;
|
|
267
|
+
} else {
|
|
268
|
+
high = mid;
|
|
269
|
+
}
|
|
270
|
+
} while (low < high);
|
|
271
|
+
}
|
|
272
|
+
return low;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function findHashForClassBreaks(hash, values, valueIndex) {
|
|
276
|
+
const value = values[valueIndex];
|
|
277
|
+
const range = bisect(hash.ranges, value);
|
|
278
|
+
return hash.symbols[range];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
I3SSymbology.prototype._getSymbology = async function (node) {
|
|
285
|
+
const symbology = {
|
|
286
|
+
default: this._defaultSymbology,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
if (this._valueFields.length > 0) {
|
|
290
|
+
const promises = [];
|
|
291
|
+
for (let i = 0; i < this._valueFields.length; i++) {
|
|
292
|
+
promises.push(node.loadField(this._valueFields[i]));
|
|
293
|
+
}
|
|
294
|
+
await Promise.all(promises);
|
|
295
|
+
|
|
296
|
+
const fieldsValues = [];
|
|
297
|
+
for (let i = 0; i < this._valueFields.length; i++) {
|
|
298
|
+
fieldsValues.push(node.fields[this._valueFields[i]].values);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
let featureHashFn;
|
|
302
|
+
if (defined(this._uniqueValueHash)) {
|
|
303
|
+
featureHashFn = (featureIndex) =>
|
|
304
|
+
findHashForUniqueValues(
|
|
305
|
+
this._uniqueValueHash,
|
|
306
|
+
fieldsValues,
|
|
307
|
+
0,
|
|
308
|
+
featureIndex
|
|
309
|
+
);
|
|
310
|
+
} else if (defined(this._classBreaksHash)) {
|
|
311
|
+
featureHashFn = (featureIndex) =>
|
|
312
|
+
findHashForClassBreaks(
|
|
313
|
+
this._classBreaksHash,
|
|
314
|
+
fieldsValues[0],
|
|
315
|
+
featureIndex
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (defined(featureHashFn)) {
|
|
320
|
+
const firstFieldValues = fieldsValues[0];
|
|
321
|
+
for (
|
|
322
|
+
let featureIndex = 0;
|
|
323
|
+
featureIndex < firstFieldValues.length;
|
|
324
|
+
featureIndex++
|
|
325
|
+
) {
|
|
326
|
+
const featureSymbology = featureHashFn(featureIndex);
|
|
327
|
+
if (defined(featureSymbology)) {
|
|
328
|
+
symbology[featureIndex] = featureSymbology;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return symbology;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export default I3SSymbology;
|
|
@@ -20,7 +20,7 @@ function KeyframeNode(spatialNode, keyframe) {
|
|
|
20
20
|
this.spatialNode = spatialNode;
|
|
21
21
|
this.keyframe = keyframe;
|
|
22
22
|
this.state = LoadState.UNLOADED;
|
|
23
|
-
this.
|
|
23
|
+
this.metadata = [];
|
|
24
24
|
this.megatextureIndex = -1;
|
|
25
25
|
this.priority = -Number.MAX_VALUE;
|
|
26
26
|
this.highPriorityFrameNumber = -1;
|
package/Source/Scene/Label.js
CHANGED
|
@@ -85,6 +85,36 @@ function parseFont(label) {
|
|
|
85
85
|
label._lineHeight = fontInfo.lineHeight;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @typedef {object} Label.ConstructorOptions
|
|
90
|
+
*
|
|
91
|
+
* Initialization options for the Label constructor
|
|
92
|
+
*
|
|
93
|
+
* @property {Cartesian3} position The cartesian position of the label.
|
|
94
|
+
* @property {string} [id] A user-defined object to return when the label is picked with {@link Scene#pick}.
|
|
95
|
+
* @property {boolean} [show=true] Determines if this label will be shown.
|
|
96
|
+
* @property {string} [text] A string specifying the text of the label.
|
|
97
|
+
* @property {string} [font='30px sans-serif'] A string specifying the font used to draw this label. Fonts are specified using the same syntax as the CSS 'font' property.
|
|
98
|
+
* @property {LabelStyle} [style=LabelStyle.FILL] A {@link LabelStyle} specifying the style of the label.
|
|
99
|
+
* @property {number} [scale=1.0] A number specifying the uniform scale that is multiplied with the label size.
|
|
100
|
+
* @property {boolean} [showBackground=false] Determines if a background behind this label will be shown.
|
|
101
|
+
* @property {Color} [backgroundColor=new Color(0.165, 0.165, 0.165, 0.8)] A {@link Color} specifying the background color of the label.
|
|
102
|
+
* @property {Cartesian2} [backgroundPadding=new Cartesian2(7, 5)] A {@link Cartesian2} Specifying the horizontal and vertical background padding in pixels.
|
|
103
|
+
* @property {Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} specifying the pixel offset in screen space from the origin of this label.
|
|
104
|
+
* @property {Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} specifying the 3D Cartesian offset applied to this label in eye coordinates.
|
|
105
|
+
* @property {HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.CENTER] A {@link HorizontalOrigin} specifying the horizontal origin of this label.
|
|
106
|
+
* @property {VerticalOrigin} [verticalOrigin=VerticalOrigin.CENTER] A {@link VerticalOrigin} specifying the vertical origin of this label.
|
|
107
|
+
* @property {HeightReference} [heightReference=HeightReference.NONE] A {@link HeightReference} specifying the height reference of this label.
|
|
108
|
+
* @property {Color} [fillColor=Color.WHITE] A {@link Color} specifying the fill color of the label.
|
|
109
|
+
* @property {Color} [outlineColor=Color.BLACK] A {@link Color} specifying the outline color of the label.
|
|
110
|
+
* @property {number} [outlineWidth=1.0] A number specifying the outline width of the label.
|
|
111
|
+
* @property {NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} specifying near and far translucency properties of the label based on the label's distance from the camera.
|
|
112
|
+
* @property {NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} specifying near and far pixel offset scaling properties of the label based on the label's distance from the camera.
|
|
113
|
+
* @property {NearFarScalar} [scaleByDistance] A {@link NearFarScalar} specifying near and far scaling properties of the label based on the label's distance from the camera.
|
|
114
|
+
* @property {DistanceDisplayCondition} [distanceDisplayCondition] A {@link DistanceDisplayCondition} specifying at what distance from the camera that this label will be displayed.
|
|
115
|
+
* @property {number} [disableDepthTestDistance] A number specifying the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain.
|
|
116
|
+
*/
|
|
117
|
+
|
|
88
118
|
/**
|
|
89
119
|
* <div class="notice">
|
|
90
120
|
* Create labels by calling {@link LabelCollection#add}. Do not call the constructor directly.
|
|
@@ -94,6 +124,9 @@ function parseFont(label) {
|
|
|
94
124
|
* @internalConstructor
|
|
95
125
|
* @class
|
|
96
126
|
*
|
|
127
|
+
* @param {Label.ConstructorOptions} options Object describing initialization options
|
|
128
|
+
* @param {LabelCollection} labelCollection Instance of LabelCollection
|
|
129
|
+
*
|
|
97
130
|
* @exception {DeveloperError} translucencyByDistance.far must be greater than translucencyByDistance.near
|
|
98
131
|
* @exception {DeveloperError} pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near
|
|
99
132
|
* @exception {DeveloperError} distanceDisplayCondition.far must be greater than distanceDisplayCondition.near
|
|
@@ -710,7 +710,7 @@ Object.defineProperties(LabelCollection.prototype, {
|
|
|
710
710
|
* Creates and adds a label with the specified initial properties to the collection.
|
|
711
711
|
* The added label is returned so it can be modified or removed from the collection later.
|
|
712
712
|
*
|
|
713
|
-
* @param {
|
|
713
|
+
* @param {Label.ConstructorOptions} [options] A template describing the label's properties as shown in Example 1.
|
|
714
714
|
* @returns {Label} The label that was added to the collection.
|
|
715
715
|
*
|
|
716
716
|
* @performance Calling <code>add</code> is expected constant time. However, the collection's vertex buffer
|
|
@@ -755,6 +755,7 @@ Object.defineProperties(LabelCollection.prototype, {
|
|
|
755
755
|
* font : '24px Helvetica',
|
|
756
756
|
* });
|
|
757
757
|
*
|
|
758
|
+
*
|
|
758
759
|
* @see LabelCollection#remove
|
|
759
760
|
* @see LabelCollection#removeAll
|
|
760
761
|
*/
|
|
@@ -198,6 +198,8 @@ export default function pickModel(
|
|
|
198
198
|
primitive,
|
|
199
199
|
VertexAttributeSemantic.POSITION
|
|
200
200
|
);
|
|
201
|
+
const byteOffset = positionAttribute.byteOffset;
|
|
202
|
+
const byteStride = positionAttribute.byteStride;
|
|
201
203
|
const vertexCount = positionAttribute.count;
|
|
202
204
|
|
|
203
205
|
if (!defined(primitive.indices)) {
|
|
@@ -234,7 +236,19 @@ export default function pickModel(
|
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
const numComponents = AttributeType.getNumberOfComponents(attributeType);
|
|
237
|
-
const
|
|
239
|
+
const bytes = ComponentDatatype.getSizeInBytes(componentDatatype);
|
|
240
|
+
const isInterleaved =
|
|
241
|
+
!defined(vertices) &&
|
|
242
|
+
defined(byteStride) &&
|
|
243
|
+
byteStride !== numComponents * bytes;
|
|
244
|
+
|
|
245
|
+
let elementStride = numComponents;
|
|
246
|
+
let offset = 0;
|
|
247
|
+
if (isInterleaved) {
|
|
248
|
+
elementStride = byteStride / bytes;
|
|
249
|
+
offset = byteOffset / bytes;
|
|
250
|
+
}
|
|
251
|
+
const elementCount = vertexCount * elementStride;
|
|
238
252
|
|
|
239
253
|
if (!defined(vertices)) {
|
|
240
254
|
const verticesBuffer = positionAttribute.buffer;
|
|
@@ -246,7 +260,7 @@ export default function pickModel(
|
|
|
246
260
|
);
|
|
247
261
|
verticesBuffer.getBufferData(
|
|
248
262
|
vertices,
|
|
249
|
-
|
|
263
|
+
isInterleaved ? 0 : byteOffset,
|
|
250
264
|
0,
|
|
251
265
|
elementCount
|
|
252
266
|
);
|
|
@@ -280,7 +294,8 @@ export default function pickModel(
|
|
|
280
294
|
const v0 = getVertexPosition(
|
|
281
295
|
vertices,
|
|
282
296
|
i0,
|
|
283
|
-
|
|
297
|
+
offset,
|
|
298
|
+
elementStride,
|
|
284
299
|
quantization,
|
|
285
300
|
instanceTransform,
|
|
286
301
|
verticalExaggeration,
|
|
@@ -291,7 +306,8 @@ export default function pickModel(
|
|
|
291
306
|
const v1 = getVertexPosition(
|
|
292
307
|
vertices,
|
|
293
308
|
i1,
|
|
294
|
-
|
|
309
|
+
offset,
|
|
310
|
+
elementStride,
|
|
295
311
|
quantization,
|
|
296
312
|
instanceTransform,
|
|
297
313
|
verticalExaggeration,
|
|
@@ -302,7 +318,8 @@ export default function pickModel(
|
|
|
302
318
|
const v2 = getVertexPosition(
|
|
303
319
|
vertices,
|
|
304
320
|
i2,
|
|
305
|
-
|
|
321
|
+
offset,
|
|
322
|
+
elementStride,
|
|
306
323
|
quantization,
|
|
307
324
|
instanceTransform,
|
|
308
325
|
verticalExaggeration,
|
|
@@ -350,7 +367,8 @@ export default function pickModel(
|
|
|
350
367
|
function getVertexPosition(
|
|
351
368
|
vertices,
|
|
352
369
|
index,
|
|
353
|
-
|
|
370
|
+
offset,
|
|
371
|
+
numElements,
|
|
354
372
|
quantization,
|
|
355
373
|
instanceTransform,
|
|
356
374
|
verticalExaggeration,
|
|
@@ -358,7 +376,7 @@ function getVertexPosition(
|
|
|
358
376
|
ellipsoid,
|
|
359
377
|
result
|
|
360
378
|
) {
|
|
361
|
-
const i = index *
|
|
379
|
+
const i = offset + index * numElements;
|
|
362
380
|
result.x = vertices[i];
|
|
363
381
|
result.y = vertices[i + 1];
|
|
364
382
|
result.z = vertices[i + 2];
|
|
@@ -27,10 +27,10 @@ function PickFramebuffer(context) {
|
|
|
27
27
|
this._width = 0;
|
|
28
28
|
this._height = 0;
|
|
29
29
|
}
|
|
30
|
+
|
|
30
31
|
PickFramebuffer.prototype.begin = function (screenSpaceRectangle, viewport) {
|
|
31
32
|
const context = this._context;
|
|
32
|
-
const width = viewport
|
|
33
|
-
const height = viewport.height;
|
|
33
|
+
const { width, height } = viewport;
|
|
34
34
|
|
|
35
35
|
BoundingRectangle.clone(
|
|
36
36
|
screenSpaceRectangle,
|
|
@@ -51,6 +51,12 @@ PickFramebuffer.prototype.begin = function (screenSpaceRectangle, viewport) {
|
|
|
51
51
|
|
|
52
52
|
const colorScratch = new Color();
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Return the picked object rendered within a given rectangle.
|
|
56
|
+
*
|
|
57
|
+
* @param {BoundingRectangle} screenSpaceRectangle
|
|
58
|
+
* @returns {object|undefined} The object rendered in the middle of the rectangle, or undefined if nothing was rendered.
|
|
59
|
+
*/
|
|
54
60
|
PickFramebuffer.prototype.end = function (screenSpaceRectangle) {
|
|
55
61
|
const width = defaultValue(screenSpaceRectangle.width, 1.0);
|
|
56
62
|
const height = defaultValue(screenSpaceRectangle.height, 1.0);
|
|
@@ -114,6 +120,34 @@ PickFramebuffer.prototype.end = function (screenSpaceRectangle) {
|
|
|
114
120
|
return undefined;
|
|
115
121
|
};
|
|
116
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Return voxel tile and sample information as rendered by a pickVoxel pass,
|
|
125
|
+
* within a given rectangle.
|
|
126
|
+
*
|
|
127
|
+
* @param {BoundingRectangle} screenSpaceRectangle
|
|
128
|
+
* @returns {TypedArray}
|
|
129
|
+
*/
|
|
130
|
+
PickFramebuffer.prototype.readVoxelInfo = function (screenSpaceRectangle) {
|
|
131
|
+
const width = defaultValue(screenSpaceRectangle.width, 1.0);
|
|
132
|
+
const height = defaultValue(screenSpaceRectangle.height, 1.0);
|
|
133
|
+
|
|
134
|
+
const context = this._context;
|
|
135
|
+
const pixels = context.readPixels({
|
|
136
|
+
x: screenSpaceRectangle.x,
|
|
137
|
+
y: screenSpaceRectangle.y,
|
|
138
|
+
width: width,
|
|
139
|
+
height: height,
|
|
140
|
+
framebuffer: this._fb.framebuffer,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// Read the center pixel
|
|
144
|
+
const halfWidth = Math.floor(width * 0.5);
|
|
145
|
+
const halfHeight = Math.floor(height * 0.5);
|
|
146
|
+
const index = 4 * (halfHeight * width + halfWidth);
|
|
147
|
+
|
|
148
|
+
return pixels.slice(index, index + 4);
|
|
149
|
+
};
|
|
150
|
+
|
|
117
151
|
PickFramebuffer.prototype.isDestroyed = function () {
|
|
118
152
|
return false;
|
|
119
153
|
};
|
|
@@ -122,4 +156,5 @@ PickFramebuffer.prototype.destroy = function () {
|
|
|
122
156
|
this._fb.destroy();
|
|
123
157
|
return destroyObject(this);
|
|
124
158
|
};
|
|
159
|
+
|
|
125
160
|
export default PickFramebuffer;
|