createPolylineGeometry.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['./defaultValue-94c3e563', './Matrix2-fc7e9822', './ArcType-0cf52f8c', './arrayRemoveDuplicates-06991c15', './Transforms-a076dbe6', './Color-ec9112c4', './ComponentDatatype-4a60b8d6', './RuntimeError-c581ca93', './GeometryAttribute-2ecf73f6', './GeometryAttributes-7df9bef6', './IndexDatatype-db156785', './PolylinePipeline-7608e667', './VertexFormat-e46f29d6', './_commonjsHelpers-3aae1032-f55dc0c4', './combine-761d9c3f', './WebGLConstants-7dccdc96', './EllipsoidGeodesic-dc94f381', './EllipsoidRhumbLine-daebc75b', './IntersectionTests-5deed78b', './Plane-e20fba8c'], (function (defaultValue, Matrix2, ArcType, arrayRemoveDuplicates, Transforms, Color, ComponentDatatype, RuntimeError, GeometryAttribute, GeometryAttributes, IndexDatatype, PolylinePipeline, VertexFormat, _commonjsHelpers3aae1032, combine, WebGLConstants, EllipsoidGeodesic, EllipsoidRhumbLine, IntersectionTests, Plane) { 'use strict';
  3. const scratchInterpolateColorsArray = [];
  4. function interpolateColors(p0, p1, color0, color1, numPoints) {
  5. const colors = scratchInterpolateColorsArray;
  6. colors.length = numPoints;
  7. let i;
  8. const r0 = color0.red;
  9. const g0 = color0.green;
  10. const b0 = color0.blue;
  11. const a0 = color0.alpha;
  12. const r1 = color1.red;
  13. const g1 = color1.green;
  14. const b1 = color1.blue;
  15. const a1 = color1.alpha;
  16. if (Color.Color.equals(color0, color1)) {
  17. for (i = 0; i < numPoints; i++) {
  18. colors[i] = Color.Color.clone(color0);
  19. }
  20. return colors;
  21. }
  22. const redPerVertex = (r1 - r0) / numPoints;
  23. const greenPerVertex = (g1 - g0) / numPoints;
  24. const bluePerVertex = (b1 - b0) / numPoints;
  25. const alphaPerVertex = (a1 - a0) / numPoints;
  26. for (i = 0; i < numPoints; i++) {
  27. colors[i] = new Color.Color(
  28. r0 + i * redPerVertex,
  29. g0 + i * greenPerVertex,
  30. b0 + i * bluePerVertex,
  31. a0 + i * alphaPerVertex
  32. );
  33. }
  34. return colors;
  35. }
  36. /**
  37. * A description of a polyline modeled as a line strip; the first two positions define a line segment,
  38. * and each additional position defines a line segment from the previous position. The polyline is capable of
  39. * displaying with a material.
  40. *
  41. * @alias PolylineGeometry
  42. * @constructor
  43. *
  44. * @param {Object} options Object with the following properties:
  45. * @param {Cartesian3[]} options.positions An array of {@link Cartesian3} defining the positions in the polyline as a line strip.
  46. * @param {Number} [options.width=1.0] The width in pixels.
  47. * @param {Color[]} [options.colors] An Array of {@link Color} defining the per vertex or per segment colors.
  48. * @param {Boolean} [options.colorsPerVertex=false] A boolean that determines whether the colors will be flat across each segment of the line or interpolated across the vertices.
  49. * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polyline segments must follow.
  50. * @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude if options.arcType is not ArcType.NONE. Determines the number of positions in the buffer.
  51. * @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
  52. * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
  53. *
  54. * @exception {DeveloperError} At least two positions are required.
  55. * @exception {DeveloperError} width must be greater than or equal to one.
  56. * @exception {DeveloperError} colors has an invalid length.
  57. *
  58. * @see PolylineGeometry#createGeometry
  59. *
  60. * @demo {@link https://sandcastle.cesium.com/index.html?src=Polyline.html|Cesium Sandcastle Polyline Demo}
  61. *
  62. * @example
  63. * // A polyline with two connected line segments
  64. * const polyline = new Cesium.PolylineGeometry({
  65. * positions : Cesium.Cartesian3.fromDegreesArray([
  66. * 0.0, 0.0,
  67. * 5.0, 0.0,
  68. * 5.0, 5.0
  69. * ]),
  70. * width : 10.0
  71. * });
  72. * const geometry = Cesium.PolylineGeometry.createGeometry(polyline);
  73. */
  74. function PolylineGeometry(options) {
  75. options = defaultValue.defaultValue(options, defaultValue.defaultValue.EMPTY_OBJECT);
  76. const positions = options.positions;
  77. const colors = options.colors;
  78. const width = defaultValue.defaultValue(options.width, 1.0);
  79. const colorsPerVertex = defaultValue.defaultValue(options.colorsPerVertex, false);
  80. //>>includeStart('debug', pragmas.debug);
  81. if (!defaultValue.defined(positions) || positions.length < 2) {
  82. throw new RuntimeError.DeveloperError("At least two positions are required.");
  83. }
  84. if (typeof width !== "number") {
  85. throw new RuntimeError.DeveloperError("width must be a number");
  86. }
  87. if (
  88. defaultValue.defined(colors) &&
  89. ((colorsPerVertex && colors.length < positions.length) ||
  90. (!colorsPerVertex && colors.length < positions.length - 1))
  91. ) {
  92. throw new RuntimeError.DeveloperError("colors has an invalid length.");
  93. }
  94. //>>includeEnd('debug');
  95. this._positions = positions;
  96. this._colors = colors;
  97. this._width = width;
  98. this._colorsPerVertex = colorsPerVertex;
  99. this._vertexFormat = VertexFormat.VertexFormat.clone(
  100. defaultValue.defaultValue(options.vertexFormat, VertexFormat.VertexFormat.DEFAULT)
  101. );
  102. this._arcType = defaultValue.defaultValue(options.arcType, ArcType.ArcType.GEODESIC);
  103. this._granularity = defaultValue.defaultValue(
  104. options.granularity,
  105. ComponentDatatype.CesiumMath.RADIANS_PER_DEGREE
  106. );
  107. this._ellipsoid = Matrix2.Ellipsoid.clone(
  108. defaultValue.defaultValue(options.ellipsoid, Matrix2.Ellipsoid.WGS84)
  109. );
  110. this._workerName = "createPolylineGeometry";
  111. let numComponents = 1 + positions.length * Matrix2.Cartesian3.packedLength;
  112. numComponents += defaultValue.defined(colors) ? 1 + colors.length * Color.Color.packedLength : 1;
  113. /**
  114. * The number of elements used to pack the object into an array.
  115. * @type {Number}
  116. */
  117. this.packedLength =
  118. numComponents + Matrix2.Ellipsoid.packedLength + VertexFormat.VertexFormat.packedLength + 4;
  119. }
  120. /**
  121. * Stores the provided instance into the provided array.
  122. *
  123. * @param {PolylineGeometry} value The value to pack.
  124. * @param {Number[]} array The array to pack into.
  125. * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
  126. *
  127. * @returns {Number[]} The array that was packed into
  128. */
  129. PolylineGeometry.pack = function (value, array, startingIndex) {
  130. //>>includeStart('debug', pragmas.debug);
  131. if (!defaultValue.defined(value)) {
  132. throw new RuntimeError.DeveloperError("value is required");
  133. }
  134. if (!defaultValue.defined(array)) {
  135. throw new RuntimeError.DeveloperError("array is required");
  136. }
  137. //>>includeEnd('debug');
  138. startingIndex = defaultValue.defaultValue(startingIndex, 0);
  139. let i;
  140. const positions = value._positions;
  141. let length = positions.length;
  142. array[startingIndex++] = length;
  143. for (i = 0; i < length; ++i, startingIndex += Matrix2.Cartesian3.packedLength) {
  144. Matrix2.Cartesian3.pack(positions[i], array, startingIndex);
  145. }
  146. const colors = value._colors;
  147. length = defaultValue.defined(colors) ? colors.length : 0.0;
  148. array[startingIndex++] = length;
  149. for (i = 0; i < length; ++i, startingIndex += Color.Color.packedLength) {
  150. Color.Color.pack(colors[i], array, startingIndex);
  151. }
  152. Matrix2.Ellipsoid.pack(value._ellipsoid, array, startingIndex);
  153. startingIndex += Matrix2.Ellipsoid.packedLength;
  154. VertexFormat.VertexFormat.pack(value._vertexFormat, array, startingIndex);
  155. startingIndex += VertexFormat.VertexFormat.packedLength;
  156. array[startingIndex++] = value._width;
  157. array[startingIndex++] = value._colorsPerVertex ? 1.0 : 0.0;
  158. array[startingIndex++] = value._arcType;
  159. array[startingIndex] = value._granularity;
  160. return array;
  161. };
  162. const scratchEllipsoid = Matrix2.Ellipsoid.clone(Matrix2.Ellipsoid.UNIT_SPHERE);
  163. const scratchVertexFormat = new VertexFormat.VertexFormat();
  164. const scratchOptions = {
  165. positions: undefined,
  166. colors: undefined,
  167. ellipsoid: scratchEllipsoid,
  168. vertexFormat: scratchVertexFormat,
  169. width: undefined,
  170. colorsPerVertex: undefined,
  171. arcType: undefined,
  172. granularity: undefined,
  173. };
  174. /**
  175. * Retrieves an instance from a packed array.
  176. *
  177. * @param {Number[]} array The packed array.
  178. * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
  179. * @param {PolylineGeometry} [result] The object into which to store the result.
  180. * @returns {PolylineGeometry} The modified result parameter or a new PolylineGeometry instance if one was not provided.
  181. */
  182. PolylineGeometry.unpack = function (array, startingIndex, result) {
  183. //>>includeStart('debug', pragmas.debug);
  184. if (!defaultValue.defined(array)) {
  185. throw new RuntimeError.DeveloperError("array is required");
  186. }
  187. //>>includeEnd('debug');
  188. startingIndex = defaultValue.defaultValue(startingIndex, 0);
  189. let i;
  190. let length = array[startingIndex++];
  191. const positions = new Array(length);
  192. for (i = 0; i < length; ++i, startingIndex += Matrix2.Cartesian3.packedLength) {
  193. positions[i] = Matrix2.Cartesian3.unpack(array, startingIndex);
  194. }
  195. length = array[startingIndex++];
  196. const colors = length > 0 ? new Array(length) : undefined;
  197. for (i = 0; i < length; ++i, startingIndex += Color.Color.packedLength) {
  198. colors[i] = Color.Color.unpack(array, startingIndex);
  199. }
  200. const ellipsoid = Matrix2.Ellipsoid.unpack(array, startingIndex, scratchEllipsoid);
  201. startingIndex += Matrix2.Ellipsoid.packedLength;
  202. const vertexFormat = VertexFormat.VertexFormat.unpack(
  203. array,
  204. startingIndex,
  205. scratchVertexFormat
  206. );
  207. startingIndex += VertexFormat.VertexFormat.packedLength;
  208. const width = array[startingIndex++];
  209. const colorsPerVertex = array[startingIndex++] === 1.0;
  210. const arcType = array[startingIndex++];
  211. const granularity = array[startingIndex];
  212. if (!defaultValue.defined(result)) {
  213. scratchOptions.positions = positions;
  214. scratchOptions.colors = colors;
  215. scratchOptions.width = width;
  216. scratchOptions.colorsPerVertex = colorsPerVertex;
  217. scratchOptions.arcType = arcType;
  218. scratchOptions.granularity = granularity;
  219. return new PolylineGeometry(scratchOptions);
  220. }
  221. result._positions = positions;
  222. result._colors = colors;
  223. result._ellipsoid = Matrix2.Ellipsoid.clone(ellipsoid, result._ellipsoid);
  224. result._vertexFormat = VertexFormat.VertexFormat.clone(vertexFormat, result._vertexFormat);
  225. result._width = width;
  226. result._colorsPerVertex = colorsPerVertex;
  227. result._arcType = arcType;
  228. result._granularity = granularity;
  229. return result;
  230. };
  231. const scratchCartesian3 = new Matrix2.Cartesian3();
  232. const scratchPosition = new Matrix2.Cartesian3();
  233. const scratchPrevPosition = new Matrix2.Cartesian3();
  234. const scratchNextPosition = new Matrix2.Cartesian3();
  235. /**
  236. * Computes the geometric representation of a polyline, including its vertices, indices, and a bounding sphere.
  237. *
  238. * @param {PolylineGeometry} polylineGeometry A description of the polyline.
  239. * @returns {Geometry|undefined} The computed vertices and indices.
  240. */
  241. PolylineGeometry.createGeometry = function (polylineGeometry) {
  242. const width = polylineGeometry._width;
  243. const vertexFormat = polylineGeometry._vertexFormat;
  244. let colors = polylineGeometry._colors;
  245. const colorsPerVertex = polylineGeometry._colorsPerVertex;
  246. const arcType = polylineGeometry._arcType;
  247. const granularity = polylineGeometry._granularity;
  248. const ellipsoid = polylineGeometry._ellipsoid;
  249. let i;
  250. let j;
  251. let k;
  252. const removedIndices = [];
  253. let positions = arrayRemoveDuplicates.arrayRemoveDuplicates(
  254. polylineGeometry._positions,
  255. Matrix2.Cartesian3.equalsEpsilon,
  256. false,
  257. removedIndices
  258. );
  259. if (defaultValue.defined(colors) && removedIndices.length > 0) {
  260. let removedArrayIndex = 0;
  261. let nextRemovedIndex = removedIndices[0];
  262. colors = colors.filter(function (color, index) {
  263. let remove = false;
  264. if (colorsPerVertex) {
  265. remove =
  266. index === nextRemovedIndex || (index === 0 && nextRemovedIndex === 1);
  267. } else {
  268. remove = index + 1 === nextRemovedIndex;
  269. }
  270. if (remove) {
  271. removedArrayIndex++;
  272. nextRemovedIndex = removedIndices[removedArrayIndex];
  273. return false;
  274. }
  275. return true;
  276. });
  277. }
  278. let positionsLength = positions.length;
  279. // A width of a pixel or less is not a valid geometry, but in order to support external data
  280. // that may have errors we treat this as an empty geometry.
  281. if (positionsLength < 2 || width <= 0.0) {
  282. return undefined;
  283. }
  284. if (arcType === ArcType.ArcType.GEODESIC || arcType === ArcType.ArcType.RHUMB) {
  285. let subdivisionSize;
  286. let numberOfPointsFunction;
  287. if (arcType === ArcType.ArcType.GEODESIC) {
  288. subdivisionSize = ComponentDatatype.CesiumMath.chordLength(
  289. granularity,
  290. ellipsoid.maximumRadius
  291. );
  292. numberOfPointsFunction = PolylinePipeline.PolylinePipeline.numberOfPoints;
  293. } else {
  294. subdivisionSize = granularity;
  295. numberOfPointsFunction = PolylinePipeline.PolylinePipeline.numberOfPointsRhumbLine;
  296. }
  297. const heights = PolylinePipeline.PolylinePipeline.extractHeights(positions, ellipsoid);
  298. if (defaultValue.defined(colors)) {
  299. let colorLength = 1;
  300. for (i = 0; i < positionsLength - 1; ++i) {
  301. colorLength += numberOfPointsFunction(
  302. positions[i],
  303. positions[i + 1],
  304. subdivisionSize
  305. );
  306. }
  307. const newColors = new Array(colorLength);
  308. let newColorIndex = 0;
  309. for (i = 0; i < positionsLength - 1; ++i) {
  310. const p0 = positions[i];
  311. const p1 = positions[i + 1];
  312. const c0 = colors[i];
  313. const numColors = numberOfPointsFunction(p0, p1, subdivisionSize);
  314. if (colorsPerVertex && i < colorLength) {
  315. const c1 = colors[i + 1];
  316. const interpolatedColors = interpolateColors(
  317. p0,
  318. p1,
  319. c0,
  320. c1,
  321. numColors
  322. );
  323. const interpolatedColorsLength = interpolatedColors.length;
  324. for (j = 0; j < interpolatedColorsLength; ++j) {
  325. newColors[newColorIndex++] = interpolatedColors[j];
  326. }
  327. } else {
  328. for (j = 0; j < numColors; ++j) {
  329. newColors[newColorIndex++] = Color.Color.clone(c0);
  330. }
  331. }
  332. }
  333. newColors[newColorIndex] = Color.Color.clone(colors[colors.length - 1]);
  334. colors = newColors;
  335. scratchInterpolateColorsArray.length = 0;
  336. }
  337. if (arcType === ArcType.ArcType.GEODESIC) {
  338. positions = PolylinePipeline.PolylinePipeline.generateCartesianArc({
  339. positions: positions,
  340. minDistance: subdivisionSize,
  341. ellipsoid: ellipsoid,
  342. height: heights,
  343. });
  344. } else {
  345. positions = PolylinePipeline.PolylinePipeline.generateCartesianRhumbArc({
  346. positions: positions,
  347. granularity: subdivisionSize,
  348. ellipsoid: ellipsoid,
  349. height: heights,
  350. });
  351. }
  352. }
  353. positionsLength = positions.length;
  354. const size = positionsLength * 4.0 - 4.0;
  355. const finalPositions = new Float64Array(size * 3);
  356. const prevPositions = new Float64Array(size * 3);
  357. const nextPositions = new Float64Array(size * 3);
  358. const expandAndWidth = new Float32Array(size * 2);
  359. const st = vertexFormat.st ? new Float32Array(size * 2) : undefined;
  360. const finalColors = defaultValue.defined(colors) ? new Uint8Array(size * 4) : undefined;
  361. let positionIndex = 0;
  362. let expandAndWidthIndex = 0;
  363. let stIndex = 0;
  364. let colorIndex = 0;
  365. let position;
  366. for (j = 0; j < positionsLength; ++j) {
  367. if (j === 0) {
  368. position = scratchCartesian3;
  369. Matrix2.Cartesian3.subtract(positions[0], positions[1], position);
  370. Matrix2.Cartesian3.add(positions[0], position, position);
  371. } else {
  372. position = positions[j - 1];
  373. }
  374. Matrix2.Cartesian3.clone(position, scratchPrevPosition);
  375. Matrix2.Cartesian3.clone(positions[j], scratchPosition);
  376. if (j === positionsLength - 1) {
  377. position = scratchCartesian3;
  378. Matrix2.Cartesian3.subtract(
  379. positions[positionsLength - 1],
  380. positions[positionsLength - 2],
  381. position
  382. );
  383. Matrix2.Cartesian3.add(positions[positionsLength - 1], position, position);
  384. } else {
  385. position = positions[j + 1];
  386. }
  387. Matrix2.Cartesian3.clone(position, scratchNextPosition);
  388. let color0, color1;
  389. if (defaultValue.defined(finalColors)) {
  390. if (j !== 0 && !colorsPerVertex) {
  391. color0 = colors[j - 1];
  392. } else {
  393. color0 = colors[j];
  394. }
  395. if (j !== positionsLength - 1) {
  396. color1 = colors[j];
  397. }
  398. }
  399. const startK = j === 0 ? 2 : 0;
  400. const endK = j === positionsLength - 1 ? 2 : 4;
  401. for (k = startK; k < endK; ++k) {
  402. Matrix2.Cartesian3.pack(scratchPosition, finalPositions, positionIndex);
  403. Matrix2.Cartesian3.pack(scratchPrevPosition, prevPositions, positionIndex);
  404. Matrix2.Cartesian3.pack(scratchNextPosition, nextPositions, positionIndex);
  405. positionIndex += 3;
  406. const direction = k - 2 < 0 ? -1.0 : 1.0;
  407. expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1; // expand direction
  408. expandAndWidth[expandAndWidthIndex++] = direction * width;
  409. if (vertexFormat.st) {
  410. st[stIndex++] = j / (positionsLength - 1);
  411. st[stIndex++] = Math.max(expandAndWidth[expandAndWidthIndex - 2], 0.0);
  412. }
  413. if (defaultValue.defined(finalColors)) {
  414. const color = k < 2 ? color0 : color1;
  415. finalColors[colorIndex++] = Color.Color.floatToByte(color.red);
  416. finalColors[colorIndex++] = Color.Color.floatToByte(color.green);
  417. finalColors[colorIndex++] = Color.Color.floatToByte(color.blue);
  418. finalColors[colorIndex++] = Color.Color.floatToByte(color.alpha);
  419. }
  420. }
  421. }
  422. const attributes = new GeometryAttributes.GeometryAttributes();
  423. attributes.position = new GeometryAttribute.GeometryAttribute({
  424. componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
  425. componentsPerAttribute: 3,
  426. values: finalPositions,
  427. });
  428. attributes.prevPosition = new GeometryAttribute.GeometryAttribute({
  429. componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
  430. componentsPerAttribute: 3,
  431. values: prevPositions,
  432. });
  433. attributes.nextPosition = new GeometryAttribute.GeometryAttribute({
  434. componentDatatype: ComponentDatatype.ComponentDatatype.DOUBLE,
  435. componentsPerAttribute: 3,
  436. values: nextPositions,
  437. });
  438. attributes.expandAndWidth = new GeometryAttribute.GeometryAttribute({
  439. componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
  440. componentsPerAttribute: 2,
  441. values: expandAndWidth,
  442. });
  443. if (vertexFormat.st) {
  444. attributes.st = new GeometryAttribute.GeometryAttribute({
  445. componentDatatype: ComponentDatatype.ComponentDatatype.FLOAT,
  446. componentsPerAttribute: 2,
  447. values: st,
  448. });
  449. }
  450. if (defaultValue.defined(finalColors)) {
  451. attributes.color = new GeometryAttribute.GeometryAttribute({
  452. componentDatatype: ComponentDatatype.ComponentDatatype.UNSIGNED_BYTE,
  453. componentsPerAttribute: 4,
  454. values: finalColors,
  455. normalize: true,
  456. });
  457. }
  458. const indices = IndexDatatype.IndexDatatype.createTypedArray(size, positionsLength * 6 - 6);
  459. let index = 0;
  460. let indicesIndex = 0;
  461. const length = positionsLength - 1.0;
  462. for (j = 0; j < length; ++j) {
  463. indices[indicesIndex++] = index;
  464. indices[indicesIndex++] = index + 2;
  465. indices[indicesIndex++] = index + 1;
  466. indices[indicesIndex++] = index + 1;
  467. indices[indicesIndex++] = index + 2;
  468. indices[indicesIndex++] = index + 3;
  469. index += 4;
  470. }
  471. return new GeometryAttribute.Geometry({
  472. attributes: attributes,
  473. indices: indices,
  474. primitiveType: GeometryAttribute.PrimitiveType.TRIANGLES,
  475. boundingSphere: Transforms.BoundingSphere.fromPoints(positions),
  476. geometryType: GeometryAttribute.GeometryType.POLYLINES,
  477. });
  478. };
  479. function createPolylineGeometry(polylineGeometry, offset) {
  480. if (defaultValue.defined(offset)) {
  481. polylineGeometry = PolylineGeometry.unpack(polylineGeometry, offset);
  482. }
  483. polylineGeometry._ellipsoid = Matrix2.Ellipsoid.clone(polylineGeometry._ellipsoid);
  484. return PolylineGeometry.createGeometry(polylineGeometry);
  485. }
  486. return createPolylineGeometry;
  487. }));