Kaynağa Gözat

完善三维场景组件的功能

tags/1.12.3
Caven Chen 5 yıl önce
ebeveyn
işleme
55cbc8888d

+ 9
- 2
CHANGE.md Dosyayı Görüntüle

# 更新 # 更新


# 1.12.3

## 2020-11-28

> 1. 移除 Cesium 默认地图 token 认证
> 2. 完善三维场景组件功能

# 1.12.2 # 1.12.2


## 2020-11-23 ## 2020-11-23
> 1. 完善webpack打包 > 1. 完善webpack打包
> 2. 完善圆材质旋转动画 > 2. 完善圆材质旋转动画
> 3. 完善模型旋转动画 > 3. 完善模型旋转动画
> 4. 开放部分场景设置功能
> 4. 开放场景部分设置功能


# 1.12.1 # 1.12.1




> 1. 添加位置转换函数 > 1. 添加位置转换函数
> 2. 开放部分 Cesium.Viewer 属性 > 2. 开放部分 Cesium.Viewer 属性
> 3. 完善气泡窗口和DivIcon的内容设置问题
> 3. 完善气泡窗口和DivIcon的内容设置功能
> 4. 优化鹰眼功能 > 4. 优化鹰眼功能


## 1.10.0 ## 1.10.0

+ 1
- 1
dist/dc.base.min.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 1
- 1
dist/dc.core.min.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 30
- 10
src/core/widget/Compass.js Dosyayı Görüntüle

this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


_bindEvent() {
this._viewer.on(SceneEventType.POST_RENDER, this._postRenderHandler, this)
}

_unbindEvent() {
this._viewer.off(SceneEventType.POST_RENDER, this._postRenderHandler, this)
}

/**
*
* @private
*/
_installHook() { _installHook() {
this._createCompassDom()
this._wrapper.onmousedown = e => { this._wrapper.onmousedown = e => {
this._handleMouseDown(e) this._handleMouseDown(e)
} }
} }
} }


/**
*
* @private
*/
_bindEvent() {
this._viewer.on(SceneEventType.POST_RENDER, this._postRenderHandler, this)
}

/**
*
* @private
*/
_unbindEvent() {
this._viewer.off(SceneEventType.POST_RENDER, this._postRenderHandler, this)
}

/**
*
* @private
*/
_postRenderHandler() { _postRenderHandler() {
let heading = this._viewer.camera.heading let heading = this._viewer.camera.heading
this._outRing && this._outRing &&
`) `)
} }


_createCompassDom() {
/**
*
* @private
*/
_mountContent() {
DomUtil.create('div', 'out-ring-bg', this._wrapper) DomUtil.create('div', 'out-ring-bg', this._wrapper)
this._outRing = DomUtil.parseDom(Icon.compass_outer, true, 'out-ring') this._outRing = DomUtil.parseDom(Icon.compass_outer, true, 'out-ring')
this._wrapper.appendChild(this._outRing) this._wrapper.appendChild(this._outRing)
) )
this._wrapper.appendChild(this._rotation_marker) this._wrapper.appendChild(this._rotation_marker)
this._rotation_marker.style.visibility = 'hidden' this._rotation_marker.style.visibility = 'hidden'
this._ready = true
} }


_handleMouseDown(e) { _handleMouseDown(e) {

+ 34
- 6
src/core/widget/ContextMenu.js Dosyayı Görüntüle

this._wrapper = DomUtil.create('div', 'dc-context-menu') this._wrapper = DomUtil.create('div', 'dc-context-menu')
this._ulEl = DomUtil.create('ul', 'menu-list', this._wrapper) this._ulEl = DomUtil.create('ul', 'menu-list', this._wrapper)
this._config = {} this._config = {}
this._positionChangeable = true
this._positionChangeable = false
this.type = Widget.getWidgetType('contextmenu') this.type = Widget.getWidgetType('contextmenu')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }
return this return this
} }


/**
*
* @private
*/
_bindEvent() { _bindEvent() {
this._viewer.on(MouseEventType.RIGHT_CLICK, this._rightClickHandler, this) this._viewer.on(MouseEventType.RIGHT_CLICK, this._rightClickHandler, this)
this._viewer.on(MouseEventType.CLICK, this._clickHandler, this) this._viewer.on(MouseEventType.CLICK, this._clickHandler, this)
} }


/**
*
* @private
*/
_unbindEvent() { _unbindEvent() {
this._viewer.off(MouseEventType.RIGHT_CLICK, this._rightClickHandler, this) this._viewer.off(MouseEventType.RIGHT_CLICK, this._rightClickHandler, this)
this._viewer.off(MouseEventType.CLICK, this._clickHandler, this) this._viewer.off(MouseEventType.CLICK, this._clickHandler, this)
} }


_installHook() {
this._prepareDefaultMenu()
}
_prepareDefaultMenu() {
/**
*
* @private
*/
_mountContent() {
let homeMenu = DomUtil.create('li', 'menu-item', this._ulEl) let homeMenu = DomUtil.create('li', 'menu-item', this._ulEl)
homeMenu.innerHTML = '飞到默认位置' homeMenu.innerHTML = '飞到默认位置'
let self = this let self = this
self._viewer.delegate.camera.flyHome(0) self._viewer.delegate.camera.flyHome(0)
self.hide() self.hide()
} }
this._ready = true
} }


/**
*
* @param e
* @private
*/
_rightClickHandler(e) { _rightClickHandler(e) {
if (e && e.windowPosition && this._enable) { if (e && e.windowPosition && this._enable) {
this._updateWindowCoord(e.windowPosition) this._updateWindowCoord(e.windowPosition)
} }
} }


/**
*
* @param e
* @private
*/
_clickHandler(e) { _clickHandler(e) {
this.hide() this.hide()
} }


/**
*
* @param windowCoord
* @private
*/
_updateWindowCoord(windowCoord) { _updateWindowCoord(windowCoord) {
this._wrapper.style.cssText = ` this._wrapper.style.cssText = `
visibility:visible; visibility:visible;
` `
} }


/**
*
* @private
*/
_setCustomClass() { _setCustomClass() {
DomUtil.setClass( DomUtil.setClass(
this._wrapper, this._wrapper,

+ 8
- 3
src/core/widget/HawkeyeMap.js Dosyayı Görüntüle

return this._baseLayers return this._baseLayers
} }


_mountMap() {
/**
*
* @private
*/
_mountContent() {
let map = new Cesium.Viewer(this._wrapper, { let map = new Cesium.Viewer(this._wrapper, {
...DEF_OPTS, ...DEF_OPTS,
sceneMode: Cesium.SceneMode.SCENE2D sceneMode: Cesium.SceneMode.SCENE2D
}) })
map.imageryLayers.removeAll() map.imageryLayers.removeAll()
map.cesiumWidget._creditContainer.style.display = 'none'
map.cesiumWidget.creditContainer.style.display = 'none'
map.cesiumWidget.screenSpaceEventHandler.removeInputAction( map.cesiumWidget.screenSpaceEventHandler.removeInputAction(
Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
) )
maximumZoomDistance: 40489014.0 maximumZoomDistance: 40489014.0
}) })
this._map = map this._map = map

this._ready = true
} }


_bindEvent() { _bindEvent() {
} }


_installHook() { _installHook() {
this._mountMap()
this._viewer.camera.percentageChanged = 0.01 this._viewer.camera.percentageChanged = 0.01
} }



+ 25
- 2
src/core/widget/LocationBar.js Dosyayı Görüntüle

constructor() { constructor() {
super() super()
this._wrapper = DomUtil.create('div', 'dc-location-bar') this._wrapper = DomUtil.create('div', 'dc-location-bar')
this._mouseEl = DomUtil.create('div', 'mouse-location', this._wrapper)
this._cameraEl = DomUtil.create('div', 'camera-location', this._wrapper)
this._mouseEl = undefined
this._cameraEl = undefined
this.type = Widget.getWidgetType('location_bar') this.type = Widget.getWidgetType('location_bar')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


/**
*
* @private
*/
_bindEvent() { _bindEvent() {
this._viewer.on(MouseEventType.MOUSE_MOVE, this._moveHandler, this) this._viewer.on(MouseEventType.MOUSE_MOVE, this._moveHandler, this)
this._viewer.on(SceneEventType.CAMERA_CHANGED, this._cameraHandler, this) this._viewer.on(SceneEventType.CAMERA_CHANGED, this._cameraHandler, this)
} }


/**
*
* @private
*/
_unbindEvent() { _unbindEvent() {
this._viewer.off(MouseEventType.MOUSE_MOVE, this._moveHandler, this) this._viewer.off(MouseEventType.MOUSE_MOVE, this._moveHandler, this)
this._viewer.off(SceneEventType.CAMERA_CHANGED, this._cameraHandler, this) this._viewer.off(SceneEventType.CAMERA_CHANGED, this._cameraHandler, this)
} }


/**
*
* @private
*/
_mountContent() {
this._mouseEl = DomUtil.create('div', 'mouse-location', this._wrapper)
this._cameraEl = DomUtil.create('div', 'camera-location', this._wrapper)
this._ready = true
}

/**
*
* @param e
* @private
*/
_moveHandler(e) { _moveHandler(e) {
let ellipsoid = Cesium.Ellipsoid.WGS84 let ellipsoid = Cesium.Ellipsoid.WGS84
let cartographic = e.surfacePosition let cartographic = e.surfacePosition

+ 6
- 1
src/core/widget/MapSplit.js Dosyayı Görüntüle

this._state = State.INITIALIZED this._state = State.INITIALIZED
} }


_installHook() {
/**
*
* @private
*/
_mountContent() {
let splitter = DomUtil.parseDom(Icon.splitter, true, 'splitter') let splitter = DomUtil.parseDom(Icon.splitter, true, 'splitter')
this._wrapper.appendChild(splitter) this._wrapper.appendChild(splitter)
let handler = new Cesium.ScreenSpaceEventHandler(splitter) let handler = new Cesium.ScreenSpaceEventHandler(splitter)
handler.setInputAction(() => { handler.setInputAction(() => {
self._moveActive = false self._moveActive = false
}, Cesium.ScreenSpaceEventType.PINCH_END) }, Cesium.ScreenSpaceEventType.PINCH_END)
this._ready = true
} }


_moveHandler(movement) { _moveHandler(movement) {

+ 6
- 1
src/core/widget/MapSwitch.js Dosyayı Görüntüle

} }


/** /**
* 当enable修改后执行的钩子,子类根据需求复写
* Override the superclass function
* @private
*/ */
_enableHook() { _enableHook() {
!this._wrapper.parentNode && !this._wrapper.parentNode &&
this._viewer.dcContainer.appendChild(this._wrapper) this._viewer.dcContainer.appendChild(this._wrapper)
} }


/**
*
* @private
*/
_installHook() { _installHook() {
this.enable = true this.enable = true
let self = this let self = this

+ 14
- 0
src/core/widget/Popup.js Dosyayı Görüntüle

config.customClass && this._setCustomClass() config.customClass && this._setCustomClass()
} }


/**
* Override the superclass function
* @private
*/
_enableHook() {
!this._wrapper.parentNode &&
this._viewer &&
this._viewer.dcContainer.appendChild(this._wrapper)
}

/**
*
* @private
*/
_installHook() { _installHook() {
this.enable = true this.enable = true
} }

+ 1
- 0
src/core/widget/Tooltip.js Dosyayı Görüntüle

constructor() { constructor() {
super() super()
this._wrapper = DomUtil.create('div', 'dc-tool-tip') this._wrapper = DomUtil.create('div', 'dc-tool-tip')
this._ready = true
this.type = Widget.getWidgetType('tooltip') this.type = Widget.getWidgetType('tooltip')
this._state = State.INITIALIZED this._state = State.INITIALIZED
} }

+ 8
- 0
src/core/widget/Widget.js Dosyayı Görüntüle

this._enable = false this._enable = false
this._wrapper = undefined this._wrapper = undefined
this._positionChangeable = false this._positionChangeable = false
this._ready = false
this.type = undefined this.type = undefined
} }


return this._state return this._state
} }


/**
* mount content
* @private
*/
_mountContent() {}

/** /**
* binds event * binds event
* @private * @private
this._viewer.dcContainer.appendChild(this._wrapper) this._viewer.dcContainer.appendChild(this._wrapper)
this._wrapper && this._wrapper &&
(this._wrapper.style.visibility = this._enable ? 'visible' : 'hidden') (this._wrapper.style.visibility = this._enable ? 'visible' : 'hidden')
!this._ready && this._mountContent()
this._enable ? this._bindEvent() : this._unbindEvent() this._enable ? this._bindEvent() : this._unbindEvent()
} }



Loading…
İptal
Kaydet