Vector3DTileContent.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. import Cartesian3 from "../Core/Cartesian3.js";
  2. import defaultValue from "../Core/defaultValue.js";
  3. import defined from "../Core/defined.js";
  4. import destroyObject from "../Core/destroyObject.js";
  5. import DeveloperError from "../Core/DeveloperError.js";
  6. import Ellipsoid from "../Core/Ellipsoid.js";
  7. import getStringFromTypedArray from "../Core/getStringFromTypedArray.js";
  8. import ComponentDatatype from "../Core/ComponentDatatype.js";
  9. import CesiumMath from "../Core/Math.js";
  10. import Matrix4 from "../Core/Matrix4.js";
  11. import Rectangle from "../Core/Rectangle.js";
  12. import RuntimeError from "../Core/RuntimeError.js";
  13. import when from "../ThirdParty/when.js";
  14. import Cesium3DTileBatchTable from "./Cesium3DTileBatchTable.js";
  15. import Cesium3DTileFeatureTable from "./Cesium3DTileFeatureTable.js";
  16. import Vector3DTilePoints from "./Vector3DTilePoints.js";
  17. import Vector3DTilePolygons from "./Vector3DTilePolygons.js";
  18. import Vector3DTilePolylines from "./Vector3DTilePolylines.js";
  19. /**
  20. * Represents the contents of a
  21. * {@link https://github.com/CesiumGS/3d-tiles/tree/3d-tiles-next/TileFormats/VectorData|Vector}
  22. * tile in a {@link https://github.com/CesiumGS/3d-tiles/tree/master/specification|3D Tiles} tileset.
  23. * <p>
  24. * Implements the {@link Cesium3DTileContent} interface.
  25. * </p>
  26. *
  27. * @alias Vector3DTileContent
  28. * @constructor
  29. *
  30. * @private
  31. */
  32. function Vector3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
  33. this._tileset = tileset;
  34. this._tile = tile;
  35. this._resource = resource;
  36. this._polygons = undefined;
  37. this._polylines = undefined;
  38. this._points = undefined;
  39. this._contentReadyPromise = undefined;
  40. this._readyPromise = when.defer();
  41. this._batchTable = undefined;
  42. this._features = undefined;
  43. /**
  44. * Part of the {@link Cesium3DTileContent} interface.
  45. */
  46. this.featurePropertiesDirty = false;
  47. initialize(this, arrayBuffer, byteOffset);
  48. }
  49. Object.defineProperties(Vector3DTileContent.prototype, {
  50. featuresLength: {
  51. get: function () {
  52. return defined(this._batchTable) ? this._batchTable.featuresLength : 0;
  53. },
  54. },
  55. pointsLength: {
  56. get: function () {
  57. if (defined(this._points)) {
  58. return this._points.pointsLength;
  59. }
  60. return 0;
  61. },
  62. },
  63. trianglesLength: {
  64. get: function () {
  65. var trianglesLength = 0;
  66. if (defined(this._polygons)) {
  67. trianglesLength += this._polygons.trianglesLength;
  68. }
  69. if (defined(this._polylines)) {
  70. trianglesLength += this._polylines.trianglesLength;
  71. }
  72. return trianglesLength;
  73. },
  74. },
  75. geometryByteLength: {
  76. get: function () {
  77. var geometryByteLength = 0;
  78. if (defined(this._polygons)) {
  79. geometryByteLength += this._polygons.geometryByteLength;
  80. }
  81. if (defined(this._polylines)) {
  82. geometryByteLength += this._polylines.geometryByteLength;
  83. }
  84. return geometryByteLength;
  85. },
  86. },
  87. texturesByteLength: {
  88. get: function () {
  89. if (defined(this._points)) {
  90. return this._points.texturesByteLength;
  91. }
  92. return 0;
  93. },
  94. },
  95. batchTableByteLength: {
  96. get: function () {
  97. return defined(this._batchTable) ? this._batchTable.memorySizeInBytes : 0;
  98. },
  99. },
  100. innerContents: {
  101. get: function () {
  102. return undefined;
  103. },
  104. },
  105. readyPromise: {
  106. get: function () {
  107. return this._readyPromise.promise;
  108. },
  109. },
  110. tileset: {
  111. get: function () {
  112. return this._tileset;
  113. },
  114. },
  115. tile: {
  116. get: function () {
  117. return this._tile;
  118. },
  119. },
  120. url: {
  121. get: function () {
  122. return this._resource.getUrlComponent(true);
  123. },
  124. },
  125. batchTable: {
  126. get: function () {
  127. return this._batchTable;
  128. },
  129. },
  130. });
  131. function createColorChangedCallback(content) {
  132. return function (batchId, color) {
  133. if (defined(content._polygons)) {
  134. content._polygons.updateCommands(batchId, color);
  135. }
  136. };
  137. }
  138. function getBatchIds(featureTableJson, featureTableBinary) {
  139. var polygonBatchIds;
  140. var polylineBatchIds;
  141. var pointBatchIds;
  142. var i;
  143. var numberOfPolygons = defaultValue(featureTableJson.POLYGONS_LENGTH, 0);
  144. var numberOfPolylines = defaultValue(featureTableJson.POLYLINES_LENGTH, 0);
  145. var numberOfPoints = defaultValue(featureTableJson.POINTS_LENGTH, 0);
  146. if (numberOfPolygons > 0 && defined(featureTableJson.POLYGON_BATCH_IDS)) {
  147. var polygonBatchIdsByteOffset =
  148. featureTableBinary.byteOffset +
  149. featureTableJson.POLYGON_BATCH_IDS.byteOffset;
  150. polygonBatchIds = new Uint16Array(
  151. featureTableBinary.buffer,
  152. polygonBatchIdsByteOffset,
  153. numberOfPolygons
  154. );
  155. }
  156. if (numberOfPolylines > 0 && defined(featureTableJson.POLYLINE_BATCH_IDS)) {
  157. var polylineBatchIdsByteOffset =
  158. featureTableBinary.byteOffset +
  159. featureTableJson.POLYLINE_BATCH_IDS.byteOffset;
  160. polylineBatchIds = new Uint16Array(
  161. featureTableBinary.buffer,
  162. polylineBatchIdsByteOffset,
  163. numberOfPolylines
  164. );
  165. }
  166. if (numberOfPoints > 0 && defined(featureTableJson.POINT_BATCH_IDS)) {
  167. var pointBatchIdsByteOffset =
  168. featureTableBinary.byteOffset +
  169. featureTableJson.POINT_BATCH_IDS.byteOffset;
  170. pointBatchIds = new Uint16Array(
  171. featureTableBinary.buffer,
  172. pointBatchIdsByteOffset,
  173. numberOfPoints
  174. );
  175. }
  176. var atLeastOneDefined =
  177. defined(polygonBatchIds) ||
  178. defined(polylineBatchIds) ||
  179. defined(pointBatchIds);
  180. var atLeastOneUndefined =
  181. (numberOfPolygons > 0 && !defined(polygonBatchIds)) ||
  182. (numberOfPolylines > 0 && !defined(polylineBatchIds)) ||
  183. (numberOfPoints > 0 && !defined(pointBatchIds));
  184. if (atLeastOneDefined && atLeastOneUndefined) {
  185. throw new RuntimeError(
  186. "If one group of batch ids is defined, then all batch ids must be defined."
  187. );
  188. }
  189. var allUndefinedBatchIds =
  190. !defined(polygonBatchIds) &&
  191. !defined(polylineBatchIds) &&
  192. !defined(pointBatchIds);
  193. if (allUndefinedBatchIds) {
  194. var id = 0;
  195. if (!defined(polygonBatchIds) && numberOfPolygons > 0) {
  196. polygonBatchIds = new Uint16Array(numberOfPolygons);
  197. for (i = 0; i < numberOfPolygons; ++i) {
  198. polygonBatchIds[i] = id++;
  199. }
  200. }
  201. if (!defined(polylineBatchIds) && numberOfPolylines > 0) {
  202. polylineBatchIds = new Uint16Array(numberOfPolylines);
  203. for (i = 0; i < numberOfPolylines; ++i) {
  204. polylineBatchIds[i] = id++;
  205. }
  206. }
  207. if (!defined(pointBatchIds) && numberOfPoints > 0) {
  208. pointBatchIds = new Uint16Array(numberOfPoints);
  209. for (i = 0; i < numberOfPoints; ++i) {
  210. pointBatchIds[i] = id++;
  211. }
  212. }
  213. }
  214. return {
  215. polygons: polygonBatchIds,
  216. polylines: polylineBatchIds,
  217. points: pointBatchIds,
  218. };
  219. }
  220. var sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;
  221. function initialize(content, arrayBuffer, byteOffset) {
  222. byteOffset = defaultValue(byteOffset, 0);
  223. var uint8Array = new Uint8Array(arrayBuffer);
  224. var view = new DataView(arrayBuffer);
  225. byteOffset += sizeOfUint32; // Skip magic number
  226. var version = view.getUint32(byteOffset, true);
  227. if (version !== 1) {
  228. throw new RuntimeError(
  229. "Only Vector tile version 1 is supported. Version " +
  230. version +
  231. " is not."
  232. );
  233. }
  234. byteOffset += sizeOfUint32;
  235. var byteLength = view.getUint32(byteOffset, true);
  236. byteOffset += sizeOfUint32;
  237. if (byteLength === 0) {
  238. content._readyPromise.resolve(content);
  239. return;
  240. }
  241. var featureTableJSONByteLength = view.getUint32(byteOffset, true);
  242. byteOffset += sizeOfUint32;
  243. if (featureTableJSONByteLength === 0) {
  244. throw new RuntimeError(
  245. "Feature table must have a byte length greater than zero"
  246. );
  247. }
  248. var featureTableBinaryByteLength = view.getUint32(byteOffset, true);
  249. byteOffset += sizeOfUint32;
  250. var batchTableJSONByteLength = view.getUint32(byteOffset, true);
  251. byteOffset += sizeOfUint32;
  252. var batchTableBinaryByteLength = view.getUint32(byteOffset, true);
  253. byteOffset += sizeOfUint32;
  254. var indicesByteLength = view.getUint32(byteOffset, true);
  255. byteOffset += sizeOfUint32;
  256. var positionByteLength = view.getUint32(byteOffset, true);
  257. byteOffset += sizeOfUint32;
  258. var polylinePositionByteLength = view.getUint32(byteOffset, true);
  259. byteOffset += sizeOfUint32;
  260. var pointsPositionByteLength = view.getUint32(byteOffset, true);
  261. byteOffset += sizeOfUint32;
  262. var featureTableString = getStringFromTypedArray(
  263. uint8Array,
  264. byteOffset,
  265. featureTableJSONByteLength
  266. );
  267. var featureTableJson = JSON.parse(featureTableString);
  268. byteOffset += featureTableJSONByteLength;
  269. var featureTableBinary = new Uint8Array(
  270. arrayBuffer,
  271. byteOffset,
  272. featureTableBinaryByteLength
  273. );
  274. byteOffset += featureTableBinaryByteLength;
  275. var batchTableJson;
  276. var batchTableBinary;
  277. if (batchTableJSONByteLength > 0) {
  278. // PERFORMANCE_IDEA: is it possible to allocate this on-demand? Perhaps keep the
  279. // arraybuffer/string compressed in memory and then decompress it when it is first accessed.
  280. //
  281. // We could also make another request for it, but that would make the property set/get
  282. // API async, and would double the number of numbers in some cases.
  283. var batchTableString = getStringFromTypedArray(
  284. uint8Array,
  285. byteOffset,
  286. batchTableJSONByteLength
  287. );
  288. batchTableJson = JSON.parse(batchTableString);
  289. byteOffset += batchTableJSONByteLength;
  290. if (batchTableBinaryByteLength > 0) {
  291. // Has a batch table binary
  292. batchTableBinary = new Uint8Array(
  293. arrayBuffer,
  294. byteOffset,
  295. batchTableBinaryByteLength
  296. );
  297. // Copy the batchTableBinary section and let the underlying ArrayBuffer be freed
  298. batchTableBinary = new Uint8Array(batchTableBinary);
  299. byteOffset += batchTableBinaryByteLength;
  300. }
  301. }
  302. var numberOfPolygons = defaultValue(featureTableJson.POLYGONS_LENGTH, 0);
  303. var numberOfPolylines = defaultValue(featureTableJson.POLYLINES_LENGTH, 0);
  304. var numberOfPoints = defaultValue(featureTableJson.POINTS_LENGTH, 0);
  305. var totalPrimitives = numberOfPolygons + numberOfPolylines + numberOfPoints;
  306. var batchTable = new Cesium3DTileBatchTable(
  307. content,
  308. totalPrimitives,
  309. batchTableJson,
  310. batchTableBinary,
  311. createColorChangedCallback(content)
  312. );
  313. content._batchTable = batchTable;
  314. if (totalPrimitives === 0) {
  315. return;
  316. }
  317. var featureTable = new Cesium3DTileFeatureTable(
  318. featureTableJson,
  319. featureTableBinary
  320. );
  321. var region = featureTable.getGlobalProperty("REGION");
  322. if (!defined(region)) {
  323. throw new RuntimeError(
  324. "Feature table global property: REGION must be defined"
  325. );
  326. }
  327. var rectangle = Rectangle.unpack(region);
  328. var minHeight = region[4];
  329. var maxHeight = region[5];
  330. var modelMatrix = content._tile.computedTransform;
  331. var center = featureTable.getGlobalProperty(
  332. "RTC_CENTER",
  333. ComponentDatatype.FLOAT,
  334. 3
  335. );
  336. if (defined(center)) {
  337. center = Cartesian3.unpack(center);
  338. Matrix4.multiplyByPoint(modelMatrix, center, center);
  339. } else {
  340. center = Rectangle.center(rectangle);
  341. center.height = CesiumMath.lerp(minHeight, maxHeight, 0.5);
  342. center = Ellipsoid.WGS84.cartographicToCartesian(center);
  343. }
  344. var batchIds = getBatchIds(featureTableJson, featureTableBinary);
  345. byteOffset += byteOffset % 4;
  346. if (numberOfPolygons > 0) {
  347. featureTable.featuresLength = numberOfPolygons;
  348. var polygonCounts = defaultValue(
  349. featureTable.getPropertyArray(
  350. "POLYGON_COUNTS",
  351. ComponentDatatype.UNSIGNED_INT,
  352. 1
  353. ),
  354. featureTable.getPropertyArray(
  355. "POLYGON_COUNT",
  356. ComponentDatatype.UNSIGNED_INT,
  357. 1
  358. ) // Workaround for old vector tilesets using the non-plural name
  359. );
  360. if (!defined(polygonCounts)) {
  361. throw new RuntimeError(
  362. "Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0"
  363. );
  364. }
  365. var polygonIndexCounts = defaultValue(
  366. featureTable.getPropertyArray(
  367. "POLYGON_INDEX_COUNTS",
  368. ComponentDatatype.UNSIGNED_INT,
  369. 1
  370. ),
  371. featureTable.getPropertyArray(
  372. "POLYGON_INDEX_COUNT",
  373. ComponentDatatype.UNSIGNED_INT,
  374. 1
  375. ) // Workaround for old vector tilesets using the non-plural name
  376. );
  377. if (!defined(polygonIndexCounts)) {
  378. throw new RuntimeError(
  379. "Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0"
  380. );
  381. }
  382. // Use the counts array to determine how many position values we want. If we used the byte length then
  383. // zero padding values would be included and cause the delta zig-zag decoding to fail
  384. var numPolygonPositions = polygonCounts.reduce(function (total, count) {
  385. return total + count * 2;
  386. }, 0);
  387. var numPolygonIndices = polygonIndexCounts.reduce(function (total, count) {
  388. return total + count;
  389. }, 0);
  390. var indices = new Uint32Array(arrayBuffer, byteOffset, numPolygonIndices);
  391. byteOffset += indicesByteLength;
  392. var polygonPositions = new Uint16Array(
  393. arrayBuffer,
  394. byteOffset,
  395. numPolygonPositions
  396. );
  397. byteOffset += positionByteLength;
  398. var polygonMinimumHeights;
  399. var polygonMaximumHeights;
  400. if (
  401. defined(featureTableJson.POLYGON_MINIMUM_HEIGHTS) &&
  402. defined(featureTableJson.POLYGON_MAXIMUM_HEIGHTS)
  403. ) {
  404. polygonMinimumHeights = featureTable.getPropertyArray(
  405. "POLYGON_MINIMUM_HEIGHTS",
  406. ComponentDatatype.FLOAT,
  407. 1
  408. );
  409. polygonMaximumHeights = featureTable.getPropertyArray(
  410. "POLYGON_MAXIMUM_HEIGHTS",
  411. ComponentDatatype.FLOAT,
  412. 1
  413. );
  414. }
  415. content._polygons = new Vector3DTilePolygons({
  416. positions: polygonPositions,
  417. counts: polygonCounts,
  418. indexCounts: polygonIndexCounts,
  419. indices: indices,
  420. minimumHeight: minHeight,
  421. maximumHeight: maxHeight,
  422. polygonMinimumHeights: polygonMinimumHeights,
  423. polygonMaximumHeights: polygonMaximumHeights,
  424. center: center,
  425. rectangle: rectangle,
  426. boundingVolume: content.tile.boundingVolume.boundingVolume,
  427. batchTable: batchTable,
  428. batchIds: batchIds.polygons,
  429. modelMatrix: modelMatrix,
  430. });
  431. }
  432. if (numberOfPolylines > 0) {
  433. featureTable.featuresLength = numberOfPolylines;
  434. var polylineCounts = defaultValue(
  435. featureTable.getPropertyArray(
  436. "POLYLINE_COUNTS",
  437. ComponentDatatype.UNSIGNED_INT,
  438. 1
  439. ),
  440. featureTable.getPropertyArray(
  441. "POLYLINE_COUNT",
  442. ComponentDatatype.UNSIGNED_INT,
  443. 1
  444. ) // Workaround for old vector tilesets using the non-plural name
  445. );
  446. if (!defined(polylineCounts)) {
  447. throw new RuntimeError(
  448. "Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0"
  449. );
  450. }
  451. var widths = featureTable.getPropertyArray(
  452. "POLYLINE_WIDTHS",
  453. ComponentDatatype.UNSIGNED_SHORT,
  454. 1
  455. );
  456. if (!defined(widths)) {
  457. widths = new Uint16Array(numberOfPolylines);
  458. for (var i = 0; i < numberOfPolylines; ++i) {
  459. widths[i] = 2.0;
  460. }
  461. }
  462. // Use the counts array to determine how many position values we want. If we used the byte length then
  463. // zero padding values would be included and cause the delta zig-zag decoding to fail
  464. var numPolylinePositions = polylineCounts.reduce(function (total, count) {
  465. return total + count * 3;
  466. }, 0);
  467. var polylinePositions = new Uint16Array(
  468. arrayBuffer,
  469. byteOffset,
  470. numPolylinePositions
  471. );
  472. byteOffset += polylinePositionByteLength;
  473. content._polylines = new Vector3DTilePolylines({
  474. positions: polylinePositions,
  475. widths: widths,
  476. counts: polylineCounts,
  477. batchIds: batchIds.polylines,
  478. minimumHeight: minHeight,
  479. maximumHeight: maxHeight,
  480. center: center,
  481. rectangle: rectangle,
  482. boundingVolume: content.tile.boundingVolume.boundingVolume,
  483. batchTable: batchTable,
  484. });
  485. }
  486. if (numberOfPoints > 0) {
  487. var pointPositions = new Uint16Array(
  488. arrayBuffer,
  489. byteOffset,
  490. numberOfPoints * 3
  491. );
  492. byteOffset += pointsPositionByteLength;
  493. content._points = new Vector3DTilePoints({
  494. positions: pointPositions,
  495. batchIds: batchIds.points,
  496. minimumHeight: minHeight,
  497. maximumHeight: maxHeight,
  498. rectangle: rectangle,
  499. batchTable: batchTable,
  500. });
  501. }
  502. }
  503. function createFeatures(content) {
  504. var featuresLength = content.featuresLength;
  505. if (!defined(content._features) && featuresLength > 0) {
  506. var features = new Array(featuresLength);
  507. if (defined(content._polygons)) {
  508. content._polygons.createFeatures(content, features);
  509. }
  510. if (defined(content._polylines)) {
  511. content._polylines.createFeatures(content, features);
  512. }
  513. if (defined(content._points)) {
  514. content._points.createFeatures(content, features);
  515. }
  516. content._features = features;
  517. }
  518. }
  519. Vector3DTileContent.prototype.hasProperty = function (batchId, name) {
  520. return this._batchTable.hasProperty(batchId, name);
  521. };
  522. Vector3DTileContent.prototype.getFeature = function (batchId) {
  523. //>>includeStart('debug', pragmas.debug);
  524. var featuresLength = this.featuresLength;
  525. if (!defined(batchId) || batchId < 0 || batchId >= featuresLength) {
  526. throw new DeveloperError(
  527. "batchId is required and between zero and featuresLength - 1 (" +
  528. (featuresLength - 1) +
  529. ")."
  530. );
  531. }
  532. //>>includeEnd('debug');
  533. createFeatures(this);
  534. return this._features[batchId];
  535. };
  536. Vector3DTileContent.prototype.applyDebugSettings = function (enabled, color) {
  537. if (defined(this._polygons)) {
  538. this._polygons.applyDebugSettings(enabled, color);
  539. }
  540. if (defined(this._polylines)) {
  541. this._polylines.applyDebugSettings(enabled, color);
  542. }
  543. if (defined(this._points)) {
  544. this._points.applyDebugSettings(enabled, color);
  545. }
  546. };
  547. Vector3DTileContent.prototype.applyStyle = function (style) {
  548. createFeatures(this);
  549. if (defined(this._polygons)) {
  550. this._polygons.applyStyle(style, this._features);
  551. }
  552. if (defined(this._polylines)) {
  553. this._polylines.applyStyle(style, this._features);
  554. }
  555. if (defined(this._points)) {
  556. this._points.applyStyle(style, this._features);
  557. }
  558. };
  559. Vector3DTileContent.prototype.update = function (tileset, frameState) {
  560. var ready = true;
  561. if (defined(this._polygons)) {
  562. this._polygons.classificationType = this._tileset.classificationType;
  563. this._polygons.debugWireframe = this._tileset.debugWireframe;
  564. this._polygons.update(frameState);
  565. ready = ready && this._polygons._ready;
  566. }
  567. if (defined(this._polylines)) {
  568. this._polylines.update(frameState);
  569. ready = ready && this._polylines._ready;
  570. }
  571. if (defined(this._points)) {
  572. this._points.update(frameState);
  573. ready = ready && this._points._ready;
  574. }
  575. if (defined(this._batchTable) && ready) {
  576. this._batchTable.update(tileset, frameState);
  577. }
  578. if (!defined(this._contentReadyPromise)) {
  579. var pointsPromise = defined(this._points)
  580. ? this._points.readyPromise
  581. : undefined;
  582. var polygonPromise = defined(this._polygons)
  583. ? this._polygons.readyPromise
  584. : undefined;
  585. var polylinePromise = defined(this._polylines)
  586. ? this._polylines.readyPromise
  587. : undefined;
  588. var that = this;
  589. this._contentReadyPromise = when
  590. .all([pointsPromise, polygonPromise, polylinePromise])
  591. .then(function () {
  592. that._readyPromise.resolve(that);
  593. });
  594. }
  595. };
  596. Vector3DTileContent.prototype.isDestroyed = function () {
  597. return false;
  598. };
  599. Vector3DTileContent.prototype.destroy = function () {
  600. this._polygons = this._polygons && this._polygons.destroy();
  601. this._polylines = this._polylines && this._polylines.destroy();
  602. this._points = this._points && this._points.destroy();
  603. this._batchTable = this._batchTable && this._batchTable.destroy();
  604. return destroyObject(this);
  605. };
  606. export default Vector3DTileContent;