Commit d9264297d634b0f463fefc1e538796aa2764fc45

Authored by 李强
1 parent e764b203

基础数据功能完善

Showing 28 changed files with 1689 additions and 868 deletions
src/main/java/com/bsth/repository/StationRepository.java
@@ -58,7 +58,7 @@ public interface StationRepository extends BaseRepository<Station, Integer> { @@ -58,7 +58,7 @@ public interface StationRepository extends BaseRepository<Station, Integer> {
58 "station_cod , station_name , road_coding , db_type , b_jwpoints , " + 58 "station_cod , station_name , road_coding , db_type , b_jwpoints , " +
59 "g_lonx , g_laty , x , y , g_polygon_grid,b_polygon_grid, " + 59 "g_lonx , g_laty , x , y , g_polygon_grid,b_polygon_grid, " +
60 "destroy , radius , shapes_type , versions , descriptions," + 60 "destroy , radius , shapes_type , versions , descriptions," +
61 - "create_by,update_by) " + 61 + "create_by,update_by,id) " +
62 " VALUES(" + 62 " VALUES(" +
63 "?1 , ?2 , ?3 , ?4 , ?5," + 63 "?1 , ?2 , ?3 , ?4 , ?5," +
64 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," + 64 "?6 , ?7 , ?8 , ?9 , GeomFromText(?10),GeomFromText(?11)," +
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -510,10 +510,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ @@ -510,10 +510,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ
510 String stationRStr = ""; 510 String stationRStr = "";
511 511
512 // windows下的文本文件换行符 512 // windows下的文本文件换行符
513 - String enterStr = "\r\n"; 513 + // String enterStr = "\r\n";
514 514
515 // linux/unix下的文本文件换行符 515 // linux/unix下的文本文件换行符
516 - // String enterStr = "\r"; 516 + String enterStr = "\r";
517 517
518 if(objects.size()>0) { 518 if(objects.size()>0) {
519 519
@@ -565,26 +565,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ @@ -565,26 +565,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ
565 565
566 FTPClientUtils ftpClientUtils = new FTPClientUtils(); 566 FTPClientUtils ftpClientUtils = new FTPClientUtils();
567 567
568 - String url = "192.168.168.101"; 568 + // ip
  569 + String url = "222.66.0.205";
569 570
  571 + // ftp端口
570 int port = 21; 572 int port = 21;
571 573
572 - String username = "testftpservice"; 574 + // 用户名
  575 + String username = "transport";
573 576
574 - String password = "123"; 577 + // 密码
  578 + String password = "transport123";
575 579
576 - String path = "C:/ftptest"; 580 + // 路径
  581 + String path = "down/";
577 582
578 - String filename = line.getLineCode() + ".txt"; 583 + // 文件名
  584 + String filename = line.getLineCode() + ".txt.gz";
579 585
580 - stationRStr = line.getName() + enterStr + stationRStr; 586 + String versions = "2";
  587 +
  588 + stationRStr = line.getName() + " " +versions + enterStr + stationRStr;
581 589
582 InputStream input = new ByteArrayInputStream(stationRStr.getBytes("utf-8")); 590 InputStream input = new ByteArrayInputStream(stationRStr.getBytes("utf-8"));
583 591
584 boolean b = ftpClientUtils.uploadFile(url, port, username, password, path, filename, input); 592 boolean b = ftpClientUtils.uploadFile(url, port, username, password, path, filename, input);
585 593
586 - System.out.println(b);  
587 -  
588 resultMap.put("status", ResponseCode.SUCCESS); 594 resultMap.put("status", ResponseCode.SUCCESS);
589 595
590 } catch (Exception e) { 596 } catch (Exception e) {
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -29,6 +29,8 @@ import com.bsth.repository.StationRepository; @@ -29,6 +29,8 @@ import com.bsth.repository.StationRepository;
29 import com.bsth.repository.StationRouteRepository; 29 import com.bsth.repository.StationRouteRepository;
30 import com.bsth.service.StationService; 30 import com.bsth.service.StationService;
31 import com.bsth.util.GetUIDAndCode; 31 import com.bsth.util.GetUIDAndCode;
  32 +import com.bsth.util.TransGPS;
  33 +import com.bsth.util.TransGPS.Location;
32 34
33 /** 35 /**
34 * 36 *
@@ -131,22 +133,32 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -131,22 +133,32 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
131 133
132 if(!stationJSON.equals("")) { 134 if(!stationJSON.equals("")) {
133 135
  136 + // 保存站点与站点路由信息
134 resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine); 137 resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine);
135 138
136 } 139 }
137 140
  141 + // 路段长度
138 sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString()); 142 sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString());
139 143
  144 + // 路段时长
140 sectionDuration= Double.valueOf(resultSaveMapm.get("sectionDuration").toString()); 145 sectionDuration= Double.valueOf(resultSaveMapm.get("sectionDuration").toString());
141 146
142 // 如果路段信息JSON字符串不为空 147 // 如果路段信息JSON字符串不为空
143 if(!sectionJSON.equals("")) { 148 if(!sectionJSON.equals("")) {
144 149
  150 + // 保存路段与路段路由信息
145 saveSectionAndSectionRouteInfo( sectionJSON, directions, resultLine, speedLimitStr,sectionDistance, sectionDuration, dbType, versions, destroy); 151 saveSectionAndSectionRouteInfo( sectionJSON, directions, resultLine, speedLimitStr,sectionDistance, sectionDuration, dbType, versions, destroy);
146 } 152 }
147 153
  154 + // 里程
148 sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString()); 155 sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString());
149 156
  157 + BigDecimal s = new BigDecimal(sumUpOrDownMileage);
  158 +
  159 + sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  160 +
  161 + // 更新里程
150 updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage); 162 updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
151 163
152 resultMap.put("status", ResponseCode.SUCCESS); 164 resultMap.put("status", ResponseCode.SUCCESS);
@@ -270,13 +282,21 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -270,13 +282,21 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
270 // 原坐标类型 282 // 原坐标类型
271 arg0.setDbType(dbType); 283 arg0.setDbType(dbType);
272 284
273 - // 站点地理位置WGS坐标经度  
274 - String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();  
275 - arg0.setgLonx(Float.parseFloat(gLonx)); 285 +
  286 + /** to WGS坐标 */
  287 + Location resultPoint = FromBDPointToWGSPoint(bLonx,bLatx);
  288 +
  289 + arg0.setgLonx((float)resultPoint.getLng());
  290 +
  291 + arg0.setgLaty((float)resultPoint.getLat());
  292 +
  293 + // 站点地理位置WGS坐标经度
  294 + // String gLonx = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lng").toString();
  295 + // arg0.setgLonx(Float.parseFloat(gLonx));
276 296
277 // 站点地理位置WGS坐标纬度 297 // 站点地理位置WGS坐标纬度
278 - String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();  
279 - arg0.setgLaty(Float.parseFloat(gLaty)); 298 + // String gLaty = JSONObject.parseObject(stationsArray.getJSONObject(i).get("WGSpotion").toString()).get("Lat").toString();
  299 + // arg0.setgLaty(Float.parseFloat(gLaty));
280 300
281 arg0.setRadius(radius); 301 arg0.setRadius(radius);
282 302
@@ -489,6 +509,15 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -489,6 +509,15 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
489 509
490 double sectionDistance,double sectionDuration,String dbType,int versions,int destroy) throws Exception{ 510 double sectionDistance,double sectionDuration,String dbType,int versions,int destroy) throws Exception{
491 511
  512 + BigDecimal t = new BigDecimal(sectionDistance);
  513 +
  514 + sectionDistance = t.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  515 +
  516 +
  517 + BigDecimal d = new BigDecimal(sectionDuration);
  518 +
  519 + sectionDuration = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  520 +
492 // 转换成JSON数组 521 // 转换成JSON数组
493 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); 522 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
494 523
@@ -505,9 +534,29 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -505,9 +534,29 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
505 534
506 String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); 535 String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
507 536
508 - String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString(); 537 + String WGSLngStr = "";
  538 +
  539 + String WGSLatStr = "";
  540 +
  541 + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
  542 +
  543 + WGSLngStr = String.valueOf(resultPoint.getLng());
509 544
510 - String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString(); 545 + WGSLatStr = String.valueOf(resultPoint.getLat());
  546 + /** to WGS坐标 */
  547 + /*double lng = Double.parseDouble(WGSLngStr);
  548 +
  549 + double lat = Double.parseDouble(WGSLatStr);
  550 +
  551 + Location bdLoc = TransGPS.LocationMake(lng, lat);
  552 +
  553 + Location location = TransGPS.bd_decrypt(bdLoc);
  554 +
  555 + Location WGSPoint = TransGPS.transformFromGCJToWGS(location);*/
  556 +
  557 + // String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString();
  558 +
  559 + // String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString();
511 560
512 if(s==0) { 561 if(s==0) {
513 562
@@ -694,7 +743,31 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -694,7 +743,31 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
694 // 原坐标点 743 // 原坐标点
695 String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString(); 744 String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString();
696 745
  746 + String bJwpointsArray[] = null;
  747 +
  748 + if(bJwpoints!=null) {
  749 +
  750 + bJwpointsArray = bJwpoints.split(" ");
  751 +
  752 + }
  753 +
697 // WGS经纬度 754 // WGS经纬度
  755 + Float gLonx = null;
  756 +
  757 + // WGS纬度
  758 + Float gLaty = null;
  759 +
  760 + if(bJwpointsArray.length>0) {
  761 +
  762 + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]);
  763 +
  764 + gLonx = (float)resultPoint.getLng();
  765 +
  766 + gLaty = (float)resultPoint.getLat();
  767 +
  768 + }
  769 +
  770 + /*// WGS经纬度
698 String gJwpoints = map.get("gJwpoints").equals("") ? null : map.get("gJwpoints").toString(); 771 String gJwpoints = map.get("gJwpoints").equals("") ? null : map.get("gJwpoints").toString();
699 772
700 String gJwpointsArray []= null; 773 String gJwpointsArray []= null;
@@ -703,7 +776,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -703,7 +776,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
703 776
704 gJwpointsArray = gJwpoints.split(" "); 777 gJwpointsArray = gJwpoints.split(" ");
705 778
706 - } 779 + }*/
707 780
708 // 方向 781 // 方向
709 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); 782 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
@@ -714,11 +787,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -714,11 +787,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
714 // 时间 787 // 时间
715 Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); 788 Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString());
716 789
717 - // WGS经纬度 790 + /*// WGS经纬度
718 Float gLonx = Float.parseFloat(gJwpointsArray[0]); 791 Float gLonx = Float.parseFloat(gJwpointsArray[0]);
719 792
720 // WGS纬度 793 // WGS纬度
721 - Float gLaty = Float.parseFloat(gJwpointsArray[1]); 794 + Float gLaty = Float.parseFloat(gJwpointsArray[1]);*/
722 795
723 // 城建坐标经度 796 // 城建坐标经度
724 Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString()); 797 Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
@@ -727,11 +800,44 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -727,11 +800,44 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
727 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString()); 800 Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
728 801
729 // 多边形WGS坐标点集合 802 // 多边形WGS坐标点集合
730 - String gPloygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString(); 803 + // String gPloygonGrid = map.get("gPolygonGrid").equals("") ? "" : map.get("gPolygonGrid").toString();
731 804
732 // 多边形原坐标点集合 805 // 多边形原坐标点集合
733 String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString(); 806 String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
734 807
  808 + // 多边形WGS坐标点集合
  809 + String gPloygonGrid ="";
  810 +
  811 + if(!bPloygonGrid.equals("")) {
  812 +
  813 + String bPloygonGridArray[] = bPloygonGrid.split(",");
  814 +
  815 + int bLen_ = bPloygonGridArray.length;
  816 +
  817 + for(int b = 0 ;b<bLen_;b++) {
  818 +
  819 + String tempArray[]= bPloygonGridArray[b].split(" ");
  820 +
  821 + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]);
  822 +
  823 + if(b==0) {
  824 +
  825 + gPloygonGrid = resultPoint.getLng() + " " + resultPoint.getLat();
  826 +
  827 + }else {
  828 +
  829 + gPloygonGrid = gPloygonGrid + ',' + resultPoint.getLng() + " " + resultPoint.getLat();
  830 +
  831 + }
  832 +
  833 + }
  834 +
  835 + }
  836 +
  837 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  838 +
  839 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
  840 +
735 // 是否撤销 841 // 是否撤销
736 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); 842 Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
737 843
@@ -1014,7 +1120,24 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1014,7 +1120,24 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1014 return resultMap; 1120 return resultMap;
1015 } 1121 }
1016 1122
1017 - 1123 +
  1124 + /** 百度坐标转WGS坐标 */
  1125 + public Location FromBDPointToWGSPoint(String bLonx,String bLatx) {
  1126 +
  1127 + double lng = Double.parseDouble(bLonx);
  1128 +
  1129 + double lat = Double.parseDouble(bLatx);
  1130 +
  1131 + Location bdLoc = TransGPS.LocationMake(lng, lat);
  1132 +
  1133 + Location location = TransGPS.bd_decrypt(bdLoc);
  1134 +
  1135 + Location WGSPoint = TransGPS.transformFromGCJToWGS(location);
  1136 +
  1137 + return WGSPoint;
  1138 +
  1139 + }
  1140 +
1018 @Override 1141 @Override
1019 public Map<String, Object> manualSave(Map<String, Object> map) { 1142 public Map<String, Object> manualSave(Map<String, Object> map) {
1020 1143
@@ -1046,15 +1169,33 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1046,15 +1169,33 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1046 // 线路ID 1169 // 线路ID
1047 int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); 1170 int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
1048 1171
  1172 + // 半径
  1173 + int radius = map.get("radius").equals("") ? 0 : Integer.parseInt(map.get("radius").toString());
  1174 +
  1175 + // 图形类型
  1176 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  1177 +
1049 // 线路信息 1178 // 线路信息
1050 Line resultLine = lineRepository.findOne(lineId); 1179 Line resultLine = lineRepository.findOne(lineId);
1051 1180
1052 - Double distance = 0.0; 1181 + // 路段距离
  1182 + Double sectionDistance = 0.0d;
  1183 +
  1184 + // 路段时长
  1185 + Double sectionDuration = 0.0d;
  1186 +
  1187 + // 里程(上或者下)
  1188 + double sumUpOrDownMileage = 0.0d;
1053 1189
1054 - Double duration = 0.0; 1190 + Map<String, Object> resultSaveMapm = new HashMap<String,Object>();
1055 1191
1056 if(!stationJSON.equals("")) { 1192 if(!stationJSON.equals("")) {
1057 1193
  1194 + // 保存站点与站点路由信息
  1195 + resultSaveMapm = savaStationAndStationRouteInfo( stationJSON, sectionDistance, sectionDuration, dbType,radius, shapesType, destroy, versions, sumUpOrDownMileage, directions, resultLine);
  1196 +
  1197 + /*
  1198 +
1058 JSONArray stationsArray = JSONArray.parseArray(stationJSON); 1199 JSONArray stationsArray = JSONArray.parseArray(stationJSON);
1059 1200
1060 for(int i = 0;i <stationsArray.size();i++) { 1201 for(int i = 0;i <stationsArray.size();i++) {
@@ -1062,45 +1203,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1062,45 +1203,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1062 // 站点名称 1203 // 站点名称
1063 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); 1204 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();
1064 1205
1065 - String distanceStr = stationsArray.getJSONObject(i).get("distance").equals("") ? "" : stationsArray.getJSONObject(i).get("distance").toString(); 1206 + String distanceStr = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("distance").toString();
1066 1207
1067 - String durationStr = stationsArray.getJSONObject(i).get("duration").equals("") ? "" : stationsArray.getJSONObject(i).get("duration").toString();  
1068 -  
1069 - if(!distanceStr.equals("")){  
1070 -  
1071 - if(distanceStr.indexOf("米")!=-1){  
1072 -  
1073 - distance = Double.parseDouble(distanceStr.replaceAll("米", "")) / 1000;  
1074 -  
1075 - }else if(distanceStr.indexOf("公里")!=-1){  
1076 -  
1077 - distance = Double.parseDouble(distanceStr.replaceAll("公里", ""));  
1078 -  
1079 - }else {  
1080 -  
1081 - distance = Double.parseDouble(distanceStr);  
1082 -  
1083 - }  
1084 -  
1085 - }  
1086 -  
1087 - if(!durationStr.equals("")){  
1088 -  
1089 - if(durationStr.indexOf("小时")!=-1){  
1090 -  
1091 - duration = Double.parseDouble(durationStr.replaceAll("durationStr", ""))*60;  
1092 -  
1093 - }else if(durationStr.indexOf("分钟")!=-1){  
1094 -  
1095 - duration = Double.parseDouble(durationStr.replaceAll("分钟", ""));  
1096 -  
1097 - }else {  
1098 -  
1099 - duration = Double.parseDouble(durationStr);  
1100 -  
1101 - }  
1102 -  
1103 - } 1208 + String durationStr = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("duration").toString();
1104 1209
1105 // 百度经纬度坐标 1210 // 百度经纬度坐标
1106 String bJwpoints = ""; 1211 String bJwpoints = "";
@@ -1233,153 +1338,188 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1233,153 +1338,188 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1233 1338
1234 } 1339 }
1235 } 1340 }
  1341 + */
1236 } 1342 }
1237 1343
  1344 + // 路段长度
  1345 + sectionDistance = Double.valueOf(resultSaveMapm.get("sectionDistance").toString());
  1346 +
  1347 + // 路段时长
  1348 + sectionDuration = Double.valueOf(resultSaveMapm.get("sectionDuration").toString());
  1349 +
1238 // 如果路段信息JSON字符串不为空 1350 // 如果路段信息JSON字符串不为空
1239 if(!sectionJSON.equals("")) { 1351 if(!sectionJSON.equals("")) {
1240 1352
1241 - // 转换成JSON数组  
1242 - JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); 1353 + manualSaveSectionAndSectionRoute(sectionJSON, speedLimitStr, sectionDistance, sectionDuration, dbType, versions, resultLine, destroy, directions);
  1354 +
  1355 + }
  1356 +
  1357 + // 里程
  1358 + sumUpOrDownMileage = Double.valueOf(resultSaveMapm.get("sumUpOrDownMileage").toString());
  1359 +
  1360 + BigDecimal s = new BigDecimal(sumUpOrDownMileage);
  1361 +
  1362 + sumUpOrDownMileage = s.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
  1363 +
  1364 + // 更新里程
  1365 + updateLineInfoUpOrDownMileage( resultLine , directions, sumUpOrDownMileage);
  1366 +
  1367 + resultMap.put("status", ResponseCode.SUCCESS);
  1368 +
  1369 + } catch (Exception e) {
  1370 +
  1371 + resultMap.put("status", ResponseCode.ERROR);
  1372 +
  1373 + logger.error("save erro.", e);
  1374 +
  1375 + }
  1376 +
  1377 + return resultMap;
  1378 + }
  1379 +
  1380 + public void manualSaveSectionAndSectionRoute(String sectionJSON,String speedLimitStr,double sectionDistance,
  1381 +
  1382 + double sectionTime,String dbType,Integer versions,Line resultLine,
  1383 +
  1384 + Integer destroy,Integer directions) {
  1385 +
  1386 + // 转换成JSON数组
  1387 + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
  1388 +
  1389 + // 遍历
  1390 + for(int s = 0 ;s<sectionsArray.size();s++) {
  1391 +
  1392 + // 站点名称
  1393 + String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString();
  1394 +
  1395 + String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString();
  1396 +
  1397 + // 原始线状图形坐标集合
  1398 + String sectionsBpoints = "";
  1399 +
  1400 + // WGS线状图形坐标集合
  1401 + String sectionsWJPpoints = "";
  1402 +
  1403 + if(!pointsStr.equals("")){
  1404 +
  1405 + JSONArray pointsArray = JSONArray.parseArray(pointsStr);
1243 1406
1244 - // 遍历  
1245 - for(int s = 0 ;s<sectionsArray.size();s++) { 1407 + for(int p =0;p<pointsArray.size();p++){
1246 1408
1247 - // 站点名称  
1248 - String sectionName = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("sectionName").toString(); 1409 + String pointsLngStr = pointsArray.getJSONObject(p).get("lng").toString();
1249 1410
1250 - String pointsStr = sectionsArray.getJSONObject(s).equals("") ? "" : sectionsArray.getJSONObject(s).get("points").toString(); 1411 + String pointsLatStr = pointsArray.getJSONObject(p).get("lat").toString();
1251 1412
1252 - // 原始线状图形坐标集合  
1253 - String sectionsBpoints = ""; 1413 + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
1254 1414
1255 - // WGS线状图形坐标集合  
1256 - String sectionsWJPpoints = ""; 1415 + String WGSLngStr = String.valueOf(resultPoint.getLng());
1257 1416
1258 - if(!pointsStr.equals("")){ 1417 + String WGSLatStr = String.valueOf(resultPoint.getLat());
  1418 +
  1419 + if(p==pointsArray.size()-1){
1259 1420
1260 - JSONArray pointsArray = JSONArray.parseArray(pointsStr); 1421 + sectionsBpoints = sectionsBpoints + pointsLngStr + " " + pointsLatStr;
  1422 +
  1423 + sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr;
  1424 +
  1425 + // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat");
  1426 +
  1427 + }else {
  1428 +
  1429 + sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+",";
  1430 +
  1431 + sectionsWJPpoints = sectionsWJPpoints + WGSLngStr + " " + WGSLatStr + ",";
  1432 +
  1433 + // sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +",";
1261 1434
1262 - for(int p =0;p<pointsArray.size();p++){  
1263 -  
1264 - if(p==pointsArray.size()-1){  
1265 -  
1266 - sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString();  
1267 -  
1268 - sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat");  
1269 -  
1270 - }else {  
1271 -  
1272 - sectionsBpoints = sectionsBpoints + pointsArray.getJSONObject(p).get("lng").toString() + " " +pointsArray.getJSONObject(p).get("lat").toString()+",";  
1273 -  
1274 - sectionsWJPpoints = sectionsWJPpoints + pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lng") + " " +pointsArray.getJSONObject(p).getJSONObject("WGSpotion").get("Lat") +",";  
1275 -  
1276 -  
1277 - }  
1278 -  
1279 - }  
1280 1435
1281 } 1436 }
1282 -  
1283 -  
1284 - long sectionMaxId = GetUIDAndCode.getSectionId();  
1285 -  
1286 - String sectionCode = String.valueOf(sectionMaxId);  
1287 -  
1288 - int sectionId = (int) (sectionMaxId);  
1289 -  
1290 - // 交出路  
1291 - String crosesRoad = "";  
1292 -  
1293 - // 终止节点  
1294 - String endNode = "";  
1295 -  
1296 - // 开始节点  
1297 - String startNode = "";  
1298 -  
1299 - // 中间节点  
1300 - String middleNode = "";  
1301 -  
1302 - // WGS坐标点集合  
1303 - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";  
1304 -  
1305 - // 原坐标点集合  
1306 - String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";  
1307 -  
1308 - // 城建坐标点集合  
1309 - String csectionVector = "";  
1310 -  
1311 - // 路段类型  
1312 - String sectionType = "";  
1313 -  
1314 - // 道路编码  
1315 - String roadCoding = "";  
1316 1437
1317 - // 路段距离  
1318 - double sectionDistance = distance;  
1319 -  
1320 - // 路段时间  
1321 - double sectionTime = duration;  
1322 -  
1323 - // 限速  
1324 - double speedLimit = Double.parseDouble(speedLimitStr);  
1325 -  
1326 - // 说明  
1327 - String descriptions = "";  
1328 -  
1329 -  
1330 - sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,  
1331 -  
1332 - middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,  
1333 -  
1334 - roadCoding, sectionDistance, sectionTime, dbType, speedLimit,  
1335 -  
1336 - descriptions, versions,sectionId);  
1337 -  
1338 -  
1339 -  
1340 - Section section = sectionRepository.findOne(Integer.parseInt(sectionCode));  
1341 -  
1342 - // 路段路由  
1343 - SectionRoute sectionRoute = new SectionRoute();  
1344 -  
1345 - // 路段序号  
1346 - sectionRoute.setSectionrouteCode((s+1)*100);  
1347 -  
1348 - // 线路编码  
1349 - sectionRoute.setLineCode(resultLine.getLineCode());  
1350 -  
1351 - // 路段ID  
1352 - sectionRoute.setSection(section);  
1353 -  
1354 - // 线路ID  
1355 - sectionRoute.setLine(resultLine);  
1356 -  
1357 - // 路段编码  
1358 - sectionRoute.setSectionCode(sectionCode);  
1359 -  
1360 - // 版本  
1361 - sectionRoute.setVersions(versions);  
1362 -  
1363 - sectionRoute.setDestroy(destroy);  
1364 -  
1365 - // 方向  
1366 - sectionRoute.setDirections(directions);  
1367 -  
1368 - sectionRouteRepository.save(sectionRoute);  
1369 } 1438 }
  1439 +
1370 } 1440 }
  1441 +
  1442 + long sectionMaxId = GetUIDAndCode.getSectionId();
1371 1443
1372 - resultMap.put("status", ResponseCode.SUCCESS); 1444 + String sectionCode = String.valueOf(sectionMaxId);
1373 1445
1374 - } catch (Exception e) {  
1375 -  
1376 - resultMap.put("status", ResponseCode.ERROR); 1446 + int sectionId = (int) (sectionMaxId);
1377 1447
1378 - logger.error("save erro.", e); 1448 + // 交出路
  1449 + String crosesRoad = "";
  1450 +
  1451 + // 终止节点
  1452 + String endNode = "";
  1453 +
  1454 + // 开始节点
  1455 + String startNode = "";
1379 1456
  1457 + // 中间节点
  1458 + String middleNode = "";
  1459 +
  1460 + // WGS坐标点集合
  1461 + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  1462 +
  1463 + // 原坐标点集合
  1464 + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
  1465 +
  1466 + // 城建坐标点集合
  1467 + String csectionVector = "";
  1468 +
  1469 + // 路段类型
  1470 + String sectionType = "";
  1471 +
  1472 + // 道路编码
  1473 + String roadCoding = "";
  1474 +
  1475 + // 限速
  1476 + double speedLimit = Double.parseDouble(speedLimitStr);
  1477 +
  1478 + // 说明
  1479 + String descriptions = "";
  1480 +
  1481 +
  1482 + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
  1483 +
  1484 + middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
  1485 +
  1486 + roadCoding, sectionDistance, sectionTime, dbType, speedLimit,
  1487 +
  1488 + descriptions, versions,sectionId);
  1489 +
  1490 +
  1491 +
  1492 + Section section = sectionRepository.findOne(Integer.parseInt(sectionCode));
  1493 +
  1494 + // 路段路由
  1495 + SectionRoute sectionRoute = new SectionRoute();
  1496 +
  1497 + // 路段序号
  1498 + sectionRoute.setSectionrouteCode((s+1)*100);
  1499 +
  1500 + // 线路编码
  1501 + sectionRoute.setLineCode(resultLine.getLineCode());
  1502 +
  1503 + // 路段ID
  1504 + sectionRoute.setSection(section);
  1505 +
  1506 + // 线路ID
  1507 + sectionRoute.setLine(resultLine);
  1508 +
  1509 + // 路段编码
  1510 + sectionRoute.setSectionCode(sectionCode);
  1511 +
  1512 + // 版本
  1513 + sectionRoute.setVersions(versions);
  1514 +
  1515 + sectionRoute.setDestroy(destroy);
  1516 +
  1517 + // 方向
  1518 + sectionRoute.setDirections(directions);
  1519 +
  1520 + sectionRouteRepository.save(sectionRoute);
1380 } 1521 }
1381 1522
1382 - return resultMap;  
1383 } 1523 }
1384 1524
1385 } 1525 }
src/main/resources/application.properties
@@ -9,9 +9,12 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy @@ -9,9 +9,12 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
9 spring.jpa.database= MYSQL 9 spring.jpa.database= MYSQL
10 spring.jpa.show-sql= true 10 spring.jpa.show-sql= true
11 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 11 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
12 -spring.datasource.url= jdbc:mysql://192.168.168.201:3306/control 12 +#spring.datasource.url= jdbc:mysql://192.168.168.201:3306/control
  13 +spring.datasource.url= jdbc:mysql://192.168.168.201:3306/test
  14 +#spring.datasource.url= jdbc:mysql://localhost:3306/test
13 spring.datasource.username= root 15 spring.datasource.username= root
14 spring.datasource.password= 123456 16 spring.datasource.password= 123456
  17 +#spring.datasource.password=
15 18
16 #DATASOURCE 19 #DATASOURCE
17 spring.datasource.max-active=100 20 spring.datasource.max-active=100
src/main/resources/static/pages/base/carpark/js/add-form-wizard.js
@@ -106,6 +106,8 @@ var FormWizard = function() { @@ -106,6 +106,8 @@ var FormWizard = function() {
106 // 表单序列化 106 // 表单序列化
107 var params = form.serializeJSON(); 107 var params = form.serializeJSON();
108 108
  109 + return params;
  110 +
109 //保存站点 111 //保存站点
110 PublicFunctions.carParkSave(params,function(data) { 112 PublicFunctions.carParkSave(params,function(data) {
111 113
src/main/resources/static/pages/base/station/add.html
@@ -99,9 +99,9 @@ @@ -99,9 +99,9 @@
99 <label > 99 <label >
100 <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加 100 <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加
101 </label> 101 </label>
102 - <label> 102 + <!-- <label>
103 <input type="radio" class="icheck" name="baseRes" value=2> 系统引用 103 <input type="radio" class="icheck" name="baseRes" value=2> 系统引用
104 - </label> 104 + </label> -->
105 </div> 105 </div>
106 </div> 106 </div>
107 </div> 107 </div>
src/main/resources/static/pages/base/station/edit.html
@@ -246,11 +246,14 @@ $(function(){ @@ -246,11 +246,14 @@ $(function(){
246 // 初始化表单值 246 // 初始化表单值
247 PublicFunctions.setFormValue(); 247 PublicFunctions.setFormValue();
248 248
  249 + // 获取站点对象信息
  250 + var stationObjEidtArray = PublicFunctions.getstationObjData();
  251 +
249 // 方向 252 // 方向
250 - var edit_direction_v = stationObj[0].stationRoutedirections; 253 + var edit_direction_v = stationObjEidtArray[0].stationRoutedirections;
251 254
252 // 线路ID 255 // 线路ID
253 - var lineId = stationObj[0].stationRouteLine; 256 + var lineId = stationObjEidtArray[0].stationRouteLine;
254 257
255 // 获取站点序号元素,并添加下拉属性值 258 // 获取站点序号元素,并添加下拉属性值
256 PublicFunctions.getStation(lineId,edit_direction_v,function(treeData) { 259 PublicFunctions.getStation(lineId,edit_direction_v,function(treeData) {
@@ -259,7 +262,7 @@ $(function(){ @@ -259,7 +262,7 @@ $(function(){
259 262
260 var dArray = treeData[0].children[0].children; 263 var dArray = treeData[0].children[0].children;
261 264
262 - var eq_stationRouteCode = stationObj[0].stationRouteCode + '_' + stationObj[0].stationRouteStationMark; 265 + var eq_stationRouteCode = stationObjEidtArray[0].stationRouteCode + '_' + stationObjEidtArray[0].stationRouteStationMark;
263 266
264 for(var i = 0 ; i<dArray.length; i++){ 267 for(var i = 0 ; i<dArray.length; i++){
265 268
@@ -278,7 +281,7 @@ $(function(){ @@ -278,7 +281,7 @@ $(function(){
278 281
279 $('#stationrouteSelect').html(options); 282 $('#stationrouteSelect').html(options);
280 283
281 - PublicFunctions.findUpStationRouteCode(lineId,edit_direction_v,stationObj[0].stationRouteCode,function(str) { 284 + PublicFunctions.findUpStationRouteCode(lineId,edit_direction_v,stationObjEidtArray[0].stationRouteCode,function(str) {
282 285
283 if(str.length>0){ 286 if(str.length>0){
284 287
@@ -429,7 +432,8 @@ $(function(){ @@ -429,7 +432,8 @@ $(function(){
429 var params = form.serializeJSON(); 432 var params = form.serializeJSON();
430 433
431 error.hide(); 434 error.hide();
432 - 435 + console.log(params);
  436 + return ;
433 PublicFunctions.stationUpdate(params,function(resuntDate) { 437 PublicFunctions.stationUpdate(params,function(resuntDate) {
434 438
435 if(resuntDate.status=='SUCCESS') { 439 if(resuntDate.status=='SUCCESS') {
@@ -517,7 +521,7 @@ $(function(){ @@ -517,7 +521,7 @@ $(function(){
517 521
518 var stationMarkV = $('#stationdirSelect').val(); 522 var stationMarkV = $('#stationdirSelect').val();
519 523
520 - if(stationMarkV!=stationObj[0].stationRoutedirections){ 524 + if(stationMarkV!=stationObjEidtArray[0].stationRoutedirections){
521 525
522 tel = false; 526 tel = false;
523 527
src/main/resources/static/pages/base/station/edit_select.html
@@ -77,14 +77,20 @@ @@ -77,14 +77,20 @@
77 77
78 $(function(){ 78 $(function(){
79 79
  80 + var stationObjEditSelect = PublicFunctions.getstationObjData();
  81 +
  82 + var editSelectMapB = WorldsBMap.getMapBValue();
  83 +
  84 + var editSelectDrawingManager = WorldsBMap.getDrawingManagerValue();
  85 +
80 // 显示选择修改方式弹出层 86 // 显示选择修改方式弹出层
81 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); 87 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
82 88
83 // 获取站点名称元素并赋值 89 // 获取站点名称元素并赋值
84 - $('#stationNamebootboxInput').val(stationObj[0].stationName); 90 + $('#stationNamebootboxInput').val(stationObjEditSelect[0].stationName);
85 91
86 // 定义站点图形类型 92 // 定义站点图形类型
87 - var stationShapesTypeV = stationObj[0].stationShapesType; 93 + var stationShapesTypeV = stationObjEditSelect[0].stationShapesType;
88 94
89 // 获取表单元素 95 // 获取表单元素
90 var form = $('#edit_select'); 96 var form = $('#edit_select');
@@ -164,7 +170,7 @@ $(function(){ @@ -164,7 +170,7 @@ $(function(){
164 // 站点名称 170 // 站点名称
165 var editStationName = params.stationNamebootbox; 171 var editStationName = params.stationNamebootbox;
166 172
167 - WorldsBMap.localSearchFromAdreesToPoint(editStationName,mapB,function(Points) { 173 + WorldsBMap.localSearchFromAdreesToPoint(editStationName,editSelectMapB,function(Points) {
168 174
169 if(Points) { 175 if(Points) {
170 176
@@ -176,12 +182,12 @@ $(function(){ @@ -176,12 +182,12 @@ $(function(){
176 182
177 var PanOptions ={noAnimation :true}; 183 var PanOptions ={noAnimation :true};
178 184
179 - mapB.panTo(stationNameChangePoint,PanOptions); 185 + editSelectMapB.panTo(stationNameChangePoint,PanOptions);
180 186
181 - mapB.panBy(0,-200); 187 + editSelectMapB.panBy(0,-200);
182 188
183 // 将标注添加到地图中 189 // 将标注添加到地图中
184 - mapB.addOverlay(marker_stargt2); 190 + editSelectMapB.addOverlay(marker_stargt2);
185 191
186 //跳动的动画 192 //跳动的动画
187 marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); 193 marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE);
@@ -190,13 +196,21 @@ $(function(){ @@ -190,13 +196,21 @@ $(function(){
190 196
191 }); 197 });
192 198
193 - stationObj[0].stationName = editStationName; 199 + // 设置站点名称
  200 + PublicFunctions.setStationNameValue(editStationName);
194 201
195 var eidtselect_ = params.editselect; 202 var eidtselect_ = params.editselect;
196 203
197 if(eidtselect_==0){ 204 if(eidtselect_==0){
198 205
199 - WorldsBMap.drawingManagerOpen(); 206 + // 清楚地图覆盖物
  207 + editSelectMapB.clearOverlays();
  208 +
  209 + // 打开鼠标绘画工具
  210 + editSelectDrawingManager.open();
  211 +
  212 + // 设置属性
  213 + editSelectDrawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
200 214
201 215
202 }else if(eidtselect_==1){ 216 }else if(eidtselect_==1){
@@ -205,11 +219,13 @@ $(function(){ @@ -205,11 +219,13 @@ $(function(){
205 var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px', 219 var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px',
206 shift: 0,time: 10000}); 220 shift: 0,time: 10000});
207 221
  222 + var markerEidtSelect = PublicFunctions.getMarkerObj();
  223 +
208 // 关闭信息窗口 224 // 关闭信息窗口
209 - marker.closeInfoWindow(); 225 + markerEidtSelect.closeInfoWindow();
210 226
211 // 清除marker 227 // 清除marker
212 - mapB.removeOverlay(marker); 228 + editSelectMapB.removeOverlay(markerEidtSelect);
213 229
214 // 编辑图形 230 // 编辑图形
215 WorldsBMap.editShapes(stationShapesTypeV,mindex); 231 WorldsBMap.editShapes(stationShapesTypeV,mindex);
src/main/resources/static/pages/base/station/js/station-positions-function.js
1 /** 1 /**
2 * 函数 2 * 函数
3 - *  
4 - * - - - - - - - 》 getCurrSelNode : 获取选中树节点数据函数  
5 - *  
6 - * - - - - - - - 》 resjtreeDate : 刷新树函数函数  
7 - *  
8 - * - - - - - - - 》 setFormInputValue : 新增站点参数集合赋值函数  
9 - *  
10 - * - - - - - - - 》 editSetStationParmas : 编辑站点参数集合赋值函数  
11 - *  
12 - * - - - - - - - 》 editSeteditStationParmasValue:编辑站点范围图形参数集合赋值函数  
13 - *  
14 - * - - - - - - - 》 lineNameIsHaveInterval : 系统规划时线路名称是否为区间  
15 - *  
16 - * - - - - - - - 》 systemLineStation:系统规划保存函数  
17 - *  
18 - * - - - - - - - 》 stationRevoke :撤销站点  
19 - *  
20 - * - - - - - - - 》 editLinePlan :编辑线路走向  
21 - *  
22 - * - - - - - - - 》 setFormValue :编辑站点设置表单元素值  
23 - *  
24 - * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标  
25 */ 3 */
26 4
27 var PublicFunctions = function () { 5 var PublicFunctions = function () {
28 6
  7 + var stationObj = '';
  8 +
  9 + var stationId = '';
  10 +
  11 + var mapB = '';
  12 +
  13 + var circle = '';
  14 +
  15 + var polygon = '';
  16 +
  17 + var marker ='';
  18 +
29 var PubFun = { 19 var PubFun = {
30 20
31 - initStationInfo : function() { 21 + initStationInfo : function(id,map_) {
  22 +
  23 + stationId = id;
  24 +
  25 + mapB = map_;
32 26
33 - PublicFunctions.getStationRouteInfo(function(r) { 27 + PublicFunctions.getStationRouteInfo(stationId,function(r) {
34 28
35 stationObj = r; 29 stationObj = r;
36 30
@@ -97,7 +91,6 @@ var PublicFunctions = function () { @@ -97,7 +91,6 @@ var PublicFunctions = function () {
97 }); 91 });
98 }, 92 },
99 93
100 -  
101 editSeteditStationParmasValue : function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) { 94 editSeteditStationParmasValue : function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
102 95
103 // 百度地图经纬度坐标中心点 96 // 百度地图经纬度坐标中心点
@@ -107,13 +100,13 @@ var PublicFunctions = function () { @@ -107,13 +100,13 @@ var PublicFunctions = function () {
107 stationObj[0].stationGlonx = gLonx; 100 stationObj[0].stationGlonx = gLonx;
108 101
109 // WGS经度 102 // WGS经度
110 - stationObj[0].gLaty = gLaty; 103 + stationObj[0].stationGlaty = gLaty;
111 104
112 // 百度坐标点图形集合 105 // 百度坐标点图形集合
113 - stationObj[0].stationGPloyonGrid = bPolygonGridValue; 106 + stationObj[0].stationGPloyonGrid = gPolygonGridVlaue;
114 107
115 // WGS坐标点图形集合 108 // WGS坐标点图形集合
116 - stationObj[0].stationBPolyonGrid = gPolygonGridVlaue; 109 + stationObj[0].stationBPolyonGrid = bPolygonGridValue;
117 110
118 // 图形类型 111 // 图形类型
119 stationObj[0].stationShapesType = shapesTypeValue; 112 stationObj[0].stationShapesType = shapesTypeValue;
@@ -192,7 +185,7 @@ var PublicFunctions = function () { @@ -192,7 +185,7 @@ var PublicFunctions = function () {
192 $('#bPolygonGridInput').val(stationObj[0].stationBPolyonGrid); 185 $('#bPolygonGridInput').val(stationObj[0].stationBPolyonGrid);
193 186
194 // 百度坐标点图形集合 187 // 百度坐标点图形集合
195 - $('#gPolygonGridInput').val(stationObj[0].stationGPloyonGrid); 188 + /*$('#gPolygonGridInput').val(stationObj[0].stationGPloyonGrid);*/
196 189
197 // 获取站点名称元素设值 190 // 获取站点名称元素设值
198 $('#stationNameInput').val(stationObj[0].stationName); 191 $('#stationNameInput').val(stationObj[0].stationName);
@@ -213,7 +206,7 @@ var PublicFunctions = function () { @@ -213,7 +206,7 @@ var PublicFunctions = function () {
213 $('#bJwpointsInput').val(stationObj[0].stationJwpoints); 206 $('#bJwpointsInput').val(stationObj[0].stationJwpoints);
214 207
215 // WGS经纬度 208 // WGS经纬度
216 - $('#gJwpointsInput').val(stationObj[0].stationGlonx + ' ' + stationObj[0].stationGlaty); 209 + /*$('#gJwpointsInput').val(stationObj[0].stationGlonx + ' ' + stationObj[0].stationGlaty);*/
217 210
218 // 获取图形类型元素,并添加值 211 // 获取图形类型元素,并添加值
219 $('#shapesTypeSelect').val(stationObj[0].stationShapesType); 212 $('#shapesTypeSelect').val(stationObj[0].stationShapesType);
@@ -260,9 +253,9 @@ var PublicFunctions = function () { @@ -260,9 +253,9 @@ var PublicFunctions = function () {
260 253
261 }, 254 },
262 255
263 - getStationRouteInfo : function(callback){ 256 + getStationRouteInfo : function(stationId,callback){
264 257
265 - $get('/stationroute/findStationRouteInfo',{id:id},function(r) { 258 + $get('/stationroute/findStationRouteInfo',{id:stationId},function(r) {
266 259
267 callback && callback(r); 260 callback && callback(r);
268 261
@@ -402,7 +395,40 @@ var PublicFunctions = function () { @@ -402,7 +395,40 @@ var PublicFunctions = function () {
402 395
403 stationObj=''; 396 stationObj='';
404 397
405 - PublicFunctions.initStationInfo(); 398 + PublicFunctions.initStationInfo(stationId,mapB);
  399 +
  400 + },
  401 +
  402 + getstationObjData : function(){
  403 +
  404 + return stationObj;
  405 + },
  406 +
  407 + getStationIdValue : function() {
  408 +
  409 + return stationId;
  410 + },
  411 +
  412 + setStationNameValue : function(editStationName) {
  413 +
  414 + stationObj[0].stationName = editStationName;
  415 +
  416 + return stationObj;
  417 + },
  418 +
  419 + getPolygonObj : function() {
  420 +
  421 + return polygon;
  422 + },
  423 +
  424 + getMarkerObj : function() {
  425 +
  426 + return marker;
  427 + },
  428 +
  429 + getCircleObj : function() {
  430 +
  431 + return circle;
406 432
407 } 433 }
408 } 434 }
src/main/resources/static/pages/base/station/js/station-positions-map.js
@@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
5 5
6 var WorldsBMap = function () { 6 var WorldsBMap = function () {
7 7
  8 + var mapBValue = '',drawingManagerInit='';
  9 +
8 var Bmap = { 10 var Bmap = {
9 11
10 init : function() { 12 init : function() {
@@ -23,47 +25,36 @@ var WorldsBMap = function () { @@ -23,47 +25,36 @@ var WorldsBMap = function () {
23 var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; 25 var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';
24 26
25 // 初始化百度地图 27 // 初始化百度地图
26 - var map = new BMap.Map("bmap_basic"); 28 + mapBValue = new BMap.Map("bmap_basic");
27 29
28 //中心点和缩放级别 30 //中心点和缩放级别
29 - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); 31 + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
30 32
31 //启用地图拖拽事件,默认启用(可不写) 33 //启用地图拖拽事件,默认启用(可不写)
32 - map.enableDragging(); 34 + mapBValue.enableDragging();
33 35
34 //启用地图滚轮放大缩小 36 //启用地图滚轮放大缩小
35 - map.enableScrollWheelZoom(); 37 + mapBValue.enableScrollWheelZoom();
36 38
37 //禁用鼠标双击放大 39 //禁用鼠标双击放大
38 - map.disableDoubleClickZoom(); 40 + mapBValue.disableDoubleClickZoom();
39 41
40 //启用键盘上下左右键移动地图 42 //启用键盘上下左右键移动地图
41 - map.enableKeyboard(); 43 + mapBValue.enableKeyboard();
42 44
43 - var styleOptions = {  
44 -  
45 - //边线颜色。  
46 - strokeColor : "blue",  
47 -  
48 - //填充颜色。当参数为空时,圆形将没有填充效果。  
49 - fillColor : "blue",  
50 -  
51 - //边线的宽度,以像素为单位。  
52 - strokeWeight : 3,  
53 -  
54 - //边线透明度,取值范围0 - 1。  
55 - strokeOpacity : 0.8,  
56 -  
57 - //填充的透明度,取值范围0 - 1。  
58 - fillOpacity : 0.6,  
59 -  
60 - //边线的样式,solid或dashed。  
61 - strokeStyle : 'solid'  
62 -  
63 - }; 45 + return mapBValue;
  46 + },
  47 +
  48 + // 获取百度地图map值
  49 + getMapBValue : function(){
  50 +
  51 + return mapBValue;
  52 + },
  53 +
  54 + initDrawingManager : function(map,styleOptions) {
64 55
65 // 创建鼠标绘制管理类 56 // 创建鼠标绘制管理类
66 - drawingManager = new BMapLib.DrawingManager(map, { 57 + drawingManagerInit = new BMapLib.DrawingManager(map, {
67 58
68 //是否开启绘制模式 59 //是否开启绘制模式
69 isOpen : false, 60 isOpen : false,
@@ -90,9 +81,9 @@ var WorldsBMap = function () { @@ -90,9 +81,9 @@ var WorldsBMap = function () {
90 }); 81 });
91 82
92 // 添加绘画完成事件 83 // 添加绘画完成事件
93 - drawingManager.addEventListener('polygoncomplete', function(e) { 84 + drawingManagerInit.addEventListener('polygoncomplete', function(e) {
94 85
95 - drawingManager.close(); 86 + drawingManagerInit.close();
96 87
97 if (e.getPath().length <= 2) { 88 if (e.getPath().length <= 2) {
98 89
@@ -124,7 +115,31 @@ var WorldsBMap = function () { @@ -124,7 +115,31 @@ var WorldsBMap = function () {
124 115
125 var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}]; 116 var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}];
126 117
127 - PublicFunctions.getFormPointEToWGS(PointsList,function(resultdata) { 118 + var gPloygonGrid = '';
  119 +
  120 + var bPloygonGrid = '';
  121 +
  122 + var pointsListLen_ = PointsList.length;
  123 +
  124 + for(var k =0;k<pointsListLen_;k++) {
  125 +
  126 + if(k==0) {
  127 +
  128 + bPloygonGrid = PointsList[k].potion.lng + ' ' +PointsList[k].potion.lat;
  129 +
  130 + }else {
  131 +
  132 + bPloygonGrid = bPloygonGrid + ',' + PointsList[k].potion.lng + ' ' +PointsList[k].potion.lat;
  133 +
  134 + }
  135 +
  136 + }
  137 +
  138 + PublicFunctions.editSeteditStationParmasValue(addSttationPoints_,'','',bPloygonGrid,'','d','');
  139 +
  140 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  141 +
  142 + /*PublicFunctions.getFormPointEToWGS(PointsList,function(resultdata) {
128 143
129 var gPloygonGrid = ''; 144 var gPloygonGrid = '';
130 145
@@ -164,16 +179,22 @@ var WorldsBMap = function () { @@ -164,16 +179,22 @@ var WorldsBMap = function () {
164 179
165 }); 180 });
166 181
167 - }); 182 + });*/
168 } 183 }
169 184
170 }); 185 });
171 186
172 - return map; 187 + return drawingManagerInit;
  188 + },
  189 +
  190 + // 获取绘制工具类
  191 + getDrawingManagerValue : function() {
  192 +
  193 + return drawingManagerInit;
173 }, 194 },
174 195
175 // 打开绘画工具 196 // 打开绘画工具
176 - drawingManagerOpen : function() { 197 + /*drawingManagerOpen : function() {
177 198
178 // 清楚地图覆盖物 199 // 清楚地图覆盖物
179 mapB.clearOverlays(); 200 mapB.clearOverlays();
@@ -184,7 +205,7 @@ var WorldsBMap = function () { @@ -184,7 +205,7 @@ var WorldsBMap = function () {
184 // 设置属性 205 // 设置属性
185 drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); 206 drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
186 207
187 - }, 208 + },*/
188 209
189 // 编辑图形 210 // 编辑图形
190 editShapes : function(stationShapesTypeV,mindex) { 211 editShapes : function(stationShapesTypeV,mindex) {
@@ -192,25 +213,33 @@ var WorldsBMap = function () { @@ -192,25 +213,33 @@ var WorldsBMap = function () {
192 // 编辑圆 213 // 编辑圆
193 if(stationShapesTypeV =='r') { 214 if(stationShapesTypeV =='r') {
194 215
  216 + var enCircle = PublicFunctions.getCircleObj();
  217 +
195 // 开启编辑功能 218 // 开启编辑功能
196 - circle.enableEditing(); 219 + enCircle.enableEditing();
197 220
198 // 编辑圆监听事件 221 // 编辑圆监听事件
199 - circle.addEventListener('dblclick',function() { 222 + enCircle.addEventListener('dblclick',function() {
200 223
201 // 关闭提示弹出层 224 // 关闭提示弹出层
202 layer.close(mindex); 225 layer.close(mindex);
203 226
204 // 返回圆形的半径,单位为米。 227 // 返回圆形的半径,单位为米。
205 - var newRadius = circle.getRadius(); 228 + var newRadius = enCircle.getRadius();
206 229
207 // 返回圆形的中心点坐标。 230 // 返回圆形的中心点坐标。
208 - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; 231 + var newCenter = enCircle.getCenter().lng + ' ' + enCircle.getCenter().lat;
209 232
210 - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; 233 + var centre_New = [{potion:{lng:enCircle.getCenter().lng,lat:enCircle.getCenter().lat}}];
  234 +
  235 + // 设置修改站点参数集合
  236 + PublicFunctions.editSeteditStationParmasValue(newCenter, '', '','','','r',Math.round(newRadius));
  237 +
  238 + // 加载编辑页面
  239 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
211 240
212 // 中心百度坐标转WGS坐标 241 // 中心百度坐标转WGS坐标
213 - PublicFunctions.getFormPointEToWGS(centre_New,function(p) { 242 + /*PublicFunctions.getFormPointEToWGS(centre_New,function(p) {
214 243
215 // 设置修改站点参数集合 244 // 设置修改站点参数集合
216 PublicFunctions.editSeteditStationParmasValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius)); 245 PublicFunctions.editSeteditStationParmasValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius));
@@ -218,21 +247,23 @@ var WorldsBMap = function () { @@ -218,21 +247,23 @@ var WorldsBMap = function () {
218 // 加载编辑页面 247 // 加载编辑页面
219 $.get('edit.html', function(m){$(pjaxContainer).append(m);}); 248 $.get('edit.html', function(m){$(pjaxContainer).append(m);});
220 249
221 - }); 250 + });*/
222 251
223 }); 252 });
224 253
225 // 编辑多变行 254 // 编辑多变行
226 }else if(stationShapesTypeV =='d') { 255 }else if(stationShapesTypeV =='d') {
227 256
  257 + var enPolygon = PublicFunctions.getCircleObj();
  258 +
228 // 开启编辑功能(自 1.1 新增) 259 // 开启编辑功能(自 1.1 新增)
229 - polygon.enableEditing(); 260 + enPolygon.enableEditing();
230 261
231 // 添加多变行编辑事件 262 // 添加多变行编辑事件
232 - polygon.addEventListener('dblclick',function(e) { 263 + enPolygon.addEventListener('dblclick',function(e) {
233 264
234 // 获取编辑的多边形对象 265 // 获取编辑的多边形对象
235 - var edit_pointE = polygon; 266 + var edit_pointE = enPolygon;
236 267
237 // 多边形坐标点集合 268 // 多边形坐标点集合
238 var eidt_PointsList = []; 269 var eidt_PointsList = [];
@@ -250,8 +281,36 @@ var WorldsBMap = function () { @@ -250,8 +281,36 @@ var WorldsBMap = function () {
250 // 多边形中心点 281 // 多边形中心点
251 var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; 282 var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat;
252 283
  284 + // 多边形WGS坐标字符串
  285 + var eidt_gPloygonGrid = '';
  286 +
  287 + // 百度坐标字符串
  288 + var edit_bPloygonGrid = '';
  289 +
  290 + var eidt_PointsListLen_ = eidt_PointsList.length;
  291 +
  292 + for(var k =0;k<eidt_PointsListLen_;k++) {
  293 +
  294 + if(k==0) {
  295 +
  296 + edit_bPloygonGrid = eidt_PointsList[k].potion.lng + ' ' +eidt_PointsList[k].potion.lat;
  297 +
  298 + }else {
  299 +
  300 + edit_bPloygonGrid = edit_bPloygonGrid + ',' + eidt_PointsList[k].potion.lng + ' ' +eidt_PointsList[k].potion.lat;
  301 +
  302 + }
  303 +
  304 + }
  305 +
  306 + // 设置编辑站点参宿集合
  307 + PublicFunctions.editSeteditStationParmasValue(centre_points,'','',edit_bPloygonGrid,'','d','');
  308 +
  309 + // 加载编辑页面
  310 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  311 +
253 // 多边形坐标点集合转WGS坐标 312 // 多边形坐标点集合转WGS坐标
254 - PublicFunctions.getFormPointEToWGS(eidt_PointsList,function(resultdata) { 313 + /*PublicFunctions.getFormPointEToWGS(eidt_PointsList,function(resultdata) {
255 314
256 // 多边形WGS坐标字符串 315 // 多边形WGS坐标字符串
257 var eidt_gPloygonGrid = ''; 316 var eidt_gPloygonGrid = '';
@@ -296,8 +355,7 @@ var WorldsBMap = function () { @@ -296,8 +355,7 @@ var WorldsBMap = function () {
296 355
297 }); 356 });
298 357
299 - });  
300 - 358 + });*/
301 359
302 }); 360 });
303 361
@@ -344,7 +402,7 @@ var WorldsBMap = function () { @@ -344,7 +402,7 @@ var WorldsBMap = function () {
344 localSearch.search(Address); 402 localSearch.search(Address);
345 403
346 } 404 }
347 - 405 +
348 } 406 }
349 407
350 return Bmap; 408 return Bmap;
src/main/resources/static/pages/base/station/js/station-positions-reload.js
@@ -15,15 +15,40 @@ @@ -15,15 +15,40 @@
15 (function(){ 15 (function(){
16 16
17 // 获取参数线路ID 17 // 获取参数线路ID
18 - id = $.url().param('no'); 18 + var id = $.url().param('no');
  19 +
  20 + var styleOptions = {
  21 +
  22 + //边线颜色。
  23 + strokeColor : "blue",
  24 +
  25 + //填充颜色。当参数为空时,圆形将没有填充效果。
  26 + fillColor : "blue",
  27 +
  28 + //边线的宽度,以像素为单位。
  29 + strokeWeight : 3,
  30 +
  31 + //边线透明度,取值范围0 - 1。
  32 + strokeOpacity : 0.8,
  33 +
  34 + //填充的透明度,取值范围0 - 1。
  35 + fillOpacity : 0.6,
  36 +
  37 + //边线的样式,solid或dashed。
  38 + strokeStyle : 'solid'
  39 +
  40 + };
19 41
20 // 等候500毫秒执行 42 // 等候500毫秒执行
21 setTimeout(function(){ 43 setTimeout(function(){
22 44
23 // 地图初始化 45 // 地图初始化
24 - mapB = WorldsBMap.init(); 46 + var map_ = WorldsBMap.init();
  47 +
  48 + // 初始化绘制工具类
  49 + var drawingManager_ = WorldsBMap.initDrawingManager(map_,styleOptions);
25 50
26 - PublicFunctions.initStationInfo(); 51 + PublicFunctions.initStationInfo(id,map_);
27 52
28 },200); 53 },200);
29 54
src/main/resources/static/pages/base/station/positions.html
@@ -25,10 +25,10 @@ @@ -25,10 +25,10 @@
25 /** 定义全局变量 */ 25 /** 定义全局变量 */
26 26
27 /** stationObj:站点信息对象;drawingManager:绘制工具对象;mapB:地图对象:circle:圆对象;polygon:多边形对象 */ 27 /** stationObj:站点信息对象;drawingManager:绘制工具对象;mapB:地图对象:circle:圆对象;polygon:多边形对象 */
28 - var stationObj = '', drawingManager= '', mapB = '',circle = '',polygon = ''; 28 + /* var stationObj = '', drawingManager= '', mapB = '',circle = '',polygon = ''; */
29 29
30 /** marker:覆盖物对象;infoWindow:信息窗口对象;Id:站点ID */ 30 /** marker:覆盖物对象;infoWindow:信息窗口对象;Id:站点ID */
31 - var marker = '',infoWindow = '',id = ''; 31 + /* var marker = '',infoWindow = '',id = ''; */
32 32
33 </script> 33 </script>
34 34
src/main/resources/static/pages/base/stationroute/add.html
@@ -19,11 +19,11 @@ @@ -19,11 +19,11 @@
19 </div> 19 </div>
20 20
21 <!-- 线路ID --> 21 <!-- 线路ID -->
22 - <input type="hidden" name="lineId" id="lineIdInput" /> 22 + <input type="hidden" name="lineId" id="lineIdInput" value="" />
23 23
24 - <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" /> 24 + <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" value="" />
25 25
26 - <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" /> 26 + <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" value="" />
27 27
28 <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> 28 <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
29 29
@@ -232,47 +232,53 @@ @@ -232,47 +232,53 @@
232 <script type="text/javascript"> 232 <script type="text/javascript">
233 $(function(){ 233 $(function(){
234 234
  235 + var addLine = LineObj.getLineObj();
  236 +
  237 + var addStation = AddStationObj.getAddStation();
  238 +
235 // 延迟加载 239 // 延迟加载
236 setTimeout(function(){ 240 setTimeout(function(){
237 241
238 // 显示mobal 242 // 显示mobal
239 - $('#add_station_mobal').modal({  
240 -  
241 - show : true,  
242 -  
243 - backdrop: 'static',  
244 -  
245 - keyboard: false  
246 -  
247 - }); 243 + $('#add_station_mobal').modal({show : true,backdrop: 'static', keyboard: false});
248 244
249 },200); 245 },200);
250 246
251 // 当调用 hide 实例方法时触发 247 // 当调用 hide 实例方法时触发
252 $('#add_station_mobal').on('hide.bs.modal', function () { 248 $('#add_station_mobal').on('hide.bs.modal', function () {
253 249
254 - addStaitonParmas = {};  
255 -  
256 - mapB.clearOverlays();  
257 -  
258 - var add_direction_v = $('#stationdirSelect').val();  
259 -  
260 - GetAjaxData.getSectionRouteInfo(id,add_direction_v,function(data) {  
261 -  
262 - PublicFunctions.linePanlThree(data,add_direction_v);  
263 -  
264 - }); 250 + closeMobleSetClean();
265 251
266 }); 252 });
267 253
268 -  
269 // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。 254 // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
270 $('#add_station_mobal').on('show.bs.modal', function () { 255 $('#add_station_mobal').on('show.bs.modal', function () {
271 256
272 // 线路ID 257 // 线路ID
273 - $('#lineIdInput').val(id); 258 + $('#lineIdInput').val(addLine.id);
  259 +
  260 + // 获取站点名称元素设值
  261 + $('#stationNameInput').val(addStation.stationNamebootbox).attr('Readonly','Readonly');
  262 +
  263 + // 获取方向元素,并添加值
  264 + $('#stationdirSelect').val(addStation.dir).attr('Readonly','Readonly');
  265 +
  266 + // 百度地图经纬度坐标中心点
  267 + $('#bJwpointsInput').val(addStation.bJwpoints).attr('Readonly','Readonly');
  268 +
  269 + // 百度坐标点图形集合
  270 + $('#bPolygonGridInput').val(addStation.bPolygonGrid);
  271 +
  272 + // 获取图形类型元素,并添加值
  273 + $('#shapesTypeSelect').val(addStation.shapesType).attr('Readonly','Readonly');
  274 +
  275 + // 获取圆形半径元素,并添加值
  276 + $('#radiusSelect').val(addStation.radius).attr('Readonly','Readonly');
274 277
275 - // WGS坐标点图形集合 278 + // 是否撤销
  279 + $('#destroySelect').val(0).attr('Readonly','Readonly');
  280 +
  281 + /* // WGS坐标点图形集合
276 $('#bPolygonGridInput').val(addStaitonParmas.bPolygonGridInput); 282 $('#bPolygonGridInput').val(addStaitonParmas.bPolygonGridInput);
277 283
278 // 百度坐标点图形集合 284 // 百度坐标点图形集合
@@ -300,10 +306,10 @@ $(function(){ @@ -300,10 +306,10 @@ $(function(){
300 $('#radiusSelect').val(addStaitonParmas.radiusInput).attr('Readonly','Readonly'); 306 $('#radiusSelect').val(addStaitonParmas.radiusInput).attr('Readonly','Readonly');
301 307
302 // 是否撤销 308 // 是否撤销
303 - $('#destroySelect').val(addStaitonParmas.destroyInput).attr('Readonly','Readonly'); 309 + $('#destroySelect').val(addStaitonParmas.destroyInput).attr('Readonly','Readonly'); */
304 310
305 // 获取站点序号元素,并添加下拉属性值 311 // 获取站点序号元素,并添加下拉属性值
306 - GetAjaxData.getStation(id,dir,function(treeData) { 312 + GetAjaxData.getStation(addLine.id,addStation.dir,function(treeData) {
307 313
308 var options = '<option value="">请选择...</option>'; 314 var options = '<option value="">请选择...</option>';
309 315
@@ -326,7 +332,7 @@ $(function(){ @@ -326,7 +332,7 @@ $(function(){
326 332
327 }); 333 });
328 334
329 - }) 335 + });
330 336
331 // 站点序号值改变事件 337 // 站点序号值改变事件
332 $('#stationrouteSelect').on('change',function() { 338 $('#stationrouteSelect').on('change',function() {
@@ -337,8 +343,6 @@ $(function(){ @@ -337,8 +343,6 @@ $(function(){
337 343
338 var tempStr = stationRValue.split('_'); 344 var tempStr = stationRValue.split('_');
339 345
340 - console.log(tempStr);  
341 -  
342 if(tempStr[1] == 'E') { 346 if(tempStr[1] == 'E') {
343 347
344 $('#stationMarkSelect').val('E'); 348 $('#stationMarkSelect').val('E');
@@ -486,30 +490,48 @@ $(function(){ @@ -486,30 +490,48 @@ $(function(){
486 // 弹出添加成功提示消息 490 // 弹出添加成功提示消息
487 layer.msg('添加成功...'); 491 layer.msg('添加成功...');
488 492
489 - // 刷行左边树  
490 - PublicFunctions.resjtreeDate(id,params.directions);  
491 -  
492 - GetAjaxData.getSectionRouteInfo(id,params.directions,function(data) {  
493 -  
494 - PublicFunctions.linePanlThree(data,params.directions);  
495 -  
496 - });  
497 -  
498 }else { 493 }else {
499 494
500 // 弹出添加失败提示消息 495 // 弹出添加失败提示消息
501 layer.msg('添加失败...'); 496 layer.msg('添加失败...');
502 497
503 } 498 }
504 - 499 +
  500 + var id =addLine.id;
  501 +
  502 + var dir = params.directions
  503 +
  504 + // 刷行左边树
  505 + PublicFunctions.resjtreeDate(id,dir);
  506 +
  507 + closeMobleSetClean();
  508 +
505 // 隐藏moble 509 // 隐藏moble
506 hideMoble(); 510 hideMoble();
507 511
508 - 512 +
509 }); 513 });
510 } 514 }
511 }); 515 });
512 516
  517 + function closeMobleSetClean() {
  518 +
  519 + // 清除地图覆盖物
  520 + WorldsBMap.clearMarkAndOverlays();
  521 +
  522 + /** 设置新增站点集合对象为空 */
  523 + AddStationObj.setAddStation();
  524 +
  525 + var add_direction_v = $('#stationdirSelect').val();
  526 +
  527 + GetAjaxData.getSectionRouteInfo(addLine.id,add_direction_v,function(data) {
  528 +
  529 + PublicFunctions.linePanlThree(addLine.id,data,add_direction_v);
  530 +
  531 + });
  532 +
  533 + }
  534 +
513 function hideMoble() { 535 function hideMoble() {
514 536
515 // 隐藏mobal 537 // 隐藏mobal
src/main/resources/static/pages/base/stationroute/add_select.html
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <div class="form-group" id="formRequ"> 23 <div class="form-group" id="formRequ">
24 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> 24 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
25 <div class="col-md-9"> 25 <div class="col-md-9">
26 - <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox"> 26 + <input type="text" class="form-control input-medium" id="stationNamebootboxInput" name="stationNamebootbox">
27 </div> 27 </div>
28 </div> 28 </div>
29 29
@@ -38,21 +38,21 @@ @@ -38,21 +38,21 @@
38 <label > 38 <label >
39 <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加 39 <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加
40 </label> 40 </label>
41 - <label> 41 + <!-- <label>
42 <input type="radio" class="icheck" name="baseRes" value=2> 系统引用 42 <input type="radio" class="icheck" name="baseRes" value=2> 系统引用
43 - </label> 43 + </label> -->
44 </div> 44 </div>
45 </div> 45 </div>
46 </div> 46 </div>
47 47
48 - <div class="form-group">  
49 - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">  
50 - <h5 class="block"><span class="help-block" style="color:#eee;"> * 新增方式说明: </span></h5>  
51 - <p><span class="help-block" style="color:#eee;"> a)系统生成:根据站点名称自动生成以300米为半径范围的圆.</span> </p>  
52 - <p><span class="help-block" style="color:#eee;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>  
53 - <p><span class="help-block" style="color:#eee;"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p>  
54 - </div>  
55 - </div> 48 + <div class="form-group">
  49 + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
  50 + <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 新增方式说明: </span></h5>
  51 + <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据站点名称自动生成以150米为半径范围的圆.</span> </p>
  52 + <p><span class="help-block" style="color:#1bbc9b;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>
  53 + <!-- <p><span class="help-block" style="color:#1bbc9b;"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p> -->
  54 + </div>
  55 + </div>
56 </form> 56 </form>
57 </div> 57 </div>
58 <div class="modal-footer"> 58 <div class="modal-footer">
@@ -69,35 +69,13 @@ $(function(){ @@ -69,35 +69,13 @@ $(function(){
69 $('#add_select_mobal').modal({show : true,backdrop: 'static', keyboard: false}); 69 $('#add_select_mobal').modal({show : true,backdrop: 'static', keyboard: false});
70 70
71 // 站点名称改变事件 71 // 站点名称改变事件
72 - $('#stationNamebootbox').on('change',function() { 72 + $('#stationNamebootboxInput').on('change',function() {
73 73
74 - var stationNameV = $('#stationNamebootbox').val(); 74 + // 获取站点名称
  75 + var stationNamebootbox = $('#stationNamebootboxInput').val();
75 76
76 - WorldsBMap.localSearchFromAdreesToPoint(stationNameV,mapB,function(Points) {  
77 -  
78 - if(Points) {  
79 -  
80 - var BJwpointsArray = Points.split(' ');  
81 -  
82 - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]);  
83 -  
84 - var marker_stargt2 = new BMap.Marker(stationNameChangePoint);  
85 -  
86 - var PanOptions ={noAnimation :true};  
87 -  
88 - mapB.panTo(stationNameChangePoint,PanOptions);  
89 -  
90 - mapB.panBy(0,100);  
91 -  
92 - // 将标注添加到地图中  
93 - mapB.addOverlay(marker_stargt2);  
94 -  
95 - //跳动的动画  
96 - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE);  
97 -  
98 - }  
99 -  
100 - }); 77 + /** 根据站点名称获取坐标在地图上标注 @param :<stationNamebootbox:站点名称> */
  78 + WorldsBMap.localtionPoint(stationNamebootbox);
101 79
102 }); 80 });
103 81
@@ -172,24 +150,90 @@ $(function(){ @@ -172,24 +150,90 @@ $(function(){
172 // 表单序列化 150 // 表单序列化
173 var params = form.serializeJSON(); 151 var params = form.serializeJSON();
174 152
175 - // 获取站点名称  
176 - var stationNamebootbox = params.stationNamebootbox; 153 + var stationName = params.stationNamebootbox
177 154
178 // 获取新增站点方式 155 // 获取新增站点方式
179 var baseRes = params.baseRes; 156 var baseRes = params.baseRes;
180 157
181 // 查询是否存在输入的站点名称 158 // 查询是否存在输入的站点名称
182 - GetAjaxData.getLikeStationName(stationNamebootbox,function(data) { 159 + GetAjaxData.getLikeStationName(stationName,function(data) {
  160 +
  161 + // 验证系统是存在该站点名称
  162 + var tempblm = PublicFunctions.isHaveStationName(data);
183 163
184 - // 站点名称  
185 - addStaitonParmas.stationNamebootbox = stationNamebootbox; 164 + if(tempblm) {
  165 +
  166 + /** 设置新增站点对象站点名称属性值 @param:<stationName:站点名称)> */
  167 + AddStationObj.setAddStationName(stationName);
  168 +
  169 + // 系统生成
  170 + if(baseRes == 0) {
  171 +
  172 + /** 根据站点位置获取坐标 @parma:<stationName:站点名称;callback:返回函数> */
  173 + WorldsBMap.localSearchFromAdreesToPoint(stationName,function(Points) {
  174 +
  175 + if(Points) {
  176 +
  177 + /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  178 + AddStationObj.setAddStationBJwpoints(Points);
  179 +
  180 + /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  181 + AddStationObj.setAddStationShapesType('r');
  182 +
  183 + /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  184 + AddStationObj.setAddStationRadius(100);
  185 +
  186 + /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  187 + AddStationObj.setBPolygonGrid('');
  188 +
  189 + // 以藏站点新增方式mobal
  190 + $('#add_select_mobal').modal('hide');
  191 +
  192 + // 加载add页面
  193 + $.get('add.html', function(m){$(pjaxContainer).append(m);});
  194 +
  195 + }else {
  196 +
  197 + // 返回坐标为空
  198 + layer.confirm('【系统无法生成,请选择其他方式新增】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  199 +
  200 + layer.close(index);
  201 +
  202 + });
  203 +
  204 + }
  205 +
  206 + });
  207 +
  208 + }else if(baseRes==1) {
  209 +
  210 + WorldsBMap.clearMarkAndOverlays();
  211 +
  212 + // 以藏站点新增方式mobal
  213 + $('#add_select_mobal').modal('hide');
  214 +
  215 + // 打开绘制工具
  216 + DrawingManagerObj.openDrawingManager();
  217 +
  218 + WorldsBMap.localtionPoint(stationName);
  219 +
  220 + }
  221 +
  222 + }else {
  223 +
  224 + // 返回坐标为空
  225 + layer.confirm('系统已存在【'+ stationName+'】站名!<br/>请选择:<br/>&nbsp;系统引用或者修改站点名进行新增.', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  226 +
  227 + layer.close(index);
  228 +
  229 + });
  230 +
  231 + }
186 232
  233 + /*
187 // 系统生成 234 // 系统生成
188 if(baseRes == 0) { 235 if(baseRes == 0) {
189 236
190 - // 验证系统是存在该站点名称  
191 - var tempblm = PublicFunctions.isHaveStationName(data);  
192 -  
193 if(tempblm) { 237 if(tempblm) {
194 238
195 WorldsBMap.localSearchFromAdreesToPoint(stationNamebootbox,mapB,function(Points) { 239 WorldsBMap.localSearchFromAdreesToPoint(stationNamebootbox,mapB,function(Points) {
@@ -199,19 +243,28 @@ $(function(){ @@ -199,19 +243,28 @@ $(function(){
199 var pointsArray = Points.split(' '); 243 var pointsArray = Points.split(' ');
200 244
201 var paramCentre = [{potion:{lng:pointsArray[0],lat:pointsArray[1]}}]; 245 var paramCentre = [{potion:{lng:pointsArray[0],lat:pointsArray[1]}}];
  246 +
  247 + // 设置值
  248 + PublicFunctions.setFormInputValue(Points, '','','','','r',100);
  249 +
  250 + // 以藏站点新增方式mobal
  251 + $('#add_select_mobal').modal('hide');
  252 +
  253 + // 加载add页面
  254 + $.get('add.html', function(m){$(pjaxContainer).append(m);});
202 255
203 - GetAjaxData.getFormPointEToWGS(paramCentre,function(p) { 256 + // GetAjaxData.getFormPointEToWGS(paramCentre,function(p) {
204 257
205 // 设置值 258 // 设置值
206 - PublicFunctions.setFormInputValue(Points, p[0].WGSpotion.Lng,p[0].WGSpotion.Lat,'','','r',300); 259 + // PublicFunctions.setFormInputValue(Points, p[0].WGSpotion.Lng,p[0].WGSpotion.Lat,'','','r',150);
207 260
208 // 以藏站点新增方式mobal 261 // 以藏站点新增方式mobal
209 - $('#add_select_mobal').modal('hide'); 262 + // $('#add_select_mobal').modal('hide');
210 263
211 // 加载add页面 264 // 加载add页面
212 $.get('add.html', function(m){$(pjaxContainer).append(m);}); 265 $.get('add.html', function(m){$(pjaxContainer).append(m);});
213 266
214 - }); 267 + });
215 268
216 } else { 269 } else {
217 270
@@ -242,7 +295,7 @@ $(function(){ @@ -242,7 +295,7 @@ $(function(){
242 status = 'add'; 295 status = 'add';
243 296
244 WorldsBMap.drawingManagerOpen(); 297 WorldsBMap.drawingManagerOpen();
245 - 298 + WorldsBMap.localtionPoint(stationNamebootbox);
246 299
247 } 300 }
248 301
@@ -254,7 +307,7 @@ $(function(){ @@ -254,7 +307,7 @@ $(function(){
254 $('#add_select_mobal').modal('hide'); 307 $('#add_select_mobal').modal('hide');
255 308
256 $.get('station_tabledate.html', function(m){$(pjaxContainer).append(m);}); 309 $.get('station_tabledate.html', function(m){$(pjaxContainer).append(m);});
257 - } 310 + }*/
258 }); 311 });
259 } 312 }
260 }); 313 });
src/main/resources/static/pages/base/stationroute/addstationstemplate.html
@@ -146,11 +146,88 @@ $(function(){ @@ -146,11 +146,88 @@ $(function(){
146 WorldsBMap.stationsNameToPoints(paramsStationsArray,function(resultJson) { 146 WorldsBMap.stationsNameToPoints(paramsStationsArray,function(resultJson) {
147 147
148 // 根据坐标点获取两点之间的时间与距离 148 // 根据坐标点获取两点之间的时间与距离
149 - WorldsBMap.getDistanceAndTotime(resultJson,function(stationdataList) { 149 + WorldsBMap.getDistanceAndDuration(resultJson,function(stationdataList) {
150 150
151 // 根据坐标点获取两点之间的折线路段 151 // 根据坐标点获取两点之间的折线路段
152 WorldsBMap.getSectionListPlonly(stationdataList,function(sectiondata) { 152 WorldsBMap.getSectionListPlonly(stationdataList,function(sectiondata) {
153 153
  154 + // 设置第一个站的距离
  155 + stationdataList[0].distance = '';
  156 +
  157 + // 设置第一个站的时间
  158 + stationdataList[0].duration = '';
  159 +
  160 + // 定义站点信息JSON字符串
  161 + var stationJSON = JSON.stringify(stationdataList);
  162 +
  163 + // 定义路段信息字符串
  164 + var sectionJSON = JSON.stringify(sectiondata);
  165 +
  166 + // 参数集合
  167 + var params = {};
  168 +
  169 + // 站点信息JSON字符串
  170 + params.stationJSON = stationJSON;
  171 +
  172 + // 线路ID
  173 + params.lineId = id;
  174 +
  175 + // 方向
  176 + params.directions = directionData;
  177 +
  178 + // 原始坐标类型
  179 + params.dbType = 'b';
  180 +
  181 + // 圆形半径
  182 + params.radius = '100';
  183 +
  184 + // 限速
  185 + params.speedLimit = '60';
  186 +
  187 + // 图形类型(r:圆形;p:多边形)
  188 + params.shapesType = 'r';
  189 +
  190 + // destroy:是否撤销
  191 + params.destroy = '0';
  192 +
  193 + // versions:版本号
  194 + params.versions = '1';
  195 +
  196 + // 路段信息JSON字符串
  197 + params.sectionJSON = sectionJSON;
  198 +
  199 + // 保存
  200 + GetAjaxData.manualSave(params,function(rd) {
  201 +
  202 + // 关闭弹出层
  203 + layer.closeAll();
  204 +
  205 + if(rd.status='SUCCESS') {
  206 +
  207 + // 清除地图覆盖物
  208 + mapB.clearOverlays();
  209 +
  210 + layer.msg('保存成功!');
  211 +
  212 + // 刷新树
  213 + PublicFunctions.resjtreeDate(id,directionData);
  214 +
  215 + // 查询上行路段信息
  216 + GetAjaxData.getSectionRouteInfo(id,directionData,function(data) {
  217 +
  218 + // 在地图上画出线路走向
  219 + PublicFunctions.linePanlThree(data,directionData);
  220 +
  221 + });
  222 +
  223 + }else {
  224 +
  225 + layer.msg('保存失败!');
  226 +
  227 + }
  228 +
  229 + });
  230 + /*
154 // 路段折线百度坐标转WGS坐标 231 // 路段折线百度坐标转WGS坐标
155 PublicFunctions.eachSectionList(sectiondata,function(successdata) { 232 PublicFunctions.eachSectionList(sectiondata,function(successdata) {
156 233
@@ -232,7 +309,7 @@ $(function(){ @@ -232,7 +309,7 @@ $(function(){
232 309
233 }); 310 });
234 311
235 - }); 312 + });*/
236 313
237 }); 314 });
238 315
src/main/resources/static/pages/base/stationroute/edit.html
@@ -228,18 +228,22 @@ @@ -228,18 +228,22 @@
228 <script type="text/javascript"> 228 <script type="text/javascript">
229 $(function(){ 229 $(function(){
230 230
231 - PublicFunctions.setFormValue(); 231 + var editStationParmasObj = EditStationObj.getEitdStation();
232 232
233 - var edit_direction_v = editStationParmas.stationRouteDirections; 233 + var addLine = LineObj.getLineObj();
  234 +
  235 + PublicFunctions.setFormValue(editStationParmasObj);
  236 +
  237 + var edit_direction_v = editStationParmasObj.stationRouteDirections;
234 238
235 // 获取站点序号元素,并添加下拉属性值 239 // 获取站点序号元素,并添加下拉属性值
236 - GetAjaxData.getStation(id,edit_direction_v,function(treeData) { 240 + GetAjaxData.getStation(addLine.id,edit_direction_v,function(treeData) {
237 241
238 var options = '<option value="">请选择...</option>'; 242 var options = '<option value="">请选择...</option>';
239 243
240 var dArray = treeData[0].children[0].children; 244 var dArray = treeData[0].children[0].children;
241 245
242 - var eq_stationRouteCode = editStationParmas.stationRouteStationRouteCode + '_' +editStationParmas.stationRouteStationMark; 246 + var eq_stationRouteCode = editStationParmasObj.stationRouteStationRouteCode + '_' +editStationParmasObj.stationRouteStationMark;
243 247
244 for(var i = 0 ; i<dArray.length; i++){ 248 for(var i = 0 ; i<dArray.length; i++){
245 249
@@ -258,7 +262,7 @@ $(function(){ @@ -258,7 +262,7 @@ $(function(){
258 262
259 $('#stationrouteSelect').html(options); 263 $('#stationrouteSelect').html(options);
260 264
261 - GetAjaxData.findUpStationRouteCode(id,dir,editStationParmas.stationRouteStationRouteCode,function(str) { 265 + GetAjaxData.findUpStationRouteCode(addLine.id,edit_direction_v,editStationParmasObj.stationRouteStationRouteCode,function(str) {
262 266
263 if(str.length>0){ 267 if(str.length>0){
264 268
@@ -278,20 +282,27 @@ $(function(){ @@ -278,20 +282,27 @@ $(function(){
278 // 当调用 hide 实例方法时触发 282 // 当调用 hide 实例方法时触发
279 $('#edit_station_mobal').on('hide.bs.modal', function () { 283 $('#edit_station_mobal').on('hide.bs.modal', function () {
280 284
281 - var diractionV = $('#stationdirSelect').val(); 285 + closeMobleSetClean();
282 286
283 - editStationParmas = {}; 287 + });
  288 +
  289 + function closeMobleSetClean() {
284 290
285 - mapB.clearOverlays(); 291 + // 清除地图覆盖物
  292 + WorldsBMap.clearMarkAndOverlays();
286 293
287 - GetAjaxData.getSectionRouteInfo(id,diractionV,function(data) { 294 + /** 设置新增站点集合对象为空 */
  295 + EditStationObj.setEitdStation({});
  296 +
  297 + var add_direction_v = $('#stationdirSelect').val();
  298 +
  299 + GetAjaxData.getSectionRouteInfo(addLine.id,add_direction_v,function(data) {
288 300
289 - PublicFunctions.linePanlThree(data,diractionV); 301 + PublicFunctions.linePanlThree(addLine.id,data,add_direction_v);
290 302
291 }); 303 });
292 304
293 - });  
294 - 305 + }
295 306
296 // 编辑表单元素 307 // 编辑表单元素
297 var form = $('#edit_station_form'); 308 var form = $('#edit_station_form');
@@ -427,14 +438,6 @@ $(function(){ @@ -427,14 +438,6 @@ $(function(){
427 // 弹出添加成功提示消息 438 // 弹出添加成功提示消息
428 layer.msg('修改成功...'); 439 layer.msg('修改成功...');
429 440
430 - // 刷行左边树  
431 - PublicFunctions.resjtreeDate(id,params.directions);  
432 -  
433 - GetAjaxData.getSectionRouteInfo(id,params.directions,function(data) {  
434 -  
435 - PublicFunctions.linePanlThree(data,params.directions);  
436 -  
437 - });  
438 441
439 }else { 442 }else {
440 443
@@ -443,6 +446,15 @@ $(function(){ @@ -443,6 +446,15 @@ $(function(){
443 446
444 } 447 }
445 448
  449 + var id = addLine.id;
  450 +
  451 + var dir = params.directions
  452 +
  453 + // 刷行左边树
  454 + PublicFunctions.resjtreeDate(id,dir);
  455 +
  456 + closeMobleSetClean();
  457 +
446 $('#edit_station_mobal').modal('hide'); 458 $('#edit_station_mobal').modal('hide');
447 459
448 }); 460 });
@@ -514,7 +526,7 @@ $(function(){ @@ -514,7 +526,7 @@ $(function(){
514 526
515 var stationMarkV = $('#stationdirSelect').val(); 527 var stationMarkV = $('#stationdirSelect').val();
516 528
517 - if(stationMarkV!=editStationParmas.stationRouteDirections){ 529 + if(stationMarkV!=editStationParmasObj.stationRouteDirections){
518 530
519 tel = false; 531 tel = false;
520 532
src/main/resources/static/pages/base/stationroute/edit_select.html
@@ -47,12 +47,14 @@ @@ -47,12 +47,14 @@
47 </div> 47 </div>
48 </div> 48 </div>
49 </div> 49 </div>
  50 +
  51 + <!-- 修改方式说明容器 -->
50 <div class="form-group"> 52 <div class="form-group">
51 <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> 53 <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
52 - <h5 class="block"><span class="help-block"> * 修改方式说明: </span></h5>  
53 - <p><span class="help-block"> a)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>  
54 - <p><span class="help-block"> b)重新编辑:编辑原始位置与站点信息.</span> </p>  
55 - <p><span class="help-block"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p> 54 + <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 修改方式说明: </span></h5>
  55 + <p><span class="help-block" style="color:#1bbc9b;"> a)重新绘制位置:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p>
  56 + <p><span class="help-block" style="color:#1bbc9b;"> b)编辑原始位置:编辑原始位置与站点信息.</span> </p>
  57 + <!-- <p><span class="help-block" style="color:#1bbc9b;"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p> -->
56 </div> 58 </div>
57 </div> 59 </div>
58 </form> 60 </form>
@@ -68,14 +70,17 @@ @@ -68,14 +70,17 @@
68 70
69 $(function(){ 71 $(function(){
70 72
  73 + // 获取修改站点对象
  74 + var editStationParmas = EditStationObj.getEitdStation();
  75 +
71 // 显示选择修改方式弹出层 76 // 显示选择修改方式弹出层
72 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); 77 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
73 78
74 // 获取站点名称元素并赋值 79 // 获取站点名称元素并赋值
75 - $('#stationNamebootbox').val(editStationParmas.stationNamebootbox); 80 + $('#stationNamebootbox').val(editStationParmas.stationStationName);
76 81
77 // 定义站点图形 82 // 定义站点图形
78 - var stationShapesTypeV = editStationParmas.shapesTypeInput; 83 + var stationShapesTypeV = editStationParmas.stationShapesType;
79 84
80 // 获取表单元素 85 // 获取表单元素
81 var form = $('#edit_select'); 86 var form = $('#edit_select');
@@ -151,14 +156,23 @@ $(function(){ @@ -151,14 +156,23 @@ $(function(){
151 // 站点名称 156 // 站点名称
152 var editStationName = params.stationNamebootbox; 157 var editStationName = params.stationNamebootbox;
153 158
  159 + EditStationObj.setEitdStationName(editStationName);
  160 +
154 if(params.editselect==0){ 161 if(params.editselect==0){
155 162
156 - status = 'edit'; 163 + WorldsBMap.clearMarkAndOverlays();
  164 +
  165 + // 打开绘制工具
  166 + DrawingManagerObj.openDrawingManager();
  167 +
  168 + WorldsBMap.localtionPoint(editStationName);
  169 +
  170 + /* status = 'edit';
157 171
158 // 站点名称 172 // 站点名称
159 editStationParmas.stationNamebootbox = editStationName; 173 editStationParmas.stationNamebootbox = editStationName;
160 174
161 - WorldsBMap.drawingManagerOpen(); 175 + WorldsBMap.drawingManagerOpen(); */
162 176
163 177
164 }else if(params.editselect==1){ 178 }else if(params.editselect==1){
src/main/resources/static/pages/base/stationroute/js/addstationobj.js 0 → 100644
  1 +var AddStationObj = function () {
  2 +
  3 + /** 定义新增站点对象 */
  4 + var station={};
  5 +
  6 + var stationObj = {
  7 +
  8 + /** 获取新增站点集合对象 @return:<station:新增站点对象> */
  9 + getAddStation : function() {
  10 +
  11 + return station;
  12 + },
  13 +
  14 + /** 设置新增站点集合对象为空 */
  15 + setAddStation : function(station) {
  16 +
  17 + station = station;
  18 + },
  19 +
  20 + /** 设置新增站点集合对象方向属性值 @param:<dir:方向(0:上行;1:下行)> */
  21 + setAddStationDiraction : function(dir) {
  22 +
  23 + station.dir = dir;
  24 + },
  25 +
  26 + /** 设置新增站点集合对象站点名称属性值 @param:<stationName:站点名称) */
  27 + setAddStationName : function(stationName) {
  28 +
  29 + station.stationNamebootbox = stationName;
  30 +
  31 + },
  32 +
  33 + /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  34 + setAddStationBJwpoints : function(bJwpoints) {
  35 +
  36 + station.bJwpoints = bJwpoints;
  37 + },
  38 +
  39 + /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  40 + setAddStationShapesType : function(shapesType) {
  41 +
  42 + station.shapesType = shapesType;
  43 + },
  44 +
  45 + /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  46 + setAddStationRadius : function(radius) {
  47 +
  48 + station.radius = radius;
  49 + },
  50 +
  51 + /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  52 + setBPolygonGrid : function(bPolygonGrid) {
  53 +
  54 + station.bPolygonGrid = bPolygonGrid;
  55 + }
  56 + }
  57 +
  58 + return stationObj;
  59 +
  60 +}();
0 \ No newline at end of file 61 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/drawingManager.js 0 → 100644
  1 +var DrawingManagerObj = function () {
  2 +
  3 + // 创建鼠标绘制管理类
  4 + var drawingManager = '';
  5 +
  6 + var draMangerObj = {
  7 +
  8 + /** 初始化绘制工具类 */
  9 + init : function(map,styleOptions) {
  10 +
  11 + drawingManager = new BMapLib.DrawingManager(map, {
  12 +
  13 + //是否开启绘制模式
  14 + isOpen : false,
  15 +
  16 + //是否显示工具栏
  17 + enableDrawingTool : false,
  18 +
  19 + drawingToolOptions : {
  20 +
  21 + //位置
  22 + anchor : BMAP_ANCHOR_TOP_RIGHT,
  23 +
  24 + //偏离值
  25 + offset : new BMap.Size(5, 5),
  26 +
  27 + //工具栏缩放比例
  28 + scale : 0.8
  29 +
  30 + },
  31 +
  32 + //线的样式
  33 + polygonOptions : styleOptions
  34 +
  35 + });
  36 +
  37 + // 添加绘画完成事件
  38 + drawingManager.addEventListener('polygoncomplete', function(e) {
  39 +
  40 + drawingManager.close;
  41 +
  42 + if (e.getPath().length <= 2) {
  43 +
  44 + // 弹出提示消息
  45 + layer.msg('坐标点不能小于等于两个...');
  46 +
  47 + // 清除地图覆盖物
  48 + WorldsBMap.clearMarkAndOverlays();
  49 +
  50 + var addLine = LineObj.getLineObj();
  51 +
  52 + var addStation = AddStationObj.getAddStation();
  53 +
  54 + GetAjaxData.getSectionRouteInfo(addLine.id,addStation.dir,function(data) {
  55 +
  56 + PublicFunctions.linePanlThree(addLine.id,data,addStation.dir);
  57 +
  58 + /** 设置新增站点集合对象为空 */
  59 + AddStationObj.setAddStation({});
  60 +
  61 + EditStationObj.setEitdStation({});
  62 +
  63 + });
  64 +
  65 + return false;
  66 +
  67 + }else {
  68 +
  69 + var pointE = e;
  70 +
  71 + // 多变行质心点
  72 + var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;
  73 +
  74 + var PointsList = [];
  75 +
  76 + for ( var i = 0; i < pointE.getPath().length; i++) {
  77 +
  78 + PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}});
  79 +
  80 + }
  81 +
  82 + PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}});
  83 +
  84 + var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}];
  85 +
  86 + var pointsListLen_ = PointsList.length;
  87 +
  88 + var bPloygonGrid = '';
  89 +
  90 + for(var k =0;k<pointsListLen_;k++) {
  91 +
  92 + if(k==0) {
  93 +
  94 + bPloygonGrid = PointsList[k].potion.lng + ' ' +PointsList[k].potion.lat;
  95 +
  96 + }else {
  97 +
  98 + bPloygonGrid = bPloygonGrid + ',' + PointsList[k].potion.lng + ' ' +PointsList[k].potion.lat;
  99 +
  100 + }
  101 +
  102 + }
  103 +
  104 + var add = AddStationObj.getAddStation();
  105 +
  106 + var edit = EditStationObj.getEitdStation();
  107 +
  108 + if(!$.isEmptyObject(add)){
  109 +
  110 + /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  111 + AddStationObj.setAddStationBJwpoints(addSttationPoints_);
  112 +
  113 + /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  114 + AddStationObj.setAddStationShapesType('d');
  115 +
  116 + /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  117 + AddStationObj.setAddStationRadius('');
  118 +
  119 + /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  120 + AddStationObj.setBPolygonGrid(bPloygonGrid);
  121 +
  122 + $.get('add.html', function(m){$(pjaxContainer).append(m);});
  123 + }
  124 +
  125 + if(!$.isEmptyObject(edit)){
  126 +
  127 + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  128 + EditStationObj.setEitdStationBJwpoints(addSttationPoints_);
  129 +
  130 + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  131 + EditStationObj.setEitdStationShapesType('d');
  132 +
  133 + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  134 + EditStationObj.setEitdStationRadius('');
  135 +
  136 + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  137 + EditStationObj.setEitdBPolygonGrid(bPloygonGrid);
  138 +
  139 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  140 + }
  141 +
  142 + }
  143 +
  144 + });
  145 +
  146 + return drawingManager;
  147 +
  148 + },
  149 +
  150 + openDrawingManager : function() {
  151 +
  152 + // 打开鼠标绘画工具
  153 + drawingManager.open();
  154 +
  155 + // 设置属性
  156 + drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
  157 +
  158 + }
  159 + }
  160 +
  161 + return draMangerObj;
  162 +
  163 +}();
0 \ No newline at end of file 164 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/editstationobj.js 0 → 100644
  1 +var EditStationObj = function () {
  2 +
  3 + /** 定义修改站点对象 */
  4 + var station={};
  5 +
  6 + var stationObj = {
  7 +
  8 + /** 获取修改站点集合对象 @return:<station:修改站点对象> */
  9 + getEitdStation : function() {
  10 +
  11 + return station;
  12 + },
  13 +
  14 + /** 设置修改站点集合对象为空 */
  15 + setEitdStation : function(staiton) {
  16 +
  17 + station = staiton;
  18 + },
  19 +
  20 + /** 设置修改站点集合对象方向属性值 @param:<dir:方向(0:上行;1:下行)> */
  21 + setEitdStationDiraction : function(dir) {
  22 +
  23 + station.stationRouteDirections = dir;
  24 + },
  25 +
  26 + /** 设置修改站点集合对象站点名称属性值 @param:<stationName:站点名称) */
  27 + setEitdStationName : function(stationName) {
  28 +
  29 + station.stationStationName = stationName;
  30 +
  31 + },
  32 +
  33 + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  34 + setEitdStationBJwpoints : function(bJwpoints) {
  35 +
  36 + station.stationBJwpoints = bJwpoints;
  37 + },
  38 +
  39 + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  40 + setEitdStationShapesType : function(shapesType) {
  41 +
  42 + station.stationShapesType = shapesType;
  43 + },
  44 +
  45 + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  46 + setEitdStationRadius : function(radius) {
  47 +
  48 + station.stationRadius = radius;
  49 + },
  50 +
  51 + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  52 + setEitdBPolygonGrid : function(bPolygonGrid) {
  53 +
  54 + station.stationBPolygonGrid = bPolygonGrid;
  55 + }
  56 + }
  57 +
  58 + return stationObj;
  59 +
  60 +}();
0 \ No newline at end of file 61 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/line.js 0 → 100644
  1 +/**
  2 + * 线路类
  3 + *
  4 + */
  5 +
  6 +var LineObj = function () {
  7 +
  8 + /** 定义线路对象 */
  9 +
  10 + var line={};
  11 +
  12 + var lineObj = {
  13 +
  14 + /** 初始化线路对象属性值 */
  15 + init : function(id) {
  16 +
  17 + // 线路Id
  18 + line.id = id;
  19 +
  20 + return line;
  21 + },
  22 +
  23 + /** 获取线路对象 @return:<line:线路对象> */
  24 + getLineObj : function() {
  25 +
  26 + return line;
  27 + }
  28 +
  29 + }
  30 +
  31 + return lineObj;
  32 +
  33 +}();
0 \ No newline at end of file 34 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
@@ -348,6 +348,8 @@ var GetAjaxData = function(){ @@ -348,6 +348,8 @@ var GetAjaxData = function(){
348 // 手动规划线路保存 348 // 手动规划线路保存
349 manualSave : function(params,callback) { 349 manualSave : function(params,callback) {
350 350
  351 + console.log(params);
  352 +
351 // 保存 353 // 保存
352 $post('/station/manualSave',params,function(rd) { 354 $post('/station/manualSave',params,function(rd) {
353 355
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
@@ -15,7 +15,7 @@ $(function(){ @@ -15,7 +15,7 @@ $(function(){
15 // 弹出正在加载层 15 // 弹出正在加载层
16 var i = layer.load(0,{offset:['200px', '280px']}); 16 var i = layer.load(0,{offset:['200px', '280px']});
17 17
18 - // 线路名称是否为区间 18 + /** 修正线路名称 @param:<directionUpValue:方向(上行)> */
19 PublicFunctions.lineNameIsHaveInterval(directionUpValue); 19 PublicFunctions.lineNameIsHaveInterval(directionUpValue);
20 20
21 }); 21 });
@@ -33,8 +33,8 @@ $(function(){ @@ -33,8 +33,8 @@ $(function(){
33 // 上行站点新增事件 33 // 上行站点新增事件
34 $('.module_tools #addUpStation').on('click', function() { 34 $('.module_tools #addUpStation').on('click', function() {
35 35
36 - // 设置方向  
37 - addStaitonParmas.dir = directionUpValue; 36 + /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */
  37 + AddStationObj.setAddStationDiraction(directionUpValue);
38 38
39 // 加载选择新增方式mobal 39 // 加载选择新增方式mobal
40 $.get('add_select.html', function(m){$(pjaxContainer).append(m);}); 40 $.get('add_select.html', function(m){$(pjaxContainer).append(m);});
@@ -52,7 +52,8 @@ $(function(){ @@ -52,7 +52,8 @@ $(function(){
52 52
53 return; 53 return;
54 } 54 }
55 - PublicFunctions.editSetStationParmas(sel); 55 +
  56 + EditStationObj.setEitdStation(sel[0].original);
56 57
57 $.get('edit_select.html', function(m){$(pjaxContainer).append(m);}); 58 $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
58 59
@@ -75,11 +76,11 @@ $(function(){ @@ -75,11 +76,11 @@ $(function(){
75 // 线路上行 76 // 线路上行
76 $('#leftUpOrDown #upLine').on('click', function(){ 77 $('#leftUpOrDown #upLine').on('click', function(){
77 78
78 - mapB.clearOverlays(); 79 + var lineIdEvents = LineObj.getLineObj();
79 80
80 - GetAjaxData.getSectionRouteInfo(id,directionUpValue,function(data) { 81 + GetAjaxData.getSectionRouteInfo(lineIdEvents.id,directionUpValue,function(data) {
81 82
82 - PublicFunctions.linePanlThree(data,directionUpValue); 83 + PublicFunctions.linePanlThree(lineIdEvents.id,data,directionUpValue);
83 84
84 }); 85 });
85 86
@@ -154,11 +155,11 @@ $(function(){ @@ -154,11 +155,11 @@ $(function(){
154 // 线路下行 155 // 线路下行
155 $('#leftUpOrDown #downLine').on('click', function(){ 156 $('#leftUpOrDown #downLine').on('click', function(){
156 157
157 - mapB.clearOverlays(); 158 + var lineIdEvents = LineObj.getLineObj();
158 159
159 - GetAjaxData.getSectionRouteInfo(id,directionDownValue,function(data) { 160 + GetAjaxData.getSectionRouteInfo(lineIdEvents.id,directionDownValue,function(data) {
160 161
161 - PublicFunctions.linePanlThree(data,directionDownValue); 162 + PublicFunctions.linePanlThree(lineIdEvents.id,data,directionDownValue);
162 163
163 }); 164 });
164 165
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -26,8 +26,49 @@ @@ -26,8 +26,49 @@
26 26
27 var PublicFunctions = function () { 27 var PublicFunctions = function () {
28 28
  29 + /*var lineIdInitValue = '',addStaitonParmas = '';*/
  30 +
  31 +
29 var PubFun = { 32 var PubFun = {
30 33
  34 + /** 初始化线路标题与ID */
  35 + setTiteText : function(lineId) {
  36 +
  37 + // 根据线路ID获取线路名称
  38 + GetAjaxData.getIdLineName(lineId,function(data) {
  39 +
  40 + // 定义线路名称
  41 + var lineNameV = data.name;
  42 +
  43 + $('.portlet-title .caption').text(lineNameV);
  44 +
  45 +
  46 + });
  47 +
  48 + },
  49 +
  50 + /** 获取线路ID */
  51 + getLineIdValue : function() {
  52 +
  53 + return lineIdInitValue;
  54 + },
  55 +
  56 + /** 获取新增站点参数集合 */
  57 + getAddStaitonParmasObj : function() {
  58 +
  59 + return addStaitonParmas;
  60 +
  61 + },
  62 +
  63 + /** 设置新增站点参数集合站点名称 */
  64 + setAddStationPararmsObjName : function(stationNamebootbox) {
  65 +
  66 + // 站点名称
  67 + addStaitonParmas.stationNamebootbox = stationNamebootbox;
  68 + },
  69 +
  70 +
  71 +
31 /** @param diraction 方向 @return array */ 72 /** @param diraction 方向 @return array */
32 getCurrSelNode : function(diraction){ 73 getCurrSelNode : function(diraction){
33 74
@@ -276,7 +317,7 @@ var PublicFunctions = function () { @@ -276,7 +317,7 @@ var PublicFunctions = function () {
276 editStationParmas.destroyInput = 0; 317 editStationParmas.destroyInput = 0;
277 }, 318 },
278 319
279 - /** @param directionData:方向 */ 320 + /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */
280 lineNameIsHaveInterval : function(directionData) { 321 lineNameIsHaveInterval : function(directionData) {
281 322
282 // 定义线路名称 323 // 定义线路名称
@@ -299,7 +340,48 @@ var PublicFunctions = function () { @@ -299,7 +340,48 @@ var PublicFunctions = function () {
299 // 线路名称去掉区间 340 // 线路名称去掉区间
300 lineNameV = lineNameNew; 341 lineNameV = lineNameNew;
301 342
302 - // 保存 343 + /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  344 + PublicFunctions.systemLineStation(lineNameV,directionData);
  345 +
  346 + },function(){
  347 +
  348 + // 关闭弹出层
  349 + layer.closeAll();
  350 +
  351 + // 上行
  352 + if(directionData==0){
  353 +
  354 + // 显示上行规划
  355 + $('#upToolsMobal').show();
  356 +
  357 + // 下行
  358 + }else if(directionData==1){
  359 +
  360 + // 显示下行规划
  361 + $('#downToolsMobal').show();
  362 +
  363 + }
  364 +
  365 + });
  366 +
  367 + // 线路名称是否为定班线路
  368 + }else if(lineNameV.indexOf('定班')>0){
  369 +
  370 + // 截去定班
  371 + var lineNameNew = lineNameV.replace('定班','');
  372 +
  373 + // 是否继续弹出层
  374 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  375 + btn : [ '确认提示并提交', '取消' ]
  376 + }, function(index) {
  377 +
  378 + // 关闭弹出层
  379 + layer.close(index);
  380 +
  381 + // 线路名称去掉区间
  382 + lineNameV = lineNameNew;
  383 +
  384 + /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
303 PublicFunctions.systemLineStation(lineNameV,directionData); 385 PublicFunctions.systemLineStation(lineNameV,directionData);
304 386
305 },function(){ 387 },function(){
@@ -325,7 +407,7 @@ var PublicFunctions = function () { @@ -325,7 +407,7 @@ var PublicFunctions = function () {
325 407
326 }else { 408 }else {
327 409
328 - // 直接保存 410 + /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
329 PublicFunctions.systemLineStation(lineNameV,directionData); 411 PublicFunctions.systemLineStation(lineNameV,directionData);
330 412
331 } 413 }
@@ -333,17 +415,16 @@ var PublicFunctions = function () { @@ -333,17 +415,16 @@ var PublicFunctions = function () {
333 }, 415 },
334 416
335 417
336 - /** @param lineNameV:线路名称 ; directionData:方向 */ 418 + /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
337 systemLineStation : function(lineNameV,directionData) { 419 systemLineStation : function(lineNameV,directionData) {
338 420
339 - // 从百度地图获取线路信息  
340 - WorldsBMap.lineInfoPanl(lineNameV,directionData,mapB,function(BusLine){ 421 + /** 从百度地图获取线路信息 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行);callback>*/
  422 + WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){
341 423
342 // 如果线路信息不为空 424 // 如果线路信息不为空
343 if(BusLine) { 425 if(BusLine) {
344 426
345 - console.log(BusLine.yB.length);  
346 - 427 + //
347 if(BusLine.yB.length == 0){ 428 if(BusLine.yB.length == 0){
348 429
349 layer.confirm('系统生成该线路【'+lineNameV+'】时获取站点与路段异常!请联系管理员或者检查网络连接是否异常!', { 430 layer.confirm('系统生成该线路【'+lineNameV+'】时获取站点与路段异常!请联系管理员或者检查网络连接是否异常!', {
@@ -401,7 +482,80 @@ var PublicFunctions = function () { @@ -401,7 +482,80 @@ var PublicFunctions = function () {
401 482
402 } 483 }
403 484
404 - // 百度站点坐标获取WGS坐标 485 + // 获取站点之间的距离与时间
  486 + WorldsBMap.getDistanceAndDuration(stationInfo,function(json) {
  487 +
  488 + // 设置第一个站的距离
  489 + json[0].distance = '';
  490 +
  491 + // 设置第一个站的时间
  492 + json[0].duration = '';
  493 +
  494 + // 定义站点信息JSON字符串
  495 + var stationJSON = JSON.stringify(json);
  496 +
  497 + // 定义路段信息字符串
  498 + var sectionJSON = JSON.stringify(polyGonArray);
  499 +
  500 + // 参数集合
  501 + var params = {};
  502 +
  503 + // 站点信息JSON字符串
  504 + params.stationJSON = stationJSON;
  505 +
  506 + var addLine = LineObj.getLineObj();
  507 +
  508 + // 线路ID
  509 + params.lineId = addLine.id;
  510 +
  511 + // 方向
  512 + params.directions = directionData;
  513 +
  514 + // 原始坐标类型
  515 + params.dbType = 'b';
  516 +
  517 + // 圆形半径
  518 + params.radius = '100';
  519 +
  520 + // 图形类型(r:圆形;p:多边形)
  521 + params.shapesType = 'r';
  522 +
  523 + // destroy:是否撤销
  524 + params.destroy = '0';
  525 +
  526 + // versions:版本号
  527 + params.versions = '1';
  528 +
  529 + // 路段信息JSON字符串
  530 + params.sectionJSON = sectionJSON;
  531 +
  532 + // 限速
  533 + params.speedLimit = '60';
  534 +
  535 + // 保存
  536 + GetAjaxData.collectionSave(params,function(rd) {
  537 +
  538 + if(rd.status='SUCCESS') {
  539 +
  540 + // 关闭弹出层
  541 + layer.closeAll();
  542 +
  543 + layer.msg('保存成功!');
  544 +
  545 + // 刷新树
  546 + PublicFunctions.resjtreeDate(addLine.id,directionData);
  547 +
  548 + }else {
  549 +
  550 + // 保存失败
  551 + layer.msg('保存失败!');
  552 + }
  553 +
  554 + });
  555 +
  556 + });
  557 +
  558 + /*// 百度站点坐标获取WGS坐标
405 GetAjaxData.getFormPointEToWGS(stationInfo,function(result) { 559 GetAjaxData.getFormPointEToWGS(stationInfo,function(result) {
406 560
407 // 如果不为空 561 // 如果不为空
@@ -410,82 +564,12 @@ var PublicFunctions = function () { @@ -410,82 +564,12 @@ var PublicFunctions = function () {
410 // 折线覆盖物对象坐标点集合转WGS坐标 564 // 折线覆盖物对象坐标点集合转WGS坐标
411 GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) { 565 GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) {
412 566
413 - // 获取站点之间的距离与时间  
414 - WorldsBMap.getDistanceAndDuration(result,function(json) {  
415 -  
416 - // 设置第一个站的距离  
417 - json[0].distance = '';  
418 -  
419 - // 设置第一个站的时间  
420 - json[0].duration = '';  
421 -  
422 - // 定义站点信息JSON字符串  
423 - var stationJSON = JSON.stringify(json);  
424 -  
425 - // 定义路段信息字符串  
426 - var sectionJSON = JSON.stringify(arraydata);  
427 -  
428 - // 参数集合  
429 - var params = {};  
430 -  
431 - // 站点信息JSON字符串  
432 - params.stationJSON = stationJSON;  
433 -  
434 - // 线路ID  
435 - params.lineId = id;  
436 -  
437 - // 方向  
438 - params.directions = directionData;  
439 -  
440 - // 原始坐标类型  
441 - params.dbType = 'b';  
442 -  
443 - // 圆形半径  
444 - params.radius = '300';  
445 -  
446 - // 图形类型(r:圆形;p:多边形)  
447 - params.shapesType = 'r';  
448 -  
449 - // destroy:是否撤销  
450 - params.destroy = '0';  
451 -  
452 - // versions:版本号  
453 - params.versions = '1';  
454 -  
455 - // 路段信息JSON字符串  
456 - params.sectionJSON = sectionJSON;  
457 -  
458 - // 限速  
459 - params.speedLimit = '60';  
460 -  
461 - // 保存  
462 - GetAjaxData.collectionSave(params,function(rd) {  
463 -  
464 - if(rd.status='SUCCESS') {  
465 -  
466 - // 关闭弹出层  
467 - layer.closeAll();  
468 -  
469 - layer.msg('保存成功!');  
470 -  
471 - // 刷新树  
472 - PublicFunctions.resjtreeDate(id,directionData);  
473 -  
474 - }else {  
475 -  
476 - // 保存失败  
477 - layer.msg('保存失败!');  
478 - }  
479 -  
480 - });  
481 -  
482 - });  
483 567
484 }); 568 });
485 569
486 } 570 }
487 571
488 - }); 572 + });*/
489 573
490 } 574 }
491 575
@@ -530,7 +614,7 @@ var PublicFunctions = function () { @@ -530,7 +614,7 @@ var PublicFunctions = function () {
530 614
531 layer.msg('撤销上行站点【'+obj[0].text+'】成功!'); 615 layer.msg('撤销上行站点【'+obj[0].text+'】成功!');
532 616
533 - mapB.clearOverlays(); 617 + functionMapB.clearOverlays();
534 GetAjaxData.getSectionRouteInfo(id,stationRouteDirections,function(data) { 618 GetAjaxData.getSectionRouteInfo(id,stationRouteDirections,function(data) {
535 619
536 // 刷新树 620 // 刷新树
@@ -610,7 +694,7 @@ var PublicFunctions = function () { @@ -610,7 +694,7 @@ var PublicFunctions = function () {
610 layer.msg('修改上行路段失败!'); 694 layer.msg('修改上行路段失败!');
611 695
612 } 696 }
613 - mapB.clearOverlays(); 697 + functionMapB.clearOverlays();
614 GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) { 698 GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) {
615 699
616 // 刷新树 700 // 刷新树
@@ -626,10 +710,10 @@ var PublicFunctions = function () { @@ -626,10 +710,10 @@ var PublicFunctions = function () {
626 }); 710 });
627 }, 711 },
628 712
629 - setFormValue : function() {  
630 - 713 + setFormValue : function(editStationParmas) {
  714 +
631 // 站点ID 715 // 站点ID
632 - $('#stationIdInput').val(editStationParmas.editUp_stationId); 716 + $('#stationIdInput').val(editStationParmas.stationId);
633 717
634 // 站点路由ID 718 // 站点路由ID
635 $('#stationRouteIdInput').val(editStationParmas.stationRouteId); 719 $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
@@ -640,17 +724,17 @@ var PublicFunctions = function () { @@ -640,17 +724,17 @@ var PublicFunctions = function () {
640 // 线路编码 724 // 线路编码
641 $('#lineCodeInput').val(editStationParmas.stationRouteLineCode); 725 $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
642 726
643 - // WGS坐标点图形集合  
644 - $('#bPolygonGridInput').val(editStationParmas.bPolygonGridInput);  
645 -  
646 // 百度坐标点图形集合 727 // 百度坐标点图形集合
647 - $('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput); 728 + $('#bPolygonGridInput').val(editStationParmas.stationBPolygonGrid);
  729 +
  730 + // WGS坐标点图形集合
  731 + /*$('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput);*/
648 732
649 // 获取站点名称元素设值 733 // 获取站点名称元素设值
650 - $('#stationNameInput').val(editStationParmas.stationNamebootbox); 734 + $('#stationNameInput').val(editStationParmas.stationStationName);
651 735
652 // 获取站点编码元素设值 736 // 获取站点编码元素设值
653 - $('#stationCodInput').val(editStationParmas.editUp_stationStationCod); 737 + $('#stationCodInput').val(editStationParmas.stationStationCod);
654 738
655 // 获取站点类型元素设值 739 // 获取站点类型元素设值
656 $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark); 740 $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
@@ -662,262 +746,51 @@ var PublicFunctions = function () { @@ -662,262 +746,51 @@ var PublicFunctions = function () {
662 $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding); 746 $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
663 747
664 // 百度地图经纬度坐标中心点 748 // 百度地图经纬度坐标中心点
665 - $('#bJwpointsInput').val(editStationParmas.stationPointInput); 749 + $('#bJwpointsInput').val(editStationParmas.stationBJwpoints);
666 750
667 // WGS经纬度 751 // WGS经纬度
668 - $('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty); 752 + /*$('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty);*/
669 753
670 // 获取图形类型元素,并添加值 754 // 获取图形类型元素,并添加值
671 - $('#shapesTypeSelect').val(editStationParmas.shapesTypeInput); 755 + $('#shapesTypeSelect').val(editStationParmas.stationShapesType);
672 756
673 // 获取方向元素,并添加值 757 // 获取方向元素,并添加值
674 - $('#stationdirSelect').val(editStationParmas.stationRouteDirections); 758 + /*$('#stationdirSelect').val(editStationParmas.stationRouteDirections);*/
675 759
676 // 获取半径元素,并添加值 760 // 获取半径元素,并添加值
677 - $('#radiusInput').val(editStationParmas.radiusInput); 761 + $('#radiusInput').val(editStationParmas.stationRadius);
678 762
679 // 是否撤销 763 // 是否撤销
680 - $('#destroySelect').val(editStationParmas.destroyInput); 764 + $('#destroySelect').val(editStationParmas.stationDestroy);
681 765
682 // 到站时间 766 // 到站时间
683 $('#toTimeInput').val(editStationParmas.stationRouteToTime); 767 $('#toTimeInput').val(editStationParmas.stationRouteToTime);
684 768
685 // 到站距离 769 // 到站距离
686 - $('#distancesInput').val(editStationParmas.stationRouteToTime); 770 + $('#distancesInput').val(editStationParmas.stationRouteDistances);
687 771
688 // 描述/说明 772 // 描述/说明
689 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions); 773 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
690 774
691 }, 775 },
692 776
693 - /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/  
694 - getBmapStationNames : function(lineNameValue,i,map,callback) {  
695 -  
696 - var busline = new BMap.BusLineSearch(map,{  
697 -  
698 - // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型  
699 - onGetBusListComplete:function(BusListResult) {  
700 -  
701 - // 如果不为空  
702 - if(BusListResult){  
703 -  
704 - //获取第一个公交列表显示到map上  
705 - var fstLine = BusListResult.getBusListItem(i);  
706 -  
707 - if(fstLine==undefined){  
708 -  
709 - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){  
710 -  
711 - layer.closeAll();  
712 -  
713 - if(i==0){  
714 -  
715 - $('#upToolsMobal').show();  
716 -  
717 - }else if(i==1){  
718 -  
719 - $('#downToolsMobal').show();  
720 -  
721 - }  
722 -  
723 - return;  
724 - });  
725 -  
726 - }  
727 -  
728 - busline.getBusLine(fstLine);  
729 -  
730 - }  
731 -  
732 - },  
733 -  
734 - //设置公交线路查询后的回调函数.参数:rs: BusLine类型  
735 - onGetBusLineComplete: function(BusLine){  
736 -  
737 - // 如果不为空  
738 - if(BusLine){  
739 -  
740 - callback && callback(BusLine);  
741 -  
742 - }  
743 -  
744 - }  
745 -  
746 - });  
747 -  
748 - busline.getBusList(lineNameValue);  
749 -  
750 - },  
751 -  
752 - /** 设置地图属性 与监听绘画事件 */  
753 - setMapEvent : function(map) {  
754 -  
755 - //启用地图拖拽事件,默认启用(可不写)  
756 - map.enableDragging();  
757 -  
758 - //启用地图滚轮放大缩小  
759 - map.enableScrollWheelZoom();  
760 -  
761 - //禁用鼠标双击放大  
762 - map.disableDoubleClickZoom();  
763 -  
764 - //启用键盘上下左右键移动地图  
765 - map.enableKeyboard();  
766 -  
767 - var styleOptions = {  
768 -  
769 - //边线颜色。  
770 - strokeColor : "blue",  
771 -  
772 - //填充颜色。当参数为空时,圆形将没有填充效果。  
773 - fillColor : "blue",  
774 -  
775 - //边线的宽度,以像素为单位。  
776 - strokeWeight : 3,  
777 -  
778 - //边线透明度,取值范围0 - 1。  
779 - strokeOpacity : 0.8,  
780 -  
781 - //填充的透明度,取值范围0 - 1。  
782 - fillOpacity : 0.6,  
783 -  
784 - //边线的样式,solid或dashed。  
785 - strokeStyle : 'solid'  
786 -  
787 - };  
788 -  
789 - // 创建鼠标绘制管理类  
790 - drawingManager = new BMapLib.DrawingManager(map, {  
791 -  
792 - //是否开启绘制模式  
793 - isOpen : false,  
794 -  
795 - //是否显示工具栏  
796 - enableDrawingTool : false,  
797 -  
798 - drawingToolOptions : {  
799 -  
800 - //位置  
801 - anchor : BMAP_ANCHOR_TOP_RIGHT,  
802 -  
803 - //偏离值  
804 - offset : new BMap.Size(5, 5),  
805 -  
806 - //工具栏缩放比例  
807 - scale : 0.8  
808 -  
809 - },  
810 -  
811 - //线的样式  
812 - polygonOptions : styleOptions  
813 -  
814 - });  
815 -  
816 - // 添加绘画完成事件  
817 - drawingManager.addEventListener('polygoncomplete', function(e) {  
818 -  
819 - if (e.getPath().length <= 2) {  
820 -  
821 - // 弹出提示消息  
822 - layer.msg('坐标点不能小于等于两个...');  
823 -  
824 - // 清除地图覆盖物  
825 - map.clearOverlays();  
826 -  
827 - // 加载该线路下所有站点位置添加到地图上  
828 - return false;  
829 -  
830 - }else {  
831 -  
832 - var pointE = e;  
833 -  
834 - // 多变行质心点  
835 - var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;  
836 -  
837 - var PointsList = [];  
838 -  
839 - for ( var i = 0; i < pointE.getPath().length; i++) {  
840 -  
841 - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}});  
842 -  
843 - }  
844 -  
845 - PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}});  
846 -  
847 - var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}];  
848 -  
849 - GetAjaxData.getFormPointEToWGS(PointsList,function(resultdata) {  
850 -  
851 - var gPloygonGrid = '';  
852 -  
853 - var bPloygonGrid = '';  
854 -  
855 - for(var k =0;k<resultdata.length;k++) {  
856 -  
857 - if(k==0) {  
858 -  
859 - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;  
860 -  
861 - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;  
862 -  
863 - }else {  
864 -  
865 - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;  
866 -  
867 - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;  
868 -  
869 - }  
870 -  
871 - }  
872 -  
873 - gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))';  
874 -  
875 - bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))';  
876 -  
877 - GetAjaxData.getFormPointEToWGS(centre,function(p) {  
878 -  
879 - var gLonx = p[0].WGSpotion.Lng;  
880 -  
881 - var gLaty = p[0].WGSpotion.Lat;  
882 -  
883 - if(status=='add'){  
884 -  
885 - PublicFunctions.setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');  
886 -  
887 - status = '';  
888 -  
889 - $.get('add.html', function(m){$(pjaxContainer).append(m);});  
890 -  
891 - }else if(status=='edit'){  
892 -  
893 - PublicFunctions.editSeteditStationParmasValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');  
894 -  
895 - status = '';  
896 -  
897 - $.get('edit.html', function(m){$(pjaxContainer).append(m);});  
898 -  
899 - }  
900 -  
901 - });  
902 -  
903 - });  
904 -  
905 - }  
906 -  
907 - });  
908 - },  
909 777
910 - /** @param data,direction */  
911 - linePanlThree : function(data,direction) { 778 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:上行路段数据> */
  779 + linePanlThree : function(lineId,data,direction) {
912 780
913 - GetAjaxData.getStationRoutePoint(id,direction,function(resultdata) { 781 + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  782 + GetAjaxData.getStationRoutePoint(lineId,direction,function(resultdata) {
914 783
  784 + // 路段数据长度
915 var dataLen = data.length; 785 var dataLen = data.length;
916 786
  787 + // 如果大于零
917 if(dataLen>0) { 788 if(dataLen>0) {
918 789
  790 + // 编辑路段数据
919 for(var d= 0; d<dataLen;d++){ 791 for(var d= 0; d<dataLen;d++){
920 792
  793 + // 获取路段折线坐标字符串
921 var sectionBsectionVectorStr = data[d].sectionBsectionVector; 794 var sectionBsectionVectorStr = data[d].sectionBsectionVector;
922 795
923 if(sectionBsectionVectorStr==null) { 796 if(sectionBsectionVectorStr==null) {
@@ -926,10 +799,13 @@ var PublicFunctions = function () { @@ -926,10 +799,13 @@ var PublicFunctions = function () {
926 799
927 } 800 }
928 801
  802 + // 切割段折线坐标字符串
929 var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); 803 var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
930 804
  805 + // 分割折线坐标字符串
931 var lineArray = tempStr.split(','); 806 var lineArray = tempStr.split(',');
932 807
  808 + // 地图折线坐标点集合
933 var polylineArray = []; 809 var polylineArray = [];
934 810
935 for(var i = 0;i<lineArray.length;i++) { 811 for(var i = 0;i<lineArray.length;i++) {
@@ -937,41 +813,29 @@ var PublicFunctions = function () { @@ -937,41 +813,29 @@ var PublicFunctions = function () {
937 polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); 813 polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
938 814
939 } 815 }
  816 +
  817 + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
940 WorldsBMap.drawingUpline(polylineArray,resultdata); 818 WorldsBMap.drawingUpline(polylineArray,resultdata);
941 819
942 } 820 }
943 821
  822 + // 如果站点路由数据不为空
944 if(resultdata.length>0) { 823 if(resultdata.length>0) {
945 824
  825 + // 遍历站点路由数据
946 for(var s = 0 ; s<resultdata.length;s++) { 826 for(var s = 0 ; s<resultdata.length;s++) {
947 827
  828 + // 中心点坐标字符串
948 var bJwpointsStr = resultdata[s].bJwpoints; 829 var bJwpointsStr = resultdata[s].bJwpoints;
949 830
  831 + // 起个中心点坐标字符串
950 var bJwpointsArray = bJwpointsStr.split(' '); 832 var bJwpointsArray = bJwpointsStr.split(' ');
951 833
  834 + // 设置中心点
952 var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]); 835 var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
953 - // var htm = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 80px; height: 26px; left: -10px; top: -35px; overflow: hidden;"><img id="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back1.png"></div>';  
954 - var htm = "<div style='background:#E7F0F5;color:#0082CB;border:1px solid #333'>"  
955 - + "欢迎使用百度地图"  
956 - + "</div>";  
957 - var myRichMarkerObject = new BMapLib.RichMarker(htm, point_center, { "enableDragging": false});  
958 - myRichMarkerObject.setWidth('50px');  
959 - myRichMarkerObject.setWidth('30px')  
960 - // 自定义标注物图片  
961 - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));  
962 -  
963 - // 创建标注物  
964 - var markers_thread = new BMap.Marker(point_center,{icon : icon_target});  
965 -  
966 - // 允许覆盖物在map.clearOverlays方法中被清除。  
967 - markers_thread.enableMassClear();  
968 -  
969 - // 清除marker  
970 - mapB.removeOverlay(markers_thread);  
971 -  
972 - mapB.addOverlay(markers_thread);  
973 836
974 - //mapB.addOverlay(myRichMarkerObject); 837 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  838 + WorldsBMap.drawingUpStationPoint(point_center);
975 839
976 } 840 }
977 841
@@ -983,16 +847,19 @@ var PublicFunctions = function () { @@ -983,16 +847,19 @@ var PublicFunctions = function () {
983 847
984 }, 848 },
985 849
986 - /** 加载树 */ 850 + /** 加载树 @param:<lineId:线路ID;diraction:方向(0:上行;1:下行)> */
987 TreeUpOrDown : function(lineId,diraction) { 851 TreeUpOrDown : function(lineId,diraction) {
988 852
  853 + /** 获取树结果数据 @param:<lineId:线路ID;diraction:方向;callback:回调函数> */
989 GetAjaxData.getStation(lineId,diraction,function(treeDateJson) { 854 GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
990 - 855 +
  856 + // 获取返回数据长度
991 var len = treeDateJson[0].children[0].children.length; 857 var len = treeDateJson[0].children[0].children.length;
992 858
993 // 上行 859 // 上行
994 if(diraction == 0) { 860 if(diraction == 0) {
995 861
  862 + /** 初始化上行树 @param:<treeDateJson:树数据结构> */
996 StationTreeData.upInit(treeDateJson); 863 StationTreeData.upInit(treeDateJson);
997 864
998 if(len>0) { 865 if(len>0) {
@@ -1013,8 +880,7 @@ var PublicFunctions = function () { @@ -1013,8 +880,7 @@ var PublicFunctions = function () {
1013 // 下行 880 // 下行
1014 }else if(diraction ==1) { 881 }else if(diraction ==1) {
1015 882
1016 - var stationDownTree = $('#station_Down_tree');  
1017 - 883 + /** 出事画下行树 @param:<treeDateJson:树数据结构> */
1018 StationTreeData.downInit(treeDateJson); 884 StationTreeData.downInit(treeDateJson);
1019 885
1020 if(len>0) { 886 if(len>0) {
@@ -1037,21 +903,6 @@ var PublicFunctions = function () { @@ -1037,21 +903,6 @@ var PublicFunctions = function () {
1037 903
1038 }, 904 },
1039 905
1040 - setTiteText : function(lineId) {  
1041 -  
1042 - // 根据线路ID获取线路名称  
1043 - GetAjaxData.getIdLineName(lineId,function(data) {  
1044 -  
1045 - // 定义线路名称  
1046 - var lineNameV = data.name;  
1047 -  
1048 - $('.portlet-title .caption').text(lineNameV);  
1049 -  
1050 -  
1051 - });  
1052 -  
1053 - },  
1054 -  
1055 isHaveStationName : function(data) { 906 isHaveStationName : function(data) {
1056 907
1057 if(data.length>0) { 908 if(data.length>0) {
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
@@ -24,16 +24,12 @@ @@ -24,16 +24,12 @@
24 24
25 var WorldsBMap = function () { 25 var WorldsBMap = function () {
26 26
  27 + /** WorldsBMap 全局变量定义 mapBVvalue:地图对象 */
  28 + var mapBVvalue = '';
  29 +
27 var Bmap = { 30 var Bmap = {
28 31
29 - init : function(map) {  
30 -  
31 - // 关闭左侧栏  
32 - if (!$('body').hasClass('page-sidebar-closed')) {  
33 -  
34 - $('.menu-toggler.sidebar-toggler').click();  
35 -  
36 - } 32 + init : function() {
37 33
38 // 设置中心点, 34 // 设置中心点,
39 var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; 35 var CENTER_POINT = {lng : 121.528733,lat : 31.237425};
@@ -42,22 +38,48 @@ var WorldsBMap = function () { @@ -42,22 +38,48 @@ var WorldsBMap = function () {
42 var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; 38 var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';
43 39
44 // 初始化百度地图 40 // 初始化百度地图
45 - map = new BMap.Map("bmap_basic"); 41 + mapBVvalue = new BMap.Map("bmap_basic");
46 42
47 //中心点和缩放级别 43 //中心点和缩放级别
48 - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); 44 + mapBVvalue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
  45 +
  46 + //启用地图拖拽事件,默认启用(可不写)
  47 + mapBVvalue.enableDragging();
  48 +
  49 + //启用地图滚轮放大缩小
  50 + mapBVvalue.enableScrollWheelZoom();
  51 +
  52 + //禁用鼠标双击放大
  53 + mapBVvalue.disableDoubleClickZoom();
  54 +
  55 + //启用键盘上下左右键移动地图
  56 + mapBVvalue.enableKeyboard();
  57 + /*PublicFunctions.setMapEvent(map);*/
  58 +
  59 + return mapBVvalue;
  60 + },
  61 +
  62 + /** 获取地图对象 @return 地图对象map */
  63 + getmapBValue : function() {
  64 +
  65 + return mapBVvalue;
  66 +
  67 + },
  68 +
  69 + initDrawingManager: function(map,styleOptions) {
49 70
50 - // 设置百度地图属性  
51 - PublicFunctions.setMapEvent(map); 71 + },
  72 +
  73 + getDrawingManagerObj : function() {
52 74
53 - return map; 75 + return drawingManagerInitV;
54 }, 76 },
55 77
56 // 从百度地图抓去站点与路段数据 78 // 从百度地图抓去站点与路段数据
57 - lineInfoPanl : function(lineNameValue,i,map,cb) { 79 + lineInfoPanl : function(lineNameValue,i,cb) {
58 80
59 /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */ 81 /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */
60 - PublicFunctions.getBmapStationNames(lineNameValue,i,map,function(BusLine){ 82 + WorldsBMap.getBmapStationNames(lineNameValue,i,function(BusLine){
61 83
62 return cb && cb(BusLine); 84 return cb && cb(BusLine);
63 85
@@ -139,11 +161,11 @@ var WorldsBMap = function () { @@ -139,11 +161,11 @@ var WorldsBMap = function () {
139 161
140 if(r.message=='ok') { 162 if(r.message=='ok') {
141 163
142 - // 获取距离  
143 - points[index+1].distance = r.result.taxi.distance+500; 164 + // 获取距离(单位:米)
  165 + points[index+1].distance = r.result.taxi.distance;
144 166
145 - // 获取时间  
146 - points[index+1].duration = r.result.taxi.duration+240; 167 + // 获取时间(单位:秒)
  168 + points[index+1].duration = r.result.taxi.duration;
147 169
148 } 170 }
149 171
@@ -158,13 +180,16 @@ var WorldsBMap = function () { @@ -158,13 +180,16 @@ var WorldsBMap = function () {
158 }, 180 },
159 181
160 // 地图画多边形 182 // 地图画多边形
161 - pointsPolygon : function(objStation,map) { 183 + pointsPolygon : function(objStation) {
  184 +
  185 + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
  186 + mapBVvalue.setZoom(16);
162 187
163 // 如果不为空 188 // 如果不为空
164 if(objStation) { 189 if(objStation) {
165 190
166 // 清除地图覆盖物 191 // 清除地图覆盖物
167 - map.clearOverlays(); 192 + mapBVvalue.clearOverlays();
168 193
169 // 获取中心点坐标字符串 194 // 获取中心点坐标字符串
170 var testpointStr = objStation.stationBJwpoints; 195 var testpointStr = objStation.stationBJwpoints;
@@ -207,7 +232,7 @@ var WorldsBMap = function () { @@ -207,7 +232,7 @@ var WorldsBMap = function () {
207 }); 232 });
208 233
209 // 增加地图覆盖物多边形 234 // 增加地图覆盖物多边形
210 - map.addOverlay(polygon); 235 + mapBVvalue.addOverlay(polygon);
211 236
212 // 信息窗口属性 237 // 信息窗口属性
213 var opts_polygon = { 238 var opts_polygon = {
@@ -244,27 +269,27 @@ var WorldsBMap = function () { @@ -244,27 +269,27 @@ var WorldsBMap = function () {
244 marker = new BMap.Marker(pointPolygon,{icon : icon_target}); 269 marker = new BMap.Marker(pointPolygon,{icon : icon_target});
245 270
246 // 把标注添物加到地图上 271 // 把标注添物加到地图上
247 - map.addOverlay(marker); 272 + mapBVvalue.addOverlay(marker);
248 273
249 // 是否在平移过程中禁止动画。(自1.2新增) 274 // 是否在平移过程中禁止动画。(自1.2新增)
250 var PanOptions_ ={noAnimation :true}; 275 var PanOptions_ ={noAnimation :true};
251 276
252 // 将地图的中心点更改为给定的点。 277 // 将地图的中心点更改为给定的点。
253 - map.panTo(pointPolygon,PanOptions_); 278 + mapBVvalue.panTo(pointPolygon,PanOptions_);
254 279
255 // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 280 // 将地图在水平位置上移动x像素,垂直位置上移动y像素。
256 - map.panBy(10,110,PanOptions_); 281 + mapBVvalue.panBy(10,110,PanOptions_);
257 282
258 //开启信息窗口 283 //开启信息窗口
259 - marker.openInfoWindow(infoWindow_target,pointPolygon); 284 + mapBVvalue.openInfoWindow(infoWindow_target,pointPolygon);
260 285
261 } 286 }
262 287
263 }, 288 },
264 289
265 - pointsThread : function(obj,map) { 290 + pointsThread : function(obj) {
266 291
267 - mapB.clearOverlays(); 292 + mapBVvalue.clearOverlays();
268 293
269 if(obj) { 294 if(obj) {
270 295
@@ -284,7 +309,7 @@ var WorldsBMap = function () { @@ -284,7 +309,7 @@ var WorldsBMap = function () {
284 polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 4,strokeOpacity : 0.5}); 309 polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 4,strokeOpacity : 0.5});
285 310
286 // 把折线添加到地图上 311 // 把折线添加到地图上
287 - mapB.addOverlay(polyUpline); 312 + mapBVvalue.addOverlay(polyUpline);
288 313
289 // 自定义标注物图片 314 // 自定义标注物图片
290 var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); 315 var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
@@ -293,22 +318,25 @@ var WorldsBMap = function () { @@ -293,22 +318,25 @@ var WorldsBMap = function () {
293 var markers_target = new BMap.Marker(polylineArray[0],{icon : icon_target}); 318 var markers_target = new BMap.Marker(polylineArray[0],{icon : icon_target});
294 319
295 // 把标注添物加到地图上 320 // 把标注添物加到地图上
296 - mapB.addOverlay(markers_target); 321 + mapBVvalue.addOverlay(markers_target);
297 322
298 //设置中心点 323 //设置中心点
299 - mapB.centerAndZoom(polylineArray[0],16); 324 + mapBVvalue.centerAndZoom(polylineArray[0],16);
300 325
301 } 326 }
302 327
303 }, 328 },
304 329
305 // 画圆 330 // 画圆
306 - pointsCircle : function(objStation,map) { 331 + pointsCircle : function(objStation) {
  332 +
  333 + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
  334 + mapBVvalue.setZoom(16);
307 335
308 if(objStation) { 336 if(objStation) {
309 337
310 // 清除地图覆盖物 338 // 清除地图覆盖物
311 - map.clearOverlays(); 339 + mapBVvalue.clearOverlays();
312 340
313 // 获取中心坐标点字符串分割 341 // 获取中心坐标点字符串分割
314 var BJwpoints = objStation.stationBJwpoints.split(' '); 342 var BJwpoints = objStation.stationBJwpoints.split(' ');
@@ -323,7 +351,7 @@ var WorldsBMap = function () { @@ -323,7 +351,7 @@ var WorldsBMap = function () {
323 circle.enableMassClear(); 351 circle.enableMassClear();
324 352
325 // 百度地图添加覆盖物圆 353 // 百度地图添加覆盖物圆
326 - map.addOverlay(circle); 354 + mapBVvalue.addOverlay(circle);
327 355
328 // 信息窗口参数属性 356 // 信息窗口参数属性
329 var opts = { 357 var opts = {
@@ -366,7 +394,7 @@ var WorldsBMap = function () { @@ -366,7 +394,7 @@ var WorldsBMap = function () {
366 marker = new BMap.Marker(point,{icon : icon_target}); 394 marker = new BMap.Marker(point,{icon : icon_target});
367 395
368 // 把标注添物加到地图上 396 // 把标注添物加到地图上
369 - map.addOverlay(marker); 397 + mapBVvalue.addOverlay(marker);
370 398
371 setTimeout(function(){ 399 setTimeout(function(){
372 //开启信息窗口 400 //开启信息窗口
@@ -378,7 +406,7 @@ var WorldsBMap = function () { @@ -378,7 +406,7 @@ var WorldsBMap = function () {
378 var PanOptions_ ={noAnimation :true}; 406 var PanOptions_ ={noAnimation :true};
379 407
380 // 将地图的中心点更改为给定的点。 408 // 将地图的中心点更改为给定的点。
381 - map.panTo(point,PanOptions_); 409 + mapBVvalue.panTo(point,PanOptions_);
382 410
383 //map.panBy(10,-50,PanOptions_); 411 //map.panBy(10,-50,PanOptions_);
384 412
@@ -395,10 +423,10 @@ var WorldsBMap = function () { @@ -395,10 +423,10 @@ var WorldsBMap = function () {
395 }, 423 },
396 424
397 // 根据地理名称获取百度经纬度坐标 425 // 根据地理名称获取百度经纬度坐标
398 - localSearchFromAdreesToPoint: function(Address,map,callback) { 426 + localSearchFromAdreesToPoint: function(Address,callback) {
399 427
400 // 创建一个搜索类实例 428 // 创建一个搜索类实例
401 - var localSearch = new BMap.LocalSearch(map); 429 + var localSearch = new BMap.LocalSearch(mapBVvalue);
402 430
403 // 检索完成后的回调函数。 431 // 检索完成后的回调函数。
404 localSearch.setSearchCompleteCallback(function (searchResult) { 432 localSearch.setSearchCompleteCallback(function (searchResult) {
@@ -442,7 +470,7 @@ var WorldsBMap = function () { @@ -442,7 +470,7 @@ var WorldsBMap = function () {
442 marker.closeInfoWindow(); 470 marker.closeInfoWindow();
443 471
444 // 清除marker 472 // 清除marker
445 - mapB.removeOverlay(marker); 473 + mapBVvalue.removeOverlay(marker);
446 474
447 // 编辑圆 475 // 编辑圆
448 if(stationShapesTypeV =='r') { 476 if(stationShapesTypeV =='r') {
@@ -563,15 +591,18 @@ var WorldsBMap = function () { @@ -563,15 +591,18 @@ var WorldsBMap = function () {
563 // 在地图上画出上行线路走向 591 // 在地图上画出上行线路走向
564 drawingUpline : function (polylineArray,resultdata) { 592 drawingUpline : function (polylineArray,resultdata) {
565 593
  594 + // 清除地图覆盖物
  595 + mapBVvalue.clearOverlays();
  596 +
566 // 创建线路走向 597 // 创建线路走向
567 polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); 598 polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
568 599
569 // 把折线添加到地图上 600 // 把折线添加到地图上
570 - mapB.addOverlay(polyUpline); 601 + mapBVvalue.addOverlay(polyUpline);
571 602
572 var ceter_index = Math.round(resultdata.length / 2); 603 var ceter_index = Math.round(resultdata.length / 2);
573 604
574 - var ceterPointsStr = resultdata[ceter_index].bJwpoints; 605 + var ceterPointsStr = resultdata[ceter_index].bJwpoints;
575 606
576 var ceterPointsArray = ceterPointsStr.split(' '); 607 var ceterPointsArray = ceterPointsStr.split(' ');
577 608
@@ -579,27 +610,40 @@ var WorldsBMap = function () { @@ -579,27 +610,40 @@ var WorldsBMap = function () {
579 610
580 var PanOptions_ ={noAnimation :true}; 611 var PanOptions_ ={noAnimation :true};
581 612
582 - mapB.reset(); 613 + mapBVvalue.reset();
583 614
584 - mapB.panTo(polyline_center,PanOptions_); 615 + mapBVvalue.panTo(polyline_center,PanOptions_);
585 616
586 - mapB.panBy(500,-510,PanOptions_); 617 + mapBVvalue.panBy(500,-510,PanOptions_);
587 618
588 - mapB.setZoom(14); 619 + mapBVvalue.setZoom(14);
589 620
590 }, 621 },
591 622
  623 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  624 + drawingUpStationPoint : function(point_center) {
  625 +
  626 + // 自定义标注物图片
  627 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
  628 +
  629 + // 创建标注物
  630 + var markers_thread = new BMap.Marker(point_center,{icon : icon_target});
  631 +
  632 + // 允许覆盖物在map.clearOverlays方法中被清除。
  633 + markers_thread.enableMassClear();
  634 +
  635 + // 清除marker
  636 + mapBVvalue.removeOverlay(markers_thread);
  637 +
  638 + mapBVvalue.addOverlay(markers_thread);
  639 + },
  640 +
592 // 打开绘画工具 641 // 打开绘画工具
593 drawingManagerOpen : function() { 642 drawingManagerOpen : function() {
594 643
595 // 清楚地图覆盖物 644 // 清楚地图覆盖物
596 - mapB.clearOverlays(); 645 + mapBVvalue.clearOverlays();
597 646
598 - // 打开鼠标绘画工具  
599 - drawingManager.open();  
600 -  
601 - // 设置属性  
602 - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);  
603 647
604 }, 648 },
605 649
@@ -634,7 +678,7 @@ var WorldsBMap = function () { @@ -634,7 +678,7 @@ var WorldsBMap = function () {
634 678
635 if(arra[index]!=''){ 679 if(arra[index]!=''){
636 680
637 - var localSearch = new BMap.LocalSearch(mapB); 681 + var localSearch = new BMap.LocalSearch(mapBVvalue);
638 682
639 localSearch.search(arra[index]); 683 localSearch.search(arra[index]);
640 684
@@ -698,7 +742,7 @@ var WorldsBMap = function () { @@ -698,7 +742,7 @@ var WorldsBMap = function () {
698 742
699 var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat); 743 var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat);
700 744
701 - var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onSearchComplete: searchComplete}); 745 + var transit = new BMap.TransitRoute(mapBVvalue, {renderOptions: {map: mapBVvalue},onSearchComplete: searchComplete});
702 746
703 transit.search(poiOne,poiTwo); 747 transit.search(poiOne,poiTwo);
704 748
@@ -766,7 +810,7 @@ var WorldsBMap = function () { @@ -766,7 +810,7 @@ var WorldsBMap = function () {
766 810
767 /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/ 811 /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/
768 812
769 - var transit = new BMap.DrivingRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet}); 813 + var transit = new BMap.DrivingRoute(mapBVvalue, {renderOptions: {map: mapBVvalue},onPolylinesSet: searchPolylinesSet});
770 814
771 function searchPolylinesSet(results){ 815 function searchPolylinesSet(results){
772 816
@@ -796,7 +840,104 @@ var WorldsBMap = function () { @@ -796,7 +840,104 @@ var WorldsBMap = function () {
796 840
797 })(); 841 })();
798 842
  843 + },
  844 +
  845 + localtionPoint : function(stationNameV) {
  846 +
  847 + WorldsBMap.localSearchFromAdreesToPoint(stationNameV,function(Points) {
  848 +
  849 + if(Points) {
  850 +
  851 + var BJwpointsArray = Points.split(' ');
  852 +
  853 + var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]);
  854 +
  855 + var marker_stargt2 = new BMap.Marker(stationNameChangePoint);
  856 +
  857 + var PanOptions ={noAnimation :true};
  858 +
  859 + mapBVvalue.panTo(stationNameChangePoint,PanOptions);
  860 +
  861 + mapBVvalue.panBy(0,-100);
  862 +
  863 + // 将标注添加到地图中
  864 + mapBVvalue.addOverlay(marker_stargt2);
  865 +
  866 + //跳动的动画
  867 + marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE);
  868 +
  869 + }
  870 +
  871 + });
  872 +
  873 + },
  874 +
  875 + /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/
  876 + getBmapStationNames : function(lineNameValue,i,callback) {
  877 +
  878 + var busline = new BMap.BusLineSearch(mapBVvalue,{
  879 +
  880 + // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
  881 + onGetBusListComplete:function(BusListResult) {
  882 +
  883 + // 如果不为空
  884 + if(BusListResult){
  885 +
  886 + //获取第一个公交列表显示到map上
  887 + var fstLine = BusListResult.getBusListItem(i);
  888 +
  889 + if(fstLine==undefined){
  890 +
  891 + layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  892 +
  893 + layer.closeAll();
  894 +
  895 + if(i==0){
  896 +
  897 + $('#upToolsMobal').show();
  898 +
  899 + }else if(i==1){
  900 +
  901 + $('#downToolsMobal').show();
  902 +
  903 + }
  904 +
  905 + return;
  906 + });
  907 +
  908 + }
  909 +
  910 + busline.getBusLine(fstLine);
  911 +
  912 + }
  913 +
  914 + },
  915 +
  916 + //设置公交线路查询后的回调函数.参数:rs: BusLine类型
  917 + onGetBusLineComplete: function(BusLine){
  918 +
  919 + // 如果不为空
  920 + if(BusLine){
  921 +
  922 + callback && callback(BusLine);
  923 +
  924 + }
  925 +
  926 + }
  927 +
  928 + });
  929 +
  930 + busline.getBusList(lineNameValue);
  931 +
  932 + },
  933 +
  934 + clearMarkAndOverlays : function() {
  935 +
  936 + // 清楚地图覆盖物
  937 + mapBVvalue.clearOverlays();
  938 +
799 } 939 }
  940 +
800 } 941 }
801 942
802 return Bmap; 943 return Bmap;
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
1 /** 1 /**
2 * reload事件 2 * reload事件
3 * 3 *
4 - * - - - - - -》初始化地图、上下行树、上行线路走向  
5 * 4 *
6 */ 5 */
7 6
8 $(function(){ 7 $(function(){
9 8
  9 + // 关闭左侧栏
  10 + if (!$('body').hasClass('page-sidebar-closed')) {
  11 +
  12 + $('.menu-toggler.sidebar-toggler').click();
  13 +
  14 + }
  15 +
10 // 获取参数线路ID 16 // 获取参数线路ID
11 - id = $.url().param('no'); 17 + var id = $.url().param('no');
12 18
13 // 如果线路ID不为空 19 // 如果线路ID不为空
14 if(id) { 20 if(id) {
15 21
  22 + var styleOptions = {
  23 +
  24 + //边线颜色。
  25 + strokeColor : "blue",
  26 +
  27 + //填充颜色。当参数为空时,圆形将没有填充效果。
  28 + fillColor : "blue",
  29 +
  30 + //边线的宽度,以像素为单位。
  31 + strokeWeight : 3,
  32 +
  33 + //边线透明度,取值范围0 - 1。
  34 + strokeOpacity : 0.8,
  35 +
  36 + //填充的透明度,取值范围0 - 1。
  37 + fillOpacity : 0.6,
  38 +
  39 + //边线的样式,solid或dashed。
  40 + strokeStyle : 'solid'
  41 +
  42 + };
  43 +
16 // 等候500毫秒执行 44 // 等候500毫秒执行
17 setTimeout(function(){ 45 setTimeout(function(){
18 46
19 - // 获取线路名称,并设置标题为线路名称  
20 - PublicFunctions.setTiteText(id); 47 + /** 初始化线路对象,这里只初始化线路Id属性 @param:<id:线路ID> @return:Line */
  48 + var Line = LineObj.init(id);
  49 +
  50 + /** 初始化线路标题 @param:<Line.id:线路ID> */
  51 + PublicFunctions.setTiteText(Line.id);
21 52
22 - // 地图初始化  
23 - var mapB = WorldsBMap.init(map); 53 + /** 初始化地图对象map @return:Map对象 */
  54 + var map_ = WorldsBMap.init();
24 55
25 - // 全局变量  
26 - window.mapB = mapB; 56 + /** 初始化绘图工具类 @param:<map_:map对象;styleOptions:绘图样式对象> @return:DrawingManager对象 */
  57 + var drawingManager_ = DrawingManagerObj.init(map_,styleOptions);
27 58
28 - // 上行树  
29 - PublicFunctions.TreeUpOrDown(id,'0'); 59 + /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */
  60 + PublicFunctions.TreeUpOrDown(Line.id,'0');
30 61
31 - // 下行树  
32 - PublicFunctions.TreeUpOrDown(id,'1'); 62 + /** 初始化下行树 @param:<Line.id:线路Id;0:下行> */
  63 + PublicFunctions.TreeUpOrDown(Line.id,'1');
33 64
34 - // 查询上行路段信息  
35 - GetAjaxData.getSectionRouteInfo(id,'0',function(data) { 65 + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:上行路段数据 */
  66 + GetAjaxData.getSectionRouteInfo(Line.id,'0',function(data) {
36 67
37 - // 在地图上画出线路走向  
38 - PublicFunctions.linePanlThree(data,'0'); 68 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:上行路段数据> */
  69 + PublicFunctions.linePanlThree(Line.id,data,'0');
39 70
40 }); 71 });
41 72
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
@@ -95,9 +95,6 @@ var StationTreeData = function(){ @@ -95,9 +95,6 @@ var StationTreeData = function(){
95 // 选中的是站点 95 // 选中的是站点
96 if(chaildredType =='station') { 96 if(chaildredType =='station') {
97 97
98 - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)  
99 - mapB.setZoom(16);  
100 -  
101 // 站点范围类型 98 // 站点范围类型
102 var shapesTypeT = treeOjb[0].original.stationShapesType; 99 var shapesTypeT = treeOjb[0].original.stationShapesType;
103 100
@@ -108,13 +105,13 @@ var StationTreeData = function(){ @@ -108,13 +105,13 @@ var StationTreeData = function(){
108 if(shapesTypeT =='r') { 105 if(shapesTypeT =='r') {
109 106
110 // 百度地图画圆 107 // 百度地图画圆
111 - WorldsBMap.pointsCircle(objStation,mapB); 108 + WorldsBMap.pointsCircle(objStation);
112 109
113 // 如果是多变行 110 // 如果是多变行
114 }else if(shapesTypeT == 'd') { 111 }else if(shapesTypeT == 'd') {
115 112
116 // 百度地图画多边形 113 // 百度地图画多边形
117 - WorldsBMap.pointsPolygon(objStation,mapB); 114 + WorldsBMap.pointsPolygon(objStation);
118 115
119 } 116 }
120 117
@@ -132,11 +129,10 @@ var StationTreeData = function(){ @@ -132,11 +129,10 @@ var StationTreeData = function(){
132 // 路段方向 129 // 路段方向
133 var dire_ = treeOjb[0].original.sectionrouteDirections; 130 var dire_ = treeOjb[0].original.sectionrouteDirections;
134 131
135 - // 清除地图覆盖物  
136 - mapB.clearOverlays(); 132 + var lineIdPanlThree = PublicFunctions.getLineIdValue();
137 133
138 // 百度地图画路段 134 // 百度地图画路段
139 - PublicFunctions.linePanlThree(polylineArray,dire_); 135 + PublicFunctions.linePanlThree(lineIdPanlThree,polylineArray,dire_);
140 136
141 // 选中的其它节点 137 // 选中的其它节点
142 }else if(chaildredType ==null){ 138 }else if(chaildredType ==null){
@@ -268,11 +264,13 @@ var StationTreeData = function(){ @@ -268,11 +264,13 @@ var StationTreeData = function(){
268 // 路段方向 264 // 路段方向
269 var dire_ = treeOjb[0].original.sectionrouteDirections; 265 var dire_ = treeOjb[0].original.sectionrouteDirections;
270 266
271 - // 清除地图覆盖物  
272 - mapB.clearOverlays(); 267 + /*// 清除地图覆盖物
  268 + mapB.clearOverlays();*/
  269 +
  270 + var lineIdPanlThree = PublicFunctions.getLineIdValue();
273 271
274 // 百度地图画路段 272 // 百度地图画路段
275 - PublicFunctions.linePanlThree(polylineArray,dire_); 273 + PublicFunctions.linePanlThree(lineIdPanlThree,polylineArray,dire_);
276 274
277 // 选中的其它节点 275 // 选中的其它节点
278 }else if(chaildredType ==null){ 276 }else if(chaildredType ==null){
src/main/resources/static/pages/base/stationroute/list.html
@@ -237,14 +237,37 @@ @@ -237,14 +237,37 @@
237 * 237 *
238 * - - - - - > status 绘画状态:新增与编辑 238 * - - - - - > status 绘画状态:新增与编辑
239 */ 239 */
240 - var id = '',dir = '',map = '', drawingManager = '',addStationNameValue = '',  
241 - circle='',marker = '',polyUpline='',addStaitonParmas = {},editStationParmas={},status='',manualPararms={}; 240 +/* var id = '',dir = '',map = '', drawingManager = '',addStationNameValue = '',
  241 + circle='',marker = '',polyUpline='',addStaitonParmas = {},editStationParmas={},status='',manualPararms={}; */
242 242
243 243
244 </script> 244 </script>
  245 +<!-- 线路类 -->
  246 +<script src="/pages/base/stationroute/js/line.js"></script>
  247 +
  248 +<!-- 新增站点对象类 -->
  249 +<script src="/pages/base/stationroute/js/addstationobj.js"></script>
  250 +
  251 +<!-- 新增站点对象类 -->
  252 +<script src="/pages/base/stationroute/js/editstationobj.js"></script>
  253 +
  254 +<!-- 绘图类 -->
  255 +<script src="/pages/base/stationroute/js/drawingManager.js"></script>
  256 +
  257 +<!-- 地图类 -->
  258 +<script src="/pages/base/stationroute/js/stationroute-list-map.js"></script>
  259 +
  260 +<!-- 函数与方法 -->
245 <script src="/pages/base/stationroute/js/stationroute-list-function.js"></script> 261 <script src="/pages/base/stationroute/js/stationroute-list-function.js"></script>
  262 +
  263 +<!-- ajax请求类 -->
246 <script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script> 264 <script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script>
  265 +
  266 +<!-- 树对类 -->
247 <script src="/pages/base/stationroute/js/stationroute-list-treedata.js"></script> 267 <script src="/pages/base/stationroute/js/stationroute-list-treedata.js"></script>
248 -<script src="/pages/base/stationroute/js/stationroute-list-map.js"></script> 268 +
  269 +<!-- reload事件 -->
249 <script src="/pages/base/stationroute/js/stationroute-list-reload.js"></script> 270 <script src="/pages/base/stationroute/js/stationroute-list-reload.js"></script>
  271 +
  272 +<!-- 事件监听 -->
250 <script src="/pages/base/stationroute/js/stationroute-list-events.js"></script> 273 <script src="/pages/base/stationroute/js/stationroute-list-events.js"></script>
251 \ No newline at end of file 274 \ No newline at end of file