| @@ -29,6 +29,8 @@ | |||
| "no-trailing-spaces": 0, | |||
| "no-mixed-spaces-and-tabs": 0, | |||
| "space-before-function-paren": [0, "always"], | |||
| "no-multiple-empty-lines": 0 | |||
| "no-multiple-empty-lines": 0, | |||
| "no-prototype-builtins": 0, | |||
| "no-loss-of-precision":0 | |||
| } | |||
| } | |||
| @@ -1,3 +1,5 @@ | |||
| # DC-SDK | |||
| <p> | |||
| <img src="https://img.shields.io/github/actions/workflow/status/dvgis/dc-sdk/build.yml"/> | |||
| <img src="https://img.shields.io/badge/license-Apache%202-blue"/> | |||
| @@ -19,6 +19,8 @@ import javascriptObfuscator from 'gulp-javascript-obfuscator' | |||
| import { babel } from '@rollup/plugin-babel' | |||
| import startServer from './server.js' | |||
| import { uglify } from 'rollup-plugin-uglify' | |||
| import inlineImage from 'esbuild-plugin-inline-image' | |||
| import { glsl } from 'esbuild-plugin-glsl' | |||
| const obfuscatorConfig = { | |||
| compact: true, //压缩代码 | |||
| @@ -44,6 +46,12 @@ const buildConfig = { | |||
| sourcemap: false, | |||
| write: true, | |||
| logLevel: 'info', | |||
| plugins: [ | |||
| inlineImage({ | |||
| limit: -1, | |||
| }), | |||
| glsl(), | |||
| ], | |||
| } | |||
| const packageJson = fse.readJsonSync('./package.json') | |||
| @@ -59,7 +67,7 @@ function getTime() { | |||
| async function buildNamespace(options) { | |||
| const bundle = await rollup({ | |||
| input: 'src/namespace.js', | |||
| input: 'src/namespace/libs.js', | |||
| plugins: [ | |||
| commonjs(), | |||
| resolve({ preferBuiltins: true }), | |||
| @@ -136,8 +144,7 @@ async function buildModules(options) { | |||
| const exportNamespace = ` | |||
| export const __namespace = { | |||
| Cesium: exports.Cesium, | |||
| turf: exports.turf | |||
| Cesium: exports.Cesium | |||
| } | |||
| ` | |||
| @@ -40,6 +40,8 @@ | |||
| "@turf/turf": "^6.5.0", | |||
| "chalk": "^5.2.0", | |||
| "esbuild": "^0.17.18", | |||
| "esbuild-plugin-glsl": "^1.2.1", | |||
| "esbuild-plugin-inline-image": "^0.0.9", | |||
| "eslint": "^8.40.0", | |||
| "eslint-config-prettier": "^8.8.0", | |||
| "eslint-plugin-import": "^2.27.5", | |||
| @@ -1,7 +1,7 @@ | |||
| /** | |||
| @Author: Caven Chen | |||
| **/ | |||
| import { registerLib } from './global-api/lib-utils.js' | |||
| import { getLib, registerLib } from './global-api/lib-utils.js' | |||
| export { registerLib, getLib } from './global-api/lib-utils.js' | |||
| @@ -24,24 +24,56 @@ export const config = { | |||
| } | |||
| export function ready(options = {}) { | |||
| if (options.baseUrl) { | |||
| this.config.baseUrl = options.baseUrl | |||
| if (options['baseUrl']) { | |||
| this.config.baseUrl = options['baseUrl'] | |||
| } | |||
| if (options.accessToken) { | |||
| this.config.accessToken = options.accessToken | |||
| if (options['accessToken']) { | |||
| this.config.accessToken = options['accessToken'] | |||
| } | |||
| const { Cesium, turf } = this['__namespace'] | |||
| registerLib('Cesium', Cesium) | |||
| registerLib('turf', turf) | |||
| if (options['Cesium']) { | |||
| registerLib('Cesium', options['Cesium']) | |||
| } else { | |||
| registerLib('Cesium', this['__namespace']['Cesium']) | |||
| } | |||
| // if (options['echarts']) { | |||
| // registerLib('echarts', options['echarts']) | |||
| // } | |||
| // if (options['turf']) { | |||
| // registerLib('turf', options['turf']) | |||
| // } | |||
| this['__cmdOut'] && this['__cmdOut']() | |||
| return new Promise((resolve, reject) => { | |||
| const Cesium = getLib('Cesium') | |||
| if (!Cesium) { | |||
| throw new Error('missing Cesium Lib') | |||
| } | |||
| this.config.baseUrl && Cesium.buildModuleUrl.setBaseUrl(this.config.baseUrl) | |||
| // register common modules | |||
| const modules = require('./modules') | |||
| this.config.baseUrl && | |||
| Cesium && | |||
| Cesium.buildModuleUrl.setBaseUrl(this.config.baseUrl) | |||
| Object.keys(modules).forEach((key) => { | |||
| this[key] = modules[key] | |||
| }) | |||
| // register chart module | |||
| if (getLib('echarts')) { | |||
| const modules = require('./modules/chart') | |||
| Object.keys(modules).forEach((key) => { | |||
| this[key] = modules[key] | |||
| }) | |||
| } | |||
| // register turf module | |||
| if (getLib('turf')) { | |||
| // todo | |||
| } | |||
| resolve() | |||
| }).catch((e) => { | |||
| throw new Error(e.message) | |||
| }) | |||
| } | |||
| @@ -0,0 +1,76 @@ | |||
| /** | |||
| @author : Caven Chen | |||
| @date : 2023-05-23 | |||
| */ | |||
| import { echarts } from '../../namespace' | |||
| import { Layer } from '../layer' | |||
| const { init } = echarts | |||
| class ChartLayer extends Layer { | |||
| constructor(id, viewer) { | |||
| super(id) | |||
| this._viewer.canvas.setAttribute('tabIndex', '0') | |||
| this._chartEl = this._createChartElement() | |||
| this._chart = init(this._chartEl) | |||
| this._show = true | |||
| Object(this._chart.getZr()).viewer = viewer | |||
| } | |||
| get id() { | |||
| return this._id | |||
| } | |||
| set show(show) { | |||
| this._show = show | |||
| this._chartEl.style.visibility = show ? 'visible' : 'hidden' | |||
| } | |||
| get show() { | |||
| return this._show | |||
| } | |||
| /** | |||
| * | |||
| * @returns {HTMLDivElement} | |||
| * @private | |||
| */ | |||
| _createChartElement() { | |||
| let canvas = this._viewer.scene.canvas | |||
| let el = document.createElement('div') | |||
| el.setAttribute('id', this._id) | |||
| el.style.cssText = `position:absolute; top:0; left:0; width: ${canvas.clientWidth}px; height: ${canvas.clientHeight}px;pointer-events:none;` | |||
| this._viewer.container.appendChild(el) | |||
| return el | |||
| } | |||
| /** | |||
| * | |||
| * @param option | |||
| * @returns {ChartLayer} | |||
| */ | |||
| setOption(option = {}) { | |||
| this._chart.setOption({ ...option, GLMap: {}, animation: false }) | |||
| return this | |||
| } | |||
| /** | |||
| * | |||
| * @returns {ChartLayer} | |||
| */ | |||
| clear() { | |||
| this._chart.clear() | |||
| return this | |||
| } | |||
| /** | |||
| * | |||
| * @returns {ChartLayer} | |||
| */ | |||
| resize() { | |||
| this._chart.resize() | |||
| return this | |||
| } | |||
| } | |||
| export default ChartLayer | |||
| @@ -0,0 +1,84 @@ | |||
| /** | |||
| @author : Caven Chen | |||
| @date : 2023-05-23 | |||
| */ | |||
| import { echarts, Cesium } from '../../namespace' | |||
| const { Cartesian3, Ellipsoid, Math: CesiumMath } = Cesium | |||
| const { graphic, matrix } = echarts | |||
| class GLMapCoordSys { | |||
| constructor(api) { | |||
| this._api = api | |||
| this._viewer = Object(api.getZr()).viewer | |||
| this._mapOffset = [0, 0] | |||
| this.dimensions = ['lng', 'lat'] | |||
| } | |||
| getViewer() { | |||
| return this._viewer | |||
| } | |||
| setMapOffset(mapOffset) { | |||
| this._mapOffset = mapOffset | |||
| return this | |||
| } | |||
| dataToPoint(data) { | |||
| let result = [] | |||
| let cartesian3 = Cartesian3.fromDegrees(data[0], data[1]) | |||
| if (!cartesian3) { | |||
| return result | |||
| } | |||
| let up = Ellipsoid.WGS84.geodeticSurfaceNormal(cartesian3, new Cartesian3()) | |||
| let cd = this._viewer.camera.direction | |||
| if (Cartesian3.dot(up, cd) >= 0) { | |||
| return result | |||
| } | |||
| let coords = this._viewer.scene.cartesianToCanvasCoordinates(cartesian3) | |||
| if (!coords) { | |||
| return result | |||
| } | |||
| return [coords.x - this._mapOffset[0], coords.y - this._mapOffset[1]] | |||
| } | |||
| pointToData(point) { | |||
| let ellipsoid = this._viewer.scene.globe.ellipsoid | |||
| let cartesian3 = new Cartesian3( | |||
| point[0] + this._mapOffset[0], | |||
| point[1] + this._mapOffset[1], | |||
| 0 | |||
| ) | |||
| let cartographic = ellipsoid.cartesianToCartographic(cartesian3) | |||
| return [ | |||
| CesiumMath.toDegrees(cartographic.longitude), | |||
| CesiumMath.toDegrees(cartographic.latitude), | |||
| ] | |||
| } | |||
| getViewRect() { | |||
| let api = this._api | |||
| return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight()) | |||
| } | |||
| getRoamTransform() { | |||
| return matrix.create() | |||
| } | |||
| static create(ecModel, api) { | |||
| let coordinateSys = undefined | |||
| ecModel.eachComponent('GLMap', function (model) { | |||
| coordinateSys = new GLMapCoordSys(api) | |||
| coordinateSys.setMapOffset(model['__mapOffset'] || [0, 0]) | |||
| model.coordinateSystem = coordinateSys | |||
| }) | |||
| ecModel.eachSeries(function (model) { | |||
| 'GLMap' === model.get('coordinateSystem') && | |||
| (model.coordinateSystem = coordinateSys) | |||
| }) | |||
| } | |||
| } | |||
| GLMapCoordSys.dimensions = ['lng', 'lat'] | |||
| export default GLMapCoordSys | |||
| @@ -0,0 +1,18 @@ | |||
| /** | |||
| @author : Caven Chen | |||
| @date : 2023-05-23 | |||
| */ | |||
| import { echarts } from '../../namespace' | |||
| const { extendComponentModel } = echarts | |||
| extendComponentModel({ | |||
| type: 'GLMap', | |||
| getViewer() { | |||
| return Object(this.getZr()).viewer | |||
| }, | |||
| defaultOption: { | |||
| roam: false, | |||
| }, | |||
| }) | |||
| @@ -0,0 +1,26 @@ | |||
| /** | |||
| @Author: Caven Chen | |||
| **/ | |||
| import { echarts } from '../../namespace' | |||
| const { extendComponentView } = echarts | |||
| extendComponentView({ | |||
| type: 'GLMap', | |||
| init: function (ecModel, api) { | |||
| this.api = api | |||
| let viewer = api.getZr().viewer | |||
| viewer.scene.postRender.addEventListener(this.moveHandler, this) | |||
| }, | |||
| moveHandler: function (t, e) { | |||
| this.api.dispatchAction({ | |||
| type: 'GLMapRoam', | |||
| }) | |||
| }, | |||
| render: function (t, e, i) {}, | |||
| dispose: function (t) { | |||
| let viewer = this.api.getZr().viewer | |||
| viewer.scene.postRender.removeEventListener(this.moveHandler, this) | |||
| }, | |||
| }) | |||
| @@ -0,0 +1,24 @@ | |||
| /** | |||
| @Author: Caven Chen | |||
| **/ | |||
| import { echarts } from '../../namespace' | |||
| import './GLMapModel' | |||
| import './GLMapView' | |||
| import GLMapCoordSys from './GLMapCoordSys' | |||
| import ChartLayer from './ChartLayer.js' | |||
| const { registerAction, registerCoordinateSystem } = echarts | |||
| registerCoordinateSystem('GLMap', GLMapCoordSys) | |||
| registerAction( | |||
| { | |||
| type: 'GLMapRoam', | |||
| event: 'GLMapRoam', | |||
| update: 'updateLayout', | |||
| }, | |||
| function (payload, ecModel) {} | |||
| ) | |||
| export { ChartLayer } | |||
| @@ -1,55 +1,56 @@ | |||
| /** | |||
| @author : Caven Chen | |||
| @date : 2023-05-09 | |||
| */ | |||
| @Author: Caven Chen | |||
| **/ | |||
| import { Cesium } from '../../namespace/index.js' | |||
| const { DeveloperError, EllipsoidTerrainProvider } = Cesium | |||
| const { EllipsoidTerrainProvider } = Cesium | |||
| class BaseLayerPicker { | |||
| constructor(options) { | |||
| if (!options.globe) { | |||
| throw new DeveloperError('globe is required') | |||
| throw new Error('globe is required') | |||
| } | |||
| this._globe = options.globe | |||
| this._imageryProviders = [] | |||
| this._imageryLayers = [] | |||
| this._terrainProviders = [] | |||
| this._selectedImagery = undefined | |||
| this._selectedImageryLayer = undefined | |||
| this._selectedTerrain = undefined | |||
| this._count = 0 | |||
| } | |||
| set selectedImagery(imagery) { | |||
| if (!imagery || !imagery.providers) { | |||
| new DeveloperError('imagery format error') | |||
| set selectedImageryLayer(imageryLayer) { | |||
| if (!imageryLayer || !imageryLayer.layers) { | |||
| new Error('imagery format error') | |||
| } | |||
| const imageryLayers = this._globe.imageryLayers | |||
| if (!this._selectedImagery) { | |||
| for (let i = imagery.providers.length - 1; i >= 0; i--) { | |||
| imageryLayers.addImageryProvider(imagery.providers[i], 0) | |||
| let imageryLayers = this._globe.imageryLayers | |||
| if (!this._selectedImageryLayer) { | |||
| for (let i = imageryLayer.layers.length - 1; i >= 0; i--) { | |||
| imageryLayers.add(imageryLayer.layers[i], 0) | |||
| } | |||
| } else if ( | |||
| this._selectedImagery && | |||
| imagery.id !== this._selectedImagery.id | |||
| this._selectedImageryLayer && | |||
| imageryLayer.id !== this._selectedImageryLayer.id | |||
| ) { | |||
| imageryLayers.removeAll() | |||
| for (let i = imagery.providers.length - 1; i >= 0; i--) { | |||
| imageryLayers.addImageryProvider(imagery.providers[i], 0) | |||
| for (let i = imageryLayer.layers.length - 1; i >= 0; i--) { | |||
| imageryLayers.addImageryProvider(imageryLayer.layers[i], 0) | |||
| } | |||
| } | |||
| this._selectedImagery = imagery | |||
| this._selectedImageryLayer = imageryLayer | |||
| } | |||
| get selectedImagery() { | |||
| return this._selectedImagery | |||
| get selectedImageryLayer() { | |||
| return this._selectedImageryLayer | |||
| } | |||
| set selectedTerrain(terrian) { | |||
| if (this.selectedImagery !== terrian) { | |||
| set selectedTerrain(terrain) { | |||
| if (this.selectedTerrain !== terrain) { | |||
| this._globe.depthTestAgainstTerrain = !( | |||
| terrian instanceof EllipsoidTerrainProvider | |||
| terrain instanceof EllipsoidTerrainProvider | |||
| ) | |||
| this._globe.terrainProvider = terrian | |||
| this._selectedTerrain = terrian | |||
| this._globe.terrainProvider = terrain | |||
| this._selectedTerrain = terrain | |||
| } | |||
| } | |||
| @@ -59,20 +60,20 @@ class BaseLayerPicker { | |||
| /** | |||
| * | |||
| * @param provider | |||
| * @param imageryLayer | |||
| * @returns {BaseLayerPicker} | |||
| */ | |||
| addImageryProvider(provider) { | |||
| let providers = [] | |||
| let len = this._imageryProviders.length + 1 | |||
| if (Array.isArray(provider)) { | |||
| providers = provider.slice(0) | |||
| addImageryLayer(imageryLayer) { | |||
| let imageryLayers = [] | |||
| if (Array.isArray(imageryLayer)) { | |||
| imageryLayers = imageryLayer.slice(0) | |||
| } else { | |||
| providers = [provider] | |||
| imageryLayers = [imageryLayer] | |||
| } | |||
| this._imageryProviders.push({ | |||
| id: `dc-imagery-${len}`, | |||
| providers, | |||
| this._count++ | |||
| this._imageryLayers.push({ | |||
| id: `dc-imagery-${this._count}`, | |||
| layers: imageryLayers, | |||
| }) | |||
| return this | |||
| } | |||
| @@ -92,12 +93,11 @@ class BaseLayerPicker { | |||
| * @param index | |||
| * @returns {BaseLayerPicker} | |||
| */ | |||
| changeImagery(index) { | |||
| if (index > this._imageryProviders.length - 1) { | |||
| new DeveloperError('index error ') | |||
| return this | |||
| changeImageryLayer(index) { | |||
| if (index > this._imageryLayers.length - 1) { | |||
| throw new Error('index error') | |||
| } | |||
| this.selectedImagery = this._imageryProviders[index] | |||
| this.selectedImageryLayer = this._imageryLayers[index] | |||
| return this | |||
| } | |||
| @@ -108,10 +108,10 @@ class BaseLayerPicker { | |||
| */ | |||
| changeTerrain(index) { | |||
| if (index > this._terrainProviders.length - 1) { | |||
| new DeveloperError('index error ') | |||
| return this | |||
| throw new Error('index error') | |||
| } | |||
| this.selectedTerrain = this._terrainProviders[index] | |||
| return this | |||
| } | |||
| } | |||
| @@ -1,8 +1,9 @@ | |||
| /** | |||
| @author : Caven Chen | |||
| @date : 2023-05-07 | |||
| @date : 2023-05-23 | |||
| */ | |||
| import { Cesium } from '../../namespace' | |||
| import { Cesium } from '../../namespace/index.js' | |||
| const { | |||
| BoundingSphere, | |||
| BoundingSphereState, | |||
| @@ -44,10 +45,104 @@ function trackDataSourceClock(timeline, clock, dataSource) { | |||
| } | |||
| /** | |||
| * @typedef {object} Viewer.ConstructorOptions | |||
| * | |||
| * Initialization options for the Viewer constructor | |||
| * | |||
| * @param container | |||
| * @param options | |||
| * @property {ImageryProvider|false} [imageryProvider=createWorldImagery()] The imagery provider to use. This value is only valid if `baseLayerPicker` is set to false. Deprecated. | |||
| * @property {ImageryLayer|false} [baseLayer=ImageryLayer.fromWorldImagery()] The bottommost imagery layer applied to the globe. If set to <code>false</code>, no imagery provider will be added. This value is only valid if `baseLayerPicker` is set to false. | |||
| * @property {TerrainProvider} [terrainProvider=new EllipsoidTerrainProvider()] The terrain provider to use | |||
| * @property {Terrain} [terrain] A terrain object which handles asynchronous terrain provider. Can only specify if options.terrainProvider is undefined. | |||
| * @property {SkyBox|false} [skyBox] The skybox used to render the stars. When <code>undefined</code>, the default stars are used. If set to <code>false</code>, no skyBox, Sun, or Moon will be added. | |||
| * @property {SkyAtmosphere|false} [skyAtmosphere] Blue sky, and the glow around the Earth's limb. Set to <code>false</code> to turn it off. | |||
| * @property {Element|string} [fullscreenElement=document.body] The element or id to be placed into fullscreen mode when the full screen button is pressed. | |||
| * @property {boolean} [useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise. | |||
| * @property {number} [targetFrameRate] The target frame rate when using the default render loop. | |||
| * @property {boolean} [showRenderLoopErrors=true] If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs. | |||
| * @property {boolean} [useBrowserRecommendedResolution=true] If true, render at the browser's recommended resolution and ignore <code>window.devicePixelRatio</code>. | |||
| * @property {boolean} [automaticallyTrackDataSourceClocks=true] If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently. | |||
| * @property {ContextOptions} [contextOptions] Context and WebGL creation properties passed to {@link Scene}. | |||
| * @property {SceneMode} [sceneMode=SceneMode.SCENE3D] The initial scene mode. | |||
| * @property {MapProjection} [mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes. | |||
| * @property {Globe|false} [globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to <code>false</code>, no globe will be added. | |||
| * @property {boolean} [orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency. | |||
| * @property {Element|string} [creditContainer] The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself. | |||
| * @property {Element|string} [creditViewport] The DOM element or ID that will contain the credit pop up created by the {@link CreditDisplay}. If not specified, it will appear over the widget itself. | |||
| * @property {DataSourceCollection} [dataSources=new DataSourceCollection()] The collection of data sources visualized by the widget. If this parameter is provided, | |||
| * the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed. | |||
| * @property {boolean} [shadows=false] Determines if shadows are cast by light sources. | |||
| * @property {ShadowMode} [terrainShadows=ShadowMode.RECEIVE_ONLY] Determines if the terrain casts or receives shadows from light sources. | |||
| * @property {MapMode2D} [mapMode2D=MapMode2D.INFINITE_SCROLL] Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction. | |||
| * @property {boolean} [projectionPicker=false] If set to true, the ProjectionPicker widget will be created. | |||
| * @property {boolean} [blurActiveElementOnCanvasFocus=true] If true, the active element will blur when the viewer's canvas is clicked. Setting this to false is useful for cases when the canvas is clicked only for retrieving position or an entity data without actually meaning to set the canvas to be the active element. | |||
| * @property {boolean} [requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}. | |||
| * @property {number} [maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}. | |||
| * @property {number} [depthPlaneEllipsoidOffset=0.0] Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation. | |||
| * @property {number} [msaaSamples=1] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. | |||
| */ | |||
| /** | |||
| * A base widget for building applications. It composites all of the standard Cesium widgets into one reusable package. | |||
| * The widget can always be extended by using mixins, which add functionality useful for a variety of applications. | |||
| * | |||
| * @alias Viewer | |||
| * @constructor | |||
| * | |||
| * @param {Element|string} container The DOM element or ID that will contain the widget. | |||
| * @param {Viewer.ConstructorOptions} [options] Object describing initialization options | |||
| * | |||
| * @exception {DeveloperError} Element with id "container" does not exist in the document. | |||
| * @exception {DeveloperError} options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.baseLayer instead. | |||
| * @exception {DeveloperError} options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget, specify options.terrainProvider instead. | |||
| * | |||
| * @see Animation | |||
| * @see BaseLayerPicker | |||
| * @see CesiumWidget | |||
| * @see FullscreenButton | |||
| * @see HomeButton | |||
| * @see SceneModePicker | |||
| * @see Timeline | |||
| * @see viewerDragDropMixin | |||
| * | |||
| * @demo {@link https://sandcastle.cesium.com/index.html?src=Hello%20World.html|Cesium Sandcastle Hello World Demo} | |||
| * | |||
| * @example | |||
| * // Initialize the viewer widget with several custom options and mixins. | |||
| * try { | |||
| * const viewer = new Cesium.Viewer("cesiumContainer", { | |||
| * // Start in Columbus Viewer | |||
| * sceneMode: Cesium.SceneMode.COLUMBUS_VIEW, | |||
| * // Use Cesium World Terrain | |||
| * terrain: Cesium.Terrain.fromWorldTerrain(), | |||
| * // Use OpenStreetMaps | |||
| * baseLayer: new Cesium.ImageryLayer(OpenStreetMapImageryProvider({ | |||
| * url: "https://a.tile.openstreetmap.org/" | |||
| * })), | |||
| * skyBox: new Cesium.SkyBox({ | |||
| * sources: { | |||
| * positiveX: "stars/TychoSkymapII.t3_08192x04096_80_px.jpg", | |||
| * negativeX: "stars/TychoSkymapII.t3_08192x04096_80_mx.jpg", | |||
| * positiveY: "stars/TychoSkymapII.t3_08192x04096_80_py.jpg", | |||
| * negativeY: "stars/TychoSkymapII.t3_08192x04096_80_my.jpg", | |||
| * positiveZ: "stars/TychoSkymapII.t3_08192x04096_80_pz.jpg", | |||
| * negativeZ: "stars/TychoSkymapII.t3_08192x04096_80_mz.jpg" | |||
| * } | |||
| * }), | |||
| * // Show Columbus View map with Web Mercator projection | |||
| * mapProjection: new Cesium.WebMercatorProjection() | |||
| * }); | |||
| * } catch (error) { | |||
| * console.log(error); | |||
| * } | |||
| * | |||
| * // Add basic drag and drop functionality | |||
| * viewer.extend(Cesium.viewerDragDropMixin); | |||
| * | |||
| * // Show a pop-up alert if we encounter an error when processing a dropped file | |||
| * viewer.dropError.addEventListener(function(dropHandler, name, error) { | |||
| * console.log(error); | |||
| * window.alert(error); | |||
| * }); | |||
| */ | |||
| function Viewer(container, options) { | |||
| //>>includeStart('debug', pragmas.debug); | |||
| @@ -59,19 +154,9 @@ function Viewer(container, options) { | |||
| container = getElement(container) | |||
| options = defaultValue(options, defaultValue.EMPTY_OBJECT) | |||
| //>>includeEnd('debug') | |||
| const viewerContainer = document.createElement('div') | |||
| viewerContainer.className = 'dc-viewer' | |||
| container.appendChild(viewerContainer) | |||
| // Cesium widget container | |||
| const cesiumWidgetContainer = document.createElement('div') | |||
| cesiumWidgetContainer.className = 'dc-viewer-widget-container' | |||
| viewerContainer.appendChild(cesiumWidgetContainer) | |||
| // Bottom container | |||
| const bottomContainer = document.createElement('div') | |||
| bottomContainer.className = 'dc-viewer-bottom' | |||
| const scene3DOnly = defaultValue(options.scene3DOnly, false) | |||
| @@ -82,7 +167,7 @@ function Viewer(container, options) { | |||
| } | |||
| // Cesium widget | |||
| const cesiumWidget = new CesiumWidget(cesiumWidgetContainer, { | |||
| const cesiumWidget = new CesiumWidget(container, { | |||
| baseLayer: false, | |||
| clock: clock, | |||
| skyBox: options.skyBox, | |||
| @@ -96,10 +181,6 @@ function Viewer(container, options) { | |||
| targetFrameRate: options.targetFrameRate, | |||
| showRenderLoopErrors: options.showRenderLoopErrors, | |||
| useBrowserRecommendedResolution: options.useBrowserRecommendedResolution, | |||
| creditContainer: defined(options.creditContainer) | |||
| ? options.creditContainer | |||
| : bottomContainer, | |||
| creditViewport: options.creditViewport, | |||
| scene3DOnly: scene3DOnly, | |||
| shadows: options.shadows, | |||
| terrainShadows: options.terrainShadows, | |||
| @@ -111,18 +192,19 @@ function Viewer(container, options) { | |||
| msaaSamples: options.msaaSamples, | |||
| }) | |||
| cesiumWidget.container.firstChild.className = 'dc-widget' | |||
| cesiumWidget.scene.backgroundColor = Color.TRANSPARENT | |||
| cesiumWidget.scene.screenSpaceCameraController.maximumZoomDistance = 40489014.0 | |||
| let childrens = cesiumWidget.creditViewport.children | |||
| for (let i = 0; i < childrens.length; i++) { | |||
| if (!(childrens[i] instanceof HTMLCanvasElement)) { | |||
| cesiumWidget.creditViewport.removeChild(childrens[i]) | |||
| } | |||
| while ( | |||
| cesiumWidget.creditViewport.hasChildNodes() && | |||
| !(cesiumWidget.creditViewport.lastChild instanceof HTMLCanvasElement) | |||
| ) { | |||
| cesiumWidget.creditViewport.removeChild( | |||
| cesiumWidget.creditViewport.lastChild | |||
| ) | |||
| } | |||
| cesiumWidget.creditViewport.className = 'dc-viewer-canvas' | |||
| let dataSourceCollection = options.dataSources | |||
| let destroyDataSourceCollection = false | |||
| if (!defined(dataSourceCollection)) { | |||
| @@ -144,7 +226,7 @@ function Viewer(container, options) { | |||
| // Main Toolbar | |||
| const toolbar = document.createElement('div') | |||
| toolbar.className = 'dc-viewer-toolbar' | |||
| //Assign all properties to this instance. No "this" assignments should | |||
| //take place above this line. | |||
| this._dataSourceChangedListeners = {} | |||
| @@ -223,7 +305,7 @@ function Viewer(container, options) { | |||
| Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the parent container. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Element} | |||
| * @readonly | |||
| */ | |||
| @@ -236,7 +318,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the DOM element for the area at the bottom of the window containing the | |||
| * {@link CreditDisplay} and potentially other things. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Element} | |||
| * @readonly | |||
| */ | |||
| @@ -248,7 +330,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the CesiumWidget. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {CesiumWidget} | |||
| * @readonly | |||
| */ | |||
| @@ -260,7 +342,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the display used for {@link DataSource} visualization. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {DataSourceDisplay} | |||
| * @readonly | |||
| */ | |||
| @@ -273,7 +355,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the collection of entities not tied to a particular data source. | |||
| * This is a shortcut to [dataSourceDisplay.defaultDataSource.entities]{@link Viewer#dataSourceDisplay}. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {EntityCollection} | |||
| * @readonly | |||
| */ | |||
| @@ -285,7 +367,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the set of {@link DataSource} instances to be visualized. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {DataSourceCollection} | |||
| * @readonly | |||
| */ | |||
| @@ -297,7 +379,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the canvas. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {HTMLCanvasElement} | |||
| * @readonly | |||
| */ | |||
| @@ -309,7 +391,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the scene. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Scene} | |||
| * @readonly | |||
| */ | |||
| @@ -321,8 +403,8 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Determines if shadows are cast by light sources. | |||
| * @memberof viewer.prototype | |||
| * @type {Boolean} | |||
| * @memberof Viewer.prototype | |||
| * @type {boolean} | |||
| */ | |||
| shadows: { | |||
| get: function () { | |||
| @@ -335,7 +417,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Determines if the terrain casts or shadows from light sources. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {ShadowMode} | |||
| */ | |||
| terrainShadows: { | |||
| @@ -349,7 +431,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Get the scene's shadow map | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {ShadowMap} | |||
| * @readonly | |||
| */ | |||
| @@ -361,7 +443,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the collection of image layers that will be rendered on the globe. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {ImageryLayerCollection} | |||
| * @readonly | |||
| @@ -374,7 +456,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * The terrain provider providing surface geometry for the globe. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {TerrainProvider} | |||
| */ | |||
| @@ -389,7 +471,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the camera. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {Camera} | |||
| * @readonly | |||
| @@ -402,7 +484,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the post-process stages. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {PostProcessStageCollection} | |||
| * @readonly | |||
| @@ -415,7 +497,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the clock. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Clock} | |||
| * @readonly | |||
| */ | |||
| @@ -427,7 +509,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets the screen space event handler. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {ScreenSpaceEventHandler} | |||
| * @readonly | |||
| */ | |||
| @@ -442,9 +524,9 @@ Object.defineProperties(Viewer.prototype, { | |||
| * is true. If undefined, the browser's requestAnimationFrame implementation | |||
| * determines the frame rate. If defined, this value must be greater than 0. A value higher | |||
| * than the underlying requestAnimationFrame implementation will have no effect. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {Number} | |||
| * @type {number} | |||
| */ | |||
| targetFrameRate: { | |||
| get: function () { | |||
| @@ -465,9 +547,9 @@ Object.defineProperties(Viewer.prototype, { | |||
| * <code>renderError</code> event will be raised and this property | |||
| * will be set to false. It must be set back to true to continue rendering | |||
| * after the error. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {Boolean} | |||
| * @type {boolean} | |||
| */ | |||
| useDefaultRenderLoop: { | |||
| get: function () { | |||
| @@ -485,9 +567,9 @@ Object.defineProperties(Viewer.prototype, { | |||
| * For example, if the widget is laid out at a size of 640x480, setting this value to 0.5 | |||
| * will cause the scene to be rendered at 320x240 and then scaled up while setting | |||
| * it to 2.0 will cause the scene to be rendered at 1280x960 and then scaled down. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {Number} | |||
| * @type {number} | |||
| * @default 1.0 | |||
| */ | |||
| resolutionScale: { | |||
| @@ -506,9 +588,9 @@ Object.defineProperties(Viewer.prototype, { | |||
| * performance on less powerful devices that have high pixel density. When false, rendering | |||
| * will be in device pixels. {@link Viewer#resolutionScale} will still take effect whether | |||
| * this flag is true or false. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {Boolean} | |||
| * @type {boolean} | |||
| * @default true | |||
| */ | |||
| useBrowserRecommendedResolution: { | |||
| @@ -526,9 +608,9 @@ Object.defineProperties(Viewer.prototype, { | |||
| * For example, if asynchronous primitives are being processed in the | |||
| * background, the clock will not advance until the geometry is ready. | |||
| * | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * | |||
| * @type {Boolean} | |||
| * @type {boolean} | |||
| */ | |||
| allowDataSourcesToSuspendAnimation: { | |||
| get: function () { | |||
| @@ -541,7 +623,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| /** | |||
| * Gets or sets the Entity instance currently being tracked by the camera. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Entity | undefined} | |||
| */ | |||
| trackedEntity: { | |||
| @@ -594,7 +676,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| * If a user interactively picks a Cesium3DTilesFeature instance, then this property | |||
| * will contain a transient Entity instance with a property named "feature" that is | |||
| * the instance that was picked. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Entity | undefined} | |||
| */ | |||
| selectedEntity: { | |||
| @@ -610,7 +692,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| }, | |||
| /** | |||
| * Gets the event that is raised when the selected entity changes. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Event} | |||
| * @readonly | |||
| */ | |||
| @@ -621,7 +703,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| }, | |||
| /** | |||
| * Gets the event that is raised when the tracked entity changes. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {Event} | |||
| * @readonly | |||
| */ | |||
| @@ -632,7 +714,7 @@ Object.defineProperties(Viewer.prototype, { | |||
| }, | |||
| /** | |||
| * Gets or sets the data source to track with the viewer's clock. | |||
| * @memberof viewer.prototype | |||
| * @memberof Viewer.prototype | |||
| * @type {DataSource} | |||
| */ | |||
| clockTrackedDataSource: { | |||
| @@ -649,9 +731,14 @@ Object.defineProperties(Viewer.prototype, { | |||
| }) | |||
| /** | |||
| * Extends the base viewer functionality with the provided mixin. | |||
| * A mixin may add additional properties, functions, or other behavior | |||
| * to the provided viewer instance. | |||
| * | |||
| * @param {Viewer.ViewerMixin} mixin The Viewer mixin to add to this instance. | |||
| * @param {object} [options] The options object to be passed to the mixin function. | |||
| * | |||
| * @param mixin | |||
| * @param options | |||
| * @see viewerDragDropMixin | |||
| */ | |||
| Viewer.prototype.extend = function (mixin, options) { | |||
| //>>includeStart('debug', pragmas.debug); | |||
| @@ -724,9 +811,6 @@ Viewer.prototype.destroy = function () { | |||
| } | |||
| this._dataSourceRemoved(undefined, this._dataSourceDisplay.defaultDataSource) | |||
| this._container.removeChild(this._element) | |||
| this._element.removeChild(this._toolbar) | |||
| this._eventHelper.removeAll() | |||
| this._dataSourceDisplay = this._dataSourceDisplay.destroy() | |||
| @@ -976,12 +1060,12 @@ Viewer.prototype.zoomTo = function (target, offset) { | |||
| * target will be the range. The heading will be determined from the offset. If the heading cannot be | |||
| * determined from the offset, the heading will be north.</p> | |||
| * | |||
| * @param {Entity|Entity[]|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|Promise.<Entity|Entity[]|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud>} target The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types. | |||
| * @param {Object} [options] Object with the following properties: | |||
| * @param {Number} [options.duration=3.0] The duration of the flight in seconds. | |||
| * @param {Number} [options.maximumHeight] The maximum height at the peak of the flight. | |||
| * @param {Entity|Entity[]|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|Promise<Entity|Entity[]|EntityCollection|DataSource|ImageryLayer|Cesium3DTileset|TimeDynamicPointCloud|VoxelPrimitive>} target The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types. | |||
| * @param {object} [options] Object with the following properties: | |||
| * @param {number} [options.duration=3.0] The duration of the flight in seconds. | |||
| * @param {number} [options.maximumHeight] The maximum height at the peak of the flight. | |||
| * @param {HeadingPitchRange} [options.offset] The offset from the target in the local east-north-up reference frame centered at the target. | |||
| * @returns {Promise.<Boolean>} A Promise that resolves to true if the flight was successful or false if the target is not currently visualized in the scene or the flight was cancelled. //TODO: Cleanup entity mentions | |||
| * @returns {Promise<boolean>} A Promise that resolves to true if the flight was successful or false if the target is not currently visualized in the scene or the flight was cancelled. //TODO: Cleanup entity mentions | |||
| */ | |||
| Viewer.prototype.flyTo = function (target, options) { | |||
| return zoomToOrFly(this, target, options, true) | |||
| @@ -1115,7 +1199,6 @@ Viewer.prototype._postRender = function () { | |||
| updateZoomTarget(this) | |||
| updateTrackedEntity(this) | |||
| } | |||
| function updateZoomTarget(viewer) { | |||
| const target = viewer._zoomTarget | |||
| if (!defined(target) || viewer.scene.mode === SceneMode.MORPHING) { | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2021-02-27 22:49:41 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| const CircleBlurMaterial = require('../shader/circle/CircleBlurMaterial.glsl') | |||
| const CircleDiffuseMaterial = require('../shader/circle/CircleDiffuseMaterial.glsl') | |||
| @@ -26,13 +26,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleBlurType, { | |||
| type: Cesium.Material.CircleBlurType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0 | |||
| speed: 3.0, | |||
| }, | |||
| source: CircleBlurMaterial | |||
| source: CircleBlurMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -45,13 +45,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleDiffuseType, { | |||
| type: Cesium.Material.CircleDiffuseType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0 | |||
| speed: 3.0, | |||
| }, | |||
| source: CircleDiffuseMaterial | |||
| source: CircleDiffuseMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -64,13 +64,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleFadeType, { | |||
| type: Cesium.Material.CircleFadeType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0 | |||
| speed: 3.0, | |||
| }, | |||
| source: CircleFadeMaterial | |||
| source: CircleFadeMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -83,13 +83,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CirclePulseType, { | |||
| type: Cesium.Material.CirclePulseType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 12.0 | |||
| speed: 12.0, | |||
| }, | |||
| source: CirclePulseMaterial | |||
| source: CirclePulseMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -101,13 +101,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRingType, { | |||
| fabric: { | |||
| type: Cesium.Material.CircleRingType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7) | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| }, | |||
| source: CircleRingMaterial | |||
| source: CircleRingMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -120,13 +120,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRotateType, { | |||
| type: Cesium.Material.CircleRotateType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| image: Cesium.Material.DefaultImageId | |||
| image: Cesium.Material.DefaultImageId, | |||
| }, | |||
| source: CircleRotateMaterial | |||
| source: CircleRotateMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -139,13 +139,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleScanType, { | |||
| type: Cesium.Material.CircleScanType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 1 | |||
| speed: 1, | |||
| }, | |||
| source: CircleScanMaterial | |||
| source: CircleScanMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -158,13 +158,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleSpiralType, { | |||
| type: Cesium.Material.CircleSpiralType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0 | |||
| speed: 3.0, | |||
| }, | |||
| source: CircleSpiralMaterial | |||
| source: CircleSpiralMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -177,13 +177,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleVaryType, { | |||
| type: Cesium.Material.CircleVaryType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0 | |||
| speed: 3.0, | |||
| }, | |||
| source: CircleVaryMaterial | |||
| source: CircleVaryMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -198,11 +198,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleWaveType, { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0, | |||
| count: 1, | |||
| gradient: 0.1 | |||
| gradient: 0.1, | |||
| }, | |||
| source: CircleWaveMaterial | |||
| source: CircleWaveMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2022-05-28 21:36:23 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| const CylinderFadeMaterial = require('../shader/cylinder/CylinderFadeMaterial.glsl') | |||
| const CylinderParticlesMaterial = require('../shader/cylinder/CylinderParticlesMaterial.glsl') | |||
| @@ -17,13 +17,13 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.CylinderFadeType, { | |||
| fabric: { | |||
| type: Cesium.Material.CylinderFadeType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7) | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| }, | |||
| source: CylinderFadeMaterial | |||
| source: CylinderFadeMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| /** | |||
| @@ -38,12 +38,12 @@ Cesium.Material._materialCache.addMaterial( | |||
| type: Cesium.Material.CylinderParticlesType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| image: Cesium.Material.DefaultImageId | |||
| image: Cesium.Material.DefaultImageId, | |||
| }, | |||
| source: CylinderParticlesMaterial | |||
| source: CylinderParticlesMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| } | |||
| ) | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2021-02-27 23:20:11 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| const EllipsoidElectricMaterial = require('../shader/ellipsoid/EllipsoidElectricMaterial.glsl') | |||
| const EllipsoidTrailMaterial = require('../shader/ellipsoid/EllipsoidTrailMaterial.glsl') | |||
| @@ -20,13 +20,13 @@ Cesium.Material._materialCache.addMaterial( | |||
| type: Cesium.Material.EllipsoidElectricType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 1 | |||
| speed: 1, | |||
| }, | |||
| source: EllipsoidElectricMaterial | |||
| source: EllipsoidElectricMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| } | |||
| ) | |||
| @@ -40,11 +40,11 @@ Cesium.Material._materialCache.addMaterial(Cesium.Material.EllipsoidTrailType, { | |||
| type: Cesium.Material.EllipsoidTrailType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: 3.0 | |||
| speed: 3.0, | |||
| }, | |||
| source: EllipsoidTrailMaterial | |||
| source: EllipsoidTrailMaterial, | |||
| }, | |||
| translucent: function(material) { | |||
| translucent: function (material) { | |||
| return true | |||
| } | |||
| }, | |||
| }) | |||
| @@ -4,7 +4,7 @@ | |||
| */ | |||
| import { Cesium } from '../../namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Transform } from '../transform' | |||
| /** | |||
| * | |||
| @@ -8,7 +8,7 @@ export default function bounds(positions = [], expand = 0) { | |||
| let minLat = 90 | |||
| let maxLng = -180 | |||
| let maxLat = -90 | |||
| positions.forEach(item => { | |||
| positions.forEach((item) => { | |||
| minLng = Math.min(minLng, item.lng || item.x) | |||
| minLat = Math.min(minLat, item.lat || item.y) | |||
| maxLng = Math.max(maxLng, item.lng || item.x) | |||
| @@ -27,6 +27,6 @@ export default function bounds(positions = [], expand = 0) { | |||
| west: minLng, | |||
| south: minLat, | |||
| east: maxLng, | |||
| north: maxLat | |||
| north: maxLat, | |||
| } | |||
| } | |||
| @@ -3,9 +3,9 @@ | |||
| * @Date: 2020-04-24 14:43:39 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Position from '@dc-modules/position/Position' | |||
| import { Cesium } from '../../namespace' | |||
| import { Transform } from '../transform' | |||
| import Position from '../position/Position' | |||
| export default function center(positions) { | |||
| if (positions && Array.isArray(positions)) { | |||
| @@ -3,8 +3,8 @@ | |||
| * @Date: 2020-03-31 20:58:06 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../namespace' | |||
| import { Transform } from '../transform' | |||
| export default function distance(positions) { | |||
| let distance = 0 | |||
| @@ -3,9 +3,9 @@ | |||
| * @Date: 2020-04-11 00:41:47 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Cesium } from '../../namespace' | |||
| import { Transform } from '../transform' | |||
| import Parse from '../parse/Parse' | |||
| export default function heading(start, end) { | |||
| let startPosition = start | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2020-08-21 18:16:52 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../namespace' | |||
| export default function midCartesian(start, end) { | |||
| let c1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(start) | |||
| @@ -3,10 +3,10 @@ | |||
| * @Date: 2020-08-21 18:16:52 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import Position from '@dc-modules/position/Position' | |||
| import { Cesium } from '../../namespace' | |||
| import { Transform } from '../transform' | |||
| import Parse from '../parse/Parse' | |||
| import Position from '../position/Position' | |||
| export default function midPosition(start, end) { | |||
| let startPosition = Parse.parsePosition(start) | |||
| @@ -27,8 +27,8 @@ class DrawPolygon extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -23,8 +23,8 @@ class DrawPolyline extends Draw { | |||
| ...this._style, | |||
| positions: new Cesium.CallbackProperty(() => { | |||
| return this._positions | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -21,8 +21,8 @@ class Angle extends MeasureBase { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| } | |||
| @@ -35,11 +35,11 @@ class Angle extends MeasureBase { | |||
| new EditPolyline(delegate).start( | |||
| { | |||
| viewer: this._viewer, | |||
| layer: this._layer | |||
| layer: this._layer, | |||
| }, | |||
| { | |||
| ...this._options, | |||
| ...{ maxAnchorSize: this._maxAnchorSize } | |||
| ...{ maxAnchorSize: this._maxAnchorSize }, | |||
| } | |||
| ) | |||
| } | |||
| @@ -70,7 +70,7 @@ class Angle extends MeasureBase { | |||
| positions[1], | |||
| new Cesium.Cartesian3() | |||
| ), | |||
| positions[1] | |||
| positions[1], | |||
| ] | |||
| let hegiht = Math.abs(Cesium.Plane.getPointDistance(plane, positions[1])) | |||
| @@ -92,7 +92,7 @@ class Angle extends MeasureBase { | |||
| start(measure, options) { | |||
| this._startHook(measure, options) | |||
| let helpLineMaterial = new Cesium.PolylineDashMaterialProperty({ | |||
| color: Cesium.Color.GREENYELLOW | |||
| color: Cesium.Color.GREENYELLOW, | |||
| }) | |||
| this._helpLine.polyline.material = helpLineMaterial | |||
| this._helpLine.polyline.depthFailMaterial = helpLineMaterial | |||
| @@ -102,13 +102,13 @@ class Angle extends MeasureBase { | |||
| depthFailMaterial: | |||
| options.depthFailMaterial || | |||
| new Cesium.PolylineDashMaterialProperty({ | |||
| color: Cesium.Color.YELLOW.withAlpha(0.6) | |||
| color: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| }), | |||
| width: options.width || 2, | |||
| clampToGround: false | |||
| clampToGround: false, | |||
| }).start(measure, { | |||
| ...options, | |||
| ...{ maxAnchorSize: this._maxAnchorSize } | |||
| ...{ maxAnchorSize: this._maxAnchorSize }, | |||
| }) | |||
| return this | |||
| } | |||
| @@ -3,10 +3,10 @@ | |||
| * @Date: 2020-01-03 12:18:17 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { OverlayEventType, OverlayEvent } from '@dc-modules/event' | |||
| import { Cesium } from '../../namespace' | |||
| import State from '../state/State' | |||
| import { Util } from '../utils' | |||
| import { OverlayEventType, OverlayEvent } from '../event' | |||
| import OverlayType from './OverlayType' | |||
| class Overlay { | |||
| @@ -244,7 +244,7 @@ class Overlay { | |||
| if (this._delegate instanceof Cesium.Entity) { | |||
| this._delegate.label = { | |||
| ...textStyle, | |||
| text: text | |||
| text: text, | |||
| } | |||
| } | |||
| return this | |||
| @@ -2,13 +2,12 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-12 21:44:24 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class CustomBillboard extends Overlay { | |||
| constructor(position, icon) { | |||
| @@ -29,7 +28,6 @@ class CustomBillboard extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian( | |||
| this._position | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -39,7 +37,6 @@ class CustomBillboard extends Overlay { | |||
| set icon(icon) { | |||
| this._icon = icon | |||
| this._delegate.billboard.image = this._icon | |||
| return this | |||
| } | |||
| get icon() { | |||
| @@ -53,7 +50,6 @@ class CustomBillboard extends Overlay { | |||
| this._size = size | |||
| this._delegate.billboard.width = this._size[0] || 32 | |||
| this._delegate.billboard.height = this._size[1] || 32 | |||
| return this | |||
| } | |||
| get size() { | |||
| @@ -81,7 +77,7 @@ class CustomBillboard extends Overlay { | |||
| setLabel(text, textStyle) { | |||
| this._delegate.label = { | |||
| ...textStyle, | |||
| text: text | |||
| text: text, | |||
| } | |||
| return this | |||
| } | |||
| @@ -114,8 +110,8 @@ class CustomBillboard extends Overlay { | |||
| ...style, | |||
| positions: Transform.transformWGS84ArrayToCartesianArray([ | |||
| position, | |||
| this._position | |||
| ]) | |||
| this._position, | |||
| ]), | |||
| } | |||
| } | |||
| return this | |||
| @@ -139,7 +135,7 @@ class CustomBillboard extends Overlay { | |||
| stRotation = 0 | |||
| } | |||
| return stRotation | |||
| }, false) | |||
| }, false), | |||
| } | |||
| return this | |||
| } | |||
| @@ -2,13 +2,12 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-07-28 18:37:59 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class CustomLabel extends Overlay { | |||
| constructor(position, text) { | |||
| @@ -28,7 +27,6 @@ class CustomLabel extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian( | |||
| this._position | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -38,7 +36,6 @@ class CustomLabel extends Overlay { | |||
| set text(text) { | |||
| this._text = text | |||
| this._delegate.label.text = this._text | |||
| return this | |||
| } | |||
| get text() { | |||
| @@ -83,8 +80,8 @@ class CustomLabel extends Overlay { | |||
| ...style, | |||
| positions: Transform.transformWGS84ArrayToCartesianArray([ | |||
| position, | |||
| this._position | |||
| ]) | |||
| this._position, | |||
| ]), | |||
| } | |||
| } | |||
| return this | |||
| @@ -110,7 +107,7 @@ class CustomLabel extends Overlay { | |||
| stRotation = 0 | |||
| } | |||
| return stRotation | |||
| }, false) | |||
| }, false), | |||
| } | |||
| return this | |||
| } | |||
| @@ -3,13 +3,13 @@ | |||
| * @Date: 2021-05-05 09:16:35 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import DynamicOverlay from './DynamicOverlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class DynamicBillboard extends DynamicOverlay { | |||
| constructor(position, icon) { | |||
| @@ -2,14 +2,13 @@ | |||
| * @Author: Caven | |||
| * @Date: 2021-05-05 09:16:35 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import DynamicOverlay from './DynamicOverlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class DynamicModel extends DynamicOverlay { | |||
| constructor(position, modelUrl) { | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2021-05-05 09:16:35 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| class DynamicOverlay extends Overlay { | |||
| constructor() { | |||
| @@ -54,7 +54,7 @@ class DynamicOverlay extends Overlay { | |||
| this._sampledPosition.removeSamples( | |||
| new Cesium.TimeInterval({ | |||
| start: start, | |||
| stop: stop | |||
| stop: stop, | |||
| }) | |||
| ) | |||
| this._cache.splice(0, this._cache.length - this._maxCacheSize) | |||
| @@ -3,14 +3,14 @@ | |||
| * @Date: 2020-02-12 21:46:22 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { DomUtil, Util } from '@dc-modules/utils' | |||
| import { MouseEventType } from '@dc-modules/event' | |||
| import { isBetween } from '@dc-modules/math' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { isBetween } from '../../math' | |||
| import { Util, DomUtil } from '../../utils' | |||
| import { MouseEventType } from '../../event' | |||
| class DivIcon extends Overlay { | |||
| constructor(position, content) { | |||
| @@ -21,7 +21,7 @@ class DivIcon extends Overlay { | |||
| Util.merge(this._delegate.style, { | |||
| position: 'absolute', | |||
| top: '0', | |||
| left: '0' | |||
| left: '0', | |||
| }) | |||
| this.content = content | |||
| this._state = State.INITIALIZED | |||
| @@ -34,7 +34,6 @@ class DivIcon extends Overlay { | |||
| set show(show) { | |||
| this._show = show | |||
| this._delegate.style.visibility = this._show ? 'visible' : 'hidden' | |||
| return this | |||
| } | |||
| get show() { | |||
| @@ -43,7 +42,6 @@ class DivIcon extends Overlay { | |||
| set position(position) { | |||
| this._position = Parse.parsePosition(position) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -59,7 +57,6 @@ class DivIcon extends Overlay { | |||
| } | |||
| this._delegate.appendChild(content) | |||
| } | |||
| return this | |||
| } | |||
| get content() { | |||
| @@ -145,7 +142,7 @@ class DivIcon extends Overlay { | |||
| let params = { | |||
| layer: layer, | |||
| overlay: this, | |||
| position: Transform.transformWGS84ToCartesian(this._position) | |||
| position: Transform.transformWGS84ToCartesian(this._position), | |||
| } | |||
| this._delegate.addEventListener('click', () => { | |||
| @@ -214,7 +211,7 @@ class DivIcon extends Overlay { | |||
| divIcon = new DivIcon(position, content) | |||
| if (entity.billboard) { | |||
| divIcon.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return divIcon | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-01-06 20:03:25 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class Model extends Overlay { | |||
| constructor(position, modelUrl) { | |||
| @@ -39,7 +39,6 @@ class Model extends Overlay { | |||
| ) | |||
| ) | |||
| } | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -49,7 +48,6 @@ class Model extends Overlay { | |||
| set modelUrl(modelUrl) { | |||
| this._modelUrl = modelUrl | |||
| this._delegate.model.uri = this._modelUrl | |||
| return this | |||
| } | |||
| get modelUrl() { | |||
| @@ -72,7 +70,6 @@ class Model extends Overlay { | |||
| ) | |||
| ) | |||
| }, false) | |||
| return this | |||
| } | |||
| get rotateAmount() { | |||
| @@ -118,7 +115,7 @@ class Model extends Overlay { | |||
| ) | |||
| let model = new Model(position, modelUrl) | |||
| model.attr = { | |||
| ...entity.properties.getValue(now) | |||
| ...entity.properties.getValue(now), | |||
| } | |||
| return model | |||
| } | |||
| @@ -3,22 +3,20 @@ | |||
| * @Date: 2020-01-07 20:51:56 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| class Tileset extends Overlay { | |||
| constructor(url, options = {}) { | |||
| super() | |||
| this._delegate = new Cesium.Cesium3DTileset({ | |||
| ...options, | |||
| url: url | |||
| url: url, | |||
| }) | |||
| this._tileVisibleCallback = undefined | |||
| this._properties = undefined | |||
| this._fragmentShader = undefined | |||
| this._replaceFS = false | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -49,12 +47,11 @@ class Tileset extends Overlay { | |||
| */ | |||
| _updateTile(tile) { | |||
| let content = tile.content | |||
| let model = content._model | |||
| // sets properties | |||
| for (let i = 0; i < content.featuresLength; i++) { | |||
| let feature = content.getFeature(i) | |||
| if (this._properties && this._properties.length) { | |||
| this._properties.forEach(property => { | |||
| this._properties.forEach((property) => { | |||
| if ( | |||
| feature.hasProperty(property['key']) && | |||
| feature.getProperty(property['key']) === property['keyValue'] | |||
| @@ -76,7 +73,7 @@ class Tileset extends Overlay { | |||
| */ | |||
| setPosition(position) { | |||
| position = Parse.parsePosition(position) | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| let modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( | |||
| Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt) | |||
| ) | |||
| @@ -103,7 +100,7 @@ class Tileset extends Overlay { | |||
| * @returns {Tileset} | |||
| */ | |||
| setHeadingPitchRoll(heading, pitch, roll) { | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| let modelMatrix = tileset.root.transform | |||
| let rotation = Cesium.Matrix4.fromRotationTranslation( | |||
| Cesium.Matrix3.fromHeadingPitchRoll( | |||
| @@ -134,7 +131,7 @@ class Tileset extends Overlay { | |||
| * @returns {Tileset} | |||
| */ | |||
| clampToGround() { | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| let center = Cesium.Cartographic.fromCartesian( | |||
| tileset.boundingSphere.center | |||
| ) | |||
| @@ -165,7 +162,7 @@ class Tileset extends Overlay { | |||
| * @returns {Tileset} | |||
| */ | |||
| setHeight(height, isAbsolute = false) { | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| let center = Cesium.Cartographic.fromCartesian( | |||
| tileset.boundingSphere.center | |||
| ) | |||
| @@ -195,7 +192,7 @@ class Tileset extends Overlay { | |||
| * @returns {Tileset} | |||
| */ | |||
| setScale(scale) { | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| let modelMatrix = tileset.root.transform | |||
| if (scale > 0 && scale !== 1) { | |||
| Cesium.Matrix4.multiplyByUniformScale(modelMatrix, scale, modelMatrix) | |||
| @@ -222,7 +219,7 @@ class Tileset extends Overlay { | |||
| * @return {Tileset} | |||
| */ | |||
| setSplitDirection(splitDirection) { | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| tileset.splitDirection = splitDirection | |||
| }) | |||
| return this | |||
| @@ -234,7 +231,7 @@ class Tileset extends Overlay { | |||
| * @return {Tileset} | |||
| */ | |||
| setCustomShader(customShader) { | |||
| this.readyPromise.then(tileset => { | |||
| this.readyPromise.then((tileset) => { | |||
| tileset.customShader = customShader | |||
| }) | |||
| return this | |||
| @@ -1,14 +1,14 @@ | |||
| /** | |||
| * @Author: Caven | |||
| * @Date: 2020-08-29 21:45:14 | |||
| * @Date: 2020-08-29 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util, PlotUtil } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util, PlotUtil } from '../../utils' | |||
| const HALF_PI = Math.PI / 2 | |||
| @@ -32,7 +32,6 @@ class AttackArrow extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polygon.hierarchy = this._getHierarchy() | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-08-29 22:15:47 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util, PlotUtil } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util, PlotUtil } from '../../utils' | |||
| const HALF_PI = Math.PI / 2 | |||
| @@ -31,7 +31,6 @@ class DoubleArrow extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polygon.hierarchy = this._getHierarchy() | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-08-29 22:38:10 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util, PlotUtil } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util, PlotUtil } from '../../utils' | |||
| const HALF_PI = Math.PI / 2 | |||
| @@ -32,7 +32,6 @@ class FineArrow extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polygon.hierarchy = this._getHierarchy() | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -92,7 +91,7 @@ class FineArrow extends Overlay { | |||
| pnt2, | |||
| headRight, | |||
| neckRight, | |||
| tailRight | |||
| tailRight, | |||
| ]) | |||
| ) | |||
| ) | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-08-29 23:00:27 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util, PlotUtil } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util, PlotUtil } from '../../utils' | |||
| const HALF_PI = Math.PI / 2 | |||
| @@ -30,7 +30,6 @@ class GatheringPlace extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polygon.hierarchy = this._getHierarchy() | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-08-29 22:51:36 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { PlotUtil } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { PlotUtil } from '../../utils' | |||
| import AttackArrow from './AttackArrow' | |||
| class TailedAttackArrow extends AttackArrow { | |||
| @@ -32,7 +32,6 @@ class TailedAttackArrow extends AttackArrow { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polygon.hierarchy = this._getHierarchy() | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -81,7 +80,7 @@ class TailedAttackArrow extends AttackArrow { | |||
| Parse.parsePositions( | |||
| leftPnts.concat(headPnts, rightPnts.reverse(), [ | |||
| swallowTailPnt, | |||
| leftPnts[0] | |||
| leftPnts[0], | |||
| ]) | |||
| ) | |||
| ) | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2021-06-03 21:06:17 | |||
| */ | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Overlay from '../Overlay' | |||
| import Parse from '../../parse/Parse' | |||
| import State from '../../state/State' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class BillboardPrimitive extends Overlay { | |||
| constructor(position, icon) { | |||
| @@ -19,7 +19,7 @@ class BillboardPrimitive extends Overlay { | |||
| position: undefined, | |||
| image: undefined, | |||
| width: 0, | |||
| height: 0 | |||
| height: 0, | |||
| } | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -33,7 +33,6 @@ class BillboardPrimitive extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian( | |||
| this._position | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -43,7 +42,6 @@ class BillboardPrimitive extends Overlay { | |||
| set icon(icon) { | |||
| this._icon = icon | |||
| this._delegate.image = this._icon | |||
| return this | |||
| } | |||
| get icon() { | |||
| @@ -57,7 +55,6 @@ class BillboardPrimitive extends Overlay { | |||
| this._size = size | |||
| this._delegate.width = this._size[0] || 32 | |||
| this._delegate.height = this._size[1] || 32 | |||
| return this | |||
| } | |||
| get size() { | |||
| @@ -3,14 +3,14 @@ | |||
| * @Date: 2021-06-03 21:06:17 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import BillboardPrimitive from './BillboardPrimitive' | |||
| const DEF_STYLE = { | |||
| maxOffsetY: 10, | |||
| offsetAmount: 0.1 | |||
| offsetAmount: 0.1, | |||
| } | |||
| class BounceBillboardPrimitive extends BillboardPrimitive { | |||
| @@ -3,14 +3,14 @@ | |||
| * @Date: 2021-06-03 21:06:17 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import LabelPrimitive from './LabelPrimitive' | |||
| const DEF_STYLE = { | |||
| maxOffsetY: 10, | |||
| offsetAmount: 0.1 | |||
| offsetAmount: 0.1, | |||
| } | |||
| class BounceLabelPrimitive extends LabelPrimitive { | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2021-11-08 20:35:42 | |||
| */ | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class CloudPrimitive extends Overlay { | |||
| constructor(position) { | |||
| @@ -15,7 +15,7 @@ class CloudPrimitive extends Overlay { | |||
| this._position = Parse.parsePosition(position) | |||
| this._delegate = { | |||
| position: undefined, | |||
| scale: { x: 12, y: 8 } | |||
| scale: { x: 12, y: 8 }, | |||
| } | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -29,7 +29,6 @@ class CloudPrimitive extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian( | |||
| this._position | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -3,19 +3,19 @@ | |||
| * @Date: 2021-06-04 20:38:39 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| const DEF_STYLE = { | |||
| minRadius: 10, | |||
| minHeight: 30, | |||
| color: Cesium.Color.RED, | |||
| slices: 128, | |||
| speed: 10 | |||
| speed: 10, | |||
| } | |||
| class DiffuseWallPrimitive extends Overlay { | |||
| @@ -134,20 +134,20 @@ class DiffuseWallPrimitive extends Overlay { | |||
| let geometry = new Cesium.WallGeometry({ | |||
| positions: positions, | |||
| minimumHeights: this._getHeights(positions.length, 0), | |||
| maximumHeights: this._getHeights(positions.length, this._currentHeight) | |||
| maximumHeights: this._getHeights(positions.length, this._currentHeight), | |||
| }) | |||
| this._delegate = new Cesium.Primitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry | |||
| geometry, | |||
| }), | |||
| appearance: new Cesium.MaterialAppearance({ | |||
| material: Cesium.Material.fromType('WallDiffuse', { | |||
| color: this._style?.color | |||
| color: this._style?.color, | |||
| }), | |||
| flat: true | |||
| flat: true, | |||
| }), | |||
| asynchronous: false | |||
| asynchronous: false, | |||
| }) | |||
| this._delegate.update(frameState) | |||
| } | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2021-01-09 21:40:36 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class ElecEllipsoidPrimitive extends Overlay { | |||
| constructor(position, radius) { | |||
| @@ -17,8 +17,8 @@ class ElecEllipsoidPrimitive extends Overlay { | |||
| this._radius = radius || { x: 10, y: 10, z: 10 } | |||
| this._delegate = new Cesium.Primitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry: {} | |||
| }) | |||
| geometry: {}, | |||
| }), | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -29,10 +29,10 @@ class ElecEllipsoidPrimitive extends Overlay { | |||
| set position(position) { | |||
| this._position = Parse.parsePosition(position) | |||
| this._delegate.geometryInstances.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame( | |||
| Transform.transformWGS84ToCartesian(this._position) | |||
| ) | |||
| return this | |||
| this._delegate.geometryInstances.modelMatrix = | |||
| Cesium.Transforms.eastNorthUpToFixedFrame( | |||
| Transform.transformWGS84ToCartesian(this._position) | |||
| ) | |||
| } | |||
| get position() { | |||
| @@ -43,9 +43,8 @@ class ElecEllipsoidPrimitive extends Overlay { | |||
| this._radius = radius | |||
| this._delegate.geometryInstances.geometry = new Cesium.EllipsoidGeometry({ | |||
| radii: this._radius, | |||
| maximumCone: Cesium.Math.PI_OVER_TWO | |||
| maximumCone: Cesium.Math.PI_OVER_TWO, | |||
| }) | |||
| return this | |||
| } | |||
| get radius() { | |||
| @@ -63,8 +62,8 @@ class ElecEllipsoidPrimitive extends Overlay { | |||
| this._delegate.appearance = new Cesium.MaterialAppearance({ | |||
| material: Cesium.Material.fromType('EllipsoidElectric', { | |||
| color: this._style?.color || Cesium.Color.GREEN, | |||
| speed: this._style?.speed || 5 | |||
| }) | |||
| speed: this._style?.speed || 5, | |||
| }), | |||
| }) | |||
| } | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2021-01-05 20:18:34 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class FlowLinePrimitive extends Overlay { | |||
| constructor(positions, width = 1) { | |||
| @@ -17,8 +17,8 @@ class FlowLinePrimitive extends Overlay { | |||
| this._width = width | |||
| this._delegate = new Cesium.Primitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry: {} | |||
| }) | |||
| geometry: {}, | |||
| }), | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -31,9 +31,8 @@ class FlowLinePrimitive extends Overlay { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ | |||
| positions: Transform.transformWGS84ArrayToCartesianArray(this._positions), | |||
| width: this._width | |||
| width: this._width, | |||
| }) | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -50,8 +49,8 @@ class FlowLinePrimitive extends Overlay { | |||
| color: this._style?.color || new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: this._style?.speed || 1, | |||
| percent: this._style?.percent || 0.03, | |||
| gradient: this._style?.gradient || 0.1 | |||
| }) | |||
| gradient: this._style?.gradient || 0.1, | |||
| }), | |||
| }) | |||
| } | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2021-06-03 22:28:49 | |||
| */ | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class LabelPrimitive extends Overlay { | |||
| constructor(position, text) { | |||
| @@ -16,7 +16,7 @@ class LabelPrimitive extends Overlay { | |||
| this._text = text | |||
| this._delegate = { | |||
| position: undefined, | |||
| text: undefined | |||
| text: undefined, | |||
| } | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -30,7 +30,6 @@ class LabelPrimitive extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian( | |||
| this._position | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -40,7 +39,6 @@ class LabelPrimitive extends Overlay { | |||
| set text(text) { | |||
| this._text = text | |||
| this._delegate.text = this._text | |||
| return this | |||
| } | |||
| get text() { | |||
| @@ -3,16 +3,16 @@ | |||
| * @Date: 2022-05-28 10:25:24 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { IMG_PARTICLES } from '@dc-modules/images/base64' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| import { IMG_PARTICLES } from '../../images/base64' | |||
| const DEF_STYLE = { | |||
| color: Cesium.Color.ORANGE | |||
| color: Cesium.Color.ORANGE, | |||
| } | |||
| class LightCylinderPrimitive extends Overlay { | |||
| @@ -34,7 +34,6 @@ class LightCylinderPrimitive extends Overlay { | |||
| set center(position) { | |||
| this._center = Parse.parsePosition(position) | |||
| this._updatePrimitives() | |||
| return this | |||
| } | |||
| get center() { | |||
| @@ -44,7 +43,6 @@ class LightCylinderPrimitive extends Overlay { | |||
| set length(length) { | |||
| this._length = length | |||
| this._updatePrimitives() | |||
| return this | |||
| } | |||
| get length() { | |||
| @@ -54,7 +52,6 @@ class LightCylinderPrimitive extends Overlay { | |||
| set topRadius(topRadius) { | |||
| this._topRadius = topRadius | |||
| this._updatePrimitives() | |||
| return this | |||
| } | |||
| get topRadius() { | |||
| @@ -64,7 +61,6 @@ class LightCylinderPrimitive extends Overlay { | |||
| set bottomRadius(bottomRadius) { | |||
| this._bottomRadius = bottomRadius | |||
| this._updatePrimitives() | |||
| return this | |||
| } | |||
| get bottomRadius() { | |||
| @@ -85,7 +81,7 @@ class LightCylinderPrimitive extends Overlay { | |||
| semiMajorAxis: radius, | |||
| semiMinorAxis: radius, | |||
| rotation: 0, | |||
| granularity: 0.005 | |||
| granularity: 0.005, | |||
| }, | |||
| false, | |||
| true | |||
| @@ -133,13 +129,13 @@ class LightCylinderPrimitive extends Overlay { | |||
| let polygon = Cesium.PolygonGeometry.createGeometry( | |||
| new Cesium.PolygonGeometry({ | |||
| polygonHierarchy: new Cesium.PolygonHierarchy(newpts), | |||
| perPositionHeight: true | |||
| perPositionHeight: true, | |||
| }) | |||
| ) | |||
| polygon.indices = define_indices | |||
| polygon.attributes.st.values = sts | |||
| return new Cesium.GeometryInstance({ | |||
| geometry: polygon | |||
| geometry: polygon, | |||
| }) | |||
| } | |||
| @@ -210,10 +206,10 @@ class LightCylinderPrimitive extends Overlay { | |||
| polygonHierarchy: new Cesium.PolygonHierarchy( | |||
| this._computeEllipsePositions(this._center, this._bottomRadius * 2) | |||
| ), | |||
| perPositionHeight: !isGroud | |||
| perPositionHeight: !isGroud, | |||
| }), | |||
| asynchronous: false | |||
| }) | |||
| asynchronous: false, | |||
| }), | |||
| } | |||
| // ring | |||
| @@ -223,8 +219,8 @@ class LightCylinderPrimitive extends Overlay { | |||
| ring.appearance = new Cesium.EllipsoidSurfaceAppearance({ | |||
| material: Cesium.Material.fromType(Cesium.Material.CircleRingType, { | |||
| color: this._style.color | |||
| }) | |||
| color: this._style.color, | |||
| }), | |||
| }) | |||
| // circle | |||
| @@ -235,8 +231,8 @@ class LightCylinderPrimitive extends Overlay { | |||
| circle.appearance = new Cesium.EllipsoidSurfaceAppearance({ | |||
| material: Cesium.Material.fromType(Cesium.Material.CircleRotateType, { | |||
| color: this._style.color, | |||
| image: this._getCircleImage() | |||
| }) | |||
| image: this._getCircleImage(), | |||
| }), | |||
| }) | |||
| // cylinder | |||
| @@ -248,10 +244,10 @@ class LightCylinderPrimitive extends Overlay { | |||
| ), | |||
| appearance: new Cesium.EllipsoidSurfaceAppearance({ | |||
| material: Cesium.Material.fromType(Cesium.Material.CylinderFadeType, { | |||
| color: this._style.color | |||
| }) | |||
| color: this._style.color, | |||
| }), | |||
| }), | |||
| asynchronous: false | |||
| asynchronous: false, | |||
| }) | |||
| if (isGroud) { | |||
| @@ -267,7 +263,7 @@ class LightCylinderPrimitive extends Overlay { | |||
| } | |||
| // particles | |||
| Cesium.Resource.fetchImage({ url: IMG_PARTICLES }).then(image => { | |||
| Cesium.Resource.fetchImage({ url: IMG_PARTICLES }).then((image) => { | |||
| let particles = new Cesium.Primitive({ | |||
| geometryInstances: this._createCylinderInstance( | |||
| topPositions, | |||
| @@ -279,11 +275,11 @@ class LightCylinderPrimitive extends Overlay { | |||
| Cesium.Material.CylinderParticlesType, | |||
| { | |||
| color: this._style.color, | |||
| image: this._getParticlesImage(image) | |||
| image: this._getParticlesImage(image), | |||
| } | |||
| ) | |||
| ), | |||
| }), | |||
| asynchronous: false | |||
| asynchronous: false, | |||
| }) | |||
| this._delegate.add(particles) | |||
| }) | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2021-08-02 20:12:04 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class ModelCollectionPrimitive extends Overlay { | |||
| constructor(positions, modelUrl) { | |||
| @@ -29,7 +29,6 @@ class ModelCollectionPrimitive extends Overlay { | |||
| set attrs(attrs) { | |||
| this._attrs = attrs | |||
| return this | |||
| } | |||
| get attrs() { | |||
| @@ -43,7 +42,6 @@ class ModelCollectionPrimitive extends Overlay { | |||
| this._resetDelegate() | |||
| this._layer.delegate.add(this._delegate) | |||
| } | |||
| return this | |||
| } | |||
| set modelUrl(modelUrl) { | |||
| @@ -53,7 +51,6 @@ class ModelCollectionPrimitive extends Overlay { | |||
| this._resetDelegate() | |||
| this._layer.delegate.add(this._delegate) | |||
| } | |||
| return this | |||
| } | |||
| get modelUrl() { | |||
| @@ -63,7 +60,7 @@ class ModelCollectionPrimitive extends Overlay { | |||
| _resetDelegate() { | |||
| this._delegate = new Cesium.ModelInstanceCollection({ | |||
| url: this._modelUrl, | |||
| instances: this._positions.map(item => { | |||
| instances: this._positions.map((item) => { | |||
| let origin = Transform.transformWGS84ToCartesian(item) | |||
| let modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame( | |||
| origin, | |||
| @@ -80,10 +77,10 @@ class ModelCollectionPrimitive extends Overlay { | |||
| modelMatrix | |||
| ) | |||
| return { | |||
| modelMatrix | |||
| modelMatrix, | |||
| } | |||
| }), | |||
| ...this._style | |||
| ...this._style, | |||
| }) | |||
| this._delegate.layerId = this._layer?.layerId | |||
| this._delegate.overlayId = this._id | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2021-05-14 00:33:27 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class ModelPrimitive extends Overlay { | |||
| constructor(position, modelUrl) { | |||
| @@ -38,7 +38,6 @@ class ModelPrimitive extends Overlay { | |||
| Cesium.Math.toRadians(this._position.roll) | |||
| ) | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -49,7 +48,6 @@ class ModelPrimitive extends Overlay { | |||
| this._modelUrl = modelUrl | |||
| this._delegate = Cesium.Model.fromGltf({ url: modelUrl }) | |||
| this.position = this._position | |||
| return this | |||
| } | |||
| get modelUrl() { | |||
| @@ -3,17 +3,17 @@ | |||
| * @Date: 2021-06-03 20:51:25 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| const DEF_STYLE = { | |||
| pixelSize: 8, | |||
| outlineColor: Cesium.Color.BLUE, | |||
| outlineWidth: 2 | |||
| outlineWidth: 2, | |||
| } | |||
| class PointPrimitive extends Overlay { | |||
| @@ -22,7 +22,7 @@ class PointPrimitive extends Overlay { | |||
| this._position = Parse.parsePosition(position) | |||
| this._delegate = { | |||
| position: undefined | |||
| position: undefined, | |||
| } | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -36,7 +36,6 @@ class PointPrimitive extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian( | |||
| this._position | |||
| ) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -3,19 +3,19 @@ | |||
| * @Date: 2021-06-03 21:16:27 | |||
| */ | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { center, distance } from '@dc-modules/math' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| import { center, distance } from '../../math' | |||
| class PolylinePrimitive extends Overlay { | |||
| constructor(positions) { | |||
| super() | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate = { | |||
| positions: [] | |||
| positions: [], | |||
| } | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -29,7 +29,6 @@ class PolylinePrimitive extends Overlay { | |||
| this._delegate.positions = Transform.transformWGS84ArrayToCartesianArray( | |||
| this._positions | |||
| ) | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-12-31 11:05:32 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class ScanCirclePrimitive extends Overlay { | |||
| constructor(position, radius) { | |||
| @@ -17,8 +17,8 @@ class ScanCirclePrimitive extends Overlay { | |||
| this._radius = radius | |||
| this._delegate = new Cesium.GroundPrimitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry: {} | |||
| }) | |||
| geometry: {}, | |||
| }), | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -32,9 +32,8 @@ class ScanCirclePrimitive extends Overlay { | |||
| this._delegate.geometryInstances.geometry = new Cesium.EllipseGeometry({ | |||
| center: Transform.transformWGS84ToCartesian(this._position), | |||
| semiMajorAxis: this._radius, | |||
| semiMinorAxis: this._radius | |||
| semiMinorAxis: this._radius, | |||
| }) | |||
| return this | |||
| } | |||
| get position() { | |||
| @@ -45,7 +44,6 @@ class ScanCirclePrimitive extends Overlay { | |||
| this._radius = radius | |||
| this._delegate.geometryInstances.geometry.semiMajorAxis = this._radius | |||
| this._delegate.geometryInstances.geometry.semiMinorAxis = this._radius | |||
| return this | |||
| } | |||
| get radius() { | |||
| @@ -63,8 +61,8 @@ class ScanCirclePrimitive extends Overlay { | |||
| this._delegate.appearance = new Cesium.MaterialAppearance({ | |||
| material: Cesium.Material.fromType('CircleScan', { | |||
| color: this._style?.color || Cesium.Color.WHITE, | |||
| speed: this._style?.speed || 10 | |||
| }) | |||
| speed: this._style?.speed || 10, | |||
| }), | |||
| }) | |||
| } | |||
| @@ -1,14 +1,14 @@ | |||
| /** | |||
| * @Author: Caven | |||
| * @Date: 2021-01-09 21:33:59 | |||
| * @Date: 2021-01-09 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class TrailLinePrimitive extends Overlay { | |||
| constructor(positions, width = 1) { | |||
| @@ -17,8 +17,8 @@ class TrailLinePrimitive extends Overlay { | |||
| this._width = width | |||
| this._delegate = new Cesium.Primitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry: {} | |||
| }) | |||
| geometry: {}, | |||
| }), | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -31,9 +31,8 @@ class TrailLinePrimitive extends Overlay { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.geometryInstances.geometry = new Cesium.PolylineGeometry({ | |||
| positions: Transform.transformWGS84ArrayToCartesianArray(this._positions), | |||
| width: this._width | |||
| width: this._width, | |||
| }) | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -48,8 +47,8 @@ class TrailLinePrimitive extends Overlay { | |||
| this._delegate.appearance = new Cesium.PolylineMaterialAppearance({ | |||
| material: Cesium.Material.fromType('PolylineTrail', { | |||
| color: this._style?.color || new Cesium.Color(1.0, 0.0, 0.0, 0.7), | |||
| speed: this._style?.speed || 5 | |||
| }) | |||
| speed: this._style?.speed || 5, | |||
| }), | |||
| }) | |||
| } | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-11-09 20:04:30 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class VideoPrimitive extends Overlay { | |||
| constructor(positions, video) { | |||
| @@ -16,8 +16,8 @@ class VideoPrimitive extends Overlay { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate = new Cesium.GroundPrimitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry: {} | |||
| }) | |||
| geometry: {}, | |||
| }), | |||
| }) | |||
| this._video = video | |||
| this._state = State.INITIALIZED | |||
| @@ -29,8 +29,8 @@ class VideoPrimitive extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.geometryInstances.geometry = Cesium.PolygonGeometry.fromPositions( | |||
| { | |||
| this._delegate.geometryInstances.geometry = | |||
| Cesium.PolygonGeometry.fromPositions({ | |||
| positions: Transform.transformWGS84ArrayToCartesianArray( | |||
| this._positions | |||
| ), | |||
| @@ -38,10 +38,8 @@ class VideoPrimitive extends Overlay { | |||
| extrudedHeight: this._style?.extrudedHeight, | |||
| closeTop: this._style?.closeTop, | |||
| closeBottom: this._style?.closeBottom, | |||
| vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT | |||
| } | |||
| ) | |||
| return this | |||
| vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, | |||
| }) | |||
| } | |||
| get positions() { | |||
| @@ -51,7 +49,6 @@ class VideoPrimitive extends Overlay { | |||
| set video(video) { | |||
| this._video = video | |||
| this._setAppearance() | |||
| return this | |||
| } | |||
| get video() { | |||
| @@ -65,8 +62,8 @@ class VideoPrimitive extends Overlay { | |||
| _setAppearance() { | |||
| this._delegate.appearance = new Cesium.EllipsoidSurfaceAppearance({ | |||
| material: Cesium.Material.fromType('Image', { | |||
| image: this._video | |||
| }) | |||
| image: this._video, | |||
| }), | |||
| }) | |||
| } | |||
| @@ -3,23 +3,23 @@ | |||
| * @Date: 2020-10-11 18:24:37 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { Util } from '../../utils' | |||
| class WaterPrimitive extends Overlay { | |||
| constructor(positions, holes = []) { | |||
| super() | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._holes = holes.map(item => Parse.parsePositions(item)) | |||
| this._holes = holes.map((item) => Parse.parsePositions(item)) | |||
| this._delegate = new Cesium.GroundPrimitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry: {} | |||
| geometry: {}, | |||
| }), | |||
| asynchronous: true | |||
| asynchronous: true, | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -34,7 +34,7 @@ class WaterPrimitive extends Overlay { | |||
| polygonHierarchy: new Cesium.PolygonHierarchy( | |||
| Transform.transformWGS84ArrayToCartesianArray(this._positions), | |||
| this._holes.map( | |||
| item => | |||
| (item) => | |||
| new Cesium.PolygonHierarchy( | |||
| Transform.transformWGS84ArrayToCartesianArray(item) | |||
| ) | |||
| @@ -44,9 +44,8 @@ class WaterPrimitive extends Overlay { | |||
| extrudedHeight: this._style?.extrudedHeight, | |||
| closeTop: this._style?.closeTop, | |||
| closeBottom: this._style?.closeBottom, | |||
| vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT | |||
| vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT, | |||
| }) | |||
| return this | |||
| } | |||
| get positions() { | |||
| @@ -72,8 +71,8 @@ class WaterPrimitive extends Overlay { | |||
| frequency: this._style?.frequency || 1000.0, | |||
| animationSpeed: this._style?.animationSpeed || 0.01, | |||
| amplitude: this._style?.amplitude || 10, | |||
| specularIntensity: this._style?.specularIntensity || 0.5 | |||
| }) | |||
| specularIntensity: this._style?.specularIntensity || 0.5, | |||
| }), | |||
| }) | |||
| } | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-01-19 10:18:23 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Billboard extends Overlay { | |||
| constructor(position, icon) { | |||
| @@ -101,7 +101,7 @@ class Billboard extends Overlay { | |||
| if (entity.billboard) { | |||
| billboard = new Billboard(position, entity.billboard.image.getValue(now)) | |||
| billboard.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return billboard | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-02-25 18:28:36 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Box extends Overlay { | |||
| constructor(position, length, width, height) { | |||
| @@ -22,9 +22,9 @@ class Box extends Overlay { | |||
| dimensions: { | |||
| x: +this._length, | |||
| y: +this._width, | |||
| z: +this._height | |||
| } | |||
| } | |||
| z: +this._height, | |||
| }, | |||
| }, | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-01-31 18:57:02 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Circle extends Overlay { | |||
| constructor(center, radius) { | |||
| @@ -73,7 +73,7 @@ class Circle extends Overlay { | |||
| semiMajorAxis: this._radius, | |||
| semiMinorAxis: this._radius, | |||
| rotation: 0, | |||
| granularity: 0.005 | |||
| granularity: 0.005, | |||
| }, | |||
| false, | |||
| true | |||
| @@ -101,7 +101,7 @@ class Circle extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian(this._center) | |||
| this._delegate.label = { | |||
| ...textStyle, | |||
| text: text | |||
| text: text, | |||
| } | |||
| return this | |||
| } | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-04-11 18:58:17 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Corridor extends Overlay { | |||
| constructor(positions) { | |||
| @@ -24,9 +24,8 @@ class Corridor extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.corridor.positions = Transform.transformWGS84ArrayToCartesianArray( | |||
| this._positions | |||
| ) | |||
| this._delegate.corridor.positions = | |||
| Transform.transformWGS84ArrayToCartesianArray(this._positions) | |||
| return this | |||
| } | |||
| @@ -79,7 +78,7 @@ class Corridor extends Overlay { | |||
| ) | |||
| corridor = new Corridor(positions) | |||
| corridor.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return corridor | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-04-14 18:10:00 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Cylinder extends Overlay { | |||
| constructor(position, length, topRadius, bottomRadius) { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-04-14 18:30:45 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Ellipse extends Overlay { | |||
| constructor(position, semiMajorAxis, semiMinorAxis) { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-04-14 18:20:23 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Ellipsoid extends Overlay { | |||
| constructor(position, radius) { | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-02-01 11:59:28 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Label extends Overlay { | |||
| constructor(position, text) { | |||
| @@ -95,7 +95,7 @@ class Label extends Overlay { | |||
| if (entity.billboard) { | |||
| label = new Label(position, entity.name) | |||
| label.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return label | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-02-18 19:08:26 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Plane extends Overlay { | |||
| constructor(position, width, height, plane = {}) { | |||
| @@ -33,10 +33,10 @@ class Plane extends Overlay { | |||
| plane: { | |||
| dimensions: { | |||
| x: this._width, | |||
| y: this._height | |||
| y: this._height, | |||
| }, | |||
| plane: new Cesium.Plane(this._normal, this._distance) | |||
| } | |||
| plane: new Cesium.Plane(this._normal, this._distance), | |||
| }, | |||
| }) | |||
| this._state = State.INITIALIZED | |||
| } | |||
| @@ -3,17 +3,17 @@ | |||
| * @Date: 2020-01-06 15:03:25 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| const DEF_STYLE = { | |||
| pixelSize: 8, | |||
| outlineColor: Cesium.Color.BLUE, | |||
| outlineWidth: 2 | |||
| outlineWidth: 2, | |||
| } | |||
| class Point extends Overlay { | |||
| @@ -80,7 +80,7 @@ class Point extends Overlay { | |||
| ) | |||
| point = new Point(position) | |||
| point.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| return point | |||
| } | |||
| @@ -3,13 +3,13 @@ | |||
| * @Date: 2020-01-09 09:10:37 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { center, area } from '@dc-modules/math' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| import { center, area } from '../../math' | |||
| class Polygon extends Overlay { | |||
| constructor(positions) { | |||
| @@ -36,7 +36,7 @@ class Polygon extends Overlay { | |||
| set holes(holes) { | |||
| if (holes && holes.length) { | |||
| this._holes = holes.map(item => Parse.parsePositions(item)) | |||
| this._holes = holes.map((item) => Parse.parsePositions(item)) | |||
| this._delegate.polygon.hierarchy = this._computeHierarchy() | |||
| } | |||
| return this | |||
| @@ -64,7 +64,7 @@ class Polygon extends Overlay { | |||
| this._positions | |||
| ) | |||
| result.holes = this._holes.map( | |||
| item => | |||
| (item) => | |||
| new Cesium.PolygonHierarchy( | |||
| Transform.transformWGS84ArrayToCartesianArray(item) | |||
| ) | |||
| @@ -89,7 +89,7 @@ class Polygon extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian(this.center) | |||
| this._delegate.label = { | |||
| text: text, | |||
| ...textStyle | |||
| ...textStyle, | |||
| } | |||
| return this | |||
| } | |||
| @@ -123,7 +123,7 @@ class Polygon extends Overlay { | |||
| ) | |||
| polygon = new Polygon(positions) | |||
| polygon.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return polygon | |||
| @@ -3,13 +3,13 @@ | |||
| * @Date: 2020-01-06 15:03:25 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { center, distance } from '@dc-modules/math' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| import { center, distance } from '../../math' | |||
| class Polyline extends Overlay { | |||
| constructor(positions) { | |||
| @@ -25,9 +25,8 @@ class Polyline extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polyline.positions = Transform.transformWGS84ArrayToCartesianArray( | |||
| this._positions | |||
| ) | |||
| this._delegate.polyline.positions = | |||
| Transform.transformWGS84ArrayToCartesianArray(this._positions) | |||
| return this | |||
| } | |||
| @@ -60,7 +59,7 @@ class Polyline extends Overlay { | |||
| this._delegate.position = Transform.transformWGS84ToCartesian(this.center) | |||
| this._delegate.label = { | |||
| text: text, | |||
| ...textStyle | |||
| ...textStyle, | |||
| } | |||
| return this | |||
| } | |||
| @@ -94,7 +93,7 @@ class Polyline extends Overlay { | |||
| ) | |||
| polyline = new Polyline(positions) | |||
| polyline.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return polyline | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-04-14 20:10:34 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class PolylineVolume extends Overlay { | |||
| constructor(positions, shape) { | |||
| @@ -25,9 +25,8 @@ class PolylineVolume extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.polylineVolume.positions = Transform.transformWGS84ArrayToCartesianArray( | |||
| this._positions | |||
| ) | |||
| this._delegate.polylineVolume.positions = | |||
| Transform.transformWGS84ArrayToCartesianArray(this._positions) | |||
| return this | |||
| } | |||
| @@ -96,7 +95,7 @@ class PolylineVolume extends Overlay { | |||
| ) | |||
| polylineVolume = new PolylineVolume(positions, shape) | |||
| polylineVolume.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return polylineVolume | |||
| @@ -3,12 +3,12 @@ | |||
| * @Date: 2020-04-14 20:46:23 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Overlay from '../Overlay' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| class Rectangle extends Overlay { | |||
| constructor(positions) { | |||
| @@ -55,7 +55,7 @@ class Rectangle extends Overlay { | |||
| ) | |||
| this._delegate.label = { | |||
| ...textStyle, | |||
| text: text | |||
| text: text, | |||
| } | |||
| return this | |||
| } | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2020-02-25 18:28:36 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import State from '@dc-modules/state/State' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Util } from '@dc-modules/utils' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import State from '../../state/State' | |||
| import Parse from '../../parse/Parse' | |||
| import { Util } from '../../utils' | |||
| import { Transform } from '../../transform' | |||
| import Overlay from '../Overlay' | |||
| class Wall extends Overlay { | |||
| @@ -24,9 +24,8 @@ class Wall extends Overlay { | |||
| set positions(positions) { | |||
| this._positions = Parse.parsePositions(positions) | |||
| this._delegate.wall.positions = Transform.transformWGS84ArrayToCartesianArray( | |||
| this._positions | |||
| ) | |||
| this._delegate.wall.positions = | |||
| Transform.transformWGS84ArrayToCartesianArray(this._positions) | |||
| return this | |||
| } | |||
| @@ -80,7 +79,7 @@ class Wall extends Overlay { | |||
| ) | |||
| wall = new Wall(positions) | |||
| wall.attr = { | |||
| ...entity?.properties?.getValue(now) | |||
| ...entity?.properties?.getValue(now), | |||
| } | |||
| } | |||
| return wall | |||
| @@ -2,8 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-03-22 00:10:25 | |||
| */ | |||
| import Position from '@dc-modules/position/Position' | |||
| import Position from '../position/Position' | |||
| class Parse { | |||
| /** | |||
| @@ -42,9 +41,9 @@ class Parse { | |||
| if (positions.indexOf('#') >= 0) { | |||
| throw new Error('the positions invalid') | |||
| } | |||
| positions = positions.split(';').filter(item => !!item) | |||
| positions = positions.split(';').filter((item) => !!item) | |||
| } | |||
| return positions.map(item => { | |||
| return positions.map((item) => { | |||
| if (typeof item === 'string') { | |||
| return Position.fromString(item) | |||
| } else if (Array.isArray(item)) { | |||
| @@ -79,7 +78,7 @@ class Parse { | |||
| static parsePolylineCoordToArray(positions) { | |||
| let result = [] | |||
| positions = this.parsePositions(positions) | |||
| positions.forEach(item => { | |||
| positions.forEach((item) => { | |||
| result.push([item.lng, item.lat]) | |||
| }) | |||
| return result | |||
| @@ -94,7 +93,7 @@ class Parse { | |||
| static parsePolygonCoordToArray(positions, loop = false) { | |||
| let result = [] | |||
| positions = this.parsePositions(positions) | |||
| positions.forEach(item => { | |||
| positions.forEach((item) => { | |||
| result.push([item.lng, item.lat]) | |||
| }) | |||
| if (loop && result.length > 0) { | |||
| @@ -3,8 +3,8 @@ | |||
| * @Date: 2020-08-29 19:26:06 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { OverlayType } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../namespace' | |||
| import { OverlayType } from '../overlay' | |||
| import DrawPoint from './draw/DrawPoint' | |||
| import DrawPolyline from './draw/DrawPolyline' | |||
| @@ -166,7 +166,7 @@ class Plot { | |||
| ...this._options, | |||
| maxAnchorSize: maxAnchorSize, | |||
| onDrawStop: callback, | |||
| clampToModel: clampToModel ?? this._options.clampToModel | |||
| clampToModel: clampToModel ?? this._options.clampToModel, | |||
| }) | |||
| return this | |||
| } | |||
| @@ -186,7 +186,7 @@ class Plot { | |||
| this._currentWorker = this._createEditWorker(overlay)?.start(this, { | |||
| ...this._options, | |||
| onEditStop: callback, | |||
| clampToModel: clampToModel ?? this._options.clampToModel | |||
| clampToModel: clampToModel ?? this._options.clampToModel, | |||
| }) | |||
| return this | |||
| } | |||
| @@ -2,8 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-01-31 19:45:32 | |||
| */ | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { PlotEventType } from '../../event' | |||
| class Draw { | |||
| constructor(style) { | |||
| @@ -31,7 +30,7 @@ class Draw { | |||
| * Subclasses need to be overridden | |||
| * @private | |||
| */ | |||
| _stopdHook() {} | |||
| _stoppedHook() {} | |||
| /** | |||
| * | |||
| @@ -58,7 +57,7 @@ class Draw { | |||
| this._unbindEvent() | |||
| this._viewer.drawTool.deactivate() | |||
| this._delegate && this._layer.entities.remove(this._delegate) | |||
| this._stopdHook() | |||
| this._stoppedHook() | |||
| } | |||
| /** | |||
| @@ -3,16 +3,16 @@ | |||
| * @Date: 2020-08-30 16:43:12 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { AttackArrow } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import Draw from './Draw' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { AttackArrow } from '../../overlay' | |||
| import AttackArrowGraphics from '../graphics/AttackArrowGraphics' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawAttackArrow extends Draw { | |||
| @@ -21,7 +21,7 @@ class DrawAttackArrow extends Draw { | |||
| this._maxAnchorSize = 3 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| this._graphics = new AttackArrowGraphics() | |||
| } | |||
| @@ -42,8 +42,8 @@ class DrawAttackArrow extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -52,7 +52,7 @@ class DrawAttackArrow extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let attackArrow = null | |||
| if (this._positions.length) { | |||
| attackArrow = new AttackArrow( | |||
| @@ -3,13 +3,12 @@ | |||
| * @Date: 2020-08-29 20:29:59 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Billboard } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import Draw from './Draw' | |||
| const IMG_CIRCLE_RED = require('@dc-modules/images/circle_red.png') | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { Billboard } from '../../overlay' | |||
| import IMG_CIRCLE_RED from '../../images/circle_red.png' | |||
| class DrawPoint extends Draw { | |||
| constructor(style) { | |||
| @@ -17,7 +16,7 @@ class DrawPoint extends Draw { | |||
| this._position = Cesium.Cartesian3.ZERO | |||
| this._style = { | |||
| image: IMG_CIRCLE_RED, | |||
| ...style | |||
| ...style, | |||
| } | |||
| } | |||
| @@ -32,8 +31,8 @@ class DrawPoint extends Draw { | |||
| return this._position | |||
| }, false), | |||
| billboard: { | |||
| ...this._style | |||
| } | |||
| ...this._style, | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -42,7 +41,7 @@ class DrawPoint extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let billboard = null | |||
| if (this._position) { | |||
| billboard = new Billboard( | |||
| @@ -3,15 +3,15 @@ | |||
| * @Date: 2020-08-29 21:24:55 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Circle } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { Circle } from '../../overlay' | |||
| import Draw from './Draw' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawCircle extends Draw { | |||
| @@ -21,7 +21,7 @@ class DrawCircle extends Draw { | |||
| this._radius = 0 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| } | |||
| @@ -49,7 +49,7 @@ class DrawCircle extends Draw { | |||
| semiMajorAxis: this._radius, | |||
| semiMinorAxis: this._radius, | |||
| rotation: 0, | |||
| granularity: 0.005 | |||
| granularity: 0.005, | |||
| }, | |||
| false, | |||
| true | |||
| @@ -60,8 +60,8 @@ class DrawCircle extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -70,7 +70,7 @@ class DrawCircle extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let circle = null | |||
| if (this._positions.length) { | |||
| circle = new Circle( | |||
| @@ -91,7 +91,7 @@ class DrawCircle extends Draw { | |||
| this._positions.push(position) | |||
| this.drawTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position, | |||
| isCenter: len === 1 | |||
| isCenter: len === 1, | |||
| }) | |||
| if (len >= this._maxAnchorSize) { | |||
| this._positions.pop() | |||
| @@ -1,18 +1,18 @@ | |||
| /** | |||
| * @Author: Caven | |||
| * @Date: 2020-08-30 16:43:12 | |||
| * @Date: 2020-08-30 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { DoubleArrow } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { DoubleArrow } from '../../overlay' | |||
| import Draw from './Draw' | |||
| import DoubleArrowGraphics from '../graphics/DoubleArrowGraphics' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawDoubleArrow extends Draw { | |||
| @@ -21,7 +21,7 @@ class DrawDoubleArrow extends Draw { | |||
| this._maxAnchorSize = 4 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| this._graphics = new DoubleArrowGraphics() | |||
| } | |||
| @@ -42,8 +42,8 @@ class DrawDoubleArrow extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -52,7 +52,7 @@ class DrawDoubleArrow extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let doubleArrow = null | |||
| if (this._positions.length) { | |||
| doubleArrow = new DoubleArrow( | |||
| @@ -3,16 +3,17 @@ | |||
| * @Date: 2020-08-30 16:43:12 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { FineArrow } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import Draw from './Draw' | |||
| import { Transform } from '../../transform' | |||
| import { PlotEventType } from '../../event' | |||
| import { FineArrow } from '../../overlay' | |||
| import FineArrowGraphics from '../graphics/FineArrowGraphics' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawFineArrow extends Draw { | |||
| @@ -21,7 +22,7 @@ class DrawFineArrow extends Draw { | |||
| this._maxAnchorSize = 2 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| this._graphics = new FineArrowGraphics() | |||
| } | |||
| @@ -42,8 +43,8 @@ class DrawFineArrow extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -52,7 +53,7 @@ class DrawFineArrow extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let fineArrow = null | |||
| if (this._positions.length) { | |||
| fineArrow = new FineArrow( | |||
| @@ -3,16 +3,17 @@ | |||
| * @Date: 2020-08-30 17:22:21 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { GatheringPlace } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import Draw from './Draw' | |||
| import { Transform } from '../../transform' | |||
| import { PlotEventType } from '../../event' | |||
| import { GatheringPlace } from '../../overlay' | |||
| import GatheringPlaceGraphics from '../graphics/GatheringPlaceGraphics' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawGatheringPlace extends Draw { | |||
| @@ -21,7 +22,7 @@ class DrawGatheringPlace extends Draw { | |||
| this._maxAnchorSize = 3 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| this._graphics = new GatheringPlaceGraphics() | |||
| } | |||
| @@ -42,8 +43,8 @@ class DrawGatheringPlace extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -52,7 +53,7 @@ class DrawGatheringPlace extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let gatheringPlace = null | |||
| if (this._positions.length) { | |||
| gatheringPlace = new GatheringPlace( | |||
| @@ -3,16 +3,16 @@ | |||
| * @Date: 2020-01-31 16:25:29 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Point } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { Point } from '../../overlay' | |||
| import Draw from './Draw' | |||
| const DEF_STYLE = { | |||
| pixelSize: 10, | |||
| outlineColor: Cesium.Color.BLUE, | |||
| outlineWidth: 5 | |||
| outlineWidth: 5, | |||
| } | |||
| class DrawPoint extends Draw { | |||
| @@ -21,7 +21,7 @@ class DrawPoint extends Draw { | |||
| this._position = Cesium.Cartesian3.ZERO | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| } | |||
| @@ -36,8 +36,8 @@ class DrawPoint extends Draw { | |||
| return this._position | |||
| }, false), | |||
| point: { | |||
| ...this._style | |||
| } | |||
| ...this._style, | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -46,7 +46,7 @@ class DrawPoint extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let point = null | |||
| if (this._position) { | |||
| point = new Point( | |||
| @@ -3,15 +3,15 @@ | |||
| * @Date: 2020-08-29 20:55:14 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Polygon } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { Polygon } from '../../overlay' | |||
| import Draw from './Draw' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawPolygon extends Draw { | |||
| @@ -19,7 +19,7 @@ class DrawPolygon extends Draw { | |||
| super() | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| } | |||
| @@ -35,13 +35,13 @@ class DrawPolygon extends Draw { | |||
| hierarchy: new Cesium.CallbackProperty(() => { | |||
| if (this._positions.length > 2) { | |||
| return new Cesium.PolygonHierarchy( | |||
| this._positions.map(item => item.clone()) | |||
| this._positions.map((item) => item.clone()) | |||
| ) | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -50,7 +50,7 @@ class DrawPolygon extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let polygon = null | |||
| if (this._positions.length) { | |||
| polygon = new Polygon( | |||
| @@ -3,15 +3,15 @@ | |||
| * @Date: 2020-08-29 20:54:37 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Polyline } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { Polyline } from '../../overlay' | |||
| import Draw from './Draw' | |||
| const DEF_STYLE = { | |||
| width: 3, | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6) | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| } | |||
| class DrawPolyline extends Draw { | |||
| @@ -19,7 +19,7 @@ class DrawPolyline extends Draw { | |||
| super() | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| } | |||
| @@ -34,8 +34,8 @@ class DrawPolyline extends Draw { | |||
| ...this._style, | |||
| positions: new Cesium.CallbackProperty(() => { | |||
| return this._positions | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -44,7 +44,7 @@ class DrawPolyline extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let polyline = null | |||
| if (this._positions.length) { | |||
| polyline = new Polyline( | |||
| @@ -3,14 +3,14 @@ | |||
| * @Date: 2020-08-29 21:30:41 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Rectangle } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import Draw from './Draw' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { Rectangle } from '../../overlay' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6) | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| } | |||
| class DrawRectangle extends Draw { | |||
| @@ -19,7 +19,7 @@ class DrawRectangle extends Draw { | |||
| this._maxAnchorSize = 2 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| } | |||
| @@ -32,14 +32,14 @@ class DrawRectangle extends Draw { | |||
| this._delegate = new Cesium.Entity({ | |||
| rectangle: { | |||
| ...this._style, | |||
| coordinates: new Cesium.CallbackProperty(time => { | |||
| coordinates: new Cesium.CallbackProperty((time) => { | |||
| if (this._positions.length > 1) { | |||
| return Cesium.Rectangle.fromCartesianArray(this._positions) | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -48,7 +48,7 @@ class DrawRectangle extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let rectangle = null | |||
| if (this._positions.length) { | |||
| rectangle = new Rectangle( | |||
| @@ -3,16 +3,16 @@ | |||
| * @Date: 2020-08-30 16:43:12 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { TailedAttackArrow } from '@dc-modules/overlay' | |||
| import { Cesium } from '../../../namespace' | |||
| import Draw from './Draw' | |||
| import TailedAttackArrowGraphics from '../graphics/TailedAttackArrowGraphics' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| import { TailedAttackArrow } from '../../overlay' | |||
| const DEF_STYLE = { | |||
| material: Cesium.Color.YELLOW.withAlpha(0.6), | |||
| fill: true | |||
| fill: true, | |||
| } | |||
| class DrawTailedAttackArrow extends Draw { | |||
| @@ -21,7 +21,7 @@ class DrawTailedAttackArrow extends Draw { | |||
| this._maxAnchorSize = 3 | |||
| this._style = { | |||
| ...DEF_STYLE, | |||
| ...style | |||
| ...style, | |||
| } | |||
| this._graphics = new TailedAttackArrowGraphics() | |||
| } | |||
| @@ -42,8 +42,8 @@ class DrawTailedAttackArrow extends Draw { | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| } | |||
| }, false), | |||
| }, | |||
| }) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| @@ -52,7 +52,7 @@ class DrawTailedAttackArrow extends Draw { | |||
| * | |||
| * @private | |||
| */ | |||
| _stopdHook() { | |||
| _stoppedHook() { | |||
| let tailedAttackArrow = null | |||
| if (this._positions.length) { | |||
| tailedAttackArrow = new TailedAttackArrow( | |||
| @@ -3,9 +3,9 @@ | |||
| * @Date: 2020-08-30 23:50:53 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| class Edit { | |||
| constructor(overlay) { | |||
| @@ -52,7 +52,7 @@ class Edit { | |||
| this._positions.forEach((item, index) => { | |||
| this.editTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position: item, | |||
| index: index | |||
| index: index, | |||
| }) | |||
| }) | |||
| } | |||
| @@ -150,7 +150,7 @@ class Edit { | |||
| stop() { | |||
| this.editTool.fire(PlotEventType.EDIT_STOP, { | |||
| pickedAnchor: null, | |||
| position: null | |||
| position: null, | |||
| }) | |||
| return this | |||
| } | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2020-08-30 23:46:07 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import AttackArrowGraphics from '../graphics/AttackArrowGraphics' | |||
| @@ -3,9 +3,9 @@ | |||
| * @Date: 2020-08-30 22:04:36 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import { Transform } from '../../transform' | |||
| class EditBillboard extends Edit { | |||
| constructor(overlay) { | |||
| @@ -3,10 +3,10 @@ | |||
| * @Date: 2020-08-31 10:54:38 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import { PlotEventType } from '../../event' | |||
| import { Transform } from '../../transform' | |||
| class EditCircle extends Edit { | |||
| constructor(overlay) { | |||
| @@ -24,9 +24,9 @@ class EditCircle extends Edit { | |||
| this._center = Transform.transformWGS84ToCartesian(this._overlay.center) | |||
| this._positions = [].concat([ | |||
| this._center, | |||
| this._computeCirclePoints(this._center, this._radius)[0] | |||
| this._computeCirclePoints(this._center, this._radius)[0], | |||
| ]) | |||
| this._delegate.polygon.hierarchy = new Cesium.CallbackProperty(time => { | |||
| this._delegate.polygon.hierarchy = new Cesium.CallbackProperty((time) => { | |||
| if (this._positions.length > 1) { | |||
| this._radius = Cesium.Cartesian3.distance( | |||
| this._positions[0], | |||
| @@ -60,7 +60,7 @@ class EditCircle extends Edit { | |||
| semiMajorAxis: radius, | |||
| semiMinorAxis: radius, | |||
| rotation: 0, | |||
| granularity: 0.005 | |||
| granularity: 0.005, | |||
| }, | |||
| false, | |||
| true | |||
| @@ -93,7 +93,7 @@ class EditCircle extends Edit { | |||
| this.editTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position: item, | |||
| index: index, | |||
| isCenter: index % 2 === 0 | |||
| isCenter: index % 2 === 0, | |||
| }) | |||
| }) | |||
| } | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2020-08-30 23:46:07 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import DoubleArrowGraphics from '../graphics/DoubleArrowGraphics' | |||
| @@ -3,9 +3,7 @@ | |||
| * @Date: 2020-08-30 23:46:07 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import FineArrowGraphics from '../graphics/FineArrowGraphics' | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2020-08-30 23:46:07 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import GatheringPlaceGraphics from '../graphics/GatheringPlaceGraphics' | |||
| @@ -3,9 +3,9 @@ | |||
| * @Date: 2020-08-30 22:04:36 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import { Transform } from '../../transform' | |||
| class EditPoint extends Edit { | |||
| constructor(overlay) { | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2020-08-30 23:12:09 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { midCartesian } from '@dc-modules/math' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import { PlotEventType } from '../../event' | |||
| import { midCartesian } from '../../math' | |||
| import { Transform } from '../../transform' | |||
| class EditPolygon extends Edit { | |||
| constructor(overlay) { | |||
| @@ -19,10 +19,10 @@ class EditPolygon extends Edit { | |||
| * @private | |||
| */ | |||
| _mountedHook() { | |||
| this._delegate.polygon.hierarchy = new Cesium.CallbackProperty(time => { | |||
| this._delegate.polygon.hierarchy = new Cesium.CallbackProperty((time) => { | |||
| if (this._positions.length > 2) { | |||
| return new Cesium.PolygonHierarchy( | |||
| this._positions.map(item => item.clone()) | |||
| this._positions.map((item) => item.clone()) | |||
| ) | |||
| } else { | |||
| return null | |||
| @@ -62,7 +62,7 @@ class EditPolygon extends Edit { | |||
| this.editTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position: item, | |||
| index: index, | |||
| isMid: index % 2 !== 0 | |||
| isMid: index % 2 !== 0, | |||
| }) | |||
| }) | |||
| } | |||
| @@ -112,7 +112,7 @@ class EditPolygon extends Edit { | |||
| this.editTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position: item, | |||
| index: index, | |||
| isMid: index % 2 !== 0 | |||
| isMid: index % 2 !== 0, | |||
| }) | |||
| }) | |||
| } | |||
| @@ -162,11 +162,11 @@ class EditPolygon extends Edit { | |||
| this._positions[nextMidAnchorIndex] = nextMidPosition | |||
| this.editTool.fire(PlotEventType.UPDATE_ANCHOR, { | |||
| index: preMidAnchorIndex, | |||
| position: preMidPosition | |||
| position: preMidPosition, | |||
| }) | |||
| this.editTool.fire(PlotEventType.UPDATE_ANCHOR, { | |||
| index: nextMidAnchorIndex, | |||
| position: nextMidPosition | |||
| position: nextMidPosition, | |||
| }) | |||
| } | |||
| } | |||
| @@ -3,11 +3,11 @@ | |||
| * @Date: 2020-08-30 22:39:34 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { PlotEventType } from '@dc-modules/event' | |||
| import { midCartesian } from '@dc-modules/math' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import { PlotEventType } from '../../event' | |||
| import { midCartesian } from '../../math' | |||
| import { Transform } from '../../transform' | |||
| class EditPolyline extends Edit { | |||
| constructor(overlay) { | |||
| @@ -60,7 +60,7 @@ class EditPolyline extends Edit { | |||
| this.editTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position: item, | |||
| index: index, | |||
| isMid: index % 2 !== 0 | |||
| isMid: index % 2 !== 0, | |||
| }) | |||
| }) | |||
| } | |||
| @@ -96,7 +96,7 @@ class EditPolyline extends Edit { | |||
| this.editTool.fire(PlotEventType.CREATE_ANCHOR, { | |||
| position: item, | |||
| index: index, | |||
| isMid: index % 2 !== 0 | |||
| isMid: index % 2 !== 0, | |||
| }) | |||
| }) | |||
| } | |||
| @@ -140,7 +140,7 @@ class EditPolyline extends Edit { | |||
| this._positions[preMidAnchorIndex] = preMidPosition | |||
| this.editTool.fire(PlotEventType.UPDATE_ANCHOR, { | |||
| index: preMidAnchorIndex, | |||
| position: preMidPosition | |||
| position: preMidPosition, | |||
| }) | |||
| } | |||
| @@ -152,7 +152,7 @@ class EditPolyline extends Edit { | |||
| this._positions[nextMidAnchorIndex] = nextMidPosition | |||
| this.editTool.fire(PlotEventType.UPDATE_ANCHOR, { | |||
| index: nextMidAnchorIndex, | |||
| position: nextMidPosition | |||
| position: nextMidPosition, | |||
| }) | |||
| } | |||
| } | |||
| @@ -3,8 +3,7 @@ | |||
| * @Date: 2020-08-30 23:41:34 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| class EditRectangle extends Edit { | |||
| @@ -18,13 +17,16 @@ class EditRectangle extends Edit { | |||
| * @private | |||
| */ | |||
| _mountedHook() { | |||
| this._delegate.rectangle.coordinates = new Cesium.CallbackProperty(time => { | |||
| if (this._positions.length > 1) { | |||
| return Cesium.Rectangle.fromCartesianArray(this._positions) | |||
| } else { | |||
| return null | |||
| } | |||
| }, false) | |||
| this._delegate.rectangle.coordinates = new Cesium.CallbackProperty( | |||
| (time) => { | |||
| if (this._positions.length > 1) { | |||
| return Cesium.Rectangle.fromCartesianArray(this._positions) | |||
| } else { | |||
| return null | |||
| } | |||
| }, | |||
| false | |||
| ) | |||
| this._layer.entities.add(this._delegate) | |||
| } | |||
| } | |||
| @@ -3,7 +3,7 @@ | |||
| * @Date: 2020-08-30 23:46:07 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import { Cesium } from '../../../namespace' | |||
| import Edit from './Edit' | |||
| import TailedAttackArrowGraphics from '../graphics/TailedAttackArrowGraphics' | |||
| @@ -3,10 +3,10 @@ | |||
| * @Date: 2020-08-30 16:22:50 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { PlotUtil } from '@dc-modules/utils' | |||
| import { Cesium } from '../../../namespace' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { PlotUtil } from '../../utils' | |||
| const HALF_PI = Math.PI / 2 | |||
| @@ -3,10 +3,10 @@ | |||
| * @Date: 2020-08-30 16:27:29 | |||
| */ | |||
| import { Cesium } from '@dc-modules/namespace' | |||
| import Parse from '@dc-modules/parse/Parse' | |||
| import { Transform } from '@dc-modules/transform' | |||
| import { PlotUtil } from '@dc-modules/utils' | |||
| import { Cesium } from '../../../namespace' | |||
| import Parse from '../../parse/Parse' | |||
| import { Transform } from '../../transform' | |||
| import { PlotUtil } from '../../utils' | |||
| const HALF_PI = Math.PI / 2 | |||