zbcx_ckyc 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +90 -0
- package/src/plugins/app/com/CesiumTool.js +730 -0
- package/src/plugins/app/com/MapMethods.js +355 -0
- package/src/plugins/app/com/MapTool.vue +772 -0
- package/src/plugins/app/com/MenuRouter.vue +157 -0
- package/src/plugins/app/com/ParamsDes.vue +35 -0
- package/src/plugins/app/com/SelCoorSys.vue +235 -0
- package/src/plugins/app/com/WebProj4.js +32 -0
- package/src/plugins/app/com/measure.js +127 -0
- package/src/plugins/app/com/yx.js +238 -0
- package/src/plugins/app/modelmanagement/D3DrawGraph.js +708 -0
- package/src/plugins/app/modelmanagement/MineralGo.vue +241 -0
- package/src/plugins/app/modelmanagement/MineralModel.vue +1203 -0
- package/src/plugins/app/modelmanagement/ModelCloudmap.vue +69 -0
- package/src/plugins/app/modelmanagement/ModelMst.vue +60 -0
- package/src/plugins/app/modelmanagement/ModelSy.vue +173 -0
- package/src/plugins/app/modelmanagement/ModelTp.vue +51 -0
- package/src/plugins/app/modelmanagement/ModelUpload.vue +774 -0
- package/src/plugins/app/znycpjxt/Api.js +714 -0
- package/src/plugins/app/znycpjxt/Bf/AttFactory.js +25 -0
- package/src/plugins/app/znycpjxt/Bf/IAnomalyhandle.js +102 -0
- package/src/plugins/app/znycpjxt/Bf/IComposeanomaly.js +140 -0
- package/src/plugins/app/znycpjxt/Bf/IContinueanaly.js +138 -0
- package/src/plugins/app/znycpjxt/Bf/IContrastanaly.js +138 -0
- package/src/plugins/app/znycpjxt/Bf/ICustomNode.js +145 -0
- package/src/plugins/app/znycpjxt/Bf/IDerivanaly.js +139 -0
- package/src/plugins/app/znycpjxt/Bf/IFilterananly.js +141 -0
- package/src/plugins/app/znycpjxt/Bf/IMeananaly.js +137 -0
- package/src/plugins/app/znycpjxt/Bf/IModelNodeBase.js +135 -0
- package/src/plugins/app/znycpjxt/Bf/IMoveaverage.js +135 -0
- package/src/plugins/app/znycpjxt/Bf/IReducepole.js +141 -0
- package/src/plugins/app/znycpjxt/Bf/ISmoothanaly.js +135 -0
- package/src/plugins/app/znycpjxt/Bf/ITrendanaly.js +144 -0
- package/src/plugins/app/znycpjxt/Bf/IVector2grd.js +144 -0
- package/src/plugins/app/znycpjxt/Bf/IYcfj.js +84 -0
- package/src/plugins/app/znycpjxt/Bf/IYcxxjs.js +105 -0
- package/src/plugins/app/znycpjxt/Bf/IYgsbtq.js +112 -0
- package/src/plugins/app/znycpjxt/Bf/IYgtxrh.js +112 -0
- package/src/plugins/app/znycpjxt/Bf/Iinteranaly.js +135 -0
- package/src/plugins/app/znycpjxt/Bf/index.js +44 -0
- package/src/plugins/app/znycpjxt/Bf/input/InputData.js +21 -0
- package/src/plugins/app/znycpjxt/Bf/input/InputExcel.js +28 -0
- package/src/plugins/app/znycpjxt/Bf/input/InputKd.js +31 -0
- package/src/plugins/app/znycpjxt/Bqqd/Bqqd.vue +380 -0
- package/src/plugins/app/znycpjxt/Bqqd/BqqdMap.vue +1046 -0
- package/src/plugins/app/znycpjxt/Bqqd/SetOpacity.vue +101 -0
- package/src/plugins/app/znycpjxt/Bqqd/SjzxTree.vue +244 -0
- package/src/plugins/app/znycpjxt/Bqqd/YclsjjTree.vue +212 -0
- package/src/plugins/app/znycpjxt/Bqqd/api/DsjzxApi.js +37 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmx.vue +161 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgGloalParams.vue +92 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgNodeFlds.vue +102 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgNodeParams.vue +277 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/Ckycmxgl.vue +303 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/SetLabelParam.vue +68 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/SetModelParam.vue +69 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Ckycmxtab.vue +107 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Dtzzylwl.vue +156 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Jjsjwl.vue +230 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Sjsl.vue +126 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zcxlj.vue +128 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zjq.vue +123 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zstp.vue +271 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zzylwl.vue +149 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/ParamsData.vue +323 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/ParamsDataNew.vue +336 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/QqtEcharts.vue +137 -0
- package/src/plugins/app/znycpjxt/Ckycmx/Ckycrwgl/Ckycrwgl.vue +290 -0
- package/src/plugins/app/znycpjxt/CusTools/CodeApi.js +83 -0
- package/src/plugins/app/znycpjxt/CusTools/CodeEditor/CodeEditor.md +36 -0
- package/src/plugins/app/znycpjxt/CusTools/CodeEditor/CodeEditor.vue +227 -0
- package/src/plugins/app/znycpjxt/CusTools/CodeEditor/PlugCodeEditor.vue +78 -0
- package/src/plugins/app/znycpjxt/CusTools/CodeEditor/demo/basic.png +0 -0
- package/src/plugins/app/znycpjxt/CusTools/CodeEditor/demo/basic.vue +27 -0
- package/src/plugins/app/znycpjxt/CusTools/DmbjForm.vue +76 -0
- package/src/plugins/app/znycpjxt/CusTools/DmfbForm.vue +351 -0
- package/src/plugins/app/znycpjxt/CusTools/GjForm.vue +206 -0
- package/src/plugins/app/znycpjxt/CusTools/Gjbjyfb.vue +200 -0
- package/src/plugins/app/znycpjxt/CusTools/ParamSelect.vue +222 -0
- package/src/plugins/app/znycpjxt/CusTools/ParamSelect2.vue +204 -0
- package/src/plugins/app/znycpjxt/CusTools/Zngjj.vue +105 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/DataAnlyModel.vue +134 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx/HgfxEcharts.vue +98 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx/HgfxTab.vue +73 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx.vue +101 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj/JctjjgTab.vue +70 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj/Plzft.vue +154 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj.vue +118 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Jlfx/JlfxImg.vue +80 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Jlfx.vue +91 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/PCAfx/PcaTab.vue +161 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/PCAfx.vue +101 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Qqt/QqtEcharts.vue +202 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Qqt.vue +88 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Xgxfx/XgxfxImg.vue +80 -0
- package/src/plugins/app/znycpjxt/DataAnlyModel/Xgxfx.vue +96 -0
- package/src/plugins/app/znycpjxt/DatasetMan/CreateDataset.vue +296 -0
- package/src/plugins/app/znycpjxt/DatasetMan/DatasetMan.vue +141 -0
- package/src/plugins/app/znycpjxt/DatasetMan/PreData.js +91 -0
- package/src/plugins/app/znycpjxt/DatasetMan/PreData.vue +545 -0
- package/src/plugins/app/znycpjxt/DatasetMan/PreDataApi.js +101 -0
- package/src/plugins/app/znycpjxt/DatasetMan/SelData.vue +186 -0
- package/src/plugins/app/znycpjxt/DatasetMan/SjTree.vue +130 -0
- package/src/plugins/app/znycpjxt/DatasetMan/Sjj.vue +478 -0
- package/src/plugins/app/znycpjxt/DatasetMan/Yclsjj.vue +445 -0
- package/src/plugins/app/znycpjxt/DatasetMan/Yssjj.vue +389 -0
- package/src/plugins/app/znycpjxt/DocList/DocList.vue +496 -0
- package/src/plugins/app/znycpjxt/DocList/unit/DocItem.vue +137 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Dchj.vue +107 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/GeophysicalAnomaly.vue +115 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Jxyt.vue +98 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Lbjs.vue +127 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Pjcjs.vue +103 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Qdjs.vue +103 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/ExceptHandlModel.vue +163 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Cdjs.vue +102 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Czfx.vue +163 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/GetFormData.vue +343 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Hdpj.vue +100 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Pjtd.vue +90 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Qsfx.vue +109 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/ResultOnlyData.vue +121 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/ResultTable.vue +231 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/UniversalComputing.vue +139 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Xgxsjs.vue +93 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Xxsjs.vue +90 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Ycfj.vue +116 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Yhcl.vue +100 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/AnomalsGard.vue +91 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Dqhxycht.vue +113 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/GeocAnomalies.vue +99 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/JgTableList.vue +203 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Lszcl.vue +110 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Ycxxjs.vue +116 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/GeoAnomalyExtraction.vue +108 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/AttWeight.vue +99 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/Ckdctq.vue +98 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/LeftForm.vue +266 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/Ygsbtq.vue +150 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/Ygtxrh.vue +107 -0
- package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/ygyctq.vue +98 -0
- package/src/plugins/app/znycpjxt/Index/DataCard.vue +45 -0
- package/src/plugins/app/znycpjxt/Index/Index.vue +123 -0
- package/src/plugins/app/znycpjxt/Rzgl/Rzgl.vue +156 -0
- package/src/plugins/app/znycpjxt/coms/CmapColor.vue +70 -0
- package/src/plugins/app/znycpjxt/coms/CustomFileView.vue +343 -0
- package/src/plugins/app/znycpjxt/coms/CustomForm.vue +220 -0
- package/src/plugins/app/znycpjxt/coms/GrdView.vue +355 -0
- package/src/plugins/app/znycpjxt/coms/LeftForm.vue +195 -0
- package/src/plugins/app/znycpjxt/coms/MakeData.js +472 -0
- package/src/plugins/app/znycpjxt/coms/PreView.js +55 -0
- package/src/plugins/app/znycpjxt/coms/RightContent.vue +71 -0
- package/src/plugins/app/znycpjxt/coms/TableEarth.vue +259 -0
- package/src/plugins/app/znycpjxt/intellPred/ModelList.vue +200 -0
- package/src/plugins/app/znycpjxt/intellPred/coms/D3DrawGraph.js +634 -0
- package/src/plugins/app/znycpjxt/intellPred/coms/MineralGo.vue +249 -0
- package/src/plugins/app/znycpjxt/intellPred/coms/ModelCard.vue +298 -0
- package/src/plugins/app/znycpjxt/intellPred/coms/ModelEdit.vue +292 -0
- package/src/plugins/app/znycpjxt/intellPred/coms/ModelSpecif.vue +46 -0
- package/src/plugins/app/znycpjxt/intellPred/intellPred.vue +71 -0
- package/src/plugins/bf/BfApi.js +92 -0
- package/src/plugins/bf/BfColAdd.vue +78 -0
- package/src/plugins/bf/BfColEdit.vue +68 -0
- package/src/plugins/bf/BfColFilter.vue +112 -0
- package/src/plugins/bf/BfDataGroup.vue +80 -0
- package/src/plugins/bf/BfDataPreview.vue +118 -0
- package/src/plugins/bf/BfDataStat.vue +81 -0
- package/src/plugins/bf/BfDuplicateDel.vue +82 -0
- package/src/plugins/bf/BfProcCall.vue +82 -0
- package/src/plugins/bf/BfRunHis.vue +289 -0
- package/src/plugins/bf/BfRunParams.vue +94 -0
- package/src/plugins/bf/BfSaveFlow.vue +186 -0
- package/src/plugins/bf/BfSelFlow.vue +123 -0
- package/src/plugins/bf/BfTabCombine.vue +127 -0
- package/src/plugins/bf/BfTabJoin.vue +108 -0
- package/src/plugins/bf/BfTabMerge.vue +68 -0
- package/src/plugins/bf/BfTabReader.vue +126 -0
- package/src/plugins/bf/BfValFormat.vue +68 -0
- package/src/plugins/bf/BfValNumber.vue +68 -0
- package/src/plugins/bf/BfValProc.vue +78 -0
- package/src/plugins/bf/BfValSort.vue +78 -0
- package/src/plugins/bf/BiFlow.vue +1177 -0
- package/src/plugins/bf/IBfPlug.js +205 -0
- package/src/plugins/bf/coms/ColAdd.vue +75 -0
- package/src/plugins/bf/coms/ColEdit.vue +52 -0
- package/src/plugins/bf/coms/ColList.vue +91 -0
- package/src/plugins/bf/coms/DataGroup.vue +90 -0
- package/src/plugins/bf/coms/DataStat.vue +67 -0
- package/src/plugins/bf/coms/EditTable.vue +161 -0
- package/src/plugins/bf/coms/NodeTree.vue +105 -0
- package/src/plugins/bf/coms/PlugCmd.vue +95 -0
- package/src/plugins/bf/coms/RunParams.vue +68 -0
- package/src/plugins/bf/coms/TabCombine.vue +60 -0
- package/src/plugins/bf/coms/TabJoin.vue +69 -0
- package/src/plugins/bf/coms/ValFormat.vue +53 -0
- package/src/plugins/bf/coms/ValProc.vue +77 -0
- package/src/plugins/bf/coms/ValSort.vue +89 -0
- package/src/plugins/bf/parts/Icon.vue +105 -0
- package/src/plugins/bf/parts/Rect.vue +98 -0
- package/src/plugins/bf/parts/index.js +11 -0
- package/src/plugins/cxMixin/IAttBase.js +78 -0
- package/src/plugins/cxMixin/IAttDlg.js +45 -0
- package/src/plugins/cxMixin/IAttProc.js +98 -0
- package/src/plugins/cxMixin/IComBase.js +42 -0
- package/src/plugins/cxMixin/IContextMenu.js +74 -0
- package/src/plugins/cxMixin/IDataAcce.js +1106 -0
- package/src/plugins/cxMixin/IDataList.js +775 -0
- package/src/plugins/cxMixin/IDataMan.js +1670 -0
- package/src/plugins/cxMixin/IDataMan2.js +2561 -0
- package/src/plugins/cxMixin/IDataProc.js +379 -0
- package/src/plugins/cxMixin/IDatagrid.js +234 -0
- package/src/plugins/cxMixin/IEditableDg.js +477 -0
- package/src/plugins/cxMixin/IExpBase.js +51 -0
- package/src/plugins/cxMixin/IFormBase.js +29 -0
- package/src/plugins/cxMixin/IGridBpm.js +732 -0
- package/src/plugins/cxMixin/IGridData.js +109 -0
- package/src/plugins/cxMixin/IOperMore.js +323 -0
- package/src/plugins/cxMixin/IPlugBase.js +341 -0
- package/src/plugins/cxMixin/ISendCode.js +86 -0
- package/src/plugins/cxMixin/ISinglePage.js +112 -0
- package/src/plugins/cxMixin/ITags.js +81 -0
- package/src/plugins/cxe/CxeMap.vue +61 -0
- package/src/plugins/home/HeadNav.vue +194 -0
- package/src/plugins/home/Home.vue +59 -0
- package/src/plugins/home/HomePage.vue +237 -0
- package/src/plugins/home/Login.vue +139 -0
- package/src/plugins/zbcxCesium/coms/GraDrawBarWgt.vue +176 -0
- package/src/plugins/zbcxCesium/coms/baseMapSwitch/BaseMap.scss +42 -0
- package/src/plugins/zbcxCesium/coms/baseMapSwitch/BaseMap.vue +59 -0
- package/src/plugins/zbcxCesium/coms/dataPreview/DataPreview.vue +526 -0
- package/src/plugins/zbcxCesium/coms/dataPreview/DataPreviewPlug.vue +79 -0
- package/src/plugins/zbcxCesium/coms/dataPreview/ReadShpFile.js +42 -0
- package/src/plugins/zbcxCesium/coms/legend/Legend.vue +78 -0
- package/src/plugins/zbcxCesium/coms/popup/dialog-left-bg.png +0 -0
- package/src/plugins/zbcxCesium/coms/popup/index.js +88 -0
- package/src/plugins/zbcxCesium/coms/popup/index.vue +93 -0
- package/src/plugins/zbcxCesium/pub/LoadGeojson.js +44 -0
- package/src/plugins/zbcxCesium/pub/LoadModel.js +128 -0
- package/src/plugins/zbcxCesium/pub/LoadOgc.js +226 -0
- package/src/plugins/zbcxCesium/pub/Opacity.vue +139 -0
- package/src/plugins/zbcxCesium/pub/PubCxe.js +97 -0
- package/src/plugins/zbcxCesium/pub/SceneSet.vue +178 -0
- package/src/plugins/zbcxCesium/pub/ShowEffect.vue +216 -0
- package/src/plugins/zbcxCesium/pub/TMeasure.vue +122 -0
- package/src/plugins/zbcxCesium/pub/ToDefView3.vue +109 -0
- package/src/plugins/zbcxCesium/pub/getWmsGetCapabilities.js +127 -0
- package/src/plugins/zbcxCesium/utils/ShpToGeoJson.js +24 -0
- package/src/plugins/zbcxCesium/utils/WebProj4.js +32 -0
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* cesium 工具类整理 基于cxe
|
|
4
|
+
* @class CesiumTool
|
|
5
|
+
* @author Guo KangLun
|
|
6
|
+
* @desc 兼容cesium原生方法
|
|
7
|
+
*/
|
|
8
|
+
class CesiumTool
|
|
9
|
+
{
|
|
10
|
+
constructor(viewer, layers)
|
|
11
|
+
{
|
|
12
|
+
this.viewer = viewer
|
|
13
|
+
this.addLayer(layers)
|
|
14
|
+
// select 要素
|
|
15
|
+
this.pick = null
|
|
16
|
+
// 闪烁数组集合
|
|
17
|
+
this.blinkingBillboards = []
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 地球配置项
|
|
22
|
+
*/
|
|
23
|
+
setOptions(option)
|
|
24
|
+
{
|
|
25
|
+
this.viewer.setOptions(option)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 添加需要绘制的图层
|
|
30
|
+
* @param {Array} layers 实例化时传入的所有图层
|
|
31
|
+
*/
|
|
32
|
+
addLayer(layers)
|
|
33
|
+
{
|
|
34
|
+
if (layers.includes('VectorLayer'))
|
|
35
|
+
{
|
|
36
|
+
// 矢量图层
|
|
37
|
+
this.layer = new cxe.VectorLayer('layer')
|
|
38
|
+
this.viewer.layers.addLayer(this.layer)
|
|
39
|
+
}
|
|
40
|
+
if (layers.includes('HtmlLayer'))
|
|
41
|
+
{
|
|
42
|
+
// 矢量图层
|
|
43
|
+
this.layer = new cxe.HtmlLayer('layer')
|
|
44
|
+
this.viewer.layers.addLayer(this.layer)
|
|
45
|
+
}
|
|
46
|
+
if (layers.includes('ClusterLayer'))
|
|
47
|
+
{
|
|
48
|
+
// 聚合图层 circle / cluster
|
|
49
|
+
this.clusterLayer = new cxe.ClusterLayer('layer', {
|
|
50
|
+
style: 'circle',
|
|
51
|
+
gradient: {
|
|
52
|
+
// 0.0001: Cesium.Color.WHITE,
|
|
53
|
+
0.001: Cesium.Color.fromCssColorString('#69ff77'),
|
|
54
|
+
0.01: Cesium.Color.fromCssColorString('#69ff77'),
|
|
55
|
+
0.1: Cesium.Color.fromCssColorString('#69ff77')
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
this.viewer.layers.addLayer(this.clusterLayer)
|
|
59
|
+
}
|
|
60
|
+
if (layers.includes('TilesetLayer'))
|
|
61
|
+
{
|
|
62
|
+
// 3dtiles瓦片图层
|
|
63
|
+
this.tile = new cxe.TilesetLayer('3dtiles')
|
|
64
|
+
this.viewer.layers.addLayer(this.tile)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 要素绘制
|
|
70
|
+
* @param {Array} coors 坐标数组
|
|
71
|
+
* @param {Number} type 绘制类型 【1点】【2线】【3面】【6广告牌】
|
|
72
|
+
* @param {Boolean} clearable 默认清空绘制
|
|
73
|
+
* @param {Object} opts 其他参数
|
|
74
|
+
*/
|
|
75
|
+
addVector(coors, type, clearable = true, flytoLayer = true, opts = {})
|
|
76
|
+
{
|
|
77
|
+
if (clearable)
|
|
78
|
+
this.clear()
|
|
79
|
+
this.draw(coors, type, opts)
|
|
80
|
+
if (flytoLayer)
|
|
81
|
+
this.flyTo(this.layer)
|
|
82
|
+
if (!this.pick)
|
|
83
|
+
this.pickVector()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
draw(coors, type, opts)
|
|
87
|
+
{
|
|
88
|
+
if (type === 1)
|
|
89
|
+
this.addPoint(coors, opts)
|
|
90
|
+
else if (type === 2)
|
|
91
|
+
this.addLine(coors, opts)
|
|
92
|
+
else if (type === 3)
|
|
93
|
+
this.addPol(coors, opts)
|
|
94
|
+
else if (type === 6)
|
|
95
|
+
this.addBillboard(coors, opts)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 添加聚合图层
|
|
100
|
+
*/
|
|
101
|
+
addCluster(coors, clear = true, flytoLayer = true)
|
|
102
|
+
{
|
|
103
|
+
if (clear)
|
|
104
|
+
this.clear()
|
|
105
|
+
this.clusterLayer.attr = { name: '聚合图层' }
|
|
106
|
+
let boards = []
|
|
107
|
+
coors.forEach(item =>
|
|
108
|
+
{
|
|
109
|
+
let { lng, lat, alt, img = 'tpyx/cxe_demo/examples/images/icon/camera.png', size = [48, 48] } = item
|
|
110
|
+
let pol = new cxe.Billboard({ lng, lat, alt }, img)
|
|
111
|
+
pol.size = size
|
|
112
|
+
pol.att = item
|
|
113
|
+
boards.push(pol)
|
|
114
|
+
})
|
|
115
|
+
this.clusterLayer.addOverlays(boards)
|
|
116
|
+
if (flytoLayer)
|
|
117
|
+
this.flyTo(this.clusterLayer)
|
|
118
|
+
if (!this.pick)
|
|
119
|
+
this.pickVector()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 3dtiles 加载
|
|
124
|
+
*/
|
|
125
|
+
addTile(obj)
|
|
126
|
+
{
|
|
127
|
+
const { url, name } = obj
|
|
128
|
+
// this.clear()
|
|
129
|
+
// let tileUrl = 'svr/uploadfile/static/model/5108021广元市供排水有限公司上西水厂水源地/ph_geomodel_D13A0913-29F0-4781-AED7-1F8450B0D7E1.json'
|
|
130
|
+
let tileset = new cxe.Tileset(url)
|
|
131
|
+
tileset.attr = { name }
|
|
132
|
+
this.tile.addOverlay(tileset)
|
|
133
|
+
this.viewer.flyTo(tileset)
|
|
134
|
+
// if (!this.pick)
|
|
135
|
+
// this.pickVector()
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 批量添加点要素
|
|
140
|
+
* @param {*} coors 坐标数组
|
|
141
|
+
*/
|
|
142
|
+
addPoint(coors, opts)
|
|
143
|
+
{
|
|
144
|
+
let points = []
|
|
145
|
+
coors.forEach(coor =>
|
|
146
|
+
{
|
|
147
|
+
let { lng, lat, style = {} } = coor
|
|
148
|
+
let point = new cxe.Point({ lng, lat })
|
|
149
|
+
point.setStyle({ pixelSize: 12, color: Cesium.Color.BLUE, outlineColor: Cesium.Color.BLUE, outlineWidth: 2, ...style })
|
|
150
|
+
// 业务属性
|
|
151
|
+
point.att = coor
|
|
152
|
+
if (opts.layerflag)
|
|
153
|
+
point.att.layerflag = opts.layerflag
|
|
154
|
+
points.push(point)
|
|
155
|
+
})
|
|
156
|
+
this.layer.addOverlays(points)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 单个添加点要素 线面等其他要素同样支持单个添加,实际可同步到批量添加里
|
|
161
|
+
* @param {*} obj
|
|
162
|
+
*/
|
|
163
|
+
addPointOne(obj)
|
|
164
|
+
{
|
|
165
|
+
let { lng, lat, style = {} } = obj
|
|
166
|
+
let point = new cxe.Point({ lng, lat })
|
|
167
|
+
point.setStyle({ pixelSize: 10, color: Cesium.Color.RED, outlineColor: Cesium.Color.BLUE, outlineWidth: 1, ...style })
|
|
168
|
+
point.att = { name: 'gkl' }
|
|
169
|
+
this.layer.addOverlay(point)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 批量添加线要素
|
|
174
|
+
* @param {Array} coors 坐标数组
|
|
175
|
+
* @param {String} jwd 坐标串,如: -75, 35; -125, 35
|
|
176
|
+
* @param {Object} style 扩展样式
|
|
177
|
+
* @param {Number} lineWidth 线宽
|
|
178
|
+
* @param {String} lineColor 线色
|
|
179
|
+
* @param {String} lineType 线型, solid:实线;dashed: 虚线
|
|
180
|
+
*/
|
|
181
|
+
addLine(coors, opts)
|
|
182
|
+
{
|
|
183
|
+
let polylines = []
|
|
184
|
+
coors.forEach(item =>
|
|
185
|
+
{
|
|
186
|
+
let { jwd, style = {}, lineWidth = 4, lineColor = 'rgb(0, 0, 255)', lineType = 'solid' } = item
|
|
187
|
+
let polyline = new cxe.Polyline(jwd)
|
|
188
|
+
polyline.setStyle({
|
|
189
|
+
width: lineWidth,
|
|
190
|
+
material: lineType === 'solid'
|
|
191
|
+
? Cesium.Color.fromCssColorString(lineColor)
|
|
192
|
+
: new Cesium.PolylineDashMaterialProperty({
|
|
193
|
+
color: Cesium.Color.fromCssColorString(lineColor)
|
|
194
|
+
}),
|
|
195
|
+
clampToGround: true,
|
|
196
|
+
...style
|
|
197
|
+
})
|
|
198
|
+
polyline.att = item
|
|
199
|
+
if (opts.layerflag)
|
|
200
|
+
polyline.att.layerflag = opts.layerflag
|
|
201
|
+
polylines.push(polyline)
|
|
202
|
+
})
|
|
203
|
+
this.layer.addOverlays(polylines)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 添加面要素
|
|
208
|
+
* @param {*} coors 坐标数组
|
|
209
|
+
*/
|
|
210
|
+
addPol(coors, opts)
|
|
211
|
+
{
|
|
212
|
+
let polygons = []
|
|
213
|
+
coors.forEach(item =>
|
|
214
|
+
{
|
|
215
|
+
let { jwd, style = {}, fillColor = 'rgb(0, 0, 255)', outline = true, outlineWidth = 10, outlineColor = Cesium.Color.BLACK } = item
|
|
216
|
+
let pol = new cxe.Polygon(jwd)
|
|
217
|
+
pol.setStyle({ material: Cesium.Color.fromCssColorString(fillColor), outline, outlineWidth, outlineColor, ...style })
|
|
218
|
+
pol.att = item
|
|
219
|
+
if (pol.layerflag)
|
|
220
|
+
pol.att.layerflag = opts.layerflag
|
|
221
|
+
// this.layer.addOverlay(pol)
|
|
222
|
+
polygons.push(pol)
|
|
223
|
+
})
|
|
224
|
+
this.layer.addOverlays(polygons)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* 空洞
|
|
229
|
+
* @desc cxe 添加空洞有点问题,改用原生
|
|
230
|
+
* @more http://cesium.xin/cesium/cn/Documentation1.72/PolygonGraphics.html#.ConstructorOptions
|
|
231
|
+
*/
|
|
232
|
+
addHole(coors)
|
|
233
|
+
{
|
|
234
|
+
this.layer.clear()
|
|
235
|
+
let { holes, pol } = coors
|
|
236
|
+
holes = holes.map(item => ({ positions: Cesium.Cartesian3.fromDegreesArray(item) }))
|
|
237
|
+
let positions = Cesium.Cartesian3.fromDegreesArray(pol)
|
|
238
|
+
let entity = this.viewer.entities.add({
|
|
239
|
+
polygon: { hierarchy: { positions, holes }, material: Cesium.Color.fromCssColorString('rgb(166, 193, 238, .5)') }
|
|
240
|
+
})
|
|
241
|
+
this.viewer.flyTo(entity)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* 绘制注记
|
|
246
|
+
* @param {*} coors 坐标数组
|
|
247
|
+
*/
|
|
248
|
+
addLabel(coors, opts = { })
|
|
249
|
+
{
|
|
250
|
+
coors.forEach(item =>
|
|
251
|
+
{
|
|
252
|
+
let { lng, lat, label = '', labelSize = '16px', labelcolor = '#fff', pixelOffset = { x: 0, y: -30 } } = item
|
|
253
|
+
let pol = new cxe.Label({ lng, lat }, label)
|
|
254
|
+
pol.setStyle({ fillColor: Cesium.Color.fromCssColorString(labelcolor), font: labelSize, pixelOffset, heightReference: 1 })
|
|
255
|
+
pol.att = item
|
|
256
|
+
if (opts.layerflag)
|
|
257
|
+
pol.att.layerflag = opts.layerflag
|
|
258
|
+
this.layer.addOverlay(pol)
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* 添加广告牌
|
|
264
|
+
* @param {Array} coors 坐标数组
|
|
265
|
+
* @param {String} img 图标地址
|
|
266
|
+
* @param {String} imgColor 图片颜色,默认图片建议白色
|
|
267
|
+
*/
|
|
268
|
+
addBillboard(coors, opts)
|
|
269
|
+
{
|
|
270
|
+
let boards = []
|
|
271
|
+
coors.forEach(item =>
|
|
272
|
+
{
|
|
273
|
+
// 经测试 png 可以修改颜色
|
|
274
|
+
let { lng, lat, alt, img = 'static/img/svg/test.png', size = [36, 36], imgColor = 'rgb(255, 0, 0)', rotation = Cesium.Math.toRadians(90) } = item
|
|
275
|
+
let pol = new cxe.Billboard({ lng, lat, alt }, img)
|
|
276
|
+
pol.size = size
|
|
277
|
+
pol.att = item
|
|
278
|
+
if (item.imgColor)
|
|
279
|
+
pol.setStyle({ color: Cesium.Color.fromCssColorString(imgColor), heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, alignedAxis: Cesium.Cartesian3.UNIT_Z })
|
|
280
|
+
else
|
|
281
|
+
pol.setStyle({ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND })
|
|
282
|
+
if (opts.layerflag)
|
|
283
|
+
pol.att.layerflag = opts.layerflag
|
|
284
|
+
|
|
285
|
+
// 不要旋转广告牌
|
|
286
|
+
if (opts.pictop)
|
|
287
|
+
pol.setStyle({ rotation: Cesium.Math.toRadians(0) })
|
|
288
|
+
|
|
289
|
+
boards.push(pol)
|
|
290
|
+
})
|
|
291
|
+
this.layer.addOverlays(boards)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 广告牌闪烁效果
|
|
296
|
+
* @param {*} overlay 广告牌overlay
|
|
297
|
+
* @returns
|
|
298
|
+
*/
|
|
299
|
+
createOnTick(overlay)
|
|
300
|
+
{
|
|
301
|
+
let alpha = 1.0
|
|
302
|
+
let fading = true
|
|
303
|
+
return function(clock)
|
|
304
|
+
{
|
|
305
|
+
if (fading)
|
|
306
|
+
{
|
|
307
|
+
alpha -= 0.05
|
|
308
|
+
if (alpha <= 0.0)
|
|
309
|
+
{
|
|
310
|
+
alpha = 0.0
|
|
311
|
+
fading = false
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else
|
|
315
|
+
{
|
|
316
|
+
alpha += 0.05
|
|
317
|
+
if (alpha >= 1.0)
|
|
318
|
+
{
|
|
319
|
+
alpha = 1.0
|
|
320
|
+
fading = true
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
overlay.setStyle({ color: new Cesium.Color(1.0, 1.0, 1.0, alpha), heightReference: 1 })
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* 经纬度转度分秒
|
|
329
|
+
* @param {*} decimal 34.56789
|
|
330
|
+
* @returns 34° 34' 4.40"
|
|
331
|
+
*/
|
|
332
|
+
decimalToDMS(decimal)
|
|
333
|
+
{
|
|
334
|
+
const degrees = Math.floor(decimal) // 度
|
|
335
|
+
const minutesFloat = (decimal - degrees) * 60
|
|
336
|
+
const minutes = Math.floor(minutesFloat) // 分
|
|
337
|
+
const seconds = (minutesFloat - minutes) * 60 // 秒
|
|
338
|
+
|
|
339
|
+
return `${degrees}° ${minutes}' ${seconds.toFixed(2)}"`
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
addBlinking(overlay)
|
|
343
|
+
{
|
|
344
|
+
this.clearBlinking()
|
|
345
|
+
let onTick = this.createOnTick(overlay)
|
|
346
|
+
this.viewer.clock.onTick.addEventListener(onTick)
|
|
347
|
+
this.blinkingBillboards.push({
|
|
348
|
+
billboard: overlay,
|
|
349
|
+
onTick: onTick
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
clearBlinking()
|
|
354
|
+
{
|
|
355
|
+
this.blinkingBillboards.forEach(item =>
|
|
356
|
+
{
|
|
357
|
+
this.viewer.clock.onTick.removeEventListener(item.onTick)
|
|
358
|
+
item.billboard.setStyle({ color: new Cesium.Color(1.0, 1.0, 1.0, 1.0), heightReference: 1 })
|
|
359
|
+
})
|
|
360
|
+
this.blinkingBillboards = [] // 清空数组
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* 添加HTML
|
|
365
|
+
* @param {*} coors 坐标数组
|
|
366
|
+
*/
|
|
367
|
+
addHtml(coors)
|
|
368
|
+
{
|
|
369
|
+
let boards = []
|
|
370
|
+
coors.forEach(item =>
|
|
371
|
+
{
|
|
372
|
+
let { lng, lat } = item
|
|
373
|
+
let pol = new cxe.DynamicHtml({ lng, lat }, `<i class="iconfont ic-tuceng" style="font-size: 25px; color: red; background-color: transparent; border: none"></i>`)
|
|
374
|
+
// let pol = new cxe.DynamicHtml({ lng, lat }, `<div style="background:rgba(123,234,122,0.5)">测试</div>`)
|
|
375
|
+
pol.att = item
|
|
376
|
+
boards.push(pol)
|
|
377
|
+
})
|
|
378
|
+
this.layer.addOverlays(boards)
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* 选择要素
|
|
383
|
+
*/
|
|
384
|
+
pickVector()
|
|
385
|
+
{
|
|
386
|
+
this.pick && this.pick.sleep()
|
|
387
|
+
this.pick = new cxe.Select(this.viewer, {
|
|
388
|
+
selected: pick =>
|
|
389
|
+
{
|
|
390
|
+
if (pick.overlay)
|
|
391
|
+
console.log()
|
|
392
|
+
}
|
|
393
|
+
})
|
|
394
|
+
this.pick.start()
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* 获取所有要素
|
|
399
|
+
* @returns array
|
|
400
|
+
*/
|
|
401
|
+
allOverlays()
|
|
402
|
+
{
|
|
403
|
+
// return this.viewer.layers.getLayers()[0].getOverlays()
|
|
404
|
+
return this.layer.getOverlays()
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
allTiles()
|
|
408
|
+
{
|
|
409
|
+
// return this.viewer.layers.getLayers()[0].getOverlays()
|
|
410
|
+
return this.tile.getOverlays()
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* 通过业务id获取要素
|
|
415
|
+
* @param {*} id 业务id
|
|
416
|
+
* @returns 获取的要素
|
|
417
|
+
*/
|
|
418
|
+
getOverlayById(id)
|
|
419
|
+
{
|
|
420
|
+
// return this.viewer.layers.getLayers()[0].getOverlayById(id)
|
|
421
|
+
return this.layer.getOverlayById(id)
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* 通过属性获取要素
|
|
426
|
+
* @param {*} name 属性名
|
|
427
|
+
* @param {*} value 属性值
|
|
428
|
+
* @returns {Array} 获取的要素
|
|
429
|
+
*/
|
|
430
|
+
getOverlayByAtt(name, value)
|
|
431
|
+
{
|
|
432
|
+
return this.layer.getOverlaysByAtt(name, value)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* 删除要素
|
|
437
|
+
* @param {*} overlay 要素
|
|
438
|
+
*/
|
|
439
|
+
removeVector(overlay)
|
|
440
|
+
{
|
|
441
|
+
this.layer.removeOverlay(overlay)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* 遍历要素
|
|
446
|
+
*/
|
|
447
|
+
eachOverlay()
|
|
448
|
+
{
|
|
449
|
+
this.layer.eachOverlay(item =>
|
|
450
|
+
{
|
|
451
|
+
console.log('do something')
|
|
452
|
+
})
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* 清空图层
|
|
457
|
+
*/
|
|
458
|
+
clear()
|
|
459
|
+
{
|
|
460
|
+
if (this.layer)
|
|
461
|
+
this.layer.clear()
|
|
462
|
+
if (this.clusterLayer)
|
|
463
|
+
this.clusterLayer.clear()
|
|
464
|
+
if (this.tile)
|
|
465
|
+
this.tile.clear()
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
clearTiels()
|
|
469
|
+
{
|
|
470
|
+
if (this.tile)
|
|
471
|
+
this.tile.clear()
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* 清空影像图层
|
|
476
|
+
*/
|
|
477
|
+
clearImageLayer()
|
|
478
|
+
{
|
|
479
|
+
this.viewer.imageryLayers.removeAll()
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* 飞向目标图层
|
|
484
|
+
* @param {*} layer 目标图层
|
|
485
|
+
* @param {*} duration 飞行时间 单位:秒
|
|
486
|
+
*/
|
|
487
|
+
flyTo(layer, duration)
|
|
488
|
+
{
|
|
489
|
+
this.zoomTo(layer)
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* 缩放到目标位置
|
|
494
|
+
* @param {*} layer 目标图层
|
|
495
|
+
*/
|
|
496
|
+
zoomTo(layer)
|
|
497
|
+
{
|
|
498
|
+
this.viewer.zoomTo(layer)
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* 缩放到具体位置
|
|
503
|
+
* @param {Object} position 位置信息 (lng:必填,lat:必填,alt:必填,heading:0,pitch:-90,roll:0)
|
|
504
|
+
* @param {Option} completeCallback 缩放完成后的回调
|
|
505
|
+
*/
|
|
506
|
+
zoomToPos(position, completeCallback)
|
|
507
|
+
{
|
|
508
|
+
let { lng, lat, alt } = position
|
|
509
|
+
this.viewer.zoomToPos({ lng, lat, alt }, completeCallback)
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* 缩放到所有要素中心点
|
|
514
|
+
*/
|
|
515
|
+
zoomToAllOverlaysCenter(alt = 1400)
|
|
516
|
+
{
|
|
517
|
+
let [allLon, allLat, positions] = [[], [], []]
|
|
518
|
+
this.allOverlays().forEach(i =>
|
|
519
|
+
{
|
|
520
|
+
if (i.type === 'polyline')
|
|
521
|
+
{
|
|
522
|
+
i.att.jwd.split(';').forEach(j =>
|
|
523
|
+
{
|
|
524
|
+
let [lon, lat] = j.split(',')
|
|
525
|
+
allLon.push(lon * 1)
|
|
526
|
+
allLat.push(lat * 1)
|
|
527
|
+
positions.push({ longitude: lon * 1, latitude: lat * 1 })
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
else if (i.type === 'billboard')
|
|
532
|
+
{
|
|
533
|
+
let { lng, lat } = i.att
|
|
534
|
+
allLon.push(lng * 1)
|
|
535
|
+
allLat.push(lat * 1)
|
|
536
|
+
positions.push({ longitude: lng * 1, latitude: lat * 1 })
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
let maxlon = Math.max.apply(null, allLon.filter(i => i))
|
|
541
|
+
let minlon = Math.min.apply(null, allLon.filter(i => i))
|
|
542
|
+
let maxlat = Math.max.apply(null, allLat.filter(i => i))
|
|
543
|
+
let minlat = Math.min.apply(null, allLat.filter(i => i))
|
|
544
|
+
let centerX = (maxlon + minlon) / 2
|
|
545
|
+
let centerY = (maxlat + minlat) / 2
|
|
546
|
+
this.zoomToPos({ lng: centerX, lat: centerY, alt: this.getSuitableHeight(positions) })
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
getSuitableHeight(positions)
|
|
550
|
+
{
|
|
551
|
+
let arr = positions.filter(i => i.longitude && i.latitude)
|
|
552
|
+
return this.setCameraForPositions(this.viewer, arr)
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
setCameraForPositions(viewer, positions)
|
|
556
|
+
{
|
|
557
|
+
// 将经纬度数组转换为 Cesium.Cartesian3 坐标数组
|
|
558
|
+
const cartesianPositions = positions.map(function(position)
|
|
559
|
+
{
|
|
560
|
+
return Cesium.Cartesian3.fromDegrees(position.longitude, position.latitude)
|
|
561
|
+
})
|
|
562
|
+
|
|
563
|
+
// 计算经纬度外包矩形
|
|
564
|
+
const rectangle = Cesium.Rectangle.fromCartesianArray(cartesianPositions)
|
|
565
|
+
|
|
566
|
+
// 计算包围盒的对角线长度(在笛卡尔坐标系中)
|
|
567
|
+
const northWest = Cesium.Cartesian3.fromRadians(rectangle.west, rectangle.north)
|
|
568
|
+
const southEast = Cesium.Cartesian3.fromRadians(rectangle.east, rectangle.south)
|
|
569
|
+
const diagonal = Cesium.Cartesian3.distance(northWest, southEast)
|
|
570
|
+
|
|
571
|
+
// 设置一个高度因子,确保相机可以看到所有点
|
|
572
|
+
const heightFactor = 3 // 根据需求调整
|
|
573
|
+
const cameraHeight = diagonal * heightFactor
|
|
574
|
+
return cameraHeight
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* 飞到具体位置
|
|
579
|
+
* @param {Object} position 位置信息 (lng:必填,lat:必填,alt:必填,heading:0,pitch:-90,roll:0)
|
|
580
|
+
* @param {Option} completeCallback 飞完之后触发的回调
|
|
581
|
+
* @param {Option} duration 飞行时间 单位:秒
|
|
582
|
+
*/
|
|
583
|
+
flyToPos(position, completeCallback, duration)
|
|
584
|
+
{
|
|
585
|
+
let { lng, lat, alt } = position
|
|
586
|
+
this.viewer.flyToPos({ lng, lat, alt }, completeCallback, duration)
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* 设置相机高度
|
|
592
|
+
*/
|
|
593
|
+
setCameraHeight(height)
|
|
594
|
+
{
|
|
595
|
+
let eye = this.viewer.camera.positionCartographic
|
|
596
|
+
this.viewer.camera.setView({ destination: Cesium.Cartesian3.fromRadians(eye.longitude, eye.latitude, height ?? eye.height) })
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* 获取相机当前高度
|
|
601
|
+
*/
|
|
602
|
+
getCurrentHeight()
|
|
603
|
+
{
|
|
604
|
+
return this.viewer.camera.positionCartographic.height
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* 弧度转经纬度
|
|
609
|
+
*/
|
|
610
|
+
radToLonLat()
|
|
611
|
+
{
|
|
612
|
+
let eye = this.viewer.camera.positionCartographic
|
|
613
|
+
let lng = Cesium.Math.toDegrees(eye.longitude)
|
|
614
|
+
let lat = Cesium.Math.toDegrees(eye.latitude)
|
|
615
|
+
let height = eye.height
|
|
616
|
+
return { lng, lat, height }
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* 屏幕坐标转经纬度
|
|
621
|
+
*/
|
|
622
|
+
cartesian2ToLonLat(Cartesian2)
|
|
623
|
+
{
|
|
624
|
+
// 屏幕坐标转为世界坐标
|
|
625
|
+
let cartesian = this.viewer.scene.globe.pick(this.viewer.camera.getPickRay(Cartesian2), this.viewer.scene)
|
|
626
|
+
// 世界坐标转换为弧度
|
|
627
|
+
let ellipsoid = this.viewer.scene.globe.ellipsoid
|
|
628
|
+
let cartographic = ellipsoid.cartesianToCartographic(cartesian)
|
|
629
|
+
// 弧度转换为经纬度
|
|
630
|
+
let lon = Cesium.Math.toDegrees(cartographic.longitude)
|
|
631
|
+
let lat = Cesium.Math.toDegrees(cartographic.latitude)
|
|
632
|
+
return { lon, lat }
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* 垂直视角
|
|
637
|
+
*/
|
|
638
|
+
verticalView()
|
|
639
|
+
{
|
|
640
|
+
let { lon, lat } = this.screenCenterLonLat()
|
|
641
|
+
this.viewer.flyToPos({ lng: lon, lat: lat, alt: this.getCurrentHeight() }, () =>
|
|
642
|
+
{}, 0)
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* 判断当前视角是否为垂直视角
|
|
647
|
+
* @returns true false
|
|
648
|
+
*/
|
|
649
|
+
isVerticalView()
|
|
650
|
+
{
|
|
651
|
+
// 获取相机的pitch角度
|
|
652
|
+
let pitch = Cesium.Math.toDegrees(this.viewer.camera.pitch)
|
|
653
|
+
|
|
654
|
+
// 检查pitch是否接近-90度
|
|
655
|
+
return Math.abs(pitch + 90) < 1 // 允许一些误差
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* 屏幕中心点坐标
|
|
660
|
+
* @returns { lon, lat }
|
|
661
|
+
*/
|
|
662
|
+
screenCenterLonLat()
|
|
663
|
+
{
|
|
664
|
+
let centerResult = this.viewer.camera.pickEllipsoid(
|
|
665
|
+
new Cesium.Cartesian2(
|
|
666
|
+
this.viewer.canvas.clientWidth / 2,
|
|
667
|
+
this.viewer.canvas.clientHeight / 2
|
|
668
|
+
)
|
|
669
|
+
)
|
|
670
|
+
// 24-11-01 zgh 如果取不到中心位置,则用相机位置
|
|
671
|
+
if (!centerResult)
|
|
672
|
+
centerResult = this.viewer.camera.position
|
|
673
|
+
let curPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(centerResult)
|
|
674
|
+
let lon = (curPosition.longitude * 180) / Math.PI
|
|
675
|
+
let lat = (curPosition.latitude * 180) / Math.PI
|
|
676
|
+
return { lon, lat }
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* 加载在线地形
|
|
681
|
+
*/
|
|
682
|
+
loadTerrian()
|
|
683
|
+
{
|
|
684
|
+
let terrainLayer = new cxe.TerrainLayer('t_xyz', {
|
|
685
|
+
url: 'hbsdxqp'
|
|
686
|
+
})
|
|
687
|
+
this.viewer.layers.addTerrain(terrainLayer)
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* 清除地形
|
|
692
|
+
*/
|
|
693
|
+
clearTreeian()
|
|
694
|
+
{
|
|
695
|
+
let terrainLayer = new cxe.TerrainLayer('t_none', {})
|
|
696
|
+
this.viewer.layers.addTerrain(terrainLayer)
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* 计算点、线、面的中心点经纬度
|
|
701
|
+
* @param {GeoJSON.Feature} feature - 点、线或面的 GeoJSON 要素
|
|
702
|
+
* @returns {Array<number>} - 中心点的经纬度数组,格式为 [经度, 纬度]
|
|
703
|
+
*/
|
|
704
|
+
getCentroidCoordinates(feature)
|
|
705
|
+
{
|
|
706
|
+
let centroidFeature
|
|
707
|
+
if (feature.type === 'Point')
|
|
708
|
+
centroidFeature = feature
|
|
709
|
+
else
|
|
710
|
+
centroidFeature = turf.centroid(feature)
|
|
711
|
+
return centroidFeature.geometry.coordinates
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* cxe 绘制 线、面 需要的坐标格式
|
|
716
|
+
* @param {Array} coor 坐标数组 [[112, 33], [112, 34], [113, 33]]
|
|
717
|
+
* @returns '112, 33; 112, 34; 113, 33'
|
|
718
|
+
*/
|
|
719
|
+
getCxeCoor(coor)
|
|
720
|
+
{
|
|
721
|
+
let jwd = ''
|
|
722
|
+
coor.forEach(i =>
|
|
723
|
+
{
|
|
724
|
+
jwd += i.join(',') + ';'
|
|
725
|
+
})
|
|
726
|
+
return jwd
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export default CesiumTool
|