Commit 8f9d64e2042ec34ebaa552b93d1a011f5597ab72

Authored by 李强
1 parent 9932f6db

基础数据功能完善

Showing 31 changed files with 1901 additions and 1355 deletions
src/main/java/com/bsth/controller/SectionController.java
... ... @@ -34,6 +34,13 @@ public class SectionController extends BaseController<Section, Integer> {
34 34 @Autowired
35 35 SectionService service;
36 36  
  37 + /**
  38 + * @Description :TODO(编辑线路走向)
  39 + *
  40 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  41 + *
  42 + * @return Map<String, Object> <SUCCESS ; ERROR>
  43 + */
37 44 @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST)
38 45 public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) {
39 46  
... ...
src/main/java/com/bsth/controller/SectionRouteController.java
... ... @@ -35,14 +35,16 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
35 35 @Autowired
36 36 SectionRouteService routeService;
37 37  
  38 + /**
  39 + * @Description :TODO(查询路段信息)
  40 + *
  41 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  42 + *
  43 + * @return Map<String, Object>
  44 + */
38 45 @RequestMapping(value = "/findSection" , method = RequestMethod.GET)
39 46 public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
40 47 return routeService.getSectionRoute(map);
41 48 }
42 49  
43   - @RequestMapping(value = "/stationRouteIsDestroy" , method = RequestMethod.POST)
44   - public Map<String, Object> stationRouteIsDestroy(@RequestParam Map<String, Object> map) {
45   - return routeService.stationRouteIsDestroy(map);
46   - }
47   -
48 50 }
... ...
src/main/java/com/bsth/controller/StationController.java
... ... @@ -2,14 +2,12 @@ package com.bsth.controller;
2 2  
3 3 import java.util.Map;
4 4  
5   -import org.hibernate.annotations.Parameter;
6 5 import org.springframework.beans.factory.annotation.Autowired;
7 6 import org.springframework.web.bind.annotation.RequestMapping;
8 7 import org.springframework.web.bind.annotation.RequestMethod;
9 8 import org.springframework.web.bind.annotation.RequestParam;
10 9 import org.springframework.web.bind.annotation.RestController;
11 10  
12   -import com.alibaba.fastjson.JSONArray;
13 11 import com.bsth.entity.Station;
14 12 import com.bsth.service.StationService;
15 13  
... ... @@ -39,10 +37,25 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
39 37 /**
40 38 * @Description :TODO(系统规划保存数据)
41 39 *
  40 + * @param map <stationJSON:站点信息;
42 41 *
  42 + * - - - - - - sectionJSON:路段信息;
43 43 *
44   - * @param map
45   - * @return
  44 + * - - - - - - dbType:坐标类型;
  45 + *
  46 + * - - - - - - destroy:是否撤销;
  47 + *
  48 + * - - - - - - directions:方向;
  49 + *
  50 + * - - - - - - lineId:线路ID;
  51 + *
  52 + * - - - - - - radius:圆半径
  53 + *
  54 + * - - - - - - shapesType:图形类型
  55 + *
  56 + * - - - - - - speedLimit:限速>
  57 + *
  58 + * @return Map<String, Object> <SUCCESS ; ERROR>
46 59 */
47 60 @RequestMapping(value="collectionSave" , method = RequestMethod.POST)
48 61 public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) {
... ... @@ -58,6 +71,21 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
58 71  
59 72 }
60 73  
  74 + /**
  75 + * @Description :TODO(新增站点保存)
  76 + *
  77 + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
  78 + *
  79 + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
  80 + *
  81 + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
  82 + *
  83 + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
  84 + *
  85 + * versions:版本号;x:城建坐标x;y:城建坐标y>
  86 + *
  87 + * @return Map<String, Object> <SUCCESS ; ERROR>
  88 + */
61 89 @RequestMapping(value="stationSave" , method = RequestMethod.POST)
62 90 public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) {
63 91  
... ... @@ -69,6 +97,21 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
69 97  
70 98 }
71 99  
  100 + /**
  101 + * @Description :TODO(更新站点保存)
  102 + *
  103 + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
  104 + *
  105 + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
  106 + *
  107 + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
  108 + *
  109 + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
  110 + *
  111 + * versions:版本号;x:城建坐标x;y:城建坐标y>
  112 + *
  113 + * @return Map<String, Object> <SUCCESS ; ERROR>
  114 + */
72 115 @RequestMapping(value="stationUpdate" , method = RequestMethod.POST)
73 116 public Map<String, Object> stationUpdate(@RequestParam Map<String, Object> map) {
74 117  
... ... @@ -78,9 +121,13 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
78 121  
79 122 }
80 123  
  124 + /**
  125 + * @Description :TODO(查询站点编码)
  126 + *
  127 + * @return int <stationCode站点编码>
  128 + */
81 129 @RequestMapping(value="getStationCode" , method = RequestMethod.GET)
82 130 public int getStationCode() {
83   -
84 131 return service.getStationCode();
85 132  
86 133 }
... ...
src/main/java/com/bsth/controller/StationRouteController.java
... ... @@ -4,10 +4,6 @@ import java.util.List;
4 4 import java.util.Map;
5 5  
6 6 import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.data.domain.Page;
8   -import org.springframework.data.domain.PageRequest;
9   -import org.springframework.data.domain.Sort;
10   -import org.springframework.data.domain.Sort.Direction;
11 7 import org.springframework.web.bind.annotation.RequestMapping;
12 8 import org.springframework.web.bind.annotation.RequestMethod;
13 9 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -38,9 +34,15 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
38 34 @Autowired
39 35 StationRouteService service;
40 36  
41   -
  37 + /**
  38 + * @Description :TODO(查询树站点与路段数据)
  39 + *
  40 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  41 + *
  42 + * @return List<Map<String, Object>>
  43 + */
42 44 @RequestMapping(value = "/findStations" , method = RequestMethod.GET)
43   - public List<Map<String, Object>> findPoints(@RequestParam Map<String, Object> map) {
  45 + public List<Map<String, Object>> findStations(@RequestParam Map<String, Object> map) {
44 46 return service.findPoints(map);
45 47 }
46 48  
... ... @@ -49,14 +51,40 @@ public class StationRouteController extends BaseController&lt;StationRoute, Integer
49 51 return service.systemQuote(map);
50 52 }
51 53  
  54 + /**
  55 + * @Description :TODO(查询线路某方向下的站点序号与类型)
  56 + *
  57 + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
  58 + *
  59 + * @return List<Map<String, Object>>
  60 + */
52 61 @RequestMapping(value = "/findUpStationRouteCode" , method = RequestMethod.GET)
53 62 public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) {
54 63 return service.findUpStationRouteCode(map);
55 64 }
56 65  
  66 + /**
  67 + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
  68 + *
  69 + * @param map <lineId:线路ID; direction:方向>
  70 + *
  71 + * @return List<Map<String, Object>>
  72 + */
57 73 @RequestMapping(value = "/getStationRouteCenterPoints" , method = RequestMethod.GET)
58 74 public List<Map<String, Object>> getStationRouteCenterPoints(@RequestParam Map<String, Object> map) {
59 75 return service.getStationRouteCenterPoints(map);
60 76 }
61 77  
  78 + /**
  79 + * @Description :TODO(撤销站点)
  80 + *
  81 + * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)>
  82 + *
  83 + * @return Map<String, Object> <SUCCESS ; ERROR>
  84 + */
  85 + @RequestMapping(value = "/stationRouteIsDestroy" , method = RequestMethod.POST)
  86 + public Map<String, Object> stationRouteIsDestroy(@RequestParam Map<String, Object> map) {
  87 + return service.stationRouteIsDestroy(map);
  88 + }
  89 +
62 90 }
... ...
src/main/java/com/bsth/entity/SectionRoute.java
... ... @@ -49,12 +49,15 @@ public class SectionRoute {
49 49 // 版本号
50 50 private Integer versions;
51 51  
  52 + // 是否撤销
  53 + private Integer destroy;
  54 +
52 55 // 描述
53 56 private String descriptions;
54 57  
55 58 // 创建人
56 59 private Integer createBy;
57   -
  60 +
58 61 // 修改人
59 62 private Integer updateBy;
60 63  
... ... @@ -121,6 +124,14 @@ public class SectionRoute {
121 124 public void setVersions(Integer versions) {
122 125 this.versions = versions;
123 126 }
  127 +
  128 + public Integer getDestroy() {
  129 + return destroy;
  130 + }
  131 +
  132 + public void setDestroy(Integer destroy) {
  133 + this.destroy = destroy;
  134 + }
124 135  
125 136 public String getDescriptions() {
126 137 return descriptions;
... ...
src/main/java/com/bsth/repository/SectionRepository.java
... ... @@ -32,6 +32,18 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
32 32 , nativeQuery=true)
33 33 public int sectionMaxId();
34 34  
  35 +
  36 + /**
  37 + * @Description :TODO(系统规划路段保存)
  38 + *
  39 + * @param map <sectionCode: 路段编码;sectionName:路段名称;crosesRoad:交叉路;endNode:终止节点;startNode:起始节点;
  40 + *
  41 + * middleNode:线路ID;gsectionVector:路段矢量(空间坐标点集合)WGS坐标点;bsectionVector:路段矢量(空间坐标点集合)--百度原始坐标坐标点;
  42 + *
  43 + * sectionType:路段类型 ;csectionVector:路段矢量(空间坐标点集合)--城建坐标点;roadCoding:路段编码;sectionDistance:路段距离;
  44 + *
  45 + * sectionTime:路段时间;dbType: 经纬坐标类型;speedLimit:限速;descriptions:描述;versions:版本号>
  46 + */
35 47 @Transactional
36 48 @Modifying
37 49 @Query(value="INSERT INTO bsth_c_section "+
... ... @@ -61,6 +73,13 @@ public interface SectionRepository extends BaseRepository&lt;Section, Integer&gt; {
61 73 String descriptions, int versions);
62 74  
63 75  
  76 + /**
  77 + * @Description :TODO(编辑线路走向)
  78 + *
  79 + * @param map <sectionId:路段ID; gsectionVector:折线WGS坐标;bsectionVector:折线百度坐标>
  80 + *
  81 + * @return Map<String, Object> <SUCCESS ; ERROR>
  82 + */
64 83 @Transactional
65 84 @Modifying
66 85 @Query(value="UPDATE bsth_c_section SET " +
... ...
src/main/java/com/bsth/repository/SectionRouteRepository.java
... ... @@ -28,6 +28,13 @@ import com.bsth.entity.SectionRoute;
28 28 @Repository
29 29 public interface SectionRouteRepository extends BaseRepository<SectionRoute, Integer> {
30 30  
  31 + /**
  32 + * @Description :TODO(查询路段信息)
  33 + *
  34 + * @param map <lineId:线路ID; directions:方向>
  35 + *
  36 + * @return List<Object[]>
  37 + */
31 38 @Query(value ="SELECT a.sectionrouteId," +
32 39 "a.sectionrouteLine," +
33 40 " a.sectionrouteLineCode," +
... ... @@ -58,14 +65,8 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
58 65 "r.section_code AS sectionrouteSectionCode," +
59 66 "r.sectionroute_code AS sectionrouteCode," +
60 67 "r.directions AS sectionrouteDirections" +
61   - " FROM bsth_c_sectionroute r where r.line = ?1 and r.directions = ?2 ) a " +
  68 + " FROM bsth_c_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " +
62 69 " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true)
63 70 List<Object[]> getSectionRoute(int lineId, int directions);
64 71  
65   - @Transactional
66   - @Modifying
67   - @Query(value="UPDATE bsth_c_stationroute SET " +
68   - "destroy = ?2 WHERE id = ?1", nativeQuery=true)
69   - public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy);
70   -
71 72 }
... ...
src/main/java/com/bsth/repository/StationRepository.java
... ... @@ -28,7 +28,11 @@ import com.bsth.entity.Station;
28 28 @Repository
29 29 public interface StationRepository extends BaseRepository<Station, Integer> {
30 30  
31   - // 查询最大ID
  31 + /**
  32 + * @Description :TODO(查询最大站点ID)
  33 + *
  34 + * @return int <站点id>
  35 + */
32 36 @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_station) k"
33 37 , nativeQuery=true)
34 38 int stationMaxId();
... ... @@ -37,7 +41,17 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
37 41 , nativeQuery=true)
38 42 List<Object[]> findStationName(String stationName);
39 43  
40   - // 站点保存
  44 + /**
  45 + * @Description :TODO(站点保存)
  46 + *
  47 + * @param map <stationCode:站点编码;stationName:站点名称;roadCoding:道路编码;dbType:原坐标类型;bJwpoints:中心点百度坐标
  48 + *
  49 + * gLonx:中心点WGS坐标经度;gLaty:中心点WGS坐标纬度;x:城建x;y:城建坐标y;gPloygonGrid:多变形WGS坐标;
  50 + *
  51 + * bPloygonGrid:多边形百度坐标;destroy:是否撤销;radius:圆半径;shapesType:图形类型;versions:版本号;
  52 + *
  53 + * descriptions:说明;createBy:创建人;updateBy:更新人>
  54 + */
41 55 @Transactional
42 56 @Modifying
43 57 @Query(value="INSERT INTO bsth_c_station (" +
... ... @@ -56,32 +70,42 @@ public interface StationRepository extends BaseRepository&lt;Station, Integer&gt; {
56 70  
57 71 Integer destroy,Integer radius,String shapesType,Integer versions,String descriptions,Integer createBy,Integer updateBy);
58 72  
59   - // 站点更新
60   - @Transactional
61   - @Modifying
62   - @Query(value="UPDATE bsth_c_station SET " +
63   - "station_cod = ?1 , " +
64   - "station_name = ?2 , " +
65   - "road_coding = ?3 , " +
66   - "db_type = ?4 , " +
67   - "b_jwpoints = ?5 , " +
68   - "g_lonx = ?6 , " +
69   - "g_laty = ?7 , " +
70   - "x = ?8 , " +
71   - "y = ?9 , " +
72   - "b_polygon_grid = GeomFromText(?10) , " +
73   - "g_polygon_grid = GeomFromText(?11) , " +
74   - "destroy = ?12 , " +
75   - "radius = ?13 , " +
76   - "shapes_type = ?14 , " +
77   - "versions = ?15 , " +
78   - "descriptions = ?16 " +
79   - " WHERE id = ?17 ", nativeQuery=true)
80   - public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints,
81   -
82   - String gLonx,String gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid,
83   -
84   - Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId);
  73 + /**
  74 + * @Description :TODO(站点更新)
  75 + *
  76 + * @param map <stationCode:站点编码;stationName:站点名称;roadCoding:道路编码;dbType:原坐标类型;bJwpoints:中心点百度坐标
  77 + *
  78 + * gLonx:中心点WGS坐标经度;gLaty:中心点WGS坐标纬度;x:城建x;y:城建坐标y;gPloygonGrid:多变形WGS坐标;
  79 + *
  80 + * bPloygonGrid:多边形百度坐标;destroy:是否撤销;radius:圆半径;shapesType:图形类型;versions:版本号;
  81 + *
  82 + * descriptions:说明;createBy:创建人;updateBy:更新人>
  83 + */
  84 + @Transactional
  85 + @Modifying
  86 + @Query(value="UPDATE bsth_c_station SET " +
  87 + "station_cod = ?1 , " +
  88 + "station_name = ?2 , " +
  89 + "road_coding = ?3 , " +
  90 + "db_type = ?4 , " +
  91 + "b_jwpoints = ?5 , " +
  92 + "g_lonx = ?6 , " +
  93 + "g_laty = ?7 , " +
  94 + "x = ?8 , " +
  95 + "y = ?9 , " +
  96 + "b_polygon_grid = GeomFromText(?10) , " +
  97 + "g_polygon_grid = GeomFromText(?11) , " +
  98 + "destroy = ?12 , " +
  99 + "radius = ?13 , " +
  100 + "shapes_type = ?14 , " +
  101 + "versions = ?15 , " +
  102 + "descriptions = ?16 " +
  103 + " WHERE id = ?17 ", nativeQuery=true)
  104 + public void stationUpdate(String stationCod,String stationName,String roadCoding,String dbType,String bJwpoints,
  105 +
  106 + String gLonx,String gLaty,Float x,Float y, String bPolygonGrid,String gPolygonGrid,
  107 +
  108 + Integer destroy, Integer radius,String shapesType, Integer versions,String descriptions,Integer stationId);
85 109  
86 110  
87 111 }
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -79,7 +79,14 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
79 79 "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true)
80 80 List<Object[]> findPoints(int line,int directions);
81 81  
82   -
  82 +
  83 + /**
  84 + * @Description :TODO(查询线路某方向下的站点序号与类型)
  85 + *
  86 + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
  87 + *
  88 + * @return List<Map<String, Object>>
  89 + */
83 90 @Query(value = "select t.station_route_code,t.station_mark from bsth_c_stationroute t where " +
84 91 " t.station_route_code =(" +
85 92 "select MAX(station_route_code) as stationRouteCode from bsth_c_stationroute r WHERE " +
... ... @@ -87,9 +94,28 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
87 94 List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
88 95  
89 96  
  97 + /**
  98 + * @Description :TODO(站点中心点坐标查询)
  99 + *
  100 + * @param map <lineId:线路ID; direction:方向>
  101 + *
  102 + * @return List<Object[]>
  103 + */
90 104 @Query(value = "SELECT s.b_jwpoints FROM (" +
91   - "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2) r " +
  105 + "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " +
92 106 "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)
93 107 List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction);
94 108  
  109 + /**
  110 + * @Description :TODO(撤销站点)
  111 + *
  112 + * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)>
  113 + *
  114 + */
  115 + @Transactional
  116 + @Modifying
  117 + @Query(value="UPDATE bsth_c_stationroute SET " +
  118 + "destroy = ?2 WHERE id = ?1", nativeQuery=true)
  119 + public void stationRouteIsDestroyUpd(Integer stationRouteId, Integer destroy);
  120 +
95 121 }
... ...
src/main/java/com/bsth/service/SectionRouteService.java
... ... @@ -23,6 +23,4 @@ import com.bsth.entity.SectionRoute;
23 23 public interface SectionRouteService extends BaseService<SectionRoute, Integer> {
24 24  
25 25 List<Map<String, Object>> getSectionRoute(Map<String, Object> map);
26   -
27   - Map<String, Object> stationRouteIsDestroy(Map<String, Object> map);
28 26 }
... ...
src/main/java/com/bsth/service/SectionService.java
... ... @@ -21,5 +21,12 @@ import com.bsth.entity.Section;
21 21 */
22 22 public interface SectionService extends BaseService<Section, Integer> {
23 23  
  24 + /**
  25 + * @Description :TODO(编辑线路走向)
  26 + *
  27 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  28 + *
  29 + * @return Map<String, Object> <SUCCESS ; ERROR>
  30 + */
24 31 Map<String, Object> sectionUpdate(Map<String, Object> map);
25 32 }
... ...
src/main/java/com/bsth/service/StationRouteService.java
... ... @@ -21,12 +21,42 @@ import com.bsth.entity.StationRoute;
21 21 *
22 22 */
23 23 public interface StationRouteService extends BaseService<StationRoute, Integer> {
24   -
  24 +
  25 + /**
  26 + * @Description :TODO(查询树站点与路段数据)
  27 + *
  28 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  29 + *
  30 + * @return List<Map<String, Object>>
  31 + */
25 32 List<Map<String, Object>> findPoints(Map<String, Object> map);
26 33  
27 34 Map<String, Object> systemQuote(Map<String, Object> map);
28 35  
  36 + /**
  37 + * @Description :TODO(查询线路某方向下的站点序号与类型)
  38 + *
  39 + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
  40 + *
  41 + * @return List<Map<String, Object>>
  42 + */
29 43 List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map);
30 44  
  45 + /**
  46 + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
  47 + *
  48 + * @param map <lineId:线路ID; direction:方向>
  49 + *
  50 + * @return List<Map<String, Object>>
  51 + */
31 52 List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map);
  53 +
  54 + /**
  55 + * @Description :TODO(撤销站点)
  56 + *
  57 + * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)>
  58 + *
  59 + * @return Map<String, Object> <SUCCESS ; ERROR>
  60 + */
  61 + Map<String, Object> stationRouteIsDestroy(Map<String, Object> map);
32 62 }
... ...
src/main/java/com/bsth/service/StationService.java
... ... @@ -21,14 +21,53 @@ import com.bsth.entity.Station;
21 21 */
22 22 public interface StationService extends BaseService<Station, Integer> {
23 23  
  24 + /**
  25 + * @Description :TODO(系统规划保存数据)
  26 + *
  27 + * @param map <stationJSON:站点信息; sectionJSON:路段信息;dbType:坐标类型; destroy:是否撤销; directions:方向;lineId:线路ID;
  28 + *
  29 + * radius:圆半径;shapesType:图形类型;speedLimit:限速>
  30 + *
  31 + * @return Map<String, Object> <SUCCESS ; ERROR>
  32 + */
24 33 Map<String, Object> systemSaveStations(Map<String, Object> map);
25 34  
26 35 Map<String, Object> manualSave(Map<String, Object> map);
27 36  
28 37 int getStationCode();
29 38  
  39 + /**
  40 + * @Description :TODO(新增站点保存)
  41 + *
  42 + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
  43 + *
  44 + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
  45 + *
  46 + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
  47 + *
  48 + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
  49 + *
  50 + * versions:版本号;x:城建坐标x;y:城建坐标y>
  51 + *
  52 + * @return Map<String, Object> <SUCCESS ; ERROR>
  53 + */
30 54 Map<String, Object> stationSaveMap(Map<String, Object> map);
31 55  
  56 + /**
  57 + * @Description :TODO(更新站点保存)
  58 + *
  59 + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
  60 + *
  61 + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
  62 + *
  63 + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
  64 + *
  65 + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
  66 + *
  67 + * versions:版本号;x:城建坐标x;y:城建坐标y>
  68 + *
  69 + * @return Map<String, Object> <SUCCESS ; ERROR>
  70 + */
32 71 Map<String, Object> stationUpdate(Map<String, Object> map);
33 72  
34 73 }
... ...
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
... ... @@ -35,6 +35,13 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
35 35 @Autowired
36 36 SectionRouteRepository repository;
37 37  
  38 + /**
  39 + * @Description :TODO(查询路段信息)
  40 + *
  41 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  42 + *
  43 + * @return Map<String, Object>
  44 + */
38 45 @Override
39 46 public List<Map<String, Object>> getSectionRoute(Map<String, Object> map) {
40 47  
... ... @@ -84,29 +91,4 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
84 91 return resultList;
85 92 }
86 93  
87   - @Override
88   - public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) {
89   - Map<String, Object> resultMap = new HashMap<String,Object>();
90   -
91   - try {
92   -
93   - Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString());
94   -
95   - Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString());
96   -
97   - repository.stationRouteIsDestroyUpd(stationRouteId, destroy);
98   -
99   - resultMap.put("status", ResponseCode.SUCCESS);
100   -
101   - } catch (Exception e) {
102   -
103   - resultMap.put("status", ResponseCode.ERROR);
104   -
105   - logger.error("save erro.", e);
106   -
107   - }
108   -
109   - return resultMap;
110   - }
111   -
112 94 }
... ...
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
... ... @@ -35,12 +35,21 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
35 35 @Autowired
36 36 SectionRepository repository;
37 37  
  38 + /**
  39 + * @Description :TODO(编辑线路走向)
  40 + *
  41 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  42 + *
  43 + * @return Map<String, Object> <SUCCESS ; ERROR>
  44 + */
38 45 @Override
39 46 public Map<String, Object> sectionUpdate(Map<String, Object> map) {
  47 +
40 48 Map<String, Object> resultMap = new HashMap<String, Object>();
41 49  
42 50 try {
43 51  
  52 + // 路段ID
44 53 Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString());
45 54  
46 55 // 路段信息字符串
... ... @@ -49,7 +58,6 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
49 58 // 如果路段信息JSON字符串不为空
50 59 if(!sectionJSON.equals("")) {
51 60  
52   -
53 61 // 转换成JSON数组
54 62 JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);
55 63  
... ... @@ -92,7 +100,10 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
92 100  
93 101 // 原坐标点集合
94 102 String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";
  103 +
  104 + // 更新
95 105 repository.sectionUpdate(sectionId, gsectionVector, bsectionVector);
  106 +
96 107 }
97 108  
98 109 resultMap.put("status", ResponseCode.SUCCESS);
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
... ... @@ -8,8 +8,6 @@ import java.util.Map;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Service;
10 10  
11   -import antlr.collections.impl.LList;
12   -
13 11 import com.bsth.common.ResponseCode;
14 12 import com.bsth.entity.Line;
15 13 import com.bsth.entity.Station;
... ... @@ -51,29 +49,36 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
51 49 @Autowired
52 50 private StationRepository stationRepository;
53 51  
  52 + /**
  53 + * @Description :TODO(查询树站点与路段数据)
  54 + *
  55 + * @param map <line.id_eq:线路ID; directions_eq:方向>
  56 + *
  57 + * @return List<Map<String, Object>>
  58 + */
54 59 @Override
55 60 public List<Map<String, Object>> findPoints(Map<String, Object> map) {
56 61  
57   - String lineStr = map.get("line.id_eq").equals("") ? "0" : map.get("line.id_eq").toString();
58   -
59   - String directionsStr = map.get("directions_eq").equals("") ? "0" : map.get("directions_eq").toString();
  62 + // 线路ID
  63 + Integer line = map.get("line.id_eq").equals("") ? null : Integer.parseInt(map.get("line.id_eq").toString());
60 64  
61   - int line = Integer.parseInt(lineStr);
  65 + // 方向
  66 + Integer directions = map.get("directions_eq").equals("") ? null : Integer.parseInt(map.get("directions_eq").toString());
62 67  
63   - int directions= Integer.parseInt(directionsStr);
64   -
  68 + // 查询站点
65 69 List<Object[]> stationList = repository.findPoints(line, directions);
66 70  
  71 + // 查询路段
67 72 List<Object[]> sectionList = routeRepository.getSectionRoute(line, directions);
68 73  
  74 + return treeListMap(stationList,sectionList);
  75 + }
  76 +
  77 + public List<Map<String, Object>> treeListMap(List<Object[]> stationList,List<Object[]> sectionList) {
69 78  
70 79 List<Map<String, Object>> resultList= new ArrayList<Map<String, Object>>();
71   - Map<String, Object> resultMap = new HashMap<String, Object>();
72   -
73   - List<Map<String, Object>> childrenTwo = new ArrayList<Map<String, Object>>();
74   - Map<String, Object> childrenStationMap = new HashMap<String, Object>();
75   -
76 80  
  81 + // 站点孩子节点
77 82 List<Map<String, Object>> staitonChildren= new ArrayList<Map<String, Object>>();
78 83  
79 84 if(stationList.size()>0) {
... ... @@ -82,100 +87,100 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
82 87  
83 88 Map<String, Object> tempM = new HashMap<String, Object>();
84 89  
85   - // stationRoute.id
  90 + // 站点路由ID
86 91 tempM.put("stationRouteId", stationList.get(i)[0]);
87 92  
88   - // stationRoute.line
  93 + // 站点路由线路ID
89 94 tempM.put("stationRouteLine", stationList.get(i)[1]);
90 95  
91   - // stationRoute.station
  96 + // 站点路由站点ID
92 97 tempM.put("stationRouteStation", stationList.get(i)[2]);
93 98  
94   - // stationRoute.stationName
  99 + // 站点路由站点名称
95 100 tempM.put("stationRouteStationName", stationList.get(i)[3]);
96 101  
97   - // stationRoute.stationRouteCode
  102 + // 站点路由站点序号
98 103 tempM.put("stationRouteStationRouteCode", stationList.get(i)[4]);
99 104  
100   - // stationRoute.lineCode
  105 + // 站点路由线路编码
101 106 tempM.put("stationRouteLineCode", stationList.get(i)[5]);
102 107  
103   - // stationRoute.stationMark
  108 + // 站点路由站点类型
104 109 tempM.put("stationRouteStationMark", stationList.get(i)[6]);
105 110  
106   - // stationRoute.outStationNmber
  111 + // 站点路由出站的序号
107 112 tempM.put("stationRouteOutStationNmber", stationList.get(i)[7]);
108 113  
109   - // stationRoute.directions
  114 + // 站点路由站点方向
110 115 tempM.put("stationRouteDirections", stationList.get(i)[8]);
111 116  
112   - // stationRoute.distances
  117 + // 站点路由站点到站距离
113 118 tempM.put("stationRouteDistances", stationList.get(i)[9]);
114 119  
115   - // stationRoute.toTime
  120 + // 站点路由到站时间
116 121 tempM.put("stationRouteToTime", stationList.get(i)[10]);
117 122  
118   - // stationRoute.firstTime
  123 + // 站点路由站点首班时间
119 124 tempM.put("stationRouteFirstTime", stationList.get(i)[11]);
120 125  
121   - // stationRoute.endTime
  126 + // 站点路由站点末班时间
122 127 tempM.put("stationRouteEndTime", stationList.get(i)[12]);
123 128  
124   - // stationRoute.descriptions
  129 + // 站点路由站点说明
125 130 tempM.put("stationRouteDescriptions", stationList.get(i)[13]);
126 131  
127   - // stationRoute.versions
  132 + // 站点路由版本
128 133 tempM.put("stationRouteVersions", stationList.get(i)[14]);
129 134  
130   - // station.id
  135 + // 站点ID
131 136 tempM.put("stationId", stationList.get(i)[15]);
132 137  
133   - // station.stationCod
  138 + // 站点编码
134 139 tempM.put("stationStationCod", stationList.get(i)[16]);
135 140  
136   - // station.stationName
  141 + // 站点名称
137 142 tempM.put("stationStationName", stationList.get(i)[17]);
138 143  
139   - // station.roadCoding
  144 + // 路段编码
140 145 tempM.put("stationRoadCoding", stationList.get(i)[18]);
141 146  
142   - // station.dbType
  147 + // 原坐标类型
143 148 tempM.put("stationDbType", stationList.get(i)[19]);
144 149  
145   - // station.bJwpoints
  150 + // 中心点(百度坐标)
146 151 tempM.put("stationBJwpoints", stationList.get(i)[20]);
147 152  
148   - // station.gLonx
  153 + // 中心点(WGS经度)
149 154 tempM.put("stationGLonx", stationList.get(i)[21]);
150 155  
151   - // station.gLaty
  156 + // 中心点(WGS纬度)
152 157 tempM.put("stationGLaty", stationList.get(i)[22]);
153 158  
154   - // station.x
  159 + // 城建坐标x
155 160 tempM.put("stationx", stationList.get(i)[23]);
156 161  
157   - // station.y
  162 + // 城建坐标y
158 163 tempM.put("stationy", stationList.get(i)[24]);
159 164  
160   - // station.shapesType
  165 + // 站点图形类型
161 166 tempM.put("stationShapesType", stationList.get(i)[25]);
162 167  
163   - // station.radius
  168 + // 站点圆半径
164 169 tempM.put("stationRadius", stationList.get(i)[26]);
165 170  
166   - // station.gPolygonGrid
  171 + // 站点图形WGS坐标
167 172 tempM.put("stationGPolygonGrid", stationList.get(i)[27]);
168 173  
169   - // station.bPolygonGrid
  174 + // 站点图形百度坐标
170 175 tempM.put("stationBPolygonGrid", stationList.get(i)[28]);
171 176  
172   - // station.destroy
  177 + // 是否撤销
173 178 tempM.put("stationDestroy", stationList.get(i)[29]);
174 179  
175   - // station.versions
  180 + // 站点版本
176 181 tempM.put("stationVersions", stationList.get(i)[30]);
177 182  
178   - // station.descriptions
  183 + // 站点说明
179 184 tempM.put("stationDescriptions", stationList.get(i)[31]);
180 185  
181 186 tempM.put("name", stationList.get(i)[17]);
... ... @@ -198,7 +203,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
198 203 }
199 204 }
200 205  
201   -
  206 + // 路段孩子节点
202 207 List<Map<String, Object>> sectionChildren = new ArrayList<Map<String, Object>>();
203 208  
204 209 if(sectionList.size()>0) {
... ... @@ -206,29 +211,74 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
206 211 for(int i = 0 ; i<sectionList.size() ; i++){
207 212  
208 213 Map<String, Object> tempM = new HashMap<String, Object>();
  214 +
  215 + // 路段路由ID
209 216 tempM.put("sectionrouteId",sectionList.get(i)[0]);
  217 +
  218 + // 路段路由线路ID
210 219 tempM.put("sectionrouteLine",sectionList.get(i)[1]);
  220 +
  221 + // 路段路由线路编码
211 222 tempM.put("sectionrouteLineCode",sectionList.get(i)[2]);
  223 +
  224 + // 路段路由路段ID
212 225 tempM.put("sectionrouteSection",sectionList.get(i)[3]);
  226 +
  227 + // 路段路由路段编码
213 228 tempM.put("sectionrouteSectionCode",sectionList.get(i)[4]);
  229 +
214 230 tempM.put("sectionrouteCode",sectionList.get(i)[5]);
  231 +
215 232 tempM.put("sectionrouteDirections",sectionList.get(i)[6]);
  233 +
  234 + // 路段ID
216 235 tempM.put("sectionId",sectionList.get(i)[7]);
  236 +
  237 + // 路段编码
217 238 tempM.put("sectionCode",sectionList.get(i)[8]);
  239 +
  240 + // 路段名称
218 241 tempM.put("sectionName",sectionList.get(i)[9]);
  242 +
  243 + // 道路编码
219 244 tempM.put("sectionCrosesRoad",sectionList.get(i)[10]);
  245 +
  246 + // 终点站
220 247 tempM.put("sectionEndNode",sectionList.get(i)[11]);
  248 +
  249 + // 起始节点
221 250 tempM.put("sectionStartNode",sectionList.get(i)[12]);
  251 +
  252 + // 中间节点
222 253 tempM.put("sectionMiddleNode",sectionList.get(i)[13]);
  254 +
  255 + // 路段类型
223 256 tempM.put("sectionType",sectionList.get(i)[14]);
  257 +
  258 + // 路段折线图形城建坐标
224 259 tempM.put("sectionCsectionVector",sectionList.get(i)[15]);
  260 +
  261 + // 路段折线图形百度坐标
225 262 tempM.put("sectionBsectionVector",sectionList.get(i)[16]);
  263 +
  264 + // 路段折线图形WGS坐标
226 265 tempM.put("sectionGsectionVector",sectionList.get(i)[17]);
  266 +
  267 + // 道路编码
227 268 tempM.put("sectionRoadCoding",sectionList.get(i)[18]);
  269 +
  270 + // 路段距离
228 271 tempM.put("sectionDistance",sectionList.get(i)[19]);
  272 +
  273 + // 路段时间
229 274 tempM.put("sectionTime",sectionList.get(i)[20]);
  275 +
  276 + // 路段原坐标类型
230 277 tempM.put("sectiondbType",sectionList.get(i)[21]);
  278 +
  279 + // 限速
231 280 tempM.put("sectionSpeedLimet",sectionList.get(i)[22]);
  281 +
232 282 tempM.put("name", sectionList.get(i)[9]);
233 283  
234 284 tempM.put("text", sectionList.get(i)[9]);
... ... @@ -240,13 +290,21 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
240 290 tempM.put("id", (i+1)*1000);
241 291  
242 292 tempM.put("groupType", "3");
  293 +
243 294 tempM.put("chaildredType", "section");
  295 +
244 296 tempM.put("enable", true);
  297 +
245 298 sectionChildren.add(tempM);
246 299  
247 300 }
248 301 }
249 302  
  303 + // 站点与路段孩子节点
  304 + List<Map<String, Object>> childrenTwo = new ArrayList<Map<String, Object>>();
  305 +
  306 + // 站点节点
  307 + Map<String, Object> childrenStationMap = new HashMap<String, Object>();
250 308 childrenStationMap.put("children", staitonChildren);
251 309 childrenStationMap.put("container", "pjax-container");
252 310 childrenStationMap.put("enable", true);
... ... @@ -260,6 +318,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
260 318 childrenStationMap.put("text", "站点");
261 319 childrenTwo.add(childrenStationMap);
262 320  
  321 + // 路段节点
263 322 Map<String, Object> childrenSectionMap = new HashMap<String, Object>();
264 323 childrenSectionMap.put("children", sectionChildren);
265 324 childrenSectionMap.put("container", "pjax-container");
... ... @@ -273,6 +332,8 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
273 332 childrenSectionMap.put("text", "路段");
274 333 childrenTwo.add(childrenSectionMap);
275 334  
  335 + // 站点与路段
  336 + Map<String, Object> resultMap = new HashMap<String, Object>();
276 337 resultMap.put("children", childrenTwo);
277 338 resultMap.put("container", "pjax-container");
278 339 resultMap.put("enable", true);
... ... @@ -285,10 +346,9 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
285 346 resultMap.put("text", "站点与路段");
286 347 resultList.add(resultMap);
287 348  
288   -
289 349 return resultList;
290 350 }
291   -
  351 +
292 352 @Override
293 353 public Map<String, Object> systemQuote(Map<String, Object> map) {
294 354 Map<String, Object> resultmap = new HashMap<>();
... ... @@ -316,7 +376,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
316 376 }
317 377 return resultmap;
318 378 }
319   -
  379 +
  380 + /**
  381 + * @Description :TODO(查询线路某方向下的站点序号与类型)
  382 + *
  383 + * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码>
  384 + *
  385 + * @return List<Map<String, Object>>
  386 + */
320 387 @Override
321 388 public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) {
322 389  
... ... @@ -345,14 +412,24 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
345 412  
346 413 return list;
347 414 }
348   -
  415 +
  416 +
  417 + /**
  418 + * @Description :TODO(查询线路某方向下所有站点的中心百度坐标)
  419 + *
  420 + * @param map <lineId:线路ID; direction:方向>
  421 + *
  422 + * @return List<Map<String, Object>>
  423 + */
349 424 @Override
350 425 public List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map) {
351 426  
352 427 List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
353 428  
  429 + // 线路ID
354 430 Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
355 431  
  432 + // 方向
356 433 Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
357 434  
358 435 List<Object[]> list = repository.getSelectStationRouteCenterPoints(lineId, direction);
... ... @@ -373,4 +450,36 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
373 450  
374 451 return resultList;
375 452 }
  453 +
  454 + /**
  455 + * @Description :TODO(撤销站点)
  456 + *
  457 + * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)>
  458 + *
  459 + * @return Map<String, Object> <SUCCESS ; ERROR>
  460 + */
  461 + @Override
  462 + public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) {
  463 + Map<String, Object> resultMap = new HashMap<String,Object>();
  464 +
  465 + try {
  466 +
  467 + Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString());
  468 +
  469 + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString());
  470 +
  471 + repository.stationRouteIsDestroyUpd(stationRouteId, destroy);
  472 +
  473 + resultMap.put("status", ResponseCode.SUCCESS);
  474 +
  475 + } catch (Exception e) {
  476 +
  477 + resultMap.put("status", ResponseCode.ERROR);
  478 +
  479 + logger.error("save erro.", e);
  480 +
  481 + }
  482 +
  483 + return resultMap;
  484 + }
376 485 }
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3 3 import java.math.BigDecimal;
4   -import java.util.ArrayList;
5 4 import java.util.HashMap;
6 5 import java.util.List;
7 6 import java.util.Map;
... ... @@ -64,6 +63,15 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
64 63  
65 64 Logger logger = LoggerFactory.getLogger(this.getClass());
66 65  
  66 + /**
  67 + * @Description :TODO(系统规划保存数据)
  68 + *
  69 + * @param map <stationJSON:站点信息; sectionJSON:路段信息;dbType:坐标类型; destroy:是否撤销; directions:方向;lineId:线路ID;
  70 + *
  71 + * radius:圆半径;shapesType:图形类型;speedLimit:限速>
  72 + *
  73 + * @return Map<String, Object> <SUCCESS ; ERROR>
  74 + */
67 75 @Override
68 76 public Map<String, Object> systemSaveStations(Map<String, Object> map) {
69 77  
... ... @@ -353,19 +361,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
353 361 // 道路编码
354 362 String roadCoding = "";
355 363  
356   - // 路段距离
357   - // double sectionDistance = 0;
358   -
359   - // 路段时间
360   - // double sectionTime = 0;
361   -
362 364 // 限速
363 365 double speedLimit = Double.parseDouble(speedLimitStr);
364 366  
365 367 // 说明
366 368 String descriptions = "";
367 369  
368   -
  370 + // 路段保存
369 371 sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode,
370 372  
371 373 middleNode, gsectionVector, bsectionVector, sectionType, csectionVector,
... ... @@ -382,7 +384,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
382 384 SectionRoute sectionRoute = new SectionRoute();
383 385  
384 386 // 路段序号
385   - sectionRoute.setSectionrouteCode(1);
  387 + sectionRoute.setSectionrouteCode(100);
386 388  
387 389 // 线路编码
388 390 sectionRoute.setLineCode(resultLine.getLineCode());
... ... @@ -390,6 +392,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
390 392 // 路段ID
391 393 sectionRoute.setSection(section);
392 394  
  395 + sectionRoute.setDestroy(destroy);
  396 +
393 397 // 线路ID
394 398 sectionRoute.setLine(resultLine);
395 399  
... ... @@ -402,6 +406,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
402 406 // 方向
403 407 sectionRoute.setDirections(directions);
404 408  
  409 + // 路段路由保存
405 410 sectionRouteRepository.save(sectionRoute);
406 411 }
407 412  
... ... @@ -447,13 +452,33 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
447 452 return temp;
448 453 }
449 454  
  455 + /**
  456 + * @Description :TODO(查询站点编码)
  457 + *
  458 + * @return int <stationCode站点编码>
  459 + */
450 460 @Override
451 461 public int getStationCode() {
452 462  
453 463 return repository.stationMaxId();
454 464  
455 465 }
456   -
  466 +
  467 + /**
  468 + * @Description :TODO(新增站点保存)
  469 + *
  470 + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
  471 + *
  472 + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
  473 + *
  474 + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
  475 + *
  476 + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
  477 + *
  478 + * versions:版本号;x:城建坐标x;y:城建坐标y>
  479 + *
  480 + * @return Map<String, Object> <SUCCESS ; ERROR>
  481 + */
457 482 @Override
458 483 public Map<String, Object> stationSaveMap(Map<String, Object> map) {
459 484  
... ... @@ -535,26 +560,27 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
535 560 // 修改人
536 561 Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
537 562  
  563 + // 线路ID
538 564 int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
539 565  
540 566 // 线路信息
541 567 Line resultLine = lineRepository.findOne(line);
542 568  
  569 + // 站点路由序号
543 570 String stationRouteCode = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString();
544 571  
  572 + // 站点类型
545 573 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString();
546 574  
547 575 String stationRouteCodeArray [] = null;
548 576  
549   -
550 577 if(stationRouteCode!="") {
551 578  
552 579 stationRouteCodeArray= stationRouteCode.split("_");
553 580  
554 581 }
555 582  
556   -
557   -
  583 + // 保存站点
558 584 repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints,
559 585  
560 586 gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
... ... @@ -569,33 +595,46 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
569 595  
570 596 StationRoute arg0 = new StationRoute();
571 597  
  598 + // 线路
572 599 arg0.setLine(resultLine);
573 600  
  601 + // 站点
574 602 arg0.setStation(station);
575 603  
  604 + // 站点路由名称
576 605 arg0.setStationName(stationName);
577 606  
  607 + // 站点路由编码
578 608 arg0.setStationCode(station.getStationCod());
579 609  
  610 + // 站点路由Id
580 611 arg0.setStationRouteCode(Integer.parseInt(stationRouteCodeArray[0])+1);
581 612  
  613 + // 站点路由类型
582 614 arg0.setStationMark(stationMark);
583 615  
  616 + // 站点路由站点方向
584 617 arg0.setDirections(directions);
585 618  
  619 + // 站点路由到站距离
586 620 arg0.setDistances(distances);
587 621  
  622 + // 站点路由到站时间
588 623 arg0.setToTime(toTime);
589 624  
  625 + // 站点版本号
590 626 arg0.setVersions(versions);
591 627  
  628 + // 是否撤销
  629 + arg0.setDestroy(destroy);
  630 +
  631 + // 站点路由说明
592 632 arg0.setDescriptions(descriptions);
593 633  
594 634 routeRepository.save(arg0);
595 635  
596 636 resultMap.put("status", ResponseCode.SUCCESS);
597 637  
598   -
599 638 } catch (Exception e) {
600 639  
601 640 resultMap.put("status", ResponseCode.ERROR);
... ... @@ -604,12 +643,24 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
604 643  
605 644 }
606 645  
607   -
608   -
609   -
610 646 return resultMap;
611 647 }
612   -
  648 +
  649 + /**
  650 + * @Description :TODO(更新站点保存)
  651 + *
  652 + * @param map <bJwpoints:中心点百度坐标;bPolygonGrid:多边形图形百度坐标;dbType:原坐标类型;
  653 + *
  654 + * descriptions:说明;destroy:是否撤销;directions:方向;distances:到站距离;gJwpoints:中心点WGS坐标;
  655 + *
  656 + * gPolygonGrid:多边形图形WGS坐标;lineId:线路ID;radius:圆半径;roadCoding:道路编码;shapesType:图形类型;
  657 + *
  658 + * stationCod:站点编码;stationMark:站点类型;stationName:站点名称;stationRouteCode:站点序号;toTime:到站时间
  659 + *
  660 + * versions:版本号;x:城建坐标x;y:城建坐标y>
  661 + *
  662 + * @return Map<String, Object> <SUCCESS ; ERROR>
  663 + */
613 664 @Override
614 665 public Map<String, Object> stationUpdate(Map<String, Object> map) {
615 666  
... ... @@ -695,30 +746,22 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
695 746  
696 747 String stationRouteCodeAraay[] = stationRouteCodeStr.split("_");
697 748  
698   - Integer old_code = resultS.getStationRouteCode();
  749 + int old_code = resultS.getStationRouteCode();
699 750  
700   - Integer new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+10;
  751 + int new_code = Integer.parseInt(stationRouteCodeAraay[0].toString())+100;
701 752  
702 753 if(new_code==old_code){
703 754  
704 755 stationRouteCode = new_code;
705 756  
706   - }else if(new_code>old_code) {
707   -
708   - stationRouteCode = new_code+1;
709   -
710   - }else if(new_code<old_code) {
711   -
712   - stationRouteCode = new_code-1;
  757 + }else {
  758 + stationRouteCode = new_code-100+1;
713 759  
714 760 }
715 761  
716   -
717   - // stationRouteCode = Integer.parseInt(stationRouteCodeAraay[0].toString()) + 10;
718   -
719 762 }
720 763  
721   - stationRouteCode = stationRouteCode == null ? 10 : stationRouteCode;
  764 + stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode;
722 765  
723 766 Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString());
724 767  
... ... @@ -761,6 +804,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
761 804  
762 805 stationRoute.setVersions(versions);
763 806  
  807 + stationRoute.setDestroy(destroy);
  808 +
764 809 stationRoute.setDescriptions(descriptions);
765 810  
766 811 routeRepository.save(stationRoute);
... ... @@ -831,15 +876,40 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
831 876  
832 877 if(!distanceStr.equals("")){
833 878  
834   - distance = Double.parseDouble(distanceStr.replaceAll("公里", ""));
  879 + if(distanceStr.indexOf("米")!=-1){
  880 +
  881 + distance = Double.parseDouble(distanceStr.replaceAll("米", ""));
  882 +
  883 + }else if(distanceStr.indexOf("公里")!=-1){
  884 +
  885 + distance = Double.parseDouble(distanceStr.replaceAll("公里", ""));
  886 +
  887 + }else {
  888 +
  889 + distance = Double.parseDouble(distanceStr);
  890 +
  891 + }
835 892  
836 893 }
837 894  
838 895 if(!durationStr.equals("")){
839 896  
840   - duration = Double.parseDouble(durationStr.replaceAll("分钟", ""));
  897 + if(durationStr.indexOf("小时")!=-1){
  898 +
  899 + duration = Double.parseDouble(durationStr.replaceAll("durationStr", ""))*60;
  900 +
  901 + }else if(durationStr.indexOf("分钟")!=-1){
  902 +
  903 + duration = Double.parseDouble(durationStr.replaceAll("分钟", ""));
  904 +
  905 + }else {
  906 +
  907 + duration = Double.parseDouble(durationStr);
  908 +
  909 + }
841 910  
842 911 }
  912 +
843 913 // 百度经纬度坐标
844 914 String bJwpoints = "";
845 915  
... ... @@ -918,12 +988,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
918 988  
919 989 route.setToTime(duration);
920 990  
  991 + route.setDestroy(destroy);
921 992  
922 993 // 站点编码
923 994 route.setStationCode(arg0.getStationCod());
924 995  
925 996 // 站点序号
926   - route.setStationRouteCode((i+1)*10);
  997 + route.setStationRouteCode((i+1)*100);
927 998  
928 999 // 站点类型
929 1000 if(i==0) {
... ... @@ -1077,7 +1148,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1077 1148 SectionRoute sectionRoute = new SectionRoute();
1078 1149  
1079 1150 // 路段序号
1080   - sectionRoute.setSectionrouteCode(1);
  1151 + sectionRoute.setSectionrouteCode((s+1)*100);
1081 1152  
1082 1153 // 线路编码
1083 1154 sectionRoute.setLineCode(resultLine.getLineCode());
... ... @@ -1094,6 +1165,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1094 1165 // 版本
1095 1166 sectionRoute.setVersions(versions);
1096 1167  
  1168 + sectionRoute.setDestroy(destroy);
  1169 +
1097 1170 // 方向
1098 1171 sectionRoute.setDirections(directions);
1099 1172  
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -259,7 +259,7 @@ $(function(){
259 259  
260 260 GetAjaxData.getSectionRouteInfo(id,add_direction_v,function(data) {
261 261  
262   - linePanlThree(data,add_direction_v);
  262 + PublicFunctions.linePanlThree(data,add_direction_v);
263 263  
264 264 });
265 265  
... ... @@ -487,11 +487,11 @@ $(function(){
487 487 layer.msg('添加成功...');
488 488  
489 489 // 刷行左边树
490   - resjtreeDate(id,params.directions);
  490 + PublicFunctions.resjtreeDate(id,params.directions);
491 491  
492 492 GetAjaxData.getSectionRouteInfo(id,params.directions,function(data) {
493 493  
494   - linePanlThree(data,params.directions);
  494 + PublicFunctions.linePanlThree(data,params.directions);
495 495  
496 496 });
497 497  
... ...
src/main/resources/static/pages/base/stationroute/add_manual_select.html
... ... @@ -68,7 +68,6 @@ $(function(){
68 68  
69 69 }
70 70  
71   -
72 71 });
73 72  
74 73 });
... ...
src/main/resources/static/pages/base/stationroute/add_select.html
... ... @@ -188,7 +188,7 @@ $(function(){
188 188 if(baseRes == 0) {
189 189  
190 190 // 验证系统是存在该站点名称
191   - var tempblm = isHaveStationName(data);
  191 + var tempblm = PublicFunctions.isHaveStationName(data);
192 192  
193 193 if(tempblm) {
194 194  
... ... @@ -203,7 +203,7 @@ $(function(){
203 203 GetAjaxData.getFormPointEToWGS(paramCentre,function(p) {
204 204  
205 205 // 设置值
206   - setFormInputValue(Points, p[0].WGSpotion.Lng,p[0].WGSpotion.Lat,'','','r',300);
  206 + PublicFunctions.setFormInputValue(Points, p[0].WGSpotion.Lng,p[0].WGSpotion.Lat,'','','r',300);
207 207  
208 208 // 以藏站点新增方式mobal
209 209 $('#add_select_mobal').modal('hide');
... ... @@ -232,7 +232,7 @@ $(function(){
232 232 }else if(baseRes==1) {
233 233  
234 234 // 验证系统是存在该站点名称
235   - var tempblm = isHaveStationName(data);
  235 + var tempblm = PublicFunctions.isHaveStationName(data);
236 236  
237 237 if(tempblm) {
238 238  
... ... @@ -259,25 +259,5 @@ $(function(){
259 259 }
260 260 });
261 261  
262   - function isHaveStationName(data) {
263   -
264   - if(data.length>0) {
265   -
266   - layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
267   -
268   - layer.close(index);
269   -
270   - });
271   -
272   - return false;
273   -
274   - }else {
275   -
276   - return true;
277   -
278   - }
279   -
280   - }
281   -
282 262 });
283 263 </script>
284 264 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/addstationstemplate.html
... ... @@ -34,8 +34,8 @@
34 34  
35 35 <div class="form-group">
36 36 <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
37   - <h5 class="block"><span class="help-block"> * 手动添加站点规划说明: </span></h5>
38   - <p><span class="help-block">&nbsp;请在文本域中按站点顺序依次输入站点名称,每输入完一个站名时请按回车键(Enter)换行.</span> </p>
  37 + <h5 class="block"><span class="help-block" style="color:#eee;"> * 手动添加站点规划说明: </span></h5>
  38 + <p><span class="help-block" style="color:#eee;">&nbsp;请在文本域中按站点顺序依次输入站点名称,每输入完一个站名时请按回车键(Enter)换行.</span> </p>
39 39 </div>
40 40 </div>
41 41 </form>
... ... @@ -50,49 +50,9 @@
50 50 <script type="text/javascript">
51 51 $(function(){
52 52  
53   - function eachSectionList(sectiondata,cb) {
54   -
55   - var dataLen_ = sectiondata.length;
56   -
57   - (function(){
58   -
59   - if (!arguments.callee.count) {
60   -
61   - arguments.callee.count = 0;
62   -
63   - }
64   -
65   - arguments.callee.count++;
66   -
67   - var index_ = parseInt(arguments.callee.count) - 1;
68   -
69   - if (index_ > dataLen_ -1) {
70   -
71   - cb && cb(sectiondata);
72   - return;
73   -
74   - }
75   -
76   - var p = arguments.callee;
77   -
78   - GetAjaxData.MuneBpointsArrayToWGS(sectiondata[index_].points,function(polyGonArray_) {
79   -
80   - sectiondata[index_].points = polyGonArray_;
81   -
82   - p();
83   - });
84   -
85   - })();
86   -
87   - }
88   -
89 53 // 延迟加载显示mobal
90 54 setTimeout(function(){$('#add_station_template_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
91 55  
92   - var directionData = $('.upManual').data('direction');
93   -
94   - // console.log();
95   -
96 56 // 获取表单元素
97 57 var form = $('#save_station_template_form');
98 58  
... ... @@ -154,26 +114,49 @@ $(function(){
154 114  
155 115 submitHandler : function(f) {
156 116  
  117 + // 隐藏手动规划弹出层
  118 + $('#add_station_template_mobal').modal('hide');
  119 +
  120 + var directionData = manualPararms.dir;
  121 +
  122 + // 上行
  123 + if(directionData==0){
  124 +
  125 + // 隐藏上行规划
  126 + $('#upToolsMobal').hide();
  127 +
  128 + // 下行
  129 + }else if(directionData==1){
  130 +
  131 + // 隐藏上行规划
  132 + $('#downToolsMobal').hide();
  133 +
  134 + }
  135 +
  136 + // 弹出正在加载层
  137 + var i = layer.load(0,{offset:['200px', '280px']});
  138 +
157 139 // 表单序列画
158 140 var params = form.serializeJSON();
159 141  
  142 + // 站点名称字符串切割
160 143 var paramsStationsArray = params.stations.split('\r\n');
161 144  
  145 + // 根据站点名称获取百度坐标
162 146 WorldsBMap.stationsNameToPoints(paramsStationsArray,function(resultJson) {
163 147  
  148 + // 根据坐标点获取两点之间的时间与距离
164 149 WorldsBMap.getDistanceAndTotime(resultJson,function(stationdataList) {
165 150  
  151 + // 根据坐标点获取两点之间的折线路段
166 152 WorldsBMap.getSectionListPlonly(stationdataList,function(sectiondata) {
167 153  
168   -
169   - eachSectionList(sectiondata,function(successdata) {
  154 + // 路段折线百度坐标转WGS坐标
  155 + PublicFunctions.eachSectionList(sectiondata,function(successdata) {
170 156  
  157 + // 站点坐标转WGS坐标
171 158 GetAjaxData.getFormPointEToWGS(stationdataList,function(stationdata) {
172 159  
173   - console.log(stationdata);
174   -
175   - console.log();
176   -
177 160 // 定义站点信息JSON字符串
178 161 var stationJSON = JSON.stringify(stationdata);
179 162  
... ... @@ -213,131 +196,53 @@ $(function(){
213 196 // 路段信息JSON字符串
214 197 params.sectionJSON = sectionJSON;
215 198  
  199 + console.log(params);
216 200  
217 201 // 保存
218   - $post('/station/manualSave',params,function(rd) {
  202 + GetAjaxData.manualSave(params,function(rd) {
219 203  
  204 + // 关闭弹出层
  205 + layer.closeAll();
  206 +
220 207 if(rd.status='SUCCESS') {
221 208  
222   - // 关闭弹出层
223   - // layer.closeAll();
  209 + // 清除地图覆盖物
  210 + map.clearOverlays();
224 211  
225   - // 显示表格
226   - // $('#hide_table').show();
  212 + layer.msg('保存成功!');
227 213  
228 214 // 刷新树
229   - resjtreeDate(id,directionData);
  215 + PublicFunctions.resjtreeDate(id,directionData);
230 216  
231   - }else {
  217 + // 查询上行路段信息
  218 + GetAjaxData.getSectionRouteInfo(id,directionData,function(data) {
  219 +
  220 + // 在地图上画出线路走向
  221 + PublicFunctions.linePanlThree(data,directionData);
  222 +
  223 + });
232 224  
233   - // 保存失败
  225 + }else {
234 226  
  227 + layer.msg('保存失败!');
235 228  
236 229 }
237 230  
238   -
239 231 });
240 232  
241 233 });
242 234  
243   -
244 235 });
245   - // console.log(sectiondata);
246 236  
247 237 });
248 238  
249   - /* GetAjaxData.getFormPointEToWGS(stationdataList,function(stationdata) {
250   -
251   -
252   -
253   -
254   - }); */
255   -
256   -
257   - /* // 百度站点坐标获取WGS坐标
258   - GetAjaxData.getFormPointEToWGS(stationdataList,function(stationdata) {
259   -
260   - eachSectionList(sectiondata,function(successdata) {
261   -
262   - console.log(successdata);
263   -
264   - // 定义站点信息JSON字符串
265   - var stationJSON = JSON.stringify(stationdata);
266   -
267   - // 定义路段信息字符串
268   - var sectionJSON = JSON.stringify(successdata);
269   -
270   - // 参数集合
271   - var params = {};
272   -
273   - // 站点信息JSON字符串
274   - params.stationJSON = stationJSON;
275   -
276   - // 线路ID
277   - params.lineId = id;
278   -
279   - // 方向
280   - params.directions = directionData;
281   -
282   - // 原始坐标类型
283   - params.dbType = 'b';
284   -
285   - // 圆形半径
286   - params.radius = '300';
287   -
288   - // 限速
289   - params.speedLimit = '60';
290   -
291   - // 图形类型(r:圆形;p:多边形)
292   - params.shapesType = 'r';
293   -
294   - // destroy:是否撤销
295   - params.destroy = '0';
296   -
297   - // versions:版本号
298   - params.versions = '1';
299   -
300   - // 路段信息JSON字符串
301   - params.sectionJSON = sectionJSON;
302   -
303   -
304   - // 保存
305   - $post('/station/manualSave',params,function(rd) {
306   -
307   - if(rd.status='SUCCESS') {
308   -
309   - // 关闭弹出层
310   - // layer.closeAll();
311   -
312   - // 显示表格
313   - // $('#hide_table').show();
314   -
315   - // 刷新树
316   - resjtreeDate(id,directionData);
317   -
318   - }else {
319   -
320   - // 保存失败
321   -
322   -
323   - }
324   -
325   -
326   - });
327   -
328   -
329   - })
330   -
331   - });
332   - */
333   - });
  239 + });
334 240  
335 241 });
336 242  
337 243 }
  244 +
338 245 });
339 246  
340   -
341   -
342 247 });
343 248 </script>
344 249 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
... ... @@ -3,7 +3,8 @@
3 3 width: calc(100% + 26px);
4 4 margin-top: -28px;
5 5 border: 2px solid #fdfdfd;
6   - height:800px;
  6 + min-height: 1200px;
  7 + height:100%;
7 8 overflow: hidden;
8 9 }
9 10  
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -228,7 +228,7 @@
228 228 <script type="text/javascript">
229 229 $(function(){
230 230  
231   - setFormValue();
  231 + PublicFunctions.setFormValue();
232 232  
233 233 var edit_direction_v = editStationParmas.stationRouteDirections;
234 234  
... ... @@ -286,7 +286,7 @@ $(function(){
286 286  
287 287 GetAjaxData.getSectionRouteInfo(id,diractionV,function(data) {
288 288  
289   - linePanlThree(data,diractionV);
  289 + PublicFunctions.linePanlThree(data,diractionV);
290 290  
291 291 });
292 292  
... ... @@ -428,11 +428,11 @@ $(function(){
428 428 layer.msg('修改成功...');
429 429  
430 430 // 刷行左边树
431   - resjtreeDate(id,params.directions);
  431 + PublicFunctions.resjtreeDate(id,params.directions);
432 432  
433 433 GetAjaxData.getSectionRouteInfo(id,params.directions,function(data) {
434 434  
435   - linePanlThree(data,params.directions);
  435 + PublicFunctions.linePanlThree(data,params.directions);
436 436  
437 437 });
438 438  
... ...
src/main/resources/static/pages/base/stationroute/edit_select.html
... ... @@ -71,12 +71,6 @@ $(function(){
71 71 // 显示选择修改方式弹出层
72 72 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
73 73  
74   - // 获取选中站点
75   - // var sel = getCurrSelNode(dir);
76   -
77   - // 设值修改时的参数集合
78   - // editSetStationParmas(sel);
79   -
80 74 // 获取站点名称元素并赋值
81 75 $('#stationNamebootbox').val(editStationParmas.stationNamebootbox);
82 76  
... ... @@ -173,7 +167,8 @@ $(function(){
173 167 var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px',
174 168 shift: 0,time: 10000});
175 169  
176   - WorldsBMap.coloseWindowsInfo(editStationName,stationShapesTypeV,mindex);
  170 + // 编辑图形
  171 + WorldsBMap.editShapes(editStationName,stationShapesTypeV,mindex);
177 172  
178 173 }else if(params.editselect==2){
179 174  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
... ... @@ -3,17 +3,40 @@
3 3 *
4 4 * - - - - - -》 collectionSave :系统规划保存请求
5 5 *
  6 + * - - - - - -》 getStation :树数据获取
6 7 *
  8 + * - - - - - -》 getStationRoutePoint :查询线路某方向下所有站点的中心百度坐标
7 9 *
  10 + * - - - - - -》 getLikeStationName :查询是否有已存在站点名称
  11 + *
  12 + * - - - - - -》 getStationCode:查询站点编码
  13 + *
  14 + * - - - - - -》 getFormPointEToWGS :原百度坐标转WGS坐标
  15 + *
  16 + * - - - - - -》 stationSave:新增站点保存
  17 + *
  18 + * - - - - - -》 stationUpdate:站点更新
  19 + *
  20 + * - - - - - -》 stationRouteIsDestroy:撤销站点
  21 + *
  22 + * - - - - - -》 sectionUpdate : 编辑线路走向保存
  23 + *
  24 + * - - - - - -》 getIdLineName:获取线路名称
  25 + *
  26 + * - - - - - -》 BpolyGonArrayToWGS:折线百度坐标转WGS坐标
  27 + *
  28 + * - - - - - -》 MuneBpointsArrayToWGS:手动规划百度坐标转WGS坐标
  29 + *
  30 + * - - - - - -》 getSectionRouteInfo:查询路段信息
8 31 */
9 32  
10 33 var GetAjaxData = function(){
11 34  
12 35 var ajaxData = {
13 36  
  37 + // 系统规划保存请求
14 38 collectionSave : function (params,callback) {
15 39  
16   - // 保存
17 40 $post('/station/collectionSave',params,function(rd) {
18 41  
19 42 callback && callback(rd);
... ... @@ -22,6 +45,7 @@ var GetAjaxData = function(){
22 45  
23 46 },
24 47  
  48 + // 树数据获取
25 49 getStation : function(id_,dir_,callback) {
26 50  
27 51 var treeDateJson = [];
... ... @@ -36,6 +60,7 @@ var GetAjaxData = function(){
36 60  
37 61 },
38 62  
  63 + // 查询线路某方向下所有站点的中心百度坐标
39 64 getStationRoutePoint : function(id_,dir_,callback) {
40 65  
41 66 $get('/stationroute/getStationRouteCenterPoints',{lineId:id_,direction:dir_},function(result) {
... ... @@ -46,6 +71,7 @@ var GetAjaxData = function(){
46 71  
47 72 },
48 73  
  74 + // 查询是否有已存在站点名称
49 75 getLikeStationName : function (stationName,callback) {
50 76  
51 77 $get('/station/all', {stationName_eq: stationName}, function(array){
... ... @@ -56,6 +82,7 @@ var GetAjaxData = function(){
56 82  
57 83 },
58 84  
  85 + // 查询站点编码
59 86 getStationCode : function(callback) {
60 87  
61 88 $get('/station/getStationCode',null,function(stationCode) {
... ... @@ -80,6 +107,7 @@ var GetAjaxData = function(){
80 107  
81 108 },
82 109  
  110 + // 原百度坐标转WGS坐标
83 111 getFormPointEToWGS: function(points,callback) {
84 112  
85 113 // 获取长度
... ... @@ -108,7 +136,6 @@ var GetAjaxData = function(){
108 136  
109 137 $.ajax({
110 138  
111   - // 百度坐标获取WGS坐标
112 139 url: 'http://api.zdoz.net/bd2wgs.aspx',
113 140  
114 141 data: {lat: points[index].potion.lat , lng: points[index].potion.lng},
... ... @@ -131,6 +158,7 @@ var GetAjaxData = function(){
131 158  
132 159 },
133 160  
  161 + // 新增站点保存
134 162 stationSave : function(station,callback) {
135 163  
136 164 $post('/station/stationSave',station,function(data) {
... ... @@ -141,6 +169,7 @@ var GetAjaxData = function(){
141 169  
142 170 },
143 171  
  172 + // 站点更新
144 173 stationUpdate : function(station,callback) {
145 174  
146 175 $post('/station/stationUpdate',station,function(data) {
... ... @@ -151,9 +180,10 @@ var GetAjaxData = function(){
151 180  
152 181 },
153 182  
  183 + // 撤销站点
154 184 stationRouteIsDestroy : function(stationRoute,callback) {
155 185  
156   - $post('/sectionroute/stationRouteIsDestroy',stationRoute,function(data) {
  186 + $post('/stationroute/stationRouteIsDestroy',stationRoute,function(data) {
157 187  
158 188 callback && callback(data);
159 189  
... ... @@ -161,6 +191,7 @@ var GetAjaxData = function(){
161 191  
162 192 },
163 193  
  194 + // 编辑线路走向保存
164 195 sectionUpdate:function(section,callback) {
165 196  
166 197 $post('/section/sectionUpdate',section,function(data) {
... ... @@ -182,6 +213,7 @@ var GetAjaxData = function(){
182 213  
183 214 },
184 215  
  216 + // 折线百度坐标转WGS坐标
185 217 BpolyGonArrayToWGS : function(polyGonArray,callback) {
186 218  
187 219 if(polyGonArray) {
... ... @@ -212,7 +244,6 @@ var GetAjaxData = function(){
212 244  
213 245 $.ajax({
214 246  
215   - // 百度坐标获取WGS坐标
216 247 url: 'http://api.zdoz.net/bd2wgs.aspx',
217 248  
218 249 data: {lat: polyGonArray[index].lat , lng: polyGonArray[index].lng},
... ... @@ -242,6 +273,7 @@ var GetAjaxData = function(){
242 273  
243 274 },
244 275  
  276 + // 手动规划百度坐标转WGS坐标
245 277 MuneBpointsArrayToWGS : function(polyGonArray,callback) {
246 278  
247 279 if(polyGonArray) {
... ... @@ -302,6 +334,7 @@ var GetAjaxData = function(){
302 334  
303 335 },
304 336  
  337 + // 查询路段信息
305 338 getSectionRouteInfo : function(lineId,direction,callback) {
306 339  
307 340 $get('/sectionroute/findSection',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) {
... ... @@ -310,6 +343,17 @@ var GetAjaxData = function(){
310 343  
311 344 });
312 345  
  346 + },
  347 +
  348 + manualSave : function(params,callback) {
  349 +
  350 + // 保存
  351 + $post('/station/manualSave',params,function(rd) {
  352 +
  353 + return callback && callback(rd);
  354 +
  355 + });
  356 +
313 357 }
314 358  
315 359 }
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
... ... @@ -16,13 +16,15 @@ $(function(){
16 16 var i = layer.load(0,{offset:['200px', '280px']});
17 17  
18 18 // 线路名称是否为区间
19   - lineNameIsHaveInterval(directionUpValue);
  19 + PublicFunctions.lineNameIsHaveInterval(directionUpValue);
20 20  
21 21 });
22 22  
23 23 // 上行站点其它规划点击事件
24 24 $('.upManual').on('click',function() {
25 25  
  26 + manualPararms.dir = directionUpValue;
  27 +
26 28 // 加载其它规划选择弹出层mobal页面
27 29 $.get('add_manual_select.html', function(m){$(pjaxContainer).append(m);});
28 30  
... ... @@ -42,7 +44,7 @@ $(function(){
42 44 // 修改上行站点mobal页面
43 45 $('.module_tools #editUpStation').on('click', function(){
44 46  
45   - var sel = getCurrSelNode(directionUpValue);
  47 + var sel = PublicFunctions.getCurrSelNode(directionUpValue);
46 48  
47 49 if(sel.length==0 || sel[0].original.chaildredType !='station'){
48 50  
... ... @@ -50,7 +52,7 @@ $(function(){
50 52  
51 53 return;
52 54 }
53   - editSetStationParmas(sel);
  55 + PublicFunctions.editSetStationParmas(sel);
54 56  
55 57 $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
56 58  
... ... @@ -59,14 +61,14 @@ $(function(){
59 61 // 撤销上行站点
60 62 $('.module_tools #deleteUpStation').on('click', function() {
61 63  
62   - stationRevoke(directionUpValue);
  64 + PublicFunctions.stationRevoke(directionUpValue);
63 65  
64 66 });
65 67  
66 68 // 编辑线路上行走向
67 69 $('.module_tools #editUplineTrend').on('click', function() {
68 70  
69   - editLinePlan(directionUpValue);
  71 + PublicFunctions.editLinePlan(directionUpValue);
70 72  
71 73 });
72 74  
... ... @@ -77,7 +79,7 @@ $(function(){
77 79  
78 80 GetAjaxData.getSectionRouteInfo(id,directionUpValue,function(data) {
79 81  
80   - linePanlThree(data,directionUpValue);
  82 + PublicFunctions.linePanlThree(data,directionUpValue);
81 83  
82 84 });
83 85  
... ... @@ -93,7 +95,17 @@ $(function(){
93 95 var i = layer.load(0,{offset:['200px', '280px']});
94 96  
95 97 // 线路名称是否为区间
96   - lineNameIsHaveInterval(directionDownValue);
  98 + PublicFunctions.lineNameIsHaveInterval(directionDownValue);
  99 +
  100 + });
  101 +
  102 + // 下行站点其它规划点击事件
  103 + $('.downManual').on('click',function() {
  104 +
  105 + manualPararms.dir = directionDownValue;
  106 +
  107 + // 加载其它规划选择弹出层mobal页面
  108 + $.get('add_manual_select.html', function(m){$(pjaxContainer).append(m);});
97 109  
98 110 });
99 111  
... ... @@ -111,7 +123,7 @@ $(function(){
111 123 // 修改下行站点mobal页面
112 124 $('.module_tools #editDownStation').on('click', function(){
113 125  
114   - var sel = getCurrSelNode(directionDownValue);
  126 + var sel = PublicFunctions.getCurrSelNode(directionDownValue);
115 127  
116 128 if(sel.length==0 || sel[0].original.chaildredType !='station'){
117 129  
... ... @@ -119,7 +131,7 @@ $(function(){
119 131  
120 132 return;
121 133 }
122   - editSetStationParmas(sel);
  134 + PublicFunctions.editSetStationParmas(sel);
123 135  
124 136 $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
125 137  
... ... @@ -128,14 +140,14 @@ $(function(){
128 140 // 撤销下行站点
129 141 $('.module_tools #deleteDownStation').on('click', function() {
130 142  
131   - stationRevoke(directionDownValue);
  143 + PublicFunctions.stationRevoke(directionDownValue);
132 144  
133 145 });
134 146  
135 147 // 编辑线路下行走向
136 148 $('.module_tools #editDownlineTrend').on('click', function() {
137 149  
138   - editLinePlan(directionDownValue);
  150 + PublicFunctions.editLinePlan(directionDownValue);
139 151  
140 152 });
141 153  
... ... @@ -146,7 +158,7 @@ $(function(){
146 158  
147 159 GetAjaxData.getSectionRouteInfo(id,directionDownValue,function(data) {
148 160  
149   - linePanlThree(data,directionDownValue);
  161 + PublicFunctions.linePanlThree(data,directionDownValue);
150 162  
151 163 });
152 164  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
... ... @@ -20,634 +20,1059 @@
20 20 * - - - - - - - 》 editLinePlan :编辑线路走向
21 21 *
22 22 * - - - - - - - 》 setFormValue :编辑站点设置表单元素值
  23 + *
  24 + * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标
23 25 */
24 26  
25   -/** @param diraction 方向 @return array */
26   -function getCurrSelNode(diraction){
27   -
28   - // 定义Obj
29   - var array = [];
  27 +var PublicFunctions = function () {
30 28  
31   - try {
32   -
33   - // 上行
34   - if(diraction=='0'){
  29 + var PubFun = {
35 30  
36   - // 获取上行选中节点
37   - array = $.jstree.reference("#station_Up_tree").get_selected(true);
38   -
39   - // 下行
40   - }else if(diraction=='1'){
41   -
42   - // 获取下行选中节点
43   - array = $.jstree.reference("#station_Down_tree").get_selected(true);
  31 + /** @param diraction 方向 @return array */
  32 + getCurrSelNode : function(diraction){
  33 +
  34 + // 定义Obj
  35 + var array = [];
  36 +
  37 + try {
  38 +
  39 + // 上行
  40 + if(diraction=='0'){
  41 +
  42 + // 获取上行选中节点
  43 + array = $.jstree.reference("#station_Up_tree").get_selected(true);
  44 +
  45 + // 下行
  46 + }else if(diraction=='1'){
  47 +
  48 + // 获取下行选中节点
  49 + array = $.jstree.reference("#station_Down_tree").get_selected(true);
  50 +
  51 + }
  52 +
  53 +
  54 + } catch (e) {
  55 +
  56 + console.log(e);
  57 +
  58 + }
  59 +
  60 + // 返回Obj
  61 + return array;
  62 + },
44 63  
45   - }
46   -
47   -
48   - } catch (e) {
49   -
50   - console.log(e);
51   -
52   - }
53   -
54   - // 返回Obj
55   - return array;
56   -}
  64 + /** @param id:线路ID ;directionData:方向 */
  65 + resjtreeDate : function(id,directionData){
  66 +
  67 + // 获取树数据
  68 + GetAjaxData.getStation(id,directionData,function(treeDateJson) {
  69 +
  70 + // 获取数据长度
  71 + var len = treeDateJson[0].children.length;
  72 +
  73 + // 上行
  74 + if(directionData==0){
  75 +
  76 + // 长度大于零
  77 + if(len>0) {
  78 +
  79 + // 隐藏上行规划
  80 + $('#upToolsMobal').hide();
  81 +
  82 + // 显示树
  83 + $('#uptreeMobal').show();
  84 +
  85 + // 刷新树
  86 + StationTreeData.upreloadeTree(treeDateJson);
  87 +
  88 + }else {
  89 +
  90 + // 显示上行规划
  91 + $('#upToolsMobal').show();
  92 +
  93 + // 隐藏上行树
  94 + $('#uptreeMobal').hide();
  95 +
  96 + }
  97 +
  98 + // 下行
  99 + }else if(directionData==1){
  100 +
  101 + // 如果长度大于
  102 + if(len>0) {
  103 +
  104 + // 隐藏下行规划
  105 + $('#downToolsMobal').hide();
  106 +
  107 + // 显示下行树
  108 + $('#DowntreeMobal').show();
  109 +
  110 + // 跟新树
  111 + StationTreeData.dwonreloadeTree(treeDateJson);
  112 +
  113 + }else {
  114 +
  115 + // 显示下行规划
  116 + $('#downToolsMobal').show();
  117 +
  118 + // 隐藏下行树
  119 + $('#DowntreeMobal').hide();
  120 +
  121 + }
  122 +
  123 + }
  124 +
  125 + });
  126 +
  127 + },
57 128  
58   -/** @param id:线路ID ;directionData:方向 */
59   -function resjtreeDate(id,directionData){
60   -
61   - // 获取树数据
62   - GetAjaxData.getStation(id,directionData,function(treeDateJson) {
63   -
64   - // 获取数据长度
65   - var len = treeDateJson[0].children.length;
66   -
67   - // 上行
68   - if(directionData==0){
69   -
70   - // 长度大于零
71   - if(len>0) {
  129 + /** @param sel 编辑树节点站点Obj */
  130 + editSetStationParmas : function(sel) {
72 131  
73   - // 隐藏上行规划
74   - $('#upToolsMobal').hide();
  132 + // 站点名称
  133 + editStationParmas.stationNamebootbox = sel[0].original.stationStationName;
75 134  
76   - // 显示树
77   - $('#uptreeMobal').show();
  135 + // 百度地图经纬度坐标中心点
  136 + editStationParmas.stationPointInput = sel[0].original.stationBJwpoints;
78 137  
79   - // 刷新树
80   - StationTreeData.upreloadeTree(treeDateJson);
  138 + // 站点WGS经度
  139 + editStationParmas.gLonx = sel[0].original.stationGLonx;
81 140  
82   - }else {
  141 + // WGS纬度
  142 + editStationParmas.gLaty = sel[0].original.stationGLaty;
83 143  
84   - // 显示上行规划
85   - $('#upToolsMobal').show();
  144 + // WGS图形坐标
  145 + editStationParmas.gPolygonGridInput = sel[0].original.stationGPolygonGrid;
86 146  
87   - // 隐藏上行树
88   - $('#uptreeMobal').hide();
  147 + // 百度图形坐标
  148 + editStationParmas.bPolygonGridInput = sel[0].original.stationBPolygonGrid;
89 149  
90   - }
91   -
92   - // 下行
93   - }else if(directionData==1){
  150 + // 站点图形类型
  151 + editStationParmas.shapesTypeInput = sel[0].original.stationShapesType;
  152 +
  153 + // 半径
  154 + editStationParmas.radiusInput = sel[0].original.stationRadius;
  155 +
  156 + // 是否撤销
  157 + editStationParmas.destroyInput = sel[0].original.stationDestroy;
  158 +
  159 + // 站点ID
  160 + editStationParmas.editUp_stationId = sel[0].original.stationId;
  161 +
  162 + // 站点编码
  163 + editStationParmas.editUp_stationStationCod = sel[0].original.stationStationCod;
  164 +
  165 + // 坐标类型
  166 + editStationParmas.editUp_stationDbType = sel[0].original.stationDbType;
  167 +
  168 + // 站点描述说明
  169 + editStationParmas.editUp_stationDescriptions = sel[0].original.stationDescriptions;
  170 +
  171 + // 站点是否撤销
  172 + editStationParmas.editUp_stationDestroy = sel[0].original.stationDestroy;
  173 +
  174 + // 站点道路编码
  175 + editStationParmas.stationRoadCoding = sel[0].original.stationRoadCoding;
  176 +
  177 + // 站点路由方向
  178 + editStationParmas.stationRouteDirections = sel[0].original.stationRouteDirections;
  179 +
  180 + // 站点路由距离
  181 + editStationParmas.stationRouteDistances = sel[0].original.stationRouteDistances;
  182 +
  183 + // 站点路由时间
  184 + editStationParmas.stationRouteToTime = sel[0].original.stationRouteToTime;
  185 +
  186 + // 站点路由ID
  187 + editStationParmas.stationRouteId = sel[0].original.stationRouteId;
  188 +
  189 + // 站点路由线路ID
  190 + editStationParmas.stationRouteLine = sel[0].original.stationRouteLine;
  191 +
  192 + // 站点路由线路编码
  193 + editStationParmas.stationRouteLineCode = sel[0].original.stationRouteLineCode;
  194 +
  195 + // 站点路由站点Id
  196 + editStationParmas.stationRouteStation = sel[0].original.stationRouteStation;
  197 +
  198 + // 站点路由类型
  199 + editStationParmas.stationRouteStationMark = sel[0].original.stationRouteStationMark;
  200 +
  201 + // 站点路由站点名称
  202 + editStationParmas.stationRouteStationName = sel[0].original.stationRouteStationName;
  203 +
  204 + // 站点路由序号
  205 + editStationParmas.stationRouteStationRouteCode = sel[0].original.stationRouteStationRouteCode;
  206 +
  207 + // 站点路由版本
  208 + editStationParmas.stationRouteVersions = sel[0].original.stationRouteVersions;
  209 +
  210 + // 站点编码
  211 + editStationParmas.stationStationCod = sel[0].original.stationStationCod;
  212 +
  213 + // 站点版本
  214 + editStationParmas.stationVersions = sel[0].original.stationVersions;
  215 +
  216 + // 站点路由说明
  217 + editStationParmas.stationRouteDescriptions = sel[0].original.stationRouteDescriptions;
  218 +
  219 + },
94 220  
95   - // 如果长度大于
96   - if(len>0) {
  221 + /** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */
  222 + setFormInputValue: function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
97 223  
98   - // 隐藏下行规划
99   - $('#downToolsMobal').hide();
  224 + // 百度地图经纬度坐标中心点
  225 + addStaitonParmas.stationPointInput = points;
100 226  
101   - // 显示下行树
102   - $('#DowntreeMobal').show();
  227 + // WGS经度
  228 + addStaitonParmas.gLonx = gLonx;
103 229  
104   - // 跟新树
105   - StationTreeData.dwonreloadeTree(treeDateJson);
  230 + // WGS经度
  231 + addStaitonParmas.gLaty = gLaty;
106 232  
107   - }else {
  233 + // 百度坐标点图形集合
  234 + addStaitonParmas.bPolygonGridInput = bPolygonGridValue;
108 235  
109   - // 显示下行规划
110   - $('#downToolsMobal').show();
  236 + // WGS坐标点图形集合
  237 + addStaitonParmas.gPolygonGridInput = gPolygonGridVlaue;
111 238  
112   - // 隐藏下行树
113   - $('#DowntreeMobal').hide();
  239 + // 图形类型
  240 + addStaitonParmas.shapesTypeInput = shapesTypeValue;
114 241  
115   - }
  242 + // 圆形半径
  243 + addStaitonParmas.radiusInput = radiusValue;
  244 +
  245 + // 是否撤销
  246 + addStaitonParmas.destroyInput = 0;
  247 +
  248 + },
116 249  
117   - }
118   -
119   - });
120   -
121   -}
122 250  
123   -/** @param sel 编辑树节点站点Obj */
124   -function editSetStationParmas(sel) {
125   -
126   - // 站点名称
127   - editStationParmas.stationNamebootbox = sel[0].original.stationStationName;
128   -
129   - // 百度地图经纬度坐标中心点
130   - editStationParmas.stationPointInput = sel[0].original.stationBJwpoints;
131   -
132   - // 站点WGS经度
133   - editStationParmas.gLonx = sel[0].original.stationGLonx;
134   -
135   - // WGS纬度
136   - editStationParmas.gLaty = sel[0].original.stationGLaty;
137   -
138   - // WGS图形坐标
139   - editStationParmas.gPolygonGridInput = sel[0].original.stationGPolygonGrid;
140   -
141   - // 百度图形坐标
142   - editStationParmas.bPolygonGridInput = sel[0].original.stationBPolygonGrid;
143   -
144   - // 站点图形类型
145   - editStationParmas.shapesTypeInput = sel[0].original.stationShapesType;
146   -
147   - // 半径
148   - editStationParmas.radiusInput = sel[0].original.stationRadius;
149   -
150   - // 是否撤销
151   - editStationParmas.destroyInput = sel[0].original.stationDestroy;
152   -
153   - // 站点ID
154   - editStationParmas.editUp_stationId = sel[0].original.stationId;
155   -
156   - // 站点编码
157   - editStationParmas.editUp_stationStationCod = sel[0].original.stationStationCod;
158   -
159   - // 坐标类型
160   - editStationParmas.editUp_stationDbType = sel[0].original.stationDbType;
161   -
162   - // 站点描述说明
163   - editStationParmas.editUp_stationDescriptions = sel[0].original.stationDescriptions;
164   -
165   - // 站点是否撤销
166   - editStationParmas.editUp_stationDestroy = sel[0].original.stationDestroy;
167   -
168   - // 站点道路编码
169   - editStationParmas.stationRoadCoding = sel[0].original.stationRoadCoding;
170   -
171   - // 站点路由方向
172   - editStationParmas.stationRouteDirections = sel[0].original.stationRouteDirections;
173   -
174   - // 站点路由距离
175   - editStationParmas.stationRouteDistances = sel[0].original.stationRouteDistances;
176   -
177   - // 站点路由时间
178   - editStationParmas.stationRouteToTime = sel[0].original.stationRouteToTime;
179   -
180   - // 站点路由ID
181   - editStationParmas.stationRouteId = sel[0].original.stationRouteId;
182   -
183   - // 站点路由线路ID
184   - editStationParmas.stationRouteLine = sel[0].original.stationRouteLine;
185   -
186   - // 站点路由线路编码
187   - editStationParmas.stationRouteLineCode = sel[0].original.stationRouteLineCode;
188   -
189   - // 站点路由站点Id
190   - editStationParmas.stationRouteStation = sel[0].original.stationRouteStation;
191   -
192   - // 站点路由类型
193   - editStationParmas.stationRouteStationMark = sel[0].original.stationRouteStationMark;
194   -
195   - // 站点路由站点名称
196   - editStationParmas.stationRouteStationName = sel[0].original.stationRouteStationName;
197   -
198   - // 站点路由序号
199   - editStationParmas.stationRouteStationRouteCode = sel[0].original.stationRouteStationRouteCode;
200   -
201   - // 站点路由版本
202   - editStationParmas.stationRouteVersions = sel[0].original.stationRouteVersions;
203   -
204   - // 站点编码
205   - editStationParmas.stationStationCod = sel[0].original.stationStationCod;
206   -
207   - // 站点版本
208   - editStationParmas.stationVersions = sel[0].original.stationVersions;
209   -
210   - // 站点路由说明
211   - editStationParmas.stationRouteDescriptions = sel[0].original.stationRouteDescriptions;
212   -
213   -}
214   -
215   -/** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */
216   -function setFormInputValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
217   -
218   - // 百度地图经纬度坐标中心点
219   - addStaitonParmas.stationPointInput = points;
220   -
221   - // WGS经度
222   - addStaitonParmas.gLonx = gLonx;
223   -
224   - // WGS经度
225   - addStaitonParmas.gLaty = gLaty;
226   -
227   - // 百度坐标点图形集合
228   - addStaitonParmas.bPolygonGridInput = bPolygonGridValue;
229   -
230   - // WGS坐标点图形集合
231   - addStaitonParmas.gPolygonGridInput = gPolygonGridVlaue;
232   -
233   - // 图形类型
234   - addStaitonParmas.shapesTypeInput = shapesTypeValue;
235   -
236   - // 圆形半径
237   - addStaitonParmas.radiusInput = radiusValue;
238   -
239   - // 是否撤销
240   - addStaitonParmas.destroyInput = 0;
241   -
242   -}
243   -
244   -/** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */
245   -function editSeteditStationParmasValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
246   -
247   - // 百度地图经纬度坐标中心点
248   - editStationParmas.stationPointInput = points;
249   -
250   - // WGS经度
251   - editStationParmas.gLonx = gLonx;
252   -
253   - // WGS经度
254   - editStationParmas.gLaty = gLaty;
255   -
256   - // 百度坐标点图形集合
257   - editStationParmas.bPolygonGridInput = bPolygonGridValue;
258   -
259   - // WGS坐标点图形集合
260   - editStationParmas.gPolygonGridInput = gPolygonGridVlaue;
261   -
262   - // 图形类型
263   - editStationParmas.shapesTypeInput = shapesTypeValue;
264   -
265   - // 圆形半径
266   - editStationParmas.radiusInput = radiusValue;
267   -
268   - // 是否撤销
269   - editStationParmas.destroyInput = 0;
270   -}
271   -
272   -
273   -/** @param directionData:方向 */
274   -function lineNameIsHaveInterval(directionData) {
275   -
276   - // 定义线路名称
277   - var lineNameV = $('.portlet-title .caption').text();
278   -
279   - // 线路名称是否为区间线路
280   - if(lineNameV.indexOf('区间')>0){
281   -
282   - // 截去区间
283   - var lineNameNew = lineNameV.replace('区间','');
284   -
285   - // 是否继续弹出层
286   - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
287   - btn : [ '确认提示并提交', '取消' ]
288   - }, function(index) {
289   -
290   - // 关闭弹出层
291   - layer.close(index);
292   -
293   - // 线路名称去掉区间
294   - lineNameV = lineNameNew;
295   -
296   - // 保存
297   - systemLineStation(lineNameV,directionData);
298   -
299   - },function(){
300   -
301   - // 关闭弹出层
302   - layer.closeAll();
303   -
304   - // 上行
305   - if(directionData==0){
  251 + /** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */
  252 + editSeteditStationParmasValue : function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
  253 +
  254 + // 百度地图经纬度坐标中心点
  255 + editStationParmas.stationPointInput = points;
  256 +
  257 + // WGS经度
  258 + editStationParmas.gLonx = gLonx;
306 259  
307   - // 显示上行规划
308   - $('#upToolsMobal').show();
  260 + // WGS经度
  261 + editStationParmas.gLaty = gLaty;
  262 +
  263 + // 百度坐标点图形集合
  264 + editStationParmas.bPolygonGridInput = bPolygonGridValue;
  265 +
  266 + // WGS坐标点图形集合
  267 + editStationParmas.gPolygonGridInput = gPolygonGridVlaue;
  268 +
  269 + // 图形类型
  270 + editStationParmas.shapesTypeInput = shapesTypeValue;
  271 +
  272 + // 圆形半径
  273 + editStationParmas.radiusInput = radiusValue;
  274 +
  275 + // 是否撤销
  276 + editStationParmas.destroyInput = 0;
  277 + },
309 278  
310   - // 下行
311   - }else if(directionData==1){
  279 + /** @param directionData:方向 */
  280 + lineNameIsHaveInterval : function(directionData) {
312 281  
313   - // 显示下行规划
314   - $('#downToolsMobal').show();
  282 + // 定义线路名称
  283 + var lineNameV = $('.portlet-title .caption').text();
315 284  
316   - }
  285 + // 线路名称是否为区间线路
  286 + if(lineNameV.indexOf('区间')>0){
  287 +
  288 + // 截去区间
  289 + var lineNameNew = lineNameV.replace('区间','');
  290 +
  291 + // 是否继续弹出层
  292 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  293 + btn : [ '确认提示并提交', '取消' ]
  294 + }, function(index) {
  295 +
  296 + // 关闭弹出层
  297 + layer.close(index);
  298 +
  299 + // 线路名称去掉区间
  300 + lineNameV = lineNameNew;
  301 +
  302 + // 保存
  303 + PublicFunctions.systemLineStation(lineNameV,directionData);
  304 +
  305 + },function(){
  306 +
  307 + // 关闭弹出层
  308 + layer.closeAll();
  309 +
  310 + // 上行
  311 + if(directionData==0){
  312 +
  313 + // 显示上行规划
  314 + $('#upToolsMobal').show();
  315 +
  316 + // 下行
  317 + }else if(directionData==1){
  318 +
  319 + // 显示下行规划
  320 + $('#downToolsMobal').show();
  321 +
  322 + }
  323 +
  324 + });
  325 +
  326 + }else {
  327 +
  328 + // 直接保存
  329 + PublicFunctions.systemLineStation(lineNameV,directionData);
  330 +
  331 + }
  332 +
  333 + },
317 334  
318   - });
319   -
320   - }else {
321   -
322   - // 直接保存
323   - systemLineStation(lineNameV,directionData);
324   -
325   - }
326   -
327   -}
328 335  
329   -/** @param lineNameV:线路名称 ; directionData:方向 */
330   -function systemLineStation(lineNameV,directionData) {
331   -
332   - // 从百度地图获取线路信息
333   - WorldsBMap.lineInfoPanl(lineNameV,directionData,mapB,function(BusLine){
334   -
335   - // 如果线路信息不为空
336   - if(BusLine) {
337   -
338   - // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
339   - var Polygon = BusLine.getPolyline();
340   -
341   - // 返回多边型的点数组(自1.2新增)
342   - var polyGonArray = Polygon.getPath();
343   -
344   - // 获取公交站点个数(自 1.2 新增)
345   - var stationNumber = BusLine.getNumBusStations();
  336 + /** @param lineNameV:线路名称 ; directionData:方向 */
  337 + systemLineStation : function(lineNameV,directionData) {
  338 +
  339 + // 从百度地图获取线路信息
  340 + WorldsBMap.lineInfoPanl(lineNameV,directionData,mapB,function(BusLine){
  341 +
  342 + // 如果线路信息不为空
  343 + if(BusLine) {
  344 +
  345 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  346 + var Polygon = BusLine.getPolyline();
  347 +
  348 + // 返回多边型的点数组(自1.2新增)
  349 + var polyGonArray = Polygon.getPath();
  350 +
  351 + // 获取公交站点个数(自 1.2 新增)
  352 + var stationNumber = BusLine.getNumBusStations();
  353 +
  354 + // 定义线路信息集合
  355 + var stationInfo = [];
  356 +
  357 + // 遍历
  358 + for(var k = 0 ; k < stationNumber; k++) {
  359 +
  360 + // 定义线路信息集合
  361 + var tempM = {};
  362 +
  363 + // 添加站点名称
  364 + tempM.name = BusLine.getBusStation(k).name;
  365 +
  366 + // 添加站点坐标
  367 + tempM.potion = BusLine.getBusStation(k).position;
  368 +
  369 + // 添加
  370 + stationInfo.push(tempM);
  371 +
  372 + }
  373 +
  374 + // 百度站点坐标获取WGS坐标
  375 + GetAjaxData.getFormPointEToWGS(stationInfo,function(result) {
  376 +
  377 + // 如果不为空
  378 + if(result) {
  379 +
  380 + // 折线覆盖物对象坐标点集合转WGS坐标
  381 + GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) {
  382 +
  383 + // 获取站点之间的距离与时间
  384 + WorldsBMap.getDistanceAndDuration(result,function(json) {
  385 +
  386 + // 设置第一个站的距离
  387 + json[0].distance = '';
  388 +
  389 + // 设置第一个站的时间
  390 + json[0].duration = '';
  391 +
  392 + // 定义站点信息JSON字符串
  393 + var stationJSON = JSON.stringify(json);
  394 +
  395 + // 定义路段信息字符串
  396 + var sectionJSON = JSON.stringify(arraydata);
  397 +
  398 + // 参数集合
  399 + var params = {};
  400 +
  401 + // 站点信息JSON字符串
  402 + params.stationJSON = stationJSON;
  403 +
  404 + // 线路ID
  405 + params.lineId = id;
  406 +
  407 + // 方向
  408 + params.directions = directionData;
  409 +
  410 + // 原始坐标类型
  411 + params.dbType = 'b';
  412 +
  413 + // 圆形半径
  414 + params.radius = '300';
  415 +
  416 + // 图形类型(r:圆形;p:多边形)
  417 + params.shapesType = 'r';
  418 +
  419 + // destroy:是否撤销
  420 + params.destroy = '0';
  421 +
  422 + // versions:版本号
  423 + params.versions = '1';
  424 +
  425 + // 路段信息JSON字符串
  426 + params.sectionJSON = sectionJSON;
  427 +
  428 + // 限速
  429 + params.speedLimit = '60';
  430 +
  431 + // 保存
  432 + GetAjaxData.collectionSave(params,function(rd) {
  433 +
  434 + if(rd.status='SUCCESS') {
  435 +
  436 + // 关闭弹出层
  437 + layer.closeAll();
  438 +
  439 + layer.msg('保存成功!');
  440 +
  441 + // 刷新树
  442 + PublicFunctions.resjtreeDate(id,directionData);
  443 +
  444 + }else {
  445 +
  446 + // 保存失败
  447 + layer.msg('保存失败!');
  448 + }
  449 +
  450 + });
  451 +
  452 + });
  453 +
  454 + });
  455 +
  456 + }
  457 +
  458 + });
  459 +
  460 + }
  461 +
  462 + });
  463 +
  464 + },
346 465  
347   - // 定义线路信息集合
348   - var stationInfo = [];
  466 + /** @param directionV_ :方向 */
  467 + stationRevoke : function(directionV_) {
  468 +
  469 + // 获取树选中节点对象
  470 + var obj = PublicFunctions.getCurrSelNode(directionV_);
  471 +
  472 + // 是否选中,选中节点是否为站点
  473 + if(obj.length == 0 || obj[0].original.chaildredType !='station'){
  474 +
  475 + // 弹出提示层
  476 + layer.msg('请先选择要删除的站点!');
  477 +
  478 + return;
  479 + }
  480 +
  481 + // 弹出是否撤销提示框
  482 + layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
  483 +
  484 + // 站点路由ID
  485 + var stationRouteId = obj[0].original.stationRouteId;
  486 +
  487 + // 撤销参数集合
  488 + var params = {stationRouteId:stationRouteId,destroy:'1'};
  489 +
  490 + // 方向
  491 + var stationRouteDirections = obj[0].original.stationRouteDirections;
  492 +
  493 + // 撤销
  494 + GetAjaxData.stationRouteIsDestroy(params,function(result) {
  495 +
  496 + // 关闭弹出框
  497 + layer.close(index);
  498 +
  499 + if(result.status=='SUCCESS'){
  500 +
  501 + layer.msg('撤销上行站点【'+obj[0].text+'】成功!');
  502 +
  503 + mapB.clearOverlays();
  504 + GetAjaxData.getSectionRouteInfo(id,stationRouteDirections,function(data) {
  505 +
  506 + // 刷新树
  507 + PublicFunctions.resjtreeDate(id,stationRouteDirections);
  508 +
  509 + PublicFunctions.linePanlThree(data,stationRouteDirections);
  510 +
  511 + });
  512 +
  513 +
  514 + }else{
  515 +
  516 + layer.msg('撤销上行站点【'+obj[0].text+'】失败!');
  517 +
  518 + }
  519 +
  520 + });
  521 +
  522 + });
  523 + },
349 524  
350   - // 遍历
351   - for(var k = 0 ; k < stationNumber; k++) {
  525 +
  526 + /** @param direction_ :方向 */
  527 + editLinePlan : function(direction_) {
352 528  
353   - // 定义线路信息集合
354   - var tempM = {};
  529 + var sel = PublicFunctions.getCurrSelNode(direction_);
355 530  
356   - // 添加站点名称
357   - tempM.name = BusLine.getBusStation(k).name;
  531 + if(sel.length==0 || sel[0].original.chaildredType !='section'){
  532 +
  533 + layer.msg('请先选中要编辑的上行路段!');
  534 +
  535 + return;
  536 + }
358 537  
359   - // 添加站点坐标
360   - tempM.potion = BusLine.getBusStation(k).position;
  538 + var sectionId = sel[0].original.sectionId;
361 539  
362   - // 添加
363   - stationInfo.push(tempM);
  540 + var sectionrouteDirections = sel[0].original.sectionrouteDirections;
364 541  
365   - }
366   -
367   - // 百度站点坐标获取WGS坐标
368   - GetAjaxData.getFormPointEToWGS(stationInfo,function(result) {
  542 + // 开启线路编辑
  543 + polyUpline.enableEditing();
  544 +
  545 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  546 + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
369 547  
370   - // 如果不为空
371   - if(result) {
  548 + // 添加双击折线保存事件
  549 + polyUpline.addEventListener('dblclick',function(e) {
  550 +
  551 + // 关闭
  552 + layer.close(yindex);
372 553  
373   - // 折线覆盖物对象坐标点集合转WGS坐标
374   - GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) {
  554 + polyUpline.disableEditing();
  555 +
  556 + // 弹出正在加载层
  557 + var i = layer.load(0,{title :'我是标题'});
  558 +
  559 + // 获取折线坐标集合
  560 + var editPloyLineArray = polyUpline.getPath();
  561 +
  562 + // 坐标转换WGS坐标
  563 + GetAjaxData.BpolyGonArrayToWGS(editPloyLineArray,function(arraydata) {
375 564  
376   - // 获取站点之间的距离与时间
377   - WorldsBMap.getDistanceAndDuration(result,function(json) {
378   -
379   - // 设置第一个站的距离
380   - json[0].distance = '';
381   -
382   - // 设置第一个站的时间
383   - json[0].duration = '';
  565 + // 定义路段信息字符串
  566 + var sectionJSON = JSON.stringify(arraydata);
  567 +
  568 + var params = {sectionId:sectionId,sectionJSON:sectionJSON}
  569 +
  570 + GetAjaxData.sectionUpdate(params,function(result) {
  571 +
  572 + layer.close(i);
  573 +
  574 + if(result.status=='SUCCESS'){
384 575  
385   - // 定义站点信息JSON字符串
386   - var stationJSON = JSON.stringify(json);
  576 + layer.msg('修改上行路段成功!');
387 577  
388   - // 定义路段信息字符串
389   - var sectionJSON = JSON.stringify(arraydata);
  578 + }else{
390 579  
391   - // 参数集合
392   - var params = {};
  580 + layer.msg('修改上行路段失败!');
393 581  
394   - // 站点信息JSON字符串
395   - params.stationJSON = stationJSON;
  582 + }
  583 + mapB.clearOverlays();
  584 + GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) {
396 585  
397   - // 线路ID
398   - params.lineId = id;
  586 + // 刷新树
  587 + PublicFunctions.resjtreeDate(id,sectionrouteDirections);
399 588  
400   - // 方向
401   - params.directions = directionData;
  589 + PublicFunctions.linePanlThree(data,sectionrouteDirections);
402 590  
403   - // 原始坐标类型
404   - params.dbType = 'b';
  591 + });
  592 + });
  593 +
  594 + });
  595 +
  596 + });
  597 + },
  598 +
  599 + setFormValue : function() {
  600 +
  601 + // 站点ID
  602 + $('#stationIdInput').val(editStationParmas.editUp_stationId);
  603 +
  604 + // 站点路由ID
  605 + $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
  606 +
  607 + // 站点路由线路Id
  608 + $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
  609 +
  610 + // 线路编码
  611 + $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
  612 +
  613 + // WGS坐标点图形集合
  614 + $('#bPolygonGridInput').val(editStationParmas.bPolygonGridInput);
  615 +
  616 + // 百度坐标点图形集合
  617 + $('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput);
  618 +
  619 + // 获取站点名称元素设值
  620 + $('#stationNameInput').val(editStationParmas.stationNamebootbox);
  621 +
  622 + // 获取站点编码元素设值
  623 + $('#stationCodInput').val(editStationParmas.editUp_stationStationCod);
  624 +
  625 + // 获取站点类型元素设值
  626 + $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
  627 +
  628 + // 获取站点方向元素设值
  629 + $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
  630 +
  631 + // 获取站点道路编码元素设值
  632 + $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
  633 +
  634 + // 百度地图经纬度坐标中心点
  635 + $('#bJwpointsInput').val(editStationParmas.stationPointInput);
  636 +
  637 + // WGS经纬度
  638 + $('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty);
  639 +
  640 + // 获取图形类型元素,并添加值
  641 + $('#shapesTypeSelect').val(editStationParmas.shapesTypeInput);
  642 +
  643 + // 获取方向元素,并添加值
  644 + $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
  645 +
  646 + // 获取半径元素,并添加值
  647 + $('#radiusInput').val(editStationParmas.radiusInput);
  648 +
  649 + // 是否撤销
  650 + $('#destroySelect').val(editStationParmas.destroyInput);
  651 +
  652 + // 到站时间
  653 + $('#toTimeInput').val(editStationParmas.stationRouteToTime);
  654 +
  655 + // 到站距离
  656 + $('#distancesInput').val(editStationParmas.stationRouteToTime);
  657 +
  658 + // 描述/说明
  659 + $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
  660 +
  661 + },
  662 +
  663 + /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/
  664 + getBmapStationNames : function(lineNameValue,i,map,callback) {
  665 +
  666 + var busline = new BMap.BusLineSearch(map,{
  667 +
  668 + // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
  669 + onGetBusListComplete:function(BusListResult) {
  670 +
  671 + // 如果不为空
  672 + if(BusListResult){
405 673  
406   - // 圆形半径
407   - params.radius = '300';
  674 + //获取第一个公交列表显示到map上
  675 + var fstLine = BusListResult.getBusListItem(i);
408 676  
409   - // 图形类型(r:圆形;p:多边形)
410   - params.shapesType = 'r';
  677 + if(fstLine==undefined){
  678 +
  679 + layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  680 +
  681 + layer.closeAll();
  682 +
  683 + if(i==0){
  684 +
  685 + $('#upToolsMobal').show();
  686 +
  687 + }else if(i==1){
  688 +
  689 + $('#downToolsMobal').show();
  690 +
  691 + }
  692 +
  693 + return;
  694 + });
  695 +
  696 + }
411 697  
412   - // destroy:是否撤销
413   - params.destroy = '0';
  698 + busline.getBusLine(fstLine);
414 699  
415   - // versions:版本号
416   - params.versions = '1';
  700 + }
  701 +
  702 + },
  703 +
  704 + //设置公交线路查询后的回调函数.参数:rs: BusLine类型
  705 + onGetBusLineComplete: function(BusLine){
  706 +
  707 + // 如果不为空
  708 + if(BusLine){
417 709  
418   - // 路段信息JSON字符串
419   - params.sectionJSON = sectionJSON;
  710 + callback && callback(BusLine);
420 711  
421   - // 限速
422   - params.speedLimit = '60';
  712 + }
  713 +
  714 + }
  715 +
  716 + });
  717 +
  718 + busline.getBusList(lineNameValue);
  719 +
  720 + },
  721 +
  722 + /** 设置地图属性 与监听绘画事件 */
  723 + setMapEvent : function(map) {
  724 +
  725 + //启用地图拖拽事件,默认启用(可不写)
  726 + map.enableDragging();
  727 +
  728 + //启用地图滚轮放大缩小
  729 + map.enableScrollWheelZoom();
  730 +
  731 + //禁用鼠标双击放大
  732 + map.disableDoubleClickZoom();
  733 +
  734 + //启用键盘上下左右键移动地图
  735 + map.enableKeyboard();
  736 +
  737 + var styleOptions = {
  738 +
  739 + //边线颜色。
  740 + strokeColor : "blue",
  741 +
  742 + //填充颜色。当参数为空时,圆形将没有填充效果。
  743 + fillColor : "blue",
  744 +
  745 + //边线的宽度,以像素为单位。
  746 + strokeWeight : 3,
  747 +
  748 + //边线透明度,取值范围0 - 1。
  749 + strokeOpacity : 0.8,
  750 +
  751 + //填充的透明度,取值范围0 - 1。
  752 + fillOpacity : 0.6,
  753 +
  754 + //边线的样式,solid或dashed。
  755 + strokeStyle : 'solid'
423 756  
424   - // 保存
425   - GetAjaxData.collectionSave(params,function(rd) {
  757 + };
  758 +
  759 + // 创建鼠标绘制管理类
  760 + drawingManager = new BMapLib.DrawingManager(map, {
  761 +
  762 + //是否开启绘制模式
  763 + isOpen : false,
  764 +
  765 + //是否显示工具栏
  766 + enableDrawingTool : false,
  767 +
  768 + drawingToolOptions : {
  769 +
  770 + //位置
  771 + anchor : BMAP_ANCHOR_TOP_RIGHT,
  772 +
  773 + //偏离值
  774 + offset : new BMap.Size(5, 5),
  775 +
  776 + //工具栏缩放比例
  777 + scale : 0.8
  778 +
  779 + },
  780 +
  781 + //线的样式
  782 + polygonOptions : styleOptions
  783 +
  784 + });
  785 +
  786 + // 添加绘画完成事件
  787 + drawingManager.addEventListener('polygoncomplete', function(e) {
  788 +
  789 + if (e.getPath().length <= 2) {
  790 +
  791 + // 弹出提示消息
  792 + layer.msg('坐标点不能小于等于两个...');
  793 +
  794 + // 清除地图覆盖物
  795 + map.clearOverlays();
  796 +
  797 + // 加载该线路下所有站点位置添加到地图上
  798 + return false;
  799 +
  800 + }else {
  801 +
  802 + var pointE = e;
  803 +
  804 + // 多变行质心点
  805 + var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;
  806 +
  807 + var PointsList = [];
  808 +
  809 + for ( var i = 0; i < pointE.getPath().length; i++) {
426 810  
427   - if(rd.status='SUCCESS') {
  811 + PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}});
  812 +
  813 + }
  814 +
  815 + PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}});
  816 +
  817 + var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}];
  818 +
  819 + GetAjaxData.getFormPointEToWGS(PointsList,function(resultdata) {
  820 +
  821 + var gPloygonGrid = '';
  822 +
  823 + var bPloygonGrid = '';
  824 +
  825 + for(var k =0;k<resultdata.length;k++) {
428 826  
429   - // 关闭弹出层
430   - layer.closeAll();
  827 + if(k==0) {
  828 +
  829 + gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
  830 +
  831 + bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
  832 +
  833 + }else {
  834 +
  835 + gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
  836 +
  837 + bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
  838 +
  839 + }
431 840  
432   - layer.msg('保存成功!');
  841 + }
  842 +
  843 + gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))';
  844 +
  845 + bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))';
  846 +
  847 + GetAjaxData.getFormPointEToWGS(centre,function(p) {
  848 +
  849 + var gLonx = p[0].WGSpotion.Lng;
433 850  
434   - // 刷新树
435   - resjtreeDate(id,directionData);
  851 + var gLaty = p[0].WGSpotion.Lat;
  852 +
  853 + if(status=='add'){
  854 +
  855 + PublicFunctions.setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');
436 856  
437   - }else {
  857 + status = '';
438 858  
439   - // 保存失败
440   - layer.msg('保存失败!');
441   - }
  859 + $.get('add.html', function(m){$(pjaxContainer).append(m);});
  860 +
  861 + }else if(status=='edit'){
  862 +
  863 + PublicFunctions.editSeteditStationParmasValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');
  864 +
  865 + status = '';
  866 +
  867 + $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  868 +
  869 + }
  870 +
  871 + });
  872 +
  873 + });
  874 +
  875 + }
  876 +
  877 + });
  878 + },
  879 +
  880 + /** @param data,direction */
  881 + linePanlThree : function(data,direction) {
  882 +
  883 + GetAjaxData.getStationRoutePoint(id,direction,function(resultdata) {
  884 +
  885 + var dataLen = data.length;
  886 +
  887 + if(dataLen>0) {
  888 +
  889 + for(var d= 0; d<dataLen;d++){
  890 +
  891 + var sectionBsectionVectorStr = data[d].sectionBsectionVector;
  892 +
  893 + if(sectionBsectionVectorStr==null) {
442 894  
443   - });
  895 + continue;
  896 +
  897 + }
444 898  
445   - });
  899 + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
  900 +
  901 + var lineArray = tempStr.split(',');
  902 +
  903 + var polylineArray = [];
  904 +
  905 + for(var i = 0;i<lineArray.length;i++) {
  906 +
  907 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  908 +
  909 + }
  910 + WorldsBMap.drawingUpline(polylineArray,resultdata);
  911 +
  912 + }
446 913  
447   - });
448   -
449   - }
450   -
451   - });
452   -
453   - }
454   -
455   - });
456   -
457   -}
  914 + if(resultdata.length>0) {
  915 +
  916 + for(var s = 0 ; s<resultdata.length;s++) {
  917 +
  918 + var bJwpointsStr = resultdata[s].bJwpoints;
  919 +
  920 + var bJwpointsArray = bJwpointsStr.split(' ');
  921 +
  922 + var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
  923 +
  924 + // 自定义标注物图片
  925 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
458 926  
459   -/** @param directionV_ :方向 */
460   -function stationRevoke(directionV_) {
461   -
462   - // 获取树选中节点对象
463   - var obj = getCurrSelNode(directionV_);
464   -
465   - // 是否选中,选中节点是否为站点
466   - if(obj.length == 0 || obj[0].original.chaildredType !='station'){
467   -
468   - // 弹出提示层
469   - layer.msg('请先选择要删除的站点!');
470   -
471   - return;
472   - }
473   -
474   - // 弹出是否撤销提示框
475   - layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
476   -
477   - // 站点路由ID
478   - var stationRouteId = obj[0].original.stationRouteId;
479   -
480   - // 撤销参数集合
481   - var params = {stationRouteId:stationRouteId,destroy:'1'};
482   -
483   - // 方向
484   - var stationRouteDirections = obj[0].original.stationRouteDirections;
485   -
486   - // 撤销
487   - GetAjaxData.stationRouteIsDestroy(params,function(result) {
488   -
489   - // 关闭弹出框
490   - layer.close(index);
491   -
492   - if(result.status=='SUCCESS'){
493   -
494   - layer.msg('撤销上行站点【'+obj[0].text+'】成功!');
495   -
496   - mapB.clearOverlays();
497   - GetAjaxData.getSectionRouteInfo(id,stationRouteDirections,function(data) {
498   -
499   - // 刷新树
500   - resjtreeDate(id,stationRouteDirections);
501   -
502   - linePanlThree(data,stationRouteDirections);
  927 + // 创建标注物
  928 + var markers_thread = new BMap.Marker(point_center,{icon : icon_target});
  929 +
  930 + // 允许覆盖物在map.clearOverlays方法中被清除。
  931 + markers_thread.enableMassClear();
  932 +
  933 + // 清除marker
  934 + mapB.removeOverlay(markers_thread);
  935 +
  936 + mapB.addOverlay(markers_thread);
  937 +
  938 + }
  939 +
  940 + }
  941 +
  942 + }
503 943  
504 944 });
505 945  
  946 + },
  947 +
  948 + /** 加载树 */
  949 + TreeUpOrDown : function(lineId,diraction) {
  950 +
  951 + GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
506 952  
507   - }else{
  953 + var len = treeDateJson[0].children[0].children.length;
508 954  
509   - layer.msg('撤销上行站点【'+obj[0].text+'】失败!');
  955 + // 上行
  956 + if(diraction == 0) {
  957 +
  958 + StationTreeData.upInit(treeDateJson);
  959 +
  960 + if(len>0) {
  961 +
  962 + $('#upToolsMobal').hide();
  963 +
  964 + $('#uptreeMobal').show();
  965 +
  966 + }else {
  967 +
  968 + $('#upToolsMobal').show();
  969 +
  970 + $('#uptreeMobal').hide();
  971 +
  972 + }
  973 +
  974 +
  975 + // 下行
  976 + }else if(diraction ==1) {
  977 +
  978 + var stationDownTree = $('#station_Down_tree');
  979 +
  980 + StationTreeData.downInit(treeDateJson);
  981 +
  982 + if(len>0) {
  983 +
  984 + $('#downToolsMobal').hide();
  985 +
  986 + $('#DowntreeMobal').show();
  987 +
  988 + }else {
  989 +
  990 + $('#downToolsMobal').show();
  991 +
  992 + $('#DowntreeMobal').hide();
  993 +
  994 + }
  995 +
  996 + }
510 997  
511   - }
512   -
513   - });
514   -
515   - });
516   -}
517   -
518   -/** @param direction_ :方向 */
519   -function editLinePlan(direction_) {
520   -
521   - var sel = getCurrSelNode(direction_);
522   -
523   - if(sel.length==0 || sel[0].original.chaildredType !='section'){
524   -
525   - layer.msg('请先选中要编辑的上行路段!');
526   -
527   - return;
528   - }
529   -
530   - var sectionId = sel[0].original.sectionId;
531   -
532   - var sectionrouteDirections = sel[0].original.sectionrouteDirections;
533   -
534   - // 开启线路编辑
535   - polyUpline.enableEditing();
536   -
537   - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
538   - var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
539   -
540   - // 添加双击折线保存事件
541   - polyUpline.addEventListener('dblclick',function(e) {
542   -
543   - // 关闭
544   - layer.close(yindex);
545   -
546   - polyUpline.disableEditing();
547   -
548   - // 弹出正在加载层
549   - var i = layer.load(0,{title :'我是标题'});
550   -
551   - // 获取折线坐标集合
552   - var editPloyLineArray = polyUpline.getPath();
553   -
554   - // 坐标转换WGS坐标
555   - GetAjaxData.BpolyGonArrayToWGS(editPloyLineArray,function(arraydata) {
556   -
557   - // 定义路段信息字符串
558   - var sectionJSON = JSON.stringify(arraydata);
559   -
560   - var params = {sectionId:sectionId,sectionJSON:sectionJSON}
561   -
562   - GetAjaxData.sectionUpdate(params,function(result) {
563   -
564   - layer.close(i);
  998 + });
  999 +
  1000 + },
565 1001  
566   - if(result.status=='SUCCESS'){
  1002 + setTiteText : function(lineId) {
567 1003  
568   - layer.msg('修改上行路段成功!');
  1004 + // 根据线路ID获取线路名称
  1005 + GetAjaxData.getIdLineName(lineId,function(data) {
  1006 +
  1007 + // 定义线路名称
  1008 + var lineNameV = data.name;
  1009 +
  1010 + $('.portlet-title .caption').text(lineNameV);
  1011 +
  1012 +
  1013 + });
569 1014  
570   - }else{
  1015 + },
  1016 +
  1017 + isHaveStationName : function(data) {
571 1018  
572   - layer.msg('修改上行路段失败!');
  1019 + if(data.length>0) {
  1020 +
  1021 + layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  1022 +
  1023 + layer.close(index);
  1024 +
  1025 + });
  1026 +
  1027 + return false;
  1028 +
  1029 + }else {
  1030 +
  1031 + return true;
  1032 +
  1033 + }
573 1034  
574   - }
575   - mapB.clearOverlays();
576   - GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) {
  1035 + },
  1036 +
  1037 + // 路段折线百度坐标转WGS坐标
  1038 + eachSectionList : function(sectiondata,cb) {
577 1039  
578   - // 刷新树
579   - resjtreeDate(id,sectionrouteDirections);
  1040 + var dataLen_ = sectiondata.length;
580 1041  
581   - linePanlThree(data,sectionrouteDirections);
  1042 + (function(){
  1043 +
  1044 + if (!arguments.callee.count) {
  1045 +
  1046 + arguments.callee.count = 0;
  1047 +
  1048 + }
  1049 +
  1050 + arguments.callee.count++;
  1051 +
  1052 + var index_ = parseInt(arguments.callee.count) - 1;
  1053 +
  1054 + if (index_ > dataLen_ -1) {
  1055 +
  1056 + cb && cb(sectiondata);
  1057 + return;
  1058 +
  1059 + }
  1060 +
  1061 + var p = arguments.callee;
  1062 +
  1063 + GetAjaxData.MuneBpointsArrayToWGS(sectiondata[index_].points,function(polyGonArray_) {
  1064 +
  1065 + sectiondata[index_].points = polyGonArray_;
  1066 +
  1067 + p();
  1068 + });
  1069 +
  1070 + })();
582 1071  
583   - });
584   - });
585   -
586   - });
587   -
588   - });
589   -}
590   -
591   -function setFormValue() {
  1072 + }
592 1073  
593   - // 站点ID
594   - $('#stationIdInput').val(editStationParmas.editUp_stationId);
595   -
596   - // 站点路由ID
597   - $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
598   -
599   - // 站点路由线路Id
600   - $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
601   -
602   - // 线路编码
603   - $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
604   -
605   - // WGS坐标点图形集合
606   - $('#bPolygonGridInput').val(editStationParmas.bPolygonGridInput);
607   -
608   - // 百度坐标点图形集合
609   - $('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput);
610   -
611   - // 获取站点名称元素设值
612   - $('#stationNameInput').val(editStationParmas.stationNamebootbox);
613   -
614   - // 获取站点编码元素设值
615   - $('#stationCodInput').val(editStationParmas.editUp_stationStationCod);
616   -
617   - // 获取站点类型元素设值
618   - $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
619   -
620   - // 获取站点方向元素设值
621   - $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
622   -
623   - // 获取站点道路编码元素设值
624   - $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
625   -
626   - // 百度地图经纬度坐标中心点
627   - $('#bJwpointsInput').val(editStationParmas.stationPointInput);
628   -
629   - // WGS经纬度
630   - $('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty);
631   -
632   - // 获取图形类型元素,并添加值
633   - $('#shapesTypeSelect').val(editStationParmas.shapesTypeInput);
634   -
635   - // 获取方向元素,并添加值
636   - $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
637   -
638   - // 获取半径元素,并添加值
639   - $('#radiusInput').val(editStationParmas.radiusInput);
640   -
641   - // 是否撤销
642   - $('#destroySelect').val(editStationParmas.destroyInput);
643   -
644   - // 到站时间
645   - $('#toTimeInput').val(editStationParmas.stationRouteToTime);
646   -
647   - // 到站距离
648   - $('#distancesInput').val(editStationParmas.stationRouteToTime);
  1074 + }
649 1075  
650   - // 描述/说明
651   - $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
  1076 + return PubFun ;
652 1077  
653   -}
654 1078 \ No newline at end of file
  1079 +}();
655 1080 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
  1 +/**
  2 + * 百度地图
  3 + *
  4 + * - - - - - -》init:地图初始化
  5 + *
  6 + * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据
  7 + *
  8 + * - - - - - -》getDistanceAndDuration:获取距离与时间
  9 + *
  10 + * - - - - - -》pointsPolygon:地图画多边行
  11 + *
  12 + * - - - - - -》pointsCircle:画圆
  13 + *
  14 + * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标
  15 + *
  16 + * - - - - - -》drawingUpline:在地图上画出上行线路走向
  17 + *
  18 + * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划)
  19 + *
  20 + * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划)
  21 + *
  22 + * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划)
  23 + */
  24 +
1 25 var WorldsBMap = function () {
2 26  
3   - function getBmapStationNames(lineNameValue,i,map,callback) {
4   -
5   - var busline = new BMap.BusLineSearch(map,{
6   -
7   - // 搜索结果呈现的配置
8   - // renderOptions:{map:map},
9   -
10   - /* // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
11   - onGetBusListComplete:function(BusListResult) {
12   -
13   - // 如果不为空
14   - if(BusListResult){
15   -
16   - //获取第一个公交列表显示到map上
17   - var fstLine = BusListResult.getBusListItem(i);
18   -
19   - busline.getBusLine(fstLine);
20   -
21   - }
22   -
23   - },*/
24   - // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型
25   - onGetBusListComplete:function(BusListResult) {
26   -
27   - // 如果不为空
28   - if(BusListResult){
29   -
30   - //获取第一个公交列表显示到map上
31   - var fstLine = BusListResult.getBusListItem(i);
32   -
33   - if(fstLine==undefined){
34   -
35   - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
36   -
37   - layer.closeAll();
38   -
39   - if(i==0){
40   -
41   - $('#upToolsMobal').show();
42   -
43   - }else if(i==1){
44   -
45   - $('#downToolsMobal').show();
46   -
47   - }
48   -
49   - return;
50   - });
51   -
52   - }
53   -
54   - busline.getBusLine(fstLine);
55   -
56   - }
57   -
58   - },
59   -
60   - //设置公交线路查询后的回调函数.参数:rs: BusLine类型
61   - onGetBusLineComplete: function(BusLine){
62   -
63   - // 如果不为空
64   - if(BusLine){
65   -
66   - callback && callback(BusLine);
67   -
68   - }
69   -
70   - }
71   -
72   - });
73   -
74   - busline.getBusList(lineNameValue);
75   -
76   - }
77   -
78   - function setMapEvent(map) {
79   - //启用地图拖拽事件,默认启用(可不写)
80   - map.enableDragging();
81   - //启用地图滚轮放大缩小
82   - map.enableScrollWheelZoom();
83   - //禁用鼠标双击放大
84   - map.disableDoubleClickZoom();
85   - //启用键盘上下左右键移动地图
86   - map.enableKeyboard();
87   - var styleOptions = {
88   - //边线颜色。
89   - strokeColor : "blue",
90   - //填充颜色。当参数为空时,圆形将没有填充效果。
91   - fillColor : "blue",
92   - //边线的宽度,以像素为单位。
93   - strokeWeight : 3,
94   - //边线透明度,取值范围0 - 1。
95   - strokeOpacity : 0.8,
96   - //填充的透明度,取值范围0 - 1。
97   - fillOpacity : 0.6,
98   - //边线的样式,solid或dashed。
99   - strokeStyle : 'solid'
100   - };
101   - // 创建鼠标绘制管理类
102   - drawingManager = new BMapLib.DrawingManager(map, {
103   - //是否开启绘制模式
104   - isOpen : false,
105   - //是否显示工具栏
106   - enableDrawingTool : false,
107   - drawingToolOptions : {
108   - //位置
109   - anchor : BMAP_ANCHOR_TOP_RIGHT,
110   - //偏离值
111   - offset : new BMap.Size(5, 5),
112   - //工具栏缩放比例
113   - scale : 0.8
114   - },
115   - //线的样式
116   - polygonOptions : styleOptions
117   - });
118   -
119   - // 添加绘画完成事件
120   - drawingManager.addEventListener('polygoncomplete', function(e) {
121   -
122   - if (e.getPath().length <= 2) {
123   -
124   - // 弹出提示消息
125   - layer.msg('坐标点不能小于等于两个...');
126   -
127   - // 清除地图覆盖物
128   - map.clearOverlays();
129   -
130   - // 加载该线路下所有站点位置添加到地图上
131   - return false;
132   -
133   - }else {
134   -
135   - var pointE = e;
136   -
137   - // 多变行质心点
138   - var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat;
139   -
140   - var PointsList = [];
141   -
142   - for ( var i = 0; i < pointE.getPath().length; i++) {
143   -
144   - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}});
145   -
146   - }
147   -
148   - PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}});
149   -
150   - var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}];
151   -
152   - GetAjaxData.getFormPointEToWGS(PointsList,function(resultdata) {
153   -
154   - var gPloygonGrid = '';
155   -
156   - var bPloygonGrid = '';
157   -
158   - for(var k =0;k<resultdata.length;k++) {
159   -
160   - if(k==0) {
161   -
162   - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
163   -
164   - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
165   -
166   - }else {
167   -
168   - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat;
169   -
170   - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat;
171   -
172   - }
173   -
174   - }
175   -
176   - gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))';
177   -
178   - bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))';
179   -
180   - GetAjaxData.getFormPointEToWGS(centre,function(p) {
181   -
182   - var gLonx = p[0].WGSpotion.Lng;
183   -
184   - var gLaty = p[0].WGSpotion.Lat;
185   -
186   - if(status=='add'){
187   -
188   - setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');
189   -
190   - status = '';
191   -
192   - $.get('add.html', function(m){$(pjaxContainer).append(m);});
193   -
194   - }else if(status=='edit'){
195   -
196   - editSeteditStationParmasValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d','');
197   -
198   - status = '';
199   -
200   - $.get('edit.html', function(m){$(pjaxContainer).append(m);});
201   -
202   - }
203   -
204   - });
205   -
206   - });
207   -
208   - }
209   -
210   - });
211   -
212   - }
213   -
214 27 var Bmap = {
215 28  
216 29 init : function(map) {
... ... @@ -234,17 +47,17 @@ var WorldsBMap = function () {
234 47 //中心点和缩放级别
235 48 map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
236 49  
237   - map.enableScrollWheelZoom();
238   -
239   - setMapEvent(map);
  50 + // 设置百度地图属性
  51 + PublicFunctions.setMapEvent(map);
240 52  
241 53 return map;
242 54 },
243 55  
244   - // 从百度地图抓去数据
  56 + // 从百度地图抓去站点与路段数据
245 57 lineInfoPanl : function(lineNameValue,i,map,cb) {
246 58  
247   - getBmapStationNames(lineNameValue,i,map,function(BusLine){
  59 + /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */
  60 + PublicFunctions.getBmapStationNames(lineNameValue,i,map,function(BusLine){
248 61  
249 62 return cb && cb(BusLine);
250 63  
... ... @@ -252,6 +65,7 @@ var WorldsBMap = function () {
252 65  
253 66 },
254 67  
  68 + /** 获取距离与时间 @param <points:坐标点集合> */
255 69 getDistanceAndDuration : function(points,callback){
256 70  
257 71 // 获取长度
... ... @@ -259,7 +73,7 @@ var WorldsBMap = function () {
259 73  
260 74 (function(){
261 75  
262   - if (!arguments.callee.count) {
  76 + if (!arguments.callee.count) {
263 77  
264 78 arguments.callee.count = 0;
265 79  
... ... @@ -276,10 +90,13 @@ var WorldsBMap = function () {
276 90 return;
277 91 }
278 92  
  93 + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。)
279 94 var f = arguments.callee;
280 95  
  96 + // 起点坐标 <坐标格式:40.056878,116.30815>
281 97 var origin = points[index].potion.lat + ',' + points[index].potion.lng;
282 98  
  99 + // 终点坐标 <坐标格式:40.056878,116.30815>
283 100 var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng;
284 101  
285 102 var region = '上海';
... ... @@ -290,15 +107,26 @@ var WorldsBMap = function () {
290 107  
291 108 var output = 'json';
292 109  
293   - var ak_My = '7BZ7eHZfCHUSVRHZilSQv6BGiUjOgGYE';
294   -
  110 + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk';
  111 +
  112 + /**
  113 + * origin:起点名称或经纬度;
  114 + *
  115 + * destination:终点名称或经纬度;
  116 + *
  117 + * origin_region:起始点所在城市,驾车导航时必填。
  118 + *
  119 + * destination_region:终点所在城市,驾车导航时必填。
  120 + *
  121 + * output :表示输出类型,可设置为xml或json,默认为xml。
  122 + *
  123 + **/
295 124 var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My};
296 125  
297   - // var url_ = 'http://api.map.baidu.com/direction/v1?mode=transit&origin='+origin+ '&destination='+destination+ '&region='+region+ '&output='+output+ '&ak='+ak_My;
298   -
  126 + /** @description :未认证开发者默认配额为:2000次/天。 */
299 127 $.ajax({
300 128  
301   - // 百度坐标获取WGS坐标
  129 + // 百度地图根据坐标获取两点之间的时间与距离
302 130 url: 'http://api.map.baidu.com/direction/v1?mode=transit',
303 131  
304 132 data: paramsB,
... ... @@ -311,8 +139,10 @@ var WorldsBMap = function () {
311 139  
312 140 if(r.message=='ok') {
313 141  
  142 + // 获取距离
314 143 points[index+1].distance = r.result.taxi.distance+500;
315 144  
  145 + // 获取时间
316 146 points[index+1].duration = r.result.taxi.duration+240;
317 147  
318 148 }
... ... @@ -327,25 +157,34 @@ var WorldsBMap = function () {
327 157  
328 158 },
329 159  
330   - // 多边形
  160 + // 地图画多边形
331 161 pointsPolygon : function(objStation,map) {
332 162  
  163 + // 如果不为空
333 164 if(objStation) {
334 165  
  166 + // 清除地图覆盖物
335 167 map.clearOverlays();
336 168  
  169 + // 获取中心点坐标字符串
337 170 var testpointStr = objStation.stationBJwpoints;
338 171  
  172 + // 按空格切割中心点坐标字符串
339 173 var BJwpointsPolygon = testpointStr.split(' ');
340 174  
  175 + // 中心点坐标
341 176 var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]);
342 177  
  178 + // 获取多边形坐标字符串
343 179 var stationBPolygonGrid = objStation.stationBPolygonGrid;
344 180  
  181 + // 截取多边形坐标字符串
345 182 var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2);
346 183  
  184 + // 按逗号切割
347 185 var pointPolygonArray = stationBPolygonGridStr.split(',');
348 186  
  187 + // 多边形坐标集合
349 188 var polygonP = [];
350 189  
351 190 for(var v = 0;v<pointPolygonArray.length;v++) {
... ... @@ -354,14 +193,23 @@ var WorldsBMap = function () {
354 193  
355 194 }
356 195  
  196 + // 画多边形
357 197 polygon = new BMap.Polygon(polygonP, {
  198 +
  199 + // 线条显色
358 200 strokeColor : "blue",
  201 +
  202 + // 边线的宽度,以像素为单位。
359 203 strokeWeight : 2,
  204 +
  205 + // 边线透明度,取值范围0 - 1。
360 206 strokeOpacity : 0.5
361 207 });
362 208  
363   - map.addOverlay(polygon); //增加多边形
  209 + // 增加地图覆盖物多边形
  210 + map.addOverlay(polygon);
364 211  
  212 + // 信息窗口属性
365 213 var opts_polygon = {
366 214  
367 215 // 信息窗口宽度
... ... @@ -380,7 +228,8 @@ var WorldsBMap = function () {
380 228 enableCloseOnClick : false
381 229 };
382 230  
383   - var infoWindow_target = new BMap.InfoWindow('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
  231 + // 创建信息窗口
  232 + var infoWindow_target = new BMap.InfoWindow('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
384 233 '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' +
385 234 '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' +
386 235 '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' +
... ... @@ -388,25 +237,26 @@ var WorldsBMap = function () {
388 237 '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' +
389 238 '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationVersions + '</span>' +
390 239 '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' , opts_polygon);
391   - // 自定义标注物图片
392   - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
393   -
394   - // 创建点
395   - marker = new BMap.Marker(pointPolygon,{icon : icon_target});
396   -
397   - // 把标注添物加到地图上
398   - map.addOverlay(marker);
399   -
400   - // marker.disableMassClear();
401   -
402   - var PanOptions_ ={noAnimation :true};
403   -
404   - map.panTo(pointPolygon,PanOptions_);
405   -
406   - map.panBy(10,110,PanOptions_);
407   -
408   - //开启信息窗口
409   - marker.openInfoWindow(infoWindow_target,pointPolygon);
  240 + // 自定义标注物图片
  241 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
  242 +
  243 + // 创建点
  244 + marker = new BMap.Marker(pointPolygon,{icon : icon_target});
  245 +
  246 + // 把标注添物加到地图上
  247 + map.addOverlay(marker);
  248 +
  249 + // 是否在平移过程中禁止动画。(自1.2新增)
  250 + var PanOptions_ ={noAnimation :true};
  251 +
  252 + // 将地图的中心点更改为给定的点。
  253 + map.panTo(pointPolygon,PanOptions_);
  254 +
  255 + // 将地图在水平位置上移动x像素,垂直位置上移动y像素。
  256 + map.panBy(10,110,PanOptions_);
  257 +
  258 + //开启信息窗口
  259 + marker.openInfoWindow(infoWindow_target,pointPolygon);
410 260  
411 261 }
412 262  
... ... @@ -457,22 +307,25 @@ var WorldsBMap = function () {
457 307  
458 308 if(objStation) {
459 309  
  310 + // 清除地图覆盖物
460 311 map.clearOverlays();
461 312  
  313 + // 获取中心坐标点字符串分割
462 314 var BJwpoints = objStation.stationBJwpoints.split(' ');
463 315  
  316 + // 中心坐标点
464 317 var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
465 318  
466   - //设置中心点
467   - // map.centerAndZoom(point,16);
468   -
469 319 //创建圆
470 320 circle = new BMap.Circle(point,objStation.stationRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});
471 321  
  322 + // 允许覆盖物在map.clearOverlays方法中被清除
472 323 circle.enableMassClear();
473 324  
  325 + // 百度地图添加覆盖物圆
474 326 map.addOverlay(circle);
475 327  
  328 + // 信息窗口参数属性
476 329 var opts = {
477 330  
478 331 // 信息窗口宽度
... ... @@ -480,7 +333,10 @@ var WorldsBMap = function () {
480 333  
481 334 // 信息窗口高度
482 335 height : 450,
  336 +
  337 + // 信息窗位置偏移值。
483 338 offset: new BMap.Size(500,120),
  339 +
484 340 //标题
485 341 title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>',
486 342  
... ... @@ -490,9 +346,11 @@ var WorldsBMap = function () {
490 346 //是否开启点击地图关闭信息窗口
491 347 enableCloseOnClick : false,
492 348  
  349 + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)
493 350 enableAutoPan:false
494 351 };
495 352  
  353 + // 创建信息窗口
496 354 var infoWindow_target = new BMap.InfoWindow('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
497 355 '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' +
498 356 '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' +
... ... @@ -501,52 +359,55 @@ var WorldsBMap = function () {
501 359 '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' +
502 360 '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationVersions + '</span>' +
503 361 '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' , opts);
504   - // 自定义标注物图片
505   - icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
506   -
507   - // 创建点
508   - marker = new BMap.Marker(point,{icon : icon_target});
509   -
510   - // 把标注添物加到地图上
511   - map.addOverlay(marker);
512   -
513   - setTimeout(function(){
514   - //开启信息窗口
515   - marker.openInfoWindow(infoWindow_target,point);
516   -
517   - },100);
518   -
519   - // marker.disableMassClear();
520   -
521   - var PanOptions_ ={noAnimation :true};
522   -
523   - map.panTo(point,PanOptions_);
524   -
525   - //map.panBy(10,-50,PanOptions_);
526   -
527   -
528   -
529   - // 添加标志物监听事件
530   - marker.addEventListener("click",function() {
531   -
532   - //开启信息窗口
533   - marker.openInfoWindow(infoWindow_target,point);
534   -
535   - });
  362 + // 自定义标注物图片
  363 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
  364 +
  365 + // 创建点
  366 + marker = new BMap.Marker(point,{icon : icon_target});
  367 +
  368 + // 把标注添物加到地图上
  369 + map.addOverlay(marker);
  370 +
  371 + setTimeout(function(){
  372 + //开启信息窗口
  373 + marker.openInfoWindow(infoWindow_target,point);
  374 +
  375 + },100);
  376 +
  377 + // 是否在平移过程中禁止动画。(自1.2新增)
  378 + var PanOptions_ ={noAnimation :true};
  379 +
  380 + // 将地图的中心点更改为给定的点。
  381 + map.panTo(point,PanOptions_);
  382 +
  383 + //map.panBy(10,-50,PanOptions_);
  384 +
  385 + // 添加标志物监听事件
  386 + marker.addEventListener("click",function() {
  387 +
  388 + //开启信息窗口
  389 + marker.openInfoWindow(infoWindow_target,point);
  390 +
  391 + });
536 392  
537 393 }
538 394  
539 395 },
  396 +
  397 + // 根据地理名称获取百度经纬度坐标
540 398 localSearchFromAdreesToPoint: function(Address,map,callback) {
541 399  
  400 + // 创建一个搜索类实例
542 401 var localSearch = new BMap.LocalSearch(map);
543 402  
  403 + // 检索完成后的回调函数。
544 404 localSearch.setSearchCompleteCallback(function (searchResult) {
545 405  
546 406 var resultPoints = '';
547 407  
548 408 if(searchResult) {
549 409  
  410 + // 返回索引指定的结果。索引0表示第1条结果
550 411 var poi = searchResult.getPoi(0);
551 412  
552 413 if(poi) {
... ... @@ -567,49 +428,68 @@ var WorldsBMap = function () {
567 428 callback && callback(false);
568 429 }
569 430  
570   - });
571   - localSearch.search(Address);
  431 + });
  432 +
  433 + // 根据检索词发起检索。
  434 + localSearch.search(Address);
572 435  
573 436 },
574 437  
575   - coloseWindowsInfo : function(editStationName,stationShapesTypeV,mindex) {
  438 + // 编辑图形
  439 + editShapes : function(editStationName,stationShapesTypeV,mindex) {
576 440  
  441 + // 关闭信息窗口
577 442 marker.closeInfoWindow();
578 443  
  444 + // 清除marker
579 445 mapB.removeOverlay(marker);
580 446  
  447 + // 编辑圆
581 448 if(stationShapesTypeV =='r') {
582 449  
  450 + // 开启编辑功能
583 451 circle.enableEditing();
584 452  
  453 + // 编辑圆监听事件
585 454 circle.addEventListener('dblclick',function() {
586 455  
  456 + // 关闭提示弹出层
587 457 layer.close(mindex);
588 458  
  459 + // 返回圆形的半径,单位为米。
589 460 var newRadius = circle.getRadius();
590 461  
  462 + // 返回圆形的中心点坐标。
591 463 var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat;
592 464  
593 465 var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}];
594 466  
  467 + // 中心百度坐标转WGS坐标
595 468 GetAjaxData.getFormPointEToWGS(centre_New,function(p) {
596 469  
597   - editSeteditStationParmasValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius));
  470 + // 设置修改站点参数集合
  471 + PublicFunctions.editSeteditStationParmasValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius));
598 472  
  473 + // 加载编辑页面
599 474 $.get('edit.html', function(m){$(pjaxContainer).append(m);});
600 475  
601 476 });
602 477  
603 478 });
604   -
  479 +
  480 + // 编辑多变行
605 481 }else if(stationShapesTypeV =='d') {
606 482  
  483 + // 开启编辑功能(自 1.1 新增)
607 484 polygon.enableEditing();
608 485  
  486 + // 添加多变行编辑事件
609 487 polygon.addEventListener('dblclick',function(e) {
610   -
  488 +
  489 + // 获取编辑的多边形对象
611 490 var edit_pointE = polygon;
612 491  
  492 + // 多边形坐标点集合
613 493 var eidt_PointsList = [];
614 494  
615 495 for ( var i = 0; i < edit_pointE.getPath().length; i++) {
... ... @@ -620,16 +500,18 @@ var WorldsBMap = function () {
620 500  
621 501 eidt_PointsList.push({potion: {lng: edit_pointE.getPath()[0].lng, lat: edit_pointE.getPath()[0].lat}});
622 502  
623   - var editSttationPoints_ = edit_pointE.getBounds().getCenter().lng+ ' ' + edit_pointE.getBounds().getCenter().lat;
624   -
625 503 var edit_centre = [{potion:{lng:edit_pointE.getBounds().getCenter().lng,lat:edit_pointE.getBounds().getCenter().lat}}];
626 504  
  505 + // 多边形中心点
627 506 var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat;
628 507  
  508 + // 多边形坐标点集合转WGS坐标
629 509 GetAjaxData.getFormPointEToWGS(eidt_PointsList,function(resultdata) {
630 510  
  511 + // 多边形WGS坐标字符串
631 512 var eidt_gPloygonGrid = '';
632   -
  513 +
  514 + // 百度坐标字符串
633 515 var edit_bPloygonGrid = '';
634 516  
635 517 for(var k =0;k<resultdata.length;k++) {
... ... @@ -654,14 +536,17 @@ var WorldsBMap = function () {
654 536  
655 537 edit_bPloygonGrid = 'POLYGON((' + edit_bPloygonGrid + '))';
656 538  
  539 + // 中心点坐标转WGS坐标
657 540 GetAjaxData.getFormPointEToWGS(edit_centre,function(p) {
658 541  
659 542 var edit_gLonx = p[0].WGSpotion.Lng;
660 543  
661 544 var edit_gLaty = p[0].WGSpotion.Lat;
662 545  
663   - editSeteditStationParmasValue(centre_points,edit_gLonx,edit_gLaty,edit_bPloygonGrid,eidt_gPloygonGrid,'d','');
  546 + // 设置编辑站点参宿集合
  547 + PublicFunctions.editSeteditStationParmasValue(centre_points,edit_gLonx,edit_gLaty,edit_bPloygonGrid,eidt_gPloygonGrid,'d','');
664 548  
  549 + // 加载编辑页面
665 550 $.get('edit.html', function(m){$(pjaxContainer).append(m);});
666 551  
667 552 });
... ... @@ -678,36 +563,12 @@ var WorldsBMap = function () {
678 563 // 在地图上画出上行线路走向
679 564 drawingUpline : function (polylineArray,resultdata) {
680 565  
681   - // mapB.clearOverlays();
682   -
683 566 // 创建线路走向
684 567 polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
685 568  
686 569 // 把折线添加到地图上
687 570 mapB.addOverlay(polyUpline);
688 571  
689   - if(resultdata.length>0) {
690   -
691   - for(var s = 0 ; s<resultdata.length;s++) {
692   -
693   - var bJwpointsStr = resultdata[s].bJwpoints;
694   -
695   - var bJwpointsArray = bJwpointsStr.split(' ');
696   -
697   - var point_center = new BMap.Point(bJwpointsArray[0],bJwpointsArray[1]);
698   -
699   - // 自定义标注物图片
700   - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20));
701   -
702   - // 创建标注物
703   - var markers_target = new BMap.Marker(point_center,{icon : icon_target});
704   -
705   - mapB.addOverlay(markers_target);
706   -
707   - }
708   -
709   - }
710   -
711 572 var ceter_index = Math.round(resultdata.length / 2);
712 573  
713 574 var ceterPointsStr = resultdata[ceter_index].bJwpoints;
... ... @@ -725,12 +586,13 @@ var WorldsBMap = function () {
725 586 mapB.panBy(500,-510,PanOptions_);
726 587  
727 588 mapB.setZoom(14);
728   -
729 589  
730 590 },
731 591  
  592 + // 打开绘画工具
732 593 drawingManagerOpen : function() {
733 594  
  595 + // 清楚地图覆盖物
734 596 mapB.clearOverlays();
735 597  
736 598 // 打开鼠标绘画工具
... ... @@ -741,6 +603,7 @@ var WorldsBMap = function () {
741 603  
742 604 },
743 605  
  606 + // 站点名称获取百度坐标(手动规划)
744 607 stationsNameToPoints : function(arra,callback) {
745 608  
746 609 // 获取长度
... ... @@ -779,7 +642,6 @@ var WorldsBMap = function () {
779 642  
780 643 var poi = searchResult.getPoi(0);
781 644  
782   -
783 645 if(poi) {
784 646  
785 647 stationList.push({name:arra[index],potion:{lng:poi.point.lng,lat:poi.point.lat}});
... ... @@ -799,6 +661,7 @@ var WorldsBMap = function () {
799 661  
800 662 },
801 663  
  664 + // 根据坐标点获取两点之间的时间与距离(手动规划)
802 665 getDistanceAndTotime : function(stationList,cb) {
803 666  
804 667 stationList[0].distance = '';
... ... @@ -870,6 +733,7 @@ var WorldsBMap = function () {
870 733  
871 734 },
872 735  
  736 + // 根据坐标点获取两点之间的折线路段(手动规划)
873 737 getSectionListPlonly : function(stationsPoint,cb) {
874 738  
875 739 var len = stationsPoint.length;
... ... @@ -900,7 +764,9 @@ var WorldsBMap = function () {
900 764  
901 765 var poiTwo = new BMap.Point(stationsPoint[index+1].potion.lng,stationsPoint[index+1].potion.lat);
902 766  
903   - var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});
  767 + /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/
  768 +
  769 + var transit = new BMap.DrivingRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});
904 770  
905 771 function searchPolylinesSet(results){
906 772  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
1   -function linePanlThree(data,direction) {
2   -
3   - GetAjaxData.getStationRoutePoint(id,direction,function(resultdata) {
4   -
5   - var dataLen = data.length;
6   -
7   - if(dataLen>0) {
8   -
9   - for(var d= 0; d<dataLen;d++){
10   -
11   - var sectionBsectionVectorStr = data[d].sectionBsectionVector;
12   -
13   - if(sectionBsectionVectorStr==null) {
14   -
15   - continue;
16   -
17   - }
18   -
19   - var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
20   -
21   - var lineArray = tempStr.split(',');
22   -
23   - var polylineArray = [];
24   -
25   - for(var i = 0;i<lineArray.length;i++) {
26   -
27   - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
28   -
29   - }
30   - WorldsBMap.drawingUpline(polylineArray,resultdata);
31   -
32   - }
33   -
34   - }
35   -
36   - });
37   -
38   -}
39   -
40   -/** 加载树 */
41   -function TreeUpOrDown(lineId,diraction) {
42   -
43   - GetAjaxData.getStation(lineId,diraction,function(treeDateJson) {
44   -
45   - var len = treeDateJson[0].children[0].children.length;
46   -
47   - // 上行
48   - if(diraction == 0) {
49   -
50   - StationTreeData.upInit(treeDateJson);
51   -
52   - if(len>0) {
53   -
54   - $('#upToolsMobal').hide();
55   -
56   - $('#uptreeMobal').show();
57   -
58   - }else {
59   -
60   - $('#upToolsMobal').show();
61   -
62   - $('#uptreeMobal').hide();
63   -
64   - }
65   -
66   -
67   - // 下行
68   - }else if(diraction ==1) {
69   -
70   - var stationDownTree = $('#station_Down_tree');
71   -
72   - StationTreeData.downInit(treeDateJson);
73   -
74   - if(len>0) {
75   -
76   - $('#downToolsMobal').hide();
77   -
78   - $('#DowntreeMobal').show();
79   -
80   - }else {
81   -
82   - $('#downToolsMobal').show();
83   -
84   - $('#DowntreeMobal').hide();
85   -
86   - }
87   -
88   - }
89   -
90   - });
91   -
92   -}
93   -
94   -function setTiteText(lineId) {
95   -
96   -
97   - // 根据线路ID获取线路名称
98   - GetAjaxData.getIdLineName(lineId,function(data) {
99   -
100   - // 定义线路名称
101   - var lineNameV = data.name;
102   -
103   - $('.portlet-title .caption').text(lineNameV);
104   -
105   -
106   - });
107   -
108   -}
  1 +/**
  2 + * reload事件
  3 + *
  4 + * - - - - - -》初始化地图、上下行树、上行线路走向
  5 + *
  6 + */
109 7  
110 8 $(function(){
111 9  
112   - // 获取参数ID
  10 + // 获取参数线路ID
113 11 id = $.url().param('no');
114 12  
115   - dir = '0';
116   -
  13 + // 如果线路ID不为空
117 14 if(id) {
118 15  
119   - // 初始化地图和表格
  16 + // 等候500毫秒执行
120 17 setTimeout(function(){
121 18  
122   - setTiteText(id);
  19 + // 获取线路名称,并设置标题为线路名称
  20 + PublicFunctions.setTiteText(id);
123 21  
124 22 // 地图初始化
125 23 var mapB = WorldsBMap.init(map);
126 24  
127 25 // 全局变量
128 26 window.mapB = mapB;
129   - TreeUpOrDown(id,'0');
130 27  
131   - TreeUpOrDown(id,'1');
  28 + // 上行树
  29 + PublicFunctions.TreeUpOrDown(id,'0');
  30 +
  31 + // 下行树
  32 + PublicFunctions.TreeUpOrDown(id,'1');
132 33  
  34 + // 查询上行路段信息
133 35 GetAjaxData.getSectionRouteInfo(id,'0',function(data) {
134 36  
135   - linePanlThree(data,'0');
  37 + // 在地图上画出线路走向
  38 + PublicFunctions.linePanlThree(data,'0');
136 39  
137 40 });
138 41  
... ... @@ -143,8 +46,10 @@ $(function(){
143 46 // 缺少ID
144 47 layer.confirm('【ID缺失,请点击返回,重新进行操作】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
145 48  
  49 + // 关闭提示弹出层
146 50 layer.close(index);
147 51  
  52 + // 返回线路list页面
148 53 loadPage('/pages/base/line/list.html');
149 54  
150 55 });
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
... ... @@ -136,7 +136,7 @@ var StationTreeData = function(){
136 136 mapB.clearOverlays();
137 137  
138 138 // 百度地图画路段
139   - linePanlThree(polylineArray,dire_);
  139 + PublicFunctions.linePanlThree(polylineArray,dire_);
140 140  
141 141 // 选中的其它节点
142 142 }else if(chaildredType ==null){
... ... @@ -272,7 +272,7 @@ var StationTreeData = function(){
272 272 mapB.clearOverlays();
273 273  
274 274 // 百度地图画路段
275   - linePanlThree(polylineArray,dire_);
  275 + PublicFunctions.linePanlThree(polylineArray,dire_);
276 276  
277 277 // 选中的其它节点
278 278 }else if(chaildredType ==null){
... ...
src/main/resources/static/pages/base/stationroute/list.html
... ... @@ -235,7 +235,7 @@
235 235 * - - - - - > status 绘画状态:新增与编辑
236 236 */
237 237 var id = '',dir = '',map = '', drawingManager = '',addStationNameValue = '',
238   - circle='',marker = '',polyUpline='',addStaitonParmas = {},editStationParmas={},status='';
  238 + circle='',marker = '',polyUpline='',addStaitonParmas = {},editStationParmas={},status='',manualPararms={};
239 239  
240 240  
241 241 </script>
... ...