Skip to content

Commit 8ef0bda

Browse files
author
潘卓然Y7000P
committed
新增cesium的代码以及对应的打包依赖&更新整个环境变量
1 parent 7179f03 commit 8ef0bda

33 files changed

Lines changed: 7650 additions & 1 deletion

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"openlayers-plugin-release": "webpack --config src/configopensource/openlayers-plugin-release-config.js --progress",
1717
"mapbox-plugin-debug": "webpack --config src/configopensource/mapbox-plugin-debug-config.js",
1818
"mapbox-plugin-release": "webpack --config src/configopensource/mapbox-plugin-release-config.js --progress",
19+
"cesium-plugin-debug": "webpack --config src/config/opensource/cesium-plugin-debug-config.js",
20+
"cesium-plugin-release": "webpack --config src/config/opensource/cesium-plugin-release-config.js --progress",
1921
"service-debug": "webpack --config src/configopensource/service-debug-config.js",
2022
"service-release": "webpack --config src/configopensource/service-release-config.js --progress",
2123
"build-docs-leaflet": "jsdoc -c ./docs/jsdoc-config/leaflet/docs.json -R ./docs/jsdoc-config/leaflet/index.md -r",
@@ -37,6 +39,7 @@
3739
"babel-preset-es2015": "^6.24.1",
3840
"babel-runtime": "^6.11.6",
3941
"clean-webpack-plugin": "^0.1.18",
42+
"copy-webpack-plugin": "^4.5.1",
4043
"eslint": "^4.6.1",
4144
"eslint-loader": "^1.9.0",
4245
"eslint-plugin-import": "^2.8.0",
@@ -51,13 +54,17 @@
5154
"webpack-parallel-uglify-plugin": "0.4.2"
5255
},
5356
"dependencies": {
57+
"@mapbox/mapbox-gl-style-spec": "^13.15.0",
5458
"@mapgis/mapbox-gl": "^1.9.0",
5559
"axios": "^0.18.0",
60+
"cesium": "^1.70.1",
61+
"d3": "^5.16.0",
5662
"echarts": "^4.4.0",
5763
"jsdoc": "^3.6.3",
5864
"leaflet": "^1.5.1",
5965
"mapv": "^2.0.40",
6066
"ol": "5.3.3",
61-
"proj4": "2.3.15"
67+
"proj4": "2.3.15",
68+
"webfont-matcher": "^1.1.0"
6269
}
6370
}
Lines changed: 34 additions & 0 deletions
Loading

src/cesiumjs/core/Base.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
*MapGIS WebClient Leaflet基类
3+
* 定义命名空间
4+
* 提供公共模块
5+
*/
6+
7+
window.CesiumZondy = window.CesiumZondy || {};
8+
9+
var CesiumZondy = window.CesiumZondy || {};
10+
11+
CesiumZondy.Manager = CesiumZondy.Manager || {};
12+
13+
CesiumZondy.UI = CesiumZondy.UI || {};
14+
15+
CesiumZondy.GeoSpark = CesiumZondy.GeoSpark || {};
16+
CesiumZondy.ElasticSearch = CesiumZondy.ElasticSearch || {};
17+
CesiumZondy.Overlayer = CesiumZondy.Overlayer || {};
18+
CesiumZondy.Layer = CesiumZondy.Layer || {};
19+
CesiumZondy.Provider = CesiumZondy.Provider || {};
20+
21+
export { CesiumZondy };

src/cesiumjs/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { CesiumZondy } from "./core/Base";
2+
export { CesiumZondy } from "./core/Base";
3+
4+
export * from './ui';
5+
6+
export * from "./manager";
7+
export * from "./layer";
8+
9+
export * from "./overlay";
10+
11+
// export * from "./provider";
12+
// export * from "./service";

src/cesiumjs/layer/BaseLayer.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { CesiumZondy } from '../core/Base';
2+
3+
/**
4+
* @author 基础平台研发中心·冯桂英
5+
* @class BaseLayer
6+
* @category BaseLayer
7+
* @classdesc BaseLayer
8+
* @description 图层管理基类,实现图层公共方法
9+
* @param option.viewer = viewer 视图
10+
*/
11+
export default class BaseLayer {
12+
constructor(option) {
13+
this._viewer = Cesium.defaultValue(option.viewer, undefined);
14+
}
15+
16+
get viewer() {
17+
return this._viewer;
18+
}
19+
20+
/**
21+
* 定位到M3D图层对象
22+
* @param {Object} layer 图层对象
23+
*/
24+
zoomToM3dLayer(layer) {
25+
let boundingSphere = layer.boundingSphere;
26+
this.viewer.camera.viewBoundingSphere(
27+
boundingSphere,
28+
new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius)
29+
);
30+
debugger;
31+
this.viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
32+
}
33+
34+
/***
35+
* 移除m3d 图层
36+
*/
37+
removeM3dLayer(layer) {
38+
this.viewer.scene.primitives.remove(layer);
39+
}
40+
41+
/**
42+
* 移除添加的所有m3d文档,layers为图层数组
43+
*/
44+
removeDocs(layers) {
45+
if (!Cesium.defined(layers)) {
46+
return;
47+
}
48+
for (var i in layers) {
49+
this.viewer.scene.primitives.remove(layers[i]);
50+
}
51+
return;
52+
}
53+
54+
/**
55+
* 添加全球网格信息
56+
* @returns 网格图层
57+
*/
58+
addGridInfo() {
59+
if (undefined === this._tileGridLayer) {
60+
let tileGridLayer = new Cesium.TileCoordinatesImageryProvider({
61+
showLonlats: true
62+
});
63+
let imagelayers = this.viewer.imageryLayers;
64+
if (imagelayers !== null && imagelayers !== undefined) {
65+
if (!imagelayers.contains(tileGridLayer)) {
66+
return imagelayers.addImageryProvider(tileGridLayer);
67+
}
68+
}
69+
}
70+
}
71+
72+
/**
73+
* 移除全球网格信息
74+
* @param {Object} gridlayers 网格图层
75+
*/
76+
removeGridInfo(gridlayers) {
77+
debugger;
78+
let imagelayers = this.viewer.imageryLayers;
79+
if (imagelayers !== null && imagelayers !== undefined) {
80+
if (imagelayers.contains(gridlayers)) {
81+
imagelayers.remove(gridlayers, true);
82+
}
83+
}
84+
}
85+
}
86+
87+
CesiumZondy.Layer.BaseLayer = BaseLayer;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { CesiumZondy } from '../core/Base';
2+
import LayerManager from '../manager/LayerManager';
3+
4+
/**
5+
* @author
6+
* @class
7+
* @category
8+
* @classdesc
9+
* @description
10+
* @see
11+
*/
12+
export default class CesiumFuncManager extends LayerManager {
13+
constructor() {
14+
super();
15+
}
16+
17+
getCesiumCartian3() {
18+
let car3 = new Cesium.Cartesian3(1, 2, 3);
19+
20+
car3.x = 12.0;
21+
22+
return car3;
23+
}
24+
}
25+
26+
CesiumZondy.Layer.CesiumFuncManager = CesiumFuncManager;
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { CesiumZondy } from "../core/Base";
2+
3+
import BaseLayer from "./BaseLayer";
4+
5+
/**
6+
* @author 三维基础平台研发中心·邱文坤
7+
* @class LayerManager.EntityController
8+
* @category LayerManager
9+
* @classdesc 实体绘制控制器类
10+
* @description 该类实现了实体数据的绘制与删除功能
11+
* @param option.viewer = viewer 视图
12+
* @see
13+
*/
14+
export default class EntityController extends BaseLayer {
15+
constructor(option) {
16+
super(option);
17+
}
18+
19+
/**
20+
* 添加点
21+
* @param {Number} lat 经度
22+
* @param {Number} lon 纬度
23+
* @param {Number} height 高程
24+
* @param {String} name 名称
25+
* @param {Number} pixelSize 像素大小
26+
* @param {Color} color (webGlobe.getColor(1,0,0,1))颜色
27+
* @param {Color} outlineColor 外边线颜色
28+
* @param {Number} outlineWidth 边线宽度
29+
* @param {string} description 属性描述信息
30+
* @example
31+
* let entityController = new EntityController({viewer});
32+
* let color1 = new Cesium.Color(1, 0, 0, 1);
33+
* let color2 = new Cesium.Color(1, 1, 0, 1);
34+
* let point = entityController.appendPoint(115.2, 31, 200, '点', 100, color1, color2, 2);
35+
* // 跳转到点位置
36+
* viewer.flyTo(point);
37+
*
38+
* @returns {entity} 返回点对象 移除通过removeEntity(entity)
39+
*/
40+
appendPoint(
41+
lat,
42+
lon,
43+
height,
44+
name,
45+
pixelSize,
46+
color,
47+
outlineColor,
48+
outlineWidth,
49+
description,
50+
) {
51+
if (undefined === this.viewer) {
52+
return undefined;
53+
}
54+
let point = this.viewer.entities.add({
55+
name: name,
56+
position: Cesium.Cartesian3.fromDegrees(lat, lon, height),
57+
point: {
58+
//点
59+
pixelSize: pixelSize,
60+
color: color,
61+
outlineColor: outlineColor,
62+
outlineWidth: outlineWidth,
63+
},
64+
description: description,
65+
});
66+
return point;
67+
}
68+
69+
/**
70+
* 通用添加点
71+
* @param {Number} lat 经度
72+
* @param {Number} lon 纬度
73+
* @param {Number} height 高程
74+
* @param {String} name 名称
75+
* @param {string} description 属性描述信息
76+
* @param {object} options entity参数信息对象
77+
*/
78+
appendPointComm(lat, lon, height, name, description, options) {
79+
let param = {
80+
name: name,
81+
position: Cesium.Cartesian3.fromDegrees(lat, lon, height),
82+
point: new Cesium.PointGraphics(),
83+
description: description,
84+
};
85+
if (Cesium.defined(options)) {
86+
Object.extend(param, options);
87+
}
88+
var point = this.viewer.entities.add(param);
89+
return point;
90+
}
91+
}
92+
93+
CesiumZondy.Layer.EntityController = EntityController;

src/cesiumjs/layer/LayerType.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import {CesiumZondy} from "../core/Base";
2+
3+
/**
4+
* 描述图层类型.
5+
*
6+
* @author 基础平台研发中心·冯桂英
7+
* @enum {Number}
8+
*
9+
* @see Layer#type
10+
*/
11+
let LayerType = {
12+
/**
13+
* 未知类型.
14+
*
15+
* @type {Number}
16+
* @constant
17+
*/
18+
UNKNOWN: 0,
19+
20+
/**
21+
* 简单要素类矢量层.
22+
*
23+
* @type {Number}
24+
* @constant
25+
*/
26+
VECTORLAYER: 1,
27+
28+
/**
29+
* 简单要素类模型层.
30+
*
31+
* @type {Number}
32+
* @constant
33+
*/
34+
MODELLAYER: 2,
35+
36+
/**
37+
* 地形层.
38+
*
39+
* @type {Number}
40+
* @constant
41+
*/
42+
TERRAINLAYER: 3,
43+
44+
/**
45+
* 瓦片层.
46+
*
47+
* @type {Number}
48+
* @constant
49+
*/
50+
TILEIMAGELAYER: 8,
51+
52+
/**
53+
* m3d模型层.
54+
*
55+
* @type {Number}
56+
* @constant
57+
*/
58+
M3DLAYER: 10,
59+
};
60+
61+
export default Object.freeze(LayerType);
62+
63+
CesiumZondy.LayerType = LayerType;

0 commit comments

Comments
 (0)