WaterPassenger.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /**
  2. * 水上客运地图功能组件,通过调用封装好的基础地图组件实现特定业务功能
  3. */
  4. import {
  5. fullExtent, clearMap, calculation, changeMap, setCamera,
  6. layerControl, layerQuery, addGraphic, draw, getDrawGeometry,
  7. addBoats, addBoatHistory, addLayer
  8. } from '@/utils/map/ArcgisUtil'
  9. import {GetPjylLinePaths, GetWaterFlightPoints, GetShipRout} from "@/apis/ssky";
  10. import {setCenter} from "@/utils/map/Common";
  11. // 浦江游览航线
  12. export function pjylLine(isShow){
  13. if(isShow){
  14. GetPjylLinePaths().then(res=>{
  15. for (let i=res.data.length-1;i>=0;i--){
  16. let lineData = res.data[i]
  17. let linePoints = lineData.linePoints
  18. let points = []
  19. let first = []
  20. for(let j=0;j<linePoints.length;j++){
  21. let point = [Number(linePoints[j].x),Number(linePoints[j].y)]
  22. if(j==0){
  23. first = [Number(linePoints[j].x),Number(linePoints[j].y)]
  24. }
  25. points.push(point)
  26. }
  27. points.push(first)
  28. let symbol
  29. if(lineData.lineName == '精华航线'){
  30. symbol = {
  31. type: "simple-fill",
  32. color: [50, 205, 50, 0.5],
  33. //style: "cross",
  34. outline: {
  35. color: [255, 0, 0],
  36. width: 2,
  37. style: "dash"
  38. }
  39. }
  40. }else{
  41. symbol = {
  42. type: "simple-fill",
  43. color: [50, 205, 50, 0.5],
  44. //style: "cross",
  45. outline: {
  46. color: [255, 0, 0],
  47. width: 2,
  48. style: "dash"
  49. }
  50. }
  51. }
  52. let params = {
  53. title: lineData.lineName,
  54. type: 'polygon',
  55. data: points,
  56. edit: false,
  57. temp: true,
  58. clear: false,
  59. goto: true,
  60. attributes: null,
  61. symbol: symbol
  62. }
  63. // 绘制到地图上
  64. addGraphic(params)
  65. }
  66. })
  67. }else{
  68. clearMap({is_draw: false, is_search:false, layers: ['tempLayer']})
  69. setCenter();
  70. }
  71. }
  72. // 浦江游览码头定位
  73. export function onePjylPortLocation(data,isShow){
  74. if(isShow){
  75. // 码头定位
  76. let param = {
  77. title: data.portName,
  78. type: 'point',
  79. data:[data.mapx,data.mapy,20],
  80. edit: false,
  81. temp: false,
  82. clear: false,
  83. goto: true,
  84. attributes: null,
  85. symbol:{
  86. "type": "picture-marker",
  87. "url": "images/ssky/bgImgPort.png",
  88. "width":"300px",
  89. "height":"10px"
  90. }
  91. }
  92. addGraphic(param)
  93. // 绘制陆域围栏
  94. layerQuery({
  95. title: "waterPassenger",
  96. layerId: "4",
  97. where: "码头名称='" + data.portName +"'",
  98. symbol: null,
  99. is_draw: true,
  100. is_clear: false,
  101. callback: "pjylPortHandle"
  102. })
  103. }else{
  104. clearMap({is_draw: false, is_search:true, layers: []})
  105. setCenter();
  106. }
  107. }
  108. // 浦江游览码头查询回调
  109. export function pjylPortHandle(res) {
  110. let data = res.data[0].geometry.rings[0]
  111. let params = {
  112. type: 'line-3d',
  113. data: data,
  114. edit: false,
  115. clear: false,
  116. goto: true,
  117. attributes: null,
  118. title: null
  119. }
  120. addGraphic(params)
  121. }
  122. // 对江轮渡码头定位
  123. export function oneDjldPortLocation(data,isShow){
  124. if(isShow) {
  125. // 码头定位
  126. let param = {
  127. title: data.portName,
  128. type: 'point',
  129. data: [data.mapx, data.mapy, 20],
  130. edit: false,
  131. clear: false,
  132. goto: true,
  133. attributes: null,
  134. symbol: {
  135. "type": "picture-marker",
  136. "url": "images/ssky/bgImgPort.png",
  137. "width": "300px",
  138. "height": "10px"
  139. }
  140. }
  141. addGraphic(param)
  142. /* // 绘制陆域围栏
  143. layerQuery({
  144. title: "waterPassenger",
  145. layerId: "1",
  146. where: "码头名称='" + data.portName + "'",
  147. symbol: null,
  148. is_draw: true,
  149. is_clear: false,
  150. callback: "djldPortHandle"
  151. })*/
  152. }else{
  153. clearMap({is_draw: false, is_search:true, layers: []})
  154. setCenter();
  155. }
  156. }
  157. // 浦江游览码头查询回调
  158. export function djldPortHandle(res) {
  159. let data = res.data[0].geometry.rings[0]
  160. let params = {
  161. type: 'line-3d',
  162. data: data,
  163. edit: false,
  164. clear: false,
  165. goto: true,
  166. attributes: null,
  167. title: null
  168. }
  169. addGraphic(params)
  170. }
  171. // 对江轮渡航线批量展示
  172. export function djldLineAll(isShow) {
  173. addLayer({
  174. id: 'djldLayer',
  175. title: 'djldLayer',
  176. type: 'feature',
  177. url: 'http://10.83.68.109:6080/arcgis/rest/services/water_passenger_3857/MapServer/5',
  178. visible: isShow,
  179. opacity: 1,
  180. token: '',
  181. is_goto: true
  182. })
  183. /* if(isShow){
  184. // GetShipRout({keywords:'',type:''}).then(res =>{
  185. // let list = res.data.Rows.list;
  186. // for(let i = 0; i < list.length;i++){
  187. // let lineData = list[i].pointList;
  188. // let lineName = list[i].name;
  189. // let points = []
  190. // for(let j=0;j<lineData.length;j++){
  191. // let point = [Number(lineData[j].mapx),Number(lineData[j].mapy)]
  192. // points.push(point)
  193. // }
  194. // let params = {
  195. // title: lineName,
  196. // type: 'polyline',
  197. // data: points,
  198. // edit: false,
  199. // clear: false,
  200. // temp: false,
  201. // goto: false,
  202. // attributes: null,
  203. // symbol: {
  204. // type: "simple-line",
  205. // color: [255, 255, 0],
  206. // width: 2
  207. // }
  208. // }
  209. // // 绘制到地图上
  210. // addGraphic(params)
  211. // }
  212. // })
  213. }else{
  214. clearMap({is_draw: false, is_search: true, layers: []})
  215. }*/
  216. }
  217. // 对江轮渡航线
  218. export function djldLine(lineName,isShow){
  219. if(isShow){
  220. GetWaterFlightPoints({lineName:lineName}).then(res=>{
  221. let rows = res.data.Rows;
  222. for (let i=0;i<rows.length;i++){
  223. let lineData = rows[i]
  224. let linePoints = lineData.linePoint[0]
  225. let points = []
  226. for(let j=0;j<linePoints.length;j++){
  227. let point = [Number(linePoints[j].x),Number(linePoints[j].y)]
  228. points.push(point)
  229. }
  230. let params = {
  231. title: lineName,
  232. type: 'polyline',
  233. data: points,
  234. edit: false,
  235. clear: false,
  236. goto: true,
  237. attributes: null,
  238. symbol: {
  239. type: "simple-line",
  240. color: [255, 255, 0],
  241. width: 2
  242. }
  243. }
  244. // 绘制到地图上
  245. addGraphic(params)
  246. }
  247. })
  248. }else{
  249. clearMap({is_draw: false, is_search:true, layers: []})
  250. setCenter();
  251. }
  252. }