| @@ -20,7 +20,7 @@ console.log( | |||
| 1.框架作为一个基础平台,代码开源,任何个人和机构可以修改、重构,无需经过我方授权。 | |||
| 2.任何个人和机构修改框架出现的问题,我方无需负责。 | |||
| 3.后期会添加一些行业性的插件和工具,代码会适量开源。 | |||
| 4.对于我方发布的程序包,任何个人和机构在遵守下列条件的前提下可以永久免费使用: | |||
| 4.对于我方发布的框架包,任何个人和机构在遵守下列条件的前提下可以永久免费使用: | |||
| 1)程序包完整引用 | |||
| 2)保留此版权信息在控制台输出 | |||
| 我方保留对此版权信息的最终解释权。`, | |||
| @@ -12,6 +12,7 @@ export { default as LayerGroup } from './LayerGroup' | |||
| */ | |||
| export { default as ClusterLayer } from './type/ClusterLayer' | |||
| export { default as CzmlLayer } from './type/CzmlLayer' | |||
| export { default as DynamicLayer } from './type/DynamicLayer' | |||
| export { default as FeatureGridLayer } from './type/FeatureGridLayer' | |||
| export { default as GeoJsonLayer } from './type/GeoJsonLayer' | |||
| export { default as HeatLayer } from './type/HeatLayer' | |||
| @@ -0,0 +1,32 @@ | |||
| /** | |||
| * @Author: Caven | |||
| * @Date: 2021-05-05 09:12:41 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Layer from '../Layer' | |||
| class DynamicLayer extends Layer { | |||
| constructor(id) { | |||
| super(id) | |||
| this._delegate = new Cesium.CustomDataSource(id) | |||
| this.type = Layer.getLayerType('dynamic') | |||
| this._state = State.INITIALIZED | |||
| } | |||
| /** | |||
| * Clears all entities | |||
| * @returns {DynamicLayer} | |||
| */ | |||
| clear() { | |||
| this._delegate.entities && this._delegate.entities.removeAll() | |||
| this._cache = {} | |||
| this._state = State.CLEARED | |||
| return this | |||
| } | |||
| } | |||
| Layer.registerType('dynamic') | |||
| export default DynamicLayer | |||
| @@ -0,0 +1,80 @@ | |||
| /** | |||
| * @Author: Caven | |||
| * @Date: 2021-05-05 09:16:35 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Overlay from '../Overlay' | |||
| class DynamicModel extends Overlay { | |||
| constructor(modelUrl) { | |||
| super() | |||
| this._delegate = new Cesium.Entity({ model: {} }) | |||
| this._posistion = new Cesium.SampledPositionProperty() | |||
| this._modelUrl = modelUrl | |||
| this._timeLine = {} | |||
| this._lastTime = undefined | |||
| this.type = Overlay.getOverlayType('dynamic-model') | |||
| this._state = State.INITIALIZED | |||
| } | |||
| get position() { | |||
| return this._position | |||
| } | |||
| get timeLine() { | |||
| return this._timeLine | |||
| } | |||
| _mountedHook() { | |||
| this._posistion.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD | |||
| this._delegate.position = this._posistion | |||
| this._delegate.orientation = new Cesium.VelocityOrientationProperty( | |||
| this._posistion | |||
| ) | |||
| } | |||
| /** | |||
| * | |||
| * @param position | |||
| * @param interval | |||
| */ | |||
| addPosition(position, interval) { | |||
| let now = Cesium.JulianDate.now() | |||
| let time = Cesium.JulianDate.addSeconds( | |||
| now, | |||
| interval, | |||
| new Cesium.JulianDate() | |||
| ) | |||
| this._lastTime = Cesium.JulianDate.toIso8601(time) | |||
| let cartesian = Transform.transformWGS84ToCartesian( | |||
| Parse.parsePosition(position) | |||
| ) | |||
| this._posistion.addSample(time, cartesian) | |||
| this._timeLine[this._lastTime] = cartesian | |||
| return this | |||
| } | |||
| /** | |||
| * Sets style | |||
| * @param style | |||
| * @returns {DynamicModel} | |||
| */ | |||
| setStyle(style) { | |||
| if (!style || Object.keys(style).length === 0) { | |||
| return this | |||
| } | |||
| delete style['uri'] && delete style['position'] | |||
| this._style = style | |||
| Util.merge(this._delegate.model, this._style) | |||
| return this | |||
| } | |||
| } | |||
| Overlay.registerType('dynamic-model') | |||
| export default DynamicModel | |||
| @@ -12,6 +12,11 @@ export { default as Overlay } from './Overlay' | |||
| export { default as CustomBillboard } from './custom/CustomBillboard' | |||
| export { default as CustomLabel } from './custom/CustomLabel' | |||
| /** | |||
| * dynamic | |||
| */ | |||
| export { default as DynamicModel } from './dynamic/DynamicModel' | |||
| /** | |||
| * model | |||
| */ | |||
| @@ -44,6 +44,7 @@ import { | |||
| Layer, | |||
| ClusterLayer, | |||
| CzmlLayer, | |||
| DynamicLayer, | |||
| FeatureGridLayer, | |||
| GeoJsonLayer, | |||
| HeatLayer, | |||
| @@ -65,6 +66,7 @@ import { | |||
| Overlay, | |||
| CustomBillboard, | |||
| CustomLabel, | |||
| DynamicModel, | |||
| Model, | |||
| Tileset, | |||
| AttackArrow, | |||
| @@ -225,6 +227,7 @@ const components = { | |||
| Layer, | |||
| ClusterLayer, | |||
| CzmlLayer, | |||
| DynamicLayer, | |||
| FeatureGridLayer, | |||
| GeoJsonLayer, | |||
| HeatLayer, | |||
| @@ -243,6 +246,7 @@ const components = { | |||
| Overlay, | |||
| CustomBillboard, | |||
| CustomLabel, | |||
| DynamicModel, | |||
| Model, | |||
| Tileset, | |||
| AttackArrow, | |||