ソースを参照

修复部分bug,添加面的拉升动画

tags/1.0.0
Caven 5年前
コミット
9de64d5326

+ 0
- 1
.prettierrc ファイルの表示

{ {
"eslintIntegration": true, "eslintIntegration": true,
"singleQuote": true, "singleQuote": true,
"printWidth": 150,
"semi": false "semi": false
} }

+ 0
- 0
material/index.js ファイルの表示


+ 22
- 6
src/core/event/MouseEvent.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2019-12-31 16:58:31 * @Date: 2019-12-31 16:58:31
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 14:45:04
* @Last Modified time: 2020-02-04 13:27:36
*/ */


import Cesium from '@/namespace' import Cesium from '@/namespace'
this._handler = new Cesium.ScreenSpaceEventHandler(this._viewer.canvas) this._handler = new Cesium.ScreenSpaceEventHandler(this._viewer.canvas)
this._registerEvent() this._registerEvent()
this.on(Cesium.ScreenSpaceEventType.LEFT_CLICK, this._clickCallback, this) this.on(Cesium.ScreenSpaceEventType.LEFT_CLICK, this._clickCallback, this)
this.on(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, this._dbclickCallback, this)
this.on(Cesium.ScreenSpaceEventType.RIGHT_CLICK, this._rightClickCallback, this)
this.on(Cesium.ScreenSpaceEventType.MOUSE_MOVE, this._mouseMoveCallback, this)
this.on(
Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
this._dbclickCallback,
this
)
this.on(
Cesium.ScreenSpaceEventType.RIGHT_CLICK,
this._rightClickCallback,
this
)
this.on(
Cesium.ScreenSpaceEventType.MOUSE_MOVE,
this._mouseMoveCallback,
this
)
} }


/** /**
let feature = undefined let feature = undefined
if (target.id && target.id instanceof Cesium.Entity) { if (target.id && target.id instanceof Cesium.Entity) {
layer = target.id.layer layer = target.id.layer
if (layer) {
if (layer && layer.getOverlay) {
overlay = layer.getOverlay(target.id.id) overlay = layer.getOverlay(target.id.id)
} }
//todo //todo
} }
let target = this._viewer.scene.pick(movement.position) let target = this._viewer.scene.pick(movement.position)
let cartesian = this._viewer.scene.pickPosition(movement.position) let cartesian = this._viewer.scene.pickPosition(movement.position)
this._raiseEvent(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, target, cartesian)
this._raiseEvent(
Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
target,
cartesian
)
} }


/** /**

+ 4
- 1
src/core/layer/DC.GeoJsonLayer.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-13 10:13:53 * @Date: 2020-01-13 10:13:53
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-01-31 15:05:07
* @Last Modified time: 2020-02-03 13:44:14
*/ */
import Cesium from '@/namespace' import Cesium from '@/namespace'
import Layer from './Layer' import Layer from './Layer'
return this return this
} }


/**
*
*/
toVectorLayer() { toVectorLayer() {
let layer = new DC.VectorLayer(this._id) let layer = new DC.VectorLayer(this._id)
let self = this let self = this

+ 1
- 1
src/core/layer/DC.TilesetLayer.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-09 09:16:27 * @Date: 2020-01-09 09:16:27
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-01-31 15:05:09
* @Last Modified time: 2020-02-02 14:10:48
*/ */


import Cesium from '@/namespace' import Cesium from '@/namespace'

+ 9
- 2
src/core/layer/Layer.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-03 09:38:21 * @Date: 2020-01-03 09:38:21
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-01-31 15:05:35
* @Last Modified time: 2020-02-02 14:18:15
*/ */
import LayerEvent from '../event/LayerEvent' import LayerEvent from '../event/LayerEvent'




clear() {} clear() {}


/**
*
*/
remove() { remove() {
if (this._viewer) { if (this._viewer) {
this._viewer.removeLayer(this) this._viewer.removeLayer(this)
} }
} }


/**
*
* @param {*} viewer
*/
addToViewer(viewer) { addToViewer(viewer) {
if (viewer) {
if (viewer && viewer.addLayer) {
viewer.addLayer(this) viewer.addLayer(this)
} }
return this return this

+ 4
- 3
src/core/option/ViewerOption.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2019-12-30 09:24:37 * @Date: 2019-12-30 09:24:37
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-01-31 15:05:52
* @Last Modified time: 2020-02-01 21:44:39
*/ */


import Cesium from '@/namespace' import Cesium from '@/namespace'
} }


_init() { _init() {
this._viewer.delegate._cesiumWidget._creditContainer.style.display = 'none'
this._viewer.delegate.scene.backgroundColor = Cesium.Color.TRANSPARENT
this._viewer.delegate.cesiumWidget._creditContainer.style.display = 'none'
this._viewer.delegate.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK) this._viewer.delegate.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)
this._viewer.delegate.scene.screenSpaceCameraController.maximumZoomDistance = 40489014.0
this._viewer.delegate.scene.backgroundColor = Cesium.Color.TRANSPARENT
} }


_setViewerOption(options) { _setViewerOption(options) {

+ 38
- 2
src/core/overlay/Overlay.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-03 12:18:17 * @Date: 2020-01-03 12:18:17
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 11:57:48
* @Last Modified time: 2020-02-04 14:29:34
*/ */
import OverlayEvent from '../event/OverlayEvent' import OverlayEvent from '../event/OverlayEvent'
class Overlay { class Overlay {
this._attr = {} this._attr = {}
this._overlayEvent = new OverlayEvent() this._overlayEvent = new OverlayEvent()
this._overlayEvent.on(DC.OverlayEventType.ADD, this._addCallback, this) this._overlayEvent.on(DC.OverlayEventType.ADD, this._addCallback, this)
this._overlayEvent.on(DC.OverlayEventType.REMOVE, this._removeCallback, this)
this._overlayEvent.on(
DC.OverlayEventType.REMOVE,
this._removeCallback,
this
)
this.type = undefined this.type = undefined
} }


this._layer.layerEvent.fire(DC.LayerEventType.REMOVE_OVERLAY, this) this._layer.layerEvent.fire(DC.LayerEventType.REMOVE_OVERLAY, this)
} }
} }

/**
*
* @param {*} type
* @param {*} callback
* @param {*} context
*/
on(type, callback, context) {
this._overlayEvent.on(type, callback, context || this)
return this
}

/**
*
* @param {*} type
* @param {*} callback
* @param {*} context
*/
off(type, callback, context) {
this._overlayEvent.off(type, callback, context || this)
return this
}

/**
*
* @param {*} type
* @param {*} param
*/
fire(type, params) {
this._overlayEvent.fire(type, params)
return this
}
} }


export default Overlay export default Overlay

+ 5
- 2
src/core/overlay/base/DC.Billboard.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-19 10:18:23 * @Date: 2020-01-19 10:18:23
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 12:05:36
* @Last Modified time: 2020-02-01 18:31:04
*/ */


import Cesium from '@/namespace' import Cesium from '@/namespace'
* @param {*} text * @param {*} text
* @param {*} textStyle * @param {*} textStyle
*/ */
bindLabel(text, textStyle) {
setLabel(text, textStyle) {
this._delegate.label = { this._delegate.label = {
...textStyle, ...textStyle,
text: text text: text
let billboard = undefined let billboard = undefined
if (entity.billboard) { if (entity.billboard) {
billboard = new DC.Billboard(position, entity.billboard.image) billboard = new DC.Billboard(position, entity.billboard.image)
billboard.attr = {
name: entity.name
}
billboard.setStyle({ billboard.setStyle({
...entity.billboard ...entity.billboard
}) })

+ 2
- 2
src/core/overlay/base/DC.Cricle.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-31 18:57:02 * @Date: 2020-01-31 18:57:02
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 12:04:08
* @Last Modified time: 2020-02-01 18:29:13
*/ */
import Cesium from '@/namespace' import Cesium from '@/namespace'
import Overlay from '../Overlay' import Overlay from '../Overlay'
* @param {*} text * @param {*} text
* @param {*} textStyle * @param {*} textStyle
*/ */
bindLabel(text, textStyle) {
setLabel(text, textStyle) {
this._delegate.label = { this._delegate.label = {
text: text, text: text,
...textStyle ...textStyle

+ 5
- 1
src/core/overlay/base/DC.Point.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-06 15:03:25 * @Date: 2020-01-06 15:03:25
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 11:58:47
* @Last Modified time: 2020-02-01 18:29:54
*/ */


import Cesium from '@/namespace' import Cesium from '@/namespace'
this._delegate.overlayId = this._id this._delegate.overlayId = this._id
} }


/**
*
* @param {*} style
*/
setStyle(style) { setStyle(style) {
if (Object.keys(style).length === 0) { if (Object.keys(style).length === 0) {
return return

+ 65
- 8
src/core/overlay/base/DC.Polygon.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-09 09:10:37 * @Date: 2020-01-09 09:10:37
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 11:58:54
* @Last Modified time: 2020-02-04 15:24:43
*/ */
import Overlay from '../Overlay' import Overlay from '../Overlay'
import Cesium from '@/namespace' import Cesium from '@/namespace'


DC.Polygon = class extends Overlay { DC.Polygon = class extends Overlay {
constructor(positions) { constructor(positions) {
if (!positions || (typeof positions !== 'string' && !Array.isArray(positions))) {
if (
!positions ||
(typeof positions !== 'string' && !Array.isArray(positions))
) {
throw new Error('the positions invalid') throw new Error('the positions invalid')
} }
super() super()
} }


get center() { get center() {
let boundingSphere = Cesium.BoundingSphere.fromPoints(DC.T.transformWSG84ArrayToCartesianArray(this._positions))
let boundingSphere = Cesium.BoundingSphere.fromPoints(
DC.T.transformWSG84ArrayToCartesianArray(this._positions)
)
return DC.T.transformCartesianToWSG84(boundingSphere.center) return DC.T.transformCartesianToWSG84(boundingSphere.center)
} }


let positions = [...this._positions] let positions = [...this._positions]
positions.push(positions[0]) positions.push(positions[0])
for (let i = 1; i < positions.length; i++) { for (let i = 1; i < positions.length; i++) {
let oel = ellipsoid.cartographicToCartesian(DC.T.transformWSG84ToCartographic(positions[i - 1]))
let el = ellipsoid.cartographicToCartesian(DC.T.transformWSG84ToCartographic(positions[i]))
let oel = ellipsoid.cartographicToCartesian(
DC.T.transformWSG84ToCartographic(positions[i - 1])
)
let el = ellipsoid.cartographicToCartesian(
DC.T.transformWSG84ToCartographic(positions[i])
)
h += oel.x * el.y - el.x * oel.y h += oel.x * el.y - el.x * oel.y
} }
result = Math.abs(h).toFixed(2) result = Math.abs(h).toFixed(2)
_prepareHierarchy() { _prepareHierarchy() {
let result = new Cesium.PolygonHierarchy() let result = new Cesium.PolygonHierarchy()
result.positions = DC.T.transformWSG84ArrayToCartesianArray(this._positions) result.positions = DC.T.transformWSG84ArrayToCartesianArray(this._positions)
result.holes = this._holes.map(item => new Cesium.PolygonHierarchy(DC.T.transformWSG84ArrayToCartesianArray(item)))
result.holes = this._holes.map(
item =>
new Cesium.PolygonHierarchy(
DC.T.transformWSG84ArrayToCartesianArray(item)
)
)
return result return result
} }


} }
} }


/**
*
* @param {*} extrudedHeight
* @param {*} duration
*/
setExtrudedHeight(extrudedHeight, duration) {
if (this._delegate.polygon) {
let now = Cesium.JulianDate.now()
let oriValue = this._delegate.polygon.extrudedHeight
? this._delegate.polygon.extrudedHeight.getValue(now)
: 0
let rate = 0
let stopTime = now
if (duration) {
rate = (extrudedHeight - oriValue) / duration
stopTime = DC.JulianDate.addSeconds(
now,
duration,
new Cesium.JulianDate()
)
}
this._delegate.polygon.extrudedHeight = new Cesium.CallbackProperty(
time => {
let result = 0
if (DC.JulianDate.greaterThan(stopTime, time)) {
result =
oriValue +
(duration - Cesium.JulianDate.secondsDifference(stopTime, time)) *
rate
} else {
result = extrudedHeight
}
return result
}
)
}
return this
}

/**
*
* @param {*} style
*/
setStyle(style) { setStyle(style) {
if (Object.keys(style).length == 0) {
if (!style || Object.keys(style).length === 0) {
return return
} }
this._style = style this._style = style
this._delegate.polygon && this._delegate.polygon.merge(this._style)
this._delegate.polygon && this._delegate.polygon.merge(style)
return this return this
} }



+ 22
- 6
src/core/overlay/base/DC.Polyline.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-06 15:03:25 * @Date: 2020-01-06 15:03:25
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 11:59:05
* @Last Modified time: 2020-02-04 14:14:16
*/ */


import Overlay from '../Overlay' import Overlay from '../Overlay'


DC.Polyline = class extends Overlay { DC.Polyline = class extends Overlay {
constructor(positions) { constructor(positions) {
if (!positions || (typeof positions !== 'string' && !Array.isArray(positions))) {
if (
!positions ||
(typeof positions !== 'string' && !Array.isArray(positions))
) {
throw new Error('the positions invalid') throw new Error('the positions invalid')
} }
super() super()
} }


get center() { get center() {
let boundingSphere = Cesium.BoundingSphere.fromPoints(DC.T.transformWSG84ArrayToCartesianArray(this._positions))
let boundingSphere = Cesium.BoundingSphere.fromPoints(
DC.T.transformWSG84ArrayToCartesianArray(this._positions)
)
return DC.T.transformCartesianToWSG84(boundingSphere.center) return DC.T.transformCartesianToWSG84(boundingSphere.center)
} }


get distance() { get distance() {
let result = 0 let result = 0
for (var i = 0; i < this._positions.length - 1; i++) { for (var i = 0; i < this._positions.length - 1; i++) {
let startCartographic = DC.T.transformWSG84ToCartographic(this._positions[i])
let endCartographic = DC.T.transformWSG84ToCartographic(this._positions[i + 1])
let startCartographic = DC.T.transformWSG84ToCartographic(
this._positions[i]
)
let endCartographic = DC.T.transformWSG84ToCartographic(
this._positions[i + 1]
)
let geodesic = new Cesium.EllipsoidGeodesic() let geodesic = new Cesium.EllipsoidGeodesic()
geodesic.setEndPoints(startCartographic, endCartographic) geodesic.setEndPoints(startCartographic, endCartographic)
let s = geodesic.surfaceDistance let s = geodesic.surfaceDistance
s = Math.sqrt(Math.pow(s, 2) + Math.pow(endCartographic.height - startCartographic.height, 2))
s = Math.sqrt(
Math.pow(s, 2) +
Math.pow(endCartographic.height - startCartographic.height, 2)
)
result = result + s result = result + s
} }
return result > 0 ? result.toFixed(2) : result return result > 0 ? result.toFixed(2) : result
this._delegate.overlayId = this._id this._delegate.overlayId = this._id
} }


/**
*
* @param {*} style
*/
setStyle(style) { setStyle(style) {
if (Object.keys(style).length == 0) { if (Object.keys(style).length == 0) {
return return

+ 2
- 2
src/core/overlay/model/DC.Model.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-06 15:03:25 * @Date: 2020-01-06 15:03:25
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 12:05:10
* @Last Modified time: 2020-02-02 16:45:32
*/ */


import Overlay from '../Overlay' import Overlay from '../Overlay'
* @param {*} text * @param {*} text
* @param {*} textStyle * @param {*} textStyle
*/ */
bindLabel(text, textStyle) {
setLabel(text, textStyle) {
this._delegate.label = { this._delegate.label = {
...textStyle, ...textStyle,
text: text text: text

+ 116
- 6
src/core/overlay/model/DC.Tileset.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-07 08:51:56 * @Date: 2020-01-07 08:51:56
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 12:06:52
* @Last Modified time: 2020-02-03 13:41:06
*/ */
import Cesium from '@/namespace' import Cesium from '@/namespace'
import Overlay from '../Overlay' import Overlay from '../Overlay'
...options ...options
}) })
this._state = DC.OverlayState.INITIALIZED this._state = DC.OverlayState.INITIALIZED
this._delegate.tileVisible.addEventListener(this._tileVisibleHandler, this)
this._propertyMap = undefined
}

/**
*
*/
get readyPromise() {
return this._delegate.readyPromise
} }


/** /**
*/ */
_addCallback(layer) { _addCallback(layer) {
this._layer = layer this._layer = layer
this._layer.delegate.add(this._delegate)
this._state = DC.OverlayState.ADDED
this._delegate.readyPromise.then(tileset => {
this._layer.delegate.add(tileset)
this._state = DC.OverlayState.ADDED
})
} }


/** /**
*/ */
_removeCallback() { _removeCallback() {
if (this._layer) { if (this._layer) {
this._layer.delegate.remove(this._delegate)
this._state = DC.OverlayState.REMOVED
this._delegate.readyPromise.then(tileset => {
this._layer.delegate.remove(tileset)
this._state = DC.OverlayState.REMOVED
})
}
}
/**
*
* @param {*} tile
*/
_tileVisibleHandler(tile) {
if (this._properties && this._properties.length) {
let content = tile.content
for (let i = 0; i < content.featuresLength; i++) {
let feature = content.getFeature(i)
this._properties.forEach(property => {
if (
feature.hasProperty(property.key) &&
feature.getProperty(property.key) === property.keyValue
) {
feature.setProperty(property.propertyName, property.propertyValue)
}
})
}
} }
} }


/**
*
* @param {*} position
*/
setPosition(position) {
if (!position || !position instanceof DC.Position) {
return this
}
this._delegate.readyPromise.then(tileset => {
let modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt)
)
let rotationX = Cesium.Matrix4.fromRotationTranslation(
Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(position.heading))
)
Cesium.Matrix4.multiply(modelMatrix, rotationX, modelMatrix)
tileset.root.transform = modelMatrix
})
return this
}

/**
*
* @param {*} height
*/
setHeight(height) {
this._delegate.readyPromise.then(tileset => {
let cartographic = Cesium.Cartographic.fromCartesian(
tileset.boundingSphere.center
)
let surface = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
cartographic.height
)
let offset = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
cartographic.height + height
)
let translation = Cesium.Cartesian3.subtract(
offset,
surface,
new Cesium.Cartesian3()
)
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation)
})
return this
}

/**
*
* @param {*} scale
*/
setScale(scale) {
this._delegate.readyPromise.then(tileset => {
let modelMatrix = tileset.root.transform
if (scale > 0 && scale !== 1) {
Cesium.Matrix4.multiplyByUniformScale(modelMatrix, scale, modelMatrix)
}
tileset.root.transform = modelMatrix
})
return this
}

/**
*
*/
setFeatureProperty(properties) {
this._properties = properties
return this
}

/**
*
* @param {*} style
*/
setStyle(style) { setStyle(style) {
if (style && style instanceof Cesium.TilesetStyle) {
if (style && style instanceof Cesium.Cesium3DTileStyle) {
this._style = style this._style = style
this._delegate && (this._delegate.style = this._style) this._delegate && (this._delegate.style = this._style)
} }

+ 9
- 2
src/core/position/DC.Position.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2019-12-27 14:35:02 * @Date: 2019-12-27 14:35:02
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-01-31 15:07:00
* @Last Modified time: 2020-02-03 14:37:45
*/ */


DC.Position = class { DC.Position = class {
} }


serialize() { serialize() {
let position = new DC.Position(this._lng, this._lat, this._alt, this._heading, this._pitch, this._roll)
let position = new DC.Position(
this._lng,
this._lat,
this._alt,
this._heading,
this._pitch,
this._roll
)
return JSON.stringify(position) return JSON.stringify(position)
} }



+ 52
- 7
src/core/viewer/DC.Viewer.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2019-12-27 17:13:24 * @Date: 2019-12-27 17:13:24
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 14:54:59
* @Last Modified time: 2020-02-02 20:45:25
*/ */


import Cesium from '@/namespace' import Cesium from '@/namespace'
this._viewerOption = new ViewerOption(this) // Initialize the viewer option this._viewerOption = new ViewerOption(this) // Initialize the viewer option
this._cameraOption = new CameraOption(this) // Initialize the camera option this._cameraOption = new CameraOption(this) // Initialize the camera option
this._viewerEvent = new ViewerEvent() // Register viewer events this._viewerEvent = new ViewerEvent() // Register viewer events
this._dcContainer = DC.DomUtil.create('div', 'dc-container', document.getElementById(id)) //Register the custom container
this._baseLayerPicker = new Cesium.BaseLayerPickerViewModel({ globe: this._delegate.scene.globe })
this._dcContainer = DC.DomUtil.create(
'div',
'dc-container',
document.getElementById(id)
) //Register the custom container
this._baseLayerPicker = new Cesium.BaseLayerPickerViewModel({
globe: this._delegate.scene.globe
})
this._layerCache = {} this._layerCache = {}
this.on(DC.ViewerEventType.ADD_LAYER, this._addLayerCallback, this) //Initialize layer add event this.on(DC.ViewerEventType.ADD_LAYER, this._addLayerCallback, this) //Initialize layer add event
this.on(DC.ViewerEventType.REMOVE_LAYER, this._removeLayerCallback, this) //Initialize layer remove event this.on(DC.ViewerEventType.REMOVE_LAYER, this._removeLayerCallback, this) //Initialize layer remove event
return this._delegate.scene.canvas return this._delegate.scene.canvas
} }


get clock() {
return this._delegate.clock
}

get viewerEvent() { get viewerEvent() {
return this._viewerEvent return this._viewerEvent
} }
_removeLayerCallback(layer) { _removeLayerCallback(layer) {
if (layer && layer.layerEvent && layer.state !== DC.LayerState.REMOVED) { if (layer && layer.layerEvent && layer.state !== DC.LayerState.REMOVED) {
layer.layerEvent.fire(DC.LayerEventType.REMOVE, this) layer.layerEvent.fire(DC.LayerEventType.REMOVE, this)
if (this._layerCache[layer.type] && this._layerCache[layer.type][layer.id]) {
if (
this._layerCache[layer.type] &&
this._layerCache[layer.type][layer.id]
) {
delete this._layerCache[layer.type][layer.id] delete this._layerCache[layer.type][layer.id]
} }
} }
*/ */
changeBaseLayer(index) { changeBaseLayer(index) {
if (this._baseLayerPicker && index >= 0) { if (this._baseLayerPicker && index >= 0) {
this._baseLayerPicker.selectedImagery = this._baseLayerPicker.imageryProviderViewModels[index]
this._baseLayerPicker.selectedImagery = this._baseLayerPicker.imageryProviderViewModels[
index
]
} }
return this return this
} }


removeEffect(effect) {} removeEffect(effect) {}


/**
*
* @param {*} target
*/
flyTo(target) { flyTo(target) {
this._delegate.flyTo(target.delegate || target) this._delegate.flyTo(target.delegate || target)
return this return this
} }


/**
*
* @param {*} target
*/
zoomTo(target) { zoomTo(target) {
this._delegate.zoomTo(target.delegate || target) this._delegate.zoomTo(target.delegate || target)
return this return this
} }


flyToPosition(position, completeCallback) {
/**
*
* @param {*} position
* @param {*} completeCallback
*/
flyToPosition(position, completeCallback, duration) {
if (position instanceof DC.Position) { if (position instanceof DC.Position) {
this._delegate.camera.flyTo({ this._delegate.camera.flyTo({
destination: DC.T.transformWSG84ToCartesian(position), destination: DC.T.transformWSG84ToCartesian(position),
pitch: Cesium.Math.toRadians(position.pitch), pitch: Cesium.Math.toRadians(position.pitch),
roll: Cesium.Math.toRadians(position.roll) roll: Cesium.Math.toRadians(position.roll)
}, },
complete: completeCallback
complete: completeCallback,
duration: duration
}) })
} }
return this return this
} }


/**
*
* @param {*} type
* @param {*} callback
* @param {*} context
*/
on(type, callback, context) { on(type, callback, context) {
this._viewerEvent.on(type, callback, context || this) this._viewerEvent.on(type, callback, context || this)
return this return this
} }


/**
*
* @param {*} type
* @param {*} callback
* @param {*} context
*/
off(type, callback, context) { off(type, callback, context) {
this._viewerEvent.off(type, callback, context || this) this._viewerEvent.off(type, callback, context || this)
return this return this
} }


/**
*
* @param {*} plugin
*/
use(plugin) { use(plugin) {
if (plugin && plugin.install) { if (plugin && plugin.install) {
plugin.install(this) plugin.install(this)

+ 3
- 3
src/core/widget/ContextMenu.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2019-12-31 17:32:01 * @Date: 2019-12-31 17:32:01
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 16:00:40
* @Last Modified time: 2020-02-01 18:57:30
*/ */
import Cesium from '@/namespace' import Cesium from '@/namespace'
import Widget from './Widget' import Widget from './Widget'
} }
} }
_rightclickHandler(e) { _rightclickHandler(e) {
if (e && e.position && this._enable) {
if (e && e.position && this._enable && this._updateWindowCoord) {
this._updateWindowCoord(Cesium.SceneTransforms.wgs84ToWindowCoordinates(this._viewer.delegate.scene, e.position)) this._updateWindowCoord(Cesium.SceneTransforms.wgs84ToWindowCoordinates(this._viewer.delegate.scene, e.position))
} }
} }
this._wapper.style.cssText = ` this._wapper.style.cssText = `
visibility:visible; visibility:visible;
z-index:1; z-index:1;
transform:translate3d(${windowCoord.x}px,${windowCoord.y}px, 0);
transform:translate3d(${Math.round(windowCoord.x)}px,${Math.round(windowCoord.y)}px, 0);
` `
} }



+ 35
- 6
src/core/widget/Popup.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-15 19:16:45 * @Date: 2020-01-15 19:16:45
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 15:04:08
* @Last Modified time: 2020-02-01 19:02:13
*/ */


import Widget from './Widget' import Widget from './Widget'
constructor() { constructor() {
super() super()
this._wapper = DC.DomUtil.create('div', 'dc-popup') this._wapper = DC.DomUtil.create('div', 'dc-popup')
this._contentEl = DC.DomUtil.create('div', 'popup-content', this._wapper)
this._config = undefined
} }


_setWindowCoord(windowCoord) {
let x = windowCoord.x + 10
let y = windowCoord.y - this._wapper.offsetHeight / 2
this._wapper.style.zIndex = 1
this._wapper.style.transform = `translate3d(${x}px,${y}px, 0)`
_installHook() {
this.enable = true
}

_updateWindowCoord(windowCoord) {
let x = windowCoord.x - this._wapper.offsetWidth / 2
let y = windowCoord.y - this._wapper.offsetHeight
if (this._config && this._config.position === 'left') {
x = windowCoord.x - this._wapper.offsetWidth
} else if (this._config && this._config.position === 'right') {
x = windowCoord.x
}
if (this._config && this._config.arrow) {
}
this._wapper.style.cssText = `
visibility:visible;
z-index:1;
transform:translate3d(${Math.round(x)}px,${Math.round(y)}px, 0);
`
}

_setCustomClass() {}

_setCustomBg() {}

_setArrowStyle() {}

set config(config) {
this._config = config
config.customClass && this._setCustomClass()
config.customBg && this._setCustomBg()
config.arrow && this._setArrowStyle()
} }
} }



+ 3
- 3
src/core/widget/Tooltip.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-02-01 12:07:54 * @Date: 2020-02-01 12:07:54
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 15:01:25
* @Last Modified time: 2020-02-01 18:58:59
*/ */


import Widget from './Widget' import Widget from './Widget'
_updateWindowCoord(windowCoord) { _updateWindowCoord(windowCoord) {
let x = windowCoord.x + 10 let x = windowCoord.x + 10
let y = windowCoord.y - this._wapper.offsetHeight / 2 let y = windowCoord.y - this._wapper.offsetHeight / 2
this._wapper.cssText = `
this._wapper.style.cssText = `
visibility:visible; visibility:visible;
z-index:1; z-index:1;
transform:translate3d(${x}px,${y}px, 0);
transform:translate3d(${Math.round(x)}px,${Math.round(y)}px, 0);
` `
} }
} }

+ 4
- 2
src/core/widget/Widget.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-15 19:17:52 * @Date: 2020-01-15 19:17:52
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 15:06:09
* @Last Modified time: 2020-02-01 18:53:59
*/ */
import Cesium from '@/namespace' import Cesium from '@/namespace'


let self = this let self = this
let scene = this._viewer.scene let scene = this._viewer.scene
scene.postRender.addEventListener(() => { scene.postRender.addEventListener(() => {
if (self._position && self._enable) {
if (self._position && self._enable && self._updateWindowCoord) {
let windowCoord = Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, self._position) let windowCoord = Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, self._position)
self._updateWindowCoord(windowCoord) self._updateWindowCoord(windowCoord)
} }
*/ */
setPosition(position) { setPosition(position) {
this._position = position this._position = position
return this
} }


/** /**
} else if (content && content instanceof Element) { } else if (content && content instanceof Element) {
this._wapper.appendChild(content) this._wapper.appendChild(content)
} }
return this
} }


/** /**

+ 0
- 0
src/plugins/shader/CircleWave.glsl ファイルの表示


+ 0
- 1
src/themes/contextmenu.scss ファイルの表示

top: 0; top: 0;
min-width: 120px; min-width: 120px;
min-height: 10px; min-height: 10px;
color: #fff;
padding: 10px 10px; padding: 10px 10px;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
border-radius: 4px; border-radius: 4px;

+ 2
- 1
src/themes/index.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2020-01-21 10:48:50 * @Date: 2020-01-21 10:48:50
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-02-01 14:13:18
* @Last Modified time: 2020-02-01 18:47:02
*/ */
import 'cesium/Widgets/widgets.css' import 'cesium/Widgets/widgets.css'
import './index.scss' import './index.scss'
import './popup.scss'
import './tooltip.scss' import './tooltip.scss'
import './contextmenu.scss' import './contextmenu.scss'

+ 13
- 0
src/themes/popup.scss ファイルの表示

.dc-popup {
position: absolute;
left: 0;
top: 0;
min-width: 120px;
min-height: 10px;
padding: 10px 10px;
background: rgba(255, 255, 255, 1);
border-radius: 4px;
visibility: hidden;
z-index: -1;
cursor: pointer;
}

+ 6
- 3
src/thirdpart/index.js ファイルの表示

* @Author: Caven * @Author: Caven
* @Date: 2019-12-30 09:35:51 * @Date: 2019-12-30 09:35:51
* @Last Modified by: Caven * @Last Modified by: Caven
* @Last Modified time: 2020-01-31 15:10:07
* @Last Modified time: 2020-02-04 14:21:26
*/ */
import Cesium from '../namespace'
import Cesium from '@/namespace'


DC.Color = Cesium.Color DC.Color = Cesium.Color


DC.Cartesian2 = Cesium.Cartesian2 DC.Cartesian2 = Cesium.Cartesian2
DC.Cartesian3 = Cesium.Cartesian3 DC.Cartesian3 = Cesium.Cartesian3
DC.Cartesian4 = Cesium.Cartesian4 DC.Cartesian4 = Cesium.Cartesian4

DC.TilesetStyle = Cesium.Cesium3DTileStyle DC.TilesetStyle = Cesium.Cesium3DTileStyle
DC.SceneMode = Cesium.SceneMode

DC.CallbackProperty = Cesium.CallbackProperty
DC.JulianDate = Cesium.JulianDate


DC.Math = Cesium.Math DC.Math = Cesium.Math

読み込み中…
キャンセル
保存