麻辣GIS微信平台

更多 GIS 干货

微信关注不错过

Cesium API - RectangleGeometry 中文文档

本文介绍下Cesium中 RectangleGeometry API的详细使用说明。

RectangleGeometry API 调用方法

new Cesium.RectangleGeometry(options)
在以原点为中心的椭球体上绘制的矩形的描述。 矩形几何图形可以用PrimitiveGroundPrimitive来绘制。
Name Type Description
options Object 对象,具有以下属性:
Name Type Default Description
rectangle Rectangle 东西南北四个属性的地图矩形,以弧度为单位。
vertexFormat VertexFormat VertexFormat.DEFAULT optional 要计算的顶点属性。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 矩形所在的椭球面。
granularity Number CesiumMath.RADIANS_PER_DEGREE optional 每个经度和纬度之间的距离,以弧度表示。确定缓冲区中的位置数。
height Number 0.0 optional 以米为单位的矩形和椭球面之间的距离。
rotation Number 0.0 optional 矩形的旋转,以弧度为单位。正的旋转是逆时针的。
stRotation Number 0.0 optional 纹理坐标的旋转,以弧度为单位。正的旋转是逆时针的。
extrudedHeight Number optional 矩形的挤压面与椭球面的距离,单位为米。
异常情况:
  • DeveloperError : options.rectangle.north 必须在 [-Pi/2, Pi/2]区间内。
  • DeveloperError : options.rectangle.south 必须在 [-Pi/2, Pi/2]区间内。
  • DeveloperError : options.rectangle.east 必须在 [-Pi, Pi]区间内。
  • DeveloperError : options.rectangle.west 必须在 [-Pi, Pi]区间内。
  • DeveloperError : options.rectangle.north 必须大于 options.rectangle.south
示例:
// 1. 创建一个矩形
var rectangle = new Cesium.RectangleGeometry({
  ellipsoid : Cesium.Ellipsoid.WGS84,
  rectangle : Cesium.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0),
  height : 10000.0
});
var geometry = Cesium.RectangleGeometry.createGeometry(rectangle);
// 2. 创建一个没有顶部的挤压矩形
var rectangle = new Cesium.RectangleGeometry({
  ellipsoid : Cesium.Ellipsoid.WGS84,
  rectangle : Cesium.Rectangle.fromDegrees(-80.0, 39.0, -74.0, 42.0),
  height : 10000.0,
  extrudedHeight: 300000
});
var geometry = Cesium.RectangleGeometry.createGeometry(rectangle);
演示Demo:
参考:
  • RectangleGeometry#createGeometry

成员变量

staticCesium.RectangleGeometry.packedLength : Number
用于将对象打包成数组的元素数。

内置方法

staticCesium.RectangleGeometry.computeRectangle(options, result)Rectangle
根据提供的options计算包围框。
Name Type Description
options Object 对象,具有以下属性:
Name Type Default Description
rectangle Rectangle 东西南北四个属性的地图矩形,以弧度为单位。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 矩形所在的椭球面。
granularity Number CesiumMath.RADIANS_PER_DEGREE optional 每个经度和纬度之间的距离,以弧度表示。确定缓冲区中的位置数。
rotation Number 0.0 optional 矩形的旋转,以弧度为单位。正的旋转是逆时针的。
result Rectangle optional 存储结果的对象。
返回值:
结果矩形。
staticCesium.RectangleGeometry.createGeometry(rectangleGeometry)Geometry|undefined
计算矩形的几何表示,包括其顶点、索引和包围球。
Name Type Description
rectangleGeometry RectangleGeometry 矩形的描述。
返回值:
计算的顶点和索引。
staticCesium.RectangleGeometry.pack(value, array, startingIndex)Array.<Number>
将提供的实例存储到提供的数组中。
Name Type Default Description
value RectangleGeometry 要包装的值。
array Array.<Number> 要被包装到的数组。
startingIndex Number 0 optional 开始包装元素的数组索引。
返回值:
被包装到的数组。
staticCesium.RectangleGeometry.unpack(array, startingIndex, result)RectangleGeometry
从已包装的数组中检索实例。
Name Type Default Description
array Array.<Number> 包装的数组。
startingIndex Number 0 optional 要解包的元素的起始索引。
result RectangleGeometry optional 存储结果的对象。
返回值:
修改后的结果参数或新的RectangleGeometry实例(如果没有提供)。

其他API

Cesium中文API文档手册(v1.63.1版本)参考:《Cesium中文API文档手册(v1.63.1版本)

相关阅读

麻辣GIS-Sailor

作者:

GIS爱好者,学GIS,更爱玩GIS。

声明

1.本文所分享的所有需要用户下载使用的内容(包括但不限于软件、数据、图片)来自于网络或者麻辣GIS粉丝自行分享,版权归该下载资源的合法拥有者所有,如有侵权请第一时间联系本站删除。

2.下载内容仅限个人学习使用,请切勿用作商用等其他用途,否则后果自负。

手机阅读
公众号关注
知识星球
手机阅读
麻辣GIS微信公众号关注
最新GIS干货
关注麻辣GIS知识星球
私享圈子

留言板(小编看到第一时间回复)