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.
Files changed (249) hide show
  1. package/README.md +3 -0
  2. package/package.json +90 -0
  3. package/src/plugins/app/com/CesiumTool.js +730 -0
  4. package/src/plugins/app/com/MapMethods.js +355 -0
  5. package/src/plugins/app/com/MapTool.vue +772 -0
  6. package/src/plugins/app/com/MenuRouter.vue +157 -0
  7. package/src/plugins/app/com/ParamsDes.vue +35 -0
  8. package/src/plugins/app/com/SelCoorSys.vue +235 -0
  9. package/src/plugins/app/com/WebProj4.js +32 -0
  10. package/src/plugins/app/com/measure.js +127 -0
  11. package/src/plugins/app/com/yx.js +238 -0
  12. package/src/plugins/app/modelmanagement/D3DrawGraph.js +708 -0
  13. package/src/plugins/app/modelmanagement/MineralGo.vue +241 -0
  14. package/src/plugins/app/modelmanagement/MineralModel.vue +1203 -0
  15. package/src/plugins/app/modelmanagement/ModelCloudmap.vue +69 -0
  16. package/src/plugins/app/modelmanagement/ModelMst.vue +60 -0
  17. package/src/plugins/app/modelmanagement/ModelSy.vue +173 -0
  18. package/src/plugins/app/modelmanagement/ModelTp.vue +51 -0
  19. package/src/plugins/app/modelmanagement/ModelUpload.vue +774 -0
  20. package/src/plugins/app/znycpjxt/Api.js +714 -0
  21. package/src/plugins/app/znycpjxt/Bf/AttFactory.js +25 -0
  22. package/src/plugins/app/znycpjxt/Bf/IAnomalyhandle.js +102 -0
  23. package/src/plugins/app/znycpjxt/Bf/IComposeanomaly.js +140 -0
  24. package/src/plugins/app/znycpjxt/Bf/IContinueanaly.js +138 -0
  25. package/src/plugins/app/znycpjxt/Bf/IContrastanaly.js +138 -0
  26. package/src/plugins/app/znycpjxt/Bf/ICustomNode.js +145 -0
  27. package/src/plugins/app/znycpjxt/Bf/IDerivanaly.js +139 -0
  28. package/src/plugins/app/znycpjxt/Bf/IFilterananly.js +141 -0
  29. package/src/plugins/app/znycpjxt/Bf/IMeananaly.js +137 -0
  30. package/src/plugins/app/znycpjxt/Bf/IModelNodeBase.js +135 -0
  31. package/src/plugins/app/znycpjxt/Bf/IMoveaverage.js +135 -0
  32. package/src/plugins/app/znycpjxt/Bf/IReducepole.js +141 -0
  33. package/src/plugins/app/znycpjxt/Bf/ISmoothanaly.js +135 -0
  34. package/src/plugins/app/znycpjxt/Bf/ITrendanaly.js +144 -0
  35. package/src/plugins/app/znycpjxt/Bf/IVector2grd.js +144 -0
  36. package/src/plugins/app/znycpjxt/Bf/IYcfj.js +84 -0
  37. package/src/plugins/app/znycpjxt/Bf/IYcxxjs.js +105 -0
  38. package/src/plugins/app/znycpjxt/Bf/IYgsbtq.js +112 -0
  39. package/src/plugins/app/znycpjxt/Bf/IYgtxrh.js +112 -0
  40. package/src/plugins/app/znycpjxt/Bf/Iinteranaly.js +135 -0
  41. package/src/plugins/app/znycpjxt/Bf/index.js +44 -0
  42. package/src/plugins/app/znycpjxt/Bf/input/InputData.js +21 -0
  43. package/src/plugins/app/znycpjxt/Bf/input/InputExcel.js +28 -0
  44. package/src/plugins/app/znycpjxt/Bf/input/InputKd.js +31 -0
  45. package/src/plugins/app/znycpjxt/Bqqd/Bqqd.vue +380 -0
  46. package/src/plugins/app/znycpjxt/Bqqd/BqqdMap.vue +1046 -0
  47. package/src/plugins/app/znycpjxt/Bqqd/SetOpacity.vue +101 -0
  48. package/src/plugins/app/znycpjxt/Bqqd/SjzxTree.vue +244 -0
  49. package/src/plugins/app/znycpjxt/Bqqd/YclsjjTree.vue +212 -0
  50. package/src/plugins/app/znycpjxt/Bqqd/api/DsjzxApi.js +37 -0
  51. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmx.vue +161 -0
  52. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgGloalParams.vue +92 -0
  53. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgNodeFlds.vue +102 -0
  54. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/CfgNodeParams.vue +277 -0
  55. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/Ckycmxgl.vue +303 -0
  56. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/SetLabelParam.vue +68 -0
  57. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxgl/SetModelParam.vue +69 -0
  58. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Ckycmxtab.vue +107 -0
  59. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Dtzzylwl.vue +156 -0
  60. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Jjsjwl.vue +230 -0
  61. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Sjsl.vue +126 -0
  62. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zcxlj.vue +128 -0
  63. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zjq.vue +123 -0
  64. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zstp.vue +271 -0
  65. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/Zzylwl.vue +149 -0
  66. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/ParamsData.vue +323 -0
  67. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/ParamsDataNew.vue +336 -0
  68. package/src/plugins/app/znycpjxt/Ckycmx/Ckycmxtab/coms/QqtEcharts.vue +137 -0
  69. package/src/plugins/app/znycpjxt/Ckycmx/Ckycrwgl/Ckycrwgl.vue +290 -0
  70. package/src/plugins/app/znycpjxt/CusTools/CodeApi.js +83 -0
  71. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/CodeEditor.md +36 -0
  72. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/CodeEditor.vue +227 -0
  73. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/PlugCodeEditor.vue +78 -0
  74. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/demo/basic.png +0 -0
  75. package/src/plugins/app/znycpjxt/CusTools/CodeEditor/demo/basic.vue +27 -0
  76. package/src/plugins/app/znycpjxt/CusTools/DmbjForm.vue +76 -0
  77. package/src/plugins/app/znycpjxt/CusTools/DmfbForm.vue +351 -0
  78. package/src/plugins/app/znycpjxt/CusTools/GjForm.vue +206 -0
  79. package/src/plugins/app/znycpjxt/CusTools/Gjbjyfb.vue +200 -0
  80. package/src/plugins/app/znycpjxt/CusTools/ParamSelect.vue +222 -0
  81. package/src/plugins/app/znycpjxt/CusTools/ParamSelect2.vue +204 -0
  82. package/src/plugins/app/znycpjxt/CusTools/Zngjj.vue +105 -0
  83. package/src/plugins/app/znycpjxt/DataAnlyModel/DataAnlyModel.vue +134 -0
  84. package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx/HgfxEcharts.vue +98 -0
  85. package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx/HgfxTab.vue +73 -0
  86. package/src/plugins/app/znycpjxt/DataAnlyModel/Hgfx.vue +101 -0
  87. package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj/JctjjgTab.vue +70 -0
  88. package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj/Plzft.vue +154 -0
  89. package/src/plugins/app/znycpjxt/DataAnlyModel/Jctj.vue +118 -0
  90. package/src/plugins/app/znycpjxt/DataAnlyModel/Jlfx/JlfxImg.vue +80 -0
  91. package/src/plugins/app/znycpjxt/DataAnlyModel/Jlfx.vue +91 -0
  92. package/src/plugins/app/znycpjxt/DataAnlyModel/PCAfx/PcaTab.vue +161 -0
  93. package/src/plugins/app/znycpjxt/DataAnlyModel/PCAfx.vue +101 -0
  94. package/src/plugins/app/znycpjxt/DataAnlyModel/Qqt/QqtEcharts.vue +202 -0
  95. package/src/plugins/app/znycpjxt/DataAnlyModel/Qqt.vue +88 -0
  96. package/src/plugins/app/znycpjxt/DataAnlyModel/Xgxfx/XgxfxImg.vue +80 -0
  97. package/src/plugins/app/znycpjxt/DataAnlyModel/Xgxfx.vue +96 -0
  98. package/src/plugins/app/znycpjxt/DatasetMan/CreateDataset.vue +296 -0
  99. package/src/plugins/app/znycpjxt/DatasetMan/DatasetMan.vue +141 -0
  100. package/src/plugins/app/znycpjxt/DatasetMan/PreData.js +91 -0
  101. package/src/plugins/app/znycpjxt/DatasetMan/PreData.vue +545 -0
  102. package/src/plugins/app/znycpjxt/DatasetMan/PreDataApi.js +101 -0
  103. package/src/plugins/app/znycpjxt/DatasetMan/SelData.vue +186 -0
  104. package/src/plugins/app/znycpjxt/DatasetMan/SjTree.vue +130 -0
  105. package/src/plugins/app/znycpjxt/DatasetMan/Sjj.vue +478 -0
  106. package/src/plugins/app/znycpjxt/DatasetMan/Yclsjj.vue +445 -0
  107. package/src/plugins/app/znycpjxt/DatasetMan/Yssjj.vue +389 -0
  108. package/src/plugins/app/znycpjxt/DocList/DocList.vue +496 -0
  109. package/src/plugins/app/znycpjxt/DocList/unit/DocItem.vue +137 -0
  110. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Dchj.vue +107 -0
  111. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/GeophysicalAnomaly.vue +115 -0
  112. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Jxyt.vue +98 -0
  113. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Lbjs.vue +127 -0
  114. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Pjcjs.vue +103 -0
  115. package/src/plugins/app/znycpjxt/ExceptHandlModel/AnomalyExtraction/Qdjs.vue +103 -0
  116. package/src/plugins/app/znycpjxt/ExceptHandlModel/ExceptHandlModel.vue +163 -0
  117. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Cdjs.vue +102 -0
  118. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Czfx.vue +163 -0
  119. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/GetFormData.vue +343 -0
  120. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Hdpj.vue +100 -0
  121. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Pjtd.vue +90 -0
  122. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Qsfx.vue +109 -0
  123. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/ResultOnlyData.vue +121 -0
  124. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/ResultTable.vue +231 -0
  125. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/UniversalComputing.vue +139 -0
  126. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Xgxsjs.vue +93 -0
  127. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Xxsjs.vue +90 -0
  128. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Ycfj.vue +116 -0
  129. package/src/plugins/app/znycpjxt/ExceptHandlModel/GeneralCalculation/Yhcl.vue +100 -0
  130. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/AnomalsGard.vue +91 -0
  131. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Dqhxycht.vue +113 -0
  132. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/GeocAnomalies.vue +99 -0
  133. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/JgTableList.vue +203 -0
  134. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Lszcl.vue +110 -0
  135. package/src/plugins/app/znycpjxt/ExceptHandlModel/extgeoanomalies/Ycxxjs.vue +116 -0
  136. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/GeoAnomalyExtraction.vue +108 -0
  137. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/AttWeight.vue +99 -0
  138. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/Ckdctq.vue +98 -0
  139. package/src/plugins/app/znycpjxt/ExceptHandlModel/geoAnomalyExtraction/coms/LeftForm.vue +266 -0
  140. package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/Ygsbtq.vue +150 -0
  141. package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/Ygtxrh.vue +107 -0
  142. package/src/plugins/app/znycpjxt/ExceptHandlModel/ygyctq/ygyctq.vue +98 -0
  143. package/src/plugins/app/znycpjxt/Index/DataCard.vue +45 -0
  144. package/src/plugins/app/znycpjxt/Index/Index.vue +123 -0
  145. package/src/plugins/app/znycpjxt/Rzgl/Rzgl.vue +156 -0
  146. package/src/plugins/app/znycpjxt/coms/CmapColor.vue +70 -0
  147. package/src/plugins/app/znycpjxt/coms/CustomFileView.vue +343 -0
  148. package/src/plugins/app/znycpjxt/coms/CustomForm.vue +220 -0
  149. package/src/plugins/app/znycpjxt/coms/GrdView.vue +355 -0
  150. package/src/plugins/app/znycpjxt/coms/LeftForm.vue +195 -0
  151. package/src/plugins/app/znycpjxt/coms/MakeData.js +472 -0
  152. package/src/plugins/app/znycpjxt/coms/PreView.js +55 -0
  153. package/src/plugins/app/znycpjxt/coms/RightContent.vue +71 -0
  154. package/src/plugins/app/znycpjxt/coms/TableEarth.vue +259 -0
  155. package/src/plugins/app/znycpjxt/intellPred/ModelList.vue +200 -0
  156. package/src/plugins/app/znycpjxt/intellPred/coms/D3DrawGraph.js +634 -0
  157. package/src/plugins/app/znycpjxt/intellPred/coms/MineralGo.vue +249 -0
  158. package/src/plugins/app/znycpjxt/intellPred/coms/ModelCard.vue +298 -0
  159. package/src/plugins/app/znycpjxt/intellPred/coms/ModelEdit.vue +292 -0
  160. package/src/plugins/app/znycpjxt/intellPred/coms/ModelSpecif.vue +46 -0
  161. package/src/plugins/app/znycpjxt/intellPred/intellPred.vue +71 -0
  162. package/src/plugins/bf/BfApi.js +92 -0
  163. package/src/plugins/bf/BfColAdd.vue +78 -0
  164. package/src/plugins/bf/BfColEdit.vue +68 -0
  165. package/src/plugins/bf/BfColFilter.vue +112 -0
  166. package/src/plugins/bf/BfDataGroup.vue +80 -0
  167. package/src/plugins/bf/BfDataPreview.vue +118 -0
  168. package/src/plugins/bf/BfDataStat.vue +81 -0
  169. package/src/plugins/bf/BfDuplicateDel.vue +82 -0
  170. package/src/plugins/bf/BfProcCall.vue +82 -0
  171. package/src/plugins/bf/BfRunHis.vue +289 -0
  172. package/src/plugins/bf/BfRunParams.vue +94 -0
  173. package/src/plugins/bf/BfSaveFlow.vue +186 -0
  174. package/src/plugins/bf/BfSelFlow.vue +123 -0
  175. package/src/plugins/bf/BfTabCombine.vue +127 -0
  176. package/src/plugins/bf/BfTabJoin.vue +108 -0
  177. package/src/plugins/bf/BfTabMerge.vue +68 -0
  178. package/src/plugins/bf/BfTabReader.vue +126 -0
  179. package/src/plugins/bf/BfValFormat.vue +68 -0
  180. package/src/plugins/bf/BfValNumber.vue +68 -0
  181. package/src/plugins/bf/BfValProc.vue +78 -0
  182. package/src/plugins/bf/BfValSort.vue +78 -0
  183. package/src/plugins/bf/BiFlow.vue +1177 -0
  184. package/src/plugins/bf/IBfPlug.js +205 -0
  185. package/src/plugins/bf/coms/ColAdd.vue +75 -0
  186. package/src/plugins/bf/coms/ColEdit.vue +52 -0
  187. package/src/plugins/bf/coms/ColList.vue +91 -0
  188. package/src/plugins/bf/coms/DataGroup.vue +90 -0
  189. package/src/plugins/bf/coms/DataStat.vue +67 -0
  190. package/src/plugins/bf/coms/EditTable.vue +161 -0
  191. package/src/plugins/bf/coms/NodeTree.vue +105 -0
  192. package/src/plugins/bf/coms/PlugCmd.vue +95 -0
  193. package/src/plugins/bf/coms/RunParams.vue +68 -0
  194. package/src/plugins/bf/coms/TabCombine.vue +60 -0
  195. package/src/plugins/bf/coms/TabJoin.vue +69 -0
  196. package/src/plugins/bf/coms/ValFormat.vue +53 -0
  197. package/src/plugins/bf/coms/ValProc.vue +77 -0
  198. package/src/plugins/bf/coms/ValSort.vue +89 -0
  199. package/src/plugins/bf/parts/Icon.vue +105 -0
  200. package/src/plugins/bf/parts/Rect.vue +98 -0
  201. package/src/plugins/bf/parts/index.js +11 -0
  202. package/src/plugins/cxMixin/IAttBase.js +78 -0
  203. package/src/plugins/cxMixin/IAttDlg.js +45 -0
  204. package/src/plugins/cxMixin/IAttProc.js +98 -0
  205. package/src/plugins/cxMixin/IComBase.js +42 -0
  206. package/src/plugins/cxMixin/IContextMenu.js +74 -0
  207. package/src/plugins/cxMixin/IDataAcce.js +1106 -0
  208. package/src/plugins/cxMixin/IDataList.js +775 -0
  209. package/src/plugins/cxMixin/IDataMan.js +1670 -0
  210. package/src/plugins/cxMixin/IDataMan2.js +2561 -0
  211. package/src/plugins/cxMixin/IDataProc.js +379 -0
  212. package/src/plugins/cxMixin/IDatagrid.js +234 -0
  213. package/src/plugins/cxMixin/IEditableDg.js +477 -0
  214. package/src/plugins/cxMixin/IExpBase.js +51 -0
  215. package/src/plugins/cxMixin/IFormBase.js +29 -0
  216. package/src/plugins/cxMixin/IGridBpm.js +732 -0
  217. package/src/plugins/cxMixin/IGridData.js +109 -0
  218. package/src/plugins/cxMixin/IOperMore.js +323 -0
  219. package/src/plugins/cxMixin/IPlugBase.js +341 -0
  220. package/src/plugins/cxMixin/ISendCode.js +86 -0
  221. package/src/plugins/cxMixin/ISinglePage.js +112 -0
  222. package/src/plugins/cxMixin/ITags.js +81 -0
  223. package/src/plugins/cxe/CxeMap.vue +61 -0
  224. package/src/plugins/home/HeadNav.vue +194 -0
  225. package/src/plugins/home/Home.vue +59 -0
  226. package/src/plugins/home/HomePage.vue +237 -0
  227. package/src/plugins/home/Login.vue +139 -0
  228. package/src/plugins/zbcxCesium/coms/GraDrawBarWgt.vue +176 -0
  229. package/src/plugins/zbcxCesium/coms/baseMapSwitch/BaseMap.scss +42 -0
  230. package/src/plugins/zbcxCesium/coms/baseMapSwitch/BaseMap.vue +59 -0
  231. package/src/plugins/zbcxCesium/coms/dataPreview/DataPreview.vue +526 -0
  232. package/src/plugins/zbcxCesium/coms/dataPreview/DataPreviewPlug.vue +79 -0
  233. package/src/plugins/zbcxCesium/coms/dataPreview/ReadShpFile.js +42 -0
  234. package/src/plugins/zbcxCesium/coms/legend/Legend.vue +78 -0
  235. package/src/plugins/zbcxCesium/coms/popup/dialog-left-bg.png +0 -0
  236. package/src/plugins/zbcxCesium/coms/popup/index.js +88 -0
  237. package/src/plugins/zbcxCesium/coms/popup/index.vue +93 -0
  238. package/src/plugins/zbcxCesium/pub/LoadGeojson.js +44 -0
  239. package/src/plugins/zbcxCesium/pub/LoadModel.js +128 -0
  240. package/src/plugins/zbcxCesium/pub/LoadOgc.js +226 -0
  241. package/src/plugins/zbcxCesium/pub/Opacity.vue +139 -0
  242. package/src/plugins/zbcxCesium/pub/PubCxe.js +97 -0
  243. package/src/plugins/zbcxCesium/pub/SceneSet.vue +178 -0
  244. package/src/plugins/zbcxCesium/pub/ShowEffect.vue +216 -0
  245. package/src/plugins/zbcxCesium/pub/TMeasure.vue +122 -0
  246. package/src/plugins/zbcxCesium/pub/ToDefView3.vue +109 -0
  247. package/src/plugins/zbcxCesium/pub/getWmsGetCapabilities.js +127 -0
  248. package/src/plugins/zbcxCesium/utils/ShpToGeoJson.js +24 -0
  249. package/src/plugins/zbcxCesium/utils/WebProj4.js +32 -0
@@ -0,0 +1,634 @@
1
+ import * as d3 from "d3";
2
+
3
+ /**
4
+ * 类名:DrawGraph
5
+ * 描述:D3绘导向图组织类
6
+ * 作者:王卫
7
+ * 时间:20230601
8
+ */
9
+ class DrawGraph {
10
+
11
+ /**
12
+ * 构造函数
13
+ * @param {视图} chart
14
+ */
15
+ constructor(chart) {
16
+
17
+ this.g = null;
18
+ this.svg = d3.select(chart)
19
+ .append("svg")
20
+ .attr("width", "100%")
21
+ .attr("height", "100%")
22
+ .attr("preserveAspectRatio", "xMidYMid meet") //控制缩放形式
23
+ .on("click", this.clickCancel.bind(this))
24
+ .on("mousedown", (event) => {
25
+ if (event.button === 1) {
26
+ this.resetCentor();
27
+ }
28
+ });
29
+
30
+ this.zoom = d3.zoom();
31
+ this.simulation = null;
32
+ this.table = null;
33
+ this.id = '';
34
+ this.color = d3.scaleOrdinal().range(d3.schemeCategory10);
35
+ this.strength = 2000;
36
+ }
37
+
38
+ /**
39
+ * 清空视图
40
+ */
41
+ clearChart() {
42
+
43
+ //重置缩放事件
44
+ this.zoom.scaleTo(this.svg, 1);
45
+ this.zoom.translateTo(this.svg, 0, 0);
46
+ this.svg.call(this.zoom.transform, d3.zoomTransform(this.svg).scale(1));
47
+
48
+ //移除所有内容
49
+ this.svg.selectAll("*").remove();
50
+ this.g = null;
51
+ this.id = '';
52
+ this.table = null;
53
+ }
54
+
55
+ /**
56
+ * 获得当前激活节点
57
+ * @returns 返回节点id
58
+ */
59
+ getCurNode() {
60
+ return this.id;
61
+ }
62
+
63
+ /**
64
+ * 设置斥力
65
+ * @param {} strength 斥力参数
66
+ */
67
+ setStrength(strength) {
68
+ this.strength = strength;
69
+ }
70
+
71
+ getLinkData(){
72
+ const links = this.g.selectAll("line").data();
73
+ const data = [];
74
+
75
+ for (const link of links) {
76
+ data.push(link.source.id);
77
+ data.push(link.target.id);
78
+ }
79
+
80
+ return data;
81
+ }
82
+
83
+ getAllNode(){
84
+ const nodes = this.g.selectAll('.node');
85
+ const data = [];
86
+ for (const node of nodes){
87
+ data.push(node.id);
88
+ }
89
+ return data;
90
+ }
91
+
92
+ /**
93
+ * 绘图接口
94
+ * @param {} nodes 顶点集合
95
+ * @param {} links 顶点关系集合
96
+ */
97
+ drawChart(nodes, links) {
98
+
99
+ if (!this.g) {
100
+ this.g = this.svg.append("g");
101
+ }
102
+
103
+ const color = this.color;
104
+ this.simulation = d3
105
+ .forceSimulation(nodes)
106
+ .force(
107
+ "link",
108
+ d3.forceLink(links).id((d) => d.id)
109
+ )
110
+ .force("charge", d3.forceManyBody().strength(-this.strength))
111
+ .force("center", d3.forceCenter());
112
+ const simulation = this.simulation;
113
+
114
+ //绘制svg
115
+ this.setSvg();
116
+
117
+ //绘制连接线标签
118
+ const linkLabel = this.drawLinkLabel(links);
119
+
120
+ //绘制连接线
121
+ const link = this.drawLink(links);
122
+
123
+ //绘制表格
124
+ this.table = this.drawTable();
125
+
126
+ //绘制节点
127
+ const node = this.drawNode(simulation, color, nodes);
128
+
129
+ //位置计算
130
+ simulation.on("tick", () => { this.drawSimulation(node, link, linkLabel) });
131
+
132
+ //绘制图例
133
+ const nodeLabels = Array.from(new Set(nodes.map((node) => node.label)));
134
+ this.drawLegend(color, nodeLabels);
135
+
136
+ //设置缩放
137
+ this.setZoom();
138
+
139
+ }
140
+
141
+ /**
142
+ * 新增顶点
143
+ * @param {} nodes 顶点集合
144
+ * @param {} links 顶点关系集合
145
+ * @returns 是否添加成功
146
+ */
147
+ addChart(nodes, links) {
148
+
149
+ const color = this.color;
150
+ const simulation = this.simulation;
151
+
152
+ //计算未加载的连接线
153
+ const haslinks = this.g.selectAll("line").data();
154
+ const haslinkdata = haslinks.map(d => ({ source: d.source, target: d.target }));
155
+
156
+ let filterlink = links.filter(d => {
157
+ const exists = haslinkdata.find(hd => {
158
+ return hd.source.id != d.source || hd.target.id != d.target;
159
+ });
160
+ return exists;
161
+ });
162
+
163
+ if (haslinks.length === 0) {
164
+ filterlink = links;
165
+ }
166
+
167
+ //计算未加载的顶点
168
+ const hasNodes = this.g.selectAll('.node').nodes();
169
+ const hasnodedata = hasNodes.map(node => node.id);
170
+ const filternodes = [];
171
+ for (const curnode of nodes) {
172
+ if (!hasnodedata.includes(curnode.id)) {
173
+ filternodes.push(curnode);
174
+ }
175
+ }
176
+
177
+ if (filternodes.length === 0) {
178
+ return false;
179
+ }
180
+
181
+ //绘制标签
182
+ this.drawLinkLabel(filterlink);
183
+
184
+ //绘制连接线
185
+ this.drawLink(filterlink);
186
+
187
+ //绘制顶点
188
+ this.drawNode(simulation, color, filternodes);
189
+
190
+ // 将所有节点重新添加到力学模拟中
191
+ const allnode = this.g.selectAll(".node");
192
+ const alllinkLabel = this.g.selectAll(".link-label");
193
+ const alllink = this.g.selectAll("line");
194
+ const nodedata = allnode.data();
195
+ const linkdata = alllink.data();
196
+
197
+ //并重新绑定tick事件
198
+ simulation.nodes(nodedata)
199
+ .force("link", d3.forceLink(linkdata).id(d => d.id))
200
+ .on("tick", () => { this.drawSimulation(allnode, alllink, alllinkLabel) })
201
+ .alpha(1)
202
+ .restart();
203
+
204
+ //绘制图例
205
+ const nodeLabels = Array.from(new Set(nodedata.map((node) => node.label)));
206
+ this.drawLegend(color, nodeLabels);
207
+
208
+ return true;
209
+ }
210
+
211
+ /**
212
+ * 定位顶点
213
+ * @param {} name 顶点名称
214
+ * @returns
215
+ */
216
+ locateNode(name) {
217
+ if (!this.g)
218
+ return false;
219
+
220
+ const nodes = this.g.selectAll(".node").nodes();
221
+ const targetNode = nodes.find(node => node.id === name);
222
+
223
+ if (targetNode) {
224
+ const data = targetNode.__data__;
225
+ const x = - data.x;
226
+ const y = - data.y;
227
+ const id = targetNode.id;
228
+ this.zoom.transform(this.svg, d3.zoomIdentity.translate(x, y));
229
+
230
+ const allnode = this.g.selectAll(".node");
231
+ allnode.classed("highlighted", d => d.id === id)
232
+ .select("circle")
233
+ .style("stroke-width", d => (d.id === id ? '8px' : '0px'));
234
+
235
+ return true;
236
+ }
237
+ else {
238
+ return false;
239
+ }
240
+ }
241
+
242
+ resetCentor() {
243
+ this.zoom.transform(this.svg, d3.zoomIdentity.translate(0, 0));
244
+ }
245
+
246
+ setZoom() {
247
+ const svg = this.svg;
248
+ const g = this.g;
249
+
250
+ // 1. 获取 SVG 图形的宽度和高度
251
+ const svgWidth = svg.node().getBoundingClientRect().width;
252
+ const svgHeight = svg.node().getBoundingClientRect().height;
253
+
254
+ // 2.设置缩放范围和初始缩放比例
255
+ this.zoom.scaleExtent([0.1, 10]).on("zoom", zoomed);
256
+ svg.call(this.zoom);
257
+ this.resetCentor();
258
+
259
+ function zoomed() {
260
+ const transform = d3.zoomTransform(svg.node());
261
+ const scale = transform.k;
262
+ const translateX = transform.x + (svgWidth * scale) / 2;
263
+ const translateY = transform.y + (svgHeight * scale) / 2;
264
+ g.attr("transform", d3.zoomIdentity.translate(translateX, translateY).scale(scale));
265
+ }
266
+ }
267
+
268
+ /**
269
+ * 设置svg属性
270
+ */
271
+ setSvg() {
272
+ this.g
273
+ .append("defs")
274
+ .selectAll("marker")
275
+ .data(["arrow"])
276
+ .enter()
277
+ .append("marker")
278
+ .attr("id", (d) => d)
279
+ .attr("markerWidth", 10)
280
+ .attr("markerHeight", 10)
281
+ .attr("markerUnits", "userSpaceOnUse")
282
+ .attr("viewBox", "0 -5 10 10")
283
+ .attr("refX", 45)
284
+ .attr("refY", 0)
285
+ .attr("orient", "auto")
286
+ .append("path")
287
+ .attr("d", "M0,-5L10,0L0,5")
288
+ .attr("fill", "gray")
289
+ .attr("transform", "translate(0,0)");
290
+ }
291
+
292
+ /**
293
+ * 绘制图例
294
+ * @param {} color 颜色集合
295
+ * @param {} nodeLabels 标签集合
296
+ */
297
+ drawLegend(color, nodeLabels) {
298
+
299
+ this.svg.selectAll(".legend").remove();
300
+ const legend = this.svg
301
+ .append("g")
302
+ .attr("class", "legend")
303
+ .attr("transform", "translate(10,10)");
304
+
305
+ // 循环添加每个图例项
306
+ nodeLabels.forEach((label, index) => {
307
+ const legendItem = legend
308
+ .append("g")
309
+ .attr("class", "legend-item")
310
+ .attr("transform", `translate(0,${index * 30})`);
311
+
312
+ legendItem
313
+ .append("rect")
314
+ .attr("x", 0)
315
+ .attr("y", 0)
316
+ .attr("width", 60)
317
+ .attr("height", 20)
318
+ .attr("selected", 1)
319
+ .attr("label", label)
320
+ .attr("color", color(label))
321
+ .style("fill", color(label))
322
+ .style("stroke", "black")
323
+ .on("click", handleLegendItemClick);
324
+
325
+ legendItem
326
+ .append("text")
327
+ .attr("x", 65)
328
+ .attr("y", 15)
329
+ .text(label)
330
+ .attr("text-anchor", "start")
331
+ .attr("font-size", 15);
332
+
333
+ });
334
+
335
+ const g = this.g;
336
+ function handleLegendItemClick() {
337
+ const itemRect = d3.select(this);
338
+ const isSelect = itemRect.attr("selected");
339
+ const label = itemRect.attr("label");
340
+ const nodes = g.selectAll(".node");
341
+ const links = g.selectAll("line");
342
+ const linkLabels = g.selectAll(".link-label");
343
+
344
+ if (1 == isSelect) {
345
+ itemRect
346
+ .style("fill", "white")
347
+ .attr("selected", 0);
348
+ nodes.filter(d => d.label === label).style("display", "none");
349
+ links.filter(d => d.source.label === label || d.target.label === label).style("display", "none");
350
+ linkLabels.filter(d => d.source.label === label || d.target.label === label).style("display", "none");
351
+ }
352
+ else {
353
+ const color = itemRect.attr("color");
354
+ itemRect
355
+ .style("fill", color)
356
+ .attr("selected", 1);
357
+ nodes.filter(d => d.label === label).style("display", "block");
358
+ links.filter(d => d.source.label === label || d.target.label === label).style("display", "block");
359
+ linkLabels.filter(d => d.source.label === label || d.target.label === label).style("display", "block");
360
+ }
361
+ }
362
+ }
363
+
364
+ /**
365
+ * 绘制顶点
366
+ * @param {} simulation 模拟器
367
+ * @param {} color 颜色集合
368
+ * @param {} nodes 顶点集合
369
+ * @returns 顶点
370
+ */
371
+ drawNode(simulation, color, nodes) {
372
+
373
+ const table = this.table;
374
+ const node = this.g
375
+ .append("g")
376
+ .selectAll("g")
377
+ .data(nodes)
378
+ .enter()
379
+ .append("g")
380
+ .attr('class', 'node')
381
+ .attr('id', (d) => d.id)
382
+ .attr("label", (d) => d.label)
383
+ .call(this.drag(simulation))
384
+ .on("click", (event, d) => handClick.call(this, event, d));
385
+
386
+ node
387
+ .append("circle")
388
+ .attr("r", 35)
389
+ .attr("fill", (d) => color(d.label))
390
+ .attr("class","circle")
391
+ .style('stroke', 'rgba(255, 210, 0)')
392
+ .style('stroke-width', '0px');
393
+
394
+ node
395
+ .append("text")
396
+ .attr("dx", 0)
397
+ .attr("dy", ".35em")
398
+ .style("fill", "white")
399
+ .style("font-size", "12px")
400
+ .style("text-anchor", "middle")
401
+ .text((d) => this.truncateText(d.name, 5));
402
+
403
+ function handClick(event, target) {
404
+ const id = target.id;
405
+ const name = target.name;
406
+ const label = target.label;
407
+ const properties = JSON.parse(target.properties);
408
+ this.id = target.id;
409
+ this.orinode = name
410
+ const data = [
411
+ { key: "名称:", value: name },
412
+ { key: "标签:", value: label },
413
+ { key: "x:", value: Math.round(target.x) },
414
+ { key: "y:", value: Math.round(target.y) }
415
+ ];
416
+
417
+ // 遍历properties并添加到data
418
+ for (let key in properties) {
419
+ data.push({ key: `${key}:`, value: properties[key] });
420
+ }
421
+
422
+ table.selectAll("g.row").remove();
423
+
424
+ // 创建表格行
425
+ const rows = table
426
+ .selectAll("g.row")
427
+ .data(data)
428
+ .enter()
429
+ .append("g")
430
+ .attr("class", "row")
431
+ .attr("transform", (d, i) => `translate(0, ${i * 30 + 20})`);
432
+
433
+ // 创建单元格并填充数据
434
+ rows
435
+ .selectAll("text")
436
+ .data((d) => [d.key, d.value])
437
+ .enter()
438
+ .append("text")
439
+ .attr("x", (d, i) => i * 120)
440
+ .text((d) => d)
441
+ .style("font-size", "16px")
442
+ .style("font-weight", "bold");
443
+
444
+ const allnode = this.g.selectAll(".node");
445
+ allnode.classed("highlighted", d => d.id === id)
446
+ .select("circle")
447
+ .style("stroke-width", d => (d.id === id ? '8px' : '0px'));
448
+
449
+ const alllink = this.g.selectAll("line");
450
+ alllink
451
+ .attr("stroke", (link) => {
452
+ if (link.source.id == id) {
453
+ return "red";
454
+ }
455
+ else if (link.target.id == id) {
456
+ return "blue";
457
+ }
458
+ else {
459
+ return "gray";
460
+ }
461
+ });
462
+
463
+ event.stopPropagation(); // 阻止事件冒泡
464
+ }
465
+
466
+ return node;
467
+ }
468
+
469
+ /**
470
+ * 绘制连接线
471
+ * @param {} links 顶点关系集合
472
+ * @returns 连接线
473
+ */
474
+ drawLink(links) {
475
+ const link = this.g
476
+ .insert("g", ":first-child")
477
+ .selectAll("line")
478
+ .data(links)
479
+ .enter()
480
+ .append("line")
481
+ .attr("stroke", "gray")
482
+ .attr("marker-end", "url(#arrow)")
483
+
484
+ return link;
485
+ }
486
+
487
+ addLink(links) {
488
+ const link = this.drawlinks(links);
489
+ link
490
+ .filter((d, i, arr) => {
491
+ // 判断是否有重复线
492
+ const source = d.source.id;
493
+ const target = d.target.id;
494
+ for (let j = 0; j < i; j++) {
495
+ const link = arr[j];
496
+ if ((link.source.id === source && link.target.id === target) ||
497
+ (link.source.id === target && link.target.id === source)) {
498
+ return false;
499
+ }
500
+ }
501
+ return true;
502
+ });
503
+ return link;
504
+ }
505
+
506
+ /**
507
+ * 绘制顶点标签
508
+ * @param {} links 顶点关系集合
509
+ * @returns 顶点标签
510
+ */
511
+ drawLinkLabel(links) {
512
+ const linkLabel = this.g
513
+ .insert("g", ":first-child")
514
+ .selectAll("linklabel")
515
+ .data(links)
516
+ .enter()
517
+ .append("g")
518
+ .attr("class", "link-label");
519
+
520
+ linkLabel
521
+ .append("rect")
522
+ .attr("width", 60)
523
+ .attr("height", 20)
524
+ .attr("fill", "white")
525
+ .attr("stroke", "white")
526
+ .attr("alignment-baseline", "central")
527
+ .attr("transform", "translate(-30,-10)");
528
+
529
+ linkLabel
530
+ .append("text")
531
+ .text((d) => d.label)
532
+ .attr("x", 0)
533
+ .attr("y", 5)
534
+ .attr("text-anchor", "middle")
535
+ .attr("font-size", 12)
536
+ .attr("fill", "blue");
537
+
538
+ return linkLabel;
539
+ }
540
+
541
+ /**
542
+ * 位置计算
543
+ * @param {} simulation 模拟器
544
+ * @param {} node 顶点
545
+ * @param {} link 连接线
546
+ * @param {} linkLabel 连接线标签
547
+ */
548
+ drawSimulation(node, link, linkLabel) {
549
+ link
550
+ .attr("x1", (d) => d.source.x)
551
+ .attr("y1", (d) => d.source.y)
552
+ .attr("x2", (d) => d.target.x)
553
+ .attr("y2", (d) => d.target.y);
554
+ node.attr("transform", (d) => `translate(${d.x},${d.y})`);
555
+
556
+ linkLabel.attr("transform", (d) => {
557
+ var x = (d.source.x + d.target.x) / 2;
558
+ var y = (d.source.y + d.target.y) / 2;
559
+ const angle =
560
+ (Math.atan2(d.target.y - d.source.y, d.target.x - d.source.x) *
561
+ 180) /
562
+ Math.PI;
563
+ return `translate(${x}, ${y}) rotate(${angle})`;
564
+ });
565
+ }
566
+
567
+ drawTable() {
568
+
569
+ // 添加一个包含表格的 g 元素
570
+ const table = this.svg
571
+ .append("g")
572
+ .attr("transform", `translate(200, 5)`);
573
+
574
+ return table;
575
+ }
576
+
577
+ /**
578
+ * 替换标签,控制标签显示长度
579
+ * @param {} text 标签
580
+ * @param {} maxLength 最大长度
581
+ * @returns 替换标签
582
+ */
583
+ truncateText(text, maxLength) {
584
+ let truncated = text;
585
+ if (text.length > maxLength) {
586
+ truncated = text.slice(0, maxLength - 1) + "...";
587
+ }
588
+ return truncated;
589
+ }
590
+
591
+ /**
592
+ * 拖拽捕捉
593
+ * @param {} simulation 模拟器
594
+ * @returns 拖拽位置
595
+ */
596
+ drag(simulation) {
597
+ function dragstarted(event) {
598
+ if (!event.active) simulation.alphaTarget(0.3).restart();
599
+ event.subject.fx = event.subject.x;
600
+ event.subject.fy = event.subject.y;
601
+ }
602
+ function dragged(event) {
603
+ event.subject.fx = event.x;
604
+ event.subject.fy = event.y;
605
+ }
606
+ function dragended(event) {
607
+ if (!event.active) simulation.alphaTarget(0);
608
+ event.subject.fx = null;
609
+ event.subject.fy = null;
610
+ }
611
+ return d3
612
+ .drag()
613
+ .on("start", dragstarted)
614
+ .on("drag", dragged)
615
+ .on("end", dragended);
616
+ }
617
+
618
+ clickCancel() {
619
+ if (this.g) {
620
+ this.g.selectAll("line").attr("stroke", "gray");
621
+ this.g.selectAll(".circle").style('stroke-width', '0px');
622
+ }
623
+
624
+ if (this.table) {
625
+ this.table.selectAll("g.row").remove();
626
+ }
627
+
628
+ this.id = '';
629
+ }
630
+ }
631
+
632
+
633
+ export default DrawGraph
634
+