椭球上一个多边形的描述。这个多边形通过polygon hierarchy定义的。Polygon geometry既可以通过Primitive也可以通过GroundPrimitive来进行渲染
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
对象具有以下属性:
|
- PolygonGeometry#createGeometry
- PolygonGeometry#fromPositions
Example:
// 1. 利用点创建一个多边形
var polygon = new LSGlobe.PolygonGeometry({
polygonHierarchy : new LSGlobe.PolygonHierarchy(
LSGlobe.Cartesian3.fromDegreesArray([
-72.0, 40.0,
-70.0, 35.0,
-75.0, 30.0,
-70.0, 30.0,
-68.0, 40.0
])
)
});
var geometry = LSGlobe.PolygonGeometry.createGeometry(polygon);
// 2. 创建一个带洞的嵌套多边形
var polygonWithHole = new LSGlobe.PolygonGeometry({
polygonHierarchy : new LSGlobe.PolygonHierarchy(
LSGlobe.Cartesian3.fromDegreesArray([
-109.0, 30.0,
-95.0, 30.0,
-95.0, 40.0,
-109.0, 40.0
]),
[new LSGlobe.PolygonHierarchy(
LSGlobe.Cartesian3.fromDegreesArray([
-107.0, 31.0,
-107.0, 39.0,
-97.0, 39.0,
-97.0, 31.0
]),
[new LSGlobe.PolygonHierarchy(
LSGlobe.Cartesian3.fromDegreesArray([
-105.0, 33.0,
-99.0, 33.0,
-99.0, 37.0,
-105.0, 37.0
]),
[new LSGlobe.PolygonHierarchy(
LSGlobe.Cartesian3.fromDegreesArray([
-103.0, 34.0,
-101.0, 34.0,
-101.0, 36.0,
-103.0, 36.0
])
)]
)]
)]
)
});
var geometry = LSGlobe.PolygonGeometry.createGeometry(polygonWithHole);
// 3. 创建一个拉伸多边形
var extrudedPolygon = new LSGlobe.PolygonGeometry({
polygonHierarchy : new LSGlobe.PolygonHierarchy(
LSGlobe.Cartesian3.fromDegreesArray([
-72.0, 40.0,
-70.0, 35.0,
-75.0, 30.0,
-70.0, 30.0,
-68.0, 40.0
])
),
extrudedHeight: 300000
});
var geometry = LSGlobe.PolygonGeometry.createGeometry(extrudedPolygon);
Demo:
See:
Members
-
用于将对象打包到数组的元素数量
Methods
-
计算出一个多边形的几何化表述。包括它的顶点、索引和包围球
Name Type Description polygonGeometryPolygonGeometry 多边形的描述 Returns:
计算出来的顶点和索引信息 -
staticLSGlobe.PolygonGeometry.fromPositions(options) → PolygonGeometry
-
由一组点创建的多边形的描述。Polygon geometry既可以通过Primitive也可以通过GroundPrimitive来进行渲染
Name Type Description optionsObject 对象具有以下属性 Name Type Default Description positionsArray.<Cartesian3> 定义多边形的边的一组点 heightNumber 0.0optional 多边形的高度 extrudedHeightNumber optional 多边形的拉伸高度 vertexFormatVertexFormat VertexFormat.DEFAULToptional 参与计算的顶点属性 stRotationNumber 0.0optional 纹理坐标的旋转(弧度)。逆时针是正方向 ellipsoidEllipsoid Ellipsoid.WGS84optional 参考椭球 granularityNumber CesiumMath.RADIANS_PER_DEGREEoptional 表示单位经纬度之间的距离(单位是弧度)。它决定了缓存中位置的数量 perPositionHeightBoolean falseoptional 对于每个位置点采用height参数(采用经纬高三个参数决定一个点) closeTopBoolean trueoptional 当值为false时,拉伸多边形的顶部不封闭 closeBottomBoolean trueoptional 当值为false时,拉伸多边形的底部不封闭 Returns:
- PolygonGeometry#createGeometry
Example:
// 由点创建一个多边形 var polygon = LSGlobe.PolygonGeometry.fromPositions({ positions : LSGlobe.Cartesian3.fromDegreesArray([ -72.0, 40.0, -70.0, 35.0, -75.0, 30.0, -70.0, 30.0, -68.0, 40.0 ]) }); var geometry = LSGlobe.PolygonGeometry.createGeometry(polygon);See:
-
由点创建一个多边形
Name Type Default Description valuePolygonGeometry 要打包的值 arrayArray.<Number> 要打包的数组 startingIndexNumber 0optional 在数组中开始打包元素的索引 Returns:
被打包的数组 -
从打包数组中检索实例
Name Type Default Description arrayArray.<Number> 打包的数组 startingIndexNumber 0optional 要解包的元素的起始索引 resultPolygonGeometry optional 存储结果的对象
