Commit 7fe23b16fa1a8199209e724f143233a517f787ed
1 parent
27cda0bc
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
update...
Showing
17 changed files
with
569 additions
and
244 deletions
src/main/java/com/bsth/controller/sys/UserController.java
| @@ -73,9 +73,13 @@ public class UserController extends BaseController<SysUser, Integer> { | @@ -73,9 +73,13 @@ public class UserController extends BaseController<SysUser, Integer> { | ||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | //解密RSA | 75 | //解密RSA |
| 76 | - userName = RSAUtils.decryptBase64(userName); | ||
| 77 | - password = RSAUtils.decryptBase64(password); | ||
| 78 | - | 76 | + try { |
| 77 | + userName = RSAUtils.decryptBase64(userName); | ||
| 78 | + password = RSAUtils.decryptBase64(password); | ||
| 79 | + } catch (RuntimeException e) { | ||
| 80 | + return put(rs, "msg", "decrypt RSA fail!可能页面已过期,尝试刷新页面。"); | ||
| 81 | + } | ||
| 82 | + | ||
| 79 | SysUser user = sysUserService.findByUserName(userName); | 83 | SysUser user = sysUserService.findByUserName(userName); |
| 80 | if (null == user) | 84 | if (null == user) |
| 81 | return put(rs, "msg", "不存在的用户"); | 85 | return put(rs, "msg", "不存在的用户"); |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -472,7 +472,6 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -472,7 +472,6 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | public void put(ScheduleRealInfo sch) { | 474 | public void put(ScheduleRealInfo sch) { |
| 475 | - | ||
| 476 | schAttrCalculator | 475 | schAttrCalculator |
| 477 | .calcRealDate(sch) | 476 | .calcRealDate(sch) |
| 478 | .calcAllTimeByFcsj(sch); | 477 | .calcAllTimeByFcsj(sch); |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| 1 | package com.bsth.data.schedule; | 1 | package com.bsth.data.schedule; |
| 2 | 2 | ||
| 3 | -import java.text.ParseException; | ||
| 4 | -import java.util.ArrayList; | ||
| 5 | -import java.util.Collections; | ||
| 6 | -import java.util.List; | ||
| 7 | - | 3 | +import com.bsth.data.LineConfigData; |
| 4 | +import com.bsth.entity.realcontrol.LineConfig; | ||
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 8 | import org.joda.time.format.DateTimeFormat; | 6 | import org.joda.time.format.DateTimeFormat; |
| 9 | import org.joda.time.format.DateTimeFormatter; | 7 | import org.joda.time.format.DateTimeFormatter; |
| 10 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| @@ -12,9 +10,10 @@ import org.slf4j.LoggerFactory; | @@ -12,9 +10,10 @@ import org.slf4j.LoggerFactory; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 14 | 12 | ||
| 15 | -import com.bsth.data.LineConfigData; | ||
| 16 | -import com.bsth.entity.realcontrol.LineConfig; | ||
| 17 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | 13 | +import java.text.ParseException; |
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.Collections; | ||
| 16 | +import java.util.List; | ||
| 18 | 17 | ||
| 19 | /** | 18 | /** |
| 20 | * | 19 | * |
| @@ -49,11 +48,30 @@ public class SchAttrCalculator { | @@ -49,11 +48,30 @@ public class SchAttrCalculator { | ||
| 49 | if (null == sch.getFcsjT()) | 48 | if (null == sch.getFcsjT()) |
| 50 | calcFcsjTime(sch); | 49 | calcFcsjTime(sch); |
| 51 | 50 | ||
| 52 | - | 51 | + //計發時間 |
| 53 | if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ | 52 | if(sch.getFcsj().compareTo(conf.getStartOpt()) < 0){ |
| 54 | sch.setFcsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsj()) + DAY_TIME); | 53 | sch.setFcsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsj()) + DAY_TIME); |
| 55 | } | 54 | } |
| 56 | - | 55 | + |
| 56 | + //待發時間 | ||
| 57 | + if(sch.getDfsj().compareTo(conf.getStartOpt()) < 0){ | ||
| 58 | + sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj()) + DAY_TIME); | ||
| 59 | + } | ||
| 60 | + else | ||
| 61 | + sch.setDfsjAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getDfsj())); | ||
| 62 | + | ||
| 63 | + //實發時間 | ||
| 64 | + if(sch.getFcsjActual() != null && | ||
| 65 | + sch.getFcsjActual().compareTo(conf.getStartOpt()) < 0){ | ||
| 66 | + sch.setFcsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getFcsjActual()) + DAY_TIME); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + //實際終點時間 | ||
| 70 | + if(sch.getZdsjActual() != null && | ||
| 71 | + sch.getZdsjActual().compareTo(conf.getStartOpt()) < 0){ | ||
| 72 | + sch.setZdsjActualAll(fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr()+sch.getZdsjActual()) + DAY_TIME); | ||
| 73 | + } | ||
| 74 | + | ||
| 57 | sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT())); | 75 | sch.setRealExecDate(fmtyyyyMMdd.print(sch.getFcsjT())); |
| 58 | } catch (Exception e) { | 76 | } catch (Exception e) { |
| 59 | logger.error("", e); | 77 | logger.error("", e); |
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
| @@ -40,7 +40,7 @@ public class RealMapServiceImpl implements RealMapService { | @@ -40,7 +40,7 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 40 | } | 40 | } |
| 41 | inStr = " (" + inStr.substring(1) + ")"; | 41 | inStr = " (" + inStr.substring(1) + ")"; |
| 42 | 42 | ||
| 43 | - String sql = "select R.LINE_CODE,R.STATION_NAME,R.STATION_CODE,R.STATION_MARK,R.DIRECTIONS,R.DISTANCES,R.TO_TIME, R.VERSIONS,S.G_LONX,S.G_LATY,S.RADIUS,S.SHAPES_TYPE,ST_AsText(S.G_POLYGON_GRID) as G_POLYGON_GRID, R.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0"; | 43 | + String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0"; |
| 44 | 44 | ||
| 45 | List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class)); | 45 | List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class)); |
| 46 | rs.put("status", ResponseCode.SUCCESS); | 46 | rs.put("status", ResponseCode.SUCCESS); |
| @@ -59,7 +59,7 @@ public class RealMapServiceImpl implements RealMapService { | @@ -59,7 +59,7 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 59 | Map<String, Object> rs = new HashMap(); | 59 | Map<String, Object> rs = new HashMap(); |
| 60 | 60 | ||
| 61 | try { | 61 | try { |
| 62 | - String sql = "select ID, AREA,PARK_CODE,PARK_NAME,ST_AsText(G_PARK_POINT) as G_PARK_POINT,G_CENTER_POINT,RADIUS,SHAPES_TYPE from bsth_c_car_park WHERE destroy=0"; | 62 | + String sql = "select ID, AREA,PARK_CODE,PARK_NAME,ST_AsText(G_PARK_POINT) as G_PARK_POINT,G_CENTER_POINT,RADIUS,SHAPES_TYPE from bsth_c_car_park WHERE destroy=0 and shapes_type='d'"; |
| 63 | 63 | ||
| 64 | List<CarPark> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CarPark.class)); | 64 | List<CarPark> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CarPark.class)); |
| 65 | rs.put("status", ResponseCode.SUCCESS); | 65 | rs.put("status", ResponseCode.SUCCESS); |
src/main/resources/static/real_control_v2/fragments/north/tabs.html
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <script id="north-tabs-temp" type="text/html"> | 2 | <script id="north-tabs-temp" type="text/html"> |
| 3 | <ul class="uk-tab" data-uk-tab="{connect:'#main-tab-content'}"> | 3 | <ul class="uk-tab" data-uk-tab="{connect:'#main-tab-content'}"> |
| 4 | <li class="uk-active" ><a>主页</a></li> | 4 | <li class="uk-active" ><a>主页</a></li> |
| 5 | - <li class=""><a>地图</a></li> | 5 | + <li id="north_tabs_map_btn"><a>地图</a></li> |
| 6 | {{each list as line i}} | 6 | {{each list as line i}} |
| 7 | <li class="tab-line"><a>{{line.name}}(<span id="badge_untreated_num_{{line.lineCode}}">0</span>, <span id="badge_yfwf_num_{{line.lineCode}}">0</span>)</a></li> | 7 | <li class="tab-line"><a>{{line.name}}(<span id="badge_untreated_num_{{line.lineCode}}">0</span>, <span id="badge_yfwf_num_{{line.lineCode}}">0</span>)</a></li> |
| 8 | {{/each}} | 8 | {{/each}} |
| @@ -12,9 +12,9 @@ | @@ -12,9 +12,9 @@ | ||
| 12 | <script id="north-tab-content-temp" type="text/html"> | 12 | <script id="north-tab-content-temp" type="text/html"> |
| 13 | <ul id="main-tab-content" class="uk-switcher uk-margin "> | 13 | <ul id="main-tab-content" class="uk-switcher uk-margin "> |
| 14 | <li class="uk-active home-panel">主页</li> | 14 | <li class="uk-active home-panel">主页</li> |
| 15 | - <li class="map-panel">地图</li> | 15 | + <li class="map-panel">地图未渲染</li> |
| 16 | {{each list as line i}} | 16 | {{each list as line i}} |
| 17 | - <li class="line_schedule" data-id="{{line.lineCode}}">{{line.name}}</li> | 17 | + <li class="line_schedule" data-id="{{line.lineCode}}">{{line.name}} 未渲染</li> |
| 18 | {{/each}} | 18 | {{/each}} |
| 19 | </ul> | 19 | </ul> |
| 20 | </script> | 20 | </script> |
src/main/resources/static/real_control_v2/js/common.js
| 1 | -var gb_common = (function() { | 1 | +var gb_common = (function () { |
| 2 | 2 | ||
| 3 | - var reqCode80 = {0xA1: '请求恢复运营', 0xA2: '申请调档', 0xA3: '出场请求', 0xA5: '进场请求', 0xA7: '加油请求', 0x50: '车辆故障', 0x70: '路阻报告', 0x60: '事故报告', 0x11: '扣证纠纷', 0x12 : '报警'}; | 3 | + var reqCode80 = { |
| 4 | + 0xA1: '请求恢复运营', | ||
| 5 | + 0xA2: '申请调档', | ||
| 6 | + 0xA3: '出场请求', | ||
| 7 | + 0xA5: '进场请求', | ||
| 8 | + 0xA7: '加油请求', | ||
| 9 | + 0x50: '车辆故障', | ||
| 10 | + 0x70: '路阻报告', | ||
| 11 | + 0x60: '事故报告', | ||
| 12 | + 0x11: '扣证纠纷', | ||
| 13 | + 0x12: '报警' | ||
| 14 | + }; | ||
| 4 | 15 | ||
| 5 | - var groupBy = function(list, field) { | 16 | + var groupBy = function (list, field) { |
| 6 | var rs = {}, | 17 | var rs = {}, |
| 7 | key; | 18 | key; |
| 8 | - $.each(list, function() { | 19 | + $.each(list, function () { |
| 9 | key = this[field]; | 20 | key = this[field]; |
| 10 | if (!rs[key]) | 21 | if (!rs[key]) |
| 11 | rs[key] = []; | 22 | rs[key] = []; |
| @@ -16,10 +27,10 @@ var gb_common = (function() { | @@ -16,10 +27,10 @@ var gb_common = (function() { | ||
| 16 | return rs; | 27 | return rs; |
| 17 | } | 28 | } |
| 18 | 29 | ||
| 19 | - var compileTempByDom = function(dom, opts) { | 30 | + var compileTempByDom = function (dom, opts) { |
| 20 | var tps = {}, | 31 | var tps = {}, |
| 21 | id; | 32 | id; |
| 22 | - $('script[type="text/html"]', dom).each(function() { | 33 | + $('script[type="text/html"]', dom).each(function () { |
| 23 | id = $(this).attr('id'); | 34 | id = $(this).attr('id'); |
| 24 | if (id) | 35 | if (id) |
| 25 | tps[id] = template.compile($(this).html(), opts); | 36 | tps[id] = template.compile($(this).html(), opts); |
| @@ -27,46 +38,47 @@ var gb_common = (function() { | @@ -27,46 +38,47 @@ var gb_common = (function() { | ||
| 27 | return tps; | 38 | return tps; |
| 28 | } | 39 | } |
| 29 | 40 | ||
| 30 | - var $get = function(url, data, successFun) { | 41 | + var $get = function (url, data, successFun) { |
| 31 | $.ajax({ | 42 | $.ajax({ |
| 32 | url: url, | 43 | url: url, |
| 33 | data: data, | 44 | data: data, |
| 34 | - complete: function(xhr, ts) { | 45 | + complete: function (xhr, ts) { |
| 35 | ajaxComplete(xhr, ts, successFun); | 46 | ajaxComplete(xhr, ts, successFun); |
| 36 | } | 47 | } |
| 37 | }); | 48 | }); |
| 38 | } | 49 | } |
| 39 | 50 | ||
| 40 | - var $post = function(url, data, successFun) { | 51 | + var $post = function (url, data, successFun) { |
| 41 | $.ajax({ | 52 | $.ajax({ |
| 42 | url: url, | 53 | url: url, |
| 43 | method: 'POST', | 54 | method: 'POST', |
| 44 | data: data, | 55 | data: data, |
| 45 | - complete: function(xhr, ts) { | 56 | + complete: function (xhr, ts) { |
| 46 | ajaxComplete(xhr, ts, successFun); | 57 | ajaxComplete(xhr, ts, successFun); |
| 47 | } | 58 | } |
| 48 | }); | 59 | }); |
| 49 | } | 60 | } |
| 50 | 61 | ||
| 51 | - var $post_arr = function(url, data, successFun) { | 62 | + var $post_arr = function (url, data, successFun) { |
| 52 | $.ajax({ | 63 | $.ajax({ |
| 53 | url: url, | 64 | url: url, |
| 54 | method: 'POST', | 65 | method: 'POST', |
| 55 | traditional: true, | 66 | traditional: true, |
| 56 | data: data, | 67 | data: data, |
| 57 | - complete: function(xhr, ts) { | 68 | + complete: function (xhr, ts) { |
| 58 | ajaxComplete(xhr, ts, successFun); | 69 | ajaxComplete(xhr, ts, successFun); |
| 59 | } | 70 | } |
| 60 | }); | 71 | }); |
| 61 | } | 72 | } |
| 62 | 73 | ||
| 63 | - var $del = function(url, successFun){ | ||
| 64 | - $post(url, {'_method': 'delete'},function(rs){ | ||
| 65 | - successFun && successFun(rs); | ||
| 66 | - }); | 74 | + var $del = function (url, successFun) { |
| 75 | + $post(url, {'_method': 'delete'}, function (rs) { | ||
| 76 | + successFun && successFun(rs); | ||
| 77 | + }); | ||
| 67 | } | 78 | } |
| 68 | 79 | ||
| 69 | - var errorHead='<span style="color:red;">服务器出现异常:</span>'; | 80 | + var errorHead = '<span style="color:red;">服务器出现异常:</span>'; |
| 81 | + | ||
| 70 | function successHandle(json, handle) { | 82 | function successHandle(json, handle) { |
| 71 | var status = json.status; | 83 | var status = json.status; |
| 72 | if (status == 407) { | 84 | if (status == 407) { |
| @@ -81,7 +93,7 @@ var gb_common = (function() { | @@ -81,7 +93,7 @@ var gb_common = (function() { | ||
| 81 | } | 93 | } |
| 82 | 94 | ||
| 83 | if (status == 'ERROR') | 95 | if (status == 'ERROR') |
| 84 | - UIkit.modal.alert(errorHead+ (json.msg ? json.msg : '未知异常'), {labels:{Ok: '确定'}}); | 96 | + UIkit.modal.alert(errorHead + (json.msg ? json.msg : '未知异常'), {labels: {Ok: '确定'}}); |
| 85 | else | 97 | else |
| 86 | handle && handle(json); | 98 | handle && handle(json); |
| 87 | } | 99 | } |
| @@ -90,11 +102,11 @@ var gb_common = (function() { | @@ -90,11 +102,11 @@ var gb_common = (function() { | ||
| 90 | if (ts == 'success') { | 102 | if (ts == 'success') { |
| 91 | successHandle(JSON.parse(xhr.responseText), succ); | 103 | successHandle(JSON.parse(xhr.responseText), succ); |
| 92 | } else if (ts == 'error') { | 104 | } else if (ts == 'error') { |
| 93 | - UIkit.modal.alert(errorHead + xhr.responseText, {labels:{Ok: '确定'}}); | 105 | + UIkit.modal.alert(errorHead + xhr.responseText, {labels: {Ok: '确定'}}); |
| 94 | } | 106 | } |
| 95 | } | 107 | } |
| 96 | 108 | ||
| 97 | - var get_vals = function(json) { | 109 | + var get_vals = function (json) { |
| 98 | var array = []; | 110 | var array = []; |
| 99 | for (var key in json) { | 111 | for (var key in json) { |
| 100 | array.push(json[key]); | 112 | array.push(json[key]); |
| @@ -103,7 +115,7 @@ var gb_common = (function() { | @@ -103,7 +115,7 @@ var gb_common = (function() { | ||
| 103 | return array; | 115 | return array; |
| 104 | } | 116 | } |
| 105 | 117 | ||
| 106 | - var get_keys = function(json) { | 118 | + var get_keys = function (json) { |
| 107 | var array = []; | 119 | var array = []; |
| 108 | for (var key in json) { | 120 | for (var key in json) { |
| 109 | array.push(key); | 121 | array.push(key); |
| @@ -111,29 +123,34 @@ var gb_common = (function() { | @@ -111,29 +123,34 @@ var gb_common = (function() { | ||
| 111 | return array; | 123 | return array; |
| 112 | } | 124 | } |
| 113 | 125 | ||
| 114 | - var get_device_tree_data = function() { | 126 | + var get_device_tree_data = function (allGps, idBefore) { |
| 127 | + if(!idBefore) | ||
| 128 | + idBefore=''; | ||
| 115 | var treeData = []; | 129 | var treeData = []; |
| 116 | - var data = groupBy(get_vals(gb_data_gps.allGps), 'lineId'); | 130 | + //var data = groupBy(get_vals(gb_data_gps.allGps), 'lineId'); |
| 131 | + var data = groupBy(get_vals(allGps), 'lineId'); | ||
| 117 | var name; | 132 | var name; |
| 118 | for (var code in data) { | 133 | for (var code in data) { |
| 119 | name = gb_data_basic.codeToLine[code].name; | 134 | name = gb_data_basic.codeToLine[code].name; |
| 120 | data[name] = groupBy(data[code], 'upDown'); | 135 | data[name] = groupBy(data[code], 'upDown'); |
| 121 | treeData.push({ | 136 | treeData.push({ |
| 122 | 'text': name, | 137 | 'text': name, |
| 123 | - 'a_attr':{'type': 'line'}, | 138 | + 'a_attr': {'type': 'line', 'id': idBefore+'line_'+code}, |
| 124 | 'children': [{ | 139 | 'children': [{ |
| 125 | 'text': '上行', | 140 | 'text': '上行', |
| 126 | 'children': grabs(data[name][0]), | 141 | 'children': grabs(data[name][0]), |
| 127 | 'a_attr': { | 142 | 'a_attr': { |
| 128 | - 'type': 'route', | ||
| 129 | - 'route': code+'_0' | 143 | + 'type': 'route', |
| 144 | + 'route': code + '_0', | ||
| 145 | + 'id': idBefore+'route_' + code + '_0' | ||
| 130 | } | 146 | } |
| 131 | }, { | 147 | }, { |
| 132 | 'text': '下行', | 148 | 'text': '下行', |
| 133 | 'children': grabs(data[name][1]), | 149 | 'children': grabs(data[name][1]), |
| 134 | 'a_attr': { | 150 | 'a_attr': { |
| 135 | - 'type': 'route', | ||
| 136 | - 'route': code+'_1' | 151 | + 'type': 'route', |
| 152 | + 'route': code + '_1', | ||
| 153 | + 'id': idBefore+'route_' + code + '_1' | ||
| 137 | } | 154 | } |
| 138 | }] | 155 | }] |
| 139 | }); | 156 | }); |
| @@ -143,7 +160,7 @@ var gb_common = (function() { | @@ -143,7 +160,7 @@ var gb_common = (function() { | ||
| 143 | if (!array) | 160 | if (!array) |
| 144 | return; | 161 | return; |
| 145 | var rs = []; | 162 | var rs = []; |
| 146 | - $.each(array, function() { | 163 | + $.each(array, function () { |
| 147 | rs.push({ | 164 | rs.push({ |
| 148 | 'text': this.nbbm, | 165 | 'text': this.nbbm, |
| 149 | 'a_attr': { | 166 | 'a_attr': { |
| @@ -160,7 +177,7 @@ var gb_common = (function() { | @@ -160,7 +177,7 @@ var gb_common = (function() { | ||
| 160 | return treeData; | 177 | return treeData; |
| 161 | }; | 178 | }; |
| 162 | 179 | ||
| 163 | - var lineAutocomplete = function(element) { | 180 | + var lineAutocomplete = function (element) { |
| 164 | //construction data | 181 | //construction data |
| 165 | var data = [], | 182 | var data = [], |
| 166 | code2Name = gb_data_basic.lineCode2NameAll(), | 183 | code2Name = gb_data_basic.lineCode2NameAll(), |
| @@ -177,42 +194,42 @@ var gb_common = (function() { | @@ -177,42 +194,42 @@ var gb_common = (function() { | ||
| 177 | init_autocom_pinyin(element, data); | 194 | init_autocom_pinyin(element, data); |
| 178 | }; | 195 | }; |
| 179 | 196 | ||
| 180 | - var personAutocomplete = function(element, personMaps) { | 197 | + var personAutocomplete = function (element, personMaps) { |
| 181 | /*var data = [],name; | 198 | /*var data = [],name; |
| 182 | - for(var jobCode in personMaps){ | ||
| 183 | - name=personMaps[jobCode]; | ||
| 184 | - data.push({ | ||
| 185 | - value: jobCode+'/'+name, | ||
| 186 | - fullChars: pinyin.getFullChars(name).toUpperCase(), | ||
| 187 | - camelChars: pinyin.getCamelChars(name) | ||
| 188 | - }); | ||
| 189 | - }*/ | 199 | + for(var jobCode in personMaps){ |
| 200 | + name=personMaps[jobCode]; | ||
| 201 | + data.push({ | ||
| 202 | + value: jobCode+'/'+name, | ||
| 203 | + fullChars: pinyin.getFullChars(name).toUpperCase(), | ||
| 204 | + camelChars: pinyin.getCamelChars(name) | ||
| 205 | + }); | ||
| 206 | + }*/ | ||
| 190 | //init_autocom_pinyin(element, data); | 207 | //init_autocom_pinyin(element, data); |
| 191 | init_autocom_pinyin(element, gb_data_basic.allPersonnel()); | 208 | init_autocom_pinyin(element, gb_data_basic.allPersonnel()); |
| 192 | }; | 209 | }; |
| 193 | 210 | ||
| 194 | - var carAutocomplete=function(element, list){ | ||
| 195 | - var data = []; | ||
| 196 | - $.each(list, function(){ | ||
| 197 | - data.push({value: this}); | ||
| 198 | - }); | ||
| 199 | - init_autocomplete(element, data); | 211 | + var carAutocomplete = function (element, list) { |
| 212 | + var data = []; | ||
| 213 | + $.each(list, function () { | ||
| 214 | + data.push({value: this}); | ||
| 215 | + }); | ||
| 216 | + init_autocomplete(element, data); | ||
| 200 | } | 217 | } |
| 201 | 218 | ||
| 202 | - var init_autocom_pinyin=function(element, data){ | 219 | + var init_autocom_pinyin = function (element, data) { |
| 203 | // init autocomplete | 220 | // init autocomplete |
| 204 | var autocomplete = UIkit.autocomplete(element, { | 221 | var autocomplete = UIkit.autocomplete(element, { |
| 205 | minLength: 1, | 222 | minLength: 1, |
| 206 | delay: 50, | 223 | delay: 50, |
| 207 | - source: function(release) { | 224 | + source: function (release) { |
| 208 | var q = $('input', element).val().toUpperCase(), | 225 | var q = $('input', element).val().toUpperCase(), |
| 209 | rs = [], | 226 | rs = [], |
| 210 | count = 0; | 227 | count = 0; |
| 211 | 228 | ||
| 212 | - $.each(data, function() { | ||
| 213 | - if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1){ | ||
| 214 | - rs.push(this); | ||
| 215 | - count++; | 229 | + $.each(data, function () { |
| 230 | + if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1) { | ||
| 231 | + rs.push(this); | ||
| 232 | + count++; | ||
| 216 | } | 233 | } |
| 217 | 234 | ||
| 218 | if (count >= 10) | 235 | if (count >= 10) |
| @@ -224,26 +241,26 @@ var gb_common = (function() { | @@ -224,26 +241,26 @@ var gb_common = (function() { | ||
| 224 | }); | 241 | }); |
| 225 | } | 242 | } |
| 226 | 243 | ||
| 227 | - var init_autocomplete=function(element, data){ | ||
| 228 | - var autocomplete = UIkit.autocomplete(element, { | ||
| 229 | - minLength: 1, | ||
| 230 | - delay: 50, | ||
| 231 | - source: function(release) { | ||
| 232 | - var q = $('input', element).val().toUpperCase(), | ||
| 233 | - rs = [], | ||
| 234 | - count = 0; | ||
| 235 | - | ||
| 236 | - $.each(data, function() { | ||
| 237 | - if (this.value.indexOf(q) != -1){ | ||
| 238 | - rs.push(this); | ||
| 239 | - count++; | ||
| 240 | - } | ||
| 241 | - if (count >= 10) | ||
| 242 | - return false; | ||
| 243 | - }); | ||
| 244 | - release && release(rs); | ||
| 245 | - } | ||
| 246 | - }); | 244 | + var init_autocomplete = function (element, data) { |
| 245 | + var autocomplete = UIkit.autocomplete(element, { | ||
| 246 | + minLength: 1, | ||
| 247 | + delay: 50, | ||
| 248 | + source: function (release) { | ||
| 249 | + var q = $('input', element).val().toUpperCase(), | ||
| 250 | + rs = [], | ||
| 251 | + count = 0; | ||
| 252 | + | ||
| 253 | + $.each(data, function () { | ||
| 254 | + if (this.value.indexOf(q) != -1) { | ||
| 255 | + rs.push(this); | ||
| 256 | + count++; | ||
| 257 | + } | ||
| 258 | + if (count >= 10) | ||
| 259 | + return false; | ||
| 260 | + }); | ||
| 261 | + release && release(rs); | ||
| 262 | + } | ||
| 263 | + }); | ||
| 247 | } | 264 | } |
| 248 | 265 | ||
| 249 | // function whichTransitionEvent() { | 266 | // function whichTransitionEvent() { |
src/main/resources/static/real_control_v2/js/data/data_gps.js
| @@ -12,7 +12,7 @@ var gb_data_gps = (function() { | @@ -12,7 +12,7 @@ var gb_data_gps = (function() { | ||
| 12 | var registerCallback = function(cb) { | 12 | var registerCallback = function(cb) { |
| 13 | if (cb) | 13 | if (cb) |
| 14 | refreshEventCallbacks.push(cb); | 14 | refreshEventCallbacks.push(cb); |
| 15 | - } | 15 | + }; |
| 16 | 16 | ||
| 17 | var refresh = function(cb) { | 17 | var refresh = function(cb) { |
| 18 | $.get('/gps/real/line', { | 18 | $.get('/gps/real/line', { |
src/main/resources/static/real_control_v2/js/home/context_menu.js
| @@ -68,7 +68,7 @@ var gb_home_context_menu = (function() { | @@ -68,7 +68,7 @@ var gb_home_context_menu = (function() { | ||
| 68 | // show modal | 68 | // show modal |
| 69 | var elem = show_modal(modal, dom); | 69 | var elem = show_modal(modal, dom); |
| 70 | //create tree | 70 | //create tree |
| 71 | - var treeData = gb_common.get_device_tree_data(); | 71 | + var treeData = gb_common.get_device_tree_data(gb_data_gps.allGps); |
| 72 | var treeObj = $('.device-tree', modal).jstree({ | 72 | var treeObj = $('.device-tree', modal).jstree({ |
| 73 | 'core': { | 73 | 'core': { |
| 74 | 'data': treeData | 74 | 'data': treeData |
src/main/resources/static/real_control_v2/js/north/tabs.js
| @@ -17,9 +17,16 @@ var gb_tabs = (function() { | @@ -17,9 +17,16 @@ var gb_tabs = (function() { | ||
| 17 | $('.north-tabs').html(tabHtmlStr); | 17 | $('.north-tabs').html(tabHtmlStr); |
| 18 | $('.main-container').html(tabContentHtmlStr); | 18 | $('.main-container').html(tabContentHtmlStr); |
| 19 | 19 | ||
| 20 | + //地图选项卡初始点击 | ||
| 21 | + $('#north_tabs_map_btn').one('click', function () { | ||
| 22 | + if(typeof(gb_map_overlay_mge)!="undefined"){ | ||
| 23 | + gb_map_overlay_mge.centerToRational(); | ||
| 24 | + } | ||
| 25 | + }); | ||
| 26 | + | ||
| 20 | cb && cb(); | 27 | cb && cb(); |
| 21 | }); | 28 | }); |
| 22 | - } | 29 | + }; |
| 23 | 30 | ||
| 24 | //文件载入完毕 | 31 | //文件载入完毕 |
| 25 | res_load_ep.emitLater('load_tab'); | 32 | res_load_ep.emitLater('load_tab'); |
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
| @@ -8,13 +8,61 @@ | @@ -8,13 +8,61 @@ | ||
| 8 | top: 20px; | 8 | top: 20px; |
| 9 | background: red; | 9 | background: red; |
| 10 | color: white; | 10 | color: white; |
| 11 | - padding: 7px; | ||
| 12 | - left: calc(50% - 250px); | 11 | + padding: 7px 25px 7px 7px; |
| 12 | + right: calc(50% - 250px); | ||
| 13 | border-radius: 5px; | 13 | border-radius: 5px; |
| 14 | font-size: 20px; | 14 | font-size: 20px; |
| 15 | cursor: pointer; | 15 | cursor: pointer; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | +.map-system-msg.flex-left a{ | ||
| 19 | + transition: all .3s ease; | ||
| 20 | + right: 325px; | ||
| 21 | + width: 45px; | ||
| 22 | + height: 10px; | ||
| 23 | + overflow: hidden; | ||
| 24 | + left: auto; | ||
| 25 | + top: 3px; | ||
| 26 | + box-shadow: none; | ||
| 27 | + border-radius: 5px 0 0 5px; | ||
| 28 | + border: 1px solid #dedede; | ||
| 29 | + border-right: none; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +.map-system-msg.flex-left a:before{ | ||
| 33 | + content: '老版本地图'; | ||
| 34 | + position: absolute; | ||
| 35 | + width: 100%; | ||
| 36 | + z-index: 2; | ||
| 37 | + height: 100%; | ||
| 38 | + background: #ffffff; | ||
| 39 | + top: 0; | ||
| 40 | + left: 0; | ||
| 41 | + text-align: center; | ||
| 42 | + font-size: 12px; | ||
| 43 | + line-height: 24px; | ||
| 44 | + color: #969696; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +.map-system-msg a:hover{ | ||
| 48 | + text-decoration: none; | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +.map-system-msg i.uk-icon-close{ | ||
| 52 | + position: absolute; | ||
| 53 | + top: 10px; | ||
| 54 | + right: 6px; | ||
| 55 | + font-size: 12px; | ||
| 56 | + color: #ff0000; | ||
| 57 | + background: #fcf6f6; | ||
| 58 | + padding: 1px 2px; | ||
| 59 | + border-radius: 10px; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +.map-system-msg i.uk-icon-close:hover{ | ||
| 63 | + color: #a75c5c; | ||
| 64 | +} | ||
| 65 | + | ||
| 18 | #real_map_container{ | 66 | #real_map_container{ |
| 19 | width: 100%; | 67 | width: 100%; |
| 20 | height: 100%; | 68 | height: 100%; |
| @@ -41,7 +89,7 @@ | @@ -41,7 +89,7 @@ | ||
| 41 | 89 | ||
| 42 | /**/ | 90 | /**/ |
| 43 | .real_bottom_panel{ | 91 | .real_bottom_panel{ |
| 44 | - position: absolute !important; | 92 | +/* position: absolute !important; |
| 45 | height: 180px; | 93 | height: 180px; |
| 46 | width: 100%; | 94 | width: 100%; |
| 47 | width: calc(100% - 342px); | 95 | width: calc(100% - 342px); |
| @@ -49,8 +97,17 @@ | @@ -49,8 +97,17 @@ | ||
| 49 | left: 0px !important; | 97 | left: 0px !important; |
| 50 | background: #fff; | 98 | background: #fff; |
| 51 | box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | 99 | box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); |
| 52 | - /* border-radius: 0 60px 0 0;*/ | 100 | + border: 1px solid #bfbcbc;*/ |
| 101 | + | ||
| 102 | + position: absolute !important; | ||
| 103 | + height: 180px; | ||
| 104 | + bottom: 2px !important; | ||
| 105 | + background: #fff; | ||
| 106 | + box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
| 53 | border: 1px solid #bfbcbc; | 107 | border: 1px solid #bfbcbc; |
| 108 | + width: 240px; | ||
| 109 | + right: 327px; | ||
| 110 | + padding-left: 20px; | ||
| 54 | } | 111 | } |
| 55 | 112 | ||
| 56 | 113 | ||
| @@ -90,8 +147,8 @@ | @@ -90,8 +147,8 @@ | ||
| 90 | */ | 147 | */ |
| 91 | .real_bottom_panel #handle{ | 148 | .real_bottom_panel #handle{ |
| 92 | width: 100%; | 149 | width: 100%; |
| 93 | - height: 4px; | ||
| 94 | - top: -4px; | 150 | + height: 3px; |
| 151 | + top: -3px; | ||
| 95 | background-color: rgba(136, 137, 138, 0.49); | 152 | background-color: rgba(136, 137, 138, 0.49); |
| 96 | cursor: row-resize; | 153 | cursor: row-resize; |
| 97 | } | 154 | } |
| @@ -105,13 +162,22 @@ | @@ -105,13 +162,22 @@ | ||
| 105 | } | 162 | } |
| 106 | 163 | ||
| 107 | .real_bottom_panel .real_br_cont{ | 164 | .real_bottom_panel .real_br_cont{ |
| 108 | - display: inline-block; | 165 | +/* display: inline-block; |
| 109 | width: 232px; | 166 | width: 232px; |
| 110 | height: 100%; | 167 | height: 100%; |
| 111 | height: calc(100% - 7px); | 168 | height: calc(100% - 7px); |
| 112 | overflow: auto; | 169 | overflow: auto; |
| 113 | padding-top: 7px; | 170 | padding-top: 7px; |
| 114 | font-size: 13px; | 171 | font-size: 13px; |
| 172 | + position: relative;*/ | ||
| 173 | + | ||
| 174 | + display: inline-block; | ||
| 175 | + width: 100%; | ||
| 176 | + height: 100%; | ||
| 177 | + height: calc(100% - 7px); | ||
| 178 | + overflow: auto; | ||
| 179 | + padding-top: 7px; | ||
| 180 | + font-size: 13px; | ||
| 115 | position: relative; | 181 | position: relative; |
| 116 | } | 182 | } |
| 117 | 183 |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
| @@ -27,13 +27,6 @@ | @@ -27,13 +27,6 @@ | ||
| 27 | <script id="map-win-station-detail-temp" type="text/html"> | 27 | <script id="map-win-station-detail-temp" type="text/html"> |
| 28 | <div class="gps_info_win"> | 28 | <div class="gps_info_win"> |
| 29 | <h4>{{stationName}}</h4> | 29 | <h4>{{stationName}}</h4> |
| 30 | - <p>方向: | ||
| 31 | - {{if directions==0}} | ||
| 32 | - 上行 | ||
| 33 | - {{else if directions==1}} | ||
| 34 | - 下行 | ||
| 35 | - {{/if}} | ||
| 36 | - </p> | ||
| 37 | <p>站点编码: {{stationCode}}</p> | 30 | <p>站点编码: {{stationCode}}</p> |
| 38 | <p>站点类型: | 31 | <p>站点类型: |
| 39 | {{if stationMark=='B'}} | 32 | {{if stationMark=='B'}} |
src/main/resources/static/real_control_v2/mapmonitor/js/config.js
| @@ -14,8 +14,8 @@ var gb_map_config = (function () { | @@ -14,8 +14,8 @@ var gb_map_config = (function () { | ||
| 14 | carPark: false | 14 | carPark: false |
| 15 | }, | 15 | }, |
| 16 | abnormalPrint: { | 16 | abnormalPrint: { |
| 17 | - speeding: true, | ||
| 18 | - outBounds: true, | 17 | + speeding: false, |
| 18 | + outBounds: false, | ||
| 19 | largeMargin: false | 19 | largeMargin: false |
| 20 | }, | 20 | }, |
| 21 | carIcon: { | 21 | carIcon: { |
| @@ -102,6 +102,7 @@ var gb_map_config = (function () { | @@ -102,6 +102,7 @@ var gb_map_config = (function () { | ||
| 102 | if (defaultConfig.traffic) | 102 | if (defaultConfig.traffic) |
| 103 | gb_map_imap.call('traffic', true); | 103 | gb_map_imap.call('traffic', true); |
| 104 | }, 1000); | 104 | }, 1000); |
| 105 | + gb_map_overlay_mge.centerToRational(); | ||
| 105 | }); | 106 | }); |
| 106 | } | 107 | } |
| 107 | 108 |
src/main/resources/static/real_control_v2/mapmonitor/js/gps_tree.js
| 1 | var gb_map_gps_tree = (function () { | 1 | var gb_map_gps_tree = (function () { |
| 2 | 2 | ||
| 3 | + var idBefore = 'map_tree_'; | ||
| 4 | + var _devices; | ||
| 3 | 5 | ||
| 4 | var treeObj; | 6 | var treeObj; |
| 5 | - | ||
| 6 | var jstreeChanged = function (e, node, event) { | 7 | var jstreeChanged = function (e, node, event) { |
| 7 | gb_map_overlay_mge.refresh(); | 8 | gb_map_overlay_mge.refresh(); |
| 8 | }; | 9 | }; |
| 9 | 10 | ||
| 10 | var init = function (cb) { | 11 | var init = function (cb) { |
| 12 | + var allGps = gb_data_gps.allGps; | ||
| 13 | + _devices = gb_common.get_keys(allGps); | ||
| 11 | //设备树 | 14 | //设备树 |
| 12 | - var treeData = gb_common.get_device_tree_data(); | 15 | + var treeData = gb_common.get_device_tree_data(allGps, idBefore); |
| 13 | treeObj = $('.real_right_gps_panel .gps_tree_list') | 16 | treeObj = $('.real_right_gps_panel .gps_tree_list') |
| 14 | - //节点初始化完成 | 17 | + //节点初始化完成 |
| 15 | .on('ready.jstree', function () { | 18 | .on('ready.jstree', function () { |
| 16 | treeObj.jstree(true).open_all(); | 19 | treeObj.jstree(true).open_all(); |
| 17 | //删掉tree node a标签的 href值(避免鼠标悬停浏览器出现状态条) | 20 | //删掉tree node a标签的 href值(避免鼠标悬停浏览器出现状态条) |
| @@ -26,14 +29,15 @@ var gb_map_gps_tree = (function () { | @@ -26,14 +29,15 @@ var gb_map_gps_tree = (function () { | ||
| 26 | .on('activate_node.jstree', function (e, n) { | 29 | .on('activate_node.jstree', function (e, n) { |
| 27 | //console.log('activate_node.jstree', e, n); | 30 | //console.log('activate_node.jstree', e, n); |
| 28 | var node = n.node; | 31 | var node = n.node; |
| 29 | - if(node.a_attr && node.a_attr.type=='device' && node.state.checked){ | 32 | + if (node.a_attr && node.a_attr.type == 'device' && node.state.checked) { |
| 30 | var device = node.a_attr.device; | 33 | var device = node.a_attr.device; |
| 31 | gb_map_overlay_mge._focus(device); | 34 | gb_map_overlay_mge._focus(device); |
| 32 | } | 35 | } |
| 33 | }) | 36 | }) |
| 34 | .jstree({ | 37 | .jstree({ |
| 35 | 'core': { | 38 | 'core': { |
| 36 | - 'data': treeData | 39 | + 'data': treeData, |
| 40 | + 'check_callback': true | ||
| 37 | }, | 41 | }, |
| 38 | 'checkbox': { | 42 | 'checkbox': { |
| 39 | 'keep_selected_style': false, | 43 | 'keep_selected_style': false, |
| @@ -57,17 +61,105 @@ var gb_map_gps_tree = (function () { | @@ -57,17 +61,105 @@ var gb_map_gps_tree = (function () { | ||
| 57 | } | 61 | } |
| 58 | }, | 62 | }, |
| 59 | //local storage里的key | 63 | //local storage里的key |
| 60 | - 'state':{ | 64 | + 'state': { |
| 61 | 'key': 'jstree_map_devices' | 65 | 'key': 'jstree_map_devices' |
| 62 | }, | 66 | }, |
| 63 | 'plugins': ['checkbox', 'contextmenu', 'state'] | 67 | 'plugins': ['checkbox', 'contextmenu', 'state'] |
| 64 | }); | 68 | }); |
| 65 | }; | 69 | }; |
| 66 | 70 | ||
| 71 | + //創建新節點 | ||
| 72 | + var create_node = function (array, create_end_cb) { | ||
| 73 | + if (!isArray(array)) | ||
| 74 | + array = [array]; | ||
| 75 | + | ||
| 76 | + var jstreeInts = treeObj.jstree(true); | ||
| 77 | + var len = array.length, i = 0; | ||
| 78 | + (function () { | ||
| 79 | + var f = arguments.callee; | ||
| 80 | + if (i >= len) { | ||
| 81 | + create_end_cb && create_end_cb(); | ||
| 82 | + return; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + var gps = array[i], | ||
| 86 | + pId = idBefore + 'route_' + gps.lineId + '_' + gps.upDown; | ||
| 87 | + //上下行节点 | ||
| 88 | + var routeNode = jstreeInts.get_node(pId); | ||
| 89 | + if (!routeNode) { | ||
| 90 | + //父节点不存在 | ||
| 91 | + create_route_node(gps.lineId, function () { | ||
| 92 | + //重新获取上下行节点 | ||
| 93 | + routeNode = jstreeInts.get_node(pId); | ||
| 94 | + appendDeviceNode(routeNode, gps, function () { | ||
| 95 | + _devices.push(gps.deviceId); | ||
| 96 | + i++; | ||
| 97 | + f(); | ||
| 98 | + }); | ||
| 99 | + }); | ||
| 100 | + } | ||
| 101 | + else { | ||
| 102 | + appendDeviceNode(routeNode, gps, function () { | ||
| 103 | + _devices.push(gps.deviceId); | ||
| 104 | + i++; | ||
| 105 | + f(); | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + })(); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + //创建线路和上下行节点 | ||
| 112 | + var create_route_node = function (lineCode, cb) { | ||
| 113 | + var lineName = gb_data_basic.codeToLine[lineCode].name; | ||
| 114 | + var id = treeObj.jstree(true).create_node('#', { | ||
| 115 | + 'text': lineName, | ||
| 116 | + 'a_attr': {'type': 'line', 'id': idBefore + 'line_' + lineCode}, | ||
| 117 | + 'state': {'opened': true}, | ||
| 118 | + 'children': [{ | ||
| 119 | + 'text': '上行', | ||
| 120 | + 'a_attr': { | ||
| 121 | + 'type': 'route', | ||
| 122 | + 'route': lineCode + '_0', | ||
| 123 | + 'id': idBefore + 'route_' + lineCode + '_0', | ||
| 124 | + 'state': {'opened': true} | ||
| 125 | + } | ||
| 126 | + }, { | ||
| 127 | + 'text': '下行', | ||
| 128 | + 'a_attr': { | ||
| 129 | + 'type': 'route', | ||
| 130 | + 'route': lineCode + '_1', | ||
| 131 | + 'id': idBefore + 'route_' + lineCode + '_1', | ||
| 132 | + 'state': {'opened': true} | ||
| 133 | + } | ||
| 134 | + }] | ||
| 135 | + }, 'last', cb); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + var appendDeviceNode = function (routeNode, gps, cb) { | ||
| 139 | + if (!routeNode) { | ||
| 140 | + return; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + //添加車輛節點 | ||
| 144 | + treeObj.jstree(true).create_node(routeNode, { | ||
| 145 | + 'text': gps.nbbm, | ||
| 146 | + 'a_attr': { | ||
| 147 | + 'type': 'device', | ||
| 148 | + 'device': gps.deviceId | ||
| 149 | + }, | ||
| 150 | + 'data': {lineId: gps.lineId, upDown: gps.upDown}, | ||
| 151 | + 'icon': 'uk-icon-bus' | ||
| 152 | + }, 'last', cb); | ||
| 153 | + } | ||
| 154 | + | ||
| 67 | return { | 155 | return { |
| 68 | init: init, | 156 | init: init, |
| 69 | getChecked: function () { | 157 | getChecked: function () { |
| 70 | return treeObj.jstree(true).get_checked(true); | 158 | return treeObj.jstree(true).get_checked(true); |
| 71 | - } | 159 | + }, |
| 160 | + all_devices: function () { | ||
| 161 | + return _devices; | ||
| 162 | + }, | ||
| 163 | + create_node: create_node | ||
| 72 | }; | 164 | }; |
| 73 | })(); | 165 | })(); |
| 74 | \ No newline at end of file | 166 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
| @@ -88,7 +88,7 @@ var gb_map_baidu = (function(){ | @@ -88,7 +88,7 @@ var gb_map_baidu = (function(){ | ||
| 88 | map.addOverlay(polyline); | 88 | map.addOverlay(polyline); |
| 89 | 89 | ||
| 90 | //延迟居中,避免多次调用时抖动 | 90 | //延迟居中,避免多次调用时抖动 |
| 91 | - delayToCenter(pos[parseInt(pos.length / 2)]); | 91 | + //delayToCenter(pos[parseInt(pos.length / 2)]); |
| 92 | //map.panTo(pos[parseInt(pos.length / 2)]); | 92 | //map.panTo(pos[parseInt(pos.length / 2)]); |
| 93 | }, | 93 | }, |
| 94 | traffic: function (enable) { | 94 | traffic: function (enable) { |
| @@ -110,8 +110,7 @@ var gb_map_baidu = (function(){ | @@ -110,8 +110,7 @@ var gb_map_baidu = (function(){ | ||
| 110 | //定位到线路中间点 | 110 | //定位到线路中间点 |
| 111 | centerToLine: function (opt) { | 111 | centerToLine: function (opt) { |
| 112 | var pos=polylines[opt.id].getPath(); | 112 | var pos=polylines[opt.id].getPath(); |
| 113 | - console.log('定位到中心,,,', pos[parseInt(pos.length / 2)]); | ||
| 114 | - map.setCenter(pos[parseInt(pos.length / 2)]); | 113 | + delayToCenter(pos[parseInt(pos.length / 2)]); |
| 115 | }, | 114 | }, |
| 116 | //绘制GPS信号 | 115 | //绘制GPS信号 |
| 117 | drawRealGpsMarker: function(opts){ | 116 | drawRealGpsMarker: function(opts){ |
| @@ -134,6 +133,12 @@ var gb_map_baidu = (function(){ | @@ -134,6 +133,12 @@ var gb_map_baidu = (function(){ | ||
| 134 | map.addOverlay(marker); | 133 | map.addOverlay(marker); |
| 135 | //设备号和marker映射 | 134 | //设备号和marker映射 |
| 136 | realMarkers[gps.deviceId] = marker; | 135 | realMarkers[gps.deviceId] = marker; |
| 136 | + /*//新上线的设备,默认隐藏 | ||
| 137 | + if(gps.newNodeHide){ | ||
| 138 | + marker.hide(); | ||
| 139 | + gps.newNodeHide=null; | ||
| 140 | + delete gps.newNodeHide; | ||
| 141 | + }*/ | ||
| 137 | } | 142 | } |
| 138 | } | 143 | } |
| 139 | }); | 144 | }); |
| @@ -186,7 +191,6 @@ var gb_map_baidu = (function(){ | @@ -186,7 +191,6 @@ var gb_map_baidu = (function(){ | ||
| 186 | //info window | 191 | //info window |
| 187 | polygon.infoWin = new BMap.InfoWindow(gb_map_overlay_mge.map_carpark_win_temp(this), {}); | 192 | polygon.infoWin = new BMap.InfoWindow(gb_map_overlay_mge.map_carpark_win_temp(this), {}); |
| 188 | polygon.addEventListener('click', function(){ | 193 | polygon.addEventListener('click', function(){ |
| 189 | - console.log('aaa', this); | ||
| 190 | map.openInfoWindow(this.infoWin, this._centerPoint); | 194 | map.openInfoWindow(this.infoWin, this._centerPoint); |
| 191 | }); | 195 | }); |
| 192 | }); | 196 | }); |
| @@ -291,18 +295,6 @@ var gb_map_baidu = (function(){ | @@ -291,18 +295,6 @@ var gb_map_baidu = (function(){ | ||
| 291 | var polygon = new BMap.Polygon(station.bdPoints, {strokeColor: opt.color, strokeWeight: opt.weight}); | 295 | var polygon = new BMap.Polygon(station.bdPoints, {strokeColor: opt.color, strokeWeight: opt.weight}); |
| 292 | map.addOverlay(polygon); | 296 | map.addOverlay(polygon); |
| 293 | electronicFences[code]=polygon; | 297 | electronicFences[code]=polygon; |
| 294 | - | ||
| 295 | -/* | ||
| 296 | - //计算多边形面积 | ||
| 297 | - var area=BMapLib.GeoUtils.getPolygonArea(polygon); | ||
| 298 | - if(!isNaN(area)) | ||
| 299 | - polygon._polygonArea=area+'米'; | ||
| 300 | - else | ||
| 301 | - polygon._polygonArea='计算失败'; | ||
| 302 | - | ||
| 303 | - polygon.addEventListener('click', function(){ | ||
| 304 | - map.openInfoWindow(this.infoWin, marker.point); | ||
| 305 | - });*/ | ||
| 306 | }, | 298 | }, |
| 307 | //删除缓冲区 | 299 | //删除缓冲区 |
| 308 | clearBuffArea: function(code){ | 300 | clearBuffArea: function(code){ |
| @@ -407,15 +399,12 @@ var gb_map_baidu = (function(){ | @@ -407,15 +399,12 @@ var gb_map_baidu = (function(){ | ||
| 407 | return marker; | 399 | return marker; |
| 408 | } | 400 | } |
| 409 | 401 | ||
| 410 | - //为每个数字定义宽度 | ||
| 411 | -/* var icon_num_width=[ | ||
| 412 | - 7,6,7,7,7,7,7,7,7,7 | ||
| 413 | - ];*/ | 402 | + |
| 414 | function calcGpsMarkerWidth(nbbm) { | 403 | function calcGpsMarkerWidth(nbbm) { |
| 415 | var width=0; | 404 | var width=0; |
| 416 | $.each(nbbm.split(''), function () { | 405 | $.each(nbbm.split(''), function () { |
| 417 | if(!isNaN(this)) | 406 | if(!isNaN(this)) |
| 418 | - width += 7;//icon_num_width[this]; | 407 | + width += 7; |
| 419 | else if(this=='-') | 408 | else if(this=='-') |
| 420 | width += 10; | 409 | width += 10; |
| 421 | else | 410 | else |
| @@ -428,7 +417,7 @@ var gb_map_baidu = (function(){ | @@ -428,7 +417,7 @@ var gb_map_baidu = (function(){ | ||
| 428 | var point = new BMap.Point(statio.bd_lon, statio.bd_lat); | 417 | var point = new BMap.Point(statio.bd_lon, statio.bd_lat); |
| 429 | var marker = new BMap.Marker(point); | 418 | var marker = new BMap.Marker(point); |
| 430 | 419 | ||
| 431 | - //根据编码长度 计算marker 宽度 | 420 | + //根据站点名称 计算marker 宽度 |
| 432 | var w = statio.stationName.length * 12 + 4 | 421 | var w = statio.stationName.length * 12 + 4 |
| 433 | ,iw=w-2; | 422 | ,iw=w-2; |
| 434 | var icon = new BMap.Icon(gb_map_imap.createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,24)}) | 423 | var icon = new BMap.Icon(gb_map_imap.createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,24)}) |
| @@ -450,34 +439,6 @@ var gb_map_baidu = (function(){ | @@ -450,34 +439,6 @@ var gb_map_baidu = (function(){ | ||
| 450 | return marker; | 439 | return marker; |
| 451 | } | 440 | } |
| 452 | 441 | ||
| 453 | - //隐藏线路线条 | ||
| 454 | -/* function hideLinePolyline(){ | ||
| 455 | - if(!linePolyline || linePolyline.length == 0) | ||
| 456 | - return; | ||
| 457 | - | ||
| 458 | - layer.msg('隐藏线路图层',{offset: 'ct', shift : 5}); | ||
| 459 | - $.each(linePolyline, function(){ | ||
| 460 | - this.setStrokeOpacity(0.1); | ||
| 461 | - }); | ||
| 462 | - } | ||
| 463 | - | ||
| 464 | - //显示线路线条 | ||
| 465 | - function showLinePolyline(){ | ||
| 466 | - if(!linePolyline || linePolyline.length == 0) | ||
| 467 | - return; | ||
| 468 | - | ||
| 469 | - layer.msg('显示线路图层',{offset: 'ct', shift : 5}); | ||
| 470 | - $.each(linePolyline, function(){ | ||
| 471 | - this.setStrokeOpacity(0.5); | ||
| 472 | - }); | ||
| 473 | - }*/ | ||
| 474 | - | ||
| 475 | -/* function refreshStation() { | ||
| 476 | - //console.log('refreshStation', map.getZoom()); | ||
| 477 | - var zoom=map.getZoom(); | ||
| 478 | - | ||
| 479 | - }*/ | ||
| 480 | - | ||
| 481 | function moveMarker(m, gps){ | 442 | function moveMarker(m, gps){ |
| 482 | m.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat)); | 443 | m.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat)); |
| 483 | m.gpsData = gps; | 444 | m.gpsData = gps; |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/gaode.js
| @@ -13,13 +13,16 @@ var gb_map_gaode = (function() { | @@ -13,13 +13,16 @@ var gb_map_gaode = (function() { | ||
| 13 | + '<div class="sk-cube sk-cube9"></div>' + '</div>'; | 13 | + '<div class="sk-cube sk-cube9"></div>' + '</div>'; |
| 14 | 14 | ||
| 15 | var map; | 15 | var map; |
| 16 | - var topMarkr; | 16 | + //var topMarkr; |
| 17 | var realMarkers = {}; | 17 | var realMarkers = {}; |
| 18 | //线路路由线条 | 18 | //线路路由线条 |
| 19 | var polylines={}; | 19 | var polylines={}; |
| 20 | + var stationMarkers={}; | ||
| 21 | + var electronicFences={}; | ||
| 22 | + var carparks={}; | ||
| 20 | //实时路况是否显示 | 23 | //实时路况是否显示 |
| 21 | - var traffVisible; | ||
| 22 | - var trafficLayer; | 24 | + //var traffVisible; |
| 25 | + //var trafficLayer; | ||
| 23 | var gaodeInstance = { | 26 | var gaodeInstance = { |
| 24 | init : function(cb) { | 27 | init : function(cb) { |
| 25 | var $mapCon = $(gb_map_consts.mapContainer); | 28 | var $mapCon = $(gb_map_consts.mapContainer); |
| @@ -78,12 +81,7 @@ var gb_map_gaode = (function() { | @@ -78,12 +81,7 @@ var gb_map_gaode = (function() { | ||
| 78 | realMarkers = {}; | 81 | realMarkers = {}; |
| 79 | polylines={}; | 82 | polylines={}; |
| 80 | map.clearMap(); | 83 | map.clearMap(); |
| 81 | - } | ||
| 82 | - /*clear: function(){ | ||
| 83 | - realMarkers = {}; | ||
| 84 | - map.clearMap(); | ||
| 85 | - linePolyline = []; | ||
| 86 | - }*/, | 84 | + }, |
| 87 | drawLine: function(opt){ | 85 | drawLine: function(opt){ |
| 88 | //linePolyline = []; | 86 | //linePolyline = []; |
| 89 | var pos = [], temps; | 87 | var pos = [], temps; |
| @@ -102,9 +100,11 @@ var gb_map_gaode = (function() { | @@ -102,9 +100,11 @@ var gb_map_gaode = (function() { | ||
| 102 | polyline.hide(); | 100 | polyline.hide(); |
| 103 | 101 | ||
| 104 | polyline.setMap(map); | 102 | polyline.setMap(map); |
| 105 | - | 103 | + }, |
| 104 | + //定位到线路中间点 | ||
| 105 | + centerToLine: function (opt) { | ||
| 106 | + var pos=polylines[opt.id].getPath(); | ||
| 106 | map.setCenter(pos[parseInt(pos.length / 2)]); | 107 | map.setCenter(pos[parseInt(pos.length / 2)]); |
| 107 | - | ||
| 108 | }, | 108 | }, |
| 109 | //根据id 显示polyline | 109 | //根据id 显示polyline |
| 110 | refreshPolyline: function (opt) { | 110 | refreshPolyline: function (opt) { |
| @@ -116,6 +116,131 @@ var gb_map_gaode = (function() { | @@ -116,6 +116,131 @@ var gb_map_gaode = (function() { | ||
| 116 | polylines[id].hide(); | 116 | polylines[id].hide(); |
| 117 | } | 117 | } |
| 118 | }, | 118 | }, |
| 119 | + drawStationMarker: function (opt) { | ||
| 120 | + this.hideAllStationMarker(); | ||
| 121 | + | ||
| 122 | + var array=opt.list, marker; | ||
| 123 | + $.each(array, function () { | ||
| 124 | + if(stationMarkers[this.stationCode]){ | ||
| 125 | + stationMarkers[this.stationCode].show(); | ||
| 126 | + return true; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + transCoord(this); | ||
| 130 | + marker=createStationMark(this); | ||
| 131 | + stationMarkers[this.stationCode]=marker; | ||
| 132 | + }); | ||
| 133 | + }, | ||
| 134 | + hideAllStationMarker: function () { | ||
| 135 | + for(var code in stationMarkers){ | ||
| 136 | + stationMarkers[code].hide(); | ||
| 137 | + } | ||
| 138 | + }, | ||
| 139 | + //绘制圆形 | ||
| 140 | + drawCircle: function(opt){ | ||
| 141 | + if(electronicFences[opt.id]){ | ||
| 142 | + electronicFences[opt.id].show(); | ||
| 143 | + return; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + var coord = TransGPS.transformFromWGSToGCJ(opt.lat, opt.lon); | ||
| 147 | + | ||
| 148 | + var circle = new AMap.Circle({ | ||
| 149 | + center: [coord.lng, coord.lat],// 圆心位置 | ||
| 150 | + radius: opt.radius, //半径 | ||
| 151 | + strokeColor: opt.color, //线颜色 | ||
| 152 | + strokeWeight: opt.weight, //线粗细度 | ||
| 153 | + fillColor: '#fff', //填充颜色 | ||
| 154 | + fillOpacity: 0.5 | ||
| 155 | + }); | ||
| 156 | + circle.setMap(map); | ||
| 157 | + electronicFences[opt.id] = circle; | ||
| 158 | + }, | ||
| 159 | + //绘制多边形 | ||
| 160 | + drawPolygon: function(opt){ | ||
| 161 | + var station = opt.station | ||
| 162 | + ,code = station.stationCode; | ||
| 163 | + if(electronicFences[code]){ | ||
| 164 | + electronicFences[code].show(); | ||
| 165 | + return; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + transMultiWGSToGCJ(station); | ||
| 169 | + var polygon=new AMap.Polygon({ | ||
| 170 | + map: map, | ||
| 171 | + path: station.gcjPoints, | ||
| 172 | + strokeColor: opt.color, | ||
| 173 | + strokeWeight: opt.weight, | ||
| 174 | + fillColor: '#fff', | ||
| 175 | + fillOpacity: 0.5 | ||
| 176 | + }); | ||
| 177 | + | ||
| 178 | + electronicFences[code]=polygon; | ||
| 179 | + }, | ||
| 180 | + //绘制停车场 | ||
| 181 | + drawCarpark: function (opt) { | ||
| 182 | + var list = opt.list; | ||
| 183 | + var config = gb_map_config.getConfig() | ||
| 184 | + ,color = config.section.color.up; | ||
| 185 | + | ||
| 186 | + this.hideDrawCarpark(); | ||
| 187 | + $.each(list, function () { | ||
| 188 | + if(carparks[this.parkCode]){ | ||
| 189 | + carparks[this.parkCode].show(); | ||
| 190 | + return true; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + transMultiWGSToGCJ(this); | ||
| 194 | + var polygon=new AMap.Polygon({ | ||
| 195 | + map: map, | ||
| 196 | + path: this.gcjPoints, | ||
| 197 | + strokeColor: color, | ||
| 198 | + strokeWeight: 1, | ||
| 199 | + fillColor: '#fff', | ||
| 200 | + fillOpacity: 0.5 | ||
| 201 | + }); | ||
| 202 | + carparks[this.parkCode]=polygon; | ||
| 203 | + //中心点 | ||
| 204 | + var ts = this.gCenterPoint.split(' ') | ||
| 205 | + ,coord = TransGPS.transformFromWGSToGCJ(parseFloat(ts[1]), parseFloat(ts[0])); | ||
| 206 | + polygon._centerPoint = [coord.lng, coord.lat]; | ||
| 207 | + //info window | ||
| 208 | + polygon.infoWin = new AMap.InfoWindow({ | ||
| 209 | + content: gb_map_overlay_mge.map_carpark_win_temp(this), | ||
| 210 | + size: new AMap.Size(228, 146) | ||
| 211 | + }); | ||
| 212 | + polygon.on('click', function () { | ||
| 213 | + this.infoWin.open(map, this._centerPoint); | ||
| 214 | + }); | ||
| 215 | + }); | ||
| 216 | + }, | ||
| 217 | + //隐藏停车场 | ||
| 218 | + hideDrawCarpark: function () { | ||
| 219 | + for(var code in carparks){ | ||
| 220 | + carparks[code].hide(); | ||
| 221 | + } | ||
| 222 | + }, | ||
| 223 | + hideAllCircles: function () { | ||
| 224 | + for(var code in electronicFences){ | ||
| 225 | + electronicFences[code].hide(); | ||
| 226 | + } | ||
| 227 | + }, | ||
| 228 | + //定位到站点 | ||
| 229 | + goToStation: function (stationCode) { | ||
| 230 | + var m = stationMarkers[stationCode]; | ||
| 231 | + if(m){ | ||
| 232 | + map.setCenter(m.getPosition()); | ||
| 233 | + m.infoWindow.open(map, m.getPosition()); | ||
| 234 | + } | ||
| 235 | + }, | ||
| 236 | + //定位到停车场 | ||
| 237 | + goToCarpark: function (parkCode) { | ||
| 238 | + var polygon = carparks[parkCode]; | ||
| 239 | + if(polygon){ | ||
| 240 | + map.setCenter(polygon._centerPoint); | ||
| 241 | + polygon.infoWin.open(map, polygon._centerPoint); | ||
| 242 | + } | ||
| 243 | + }, | ||
| 119 | drawRealGpsMarker: function(opts){ | 244 | drawRealGpsMarker: function(opts){ |
| 120 | gpsArray = opts.gpsList; | 245 | gpsArray = opts.gpsList; |
| 121 | var coord; | 246 | var coord; |
| @@ -136,45 +261,7 @@ var gb_map_gaode = (function() { | @@ -136,45 +261,7 @@ var gb_map_gaode = (function() { | ||
| 136 | realMarkers[gps.deviceId] = marker | 261 | realMarkers[gps.deviceId] = marker |
| 137 | } | 262 | } |
| 138 | } | 263 | } |
| 139 | - | ||
| 140 | - /*coord = TransGPS.transformFromWGSToGCJ(gps.lat, gps.lon); | ||
| 141 | - gps.gcj_lat = coord.lat; | ||
| 142 | - gps.gcj_lon = coord.lng; | ||
| 143 | - | ||
| 144 | - marker = realMarkers[gps.deviceId]; | ||
| 145 | - if(marker){ | ||
| 146 | - if(gps.timestamp == marker.gpsData.timestamp) | ||
| 147 | - return; | ||
| 148 | - else | ||
| 149 | - moveMarker(marker, gps);//移动marker | ||
| 150 | - } | ||
| 151 | - else{ | ||
| 152 | - var marker = createGDMarkerByGps(gps); | ||
| 153 | - realMarkers[gps.deviceId] = marker | ||
| 154 | - }*/ | ||
| 155 | }); | 264 | }); |
| 156 | - | ||
| 157 | - /*var gpsArray = opts.gpsList; | ||
| 158 | - var coord; | ||
| 159 | - $.each(gpsArray, function(i, gps){ | ||
| 160 | - if(opts.coordTransform){ | ||
| 161 | - coord = TransGPS.transformFromWGSToGCJ(gps.lat, gps.lon); | ||
| 162 | - gps.gcj_lat = coord.lat; | ||
| 163 | - gps.gcj_lon = coord.lng; | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - marker = realMarkers[gps.deviceId]; | ||
| 167 | - if(marker){ | ||
| 168 | - if(gps.timestamp == marker.gpsData.timestamp) | ||
| 169 | - return; | ||
| 170 | - else | ||
| 171 | - moveMarker(marker, gps);//移动marker | ||
| 172 | - } | ||
| 173 | - else{ | ||
| 174 | - var marker = createGDMarkerByGps(gps); | ||
| 175 | - realMarkers[gps.deviceId] = marker | ||
| 176 | - } | ||
| 177 | - });*/ | ||
| 178 | }, | 265 | }, |
| 179 | showGpsMarker: function (opt) { | 266 | showGpsMarker: function (opt) { |
| 180 | var chs = opt.chs; | 267 | var chs = opt.chs; |
| @@ -190,7 +277,7 @@ var gb_map_gaode = (function() { | @@ -190,7 +277,7 @@ var gb_map_gaode = (function() { | ||
| 190 | ,m = realMarkers[deviceId]; | 277 | ,m = realMarkers[deviceId]; |
| 191 | if(m){ | 278 | if(m){ |
| 192 | map.setCenter(m.getPosition()); | 279 | map.setCenter(m.getPosition()); |
| 193 | - setTop(m); | 280 | + //setTop(m); |
| 194 | } | 281 | } |
| 195 | }, | 282 | }, |
| 196 | openWindow: function(opts){ | 283 | openWindow: function(opts){ |
| @@ -208,7 +295,7 @@ var gb_map_gaode = (function() { | @@ -208,7 +295,7 @@ var gb_map_gaode = (function() { | ||
| 208 | 295 | ||
| 209 | function createGDMarkerByGps(gps){ | 296 | function createGDMarkerByGps(gps){ |
| 210 | //根据编码长度 计算marker 宽度 | 297 | //根据编码长度 计算marker 宽度 |
| 211 | - var w = gps.nbbm.length * 10; | 298 | + var w = calcGpsMarkerWidth(gps.nbbm); |
| 212 | 299 | ||
| 213 | var marker = new AMap.Marker({ | 300 | var marker = new AMap.Marker({ |
| 214 | map: map, | 301 | map: map, |
| @@ -217,15 +304,20 @@ var gb_map_gaode = (function() { | @@ -217,15 +304,20 @@ var gb_map_gaode = (function() { | ||
| 217 | size: new AMap.Size(w, 25), //图标大小 | 304 | size: new AMap.Size(w, 25), //图标大小 |
| 218 | image: gb_map_imap.createCarIcon(gps, w) | 305 | image: gb_map_imap.createCarIcon(gps, w) |
| 219 | }), | 306 | }), |
| 220 | - offset: new AMap.Pixel(-35, -12) | 307 | + offset: new AMap.Pixel(-(w/2), -12) |
| 221 | }); | 308 | }); |
| 222 | 309 | ||
| 310 | + marker._icon_width=w; | ||
| 223 | //绑定数据 | 311 | //绑定数据 |
| 224 | marker.gpsData = gps; | 312 | marker.gpsData = gps; |
| 225 | marker.infoWindow = new AMap.InfoWindow(); | 313 | marker.infoWindow = new AMap.InfoWindow(); |
| 226 | 314 | ||
| 315 | + marker.setzIndex(2); | ||
| 227 | marker.on('mouseover', function(){ | 316 | marker.on('mouseover', function(){ |
| 228 | - setTop(this); | 317 | + this.setzIndex(3); |
| 318 | + }); | ||
| 319 | + marker.on('mouseout', function () { | ||
| 320 | + this.setzIndex(2); | ||
| 229 | }); | 321 | }); |
| 230 | //点击事件 | 322 | //点击事件 |
| 231 | marker.on('click', function(){ | 323 | marker.on('click', function(){ |
| @@ -235,12 +327,49 @@ var gb_map_gaode = (function() { | @@ -235,12 +327,49 @@ var gb_map_gaode = (function() { | ||
| 235 | return marker; | 327 | return marker; |
| 236 | } | 328 | } |
| 237 | 329 | ||
| 330 | + //创建站点marker | ||
| 331 | + function createStationMark(statio) { | ||
| 332 | + //根据编码长度 计算marker 宽度 | ||
| 333 | + var w = statio.stationName.length * 12 + 4; | ||
| 334 | + | ||
| 335 | + var marker = new AMap.Marker({ | ||
| 336 | + map: map, | ||
| 337 | + position: [statio.gcj_lon, statio.gcj_lat], | ||
| 338 | + icon: new AMap.Icon({ | ||
| 339 | + size: new AMap.Size(w, 24), //图标大小 | ||
| 340 | + image: gb_map_imap.createStationIcon(statio, w) | ||
| 341 | + }), | ||
| 342 | + offset: new AMap.Pixel(-(w/2), -24) | ||
| 343 | + }); | ||
| 344 | + | ||
| 345 | + //信息窗口 | ||
| 346 | + marker.infoWindow = new AMap.InfoWindow({ | ||
| 347 | + content:gb_map_overlay_mge.map_station_win_temp(statio), | ||
| 348 | + size: new AMap.Size(178, 240) | ||
| 349 | + }); | ||
| 350 | + | ||
| 351 | + //mouseover | ||
| 352 | + marker.setzIndex(1); | ||
| 353 | + marker.on('mouseover', function(){ | ||
| 354 | + this.setzIndex(3); | ||
| 355 | + }); | ||
| 356 | + marker.on('mouseout', function () { | ||
| 357 | + this.setzIndex(1); | ||
| 358 | + }); | ||
| 359 | + | ||
| 360 | + //点击事件 | ||
| 361 | + marker.on('click', function(){ | ||
| 362 | + this.infoWindow.open(map, this.getPosition()); | ||
| 363 | + }); | ||
| 364 | + return marker; | ||
| 365 | + } | ||
| 366 | + | ||
| 238 | function moveMarker(m, gps){ | 367 | function moveMarker(m, gps){ |
| 239 | m.setPosition(new AMap.LngLat(gps.gcj_lon, gps.gcj_lat)); | 368 | m.setPosition(new AMap.LngLat(gps.gcj_lon, gps.gcj_lat)); |
| 240 | m.gpsData = gps; | 369 | m.gpsData = gps; |
| 370 | + | ||
| 241 | //重新设置icon | 371 | //重新设置icon |
| 242 | - //根据编码长度 计算marker 宽度 | ||
| 243 | - var w = gps.nbbm.length * 10; | 372 | + var w = m._icon_width; |
| 244 | m.setIcon(new AMap.Icon({ | 373 | m.setIcon(new AMap.Icon({ |
| 245 | size: new AMap.Size(w, 25), | 374 | size: new AMap.Size(w, 25), |
| 246 | image: gb_map_imap.createCarIcon(gps, w) | 375 | image: gb_map_imap.createCarIcon(gps, w) |
| @@ -250,26 +379,31 @@ var gb_map_gaode = (function() { | @@ -250,26 +379,31 @@ var gb_map_gaode = (function() { | ||
| 250 | openWindow(m); | 379 | openWindow(m); |
| 251 | } | 380 | } |
| 252 | 381 | ||
| 253 | -/* //隐藏线路线条 | ||
| 254 | - function hideLinePolyline(){ | ||
| 255 | - if(!linePolyline || linePolyline.length == 0) | ||
| 256 | - return; | ||
| 257 | - layer.msg('隐藏线路图层',{offset: 'ct', shift : 5}); | ||
| 258 | - $.each(linePolyline, function(){ | ||
| 259 | - this.setOptions({strokeOpacity: 0}); | 382 | + function calcGpsMarkerWidth(nbbm) { |
| 383 | + var width=0; | ||
| 384 | + $.each(nbbm.split(''), function () { | ||
| 385 | + if(!isNaN(this)) | ||
| 386 | + width += 7;//icon_num_width[this]; | ||
| 387 | + else if(this=='-') | ||
| 388 | + width += 10; | ||
| 389 | + else | ||
| 390 | + width += 16; | ||
| 260 | }); | 391 | }); |
| 261 | - }*/ | ||
| 262 | - | ||
| 263 | -/* //显示线路线条 | ||
| 264 | - function showLinePolyline(){ | ||
| 265 | - if(!linePolyline || linePolyline.length == 0) | 392 | + return width; |
| 393 | + } | ||
| 394 | + | ||
| 395 | + function transMultiWGSToGCJ(obj) { | ||
| 396 | + if(!obj._gPoints) | ||
| 266 | return; | 397 | return; |
| 398 | + var gcjPoints=[],coord; | ||
| 267 | 399 | ||
| 268 | - layer.msg('显示线路图层',{offset: 'ct', shift : 5}); | ||
| 269 | - $.each(linePolyline, function(){ | ||
| 270 | - this.setOptions({strokeOpacity: 0.5}); | 400 | + $.each(obj._gPoints, function () { |
| 401 | + coord = TransGPS.transformFromWGSToGCJ(this.lat, this.lng); | ||
| 402 | + gcjPoints.push([coord.lng, coord.lat]); | ||
| 271 | }); | 403 | }); |
| 272 | - }*/ | 404 | + |
| 405 | + obj.gcjPoints=gcjPoints; | ||
| 406 | + } | ||
| 273 | 407 | ||
| 274 | function openWindow(marker){ | 408 | function openWindow(marker){ |
| 275 | var gps = marker.gpsData; | 409 | var gps = marker.gpsData; |
| @@ -282,12 +416,12 @@ var gb_map_gaode = (function() { | @@ -282,12 +416,12 @@ var gb_map_gaode = (function() { | ||
| 282 | marker.infoWindow.open(map, marker.getPosition()); | 416 | marker.infoWindow.open(map, marker.getPosition()); |
| 283 | } | 417 | } |
| 284 | 418 | ||
| 285 | - function setTop(marker){ | 419 | +/* function setTop(marker, index){ |
| 286 | if(topMarkr) | 420 | if(topMarkr) |
| 287 | topMarkr.setzIndex(1); | 421 | topMarkr.setzIndex(1); |
| 288 | marker.setzIndex(2); | 422 | marker.setzIndex(2); |
| 289 | topMarkr = marker; | 423 | topMarkr = marker; |
| 290 | - } | 424 | + }*/ |
| 291 | 425 | ||
| 292 | //文件载入完毕 | 426 | //文件载入完毕 |
| 293 | mapmonitor_load_ep.emitLater('load_gaode'); | 427 | mapmonitor_load_ep.emitLater('load_gaode'); |
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
| @@ -17,7 +17,19 @@ var gb_map_overlay_mge = (function () { | @@ -17,7 +17,19 @@ var gb_map_overlay_mge = (function () { | ||
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | var gpsRefreshAll = function (allList) { | 19 | var gpsRefreshAll = function (allList) { |
| 20 | + //是否需要添加樹節點 | ||
| 21 | + var newTreeNodes=[], currArray=gb_map_gps_tree.all_devices(); | ||
| 22 | + $.each(allList, function () { | ||
| 23 | + if(currArray.indexOf(this.deviceId) == -1) | ||
| 24 | + newTreeNodes.push(this); | ||
| 25 | + }); | ||
| 26 | + | ||
| 20 | gb_map_imap.call('drawRealGpsMarker', {gpsList: allList}); | 27 | gb_map_imap.call('drawRealGpsMarker', {gpsList: allList}); |
| 28 | + | ||
| 29 | + //有新设备上线 | ||
| 30 | + if(newTreeNodes.length > 0){ | ||
| 31 | + gb_map_gps_tree.create_node(newTreeNodes, showOverlayByChecks); | ||
| 32 | + } | ||
| 21 | }; | 33 | }; |
| 22 | 34 | ||
| 23 | var deviceFilter = function (node) { | 35 | var deviceFilter = function (node) { |
| @@ -85,6 +97,9 @@ var gb_map_overlay_mge = (function () { | @@ -85,6 +97,9 @@ var gb_map_overlay_mge = (function () { | ||
| 85 | reDraw(); | 97 | reDraw(); |
| 86 | //注册GPS刷新事件 | 98 | //注册GPS刷新事件 |
| 87 | gb_data_gps.registerCallback(gpsRefresh); | 99 | gb_data_gps.registerCallback(gpsRefresh); |
| 100 | + | ||
| 101 | + | ||
| 102 | + centerToRational(); | ||
| 88 | }; | 103 | }; |
| 89 | 104 | ||
| 90 | 105 | ||
| @@ -185,6 +200,15 @@ var gb_map_overlay_mge = (function () { | @@ -185,6 +200,15 @@ var gb_map_overlay_mge = (function () { | ||
| 185 | 200 | ||
| 186 | gb_map_imap.call('drawPolygon', opt); | 201 | gb_map_imap.call('drawPolygon', opt); |
| 187 | } | 202 | } |
| 203 | + | ||
| 204 | + //地图居中至合理的位置 | ||
| 205 | + var centerToRational=function () { | ||
| 206 | + var chs=gb_map_gps_tree.getChecked(); | ||
| 207 | + if(chs && chs.length > 0){ | ||
| 208 | + var id=chs[0].data.lineId+'_'+chs[0].data.upDown; | ||
| 209 | + gb_map_imap.call('centerToLine', {id: id}); | ||
| 210 | + } | ||
| 211 | + } | ||
| 188 | 212 | ||
| 189 | return { | 213 | return { |
| 190 | init: init, | 214 | init: init, |
| @@ -205,6 +229,7 @@ var gb_map_overlay_mge = (function () { | @@ -205,6 +229,7 @@ var gb_map_overlay_mge = (function () { | ||
| 205 | getCheckedDevice: getCheckedDevice, | 229 | getCheckedDevice: getCheckedDevice, |
| 206 | drawStation: drawStation, | 230 | drawStation: drawStation, |
| 207 | drawElectronicFence: drawElectronicFence, | 231 | drawElectronicFence: drawElectronicFence, |
| 208 | - drawCarpark: drawCarpark | 232 | + drawCarpark: drawCarpark, |
| 233 | + centerToRational:centerToRational | ||
| 209 | }; | 234 | }; |
| 210 | })(); | 235 | })(); |
| 211 | \ No newline at end of file | 236 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/real.html
| @@ -5,8 +5,19 @@ | @@ -5,8 +5,19 @@ | ||
| 5 | <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/> | 5 | <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/> |
| 6 | 6 | ||
| 7 | <div class="map-system-msg"> | 7 | <div class="map-system-msg"> |
| 8 | - <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank"><i style="transform: rotate(90deg);" class="uk-icon-hand-pointer-o"></i> 当前地图模块正在维护升级中,请点这里打开原版地图。</a> | 8 | + <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank"> |
| 9 | + 当前地图模块正在维护升级中,请点这里打开原版地图 | ||
| 10 | + | ||
| 11 | + <i class="uk-icon-close map-system-msg-close"></i> | ||
| 12 | + </a> | ||
| 9 | </div> | 13 | </div> |
| 14 | +<script> | ||
| 15 | + $('.map-system-msg-close').on('click', function (e) { | ||
| 16 | + e.stopPropagation(); | ||
| 17 | + $('.map-system-msg').addClass('flex-left'); | ||
| 18 | + return false; | ||
| 19 | + }); | ||
| 20 | +</script> | ||
| 10 | 21 | ||
| 11 | <div id="real_map_container"></div> | 22 | <div id="real_map_container"></div> |
| 12 | <div class="real_right_gps_panel"> | 23 | <div class="real_right_gps_panel"> |
| @@ -22,9 +33,6 @@ | @@ -22,9 +33,6 @@ | ||
| 22 | 33 | ||
| 23 | <div class="real_bottom_panel"> | 34 | <div class="real_bottom_panel"> |
| 24 | <div id="handle" class="ui-resizable-handle ui-resizable-n"></div> | 35 | <div id="handle" class="ui-resizable-handle ui-resizable-n"></div> |
| 25 | - <div class="real_bl_cont"> | ||
| 26 | - | ||
| 27 | - </div> | ||
| 28 | <div class="real_br_cont map_config_wrap"></div> | 36 | <div class="real_br_cont map_config_wrap"></div> |
| 29 | </div> | 37 | </div> |
| 30 | 38 |