-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
Copy pathCesium3DTilesetStatistics.js
129 lines (120 loc) · 4.89 KB
/
Cesium3DTilesetStatistics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import defined from "../Core/defined.js";
/**
* @private
*/
function Cesium3DTilesetStatistics() {
// Rendering statistics
this.selected = 0;
this.visited = 0;
// Loading statistics
this.numberOfCommands = 0;
this.numberOfAttemptedRequests = 0;
this.numberOfPendingRequests = 0;
this.numberOfTilesProcessing = 0;
this.numberOfTilesWithContentReady = 0; // Number of tiles with content loaded, does not include empty tiles
this.numberOfTilesTotal = 0; // Number of tiles in tileset JSON (and other tileset JSON files as they are loaded)
this.numberOfLoadedTilesTotal = 0; // Running total of loaded tiles for the lifetime of the session
// Features statistics
this.numberOfFeaturesSelected = 0; // Number of features rendered
this.numberOfFeaturesLoaded = 0; // Number of features in memory
this.numberOfPointsSelected = 0;
this.numberOfPointsLoaded = 0;
this.numberOfTrianglesSelected = 0;
// Styling statistics
this.numberOfTilesStyled = 0;
this.numberOfFeaturesStyled = 0;
// Optimization statistics
this.numberOfTilesCulledWithChildrenUnion = 0;
// Memory statistics
this.geometryByteLength = 0;
this.texturesByteLength = 0;
this.batchTableByteLength = 0; // batch textures and any binary metadata properties not otherwise accounted for
}
Cesium3DTilesetStatistics.prototype.clear = function () {
this.selected = 0;
this.visited = 0;
this.numberOfCommands = 0;
this.numberOfAttemptedRequests = 0;
this.numberOfFeaturesSelected = 0;
this.numberOfPointsSelected = 0;
this.numberOfTrianglesSelected = 0;
this.numberOfTilesStyled = 0;
this.numberOfFeaturesStyled = 0;
this.numberOfTilesCulledWithChildrenUnion = 0;
};
function updatePointAndFeatureCounts(statistics, content, decrement, load) {
const contents = content.innerContents;
const pointsLength = content.pointsLength;
const trianglesLength = content.trianglesLength;
const featuresLength = content.featuresLength;
const geometryByteLength = content.geometryByteLength;
const texturesByteLength = content.texturesByteLength;
const batchTableByteLength = content.batchTableByteLength;
if (load) {
statistics.numberOfFeaturesLoaded += decrement
? -featuresLength
: featuresLength;
statistics.numberOfPointsLoaded += decrement ? -pointsLength : pointsLength;
statistics.geometryByteLength += decrement
? -geometryByteLength
: geometryByteLength;
statistics.texturesByteLength += decrement
? -texturesByteLength
: texturesByteLength;
statistics.batchTableByteLength += decrement
? -batchTableByteLength
: batchTableByteLength;
} else {
statistics.numberOfFeaturesSelected += decrement
? -featuresLength
: featuresLength;
statistics.numberOfPointsSelected += decrement
? -pointsLength
: pointsLength;
statistics.numberOfTrianglesSelected += decrement
? -trianglesLength
: trianglesLength;
}
if (defined(contents)) {
const length = contents.length;
for (let i = 0; i < length; ++i) {
updatePointAndFeatureCounts(statistics, contents[i], decrement, load);
}
}
}
Cesium3DTilesetStatistics.prototype.incrementSelectionCounts = function (
content
) {
updatePointAndFeatureCounts(this, content, false, false);
};
Cesium3DTilesetStatistics.prototype.incrementLoadCounts = function (content) {
updatePointAndFeatureCounts(this, content, false, true);
};
Cesium3DTilesetStatistics.prototype.decrementLoadCounts = function (content) {
updatePointAndFeatureCounts(this, content, true, true);
};
Cesium3DTilesetStatistics.clone = function (statistics, result) {
result.selected = statistics.selected;
result.visited = statistics.visited;
result.numberOfCommands = statistics.numberOfCommands;
result.selected = statistics.selected;
result.numberOfAttemptedRequests = statistics.numberOfAttemptedRequests;
result.numberOfPendingRequests = statistics.numberOfPendingRequests;
result.numberOfTilesProcessing = statistics.numberOfTilesProcessing;
result.numberOfTilesWithContentReady =
statistics.numberOfTilesWithContentReady;
result.numberOfTilesTotal = statistics.numberOfTilesTotal;
result.numberOfFeaturesSelected = statistics.numberOfFeaturesSelected;
result.numberOfFeaturesLoaded = statistics.numberOfFeaturesLoaded;
result.numberOfPointsSelected = statistics.numberOfPointsSelected;
result.numberOfPointsLoaded = statistics.numberOfPointsLoaded;
result.numberOfTrianglesSelected = statistics.numberOfTrianglesSelected;
result.numberOfTilesStyled = statistics.numberOfTilesStyled;
result.numberOfFeaturesStyled = statistics.numberOfFeaturesStyled;
result.numberOfTilesCulledWithChildrenUnion =
statistics.numberOfTilesCulledWithChildrenUnion;
result.geometryByteLength = statistics.geometryByteLength;
result.texturesByteLength = statistics.texturesByteLength;
result.batchTableByteLength = statistics.batchTableByteLength;
};
export default Cesium3DTilesetStatistics;