Commit dfd3a1924c5b03c4d96a0b9e51cb438a2b2441b1

Authored by 王通
1 parent b56089fd

1.线调->地图中电子围栏显示异常修复

src/main/java/com/bsth/controller/realcontrol/dto/StationSpatialData.java
1 -package com.bsth.controller.realcontrol.dto;  
2 -  
3 -/**  
4 - * Created by panzhao on 2016/11/23.  
5 - */  
6 -public class StationSpatialData {  
7 -  
8 - private String lineCode;  
9 -  
10 - private String stationName;  
11 -  
12 - private String stationCode;  
13 -  
14 - private String stationMark;  
15 -  
16 - private int directions;  
17 -  
18 - private Float distances;  
19 -  
20 - private Float toTime;  
21 -  
22 - private Integer versions;  
23 -  
24 - private Float gLonx;  
25 -  
26 - private Float gLaty;  
27 -  
28 - private Float radius;  
29 -  
30 - private String shapesType;  
31 -  
32 - private String gPolygonGrid;  
33 -  
34 - private Integer stationRouteCode;  
35 -  
36 - public String getLineCode() {  
37 - return lineCode;  
38 - }  
39 -  
40 - public void setLineCode(String lineCode) {  
41 - this.lineCode = lineCode;  
42 - }  
43 -  
44 - public String getStationName() {  
45 - return stationName;  
46 - }  
47 -  
48 - public void setStationName(String stationName) {  
49 - this.stationName = stationName;  
50 - }  
51 -  
52 - public String getStationCode() {  
53 - return stationCode;  
54 - }  
55 -  
56 - public void setStationCode(String stationCode) {  
57 - this.stationCode = stationCode;  
58 - }  
59 -  
60 - public String getStationMark() {  
61 - return stationMark;  
62 - }  
63 -  
64 - public void setStationMark(String stationMark) {  
65 - this.stationMark = stationMark;  
66 - }  
67 -  
68 - public int getDirections() {  
69 - return directions;  
70 - }  
71 -  
72 - public void setDirections(int directions) {  
73 - this.directions = directions;  
74 - }  
75 -  
76 - public Float getDistances() {  
77 - return distances;  
78 - }  
79 -  
80 - public void setDistances(Float distances) {  
81 - this.distances = distances;  
82 - }  
83 -  
84 - public Float getToTime() {  
85 - return toTime;  
86 - }  
87 -  
88 - public void setToTime(Float toTime) {  
89 - this.toTime = toTime;  
90 - }  
91 -  
92 - public Integer getVersions() {  
93 - return versions;  
94 - }  
95 -  
96 - public void setVersions(Integer versions) {  
97 - this.versions = versions;  
98 - }  
99 -  
100 - public Float getgLonx() {  
101 - return gLonx;  
102 - }  
103 -  
104 - public void setgLonx(Float gLonx) {  
105 - this.gLonx = gLonx;  
106 - }  
107 -  
108 - public Float getgLaty() {  
109 - return gLaty;  
110 - }  
111 -  
112 - public void setgLaty(Float gLaty) {  
113 - this.gLaty = gLaty;  
114 - }  
115 -  
116 - public Float getRadius() {  
117 - return radius;  
118 - }  
119 -  
120 - public void setRadius(Float radius) {  
121 - this.radius = radius;  
122 - }  
123 -  
124 - public String getShapesType() {  
125 - return shapesType;  
126 - }  
127 -  
128 - public void setShapesType(String shapesType) {  
129 - this.shapesType = shapesType;  
130 - }  
131 -  
132 - public String getgPolygonGrid() {  
133 - return gPolygonGrid;  
134 - }  
135 -  
136 - public void setgPolygonGrid(String gPolygonGrid) {  
137 - this.gPolygonGrid = gPolygonGrid;  
138 - }  
139 -  
140 - public Integer getStationRouteCode() {  
141 - return stationRouteCode;  
142 - }  
143 -  
144 - public void setStationRouteCode(Integer stationRouteCode) {  
145 - this.stationRouteCode = stationRouteCode;  
146 - }  
147 -} 1 +package com.bsth.controller.realcontrol.dto;
  2 +
  3 +/**
  4 + * Created by panzhao on 2016/11/23.
  5 + */
  6 +public class StationSpatialData {
  7 +
  8 + private Integer stationRouteId;
  9 +
  10 + private String lineCode;
  11 +
  12 + private String stationName;
  13 +
  14 + private String stationCode;
  15 +
  16 + private String stationMark;
  17 +
  18 + private int directions;
  19 +
  20 + private Float distances;
  21 +
  22 + private Float toTime;
  23 +
  24 + private Integer versions;
  25 +
  26 + private Float gLonx;
  27 +
  28 + private Float gLaty;
  29 +
  30 + private Float radius;
  31 +
  32 + private String shapesType;
  33 +
  34 + private String gPolygonGrid;
  35 +
  36 + private Integer stationRouteCode;
  37 +
  38 + public Integer getStationRouteId() {
  39 + return stationRouteId;
  40 + }
  41 +
  42 + public void setStationRouteId(Integer stationRouteId) {
  43 + this.stationRouteId = stationRouteId;
  44 + }
  45 +
  46 + public String getLineCode() {
  47 + return lineCode;
  48 + }
  49 +
  50 + public void setLineCode(String lineCode) {
  51 + this.lineCode = lineCode;
  52 + }
  53 +
  54 + public String getStationName() {
  55 + return stationName;
  56 + }
  57 +
  58 + public void setStationName(String stationName) {
  59 + this.stationName = stationName;
  60 + }
  61 +
  62 + public String getStationCode() {
  63 + return stationCode;
  64 + }
  65 +
  66 + public void setStationCode(String stationCode) {
  67 + this.stationCode = stationCode;
  68 + }
  69 +
  70 + public String getStationMark() {
  71 + return stationMark;
  72 + }
  73 +
  74 + public void setStationMark(String stationMark) {
  75 + this.stationMark = stationMark;
  76 + }
  77 +
  78 + public int getDirections() {
  79 + return directions;
  80 + }
  81 +
  82 + public void setDirections(int directions) {
  83 + this.directions = directions;
  84 + }
  85 +
  86 + public Float getDistances() {
  87 + return distances;
  88 + }
  89 +
  90 + public void setDistances(Float distances) {
  91 + this.distances = distances;
  92 + }
  93 +
  94 + public Float getToTime() {
  95 + return toTime;
  96 + }
  97 +
  98 + public void setToTime(Float toTime) {
  99 + this.toTime = toTime;
  100 + }
  101 +
  102 + public Integer getVersions() {
  103 + return versions;
  104 + }
  105 +
  106 + public void setVersions(Integer versions) {
  107 + this.versions = versions;
  108 + }
  109 +
  110 + public Float getgLonx() {
  111 + return gLonx;
  112 + }
  113 +
  114 + public void setgLonx(Float gLonx) {
  115 + this.gLonx = gLonx;
  116 + }
  117 +
  118 + public Float getgLaty() {
  119 + return gLaty;
  120 + }
  121 +
  122 + public void setgLaty(Float gLaty) {
  123 + this.gLaty = gLaty;
  124 + }
  125 +
  126 + public Float getRadius() {
  127 + return radius;
  128 + }
  129 +
  130 + public void setRadius(Float radius) {
  131 + this.radius = radius;
  132 + }
  133 +
  134 + public String getShapesType() {
  135 + return shapesType;
  136 + }
  137 +
  138 + public void setShapesType(String shapesType) {
  139 + this.shapesType = shapesType;
  140 + }
  141 +
  142 + public String getgPolygonGrid() {
  143 + return gPolygonGrid;
  144 + }
  145 +
  146 + public void setgPolygonGrid(String gPolygonGrid) {
  147 + this.gPolygonGrid = gPolygonGrid;
  148 + }
  149 +
  150 + public Integer getStationRouteCode() {
  151 + return stationRouteCode;
  152 + }
  153 +
  154 + public void setStationRouteCode(Integer stationRouteCode) {
  155 + this.stationRouteCode = stationRouteCode;
  156 + }
  157 +}
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
@@ -42,7 +42,7 @@ public class RealMapServiceImpl implements RealMapService { @@ -42,7 +42,7 @@ public class RealMapServiceImpl implements RealMapService {
42 } 42 }
43 inStr = " (" + inStr.substring(1) + ")"; 43 inStr = " (" + inStr.substring(1) + ")";
44 44
45 - String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,ST_X(s.CENTER_POINT_WGS) G_LONX,ST_Y(s.CENTER_POINT_WGS) G_LATY,r.RADIUS,r.SHAPED_TYPE shapes_type,ST_AsText(r.BUFFER_POLYGON_WGS) 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"; 45 + String sql = "select r.ID STATION_ROUTE_ID,r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,ST_X(s.CENTER_POINT_WGS) G_LONX,ST_Y(s.CENTER_POINT_WGS) G_LATY,r.RADIUS,r.SHAPED_TYPE shapes_type,ST_AsText(r.BUFFER_POLYGON_WGS) 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";
46 46
47 List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class)); 47 List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class));
48 rs.put("status", ResponseCode.SUCCESS); 48 rs.put("status", ResponseCode.SUCCESS);
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
@@ -282,7 +282,7 @@ var gb_map_baidu = (function(){ @@ -282,7 +282,7 @@ var gb_map_baidu = (function(){
282 //绘制多边形 282 //绘制多边形
283 drawPolygon: function(opt){ 283 drawPolygon: function(opt){
284 var station = opt.station 284 var station = opt.station
285 - ,code = station.stationCode; 285 + ,code = station.stationRouteId;
286 if(electronicFences[code]){ 286 if(electronicFences[code]){
287 electronicFences[code].show(); 287 electronicFences[code].show();
288 return; 288 return;
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/gaode.js
@@ -168,7 +168,7 @@ var gb_map_gaode = (function() { @@ -168,7 +168,7 @@ var gb_map_gaode = (function() {
168 //绘制多边形 168 //绘制多边形
169 drawPolygon: function(opt){ 169 drawPolygon: function(opt){
170 var station = opt.station 170 var station = opt.station
171 - ,code = station.stationCode; 171 + ,code = station.stationRouteId;
172 if(electronicFences[code]){ 172 if(electronicFences[code]){
173 electronicFences[code].show(); 173 electronicFences[code].show();
174 return; 174 return;
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
1 -var gb_map_overlay_mge = (function () {  
2 -  
3 - var storage = window.localStorage;  
4 -  
5 - var temps;  
6 - $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) {  
7 - temps = gb_common.compileTempByDom(dom, {compress: true});  
8 - });  
9 -  
10 - var $abnormNoticePanel = $('.c_b_abnorm_notice');  
11 - var gpsRefresh = function (addArr, upArr, upDownChange, overspeedList) {  
12 - if(!$('.main-container .map-panel').is(':visible'))  
13 - return;  
14 - //如果地图正在重绘,暂时不刷新GPS  
15 - if(reDrawing)  
16 - return;  
17 - //var all = addArr.concat(upArr).concat(upDownChange);  
18 - gpsRefreshAll(addArr, upArr, upDownChange);  
19 -  
20 - //渲染超速信息  
21 - overspeedList.sort(overspeed_sort);  
22 - var htmlStr = template('map_abnorm_overspeed_list-temp', {list: overspeedList});  
23 - $abnormNoticePanel.html(htmlStr).scrollTop($abnormNoticePanel[0].scrollHeight);  
24 - };  
25 -  
26 - var overspeed_sort = function (a, b) {  
27 - if(a.ets && !b.ets)  
28 - return -1;  
29 - if(!a.ets && b.ets)  
30 - return 1;  
31 - return a.st - b.st;  
32 - };  
33 -  
34 - /**  
35 - * 超速点击  
36 - */  
37 - $abnormNoticePanel.on('click', '.c_b_item', function () {  
38 - var nbbm = $(this).data('nbbm');  
39 - gb_map_gps_tree.selectitem(null, {value: nbbm});  
40 - });  
41 -  
42 - var gpsRefreshAll = function (addArr, upArr, upDownChange) {  
43 - //更新设备树菜单  
44 - if(gb_map_gps_tree.readyStatus()){  
45 - gb_map_gps_tree.create_node(addArr);  
46 - gb_map_gps_tree.update_node(upArr);  
47 - gb_map_gps_tree.changeUpDown(upDownChange);  
48 - }  
49 -  
50 - //更新地图  
51 - var all = addArr.concat(upArr).concat(upDownChange);  
52 - gb_map_imap.call('drawRealGpsMarker', {gpsList: all});  
53 - };  
54 -  
55 - var reload_gps = function () {  
56 - var array = gb_common.get_vals(gb_data_gps.allGps);  
57 - gb_map_gps_tree.refresh();  
58 - gb_map_imap.call('drawRealGpsMarker', {gpsList: array});  
59 - };  
60 -  
61 - var deviceFilter = function (node) {  
62 - return node.a_attr && node.a_attr.type=='device';  
63 - };  
64 -  
65 - //绘制线路走向  
66 - var drawAllSection=function () {  
67 - //绘制线路走向  
68 - var lines=JSON.parse(storage.getItem('lineControlItems'));  
69 - $.each(lines, function () {  
70 - //从storage里获取路由数据  
71 - var lineCode=this.lineCode;  
72 - var route = JSON.parse(storage.getItem(lineCode + '_route'));  
73 - //上行  
74 - gb_map_imap.call('drawLine', {  
75 - route: route,  
76 - style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.up},  
77 - id: lineCode+'_0',  
78 - upDown: 0,  
79 - hide: true  
80 - });  
81 - //下行  
82 - gb_map_imap.call('drawLine', {  
83 - route: route,  
84 - style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.down},  
85 - id: lineCode+'_1',  
86 - upDown: 1,  
87 - hide: true  
88 - });  
89 -  
90 - });  
91 - };  
92 -  
93 - //根据选中项显示路段  
94 - var showSection = function (chs) {  
95 - var idx = {};  
96 - $.each(chs, function () {  
97 - idx[this.data.lineId+'_'+this.data.upDown]=1;  
98 - });  
99 -  
100 - gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)});  
101 - };  
102 -  
103 -  
104 - //是否正在重绘  
105 - var reDrawing;  
106 - var reDraw = function () {  
107 - reDrawing = true;  
108 -  
109 - gb_map_imap.call('clearAll');  
110 -  
111 - try{  
112 - drawAllSection();  
113 - }catch (e){  
114 - console.log(e);  
115 - }  
116 - //重绘GPS  
117 - gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});  
118 -  
119 - showOverlayByChecks();  
120 - //显示路段  
121 - showSection(getCheckedDevice());  
122 -  
123 - reDrawing = false;  
124 - };  
125 -  
126 - //重绘GPS  
127 - var reDrawGps = function () {  
128 - reDrawing = true;  
129 - gb_map_imap.call('clearAllGps');  
130 - //重绘GPS  
131 - gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});  
132 -  
133 - showOverlayByChecks();  
134 - reDrawing = false;  
135 - };  
136 -  
137 - var init = function () {  
138 - reDraw();  
139 - //注册GPS刷新事件  
140 - gb_data_gps.registerCallback(gpsRefresh);  
141 -  
142 - centerToRational();  
143 - };  
144 -  
145 -  
146 - var showOverlayByChecks = function () {  
147 - var chs = getCheckedDevice(),chsMap={};  
148 - $.each(chs, function () {  
149 - chsMap[this.a_attr.device]=true;  
150 - });  
151 -  
152 - gb_map_imap.call('showGpsMarker', {chs: chsMap});  
153 -  
154 - //路段  
155 - showSection(chs);  
156 -  
157 - };  
158 -  
159 - var _focus = function (deviceId) {  
160 - gb_map_imap.call('goToMarker', {deviceId: deviceId});  
161 - //打开信息窗口  
162 - gb_map_imap.call('openWindow',{deviceId: deviceId});  
163 - };  
164 -  
165 - //站点获得焦点  
166 - var _focus_station = function (station) {  
167 - gb_map_imap.call('goToStation', station.stationCode);  
168 - };  
169 -  
170 - //停车场获得焦点  
171 - var _focus_carpark = function (carpark) {  
172 - //console.log('_focus_carpark', carpark);  
173 - gb_map_imap.call('goToCarpark', carpark.parkCode);  
174 - };  
175 -  
176 - function getCheckedDevice() {  
177 - return gb_map_gps_tree.getChecked().filter(deviceFilter);  
178 - }  
179 -  
180 - //绘制站点  
181 - var drawStation = function () {  
182 - var list = gb_map_spatial_data.getCheckedStation();  
183 - //绘制站点  
184 - gb_map_imap.call('drawStationMarker', {list: list});  
185 - //绘制电子围栏  
186 - drawElectronicFence(list);  
187 - };  
188 -  
189 - //绘制电子围栏  
190 - var drawElectronicFence = function (list) {  
191 - var config = gb_map_config.getConfig().spatialData;  
192 - if(!config.electronicFence)  
193 - return;  
194 -  
195 - if(!list){  
196 - list = gb_map_spatial_data.getCheckedStation();  
197 - }  
198 -  
199 -  
200 - gb_map_imap.call('hideAllCircles');  
201 - $.each(list, function () {  
202 - fun=this.shapesType=='r'?drawCircle:drawPolygon;  
203 - fun(this);  
204 - });  
205 - };  
206 -  
207 - //绘制停车场  
208 - var drawCarpark = function () {  
209 - var list = gb_map_spatial_data.gteCheckedCarpark();  
210 - gb_map_imap.call('drawCarpark', {list: list});  
211 - };  
212 -  
213 - var drawCircle=function (data) {  
214 - var config = gb_map_config.getConfig().section.color;  
215 - var color = data.directions==0?config.up:config.down;  
216 -  
217 - var opt = {  
218 - lon: data.lon,  
219 - lat: data.lat,  
220 - text: data.stationName,  
221 - color: color,  
222 - weight: 2,  
223 - radius: parseFloat(data.radius),  
224 - id: data.stationCode  
225 - };  
226 -  
227 - gb_map_imap.call('drawCircle', opt);  
228 - };  
229 -  
230 - var drawPolygon=function (data) {  
231 - var config = gb_map_config.getConfig().section.color;  
232 - var color = data.directions==0?config.up:config.down;  
233 -  
234 - var opt = {  
235 - //id:data.stationCode,  
236 - color: color,  
237 - weight: 2,  
238 - station: data  
239 - };  
240 -  
241 - gb_map_imap.call('drawPolygon', opt);  
242 - };  
243 -  
244 - //地图居中至合理的位置  
245 - var centerToRational=function () {  
246 - var chs=getCheckedDevice();  
247 - if(chs && chs.length > 0){  
248 - var id=chs[0].data.lineId+'_'+chs[0].data.upDown;  
249 - gb_map_imap.call('centerToLine', {id: id});  
250 - }  
251 - };  
252 -  
253 - return {  
254 - init: init,  
255 - refresh: showOverlayByChecks,  
256 - _focus: _focus,  
257 - _focus_station: _focus_station,  
258 - _focus_carpark: _focus_carpark,  
259 - map_gps_win_temp: function (data) {  
260 - return temps['map-win-gps-detail-temp'](data);  
261 - },  
262 - map_station_win_temp: function (data) {  
263 - return temps['map-win-station-detail-temp'](data);  
264 - },  
265 - map_carpark_win_temp: function (data) {  
266 - return temps['map-win-carpark-detail-temp'](data);  
267 - },  
268 - reDraw: reDraw,  
269 - reDrawGps: reDrawGps,  
270 - getCheckedDevice: getCheckedDevice,  
271 - drawStation: drawStation,  
272 - drawElectronicFence: drawElectronicFence,  
273 - drawCarpark: drawCarpark,  
274 - centerToRational:centerToRational,  
275 - reload_gps: reload_gps  
276 - }; 1 +var gb_map_overlay_mge = (function () {
  2 +
  3 + var storage = window.localStorage;
  4 +
  5 + var temps;
  6 + $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) {
  7 + temps = gb_common.compileTempByDom(dom, {compress: true});
  8 + });
  9 +
  10 + var $abnormNoticePanel = $('.c_b_abnorm_notice');
  11 + var gpsRefresh = function (addArr, upArr, upDownChange, overspeedList) {
  12 + if(!$('.main-container .map-panel').is(':visible'))
  13 + return;
  14 + //如果地图正在重绘,暂时不刷新GPS
  15 + if(reDrawing)
  16 + return;
  17 + //var all = addArr.concat(upArr).concat(upDownChange);
  18 + gpsRefreshAll(addArr, upArr, upDownChange);
  19 +
  20 + //渲染超速信息
  21 + overspeedList.sort(overspeed_sort);
  22 + var htmlStr = template('map_abnorm_overspeed_list-temp', {list: overspeedList});
  23 + $abnormNoticePanel.html(htmlStr).scrollTop($abnormNoticePanel[0].scrollHeight);
  24 + };
  25 +
  26 + var overspeed_sort = function (a, b) {
  27 + if(a.ets && !b.ets)
  28 + return -1;
  29 + if(!a.ets && b.ets)
  30 + return 1;
  31 + return a.st - b.st;
  32 + };
  33 +
  34 + /**
  35 + * 超速点击
  36 + */
  37 + $abnormNoticePanel.on('click', '.c_b_item', function () {
  38 + var nbbm = $(this).data('nbbm');
  39 + gb_map_gps_tree.selectitem(null, {value: nbbm});
  40 + });
  41 +
  42 + var gpsRefreshAll = function (addArr, upArr, upDownChange) {
  43 + //更新设备树菜单
  44 + if(gb_map_gps_tree.readyStatus()){
  45 + gb_map_gps_tree.create_node(addArr);
  46 + gb_map_gps_tree.update_node(upArr);
  47 + gb_map_gps_tree.changeUpDown(upDownChange);
  48 + }
  49 +
  50 + //更新地图
  51 + var all = addArr.concat(upArr).concat(upDownChange);
  52 + gb_map_imap.call('drawRealGpsMarker', {gpsList: all});
  53 + };
  54 +
  55 + var reload_gps = function () {
  56 + var array = gb_common.get_vals(gb_data_gps.allGps);
  57 + gb_map_gps_tree.refresh();
  58 + gb_map_imap.call('drawRealGpsMarker', {gpsList: array});
  59 + };
  60 +
  61 + var deviceFilter = function (node) {
  62 + return node.a_attr && node.a_attr.type=='device';
  63 + };
  64 +
  65 + //绘制线路走向
  66 + var drawAllSection=function () {
  67 + //绘制线路走向
  68 + var lines=JSON.parse(storage.getItem('lineControlItems'));
  69 + $.each(lines, function () {
  70 + //从storage里获取路由数据
  71 + var lineCode=this.lineCode;
  72 + var route = JSON.parse(storage.getItem(lineCode + '_route'));
  73 + //上行
  74 + gb_map_imap.call('drawLine', {
  75 + route: route,
  76 + style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.up},
  77 + id: lineCode+'_0',
  78 + upDown: 0,
  79 + hide: true
  80 + });
  81 + //下行
  82 + gb_map_imap.call('drawLine', {
  83 + route: route,
  84 + style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.down},
  85 + id: lineCode+'_1',
  86 + upDown: 1,
  87 + hide: true
  88 + });
  89 +
  90 + });
  91 + };
  92 +
  93 + //根据选中项显示路段
  94 + var showSection = function (chs) {
  95 + var idx = {};
  96 + $.each(chs, function () {
  97 + idx[this.data.lineId+'_'+this.data.upDown]=1;
  98 + });
  99 +
  100 + gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)});
  101 + };
  102 +
  103 +
  104 + //是否正在重绘
  105 + var reDrawing;
  106 + var reDraw = function () {
  107 + reDrawing = true;
  108 +
  109 + gb_map_imap.call('clearAll');
  110 +
  111 + try{
  112 + drawAllSection();
  113 + }catch (e){
  114 + console.log(e);
  115 + }
  116 + //重绘GPS
  117 + gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});
  118 +
  119 + showOverlayByChecks();
  120 + //显示路段
  121 + showSection(getCheckedDevice());
  122 +
  123 + reDrawing = false;
  124 + };
  125 +
  126 + //重绘GPS
  127 + var reDrawGps = function () {
  128 + reDrawing = true;
  129 + gb_map_imap.call('clearAllGps');
  130 + //重绘GPS
  131 + gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)});
  132 +
  133 + showOverlayByChecks();
  134 + reDrawing = false;
  135 + };
  136 +
  137 + var init = function () {
  138 + reDraw();
  139 + //注册GPS刷新事件
  140 + gb_data_gps.registerCallback(gpsRefresh);
  141 +
  142 + centerToRational();
  143 + };
  144 +
  145 +
  146 + var showOverlayByChecks = function () {
  147 + var chs = getCheckedDevice(),chsMap={};
  148 + $.each(chs, function () {
  149 + chsMap[this.a_attr.device]=true;
  150 + });
  151 +
  152 + gb_map_imap.call('showGpsMarker', {chs: chsMap});
  153 +
  154 + //路段
  155 + showSection(chs);
  156 +
  157 + };
  158 +
  159 + var _focus = function (deviceId) {
  160 + gb_map_imap.call('goToMarker', {deviceId: deviceId});
  161 + //打开信息窗口
  162 + gb_map_imap.call('openWindow',{deviceId: deviceId});
  163 + };
  164 +
  165 + //站点获得焦点
  166 + var _focus_station = function (station) {
  167 + gb_map_imap.call('goToStation', station.stationCode);
  168 + };
  169 +
  170 + //停车场获得焦点
  171 + var _focus_carpark = function (carpark) {
  172 + //console.log('_focus_carpark', carpark);
  173 + gb_map_imap.call('goToCarpark', carpark.parkCode);
  174 + };
  175 +
  176 + function getCheckedDevice() {
  177 + return gb_map_gps_tree.getChecked().filter(deviceFilter);
  178 + }
  179 +
  180 + //绘制站点
  181 + var drawStation = function () {
  182 + var list = gb_map_spatial_data.getCheckedStation();
  183 + //绘制站点
  184 + gb_map_imap.call('drawStationMarker', {list: list});
  185 + //绘制电子围栏
  186 + drawElectronicFence(list);
  187 + };
  188 +
  189 + //绘制电子围栏
  190 + var drawElectronicFence = function (list) {
  191 + var config = gb_map_config.getConfig().spatialData;
  192 + if(!config.electronicFence)
  193 + return;
  194 +
  195 + if(!list){
  196 + list = gb_map_spatial_data.getCheckedStation();
  197 + }
  198 +
  199 +
  200 + gb_map_imap.call('hideAllCircles');
  201 + $.each(list, function () {
  202 + fun=this.shapesType=='r'?drawCircle:drawPolygon;
  203 + fun(this);
  204 + });
  205 + };
  206 +
  207 + //绘制停车场
  208 + var drawCarpark = function () {
  209 + var list = gb_map_spatial_data.gteCheckedCarpark();
  210 + gb_map_imap.call('drawCarpark', {list: list});
  211 + };
  212 +
  213 + var drawCircle=function (data) {
  214 + var config = gb_map_config.getConfig().section.color;
  215 + var color = data.directions==0?config.up:config.down;
  216 +
  217 + var opt = {
  218 + lon: data.lon,
  219 + lat: data.lat,
  220 + text: data.stationName,
  221 + color: color,
  222 + weight: 2,
  223 + radius: parseFloat(data.radius),
  224 + id: data.stationRouteId
  225 + };
  226 +
  227 + gb_map_imap.call('drawCircle', opt);
  228 + };
  229 +
  230 + var drawPolygon=function (data) {
  231 + var config = gb_map_config.getConfig().section.color;
  232 + var color = data.directions==0?config.up:config.down;
  233 +
  234 + var opt = {
  235 + //id:data.stationCode,
  236 + color: color,
  237 + weight: 2,
  238 + station: data
  239 + };
  240 +
  241 + gb_map_imap.call('drawPolygon', opt);
  242 + };
  243 +
  244 + //地图居中至合理的位置
  245 + var centerToRational=function () {
  246 + var chs=getCheckedDevice();
  247 + if(chs && chs.length > 0){
  248 + var id=chs[0].data.lineId+'_'+chs[0].data.upDown;
  249 + gb_map_imap.call('centerToLine', {id: id});
  250 + }
  251 + };
  252 +
  253 + return {
  254 + init: init,
  255 + refresh: showOverlayByChecks,
  256 + _focus: _focus,
  257 + _focus_station: _focus_station,
  258 + _focus_carpark: _focus_carpark,
  259 + map_gps_win_temp: function (data) {
  260 + return temps['map-win-gps-detail-temp'](data);
  261 + },
  262 + map_station_win_temp: function (data) {
  263 + return temps['map-win-station-detail-temp'](data);
  264 + },
  265 + map_carpark_win_temp: function (data) {
  266 + return temps['map-win-carpark-detail-temp'](data);
  267 + },
  268 + reDraw: reDraw,
  269 + reDrawGps: reDrawGps,
  270 + getCheckedDevice: getCheckedDevice,
  271 + drawStation: drawStation,
  272 + drawElectronicFence: drawElectronicFence,
  273 + drawCarpark: drawCarpark,
  274 + centerToRational:centerToRational,
  275 + reload_gps: reload_gps
  276 + };
277 })(); 277 })();
278 \ No newline at end of file 278 \ No newline at end of file