@snowemperor/cesium-core
v0.2.6
Published
Cesium initialization and common utilities
Downloads
704
Readme
Classes
Functions
Typedefs
Measure
测量工具 - 距离、面积、高度测量
Kind: global class
new Measure()
测量计算
Example
import { Measure } from "cesium-core";
const measure = new Measure(viewer);
measure.drawLineMeasureGraphics(); // 测量距离
measure.drawAreaMeasureGraphics(); // 测量面积
measure.drawTrianglesMeasureGraphics(); // 三角测量高度
measure.destroy(); // 销毁
measure.clear(); // 清除measure.transformWGS84ToCartographic(position) ⇒ Object
84坐标转弧度坐标
Kind: instance method of Measure
Returns: Object - Cartographic 弧度坐标
| Param | Type | Description | | --- | --- | --- | | position | Object | wgs84 |
measure.getCatesian3FromPX(px) ⇒ Object
拾取位置点
Kind: instance method of Measure
Returns: Object - Cartesian3 三维坐标
| Param | Type | Description | | --- | --- | --- | | px | Object | 屏幕坐标 |
measure.getPositionDistance(positions)
获取84坐标的距离
Kind: instance method of Measure
| Param | Type | | --- | --- | | positions | * |
measure.getPositionsArea(positions)
计算一组坐标组成多边形的面积
Kind: instance method of Measure
| Param | Type | | --- | --- | | positions | * |
measure.drawLineMeasureGraphics(options)
测距
Kind: instance method of Measure
| Param | Type | Description | | --- | --- | --- | | options | * | 默认即可暂时可以不传递 | | options.width | * | 线宽 | | options.material | * | 线颜色 | | options.clampToGround | * | 是否贴地 | | options.callback | * | 回调函数 |
measure.drawAreaMeasureGraphics(options)
测面积
Kind: instance method of Measure
| Param | Type | | --- | --- | | options | * |
measure.drawTrianglesMeasureGraphics(options)
画三角量测
Kind: instance method of Measure
| Param | Type | | --- | --- | | options | * |
measure.destroy()
销毁
Kind: instance method of Measure
measure.clear()
清除
Kind: instance method of Measure
CreateCustomSensor
载荷创建类 —— 创建各种卫星载荷工具(SAR、六边形、多波束等)
Kind: global class
- CreateCustomSensor
- new CreateCustomSensor()
- instance
- .removeSensorFromSatellite(id, isCzml, czmlIndex)
- .InitCreateSarOrCurtomSensor(isSar, isConicCustom, isHexagonal)
- .createSARSensor(id, oHalfAngle, iHalfAngle, maxRoll, radius, isMount, isRadians, isCzml, czmlIndex, orienMark)
- .createConicSensorByCustom(id, isClusterBeams, beamsArr, isCzml, czmlIndex, bigCircleAngle, smallBeamAngle, radius, isMount, orienMark)
- .createHexagonalSensorByCustom(id, isHexagonalClusterBeams, beamsArr, isCzml, czmlIndex, bigCircleAngle, smallHalfAngleDeg, radius, isMount, orienMark)
- .createConicSensor(id, halfAngle, radius, isCzml, czmlIndex, isMount, orienMark) ⇒ *
- .createRectSensor(id, yHalfAngle, xHalfAngle, radius, isCzml, czmlIndex, isMount, orienMark) ⇒ *
- .constrollOrientationOnlyRoll(id, rollAngle, isCzml, czmlIndex)
- .constrollOrientationByHeadingPitchRoll(id, rotationValues, isCzml, czmlIndex)
- .constrollOrientationByFromRotation(id, rotationValues, isCzml, czmlIndex)
- .initSlerpControl(id, rollAngle, durationSeconds, isCzml, czmlIndex)
- .toggleSatelliteSideLook(id)
- static
- .autobind(instance)
- .judgeEntityHasOrientation(satelliteEntity, orienMark)
- .createDependenceSARSensor(id, satelliteEntity, oHalfAngle, iHalfAngle, maxRoll, radius, isRadians)
- .createIndependentSARSensor(id, satelliteEntity, oHalfAngle, iHalfAngle, maxRoll, radius, isRadians)
- .createDependenceConicCustom(id, satelliteEntity, beams, radius)
- .createIndependentConicCustom(id, satelliteEntity, beams, radius)
- .createDependenceHexagonalCustom(id, satelliteEntity, beams, radius)
- .createIndependentHexagonalCustom(id, satelliteEntity, beams, radius)
- .createDependenceConicSensor(id, satelliteEntity, halfAngle, radius)
- .createIndependentConicSensor(id, satelliteEntity, halfAngle, radius)
- .createDependenceRectSensor(id, satelliteEntity, yHalfAngle, xHalfAngle, radius)
- .createIndependentRectSensor(id, satelliteEntity, yHalfAngle, xHalfAngle, radius)
- .generateClusterBeams(bigHalfAngleDeg, smallHalfAngleDeg) ⇒ Array
- .generateHexagonalClusterBeams(bigHalfAngleDeg, smallHexHalfAngleDeg)
- .convertStkSarToCesiumParams(stkEleMin, stkEleMax, stkExclForward, stkExclAft) ⇒ Object
new CreateCustomSensor()
载荷创建类 —— 创建各种卫星载荷工具(SAR、六边形、多波束等)
Example
import { CreateCustomSensor } from "cesium-core";
let customSensor = new CreateCustomSensor();
customSensor.InitCreateSarOrCurtomSensor(true, true, false);
initCesium(viewer)初始化完毕后,调用以下方法
customSensor.setViewer(viewer);
创建自定义SAR传感器
customSensor.createSARSensor('Satellite/Satellite3',10,72,2,2e7,true,false,true,0,'HPR');
普通圆形载荷
var cone = customSensor.createConicSensor('Satellite/Satellite3',10,2e7,false,0,true,'HPR')
普通矩形载荷
var rect = customSensor.createRectSensor('Satellite/Satellite3',2,4,2e7,false,0,true,'HPR')
自定义圆形载荷(不覆盖圆形范围)
customSensor.createConicSensorByCustom('Satellite/Satellite3',false,[
{ pitch: 0, roll: 0, halfAngle: Cesium.Math.toRadians(10) },
{
pitch: 0,
roll: Cesium.Math.toRadians(20),
halfAngle: Cesium.Math.toRadians(5),
},
{
pitch: 0,
roll: Cesium.Math.toRadians(-20),
halfAngle: Cesium.Math.toRadians(5),
},
{
pitch: Cesium.Math.toRadians(20),
roll: 0,
halfAngle: Cesium.Math.toRadians(5),
},
{
pitch: Cesium.Math.toRadians(-20),
roll: 0,
halfAngle: Cesium.Math.toRadians(5),
},
],false,0,10,2.5,2e7,true,'HPR')
自定义圆形载荷(覆盖圆形范围)
customSensor.createConicSensorByCustom('Satellite/Satellite3',true,[],false,0,10,2.5,2e7,true,'HPR')
自定义矩形载荷(不覆盖圆形范围)
customSensor.createHexagonalSensorByCustom('Satellite/Satellite3',false,[
{ pitch: 0, roll: 0, halfAngle: Cesium.Math.toRadians(10) },
{
pitch: 0,
roll: Cesium.Math.toRadians(20),
halfAngle: Cesium.Math.toRadians(5),
},
{
pitch: 0,
roll: Cesium.Math.toRadians(-20),
halfAngle: Cesium.Math.toRadians(5),
},
{
pitch: Cesium.Math.toRadians(20),
roll: 0,
halfAngle: Cesium.Math.toRadians(5),
},
{
pitch: Cesium.Math.toRadians(-20),
roll: 0,
halfAngle: Cesium.Math.toRadians(5),
},
],false,0,20,2,2e7,true,'HPR')
自定义矩形载荷(覆盖圆形范围)
customSensor.createHexagonalSensorByCustom('Satellite/Satellite3',true,[],false,0,20,2,2e7,true,'HPR')createCustomSensor.removeSensorFromSatellite(id, isCzml, czmlIndex)
从卫星上移除传感器载荷
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | String | | 卫星实体的 ID | | isCzml | Boolean | false | 是否为 CZML 数据源中的实体 | | czmlIndex | Number | String | 0 | CZML 数据源的索引或名称 |
createCustomSensor.InitCreateSarOrCurtomSensor(isSar, isConicCustom, isHexagonal)
创建自定义sensor初始化函数
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | isSar | * | false | 是否初始化SAR | | isConicCustom | * | false | 是否初始化自定义圆锥 | | isHexagonal | * | false | 是否初始化自定义六边形 |
createCustomSensor.createSARSensor(id, oHalfAngle, iHalfAngle, maxRoll, radius, isMount, isRadians, isCzml, czmlIndex, orienMark)
创建自定义SAR载荷
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | 卫星ID | | oHalfAngle | * | | 内角 度 | | iHalfAngle | * | | 外角 度 | | maxRoll | * | 2 | 厚度 度 | | radius | * | 20000000 | 半径 米 | | isMount | * | true | 是否挂载到卫星实体 | | isRadians | * | false | 弧度单位标志 | | isCzml | * | false | 是否是CZML实体 | | czmlIndex | * | 0 | CZML索引 | | orienMark | * | HPR | 姿态标志位 NONE Velocity HPR |
createCustomSensor.createConicSensorByCustom(id, isClusterBeams, beamsArr, isCzml, czmlIndex, bigCircleAngle, smallBeamAngle, radius, isMount, orienMark)
自定义多波束载荷
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | 卫星ID | | isClusterBeams | * | false | 是否是聚类模式,true 则生成聚类模式的多波束载荷,false 则生成自定义多波束载荷 | | beamsArr | * | | 圆形集合 包含pitch roll halfAngle pitch 俯仰 roll偏航角 单位 弧度 | | isCzml | * | false | 是否是CZML实体 | | czmlIndex | * | 0 | CZML索引 | | bigCircleAngle | * | 10 | 大圆形的半径角度 度 (需要覆盖的区域角度) | | smallBeamAngle | * | 2.5 | 小圆形的半径角度 度 | | radius | * | 20000000 | 半径 米 | | isMount | * | true | 是否挂载到卫星实体 | | orienMark | * | HPR | 姿态标志位 NONE Velocity HPR |
createCustomSensor.createHexagonalSensorByCustom(id, isHexagonalClusterBeams, beamsArr, isCzml, czmlIndex, bigCircleAngle, smallHalfAngleDeg, radius, isMount, orienMark)
自定义六边形多波束载荷
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | 卫星ID | | isHexagonalClusterBeams | * | false | 是否是聚类模式,true 则生成聚类模式的多波束载荷,false 则生成自定义多波束载荷 | | beamsArr | * | | 六边形集合 包含pitch roll halfAngle pitch 俯仰 roll偏航角 单位 弧度 | | isCzml | * | false | 是否是CZML实体 | | czmlIndex | * | 0 | CZML索引 | | bigCircleAngle | * | 20 | 大圆形的半径角度 度 (需要覆盖的区域角度) | | smallHalfAngleDeg | * | 2 | 小六边形的半径角度 度 | | radius | * | 20000000 | 半径 米 | | isMount | * | true | 是否挂载到卫星实体 | | orienMark | * | HPR | 姿态标志位 NONE Velocity HPR |
createCustomSensor.createConicSensor(id, halfAngle, radius, isCzml, czmlIndex, isMount, orienMark) ⇒ *
创建卫星圆形载荷
Kind: instance method of CreateCustomSensor
Returns: * - 载荷实体
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | 卫星ID | | halfAngle | * | | 半角 度 | | radius | * | 20000000 | 半径 米 | | isCzml | * | true | 是否是CZML实体 | | czmlIndex | * | 0 | CZML索引 | | isMount | * | false | 是否挂载到卫星实体上,挂在到卫星实体上,后两个参数不用管有默认值 | | orienMark | * | HPR | 姿态标志位 NONE Velocity HPR |
createCustomSensor.createRectSensor(id, yHalfAngle, xHalfAngle, radius, isCzml, czmlIndex, isMount, orienMark) ⇒ *
创建卫星矩形载荷
Kind: instance method of CreateCustomSensor
Returns: * - 载荷实体
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | 卫星ID | | yHalfAngle | * | | Y轴方向 运行方向 半角 度 | | xHalfAngle | * | | X轴方向 垂直运动方向 半角 度 | | radius | * | 20000000 | 半径 米 | | isCzml | * | true | 是否是CZML实体 | | czmlIndex | * | 0 | CZML索引 | | isMount | * | false | 是否挂载到卫星实体上 | | orienMark | * | HPR | 姿态标志位 NONE Velocity HPR |
createCustomSensor.constrollOrientationOnlyRoll(id, rollAngle, isCzml, czmlIndex)
constrollOrientation 控制载荷侧摆使用,这个是直接就侧摆了,没有滑动效果
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | | | rollAngle | * | | 侧摆的角度 度 可正可负,正右摆,负左摆 | | isCzml | * | false | 是否为CZML数据源 | | czmlIndex | * | 0 | 数据源索引 |
createCustomSensor.constrollOrientationByHeadingPitchRoll(id, rotationValues, isCzml, czmlIndex)
控制卫星姿态侧拍(支持三轴旋转叠加)通过heading pitch roll 构造hpr的结构更改
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | String | | 卫星ID | | rotationValues | Object | | 旋转角度(度): { x: 0, y: 0, z: 0 } 其中x对应roll,y对应pitch ,z对应heading | | isCzml | Boolean | false | 是否为CZML数据源 | | czmlIndex | Number | 0 | 数据源索引 |
createCustomSensor.constrollOrientationByFromRotation(id, rotationValues, isCzml, czmlIndex)
控制卫星姿态侧拍(支持三轴旋转叠加)通过fromRotation x/y/z旋转矩阵 构造姿态数据 这个要恢复,必须是输入多少 ,二次输入同样的负值才能回到原位,不然依旧是在原基础上进行相加流入 x:50 x:1 则是 x:51
Kind: instance method of CreateCustomSensor
| Param | Type | Default | Description | | --- | --- | --- | --- | | id | * | | 卫星id | | rotationValues | * | | 旋转角度(度): { x: 0, y: 0, z: 0 } 其中x对应roll,y对应pitch ,z对应heading | | isCzml | * | false | 是否为CZML数据源 | | czmlIndex | * | 0 | 数据源索引 |
createCustomSensor.initSlerpControl(id, rollAngle, durationSeconds, isCzml, czmlIndex)
初始化并获取卫星的侧拍控制开关, 控制载荷侧摆使用,这个是慢慢侧摆过去,带有滑动效果,存在离散值的,其中传递的值为正则为向左侧摆,传递的值为负,则向右侧拍
Kind: instance method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星id | | rollAngle | * | 侧拍角度 度 | | durationSeconds | * | 侧拍持续时间 秒 整秒 | | isCzml | * | 是否为CZML数据源 | | czmlIndex | * | 数据源索引 |
createCustomSensor.toggleSatelliteSideLook(id)
外部调用的接口,控制每颗卫星进行姿态调整
Kind: instance method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星id |
CreateCustomSensor.autobind(instance)
自动绑定方法
Kind: static method of CreateCustomSensor
| Param | Type | | --- | --- | | instance | * |
CreateCustomSensor.judgeEntityHasOrientation(satelliteEntity, orienMark)
判断实体是否存在载荷属性
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | satelliteEntity | * | 卫星ID | | orienMark | * | 姿态标志位 NONE Velocity HPR |
CreateCustomSensor.createDependenceSARSensor(id, satelliteEntity, oHalfAngle, iHalfAngle, maxRoll, radius, isRadians)
挂载SAR载荷到卫星实体
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | oHalfAngle | * | 内角 度 | | iHalfAngle | * | 外角 度 | | maxRoll | * | 厚度 度 | | radius | * | 半径 米 | | isRadians | * | 弧度单位标志 |
CreateCustomSensor.createIndependentSARSensor(id, satelliteEntity, oHalfAngle, iHalfAngle, maxRoll, radius, isRadians)
创建独立SAR载荷实体
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | oHalfAngle | * | 内角 度 | | iHalfAngle | * | 外角 度 | | maxRoll | * | 厚度 度 | | radius | * | 半径 米 | | isRadians | * | 弧度单位标志 |
CreateCustomSensor.createDependenceConicCustom(id, satelliteEntity, beams, radius)
自定义圆形载荷挂在到卫星上
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | beams | * | 圆形集合 包含pitch roll halfAngle pitch 俯仰 roll偏航角 单位 弧度 | | radius | * | 半径 米 |
CreateCustomSensor.createIndependentConicCustom(id, satelliteEntity, beams, radius)
自定义创建圆形载荷实体
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | beams | * | 圆形集合 包含pitch roll halfAngle pitch 俯仰 roll偏航角 单位 弧度 | | radius | * | 半径 米 |
CreateCustomSensor.createDependenceHexagonalCustom(id, satelliteEntity, beams, radius)
自定义六边形载荷挂在到卫星上
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | beams | * | 六边形集合 包含pitch roll halfAngle pitch 俯仰 roll偏航角 单位 弧度 | | radius | * | 半径 米 |
CreateCustomSensor.createIndependentHexagonalCustom(id, satelliteEntity, beams, radius)
自定义创建六边形载荷实体
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | beams | * | 六边形集合 包含pitch roll halfAngle pitch 俯仰 roll偏航角 单位 弧度 | | radius | * | 半径 米 |
CreateCustomSensor.createDependenceConicSensor(id, satelliteEntity, halfAngle, radius)
挂载圆形载荷到卫星实体
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | halfAngle | * | 半角 度 | | radius | * | 半径 米 |
CreateCustomSensor.createIndependentConicSensor(id, satelliteEntity, halfAngle, radius)
创建独立圆形载荷
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | halfAngle | * | 半角 度 | | radius | * | 半径 米 |
CreateCustomSensor.createDependenceRectSensor(id, satelliteEntity, yHalfAngle, xHalfAngle, radius)
挂载矩形载荷到卫星实体
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | yHalfAngle | * | Y轴方向 运行方向 半角 度 | | xHalfAngle | * | X轴方向 垂直运动方向 半角 度 | | radius | * | 半径 米 |
CreateCustomSensor.createIndependentRectSensor(id, satelliteEntity, yHalfAngle, xHalfAngle, radius)
创建独立矩形载荷
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | id | * | 卫星ID | | satelliteEntity | * | 卫星实体 | | yHalfAngle | * | Y轴方向 运行方向 半角 度 | | xHalfAngle | * | X轴方向 垂直运动方向 半角 度 | | radius | * | 半径 米 |
CreateCustomSensor.generateClusterBeams(bigHalfAngleDeg, smallHalfAngleDeg) ⇒ Array
动态生成蜂窝状覆盖的波束簇
Kind: static method of CreateCustomSensor
Returns: Array - 返回 MultiCircularSensor 需要的 beams 配置数组
| Param | Type | Description | | --- | --- | --- | | bigHalfAngleDeg | Number | 大圆的总覆盖半径(度) | | smallHalfAngleDeg | Number | 单个小圆形波束的半径(度) |
CreateCustomSensor.generateHexagonalClusterBeams(bigHalfAngleDeg, smallHexHalfAngleDeg)
动态生成完美无缝拼接的【六边形】波束簇
Kind: static method of CreateCustomSensor
| Param | Type | Description | | --- | --- | --- | | bigHalfAngleDeg | Number | 大圆的总覆盖半径(度) | | smallHexHalfAngleDeg | Number | 单个小六边形外接圆的半径半角(度) |
CreateCustomSensor.convertStkSarToCesiumParams(stkEleMin, stkEleMax, stkExclForward, stkExclAft) ⇒ Object
将 STK 的 SAR 载荷参数转换为 Cesium/newSARSensor.js 的几何参数
Kind: static method of CreateCustomSensor
Returns: Object - 返回供 Cesium 载荷直接使用的弧度值
示例
假设这是从你的接口或配置中读取的 STK 参数 ------这里是测试数据及样例,不能删除
const stkParams = {
elevationMin: 10,
elevationMax: 77,
exclusionForward: 80,
exclusionAft: 80
};
// 1. 进行参数转换 const cesiumSarParams = convertStkSarToCesiumParams( stkParams.elevationMin, stkParams.elevationMax, stkParams.exclusionForward, stkParams.exclusionAft );
| Param | Type | Description | | --- | --- | --- | | stkEleMin | Number | STK Elevation Min (度) - 例如 10 | | stkEleMax | Number | STK Elevation Max (度) - 例如 55 | | stkExclForward | Number | STK Exclusion Forward (度) - 例如 80 | | stkExclAft | Number | STK Exclusion Aft (度) - 例如 80 (通常与Forward对称) |
InitCesium()
初始化Cesium Viewer
Kind: global function
Example
import { InitCesium } from "cesium-core";
let init = InitCesium({
containerId: "ID",
titleUrl: "",
imageryUrl:
import.meta.env.VITE_APP_OL_URL + "/image/mapbox/{z}/{x}/{y}.png",
terrainUrl: import.meta.env.VITE_APP_OL_URL + "/terrain",
fullscreenButton: true,
sceneModePicker: true,
homeButton: false,
maximumLevel: 9,
})InitCesiumConfig : Object
Cesium 初始化配置
Kind: global typedef
Properties
| Name | Type | Description | | --- | --- | --- | | containerId | string | | | [imageryUrl] | string | | | [terrainUrl] | string | | | [titleUrl] | string | | | [fullscreenButton] | boolean | | | [sceneModePicker] | boolean | | | [homeButton] | boolean | | | [maximumLevel] | number | let init = InitCesium({ containerId: "viewer-container", titleUrl: "", imageryUrl: import.meta.env.VITE_APP_OL_URL + "/image/mapbox/{z}/{x}/{y}.png", terrainUrl: import.meta.env.VITE_APP_OL_URL + "/terrain", fullscreenButton: true, sceneModePicker: true, homeButton: false, maximumLevel: 9, }); |
