初始化坐标转换对象
Name | Type | Description |
---|---|---|
viewer |
Cesium.Viewer |
viewer对象 |
Example:
var ct=new GisEye.CoordinatesTransform(viewer)
var d=ct.cartesian3ToDegrees(new Cesium.Cartesin3(0,0,0))
console.log(d)
See:
Methods
计算等距离的沿线点并且带有每个点的方位角
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> | |
distance |
Number |
Returns:
{position,hpr} 返回坐标点和角度值
Example:
let positions = [ new Cesium.Cartesian3(0,0,0), new Cesium.Cartesian3(1,0,0), new Cesium.Cartesian3(2,0,0) ]
let result = CoordinatesTransform.alongLine(positions, 0.5)
static GisEye.CoordinatesTransform.cartesian3ToDegrees(inCartesian3, viewer, result) → Array|undefined
将笛卡尔坐标转为经纬度坐标
Name | Type | Description |
---|---|---|
inCartesian3 |
Cartesian3 |
需要转换的笛卡尔坐标 |
viewer |
Viewer |
viewer对象 |
result |
Array |
返回值例如:[102,23,100] |
Returns:
返回转换后的经纬度坐标例如:[102,23,100]
static GisEye.CoordinatesTransform.cartesian3ToWindowPosition(inCartesian3, viewer, result) → Cartesian2|undefined
笛卡尔坐标转为屏幕坐标
Name | Type | Description |
---|---|---|
inCartesian3 |
Cartesian3 |
需要转换的笛卡尔坐标 |
viewer |
Viewer |
viewer对象 |
result |
Cartesian2 |
返回的屏幕坐标 |
Returns:
返回转换后的屏幕坐标
static GisEye.CoordinatesTransform.cartograhphicToWindowPosition(inCartographic, viewer, result) → Cartesian2|undefined
弧度制的地理坐标转换为屏幕坐标
Name | Type | Description |
---|---|---|
inCartographic |
Cartographic |
需要转换的弧度制地理坐标 |
viewer |
Viewer |
viewer对象 |
result |
Cartesian2 |
返回的屏幕坐标 |
Returns:
返回转换后的屏幕坐标
static GisEye.CoordinatesTransform.degreesToWindowPosition(inDegrees, viewer, result) → Cartesian2|undefined
经纬度转屏幕坐标
Name | Type | Description |
---|---|---|
inDegrees |
object |
需要转换的经纬度值的对象 |
viewer |
Viewer |
viewer对象 |
result |
Cartesian2 |
返回的屏幕坐标 |
Returns:
返回转换后的屏幕坐标
static GisEye.CoordinatesTransform.getAlongLineDistancePoint(positions, distance) → Object|undefined
获取从起始点开始的沿线距离处的坐标和角度(沿线的)信息
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> |
点集合 |
distance |
Number |
距离起点的距离 |
Returns:
获取两个点之间的距离,包括空间距离、水平距离、垂直距离,以及垂足的点数据,垂足为高度低点所在的水平面的垂足点
Name | Type | Description |
---|---|---|
pointA |
Cartesina3 |
点A |
pointB |
Cartesina3 |
点B |
Returns:
height是垂直高度,diantanceH是水平距离,diantanceS是空间距离,hypPoint是垂足点
Example:
let result = CoordinatesTransform.getDistance(new Cesium.Cartesian3(0,0,0), new Cesium.Cartesian3(1,1,1))
console.log(result.height, result.diantanceH, result.diantanceS, result.hypPoint)
根据两点获取偏航角
Name | Type | Description |
---|---|---|
pointA |
Cartesian3 |
A点 |
pointB |
Cartesian3 |
B点 |
Returns:
heading 单位是弧度制的
Example:
GisEye.CoordinatesTransform.getHeading(new Cesium.Cartesian3(0,0,0),new Cesium.Cartesian3(1,0,0))
根据两点获取方位角和俯仰角
Name | Type | Description |
---|---|---|
pointA |
Cartesian3 |
点A |
pointB |
Cartesian3 |
点B |
Returns:
返回带有heading和pitch的对象,如果点A和点B相等那么返回undefined
计算两点间的方位角俯仰角以及旋转角
Name | Type | Description |
---|---|---|
pointA |
Cartesian3 |
点A |
pointB |
Cartesian3 |
点B |
Returns:
返回方位角俯仰角以及旋转角
计算线的空间长度
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> |
坐标点 |
flagDis |
Boolean |
是否计算长度 |
Returns:
计算的距离值,如果传入的坐标不是数组返回undefined
获取点到线的最短距离,返回的结果始终是在线上
Name | Type | Description |
---|---|---|
positions |
Array.<Cartesian3> |
线的坐标点 |
point |
Cartesina3 |
需要计算的坐标点 |
Returns:
{position,distance} 其中position是点到线的最短距离的点,distance是距离
获取两点的俯仰角
Name | Type | Description |
---|---|---|
pointA |
Cartesian3 |
点A |
pointB |
Cartesian3 |
点B |
Returns:
返回俯仰角,单位弧度制
对entity进行旋转和平移,旋转只针对于方位角的旋转,平移是x、y、z三个方向的设值, 只针对于设置了position的entity生效,polygon、polyline这样的不会生效
Name | Type | Description |
---|---|---|
entity |
Entity |
需要处理的entity |
angle |
Number |
旋转角度,这是一个增量值,不是定义值, 也就是说不是旋转到这个度数的角度,而是旋转这么多角度。单位度 |
tranlation |
Cartesian3 |
要平移的距离 |
Returns:
返回旋转屏以后的entity对象
Throws:
-
entity 未定义
-
传入的entity参数不是Cesium.Entity类型的
Example:
GisEye.CoordinatesTransform.rotationAndTranlationEntity(entity,30,new Cesium.Cartesian3(10,0,10))
static GisEye.CoordinatesTransform.translate(position, offset, matrix4, result) → Cartesian3|undefined
指定偏移矩阵将点偏移
Name | Type | Default | Description |
---|---|---|---|
position |
Cartesian3 |
需要偏移的原始点位 |
|
offset |
Cartesina3 |
偏移值 |
|
matrix4 |
Matrix4 |
Cesium.Transforms.eastNorthUpToFixedFrame(position)
|
optional
原始矩阵4x4 |
result |
Cartesina3 |
返回值 |
Returns:
返回偏移后的笛卡尔坐标
Example:
GisEye.CoordinatesTransform.translate(Cesium.Cartesian3.fromDegrees(103,29,10),new Cesium.Cartesian3(10,0,100),undefined,new Cesium.Cartesian3())
static GisEye.CoordinatesTransform.windowPositionToCartesian3(inCartesian2, viewer, result) → Cartesian3|undefined
屏幕坐标转为笛卡尔坐标
Name | Type | Description |
---|---|---|
inCartesian2 |
Cartesian2 |
屏幕坐标 |
viewer |
Viewer |
viewer对象 |
result |
Cartesian3 |
返回值 |
Returns:
返回转换后的笛卡尔坐标
static GisEye.CoordinatesTransform.windowPositionToCartographic(inCartesian2, viewer, result) → Cartographic|undefined
屏幕坐标转为弧度制的
Name | Type | Description |
---|---|---|
inCartesian2 |
Cartesian2 |
屏幕坐标 |
viewer |
Viewer |
viewer对象 |
result |
Cartographic |
返回值 |
Returns:
返回转换后的弧度制地理坐标
static GisEye.CoordinatesTransform.windowPositionToDegrees(inCartesian2, viewer, result) → object|undefined
将屏幕坐标转为经纬度值
Name | Type | Description |
---|---|---|
inCartesian2 |
Cartesian2 |
需要转换的屏幕坐标 |
viewer |
Viewer |
viewer对象 |
result |
object |
返回值 |
Returns:
返回转换后的经纬度坐标
将笛卡尔坐标转为经纬度坐标
Name | Type | Description |
---|---|---|
inCartesian3 |
Cartesian3 |
需要转换的笛卡尔坐标 |
result |
Array |
返回值例如:[102,23,100] |
Returns:
返回转换后的经纬度坐标返回转换后的经纬度坐标例如:[102,23,100]
笛卡尔坐标转为屏幕坐标
Name | Type | Description |
---|---|---|
inCartesian3 |
Cartesian3 |
需要转换的笛卡尔坐标 |
result |
Cartesian2 |
返回的屏幕坐标 |
Returns:
返回转换后的屏幕坐标
屏幕坐标转为笛卡尔坐标
Name | Type | Description |
---|---|---|
inCartesian2 |
Cartesian2 |
屏幕坐标 |
result |
Cartesian3 |
返回值 |
Returns:
返回转换后的笛卡尔坐标
屏幕坐标转为弧度制的
Name | Type | Description |
---|---|---|
inCartesian2 |
Cartesian2 |
屏幕坐标 |
result |
Cartographic |
返回值 |
Returns:
返回转换后的弧度制地理坐标
将屏幕坐标转为经纬度值
Name | Type | Description |
---|---|---|
inCartesian2 |
Cartesian2 |
需要转换的屏幕坐标 |
result |
object |
返回值 |
Returns:
返回转换后的经纬度坐标