| @@ -73,6 +73,11 @@ module.exports = { | |||
| loader: 'webpack-glsl-loader' | |||
| } | |||
| ], | |||
| performance: { | |||
| hints: 'warning', | |||
| maxAssetSize: 30000000, | |||
| maxEntrypointSize: 50000000 | |||
| }, | |||
| plugins: [ | |||
| new webpack.DefinePlugin({ | |||
| __VERSION__: JSON.stringify(packageInfo.version), | |||
| @@ -27,6 +27,14 @@ let cesiumCopyPlugin = [ | |||
| 'Workers' | |||
| ), | |||
| to: 'resources/Workers' | |||
| }, | |||
| { | |||
| from: path.resolve( | |||
| __dirname, | |||
| '../node_modules/@cesium/engine/Source', | |||
| 'ThirdParty' | |||
| ), | |||
| to: 'resources/ThirdParty' | |||
| } | |||
| ]) | |||
| ] | |||
| @@ -49,7 +57,7 @@ module.exports = env => { | |||
| publicPath: publicPath, | |||
| library: 'DC', | |||
| libraryExport: 'default', | |||
| libraryTarget: 'umd', | |||
| libraryTarget: `umd`, | |||
| umdNamedDefine: true | |||
| }, | |||
| module: { | |||
| @@ -62,6 +70,7 @@ module.exports = env => { | |||
| '@dc-modules': path.resolve(__dirname, '..', 'modules') | |||
| } | |||
| }, | |||
| performance: common.performance, | |||
| plugins | |||
| } | |||
| } | |||
| @@ -50,6 +50,7 @@ module.exports = env => { | |||
| entry: path.resolve(__dirname, '..', 'packages/chart/index.js') | |||
| } | |||
| }, | |||
| performance: common.performance, | |||
| plugins | |||
| } | |||
| } | |||
| @@ -63,6 +63,7 @@ module.exports = env => { | |||
| cesium: path.resolve(__dirname, cesiumBuild) | |||
| } | |||
| }, | |||
| performance: common.performance, | |||
| plugins | |||
| } | |||
| } | |||
| @@ -62,6 +62,7 @@ module.exports = env => { | |||
| entry: path.resolve(__dirname, '..', 'packages/mapv/index.js') | |||
| } | |||
| }, | |||
| performance: common.performance, | |||
| plugins | |||
| } | |||
| } | |||
| @@ -62,6 +62,7 @@ module.exports = env => { | |||
| entry: path.resolve(__dirname, '..', 'packages/s3m/index.js') | |||
| } | |||
| }, | |||
| performance: common.performance, | |||
| plugins | |||
| } | |||
| } | |||
| @@ -10,6 +10,43 @@ | |||
| display: block; | |||
| } | |||
| .cesium-viewer { | |||
| font-family: sans-serif; | |||
| font-size: 16px; | |||
| overflow: hidden; | |||
| display: block; | |||
| position: relative; | |||
| top: 0; | |||
| left: 0; | |||
| width: 100%; | |||
| height: 100%; | |||
| } | |||
| .cesium-viewer-widget-container { | |||
| width: 100%; | |||
| height: 100%; | |||
| } | |||
| .cesium-widget { | |||
| font-family: sans-serif; | |||
| font-size: 16px; | |||
| overflow: hidden; | |||
| display: block; | |||
| position: relative; | |||
| top: 0; | |||
| left: 0; | |||
| width: 100%; | |||
| height: 100%; | |||
| } | |||
| .cesium-widget, | |||
| .cesium-widget canvas { | |||
| width: 100%; | |||
| height: 100%; | |||
| touch-action: none; | |||
| } | |||
| .div-icon { | |||
| user-select: none; | |||
| background-color: #fff; | |||
| @@ -296,7 +296,7 @@ class Viewer { | |||
| } | |||
| this._baseLayerPicker.addImageryProvider(baseLayers) | |||
| if (!this._baseLayerPicker.selectedImagery) { | |||
| this._baseLayerPicker.changeBaseLayer(0) | |||
| this._baseLayerPicker.changeImagery(0) | |||
| } | |||
| this.mapSwitch && this.mapSwitch.addMap(options) | |||
| return this | |||
| @@ -308,7 +308,7 @@ class Viewer { | |||
| * @returns {Viewer} | |||
| */ | |||
| changeBaseLayer(index) { | |||
| this._baseLayerPicker.changeBaseLayer(index) | |||
| this._baseLayerPicker.changeImagery(index) | |||
| return this | |||
| } | |||
| @@ -80,7 +80,7 @@ | |||
| "webpack-obfuscator": "^1.8.0" | |||
| }, | |||
| "dependencies": { | |||
| "@cesium/engine": "^1.1.0", | |||
| "@cesium/engine": "^2.1.0", | |||
| "@turf/turf": "^6.3.0" | |||
| } | |||
| } | |||
| @@ -4,12 +4,16 @@ | |||
| */ | |||
| import * as turf from '@turf/turf' | |||
| import { initMixin, initUse } from '@dc-modules/global-api' | |||
| import { CesiumViewer, GroundSkyBox } from '@dc-modules/exts' | |||
| import { CesiumViewer, GroundSkyBox, BaseLayerPicker } from '@dc-modules/exts' | |||
| const Cesium = require('@cesium/engine') | |||
| Cesium['Viewer'] = CesiumViewer | |||
| Cesium['GroundSkyBox'] = GroundSkyBox | |||
| Cesium['BaseLayerPicker'] = BaseLayerPicker | |||
| let DC = { | |||
| version: __VERSION__, | |||
| @@ -59,7 +59,7 @@ declare module 'dc' { | |||
| MOUSE_OUT = 'mouseout' | |||
| } | |||
| export enum SceneEventType { | |||
| CAMERA_MOVE_END = 'cameraMoveEnd', | |||
| CAMERA_CHANGED = 'cameraChanged', | |||
| @@ -508,7 +508,7 @@ declare module 'dc' { | |||
| } | |||
| export class TilesetLayer extends Layer { | |||
| constructor(id: String, url: String, options?: JSON) | |||
| constructor(id: String) | |||
| } | |||
| export class TopoJsonLayer extends Layer { | |||
| @@ -22,24 +22,24 @@ const pkgs = ['base', 'core', 'chart', 'mapv', 's3m'] | |||
| const count = pkgs.length | |||
| pkgs.forEach((item, index) => { | |||
| fse.exists( | |||
| path.resolve(__dirname, '..', `packages/${item}/dist`), | |||
| async exists => { | |||
| if (exists) { | |||
| fse.copySync( | |||
| path.resolve(__dirname, '..', `packages/${item}/dist`), | |||
| outoutDir | |||
| ) | |||
| shell.echo(chalk.yellow(`copy ${item} success`)) | |||
| if (index === count - 1) { | |||
| await shell.echo(chalk.green('build sdk end')) | |||
| } | |||
| } else { | |||
| shell.echo(chalk.red(`no ${item} dist`)) | |||
| if (index === count - 1) { | |||
| shell.echo(chalk.green('build sdk end')) | |||
| let dist = path.resolve(__dirname, '..', `packages/${item}/dist`) | |||
| fse.exists(dist, async exists => { | |||
| if (exists) { | |||
| if (item === 'base') { | |||
| for (let i = 0; i < 7; i++) { | |||
| fse.removeSync(path.join(dist, `${i}.min.js`)) | |||
| } | |||
| } | |||
| fse.copySync(dist, outoutDir) | |||
| shell.echo(chalk.yellow(`copy ${item} success`)) | |||
| if (index === count - 1) { | |||
| await shell.echo(chalk.green('build sdk end')) | |||
| } | |||
| } else { | |||
| shell.echo(chalk.red(`no ${item} dist`)) | |||
| if (index === count - 1) { | |||
| await shell.echo(chalk.green('build sdk end')) | |||
| } | |||
| } | |||
| ) | |||
| }) | |||
| }) | |||