util/projection

projection

Members

(inner) world2localMtx

地球上pick到的点坐标转换到图层局部坐标系下

Methods

(static) CalMatrixByZprj(zprj) → {Cesium.Matrix4}

根据zprj配置生成模型矩阵

Examples
// 手动校准
let zprj = {
  way: "manual",
  x: 0.0,
  y: 0.0,
  longitudeDegree: 120.0,
  latitudeDegree: 32.0,
  translate: {
    x: 0.0,
    y: 0.0,
    z: 0.0
  },
 rotate: {
    x: 0.0,
    y: 0.0,
    z: 0.0
  },
 scale: {
    x: 1.0,
    y: 1.0,
    z: 1.0
  }
}
// 自动校准
let zprj = {
  way: "auto",
  x: 500742.87,
  y: 3351182.95,
  epsgId: 4549,
  translate: {
    x: 0.0,
    y: 0.0,
    z: 0.0
  },
 rotate: {
    x: 0.0,
    y: 0.0,
    z: 0.0
  },
 scale: {
    x: 1.0,
    y: 1.0,
    z: 1.0
  }
}
// 不需要校准,只计算平移旋转缩放
let zprj = {
  way: "globe",
  longitudeDegree: 120.0,
  latitudeDegree: 32.0,
  translate: {
    x: 0.0,
    y: 0.0,
    z: 0.0
  },
 rotate: {
    x: 0.0,
    y: 0.0,
    z: 0.0
  },
 scale: {
    x: 1.0,
    y: 1.0,
    z: 1.0
  }
}
Parameters:
Name Type Description
zprj Object
Properties
Name Type Attributes Default Description
way String

校准方式

x Number

基准点投影坐标的x值

y Number

基准点投影坐标的y值

longitudeDegree Number <optional>

在手动计算时,基准点地理坐标的经度值

latitudeDegree Number <optional>

在手动计算时,基准点地理坐标的纬度值

elevation Number <optional>
0

基准点地理坐标的海拔, 计算沿x和y的旋转时用

epsgId Number <optional>

在自动计算时, 对应的EPSGID值

translate Object <optional>

基于基准点的平移

Properties
Name Type Attributes Default Description
x Number <optional>
0

平移的x值

y Number <optional>
0

平移的y值

z Number <optional>
0

平移的z值

rotate Object <optional>

基于基准点的旋转

Properties
Name Type Attributes Default Description
x Number <optional>
0

旋转的x值

y Number <optional>
0

旋转的y值

z Number <optional>
0

旋转的z值

scale Object <optional>

基于基准点的缩放

Properties
Name Type Attributes Default Description
x Number <optional>
1.0

缩放的x值

y Number <optional>
1.0

缩放的y值

z Number <optional>
1.0

缩放的z值

Returns:

变换矩阵

Type
Cesium.Matrix4

(static) localPos2WorldPos(localPt, tileset) → {Cartesian3}

图层局部坐标系下的点转换成地球上的点

Parameters:
Name Type Description
localPt Cartesian3

局部坐标系下的点

tileset Cesium3DTileset

要变换到哪个图层的地球坐标

Returns:

局部坐标对应的地球坐标

Type
Cartesian3

(inner) CoordinateProject(epsgIdFromopt, epsgIdToopt, coordinatesopt) → {array}

坐标系转换: 支持的EpsgId对应投影坐标系有 CGCS2000/WGS_1984_UTM/Xian_1980/Beijing_1954/New_Beijing

Parameters:
Name Type Attributes Description
epsgIdFrom Number <optional>

epsgId 形如: 4326

epsgIdTo Number <optional>

epsgId 形如: 3857

coordinates array <optional>

坐标 形如: [106,32]

Returns:
Type
array

(inner) GetMatrix4Rotation(matrix4, result) → {Cesium.Matrix3}

假设矩阵是仿射变换,提取旋转矩阵

Parameters:
Name Type Description
matrix4 Cesium.Matrix4

原矩阵.

result Cesium.Matrix3

提取的变换矩阵.

Returns:

提取的变换矩阵.

Type
Cesium.Matrix3

(inner) getScaleFromMatrix4(matrix4, result) → {Cesium.Cartesian3}

假设矩阵是仿射变换,提取缩放系数

Parameters:
Name Type Description
matrix4 Cesium.Matrix4

原矩阵.

result Cesium.Cartesian3

提取的缩放系数.

Returns:

提取的缩放系数.

Type
Cesium.Cartesian3

(inner) ProjectToCartesian3(ptProject, epsgId) → {Cartesian3}

投影坐标转球心坐标

Parameters:
Name Type Description
ptProject Cartesian3

投影坐标

epsgId Number

EPSGID

Returns:

球心坐标

Type
Cartesian3

(inner) ProjectToLonlat(ptProject, epsgId) → {Cartesian3}

投影坐标转经纬度

Parameters:
Name Type Description
ptProject Cartesian3

投影坐标

epsgId Number

EPSGID

Returns:

经纬度

Type
Cartesian3