Commit ee24fbe756a6d00b92c08d6c43c118877fb052e4

Authored by lizhuojun
1 parent a9c1e8a6

线调更新

src/main/java/com/bsth/controller/realcontrol/RealMapController.java
@@ -49,6 +49,12 @@ public class RealMapController { @@ -49,6 +49,12 @@ public class RealMapController {
49 return realMapService.findRouteByLine(idx); 49 return realMapService.findRouteByLine(idx);
50 } 50 }
51 51
  52 +
  53 + @RequestMapping(value = "/findRouteAndVersionByLine")
  54 + public Map<String, Object> findRouteByLineAndVersion(@RequestParam String idx) {
  55 + return realMapService.findRouteAndVersionByLine(idx);
  56 + }
  57 +
52 @RequestMapping(value = "/multiRouteByLine") 58 @RequestMapping(value = "/multiRouteByLine")
53 public Map<String, Object> multiRouteByLine(@RequestParam String codeStr) { 59 public Map<String, Object> multiRouteByLine(@RequestParam String codeStr) {
54 return realMapService.multiRouteByLine(codeStr); 60 return realMapService.multiRouteByLine(codeStr);
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -12,9 +12,11 @@ import com.bsth.data.pilot80.PilotReport; @@ -12,9 +12,11 @@ import com.bsth.data.pilot80.PilotReport;
12 import com.bsth.data.safe_driv.SafeDriv; 12 import com.bsth.data.safe_driv.SafeDriv;
13 import com.bsth.data.safe_driv.SafeDrivCenter; 13 import com.bsth.data.safe_driv.SafeDrivCenter;
14 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
  15 +import com.bsth.entity.LineVersions;
15 import com.bsth.entity.directive.D80; 16 import com.bsth.entity.directive.D80;
16 import com.bsth.entity.realcontrol.ScheduleRealInfo; 17 import com.bsth.entity.realcontrol.ScheduleRealInfo;
17 import com.bsth.repository.CarParkRepository; 18 import com.bsth.repository.CarParkRepository;
  19 +import com.bsth.repository.LineVersionsRepository;
18 import com.bsth.repository.StationRepository; 20 import com.bsth.repository.StationRepository;
19 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 21 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
20 import com.bsth.service.gps.entity.*; 22 import com.bsth.service.gps.entity.*;
@@ -81,6 +83,10 @@ public class GpsServiceImpl implements GpsService { @@ -81,6 +83,10 @@ public class GpsServiceImpl implements GpsService {
81 @Autowired 83 @Autowired
82 ScheduleRealInfoRepository scheduleRealInfoRepository; 84 ScheduleRealInfoRepository scheduleRealInfoRepository;
83 85
  86 +
  87 + @Autowired
  88 + LineVersionsRepository lineVersionsRepository;
  89 +
84 // 历史gps查询 90 // 历史gps查询
85 @Override 91 @Override
86 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { 92 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) {
@@ -222,7 +228,35 @@ public class GpsServiceImpl implements GpsService { @@ -222,7 +228,35 @@ public class GpsServiceImpl implements GpsService {
222 //查询GPS数据 228 //查询GPS数据
223 JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); 229 JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource());
224 List<Map<String, Object>> dataList = jdbcTemplate_ms.queryForList(sql.toString()); 230 List<Map<String, Object>> dataList = jdbcTemplate_ms.queryForList(sql.toString());
225 - 231 + if (!dataList.isEmpty()){
  232 +
  233 + int lineId=Integer.parseInt(map_get_str(dataList.get(0), "LINE_ID"));
  234 + List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId);
  235 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  236 + List<Map<String,Object>> vlist=new ArrayList<>();
  237 + Map<String,Object> vMap;
  238 + if (lvs!=null&&!lvs.isEmpty()){
  239 + for (LineVersions lv : lvs) {
  240 + vMap=new HashMap();
  241 + Long sd=lv.getStartDate().getTime();
  242 + Long ed=lv.getEndDate().getTime();
  243 + if (sd<st&&et<ed){
  244 + vMap.put("version",lv.getVersions());
  245 + vMap.put("vtime","all");
  246 + vlist.add(vMap);
  247 + }else if(sd<st&&et>ed&&st<ed){
  248 + vMap.put("version",lv.getVersions());
  249 + vMap.put("endTime",lv.getEndDate().getTime());
  250 + vlist.add(vMap);
  251 + }else if(st<sd&&et<ed&&sd<et){
  252 + vMap.put("version",lv.getVersions());
  253 + vMap.put("startTime",lv.getStartDate().getTime());
  254 + vlist.add(vMap);
  255 + }
  256 + }
  257 + }
  258 + rsMap.put("lineVerson",vlist);
  259 + }
226 Float lon, lat; 260 Float lon, lat;
227 Location bdLoc, gdLoc; 261 Location bdLoc, gdLoc;
228 int inOutStop; 262 int inOutStop;
@@ -714,6 +748,7 @@ public class GpsServiceImpl implements GpsService { @@ -714,6 +748,7 @@ public class GpsServiceImpl implements GpsService {
714 rs.put("outboundList", outboundList); 748 rs.put("outboundList", outboundList);
715 rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000)); 749 rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000));
716 rs.put("dcs", gpsMap.get("dcs")); 750 rs.put("dcs", gpsMap.get("dcs"));
  751 + rs.put("lineVerson",gpsMap.get("lineVerson"));
717 } catch (Exception e) { 752 } catch (Exception e) {
718 logger.error("", e); 753 logger.error("", e);
719 rs.put("status", ResponseCode.ERROR); 754 rs.put("status", ResponseCode.ERROR);
src/main/java/com/bsth/service/realcontrol/RealMapService.java
@@ -12,6 +12,8 @@ public interface RealMapService { @@ -12,6 +12,8 @@ public interface RealMapService {
12 12
13 Map<String, Object> findRouteByLine(String idx); 13 Map<String, Object> findRouteByLine(String idx);
14 14
  15 + Map<String, Object> findRouteAndVersionByLine(String idx);
  16 +
15 Map<String,Object> findRouteAndStationByLine(String lineCode); 17 Map<String,Object> findRouteAndStationByLine(String lineCode);
16 18
17 Map<String,Object> multiSectionRoute(String codeIdx); 19 Map<String,Object> multiSectionRoute(String codeIdx);
src/main/java/com/bsth/service/realcontrol/dto/SectionRouteCoords.java
@@ -24,6 +24,16 @@ public class SectionRouteCoords { @@ -24,6 +24,16 @@ public class SectionRouteCoords {
24 24
25 private Float sectionTime; 25 private Float sectionTime;
26 26
  27 + private Integer versions;
  28 +
  29 + public Integer getVersions() {
  30 + return versions;
  31 + }
  32 +
  33 + public void setVersions(Integer versions) {
  34 + this.versions = versions;
  35 + }
  36 +
27 public int getId() { 37 public int getId() {
28 return id; 38 return id;
29 } 39 }
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,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"; 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,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,r.versions 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);
@@ -84,7 +84,7 @@ public class RealMapServiceImpl implements RealMapService { @@ -84,7 +84,7 @@ public class RealMapServiceImpl implements RealMapService {
84 } 84 }
85 inCond.deleteCharAt(inCond.length() - 1).append(")"); 85 inCond.deleteCharAt(inCond.length() - 1).append(")");
86 86
87 - String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code"; 87 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME,r.versions FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code";
88 List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class)); 88 List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class));
89 89
90 //排序 90 //排序
@@ -133,6 +133,64 @@ public class RealMapServiceImpl implements RealMapService { @@ -133,6 +133,64 @@ public class RealMapServiceImpl implements RealMapService {
133 } 133 }
134 134
135 @Override 135 @Override
  136 + public Map<String, Object> findRouteAndVersionByLine(String idx) {
  137 + Map<String, Object> rs = new HashMap<>();
  138 + StringBuilder inCond = new StringBuilder("(");
  139 + List<String> codeList = Splitter.on(",").splitToList(idx);
  140 + for(String lineCode : codeList){
  141 + inCond.append("'" + lineCode + "',");
  142 + }
  143 + inCond.deleteCharAt(inCond.length() - 1).append(")");
  144 +
  145 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME,r.versions FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code";
  146 + List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class));
  147 +
  148 + //排序
  149 + Collections.sort(list, new Comparator<SectionRouteCoords>() {
  150 + @Override
  151 + public int compare(SectionRouteCoords o1, SectionRouteCoords o2) {
  152 + return Integer.parseInt(o1.getSectionrouteCode()) - Integer.parseInt(o2.getSectionrouteCode());
  153 + }
  154 + });
  155 +
  156 + ArrayListMultimap<String, SectionRouteCoords> listMultimap = ArrayListMultimap.create();
  157 + for (SectionRouteCoords sr : list) {
  158 + //按lineCode 分组
  159 + listMultimap.put(sr.getLineCode()+"_"+sr.getVersions(), sr);
  160 + }
  161 + //坐标转换
  162 + Map<String, Object> subMap;
  163 + Set<String> ks = listMultimap.keySet();
  164 + List<SectionRouteCoords> sublist;
  165 + List<String> upList,downList;
  166 + String vectorStr = "";
  167 + for(String k : ks){
  168 + subMap = new HashMap<>();
  169 + sublist = listMultimap.get(k);
  170 + upList = new ArrayList<>();
  171 + downList = new ArrayList<>();
  172 + for(SectionRouteCoords sr : sublist){
  173 + vectorStr = sr.getGsectionVector();
  174 + vectorStr = vectorStr.substring(11, vectorStr.length() - 2);
  175 + if (sr.getDirections() == 0)
  176 + upList.add(vectorStr);
  177 + else
  178 + downList.add(vectorStr);
  179 + }
  180 + subMap.put("up", upList);
  181 + //subMap.put("upJoins", jointCoords(upList));
  182 + subMap.put("down", downList);
  183 + subMap.put("up_bd", multiWgsToBd(upList));
  184 + subMap.put("down_bd", multiWgsToBd(downList));
  185 + subMap.put("up_gcj", multiWgsToGcj(upList));
  186 + subMap.put("down_gcj", multiWgsToGcj(downList));
  187 +
  188 + rs.put(k, subMap);
  189 + }
  190 + return rs;
  191 + }
  192 +
  193 + @Override
136 public Map<String, Object> findRouteAndStationByLine(String lineCode) { 194 public Map<String, Object> findRouteAndStationByLine(String lineCode) {
137 Map<String, Object> rs = new HashMap<>(); 195 Map<String, Object> rs = new HashMap<>();
138 try { 196 try {
src/main/resources/static/pages/control/lineallot_v2/main.html
@@ -507,6 +507,14 @@ @@ -507,6 +507,14 @@
507 }); 507 });
508 //缓存路由 508 //缓存路由
509 idx=idx.substr(0, idx.length - 1); 509 idx=idx.substr(0, idx.length - 1);
  510 + $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) {
  511 + if (rs) {
  512 + for(var lineCode in rs)
  513 + storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode]));
  514 +
  515 + eq.emit('cache_route');
  516 + }
  517 + });
510 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { 518 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) {
511 if (rs) { 519 if (rs) {
512 for(var lineCode in rs) 520 for(var lineCode in rs)
@@ -516,6 +524,7 @@ @@ -516,6 +524,7 @@
516 } 524 }
517 }); 525 });
518 526
  527 +
519 //检查线路配置 528 //检查线路配置
520 checkLineConfig(ls_line_data, function (rs) { 529 checkLineConfig(ls_line_data, function (rs) {
521 if (rs.status == 0) 530 if (rs.status == 0)
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/right.html
@@ -80,8 +80,11 @@ @@ -80,8 +80,11 @@
80 var timeTip = $('.ui-slider-tip', rightWrap); 80 var timeTip = $('.ui-slider-tip', rightWrap);
81 var scale = $('.scale', progress); 81 var scale = $('.scale', progress);
82 var play_before_flag; 82 var play_before_flag;
  83 + var lineVersionList;
  84 + var currentVersion;
83 85
84 $('.play-back-tools-wrap', rightWrap).on('ready-to-play', function (e, data) { 86 $('.play-back-tools-wrap', rightWrap).on('ready-to-play', function (e, data) {
  87 + debugger
85 e.stopPropagation(); 88 e.stopPropagation();
86 //reset 89 //reset
87 reset(); 90 reset();
@@ -89,6 +92,7 @@ @@ -89,6 +92,7 @@
89 gpsArray = data.list; 92 gpsArray = data.list;
90 arrivalData = data.arrivalData; 93 arrivalData = data.arrivalData;
91 inoutLen = arrivalData.length; 94 inoutLen = arrivalData.length;
  95 + lineVersionList=data.lineVerson;
92 96
93 if(!gpsArray || gpsArray.length==0) 97 if(!gpsArray || gpsArray.length==0)
94 return; 98 return;
@@ -241,7 +245,7 @@ debugger @@ -241,7 +245,7 @@ debugger
241 } 245 }
242 246
243 gps = gpsArray[index]; 247 gps = gpsArray[index];
244 - drawCarMarker(gps);//更新GPS点位 248 + getLineVersionAnddrawCarMarker(gps);
245 updateTrailLine(gps, index);//行车轨迹线 249 updateTrailLine(gps, index);//行车轨迹线
246 updateProgress(gps, index)//进度条 250 updateProgress(gps, index)//进度条
247 251
@@ -276,7 +280,8 @@ debugger @@ -276,7 +280,8 @@ debugger
276 var xlPolyline = {}; 280 var xlPolyline = {};
277 var circleFirstStop=0; 281 var circleFirstStop=0;
278 var circlePrevStop=0; 282 var circlePrevStop=0;
279 - var drawCarMarker = function (gps) { 283 + var circleLine=false;
  284 + var drawCarMarker = function (gps,lineVersion) {
280 if(!gpsMarker){ 285 if(!gpsMarker){
281 gpsMarker = new BMap.Marker(new BMap.Point(gps.bd_lon, gps.bd_lat)); 286 gpsMarker = new BMap.Marker(new BMap.Point(gps.bd_lon, gps.bd_lat));
282 var width = gb_map_imap.calcGpsMarkerWidth(gps.nbbm); 287 var width = gb_map_imap.calcGpsMarkerWidth(gps.nbbm);
@@ -291,19 +296,21 @@ debugger @@ -291,19 +296,21 @@ debugger
291 var width = gb_map_imap.calcGpsMarkerWidth(gps.nbbm); 296 var width = gb_map_imap.calcGpsMarkerWidth(gps.nbbm);
292 gpsMarker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75))); 297 gpsMarker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75)));
293 } 298 }
294 - var circleLine=queryIsCircle(gps.lineId,gps.nbbm,gps.timestamp,gps.stopNo); 299 + if (gps.lineId!=xlPolyline.lineId) {
  300 + circleLine=queryIsCircle(gps.lineId,gps.nbbm,gps.timestamp,gps.stopNo);
  301 + }
295 if (circleLine) 302 if (circleLine)
296 circleFirstStop=gps.stopNo; 303 circleFirstStop=gps.stopNo;
297 circleLine=circleLine&&circlePrevStop!=circleFirstStop?true:false; 304 circleLine=circleLine&&circlePrevStop!=circleFirstStop?true:false;
298 circlePrevStop=gps.stopNo; 305 circlePrevStop=gps.stopNo;
299 - if(autoChange && (gps.lineId!=xlPolyline.lineId || gps.upDown!=xlPolyline.upDown||circleLine)){  
300 - drawXlPolyline(gps.lineId, gps.upDown); 306 + if(autoChange && (gps.lineId!=xlPolyline.lineId || gps.upDown!=xlPolyline.upDown||circleLine)||xlPolyline.lineVersion != lineVersion){
  307 + drawXlPolyline(gps.lineId, gps.upDown,lineVersion);
301 } 308 }
302 } 309 }
303 310
304 var bform = $('.buffer_area_form', rightWrap); 311 var bform = $('.buffer_area_form', rightWrap);
305 var autoChange=true; 312 var autoChange=true;
306 - function drawXlPolyline(lineCode, upDown) { 313 + function drawXlPolyline(lineCode, upDown,lineVersion) {
307 if(upDown!=0 && upDown!=1){ 314 if(upDown!=0 && upDown!=1){
308 //upDown = xlPolyline.upDown?xlPolyline.upDown:0; 315 //upDown = xlPolyline.upDown?xlPolyline.upDown:0;
309 return; 316 return;
@@ -311,19 +318,21 @@ debugger @@ -311,19 +318,21 @@ debugger
311 318
312 clearXlPolyline(); 319 clearXlPolyline();
313 //绘制路段 320 //绘制路段
314 - drawRoadPolyline(lineCode, upDown); 321 + drawRoadPolyline(lineCode, upDown,lineVersion);
315 //绘制站点 322 //绘制站点
316 if($('input[name=drawPoint]', bform)[0].checked) 323 if($('input[name=drawPoint]', bform)[0].checked)
317 - drawStationMarkers(lineCode, upDown); 324 + drawStationMarkers(lineCode, upDown,lineVersion);
318 //绘制缓冲区 325 //绘制缓冲区
319 if($('input[name=drawBuffArea]', bform)[0].checked) 326 if($('input[name=drawBuffArea]', bform)[0].checked)
320 - drawBuffArea(lineCode, upDown); 327 + drawBuffArea(lineCode, upDown,lineVersion);
321 //绘制站点名称 328 //绘制站点名称
322 if($('input[name=stationName]', bform)[0].checked) 329 if($('input[name=stationName]', bform)[0].checked)
323 - drawNameMarkers(lineCode, upDown); 330 + drawNameMarkers(lineCode, upDown,lineVersion);
324 331
325 xlPolyline.lineId = lineCode; 332 xlPolyline.lineId = lineCode;
326 xlPolyline.upDown = upDown; 333 xlPolyline.upDown = upDown;
  334 + xlPolyline.lineVersion = lineVersion;
  335 + currentVersion =lineVersion;
327 } 336 }
328 337
329 var storage = window.localStorage; 338 var storage = window.localStorage;
@@ -331,10 +340,11 @@ debugger @@ -331,10 +340,11 @@ debugger
331 var stations;//站点 340 var stations;//站点
332 var parks;//停车场 341 var parks;//停车场
333 342
334 - function drawRoadPolyline(lineCode, upDown) { 343 + function drawRoadPolyline(lineCode, upDown,lineVersion) {
335 //从localStorage获取路段 344 //从localStorage获取路段
336 - routes = JSON.parse(storage.getItem(lineCode + '_route')); 345 + routes = JSON.parse(storage.getItem(lineCode+"_"+lineVersion + '_route'));
337 if(!routes){ 346 if(!routes){
  347 + debugger
338 var name = gb_data_basic.lineCode2NameAll()[lineCode]; 348 var name = gb_data_basic.lineCode2NameAll()[lineCode];
339 notify_err("缺少" + name + "的路段信息,请选择" + name + "进入线调"); 349 notify_err("缺少" + name + "的路段信息,请选择" + name + "进入线调");
340 return; 350 return;
@@ -355,7 +365,7 @@ debugger @@ -355,7 +365,7 @@ debugger
355 xlPolyline.polylines = pls; 365 xlPolyline.polylines = pls;
356 } 366 }
357 367
358 - function drawStationMarkers(lineCode, upDown) { 368 + function drawStationMarkers(lineCode, upDown,lineVersion) {
359 if(!lineCode)return; 369 if(!lineCode)return;
360 //从地图模块获取站点数据 370 //从地图模块获取站点数据
361 stations = gb_map_spatial_data.getStationArray(lineCode); 371 stations = gb_map_spatial_data.getStationArray(lineCode);
@@ -367,6 +377,8 @@ debugger @@ -367,6 +377,8 @@ debugger
367 377
368 var array = stations[upDown], psm, zdMarkers=[]; 378 var array = stations[upDown], psm, zdMarkers=[];
369 $.each(array, function () { 379 $.each(array, function () {
  380 + if(this.versions==lineVersion){
  381 +
370 //坐标转换 382 //坐标转换
371 var coord = TransGPS.wgsToBD(this.lat, this.lon); 383 var coord = TransGPS.wgsToBD(this.lat, this.lon);
372 this.bd_lat = coord.lat; 384 this.bd_lat = coord.lat;
@@ -376,11 +388,12 @@ debugger @@ -376,11 +388,12 @@ debugger
376 map.addOverlay(psm); 388 map.addOverlay(psm);
377 psm.setIcon(new BMap.Icon(gb_map_imap.createStationPointIcon(), new BMap.Size(12, 12))); 389 psm.setIcon(new BMap.Icon(gb_map_imap.createStationPointIcon(), new BMap.Size(12, 12)));
378 zdMarkers.push(psm); 390 zdMarkers.push(psm);
  391 + }
379 }); 392 });
380 xlPolyline.zdMarkers=zdMarkers; 393 xlPolyline.zdMarkers=zdMarkers;
381 } 394 }
382 395
383 - function drawBuffArea(lineCode, upDown) { 396 + function drawBuffArea(lineCode, upDown,lineVersion) {
384 if(!lineCode)return; 397 if(!lineCode)return;
385 stations = gb_map_spatial_data.getStationArray(lineCode); 398 stations = gb_map_spatial_data.getStationArray(lineCode);
386 if(!stations){ 399 if(!stations){
@@ -391,6 +404,7 @@ debugger @@ -391,6 +404,7 @@ debugger
391 404
392 var array = stations[upDown], obj, buffs=[]; 405 var array = stations[upDown], obj, buffs=[];
393 $.each(array, function () { 406 $.each(array, function () {
  407 + if(this.versions==lineVersion){
394 if(this.shapesType=='r') 408 if(this.shapesType=='r')
395 obj = drawCircle(new BMap.Point(this.bd_lon, this.bd_lat), this.radius); 409 obj = drawCircle(new BMap.Point(this.bd_lon, this.bd_lat), this.radius);
396 else if(this.shapesType=='d') 410 else if(this.shapesType=='d')
@@ -398,12 +412,13 @@ debugger @@ -398,12 +412,13 @@ debugger
398 412
399 if(obj) 413 if(obj)
400 buffs.push(obj); 414 buffs.push(obj);
  415 + }
401 }); 416 });
402 417
403 xlPolyline.buffs = buffs; 418 xlPolyline.buffs = buffs;
404 } 419 }
405 420
406 - function drawNameMarkers(lineCode, upDown) { 421 + function drawNameMarkers(lineCode, upDown,lineVersion) {
407 if(!lineCode)return; 422 if(!lineCode)return;
408 //从地图模块获取站点数据 423 //从地图模块获取站点数据
409 stations = gb_map_spatial_data.getStationArray(lineCode); 424 stations = gb_map_spatial_data.getStationArray(lineCode);
@@ -416,6 +431,8 @@ debugger @@ -416,6 +431,8 @@ debugger
416 var style = {backgroundColor: "rgba(255, 255, 255, 0.69)",color : "black", borderColor: "black", fontSize : "12px", height : "16px", lineHeight : "16px", fontFamily:"微软雅黑"} 431 var style = {backgroundColor: "rgba(255, 255, 255, 0.69)",color : "black", borderColor: "black", fontSize : "12px", height : "16px", lineHeight : "16px", fontFamily:"微软雅黑"}
417 var array = stations[upDown], tMarkers=[]; 432 var array = stations[upDown], tMarkers=[];
418 $.each(array, function () { 433 $.each(array, function () {
  434 + if (this.versions==lineVersion) {
  435 +
419 var width = this.stationName.length * 12; 436 var width = this.stationName.length * 12;
420 var label = new BMap.Label(this.stationName, { 437 var label = new BMap.Label(this.stationName, {
421 position:new BMap.Point(this.bd_lon, this.bd_lat), 438 position:new BMap.Point(this.bd_lon, this.bd_lat),
@@ -424,6 +441,7 @@ debugger @@ -424,6 +441,7 @@ debugger
424 label.setStyle(style); 441 label.setStyle(style);
425 map.addOverlay(label); 442 map.addOverlay(label);
426 tMarkers.push(label); 443 tMarkers.push(label);
  444 + }
427 }); 445 });
428 446
429 xlPolyline.tMarkers = tMarkers; 447 xlPolyline.tMarkers = tMarkers;
@@ -564,27 +582,28 @@ debugger @@ -564,27 +582,28 @@ debugger
564 var name = $(this).attr('name'), 582 var name = $(this).attr('name'),
565 lineCode = xlPolyline.lineId, 583 lineCode = xlPolyline.lineId,
566 upDown = xlPolyline.upDown; 584 upDown = xlPolyline.upDown;
  585 + linesVersion = xlPolyline.lineVersion;
567 switch (name){ 586 switch (name){
568 case 'stationName': 587 case 'stationName':
569 //清除站点名称 588 //清除站点名称
570 clearOverlayArray(xlPolyline.tMarkers); 589 clearOverlayArray(xlPolyline.tMarkers);
571 xlPolyline.tMarkers = []; 590 xlPolyline.tMarkers = [];
572 if(this.checked) 591 if(this.checked)
573 - drawNameMarkers(lineCode, upDown); 592 + drawNameMarkers(lineCode, upDown,linesVersion);
574 break; 593 break;
575 case 'drawBuffArea': 594 case 'drawBuffArea':
576 //清除缓冲区 595 //清除缓冲区
577 clearOverlayArray(xlPolyline.buffs); 596 clearOverlayArray(xlPolyline.buffs);
578 xlPolyline.buffs = []; 597 xlPolyline.buffs = [];
579 if(this.checked) 598 if(this.checked)
580 - drawBuffArea(lineCode, upDown); 599 + drawBuffArea(lineCode, upDown,linesVersion);
581 break; 600 break;
582 case 'drawPoint': 601 case 'drawPoint':
583 //清除站点 602 //清除站点
584 clearOverlayArray(xlPolyline.zdMarkers); 603 clearOverlayArray(xlPolyline.zdMarkers);
585 xlPolyline.zdMarkers = []; 604 xlPolyline.zdMarkers = [];
586 if(this.checked) 605 if(this.checked)
587 - drawStationMarkers(lineCode, upDown); 606 + drawStationMarkers(lineCode, upDown,linesVersion);
588 break; 607 break;
589 } 608 }
590 }); 609 });
@@ -607,7 +626,8 @@ debugger @@ -607,7 +626,8 @@ debugger
607 var gps = gpsArray[ei]; 626 var gps = gpsArray[ei];
608 updateProgress(gps, ei); 627 updateProgress(gps, ei);
609 //更新gps marker 628 //更新gps marker
610 - drawCarMarker(gps); 629 + getLineVersionAnddrawCarMarker(gps);
  630 + //drawCarMarker(gps,lineVersionList);
611 631
612 //更新轨迹线条 632 //更新轨迹线条
613 trailArray = []; 633 trailArray = [];
@@ -645,8 +665,9 @@ debugger @@ -645,8 +665,9 @@ debugger
645 return; 665 return;
646 666
647 var gps = gpsArray[ei]; 667 var gps = gpsArray[ei];
  668 + getLineVersionAnddrawCarMarker(gps);
648 //更新gps marker 669 //更新gps marker
649 - drawCarMarker(gps); 670 + //drawCarMarker(gps,lineVersionList);
650 //更新轨迹线条 671 //更新轨迹线条
651 trailArray = []; 672 trailArray = [];
652 var i = 0; 673 var i = 0;
@@ -659,6 +680,17 @@ debugger @@ -659,6 +680,17 @@ debugger
659 //居中 680 //居中
660 map.panTo(gpsMarker.getPosition()); 681 map.panTo(gpsMarker.getPosition());
661 } 682 }
  683 + function getLineVersionAnddrawCarMarker(gps){
  684 + if(lineVersionList.length>0){
  685 + for (var i = 0; i < lineVersionList.length; i++) {
  686 + if ((lineVersionList[i].endTime&&lineVersionList[i].endTime>gps.timestamp)||(lineVersionList[i].startTime&&lineVersionList[i].startTime<gps.timestamp)||(lineVersionList[i].vtime&&lineVersionList[i].vtime=='all')) {
  687 + drawCarMarker(gps,lineVersionList[i].version);//更新GPS点位
  688 + }
  689 + }
  690 + }else {
  691 + drawCarMarker(gps,0);//除非线路没有版本信息
  692 + }
  693 + }
662 694
663 /** 695 /**
664 * 初始化停车场下拉菜单 696 * 初始化停车场下拉菜单
@@ -746,7 +778,7 @@ debugger @@ -746,7 +778,7 @@ debugger
746 var code = $(this).data('code'); 778 var code = $(this).data('code');
747 var updown = $(this).data('dir'); 779 var updown = $(this).data('dir');
748 autoChange = false; 780 autoChange = false;
749 - drawXlPolyline(code, updown); 781 + drawXlPolyline(code, updown,currentVersion);
750 }); 782 });
751 })(); 783 })();
752 784