| * @Date: 2021-02-21 17:50:31 | * @Date: 2021-02-21 17:50:31 | ||||
| */ | */ | ||||
| import { Cesium } from '@dc-modules/namespace' | |||||
| const { | |||||
| import { | |||||
| BoxGeometry, | BoxGeometry, | ||||
| Cartesian3, | Cartesian3, | ||||
| defined, | defined, | ||||
| BlendingState, | BlendingState, | ||||
| SceneMode, | SceneMode, | ||||
| ShaderProgram, | ShaderProgram, | ||||
| ShaderSource | |||||
| } = Cesium | |||||
| ShaderSource, | |||||
| SkyBox | |||||
| } from '@cesium/engine' | |||||
| const SkyBoxFS = ` | const SkyBoxFS = ` | ||||
| uniform samplerCube u_cubeMap; | uniform samplerCube u_cubeMap; | ||||
| } | } | ||||
| ` | ` | ||||
| class GroundSkyBox extends Cesium.SkyBox { | |||||
| class GroundSkyBox extends SkyBox { | |||||
| constructor(options = {}) { | constructor(options = {}) { | ||||
| super(options) | super(options) | ||||
| this.offsetAngle = options?.offsetAngle || 0 | this.offsetAngle = options?.offsetAngle || 0 |
| } | } | ||||
| return this | return this | ||||
| } | } | ||||
| /** | |||||
| * | |||||
| * @return {HeatLayer} | |||||
| */ | |||||
| clear() { | |||||
| return this | |||||
| } | |||||
| } | } | ||||
| Layer.registerType('heat') | Layer.registerType('heat') |
| class ViewerOption { | class ViewerOption { | ||||
| constructor(viewer) { | constructor(viewer) { | ||||
| this._viewer = viewer | this._viewer = viewer | ||||
| this._options = {} | |||||
| this._init() | |||||
| } | |||||
| /** | |||||
| * Init viewer | |||||
| * @private | |||||
| */ | |||||
| _init() { | |||||
| this._viewer.delegate.cesiumWidget.creditContainer.style.display = 'none' | |||||
| this._viewer.delegate.cesiumWidget.screenSpaceEventHandler.removeInputAction( | |||||
| Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK | |||||
| ) | |||||
| this._viewer.scene.screenSpaceCameraController.maximumZoomDistance = 40489014.0 | this._viewer.scene.screenSpaceCameraController.maximumZoomDistance = 40489014.0 | ||||
| this._viewer.scene.backgroundColor = Cesium.Color.TRANSPARENT | |||||
| this._viewer.delegate.imageryLayers.removeAll() | |||||
| this._options = {} | |||||
| } | } | ||||
| /** | /** |
| * @private | * @private | ||||
| */ | */ | ||||
| _mountAnchor() { | _mountAnchor() { | ||||
| let positions = [].concat( | |||||
| this._overlay.delegate.polygon.hierarchy.getValue(Cesium.JulianDate.now()) | |||||
| this._positions = [] | |||||
| let positions = this._overlay.delegate.polygon.hierarchy.getValue(Cesium.JulianDate.now()) | |||||
| .positions | .positions | ||||
| ) | |||||
| positions.push(positions[0]) | positions.push(positions[0]) | ||||
| for (let i = 0; i < positions.length - 1; i++) { | for (let i = 0; i < positions.length - 1; i++) { | ||||
| let mid = midCartesian(positions[i], positions[i + 1]) | let mid = midCartesian(positions[i], positions[i + 1]) |
| * @private | * @private | ||||
| */ | */ | ||||
| _mountAnchor() { | _mountAnchor() { | ||||
| let positions = [].concat( | |||||
| this._overlay.delegate.polyline.positions.getValue( | |||||
| Cesium.JulianDate.now() | |||||
| ) | |||||
| ) | |||||
| this._positions = [] | |||||
| let positions = this._overlay.delegate.polyline.positions.getValue(Cesium.JulianDate.now()) | |||||
| for (let i = 0; i < positions.length - 1; i++) { | for (let i = 0; i < positions.length - 1; i++) { | ||||
| let mid = midCartesian(positions[i], positions[i + 1]) | let mid = midCartesian(positions[i], positions[i + 1]) | ||||
| this._positions.push(positions[i]) | this._positions.push(positions[i]) |
| * @returns {EditTool} | * @returns {EditTool} | ||||
| */ | */ | ||||
| activate(options = {}) { | activate(options = {}) { | ||||
| this._anchorLayer.entities.removeAll() | |||||
| this._anchors = [] | |||||
| this._viewer.tooltip.enable = true | this._viewer.tooltip.enable = true | ||||
| this._options = { ...DEF_OPTS, ...options } | this._options = { ...DEF_OPTS, ...options } | ||||
| this._unbindEvent() | this._unbindEvent() |
| * @Author: Caven | * @Author: Caven | ||||
| * @Date: 2019-12-27 17:13:24 | * @Date: 2019-12-27 17:13:24 | ||||
| */ | */ | ||||
| import { Cesium } from '@dc-modules/namespace' | import { Cesium } from '@dc-modules/namespace' | ||||
| import Parse from '@dc-modules/parse/Parse' | import Parse from '@dc-modules/parse/Parse' | ||||
| import { | import { | ||||
| import createTools from '@dc-modules/tools' | import createTools from '@dc-modules/tools' | ||||
| const DEF_OPTS = { | const DEF_OPTS = { | ||||
| animation: false, //Whether to create animated widgets, lower left corner of the meter | |||||
| baseLayerPicker: false, //Whether to display the layer selector | |||||
| imageryProvider: false, // Whether to display the default imagery | |||||
| fullscreenButton: false, //Whether to display the full-screen button | |||||
| geocoder: false, //To display the geocoder widget, query the button in the upper right corner | |||||
| homeButton: false, //Whether to display the Home button | |||||
| infoBox: false, //Whether to display the information box | |||||
| sceneModePicker: false, //Whether to display 3D/2D selector | |||||
| selectionIndicator: false, //Whether to display the selection indicator component | |||||
| timeline: false, //Whether to display the timeline | |||||
| navigationHelpButton: false, //Whether to display the help button in the upper right corner | |||||
| navigationInstructionsInitiallyVisible: false, | |||||
| creditContainer: undefined, | creditContainer: undefined, | ||||
| shouldAnimate: true | shouldAnimate: true | ||||
| } | } |