Commit 7f3fc290c82dda6cfe643e9ea81b5e3e18c5cdf4
1 parent
88b049d1
线路相关问题优化(站点缓冲区修改多边形中心点可拖动,可以修改会圆形、修改后定位、线路文件可填写版本)
Showing
7 changed files
with
163 additions
and
263 deletions
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -743,6 +743,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -743,6 +743,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 743 | try { | 743 | try { |
| 744 | // 获取线路ID | 744 | // 获取线路ID |
| 745 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | 745 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 746 | + Integer fileVersions = map.get("fileVersions").equals("") ? 2 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认2 | ||
| 746 | /** 查询线路信息 @param:<lineId:线路ID> */ | 747 | /** 查询线路信息 @param:<lineId:线路ID> */ |
| 747 | Line line = lineRepository.findOne(lineId); | 748 | Line line = lineRepository.findOne(lineId); |
| 748 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ | 749 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ |
| @@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 778 | textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ | 779 | textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ |
| 779 | else | 780 | else |
| 780 | resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 | 781 | resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 |
| 781 | - textStr = line.getName() + " " + "2" + "\r" + textStr; | 782 | + textStr = line.getName() + " " + fileVersions + "\r" + textStr; |
| 782 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); | 783 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); |
| 783 | /** 生成txt文件,上传ftp */ | 784 | /** 生成txt文件,上传ftp */ |
| 784 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); | 785 | clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input); |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -338,30 +338,54 @@ | @@ -338,30 +338,54 @@ | ||
| 338 | layer.msg('请选中一条线路!'); | 338 | layer.msg('请选中一条线路!'); |
| 339 | return ; | 339 | return ; |
| 340 | }else { | 340 | }else { |
| 341 | - id = arrChk.data('id'); | ||
| 342 | - lineName = arrChk.val(); | ||
| 343 | - // 请求参数 | ||
| 344 | - var params = {lineId:id}; | ||
| 345 | - // 弹出正在加载层 | ||
| 346 | - var index = layer.load(0); | ||
| 347 | - /** 生成线路行单 @pararm:<params:请求参数> */ | ||
| 348 | - $post('/stationroute/usingSingle',params,function(data) { | ||
| 349 | - // 关闭弹出框 | ||
| 350 | - layer.close(index); | ||
| 351 | - if(data.status=='SUCCESS') { | ||
| 352 | - // 弹出添加成功提示消息 | ||
| 353 | - layer.msg('生成线路【'+ lineName +'】路单文件成功!'); | ||
| 354 | - }else if(data.status=='ERROR'){ | ||
| 355 | - // 弹出添加成功提示消息 | ||
| 356 | - layer.msg('生成线路【'+ lineName +'】路单文件失败!'); | ||
| 357 | - }else if(data.status=='NOTDATA') { | ||
| 358 | - // 弹出添加成功提示消息 | ||
| 359 | - layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!'); | ||
| 360 | - }else if(data.status=='NOLinePlayType') { | ||
| 361 | - // 弹出添加成功提示消息 | ||
| 362 | - layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!'); | ||
| 363 | - } | ||
| 364 | - }); | 341 | + layer.open({ |
| 342 | + id:1, | ||
| 343 | + type: 1, | ||
| 344 | + title: "线路文件版本号", | ||
| 345 | + // skin:'layui-layer-rim', | ||
| 346 | + area:['450px', 'auto'], | ||
| 347 | + | ||
| 348 | + content: '<div class="col-sm-12">' | ||
| 349 | + +'<div class="input-group">' | ||
| 350 | + +'<span class="input-group-addon"> 线路文件版本号 :</span>' | ||
| 351 | + +'<input id="fileVersionsInput" type="text" class="form-control" placeholder="没有填写默认为2">' | ||
| 352 | + +'</div>' | ||
| 353 | + +'</div>', | ||
| 354 | + btn:['确定','取消'], | ||
| 355 | + btn1: function (index,layero) { | ||
| 356 | + var fileVersions = $('#fileVersionsInput').val(); | ||
| 357 | + id = arrChk.data('id'); | ||
| 358 | + lineName = arrChk.val(); | ||
| 359 | + // 请求参数 | ||
| 360 | + var params = {lineId:id, fileVersions:fileVersions}; | ||
| 361 | + // 弹出正在加载层 | ||
| 362 | + var index = layer.load(0); | ||
| 363 | + /** 生成线路行单 @pararm:<params:请求参数> */ | ||
| 364 | + $post('/stationroute/usingSingle',params,function(data) { | ||
| 365 | + // 关闭弹出框 | ||
| 366 | + layer.close(index); | ||
| 367 | + if(data.status=='SUCCESS') { | ||
| 368 | + // 弹出添加成功提示消息 | ||
| 369 | + layer.msg('生成线路【'+ lineName +'】路单文件成功!'); | ||
| 370 | + }else if(data.status=='ERROR'){ | ||
| 371 | + // 弹出添加成功提示消息 | ||
| 372 | + layer.msg('生成线路【'+ lineName +'】路单文件失败!'); | ||
| 373 | + }else if(data.status=='NOTDATA') { | ||
| 374 | + // 弹出添加成功提示消息 | ||
| 375 | + layer.msg('系统无线路【'+ lineName +'】的站点与路段信息!'); | ||
| 376 | + }else if(data.status=='NOLinePlayType') { | ||
| 377 | + // 弹出添加成功提示消息 | ||
| 378 | + layer.msg('无法识别【'+ lineName +'】的线路规划类型,请设置为双向/环线!'); | ||
| 379 | + } | ||
| 380 | + }); | ||
| 381 | + }, | ||
| 382 | + btn2:function (index,layero) { | ||
| 383 | + layer.close(index); | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + }); | ||
| 387 | + | ||
| 388 | + | ||
| 365 | } | 389 | } |
| 366 | }); | 390 | }); |
| 367 | /** 生成路线(路段和站点) */ | 391 | /** 生成路线(路段和站点) */ |
src/main/resources/static/pages/base/stationroute/edit.html
| @@ -190,7 +190,11 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | @@ -190,7 +190,11 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | ||
| 190 | fun.linePanlThree(addLine.id,data,add_direction_v); | 190 | fun.linePanlThree(addLine.id,data,add_direction_v); |
| 191 | }); | 191 | }); |
| 192 | fun.editMapStatusRemove(); | 192 | fun.editMapStatusRemove(); |
| 193 | - } | 193 | + setTimeout(function () { |
| 194 | + var stationArray = map_.getStationArray(); | ||
| 195 | + map_.openStationInfoWin(stationArray[editStationParmasObj.stationRouteId]); | ||
| 196 | + },1000); | ||
| 197 | + } | ||
| 194 | // 编辑表单元素 | 198 | // 编辑表单元素 |
| 195 | var form = $('#edit_station_form'); | 199 | var form = $('#edit_station_form'); |
| 196 | // 获取错误提示元素 | 200 | // 获取错误提示元素 |
| @@ -206,9 +210,9 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | @@ -206,9 +210,9 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati | ||
| 206 | errorClass : 'help-block help-block-error', | 210 | errorClass : 'help-block help-block-error', |
| 207 | focusInvalid : false, | 211 | focusInvalid : false, |
| 208 | rules : { | 212 | rules : { |
| 209 | - 'zdmc' : { required : true,maxlength : 50,},// 站点名称 必填项 | ||
| 210 | - 'stationName' : { required : true,maxlength : 50,},// 站点名称 必填项 | ||
| 211 | - 'stationCod': {required : true,},// 站点编码 必填项 | 213 | + 'zdmc' : { required : true,maxlength : 50},// 站点名称 必填项 |
| 214 | + 'stationName' : { required : true,maxlength : 50},// 站点名称 必填项 | ||
| 215 | + 'stationCod': {required : true},// 站点编码 必填项 | ||
| 212 | 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 | 216 | 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 |
| 213 | 'stationRouteCode' : {isStart : true},// 站点序号 | 217 | 'stationRouteCode' : {isStart : true},// 站点序号 |
| 214 | 'stationMark' : {required : true},// 站点类型 必填项 | 218 | 'stationMark' : {required : true},// 站点类型 必填项 |
src/main/resources/static/pages/base/stationroute/edit_select.html
| @@ -14,10 +14,6 @@ | @@ -14,10 +14,6 @@ | ||
| 14 | <button class="close" data-close="alert"></button> | 14 | <button class="close" data-close="alert"></button> |
| 15 | 站点名称为必填项 | 15 | 站点名称为必填项 |
| 16 | </div> | 16 | </div> |
| 17 | - <div class="alert alert-danger display-hide" id="serchrname"> | ||
| 18 | - <button class="close" data-close="alert"></button> | ||
| 19 | - 系统无法生成,请选择其他方式新增 | ||
| 20 | - </div> | ||
| 21 | <div class="form-group" id="formRequ"> | 17 | <div class="form-group" id="formRequ"> |
| 22 | <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> | 18 | <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> |
| 23 | <div class="col-md-9" id="errorInfo"> | 19 | <div class="col-md-9" id="errorInfo"> |
| @@ -29,10 +25,13 @@ | @@ -29,10 +25,13 @@ | ||
| 29 | <div class="col-md-9"> | 25 | <div class="col-md-9"> |
| 30 | <div class="icheck-list"> | 26 | <div class="icheck-list"> |
| 31 | <label> | 27 | <label> |
| 32 | - <input type="radio" class="icheck" name="editselect" value=0> 重新绘制位置 | 28 | + <input type="radio" class="icheck" name="editselect" value=0> 重新绘制为多边形 |
| 33 | </label> | 29 | </label> |
| 34 | <label> | 30 | <label> |
| 35 | - <input type="radio" class="icheck" name="editselect" value=1 checked> 编辑原始位置 | 31 | + <input type="radio" class="icheck" name="editselect" value=1> 重新绘制为圆形 |
| 32 | + </label> | ||
| 33 | + <label> | ||
| 34 | + <input type="radio" class="icheck" name="editselect" value=2 checked> 编辑原始位置 | ||
| 36 | </label> | 35 | </label> |
| 37 | </div> | 36 | </div> |
| 38 | </div> | 37 | </div> |
| @@ -124,6 +123,19 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | @@ -124,6 +123,19 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | ||
| 124 | map_.localtionPoint(editStationName+"公交站点"); | 123 | map_.localtionPoint(editStationName+"公交站点"); |
| 125 | fun.editMapStatus(); | 124 | fun.editMapStatus(); |
| 126 | }else if(params.editselect==1){ | 125 | }else if(params.editselect==1){ |
| 126 | + WorldsBMap.localSearchFromAdreesToPoint(editStationName+"公交站点", function (Points) { | ||
| 127 | + if (Points) { | ||
| 128 | + Station.stationJwpoints = Points; | ||
| 129 | + } | ||
| 130 | + Station.stationShapesType = 'r'; | ||
| 131 | + Station.stationGPloyonGrid = null; | ||
| 132 | + Station.stationRadius = 100; | ||
| 133 | + editStationObj.setEitdStation(Station); | ||
| 134 | + editStationObj.setEitdStationName(editStationName); | ||
| 135 | + map_.editShapes(editStationObj); | ||
| 136 | + }); | ||
| 137 | + fun.editMapStatus(); | ||
| 138 | + }else if(params.editselect==2){ | ||
| 127 | editStationObj.setEitdStation(Station); | 139 | editStationObj.setEitdStation(Station); |
| 128 | editStationObj.setEitdStationName(editStationName); | 140 | editStationObj.setEitdStationName(editStationName); |
| 129 | map_.clearMark(); | 141 | map_.clearMark(); |
src/main/resources/static/pages/base/stationroute/editsection.html
| @@ -110,6 +110,9 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fu | @@ -110,6 +110,9 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fu | ||
| 110 | ajaxd.getSectionRouteInfo(lineId,dir,function(data) { | 110 | ajaxd.getSectionRouteInfo(lineId,dir,function(data) { |
| 111 | fun.linePanlThree(lineId,data,dir); | 111 | fun.linePanlThree(lineId,data,dir); |
| 112 | }); | 112 | }); |
| 113 | + setTimeout(function () { | ||
| 114 | + map_.openSectionInfoWin(p); | ||
| 115 | + },1000); | ||
| 113 | } | 116 | } |
| 114 | // 编辑表单元素 | 117 | // 编辑表单元素 |
| 115 | var form = $('#edit_section__form'); | 118 | var form = $('#edit_section__form'); |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| @@ -24,9 +24,19 @@ | @@ -24,9 +24,19 @@ | ||
| 24 | 24 | ||
| 25 | window.WorldsBMap = function () { | 25 | window.WorldsBMap = function () { |
| 26 | 26 | ||
| 27 | - /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆; road_win_show_p:信息窗口打开状态的路段,map_status:地图编辑状态,drawingManager:绘画工具*/ | ||
| 28 | - var mapBValue = '',polygon = '', polyUpline = '', circle = '', iseditStatus = false, road_win_show_p = '', editPolyline = '', sectionArray = [], stationArray = new Map(),map_status = 0, | ||
| 29 | - drawingManager; | 27 | + /** WorldsBMap 全局变量定义 mapBValue:地图对象; road_win_show_p:信息窗口打开状态的路段, |
| 28 | + * sectionArray: 路段集合,stationArray: 站点集合 | ||
| 29 | + * map_status:地图编辑状态,drawingManager:绘画工具, topOverlay:置顶视图*/ | ||
| 30 | + var mapBValue = '', iseditStatus = false, road_win_show_p = '', editPolyline = '', | ||
| 31 | + sectionArray = [], stationArray = new Map(), | ||
| 32 | + map_status = 0,drawingManager,topOverlay; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 编辑缓冲区 | ||
| 36 | + * stationMarkers: 站点图标集合 | ||
| 37 | + */ | ||
| 38 | + var editCircle, editPolygon, dragMarker, stationMarkers = new Map(),centerPoint; | ||
| 39 | + | ||
| 30 | var styleOptions = { | 40 | var styleOptions = { |
| 31 | strokeColor:"blue", //边线颜色。 | 41 | strokeColor:"blue", //边线颜色。 |
| 32 | fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。 | 42 | fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。 |
| @@ -34,7 +44,39 @@ window.WorldsBMap = function () { | @@ -34,7 +44,39 @@ window.WorldsBMap = function () { | ||
| 34 | strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。 | 44 | strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。 |
| 35 | fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 | 45 | fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 |
| 36 | strokeStyle: 'solid' //边线的样式,solid或dashed。 | 46 | strokeStyle: 'solid' //边线的样式,solid或dashed。 |
| 37 | - } | 47 | + }; |
| 48 | + | ||
| 49 | + // 覆盖物置顶 | ||
| 50 | + var setTop = function(overlay) { | ||
| 51 | + if (topOverlay) | ||
| 52 | + topOverlay.setTop(false); | ||
| 53 | + overlay.setTop(true); | ||
| 54 | + topOverlay = overlay; | ||
| 55 | + }; | ||
| 56 | + | ||
| 57 | + var setDragMarker = function (marker) { | ||
| 58 | + marker.enableDragging(); | ||
| 59 | + dragMarker = marker; | ||
| 60 | + dragMarker._old_point = dragMarker._position; | ||
| 61 | + //监听拖拽事件 dragging | ||
| 62 | + dragMarker.addEventListener('dragging', dragMarkerDragEvent); | ||
| 63 | + }; | ||
| 64 | + | ||
| 65 | + var dragMarkerDragEvent = function (e) { | ||
| 66 | + if (editPolygon) { | ||
| 67 | + if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) | ||
| 68 | + dragMarker.setPosition(dragMarker._old_point);//还原位置 | ||
| 69 | + | ||
| 70 | + centerPoint = e.target._position; | ||
| 71 | + } | ||
| 72 | + else if (editCircle) { | ||
| 73 | + editCircle.disableEditing(); | ||
| 74 | + //缓冲区跟随点位运动 | ||
| 75 | + editCircle.setCenter(e.target._position); | ||
| 76 | + editCircle.enableEditing(); | ||
| 77 | + centerPoint = e.target._position; | ||
| 78 | + } | ||
| 79 | + }; | ||
| 38 | 80 | ||
| 39 | var Bmap = { | 81 | var Bmap = { |
| 40 | 82 | ||
| @@ -44,7 +86,7 @@ window.WorldsBMap = function () { | @@ -44,7 +86,7 @@ window.WorldsBMap = function () { | ||
| 44 | // 百度API Key | 86 | // 百度API Key |
| 45 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | 87 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 46 | // 初始化百度地图 | 88 | // 初始化百度地图 |
| 47 | - mapBValue = new BMap.Map("bmap_basic"); | 89 | + mapBValue = new BMap.Map("bmap_basic" , {enableMapClick: false}); |
| 48 | //中心点和缩放级别 | 90 | //中心点和缩放级别 |
| 49 | mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); | 91 | mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); |
| 50 | //启用地图拖拽事件,默认启用(可不写) | 92 | //启用地图拖拽事件,默认启用(可不写) |
| @@ -62,24 +104,21 @@ window.WorldsBMap = function () { | @@ -62,24 +104,21 @@ window.WorldsBMap = function () { | ||
| 62 | getmapBValue: function () { | 104 | getmapBValue: function () { |
| 63 | return mapBValue; | 105 | return mapBValue; |
| 64 | }, | 106 | }, |
| 65 | - getPolygon: function () { | ||
| 66 | - return polygon; | ||
| 67 | - }, | ||
| 68 | - getPolyUpline: function () { | ||
| 69 | - return polyUpline; | ||
| 70 | - }, | ||
| 71 | - getCircle: function () { | ||
| 72 | - return circle; | 107 | + setMap_status : function (i) { |
| 108 | + map_status = i; | ||
| 73 | }, | 109 | }, |
| 74 | getIsEditStatus: function () { | 110 | getIsEditStatus: function () { |
| 75 | return iseditStatus; | 111 | return iseditStatus; |
| 76 | }, | 112 | }, |
| 77 | - setMap_status : function (i) { | ||
| 78 | - map_status = i; | ||
| 79 | - }, | ||
| 80 | setIsEditStatus: function (v) { | 113 | setIsEditStatus: function (v) { |
| 81 | iseditStatus = v; | 114 | iseditStatus = v; |
| 82 | }, | 115 | }, |
| 116 | + getStationArray: function () { | ||
| 117 | + return stationArray; | ||
| 118 | + }, | ||
| 119 | + setStationArray : function (s) { | ||
| 120 | + stationArray = s; | ||
| 121 | + }, | ||
| 83 | /*initDrawingManager: function (map, styleOptions) { | 122 | /*initDrawingManager: function (map, styleOptions) { |
| 84 | },*/ | 123 | },*/ |
| 85 | getDrawingManagerObj: function () { | 124 | getDrawingManagerObj: function () { |
| @@ -100,59 +139,35 @@ window.WorldsBMap = function () { | @@ -100,59 +139,35 @@ window.WorldsBMap = function () { | ||
| 100 | 139 | ||
| 101 | /** 获取距离与时间 @param <points:坐标点集合> */ | 140 | /** 获取距离与时间 @param <points:坐标点集合> */ |
| 102 | getDistanceAndDuration: function (points, callback) { | 141 | getDistanceAndDuration: function (points, callback) { |
| 103 | - | ||
| 104 | // 获取长度 | 142 | // 获取长度 |
| 105 | var len = points.length; | 143 | var len = points.length; |
| 106 | - | ||
| 107 | (function () { | 144 | (function () { |
| 108 | - | ||
| 109 | if (!arguments.callee.count) { | 145 | if (!arguments.callee.count) { |
| 110 | - | ||
| 111 | arguments.callee.count = 0; | 146 | arguments.callee.count = 0; |
| 112 | - | ||
| 113 | } | 147 | } |
| 114 | - | ||
| 115 | arguments.callee.count++; | 148 | arguments.callee.count++; |
| 116 | - | ||
| 117 | var index = parseInt(arguments.callee.count) - 1; | 149 | var index = parseInt(arguments.callee.count) - 1; |
| 118 | - | ||
| 119 | if (index >= len - 1) { | 150 | if (index >= len - 1) { |
| 120 | - | ||
| 121 | callback && callback(points); | 151 | callback && callback(points); |
| 122 | - | ||
| 123 | return; | 152 | return; |
| 124 | } | 153 | } |
| 125 | - | ||
| 126 | // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | 154 | // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) |
| 127 | var f = arguments.callee; | 155 | var f = arguments.callee; |
| 128 | - | ||
| 129 | // 起点坐标 <坐标格式:40.056878,116.30815> | 156 | // 起点坐标 <坐标格式:40.056878,116.30815> |
| 130 | var origin = points[index].potion.lat + ',' + points[index].potion.lng; | 157 | var origin = points[index].potion.lat + ',' + points[index].potion.lng; |
| 131 | - | ||
| 132 | // 终点坐标 <坐标格式:40.056878,116.30815> | 158 | // 终点坐标 <坐标格式:40.056878,116.30815> |
| 133 | var destination = points[index + 1].potion.lat + ',' + points[index + 1].potion.lng; | 159 | var destination = points[index + 1].potion.lat + ',' + points[index + 1].potion.lng; |
| 134 | - | ||
| 135 | var region = '上海'; | 160 | var region = '上海'; |
| 136 | - | ||
| 137 | var origin_region = '上海'; | 161 | var origin_region = '上海'; |
| 138 | - | ||
| 139 | var destination_region = '上海'; | 162 | var destination_region = '上海'; |
| 140 | - | ||
| 141 | var output = 'json'; | 163 | var output = 'json'; |
| 142 | - | ||
| 143 | var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | 164 | var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; |
| 144 | - | ||
| 145 | /** | 165 | /** |
| 146 | * origin:起点名称或经纬度; | 166 | * origin:起点名称或经纬度; |
| 147 | - * | ||
| 148 | * destination:终点名称或经纬度; | 167 | * destination:终点名称或经纬度; |
| 149 | - * | ||
| 150 | * origin_region:起始点所在城市,驾车导航时必填。 | 168 | * origin_region:起始点所在城市,驾车导航时必填。 |
| 151 | - * | ||
| 152 | * destination_region:终点所在城市,驾车导航时必填。 | 169 | * destination_region:终点所在城市,驾车导航时必填。 |
| 153 | - * | ||
| 154 | * output :表示输出类型,可设置为xml或json,默认为xml。 | 170 | * output :表示输出类型,可设置为xml或json,默认为xml。 |
| 155 | - * | ||
| 156 | **/ | 171 | **/ |
| 157 | var paramsB = { | 172 | var paramsB = { |
| 158 | origin: origin, | 173 | origin: origin, |
| @@ -166,60 +181,40 @@ window.WorldsBMap = function () { | @@ -166,60 +181,40 @@ window.WorldsBMap = function () { | ||
| 166 | 181 | ||
| 167 | /** @description :未认证开发者默认配额为:2000次/天。 */ | 182 | /** @description :未认证开发者默认配额为:2000次/天。 */ |
| 168 | $.ajax({ | 183 | $.ajax({ |
| 169 | - | ||
| 170 | // 百度地图根据坐标获取两点之间的时间与距离 | 184 | // 百度地图根据坐标获取两点之间的时间与距离 |
| 171 | url: 'http://api.map.baidu.com/direction/v1?mode=transit', | 185 | url: 'http://api.map.baidu.com/direction/v1?mode=transit', |
| 172 | - | ||
| 173 | data: paramsB, | 186 | data: paramsB, |
| 174 | - | ||
| 175 | dataType: 'jsonp', | 187 | dataType: 'jsonp', |
| 176 | - | ||
| 177 | success: function (r) { | 188 | success: function (r) { |
| 178 | - | ||
| 179 | if (r) { | 189 | if (r) { |
| 180 | - | ||
| 181 | if (r.message == 'ok') { | 190 | if (r.message == 'ok') { |
| 182 | - | ||
| 183 | if (r.result.taxi == null) { | 191 | if (r.result.taxi == null) { |
| 184 | - | ||
| 185 | // 获取距离(单位:米) | 192 | // 获取距离(单位:米) |
| 186 | points[index + 1].distance = 0; | 193 | points[index + 1].distance = 0; |
| 187 | - | ||
| 188 | // 获取时间(单位:秒) | 194 | // 获取时间(单位:秒) |
| 189 | points[index + 1].duration = 0; | 195 | points[index + 1].duration = 0; |
| 190 | - | ||
| 191 | } else { | 196 | } else { |
| 192 | - | ||
| 193 | // 获取距离(单位:米) | 197 | // 获取距离(单位:米) |
| 194 | points[index + 1].distance = r.result.taxi.distance; | 198 | points[index + 1].distance = r.result.taxi.distance; |
| 195 | - | ||
| 196 | // 获取时间(单位:秒) | 199 | // 获取时间(单位:秒) |
| 197 | points[index + 1].duration = r.result.taxi.duration; | 200 | points[index + 1].duration = r.result.taxi.duration; |
| 198 | - | ||
| 199 | } | 201 | } |
| 200 | - | ||
| 201 | - | ||
| 202 | } | 202 | } |
| 203 | - | ||
| 204 | } | 203 | } |
| 205 | - | ||
| 206 | f(); | 204 | f(); |
| 207 | } | 205 | } |
| 208 | }); | 206 | }); |
| 209 | - | ||
| 210 | })(); | 207 | })(); |
| 211 | - | ||
| 212 | }, | 208 | }, |
| 209 | + | ||
| 213 | // 打开站点信息窗口 | 210 | // 打开站点信息窗口 |
| 214 | openStationInfoWin : function (objStation) { | 211 | openStationInfoWin : function (objStation) { |
| 215 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | 212 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) |
| 216 | - mapBValue.setZoom(25); | ||
| 217 | if (objStation) { | 213 | if (objStation) { |
| 218 | // 站点形状 | 214 | // 站点形状 |
| 219 | var shapes = objStation.stationShapesType; | 215 | var shapes = objStation.stationShapesType; |
| 220 | // 获取中心坐标点字符串分割 | 216 | // 获取中心坐标点字符串分割 |
| 221 | var BJwpoints = objStation.stationJwpoints.split(' '); | 217 | var BJwpoints = objStation.stationJwpoints.split(' '); |
| 222 | - | ||
| 223 | // 中心坐标点 | 218 | // 中心坐标点 |
| 224 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); | 219 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); |
| 225 | var width = WorldsBMap.strGetLength(objStation.stationRouteName) * 11; | 220 | var width = WorldsBMap.strGetLength(objStation.stationRouteName) * 11; |
| @@ -270,102 +265,59 @@ window.WorldsBMap = function () { | @@ -270,102 +265,59 @@ window.WorldsBMap = function () { | ||
| 270 | //开启信息窗口 | 265 | //开启信息窗口 |
| 271 | mapBValue.openInfoWindow(infoWindow_target, point); | 266 | mapBValue.openInfoWindow(infoWindow_target, point); |
| 272 | }, 100); | 267 | }, 100); |
| 273 | - // 是否在平移过程中禁止动画。(自1.2新增) | ||
| 274 | - var PanOptions_ = {noAnimation: true}; | ||
| 275 | // 将地图的中心点更改为给定的点。 | 268 | // 将地图的中心点更改为给定的点。 |
| 276 | - mapBValue.panTo(point, PanOptions_); | ||
| 277 | - // mapBValue.panBy(10, -150, PanOptions_); | 269 | + mapBValue.panTo(point); |
| 278 | } | 270 | } |
| 279 | }, | 271 | }, |
| 280 | 272 | ||
| 281 | - editPolyUpline: function () { | ||
| 282 | - // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | ||
| 283 | - polyUpline.disableMassClear(); | ||
| 284 | - WorldsBMap.clearMarkAndOverlays(); | ||
| 285 | - // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | ||
| 286 | - polyUpline.enableMassClear(); | ||
| 287 | - // 开启线路编辑 | ||
| 288 | - polyUpline.enableEditing(); | ||
| 289 | - // 添加双击折线保存事件 | ||
| 290 | - polyUpline.addEventListener('dblclick', function (e) { | ||
| 291 | - // 关闭 | ||
| 292 | - layer.closeAll(); | ||
| 293 | - polyUpline.disableEditing(); | ||
| 294 | - // 获取折线坐标集合 | ||
| 295 | - var editPloyLineArray = polyUpline.getPath(); | ||
| 296 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | ||
| 297 | - polyUpline = ''; | ||
| 298 | - // 加载修改路段弹出层mobal页面 | ||
| 299 | - $.get('editsection.html', function (m) { | ||
| 300 | - $(pjaxContainer).append(m); | ||
| 301 | - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap, GetAjaxData, EditSectionObj, PublicFunctions]); | ||
| 302 | - }); | ||
| 303 | - }); | ||
| 304 | - }, | ||
| 305 | - | ||
| 306 | // 根据地理名称获取百度经纬度坐标 | 273 | // 根据地理名称获取百度经纬度坐标 |
| 307 | localSearchFromAdreesToPoint: function (Address, callback) { | 274 | localSearchFromAdreesToPoint: function (Address, callback) { |
| 308 | - | ||
| 309 | // 创建一个搜索类实例 | 275 | // 创建一个搜索类实例 |
| 310 | var localSearch = new BMap.LocalSearch(mapBValue); | 276 | var localSearch = new BMap.LocalSearch(mapBValue); |
| 311 | - | ||
| 312 | // 检索完成后的回调函数。 | 277 | // 检索完成后的回调函数。 |
| 313 | localSearch.setSearchCompleteCallback(function (searchResult) { | 278 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| 314 | - | ||
| 315 | var resultPoints = ''; | 279 | var resultPoints = ''; |
| 316 | - | ||
| 317 | if (searchResult) { | 280 | if (searchResult) { |
| 318 | - | ||
| 319 | // 返回索引指定的结果。索引0表示第1条结果 | 281 | // 返回索引指定的结果。索引0表示第1条结果 |
| 320 | var poi = searchResult.getPoi(0); | 282 | var poi = searchResult.getPoi(0); |
| 321 | - | ||
| 322 | if (poi) { | 283 | if (poi) { |
| 323 | - | ||
| 324 | //获取经度和纬度 | 284 | //获取经度和纬度 |
| 325 | resultPoints = poi.point.lng + ' ' + poi.point.lat; | 285 | resultPoints = poi.point.lng + ' ' + poi.point.lat; |
| 326 | - | ||
| 327 | callback && callback(resultPoints); | 286 | callback && callback(resultPoints); |
| 328 | - | ||
| 329 | } else { | 287 | } else { |
| 330 | - | ||
| 331 | callback && callback(false); | 288 | callback && callback(false); |
| 332 | - | ||
| 333 | } | 289 | } |
| 334 | - | ||
| 335 | } else { | 290 | } else { |
| 336 | - | ||
| 337 | callback && callback(false); | 291 | callback && callback(false); |
| 338 | } | 292 | } |
| 339 | - | ||
| 340 | }); | 293 | }); |
| 341 | - | ||
| 342 | // 根据检索词发起检索。 | 294 | // 根据检索词发起检索。 |
| 343 | localSearch.search(Address); | 295 | localSearch.search(Address); |
| 344 | - | ||
| 345 | }, | 296 | }, |
| 346 | 297 | ||
| 347 | - // 编辑图形 | 298 | + // 编辑站点 |
| 348 | editShapes: function (obj) { | 299 | editShapes: function (obj) { |
| 349 | // 关闭信息窗口 | 300 | // 关闭信息窗口 |
| 350 | mapBValue.closeInfoWindow(); | 301 | mapBValue.closeInfoWindow(); |
| 351 | - | ||
| 352 | // 清除marker | 302 | // 清除marker |
| 353 | // mapBValue.removeOverlay(marker); | 303 | // mapBValue.removeOverlay(marker); |
| 354 | var station = obj.getEitdStation(); | 304 | var station = obj.getEitdStation(); |
| 355 | var stationShapesTypeV = station.stationShapesType; | 305 | var stationShapesTypeV = station.stationShapesType; |
| 306 | + setDragMarker(stationMarkers[station.stationRouteId]); | ||
| 356 | // 编辑圆 | 307 | // 编辑圆 |
| 357 | if (stationShapesTypeV == 'r') { | 308 | if (stationShapesTypeV == 'r') { |
| 358 | - | ||
| 359 | // 获取中心坐标点字符串分割 | 309 | // 获取中心坐标点字符串分割 |
| 360 | var BJwpoints = station.stationJwpoints.split(' '); | 310 | var BJwpoints = station.stationJwpoints.split(' '); |
| 361 | // 中心坐标点 | 311 | // 中心坐标点 |
| 362 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); | 312 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); |
| 363 | //创建圆 | 313 | //创建圆 |
| 364 | - circle = new BMap.Circle(point, station.stationRadius, { | 314 | + var circle = new BMap.Circle(point, station.stationRadius, { |
| 365 | strokeColor: "blue", | 315 | strokeColor: "blue", |
| 366 | strokeWeight: 2, | 316 | strokeWeight: 2, |
| 367 | strokeOpacity: 0.7 | 317 | strokeOpacity: 0.7 |
| 368 | }); | 318 | }); |
| 319 | + mapBValue.centerAndZoom(point, 18); | ||
| 320 | + editCircle = circle; | ||
| 369 | // 允许覆盖物在map.clearOverlays方法中被清除 | 321 | // 允许覆盖物在map.clearOverlays方法中被清除 |
| 370 | circle.enableMassClear(); | 322 | circle.enableMassClear(); |
| 371 | // 百度地图添加覆盖物圆 | 323 | // 百度地图添加覆盖物圆 |
| @@ -378,7 +330,7 @@ window.WorldsBMap = function () { | @@ -378,7 +330,7 @@ window.WorldsBMap = function () { | ||
| 378 | var newRadius = circle.getRadius(); | 330 | var newRadius = circle.getRadius(); |
| 379 | // 返回圆形的中心点坐标。 | 331 | // 返回圆形的中心点坐标。 |
| 380 | var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | 332 | var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; |
| 381 | - var centre_New = [{potion: {lng: circle.getCenter().lng, lat: circle.getCenter().lat}}]; | 333 | + // var centre_points = [{potion: {lng: circle.getCenter().lng, lat: circle.getCenter().lat}}]; |
| 382 | /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | 334 | /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ |
| 383 | EditStationObj.setEitdStationJwpoints(newCenter); | 335 | EditStationObj.setEitdStationJwpoints(newCenter); |
| 384 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | 336 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ |
| @@ -387,13 +339,14 @@ window.WorldsBMap = function () { | @@ -387,13 +339,14 @@ window.WorldsBMap = function () { | ||
| 387 | EditStationObj.setEitdStationRadius(Math.round(newRadius)); | 339 | EditStationObj.setEitdStationRadius(Math.round(newRadius)); |
| 388 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | 340 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 389 | EditStationObj.setEitdBPolygonGrid(''); | 341 | EditStationObj.setEitdBPolygonGrid(''); |
| 342 | + // 清除正在编辑的站点 | ||
| 343 | + editCircle = null; | ||
| 390 | // 加载编辑页面 | 344 | // 加载编辑页面 |
| 391 | $.get('edit.html', function (m) { | 345 | $.get('edit.html', function (m) { |
| 392 | $(pjaxContainer).append(m); | 346 | $(pjaxContainer).append(m); |
| 393 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); | 347 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); |
| 394 | }); | 348 | }); |
| 395 | }); | 349 | }); |
| 396 | - | ||
| 397 | // 编辑多变行 | 350 | // 编辑多变行 |
| 398 | } else if (stationShapesTypeV == 'd') { | 351 | } else if (stationShapesTypeV == 'd') { |
| 399 | // 获取中心点坐标字符串 | 352 | // 获取中心点坐标字符串 |
| @@ -413,9 +366,8 @@ window.WorldsBMap = function () { | @@ -413,9 +366,8 @@ window.WorldsBMap = function () { | ||
| 413 | for (var v = 0; v < pointPolygonArray.length; v++) { | 366 | for (var v = 0; v < pointPolygonArray.length; v++) { |
| 414 | polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0], pointPolygonArray[v].split(" ")[1])); | 367 | polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0], pointPolygonArray[v].split(" ")[1])); |
| 415 | } | 368 | } |
| 416 | - | ||
| 417 | // 画多边形 | 369 | // 画多边形 |
| 418 | - polygon = new BMap.Polygon(polygonP, { | 370 | + var polygon = new BMap.Polygon(polygonP, { |
| 419 | // 线条显色 | 371 | // 线条显色 |
| 420 | strokeColor: "blue", | 372 | strokeColor: "blue", |
| 421 | // 边线的宽度,以像素为单位。 | 373 | // 边线的宽度,以像素为单位。 |
| @@ -423,92 +375,46 @@ window.WorldsBMap = function () { | @@ -423,92 +375,46 @@ window.WorldsBMap = function () { | ||
| 423 | // 边线透明度,取值范围0 - 1。 | 375 | // 边线透明度,取值范围0 - 1。 |
| 424 | strokeOpacity: 0.7 | 376 | strokeOpacity: 0.7 |
| 425 | }); | 377 | }); |
| 426 | - | 378 | + mapBValue.centerAndZoom(pointPolygon, 18); |
| 379 | + editPolygon = polygon; | ||
| 427 | // 增加地图覆盖物多边形 | 380 | // 增加地图覆盖物多边形 |
| 428 | mapBValue.addOverlay(polygon); | 381 | mapBValue.addOverlay(polygon); |
| 429 | - | ||
| 430 | // 开启编辑功能(自 1.1 新增) | 382 | // 开启编辑功能(自 1.1 新增) |
| 431 | polygon.enableEditing(); | 383 | polygon.enableEditing(); |
| 432 | - | ||
| 433 | // 添加多变行编辑事件 | 384 | // 添加多变行编辑事件 |
| 434 | polygon.addEventListener('dblclick', function (e) { | 385 | polygon.addEventListener('dblclick', function (e) { |
| 435 | - | ||
| 436 | // 获取编辑的多边形对象 | 386 | // 获取编辑的多边形对象 |
| 437 | var edit_pointE = polygon; | 387 | var edit_pointE = polygon; |
| 438 | - | ||
| 439 | var edit_bPloygonGrid = ""; | 388 | var edit_bPloygonGrid = ""; |
| 440 | - | ||
| 441 | var editPolyGonLen_ = edit_pointE.getPath().length; | 389 | var editPolyGonLen_ = edit_pointE.getPath().length; |
| 442 | - | ||
| 443 | for (var k = 0; k < editPolyGonLen_; k++) { | 390 | for (var k = 0; k < editPolyGonLen_; k++) { |
| 444 | - | ||
| 445 | if (k == 0) { | 391 | if (k == 0) { |
| 446 | - | ||
| 447 | edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | 392 | edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; |
| 448 | - | ||
| 449 | } else { | 393 | } else { |
| 450 | - | ||
| 451 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | 394 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; |
| 452 | - | ||
| 453 | } | 395 | } |
| 454 | - | ||
| 455 | } | 396 | } |
| 456 | - | ||
| 457 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | 397 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; |
| 458 | - | ||
| 459 | // 多边形中心点 | 398 | // 多边形中心点 |
| 460 | - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | ||
| 461 | - | ||
| 462 | - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | ||
| 463 | - EditStationObj.setEitdStationJwpoints(centre_points); | ||
| 464 | - | 399 | + // var centre = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; |
| 400 | + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) centerPoint可拖动点 */ | ||
| 401 | + EditStationObj.setEitdStationJwpoints(centerPoint.lng+' '+centerPoint.lat); | ||
| 465 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | 402 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ |
| 466 | EditStationObj.setEitdStationShapesType('d'); | 403 | EditStationObj.setEitdStationShapesType('d'); |
| 467 | - | ||
| 468 | /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ | 404 | /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ |
| 469 | EditStationObj.setEitdStationRadius(''); | 405 | EditStationObj.setEitdStationRadius(''); |
| 470 | - | ||
| 471 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | 406 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 472 | EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); | 407 | EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); |
| 473 | - | 408 | + // 清除正在编辑的站点 |
| 409 | + editPolygon = null; | ||
| 474 | $.get('edit.html', function (m) { | 410 | $.get('edit.html', function (m) { |
| 475 | - | ||
| 476 | $(pjaxContainer).append(m); | 411 | $(pjaxContainer).append(m); |
| 477 | - | ||
| 478 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); | 412 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); |
| 479 | - | ||
| 480 | }); | 413 | }); |
| 481 | - | ||
| 482 | }); | 414 | }); |
| 483 | - | ||
| 484 | } | 415 | } |
| 485 | - | ||
| 486 | }, | 416 | }, |
| 487 | 417 | ||
| 488 | - // 在地图上画出上行线路走向 | ||
| 489 | - /*drawingUpline: function (polylineArray, polyline_center, data) { | ||
| 490 | - /!*WorldsBMap.clearMarkAndOverlays();*!/ | ||
| 491 | - polyUpline = ''; | ||
| 492 | - // 创建线路走向 | ||
| 493 | - polyUpline = new BMap.Polyline(polylineArray, {strokeColor: "red", strokeWeight: 6, strokeOpacity: 0.7}); | ||
| 494 | - // polyUpline.data = data; | ||
| 495 | - // 把折线添加到地图上 | ||
| 496 | - mapBValue.addOverlay(polyUpline); | ||
| 497 | - /!*var ceter_index = Math.round(resultdata.length / 2); | ||
| 498 | - | ||
| 499 | - var ceterPointsStr = resultdata[ceter_index].bJwpoints; | ||
| 500 | - | ||
| 501 | - var ceterPointsArray = ceterPointsStr.split(' '); | ||
| 502 | - | ||
| 503 | - var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);*!/ | ||
| 504 | - var PanOptions_ = {noAnimation: true}; | ||
| 505 | - mapBValue.reset(); | ||
| 506 | - mapBValue.panTo(polyline_center, PanOptions_); | ||
| 507 | - mapBValue.panBy(500, -510, PanOptions_); | ||
| 508 | - mapBValue.setZoom(14); | ||
| 509 | - },*/ | ||
| 510 | - | ||
| 511 | - | ||
| 512 | // 画路段走向 | 418 | // 画路段走向 |
| 513 | drawingUpline01: function (polyline_center, datas) { | 419 | drawingUpline01: function (polyline_center, datas) { |
| 514 | if (polyline_center && datas) { | 420 | if (polyline_center && datas) { |
| @@ -558,8 +464,9 @@ window.WorldsBMap = function () { | @@ -558,8 +464,9 @@ window.WorldsBMap = function () { | ||
| 558 | }); | 464 | }); |
| 559 | sectionArray.push(polyUpline01); | 465 | sectionArray.push(polyUpline01); |
| 560 | } | 466 | } |
| 561 | - mapBValue.setCenter(polyline_center); | ||
| 562 | - mapBValue.setZoom(15); | 467 | + // mapBValue.setCenter(polyline_center); |
| 468 | + mapBValue.panTo(polyline_center); | ||
| 469 | + // mapBValue.setZoom(15); | ||
| 563 | // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | 470 | // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) |
| 564 | // polyUpline01.disableMassClear(); | 471 | // polyUpline01.disableMassClear(); |
| 565 | } | 472 | } |
| @@ -595,6 +502,7 @@ window.WorldsBMap = function () { | @@ -595,6 +502,7 @@ window.WorldsBMap = function () { | ||
| 595 | WorldsBMap.openStationInfoWin(station); | 502 | WorldsBMap.openStationInfoWin(station); |
| 596 | }); | 503 | }); |
| 597 | stationArray[station.stationRouteId] = station; | 504 | stationArray[station.stationRouteId] = station; |
| 505 | + stationMarkers[station.stationRouteId] = myRichMarker1; | ||
| 598 | }, | 506 | }, |
| 599 | 507 | ||
| 600 | // 站点名称获取百度坐标(手动规划) | 508 | // 站点名称获取百度坐标(手动规划) |
| @@ -725,99 +633,44 @@ window.WorldsBMap = function () { | @@ -725,99 +633,44 @@ window.WorldsBMap = function () { | ||
| 725 | localtionPoint: function (stationNameV) { | 633 | localtionPoint: function (stationNameV) { |
| 726 | // 关闭信息窗口 | 634 | // 关闭信息窗口 |
| 727 | mapBValue.closeInfoWindow(); | 635 | mapBValue.closeInfoWindow(); |
| 728 | - | ||
| 729 | WorldsBMap.localSearchFromAdreesToPoint(stationNameV, function (Points) { | 636 | WorldsBMap.localSearchFromAdreesToPoint(stationNameV, function (Points) { |
| 730 | - | ||
| 731 | if (Points) { | 637 | if (Points) { |
| 732 | - | ||
| 733 | var BJwpointsArray = Points.split(' '); | 638 | var BJwpointsArray = Points.split(' '); |
| 734 | - | ||
| 735 | var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | 639 | var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); |
| 736 | - | ||
| 737 | var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | 640 | var marker_stargt2 = new BMap.Marker(stationNameChangePoint); |
| 738 | - | ||
| 739 | - var PanOptions = {noAnimation: true}; | ||
| 740 | - | ||
| 741 | - mapBValue.panTo(stationNameChangePoint, PanOptions); | ||
| 742 | - | ||
| 743 | - mapBValue.panBy(0, -100); | ||
| 744 | - | 641 | + mapBValue.panTo(stationNameChangePoint); |
| 745 | // 将标注添加到地图中 | 642 | // 将标注添加到地图中 |
| 746 | mapBValue.addOverlay(marker_stargt2); | 643 | mapBValue.addOverlay(marker_stargt2); |
| 747 | - | ||
| 748 | //跳动的动画 | 644 | //跳动的动画 |
| 749 | marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | 645 | marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); |
| 750 | - | ||
| 751 | } | 646 | } |
| 752 | - | ||
| 753 | }); | 647 | }); |
| 754 | - | ||
| 755 | }, | 648 | }, |
| 756 | 649 | ||
| 757 | /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ | 650 | /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ |
| 758 | getBmapStationNames: function (lineNameValue, i, callback) { | 651 | getBmapStationNames: function (lineNameValue, i, callback) { |
| 759 | - | ||
| 760 | var busline = new BMap.BusLineSearch(mapBValue, { | 652 | var busline = new BMap.BusLineSearch(mapBValue, { |
| 761 | - | ||
| 762 | // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 | 653 | // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 |
| 763 | onGetBusListComplete: function (BusListResult) { | 654 | onGetBusListComplete: function (BusListResult) { |
| 764 | - | ||
| 765 | // 如果不为空 | 655 | // 如果不为空 |
| 766 | if (BusListResult) { | 656 | if (BusListResult) { |
| 767 | - | ||
| 768 | //获取第一个公交列表显示到map上 | 657 | //获取第一个公交列表显示到map上 |
| 769 | var fstLine = BusListResult.getBusListItem(i); | 658 | var fstLine = BusListResult.getBusListItem(i); |
| 770 | - | ||
| 771 | - /*if(fstLine==undefined){ | ||
| 772 | - | ||
| 773 | - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | ||
| 774 | - | ||
| 775 | - layer.closeAll(); | ||
| 776 | - | ||
| 777 | - if(i==0){ | ||
| 778 | - | ||
| 779 | - $('#upToolsMobal').show(); | ||
| 780 | - | ||
| 781 | - }else if(i==1){ | ||
| 782 | - | ||
| 783 | - $('#downToolsMobal').show(); | ||
| 784 | - | ||
| 785 | - } | ||
| 786 | - | ||
| 787 | - return; | ||
| 788 | - }); | ||
| 789 | - | ||
| 790 | - }*/ | ||
| 791 | - | ||
| 792 | if (fstLine == undefined) { | 659 | if (fstLine == undefined) { |
| 793 | - | ||
| 794 | - | ||
| 795 | callback && callback(null); | 660 | callback && callback(null); |
| 796 | - | ||
| 797 | } | 661 | } |
| 798 | - | ||
| 799 | busline.getBusLine(fstLine); | 662 | busline.getBusLine(fstLine); |
| 800 | - | ||
| 801 | } | 663 | } |
| 802 | - | ||
| 803 | }, | 664 | }, |
| 804 | - | ||
| 805 | //设置公交线路查询后的回调函数.参数:rs: BusLine类型 | 665 | //设置公交线路查询后的回调函数.参数:rs: BusLine类型 |
| 806 | onGetBusLineComplete: function (BusLine) { | 666 | onGetBusLineComplete: function (BusLine) { |
| 807 | - | ||
| 808 | // 如果不为空 | 667 | // 如果不为空 |
| 809 | if (BusLine) { | 668 | if (BusLine) { |
| 810 | - | ||
| 811 | callback && callback(BusLine); | 669 | callback && callback(BusLine); |
| 812 | - | ||
| 813 | } | 670 | } |
| 814 | - | ||
| 815 | } | 671 | } |
| 816 | - | ||
| 817 | }); | 672 | }); |
| 818 | - | ||
| 819 | busline.getBusList(lineNameValue); | 673 | busline.getBusList(lineNameValue); |
| 820 | - | ||
| 821 | }, | 674 | }, |
| 822 | // 修改站点 | 675 | // 修改站点 |
| 823 | editStation: function (stationRouteId) { | 676 | editStation: function (stationRouteId) { |
| @@ -952,6 +805,9 @@ window.WorldsBMap = function () { | @@ -952,6 +805,9 @@ window.WorldsBMap = function () { | ||
| 952 | break; | 805 | break; |
| 953 | } | 806 | } |
| 954 | } | 807 | } |
| 808 | + // 路段中间点为中心 | ||
| 809 | + var c = p.ia[Math.floor(p.ia.length/2)]; | ||
| 810 | + mapBValue.centerAndZoom(new BMap.Point(c.lng, c.lat), 18); | ||
| 955 | p.addEventListener('dblclick', function () { | 811 | p.addEventListener('dblclick', function () { |
| 956 | /** 设置修改路段集合对象为空 */ | 812 | /** 设置修改路段集合对象为空 */ |
| 957 | editPolyline = ''; | 813 | editPolyline = ''; |
| @@ -1230,8 +1086,7 @@ window.WorldsBMap = function () { | @@ -1230,8 +1086,7 @@ window.WorldsBMap = function () { | ||
| 1230 | }); | 1086 | }); |
| 1231 | //开启信息窗口 | 1087 | //开启信息窗口 |
| 1232 | mapBValue.openInfoWindow(infoWindow_target, centerPoint); | 1088 | mapBValue.openInfoWindow(infoWindow_target, centerPoint); |
| 1233 | - mapBValue.setZoom(18); | ||
| 1234 | - mapBValue.setCenter(centerPoint); | 1089 | + mapBValue.panTo(centerPoint); |
| 1235 | }, | 1090 | }, |
| 1236 | /** | 1091 | /** |
| 1237 | * 绘制新增路段 | 1092 | * 绘制新增路段 |
| @@ -1310,7 +1165,7 @@ window.WorldsBMap = function () { | @@ -1310,7 +1165,7 @@ window.WorldsBMap = function () { | ||
| 1310 | strGetLength: function (str) { | 1165 | strGetLength: function (str) { |
| 1311 | return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度 | 1166 | return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度 |
| 1312 | } | 1167 | } |
| 1313 | - } | 1168 | + }; |
| 1314 | 1169 | ||
| 1315 | return Bmap; | 1170 | return Bmap; |
| 1316 | 1171 |
src/main/resources/static/pages/base/stationroute/list.html
| @@ -255,6 +255,7 @@ | @@ -255,6 +255,7 @@ | ||
| 255 | </div> | 255 | </div> |
| 256 | </div> | 256 | </div> |
| 257 | </div> | 257 | </div> |
| 258 | +<script src="/assets/js/baidu/bd_GeoUtils_min.js" ></script> | ||
| 258 | <!-- 线路类 --> | 259 | <!-- 线路类 --> |
| 259 | <script src="/pages/base/stationroute/js/line.js"></script> | 260 | <script src="/pages/base/stationroute/js/line.js"></script> |
| 260 | <!-- 新增站点对象类 --> | 261 | <!-- 新增站点对象类 --> |