| @@ -1,5 +1,13 @@ | |||
| # 更新 | |||
| ## 1.9.3 | |||
| ### 2020-8-22 | |||
| > 1. 添加贝塞尔曲线、两点中心点的函数 | |||
| > 2. 添加覆盖物支持Entity转换函数 | |||
| > 3. 添加wms地图服务的支持 | |||
| ## 1.9.2 | |||
| ### 2020-8-15 | |||
| @@ -1,6 +1,6 @@ | |||
| { | |||
| "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.", | |||
| "main": "index.js", | |||
| "repository": "https://github.com/dvgis/dc-sdk.git", | |||
| @@ -30,6 +30,7 @@ import { | |||
| import { | |||
| area, | |||
| bounds, | |||
| mid, | |||
| center, | |||
| distance, | |||
| heading, | |||
| @@ -40,15 +41,6 @@ import { | |||
| 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 = { | |||
| ImageryLayerFactory, | |||
| TerrainFactory, | |||
| @@ -69,7 +61,18 @@ const core = { | |||
| Polygon, | |||
| Model, | |||
| Tileset, | |||
| Math: Cesium.Math | |||
| Math: { | |||
| ...Cesium.Math, | |||
| area, | |||
| bounds, | |||
| mid, | |||
| center, | |||
| distance, | |||
| heading, | |||
| isBetween, | |||
| parabola, | |||
| curve | |||
| } | |||
| } | |||
| DC.mixin(core) | |||
| @@ -5,6 +5,7 @@ | |||
| export { default as area } from './area' | |||
| export { default as bounds } from './bounds' | |||
| export { default as mid } from './mid' | |||
| export { default as center } from './center' | |||
| export { default as distance } from './distance' | |||
| export { default as heading } from './heading' | |||
| @@ -0,0 +1,29 @@ | |||
| /** | |||
| * @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 | |||
| ) | |||
| } | |||
| @@ -99,7 +99,7 @@ class Billboard extends Overlay { | |||
| if (entity.billboard) { | |||
| billboard = new Billboard(position, entity.billboard.image.getValue(now)) | |||
| billboard.attr = { | |||
| ...entity.properties.getValue(now) | |||
| ...entity?.properties?.getValue(now) | |||
| } | |||
| } | |||
| return billboard | |||
| @@ -166,7 +166,7 @@ class DivIcon extends Overlay { | |||
| divIcon = new DC.DivIcon(position, content) | |||
| if (entity.billboard) { | |||
| divIcon.attr = { | |||
| ...entity.properties.getValue(now) | |||
| ...entity?.properties?.getValue(now) | |||
| } | |||
| } | |||
| return divIcon | |||
| @@ -85,14 +85,15 @@ class Label extends Overlay { | |||
| * @returns {any} | |||
| */ | |||
| static fromEntity(entity) { | |||
| let now = Cesium.JulianDate.now() | |||
| let position = Transform.transformCartesianToWGS84( | |||
| entity.position.getValue(Cesium.JulianDate.now()) | |||
| entity.position.getValue(now) | |||
| ) | |||
| let label = undefined | |||
| if (entity.billboard) { | |||
| label = new Label(position, entity.name) | |||
| label.attr = { | |||
| ...entity.properties.getValue(Cesium.JulianDate.now()) | |||
| ...entity?.properties?.getValue(now) | |||
| } | |||
| } | |||
| return label | |||
| @@ -78,7 +78,7 @@ class Point extends Overlay { | |||
| ) | |||
| point = new Point(position) | |||
| point.attr = { | |||
| ...entity.properties.getValue(now) | |||
| ...entity?.properties?.getValue(now) | |||
| } | |||
| return point | |||
| } | |||
| @@ -120,7 +120,7 @@ class Polygon extends Overlay { | |||
| ) | |||
| polygon = new Polygon(positions) | |||
| polygon.attr = { | |||
| ...entity.properties.getValue(now) | |||
| ...entity?.properties?.getValue(now) | |||
| } | |||
| } | |||
| return polygon | |||
| @@ -92,7 +92,7 @@ class Polyline extends Overlay { | |||
| ) | |||
| polyline = new Polyline(positions) | |||
| polyline.attr = { | |||
| ...entity.properties.getValue(now) | |||
| ...entity?.properties?.getValue(now) | |||
| } | |||
| } | |||
| return polyline | |||