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 | 743 | try { |
| 744 | 744 | // 获取线路ID |
| 745 | 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 | 747 | /** 查询线路信息 @param:<lineId:线路ID> */ |
| 747 | 748 | Line line = lineRepository.findOne(lineId); |
| 748 | 749 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ |
| ... | ... | @@ -778,7 +779,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 778 | 779 | textStr = newTextFileToFTP(objects,lineId);/** 双向行单文件内容 @param:<objects:站点路由;lineId:线路ID>*/ |
| 779 | 780 | else |
| 780 | 781 | resultMap.put("status","NOLinePlayType");// 线路无线路规划类型 |
| 781 | - textStr = line.getName() + " " + "2" + "\r" + textStr; | |
| 782 | + textStr = line.getName() + " " + fileVersions + "\r" + textStr; | |
| 782 | 783 | InputStream input = new ByteArrayInputStream(textStr.getBytes("gbk")); |
| 783 | 784 | /** 生成txt文件,上传ftp */ |
| 784 | 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 | 338 | layer.msg('请选中一条线路!'); |
| 339 | 339 | return ; |
| 340 | 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 | 190 | fun.linePanlThree(addLine.id,data,add_direction_v); |
| 191 | 191 | }); |
| 192 | 192 | fun.editMapStatusRemove(); |
| 193 | - } | |
| 193 | + setTimeout(function () { | |
| 194 | + var stationArray = map_.getStationArray(); | |
| 195 | + map_.openStationInfoWin(stationArray[editStationParmasObj.stationRouteId]); | |
| 196 | + },1000); | |
| 197 | + } | |
| 194 | 198 | // 编辑表单元素 |
| 195 | 199 | var form = $('#edit_station_form'); |
| 196 | 200 | // 获取错误提示元素 |
| ... | ... | @@ -206,9 +210,9 @@ $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,stati |
| 206 | 210 | errorClass : 'help-block help-block-error', |
| 207 | 211 | focusInvalid : false, |
| 208 | 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 | 216 | 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 |
| 213 | 217 | 'stationRouteCode' : {isStart : true},// 站点序号 |
| 214 | 218 | 'stationMark' : {required : true},// 站点类型 必填项 | ... | ... |
src/main/resources/static/pages/base/stationroute/edit_select.html
| ... | ... | @@ -14,10 +14,6 @@ |
| 14 | 14 | <button class="close" data-close="alert"></button> |
| 15 | 15 | 站点名称为必填项 |
| 16 | 16 | </div> |
| 17 | - <div class="alert alert-danger display-hide" id="serchrname"> | |
| 18 | - <button class="close" data-close="alert"></button> | |
| 19 | - 系统无法生成,请选择其他方式新增 | |
| 20 | - </div> | |
| 21 | 17 | <div class="form-group" id="formRequ"> |
| 22 | 18 | <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> |
| 23 | 19 | <div class="col-md-9" id="errorInfo"> |
| ... | ... | @@ -29,10 +25,13 @@ |
| 29 | 25 | <div class="col-md-9"> |
| 30 | 26 | <div class="icheck-list"> |
| 31 | 27 | <label> |
| 32 | - <input type="radio" class="icheck" name="editselect" value=0> 重新绘制位置 | |
| 28 | + <input type="radio" class="icheck" name="editselect" value=0> 重新绘制为多边形 | |
| 33 | 29 | </label> |
| 34 | 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 | 35 | </label> |
| 37 | 36 | </div> |
| 38 | 37 | </div> |
| ... | ... | @@ -124,6 +123,19 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed |
| 124 | 123 | map_.localtionPoint(editStationName+"公交站点"); |
| 125 | 124 | fun.editMapStatus(); |
| 126 | 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 | 139 | editStationObj.setEitdStation(Station); |
| 128 | 140 | editStationObj.setEitdStationName(editStationName); |
| 129 | 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 | 110 | ajaxd.getSectionRouteInfo(lineId,dir,function(data) { |
| 111 | 111 | fun.linePanlThree(lineId,data,dir); |
| 112 | 112 | }); |
| 113 | + setTimeout(function () { | |
| 114 | + map_.openSectionInfoWin(p); | |
| 115 | + },1000); | |
| 113 | 116 | } |
| 114 | 117 | // 编辑表单元素 |
| 115 | 118 | var form = $('#edit_section__form'); | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| ... | ... | @@ -24,9 +24,19 @@ |
| 24 | 24 | |
| 25 | 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 | 40 | var styleOptions = { |
| 31 | 41 | strokeColor:"blue", //边线颜色。 |
| 32 | 42 | fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。 |
| ... | ... | @@ -34,7 +44,39 @@ window.WorldsBMap = function () { |
| 34 | 44 | strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。 |
| 35 | 45 | fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。 |
| 36 | 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 | 81 | var Bmap = { |
| 40 | 82 | |
| ... | ... | @@ -44,7 +86,7 @@ window.WorldsBMap = function () { |
| 44 | 86 | // 百度API Key |
| 45 | 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 | 91 | mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); |
| 50 | 92 | //启用地图拖拽事件,默认启用(可不写) |
| ... | ... | @@ -62,24 +104,21 @@ window.WorldsBMap = function () { |
| 62 | 104 | getmapBValue: function () { |
| 63 | 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 | 110 | getIsEditStatus: function () { |
| 75 | 111 | return iseditStatus; |
| 76 | 112 | }, |
| 77 | - setMap_status : function (i) { | |
| 78 | - map_status = i; | |
| 79 | - }, | |
| 80 | 113 | setIsEditStatus: function (v) { |
| 81 | 114 | iseditStatus = v; |
| 82 | 115 | }, |
| 116 | + getStationArray: function () { | |
| 117 | + return stationArray; | |
| 118 | + }, | |
| 119 | + setStationArray : function (s) { | |
| 120 | + stationArray = s; | |
| 121 | + }, | |
| 83 | 122 | /*initDrawingManager: function (map, styleOptions) { |
| 84 | 123 | },*/ |
| 85 | 124 | getDrawingManagerObj: function () { |
| ... | ... | @@ -100,59 +139,35 @@ window.WorldsBMap = function () { |
| 100 | 139 | |
| 101 | 140 | /** 获取距离与时间 @param <points:坐标点集合> */ |
| 102 | 141 | getDistanceAndDuration: function (points, callback) { |
| 103 | - | |
| 104 | 142 | // 获取长度 |
| 105 | 143 | var len = points.length; |
| 106 | - | |
| 107 | 144 | (function () { |
| 108 | - | |
| 109 | 145 | if (!arguments.callee.count) { |
| 110 | - | |
| 111 | 146 | arguments.callee.count = 0; |
| 112 | - | |
| 113 | 147 | } |
| 114 | - | |
| 115 | 148 | arguments.callee.count++; |
| 116 | - | |
| 117 | 149 | var index = parseInt(arguments.callee.count) - 1; |
| 118 | - | |
| 119 | 150 | if (index >= len - 1) { |
| 120 | - | |
| 121 | 151 | callback && callback(points); |
| 122 | - | |
| 123 | 152 | return; |
| 124 | 153 | } |
| 125 | - | |
| 126 | 154 | // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) |
| 127 | 155 | var f = arguments.callee; |
| 128 | - | |
| 129 | 156 | // 起点坐标 <坐标格式:40.056878,116.30815> |
| 130 | 157 | var origin = points[index].potion.lat + ',' + points[index].potion.lng; |
| 131 | - | |
| 132 | 158 | // 终点坐标 <坐标格式:40.056878,116.30815> |
| 133 | 159 | var destination = points[index + 1].potion.lat + ',' + points[index + 1].potion.lng; |
| 134 | - | |
| 135 | 160 | var region = '上海'; |
| 136 | - | |
| 137 | 161 | var origin_region = '上海'; |
| 138 | - | |
| 139 | 162 | var destination_region = '上海'; |
| 140 | - | |
| 141 | 163 | var output = 'json'; |
| 142 | - | |
| 143 | 164 | var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; |
| 144 | - | |
| 145 | 165 | /** |
| 146 | 166 | * origin:起点名称或经纬度; |
| 147 | - * | |
| 148 | 167 | * destination:终点名称或经纬度; |
| 149 | - * | |
| 150 | 168 | * origin_region:起始点所在城市,驾车导航时必填。 |
| 151 | - * | |
| 152 | 169 | * destination_region:终点所在城市,驾车导航时必填。 |
| 153 | - * | |
| 154 | 170 | * output :表示输出类型,可设置为xml或json,默认为xml。 |
| 155 | - * | |
| 156 | 171 | **/ |
| 157 | 172 | var paramsB = { |
| 158 | 173 | origin: origin, |
| ... | ... | @@ -166,60 +181,40 @@ window.WorldsBMap = function () { |
| 166 | 181 | |
| 167 | 182 | /** @description :未认证开发者默认配额为:2000次/天。 */ |
| 168 | 183 | $.ajax({ |
| 169 | - | |
| 170 | 184 | // 百度地图根据坐标获取两点之间的时间与距离 |
| 171 | 185 | url: 'http://api.map.baidu.com/direction/v1?mode=transit', |
| 172 | - | |
| 173 | 186 | data: paramsB, |
| 174 | - | |
| 175 | 187 | dataType: 'jsonp', |
| 176 | - | |
| 177 | 188 | success: function (r) { |
| 178 | - | |
| 179 | 189 | if (r) { |
| 180 | - | |
| 181 | 190 | if (r.message == 'ok') { |
| 182 | - | |
| 183 | 191 | if (r.result.taxi == null) { |
| 184 | - | |
| 185 | 192 | // 获取距离(单位:米) |
| 186 | 193 | points[index + 1].distance = 0; |
| 187 | - | |
| 188 | 194 | // 获取时间(单位:秒) |
| 189 | 195 | points[index + 1].duration = 0; |
| 190 | - | |
| 191 | 196 | } else { |
| 192 | - | |
| 193 | 197 | // 获取距离(单位:米) |
| 194 | 198 | points[index + 1].distance = r.result.taxi.distance; |
| 195 | - | |
| 196 | 199 | // 获取时间(单位:秒) |
| 197 | 200 | points[index + 1].duration = r.result.taxi.duration; |
| 198 | - | |
| 199 | 201 | } |
| 200 | - | |
| 201 | - | |
| 202 | 202 | } |
| 203 | - | |
| 204 | 203 | } |
| 205 | - | |
| 206 | 204 | f(); |
| 207 | 205 | } |
| 208 | 206 | }); |
| 209 | - | |
| 210 | 207 | })(); |
| 211 | - | |
| 212 | 208 | }, |
| 209 | + | |
| 213 | 210 | // 打开站点信息窗口 |
| 214 | 211 | openStationInfoWin : function (objStation) { |
| 215 | 212 | // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) |
| 216 | - mapBValue.setZoom(25); | |
| 217 | 213 | if (objStation) { |
| 218 | 214 | // 站点形状 |
| 219 | 215 | var shapes = objStation.stationShapesType; |
| 220 | 216 | // 获取中心坐标点字符串分割 |
| 221 | 217 | var BJwpoints = objStation.stationJwpoints.split(' '); |
| 222 | - | |
| 223 | 218 | // 中心坐标点 |
| 224 | 219 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); |
| 225 | 220 | var width = WorldsBMap.strGetLength(objStation.stationRouteName) * 11; |
| ... | ... | @@ -270,102 +265,59 @@ window.WorldsBMap = function () { |
| 270 | 265 | //开启信息窗口 |
| 271 | 266 | mapBValue.openInfoWindow(infoWindow_target, point); |
| 272 | 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 | 274 | localSearchFromAdreesToPoint: function (Address, callback) { |
| 308 | - | |
| 309 | 275 | // 创建一个搜索类实例 |
| 310 | 276 | var localSearch = new BMap.LocalSearch(mapBValue); |
| 311 | - | |
| 312 | 277 | // 检索完成后的回调函数。 |
| 313 | 278 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| 314 | - | |
| 315 | 279 | var resultPoints = ''; |
| 316 | - | |
| 317 | 280 | if (searchResult) { |
| 318 | - | |
| 319 | 281 | // 返回索引指定的结果。索引0表示第1条结果 |
| 320 | 282 | var poi = searchResult.getPoi(0); |
| 321 | - | |
| 322 | 283 | if (poi) { |
| 323 | - | |
| 324 | 284 | //获取经度和纬度 |
| 325 | 285 | resultPoints = poi.point.lng + ' ' + poi.point.lat; |
| 326 | - | |
| 327 | 286 | callback && callback(resultPoints); |
| 328 | - | |
| 329 | 287 | } else { |
| 330 | - | |
| 331 | 288 | callback && callback(false); |
| 332 | - | |
| 333 | 289 | } |
| 334 | - | |
| 335 | 290 | } else { |
| 336 | - | |
| 337 | 291 | callback && callback(false); |
| 338 | 292 | } |
| 339 | - | |
| 340 | 293 | }); |
| 341 | - | |
| 342 | 294 | // 根据检索词发起检索。 |
| 343 | 295 | localSearch.search(Address); |
| 344 | - | |
| 345 | 296 | }, |
| 346 | 297 | |
| 347 | - // 编辑图形 | |
| 298 | + // 编辑站点 | |
| 348 | 299 | editShapes: function (obj) { |
| 349 | 300 | // 关闭信息窗口 |
| 350 | 301 | mapBValue.closeInfoWindow(); |
| 351 | - | |
| 352 | 302 | // 清除marker |
| 353 | 303 | // mapBValue.removeOverlay(marker); |
| 354 | 304 | var station = obj.getEitdStation(); |
| 355 | 305 | var stationShapesTypeV = station.stationShapesType; |
| 306 | + setDragMarker(stationMarkers[station.stationRouteId]); | |
| 356 | 307 | // 编辑圆 |
| 357 | 308 | if (stationShapesTypeV == 'r') { |
| 358 | - | |
| 359 | 309 | // 获取中心坐标点字符串分割 |
| 360 | 310 | var BJwpoints = station.stationJwpoints.split(' '); |
| 361 | 311 | // 中心坐标点 |
| 362 | 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 | 315 | strokeColor: "blue", |
| 366 | 316 | strokeWeight: 2, |
| 367 | 317 | strokeOpacity: 0.7 |
| 368 | 318 | }); |
| 319 | + mapBValue.centerAndZoom(point, 18); | |
| 320 | + editCircle = circle; | |
| 369 | 321 | // 允许覆盖物在map.clearOverlays方法中被清除 |
| 370 | 322 | circle.enableMassClear(); |
| 371 | 323 | // 百度地图添加覆盖物圆 |
| ... | ... | @@ -378,7 +330,7 @@ window.WorldsBMap = function () { |
| 378 | 330 | var newRadius = circle.getRadius(); |
| 379 | 331 | // 返回圆形的中心点坐标。 |
| 380 | 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 | 334 | /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ |
| 383 | 335 | EditStationObj.setEitdStationJwpoints(newCenter); |
| 384 | 336 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ |
| ... | ... | @@ -387,13 +339,14 @@ window.WorldsBMap = function () { |
| 387 | 339 | EditStationObj.setEitdStationRadius(Math.round(newRadius)); |
| 388 | 340 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 389 | 341 | EditStationObj.setEitdBPolygonGrid(''); |
| 342 | + // 清除正在编辑的站点 | |
| 343 | + editCircle = null; | |
| 390 | 344 | // 加载编辑页面 |
| 391 | 345 | $.get('edit.html', function (m) { |
| 392 | 346 | $(pjaxContainer).append(m); |
| 393 | 347 | $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]); |
| 394 | 348 | }); |
| 395 | 349 | }); |
| 396 | - | |
| 397 | 350 | // 编辑多变行 |
| 398 | 351 | } else if (stationShapesTypeV == 'd') { |
| 399 | 352 | // 获取中心点坐标字符串 |
| ... | ... | @@ -413,9 +366,8 @@ window.WorldsBMap = function () { |
| 413 | 366 | for (var v = 0; v < pointPolygonArray.length; v++) { |
| 414 | 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 | 372 | strokeColor: "blue", |
| 421 | 373 | // 边线的宽度,以像素为单位。 |
| ... | ... | @@ -423,92 +375,46 @@ window.WorldsBMap = function () { |
| 423 | 375 | // 边线透明度,取值范围0 - 1。 |
| 424 | 376 | strokeOpacity: 0.7 |
| 425 | 377 | }); |
| 426 | - | |
| 378 | + mapBValue.centerAndZoom(pointPolygon, 18); | |
| 379 | + editPolygon = polygon; | |
| 427 | 380 | // 增加地图覆盖物多边形 |
| 428 | 381 | mapBValue.addOverlay(polygon); |
| 429 | - | |
| 430 | 382 | // 开启编辑功能(自 1.1 新增) |
| 431 | 383 | polygon.enableEditing(); |
| 432 | - | |
| 433 | 384 | // 添加多变行编辑事件 |
| 434 | 385 | polygon.addEventListener('dblclick', function (e) { |
| 435 | - | |
| 436 | 386 | // 获取编辑的多边形对象 |
| 437 | 387 | var edit_pointE = polygon; |
| 438 | - | |
| 439 | 388 | var edit_bPloygonGrid = ""; |
| 440 | - | |
| 441 | 389 | var editPolyGonLen_ = edit_pointE.getPath().length; |
| 442 | - | |
| 443 | 390 | for (var k = 0; k < editPolyGonLen_; k++) { |
| 444 | - | |
| 445 | 391 | if (k == 0) { |
| 446 | - | |
| 447 | 392 | edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; |
| 448 | - | |
| 449 | 393 | } else { |
| 450 | - | |
| 451 | 394 | edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; |
| 452 | - | |
| 453 | 395 | } |
| 454 | - | |
| 455 | 396 | } |
| 456 | - | |
| 457 | 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 | 402 | /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ |
| 466 | 403 | EditStationObj.setEitdStationShapesType('d'); |
| 467 | - | |
| 468 | 404 | /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ |
| 469 | 405 | EditStationObj.setEitdStationRadius(''); |
| 470 | - | |
| 471 | 406 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 472 | 407 | EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); |
| 473 | - | |
| 408 | + // 清除正在编辑的站点 | |
| 409 | + editPolygon = null; | |
| 474 | 410 | $.get('edit.html', function (m) { |
| 475 | - | |
| 476 | 411 | $(pjaxContainer).append(m); |
| 477 | - | |
| 478 | 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 | 419 | drawingUpline01: function (polyline_center, datas) { |
| 514 | 420 | if (polyline_center && datas) { |
| ... | ... | @@ -558,8 +464,9 @@ window.WorldsBMap = function () { |
| 558 | 464 | }); |
| 559 | 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 | 470 | // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) |
| 564 | 471 | // polyUpline01.disableMassClear(); |
| 565 | 472 | } |
| ... | ... | @@ -595,6 +502,7 @@ window.WorldsBMap = function () { |
| 595 | 502 | WorldsBMap.openStationInfoWin(station); |
| 596 | 503 | }); |
| 597 | 504 | stationArray[station.stationRouteId] = station; |
| 505 | + stationMarkers[station.stationRouteId] = myRichMarker1; | |
| 598 | 506 | }, |
| 599 | 507 | |
| 600 | 508 | // 站点名称获取百度坐标(手动规划) |
| ... | ... | @@ -725,99 +633,44 @@ window.WorldsBMap = function () { |
| 725 | 633 | localtionPoint: function (stationNameV) { |
| 726 | 634 | // 关闭信息窗口 |
| 727 | 635 | mapBValue.closeInfoWindow(); |
| 728 | - | |
| 729 | 636 | WorldsBMap.localSearchFromAdreesToPoint(stationNameV, function (Points) { |
| 730 | - | |
| 731 | 637 | if (Points) { |
| 732 | - | |
| 733 | 638 | var BJwpointsArray = Points.split(' '); |
| 734 | - | |
| 735 | 639 | var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); |
| 736 | - | |
| 737 | 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 | 643 | mapBValue.addOverlay(marker_stargt2); |
| 747 | - | |
| 748 | 644 | //跳动的动画 |
| 749 | 645 | marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); |
| 750 | - | |
| 751 | 646 | } |
| 752 | - | |
| 753 | 647 | }); |
| 754 | - | |
| 755 | 648 | }, |
| 756 | 649 | |
| 757 | 650 | /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ |
| 758 | 651 | getBmapStationNames: function (lineNameValue, i, callback) { |
| 759 | - | |
| 760 | 652 | var busline = new BMap.BusLineSearch(mapBValue, { |
| 761 | - | |
| 762 | 653 | // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 |
| 763 | 654 | onGetBusListComplete: function (BusListResult) { |
| 764 | - | |
| 765 | 655 | // 如果不为空 |
| 766 | 656 | if (BusListResult) { |
| 767 | - | |
| 768 | 657 | //获取第一个公交列表显示到map上 |
| 769 | 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 | 659 | if (fstLine == undefined) { |
| 793 | - | |
| 794 | - | |
| 795 | 660 | callback && callback(null); |
| 796 | - | |
| 797 | 661 | } |
| 798 | - | |
| 799 | 662 | busline.getBusLine(fstLine); |
| 800 | - | |
| 801 | 663 | } |
| 802 | - | |
| 803 | 664 | }, |
| 804 | - | |
| 805 | 665 | //设置公交线路查询后的回调函数.参数:rs: BusLine类型 |
| 806 | 666 | onGetBusLineComplete: function (BusLine) { |
| 807 | - | |
| 808 | 667 | // 如果不为空 |
| 809 | 668 | if (BusLine) { |
| 810 | - | |
| 811 | 669 | callback && callback(BusLine); |
| 812 | - | |
| 813 | 670 | } |
| 814 | - | |
| 815 | 671 | } |
| 816 | - | |
| 817 | 672 | }); |
| 818 | - | |
| 819 | 673 | busline.getBusList(lineNameValue); |
| 820 | - | |
| 821 | 674 | }, |
| 822 | 675 | // 修改站点 |
| 823 | 676 | editStation: function (stationRouteId) { |
| ... | ... | @@ -952,6 +805,9 @@ window.WorldsBMap = function () { |
| 952 | 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 | 811 | p.addEventListener('dblclick', function () { |
| 956 | 812 | /** 设置修改路段集合对象为空 */ |
| 957 | 813 | editPolyline = ''; |
| ... | ... | @@ -1230,8 +1086,7 @@ window.WorldsBMap = function () { |
| 1230 | 1086 | }); |
| 1231 | 1087 | //开启信息窗口 |
| 1232 | 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 | 1165 | strGetLength: function (str) { |
| 1311 | 1166 | return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度 |
| 1312 | 1167 | } |
| 1313 | - } | |
| 1168 | + }; | |
| 1314 | 1169 | |
| 1315 | 1170 | return Bmap; |
| 1316 | 1171 | ... | ... |
src/main/resources/static/pages/base/stationroute/list.html