Commit b3c3df154ac9e0dda1a90181244ff751fdfc2fdc
1 parent
209cf915
双路段路名
Showing
27 changed files
with
1554 additions
and
249 deletions
src/main/java/com/bsth/controller/SectionController.java
| @@ -135,7 +135,16 @@ public class SectionController extends BaseController<Section, Integer> { | @@ -135,7 +135,16 @@ public class SectionController extends BaseController<Section, Integer> { | ||
| 135 | @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) | 135 | @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) |
| 136 | public long getSectionCode() { | 136 | public long getSectionCode() { |
| 137 | return GetUIDAndCode.getSectionId(); | 137 | return GetUIDAndCode.getSectionId(); |
| 138 | - | 138 | + } |
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * @Description :TODO(把路段截取位双路名路段) | ||
| 142 | + * | ||
| 143 | + * @return int <sectionCode路段编码> | ||
| 144 | + */ | ||
| 145 | + @RequestMapping(value="doubleName" , method = RequestMethod.GET) | ||
| 146 | + public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { | ||
| 147 | + return service.doubleName(map); | ||
| 139 | } | 148 | } |
| 140 | 149 | ||
| 141 | } | 150 | } |
src/main/java/com/bsth/controller/StationRouteController.java
| 1 | package com.bsth.controller; | 1 | package com.bsth.controller; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.Station; | ||
| 3 | import com.bsth.entity.StationRoute; | 4 | import com.bsth.entity.StationRoute; |
| 4 | import com.bsth.entity.StationRouteCache; | 5 | import com.bsth.entity.StationRouteCache; |
| 5 | import com.bsth.repository.StationRouteCacheRepository; | 6 | import com.bsth.repository.StationRouteCacheRepository; |
| @@ -110,12 +111,20 @@ public class StationRouteController extends BaseController<StationRoute, Integer | @@ -110,12 +111,20 @@ public class StationRouteController extends BaseController<StationRoute, Integer | ||
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | /** | 113 | /** |
| 113 | - * @Description :TODO(查询缓存站点的上一个缓存站点) | 114 | + * @Description :TODO(查询线路某方向下的站点序号与类型) |
| 114 | */ | 115 | */ |
| 115 | @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET) | 116 | @RequestMapping(value = "/findCacheUpStationRouteCode" , method = RequestMethod.GET) |
| 116 | public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) { | 117 | public List<Map<String, Object>> findCacheUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 117 | return service.findCacheUpStationRouteCode(map); | 118 | return service.findCacheUpStationRouteCode(map); |
| 118 | } | 119 | } |
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * @Description :TODO(查询站点的下一个缓存站点) | ||
| 123 | + */ | ||
| 124 | + @RequestMapping(value = "/findDownStationRoute" , method = RequestMethod.GET) | ||
| 125 | + public List<Map<String, Object>> findDownStationRoute(@RequestParam Map<String, Object> map) { | ||
| 126 | + return service.findDownStationRoute(map); | ||
| 127 | + } | ||
| 119 | 128 | ||
| 120 | /** | 129 | /** |
| 121 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 130 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
src/main/java/com/bsth/entity/LonLatName.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +public class LonLatName { | ||
| 4 | + public String first_name; | ||
| 5 | + public String second_name; | ||
| 6 | + public String way_name; | ||
| 7 | + public String location; | ||
| 8 | + | ||
| 9 | + public String getFirst_name() { | ||
| 10 | + return first_name; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + public void setFirst_name(String first_name) { | ||
| 14 | + this.first_name = first_name; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public String getSecond_name() { | ||
| 18 | + return second_name; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setSecond_name(String second_name) { | ||
| 22 | + this.second_name = second_name; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public String getWay_name() { | ||
| 26 | + return way_name; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setWay_name(String way_name) { | ||
| 30 | + this.way_name = way_name; | ||
| 31 | + } | ||
| 32 | + public String getLocation() { | ||
| 33 | + return location; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setLocation(String location) { | ||
| 37 | + this.location = location; | ||
| 38 | + } | ||
| 39 | +} |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| @@ -172,9 +172,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | @@ -172,9 +172,13 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int | ||
| 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); | 172 | void isRoadSpeedUpd(Integer isR,Integer line,Integer directions); |
| 173 | 173 | ||
| 174 | @Modifying | 174 | @Modifying |
| 175 | - @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+10) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | 175 | + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+100) where line = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) |
| 176 | public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); | 176 | public void sectionUpdSectionRouteCode(Integer line,Integer dir,Integer routeCod); |
| 177 | - | 177 | + |
| 178 | + @Modifying | ||
| 179 | + @Query(value="UPDATE bsth_c_sectionroute set sectionroute_code = (sectionroute_code+100) where line_code = ?1 and directions = ?2 and sectionroute_code >=?3 and destroy = 0", nativeQuery=true) | ||
| 180 | + public void sectionUpdSectionRouteCode(String lineCode,Integer dir,int routeCod); | ||
| 181 | + | ||
| 178 | @Modifying | 182 | @Modifying |
| 179 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) | 183 | @Query(value="UPDATE bsth_c_sectionroute set destroy = 1 where id = ?1", nativeQuery=true) |
| 180 | public void sectionRouteIsDestroyUpdBatch(Integer id); | 184 | public void sectionRouteIsDestroyUpdBatch(Integer id); |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -102,8 +102,79 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -102,8 +102,79 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 102 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + | 102 | "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + |
| 103 | "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true) | 103 | "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true) |
| 104 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); | 104 | List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode); |
| 105 | - | ||
| 106 | - | 105 | + |
| 106 | + /** | ||
| 107 | + * @Description :TODO(查询下个站点) | ||
| 108 | + * | ||
| 109 | + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 110 | + * | ||
| 111 | + * @return List<Map<String, Object>> | ||
| 112 | + */ | ||
| 113 | + @Query(value = "SELECT a.stationRouteLine," + | ||
| 114 | + " a.stationRouteStation," + | ||
| 115 | + " a.stationRouteCode," + | ||
| 116 | + " a.stationRouteLIneCode," + | ||
| 117 | + " a.stationRouteStationMark," + | ||
| 118 | + " a.stationOutStationNmber," + | ||
| 119 | + " a.stationRoutedirections," + | ||
| 120 | + " a.stationRouteDistances," + | ||
| 121 | + " a.stationRouteToTime," + | ||
| 122 | + " a.staitonRouteFirstTime," + | ||
| 123 | + " a.stationRouteEndTime," + | ||
| 124 | + " a.stationRouteDescriptions," + | ||
| 125 | + " a.stationRouteDestroy," + | ||
| 126 | + " a.stationRouteVersions," + | ||
| 127 | + " a.stationRouteCreateBy," + | ||
| 128 | + " a.stationRouteCreateDate," + | ||
| 129 | + " a.stationRouteUpdateBy," + | ||
| 130 | + " a.stationRouteUpdateDate," + | ||
| 131 | + " b.id AS stationId," + | ||
| 132 | + " b.station_cod AS stationCode," + | ||
| 133 | + " a.stationRouteName," + | ||
| 134 | + " b.road_coding AS stationRoadCoding," + | ||
| 135 | + " b.db_type AS stationDbType," + | ||
| 136 | + " b.b_jwpoints AS stationJwpoints," + | ||
| 137 | + " b.g_lonx AS stationGlonx," + | ||
| 138 | + " b.g_laty AS stationGlaty," + | ||
| 139 | + " b.x AS stationX," + | ||
| 140 | + " b.y AS stationY," + | ||
| 141 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | ||
| 142 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | ||
| 143 | + " b.destroy AS stationDestroy," + | ||
| 144 | + " b.radius AS stationRadius," + | ||
| 145 | + " b.shapes_type AS stationShapesType," + | ||
| 146 | + " b.versions AS stationVersions," + | ||
| 147 | + " b.descriptions AS sttationDescriptions," + | ||
| 148 | + " b.create_by AS stationCreateBy," + | ||
| 149 | + " b.create_date AS stationCreateDate," + | ||
| 150 | + " b.update_by AS stationUpdateBy," + | ||
| 151 | + " b.update_date AS stationUpdateDate," + | ||
| 152 | + " a.stationRouteId,b.station_name as zdmc "+ | ||
| 153 | + " FROM ( SELECT s.id AS stationRouteId," + | ||
| 154 | + " s.line AS stationRouteLine," + | ||
| 155 | + " s.station as stationRouteStation," + | ||
| 156 | + " s.station_name AS stationRouteName," + | ||
| 157 | + " s.station_route_code as stationRouteCode," + | ||
| 158 | + " s.line_code AS stationRouteLIneCode," + | ||
| 159 | + " s.station_mark AS stationRouteStationMark," + | ||
| 160 | + " s.out_station_nmber AS stationOutStationNmber," + | ||
| 161 | + " s.directions AS stationRoutedirections," + | ||
| 162 | + " s.distances AS stationRouteDistances," + | ||
| 163 | + " s.to_time AS stationRouteToTime," + | ||
| 164 | + " s.first_time AS staitonRouteFirstTime," + | ||
| 165 | + " s.end_time AS stationRouteEndTime," + | ||
| 166 | + " s.descriptions AS stationRouteDescriptions," + | ||
| 167 | + " s.destroy AS stationRouteDestroy," + | ||
| 168 | + " s.versions AS stationRouteVersions," + | ||
| 169 | + " s.create_by AS stationRouteCreateBy," + | ||
| 170 | + " s.create_date AS stationRouteCreateDate," + | ||
| 171 | + " s.update_by AS stationRouteUpdateBy," + | ||
| 172 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_stationroute s WHERE s.station_route_code =(" + | ||
| 173 | + "select MIN(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " + | ||
| 174 | + "r.line=?1 and r.directions =?2 and station_route_code > ?3 and r.destroy = 0 ) and s.line=?1 and s.directions = ?2 AND s.destroy = 0) a " + | ||
| 175 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | ||
| 176 | + List<Object[]> findDownStationRoute(Integer id,Integer direction,Integer stationRouteCode); | ||
| 177 | + | ||
| 107 | /** | 178 | /** |
| 108 | * @Description :TODO(站点中心点坐标查询) | 179 | * @Description :TODO(站点中心点坐标查询) |
| 109 | * | 180 | * |
src/main/java/com/bsth/service/SectionService.java
| @@ -37,4 +37,6 @@ public interface SectionService extends BaseService<Section, Integer> { | @@ -37,4 +37,6 @@ public interface SectionService extends BaseService<Section, Integer> { | ||
| 37 | Map<String, Object> sectionCacheUpdate(Map<String, Object> map); | 37 | Map<String, Object> sectionCacheUpdate(Map<String, Object> map); |
| 38 | 38 | ||
| 39 | Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map); | 39 | Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map); |
| 40 | + | ||
| 41 | + Map<String,Object> doubleName(Map<String, Object> map); | ||
| 40 | } | 42 | } |
src/main/java/com/bsth/service/StationRouteService.java
| @@ -72,9 +72,18 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | @@ -72,9 +72,18 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> | ||
| 72 | * @return List<Map<String, Object>> | 72 | * @return List<Map<String, Object>> |
| 73 | */ | 73 | */ |
| 74 | List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map); | 74 | List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map); |
| 75 | - | 75 | + |
| 76 | List<Map<String, Object>> findCacheUpStationRouteCode(Map<String, Object> map); | 76 | List<Map<String, Object>> findCacheUpStationRouteCode(Map<String, Object> map); |
| 77 | - | 77 | + |
| 78 | + /** | ||
| 79 | + * @Description :TODO(查询下一个站点) | ||
| 80 | + * | ||
| 81 | + * @param map <站点路由id; direction:方向;stationRouteCode:站点编码> | ||
| 82 | + * | ||
| 83 | + * @return List<Map<String, Object>> | ||
| 84 | + */ | ||
| 85 | + List<Map<String, Object>> findDownStationRoute(Map<String, Object> map); | ||
| 86 | + | ||
| 78 | /** | 87 | /** |
| 79 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 88 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 80 | * | 89 | * |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| @@ -7,6 +7,7 @@ import java.util.HashMap; | @@ -7,6 +7,7 @@ import java.util.HashMap; | ||
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | import java.util.Map; | 8 | import java.util.Map; |
| 9 | 9 | ||
| 10 | +import com.bsth.util.RoadCutDoubleName; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 12 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
| @@ -360,6 +361,129 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -360,6 +361,129 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 360 | return resultMap; | 361 | return resultMap; |
| 361 | } | 362 | } |
| 362 | 363 | ||
| 364 | + /** | ||
| 365 | + * @Description :TODO(生成双路名路段) | ||
| 366 | + * @param map <lineId:线路ID; route:路段信息> | ||
| 367 | + * @return | ||
| 368 | + */ | ||
| 369 | + @Override | ||
| 370 | + @Transactional | ||
| 371 | + public Map<String, Object> doubleName(Map<String, Object> map) { | ||
| 372 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 373 | + try { | ||
| 374 | + // 路段点List | ||
| 375 | + List<Point> bPointsList = new ArrayList<>(); | ||
| 376 | + // 截取后的路段 | ||
| 377 | + List<Map<String, String>> sectionArrayList = new ArrayList<>(); | ||
| 378 | + Integer lineId = Integer.parseInt(map.get("lineId").equals("") ? "" :map.get("lineId").toString()); | ||
| 379 | + String lineCode = map.get("lineCode").equals("") ? "" :map.get("lineCode").toString(); | ||
| 380 | + Integer directions = Integer.parseInt(map.get("directions").equals("") ? "" :map.get("directions").toString()); | ||
| 381 | + String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" :map.get("sectionrouteCode").toString(); | ||
| 382 | + Integer versions = Integer.parseInt(map.get("versions").equals("") ? "" :map.get("versions").toString()); | ||
| 383 | + String stationRouteBegin = map.get("stationRouteBegin").equals("") ? "" :map.get("stationRouteBegin").toString(); | ||
| 384 | + String stationRouteFinish = map.get("stationRouteFinish").equals("") ? "" :map.get("stationRouteFinish").toString(); | ||
| 385 | + String routes = map.get("route").equals("") ? "" :map.get("route").toString(); | ||
| 386 | + if(!routes.equals("")) { | ||
| 387 | + String sectionStr = ""; | ||
| 388 | + // 转换成JSON数组 | ||
| 389 | + JSONArray sectionsArray = JSONArray.parseArray(routes); | ||
| 390 | + // 遍历 | ||
| 391 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 392 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 393 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 394 | + if(s == sectionsArray.size()-1){ | ||
| 395 | + sectionStr += pointsLngStr+","+pointsLatStr; | ||
| 396 | + } else { | ||
| 397 | + sectionStr += pointsLngStr+","+pointsLatStr+";"; | ||
| 398 | + } | ||
| 399 | + } | ||
| 400 | + Map<String, Object> roads = RoadCutDoubleName.start(sectionStr); | ||
| 401 | + if (!roads.isEmpty()) { | ||
| 402 | + List bSectionList = (List) roads.get("bSections"); | ||
| 403 | + List roadName = (List) roads.get("roadName"); | ||
| 404 | + // 路段序号 | ||
| 405 | + Integer routeCode = 0; | ||
| 406 | + if(!sectionrouteCode.equals("")){ | ||
| 407 | + String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | ||
| 408 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+100; | ||
| 409 | + }else { | ||
| 410 | + routeCode = 100; | ||
| 411 | + } | ||
| 412 | + // 增加路段序号 | ||
| 413 | + | ||
| 414 | + for(int i = 0; i < bSectionList.size(); i++){ | ||
| 415 | + List<Location> bSection = new ArrayList<>(); | ||
| 416 | + bSectionList.get(i); | ||
| 417 | + bSection = (List<Location>) bSectionList.get(i); | ||
| 418 | + | ||
| 419 | + String sectionsBpoints = ""; | ||
| 420 | + // WGS线状图形坐标集合 | ||
| 421 | + String sectionsWJPpoints = ""; | ||
| 422 | + for (int j = 0; j < bSection.size(); j++) { | ||
| 423 | + bSection.get(j); | ||
| 424 | + Location point = bSection.get(j); | ||
| 425 | + String pointsLngStr = String.valueOf(point.getLng()); | ||
| 426 | + String pointsLatStr = String.valueOf(point.getLat()); | ||
| 427 | + /** to WGS坐标 */ | ||
| 428 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 429 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 430 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 431 | + if(j == 0) { | ||
| 432 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 433 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 434 | + }else { | ||
| 435 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 436 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 437 | + } | ||
| 438 | + } | ||
| 439 | + // 获取当前最大Id | ||
| 440 | + long sectionMaxId = GetUIDAndCode.getSectionId(); | ||
| 441 | + // 路段编码 | ||
| 442 | + String sectionCode = String.valueOf(sectionMaxId); | ||
| 443 | + // 路段ID | ||
| 444 | + int sectionId = (int)sectionMaxId; | ||
| 445 | + String sectionName = roadName.get(i).toString(); | ||
| 446 | + // WGS坐标点集合 | ||
| 447 | + String gsectionVector = null; | ||
| 448 | + if(!sectionsWJPpoints.equals("")) { | ||
| 449 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 450 | + } | ||
| 451 | + // 原坐标点集合 | ||
| 452 | + String bsectionVectorS = null; | ||
| 453 | + if(!sectionsBpoints.equals("")) { | ||
| 454 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 455 | + } | ||
| 456 | + repository.systemSave(sectionCode, sectionName, "", "", "", "", gsectionVector, bsectionVectorS, "", "", "", 0, 0, "", 0, "", 1, sectionId); | ||
| 457 | + | ||
| 458 | + routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode+i*100); | ||
| 459 | + SectionRoute route = new SectionRoute(); | ||
| 460 | + Line line = lineRepository.findOne(lineId); | ||
| 461 | + Section section = repository.findOne(sectionId); | ||
| 462 | + route.setSectionrouteCode(routeCode+i*100); | ||
| 463 | + route.setLineCode(lineCode); | ||
| 464 | + route.setSectionCode(sectionCode); | ||
| 465 | + route.setDirections(directions); | ||
| 466 | + route.setVersions(versions); | ||
| 467 | + route.setDestroy(0); | ||
| 468 | + route.setLine(line); | ||
| 469 | + route.setSection(section); | ||
| 470 | + route.setIsRoadeSpeed(0); | ||
| 471 | + routeRepository.save(route); | ||
| 472 | + } | ||
| 473 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 474 | + return resultMap; | ||
| 475 | + } else { | ||
| 476 | + resultMap.put("status", "Failure"); | ||
| 477 | + return resultMap; | ||
| 478 | + } | ||
| 479 | + } | ||
| 480 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 481 | + } catch (Exception e) { | ||
| 482 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 483 | + } | ||
| 484 | + return resultMap; | ||
| 485 | + } | ||
| 486 | + | ||
| 363 | private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList, | 487 | private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList, |
| 364 | String bsectionVector, String bsectionVectorCutList) { | 488 | String bsectionVector, String bsectionVectorCutList) { |
| 365 | if(!bsectionVector.equals("")) { | 489 | if(!bsectionVector.equals("")) { |
| @@ -480,6 +604,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -480,6 +604,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 480 | * @return Map<String, Object> <SUCCESS ; ERROR> | 604 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 481 | */ | 605 | */ |
| 482 | @Override | 606 | @Override |
| 607 | + @Transactional | ||
| 483 | public Map<String, Object> sectionUpdate(Map<String, Object> map) { | 608 | public Map<String, Object> sectionUpdate(Map<String, Object> map) { |
| 484 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 609 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 485 | try { | 610 | try { |
| @@ -539,32 +664,30 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -539,32 +664,30 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 539 | SectionRoute resultS = routeRepository.findOne(sectionRouteId); | 664 | SectionRoute resultS = routeRepository.findOne(sectionRouteId); |
| 540 | int old_code = resultS.getSectionrouteCode(); | 665 | int old_code = resultS.getSectionrouteCode(); |
| 541 | if(sectionrouteCode!=null) { | 666 | if(sectionrouteCode!=null) { |
| 542 | - int new_code = sectionrouteCode+100; | ||
| 543 | - if(new_code==old_code){ | ||
| 544 | - sectionrouteCode = new_code; | ||
| 545 | - }else { | ||
| 546 | - sectionrouteCode = new_code-100+1; | ||
| 547 | - } | ||
| 548 | - }else { | ||
| 549 | - sectionrouteCode = old_code; | ||
| 550 | - } | 667 | + sectionrouteCode += 100; |
| 668 | + }else { | ||
| 669 | + sectionrouteCode = old_code; | ||
| 670 | + } | ||
| 671 | + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | ||
| 551 | // 限速 | 672 | // 限速 |
| 552 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | 673 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 553 | // 版本 | 674 | // 版本 |
| 554 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | 675 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 555 | // WGS坐标点集合 | 676 | // WGS坐标点集合 |
| 556 | String gsectionVector = null; | 677 | String gsectionVector = null; |
| 557 | - if(!sectionsWJPpoints.equals("")) | 678 | + if(!sectionsWJPpoints.equals("")) { |
| 558 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | 679 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 680 | + } | ||
| 559 | // 原坐标点集合 | 681 | // 原坐标点集合 |
| 560 | String bsectionVectorS = null; | 682 | String bsectionVectorS = null; |
| 561 | - if(!sectionsBpoints.equals("")) | ||
| 562 | - bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | 683 | + if(!sectionsBpoints.equals("")) { |
| 684 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 685 | + } | ||
| 563 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | 686 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 564 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | 687 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); |
| 565 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | 688 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); |
| 566 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | 689 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); |
| 567 | - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | 690 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 568 | Date date = new Date(); | 691 | Date date = new Date(); |
| 569 | // 修改日期 | 692 | // 修改日期 |
| 570 | String updateDate = formatter.format(date); | 693 | String updateDate = formatter.format(date); |
| @@ -604,6 +727,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -604,6 +727,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 604 | * @Description :TODO(编辑缓存线路走向) | 727 | * @Description :TODO(编辑缓存线路走向) |
| 605 | */ | 728 | */ |
| 606 | @Override | 729 | @Override |
| 730 | + @Transactional | ||
| 607 | public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) { | 731 | public Map<String, Object> sectionCacheUpdate(Map<String, Object> map) { |
| 608 | Map<String, Object> resultMap = new HashMap<String, Object>(); | 732 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 609 | try { | 733 | try { |
| @@ -670,26 +794,29 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -670,26 +794,29 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 670 | }else { | 794 | }else { |
| 671 | sectionrouteCode = new_code-100+1; | 795 | sectionrouteCode = new_code-100+1; |
| 672 | } | 796 | } |
| 673 | - }else { | ||
| 674 | - sectionrouteCode = old_code; | ||
| 675 | - } | 797 | + }else { |
| 798 | + sectionrouteCode = old_code; | ||
| 799 | + } | ||
| 800 | + routeRepository.sectionUpdSectionRouteCode(lineCode, directions,sectionrouteCode); | ||
| 676 | // 限速 | 801 | // 限速 |
| 677 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | 802 | Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); |
| 678 | // 版本 | 803 | // 版本 |
| 679 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | 804 | Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); |
| 680 | // WGS坐标点集合 | 805 | // WGS坐标点集合 |
| 681 | String gsectionVector = null; | 806 | String gsectionVector = null; |
| 682 | - if(!sectionsWJPpoints.equals("")) | 807 | + if(!sectionsWJPpoints.equals("")) { |
| 683 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | 808 | gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; |
| 809 | + } | ||
| 684 | // 原坐标点集合 | 810 | // 原坐标点集合 |
| 685 | String bsectionVectorS = null; | 811 | String bsectionVectorS = null; |
| 686 | - if(!sectionsBpoints.equals("")) | ||
| 687 | - bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | 812 | + if(!sectionsBpoints.equals("")) { |
| 813 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 814 | + } | ||
| 688 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | 815 | Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); |
| 689 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | 816 | String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); |
| 690 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | 817 | Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); |
| 691 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); | 818 | Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString()); |
| 692 | - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | 819 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); |
| 693 | Date date = new Date(); | 820 | Date date = new Date(); |
| 694 | // 修改日期 | 821 | // 修改日期 |
| 695 | String updateDate = formatter.format(date); | 822 | String updateDate = formatter.format(date); |
| @@ -742,7 +869,6 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -742,7 +869,6 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 742 | 869 | ||
| 743 | } | 870 | } |
| 744 | 871 | ||
| 745 | - | ||
| 746 | /** | 872 | /** |
| 747 | * 新增路段信息 | 873 | * 新增路段信息 |
| 748 | * | 874 | * |
| @@ -833,11 +959,11 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -833,11 +959,11 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 833 | Integer routeCode = null; | 959 | Integer routeCode = null; |
| 834 | if(!sectionrouteCode.equals("")){ | 960 | if(!sectionrouteCode.equals("")){ |
| 835 | String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | 961 | String sectionrouteCodeArray[] = sectionrouteCode.split("_"); |
| 836 | - routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; | 962 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+100; |
| 837 | }else { | 963 | }else { |
| 838 | routeCode = 100; | 964 | routeCode = 100; |
| 839 | } | 965 | } |
| 840 | - routeRepository.sectionUpdSectionRouteCode(lineId, directions,routeCode); | 966 | + routeRepository.sectionUpdSectionRouteCode(lineId, directions, routeCode); |
| 841 | sectionRoute.setSectionrouteCode(routeCode); | 967 | sectionRoute.setSectionrouteCode(routeCode); |
| 842 | sectionRoute.setLineCode(lineCode); | 968 | sectionRoute.setLineCode(lineCode); |
| 843 | sectionRoute.setSection(section); | 969 | sectionRoute.setSection(section); |
| @@ -856,4 +982,5 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | @@ -856,4 +982,5 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem | ||
| 856 | } | 982 | } |
| 857 | return resultMap; | 983 | return resultMap; |
| 858 | } | 984 | } |
| 985 | + | ||
| 859 | } | 986 | } |
| 860 | \ No newline at end of file | 987 | \ No newline at end of file |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -544,7 +544,116 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -544,7 +544,116 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 544 | } | 544 | } |
| 545 | return list; | 545 | return list; |
| 546 | } | 546 | } |
| 547 | - | 547 | + |
| 548 | + /** | ||
| 549 | + * @Description :TODO(查询下一个站点) | ||
| 550 | + * | ||
| 551 | + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> | ||
| 552 | + * | ||
| 553 | + * @return List<Map<String, Object>> | ||
| 554 | + */ | ||
| 555 | + @Override | ||
| 556 | + public List<Map<String, Object>> findDownStationRoute(Map<String, Object> map) { | ||
| 557 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); | ||
| 558 | + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); | ||
| 559 | + Integer stationRouteCode = map.get("stationRouteCode").equals("") ? null : Integer.parseInt(map.get("stationRouteCode").toString()); | ||
| 560 | + List<Object[]> objects = repository.findDownStationRoute(lineId, direction, stationRouteCode); | ||
| 561 | + List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); | ||
| 562 | + | ||
| 563 | + int len = objects.size(); | ||
| 564 | + | ||
| 565 | + if(objects.size()>0) { | ||
| 566 | + | ||
| 567 | + for(int i = 0 ; i < len; i++) { | ||
| 568 | + Map<String, Object> tempM = new HashMap<String,Object>(); | ||
| 569 | + | ||
| 570 | + tempM.put("stationRouteLine", objects.get(i)[0]); | ||
| 571 | + | ||
| 572 | + tempM.put("stationRouteStation", objects.get(i)[1]); | ||
| 573 | + | ||
| 574 | + tempM.put("stationRouteCode", objects.get(i)[2]); | ||
| 575 | + | ||
| 576 | + tempM.put("stationRouteLIneCode", objects.get(i)[3]); | ||
| 577 | + | ||
| 578 | + tempM.put("stationRouteStationMark", objects.get(i)[4]); | ||
| 579 | + | ||
| 580 | + tempM.put("stationOutStationNmber", objects.get(i)[5]); | ||
| 581 | + | ||
| 582 | + tempM.put("stationRoutedirections", objects.get(i)[6]); | ||
| 583 | + | ||
| 584 | + tempM.put("stationRouteDistances", objects.get(i)[7]); | ||
| 585 | + | ||
| 586 | + tempM.put("stationRouteToTime", objects.get(i)[8]); | ||
| 587 | + | ||
| 588 | + tempM.put("staitonRouteFirstTime", objects.get(i)[9]); | ||
| 589 | + | ||
| 590 | + tempM.put("stationRouteEndTime", objects.get(i)[10]); | ||
| 591 | + | ||
| 592 | + tempM.put("stationRouteDescriptions", objects.get(i)[11]); | ||
| 593 | + | ||
| 594 | + tempM.put("stationRouteDestroy", objects.get(i)[12]); | ||
| 595 | + | ||
| 596 | + tempM.put("stationRouteVersions", objects.get(i)[13]); | ||
| 597 | + | ||
| 598 | + tempM.put("stationRouteCreateBy", objects.get(i)[14]); | ||
| 599 | + | ||
| 600 | + tempM.put("stationRouteCreateDate", objects.get(i)[15]); | ||
| 601 | + | ||
| 602 | + tempM.put("stationRouteUpdateBy", objects.get(i)[16]); | ||
| 603 | + | ||
| 604 | + tempM.put("stationRouteUpdateDate", objects.get(i)[17]); | ||
| 605 | + | ||
| 606 | + tempM.put("stationId", objects.get(i)[18]); | ||
| 607 | + | ||
| 608 | + tempM.put("stationCode", objects.get(i)[19]); | ||
| 609 | + | ||
| 610 | + tempM.put("stationRouteName", objects.get(i)[20]); | ||
| 611 | + | ||
| 612 | + tempM.put("stationRoadCoding", objects.get(i)[21]); | ||
| 613 | + | ||
| 614 | + tempM.put("stationDbType", objects.get(i)[22]); | ||
| 615 | + | ||
| 616 | + tempM.put("stationJwpoints", objects.get(i)[23]); | ||
| 617 | + | ||
| 618 | + tempM.put("stationGlonx", objects.get(i)[24]); | ||
| 619 | + | ||
| 620 | + tempM.put("stationGlaty", objects.get(i)[25]); | ||
| 621 | + | ||
| 622 | + tempM.put("stationX", objects.get(i)[26]); | ||
| 623 | + | ||
| 624 | + tempM.put("stationY", objects.get(i)[27]); | ||
| 625 | + | ||
| 626 | + tempM.put("stationBPolyonGrid", objects.get(i)[28]); | ||
| 627 | + | ||
| 628 | + tempM.put("stationGPloyonGrid", objects.get(i)[29]); | ||
| 629 | + | ||
| 630 | + tempM.put("stationDestroy", objects.get(i)[30]); | ||
| 631 | + | ||
| 632 | + tempM.put("stationRadius", objects.get(i)[31]); | ||
| 633 | + | ||
| 634 | + tempM.put("stationShapesType", objects.get(i)[32]); | ||
| 635 | + | ||
| 636 | + tempM.put("stationVersions", objects.get(i)[33]); | ||
| 637 | + | ||
| 638 | + tempM.put("sttationDescriptions", objects.get(i)[34]); | ||
| 639 | + | ||
| 640 | + tempM.put("stationCreateBy", objects.get(i)[35]); | ||
| 641 | + | ||
| 642 | + tempM.put("stationCreateDate", objects.get(i)[36]); | ||
| 643 | + | ||
| 644 | + tempM.put("stationUpdateBy", objects.get(i)[37]); | ||
| 645 | + | ||
| 646 | + tempM.put("stationUpdateDate", objects.get(i)[38]); | ||
| 647 | + | ||
| 648 | + tempM.put("stationRouteId", objects.get(i)[39]); | ||
| 649 | + tempM.put("zdmc", objects.get(i)[40]); | ||
| 650 | + | ||
| 651 | + resultList.add(tempM); | ||
| 652 | + } | ||
| 653 | + } | ||
| 654 | + return resultList; | ||
| 655 | + } | ||
| 656 | + | ||
| 548 | /** | 657 | /** |
| 549 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) | 658 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 550 | * | 659 | * |
| @@ -742,10 +851,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -742,10 +851,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 742 | 851 | ||
| 743 | // 将txt文件打包 | 852 | // 将txt文件打包 |
| 744 | File targetFile = PackTarGZUtils.compress(textFile, target); | 853 | File targetFile = PackTarGZUtils.compress(textFile, target); |
| 745 | - | 854 | + |
| 746 | /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | 855 | /*clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ |
| 747 | - | 856 | + |
| 748 | clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); | 857 | clientUtils.FTPUpLoadFromDisk(targetFile, targetFile.getName(), url, port, username, password, remotePath); |
| 858 | + | ||
| 859 | + // 删除文件 | ||
| 860 | + textFile.delete(); | ||
| 861 | + targetFile.delete(); | ||
| 749 | 862 | ||
| 750 | resultMap.put("status", ResponseCode.SUCCESS); | 863 | resultMap.put("status", ResponseCode.SUCCESS); |
| 751 | 864 | ||
| @@ -1313,7 +1426,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -1313,7 +1426,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 1313 | /** | 1426 | /** |
| 1314 | * @Description :TODO(查询缓存路由) | 1427 | * @Description :TODO(查询缓存路由) |
| 1315 | * | 1428 | * |
| 1316 | - * @param map <line.id_eq:线路ID; directions_eq:方向> | 1429 | + * @param map (line.id_eq:线路ID; directions_eq:方向) |
| 1317 | * | 1430 | * |
| 1318 | * @return List<Map<String, Object>> | 1431 | * @return List<Map<String, Object>> |
| 1319 | */ | 1432 | */ |
src/main/java/com/bsth/util/ClosestPoint.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.List; | ||
| 6 | +import java.util.Map; | ||
| 7 | +import com.bsth.util.TransGPS.Location; | ||
| 8 | + | ||
| 9 | +public class ClosestPoint { | ||
| 10 | + | ||
| 11 | + public static Location getVerticalPoint(Location loc1, Location loc2, Location loc3) { | ||
| 12 | + // 第一步:求得直线方程相关参数y=kx+b | kx-y+b=0 | ||
| 13 | + double k = (loc1.getLat() - loc2.getLat()) * 1.0 / (loc1.getLng() - loc2.getLng());// 坐标直线斜率k | ||
| 14 | + double b = loc1.getLat() - k * loc1.getLng();// 坐标直线b | ||
| 15 | + // 第一种: 设直线方程为ax+by+c=0,点坐标为(m,n) | ||
| 16 | + // 则垂足为((b*b*m-a*b*n-a*c)/(a*a+b*b),(a*a*n-a*b*m-b*c)/(a*a+b*b)) | ||
| 17 | + Location loc4 = TransGPS.LocationMake(((-1) * (-1) * loc3.getLng() - k * (-1) * loc3.getLat() - k * b) / (k * k + (-1) * (-1)), | ||
| 18 | + (k * k * loc3.getLat() - k * (-1) * loc3.getLng() - (-1) * b) / (k * k + (-1) * (-1))); | ||
| 19 | + return loc4; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + // 获取两点间距离 | ||
| 23 | + static double GetPointDistance(Location p1, Location p2) { | ||
| 24 | + return Math.sqrt((p1.getLng() - p2.getLng()) * (p1.getLng() - p2.getLng()) + (p1.getLat() - p2.getLat()) * (p1.getLat() - p2.getLat())); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + // 求点到线段距离的最近点 | ||
| 28 | + static Map<Double, List<Location>> GetNearestDistance(Location PA, Location PB, Location P3) { | ||
| 29 | + Map<Double, List<Location>> point = new HashMap<>(); | ||
| 30 | + List<Location> locations = new ArrayList<>(); | ||
| 31 | + locations.add(PA); | ||
| 32 | + locations.add(PB); | ||
| 33 | + // 点在线段上 | ||
| 34 | + double a, b, c; | ||
| 35 | + a = GetPointDistance(PB, P3); | ||
| 36 | + if (a <= 0.000000001) { | ||
| 37 | + locations.add(P3); | ||
| 38 | + point.put(a, locations); | ||
| 39 | + return point; | ||
| 40 | + } | ||
| 41 | + b = GetPointDistance(PA, P3); | ||
| 42 | + if (b <= 0.000000001) { | ||
| 43 | + locations.add(P3); | ||
| 44 | + point.put(b, locations); | ||
| 45 | + return point; | ||
| 46 | + } | ||
| 47 | + c = GetPointDistance(PA, PB); | ||
| 48 | + if (c <= 0.000000001) { | ||
| 49 | + locations.add(PA); | ||
| 50 | + point.put(b, locations);// 如果PA和PB坐标相同,则退出函数,并返回距离 | ||
| 51 | + return point; | ||
| 52 | + } | ||
| 53 | + // 点和线段组成钝角三角形 | ||
| 54 | + if (a * a >= b * b + c * c) { | ||
| 55 | + locations.add(PA); | ||
| 56 | + point.put(b, locations); | ||
| 57 | + return point;// 如果是钝角返回b | ||
| 58 | + } | ||
| 59 | + if (b * b >= a * a + c * c) { | ||
| 60 | + locations.add(PB); | ||
| 61 | + point.put(a, locations);// 如果是钝角返回a | ||
| 62 | + return point; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // 点和线段组成锐角三角形 | ||
| 66 | + double l = (a + b + c) / 2; // 周长的一半 | ||
| 67 | + double s = Math.sqrt(l * (l - a) * (l - b) * (l - c)); // 海伦公式求面积,也可以用矢量求 | ||
| 68 | + Location location = getVerticalPoint(PA, PB, P3); | ||
| 69 | + locations.add(location); | ||
| 70 | + point.put(2 * s / c, locations); | ||
| 71 | + return point; | ||
| 72 | + } | ||
| 73 | +} |
src/main/java/com/bsth/util/HttpClientUtils.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import org.apache.http.HttpEntity; | ||
| 4 | +import org.apache.http.client.config.RequestConfig; | ||
| 5 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 6 | +import org.apache.http.client.methods.HttpGet; | ||
| 7 | +import org.apache.http.client.methods.HttpPost; | ||
| 8 | +import org.apache.http.entity.StringEntity; | ||
| 9 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 10 | +import org.apache.http.impl.client.HttpClients; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | + | ||
| 14 | +import java.io.BufferedReader; | ||
| 15 | +import java.io.IOException; | ||
| 16 | +import java.io.InputStreamReader; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Created by panzhao on 2017/8/2. | ||
| 20 | + */ | ||
| 21 | +public class HttpClientUtils { | ||
| 22 | + | ||
| 23 | + static Logger logger = LoggerFactory.getLogger(HttpClientUtils.class); | ||
| 24 | + public static StringBuilder get(String url) throws Exception { | ||
| 25 | + | ||
| 26 | + CloseableHttpClient httpClient = null; | ||
| 27 | + CloseableHttpResponse response = null; | ||
| 28 | + StringBuilder stringBuffer = null; | ||
| 29 | + try { | ||
| 30 | + httpClient = HttpClients.createDefault(); | ||
| 31 | + HttpGet get = new HttpGet(url); | ||
| 32 | + //超时时间 | ||
| 33 | + RequestConfig requestConfig = RequestConfig.custom() | ||
| 34 | + .setConnectTimeout(10500).setConnectionRequestTimeout(7000) | ||
| 35 | + .setSocketTimeout(10500).build(); | ||
| 36 | + get.setConfig(requestConfig); | ||
| 37 | + get.addHeader("Content-Encoding", "gzip"); | ||
| 38 | + response = httpClient.execute(get); | ||
| 39 | + stringBuffer = getResult(response.getEntity()); | ||
| 40 | + } catch (Exception e) { | ||
| 41 | + logger.error("", e); | ||
| 42 | + } finally { | ||
| 43 | + if (null != httpClient) | ||
| 44 | + httpClient.close(); | ||
| 45 | + if (null != response) | ||
| 46 | + response.close(); | ||
| 47 | + } | ||
| 48 | + return stringBuffer; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * raw post data | ||
| 53 | + * @param url | ||
| 54 | + * @param data | ||
| 55 | + * @return | ||
| 56 | + */ | ||
| 57 | + public static StringBuilder post(String url, String data) throws Exception { | ||
| 58 | + CloseableHttpClient httpClient = null; | ||
| 59 | + CloseableHttpResponse response = null; | ||
| 60 | + StringBuilder stringBuffer = null; | ||
| 61 | + try { | ||
| 62 | + httpClient = HttpClients.createDefault(); | ||
| 63 | + HttpPost post = new HttpPost(url); | ||
| 64 | + | ||
| 65 | + post.setHeader("Accept", "application/json"); | ||
| 66 | + post.setHeader("Content-Type", "application/json"); | ||
| 67 | + //超时时间 | ||
| 68 | + RequestConfig requestConfig = RequestConfig.custom() | ||
| 69 | + .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 70 | + .setSocketTimeout(3500).build(); | ||
| 71 | + post.setConfig(requestConfig); | ||
| 72 | + post.setEntity((new StringEntity(data, "UTF-8"))); | ||
| 73 | + | ||
| 74 | + response = httpClient.execute(post); | ||
| 75 | + stringBuffer = getResult(response.getEntity()); | ||
| 76 | + } catch (Exception e) { | ||
| 77 | + logger.error("", e); | ||
| 78 | + } finally { | ||
| 79 | + if (null != httpClient) | ||
| 80 | + httpClient.close(); | ||
| 81 | + if (null != response) | ||
| 82 | + response.close(); | ||
| 83 | + } | ||
| 84 | + return stringBuffer; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + private static StringBuilder getResult(HttpEntity entity) throws IOException { | ||
| 88 | + StringBuilder stringBuffer = null; | ||
| 89 | + if (null != entity) { | ||
| 90 | + BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | ||
| 91 | + stringBuffer = new StringBuilder(); | ||
| 92 | + String str = ""; | ||
| 93 | + while ((str = br.readLine()) != null) | ||
| 94 | + stringBuffer.append(str); | ||
| 95 | + } | ||
| 96 | + return stringBuffer; | ||
| 97 | + } | ||
| 98 | +} |
src/main/java/com/bsth/util/RoadCutDoubleName.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONArray; | ||
| 5 | +import com.alibaba.fastjson.JSONObject; | ||
| 6 | +import com.bsth.entity.LonLatName; | ||
| 7 | +import com.bsth.util.TransGPS.Location; | ||
| 8 | +import com.bsth.util.TransGPS; | ||
| 9 | + | ||
| 10 | +import java.net.URLEncoder; | ||
| 11 | +import java.util.*; | ||
| 12 | + | ||
| 13 | +public class RoadCutDoubleName { | ||
| 14 | + | ||
| 15 | + // 存放获取交点的经纬度,路段名字 | ||
| 16 | + static ArrayList<LonLatName> al = new ArrayList<LonLatName>(); | ||
| 17 | + | ||
| 18 | + public static Map<String, Object> start(String sectionStr) throws Exception { | ||
| 19 | + | ||
| 20 | + al.clear(); | ||
| 21 | + // 存放过滤后返还会来的list集合 | ||
| 22 | + ArrayList dl = new ArrayList(); | ||
| 23 | + | ||
| 24 | + String fy = URLEncoder.encode("|", "utf-8"); | ||
| 25 | + String lL = baiduToGoogle(sectionStr); | ||
| 26 | + String[] lonLat = lL.split(";"); | ||
| 27 | + | ||
| 28 | + int number = 0; | ||
| 29 | + if (lonLat.length % 20 == 0) { | ||
| 30 | + number = lonLat.length / 20; | ||
| 31 | + } else { | ||
| 32 | + number = lonLat.length / 20 + 1; | ||
| 33 | + } | ||
| 34 | + int middle = 0; | ||
| 35 | + int max = 20; | ||
| 36 | + if (lonLat.length >= 20) { | ||
| 37 | + for (int NOT = 1; NOT <= number; NOT++) { | ||
| 38 | + String Ol = ""; | ||
| 39 | + if (NOT < number) { | ||
| 40 | + for (int min = middle; min < max; min++) { | ||
| 41 | + if (min < max - 1) { | ||
| 42 | + Ol += lonLat[min] + fy; | ||
| 43 | + } else { | ||
| 44 | + Ol += lonLat[min]; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + dl = getData(Ol,al); | ||
| 48 | + middle = max; | ||
| 49 | + max += 20; | ||
| 50 | + } else { | ||
| 51 | + for (int min = middle; min < lonLat.length; min++) { | ||
| 52 | + if (min < lonLat.length - 1) { | ||
| 53 | + Ol += lonLat[min] + fy; | ||
| 54 | + } else { | ||
| 55 | + Ol += lonLat[min]; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + dl = getData(Ol,al); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + } else { | ||
| 62 | + String Ol = ""; | ||
| 63 | + for (int min = middle; min < lonLat.length; min++) { | ||
| 64 | + if (min < lonLat.length - 1) { | ||
| 65 | + Ol += lonLat[min] + fy; | ||
| 66 | + } else { | ||
| 67 | + Ol += lonLat[min]; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + dl = getData(Ol,al); | ||
| 71 | + } | ||
| 72 | + // 将原有的经纬度数组转换为list集合 | ||
| 73 | + ArrayList<Location> el = new ArrayList<>(); | ||
| 74 | + for (int j = 0; j < lonLat.length; j++) { | ||
| 75 | + String lon[] = lonLat[j].split(","); | ||
| 76 | + Location point = new Location(); | ||
| 77 | + point.setLng(Double.valueOf(lon[0])); | ||
| 78 | + point.setLat(Double.valueOf(lon[1])); | ||
| 79 | + el.add(point); | ||
| 80 | + } | ||
| 81 | + ArrayList<Location> gl = new ArrayList<>(); | ||
| 82 | + for (int k = 0; k < dl.size(); k += 4) { | ||
| 83 | + Location point = new Location(); | ||
| 84 | + String object = (String) dl.get(k); | ||
| 85 | + String[] split = object.split(","); | ||
| 86 | + point.setLng(Double.valueOf(split[0])); | ||
| 87 | + point.setLat(Double.valueOf(split[1])); | ||
| 88 | + gl.add(point); | ||
| 89 | + } | ||
| 90 | + // 将做过处理的百度坐标与过滤后的交点坐标存入,传给垂足获取方法 | ||
| 91 | + ArrayList fl = new ArrayList(); | ||
| 92 | + // 路的坐标点 | ||
| 93 | + fl.add(0, el); | ||
| 94 | + // 路的交点 | ||
| 95 | + fl.add(1, gl); | ||
| 96 | + List returnData = returnData(fl); | ||
| 97 | + ArrayList<Location> pointList = new ArrayList<>(); | ||
| 98 | + for (int x = 0; x < returnData.size(); x++) { | ||
| 99 | + List<Location> aList = new ArrayList<>(); | ||
| 100 | + aList = (List<Location>) returnData.get(x); | ||
| 101 | + for (int z = 0; z < aList.size(); z++) { | ||
| 102 | + Location point = new Location(); | ||
| 103 | + Location location = aList.get(z); | ||
| 104 | + point.setLng(location.getLng()); | ||
| 105 | + point.setLat(location.getLat()); | ||
| 106 | + pointList.add(point); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + /* | ||
| 110 | + * 垂足返还的数据中每三条为一个交点,第一经纬度为前,第二为后,第三为原交点的垂足 | ||
| 111 | + * 下面循环会将返还的数据按前经纬度与返还数据的第一经纬度相匹配 将返还数据的第三个经纬度按顺序插入进去 | ||
| 112 | + */ | ||
| 113 | + // lonLat:转换为高德的坐标点数组 | ||
| 114 | + for (int t = 0; t < pointList.size(); t += 3) { | ||
| 115 | + Location pl = (Location) pointList.get(t); | ||
| 116 | + Location newPl = (Location) pointList.get(t + 1); | ||
| 117 | + // 判断切点是否添加成功 | ||
| 118 | + boolean type = false; | ||
| 119 | + // pointList:包含前后垂足的集合,每三个一个轮回 | ||
| 120 | + for (int o = 0; o < el.size() - 1; o++) { | ||
| 121 | + Location location1 = el.get(o); | ||
| 122 | + Location location2 = el.get(o + 1); | ||
| 123 | + if (location1.getLng() == pl.getLng() && location1.getLat() == pl.getLat() | ||
| 124 | + && location2.getLng() == newPl.getLng() && location2.getLat() == newPl.getLat()) { | ||
| 125 | + if (o < el.size() - 1) { | ||
| 126 | + // el:存放原始坐标Location对象的集合 | ||
| 127 | + el.add(o + 1, (Location) pointList.get(t + 2)); | ||
| 128 | + type = true; | ||
| 129 | + break; | ||
| 130 | + } else { | ||
| 131 | + el.add(o, (Location) pointList.get(t + 2)); | ||
| 132 | + type = true; | ||
| 133 | + break; | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + // 防止在同一线段下的两个切点会只添加一个 | ||
| 138 | + if (!type) { | ||
| 139 | + for (int o = 0; o < el.size(); o++) { | ||
| 140 | + Location location = el.get(o); | ||
| 141 | + if (location.getLng() == newPl.getLng() && location.getLat() == newPl.getLat()) { | ||
| 142 | + el.add(o, (Location) pointList.get(t + 2)); | ||
| 143 | + type = true; | ||
| 144 | + break; | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + // 通过返还的垂足数据,将原有的中间点给替换掉 | ||
| 150 | + int w = 0; | ||
| 151 | + for (int q = 2; q < pointList.size(); q += 3) { | ||
| 152 | + Location pL = (Location) pointList.get(q); | ||
| 153 | + dl.set(w, pL.getLng() + "," + pL.getLat()); | ||
| 154 | + w += 4; | ||
| 155 | + } | ||
| 156 | + // 对替换后的location进行路名拼接,十个点则应拼接出九个路段路名 | ||
| 157 | + // 若location获取的路名不符合规则,则返还“(-)” | ||
| 158 | + int maxOne = 2; | ||
| 159 | + int maxTwo = 6; | ||
| 160 | + int minOne = 1; | ||
| 161 | + int minTwo = 5; | ||
| 162 | + String theMainRoad = ""; | ||
| 163 | + String theFirstRoad = ""; | ||
| 164 | + String theSecondRoad = ""; | ||
| 165 | + List<String> roadName = new ArrayList<>(); | ||
| 166 | + for (int d = maxTwo; d < dl.size();) { | ||
| 167 | + boolean buff = false; | ||
| 168 | + // 若两段路名中含有相同的路名,则此路名作为主路名 | ||
| 169 | + for (int h = minOne; h <= maxOne; h++) { | ||
| 170 | + for (int f = minTwo; f <= maxTwo; f++) { | ||
| 171 | + if (dl.get(h).equals(dl.get(f))) { | ||
| 172 | + theMainRoad = dl.get(h).toString(); | ||
| 173 | + buff = true; | ||
| 174 | + break; | ||
| 175 | + } else { | ||
| 176 | + theMainRoad = ""; | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + if (buff) { | ||
| 180 | + break; | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + // 获取主路名后,将主路名不为空的进行拼接 | ||
| 184 | + // 规则为:两段路名的firstName和secondName不与主路名相同 | ||
| 185 | + // 存入roadName列表且按数序包含无法进行拼接的路名返回值为“(-)” | ||
| 186 | + for (int h = minOne; h <= maxOne; h++) { | ||
| 187 | + for (int f = minTwo; f <= maxTwo; f++) { | ||
| 188 | + if (!theMainRoad.equals("")) { | ||
| 189 | + if (!dl.get(h).equals(theMainRoad)) { | ||
| 190 | + theFirstRoad = dl.get(h).toString(); | ||
| 191 | + if (!dl.get(f).equals(theMainRoad)) { | ||
| 192 | + theSecondRoad = dl.get(f).toString(); | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + } else { | ||
| 196 | + theFirstRoad = ""; | ||
| 197 | + theSecondRoad = ""; | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + minOne += 4; | ||
| 202 | + minTwo += 4; | ||
| 203 | + maxOne += 4; | ||
| 204 | + maxTwo += 4; | ||
| 205 | + d = maxTwo; | ||
| 206 | + roadName.add(theMainRoad + "(" + theFirstRoad + "-" + theSecondRoad + ")"); | ||
| 207 | + } | ||
| 208 | + // 将所有经纬度列表进行重复过滤 | ||
| 209 | + for (int i = 0; i < el.size() - 1; i++) { | ||
| 210 | + Location location = el.get(i); | ||
| 211 | + for (int j = i + 1; j < el.size(); j++) { | ||
| 212 | + Location location2 = el.get(j); | ||
| 213 | + if (location.getLng() == location2.getLng() && location.getLat() == location2.getLat()) { | ||
| 214 | + el.remove(j); | ||
| 215 | + break; | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + // 用来区分此线路的开始是否等于location的第一个点 | ||
| 220 | + boolean buff = false; | ||
| 221 | + //将路名roadName与路段roadNumber添加进theFrontDesk返还给前台 | ||
| 222 | + Map<String, Object> theFrontDesk = new HashMap<>(); | ||
| 223 | + // 若坐标组的第一个坐标与交点的第一个不相同,就说明实际规划出的线路条数+1 | ||
| 224 | + // 此方法的作用就是用来避免线路名称与线路不对称 | ||
| 225 | + if(dl.size() != 0) { | ||
| 226 | + String firstLocation = (String) dl.get(0); | ||
| 227 | + String[] firstLocationSplit = firstLocation.split(","); | ||
| 228 | + Location firstOfAll = el.get(0); | ||
| 229 | + if (firstOfAll.getLng() != Double.valueOf(firstLocationSplit[0]) | ||
| 230 | + && firstOfAll.getLat() != Double.valueOf(firstLocationSplit[1])) { | ||
| 231 | + roadName.add(0, "(-)"); | ||
| 232 | + buff = true; | ||
| 233 | + } | ||
| 234 | + String lastLocation = (String) dl.get(dl.size() - 4); | ||
| 235 | + String[] lastLocationSplit = lastLocation.split(","); | ||
| 236 | + Location lastOfAll = el.get(el.size() - 1); | ||
| 237 | + if (lastOfAll.getLng() != Double.valueOf(lastLocationSplit[0]) | ||
| 238 | + && lastOfAll.getLat() != Double.valueOf(lastLocationSplit[1])) { | ||
| 239 | + roadName.add(roadName.size(), "(-)"); | ||
| 240 | + } | ||
| 241 | + //切分路段,有两种情况,路段的第一个经纬度既是切点,则从第二个点开始计算 | ||
| 242 | + //路段的前几个点是多余的点 则将其保留,并且上面的方法就是用来防止第一个路段路名错误 | ||
| 243 | + List roadNumber = new ArrayList(); | ||
| 244 | + if (buff) { | ||
| 245 | + int logo = 0; | ||
| 246 | + for (int j = 0; j < dl.size(); j += 4) { | ||
| 247 | + List wayNumber = new ArrayList(); | ||
| 248 | + String object = (String) dl.get(j); | ||
| 249 | + String[] split = object.split(","); | ||
| 250 | + for (int i = logo; i < el.size(); i++) { | ||
| 251 | + Location location = el.get(i); | ||
| 252 | + wayNumber.add(el.get(i)); | ||
| 253 | + if (location.getLng() == Double.valueOf(split[0]) | ||
| 254 | + && location.getLat() == Double.valueOf(split[1])) { | ||
| 255 | + logo = i; | ||
| 256 | + roadNumber.add(wayNumber); | ||
| 257 | + break; | ||
| 258 | + } | ||
| 259 | + if(i == el.size()-1){ | ||
| 260 | + logo = i; | ||
| 261 | + roadNumber.add(wayNumber); | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + }else{ | ||
| 266 | + int logo = 0; | ||
| 267 | + for (int j = 4; j < dl.size(); j += 4) { | ||
| 268 | + List wayNumber = new ArrayList(); | ||
| 269 | + String object = (String) dl.get(j); | ||
| 270 | + String[] split = object.split(","); | ||
| 271 | + for (int i = logo; i < el.size(); i++) { | ||
| 272 | + Location location = el.get(i); | ||
| 273 | + wayNumber.add(el.get(i)); | ||
| 274 | + if (location.getLng() == Double.valueOf(split[0]) | ||
| 275 | + && location.getLat() == Double.valueOf(split[1])) { | ||
| 276 | + logo = i; | ||
| 277 | + roadNumber.add(wayNumber); | ||
| 278 | + break; | ||
| 279 | + } | ||
| 280 | + if(i == el.size()-1){ | ||
| 281 | + logo = i; | ||
| 282 | + roadNumber.add(wayNumber); | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + List bSections = googleToBaidu(roadNumber); | ||
| 288 | + //将路名roadName与路段roadNumber添加进theFrontDesk返还给前台 | ||
| 289 | +// List theFrontDesk = new ArrayList(); | ||
| 290 | + theFrontDesk.put("roadName",roadName); | ||
| 291 | + theFrontDesk.put("bSections",bSections); | ||
| 292 | + for(int i =0;i<bSections.size();i++){ | ||
| 293 | + List<Location> rn = new ArrayList<>(); | ||
| 294 | + rn = (List<Location>) bSections.get(i); | ||
| 295 | + System.out.println("第"+(i+1)+"条路"); | ||
| 296 | + System.out.println(roadName.get(i)); | ||
| 297 | + for(int j=0;j<rn.size();j++){ | ||
| 298 | + Location object = (Location) rn.get(j); | ||
| 299 | + System.out.println(object.getLng()+" "+object.getLat()+";"); | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + return theFrontDesk; | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + public static ArrayList<LonLatName> getData(String Ol,ArrayList<LonLatName> al) throws Exception { | ||
| 308 | + // 将去重后的list列表添加进来 | ||
| 309 | + ArrayList cl = new ArrayList(); | ||
| 310 | + StringBuilder sb = HttpClientUtils.get("http://restapi.amap.com/v3/geocode/regeo?output=json&location=" + Ol | ||
| 311 | + + "&key=ae7b43460cab274a8702b55640f9a5a7&radius=0&extensions=all&batch=true&roadlevel=1"); | ||
| 312 | + JSONObject jsonarr = JSON.parseObject(sb.toString()); | ||
| 313 | + JSONArray regeocodes = jsonarr.getJSONArray("regeocodes"); | ||
| 314 | + | ||
| 315 | + for (int a = 0; a < regeocodes.size(); a++) { | ||
| 316 | + LonLatName lln = new LonLatName(); | ||
| 317 | + JSONObject json = (JSONObject) regeocodes.get(a); | ||
| 318 | + JSONArray roadinters = json.getJSONArray("roadinters"); | ||
| 319 | + JSONArray roads = json.getJSONArray("roads"); | ||
| 320 | + JSONObject jsonObject = roadinters.getJSONObject(0); | ||
| 321 | + JSONObject roadsObject = roads.getJSONObject(0); | ||
| 322 | + lln.setFirst_name(jsonObject.getString("first_name")); | ||
| 323 | + lln.setSecond_name(jsonObject.getString("second_name")); | ||
| 324 | + lln.setLocation(jsonObject.getString("location")); | ||
| 325 | + lln.setWay_name(roadsObject.getString("name")); | ||
| 326 | + al.add(lln); | ||
| 327 | + } | ||
| 328 | + int a = 0; | ||
| 329 | + for (int b = 1; b < al.size(); b++) { | ||
| 330 | + if (al.get(b).getWay_name().equals(al.get(b).getFirst_name()) | ||
| 331 | + || al.get(b).getWay_name().equals(al.get(b).getSecond_name())) { | ||
| 332 | + if (b == 1) { | ||
| 333 | + cl.add(al.get(a).getLocation()); | ||
| 334 | + cl.add(al.get(a).getFirst_name()); | ||
| 335 | + cl.add(al.get(a).getSecond_name()); | ||
| 336 | + cl.add(al.get(a).getWay_name()); | ||
| 337 | + } | ||
| 338 | + if (!al.get(a).getLocation().equals(al.get(b).getLocation())) { | ||
| 339 | + | ||
| 340 | + cl.add(al.get(b).getLocation()); | ||
| 341 | + cl.add(al.get(b).getFirst_name()); | ||
| 342 | + cl.add(al.get(b).getSecond_name()); | ||
| 343 | + cl.add(al.get(b).getWay_name()); | ||
| 344 | + a = b; | ||
| 345 | + } | ||
| 346 | + } | ||
| 347 | + } | ||
| 348 | + return cl; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + // 处理所有的切点(用每个切点去匹配到整条路段上最近的点) | ||
| 352 | + public static List returnData(ArrayList twoList) { | ||
| 353 | +// List<Location> aList = new ArrayList<>(); | ||
| 354 | +// List<Location> wip = new ArrayList<>(); | ||
| 355 | + // 路的坐标点 | ||
| 356 | + List<Location> aList = (List<Location>) twoList.get(0); | ||
| 357 | + // 路的交点 | ||
| 358 | + List<Location> wip = (List<Location>) twoList.get(1); | ||
| 359 | + List<List<Location>> list = new ArrayList<>(); | ||
| 360 | + for (int j = 0; j < wip.size(); j++) { | ||
| 361 | + Map<Double, List<Location>> points = new HashMap<>(); | ||
| 362 | + for (int i = 1; i < aList.size(); i++) { | ||
| 363 | + // 获取最近点为切点 | ||
| 364 | + points.putAll(ClosestPoint.GetNearestDistance(aList.get(i - 1), aList.get(i), wip.get(j))); | ||
| 365 | + } | ||
| 366 | + // points 为返回的所有切点的集合 | ||
| 367 | + Object[] obj = points.keySet().toArray(); | ||
| 368 | + Arrays.sort(obj); | ||
| 369 | + list.add(j,points.get(obj[0])); | ||
| 370 | + } | ||
| 371 | + return list; | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + // 百度坐标解密位高德 | ||
| 375 | + public static String baiduToGoogle(String sectionStr) { | ||
| 376 | + String gdLL=""; | ||
| 377 | +// String lL = "121.531301,31.211823;121.532438,31.213784;121.532438,31.213784;121.535025,31.213764;121.535095,31.213765;121.535702,31.213757;121.536388,31.21375;121.537383,31.213699;121.53802,31.213711;121.538408,31.213709;121.538478,31.21371;121.538955,31.213699;121.540289,31.213714;121.540826,31.213724;121.541543,31.213718;121.542867,31.213552;121.542976,31.213534;121.543245,31.213489;121.544787,31.213256;121.546102,31.213059;121.546221,31.213041;121.546898,31.212892;121.547445,31.212691;121.547724,31.212566;121.54855,31.212099;121.549466,31.211432;121.550113,31.210802;121.550402,31.210576;121.551437,31.20911;121.551486,31.209031;121.551795,31.208585;121.552282,31.207861;121.552641,31.207316;121.5528,31.207088;121.552959,31.20685;121.553009,31.20678;121.553357,31.206235;121.553626,31.205898;121.553696,31.205939;121.553696,31.205936;121.554105,31.206171;121.555941,31.207121;121.555941,31.207121;121.556021,31.207202;121.556719,31.207589;121.557458,31.208006;121.557538,31.208116;121.557538,31.208116;121.558047,31.208401;121.559076,31.208909;121.559625,31.209182;121.559865,31.209304;121.560744,31.209599;121.560904,31.20966;121.562362,31.209967;121.563621,31.210132;121.563951,31.210132;121.56675,31.210135;121.569371,31.210191;121.570593,31.210377;121.573087,31.211114;121.573437,31.211241;121.57461,31.211763;121.577197,31.21297;121.577458,31.213077;121.577458,31.213077;121.57805,31.213351;121.57805,31.213351;121.58085,31.214638;121.58097,31.214686;121.58097,31.214686;121.583581,31.21581;121.584605,31.216194;121.584967,31.216339;121.585961,31.216703;121.586393,31.216806;121.587398,31.217059;121.588342,31.217293;121.588744,31.217386;121.58998,31.217694;121.590814,31.217889;121.590915,31.217918;121.591548,31.218056;121.591648,31.218084;121.593065,31.218388;121.593517,31.21854;121.59393,31.218762;121.594704,31.219287;121.596986,31.220814;121.59766,31.221212;121.598001,31.221375;121.600474,31.222169;121.600544,31.222198;121.600574,31.222207;121.600685,31.222245;121.603348,31.223057;121.605639,31.223607;121.605638,31.223607;121.605648,31.223537;121.605698,31.222176;121.605787,31.221004;121.606055,31.216939;121.606324,31.213734;121.606373,31.212813;121.606522,31.21086;121.606611,31.210048;121.606621,31.209968;121.606772,31.209986;121.606772,31.209985;121.608479,31.210248;121.60864,31.210265;121.60864,31.210265;121.60871,31.210014"; | ||
| 378 | + System.out.println(sectionStr); | ||
| 379 | + String lonLat[] = sectionStr.split(";"); | ||
| 380 | + for (int a = 0; a < lonLat.length; a++) { | ||
| 381 | + String[] split = lonLat[a].split(","); | ||
| 382 | + Location locationMake = TransGPS.LocationMake(Double.valueOf(split[0]), Double.valueOf(split[1])); | ||
| 383 | + Location gd_decrypt = TransGPS.bd_decrypt(locationMake); | ||
| 384 | + if (a < lonLat.length - 1) { | ||
| 385 | + gdLL += gd_decrypt.getLng() + "," + gd_decrypt.getLat() + ";"; | ||
| 386 | + } else { | ||
| 387 | + gdLL += gd_decrypt.getLng() + "," + gd_decrypt.getLat(); | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + return gdLL; | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + // 高德坐标加密位百度 | ||
| 396 | + public static List googleToBaidu(List list) { | ||
| 397 | + List roadNumber = new ArrayList(); | ||
| 398 | + for(int i =0;i<list.size();i++){ | ||
| 399 | + String lL = ""; | ||
| 400 | + List wayNumber = new ArrayList(); | ||
| 401 | + List<Location> rn = new ArrayList<>(); | ||
| 402 | + rn = (List<Location>) list.get(i); | ||
| 403 | + for(int j=0;j<rn.size();j++){ | ||
| 404 | + Location object = (Location) rn.get(j); | ||
| 405 | + if(j<rn.size()-1){ | ||
| 406 | + lL += object.getLng()+","+object.getLat()+";"; | ||
| 407 | + }else{ | ||
| 408 | + lL += object.getLng()+","+object.getLat(); | ||
| 409 | + } | ||
| 410 | + } | ||
| 411 | + String lonLat[] = lL.split(";"); | ||
| 412 | + for (int a = 0; a < lonLat.length; a++) { | ||
| 413 | + String[] split = lonLat[a].split(","); | ||
| 414 | + Location locationMake = TransGPS.LocationMake(Double.valueOf(split[0]), Double.valueOf(split[1])); | ||
| 415 | + Location bd_encrypt = TransGPS.bd_encrypt(locationMake); | ||
| 416 | + wayNumber.add(bd_encrypt); | ||
| 417 | + } | ||
| 418 | + roadNumber.add(wayNumber); | ||
| 419 | + } | ||
| 420 | + | ||
| 421 | + return roadNumber; | ||
| 422 | + } | ||
| 423 | +} | ||
| 0 | \ No newline at end of file | 424 | \ No newline at end of file |
src/main/resources/static/pages/base/carpark/js/carpark-list-table.js
| @@ -24,7 +24,25 @@ | @@ -24,7 +24,25 @@ | ||
| 24 | return cb && cb(gs_d); | 24 | return cb && cb(gs_d); |
| 25 | }); | 25 | }); |
| 26 | } | 26 | } |
| 27 | - initCompanySelect2(function(array) { | 27 | + // 营运公司Map[key(businessCode)] = 名字 |
| 28 | + var companyMap = new Map(); | ||
| 29 | + // 分公司Map[key(upCode+_+businessCode)] = 名字 | ||
| 30 | + var branchMap = new Map(); | ||
| 31 | + initCompanySelect2(function(array) { | ||
| 32 | + $.each(array, function() { | ||
| 33 | + companyMap[this.businessCode] = this.businessName; | ||
| 34 | + // companyMap.put(this.businessCode.toString(), this.businessName); | ||
| 35 | + if(this.businessCode != null || this.businessCode !=''){ | ||
| 36 | + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */ | ||
| 37 | + $get('/business/all', {upCode_eq: this.businessCode}, function(array){ | ||
| 38 | + // 遍历array | ||
| 39 | + $.each(array, function(i,d){ | ||
| 40 | + branchMap[this.upCode+"_"+this.businessCode] = this.businessName; | ||
| 41 | + // branchMap.put(this.upCode+"_"+this.businessCode, this.businessName); | ||
| 42 | + }); | ||
| 43 | + }); | ||
| 44 | + } | ||
| 45 | + }); | ||
| 28 | // 公司下拉options属性值 | 46 | // 公司下拉options属性值 |
| 29 | var options = '<option value="">请选择...</option>'; | 47 | var options = '<option value="">请选择...</option>'; |
| 30 | // 遍历array | 48 | // 遍历array |
| @@ -202,6 +220,10 @@ | @@ -202,6 +220,10 @@ | ||
| 202 | $.get('/carpark',params,function(result){ | 220 | $.get('/carpark',params,function(result){ |
| 203 | // 添加序号 | 221 | // 添加序号 |
| 204 | result.content.page = page; | 222 | result.content.page = page; |
| 223 | + $.each(result.content, function(i, data) { | ||
| 224 | + result.content[i].gsmc = companyMap[data.company]; | ||
| 225 | + result.content[i].fgsmc = branchMap[data.cgsbm]; | ||
| 226 | + }); | ||
| 205 | // 把数据填充到模版中 | 227 | // 把数据填充到模版中 |
| 206 | var tbodyHtml = template('carpark_list_table_temp',{list:result.content}); | 228 | var tbodyHtml = template('carpark_list_table_temp',{list:result.content}); |
| 207 | $('#datatable_carpark tbody').html(tbodyHtml); | 229 | $('#datatable_carpark tbody').html(tbodyHtml); |
src/main/resources/static/pages/base/carpark/list.html
| @@ -114,7 +114,8 @@ | @@ -114,7 +114,8 @@ | ||
| 114 | {{obj.area}} | 114 | {{obj.area}} |
| 115 | </td> | 115 | </td> |
| 116 | <td> | 116 | <td> |
| 117 | - {{if obj.company == '55'}} | 117 | + {{obj.gsmc}} |
| 118 | + <!--{{if obj.company == '55'}} | ||
| 118 | 上南公司 | 119 | 上南公司 |
| 119 | {{else if obj.company == '22'}} | 120 | {{else if obj.company == '22'}} |
| 120 | 金高公司 | 121 | 金高公司 |
| @@ -124,10 +125,11 @@ | @@ -124,10 +125,11 @@ | ||
| 124 | 南汇公司 | 125 | 南汇公司 |
| 125 | {{else if obj.company == '77'}} | 126 | {{else if obj.company == '77'}} |
| 126 | 闵行公司 | 127 | 闵行公司 |
| 127 | - {{/if}} | 128 | + {{/if}}--> |
| 128 | </td> | 129 | </td> |
| 129 | <td> | 130 | <td> |
| 130 | - {{if obj.company == '55'}} | 131 | + {{obj.fgsmc}} |
| 132 | + <!--{{if obj.company == '55'}} | ||
| 131 | 133 | ||
| 132 | {{if obj.brancheCompany == '1'}} | 134 | {{if obj.brancheCompany == '1'}} |
| 133 | 上南二分公司 | 135 | 上南二分公司 |
| @@ -179,7 +181,7 @@ | @@ -179,7 +181,7 @@ | ||
| 179 | 南汇公司 | 181 | 南汇公司 |
| 180 | {{/if}} | 182 | {{/if}} |
| 181 | 183 | ||
| 182 | - {{/if}} | 184 | + {{/if}}--> |
| 183 | </td> | 185 | </td> |
| 184 | <td> | 186 | <td> |
| 185 | {{obj.versions}} | 187 | {{obj.versions}} |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -44,7 +44,25 @@ | @@ -44,7 +44,25 @@ | ||
| 44 | setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); | 44 | setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); |
| 45 | },200); | 45 | },200); |
| 46 | } | 46 | } |
| 47 | + // 营运公司Map[key(businessCode)] = 名字 | ||
| 48 | + var companyMap = new Map(); | ||
| 49 | + // 分公司Map[key(upCode+_+businessCode)] = 名字 | ||
| 50 | + var branchMap = new Map(); | ||
| 47 | initCompanySelect2(function(array) { | 51 | initCompanySelect2(function(array) { |
| 52 | + $.each(array, function() { | ||
| 53 | + companyMap[this.businessCode] = this.businessName; | ||
| 54 | + // companyMap.put(this.businessCode.toString(), this.businessName); | ||
| 55 | + if(this.businessCode != null || this.businessCode !=''){ | ||
| 56 | + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */ | ||
| 57 | + $get('/business/all', {upCode_eq: this.businessCode}, function(array){ | ||
| 58 | + // 遍历array | ||
| 59 | + $.each(array, function(i,d){ | ||
| 60 | + branchMap[this.upCode+"_"+this.businessCode] = this.businessName; | ||
| 61 | + // branchMap.put(this.upCode+"_"+this.businessCode, this.businessName); | ||
| 62 | + }); | ||
| 63 | + }); | ||
| 64 | + } | ||
| 65 | + }); | ||
| 48 | // 公司下拉options属性值 | 66 | // 公司下拉options属性值 |
| 49 | var options = '<option value="">请选择...</option>'; | 67 | var options = '<option value="">请选择...</option>'; |
| 50 | // 遍历array | 68 | // 遍历array |
| @@ -184,7 +202,11 @@ | @@ -184,7 +202,11 @@ | ||
| 184 | $.get('/line',params,function(result){ | 202 | $.get('/line',params,function(result){ |
| 185 | // 添加序号 | 203 | // 添加序号 |
| 186 | result.content.page = page; | 204 | result.content.page = page; |
| 187 | - // 把数据填充到模版中 | 205 | + $.each(result.content, function(i, data) { |
| 206 | + result.content[i].gsmc = companyMap[data.company]; | ||
| 207 | + result.content[i].fgsmc = branchMap[data.cgsbm]; | ||
| 208 | + }); | ||
| 209 | + // 把数据填充到模版中 | ||
| 188 | var tbodyHtml = template('line_list_temp',{list:result.content}); | 210 | var tbodyHtml = template('line_list_temp',{list:result.content}); |
| 189 | // 把渲染好的模版html文本追加到表格中 | 211 | // 把渲染好的模版html文本追加到表格中 |
| 190 | $('#datatable_line tbody').html(tbodyHtml); | 212 | $('#datatable_line tbody').html(tbodyHtml); |
src/main/resources/static/pages/base/line/list.html
| @@ -232,7 +232,8 @@ | @@ -232,7 +232,8 @@ | ||
| 232 | {{obj.name}} | 232 | {{obj.name}} |
| 233 | </td> | 233 | </td> |
| 234 | <td> | 234 | <td> |
| 235 | - {{if obj.company == '55'}} | 235 | + {{obj.gsmc}} |
| 236 | + <!--{{if obj.company == '55'}} | ||
| 236 | 上南公司 | 237 | 上南公司 |
| 237 | {{else if obj.company == '22'}} | 238 | {{else if obj.company == '22'}} |
| 238 | 金高公司 | 239 | 金高公司 |
| @@ -242,10 +243,11 @@ | @@ -242,10 +243,11 @@ | ||
| 242 | 南汇公司 | 243 | 南汇公司 |
| 243 | {{else if obj.company == '77'}} | 244 | {{else if obj.company == '77'}} |
| 244 | 闵行公司 | 245 | 闵行公司 |
| 245 | - {{/if}} | 246 | + {{/if}}--> |
| 246 | </td> | 247 | </td> |
| 247 | <td> | 248 | <td> |
| 248 | - {{if obj.company == '55'}} | 249 | + {{obj.fgsmc}} |
| 250 | + <!--{{if obj.company == '55'}} | ||
| 249 | 251 | ||
| 250 | {{if obj.brancheCompany == '1'}} | 252 | {{if obj.brancheCompany == '1'}} |
| 251 | 上南二分公司 | 253 | 上南二分公司 |
| @@ -299,7 +301,7 @@ | @@ -299,7 +301,7 @@ | ||
| 299 | 航头枢纽站 | 301 | 航头枢纽站 |
| 300 | {{/if}} | 302 | {{/if}} |
| 301 | 303 | ||
| 302 | - {{/if}} | 304 | + {{/if}}--> |
| 303 | </td> | 305 | </td> |
| 304 | <td> | 306 | <td> |
| 305 | {{if obj.nature == 'lj'}} | 307 | {{if obj.nature == 'lj'}} |
| @@ -347,6 +349,7 @@ | @@ -347,6 +349,7 @@ | ||
| 347 | <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> | 349 | <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> |
| 348 | </td> | 350 | </td> |
| 349 | <td> | 351 | <td> |
| 352 | + <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看1</a> | ||
| 350 | <a href="javascript:window.localStorage.setItem('geo_data_edit_line_code' , '{{obj.lineCode}}');window.localStorage.removeItem('geo_data_edit_line_version');window.location.href='/pages/base/geo_data_edit/uk3_wrap.html';" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> | 353 | <a href="javascript:window.localStorage.setItem('geo_data_edit_line_code' , '{{obj.lineCode}}');window.localStorage.removeItem('geo_data_edit_line_version');window.location.href='/pages/base/geo_data_edit/uk3_wrap.html';" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> |
| 351 | </td> | 354 | </td> |
| 352 | <td> | 355 | <td> |
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js
| @@ -34,7 +34,25 @@ | @@ -34,7 +34,25 @@ | ||
| 34 | setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); | 34 | setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); |
| 35 | },200); | 35 | },200); |
| 36 | } | 36 | } |
| 37 | + // 营运公司Map[key(businessCode)] = 名字 | ||
| 38 | + var companyMap = new Map(); | ||
| 39 | + // 分公司Map[key(upCode+_+businessCode)] = 名字 | ||
| 40 | + var branchMap = new Map(); | ||
| 37 | initCompanySelect2(function(array) { | 41 | initCompanySelect2(function(array) { |
| 42 | + $.each(array, function() { | ||
| 43 | + companyMap[this.businessCode] = this.businessName; | ||
| 44 | + // companyMap.put(this.businessCode.toString(), this.businessName); | ||
| 45 | + if(this.businessCode != null || this.businessCode !=''){ | ||
| 46 | + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */ | ||
| 47 | + $get('/business/all', {upCode_eq: this.businessCode}, function(array){ | ||
| 48 | + // 遍历array | ||
| 49 | + $.each(array, function(i,d){ | ||
| 50 | + branchMap[this.upCode+"_"+this.businessCode] = this.businessName; | ||
| 51 | + // branchMap.put(this.upCode+"_"+this.businessCode, this.businessName); | ||
| 52 | + }); | ||
| 53 | + }); | ||
| 54 | + } | ||
| 55 | + }); | ||
| 38 | // 公司下拉options属性值 | 56 | // 公司下拉options属性值 |
| 39 | var options = '<option value="">请选择...</option>'; | 57 | var options = '<option value="">请选择...</option>'; |
| 40 | // 遍历array | 58 | // 遍历array |
| @@ -161,10 +179,12 @@ | @@ -161,10 +179,12 @@ | ||
| 161 | // 添加序号 | 179 | // 添加序号 |
| 162 | result.content.page = page; | 180 | result.content.page = page; |
| 163 | // 把数据填充到模版中 | 181 | // 把数据填充到模版中 |
| 164 | - $.each(result.content, function(){ | ||
| 165 | - this.startDateStr=moment(this.startDate).format('YYYY-MM-DD HH:mm:ss'); | ||
| 166 | - this.endDateStr=moment(this.endDate).format('YYYY-MM-DD HH:mm:ss'); | ||
| 167 | - }) | 182 | + $.each(result.content, function(i, data) { |
| 183 | + result.content[i].gsmc = companyMap[data.line.company]; | ||
| 184 | + result.content[i].fgsmc = branchMap[data.line.cgsbm]; | ||
| 185 | + data.startDateStr=moment(data.startDate).format('YYYY-MM-DD HH:mm:ss'); | ||
| 186 | + data.endDateStr=moment(data.endDate).format('YYYY-MM-DD HH:mm:ss'); | ||
| 187 | + }); | ||
| 168 | 188 | ||
| 169 | var tbodyHtml = template('lineversions_list_temp',{list:result.content}); | 189 | var tbodyHtml = template('lineversions_list_temp',{list:result.content}); |
| 170 | $('#datatable_lineversions tbody').html(tbodyHtml); | 190 | $('#datatable_lineversions tbody').html(tbodyHtml); |
src/main/resources/static/pages/base/lineversions/list.html
| @@ -118,7 +118,8 @@ | @@ -118,7 +118,8 @@ | ||
| 118 | {{obj.line.name}} | 118 | {{obj.line.name}} |
| 119 | </td> | 119 | </td> |
| 120 | <td> | 120 | <td> |
| 121 | - {{if obj.line.company == '55'}} | 121 | + {{obj.gsmc}} |
| 122 | + <!--{{if obj.line.company == '55'}} | ||
| 122 | 上南公司 | 123 | 上南公司 |
| 123 | {{else if obj.line.company == '22'}} | 124 | {{else if obj.line.company == '22'}} |
| 124 | 金高公司 | 125 | 金高公司 |
| @@ -128,10 +129,11 @@ | @@ -128,10 +129,11 @@ | ||
| 128 | 南汇公司 | 129 | 南汇公司 |
| 129 | {{else if obj.line.company == '77'}} | 130 | {{else if obj.line.company == '77'}} |
| 130 | 闵行公司 | 131 | 闵行公司 |
| 131 | - {{/if}} | 132 | + {{/if}}--> |
| 132 | </td> | 133 | </td> |
| 133 | <td> | 134 | <td> |
| 134 | - {{if obj.line.company == '55'}} | 135 | + {{obj.fgsmc}} |
| 136 | + <!--{{if obj.line.company == '55'}} | ||
| 135 | 137 | ||
| 136 | {{if obj.line.brancheCompany == '1'}} | 138 | {{if obj.line.brancheCompany == '1'}} |
| 137 | 上南二分公司 | 139 | 上南二分公司 |
| @@ -185,7 +187,7 @@ | @@ -185,7 +187,7 @@ | ||
| 185 | 航头枢纽站 | 187 | 航头枢纽站 |
| 186 | {{/if}} | 188 | {{/if}} |
| 187 | 189 | ||
| 188 | - {{/if}} | 190 | + {{/if}}--> |
| 189 | </td> | 191 | </td> |
| 190 | <td> | 192 | <td> |
| 191 | {{obj.startDateStr}} | 193 | {{obj.startDateStr}} |
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
| 1 | #bmap_basic{ | 1 | #bmap_basic{ |
| 2 | min-width: 100%; | 2 | min-width: 100%; |
| 3 | - width: calc(100% + 26px); | ||
| 4 | - margin-top: -28px; | 3 | + /*width: calc(100% + 26px); */ |
| 4 | + margin-top: -10px; | ||
| 5 | border: 2px solid #fdfdfd; | 5 | border: 2px solid #fdfdfd; |
| 6 | min-height: 1200px; | 6 | min-height: 1200px; |
| 7 | height:100%; | 7 | height:100%; |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | 10 | ||
| 11 | html,body{ | 11 | html,body{ |
| 12 | overflow:hidden; | 12 | overflow:hidden; |
| 13 | + height: 99%; | ||
| 13 | } | 14 | } |
| 14 | 15 | ||
| 15 | .rm3_image { | 16 | .rm3_image { |
| @@ -27,67 +28,64 @@ html,body{ | @@ -27,67 +28,64 @@ html,body{ | ||
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | .protlet-box{ | 30 | .protlet-box{ |
| 30 | - | ||
| 31 | - position: absolute; | ||
| 32 | - | ||
| 33 | - top: 40px; | ||
| 34 | - | 31 | + position: absolute; |
| 32 | + top: 30px; | ||
| 35 | margin-left: 10px; | 33 | margin-left: 10px; |
| 36 | - | ||
| 37 | overflow: hidden; | 34 | overflow: hidden; |
| 38 | - | ||
| 39 | width: 380px; | 35 | width: 380px; |
| 40 | - | ||
| 41 | height: auto; | 36 | height: auto; |
| 42 | - | ||
| 43 | background:transparent; | 37 | background:transparent; |
| 44 | - | ||
| 45 | border:0px solid; | 38 | border:0px solid; |
| 46 | - | ||
| 47 | box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33); | 39 | box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33); |
| 40 | + border-radius: 6px !important;box-shadow: 10px 10px 5px #888888; | ||
| 48 | } | 41 | } |
| 49 | 42 | ||
| 50 | -.BMap_pop div:nth-child(1) , | ||
| 51 | -.BMap_pop div:nth-child(2) , | ||
| 52 | -.BMap_pop div:nth-child(3) , | ||
| 53 | -.BMap_pop div:nth-child(4) , | ||
| 54 | -.BMap_pop div:nth-child(5) , | ||
| 55 | -.BMap_pop div:nth-child(6) , | ||
| 56 | -.BMap_pop div:nth-child(7) { | ||
| 57 | - | ||
| 58 | - border:0px solid rgb(255, 255, 255) !important; | ||
| 59 | - background-color:#3B3F51 !important; | ||
| 60 | - | 43 | +.help-block{ |
| 44 | + color:#000; | ||
| 45 | + font-size: 15px; | ||
| 61 | } | 46 | } |
| 62 | 47 | ||
| 63 | -.BMap_pop div:nth-child(3){ | ||
| 64 | - | ||
| 65 | - width:23px !important; | ||
| 66 | - | ||
| 67 | -} | 48 | +/*.BMap_pop div:nth-child(1) ,*/ |
| 49 | +/*.BMap_pop div:nth-child(2) ,*/ | ||
| 50 | +/*.BMap_pop div:nth-child(3) ,*/ | ||
| 51 | +/*.BMap_pop div:nth-child(4) ,*/ | ||
| 52 | +/*.BMap_pop div:nth-child(5) ,*/ | ||
| 53 | +/*.BMap_pop div:nth-child(6) ,*/ | ||
| 54 | +/*.BMap_pop div:nth-child(7) {*/ | ||
| 55 | + /**/ | ||
| 56 | + /*border:0px solid rgb(255, 255, 255) !important;*/ | ||
| 57 | + /*background-color:#3B3F51 !important;*/ | ||
| 58 | + /**/ | ||
| 59 | +/*}*/ | ||
| 68 | 60 | ||
| 69 | -.BMap_pop div:nth-child(7) { | ||
| 70 | - | ||
| 71 | - width:23px !important; | ||
| 72 | - | ||
| 73 | - height:24px !important; | ||
| 74 | - | ||
| 75 | -} | 61 | +/*.BMap_pop div:nth-child(3){*/ |
| 62 | + /**/ | ||
| 63 | + /*width:23px !important;*/ | ||
| 64 | + /**/ | ||
| 65 | +/*}*/ | ||
| 76 | 66 | ||
| 77 | -.BMap_pop div:nth-child(5) { | ||
| 78 | - | ||
| 79 | - height:24px !important; | ||
| 80 | - | ||
| 81 | -} | 67 | +/*.BMap_pop div:nth-child(7) {*/ |
| 68 | + /**/ | ||
| 69 | + /*width:23px !important;*/ | ||
| 70 | + /**/ | ||
| 71 | + /*height:24px !important;*/ | ||
| 72 | + /**/ | ||
| 73 | +/*}*/ | ||
| 74 | + | ||
| 75 | +/*.BMap_pop div:nth-child(5) {*/ | ||
| 76 | + /**/ | ||
| 77 | + /*height:24px !important;*/ | ||
| 78 | + /**/ | ||
| 79 | +/*}*/ | ||
| 82 | 80 | ||
| 83 | /* 图片以后在弄,先隐藏div */ | 81 | /* 图片以后在弄,先隐藏div */ |
| 84 | -.BMap_pop div:nth-child(8) { | ||
| 85 | - | ||
| 86 | - height:0px !important; | ||
| 87 | - /* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; */ | ||
| 88 | - /* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; */ | ||
| 89 | - | ||
| 90 | -} | 82 | +/*.BMap_pop div:nth-child(8) {*/ |
| 83 | + /**/ | ||
| 84 | + /*height:0px !important;*/ | ||
| 85 | + /*!* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; *!*/ | ||
| 86 | + /*!* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; *!*/ | ||
| 87 | + /**/ | ||
| 88 | +/*}*/ | ||
| 91 | 89 | ||
| 92 | .BMap_pop { | 90 | .BMap_pop { |
| 93 | 91 |
src/main/resources/static/pages/base/stationroute/css/img/bg.png
0 → 100644
2.95 KB
src/main/resources/static/pages/base/stationroute/doublename_road.html
0 → 100644
| 1 | +<!-- 生成双路名路段路段 --> | ||
| 2 | +<div class="modal fade" id="doublename_road_mobal" role="basic" aria-hidden="true" style="margin-top:10%"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 7 | + <h4 class="modal-title">选择生成路段的位置</h4> | ||
| 8 | + </div> | ||
| 9 | + <div class="modal-body"> | ||
| 10 | + <form class="form-horizontal" role="form" id="edit_section__form" action="/module" method="post"> | ||
| 11 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 12 | + 请选择上一路段! | ||
| 13 | + </div> | ||
| 14 | + <input type="hidden" name="versions" id="versionsInput"> | ||
| 15 | + <input type="hidden" name="directions" id="directionsSection"> | ||
| 16 | + <input type="hidden" name="lineId" id="lineId"> | ||
| 17 | + <input type="hidden" name="lineCode" id="lineCodeInput"> | ||
| 18 | + <input type="hidden" name="bsectionVector" id="bsectionVectorInput" /> | ||
| 19 | + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> | ||
| 20 | + <!-- 路段序号 --> | ||
| 21 | + <div class="form-body"> | ||
| 22 | + <div class="form-group"> | ||
| 23 | + <label class="control-label col-md-3"> | ||
| 24 | + 上一路段: | ||
| 25 | + </label> | ||
| 26 | + <div class="col-md-8"> | ||
| 27 | + <select name="sectionrouteCode" id="sectionrouteCodeSelect"></select> | ||
| 28 | + <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> | ||
| 29 | + </div> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + </form> | ||
| 33 | + </div> | ||
| 34 | + <div class="modal-footer"> | ||
| 35 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 36 | + <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | +</div> | ||
| 41 | +<script type="text/javascript"> | ||
| 42 | + | ||
| 43 | + $('#doublename_road_mobal').on('doubleNameRoadMobal_show', function(e,params,map_,ajaxd,fun){ | ||
| 44 | + // 方向 | ||
| 45 | + var dir = params.directions; | ||
| 46 | + var lineId = params.lineId; | ||
| 47 | + | ||
| 48 | + // 获取路段号元素,并添加下拉属性值 | ||
| 49 | + ajaxd.getStation(lineId,dir,function(treeData) { | ||
| 50 | + var array = treeData[0].children[1].children,paramsD =new Array(); | ||
| 51 | + paramsD.push({'id':'启始路段(默认在所有路段的前面)','text':'启始路段(默认在所有路段的前面)'}); | ||
| 52 | + // 记录最后一个路段 | ||
| 53 | + var endRoad = 0; | ||
| 54 | + // 遍历. | ||
| 55 | + $.each(array, function(i, g){ | ||
| 56 | + // 判断. | ||
| 57 | + if(g.sectionName!='' || g.sectionName != null) { | ||
| 58 | + var ptions_v = g.sectionrouteCode; | ||
| 59 | + if(endRoad < ptions_v) | ||
| 60 | + endRoad = ptions_v; | ||
| 61 | + // 添加拼音检索下拉框格式数据数组. | ||
| 62 | + paramsD.push({'id':ptions_v, | ||
| 63 | + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.sectionrouteDirections)}); | ||
| 64 | + } | ||
| 65 | + }); | ||
| 66 | + // 初始化上一个路段拼音检索下拉框. | ||
| 67 | + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) { | ||
| 68 | + if(endRoad != 0) | ||
| 69 | + $('#sectionrouteCodeSelect').select2('val',endRoad); | ||
| 70 | + else | ||
| 71 | + $('#sectionrouteCodeSelect').select2('val','启始路段(默认在所有路段的前面)'); | ||
| 72 | + }); | ||
| 73 | + }); | ||
| 74 | + // 显示mobal | ||
| 75 | + $('#doublename_road_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | ||
| 76 | + // 当调用 hide 实例方法时触发 | ||
| 77 | + $('#doublename_road_mobal').on('hide.bs.modal', function () { | ||
| 78 | + closeMobleSetClean(); | ||
| 79 | + }); | ||
| 80 | + function closeMobleSetClean() { | ||
| 81 | + // 清除地图覆盖物 | ||
| 82 | + map_.clearMarkAndOverlays(); | ||
| 83 | + fun.resjtreeDate(lineId,dir); | ||
| 84 | + fun.editAChangeCssRemoveDisabled(); | ||
| 85 | + ajaxd.getSectionRouteInfo(lineId,dir,function(data) { | ||
| 86 | + fun.linePanlThree(lineId,data,dir); | ||
| 87 | + }); | ||
| 88 | + } | ||
| 89 | + // 编辑表单元素 | ||
| 90 | + var form = $('#edit_section__form'); | ||
| 91 | + // 获取错误提示元素 | ||
| 92 | + var error = $('.alert-danger', form); | ||
| 93 | + // 提交数据按钮事件 | ||
| 94 | + $('#editSectionButton').on('click', function() { | ||
| 95 | + // 表单提交 | ||
| 96 | + form.submit(); | ||
| 97 | + }); | ||
| 98 | + // 表单验证 | ||
| 99 | + form.validate({ | ||
| 100 | + errorElement : 'span', | ||
| 101 | + errorClass : 'help-block help-block-error', | ||
| 102 | + focusInvalid : false, | ||
| 103 | + /* rules : { | ||
| 104 | + 'sectionrouteCode': {required : true}// 路由序号 必填项 | ||
| 105 | + },*/ | ||
| 106 | + invalidHandler : function(event, validator) { | ||
| 107 | + error.show(); | ||
| 108 | + App.scrollTo(error, -200); | ||
| 109 | + }, | ||
| 110 | + highlight : function(element) { | ||
| 111 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 112 | + }, | ||
| 113 | + unhighlight : function(element) { | ||
| 114 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 115 | + }, | ||
| 116 | + success : function(label) { | ||
| 117 | + label.closest('.form-group').removeClass('has-error'); | ||
| 118 | + }, | ||
| 119 | + submitHandler : function(f) { | ||
| 120 | + var data = form.serializeJSON(); | ||
| 121 | + if(data.sectionrouteCode=='启始路段(默认在所有路段的前面)') { | ||
| 122 | + params.sectionrouteCode = ''; | ||
| 123 | + } else { | ||
| 124 | + params.sectionrouteCode = data.sectionrouteCode; | ||
| 125 | + } | ||
| 126 | + // 获取版本 | ||
| 127 | + $.get("/lineVersions/findCurrentVersion", {"lineId" : lineId}, function (versions) { | ||
| 128 | + params.versions = versions; | ||
| 129 | + // 生成路段 | ||
| 130 | + $.get('/section/doubleName',params,function (resuntDate) { | ||
| 131 | + debugger | ||
| 132 | + if(resuntDate.status=='SUCCESS') { | ||
| 133 | + // 弹出添加成功提示消息 | ||
| 134 | + layer.msg('生成成功...'); | ||
| 135 | + } else if (resuntDate.status=='Failure') { | ||
| 136 | + layer.msg('抱歉,选取的路段太短,无法生成双路段!'); | ||
| 137 | + } else { | ||
| 138 | + // 弹出添加失败提示消息 | ||
| 139 | + layer.msg('生成失败...'); | ||
| 140 | + } | ||
| 141 | + $('#doublename_road_mobal').modal('hide'); | ||
| 142 | + var dir = params.directions; | ||
| 143 | + // 刷行左边树 | ||
| 144 | + fun.resjtreeDate(lineId,dir); | ||
| 145 | + closeMobleSetClean(); | ||
| 146 | + }); | ||
| 147 | + }); | ||
| 148 | + | ||
| 149 | + } | ||
| 150 | + }); | ||
| 151 | + }); | ||
| 152 | +</script> | ||
| 0 | \ No newline at end of file | 153 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/edit_select.html
| @@ -49,6 +49,7 @@ | @@ -49,6 +49,7 @@ | ||
| 49 | <script type="text/javascript"> | 49 | <script type="text/javascript"> |
| 50 | $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,editStationObj,lineObj,fun,dir_){ | 50 | $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,editStationObj,lineObj,fun,dir_){ |
| 51 | var sel = fun.getCurrSelNode(dir_); | 51 | var sel = fun.getCurrSelNode(dir_); |
| 52 | + debugger | ||
| 52 | var Station = sel[0].original; | 53 | var Station = sel[0].original; |
| 53 | // 显示选择修改方式弹出层 | 54 | // 显示选择修改方式弹出层 |
| 54 | $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | 55 | $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); |
| @@ -117,21 +118,16 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | @@ -117,21 +118,16 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | ||
| 117 | var editStationName = params.stationNamebootbox; | 118 | var editStationName = params.stationNamebootbox; |
| 118 | 119 | ||
| 119 | if(params.editselect==0){ | 120 | if(params.editselect==0){ |
| 120 | - layer.confirm('重绘站点,会修改站点编码,影响已做好的排班和线路文件。请谨慎使用,谢谢!', { | ||
| 121 | - btn: ['绘制','取消'] //按钮 | ||
| 122 | - }, function(index){ | ||
| 123 | - $('#downLine').addClass('btn disabled'); | ||
| 124 | - $('.btn-circle').addClass('disabled'); | ||
| 125 | - $('#upLine').addClass('btn disabled'); | ||
| 126 | - editStationObj.setEitdStation(Station); | ||
| 127 | - editStationObj.setEitdStationName(editStationName); | ||
| 128 | - | ||
| 129 | - map_.clearMarkAndOverlays(); | ||
| 130 | - // 打开绘制工具 | ||
| 131 | - drw.openDrawingManager(); | ||
| 132 | - map_.localtionPoint(editStationName); | ||
| 133 | - layer.close(index) | ||
| 134 | - }); | 121 | + $('#downLine').addClass('btn disabled'); |
| 122 | + $('.btn-circle').addClass('disabled'); | ||
| 123 | + $('#upLine').addClass('btn disabled'); | ||
| 124 | + editStationObj.setEitdStation(Station); | ||
| 125 | + editStationObj.setEitdStationName(editStationName); | ||
| 126 | + | ||
| 127 | + map_.clearMarkAndOverlays(); | ||
| 128 | + // 打开绘制工具 | ||
| 129 | + drw.openDrawingManager(); | ||
| 130 | + map_.localtionPoint(editStationName); | ||
| 135 | }else if(params.editselect==1){ | 131 | }else if(params.editselect==1){ |
| 136 | $('#downLine').addClass('btn disabled'); | 132 | $('#downLine').addClass('btn disabled'); |
| 137 | $('.btn-circle').addClass('disabled'); | 133 | $('.btn-circle').addClass('disabled'); |
| @@ -141,7 +137,7 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | @@ -141,7 +137,7 @@ $('#edit_select_mobal').on('editSelectMobal_show', function(e, map_,drw,ajaxd,ed | ||
| 141 | 137 | ||
| 142 | // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒) | 138 | // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒) |
| 143 | var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px', | 139 | var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px', |
| 144 | - shift: 0,time: 10000}); | 140 | + shift: 0,time: 3000}); |
| 145 | // 编辑图形 | 141 | // 编辑图形 |
| 146 | map_.editShapes(editStationName,stationShapesTypeV,mindex); | 142 | map_.editShapes(editStationName,stationShapesTypeV,mindex); |
| 147 | } | 143 | } |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
| @@ -19,11 +19,16 @@ $(function(){ | @@ -19,11 +19,16 @@ $(function(){ | ||
| 19 | 19 | ||
| 20 | // 上行站点其它规划点击事件 | 20 | // 上行站点其它规划点击事件 |
| 21 | $('.upManual').on('click',function() { | 21 | $('.upManual').on('click',function() { |
| 22 | - // 加载其它规划选择弹出层mobal页面 | 22 | + // 加载模板手动添加站点页面 |
| 23 | + $.get('addstationstemplate.html', function(m){ | ||
| 24 | + $(pjaxContainer).append(m); | ||
| 25 | + $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | ||
| 26 | + }); | ||
| 27 | + /*// 加载其它规划选择弹出层mobal页面 | ||
| 23 | $.get('add_manual_select.html', function(m){ | 28 | $.get('add_manual_select.html', function(m){ |
| 24 | $(pjaxContainer).append(m); | 29 | $(pjaxContainer).append(m); |
| 25 | $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | 30 | $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); |
| 26 | - }); | 31 | + });*/ |
| 27 | 32 | ||
| 28 | }); | 33 | }); |
| 29 | 34 | ||
| @@ -187,11 +192,16 @@ $(function(){ | @@ -187,11 +192,16 @@ $(function(){ | ||
| 187 | 192 | ||
| 188 | // 下行站点其它规划点击事件 | 193 | // 下行站点其它规划点击事件 |
| 189 | $('.downManual').on('click',function() { | 194 | $('.downManual').on('click',function() { |
| 190 | - // 加载其它规划选择弹出层mobal页面 | 195 | + // 加载模板手动添加站点页面 |
| 196 | + $.get('addstationstemplate.html', function(m){ | ||
| 197 | + $(pjaxContainer).append(m); | ||
| 198 | + $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | ||
| 199 | + }); | ||
| 200 | + /*// 加载其它规划选择弹出层mobal页面 | ||
| 191 | $.get('add_manual_select.html', function(m){ | 201 | $.get('add_manual_select.html', function(m){ |
| 192 | $(pjaxContainer).append(m); | 202 | $(pjaxContainer).append(m); |
| 193 | $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | 203 | $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); |
| 194 | - }); | 204 | + });*/ |
| 195 | }); | 205 | }); |
| 196 | 206 | ||
| 197 | // 下行站点新增事件 | 207 | // 下行站点新增事件 |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
| @@ -161,7 +161,7 @@ var PublicFunctions = function () { | @@ -161,7 +161,7 @@ var PublicFunctions = function () { | ||
| 161 | /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */ | 161 | /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */ |
| 162 | PublicFunctions.systemLineStation(lineNameV,directionData); | 162 | PublicFunctions.systemLineStation(lineNameV,directionData); |
| 163 | } | 163 | } |
| 164 | - | 164 | + |
| 165 | }, | 165 | }, |
| 166 | 166 | ||
| 167 | /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */ | 167 | /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */ |
| @@ -170,33 +170,6 @@ var PublicFunctions = function () { | @@ -170,33 +170,6 @@ var PublicFunctions = function () { | ||
| 170 | WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){ | 170 | WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){ |
| 171 | // 如果线路信息不为空 | 171 | // 如果线路信息不为空 |
| 172 | if(BusLine) { | 172 | if(BusLine) { |
| 173 | - /*if(BusLine.zB.length == 0){ | ||
| 174 | - | ||
| 175 | - layer.confirm('系统生成该线路【'+lineNameV+'】时获取站点与路段异常!请联系管理员或者检查网络连接是否异常!', { | ||
| 176 | - btn : [ '确认' ] | ||
| 177 | - }, function(index) { | ||
| 178 | - | ||
| 179 | - // 关闭弹出层 | ||
| 180 | - layer.closeAll(); | ||
| 181 | - | ||
| 182 | - // 上行 | ||
| 183 | - if(directionData==0){ | ||
| 184 | - | ||
| 185 | - // 显示上行规划 | ||
| 186 | - $('#upToolsMobal').show(); | ||
| 187 | - | ||
| 188 | - // 下行 | ||
| 189 | - }else if(directionData==1){ | ||
| 190 | - | ||
| 191 | - // 显示下行规划 | ||
| 192 | - $('#downToolsMobal').show(); | ||
| 193 | - | ||
| 194 | - } | ||
| 195 | - | ||
| 196 | - return ; | ||
| 197 | - }); | ||
| 198 | - | ||
| 199 | - }*/ | ||
| 200 | // 获取公交线几何对象, 仅当结果自动添加到地图上时有效 | 173 | // 获取公交线几何对象, 仅当结果自动添加到地图上时有效 |
| 201 | var Polygon = BusLine.getPolyline(); | 174 | var Polygon = BusLine.getPolyline(); |
| 202 | // 返回多边型的点数组(自1.2新增) | 175 | // 返回多边型的点数组(自1.2新增) |
| @@ -277,10 +250,42 @@ var PublicFunctions = function () { | @@ -277,10 +250,42 @@ var PublicFunctions = function () { | ||
| 277 | } | 250 | } |
| 278 | }) | 251 | }) |
| 279 | }); | 252 | }); |
| 280 | - | ||
| 281 | - | ||
| 282 | }); | 253 | }); |
| 283 | - } | 254 | + // 关闭弹出层 |
| 255 | + layer.closeAll(); | ||
| 256 | + // 上行 | ||
| 257 | + if(directionData==0){ | ||
| 258 | + $('#stationDown').removeClass('active'); | ||
| 259 | + $('#stationDown').removeClass('in'); | ||
| 260 | + $('#stationDown').addClass('fade'); | ||
| 261 | + $('#stationUp').addClass('active in'); | ||
| 262 | + $('#downLine').parent().removeClass('active'); | ||
| 263 | + $('#upLine').parent().addClass('active'); | ||
| 264 | + // 下行 | ||
| 265 | + }else if(directionData==1){ | ||
| 266 | + $('#stationUp').removeClass('active'); | ||
| 267 | + $('#stationUp').removeClass('in'); | ||
| 268 | + $('#stationUp').addClass('fade'); | ||
| 269 | + $('#stationDown').addClass('active in'); | ||
| 270 | + $('#upLine').parent().removeClass('active'); | ||
| 271 | + $('#downLine').parent().addClass('active'); | ||
| 272 | + } | ||
| 273 | + } else { | ||
| 274 | + layer.msg('百度地图中没有此线路,无法系统规划!'); | ||
| 275 | + setTimeout(function() { | ||
| 276 | + // 关闭弹出层 | ||
| 277 | + layer.closeAll(); | ||
| 278 | + // 上行 | ||
| 279 | + if(directionData==0){ | ||
| 280 | + // 显示上行规划 | ||
| 281 | + $('#upToolsMobal').show(); | ||
| 282 | + // 下行 | ||
| 283 | + }else if(directionData==1){ | ||
| 284 | + // 显示下行规划 | ||
| 285 | + $('#downToolsMobal').show(); | ||
| 286 | + } | ||
| 287 | + }, 3000); | ||
| 288 | + } | ||
| 284 | }); | 289 | }); |
| 285 | }, | 290 | }, |
| 286 | 291 | ||
| @@ -484,7 +489,6 @@ var PublicFunctions = function () { | @@ -484,7 +489,6 @@ var PublicFunctions = function () { | ||
| 484 | } | 489 | } |
| 485 | // 路段数据长度 | 490 | // 路段数据长度 |
| 486 | var dataLen = data.length; | 491 | var dataLen = data.length; |
| 487 | - //debugger; | ||
| 488 | // 如果大于零 | 492 | // 如果大于零 |
| 489 | if(dataLen>0) { | 493 | if(dataLen>0) { |
| 490 | // 编辑路段数据 | 494 | // 编辑路段数据 |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| @@ -222,43 +222,30 @@ var WorldsBMap = function () { | @@ -222,43 +222,30 @@ var WorldsBMap = function () { | ||
| 222 | 222 | ||
| 223 | // 如果不为空 | 223 | // 如果不为空 |
| 224 | if(objStation) { | 224 | if(objStation) { |
| 225 | - | ||
| 226 | // 获取中心点坐标字符串 | 225 | // 获取中心点坐标字符串 |
| 227 | var testpointStr = objStation.stationBJwpoints; | 226 | var testpointStr = objStation.stationBJwpoints; |
| 228 | - | ||
| 229 | // 按空格切割中心点坐标字符串 | 227 | // 按空格切割中心点坐标字符串 |
| 230 | var BJwpointsPolygon = testpointStr.split(' '); | 228 | var BJwpointsPolygon = testpointStr.split(' '); |
| 231 | - | ||
| 232 | // 中心点坐标 | 229 | // 中心点坐标 |
| 233 | var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]); | 230 | var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]); |
| 234 | - | ||
| 235 | // 获取多边形坐标字符串 | 231 | // 获取多边形坐标字符串 |
| 236 | var stationBPolygonGrid = objStation.stationBPolygonGrid; | 232 | var stationBPolygonGrid = objStation.stationBPolygonGrid; |
| 237 | - | ||
| 238 | // 截取多边形坐标字符串 | 233 | // 截取多边形坐标字符串 |
| 239 | var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | 234 | var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); |
| 240 | - | ||
| 241 | // 按逗号切割 | 235 | // 按逗号切割 |
| 242 | var pointPolygonArray = stationBPolygonGridStr.split(','); | 236 | var pointPolygonArray = stationBPolygonGridStr.split(','); |
| 243 | - | ||
| 244 | // 多边形坐标集合 | 237 | // 多边形坐标集合 |
| 245 | var polygonP = []; | 238 | var polygonP = []; |
| 246 | - | ||
| 247 | for(var v = 0;v<pointPolygonArray.length;v++) { | 239 | for(var v = 0;v<pointPolygonArray.length;v++) { |
| 248 | - | ||
| 249 | polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | 240 | polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); |
| 250 | - | ||
| 251 | } | 241 | } |
| 252 | 242 | ||
| 253 | // 画多边形 | 243 | // 画多边形 |
| 254 | polygon = new BMap.Polygon(polygonP, { | 244 | polygon = new BMap.Polygon(polygonP, { |
| 255 | - | ||
| 256 | // 线条显色 | 245 | // 线条显色 |
| 257 | strokeColor : "blue", | 246 | strokeColor : "blue", |
| 258 | - | ||
| 259 | // 边线的宽度,以像素为单位。 | 247 | // 边线的宽度,以像素为单位。 |
| 260 | strokeWeight : 2, | 248 | strokeWeight : 2, |
| 261 | - | ||
| 262 | // 边线透明度,取值范围0 - 1。 | 249 | // 边线透明度,取值范围0 - 1。 |
| 263 | strokeOpacity : 0.5 | 250 | strokeOpacity : 0.5 |
| 264 | }); | 251 | }); |
| @@ -268,80 +255,62 @@ var WorldsBMap = function () { | @@ -268,80 +255,62 @@ var WorldsBMap = function () { | ||
| 268 | 255 | ||
| 269 | // 信息窗口属性 | 256 | // 信息窗口属性 |
| 270 | var opts_polygon = { | 257 | var opts_polygon = { |
| 271 | - | ||
| 272 | // 信息窗口宽度 | 258 | // 信息窗口宽度 |
| 273 | width : 200, | 259 | width : 200, |
| 274 | - | ||
| 275 | // 信息窗口高度 | 260 | // 信息窗口高度 |
| 276 | - height : 400, | ||
| 277 | - | ||
| 278 | - // 信息窗位置偏移值。 | ||
| 279 | - offset: new BMap.Size(500,20), | ||
| 280 | - | 261 | + height : 300, |
| 262 | + // 信息窗位置偏移值。 | ||
| 263 | + // offset: new BMap.Size(500,20), | ||
| 281 | //标题 | 264 | //标题 |
| 282 | - title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | ||
| 283 | - | 265 | + // title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', |
| 284 | //设置不允许信窗发送短息 | 266 | //设置不允许信窗发送短息 |
| 285 | enableMessage : false, | 267 | enableMessage : false, |
| 286 | - | ||
| 287 | //是否开启点击地图关闭信息窗口 | 268 | //是否开启点击地图关闭信息窗口 |
| 288 | enableCloseOnClick : false | 269 | enableCloseOnClick : false |
| 289 | }; | 270 | }; |
| 290 | - | 271 | + |
| 291 | var markTypeStr = ''; | 272 | var markTypeStr = ''; |
| 292 | - | ||
| 293 | if(objStation.stationRouteStationMark=='B') { | 273 | if(objStation.stationRouteStationMark=='B') { |
| 294 | - | ||
| 295 | markTypeStr='起点站'; | 274 | markTypeStr='起点站'; |
| 296 | - | ||
| 297 | }else if(objStation.stationRouteStationMark=='Z') { | 275 | }else if(objStation.stationRouteStationMark=='Z') { |
| 298 | - | ||
| 299 | markTypeStr ='中途站'; | 276 | markTypeStr ='中途站'; |
| 300 | - | ||
| 301 | - | ||
| 302 | }else if(objStation.stationRouteStationMark=='E') { | 277 | }else if(objStation.stationRouteStationMark=='E') { |
| 303 | - | ||
| 304 | markTypeStr='终点站'; | 278 | markTypeStr='终点站'; |
| 305 | - | ||
| 306 | } | 279 | } |
| 307 | - | ||
| 308 | - var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | ||
| 309 | - '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' + | ||
| 310 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' + | ||
| 311 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | ||
| 312 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' + | ||
| 313 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' + | ||
| 314 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | ||
| 315 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | ||
| 316 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' + | ||
| 317 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">版本号  :' + objStation.stationRouteVersions + '</span>' + | ||
| 318 | - '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD;'+ | ||
| 319 | - 'overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ | ||
| 320 | - objStation.stationRouteDescriptions +'" >说明/描述:' + objStation.stationRouteDescriptions + '</span>' ; | ||
| 321 | - | ||
| 322 | - // 创建信息窗口 | 280 | + var point = objStation.stationBJwpoints.split(" ") |
| 281 | + var htm = '<span style="color: #ff8355;font-size: 20px;">' + objStation.stationStationName + '</span>' + | ||
| 282 | + '<span class="help-block" >站点编码:' + objStation.stationStationCod + '</span>' + | ||
| 283 | + '<span class="help-block" >站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | ||
| 284 | + '<span class="help-block" >站点类型:' + markTypeStr + '</span>' + | ||
| 285 | + '<span class="help-block" >经度:  ' + point[0] + '</span>' + | ||
| 286 | + '<span class="help-block" >纬度:  ' + point[1] + '</span>' + | ||
| 287 | + '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | ||
| 288 | + '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | ||
| 289 | + '<span class="help-block" >缓冲区形状:' + (objStation.stationShapesType == "r"?"圆形":"多边形") + '</span>' + | ||
| 290 | + '<span class="help-block" >版本号:  ' + objStation.stationRouteVersions + '</span>' + | ||
| 291 | + '<div style="display: flex">' + | ||
| 292 | + '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' + | ||
| 293 | + 'id="editStation" onclick="WorldsBMap.editStation('+objStation.stationRouteDirections+')">修改站点</button></span>' + | ||
| 294 | + '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' + | ||
| 295 | + 'id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad('+objStation.stationRouteId+')">添加站点间路段</button></span>' + | ||
| 296 | + '</div>'; | ||
| 297 | + | ||
| 298 | + // 创建信息窗口 | ||
| 323 | var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon); | 299 | var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon); |
| 324 | // 自定义标注物图片 | 300 | // 自定义标注物图片 |
| 325 | var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | 301 | var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); |
| 326 | - | ||
| 327 | // 创建点 | 302 | // 创建点 |
| 328 | marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | 303 | marker = new BMap.Marker(pointPolygon,{icon : icon_target}); |
| 329 | - | ||
| 330 | // 把标注添物加到地图上 | 304 | // 把标注添物加到地图上 |
| 331 | mapBValue.addOverlay(marker); | 305 | mapBValue.addOverlay(marker); |
| 332 | - | ||
| 333 | // 是否在平移过程中禁止动画。(自1.2新增) | 306 | // 是否在平移过程中禁止动画。(自1.2新增) |
| 334 | var PanOptions_ ={noAnimation :true}; | 307 | var PanOptions_ ={noAnimation :true}; |
| 335 | - | ||
| 336 | // 将地图的中心点更改为给定的点。 | 308 | // 将地图的中心点更改为给定的点。 |
| 337 | mapBValue.panTo(pointPolygon,PanOptions_); | 309 | mapBValue.panTo(pointPolygon,PanOptions_); |
| 338 | - | ||
| 339 | // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | 310 | // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 |
| 340 | mapBValue.panBy(10,-150,PanOptions_); | 311 | mapBValue.panBy(10,-150,PanOptions_); |
| 341 | - | ||
| 342 | //开启信息窗口 | 312 | //开启信息窗口 |
| 343 | mapBValue.openInfoWindow(infoWindow_target,pointPolygon); | 313 | mapBValue.openInfoWindow(infoWindow_target,pointPolygon); |
| 344 | - | ||
| 345 | } | 314 | } |
| 346 | 315 | ||
| 347 | }, | 316 | }, |
| @@ -399,61 +368,50 @@ var WorldsBMap = function () { | @@ -399,61 +368,50 @@ var WorldsBMap = function () { | ||
| 399 | 368 | ||
| 400 | // 信息窗口参数属性 | 369 | // 信息窗口参数属性 |
| 401 | var opts = { | 370 | var opts = { |
| 402 | - | ||
| 403 | // 信息窗口宽度 | 371 | // 信息窗口宽度 |
| 404 | width : 200, | 372 | width : 200, |
| 405 | - | ||
| 406 | // 信息窗口高度 | 373 | // 信息窗口高度 |
| 407 | - height : 450, | ||
| 408 | - | 374 | + height : 330, |
| 409 | // 信息窗位置偏移值。 | 375 | // 信息窗位置偏移值。 |
| 410 | - offset: new BMap.Size(500,120), | ||
| 411 | - | 376 | + // offset: new BMap.Size(500,120), |
| 412 | //标题 | 377 | //标题 |
| 413 | - title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | ||
| 414 | - | 378 | + // title : '<h4 style="color:#ff8355">'+objStation.stationStationName+'站详情</h4>', |
| 415 | //设置不允许信窗发送短息 | 379 | //设置不允许信窗发送短息 |
| 416 | enableMessage : false, | 380 | enableMessage : false, |
| 417 | - | ||
| 418 | //是否开启点击地图关闭信息窗口 | 381 | //是否开启点击地图关闭信息窗口 |
| 419 | enableCloseOnClick : false, | 382 | enableCloseOnClick : false, |
| 420 | - | ||
| 421 | // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | 383 | // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) |
| 422 | enableAutoPan:false | 384 | enableAutoPan:false |
| 423 | }; | 385 | }; |
| 424 | 386 | ||
| 425 | var markTypeStr = ''; | 387 | var markTypeStr = ''; |
| 426 | - | ||
| 427 | if(objStation.stationRouteStationMark=='B') { | 388 | if(objStation.stationRouteStationMark=='B') { |
| 428 | - | ||
| 429 | markTypeStr='起点站'; | 389 | markTypeStr='起点站'; |
| 430 | - | ||
| 431 | }else if(objStation.stationRouteStationMark=='Z') { | 390 | }else if(objStation.stationRouteStationMark=='Z') { |
| 432 | - | ||
| 433 | markTypeStr ='中途站'; | 391 | markTypeStr ='中途站'; |
| 434 | - | ||
| 435 | - | ||
| 436 | }else if(objStation.stationRouteStationMark=='E') { | 392 | }else if(objStation.stationRouteStationMark=='E') { |
| 437 | - | ||
| 438 | markTypeStr='终点站'; | 393 | markTypeStr='终点站'; |
| 439 | - | ||
| 440 | } | 394 | } |
| 441 | - | ||
| 442 | - var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | ||
| 443 | - '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' + | ||
| 444 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' + | ||
| 445 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | ||
| 446 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' + | ||
| 447 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' + | ||
| 448 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | ||
| 449 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | ||
| 450 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' + | ||
| 451 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">版本号  :' + objStation.stationRouteVersions + '</span>' + | ||
| 452 | - '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD;'+ | ||
| 453 | - 'overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ | ||
| 454 | - objStation.stationRouteDescriptions +'" >说明/描述:' + objStation.stationRouteDescriptions + '</span>' ; | ||
| 455 | - | ||
| 456 | - // 创建信息窗口 | 395 | + var point1 = objStation.stationBJwpoints.split(" "); |
| 396 | + var htm = '<span style="color: #ff8355;font-size: 20px;">' + objStation.stationStationName + '</span>' + | ||
| 397 | + '<span class="help-block" >站点编码:' + objStation.stationStationCod + '</span>' + | ||
| 398 | + '<span class="help-block" >站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | ||
| 399 | + '<span class="help-block" >站点类型:' + markTypeStr + '</span>' + | ||
| 400 | + '<span class="help-block" >经度:  ' + point1[0] + '</span>' + | ||
| 401 | + '<span class="help-block" >纬度:  ' + point1[1] + '</span>' + | ||
| 402 | + '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | ||
| 403 | + '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | ||
| 404 | + '<span class="help-block" >缓冲区形状:' + (objStation.stationShapesType == "r"?"圆形":"多边形") + '</span>' + | ||
| 405 | + '<span class="help-block" >半径  :' + objStation.stationRadius + '</span>' + | ||
| 406 | + '<span class="help-block" >版本号  :' + objStation.stationRouteVersions + '</span>' + | ||
| 407 | + '<div style="display: flex">' + | ||
| 408 | + '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' + | ||
| 409 | + 'id="editStation" onclick="WorldsBMap.editStation('+objStation.stationRouteDirections+')">修改站点</button></span>' + | ||
| 410 | + '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' + | ||
| 411 | + 'id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad('+objStation.stationRouteId+')">添加站点间路段</button></span>' + | ||
| 412 | + '</div>'; | ||
| 413 | + | ||
| 414 | + // 创建信息窗口 | ||
| 457 | var infoWindow_target = new BMap.InfoWindow(htm, opts); | 415 | var infoWindow_target = new BMap.InfoWindow(htm, opts); |
| 458 | // 自定义标注物图片 | 416 | // 自定义标注物图片 |
| 459 | var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | 417 | var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); |
| @@ -664,6 +622,65 @@ var WorldsBMap = function () { | @@ -664,6 +622,65 @@ var WorldsBMap = function () { | ||
| 664 | mapBValue.panTo(polyline_center,PanOptions_); | 622 | mapBValue.panTo(polyline_center,PanOptions_); |
| 665 | mapBValue.panBy(500,-510,PanOptions_); | 623 | mapBValue.panBy(500,-510,PanOptions_); |
| 666 | mapBValue.setZoom(14); | 624 | mapBValue.setZoom(14); |
| 625 | + | ||
| 626 | + // 信息窗口属性 | ||
| 627 | + var opts_polygon = { | ||
| 628 | + // 信息窗口宽度 | ||
| 629 | + width : 200, | ||
| 630 | + // 信息窗口高度 | ||
| 631 | + height : 300, | ||
| 632 | + // 信息窗位置偏移值。 | ||
| 633 | + // offset: new BMap.Size(500,20), | ||
| 634 | + //标题 | ||
| 635 | + // title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | ||
| 636 | + //设置不允许信窗发送短息 | ||
| 637 | + enableMessage : false, | ||
| 638 | + //是否开启点击地图关闭信息窗口 | ||
| 639 | + enableCloseOnClick : false | ||
| 640 | + }; | ||
| 641 | + | ||
| 642 | + // var markTypeStr = ''; | ||
| 643 | + // if(objStation.stationRouteStationMark=='B') { | ||
| 644 | + // markTypeStr='起点站'; | ||
| 645 | + // }else if(objStation.stationRouteStationMark=='Z') { | ||
| 646 | + // markTypeStr ='中途站'; | ||
| 647 | + // }else if(objStation.stationRouteStationMark=='E') { | ||
| 648 | + // markTypeStr='终点站'; | ||
| 649 | + // } | ||
| 650 | + // var point = objStation.stationBJwpoints.split(" ") | ||
| 651 | + // var htm = '<span style="color: #ff8355;font-size: 20px;">' + objStation.stationStationName + '</span>' + | ||
| 652 | + // '<span class="help-block" >站点编码:' + objStation.stationStationCod + '</span>' + | ||
| 653 | + // '<span class="help-block" >站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | ||
| 654 | + // '<span class="help-block" >站点类型:' + markTypeStr + '</span>' + | ||
| 655 | + // '<span class="help-block" >经度:  ' + point[0] + '</span>' + | ||
| 656 | + // '<span class="help-block" >纬度:  ' + point[1] + '</span>' + | ||
| 657 | + // '<span class="help-block" >到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | ||
| 658 | + // '<span class="help-block" >到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | ||
| 659 | + // '<span class="help-block" >缓冲区形状:' + (objStation.stationShapesType == "r"?"圆形":"多边形") + '</span>' + | ||
| 660 | + // '<span class="help-block" >版本号:  ' + objStation.stationRouteVersions + '</span>' + | ||
| 661 | + // '<div style="display: flex">' + | ||
| 662 | + // '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' + | ||
| 663 | + // 'id="editStation" onclick="WorldsBMap.editStation('+objStation.stationRouteDirections+')">修改站点</button></span>' + | ||
| 664 | + // '<span><button style="background: #ff8355; color: #fff; padding-bottom:5px; font-size: 9px;" class="btn btn-circle" ' + | ||
| 665 | + // 'id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad('+objStation.stationRouteId+')">添加站点间路段</button></span>' + | ||
| 666 | + // '</div>'; | ||
| 667 | + // | ||
| 668 | + // // 创建信息窗口 | ||
| 669 | + // var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon); | ||
| 670 | + // // 自定义标注物图片 | ||
| 671 | + // var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | ||
| 672 | + // // 创建点 | ||
| 673 | + // marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | ||
| 674 | + // // 把标注添物加到地图上 | ||
| 675 | + // mapBValue.addOverlay(marker); | ||
| 676 | + // // 是否在平移过程中禁止动画。(自1.2新增) | ||
| 677 | + // var PanOptions_ ={noAnimation :true}; | ||
| 678 | + // // 将地图的中心点更改为给定的点。 | ||
| 679 | + // mapBValue.panTo(pointPolygon,PanOptions_); | ||
| 680 | + // // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | ||
| 681 | + // mapBValue.panBy(10,-150,PanOptions_); | ||
| 682 | + // //开启信息窗口 | ||
| 683 | + // mapBValue.openInfoWindow(infoWindow_target,pointPolygon); | ||
| 667 | }, | 684 | }, |
| 668 | 685 | ||
| 669 | 686 | ||
| @@ -1003,6 +1020,84 @@ var WorldsBMap = function () { | @@ -1003,6 +1020,84 @@ var WorldsBMap = function () { | ||
| 1003 | busline.getBusList(lineNameValue); | 1020 | busline.getBusList(lineNameValue); |
| 1004 | 1021 | ||
| 1005 | }, | 1022 | }, |
| 1023 | + editStation : function(dir) { | ||
| 1024 | + // $.get("/stationroute/findStationRouteInfo",{"id":stationRouteId},function (route) { | ||
| 1025 | + $.get('edit_select.html', function(m){ | ||
| 1026 | + $(pjaxContainer).append(m); | ||
| 1027 | + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,dir]); | ||
| 1028 | + }); | ||
| 1029 | + // }); | ||
| 1030 | + }, | ||
| 1031 | + addBetweenStationRoad : function (stationRouteId) { | ||
| 1032 | + $.get("/stationroute/findStationRouteInfo",{"id":stationRouteId},function (route) { | ||
| 1033 | + var stationRouteBegin = route[0]; | ||
| 1034 | + // 查询下一个站点 | ||
| 1035 | + $.get("/stationroute/findDownStationRoute",{"lineId":stationRouteBegin.stationRouteLine, "direction":stationRouteBegin.stationRoutedirections, "stationRouteCode":stationRouteBegin.stationRouteCode},function (stationRoute) { | ||
| 1036 | + var stationRouteFinish = stationRoute[0]; | ||
| 1037 | + | ||
| 1038 | + if(stationRouteFinish){ | ||
| 1039 | + var pointBegin = stationRouteBegin.stationJwpoints.split(" "); | ||
| 1040 | + var pointFinish = stationRouteFinish.stationJwpoints.split(" ") | ||
| 1041 | + console.log(pointFinish); | ||
| 1042 | + var sectionList = []; | ||
| 1043 | + // 两个站点的坐标 | ||
| 1044 | + var poiOne = new BMap.Point(pointBegin[0],pointBegin[1]); | ||
| 1045 | + var poiTwo = new BMap.Point(pointFinish[0],pointFinish[1]); | ||
| 1046 | + // 路径规划保存按钮 | ||
| 1047 | + var label = new BMap.Label("保存路段", { | ||
| 1048 | + offset: new BMap.Size(13, -53) | ||
| 1049 | + }); | ||
| 1050 | + label.setStyle({ | ||
| 1051 | + color: '#fff', | ||
| 1052 | + background:"url(/pages/base/stationroute/css/img/bg.png)", | ||
| 1053 | + border: '0px solid', | ||
| 1054 | + textAlign: "center", | ||
| 1055 | + height: "28px", | ||
| 1056 | + lineHeight: "26px", | ||
| 1057 | + width: "80px", | ||
| 1058 | + maxWidth: "none" | ||
| 1059 | + }); | ||
| 1060 | + label.addEventListener('click', function () { | ||
| 1061 | + var params = {}; | ||
| 1062 | + params.lineId = stationRouteBegin.stationRouteLine; | ||
| 1063 | + params.lineCode = stationRouteBegin.stationRouteLIneCode; | ||
| 1064 | + params.directions = stationRouteBegin.stationRoutedirections; | ||
| 1065 | + params.stationRouteBegin = stationRouteBegin.stationRouteName; | ||
| 1066 | + params.stationRouteFinish = stationRouteFinish.stationRouteName; | ||
| 1067 | + params.route = $("#routePlanning").val(); | ||
| 1068 | + $.get('doublename_road.html', function(m){ | ||
| 1069 | + $(pjaxContainer).append(m); | ||
| 1070 | + $('#doublename_road_mobal').trigger('doubleNameRoadMobal_show', [params,WorldsBMap,GetAjaxData,PublicFunctions]); | ||
| 1071 | + }); | ||
| 1072 | + }); | ||
| 1073 | + // 路径规划 | ||
| 1074 | + var transit = new BMap.DrivingRoute(mapBValue, {renderOptions: {map: mapBValue,enableDragging : true},onPolylinesSet: searchPolylinesSet}); | ||
| 1075 | + function searchPolylinesSet(results){ | ||
| 1076 | + if (transit.getStatus() == BMAP_STATUS_SUCCESS){ | ||
| 1077 | + var sectionArrayList = []; | ||
| 1078 | + for (i = 0; i < results.length; i++){ | ||
| 1079 | + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath()); | ||
| 1080 | + } | ||
| 1081 | + sectionList = sectionArrayList;//JSON.stringify() | ||
| 1082 | + $("#routePlanning").val(JSON.stringify(sectionArrayList)); | ||
| 1083 | + var pointMap = new Map(); | ||
| 1084 | + pointMap = sectionArrayList[sectionArrayList.length-1]; | ||
| 1085 | + var pointLabel = new BMap.Point(pointMap.lng,pointMap.lat); | ||
| 1086 | + label.enableMassClear(); | ||
| 1087 | + label.setPosition(pointLabel); | ||
| 1088 | + mapBValue.addOverlay(label); | ||
| 1089 | + } | ||
| 1090 | + } | ||
| 1091 | + transit.search(poiOne,poiTwo); | ||
| 1092 | + transit.disableAutoViewport(); | ||
| 1093 | + } else { | ||
| 1094 | + layer.msg("您选择的站点后没有站点了,不能生成站点间路段!") | ||
| 1095 | + } | ||
| 1096 | + | ||
| 1097 | + }); | ||
| 1098 | + }); | ||
| 1099 | + | ||
| 1100 | + }, | ||
| 1006 | 1101 | ||
| 1007 | clearMarkAndOverlays : function() { | 1102 | clearMarkAndOverlays : function() { |
| 1008 | 1103 |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
| @@ -37,7 +37,7 @@ var StationTreeData = function(){ | @@ -37,7 +37,7 @@ var StationTreeData = function(){ | ||
| 37 | // 百度地图画圆 | 37 | // 百度地图画圆 |
| 38 | WorldsBMap.pointsCircle(data); | 38 | WorldsBMap.pointsCircle(data); |
| 39 | 39 | ||
| 40 | - // 如果是多变行 | 40 | + // 如果是多边形 |
| 41 | }else if(shapesTypeT == 'd') { | 41 | }else if(shapesTypeT == 'd') { |
| 42 | 42 | ||
| 43 | // 百度地图画多边形 | 43 | // 百度地图画多边形 |
src/main/resources/static/pages/base/stationroute/list.html
| @@ -2,7 +2,9 @@ | @@ -2,7 +2,9 @@ | ||
| 2 | <div class="portlet-body"> | 2 | <div class="portlet-body"> |
| 3 | <!-- 地图 --> | 3 | <!-- 地图 --> |
| 4 | <div id="bmap_basic" class="bmaps"></div> | 4 | <div id="bmap_basic" class="bmaps"></div> |
| 5 | - <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;"> | 5 | + <!-- 路径规划路段 --> |
| 6 | + <input class="hand" id="routePlanning" /> | ||
| 7 | + <div class="portlet box protlet-box"> | ||
| 6 | <!-- 左边标题栏 --> | 8 | <!-- 左边标题栏 --> |
| 7 | <div class="portlet-title" style="background-color:#12527f;"> | 9 | <div class="portlet-title" style="background-color:#12527f;"> |
| 8 | <div class="caption"> | 10 | <div class="caption"> |
| @@ -13,7 +15,7 @@ | @@ -13,7 +15,7 @@ | ||
| 13 | </div> | 15 | </div> |
| 14 | </div> | 16 | </div> |
| 15 | <!-- 左边栏 --> | 17 | <!-- 左边栏 --> |
| 16 | - <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 420px;"> | 18 | + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 520px;"> |
| 17 | <div class="row"> | 19 | <div class="row"> |
| 18 | <!-- 上下行栏 --> | 20 | <!-- 上下行栏 --> |
| 19 | <div class="col-md-3 col-sm-3 col-xs-3"> | 21 | <div class="col-md-3 col-sm-3 col-xs-3"> |
| @@ -105,11 +107,11 @@ | @@ -105,11 +107,11 @@ | ||
| 105 | </a> | 107 | </a> |
| 106 | <ul class="dropdown-menu pull-right" style="min-width:100px"> | 108 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 107 | <li> | 109 | <li> |
| 108 | - <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | 110 | + <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> |
| 109 | </li> | 111 | </li> |
| 110 | <li class="divider"> </li> | 112 | <li class="divider"> </li> |
| 111 | <li> | 113 | <li> |
| 112 | - <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 其它方式</a> | 114 | + <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> |
| 113 | </li> | 115 | </li> |
| 114 | </ul> | 116 | </ul> |
| 115 | </div> | 117 | </div> |
| @@ -201,11 +203,11 @@ | @@ -201,11 +203,11 @@ | ||
| 201 | </a> | 203 | </a> |
| 202 | <ul class="dropdown-menu pull-right" style="min-width:100px"> | 204 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 203 | <li> | 205 | <li> |
| 204 | - <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | 206 | + <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> |
| 205 | </li> | 207 | </li> |
| 206 | <li class="divider"> </li> | 208 | <li class="divider"> </li> |
| 207 | <li> | 209 | <li> |
| 208 | - <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 其它方式</a> | 210 | + <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> |
| 209 | </li> | 211 | </li> |
| 210 | </ul> | 212 | </ul> |
| 211 | </div> | 213 | </div> |