cesium 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/Cesium.js +5 -2
- data/app/assets/javascripts/Core/Cartesian2.js +58 -0
- data/app/assets/javascripts/Core/Cartesian3.js +67 -7
- data/app/assets/javascripts/Core/Cartesian4.js +63 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +183 -163
- data/app/assets/javascripts/Core/CorridorGeometry.js +2 -2
- data/app/assets/javascripts/Core/Ellipsoid.js +16 -0
- data/app/assets/javascripts/Core/ExtentGeometry.js +9 -2
- data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +2 -2
- data/app/assets/javascripts/Core/GeometryPipeline.js +23 -23
- data/app/assets/javascripts/Core/HermiteSpline.js +260 -155
- data/app/assets/javascripts/Core/IndexDatatype.js +43 -34
- data/app/assets/javascripts/Core/LinearSpline.js +118 -0
- data/app/assets/javascripts/Core/Math.js +34 -3
- data/app/assets/javascripts/Core/Matrix2.js +26 -0
- data/app/assets/javascripts/Core/Matrix3.js +98 -0
- data/app/assets/javascripts/Core/Matrix4.js +42 -0
- data/app/assets/javascripts/Core/ObjectOrientedBoundingBox.js +396 -0
- data/app/assets/javascripts/Core/PolygonGeometry.js +87 -47
- data/app/assets/javascripts/Core/PolygonGeometryLibrary.js +20 -17
- data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +68 -40
- data/app/assets/javascripts/Core/PolygonPipeline.js +19 -9
- data/app/assets/javascripts/Core/PrimitiveType.js +33 -36
- data/app/assets/javascripts/Core/Quaternion.js +147 -1
- data/app/assets/javascripts/Core/QuaternionSpline.js +160 -0
- data/app/assets/javascripts/Core/Spline.js +121 -0
- data/app/assets/javascripts/Core/Transforms.js +0 -2
- data/app/assets/javascripts/Core/loadArrayBuffer.js +5 -1
- data/app/assets/javascripts/Core/loadBlob.js +5 -1
- data/app/assets/javascripts/Core/loadText.js +4 -1
- data/app/assets/javascripts/Core/loadWithXhr.js +30 -14
- data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +2 -2
- data/app/assets/javascripts/Renderer/AutomaticUniforms.js +41 -41
- data/app/assets/javascripts/Renderer/Context.js +171 -201
- data/app/assets/javascripts/Renderer/CubeMapFace.js +2 -2
- data/app/assets/javascripts/Renderer/DrawCommand.js +2 -2
- data/app/assets/javascripts/Renderer/PixelFormat.js +22 -28
- data/app/assets/javascripts/Renderer/ShaderProgram.js +65 -46
- data/app/assets/javascripts/Renderer/Texture.js +1 -1
- data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +7 -9
- data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +19 -25
- data/app/assets/javascripts/Renderer/TextureWrap.js +11 -13
- data/app/assets/javascripts/Renderer/UniformDatatype.js +29 -29
- data/app/assets/javascripts/Renderer/VertexArray.js +43 -35
- data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/BillboardCollection.js +10 -1
- data/app/assets/javascripts/Scene/CameraFlightPath.js +58 -101
- data/app/assets/javascripts/Scene/CentralBody.js +1 -4
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -2
- data/app/assets/javascripts/Scene/CesiumTerrainProvider.js +1 -2
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -3
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +20 -5
- data/app/assets/javascripts/Scene/EllipsoidSurfaceAppearance.js +1 -2
- data/app/assets/javascripts/Scene/FrameState.js +1 -3
- data/app/assets/javascripts/Scene/GoogleEarthImageryProvider.js +2 -5
- data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/OrthographicFrustum.js +1 -2
- data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +1 -2
- data/app/assets/javascripts/Scene/Polygon.js +1 -3
- data/app/assets/javascripts/Scene/Polyline.js +5 -2
- data/app/assets/javascripts/Scene/PolylineCollection.js +4 -6
- data/app/assets/javascripts/Scene/Primitive.js +19 -13
- data/app/assets/javascripts/Scene/PrimitivePipeline.js +1 -1
- data/app/assets/javascripts/Scene/Scene.js +7 -10
- data/app/assets/javascripts/Scene/SceneTransforms.js +1 -3
- data/app/assets/javascripts/Scene/SceneTransitioner.js +11 -11
- data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/TexturePool.js +1 -1
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/VRTheWorldTerrainProvider.js +1 -2
- data/app/assets/javascripts/Scene/ViewportQuad.js +1 -3
- data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +1 -2
- data/app/assets/javascripts/ThirdParty/knockout-3.0.0.js +6 -3
- data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +4 -3
- data/app/assets/javascripts/Widgets/SceneModePicker/SceneModePickerViewModel.js +1 -1
- data/app/assets/javascripts/Widgets/Viewer/Viewer.js +5 -5
- data/app/assets/javascripts/Widgets/Viewer/viewerDragDropMixin.js +13 -13
- data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +6 -6
- data/app/assets/javascripts/Widgets/widgets.css +1 -1
- data/lib/cesium/version.rb +1 -1
- metadata +6 -3
- data/app/assets/javascripts/Core/OrientationInterpolator.js +0 -106
|
@@ -25,8 +25,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/Cartesian3', 'Core/Ellipsoid'
|
|
|
25
25
|
PolygonGeometryLibrary.subdivideLine = function(p0, p1, granularity) {
|
|
26
26
|
var length = Cartesian3.distance(p0, p1);
|
|
27
27
|
var angleBetween = Cartesian3.angleBetween(p0, p1);
|
|
28
|
-
var n = angleBetween/granularity;
|
|
29
|
-
var countDivide = Math.ceil(Math.log(n)/Math.log(2));
|
|
28
|
+
var n = angleBetween / granularity;
|
|
29
|
+
var countDivide = Math.ceil(Math.log(n) / Math.log(2));
|
|
30
30
|
if (countDivide < 1) {
|
|
31
31
|
countDivide = 0;
|
|
32
32
|
}
|
|
@@ -39,8 +39,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/Cartesian3', 'Core/Ellipsoid'
|
|
|
39
39
|
positions[index++] = p0.x;
|
|
40
40
|
positions[index++] = p0.y;
|
|
41
41
|
positions[index++] = p0.z;
|
|
42
|
-
for (var i = 1; i < numVertices; i++) {
|
|
43
|
-
var p = getPointAtDistance(p0, p1, i*distanceBetweenVertices, length);
|
|
42
|
+
for ( var i = 1; i < numVertices; i++) {
|
|
43
|
+
var p = getPointAtDistance(p0, p1, i * distanceBetweenVertices, length);
|
|
44
44
|
positions[index++] = p[0];
|
|
45
45
|
positions[index++] = p[1];
|
|
46
46
|
positions[index++] = p[2];
|
|
@@ -49,19 +49,20 @@ define(['Core/defaultValue', 'Core/defined', 'Core/Cartesian3', 'Core/Ellipsoid'
|
|
|
49
49
|
return positions;
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
|
|
53
52
|
var scaleToGeodeticHeightN1 = new Cartesian3();
|
|
54
53
|
var scaleToGeodeticHeightN2 = new Cartesian3();
|
|
55
|
-
var
|
|
54
|
+
var scaleToGeodeticHeightP1 = new Cartesian3();
|
|
55
|
+
var scaleToGeodeticHeightP2 = new Cartesian3();
|
|
56
56
|
/**
|
|
57
57
|
* @private
|
|
58
58
|
*/
|
|
59
|
-
PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid) {
|
|
59
|
+
PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
|
|
60
60
|
ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
|
|
61
61
|
|
|
62
62
|
var n1 = scaleToGeodeticHeightN1;
|
|
63
63
|
var n2 = scaleToGeodeticHeightN2;
|
|
64
|
-
var p =
|
|
64
|
+
var p = scaleToGeodeticHeightP1;
|
|
65
|
+
var p2 = scaleToGeodeticHeightP2;
|
|
65
66
|
|
|
66
67
|
if (defined(geometry) && defined(geometry.attributes) && defined(geometry.attributes.position)) {
|
|
67
68
|
var positions = geometry.attributes.position.values;
|
|
@@ -70,20 +71,22 @@ define(['Core/defaultValue', 'Core/defined', 'Core/Cartesian3', 'Core/Ellipsoid'
|
|
|
70
71
|
for ( var i = 0; i < length; i += 3) {
|
|
71
72
|
Cartesian3.fromArray(positions, i, p);
|
|
72
73
|
|
|
73
|
-
ellipsoid.scaleToGeodeticSurface(p, p);
|
|
74
74
|
ellipsoid.geodeticSurfaceNormal(p, n1);
|
|
75
|
+
p2 = ellipsoid.scaleToGeodeticSurface(p, p2);
|
|
76
|
+
n2 = Cartesian3.multiplyByScalar(n1, minHeight, n2);
|
|
77
|
+
n2 = Cartesian3.add(p2, n2, n2);
|
|
78
|
+
positions[i + length] = n2.x;
|
|
79
|
+
positions[i + 1 + length] = n2.y;
|
|
80
|
+
positions[i + 2 + length] = n2.z;
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
if (perPositionHeight) {
|
|
83
|
+
p2 = Cartesian3.clone(p, p2);
|
|
84
|
+
}
|
|
85
|
+
n2 = Cartesian3.multiplyByScalar(n1, maxHeight, n2);
|
|
86
|
+
n2 = Cartesian3.add(p2, n2, n2);
|
|
78
87
|
positions[i] = n2.x;
|
|
79
88
|
positions[i + 1] = n2.y;
|
|
80
89
|
positions[i + 2] = n2.z;
|
|
81
|
-
|
|
82
|
-
Cartesian3.multiplyByScalar(n1, minHeight, n2);
|
|
83
|
-
Cartesian3.add(p, n2, n2);
|
|
84
|
-
positions[i + length] = n2.x;
|
|
85
|
-
positions[i + 1 + length] = n2.y;
|
|
86
|
-
positions[i + 2 + length] = n2.z;
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
return geometry;
|
|
@@ -23,7 +23,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
23
23
|
"use strict";
|
|
24
24
|
var createGeometryFromPositionsPositions = [];
|
|
25
25
|
|
|
26
|
-
function createGeometryFromPositions(ellipsoid, positions, granularity) {
|
|
26
|
+
function createGeometryFromPositions(ellipsoid, positions, granularity, perPositionHeight) {
|
|
27
27
|
var cleanedPositions = PolygonPipeline.removeDuplicates(positions);
|
|
28
28
|
if (cleanedPositions.length < 3) {
|
|
29
29
|
throw new DeveloperError('Duplicate positions result in not enough positions to form a polygon.');
|
|
@@ -37,36 +37,44 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
37
37
|
positions2D.reverse();
|
|
38
38
|
cleanedPositions.reverse();
|
|
39
39
|
}
|
|
40
|
+
|
|
40
41
|
var subdividedPositions = [];
|
|
41
42
|
var length = cleanedPositions.length;
|
|
42
43
|
var i;
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (!perPositionHeight) {
|
|
45
|
+
for (i = 0; i < length; i++) {
|
|
46
|
+
subdividedPositions = subdividedPositions.concat(PolygonGeometryLibrary.subdivideLine(cleanedPositions[i], cleanedPositions[(i + 1) % length], granularity));
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
for (i = 0; i < length; i++) {
|
|
50
|
+
var p0 = cleanedPositions[i];
|
|
51
|
+
var p1 = cleanedPositions[(i + 1) % length];
|
|
52
|
+
subdividedPositions.push(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z);
|
|
53
|
+
}
|
|
45
54
|
}
|
|
46
|
-
subdividedPositions = subdividedPositions.concat(PolygonGeometryLibrary.subdivideLine(cleanedPositions[length-1], cleanedPositions[0], granularity));
|
|
47
55
|
|
|
48
|
-
length = subdividedPositions.length/3;
|
|
49
|
-
var indicesSize = length*2;
|
|
50
|
-
var indices = IndexDatatype.createTypedArray(subdividedPositions.length/3, indicesSize);
|
|
56
|
+
length = subdividedPositions.length / 3;
|
|
57
|
+
var indicesSize = length * 2;
|
|
58
|
+
var indices = IndexDatatype.createTypedArray(subdividedPositions.length / 3, indicesSize);
|
|
51
59
|
var index = 0;
|
|
52
|
-
for (i = 0; i < length-1; i++) {
|
|
60
|
+
for (i = 0; i < length - 1; i++) {
|
|
53
61
|
indices[index++] = i;
|
|
54
|
-
indices[index++] = i+1;
|
|
62
|
+
indices[index++] = i + 1;
|
|
55
63
|
}
|
|
56
|
-
indices[index++] = length-1;
|
|
64
|
+
indices[index++] = length - 1;
|
|
57
65
|
indices[index++] = 0;
|
|
58
66
|
|
|
59
67
|
return new GeometryInstance({
|
|
60
68
|
geometry : new Geometry({
|
|
61
|
-
attributes: new GeometryAttributes({
|
|
62
|
-
position: new GeometryAttribute({
|
|
69
|
+
attributes : new GeometryAttributes({
|
|
70
|
+
position : new GeometryAttribute({
|
|
63
71
|
componentDatatype : ComponentDatatype.DOUBLE,
|
|
64
72
|
componentsPerAttribute : 3,
|
|
65
73
|
values : new Float64Array(subdividedPositions)
|
|
66
74
|
})
|
|
67
75
|
}),
|
|
68
|
-
indices: indices,
|
|
69
|
-
primitiveType: PrimitiveType.LINES
|
|
76
|
+
indices : indices,
|
|
77
|
+
primitiveType : PrimitiveType.LINES
|
|
70
78
|
})
|
|
71
79
|
});
|
|
72
80
|
}
|
|
@@ -75,7 +83,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
75
83
|
var scratchNormal = new Cartesian3();
|
|
76
84
|
var scratchBoundingSphere = new BoundingSphere();
|
|
77
85
|
|
|
78
|
-
function createGeometryFromPositionsExtruded(ellipsoid, positions, granularity) {
|
|
86
|
+
function createGeometryFromPositionsExtruded(ellipsoid, positions, granularity, perPositionHeight) {
|
|
79
87
|
var cleanedPositions = PolygonPipeline.removeDuplicates(positions);
|
|
80
88
|
if (cleanedPositions.length < 3) {
|
|
81
89
|
throw new DeveloperError('Duplicate positions result in not enough positions to form a polygon.');
|
|
@@ -94,25 +102,39 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
94
102
|
var i;
|
|
95
103
|
var corners = new Array(length);
|
|
96
104
|
corners[0] = 0;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
if (!perPositionHeight) {
|
|
106
|
+
for (i = 0; i < length - 1; i++) {
|
|
107
|
+
subdividedPositions = subdividedPositions.concat(PolygonGeometryLibrary.subdivideLine(cleanedPositions[i], cleanedPositions[i + 1], granularity));
|
|
108
|
+
corners[i + 1] = subdividedPositions.length / 3;
|
|
109
|
+
}
|
|
110
|
+
subdividedPositions = subdividedPositions.concat(PolygonGeometryLibrary.subdivideLine(cleanedPositions[length - 1], cleanedPositions[0], granularity));
|
|
111
|
+
} else {
|
|
112
|
+
var p0;
|
|
113
|
+
var p1;
|
|
114
|
+
for (i = 0; i < length - 1; i++) {
|
|
115
|
+
p0 = cleanedPositions[i];
|
|
116
|
+
p1 = cleanedPositions[(i + 1) % length];
|
|
117
|
+
subdividedPositions.push(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z);
|
|
118
|
+
corners[i + 1] = subdividedPositions.length / 3;
|
|
119
|
+
}
|
|
120
|
+
p0 = cleanedPositions[length - 1];
|
|
121
|
+
p1 = cleanedPositions[0];
|
|
122
|
+
subdividedPositions.push(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z);
|
|
100
123
|
}
|
|
101
|
-
subdividedPositions = subdividedPositions.concat(PolygonGeometryLibrary.subdivideLine(cleanedPositions[length-1], cleanedPositions[0], granularity));
|
|
102
124
|
|
|
103
|
-
length = subdividedPositions.length/3;
|
|
104
|
-
var indicesSize = ((length * 2) + corners.length)*2;
|
|
105
|
-
var indices = IndexDatatype.createTypedArray(subdividedPositions.length/3, indicesSize);
|
|
125
|
+
length = subdividedPositions.length / 3;
|
|
126
|
+
var indicesSize = ((length * 2) + corners.length) * 2;
|
|
127
|
+
var indices = IndexDatatype.createTypedArray(subdividedPositions.length / 3, indicesSize);
|
|
106
128
|
var index = 0;
|
|
107
|
-
for (i = 0; i < length-1; i++) {
|
|
129
|
+
for (i = 0; i < length - 1; i++) {
|
|
108
130
|
indices[index++] = i;
|
|
109
|
-
indices[index++] = i+1;
|
|
131
|
+
indices[index++] = i + 1;
|
|
110
132
|
indices[index++] = i + length;
|
|
111
|
-
indices[index++] = i+1 + length;
|
|
133
|
+
indices[index++] = i + 1 + length;
|
|
112
134
|
}
|
|
113
|
-
indices[index++] = length-1;
|
|
135
|
+
indices[index++] = length - 1;
|
|
114
136
|
indices[index++] = 0;
|
|
115
|
-
indices[index++] = length + length-1;
|
|
137
|
+
indices[index++] = length + length - 1;
|
|
116
138
|
indices[index++] = length;
|
|
117
139
|
|
|
118
140
|
for (i = 0; i < corners.length; i++) {
|
|
@@ -125,15 +147,15 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
125
147
|
|
|
126
148
|
return new GeometryInstance({
|
|
127
149
|
geometry : new Geometry({
|
|
128
|
-
attributes: new GeometryAttributes({
|
|
129
|
-
position: new GeometryAttribute({
|
|
150
|
+
attributes : new GeometryAttributes({
|
|
151
|
+
position : new GeometryAttribute({
|
|
130
152
|
componentDatatype : ComponentDatatype.DOUBLE,
|
|
131
153
|
componentsPerAttribute : 3,
|
|
132
154
|
values : new Float64Array(subdividedPositions)
|
|
133
155
|
})
|
|
134
156
|
}),
|
|
135
|
-
indices: indices,
|
|
136
|
-
primitiveType: PrimitiveType.LINES
|
|
157
|
+
indices : indices,
|
|
158
|
+
primitiveType : PrimitiveType.LINES
|
|
137
159
|
})
|
|
138
160
|
});
|
|
139
161
|
}
|
|
@@ -150,6 +172,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
150
172
|
* @param {VertexFormat} [options.vertexFormat=VertexFormat.DEFAULT] The vertex attributes to be computed.
|
|
151
173
|
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
|
|
152
174
|
* @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
|
|
175
|
+
* @param {Boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
|
|
153
176
|
*
|
|
154
177
|
* @exception {DeveloperError} polygonHierarchy is required.
|
|
155
178
|
*
|
|
@@ -228,9 +251,10 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
228
251
|
var ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
|
|
229
252
|
var granularity = defaultValue(options.granularity, CesiumMath.RADIANS_PER_DEGREE);
|
|
230
253
|
var height = defaultValue(options.height, 0.0);
|
|
254
|
+
var perPositionHeight = defaultValue(options.perPositionHeight, false);
|
|
231
255
|
|
|
232
|
-
var extrudedHeight =
|
|
233
|
-
var extrude = (defined(extrudedHeight) && !CesiumMath.equalsEpsilon(height, extrudedHeight, CesiumMath.EPSILON6));
|
|
256
|
+
var extrudedHeight = options.extrudedHeight;
|
|
257
|
+
var extrude = (defined(extrudedHeight) && (!CesiumMath.equalsEpsilon(height, extrudedHeight, CesiumMath.EPSILON6) || perPositionHeight));
|
|
234
258
|
if (extrude) {
|
|
235
259
|
var h = extrudedHeight;
|
|
236
260
|
extrudedHeight = Math.min(h, height);
|
|
@@ -248,6 +272,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
248
272
|
this._extrudedHeight = extrudedHeight;
|
|
249
273
|
this._extrude = extrude;
|
|
250
274
|
this._polygonHierarchy = polygonHierarchy;
|
|
275
|
+
this._perPositionHeight = perPositionHeight;
|
|
251
276
|
this._workerName = 'createPolygonOutlineGeometry';
|
|
252
277
|
};
|
|
253
278
|
|
|
@@ -261,6 +286,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
261
286
|
* @param {Number} [options.extrudedHeight] The height of the polygon extrusion.
|
|
262
287
|
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
|
|
263
288
|
* @param {Number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
|
|
289
|
+
* @param {Boolean} [options.perPositionHeight=false] Use the height of options.positions for each position instead of using options.height to determine the height.
|
|
264
290
|
*
|
|
265
291
|
* @exception {DeveloperError} options.positions is required.
|
|
266
292
|
*
|
|
@@ -293,7 +319,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
293
319
|
height : options.height,
|
|
294
320
|
extrudedHeight : options.extrudedHeight,
|
|
295
321
|
ellipsoid : options.ellipsoid,
|
|
296
|
-
granularity : options.granularity
|
|
322
|
+
granularity : options.granularity,
|
|
323
|
+
perPositionHeight : options.perPositionHeight
|
|
297
324
|
};
|
|
298
325
|
return new PolygonOutlineGeometry(newOptions);
|
|
299
326
|
};
|
|
@@ -315,6 +342,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
315
342
|
var extrudedHeight = polygonGeometry._extrudedHeight;
|
|
316
343
|
var extrude = polygonGeometry._extrude;
|
|
317
344
|
var polygonHierarchy = polygonGeometry._polygonHierarchy;
|
|
345
|
+
var perPositionHeight = polygonGeometry._perPositionHeight;
|
|
318
346
|
|
|
319
347
|
var boundingSphere;
|
|
320
348
|
var outerPositions;
|
|
@@ -344,7 +372,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
344
372
|
numGrandchildren = hole.holes.length;
|
|
345
373
|
}
|
|
346
374
|
|
|
347
|
-
for (var j = 0; j < numGrandchildren; j++) {
|
|
375
|
+
for ( var j = 0; j < numGrandchildren; j++) {
|
|
348
376
|
queue.enqueue(hole.holes[j]);
|
|
349
377
|
}
|
|
350
378
|
}
|
|
@@ -352,7 +380,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
352
380
|
polygons.push(outerRing);
|
|
353
381
|
}
|
|
354
382
|
|
|
355
|
-
outerPositions =
|
|
383
|
+
outerPositions = polygons[0];
|
|
356
384
|
// The bounding volume is just around the boundary points, so there could be cases for
|
|
357
385
|
// contrived polygons on contrived ellipsoids - very oblate ones - where the bounding
|
|
358
386
|
// volume doesn't cover the polygon.
|
|
@@ -363,17 +391,17 @@ define(['Core/defaultValue', 'Core/defined', 'Core/BoundingSphere', 'Core/Cartes
|
|
|
363
391
|
|
|
364
392
|
if (extrude) {
|
|
365
393
|
for (i = 0; i < polygons.length; i++) {
|
|
366
|
-
geometry = createGeometryFromPositionsExtruded(ellipsoid, polygons[i], granularity);
|
|
394
|
+
geometry = createGeometryFromPositionsExtruded(ellipsoid, polygons[i], granularity, perPositionHeight);
|
|
367
395
|
if (defined(geometry)) {
|
|
368
|
-
geometry.geometry = PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(geometry.geometry, height, extrudedHeight, ellipsoid);
|
|
396
|
+
geometry.geometry = PolygonGeometryLibrary.scaleToGeodeticHeightExtruded(geometry.geometry, height, extrudedHeight, ellipsoid, perPositionHeight);
|
|
369
397
|
geometries.push(geometry);
|
|
370
398
|
}
|
|
371
399
|
}
|
|
372
400
|
} else {
|
|
373
401
|
for (i = 0; i < polygons.length; i++) {
|
|
374
|
-
geometry = createGeometryFromPositions(ellipsoid, polygons[i], granularity);
|
|
402
|
+
geometry = createGeometryFromPositions(ellipsoid, polygons[i], granularity, perPositionHeight);
|
|
375
403
|
if (defined(geometry)) {
|
|
376
|
-
geometry.geometry = PolygonPipeline.scaleToGeodeticHeight(geometry.geometry, height, ellipsoid);
|
|
404
|
+
geometry.geometry = PolygonPipeline.scaleToGeodeticHeight(geometry.geometry, height, ellipsoid, !perPositionHeight);
|
|
377
405
|
geometries.push(geometry);
|
|
378
406
|
}
|
|
379
407
|
}
|
|
@@ -882,11 +882,11 @@ define(['Core/DeveloperError', 'Core/Math', 'Core/Cartesian2', 'Core/Cartesian3'
|
|
|
882
882
|
},
|
|
883
883
|
|
|
884
884
|
/**
|
|
885
|
-
*
|
|
885
|
+
* Subdivides positions and raises points to the surface of the ellipsoid.
|
|
886
886
|
*
|
|
887
|
-
* @param {
|
|
888
|
-
* @param {
|
|
889
|
-
* @param {Number} [granularity]
|
|
887
|
+
* @param {Array} positions An array of {@link Cartesian3} positions of the polygon.
|
|
888
|
+
* @param {Array} indices An array of indices that determines the triangles in the polygon.
|
|
889
|
+
* @param {Number} [granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer.
|
|
890
890
|
*
|
|
891
891
|
* @exception {DeveloperError} positions is required.
|
|
892
892
|
* @exception {DeveloperError} indices is required.
|
|
@@ -1053,17 +1053,23 @@ define(['Core/DeveloperError', 'Core/Math', 'Core/Cartesian2', 'Core/Cartesian3'
|
|
|
1053
1053
|
},
|
|
1054
1054
|
|
|
1055
1055
|
/**
|
|
1056
|
-
*
|
|
1056
|
+
* Scales each position of a geometry's position attribute to a height, in place.
|
|
1057
|
+
*
|
|
1058
|
+
* @param {Geometry} geometry The geometry whose positions are to be scaled.
|
|
1059
|
+
* @param {Number} [height=0.0] The desired height to add to the positions of the geometry.
|
|
1060
|
+
* @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the positions lie.
|
|
1061
|
+
* @param {Boolean} [scaleToSurface=true] <code>true</code> if the positions need to be scaled to the surface before the height is added.
|
|
1057
1062
|
*
|
|
1058
|
-
* @
|
|
1063
|
+
* @returns {Geometry} The same geometry whose positions where scaled.
|
|
1059
1064
|
*/
|
|
1060
|
-
scaleToGeodeticHeight : function(geometry, height, ellipsoid) {
|
|
1065
|
+
scaleToGeodeticHeight : function(geometry, height, ellipsoid, scaleToSurface) {
|
|
1061
1066
|
ellipsoid = defaultValue(ellipsoid, Ellipsoid.WGS84);
|
|
1062
1067
|
|
|
1063
1068
|
var n = scaleToGeodeticHeightN;
|
|
1064
1069
|
var p = scaleToGeodeticHeightP;
|
|
1065
1070
|
|
|
1066
1071
|
height = defaultValue(height, 0.0);
|
|
1072
|
+
scaleToSurface = defaultValue(scaleToSurface, true);
|
|
1067
1073
|
|
|
1068
1074
|
if (defined(geometry) && defined(geometry.attributes) && defined(geometry.attributes.position)) {
|
|
1069
1075
|
var positions = geometry.attributes.position.values;
|
|
@@ -1072,8 +1078,12 @@ define(['Core/DeveloperError', 'Core/Math', 'Core/Cartesian2', 'Core/Cartesian3'
|
|
|
1072
1078
|
for ( var i = 0; i < length; i += 3) {
|
|
1073
1079
|
Cartesian3.fromArray(positions, i, p);
|
|
1074
1080
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1081
|
+
if (scaleToSurface) {
|
|
1082
|
+
p = ellipsoid.scaleToGeodeticSurface(p, p);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
n = ellipsoid.geodeticSurfaceNormal(p, n);
|
|
1086
|
+
|
|
1077
1087
|
Cartesian3.multiplyByScalar(n, height, n);
|
|
1078
1088
|
Cartesian3.add(p, n, p);
|
|
1079
1089
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(
|
|
2
|
+
define(function() {
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -9,61 +9,58 @@ define(['Core/Enumeration'], function(Enumeration) {
|
|
|
9
9
|
*/
|
|
10
10
|
var PrimitiveType = {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* 0x0000. Points primitive where each vertex (or index) is a separate point.
|
|
13
13
|
*
|
|
14
|
-
* @type {
|
|
14
|
+
* @type {Number}
|
|
15
15
|
* @constant
|
|
16
|
-
* @default 0x0000
|
|
17
16
|
*/
|
|
18
|
-
POINTS :
|
|
17
|
+
POINTS : 0x0000,
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
19
|
+
* 0x0001. Lines primitive where each two vertices (or indices) is a line segment. Line segments are not necessarily connected.
|
|
21
20
|
*
|
|
22
|
-
* @type {
|
|
21
|
+
* @type {Number}
|
|
23
22
|
* @constant
|
|
24
|
-
* @default 0x0001
|
|
25
23
|
*/
|
|
26
|
-
LINES :
|
|
24
|
+
LINES : 0x0001,
|
|
27
25
|
/**
|
|
28
|
-
*
|
|
26
|
+
* 0x0002. Line loop primitive where each vertex (or index) after the first connects a line to
|
|
27
|
+
* the previous vertex, and the last vertex implicitly connects to the first.
|
|
29
28
|
*
|
|
30
|
-
* @type {
|
|
29
|
+
* @type {Number}
|
|
31
30
|
* @constant
|
|
32
|
-
* @default 0x0002
|
|
33
31
|
*/
|
|
34
|
-
LINE_LOOP :
|
|
32
|
+
LINE_LOOP : 0x0002,
|
|
35
33
|
/**
|
|
36
|
-
*
|
|
34
|
+
* 0x0003. Line strip primitive where each vertex (or index) after the first connects a line to the previous vertex.
|
|
37
35
|
*
|
|
38
|
-
* @type {
|
|
36
|
+
* @type {Number}
|
|
39
37
|
* @constant
|
|
40
|
-
* @default 0x0003
|
|
41
38
|
*/
|
|
42
|
-
LINE_STRIP :
|
|
39
|
+
LINE_STRIP : 0x0003,
|
|
43
40
|
/**
|
|
44
|
-
*
|
|
41
|
+
* 0x0004. Triangles primitive where each three vertices (or indices) is a triangle. Triangles do not necessarily share edges.
|
|
45
42
|
*
|
|
46
|
-
* @type {
|
|
43
|
+
* @type {Number}
|
|
47
44
|
* @constant
|
|
48
|
-
* @default 0x0004
|
|
49
45
|
*/
|
|
50
|
-
TRIANGLES :
|
|
46
|
+
TRIANGLES : 0x0004,
|
|
51
47
|
/**
|
|
52
|
-
*
|
|
48
|
+
* 0x0005. Triangle strip primitive where each vertex (or index) after the first two connect to
|
|
49
|
+
* the previous two vertices forming a triangle. For example, this can be used to model a wall.
|
|
53
50
|
*
|
|
54
|
-
* @type {
|
|
51
|
+
* @type {Number}
|
|
55
52
|
* @constant
|
|
56
|
-
* @default 0x0004
|
|
57
53
|
*/
|
|
58
|
-
TRIANGLE_STRIP :
|
|
54
|
+
TRIANGLE_STRIP : 0x0005,
|
|
59
55
|
/**
|
|
60
|
-
*
|
|
56
|
+
* 0x0006. Triangle fan primitive where each vertex (or index) after the first two connect to
|
|
57
|
+
* the previous vertex and the first vertex forming a triangle. For example, this can be used
|
|
58
|
+
* to model a cone or circle.
|
|
61
59
|
*
|
|
62
|
-
* @type {
|
|
60
|
+
* @type {Number}
|
|
63
61
|
* @constant
|
|
64
|
-
* @default 0x0006
|
|
65
62
|
*/
|
|
66
|
-
TRIANGLE_FAN :
|
|
63
|
+
TRIANGLE_FAN : 0x0006,
|
|
67
64
|
|
|
68
65
|
/**
|
|
69
66
|
* DOC_TBA
|
|
@@ -73,13 +70,13 @@ define(['Core/Enumeration'], function(Enumeration) {
|
|
|
73
70
|
* @returns {Boolean}
|
|
74
71
|
*/
|
|
75
72
|
validate : function(primitiveType) {
|
|
76
|
-
return ((primitiveType
|
|
77
|
-
(primitiveType
|
|
78
|
-
(primitiveType
|
|
79
|
-
(primitiveType
|
|
80
|
-
(primitiveType
|
|
81
|
-
(primitiveType
|
|
82
|
-
(primitiveType
|
|
73
|
+
return ((primitiveType === PrimitiveType.POINTS) ||
|
|
74
|
+
(primitiveType === PrimitiveType.LINES) ||
|
|
75
|
+
(primitiveType === PrimitiveType.LINE_LOOP) ||
|
|
76
|
+
(primitiveType === PrimitiveType.LINE_STRIP) ||
|
|
77
|
+
(primitiveType === PrimitiveType.TRIANGLES) ||
|
|
78
|
+
(primitiveType === PrimitiveType.TRIANGLE_STRIP) ||
|
|
79
|
+
(primitiveType === PrimitiveType.TRIANGLE_FAN));
|
|
83
80
|
}
|
|
84
81
|
};
|
|
85
82
|
|