- Description:
三维基础方法
Example
util.getCameraView(viewer);
Methods
(static) cartesianToLnglat(cartesian, viewer) → {Array}
- Description:
Parameters:
Name |
Type |
Description |
cartesian |
Cesium.Cartesian3
|
世界坐标 |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
经纬度坐标s
-
Type
-
Array
(static) cartesiansToLnglats(cartesians, viewer) → {Array}
- Description:
Parameters:
Name |
Type |
Description |
cartesians |
Array.<Cesium.Cartesian3>
|
世界坐标数组 |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
经纬度坐标数组
-
Type
-
Array
(static) computeAngle(p1, p2) → {Number}
- Description:
Parameters:
Name |
Type |
Description |
p1 |
Cartographic
|
|
p2 |
Cartographic
|
|
Returns:
bearing 角度
-
Type
-
Number
(static) computeArea(positions, viewer) → {Number}
- Description:
Parameters:
Name |
Type |
Description |
positions |
Array.<Cesium.Cartesian3>
|
世界坐标数组 |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
area,面积
-
Type
-
Number
(static) computeAreaOfTriangle(pos1, pos2, pos3) → {Number}
- Description:
Parameters:
Name |
Type |
Description |
pos1 |
Cesium.Cartesian3
|
当前点坐标1 |
pos2 |
Cesium.Cartesian3
|
当前点坐标2 |
pos3 |
Cesium.Cartesian3
|
当前点坐标3 |
Returns:
area,面积
-
Type
-
Number
- Description:
Parameters:
Name |
Type |
Description |
positions |
Array.<Cesium.Cartesian3>
|
世界坐标数组 |
isOn3dtiles |
Boolean
|
是否在模型上 |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
data 返回值,包含uniformArr(对象数组,每个对象中包含当前片元面积及高度),minHeight(当前范围内最小高度),maxHeight(当前范围内最大高度)
-
Type
-
Object
(static) flyTo(opt, viewer)
- Description:
Parameters:
Name |
Type |
Description |
opt |
Object
|
定位参数
Properties
Name |
Type |
Description |
center |
Cartesian3
|
Array
|
当前定位中心点 |
heading |
Number
|
当前定位偏转角度 默认为0 |
pitch |
Number
|
当前定位仰俯角 默认为-60 |
range |
Number
|
当前定位距离 默认为1000米 |
|
viewer |
Cesium.Viewer
|
当前viewer对象 |
(static) get3dtilesHeight(position, viewer) → {Number}
- Description:
Parameters:
Name |
Type |
Description |
position |
Cesium.Cartesian3
|
当前点坐标 |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
height,当前坐标点的高度
-
Type
-
Number
(static) getCameraView(viewer) → {Object}
- Description:
Parameters:
Name |
Type |
Description |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
cameraView 当前相机姿态
-
Type
-
Object
(static) getCirclePointsByAngle(center, aimP, angleopt) → {Array.<Cesium.Cartesian3>}
- Description:
Parameters:
Name |
Type |
Attributes |
Description |
center |
Cesium.Cartesian3
|
|
圆的中心点 |
aimP |
Cesium.Cartesian3
|
|
圆上某点 |
angle |
Number
|
<optional>
|
间隔角度,默认为60° |
Returns:
圆上点坐标数组
-
Type
-
Array.<Cesium.Cartesian3>
(static) getCirclePointsByRadius(center, radius, angleopt) → {Array.<Cesium.Cartesian3>}
- Description:
Parameters:
Name |
Type |
Attributes |
Description |
center |
Cesium.Cartesian3
|
|
圆的中心点 |
radius |
Number
|
|
半径长度 |
angle |
Number
|
<optional>
|
间隔角度,默认为60° |
Returns:
圆上点坐标数组
-
Type
-
Array.<Cesium.Cartesian3>
(static) getIntersectPosition(obj, viewer) → {Cesium.Cartesian3}
- Description:
Parameters:
Name |
Type |
Description |
obj |
Object
|
坐标参数
Properties
Name |
Type |
Description |
startPoint |
Cesium.Cartesian3
|
起点坐标 |
endPoint |
Cesium.Cartesian3
|
终点坐标 |
|
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
交点坐标
-
Type
-
Cesium.Cartesian3
(static) getSlopePosition(center, radiusopt, angleopt, viewer) → {Object}
- Description:
Parameters:
Name |
Type |
Attributes |
Description |
center |
Cesium.Cartesian3
|
|
|
radius |
Number
|
<optional>
|
坡度半径 |
angle |
Number
|
<optional>
|
插值角度 |
viewer |
Cesium.Viewer
|
|
当前viewer对象 |
Returns:
返回坡度起始点坐标、终点坐标以及坡度值
-
Type
-
Object
(static) getTerrainHeight(position, viewer) → {Number}
- Description:
Parameters:
Name |
Type |
Description |
position |
Cesium.Cartesian3
|
当前点坐标 |
viewer |
Cesium.Viewer
|
当前viewer对象 |
Returns:
height,当前坐标点的地形高度
-
Type
-
Number
(static) lerpPositions(positions, granularityopt) → {Array.<Cesium.Cartesian3>}
- Description:
Parameters:
Name |
Type |
Attributes |
Description |
positions |
Array.<Cesium.Cartesian3>
|
|
世界坐标数组 |
granularity |
Number
|
<optional>
|
插值粒度,默认为0.00001,值越小,插值越多 |
Returns:
newPositions 转换后世界坐标数组
-
Type
-
Array.<Cesium.Cartesian3>
(static) lnglatsToCartesians(lnglats) → {Array.<Cesium.Cartesian3>}
- Description:
Example
util.lnglatsToCartesians([[117,40],[118.41]])
Parameters:
Name |
Type |
Description |
lnglats |
Array.<Array>
|
经纬度坐标数组 |
Returns:
cartesians 世界坐标数组
-
Type
-
Array.<Cesium.Cartesian3>
(static) oreatationToHpr(position, orientation, toDegrees) → {Object}
- Description:
- 由四元数计算偏转角(heading)、仰俯角(pitch)、翻滚角(roll)
Parameters:
Name |
Type |
Description |
position |
Cesium.Cartesian3
|
中心点坐标 |
orientation |
Cesium.Quaternion
|
四元数 |
toDegrees |
Boolean
|
true,转化为度 / false,转为弧度 |
Returns:
hpr 姿态参数
-
Type
-
Object
(static) setCameraView(cameraView, viewer)
- Description:
- 设置相机姿态 一般和getCameraView搭配使用
Parameters:
Name |
Type |
Description |
cameraView |
Object
|
相机姿态参数
Properties
Name |
Type |
Description |
duration |
Number
|
定位所需时间 |
|
viewer |
Cesium.Viewer
|
当前viewer对象 |
(static) updatePositionsHeight(positions, h) → {Array.<Cesium.Cartesian3>}
- Description:
Parameters:
Name |
Type |
Description |
positions |
Array.<Cesium.Cartesian3>
|
世界坐标数组 |
h |
Number
|
坐标高度 |
Returns:
newPoisitions 修改高度后的世界坐标数组
-
Type
-
Array.<Cesium.Cartesian3>