| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('heat') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private |
| this._layerEvent.on(LayerEventType.ADD, this._onAdd, this) | this._layerEvent.on(LayerEventType.ADD, this._onAdd, this) | ||||
| this._layerEvent.on(LayerEventType.REMOVE, this._onRemove, this) | this._layerEvent.on(LayerEventType.REMOVE, this._onRemove, this) | ||||
| this._state = undefined | this._state = undefined | ||||
| this.type = undefined | |||||
| } | } | ||||
| get layerId() { | get layerId() { |
| this._layerGroupEvent = new LayerGroupEvent() | this._layerGroupEvent = new LayerGroupEvent() | ||||
| this._layerGroupEvent.on(LayerGroupEventType.ADD, this._onAdd, this) | this._layerGroupEvent.on(LayerGroupEventType.ADD, this._onAdd, this) | ||||
| this._layerGroupEvent.on(LayerGroupEventType.REMOVE, this._onRemove, this) | this._layerGroupEvent.on(LayerGroupEventType.REMOVE, this._onRemove, this) | ||||
| this.type = Layer.getLayerType('layer_group') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| return this._id | return this._id | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('layer_group') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| Object.keys(this._cache).forEach(key => { | Object.keys(this._cache).forEach(key => { |
| this | this | ||||
| ) | ) | ||||
| this._delegate.clustering.pixelRange = this._options.pixelRange | this._delegate.clustering.pixelRange = this._options.pixelRange | ||||
| this.type = Layer.getLayerType('cluster') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('cluster') | |||||
| } | |||||
| set enableCluster(enableCluster) { | set enableCluster(enableCluster) { | ||||
| this._delegate.clustering.enabled = enableCluster | this._delegate.clustering.enabled = enableCluster | ||||
| return this | return this |
| constructor(id, url = '', options = {}) { | constructor(id, url = '', options = {}) { | ||||
| super(id) | super(id) | ||||
| this._delegate = Cesium.CzmlDataSource.load(url, options) | this._delegate = Cesium.CzmlDataSource.load(url, options) | ||||
| this.type = Layer.getLayerType('czml') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('czml') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| this._delegate && | this._delegate && |
| constructor(id) { | constructor(id) { | ||||
| super(id) | super(id) | ||||
| this._delegate = new Cesium.CustomDataSource(id) | this._delegate = new Cesium.CustomDataSource(id) | ||||
| this.type = Layer.getLayerType('dynamic') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('dynamic') | |||||
| } | |||||
| /** | /** | ||||
| * Clears all entities | * Clears all entities | ||||
| * @returns {DynamicLayer} | * @returns {DynamicLayer} |
| count: 10, | count: 10, | ||||
| maximumLevel: 21, | maximumLevel: 21, | ||||
| dataProperty: '', | dataProperty: '', | ||||
| callback: record => { | |||||
| callback: () => { | |||||
| return null | return null | ||||
| } | } | ||||
| } | } | ||||
| this._rectangle = this._tilingScheme.rectangle | this._rectangle = this._tilingScheme.rectangle | ||||
| this._credit = undefined | this._credit = undefined | ||||
| this._token = undefined | this._token = undefined | ||||
| this.type = Layer.getLayerType('feature_grid') | |||||
| for (let i = 0; i < this.maximumLevel; i++) { | for (let i = 0; i < this.maximumLevel; i++) { | ||||
| this._levelLayers[String(i)] = new VectorLayer(id + '-grid-' + i) | this._levelLayers[String(i)] = new VectorLayer(id + '-grid-' + i) | ||||
| } | } | ||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('feature_grid') | |||||
| } | |||||
| get url() { | get url() { | ||||
| return this._url | return this._url | ||||
| } | } |
| } | } | ||||
| super(id) | super(id) | ||||
| this._delegate = Cesium.GeoJsonDataSource.load(url, options) | this._delegate = Cesium.GeoJsonDataSource.load(url, options) | ||||
| this.type = Layer.getLayerType('geojson') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('geojson') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| this._delegate && | this._delegate && |
| this._delegate = DomUtil.create('div', 'html-layer', undefined) | this._delegate = DomUtil.create('div', 'html-layer', undefined) | ||||
| this._delegate.setAttribute('id', this._id) | this._delegate.setAttribute('id', this._id) | ||||
| this._renderRemoveCallback = undefined | this._renderRemoveCallback = undefined | ||||
| this.type = Layer.getLayerType('html') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('html') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| this._delegate.style.visibility = this._show ? 'visible' : 'hidden' | this._delegate.style.visibility = this._show ? 'visible' : 'hidden' |
| } | } | ||||
| super(id) | super(id) | ||||
| this._delegate = Cesium.KmlDataSource.load(url, options) | this._delegate = Cesium.KmlDataSource.load(url, options) | ||||
| this.type = Layer.getLayerType('kml') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('kml') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| this._delegate && | this._delegate && |
| this._dataSource = Cesium.GeoJsonDataSource.load(url) | this._dataSource = Cesium.GeoJsonDataSource.load(url) | ||||
| this._delegate = new Cesium.CustomDataSource(id) | this._delegate = new Cesium.CustomDataSource(id) | ||||
| this._initLabel() | this._initLabel() | ||||
| this.type = Layer.registerType('label') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('label') | |||||
| } | |||||
| _createLabel(entity) { | _createLabel(entity) { | ||||
| if (entity.position && entity.name) { | if (entity.position && entity.name) { | ||||
| return Label.fromEntity(entity) | return Label.fromEntity(entity) |
| import State from '@dc-modules/state/State' | import State from '@dc-modules/state/State' | ||||
| import Layer from '../Layer' | import Layer from '../Layer' | ||||
| /** | |||||
| * PrimitiveLayer is used to add primitve | |||||
| */ | |||||
| class PrimitiveLayer extends Layer { | class PrimitiveLayer extends Layer { | ||||
| constructor(id) { | constructor(id) { | ||||
| super(id) | super(id) | ||||
| this._labels = this._delegate.add(new Cesium.LabelCollection()) | this._labels = this._delegate.add(new Cesium.LabelCollection()) | ||||
| this._billboards = this._delegate.add(new Cesium.BillboardCollection()) | this._billboards = this._delegate.add(new Cesium.BillboardCollection()) | ||||
| this._polylines = this._delegate.add(new Cesium.PolylineCollection()) | this._polylines = this._delegate.add(new Cesium.PolylineCollection()) | ||||
| this.type = Layer.getLayerType('primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('primitive') | |||||
| } | |||||
| get points() { | get points() { | ||||
| return this._points | return this._points | ||||
| } | } |
| constructor(id) { | constructor(id) { | ||||
| super(id) | super(id) | ||||
| this._delegate = new Cesium.PrimitiveCollection() | this._delegate = new Cesium.PrimitiveCollection() | ||||
| this.type = Layer.getLayerType('tileset') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('tileset') | |||||
| } | |||||
| /** | /** | ||||
| * Clear all tileset | * Clear all tileset | ||||
| * @returns {TilesetLayer} | * @returns {TilesetLayer} |
| import State from '@dc-modules/state/State' | import State from '@dc-modules/state/State' | ||||
| import GeoJsonLayer from './GeoJsonLayer' | import GeoJsonLayer from './GeoJsonLayer' | ||||
| import Layer from '../Layer' | |||||
| class TopoJsonLayer extends GeoJsonLayer { | class TopoJsonLayer extends GeoJsonLayer { | ||||
| constructor(id, url, options = {}) { | constructor(id, url, options = {}) { | ||||
| throw new Error('TopoJsonLayer:the url invalid') | throw new Error('TopoJsonLayer:the url invalid') | ||||
| } | } | ||||
| super(id, url, options) | super(id, url, options) | ||||
| this.type = GeoJsonLayer.getLayerType('topojson') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('topojson') | |||||
| } | |||||
| } | } | ||||
| GeoJsonLayer.registerType('topojson') | GeoJsonLayer.registerType('topojson') |
| constructor(id) { | constructor(id) { | ||||
| super(id) | super(id) | ||||
| this._delegate = new Cesium.CustomDataSource(id) | this._delegate = new Cesium.CustomDataSource(id) | ||||
| this.type = Layer.getLayerType('vector') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('vector') | |||||
| } | |||||
| /** | /** | ||||
| * Clears all entities | * Clears all entities | ||||
| * @returns {VectorLayer} | * @returns {VectorLayer} |
| import { mapv } from '@dc-modules/namespace' | import { mapv } from '@dc-modules/namespace' | ||||
| import State from '@dc-modules/state/State' | import State from '@dc-modules/state/State' | ||||
| import { Layer } from '@dc-modules/layer' | import { Layer } from '@dc-modules/layer' | ||||
| import Overlay from '../overlay/Overlay' | |||||
| class MapvLayer extends Layer { | class MapvLayer extends Layer { | ||||
| constructor(id, option = {}) { | constructor(id, option = {}) { | ||||
| this._option = option | this._option = option | ||||
| this._dataSet = undefined | this._dataSet = undefined | ||||
| this._delegate = undefined | this._delegate = undefined | ||||
| this.type = Layer.getLayerType('mapv') | |||||
| this._state = State.INITIALIZED | |||||
| } | |||||
| get type() { | |||||
| return Overlay.getOverlayType('mapv') | |||||
| } | } | ||||
| set show(show) { | set show(show) { |
| this._allowDrillPicking = false | this._allowDrillPicking = false | ||||
| this._contextMenu = [] | this._contextMenu = [] | ||||
| this._overlayEvent = new OverlayEvent() | this._overlayEvent = new OverlayEvent() | ||||
| this.type = undefined | |||||
| this.on(OverlayEventType.ADD, this._onAdd, this) | this.on(OverlayEventType.ADD, this._onAdd, this) | ||||
| this.on(OverlayEventType.REMOVE, this._onRemove, this) | this.on(OverlayEventType.REMOVE, this._onRemove, this) | ||||
| } | } | ||||
| this._layer.delegate.entities.add(this._delegate) | this._layer.delegate.entities.add(this._delegate) | ||||
| } else if (this._layer?.delegate?.add && this._delegate) { | } else if (this._layer?.delegate?.add && this._delegate) { | ||||
| // for Primitive | // for Primitive | ||||
| if (this.type === 'point_primitive' && this._layer.points) { | |||||
| if (this.type && this.type === 'point_primitive' && this._layer.points) { | |||||
| this._delegate = this._layer.points.add(this._delegate) | this._delegate = this._layer.points.add(this._delegate) | ||||
| } else if ( | } else if ( | ||||
| this.type === 'billboard_primitive' && | |||||
| this.type.indexOf('billboard_primitive') >= 0 && | |||||
| this._layer.billboards | this._layer.billboards | ||||
| ) { | ) { | ||||
| this._delegate = this._layer.billboards.add(this._delegate) | this._delegate = this._layer.billboards.add(this._delegate) | ||||
| } else if (this.type === 'polyline_primitive' && this._layer.polylines) { | } else if (this.type === 'polyline_primitive' && this._layer.polylines) { | ||||
| this._delegate = this._layer.polylines.add(this._delegate) | this._delegate = this._layer.polylines.add(this._delegate) | ||||
| } else if (this.type === 'label_primitive' && this._layer.labels) { | |||||
| } else if ( | |||||
| this.type.indexOf('label_primitive') >= 0 && | |||||
| this._layer.labels | |||||
| ) { | |||||
| this._delegate = this._layer.labels.add(this._delegate) | this._delegate = this._layer.labels.add(this._delegate) | ||||
| } else { | } else { | ||||
| this._layer.delegate.add(this._delegate) | this._layer.delegate.add(this._delegate) | ||||
| if (this.type === 'point_primitive' && this._layer.points) { | if (this.type === 'point_primitive' && this._layer.points) { | ||||
| this._layer.points.remove(this._delegate) | this._layer.points.remove(this._delegate) | ||||
| } else if ( | } else if ( | ||||
| this.type === 'billboard_primitive' && | |||||
| this.type.indexOf('billboard_primitive') >= 0 && | |||||
| this._layer.billboards | this._layer.billboards | ||||
| ) { | ) { | ||||
| this._layer.billboards.remove(this._delegate) | this._layer.billboards.remove(this._delegate) | ||||
| } else if (this.type === 'polyline_primitive' && this._layer.polylines) { | } else if (this.type === 'polyline_primitive' && this._layer.polylines) { | ||||
| this._layer.polylines.remove(this._delegate) | this._layer.polylines.remove(this._delegate) | ||||
| } else if (this.type === 'label_primitive' && this._layer.labels) { | |||||
| } else if ( | |||||
| this.type.indexOf('label_primitive') >= 0 && | |||||
| this._layer.labels | |||||
| ) { | |||||
| this._layer.labels.remove(this._delegate) | this._layer.labels.remove(this._delegate) | ||||
| } else { | } else { | ||||
| this._layer.delegate.remove(this._delegate) | this._layer.delegate.remove(this._delegate) |
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('custom_billboard') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( | ||||
| ...style, | ...style, | ||||
| semiMajorAxis: radius, | semiMajorAxis: radius, | ||||
| semiMinorAxis: radius, | semiMinorAxis: radius, | ||||
| stRotation: new Cesium.CallbackProperty(time => { | |||||
| stRotation: new Cesium.CallbackProperty(() => { | |||||
| stRotation += amount | stRotation += amount | ||||
| if (stRotation >= 360 || stRotation <= -360) { | if (stRotation >= 360 || stRotation <= -360) { | ||||
| stRotation = 0 | stRotation = 0 |
| this._delegate = new Cesium.Entity({ label: {} }) | this._delegate = new Cesium.Entity({ label: {} }) | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._text = text | this._text = text | ||||
| this.type = Overlay.getOverlayType('custom_label') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('custom_label') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( | ||||
| ...style, | ...style, | ||||
| semiMajorAxis: radius, | semiMajorAxis: radius, | ||||
| semiMinorAxis: radius, | semiMinorAxis: radius, | ||||
| stRotation: new Cesium.CallbackProperty(time => { | |||||
| stRotation: new Cesium.CallbackProperty(() => { | |||||
| stRotation += amount | stRotation += amount | ||||
| if (stRotation >= 360 || stRotation <= -360) { | if (stRotation >= 360 || stRotation <= -360) { | ||||
| stRotation = 0 | stRotation = 0 |
| this._posistion = Parse.parsePosition(position) | this._posistion = Parse.parsePosition(position) | ||||
| this._icon = icon | this._icon = icon | ||||
| this._delegate = new Cesium.Entity({ billboard: {} }) | this._delegate = new Cesium.Entity({ billboard: {} }) | ||||
| this.type = Overlay.getOverlayType('dynamic_billboard') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('dynamic_billboard') | |||||
| } | |||||
| set icon(icon) { | set icon(icon) { | ||||
| this._icon = icon | this._icon = icon | ||||
| this._delegate.billboard.image = this._icon | this._delegate.billboard.image = this._icon |
| this._posistion = Parse.parsePosition(position) | this._posistion = Parse.parsePosition(position) | ||||
| this._modelUrl = modelUrl | this._modelUrl = modelUrl | ||||
| this._delegate = new Cesium.Entity({ model: {} }) | this._delegate = new Cesium.Entity({ model: {} }) | ||||
| this.type = Overlay.getOverlayType('dynamic_model') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('dynamic_model') | |||||
| } | |||||
| set modelUrl(modelUrl) { | set modelUrl(modelUrl) { | ||||
| this._modelUrl = modelUrl | this._modelUrl = modelUrl | ||||
| this._delegate.model.uri = this._modelUrl | this._delegate.model.uri = this._modelUrl |
| left: '0' | left: '0' | ||||
| }) | }) | ||||
| this.content = content | this.content = content | ||||
| this.type = Overlay.getOverlayType('div_icon') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('div_icon') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| this._delegate.style.visibility = this._show ? 'visible' : 'hidden' | this._delegate.style.visibility = this._show ? 'visible' : 'hidden' |
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._modelUrl = modelUrl | this._modelUrl = modelUrl | ||||
| this._rotateAmount = 0 | this._rotateAmount = 0 | ||||
| this.type = Overlay.getOverlayType('model') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('model') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( | ||||
| set rotateAmount(amount) { | set rotateAmount(amount) { | ||||
| this._rotateAmount = +amount | this._rotateAmount = +amount | ||||
| this._delegate.orientation = new Cesium.CallbackProperty(time => { | |||||
| this._delegate.orientation = new Cesium.CallbackProperty(() => { | |||||
| this._position.heading += this._rotateAmount | this._position.heading += this._rotateAmount | ||||
| if (this._position.heading >= 360 || this._position.heading <= -360) { | if (this._position.heading >= 360 || this._position.heading <= -360) { | ||||
| this._position.heading = 0 | this._position.heading = 0 |
| this._tileVisibleCallback = undefined | this._tileVisibleCallback = undefined | ||||
| this._properties = undefined | this._properties = undefined | ||||
| this._customShader = undefined | this._customShader = undefined | ||||
| this.type = Overlay.getOverlayType('tileset') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('tileset') | |||||
| } | |||||
| get readyPromise() { | get readyPromise() { | ||||
| return this._delegate.readyPromise | return this._delegate.readyPromise | ||||
| } | } |
| this.neckHeightFactor = 0.85 | this.neckHeightFactor = 0.85 | ||||
| this.neckWidthFactor = 0.15 | this.neckWidthFactor = 0.15 | ||||
| this.headTailFactor = 0.8 | this.headTailFactor = 0.8 | ||||
| this.type = Overlay.getOverlayType('attack_arrow') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('attack_arrow') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polygon.hierarchy = this._getHierarchy() | this._delegate.polygon.hierarchy = this._getHierarchy() |
| this.headWidthFactor = 0.3 | this.headWidthFactor = 0.3 | ||||
| this.neckHeightFactor = 0.85 | this.neckHeightFactor = 0.85 | ||||
| this.neckWidthFactor = 0.15 | this.neckWidthFactor = 0.15 | ||||
| this.type = Overlay.getOverlayType('double_arrow') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('double_arrow') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polygon.hierarchy = this._getHierarchy() | this._delegate.polygon.hierarchy = this._getHierarchy() |
| this.headWidthFactor = 0.25 | this.headWidthFactor = 0.25 | ||||
| this.headAngle = Math.PI / 8.5 | this.headAngle = Math.PI / 8.5 | ||||
| this.neckAngle = Math.PI / 13 | this.neckAngle = Math.PI / 13 | ||||
| this.type = Overlay.getOverlayType('fine_arrow') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('fine_arrow') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polygon.hierarchy = this._getHierarchy() | this._delegate.polygon.hierarchy = this._getHierarchy() |
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate = new Cesium.Entity({ polygon: {} }) | this._delegate = new Cesium.Entity({ polygon: {} }) | ||||
| this.t = 0.4 | this.t = 0.4 | ||||
| this.type = Overlay.getOverlayType('gathering_place') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('gathering_place') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polygon.hierarchy = this._getHierarchy() | this._delegate.polygon.hierarchy = this._getHierarchy() |
| this.tailWidthFactor = 0.1 | this.tailWidthFactor = 0.1 | ||||
| this.headTailFactor = 0.8 | this.headTailFactor = 0.8 | ||||
| this.swallowTailFactor = 1 | this.swallowTailFactor = 1 | ||||
| this.type = Overlay.getOverlayType('tailed_attack_arrow') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('tailed_attack_arrow') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polygon.hierarchy = this._getHierarchy() | this._delegate.polygon.hierarchy = this._getHierarchy() |
| width: 0, | width: 0, | ||||
| height: 0 | height: 0 | ||||
| } | } | ||||
| this.type = Overlay.getOverlayType('billboard_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('billboard_primitive') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| import { Cesium } from '@dc-modules/namespace' | import { Cesium } from '@dc-modules/namespace' | ||||
| import State from '@dc-modules/state/State' | import State from '@dc-modules/state/State' | ||||
| import { Util } from '@dc-modules/utils' | |||||
| import Overlay from '../Overlay' | import Overlay from '../Overlay' | ||||
| import BillboardPrimitive from './BillboardPrimitive' | import BillboardPrimitive from './BillboardPrimitive' | ||||
| super(position, icon) | super(position, icon) | ||||
| this._currentOffset = new Cesium.Cartesian2(0, 0) | this._currentOffset = new Cesium.Cartesian2(0, 0) | ||||
| this._isUp = true | this._isUp = true | ||||
| this.type = Overlay.getOverlayType('bounce_billboard_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('bounce_billboard_primitive') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @param layer | |||||
| * @private | * @private | ||||
| */ | */ | ||||
| _onAdd(layer) { | |||||
| if (!layer) { | |||||
| _addedHook() { | |||||
| if (!this._delegate || !this._layer) { | |||||
| return | return | ||||
| } | } | ||||
| this._layer = layer | |||||
| this._mountedHook && this._mountedHook() | |||||
| if (this._layer?.delegate?.add && this._delegate) { | |||||
| this._delegate = this._layer.billboards.add(this._delegate) | |||||
| this._layer.delegate.add(this) | |||||
| } | |||||
| this._addedHook && this._addedHook() | |||||
| this._state = State.ADDED | |||||
| this._delegate.layerId = this._layer?.layerId | |||||
| this._delegate.overlayId = this._id | |||||
| this._layer.delegate.add(this) | |||||
| } | } | ||||
| _onRemove() { | |||||
| if (!this._layer || !this._delegate) { | |||||
| /** | |||||
| * | |||||
| * @private | |||||
| */ | |||||
| _removedHook() { | |||||
| if (!this._layer) { | |||||
| return | return | ||||
| } | } | ||||
| if (this._layer?.delegate?.remove) { | |||||
| this._layer.billboards.remove(this._delegate) | |||||
| this._layer.delegate.remove(this) | |||||
| } | |||||
| this._removedHook && this._removedHook() | |||||
| this._state = State.REMOVED | |||||
| this._layer.delegate.remove(this) | |||||
| } | } | ||||
| /** | /** |
| import { Cesium } from '@dc-modules/namespace' | import { Cesium } from '@dc-modules/namespace' | ||||
| import State from '@dc-modules/state/State' | import State from '@dc-modules/state/State' | ||||
| import { Util } from '@dc-modules/utils' | |||||
| import Overlay from '../Overlay' | import Overlay from '../Overlay' | ||||
| import LabelPrimitive from './LabelPrimitive' | import LabelPrimitive from './LabelPrimitive' | ||||
| super(position, text) | super(position, text) | ||||
| this._currentOffset = new Cesium.Cartesian2(0, 0) | this._currentOffset = new Cesium.Cartesian2(0, 0) | ||||
| this._isUp = true | this._isUp = true | ||||
| this.type = Overlay.getOverlayType('bounce_label_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('bounce_label_primitive') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @param layer | |||||
| * @private | * @private | ||||
| */ | */ | ||||
| _onAdd(layer) { | |||||
| if (!layer) { | |||||
| _addedHook() { | |||||
| if (!this._delegate || !this._layer) { | |||||
| return | return | ||||
| } | } | ||||
| this._layer = layer | |||||
| this._mountedHook && this._mountedHook() | |||||
| if (this._layer?.delegate?.add && this._delegate) { | |||||
| this._delegate = this._layer.labels.add(this._delegate) | |||||
| this._layer.delegate.add(this) | |||||
| } | |||||
| this._addedHook && this._addedHook() | |||||
| this._state = State.ADDED | |||||
| this._delegate.layerId = this._layer?.layerId | |||||
| this._delegate.overlayId = this._id | |||||
| this._layer.delegate.add(this) | |||||
| } | } | ||||
| _onRemove() { | |||||
| if (!this._layer || !this._delegate) { | |||||
| /** | |||||
| * | |||||
| * @private | |||||
| */ | |||||
| _removedHook() { | |||||
| if (!this._layer) { | |||||
| return | return | ||||
| } | } | ||||
| if (this._layer?.delegate?.remove) { | |||||
| this._layer.labels.remove(this._delegate) | |||||
| this._layer.delegate.remove(this) | |||||
| } | |||||
| this._removedHook && this._removedHook() | |||||
| this._state = State.REMOVED | |||||
| this._layer.delegate.remove(this) | |||||
| } | } | ||||
| /** | /** |
| this._currentHeight = height || 0 | this._currentHeight = height || 0 | ||||
| this._currentRadius = 10 | this._currentRadius = 10 | ||||
| this._style = { ...DEF_STYLE } | this._style = { ...DEF_STYLE } | ||||
| this.type = Overlay.getOverlayType('diffuse_wall_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('diffuse_wall_primitive') | |||||
| } | |||||
| set center(position) { | set center(position) { | ||||
| this._center = Parse.parsePosition(position) | this._center = Parse.parsePosition(position) | ||||
| return this | return this |
| geometry: {} | geometry: {} | ||||
| }) | }) | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('elec_ellipsoid_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('elec_ellipsoid_primitive') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.geometryInstances.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( | this._delegate.geometryInstances.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( |
| geometry: {} | geometry: {} | ||||
| }) | }) | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('flow_line_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('flow_line_primitive') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ | this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ |
| position: undefined, | position: undefined, | ||||
| text: undefined | text: undefined | ||||
| } | } | ||||
| this.type = Overlay.getOverlayType('label_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('label_primitive') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._modelUrl = modelUrl | this._modelUrl = modelUrl | ||||
| this._delegate = Cesium.Model.fromGltf({ url: modelUrl }) | this._delegate = Cesium.Model.fromGltf({ url: modelUrl }) | ||||
| this.type = Overlay.getOverlayType('model_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('model_primitive') | |||||
| } | |||||
| get readyPromise() { | get readyPromise() { | ||||
| return this._delegate.readyPromise | return this._delegate.readyPromise | ||||
| } | } |
| constructor(position) { | constructor(position) { | ||||
| super() | super() | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this.type = Overlay.getOverlayType('point_primitive') | |||||
| this._delegate = { | this._delegate = { | ||||
| position: undefined | position: undefined | ||||
| } | } | ||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('point_primitive') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| this._delegate = { | this._delegate = { | ||||
| positions: [] | positions: [] | ||||
| } | } | ||||
| this.type = Overlay.getOverlayType('polyline_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('polyline_primitive') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.positions = Transform.transformWGS84ArrayToCartesianArray( | this._delegate.positions = Transform.transformWGS84ArrayToCartesianArray( |
| geometry: {} | geometry: {} | ||||
| }) | }) | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('scan_circle_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('scan_circle_primitive') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.geometryInstances.geometry = new Cesium.EllipseGeometry({ | this._delegate.geometryInstances.geometry = new Cesium.EllipseGeometry({ |
| geometry: {} | geometry: {} | ||||
| }) | }) | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('trail_line_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('trail_line_primitive') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ | this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ |
| }) | }) | ||||
| }) | }) | ||||
| this._video = video | this._video = video | ||||
| this.type = Overlay.getOverlayType('video_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('video_primitive') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( | this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( |
| }), | }), | ||||
| asynchronous: true | asynchronous: true | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('water_primitive') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('water_primitive') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( | this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( |
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._icon = icon | this._icon = icon | ||||
| this._size = [32, 32] | this._size = [32, 32] | ||||
| this.type = Overlay.getOverlayType('billboard') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('billboard') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| } | } | ||||
| } | } | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('box') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('box') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @param position | * @param position |
| this._radius = +radius || 0 | this._radius = +radius || 0 | ||||
| this._rotateAmount = 0 | this._rotateAmount = 0 | ||||
| this._stRotation = 0 | this._stRotation = 0 | ||||
| this.type = Overlay.getOverlayType('circle') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('circle') | |||||
| } | |||||
| set center(center) { | set center(center) { | ||||
| this._center = Parse.parsePosition(center) | this._center = Parse.parsePosition(center) | ||||
| this._delegate.polygon.hierarchy = this._computeHierarchy() | this._delegate.polygon.hierarchy = this._computeHierarchy() | ||||
| set rotateAmount(amount) { | set rotateAmount(amount) { | ||||
| this._rotateAmount = +amount | this._rotateAmount = +amount | ||||
| this._delegate.polygon.stRotation = new Cesium.CallbackProperty(time => { | |||||
| this._delegate.polygon.stRotation = new Cesium.CallbackProperty(() => { | |||||
| this._stRotation += this._rotateAmount | this._stRotation += this._rotateAmount | ||||
| if (this._stRotation >= 360 || this._stRotation <= -360) { | if (this._stRotation >= 360 || this._stRotation <= -360) { | ||||
| this._stRotation = 0 | this._stRotation = 0 |
| super() | super() | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate = new Cesium.Entity({ corridor: {} }) | this._delegate = new Cesium.Entity({ corridor: {} }) | ||||
| this.type = Overlay.getOverlayType('corridor') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('corridor') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.corridor.positions = Transform.transformWGS84ArrayToCartesianArray( | this._delegate.corridor.positions = Transform.transformWGS84ArrayToCartesianArray( |
| this._topRadius = +topRadius || 0 | this._topRadius = +topRadius || 0 | ||||
| this._bottomRadius = +bottomRadius || 0 | this._bottomRadius = +bottomRadius || 0 | ||||
| this._delegate = new Cesium.Entity({ cylinder: {} }) | this._delegate = new Cesium.Entity({ cylinder: {} }) | ||||
| this.type = Overlay.getOverlayType('cylinder') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('cylinder') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| this._semiMajorAxis = +semiMajorAxis || 0 | this._semiMajorAxis = +semiMajorAxis || 0 | ||||
| this._semiMinorAxis = +semiMinorAxis || 0 | this._semiMinorAxis = +semiMinorAxis || 0 | ||||
| this._delegate = new Cesium.Entity({ ellipse: {} }) | this._delegate = new Cesium.Entity({ ellipse: {} }) | ||||
| this.type = Overlay.getOverlayType('ellipse') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('ellipse') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._radius = radius || { x: 10, y: 10, z: 10 } | this._radius = radius || { x: 10, y: 10, z: 10 } | ||||
| this._delegate = new Cesium.Entity({ ellipsoid: {} }) | this._delegate = new Cesium.Entity({ ellipsoid: {} }) | ||||
| this.type = Overlay.getOverlayType('ellipsoid') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('ellipsoid') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| this._delegate = new Cesium.Entity({ label: {} }) | this._delegate = new Cesium.Entity({ label: {} }) | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._text = text | this._text = text | ||||
| this.type = Overlay.getOverlayType('label') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('label') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| plane: new Cesium.Plane(this._normal, this._distance) | plane: new Cesium.Plane(this._normal, this._distance) | ||||
| } | } | ||||
| }) | }) | ||||
| this.type = Overlay.getOverlayType('plane') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('plane') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| super() | super() | ||||
| this._delegate = new Cesium.Entity({ point: {} }) | this._delegate = new Cesium.Entity({ point: {} }) | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this.type = Overlay.getOverlayType('point') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('point') | |||||
| } | |||||
| set position(position) { | set position(position) { | ||||
| this._position = Parse.parsePosition(position) | this._position = Parse.parsePosition(position) | ||||
| this._delegate.position = Transform.transformWGS84ToCartesian( | this._delegate.position = Transform.transformWGS84ToCartesian( |
| this._delegate = new Cesium.Entity({ polygon: {} }) | this._delegate = new Cesium.Entity({ polygon: {} }) | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._holes = [] | this._holes = [] | ||||
| this.type = Overlay.getOverlayType('polygon') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('polygon') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polygon.hierarchy = this._computeHierarchy() | this._delegate.polygon.hierarchy = this._computeHierarchy() |
| super() | super() | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate = new Cesium.Entity({ polyline: {} }) | this._delegate = new Cesium.Entity({ polyline: {} }) | ||||
| this.type = Overlay.getOverlayType('polyline') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('polyline') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polyline.positions = Transform.transformWGS84ArrayToCartesianArray( | this._delegate.polyline.positions = Transform.transformWGS84ArrayToCartesianArray( |
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._shape = shape || [] | this._shape = shape || [] | ||||
| this._delegate = new Cesium.Entity({ polylineVolume: {} }) | this._delegate = new Cesium.Entity({ polylineVolume: {} }) | ||||
| this.type = Overlay.getOverlayType('polyline_volume') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('polyline_volume') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.polylineVolume.positions = Transform.transformWGS84ArrayToCartesianArray( | this._delegate.polylineVolume.positions = Transform.transformWGS84ArrayToCartesianArray( |
| super() | super() | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate = new Cesium.Entity({ rectangle: {} }) | this._delegate = new Cesium.Entity({ rectangle: {} }) | ||||
| this.type = Overlay.getOverlayType('rectangle') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('rectangle') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.rectangle.coordinates = Cesium.Rectangle.fromCartesianArray( | this._delegate.rectangle.coordinates = Cesium.Rectangle.fromCartesianArray( |
| super() | super() | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate = new Cesium.Entity({ wall: {} }) | this._delegate = new Cesium.Entity({ wall: {} }) | ||||
| this.type = Overlay.getOverlayType('wall') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Overlay.getOverlayType('wall') | |||||
| } | |||||
| set positions(positions) { | set positions(positions) { | ||||
| this._positions = Parse.parsePositions(positions) | this._positions = Parse.parsePositions(positions) | ||||
| this._delegate.wall.positions = Transform.transformWGS84ArrayToCartesianArray( | this._delegate.wall.positions = Transform.transformWGS84ArrayToCartesianArray( |
| this._delegate = undefined | this._delegate = undefined | ||||
| this._rotateAmount = 0 | this._rotateAmount = 0 | ||||
| this._enable = false | this._enable = false | ||||
| this.type = 'cloud' | |||||
| this._heading = 0 | this._heading = 0 | ||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return 'cloud' | |||||
| } | |||||
| set enable(enable) { | set enable(enable) { | ||||
| if (!this._viewer.scene.mode === Cesium.SceneMode.SCENE3D) { | if (!this._viewer.scene.mode === Cesium.SceneMode.SCENE3D) { | ||||
| return this | return this |
| this._enable = false | this._enable = false | ||||
| this._fogByDistance = { near: 10, nearValue: 0, far: 2000, farValue: 1.0 } | this._fogByDistance = { near: 10, nearValue: 0, far: 2000, farValue: 1.0 } | ||||
| this._color = new Cesium.Color(0, 0, 0, 1) | this._color = new Cesium.Color(0, 0, 0, 1) | ||||
| this.type = 'fog' | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return 'fog' | |||||
| } | |||||
| set enable(enable) { | set enable(enable) { | ||||
| this._enable = enable | this._enable = enable | ||||
| if (enable && this._viewer && !this._delegate) { | if (enable && this._viewer && !this._delegate) { |
| this._delegate = undefined | this._delegate = undefined | ||||
| this._enable = false | this._enable = false | ||||
| this._speed = 10.0 | this._speed = 10.0 | ||||
| this.type = 'rain' | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return 'rain' | |||||
| } | |||||
| set enable(enable) { | set enable(enable) { | ||||
| this._enable = enable | this._enable = enable | ||||
| if (enable && this._viewer && !this._delegate) { | if (enable && this._viewer && !this._delegate) { |
| this._delegate = undefined | this._delegate = undefined | ||||
| this._enable = false | this._enable = false | ||||
| this._speed = 10.0 | this._speed = 10.0 | ||||
| this.type = 'snow' | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return 'snow' | |||||
| } | |||||
| set enable(enable) { | set enable(enable) { | ||||
| this._enable = enable | this._enable = enable | ||||
| if (enable && this._viewer && !this._delegate) { | if (enable && this._viewer && !this._delegate) { |
| this._enable = false | this._enable = false | ||||
| this._wrapper = undefined | this._wrapper = undefined | ||||
| this._ready = false | this._ready = false | ||||
| this.type = undefined | |||||
| } | } | ||||
| set enable(enable) { | set enable(enable) { |
| this._rotateFrame = undefined | this._rotateFrame = undefined | ||||
| this._mouseMoveHandle = undefined | this._mouseMoveHandle = undefined | ||||
| this._mouseUpHandle = undefined | this._mouseUpHandle = undefined | ||||
| this.type = Widget.getWidgetType('compass') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('compass') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private | ||||
| } | } | ||||
| } | } | ||||
| _handleDoubleClick(event) { | |||||
| _handleDoubleClick() { | |||||
| let scene = this._viewer.scene | let scene = this._viewer.scene | ||||
| let camera = scene.camera | let camera = scene.camera | ||||
| let sscc = scene.screenSpaceCameraController | let sscc = scene.screenSpaceCameraController | ||||
| this._updateAngleAndOpacity(vector, this._compassRectangle.width) | this._updateAngleAndOpacity(vector, this._compassRectangle.width) | ||||
| } | } | ||||
| _orbitTickFunction(e) { | |||||
| _orbitTickFunction() { | |||||
| let scene = this._viewer.scene | let scene = this._viewer.scene | ||||
| let camera = this._viewer.camera | let camera = this._viewer.camera | ||||
| let timestamp = Cesium.getTimestamp() | let timestamp = Cesium.getTimestamp() |
| this._defaultMenu = [ | this._defaultMenu = [ | ||||
| { | { | ||||
| label: '飞到默认位置', | label: '飞到默认位置', | ||||
| callback: e => { | |||||
| callback: () => { | |||||
| this._viewer.camera.flyHome(1.5) | this._viewer.camera.flyHome(1.5) | ||||
| }, | }, | ||||
| context: this | context: this | ||||
| }, | }, | ||||
| { | { | ||||
| label: '取消飞行', | label: '取消飞行', | ||||
| callback: e => { | |||||
| callback: () => { | |||||
| this._viewer.camera.cancelFlight() | this._viewer.camera.cancelFlight() | ||||
| }, | }, | ||||
| context: this | context: this | ||||
| } | } | ||||
| ] | ] | ||||
| this._overlayMenu = [] | this._overlayMenu = [] | ||||
| this.type = Widget.getWidgetType('contextmenu') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('contextmenu') | |||||
| } | |||||
| set DEFAULT_MENU(menus) { | set DEFAULT_MENU(menus) { | ||||
| this._defaultMenu = menus | this._defaultMenu = menus | ||||
| return this | return this |
| this._labelEl = undefined | this._labelEl = undefined | ||||
| this._scaleBarEl = undefined | this._scaleBarEl = undefined | ||||
| this._lastUpdate = Cesium.getTimestamp() | this._lastUpdate = Cesium.getTimestamp() | ||||
| this.type = Widget.getWidgetType('distance_legend') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('distance_legend') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private |
| this._wrapper.setAttribute('id', Util.uuid()) | this._wrapper.setAttribute('id', Util.uuid()) | ||||
| this._baseLayers = [] | this._baseLayers = [] | ||||
| this._map = undefined | this._map = undefined | ||||
| this.type = Widget.getWidgetType('hawkeye_map') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('hawkeye_map') | |||||
| } | |||||
| get baseLayers() { | get baseLayers() { | ||||
| return this._baseLayers | return this._baseLayers | ||||
| } | } |
| constructor() { | constructor() { | ||||
| super() | super() | ||||
| this._wrapper = DomUtil.create('div', 'dc-loading-mask') | this._wrapper = DomUtil.create('div', 'dc-loading-mask') | ||||
| this.type = Widget.getWidgetType('loading_mask') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('loading_mask') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private |
| this._wrapper = DomUtil.create('div', 'dc-location-bar') | this._wrapper = DomUtil.create('div', 'dc-location-bar') | ||||
| this._mouseEl = undefined | this._mouseEl = undefined | ||||
| this._cameraEl = undefined | this._cameraEl = undefined | ||||
| this.type = Widget.getWidgetType('location_bar') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| this._lastMouseUpdate = Cesium.getTimestamp() | this._lastMouseUpdate = Cesium.getTimestamp() | ||||
| this._lastCameraUpdate = Cesium.getTimestamp() | this._lastCameraUpdate = Cesium.getTimestamp() | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('location_bar') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private |
| this._wrapper = DomUtil.create('div', 'dc-slider') | this._wrapper = DomUtil.create('div', 'dc-slider') | ||||
| this._baseLayer = undefined | this._baseLayer = undefined | ||||
| this._moveActive = false | this._moveActive = false | ||||
| this.type = Widget.getWidgetType('map_split') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('map_split') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private |
| this._wrapper = DomUtil.create('div', 'dc-map-switch') | this._wrapper = DomUtil.create('div', 'dc-map-switch') | ||||
| this._config = undefined | this._config = undefined | ||||
| this._cache = [] | this._cache = [] | ||||
| this.type = Widget.getWidgetType('map_switch') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('map_switch') | |||||
| } | |||||
| /** | /** | ||||
| * Override the superclass function | * Override the superclass function | ||||
| * @private | * @private |
| this._wrapper = DomUtil.create('div', 'dc-popup') | this._wrapper = DomUtil.create('div', 'dc-popup') | ||||
| this._config = { customClass: '' } | this._config = { customClass: '' } | ||||
| this._position = undefined | this._position = undefined | ||||
| this.type = Widget.getWidgetType('popup') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('popup') | |||||
| } | |||||
| set config(config) { | set config(config) { | ||||
| this._config = config | this._config = config | ||||
| config.customClass && this._setCustomClass() | config.customClass && this._setCustomClass() |
| super() | super() | ||||
| this._wrapper = DomUtil.create('div', 'dc-tool-tip') | this._wrapper = DomUtil.create('div', 'dc-tool-tip') | ||||
| this._ready = true | this._ready = true | ||||
| this.type = Widget.getWidgetType('tooltip') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('tooltip') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @private | * @private |
| this._zoomInEl = undefined | this._zoomInEl = undefined | ||||
| this._zoomOutEl = undefined | this._zoomOutEl = undefined | ||||
| this._refreshEl = undefined | this._refreshEl = undefined | ||||
| this.type = Widget.getWidgetType('zoom_controller') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Widget.getWidgetType('zoom_controller') | |||||
| } | |||||
| /** | /** | ||||
| * | * | ||||
| * @param scene | * @param scene | ||||
| this._wrapper.appendChild(this._refreshEl) | this._wrapper.appendChild(this._refreshEl) | ||||
| this._wrapper.appendChild(this._zoomOutEl) | this._wrapper.appendChild(this._zoomOutEl) | ||||
| let self = this | let self = this | ||||
| this._zoomInEl.onclick = e => { | |||||
| this._zoomInEl.onclick = () => { | |||||
| self._zoomIn() | self._zoomIn() | ||||
| } | } | ||||
| this._refreshEl.onclick = e => { | |||||
| this._refreshEl.onclick = () => { | |||||
| self._refresh() | self._refresh() | ||||
| } | } | ||||
| this._zoomOutEl.onclick = e => { | |||||
| this._zoomOutEl.onclick = () => { | |||||
| self._zoomOut() | self._zoomOut() | ||||
| } | } | ||||
| this._ready = true | this._ready = true |
| } | } | ||||
| this._data = undefined | this._data = undefined | ||||
| this._canvas = document.createElement('canvas') | this._canvas = document.createElement('canvas') | ||||
| this.type = Layer.getLayerType('wind') | |||||
| this._state = State.INITIALIZED | this._state = State.INITIALIZED | ||||
| } | } | ||||
| get type() { | |||||
| return Layer.getLayerType('wind') | |||||
| } | |||||
| set show(show) { | set show(show) { | ||||
| this._show = show | this._show = show | ||||
| this._canvas.style.visibility = show ? 'visible' : 'hidden' | this._canvas.style.visibility = show ? 'visible' : 'hidden' |