plot_drawGraphics.html 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="utf-8">
  8. <title data-i18n="resources.title_drawGraphics"></title>
  9. <style type="text/css">
  10. body {
  11. margin: 0;
  12. overflow: hidden;
  13. background: #fff;
  14. width: 100%;
  15. height: 100%
  16. }
  17. #map {
  18. position: absolute;
  19. position: absolute;
  20. left: 200px;
  21. right: 0px;
  22. width: 100%;
  23. height: 100%;
  24. }
  25. #toolbar {
  26. position: absolute;
  27. top: 50px;
  28. right: 10px;
  29. text-align: center;
  30. z-index: 100;
  31. border-radius: 4px;
  32. }
  33. #toolbar .panel-title {
  34. font-size: 16px;
  35. color: white;
  36. }
  37. #menu {
  38. position: absolute;
  39. float: left;
  40. background: #ffffff;
  41. width: 200px;
  42. height: 100%;
  43. z-index: 100;
  44. }
  45. #myMenu1 {
  46. position: absolute;
  47. visibility: hidden;
  48. z-index: 9999;
  49. }
  50. #myMenu1 ul {
  51. float: left;
  52. border: 1px solid #979797;
  53. background: #f1f1f1 url(./images/line.png) 36px 0 repeat-y;
  54. padding: 2px;
  55. box-shadow: 2px 2px 2px rgba(0, 0, 0, .6);
  56. }
  57. #myMenu1 ul li {
  58. width: 112px;
  59. float: left;
  60. clear: both;
  61. height: 30px;
  62. cursor: pointer;
  63. line-height: 30px;
  64. }
  65. #myMenu1 ul li:hover {
  66. background-color: #CAE1FF;
  67. }
  68. #myMenu2 {
  69. position: absolute;
  70. visibility: hidden;
  71. z-index: 9999;
  72. }
  73. #myMenu2 ul {
  74. float: left;
  75. border: 1px solid #979797;
  76. background: #f1f1f1 url(./images/line.png) 36px 0 repeat-y;
  77. padding: 2px;
  78. box-shadow: 2px 2px 2px rgba(0, 0, 0, .6);
  79. }
  80. #myMenu2 ul li {
  81. width: 112px;
  82. float: left;
  83. clear: both;
  84. height: 30px;
  85. cursor: pointer;
  86. line-height: 30px;
  87. }
  88. #myMenu2 ul li:hover {
  89. background-color: #CAE1FF;
  90. }
  91. #myMenu3 {
  92. position: absolute;
  93. visibility: hidden;
  94. z-index: 9999;
  95. }
  96. #myMenu3 ul {
  97. float: left;
  98. border: 1px solid #979797;
  99. background: #f1f1f1 url(./images/line.png) 36px 0 repeat-y;
  100. padding: 2px;
  101. box-shadow: 2px 2px 2px rgba(0, 0, 0, .6);
  102. }
  103. #myMenu3 ul li {
  104. width: 112px;
  105. float: left;
  106. clear: both;
  107. height: 30px;
  108. cursor: pointer;
  109. line-height: 30px;
  110. }
  111. #myMenu3 ul li:hover {
  112. background-color: #CAE1FF;
  113. }
  114. .panel-title {
  115. font-size: 16px;
  116. color: #ffffff;
  117. }
  118. .panel {
  119. border-bottom: none;
  120. }
  121. .input-group {
  122. margin: 10px auto;
  123. }
  124. </style>
  125. </head>
  126. <body>
  127. <div id="toolbar" class="panel panel-primary">
  128. <div class='panel-heading'>
  129. <h5 class='panel-title text-center' data-i18n="resources.title_drawGraphics"></h5></div>
  130. <div class='panel-body content' style="padding: 10px;">
  131. <div class='input-group'>
  132. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_route1"
  133. onclick="drawKJRoute()"/>&nbsp;
  134. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_route2"
  135. onclick="drawHJRoute()"/>&nbsp;
  136. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_route3"
  137. onclick="drawDDRoute()"/>
  138. </div>
  139. <div class='input-group'>
  140. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_sectorArea"
  141. onclick="drawArcRegion()"/>&nbsp;
  142. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_interfereBeam"
  143. onclick="drawInterferenceBeam()"/>
  144. </div>
  145. <div class='input-group'>
  146. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_objectMarker"
  147. onclick="drawSymbolText()"/>&nbsp;
  148. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_objectMarker1"
  149. onclick="drawSymbolText1()"/>
  150. </div>
  151. <div class='input-group'>
  152. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_troopDeploy1"
  153. onclick="drawHJBLdeploy()"/>&nbsp;
  154. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_troopDeploy2"
  155. onclick="drawKJBLdeploy()"/>
  156. </div>
  157. <div class='input-group'>
  158. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_satellite"
  159. onclick="drawSatellite()"/>&nbsp;
  160. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_satelliteWindow1"
  161. onclick="drawSatelliteTimeWindows1()"/>&nbsp;
  162. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_satelliteWindow2"
  163. onclick="drawSatelliteTimeWindows2()"/>
  164. </div>
  165. <div class='input-group'>
  166. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_editRectangle"
  167. onclick="editCircumRetangle()"/>&nbsp;
  168. <input type="button" class="btn btn-default" data-i18n="[value]resources.btn_editNode"
  169. onclick="editControlPoints()"/>
  170. </div>
  171. </div>
  172. </div>
  173. <div id="menu" style="width: 250px;">
  174. <div class="easyui-panel" style="position:absolute;top:0px;bottom:0px;left:0px;right:0px;padding:5px; width: 100%;">
  175. <div class="easyui-tabs" style="width: 100%;height: 100%">
  176. <div id="stylePanel" data-i18n="[title]resources.text_attributePanel"></div>
  177. </div>
  178. </div>
  179. </div>
  180. <div id="map"></div>
  181. <script type="text/javascript" include="bootstrap,responsive,sticklr" src="../js/include-web.js"></script>
  182. <script type="text/javascript" exclude="iclient-classic" include="iclient8c-plot,DefaultStyleConfiguration,PlottingPanel"
  183. src="../../dist/classic/include-classic.js"></script>
  184. <script>
  185. var map, plottingLayer, layer, menu1, menu2, menu3;
  186. var stylePanel;
  187. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  188. var mapurl = host + "/iserver/services/map-china400/rest/maps/China_4326";
  189. var serverUrl = host + "/iserver/services/plot-jingyong/rest/plot/";
  190. var plotting;
  191. var drawGraphicObjects = [];
  192. var plottingEdit;
  193. init();
  194. function init() {
  195. map = new SuperMap.Map("map", {
  196. controls: [
  197. new SuperMap.Control.LayerSwitcher(),
  198. new SuperMap.Control.ScaleLine(),
  199. new SuperMap.Control.Zoom(),
  200. new SuperMap.Control.Navigation({
  201. dragPanOptions: {
  202. enableKinetic: true
  203. }
  204. })]
  205. });
  206. layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", mapurl, {
  207. transparent: true,
  208. cacheEnabled: true
  209. }, {maxResolution: "auto"});
  210. layer.events.on({"layerInitialized": addLayer});
  211. map.events.register("mousedown");
  212. //总控类
  213. plotting = SuperMap.Plotting.getInstance(map, serverUrl);
  214. plottingLayer = new SuperMap.Layer.PlottingLayer("标绘图层", serverUrl);
  215. //空间分析服务地址:目前使用的是服务器默认空间分析地址,可更换成实际使用的空间分析服务地址
  216. //plottingLayer.spatialAnalystUrl = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
  217. //态势标绘编辑
  218. plottingEdit = new SuperMap.Control.PlottingEdit();
  219. // 绘制标号;
  220. var drawGraphicObject = new SuperMap.Control.DrawFeature(plottingLayer, SuperMap.Handler.GraphicObject);
  221. drawGraphicObjects.push(drawGraphicObject);
  222. //添加态势标绘控件
  223. map.addControls([plottingEdit, drawGraphicObject]);
  224. }
  225. function addLayer() {
  226. map.addLayers([layer, plottingLayer]);
  227. map.setCenter(new SuperMap.LonLat(104, 35), 3);//定位中国地图
  228. //创建属性面板
  229. stylePanel = new SuperMap.Plotting.StylePanel("stylePanel");
  230. stylePanel.addEditLayer(plottingLayer);
  231. }
  232. //取消标绘与编辑
  233. function plottingAllDeactivate() {
  234. for (var i = 0; i < drawGraphicObjects.length; i++) {
  235. drawGraphicObjects[i].deactivate();
  236. }
  237. plottingEdit.deactivate();
  238. }
  239. //取消标绘,激活标绘编辑控件
  240. function PlottingDrawCancel() {
  241. plottingAllDeactivate();
  242. plottingEdit.activate();
  243. }
  244. //清除feature
  245. function clearFeatures() {
  246. plottingLayer.removeAllFeatures();
  247. }
  248. function editCircumRetangle() {
  249. plottingEdit.setEditMode(SuperMap.Plot.EditMode.EDITCIRCUMRECTANGLE);
  250. }
  251. function editControlPoints() {
  252. plottingEdit.setEditMode(SuperMap.Plot.EditMode.EDITCONTROLPOINT);
  253. }
  254. //创建扇形区域
  255. function drawArcRegion() {
  256. plottingEdit.deactivate();
  257. clearFeatures();
  258. var uuid = "iArcRegion";
  259. var locationPointWCs = new SuperMap.Geometry.Point(104, 31);
  260. var options = {
  261. radiusText: [resources.text_radius, 1000 + resources.text_kilometre],
  262. radiusPosAngle: 30,
  263. radiusLineType: SuperMap.Plot.RadiusLineType.ARROW
  264. };
  265. plottingLayer.createArcRegion(locationPointWCs, 1000, 0, 100, resources.btn_sectorArea, 50, uuid, {}, options, {text: resources.btn_sectorArea});
  266. plottingEdit.activate();
  267. }
  268. //干扰波束绘制
  269. function drawInterferenceBeam() {
  270. plottingEdit.deactivate();
  271. clearFeatures();
  272. plottingLayer.events.on({"symbolcreated": symbolCreated});
  273. //创建点标号
  274. var locationPointWCs1 = [new SuperMap.Geometry.Point(109, 34)];
  275. var uuid = "subInterferenceBeam";
  276. plottingLayer.createSymbolWC(421, 80400, locationPointWCs1, uuid, {}, {}, {text: resources.text_customAttr});
  277. function symbolCreated(evt) {
  278. plottingLayer.events.un({"symbolcreated": symbolCreated});
  279. var locationPointWCs = [];
  280. locationPointWCs.push(new SuperMap.Geometry.Point(103, 32));
  281. locationPointWCs.push(new SuperMap.Geometry.Point(113, 30));
  282. locationPointWCs.push(new SuperMap.Geometry.Point(112, 36));
  283. locationPointWCs.push(new SuperMap.Geometry.Point(108, 38));
  284. //创建干扰波束
  285. var associatedUuid = evt.feature.geometry.uuid;
  286. var uuid = "iInterferenceBeam";
  287. plottingLayer.createInterferenceBeam(associatedUuid, locationPointWCs, uuid, {}, null, {text: resources.btn_interfereBeam});
  288. plottingEdit.activate();
  289. }
  290. }
  291. //对象标注
  292. function drawSymbolText() {
  293. plottingEdit.deactivate();
  294. clearFeatures();
  295. plottingLayer.events.on({"symbolcreated": symbolCreated});
  296. //创建点标号
  297. var locationPointWCs1 = [new SuperMap.Geometry.Point(109, 34)];
  298. var symbolSize = new SuperMap.Size(30, 30);
  299. plottingLayer.createSymbolWC(421, 80102, locationPointWCs1, "uuid-sub-Symbol-1", {}, {symbolSize: symbolSize}, {textContent: resources.text_commandPost});
  300. function symbolCreated(evt) {
  301. plottingLayer.events.un({"symbolcreated": symbolCreated});
  302. //创建对象标注
  303. var symbolTexts = [];
  304. symbolTexts.push(new SuperMap.Plot.SymbolText(resources.text_shanxiXian, 0, null));
  305. symbolTexts.push(new SuperMap.Plot.SymbolText(resources.text_weather, 2, null));
  306. var associatedUuid = evt.feature.geometry.uuid;
  307. plottingLayer.createSymbolText(associatedUuid, symbolTexts, "uuid-SymbolText", {}, {addFrame: false}, {text: resources.btn_objectMarker});
  308. plottingEdit.activate();
  309. }
  310. }
  311. //对象标注1
  312. function drawSymbolText1() {
  313. plottingEdit.deactivate();
  314. clearFeatures();
  315. plottingLayer.events.on({"symbolcreated": symbolCreated});
  316. //创建点标号
  317. var locationPointWCs1 = [new SuperMap.Geometry.Point(119, 38)];
  318. plottingLayer.createSymbolWC(421, 80500, locationPointWCs1, "uuid-sub-Symbol-2", {}, {}, {textContent: resources.text_commandPost});
  319. function symbolCreated(evt) {
  320. plottingLayer.events.un({"symbolcreated": symbolCreated});
  321. //创建对象标注
  322. var associatedUuid = evt.feature.geometry.uuid;
  323. plottingLayer.createSymbolText1(associatedUuid, [resources.text_direction, resources.text_speed, resources.text_drainageAmount], "uuid-SymbolText", {}, {}, {text: resources.btn_objectMarker});
  324. plottingEdit.activate();
  325. }
  326. }
  327. //创建HJBL海军兵力部署
  328. function drawHJBLdeploy() {
  329. plottingEdit.deactivate();
  330. clearFeatures();
  331. plottingLayer.events.on({"symbolcreated": symbolCreated});
  332. var locationPointWCs = [new SuperMap.Geometry.Point(117, 39)];
  333. var uuid = "subHJBLdeploy";
  334. plottingLayer.createSymbolWC(421, 9, locationPointWCs, uuid, {}, {}, {text: resources.text_customAttr});
  335. function symbolCreated(evt) {
  336. plottingLayer.events.un({"symbolcreated": symbolCreated});
  337. var subSymbol = new SuperMap.Plot.SubSymbol();
  338. subSymbol.libID = 421;
  339. subSymbol.code = 10100;
  340. subSymbol.totalNum = 3;
  341. subSymbol.textContent = "Text";
  342. var subSymbol1 = new SuperMap.Plot.SubSymbol();
  343. subSymbol1.libID = 421;
  344. subSymbol1.code = 9;
  345. subSymbol1.totalNum = 3;
  346. subSymbol1.textContent = resources.text_police;
  347. var subSymbol2 = new SuperMap.Plot.SubSymbol();
  348. subSymbol2.libID = 421;
  349. subSymbol2.code = 80701;
  350. subSymbol2.totalNum = 3;
  351. subSymbol2.textContent = resources.text_firearms;
  352. var subObjects = [subSymbol, subSymbol1, subSymbol2];
  353. var associatedUuid = evt.feature.geometry.uuid;
  354. var uuid = "iNavyDeployment";
  355. var options = {colNum: 3, space: 5, textContent: "BLState"};
  356. plottingLayer.createNavyDeployment(associatedUuid, subObjects, uuid, {}, options, {text: resources.text_navy});
  357. plottingEdit.activate();
  358. }
  359. }
  360. //创建KJ机场兵力部署
  361. function drawKJBLdeploy() {
  362. plottingEdit.deactivate();
  363. clearFeatures();
  364. plottingLayer.events.on({"symbolcreated": symbolCreated});
  365. var locationPointWCs = [new SuperMap.Geometry.Point(117, 39)];
  366. plottingLayer.createSymbolWC(421, 80101, locationPointWCs, "uuid-sub-KJBLdeploy", null, {}, {text: resources.text_airport});
  367. function symbolCreated(evt) {
  368. plottingLayer.events.un({"symbolcreated": symbolCreated});
  369. var subSymbol = new SuperMap.Plot.SubSymbol();
  370. subSymbol.libID = 421;
  371. subSymbol.code = 80103;
  372. subSymbol.totalNum = 5;
  373. subSymbol.textContent = resources.text_trafficPolice;
  374. var subSymbol1 = new SuperMap.Plot.SubSymbol();
  375. subSymbol1.libID = 421;
  376. subSymbol1.code = 80105;
  377. subSymbol1.totalNum = 5;
  378. subSymbol1.textContent = resources.text_orderPolice;
  379. var subSymbol2 = new SuperMap.Plot.SubSymbol();
  380. subSymbol2.libID = 421;
  381. subSymbol2.code = 80201;
  382. subSymbol2.totalNum = 5;
  383. subSymbol2.textContent = resources.text_commandCar;
  384. var subObjects = [subSymbol, subSymbol1, subSymbol2];
  385. var associatedUuid = evt.feature.geometry.uuid;
  386. var options = {colNum: 5, space: 5, isShowTooltip: true};
  387. plottingLayer.createAirDeployment(associatedUuid, subObjects, "uuid-AirDeployment", {}, options, {text: resources.text_airportForceDeployment});
  388. plottingEdit.activate();
  389. }
  390. }
  391. //创建卫星
  392. function drawSatellite() {
  393. plottingEdit.deactivate();
  394. clearFeatures();
  395. var orbitPointWCs = [];
  396. var time = new Date().getTime();
  397. for (var i = 30; i < 60; i++) {
  398. var x = 75 + 40 * Math.cos(i * Math.PI / 180);
  399. var y = 7.5 + 40 * Math.sin(i * Math.PI / 180);
  400. orbitPointWCs.push(new SuperMap.Plot.OrbitPoint(x, y, 0, i, time + i));
  401. }
  402. var uuid = "iSatellite";
  403. plottingLayer.createSatellite(421, 80400, orbitPointWCs, resources.btn_satellite, uuid, {}, {visible: true}, {text: resources.text_satelliteCustomAttr});
  404. plottingEdit.activate();
  405. }
  406. //创建卫星可见时间窗口1
  407. function drawSatelliteTimeWindows1() {
  408. plottingEdit.deactivate();
  409. clearFeatures();
  410. plottingLayer.events.on({"symbolcreated": symbolCreated});
  411. var orbitPointWCs = [];
  412. var time = new Date().getTime();
  413. for (var i = 30; i < 60; i++) {
  414. var x = 75 + 40 * Math.cos(i * Math.PI / 180);
  415. var y = 7.5 + 40 * Math.sin(i * Math.PI / 180);
  416. orbitPointWCs.push(new SuperMap.Plot.OrbitPoint(x, y, 0, i, time + i));
  417. }
  418. var uuid = "uSatellite";
  419. plottingLayer.createSatellite(421, 80400, orbitPointWCs, resources.btn_satellite, uuid, {}, {visible: true}, {text: resources.btn_satellite});
  420. function symbolCreated(evt) {
  421. plottingLayer.events.un({"symbolcreated": symbolCreated});
  422. var associatedUuid = evt.feature.geometry.uuid;
  423. var timeWindows1 = new SuperMap.Plot.TimeWindowParameter(40, 50);
  424. var timeWindows = [timeWindows1];
  425. var uuid = "iSatelliteTimeWindows1";
  426. plottingLayer.createSatelliteTimeWindows1(associatedUuid, timeWindows, uuid, {}, {text: resources.text_customAttr});
  427. plottingEdit.activate();
  428. }
  429. }
  430. //创建卫星可见时间窗口2
  431. function drawSatelliteTimeWindows2() {
  432. plottingEdit.deactivate();
  433. clearFeatures();
  434. plottingLayer.events.on({"symbolcreated": symbolCreated});
  435. var orbitPointWCs = [];
  436. var time = new Date().getTime();
  437. for (var i = 30; i < 60; i++) {
  438. var x = 75 + 40 * Math.cos(i * Math.PI / 180);
  439. var y = 7.5 + 40 * Math.sin(i * Math.PI / 180);
  440. orbitPointWCs.push(new SuperMap.Plot.OrbitPoint(x, y, 0, i, 1000 + i));
  441. }
  442. var uuid = "uSatellite1";
  443. plottingLayer.createSatellite(421, 80400, orbitPointWCs, resources.btn_satellite, uuid, {}, {visible: true}, {text: resources.btn_satellite});
  444. function symbolCreated(evt) {
  445. plottingLayer.events.un({"symbolcreated": symbolCreated});
  446. var associatedUuid = evt.feature.geometry.uuid;
  447. var timeWindows1 = new SuperMap.Plot.TimeWindowParameter(1035, 1040);
  448. var timeWindows2 = new SuperMap.Plot.TimeWindowParameter(1045, 1050);
  449. var timeWindows = [timeWindows1, timeWindows2];
  450. var uuid = "iSatelliteTimeWindows2";
  451. plottingLayer.createSatelliteTimeWindows2(associatedUuid, timeWindows, uuid, {}, {text: resources.btn_satelliteWindow2});
  452. plottingEdit.activate();
  453. }
  454. }
  455. //创建KJ飞机航线
  456. function drawKJRoute() {
  457. plottingEdit.deactivate();
  458. clearFeatures();
  459. var arrRoutePts = [];
  460. var routePoints = [];
  461. routePoints.push(new SuperMap.Geometry.Point(106, 29));
  462. routePoints.push(new SuperMap.Geometry.Point(116, 29));
  463. routePoints.push(new SuperMap.Geometry.Point(116.5, 40));
  464. routePoints.push(new SuperMap.Geometry.Point(106, 39));
  465. routePoints.push(new SuperMap.Geometry.Point(106, 29));
  466. arrRoutePts.push(routePoints);
  467. //待机点
  468. var routeNode1 = new SuperMap.Plot.RouteNode();
  469. routeNode1.positionPoint = new SuperMap.Geometry.Point(106, 29);
  470. routeNode1.type = SuperMap.Plot.RouteNodeType.STANDBY;
  471. routeNode1.name = resources.text_Chongqing;
  472. //起飞点
  473. var routeNode2 = new SuperMap.Plot.RouteNode();
  474. routeNode2.positionPoint = new SuperMap.Geometry.Point(116, 29);
  475. routeNode2.type = SuperMap.Plot.RouteNodeType.TAKEOFF;
  476. routeNode2.name = resources.text_Nanchang;
  477. //展开点
  478. var routeNode3 = new SuperMap.Plot.RouteNode();
  479. routeNode3.positionPoint = new SuperMap.Geometry.Point(116.5, 40);
  480. routeNode3.type = SuperMap.Plot.RouteNodeType.EXPANDING;
  481. routeNode3.name = resources.text_Beijing;
  482. //可视化初始点
  483. var routeNode4 = new SuperMap.Plot.RouteNode();
  484. routeNode4.positionPoint = new SuperMap.Geometry.Point(106, 39);
  485. routeNode4.type = SuperMap.Plot.RouteNodeType.VISUALINITAL;
  486. routeNode4.name = resources.text_Yinchuan;
  487. //创建指向节点
  488. var textContents = [];
  489. textContents.push(resources.text_orientation);
  490. textContents.push(resources.text_seep1);
  491. textContents.push(resources.text_height);
  492. textContents.push(resources.text_time);
  493. var towardNode1 = new SuperMap.Plot.TowardNode({
  494. routeNodeId: routeNode2.id,
  495. textContent: textContents,
  496. index: 1
  497. });
  498. routeNode1.towardNodes.push(towardNode1);
  499. var towardNode2 = new SuperMap.Plot.TowardNode({
  500. routeNodeId: routeNode3.id,
  501. textContent: textContents,
  502. index: 1
  503. });
  504. routeNode2.towardNodes.push(towardNode2);
  505. var towardNode3 = new SuperMap.Plot.TowardNode({
  506. routeNodeId: routeNode4.id,
  507. textContent: textContents,
  508. index: 1
  509. });
  510. routeNode3.towardNodes.push(towardNode3);
  511. var towardNode4 = new SuperMap.Plot.TowardNode({
  512. routeNodeId: routeNode1.id,
  513. textContent: textContents,
  514. index: 1
  515. });
  516. routeNode4.towardNodes.push(towardNode4);
  517. var routeNodes = [];
  518. routeNodes.push(routeNode1);
  519. routeNodes.push(routeNode2);
  520. routeNodes.push(routeNode3);
  521. routeNodes.push(routeNode4);
  522. var uuid = "iKJRoute";//实体的唯一标识
  523. plottingLayer.createAirRoute(arrRoutePts, routeNodes, uuid, null, null, {text: resources.text_customAttr});
  524. plottingEdit.activate();
  525. }
  526. //HJ舰船航线
  527. function drawHJRoute() {
  528. plottingEdit.deactivate();
  529. clearFeatures();
  530. var routeNode1 = new SuperMap.Plot.RouteNode();
  531. routeNode1.positionPoint = new SuperMap.Geometry.Point(88, 44);
  532. routeNode1.type = SuperMap.Plot.RouteNodeType.STANDBY;
  533. routeNode1.name = "乌鲁木齐";
  534. var routeNode2 = new SuperMap.Plot.RouteNode();
  535. routeNode2.positionPoint = new SuperMap.Geometry.Point(91, 30);
  536. routeNode2.type = SuperMap.Plot.RouteNodeType.TAKEOFF;
  537. routeNode2.name = "拉萨";
  538. var routeNode3 = new SuperMap.Plot.RouteNode();
  539. routeNode3.positionPoint = new SuperMap.Geometry.Point(102, 37);
  540. routeNode3.type = SuperMap.Plot.RouteNodeType.SUPPLY;
  541. routeNode3.name = "西宁";
  542. var routeNode4 = new SuperMap.Plot.RouteNode();
  543. routeNode4.positionPoint = new SuperMap.Geometry.Point(104, 36);
  544. routeNode4.type = SuperMap.Plot.RouteNodeType.VISUALINITAL;
  545. routeNode4.name = "兰州";
  546. var routeNode5 = new SuperMap.Plot.RouteNode();
  547. routeNode5.positionPoint = new SuperMap.Geometry.Point(106, 39);
  548. routeNode5.type = SuperMap.Plot.RouteNodeType.EXPANDING;
  549. routeNode5.name = "银川";
  550. var routeNode6 = new SuperMap.Plot.RouteNode();
  551. routeNode6.positionPoint = new SuperMap.Geometry.Point(109, 34);
  552. routeNode6.type = SuperMap.Plot.RouteNodeType.COMMONROUTE;
  553. routeNode6.name = "西安";
  554. var routeNode7 = new SuperMap.Plot.RouteNode();
  555. routeNode7.positionPoint = new SuperMap.Geometry.Point(114, 35);
  556. routeNode7.type = SuperMap.Plot.RouteNodeType.RENDEZVOUS;
  557. routeNode7.name = "郑州";
  558. var routeNode8 = new SuperMap.Plot.RouteNode();
  559. routeNode8.positionPoint = new SuperMap.Geometry.Point(117, 37);
  560. routeNode8.type = SuperMap.Plot.RouteNodeType.TAKEOFF;
  561. routeNode8.name = "济南";
  562. var routeNode9 = new SuperMap.Plot.RouteNode();
  563. routeNode9.positionPoint = new SuperMap.Geometry.Point(117, 39);
  564. routeNode9.type = SuperMap.Plot.RouteNodeType.VOLLEY;
  565. routeNode9.name = "天津";
  566. var routeNode10 = new SuperMap.Plot.RouteNode();
  567. routeNode10.positionPoint = new SuperMap.Geometry.Point(123, 42);
  568. routeNode10.type = SuperMap.Plot.RouteNodeType.LANCH;
  569. routeNode10.name = "沈阳";
  570. var routeNode11 = new SuperMap.Plot.RouteNode();
  571. routeNode11.positionPoint = new SuperMap.Geometry.Point(125, 44);
  572. routeNode11.type = SuperMap.Plot.RouteNodeType.AIMING;
  573. routeNode11.name = "长春";
  574. var routeNode12 = new SuperMap.Plot.RouteNode();
  575. routeNode12.positionPoint = new SuperMap.Geometry.Point(112, 41);
  576. routeNode12.type = SuperMap.Plot.RouteNodeType.WEAPONLAUNCH;
  577. routeNode12.name = "呼和浩特";
  578. //创建指向节点
  579. var arrRoutPts = [];
  580. var pts = [];
  581. //创建指向节点
  582. var towardNode1 = new SuperMap.Plot.TowardNode({
  583. routeNodeId: routeNode2.id,
  584. textContent: "速度:1.14公里/分钟 距离:2673.5公里",
  585. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  586. });
  587. routeNode1.towardNodes.push(towardNode1);
  588. pts.push(routeNode1.positionPoint.clone());
  589. pts.push(routeNode2.positionPoint.clone());
  590. arrRoutPts.push(pts);
  591. var towardNode2 = new SuperMap.Plot.TowardNode({
  592. routeNodeId: routeNode3.id,
  593. textContent: "速度:1.14公里/分钟",
  594. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  595. });
  596. routeNode2.towardNodes.push(towardNode2);
  597. pts = [];
  598. pts.push(routeNode2.positionPoint.clone());
  599. pts.push(routeNode3.positionPoint.clone());
  600. arrRoutPts.push(pts);
  601. var towardNode3 = new SuperMap.Plot.TowardNode({
  602. routeNodeId: routeNode4.id,
  603. textContent: "",
  604. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  605. });
  606. routeNode3.towardNodes.push(towardNode3);
  607. pts = [];
  608. pts.push(routeNode3.positionPoint.clone());
  609. pts.push(routeNode4.positionPoint.clone());
  610. arrRoutPts.push(pts);
  611. var towardNode4 = new SuperMap.Plot.TowardNode({
  612. routeNodeId: routeNode5.id,
  613. textContent: "",
  614. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  615. });
  616. routeNode4.towardNodes.push(towardNode4);
  617. pts = [];
  618. pts.push(routeNode4.positionPoint.clone());
  619. pts.push(routeNode5.positionPoint.clone());
  620. arrRoutPts.push(pts);
  621. var towardNode5 = new SuperMap.Plot.TowardNode({
  622. routeNodeId: routeNode6.id,
  623. textContent: "",
  624. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  625. });
  626. routeNode5.towardNodes.push(towardNode5);
  627. pts = [];
  628. pts.push(routeNode5.positionPoint.clone());
  629. pts.push(routeNode6.positionPoint.clone());
  630. arrRoutPts.push(pts);
  631. var towardNode6 = new SuperMap.Plot.TowardNode({
  632. routeNodeId: routeNode8.id,
  633. textContent: "",
  634. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  635. });
  636. routeNode7.towardNodes.push(towardNode6);
  637. pts = [];
  638. pts.push(routeNode7.positionPoint.clone());
  639. pts.push(routeNode8.positionPoint.clone());
  640. arrRoutPts.push(pts);
  641. var towardNode7 = new SuperMap.Plot.TowardNode({
  642. routeNodeId: routeNode9.id,
  643. textContent: "",
  644. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  645. });
  646. routeNode8.towardNodes.push(towardNode7);
  647. pts = [];
  648. pts.push(routeNode8.positionPoint.clone());
  649. pts.push(routeNode9.positionPoint.clone());
  650. arrRoutPts.push(pts);
  651. var towardNode11 = new SuperMap.Plot.TowardNode({
  652. routeNodeId: routeNode10.id,
  653. textContent: "速度:1.14公里/分钟",
  654. relLineText: SuperMap.Plot.RelLineText.ONRIGHTLINE
  655. });
  656. routeNode9.towardNodes.push(towardNode11);
  657. pts = [];
  658. pts.push(routeNode9.positionPoint.clone());
  659. pts.push(routeNode10.positionPoint.clone());
  660. arrRoutPts.push(pts);
  661. var towardNode12 = new SuperMap.Plot.TowardNode({
  662. routeNodeId: routeNode11.id,
  663. textContent: "",
  664. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  665. });
  666. routeNode10.towardNodes.push(towardNode12);
  667. pts = [];
  668. pts.push(routeNode10.positionPoint.clone());
  669. pts.push(routeNode11.positionPoint.clone());
  670. arrRoutPts.push(pts);
  671. var towardNode13 = new SuperMap.Plot.TowardNode({
  672. routeNodeId: routeNode12.id,
  673. textContent: "",
  674. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  675. });
  676. routeNode5.towardNodes.push(towardNode13);
  677. pts = [];
  678. pts.push(routeNode5.positionPoint.clone());
  679. pts.push(routeNode12.positionPoint.clone());
  680. arrRoutPts.push(pts);
  681. var towardNode14 = new SuperMap.Plot.TowardNode({
  682. routeNodeId: routeNode7.id,
  683. textContent: "",
  684. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  685. });
  686. routeNode12.towardNodes.push(towardNode14);
  687. pts = [];
  688. pts.push(routeNode12.positionPoint.clone());
  689. pts.push(routeNode7.positionPoint.clone());
  690. arrRoutPts.push(pts);
  691. var towardNode15 = new SuperMap.Plot.TowardNode({
  692. routeNodeId: routeNode7.id,
  693. textContent: "",
  694. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  695. });
  696. routeNode6.towardNodes.push(towardNode15);
  697. pts = [];
  698. pts.push(routeNode6.positionPoint.clone());
  699. pts.push(routeNode7.positionPoint.clone());
  700. arrRoutPts.push(pts);
  701. var routeNodes = [];
  702. routeNodes.push(routeNode1);
  703. routeNodes.push(routeNode2);
  704. routeNodes.push(routeNode3);
  705. routeNodes.push(routeNode4);
  706. routeNodes.push(routeNode5);
  707. routeNodes.push(routeNode6);
  708. routeNodes.push(routeNode7);
  709. routeNodes.push(routeNode8);
  710. routeNodes.push(routeNode9);
  711. routeNodes.push(routeNode10);
  712. routeNodes.push(routeNode11);
  713. routeNodes.push(routeNode12);
  714. var uuid = "iNavyRoute";//实体的唯一标识
  715. plottingLayer.createNavyRoute(arrRoutPts, routeNodes, uuid, null, null, {text: resources.text_customAttr});
  716. plottingEdit.activate();
  717. }
  718. //创建DD导弹航线
  719. function drawDDRoute() {
  720. plottingEdit.deactivate();
  721. clearFeatures();
  722. var routeNode1 = new SuperMap.Plot.RouteNode();
  723. routeNode1.positionPoint = new SuperMap.Geometry.Point(117, 40);
  724. routeNode1.type = SuperMap.Plot.RouteNodeType.STANDBY;
  725. routeNode1.name = "北京";
  726. var routeNode2 = new SuperMap.Plot.RouteNode();
  727. routeNode2.positionPoint = new SuperMap.Geometry.Point(112, 41);
  728. routeNode2.type = SuperMap.Plot.RouteNodeType.TAKEOFF;
  729. routeNode2.name = "呼和浩特";
  730. var routeNode3 = new SuperMap.Plot.RouteNode();
  731. routeNode3.positionPoint = new SuperMap.Geometry.Point(113, 38);
  732. routeNode3.type = SuperMap.Plot.RouteNodeType.EXPANDING;
  733. routeNode3.name = "太原";
  734. var routeNode4 = new SuperMap.Plot.RouteNode();
  735. routeNode4.positionPoint = new SuperMap.Geometry.Point(119, 32);
  736. routeNode4.type = SuperMap.Plot.RouteNodeType.VISUALINITAL;
  737. routeNode4.name = "南京";
  738. var routeNode5 = new SuperMap.Plot.RouteNode();
  739. routeNode5.positionPoint = new SuperMap.Geometry.Point(116, 29);
  740. routeNode5.type = SuperMap.Plot.RouteNodeType.RENDEZVOUS;
  741. routeNode5.name = "南昌市";
  742. var routeNode6 = new SuperMap.Plot.RouteNode();
  743. routeNode6.positionPoint = new SuperMap.Geometry.Point(107, 27);
  744. routeNode6.type = SuperMap.Plot.RouteNodeType.VOLLEY;
  745. routeNode6.name = "贵阳市";
  746. var routeNode7 = new SuperMap.Plot.RouteNode();
  747. routeNode7.positionPoint = new SuperMap.Geometry.Point(106, 29);
  748. routeNode7.type = SuperMap.Plot.RouteNodeType.SUPPLY;
  749. routeNode7.name = "重庆市";
  750. var routeNode8 = new SuperMap.Plot.RouteNode();
  751. routeNode8.positionPoint = new SuperMap.Geometry.Point(104, 31);
  752. routeNode8.type = SuperMap.Plot.RouteNodeType.TURNING;
  753. routeNode8.name = "成都市";
  754. var routeNode9 = new SuperMap.Plot.RouteNode();
  755. routeNode9.positionPoint = new SuperMap.Geometry.Point(103, 25);
  756. routeNode9.type = SuperMap.Plot.RouteNodeType.LANCH;
  757. routeNode9.name = "昆明市";
  758. var routeNode10 = new SuperMap.Plot.RouteNode();
  759. routeNode10.positionPoint = new SuperMap.Geometry.Point(91, 30);
  760. routeNode10.type = SuperMap.Plot.RouteNodeType.AIMING;
  761. routeNode10.name = "拉萨市";
  762. var routeNode11 = new SuperMap.Plot.RouteNode();
  763. routeNode11.positionPoint = new SuperMap.Geometry.Point(114, 31);
  764. routeNode11.type = SuperMap.Plot.RouteNodeType.AIMING;
  765. routeNode11.name = "武汉市";
  766. var arrRoutPts = [];
  767. var pts = [];
  768. //创建指向节点
  769. var towardNode1 = new SuperMap.Plot.TowardNode({
  770. routeNodeId: routeNode2.id,
  771. textContent: "",
  772. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  773. });
  774. routeNode1.towardNodes.push(towardNode1);
  775. pts.push(routeNode1.positionPoint.clone());
  776. pts.push(routeNode2.positionPoint.clone());
  777. arrRoutPts.push(pts);
  778. var towardNode2 = new SuperMap.Plot.TowardNode({
  779. routeNodeId: routeNode3.id,
  780. textContent: "",
  781. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  782. });
  783. routeNode2.towardNodes.push(towardNode2);
  784. pts = [];
  785. pts.push(routeNode2.positionPoint.clone());
  786. pts.push(routeNode3.positionPoint.clone());
  787. arrRoutPts.push(pts);
  788. var towardNode3 = new SuperMap.Plot.TowardNode({
  789. routeNodeId: routeNode4.id,
  790. textContent: "距离:1094.7/公里",
  791. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  792. });
  793. routeNode3.towardNodes.push(towardNode3);
  794. pts = [];
  795. pts.push(routeNode3.positionPoint.clone());
  796. pts.push(routeNode4.positionPoint.clone());
  797. arrRoutPts.push(pts);
  798. var towardNode4 = new SuperMap.Plot.TowardNode({
  799. routeNodeId: routeNode6.id,
  800. textContent: "距离:1152.5/公里",
  801. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  802. });
  803. routeNode5.towardNodes.push(towardNode4);
  804. pts = [];
  805. pts.push(routeNode5.positionPoint.clone());
  806. pts.push(routeNode6.positionPoint.clone());
  807. arrRoutPts.push(pts);
  808. var towardNode5 = new SuperMap.Plot.TowardNode({
  809. routeNodeId: routeNode7.id,
  810. textContent: "",
  811. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  812. });
  813. routeNode6.towardNodes.push(towardNode5);
  814. pts = [];
  815. pts.push(routeNode6.positionPoint.clone());
  816. pts.push(routeNode7.positionPoint.clone());
  817. arrRoutPts.push(pts);
  818. var towardNode6 = new SuperMap.Plot.TowardNode({
  819. routeNodeId: routeNode8.id,
  820. textContent: "",
  821. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  822. });
  823. routeNode7.towardNodes.push(towardNode6);
  824. pts = [];
  825. pts.push(routeNode7.positionPoint.clone());
  826. pts.push(routeNode8.positionPoint.clone());
  827. arrRoutPts.push(pts);
  828. var towardNode7 = new SuperMap.Plot.TowardNode({
  829. routeNodeId: routeNode9.id,
  830. textContent: "",
  831. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  832. });
  833. routeNode8.towardNodes.push(towardNode7);
  834. pts = [];
  835. pts.push(routeNode8.positionPoint.clone());
  836. pts.push(routeNode9.positionPoint.clone());
  837. arrRoutPts.push(pts);
  838. var towardNode8 = new SuperMap.Plot.TowardNode({
  839. routeNodeId: routeNode10.id,
  840. textContent: "速度:1.14公里/分钟 距离:2223.1/公里",
  841. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  842. });
  843. routeNode9.towardNodes.push(towardNode8);
  844. pts = [];
  845. pts.push(routeNode9.positionPoint.clone());
  846. pts.push(routeNode10.positionPoint.clone());
  847. arrRoutPts.push(pts);
  848. var towardNode9 = new SuperMap.Plot.TowardNode({
  849. routeNodeId: routeNode11.id,
  850. textContent: "速度:1.14公里/分钟 距离:2223.1/公里",
  851. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  852. });
  853. routeNode3.towardNodes.push(towardNode9);
  854. pts = [];
  855. pts.push(routeNode3.positionPoint.clone());
  856. pts.push(routeNode11.positionPoint.clone());
  857. arrRoutPts.push(pts);
  858. var towardNode10 = new SuperMap.Plot.TowardNode({
  859. routeNodeId: routeNode5.id,
  860. textContent: "",
  861. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  862. });
  863. routeNode11.towardNodes.push(towardNode10);
  864. pts = [];
  865. pts.push(routeNode11.positionPoint.clone());
  866. pts.push(routeNode5.positionPoint.clone());
  867. arrRoutPts.push(pts);
  868. var towardNode11 = new SuperMap.Plot.TowardNode({
  869. routeNodeId: routeNode5.id,
  870. textContent: "",
  871. relLineText: SuperMap.Plot.RelLineText.ONLEFTLINE
  872. });
  873. routeNode4.towardNodes.push(towardNode11);
  874. pts = [];
  875. pts.push(routeNode4.positionPoint.clone());
  876. pts.push(routeNode5.positionPoint.clone());
  877. arrRoutPts.push(pts);
  878. var uuid = "iMissileRoute";//实体的唯一标识
  879. var routeNodes = [];
  880. routeNodes.push(routeNode1);
  881. routeNodes.push(routeNode2);
  882. routeNodes.push(routeNode3);
  883. routeNodes.push(routeNode4);
  884. routeNodes.push(routeNode5);
  885. routeNodes.push(routeNode6);
  886. routeNodes.push(routeNode7);
  887. routeNodes.push(routeNode8);
  888. routeNodes.push(routeNode9);
  889. routeNodes.push(routeNode10);
  890. routeNodes.push(routeNode11);
  891. plottingLayer.createMissileRoute(arrRoutPts, routeNodes, uuid, null, null, {text: resources.text_customAttr});
  892. plottingEdit.activate();
  893. }
  894. document.onmouseup = function (evt) {
  895. var evt = evt || window.event;
  896. if (evt.button === 2) {
  897. PlottingDrawCancel();
  898. return false;
  899. }
  900. evt.stopPropagation();
  901. }
  902. </script>
  903. </body>
  904. </html>