qd-changjing/public/static/Build/CesiumUnminified/Workers/createSimplePolylineGeometr...

1 line
31 KiB
Plaintext
Raw Normal View History

2022-07-05 16:56:29 +08:00
{"version":3,"file":"createSimplePolylineGeometry.js","sources":["../../../../Source/Core/SimplePolylineGeometry.js","../../../../Source/WorkersES6/createSimplePolylineGeometry.js"],"sourcesContent":["import ArcType from \"./ArcType.js\";\nimport BoundingSphere from \"./BoundingSphere.js\";\nimport Cartesian3 from \"./Cartesian3.js\";\nimport Color from \"./Color.js\";\nimport ComponentDatatype from \"./ComponentDatatype.js\";\nimport defaultValue from \"./defaultValue.js\";\nimport defined from \"./defined.js\";\nimport DeveloperError from \"./DeveloperError.js\";\nimport Ellipsoid from \"./Ellipsoid.js\";\nimport Geometry from \"./Geometry.js\";\nimport GeometryAttribute from \"./GeometryAttribute.js\";\nimport GeometryAttributes from \"./GeometryAttributes.js\";\nimport IndexDatatype from \"./IndexDatatype.js\";\nimport CesiumMath from \"./Math.js\";\nimport PolylinePipeline from \"./PolylinePipeline.js\";\nimport PrimitiveType from \"./PrimitiveType.js\";\n\nfunction interpolateColors(p0, p1, color0, color1, minDistance, array, offset) {\n const numPoints = PolylinePipeline.numberOfPoints(p0, p1, minDistance);\n let i;\n\n const r0 = color0.red;\n const g0 = color0.green;\n const b0 = color0.blue;\n const a0 = color0.alpha;\n\n const r1 = color1.red;\n const g1 = color1.green;\n const b1 = color1.blue;\n const a1 = color1.alpha;\n\n if (Color.equals(color0, color1)) {\n for (i = 0; i < numPoints; i++) {\n array[offset++] = Color.floatToByte(r0);\n array[offset++] = Color.floatToByte(g0);\n array[offset++] = Color.floatToByte(b0);\n array[offset++] = Color.floatToByte(a0);\n }\n return offset;\n }\n\n const redPerVertex = (r1 - r0) / numPoints;\n const greenPerVertex = (g1 - g0) / numPoints;\n const bluePerVertex = (b1 - b0) / numPoints;\n const alphaPerVertex = (a1 - a0) / numPoints;\n\n let index = offset;\n for (i = 0; i < numPoints; i++) {\n array[index++] = Color.floatToByte(r0 + i * redPerVertex);\n array[index++] = Color.floatToByte(g0 + i * greenPerVertex);\n array[index++] = Color.floatToByte(b0 + i * bluePerVertex);\n array[index++] = Color.floatToByte(a0 + i * alphaPerVertex);\n }\n\n return index;\n}\n\n/**\n * A description of a polyline modeled as a line strip; the first two positions define a line segment,\n * and each additional position defines a line segment from the previous position.\n *\n * @alias SimplePolylineGeometry\n * @constructor\n *\n * @param {Object} options Object with the following properties:\n * @param {Cartesian3[]} options.positions An array of {@link Cartesian3} defining the positions in the polyline as a line strip.\n * @param {Color[]} [options.colors] An Array of {@link Color} defining the per vertex or per segment colors.\n * @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.\n * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polyline segments must follow.\n * @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.\n * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.\n *\n * @exception {DeveloperError} At least two positions are required.\n * @exception {DeveloperError} colors has an invalid length.\n *\n * @see SimplePolylineGeometry#createGeometry\n *\n * @example\n * // A polyline with two connected line segments\n * const polyline = new Cesium.SimplePolylineGeometry({\n * positions : Cesium.Cartesian3.fromDegreesArray([\n * 0.0, 0.0,\n * 5.0, 0.0,\n * 5.0, 5.0\n * ])\n * });\n * const geometry = Cesium.SimplePolylineGeometry.createGeometry(polyline);\n */\nfunction SimplePolylineGeometry(options) {\n options = defaultValue(options, defaultValue.EMPTY_OBJECT);\n const positions = options.positions;\n const colors = options.colors;\n const