Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | 179x 179x 179x 179x 179x 179x 179x 179x 179x 179x 179x 179x 179x 1x 1184x 907x 312x 595x 732x 732x 300x 732x 207x 732x 175x 175x 67x 175x 69x 175x 175x 47x 128x 175x 907x 723x 185x 136x 175x 80x 177x 16x 8x 176x 176x 176x 176x 7x 7x 176x 16x 16x 176x 7x 7x 176x 176x 176x 1x 175x 175x 151x 151x 61x 61x 67x 151x 53x 53x 62x 151x 41x 41x 47x 175x 1x 52x 17x 179x 179x 179x 179x 179x 179x 1x 178x 178x 178x 178x 178x 178x 178x 1x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 175x 175x 175x 177x 177x 177x 177x 177x 177x 177x 177x 177x 177x 1x 176x 176x 176x 176x 176x 176x 176x 176x 176x 176x 175x 175x 67x 67x 67x 67x 67x 67x 79x 67x 79x 67x 67x 67x 67x 67x 67x 175x 175x 69x 69x 69x 69x 69x 69x 69x 99x 69x 99x 69x 69x 69x 69x 69x 69x 17x 69x 175x 47x 47x 47x 175x 175x 175x 175x 67x 175x 69x 175x 47x 175x 1x 1x 46x 46x 3x 43x 43x 1x 1x 56x 56x 20x 56x 20x 56x 16x 1x 1455x 1455x 563x 563x 563x 563x 1455x 492x 492x 1455x 466x 466x 1455x 1082x 175x 1082x 1082x 1x 1x 10x 10x 1x 9x 1x 1x 175x 175x 175x 175x 175x | import Cartesian3 from "../Core/Cartesian3.js";
import defined from "../Core/defined.js";
import destroyObject from "../Core/destroyObject.js";
import DeveloperError from "../Core/DeveloperError.js";
import Ellipsoid from "../Core/Ellipsoid.js";
import getJsonFromTypedArray from "../Core/getJsonFromTypedArray.js";
import ComponentDatatype from "../Core/ComponentDatatype.js";
import CesiumMath from "../Core/Math.js";
import Matrix4 from "../Core/Matrix4.js";
import Rectangle from "../Core/Rectangle.js";
import RuntimeError from "../Core/RuntimeError.js";
import Cesium3DTileBatchTable from "./Cesium3DTileBatchTable.js";
import Cesium3DTileFeatureTable from "./Cesium3DTileFeatureTable.js";
import Vector3DTilePoints from "./Vector3DTilePoints.js";
import Vector3DTilePolygons from "./Vector3DTilePolygons.js";
import Vector3DTilePolylines from "./Vector3DTilePolylines.js";
import Vector3DTileClampedPolylines from "./Vector3DTileClampedPolylines.js";
import decodeVectorPolylinePositions from "../Core/decodeVectorPolylinePositions.js";
/**
* Represents the contents of a
* {@link https://github.com/CesiumGS/3d-tiles/tree/vctr/TileFormats/VectorData|Vector}
* tile in a {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification|3D Tiles} tileset.
* <p>
* Implements the {@link Cesium3DTileContent} interface.
* </p>
*
* @alias Vector3DTileContent
* @constructor
*
* @private
*/
function Vector3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
this._tileset = tileset;
this._tile = tile;
this._resource = resource;
this._polygons = undefined;
this._polylines = undefined;
this._points = undefined;
this._metadata = undefined;
this._batchTable = undefined;
this._features = undefined;
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
this.featurePropertiesDirty = false;
this._group = undefined;
this._ready = false;
initialize(this, arrayBuffer, byteOffset);
}
Object.defineProperties(Vector3DTileContent.prototype, {
featuresLength: {
get: function () {
return defined(this._batchTable) ? this._batchTable.featuresLength : 0;
},
},
pointsLength: {
get: function () {
if (defined(this._points)) {
return this._points.pointsLength;
}
return 0;
},
},
trianglesLength: {
get: function () {
let trianglesLength = 0;
if (defined(this._polygons)) {
trianglesLength += this._polygons.trianglesLength;
}
if (defined(this._polylines)) {
trianglesLength += this._polylines.trianglesLength;
}
return trianglesLength;
},
},
geometryByteLength: {
get: function () {
let geometryByteLength = 0;
if (defined(this._polygons)) {
geometryByteLength += this._polygons.geometryByteLength;
}
if (defined(this._polylines)) {
geometryByteLength += this._polylines.geometryByteLength;
}
return geometryByteLength;
},
},
texturesByteLength: {
get: function () {
if (defined(this._points)) {
return this._points.texturesByteLength;
}
return 0;
},
},
batchTableByteLength: {
get: function () {
return defined(this._batchTable)
? this._batchTable.batchTableByteLength
: 0;
},
},
innerContents: {
get: function () {
return undefined;
},
},
/**
* Returns true when the tile's content is ready to render; otherwise false
*
* @memberof Vector3DTileContent.prototype
*
* @type {boolean}
* @readonly
* @private
*/
ready: {
get: function () {
return this._ready;
},
},
tileset: {
get: function () {
return this._tileset;
},
},
tile: {
get: function () {
return this._tile;
},
},
url: {
get: function () {
return this._resource.getUrlComponent(true);
},
},
metadata: {
get: function () {
return this._metadata;
},
set: function (value) {
this._metadata = value;
},
},
batchTable: {
get: function () {
return this._batchTable;
},
},
group: {
get: function () {
return this._group;
},
set: function (value) {
this._group = value;
},
},
});
function createColorChangedCallback(content) {
return function (batchId, color) {
if (defined(content._polygons)) {
content._polygons.updateCommands(batchId, color);
}
};
}
function getBatchIds(featureTableJson, featureTableBinary) {
let polygonBatchIds;
let polylineBatchIds;
let pointBatchIds;
let i;
const numberOfPolygons = featureTableJson.POLYGONS_LENGTH ?? 0;
const numberOfPolylines = featureTableJson.POLYLINES_LENGTH ?? 0;
const numberOfPoints = featureTableJson.POINTS_LENGTH ?? 0;
if (numberOfPolygons > 0 && defined(featureTableJson.POLYGON_BATCH_IDS)) {
const polygonBatchIdsByteOffset =
featureTableBinary.byteOffset +
featureTableJson.POLYGON_BATCH_IDS.byteOffset;
polygonBatchIds = new Uint16Array(
featureTableBinary.buffer,
polygonBatchIdsByteOffset,
numberOfPolygons,
);
}
if (numberOfPolylines > 0 && defined(featureTableJson.POLYLINE_BATCH_IDS)) {
const polylineBatchIdsByteOffset =
featureTableBinary.byteOffset +
featureTableJson.POLYLINE_BATCH_IDS.byteOffset;
polylineBatchIds = new Uint16Array(
featureTableBinary.buffer,
polylineBatchIdsByteOffset,
numberOfPolylines,
);
}
if (numberOfPoints > 0 && defined(featureTableJson.POINT_BATCH_IDS)) {
const pointBatchIdsByteOffset =
featureTableBinary.byteOffset +
featureTableJson.POINT_BATCH_IDS.byteOffset;
pointBatchIds = new Uint16Array(
featureTableBinary.buffer,
pointBatchIdsByteOffset,
numberOfPoints,
);
}
const atLeastOneDefined =
defined(polygonBatchIds) ||
defined(polylineBatchIds) ||
defined(pointBatchIds);
const atLeastOneUndefined =
(numberOfPolygons > 0 && !defined(polygonBatchIds)) ||
(numberOfPolylines > 0 && !defined(polylineBatchIds)) ||
(numberOfPoints > 0 && !defined(pointBatchIds));
if (atLeastOneDefined && atLeastOneUndefined) {
throw new RuntimeError(
"If one group of batch ids is defined, then all batch ids must be defined",
);
}
const allUndefinedBatchIds =
!defined(polygonBatchIds) &&
!defined(polylineBatchIds) &&
!defined(pointBatchIds);
if (allUndefinedBatchIds) {
let id = 0;
if (!defined(polygonBatchIds) && numberOfPolygons > 0) {
polygonBatchIds = new Uint16Array(numberOfPolygons);
for (i = 0; i < numberOfPolygons; ++i) {
polygonBatchIds[i] = id++;
}
}
if (!defined(polylineBatchIds) && numberOfPolylines > 0) {
polylineBatchIds = new Uint16Array(numberOfPolylines);
for (i = 0; i < numberOfPolylines; ++i) {
polylineBatchIds[i] = id++;
}
}
if (!defined(pointBatchIds) && numberOfPoints > 0) {
pointBatchIds = new Uint16Array(numberOfPoints);
for (i = 0; i < numberOfPoints; ++i) {
pointBatchIds[i] = id++;
}
}
}
return {
polygons: polygonBatchIds,
polylines: polylineBatchIds,
points: pointBatchIds,
};
}
const sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;
function createFloatingPolylines(options) {
return new Vector3DTilePolylines(options);
}
function createClampedPolylines(options) {
return new Vector3DTileClampedPolylines(options);
}
function initialize(content, arrayBuffer, byteOffset) {
byteOffset = byteOffset ?? 0;
const uint8Array = new Uint8Array(arrayBuffer);
const view = new DataView(arrayBuffer);
byteOffset += sizeOfUint32; // Skip magic number
const version = view.getUint32(byteOffset, true);
if (version !== 1) {
throw new RuntimeError(
`Only Vector tile version 1 is supported. Version ${version} is not.`,
);
}
byteOffset += sizeOfUint32;
const byteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
Iif (byteLength === 0) {
content._ready = true;
return;
}
const featureTableJSONByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
if (featureTableJSONByteLength === 0) {
throw new RuntimeError(
"Feature table must have a byte length greater than zero",
);
}
const featureTableBinaryByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const batchTableJSONByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const batchTableBinaryByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const indicesByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const positionByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const polylinePositionByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const pointsPositionByteLength = view.getUint32(byteOffset, true);
byteOffset += sizeOfUint32;
const featureTableJson = getJsonFromTypedArray(
uint8Array,
byteOffset,
featureTableJSONByteLength,
);
byteOffset += featureTableJSONByteLength;
const featureTableBinary = new Uint8Array(
arrayBuffer,
byteOffset,
featureTableBinaryByteLength,
);
byteOffset += featureTableBinaryByteLength;
let batchTableJson;
let batchTableBinary;
if (batchTableJSONByteLength > 0) {
// PERFORMANCE_IDEA: is it possible to allocate this on-demand? Perhaps keep the
// arraybuffer/string compressed in memory and then decompress it when it is first accessed.
//
// We could also make another request for it, but that would make the property set/get
// API async, and would double the number of numbers in some cases.
batchTableJson = getJsonFromTypedArray(
uint8Array,
byteOffset,
batchTableJSONByteLength,
);
byteOffset += batchTableJSONByteLength;
Iif (batchTableBinaryByteLength > 0) {
// Has a batch table binary
batchTableBinary = new Uint8Array(
arrayBuffer,
byteOffset,
batchTableBinaryByteLength,
);
// Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
batchTableBinary = new Uint8Array(batchTableBinary);
byteOffset += batchTableBinaryByteLength;
}
}
const numberOfPolygons = featureTableJson.POLYGONS_LENGTH ?? 0;
const numberOfPolylines = featureTableJson.POLYLINES_LENGTH ?? 0;
const numberOfPoints = featureTableJson.POINTS_LENGTH ?? 0;
const totalPrimitives = numberOfPolygons + numberOfPolylines + numberOfPoints;
const batchTable = new Cesium3DTileBatchTable(
content,
totalPrimitives,
batchTableJson,
batchTableBinary,
createColorChangedCallback(content),
);
content._batchTable = batchTable;
Iif (totalPrimitives === 0) {
return;
}
const featureTable = new Cesium3DTileFeatureTable(
featureTableJson,
featureTableBinary,
);
const region = featureTable.getGlobalProperty("REGION");
if (!defined(region)) {
throw new RuntimeError(
"Feature table global property: REGION must be defined",
);
}
const rectangle = Rectangle.unpack(region);
const minHeight = region[4];
const maxHeight = region[5];
const modelMatrix = content._tile.computedTransform;
let center = featureTable.getGlobalProperty(
"RTC_CENTER",
ComponentDatatype.FLOAT,
3,
);
Iif (defined(center)) {
center = Cartesian3.unpack(center);
Matrix4.multiplyByPoint(modelMatrix, center, center);
} else {
center = Rectangle.center(rectangle);
center.height = CesiumMath.lerp(minHeight, maxHeight, 0.5);
center = Ellipsoid.WGS84.cartographicToCartesian(center);
}
const batchIds = getBatchIds(featureTableJson, featureTableBinary);
byteOffset += (4 - (byteOffset % 4)) % 4;
if (numberOfPolygons > 0) {
featureTable.featuresLength = numberOfPolygons;
const polygonCounts =
featureTable.getPropertyArray(
"POLYGON_COUNTS",
ComponentDatatype.UNSIGNED_INT,
1,
) ??
featureTable.getPropertyArray(
"POLYGON_COUNT",
ComponentDatatype.UNSIGNED_INT,
1,
); // Workaround for old vector tilesets using the non-plural name;
Iif (!defined(polygonCounts)) {
throw new RuntimeError(
"Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0",
);
}
const polygonIndexCounts =
featureTable.getPropertyArray(
"POLYGON_INDEX_COUNTS",
ComponentDatatype.UNSIGNED_INT,
1,
) ??
featureTable.getPropertyArray(
"POLYGON_INDEX_COUNT",
ComponentDatatype.UNSIGNED_INT,
1,
); // Workaround for old vector tilesets using the non-plural name;
Iif (!defined(polygonIndexCounts)) {
throw new RuntimeError(
"Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0",
);
}
// Use the counts array to determine how many position values we want. If we used the byte length then
// zero padding values would be included and cause the delta zig-zag decoding to fail
const numPolygonPositions = polygonCounts.reduce(function (total, count) {
return total + count * 2;
}, 0);
const numPolygonIndices = polygonIndexCounts.reduce(function (
total,
count,
) {
return total + count;
}, 0);
const indices = new Uint32Array(arrayBuffer, byteOffset, numPolygonIndices);
byteOffset += indicesByteLength;
const polygonPositions = new Uint16Array(
arrayBuffer,
byteOffset,
numPolygonPositions,
);
byteOffset += positionByteLength;
let polygonMinimumHeights;
let polygonMaximumHeights;
Iif (
defined(featureTableJson.POLYGON_MINIMUM_HEIGHTS) &&
defined(featureTableJson.POLYGON_MAXIMUM_HEIGHTS)
) {
polygonMinimumHeights = featureTable.getPropertyArray(
"POLYGON_MINIMUM_HEIGHTS",
ComponentDatatype.FLOAT,
1,
);
polygonMaximumHeights = featureTable.getPropertyArray(
"POLYGON_MAXIMUM_HEIGHTS",
ComponentDatatype.FLOAT,
1,
);
}
content._polygons = new Vector3DTilePolygons({
positions: polygonPositions,
counts: polygonCounts,
indexCounts: polygonIndexCounts,
indices: indices,
minimumHeight: minHeight,
maximumHeight: maxHeight,
polygonMinimumHeights: polygonMinimumHeights,
polygonMaximumHeights: polygonMaximumHeights,
center: center,
rectangle: rectangle,
boundingVolume: content.tile.boundingVolume.boundingVolume,
batchTable: batchTable,
batchIds: batchIds.polygons,
modelMatrix: modelMatrix,
});
}
const tileset = content._tileset;
if (numberOfPolylines > 0) {
featureTable.featuresLength = numberOfPolylines;
const polylineCounts =
featureTable.getPropertyArray(
"POLYLINE_COUNTS",
ComponentDatatype.UNSIGNED_INT,
1,
) ??
featureTable.getPropertyArray(
"POLYLINE_COUNT",
ComponentDatatype.UNSIGNED_INT,
1,
); // Workaround for old vector tilesets using the non-plural name;
Iif (!defined(polylineCounts)) {
throw new RuntimeError(
"Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0",
);
}
let widths = featureTable.getPropertyArray(
"POLYLINE_WIDTHS",
ComponentDatatype.UNSIGNED_SHORT,
1,
);
Eif (!defined(widths)) {
widths = new Uint16Array(numberOfPolylines);
for (let i = 0; i < numberOfPolylines; ++i) {
widths[i] = 2.0;
}
}
// Use the counts array to determine how many position values we want. If we used the byte length then
// zero padding values would be included and cause the delta zig-zag decoding to fail
const numPolylinePositions = polylineCounts.reduce(function (total, count) {
return total + count * 3;
}, 0);
const polylinePositions = new Uint16Array(
arrayBuffer,
byteOffset,
numPolylinePositions,
);
byteOffset += polylinePositionByteLength;
const examineVectorLinesFunction = tileset.examineVectorLinesFunction;
Iif (defined(examineVectorLinesFunction)) {
const decodedPositions = decodeVectorPolylinePositions(
new Uint16Array(polylinePositions),
rectangle,
minHeight,
maxHeight,
Ellipsoid.WGS84,
);
examineVectorLines(
decodedPositions,
polylineCounts,
batchIds.polylines,
batchTable,
content.url,
examineVectorLinesFunction,
);
}
let createPolylines = createFloatingPolylines;
if (defined(tileset.classificationType)) {
createPolylines = createClampedPolylines;
}
content._polylines = createPolylines({
positions: polylinePositions,
widths: widths,
counts: polylineCounts,
batchIds: batchIds.polylines,
minimumHeight: minHeight,
maximumHeight: maxHeight,
center: center,
rectangle: rectangle,
boundingVolume: content.tile.boundingVolume.boundingVolume,
batchTable: batchTable,
classificationType: tileset.classificationType,
keepDecodedPositions: tileset.vectorKeepDecodedPositions,
});
}
if (numberOfPoints > 0) {
const pointPositions = new Uint16Array(
arrayBuffer,
byteOffset,
numberOfPoints * 3,
);
byteOffset += pointsPositionByteLength;
content._points = new Vector3DTilePoints({
positions: pointPositions,
batchIds: batchIds.points,
minimumHeight: minHeight,
maximumHeight: maxHeight,
rectangle: rectangle,
batchTable: batchTable,
heightReference: tileset.heightReference,
scene: tileset.scene,
});
}
}
function createFeatures(content) {
const featuresLength = content.featuresLength;
Eif (!defined(content._features) && featuresLength > 0) {
const features = new Array(featuresLength);
if (defined(content._polygons)) {
content._polygons.createFeatures(content, features);
}
if (defined(content._polylines)) {
content._polylines.createFeatures(content, features);
}
if (defined(content._points)) {
content._points.createFeatures(content, features);
}
content._features = features;
}
}
Vector3DTileContent.prototype.hasProperty = function (batchId, name) {
return this._batchTable.hasProperty(batchId, name);
};
Vector3DTileContent.prototype.getFeature = function (batchId) {
//>>includeStart('debug', pragmas.debug);
const featuresLength = this.featuresLength;
if (!defined(batchId) || batchId < 0 || batchId >= featuresLength) {
throw new DeveloperError(
`batchId is required and between zero and featuresLength - 1 (${
featuresLength - 1
}).`,
);
}
//>>includeEnd('debug');
Iif (!defined(this._features)) {
createFeatures(this);
}
return this._features[batchId];
};
Vector3DTileContent.prototype.applyDebugSettings = function (enabled, color) {
if (defined(this._polygons)) {
this._polygons.applyDebugSettings(enabled, color);
}
if (defined(this._polylines)) {
this._polylines.applyDebugSettings(enabled, color);
}
if (defined(this._points)) {
this._points.applyDebugSettings(enabled, color);
}
};
Vector3DTileContent.prototype.applyStyle = function (style) {
Iif (!defined(this._features)) {
createFeatures(this);
}
if (defined(this._polygons)) {
this._polygons.applyStyle(style, this._features);
}
if (defined(this._polylines)) {
this._polylines.applyStyle(style, this._features);
}
if (defined(this._points)) {
this._points.applyStyle(style, this._features);
}
};
Vector3DTileContent.prototype.update = function (tileset, frameState) {
let ready = true;
if (defined(this._polygons)) {
this._polygons.classificationType = this._tileset.classificationType;
this._polygons.debugWireframe = this._tileset.debugWireframe;
this._polygons.update(frameState);
ready = ready && this._polygons.ready;
}
if (defined(this._polylines)) {
this._polylines.update(frameState);
ready = ready && this._polylines.ready;
}
if (defined(this._points)) {
this._points.update(frameState);
ready = ready && this._points.ready;
}
if (defined(this._batchTable) && ready) {
if (!defined(this._features)) {
createFeatures(this);
}
this._batchTable.update(tileset, frameState);
this._ready = true;
}
};
Vector3DTileContent.prototype.pick = function (ray, frameState, result) {
return undefined;
};
Vector3DTileContent.prototype.getPolylinePositions = function (batchId) {
const polylines = this._polylines;
if (!defined(polylines)) {
return undefined;
}
return polylines.getPositions(batchId);
};
Vector3DTileContent.prototype.isDestroyed = function () {
return false;
};
Vector3DTileContent.prototype.destroy = function () {
this._polygons = this._polygons && this._polygons.destroy();
this._polylines = this._polylines && this._polylines.destroy();
this._points = this._points && this._points.destroy();
this._batchTable = this._batchTable && this._batchTable.destroy();
return destroyObject(this);
};
function examineVectorLines(
positions,
counts,
batchIds,
batchTable,
url,
callback,
) {
const countsLength = counts.length;
let polylineStart = 0;
for (let i = 0; i < countsLength; i++) {
const count = counts[i] * 3;
const linePositions = positions.slice(polylineStart, polylineStart + count);
polylineStart += count;
callback(linePositions, batchIds[i], url, batchTable);
}
}
export default Vector3DTileContent;
|