Skip to content

Commit 0a65f2b

Browse files
author
潘卓然Y7000P
committed
【SDK】【新增】【服务器数据查询模块】
1 parent a1d0c36 commit 0a65f2b

15 files changed

Lines changed: 1023 additions & 731 deletions

src/cesiumjs/manager/AdvancedAnalysisManager.js

Lines changed: 146 additions & 140 deletions
Large diffs are not rendered by default.

src/cesiumjs/manager/AnalysisManager.js

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ export default class AnalysisManager {
191191
constructor(options) {
192192
this._viewer = Cesium.defaultValue(options.viewer, undefined);
193193
this._scene = this._viewer.scene;
194-
this._commFun = new CommonFuncManager(options);
195194
}
196195

197196
/**
@@ -335,7 +334,7 @@ export default class AnalysisManager {
335334
for (let j = 0; j < cartesianArr.length - 1; j += 1) {
336335
len += Math.sqrt((cartesianArr[j].x - cartesianArr[j + 1].x) ** 2 + (cartesianArr[j].y - cartesianArr[j + 1].y) ** 2);
337336
}
338-
const pnts = this._commFun.linearInterpolate3D(cartesianArr, len / 300);
337+
const pnts = CommonFuncManager.linearInterpolate3D(cartesianArr, len / 300);
339338

340339
let cartographicsArr = this._viewer.scene.globe.ellipsoid.cartesianArrayToCartographicArray(cartesianArr);
341340
cartographicsArr = cartographicsArr.concat(this._viewer.scene.globe.ellipsoid.cartesianArrayToCartographicArray(pnts));
@@ -556,20 +555,20 @@ export default class AnalysisManager {
556555
* @function module:客户端可视化分析.AnalysisManager.prototype.createDynamicCutting
557556
* @param {Object} tileset 图层集
558557
* @param {Array} planes 平面集
559-
* @param {Object} optionsParam 动态剖切参数
560-
* @param {Color} [optionsParam.color] 材质
561-
* @param {Boolean} [optionsParam.interaction] 交互
558+
* @param {Object} options 动态剖切参数
559+
* @param {Color} [options.color] 材质
560+
* @param {Boolean} [options.interaction] 交互
562561
*/
563-
createDynamicCutting(tilesets, planes, optionsParam) {
562+
createDynamicCutting(tilesets, planes, options) {
564563
if (!Cesium.defined(tilesets) && tilesets.length > 0) {
565564
return undefined;
566565
}
567566
let material = Cesium.Color.WHITE.withAlpha(0.02);
568567
let interaction = false;
569-
const options = Cesium.defaultValue(optionsParam, {});
568+
const optionsParam = Cesium.defaultValue(options, {});
570569

571-
material = Cesium.defaultValue(options.color, material);
572-
interaction = Cesium.defaultValue(options.interaction, false);
570+
material = Cesium.defaultValue(optionsParam.color, material);
571+
interaction = Cesium.defaultValue(optionsParam.interaction, false);
573572

574573
const that = this;
575574
const cutPlanes = [];
@@ -693,27 +692,27 @@ export default class AnalysisManager {
693692
* @param {Array} planeArray 用于卷帘分析的两个面
694693
* @param {Number} distance 平面一的距离
695694
* @param {Number} distance1 平面二的距离
696-
* @param {Object} optionsParam 剖切面材质参数
697-
* @param {Color} [optionsParam.color] 剖切一的颜色
698-
* @param {Color} [optionsParam.color1] 剖切二的颜色
695+
* @param {Object} options 剖切面材质参数
696+
* @param {Color} [options.color] 剖切一的颜色
697+
* @param {Color} [options.color1] 剖切二的颜色
699698
* @example
700699
* 调用方法
701700
* analysisManager.createRollershutters([tileset],distance,distance2);
702701
*/
703-
createRollershutters(tileset, planeArray, distance, distance1, optionsParam) {
704-
const options = Cesium.defaultValue(optionsParam, {});
702+
createRollershutters(tileset, planeArray, distance, distance1, options) {
703+
const optionsParam = Cesium.defaultValue(options, {});
705704
const plane = Cesium.defaultValue(planeArray[0], new Cesium.ClippingPlane(new Cesium.Cartesian3(1, 0, 0), -200.0));
706705
const plane1 = Cesium.defaultValue(planeArray[1], new Cesium.ClippingPlane(new Cesium.Cartesian3(-1, 0, 0), -200.0));
707706
const dynaCut = this.createDynamicCutting(tileset, [plane], {
708-
color: Cesium.defaultValue(options.color, new Cesium.Color(1.0, 1.0, 1.0, 0.3))
707+
color: Cesium.defaultValue(optionsParam.color, new Cesium.Color(1.0, 1.0, 1.0, 0.3))
709708
});
710709
const planetEntity = dynaCut.planes[0];
711710
planetEntity.plane.plane = new Cesium.CallbackProperty(() => {
712711
plane.distance = distance;
713712
return Cesium.Plane.transform(plane, tileset[0].modelMatrix, new Cesium.ClippingPlane(Cesium.Cartesian3.UNIT_X, 0.0));
714713
}, false);
715714
const dynaCut1 = this.createDynamicCutting(tileset, [plane1], {
716-
color: Cesium.defaultValue(options.color1, new Cesium.Color(1.0, 1.0, 1.0, 0.3))
715+
color: Cesium.defaultValue(optionsParam.color1, new Cesium.Color(1.0, 1.0, 1.0, 0.3))
717716
});
718717
const planetEntity1 = dynaCut1.planes[0];
719718
planetEntity1.plane.plane = new Cesium.CallbackProperty(() => {
@@ -726,31 +725,31 @@ export default class AnalysisManager {
726725
* @function module:客户端可视化分析.AnalysisManager.prototype.startCustomDisplay
727726
* @param {Array<layer>} layerList 图层列表
728727
* @param {Array<id>} idList id列表
729-
* @param {Object} optionsParam 扩展属性
730-
* @param {Color} [optionsParam.color = new Cesium.Color(1.0,0,0,0.5)] 高亮颜色
731-
* @param {Cesium3DTileColorBlendMode} [optionsParam.colorBlendMode = Cesium.Cesium3DTileColorBlendMode.HIGHLIGHT] 高亮模式
732-
* @param {Number} [optionsParam.colorBlendAmount = 0.5] 混合系数
733-
* @param {Boolean} [optionsParam.applyForLayer = false] 是否应用至图层
734-
* @param {Color} [optionsParam.negate = true] 是否取反 ——意思是除了id列表中的要素应用color
735-
* @param {Color} [optionsParam.negateColor = new Cesium.Color.WHITE] 取反的颜色 只有在negate=true 的时候才起作用
736-
* @param {String} [optionsParam.style='EdgeHighlight'] 高亮模式//'EdgeHighlight'高亮+描边 'Edge'//描边
737-
* @param {Color} [optionsParam.edgeColor=new Cesium.Color(0, 0, 1,1.0)] //描边颜色 默认红色
728+
* @param {Object} options 扩展属性
729+
* @param {Color} [options.color = new Cesium.Color(1.0,0,0,0.5)] 高亮颜色
730+
* @param {Cesium3DTileColorBlendMode} [options.colorBlendMode = Cesium.Cesium3DTileColorBlendMode.HIGHLIGHT] 高亮模式
731+
* @param {Number} [options.colorBlendAmount = 0.5] 混合系数
732+
* @param {Boolean} [options.applyForLayer = false] 是否应用至图层
733+
* @param {Color} [options.negate = true] 是否取反 ——意思是除了id列表中的要素应用color
734+
* @param {Color} [options.negateColor = new Cesium.Color.WHITE] 取反的颜色 只有在negate=true 的时候才起作用
735+
* @param {String} [options.style='EdgeHighlight'] 高亮模式//'EdgeHighlight'高亮+描边 'Edge'//描边
736+
* @param {Color} [options.edgeColor=new Cesium.Color(0, 0, 1,1.0)] //描边颜色 默认红色
738737
*
739738
*/
740-
startCustomDisplay(layerList, idList, optionsParam) {
739+
startCustomDisplay(layerList, idList, options) {
741740
if (!Cesium.defined(layerList) || !Cesium.defined(idList)) {
742741
return;
743742
}
744-
const options = Cesium.defaultValue(optionsParam, {});
743+
const optionsParam = Cesium.defaultValue(options, {});
745744
const that = this;
746-
let colorUse = Cesium.defaultValue(options.color, new Cesium.Color(1, 0, 0, 0.5));
747-
const edgeColorUse = Cesium.defaultValue(options.edgeColor, new Cesium.Color(1, 0, 0, 1.0));
748-
const negate = Cesium.defaultValue(options.negate, false);
749-
const negateColor = Cesium.defaultValue(options.negateColor, Cesium.Color.WHITE);
750-
const applyForLayer = Cesium.defaultValue(options.applyForLayer, false);
751-
const style = Cesium.defaultValue(options.style, '');
752-
const colorBlendMode = Cesium.defaultValue(options.colorBlendMode, Cesium.Cesium3DTileColorBlendMode.HIGHLIGHT);
753-
const colorBlendAmount = Cesium.defaultValue(options.colorBlendAmount, 0.5);
745+
let colorUse = Cesium.defaultValue(optionsParam.color, new Cesium.Color(1, 0, 0, 0.5));
746+
const edgeColorUse = Cesium.defaultValue(optionsParam.edgeColor, new Cesium.Color(1, 0, 0, 1.0));
747+
const negate = Cesium.defaultValue(optionsParam.negate, false);
748+
const negateColor = Cesium.defaultValue(optionsParam.negateColor, Cesium.Color.WHITE);
749+
const applyForLayer = Cesium.defaultValue(optionsParam.applyForLayer, false);
750+
const style = Cesium.defaultValue(optionsParam.style, '');
751+
const colorBlendMode = Cesium.defaultValue(optionsParam.colorBlendMode, Cesium.Cesium3DTileColorBlendMode.HIGHLIGHT);
752+
const colorBlendAmount = Cesium.defaultValue(optionsParam.colorBlendAmount, 0.5);
754753
if (style === 'Edge' && !Cesium.defined(this._edgeDetectionStageCD)) {
755754
this._edgeDetectionStageCD = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
756755
this._edgeDetectionStageCD.uniforms.color = edgeColorUse; // Color.BLUE;
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ import LayerManager from '../layer/LayerManager';
33

44
/**
55
* @author 三维基础平台研发中心·冯桂英
6-
* @class module:客户端公共方法.CesiumFuncManager
7-
* @category CesiumFuncManager
8-
* @classdesc 实体绘制控制器类
9-
* @description 该类实现了实体数据的绘制与删除功能
6+
* @class module:客户端公共方法.CommonDataManager
7+
* @category CommonDataManager
8+
* @classdesc 通用数据管理类
9+
* @description 该类实现了通用数据的添加与删除功能
1010
* @param option.viewer 视图
1111
*/
12-
export default class CesiumFuncManager extends LayerManager {
12+
export default class CommonDataManager extends LayerManager {
1313
constructor(optionsParam) {
1414
const options = optionsParam;
1515
super(options);
1616
}
1717

1818
/**
1919
* 通过地址添加图片,包括本地图片和网络图片
20-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendImageByUrl
20+
* @function module:客户端公共方法.CommonDataManager.prototype.appendImageByUrl
2121
* @param {String} url 图片地址
2222
* @param {Number} west 西经
2323
* @param {Number} south 南纬
2424
* @param {Number} east 东经
2525
* @param {Number} north 北纬
2626
* @param {Object} options 扩展参数
2727
* @example
28-
* let cesiumFun = new CesiumFuncManager({viewer:viewer});
28+
* let cesiumFun = new CommonDataManager({viewer:viewer});
2929
* let singleImage = cesiumFun.appendImageByUrl('.../../../../../../../../static/libs/Cesium/MapGIS/image/2.5D2.png',110,20,114,30);
3030
*/
3131
appendImageByUrl(url, west, south, east, north, options) {
@@ -42,7 +42,7 @@ export default class CesiumFuncManager extends LayerManager {
4242

4343
/**
4444
*移除添加的图片
45-
* @function module:客户端公共方法.CesiumFuncManager.prototype.removeImage
45+
* @function module:客户端公共方法.CommonDataManager.prototype.removeImage
4646
* @param {Object} imageryLayer 添加的图片对象
4747
* @param {Boolean} isDestroy 是否销毁图片对象
4848
*/
@@ -54,7 +54,7 @@ export default class CesiumFuncManager extends LayerManager {
5454

5555
/**
5656
* 通过路径添加3DTile数据
57-
* @function module:客户端公共方法.CesiumFuncManager.prototype.append3DTile
57+
* @function module:客户端公共方法.CommonDataManager.prototype.append3DTile
5858
* @param {String} url 路径
5959
* @param {Function} onsuccess 成功回调
6060
* @param {Object} options 扩展参数
@@ -88,7 +88,7 @@ export default class CesiumFuncManager extends LayerManager {
8888

8989
/**
9090
*移除3dTile对象
91-
* @function module:客户端公共方法.CesiumFuncManager.prototype.remove3DTile
91+
* @function module:客户端公共方法.CommonDataManager.prototype.remove3DTile
9292
* @param {Object} tileset 3dTile对象
9393
*/
9494
remove3DTile(tileset) {
@@ -97,14 +97,14 @@ export default class CesiumFuncManager extends LayerManager {
9797

9898
/**
9999
* 添加模型(gltf文件)
100-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendModel
100+
* @function module:客户端公共方法.CommonDataManager.prototype.appendModel
101101
* @param {Number} id 模型id
102102
* @param {String} url 模型url路径
103103
* @param {Number} lon 模型所在经度
104104
* @param {Number} lat 模型坐在纬度
105105
* @param {Number} height 高度
106106
* @param {Number} scale 缩放比
107-
* @param {Option} 包含以下参数
107+
* @param {Object} options 包含以下参数
108108
* @param {Color} [options.color] 颜色
109109
* @param {ColorBlendMode} [options.colorBlendMode] 颜色混合模式 Cesium.ColorBlendMode.MIX
110110
* @param {Number} [options.colorBlendAmount] 颜色混合程度
@@ -142,7 +142,7 @@ export default class CesiumFuncManager extends LayerManager {
142142

143143
/**
144144
* 批量添加模型
145-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendModels
145+
* @function module:客户端公共方法.CommonDataManager.prototype.appendModels
146146
* @param {String} modelsString 模型组织
147147
* @param {Function} successCall 成功后的回调
148148
* @returns {Object} 模型层对象
@@ -160,7 +160,7 @@ export default class CesiumFuncManager extends LayerManager {
160160

161161
/**
162162
* 通过文件批量添加模型
163-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendModels
163+
* @function module:客户端公共方法.CommonDataManager.prototype.appendModels
164164
* @param {String} filePath 模型组织文件
165165
* @param {Function} successCall 成功后的回调
166166
* @returns {Object} 模型层对象
@@ -178,7 +178,7 @@ export default class CesiumFuncManager extends LayerManager {
178178

179179
/**
180180
* 加载Kml、kmz数据
181-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendKml
181+
* @function module:客户端公共方法.CommonDataManager.prototype.appendKml
182182
* @param {String} url 路径
183183
* @param {Object} options 参数
184184
* @see {@link https://cesium.com/docs/cesiumjs-ref-doc/KmlDataSource.html }
@@ -207,7 +207,7 @@ export default class CesiumFuncManager extends LayerManager {
207207

208208
/**
209209
* 添加czml文件
210-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendCZML
210+
* @function module:客户端公共方法.CommonDataManager.prototype.appendCZML
211211
* @param {String} url 文件地址
212212
* @param {Function} successCall 成功后的回调
213213
* @returns {CzmlDataSource} czml 对象
@@ -227,7 +227,7 @@ export default class CesiumFuncManager extends LayerManager {
227227

228228
/**
229229
* 添加GeoJson文件
230-
* @function module:客户端公共方法.CesiumFuncManager.prototype.appendGeoJson
230+
* @function module:客户端公共方法.CommonDataManager.prototype.appendGeoJson
231231
* @param {String} url 文件地址
232232
* @returns {GeoJsonDataSource} 数据对象
233233
* @example
@@ -254,7 +254,7 @@ export default class CesiumFuncManager extends LayerManager {
254254

255255
/**
256256
* 移除模型
257-
* @function module:客户端公共方法.CesiumFuncManager.prototype.removeModel
257+
* @function module:客户端公共方法.CommonDataManager.prototype.removeModel
258258
* @param {Model} model 模型对象
259259
*/
260260
removeModel(model) {
@@ -264,7 +264,7 @@ export default class CesiumFuncManager extends LayerManager {
264264

265265
/**
266266
* 移除通过appendModelsByFile()和appendModels()添加的模型
267-
* @function module:客户端公共方法.CesiumFuncManager.prototype.removeModels
267+
* @function module:客户端公共方法.CommonDataManager.prototype.removeModels
268268
* @param {DataSource} models 模型组织
269269
*/
270270
removeModels(models) {
@@ -273,7 +273,7 @@ export default class CesiumFuncManager extends LayerManager {
273273

274274
/**
275275
* 移除数据对象
276-
* @function module:客户端公共方法.CesiumFuncManager.prototype.removeDataSource
276+
* @function module:客户端公共方法.CommonDataManager.prototype.removeDataSource
277277
* @param {DataSource} datasource 模型组织
278278
* @param {Boolean} isDestroy 是否销毁
279279
*/
@@ -287,12 +287,12 @@ export default class CesiumFuncManager extends LayerManager {
287287

288288
/**
289289
* 删除所有数据源:与以上几个接口配合使用
290-
* @function module:客户端公共方法.CesiumFuncManager.prototype.removeAllDataSource
290+
* @function module:客户端公共方法.CommonDataManager.prototype.removeAllDataSource
291291
* @param {Boolean} isDestroy 是否销毁
292292
*/
293293
removeAllDataSource(isDestroy = false) {
294294
this.viewer.dataSources.removeAll(isDestroy);
295295
}
296296
}
297297

298-
CesiumZondy.Layer.CesiumFuncManager = CesiumFuncManager;
298+
CesiumZondy.Manager.CommonDataManager = CommonDataManager;

src/cesiumjs/manager/CommonFuncManager.js

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function calAngleOf3Pnt(p1, p2, p3) {
1919
* @author 三维基础平台研发中心·冯桂英
2020
* @class module:客户端公共方法.CommonFuncManager
2121
* @category CommonFuncManager
22-
* @classdesc 辅助计算类
23-
* @description 该类实提供加密点等辅助计算函数
22+
* @classdesc 通用辅助计算类
23+
* @description 该类实提供例如加密点等辅助计算函数
2424
* @param optionsParam.viewer 场景视窗
2525
*/
2626
export default class CommonFuncManager {
@@ -389,7 +389,7 @@ export default class CommonFuncManager {
389389
* // ClockRange:Cesium.ClockRange.CLAMPED
390390
* // };
391391
* //let update = commfun.rotationView('rotationAroundPos',opt) ;
392-
* commfun.pauseRotationView(update);
392+
* commfun.pauseRotationView();
393393
*/
394394
pauseRotationView() {
395395
this.viewer.clock.shouldAnimate = false;
@@ -407,7 +407,7 @@ export default class CommonFuncManager {
407407
* // ClockRange:Cesium.ClockRange.CLAMPED
408408
* // };
409409
* //let update = commfun.rotationView('rotationAroundPos',opt) ;
410-
* //commfun.pauseRotationView(update);
410+
* //commfun.pauseRotationView();
411411
* commfun.startRotationAroundPos(update);
412412
*/
413413
startRotationAroundPos() {
@@ -685,6 +685,37 @@ export default class CommonFuncManager {
685685
}
686686
});
687687
}
688+
689+
/**
690+
* 创建导航控件
691+
* @function module:客户端公共方法.CommonFuncManager.prototype.createNavigationTool
692+
* @param {object} options 导航控件参数
693+
* let options = {};
694+
* //用于在使用重置导航重置地图视图时设置默认视图控制。接受的值是Cesium.Cartographic 和 Cesium.Rectangle
695+
* options.defaultResetView = Cesium.Rectangle.fromDegrees(71, 3, 90, 14);
696+
* //用于启用或禁用罗盘
697+
* options.enableCompass= true;
698+
* //用于启用或禁用缩放控件
699+
* options.enableZoomControls= false;
700+
* //用于启用或禁用距离图例
701+
* options.enableDistanceLegend= false;
702+
* //用于启用或禁用指南针外环
703+
* options.enableCompassOuterRing= true;
704+
* @returns {Object} 导航控件对象
705+
* @example
706+
* let commfun = new CommonFun({viewer:viewer});
707+
* let navigation = commfun.createNavigationTool({
708+
enableCompass: true,
709+
enableZoomControls: true,
710+
enableDistanceLegend: true,
711+
enableCompassOuterRing: true,
712+
defaultResetView: Cesium.Rectangle.fromDegrees(110, 30, 121, 31)
713+
});
714+
*/
715+
createNavigationTool(options) {
716+
this.viewer.extend(Cesium.viewerCesiumNavigationMixin, options);
717+
return this.viewer.cesiumNavigation;
718+
}
688719
}
689720

690721
CesiumZondy.Manager.CommonFuncManager = CommonFuncManager;

0 commit comments

Comments
 (0)