| # 更新 | # 更新 | ||||
| ## 1.9.3 | |||||
| ### 2020-8-22 | |||||
| > 1. 添加贝塞尔曲线、两点中心点的函数 | |||||
| > 2. 添加覆盖物支持Entity转换函数 | |||||
| > 3. 添加wms地图服务的支持 | |||||
| ## 1.9.2 | ## 1.9.2 | ||||
| ### 2020-8-15 | ### 2020-8-15 | 
| { | { | ||||
| "name": "@dvgis/dc-sdk", | "name": "@dvgis/dc-sdk", | ||||
| "version": "1.9.2", | |||||
| "version": "1.9.3", | |||||
| "description": " The SDK is a secondary development based on the open source project Cesium, which optimizes some operations of Cesium and enables developers to quickly develop 3D applications through the framework.", | "description": " The SDK is a secondary development based on the open source project Cesium, which optimizes some operations of Cesium and enables developers to quickly develop 3D applications through the framework.", | ||||
| "main": "index.js", | "main": "index.js", | ||||
| "repository": "https://github.com/dvgis/dc-sdk.git", | "repository": "https://github.com/dvgis/dc-sdk.git", | 
| import { | import { | ||||
| area, | area, | ||||
| bounds, | bounds, | ||||
| mid, | |||||
| center, | center, | ||||
| distance, | distance, | ||||
| heading, | heading, | ||||
| const { Cesium } = DC.Namespace | const { Cesium } = DC.Namespace | ||||
| Cesium.Math.area = area | |||||
| Cesium.Math.bounds = bounds | |||||
| Cesium.Math.center = center | |||||
| Cesium.Math.distance = distance | |||||
| Cesium.Math.heading = heading | |||||
| Cesium.Math.isBetween = isBetween | |||||
| Cesium.Math.parabola = parabola | |||||
| Cesium.Math.curve = curve | |||||
| const core = { | const core = { | ||||
| ImageryLayerFactory, | ImageryLayerFactory, | ||||
| TerrainFactory, | TerrainFactory, | ||||
| Polygon, | Polygon, | ||||
| Model, | Model, | ||||
| Tileset, | Tileset, | ||||
| Math: Cesium.Math | |||||
| Math: { | |||||
| ...Cesium.Math, | |||||
| area, | |||||
| bounds, | |||||
| mid, | |||||
| center, | |||||
| distance, | |||||
| heading, | |||||
| isBetween, | |||||
| parabola, | |||||
| curve | |||||
| } | |||||
| } | } | ||||
| DC.mixin(core) | DC.mixin(core) | 
| export { default as area } from './area' | export { default as area } from './area' | ||||
| export { default as bounds } from './bounds' | export { default as bounds } from './bounds' | ||||
| export { default as mid } from './mid' | |||||
| export { default as center } from './center' | export { default as center } from './center' | ||||
| export { default as distance } from './distance' | export { default as distance } from './distance' | ||||
| export { default as heading } from './heading' | export { default as heading } from './heading' | 
| /** | |||||
| * @Author: Caven | |||||
| * @Date: 2020-08-21 18:16:52 | |||||
| */ | |||||
| import Position from '../position/Position' | |||||
| import Transform from '../transform/Transform' | |||||
| const { Cesium } = DC.Namespace | |||||
| export default function mid(startPosition, endPosition) { | |||||
| if (startPosition instanceof Position) { | |||||
| startPosition = Transform.transformWGS84ToCartographic(startPosition) | |||||
| } | |||||
| if (endPosition instanceof Position) { | |||||
| endPosition = Transform.transformWGS84ToCartographic(endPosition) | |||||
| } | |||||
| let mc = new Cesium.EllipsoidGeodesic( | |||||
| startPosition, | |||||
| endPosition | |||||
| ).interpolateUsingFraction(0.5) | |||||
| return new Position( | |||||
| Cesium.Math.toDegrees(mc.longitude), | |||||
| Cesium.Math.toDegrees(mc.latitude), | |||||
| mc.height | |||||
| ) | |||||
| } | 
| if (entity.billboard) { | if (entity.billboard) { | ||||
| billboard = new Billboard(position, entity.billboard.image.getValue(now)) | billboard = new Billboard(position, entity.billboard.image.getValue(now)) | ||||
| billboard.attr = { | billboard.attr = { | ||||
| ...entity.properties.getValue(now) | |||||
| ...entity?.properties?.getValue(now) | |||||
| } | } | ||||
| } | } | ||||
| return billboard | return billboard | 
| divIcon = new DC.DivIcon(position, content) | divIcon = new DC.DivIcon(position, content) | ||||
| if (entity.billboard) { | if (entity.billboard) { | ||||
| divIcon.attr = { | divIcon.attr = { | ||||
| ...entity.properties.getValue(now) | |||||
| ...entity?.properties?.getValue(now) | |||||
| } | } | ||||
| } | } | ||||
| return divIcon | return divIcon | 
| * @returns {any} | * @returns {any} | ||||
| */ | */ | ||||
| static fromEntity(entity) { | static fromEntity(entity) { | ||||
| let now = Cesium.JulianDate.now() | |||||
| let position = Transform.transformCartesianToWGS84( | let position = Transform.transformCartesianToWGS84( | ||||
| entity.position.getValue(Cesium.JulianDate.now()) | |||||
| entity.position.getValue(now) | |||||
| ) | ) | ||||
| let label = undefined | let label = undefined | ||||
| if (entity.billboard) { | if (entity.billboard) { | ||||
| label = new Label(position, entity.name) | label = new Label(position, entity.name) | ||||
| label.attr = { | label.attr = { | ||||
| ...entity.properties.getValue(Cesium.JulianDate.now()) | |||||
| ...entity?.properties?.getValue(now) | |||||
| } | } | ||||
| } | } | ||||
| return label | return label | 
| ) | ) | ||||
| point = new Point(position) | point = new Point(position) | ||||
| point.attr = { | point.attr = { | ||||
| ...entity.properties.getValue(now) | |||||
| ...entity?.properties?.getValue(now) | |||||
| } | } | ||||
| return point | return point | ||||
| } | } | 
| ) | ) | ||||
| polygon = new Polygon(positions) | polygon = new Polygon(positions) | ||||
| polygon.attr = { | polygon.attr = { | ||||
| ...entity.properties.getValue(now) | |||||
| ...entity?.properties?.getValue(now) | |||||
| } | } | ||||
| } | } | ||||
| return polygon | return polygon | 
| ) | ) | ||||
| polyline = new Polyline(positions) | polyline = new Polyline(positions) | ||||
| polyline.attr = { | polyline.attr = { | ||||
| ...entity.properties.getValue(now) | |||||
| ...entity?.properties?.getValue(now) | |||||
| } | } | ||||
| } | } | ||||
| return polyline | return polyline |