Commit 0c93f0111aea478952e01e721281c7334e2da776
Merge branch 'master' of 192.168.168.201:panzhaov5/bsth_control
Showing
25 changed files
with
1310 additions
and
932 deletions
src/main/java/com/bsth/controller/SectionController.java
| ... | ... | @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RestController; |
| 10 | 10 | |
| 11 | 11 | import com.bsth.entity.Section; |
| 12 | 12 | import com.bsth.service.SectionService; |
| 13 | +import com.bsth.util.GetUIDAndCode; | |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | 16 | * |
| ... | ... | @@ -35,6 +36,28 @@ public class SectionController extends BaseController<Section, Integer> { |
| 35 | 36 | SectionService service; |
| 36 | 37 | |
| 37 | 38 | /** |
| 39 | + * 新增路段信息 | |
| 40 | + * | |
| 41 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | |
| 42 | + * | |
| 43 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | |
| 44 | + * | |
| 45 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | |
| 46 | + * | |
| 47 | + * @return map<SUCCESS:成功;ERROR:异常> | |
| 48 | + */ | |
| 49 | + @RequestMapping(value="sectionSave" , method = RequestMethod.POST) | |
| 50 | + public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { | |
| 51 | + | |
| 52 | + map.put("createBy", ""); | |
| 53 | + | |
| 54 | + map.put("updateBy", ""); | |
| 55 | + | |
| 56 | + return service.sectionSave(map); | |
| 57 | + | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 38 | 61 | * @Description :TODO(编辑线路走向) |
| 39 | 62 | * |
| 40 | 63 | * @param map <sectionId:路段ID; sectionJSON:路段信息> |
| ... | ... | @@ -46,8 +69,23 @@ public class SectionController extends BaseController<Section, Integer> { |
| 46 | 69 | |
| 47 | 70 | map.put("updateBy", ""); |
| 48 | 71 | |
| 72 | + map.put("createBy", ""); | |
| 73 | + | |
| 74 | + map.put("createDate", ""); | |
| 75 | + | |
| 49 | 76 | return service.sectionUpdate(map); |
| 50 | 77 | |
| 51 | 78 | } |
| 79 | + | |
| 80 | + /** | |
| 81 | + * @Description :TODO(查询路段编码) | |
| 82 | + * | |
| 83 | + * @return int <sectionCode路段编码> | |
| 84 | + */ | |
| 85 | + @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) | |
| 86 | + public long getSectionCode() { | |
| 87 | + return GetUIDAndCode.getSectionId(); | |
| 88 | + | |
| 89 | + } | |
| 52 | 90 | |
| 53 | 91 | } | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
| ... | ... | @@ -84,7 +84,35 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 84 | 84 | @Modifying |
| 85 | 85 | @Query(value="UPDATE bsth_c_section SET " + |
| 86 | 86 | "gsection_vector = GEOMFROMTEXT(?2) , " + |
| 87 | - "bsection_vector = GEOMFROMTEXT(?3) WHERE id = ?1", nativeQuery=true) | |
| 88 | - public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector); | |
| 87 | + "bsection_vector = GEOMFROMTEXT(?3)," + | |
| 88 | + "section_code = ?4," + | |
| 89 | + "section_name = ?5," + | |
| 90 | + "croses_road = ?6," + | |
| 91 | + "end_node = ?7," + | |
| 92 | + "start_node = ?8," + | |
| 93 | + "middle_node = ?9," + | |
| 94 | + "section_type = ?10," + | |
| 95 | + "csection_vector = ?11," + | |
| 96 | + "road_coding = ?12," + | |
| 97 | + "section_distance = ?13," + | |
| 98 | + "section_time = ?14," + | |
| 99 | + "db_type = ?15," + | |
| 100 | + "speed_limit = ?16," + | |
| 101 | + "descriptions = ?17," + | |
| 102 | + "versions = ?18," + | |
| 103 | + "create_by = ?19," + | |
| 104 | + "create_date = str_to_date(?20,'%Y-%m-%d %H:%i:%s')," + | |
| 105 | + "update_by = ?21," + | |
| 106 | + "update_date = str_to_date(?22,'%Y-%m-%d %H:%i:%s')" + | |
| 107 | + " WHERE id = ?1", nativeQuery=true) | |
| 108 | + public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector,String sectionCode,String sectionName, | |
| 109 | + | |
| 110 | + String crosesRoad,String endNode,String startNode,String middleNode,String sectionType, | |
| 111 | + | |
| 112 | + String csectionVector,String roadCoding,Double sectionDistance,Double sectionTime,String dbType, | |
| 113 | + | |
| 114 | + Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate, | |
| 115 | + | |
| 116 | + Integer updateBy,String updateDate); | |
| 89 | 117 | |
| 90 | 118 | } | ... | ... |
src/main/java/com/bsth/service/SectionService.java
| ... | ... | @@ -29,4 +29,6 @@ public interface SectionService extends BaseService<Section, Integer> { |
| 29 | 29 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 30 | 30 | */ |
| 31 | 31 | Map<String, Object> sectionUpdate(Map<String, Object> map); |
| 32 | + | |
| 33 | + Map<String, Object> sectionSave(Map<String, Object> map); | |
| 32 | 34 | } | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| 1 | 1 | package com.bsth.service.impl; |
| 2 | 2 | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.Date; | |
| 3 | 5 | import java.util.HashMap; |
| 4 | 6 | import java.util.Map; |
| 5 | 7 | |
| ... | ... | @@ -9,9 +11,15 @@ import org.springframework.stereotype.Service; |
| 9 | 11 | import com.alibaba.fastjson.JSONArray; |
| 10 | 12 | import com.alibaba.fastjson.JSONObject; |
| 11 | 13 | import com.bsth.common.ResponseCode; |
| 14 | +import com.bsth.entity.Line; | |
| 12 | 15 | import com.bsth.entity.Section; |
| 16 | +import com.bsth.entity.SectionRoute; | |
| 17 | +import com.bsth.repository.LineRepository; | |
| 13 | 18 | import com.bsth.repository.SectionRepository; |
| 19 | +import com.bsth.repository.SectionRouteRepository; | |
| 14 | 20 | import com.bsth.service.SectionService; |
| 21 | +import com.bsth.util.TransGPS; | |
| 22 | +import com.bsth.util.TransGPS.Location; | |
| 15 | 23 | |
| 16 | 24 | /** |
| 17 | 25 | * |
| ... | ... | @@ -35,6 +43,12 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 35 | 43 | @Autowired |
| 36 | 44 | SectionRepository repository; |
| 37 | 45 | |
| 46 | + @Autowired | |
| 47 | + LineRepository lineRepository; | |
| 48 | + | |
| 49 | + @Autowired | |
| 50 | + SectionRouteRepository routeRepository; | |
| 51 | + | |
| 38 | 52 | /** |
| 39 | 53 | * @Description :TODO(编辑线路走向) |
| 40 | 54 | * |
| ... | ... | @@ -49,24 +63,282 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 49 | 63 | |
| 50 | 64 | try { |
| 51 | 65 | |
| 66 | + String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); | |
| 67 | + | |
| 68 | + // 原始线状图形坐标集合 | |
| 69 | + String sectionsBpoints = ""; | |
| 70 | + | |
| 71 | + // WGS线状图形坐标集合 | |
| 72 | + String sectionsWJPpoints = ""; | |
| 73 | + | |
| 74 | + if(!bsectionVector.equals("")) { | |
| 75 | + | |
| 76 | + // 转换成JSON数组 | |
| 77 | + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); | |
| 78 | + | |
| 79 | + // 遍历 | |
| 80 | + for(int s = 0 ;s<sectionsArray.size();s++) { | |
| 81 | + | |
| 82 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | |
| 83 | + | |
| 84 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | |
| 85 | + | |
| 86 | + /** to WGS坐标 */ | |
| 87 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | |
| 88 | + | |
| 89 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | |
| 90 | + | |
| 91 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | |
| 92 | + | |
| 93 | + if(s==0) { | |
| 94 | + | |
| 95 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | |
| 96 | + | |
| 97 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | |
| 98 | + | |
| 99 | + }else { | |
| 100 | + | |
| 101 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | |
| 102 | + | |
| 103 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | |
| 104 | + | |
| 105 | + } | |
| 106 | + | |
| 107 | + | |
| 108 | + } | |
| 109 | + | |
| 110 | + } | |
| 111 | + | |
| 112 | + // 原坐标类型 | |
| 113 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | |
| 114 | + | |
| 115 | + // 说明 | |
| 116 | + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString(); | |
| 117 | + | |
| 118 | + // 是否撤销 | |
| 119 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | |
| 120 | + | |
| 121 | + // 方向 | |
| 122 | + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | |
| 123 | + | |
| 124 | + // 线路ID | |
| 125 | + Integer sectionRouteLine =map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | |
| 126 | + | |
| 127 | + // 道路编码 | |
| 128 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | |
| 129 | + | |
| 130 | + // 路段编码 | |
| 131 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | |
| 132 | + | |
| 133 | + // 路段长度 | |
| 134 | + Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | |
| 135 | + | |
| 52 | 136 | // 路段ID |
| 53 | 137 | Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); |
| 54 | 138 | |
| 55 | - // 路段信息字符串 | |
| 56 | - String sectionJSON = map.get("sectionJSON").toString().equals("") ? "" : map.get("sectionJSON").toString(); | |
| 139 | + // 路段名称 | |
| 140 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | |
| 141 | + | |
| 142 | + // 路段路由Id | |
| 143 | + Integer sectionRouteId = map.get("sectionRouteId").equals("") ? null : Integer.valueOf(map.get("sectionRouteId").toString()); | |
| 144 | + | |
| 145 | + // 线路编码 | |
| 146 | + String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | |
| 147 | + | |
| 148 | + // 路段时长 | |
| 149 | + Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | |
| 150 | + | |
| 151 | + // 路段路由 | |
| 152 | + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | |
| 153 | + | |
| 154 | + SectionRoute resultS = routeRepository.findOne(sectionRouteId); | |
| 155 | + | |
| 156 | + int old_code = resultS.getSectionrouteCode(); | |
| 157 | + | |
| 158 | + if(sectionrouteCode!=null) { | |
| 159 | + | |
| 160 | + int new_code = sectionrouteCode+100; | |
| 161 | + | |
| 162 | + if(new_code==old_code){ | |
| 163 | + | |
| 164 | + sectionrouteCode = new_code; | |
| 165 | + | |
| 166 | + }else { | |
| 167 | + | |
| 168 | + sectionrouteCode = new_code-100+1; | |
| 169 | + | |
| 170 | + } | |
| 171 | + | |
| 172 | + }else { | |
| 173 | + | |
| 174 | + sectionrouteCode = old_code; | |
| 175 | + | |
| 176 | + } | |
| 177 | + | |
| 178 | + // 限速 | |
| 179 | + Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | |
| 180 | + | |
| 181 | + // 版本 | |
| 182 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | |
| 183 | + | |
| 184 | + // WGS坐标点集合 | |
| 185 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 186 | + | |
| 187 | + // 原坐标点集合 | |
| 188 | + String bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | |
| 189 | + | |
| 190 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | |
| 191 | + | |
| 192 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | |
| 193 | + | |
| 194 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | |
| 195 | + | |
| 196 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | |
| 197 | + | |
| 198 | + Date date = new Date(); | |
| 199 | + | |
| 200 | + // 修改日期 | |
| 201 | + String updateDate = formatter.format(date); | |
| 202 | + | |
| 203 | + String crosesRoad=""; | |
| 204 | + | |
| 205 | + String endNode=""; | |
| 206 | + | |
| 207 | + String startNode=""; | |
| 208 | + | |
| 209 | + String middleNode=""; | |
| 210 | + | |
| 211 | + String sectionType=""; | |
| 212 | + | |
| 213 | + String csectionVector=""; | |
| 214 | + | |
| 215 | + // 更新 | |
| 216 | + repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | |
| 217 | + | |
| 218 | + SectionRoute route = new SectionRoute(); | |
| 219 | + | |
| 220 | + Line line = lineRepository.findOne(sectionRouteLine); | |
| 221 | + | |
| 222 | + Section section = repository.findOne(sectionId); | |
| 223 | + | |
| 224 | + route.setId(sectionRouteId); | |
| 225 | + | |
| 226 | + route.setSectionrouteCode(sectionrouteCode); | |
| 227 | + | |
| 228 | + route.setLineCode(lineCode); | |
| 229 | + | |
| 230 | + route.setSectionCode(sectionCode); | |
| 231 | + | |
| 232 | + route.setDirections(directions); | |
| 233 | + | |
| 234 | + route.setVersions(version); | |
| 235 | + | |
| 236 | + route.setDestroy(destroy); | |
| 237 | + | |
| 238 | + route.setDescriptions(descriptions); | |
| 239 | + | |
| 240 | + route.setCreateBy(createBy); | |
| 241 | + | |
| 242 | + route.setUpdateBy(updateBy); | |
| 243 | + | |
| 244 | + route.setLine(line); | |
| 245 | + | |
| 246 | + route.setSection(section); | |
| 247 | + | |
| 248 | + routeRepository.save(route); | |
| 249 | + | |
| 250 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 251 | + | |
| 252 | + } catch (Exception e) { | |
| 253 | + | |
| 254 | + resultMap.put("status", ResponseCode.ERROR); | |
| 255 | + | |
| 256 | + logger.error("save erro.", e); | |
| 257 | + | |
| 258 | + } | |
| 259 | + | |
| 260 | + return resultMap; | |
| 261 | + } | |
| 262 | + | |
| 263 | + /** 百度坐标转WGS坐标 */ | |
| 264 | + public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { | |
| 265 | + | |
| 266 | + double lng = Double.parseDouble(bLonx); | |
| 267 | + | |
| 268 | + double lat = Double.parseDouble(bLatx); | |
| 269 | + | |
| 270 | + Location bdLoc = TransGPS.LocationMake(lng, lat); | |
| 271 | + | |
| 272 | + Location location = TransGPS.bd_decrypt(bdLoc); | |
| 273 | + | |
| 274 | + Location WGSPoint = TransGPS.transformFromGCJToWGS(location); | |
| 275 | + | |
| 276 | + return WGSPoint; | |
| 277 | + | |
| 278 | + } | |
| 279 | + | |
| 280 | + | |
| 281 | + /** | |
| 282 | + * 新增路段信息 | |
| 283 | + * | |
| 284 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | |
| 285 | + * | |
| 286 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | |
| 287 | + * | |
| 288 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | |
| 289 | + * | |
| 290 | + * @return map<SUCCESS:成功;ERROR:异常> | |
| 291 | + */ | |
| 292 | + @Override | |
| 293 | + public Map<String, Object> sectionSave(Map<String, Object> map) { | |
| 294 | + | |
| 295 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | |
| 296 | + | |
| 297 | + try { | |
| 298 | + | |
| 299 | + /** 线路ID */ | |
| 300 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString()); | |
| 301 | + | |
| 302 | + /** 线路编码 */ | |
| 303 | + String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | |
| 304 | + | |
| 305 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | |
| 306 | + | |
| 307 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | |
| 308 | + | |
| 309 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | |
| 310 | + | |
| 311 | + String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString(); | |
| 312 | + | |
| 313 | + String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString(); | |
| 314 | + | |
| 315 | + String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString(); | |
| 316 | + | |
| 317 | + Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | |
| 318 | + | |
| 319 | + Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | |
| 320 | + | |
| 321 | + Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | |
| 322 | + | |
| 323 | + Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | |
| 324 | + | |
| 325 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.valueOf(map.get("destroy").toString()); | |
| 326 | + | |
| 327 | + Integer directions = map.get("directions").equals("") ? null : Integer.valueOf(map.get("directions").toString()); | |
| 328 | + | |
| 329 | + String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString(); | |
| 330 | + | |
| 331 | + // 原始线状图形坐标集合 | |
| 332 | + String sectionsBpoints = ""; | |
| 333 | + | |
| 334 | + // WGS线状图形坐标集合 | |
| 335 | + String sectionsWJPpoints = ""; | |
| 57 | 336 | |
| 58 | - // 如果路段信息JSON字符串不为空 | |
| 59 | 337 | if(!sectionJSON.equals("")) { |
| 60 | 338 | |
| 61 | 339 | // 转换成JSON数组 |
| 62 | 340 | JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); |
| 63 | 341 | |
| 64 | - // 原始线状图形坐标集合 | |
| 65 | - String sectionsBpoints = ""; | |
| 66 | - | |
| 67 | - // WGS线状图形坐标集合 | |
| 68 | - String sectionsWJPpoints = ""; | |
| 69 | - | |
| 70 | 342 | // 遍历 |
| 71 | 343 | for(int s = 0 ;s<sectionsArray.size();s++) { |
| 72 | 344 | |
| ... | ... | @@ -74,9 +346,15 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 74 | 346 | |
| 75 | 347 | String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); |
| 76 | 348 | |
| 77 | - String WGSLngStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lng").toString(); | |
| 349 | + String WGSLngStr = ""; | |
| 350 | + | |
| 351 | + String WGSLatStr = ""; | |
| 78 | 352 | |
| 79 | - String WGSLatStr = JSONObject.parseObject(sectionsArray.getJSONObject(s).get("WGSpotion").toString()).get("Lat").toString(); | |
| 353 | + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | |
| 354 | + | |
| 355 | + WGSLngStr = String.valueOf(resultPoint.getLng()); | |
| 356 | + | |
| 357 | + WGSLatStr = String.valueOf(resultPoint.getLat()); | |
| 80 | 358 | |
| 81 | 359 | if(s==0) { |
| 82 | 360 | |
| ... | ... | @@ -92,24 +370,75 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 92 | 370 | |
| 93 | 371 | } |
| 94 | 372 | |
| 95 | - | |
| 96 | 373 | } |
| 97 | 374 | |
| 98 | - // WGS坐标点集合 | |
| 99 | - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 375 | + } | |
| 376 | + | |
| 377 | + // WGS坐标点集合 | |
| 378 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | |
| 379 | + | |
| 380 | + // 原坐标点集合 | |
| 381 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | |
| 382 | + | |
| 383 | + String crosesRoad=""; | |
| 384 | + | |
| 385 | + String endNode =""; | |
| 386 | + | |
| 387 | + String startNode=""; | |
| 388 | + | |
| 389 | + String middleNode=""; | |
| 390 | + | |
| 391 | + String sectionType=""; | |
| 392 | + | |
| 393 | + String csectionVector=""; | |
| 394 | + | |
| 395 | + Integer id = Integer.valueOf(sectionCode); | |
| 396 | + | |
| 397 | + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id); | |
| 398 | + | |
| 399 | + Section section = repository.findOne(id); | |
| 400 | + | |
| 401 | + Line line = lineRepository.findOne(lineId); | |
| 402 | + | |
| 403 | + // 路段路由 | |
| 404 | + SectionRoute sectionRoute = new SectionRoute(); | |
| 405 | + | |
| 406 | + String sectionrouteCodeArray[] = null; | |
| 407 | + | |
| 408 | + Integer routeCode = null; | |
| 409 | + | |
| 410 | + if(!sectionrouteCode.equals("")){ | |
| 100 | 411 | |
| 101 | - // 原坐标点集合 | |
| 102 | - String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | |
| 412 | + sectionrouteCodeArray = sectionrouteCode.split("_"); | |
| 103 | 413 | |
| 104 | - // 更新 | |
| 105 | - repository.sectionUpdate(sectionId, gsectionVector, bsectionVector); | |
| 414 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; | |
| 106 | 415 | |
| 107 | - } | |
| 416 | + } | |
| 417 | + | |
| 418 | + sectionRoute.setSectionrouteCode(routeCode); | |
| 419 | + | |
| 420 | + sectionRoute.setLineCode(lineCode); | |
| 421 | + | |
| 422 | + sectionRoute.setSection(section); | |
| 423 | + | |
| 424 | + sectionRoute.setSectionCode(sectionCode); | |
| 425 | + | |
| 426 | + sectionRoute.setDirections(directions); | |
| 427 | + | |
| 428 | + sectionRoute.setDescriptions(descriptions); | |
| 429 | + | |
| 430 | + sectionRoute.setDestroy(destroy); | |
| 431 | + | |
| 432 | + sectionRoute.setVersions(versions); | |
| 433 | + | |
| 434 | + sectionRoute.setLine(line); | |
| 435 | + | |
| 436 | + routeRepository.save(sectionRoute); | |
| 108 | 437 | |
| 109 | 438 | resultMap.put("status", ResponseCode.SUCCESS); |
| 110 | 439 | |
| 111 | 440 | } catch (Exception e) { |
| 112 | - | |
| 441 | + | |
| 113 | 442 | resultMap.put("status", ResponseCode.ERROR); |
| 114 | 443 | |
| 115 | 444 | logger.error("save erro.", e); | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -880,11 +880,11 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | // 保存站点 |
| 883 | - repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, | |
| 883 | + /*repository.stationSave(stationCod, stationName, roadCoding, dbType, bJwpoints, | |
| 884 | 884 | |
| 885 | 885 | gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius, |
| 886 | 886 | |
| 887 | - shapesType, versions, descriptions, createBy, updateBy,stationId); | |
| 887 | + shapesType, versions, descriptions, createBy, updateBy,stationId);*/ | |
| 888 | 888 | |
| 889 | 889 | |
| 890 | 890 | |
| ... | ... | @@ -931,7 +931,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 931 | 931 | // 站点路由说明 |
| 932 | 932 | arg0.setDescriptions(descriptions); |
| 933 | 933 | |
| 934 | - routeRepository.save(arg0); | |
| 934 | + /*routeRepository.save(arg0);*/ | |
| 935 | 935 | |
| 936 | 936 | resultMap.put("status", ResponseCode.SUCCESS); |
| 937 | 937 | |
| ... | ... | @@ -1113,10 +1113,15 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 1113 | 1113 | stationRouteCode = new_code; |
| 1114 | 1114 | |
| 1115 | 1115 | }else { |
| 1116 | + | |
| 1116 | 1117 | stationRouteCode = new_code-100+1; |
| 1117 | 1118 | |
| 1118 | 1119 | } |
| 1119 | 1120 | |
| 1121 | + }else { | |
| 1122 | + | |
| 1123 | + stationRouteCode = resultS.getStationRouteCode(); | |
| 1124 | + | |
| 1120 | 1125 | } |
| 1121 | 1126 | |
| 1122 | 1127 | stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-form-wizard.js
| ... | ... | @@ -150,8 +150,6 @@ var FormWizard = function() { |
| 150 | 150 | // 表单序列化 |
| 151 | 151 | var params = form.serializeJSON(); |
| 152 | 152 | |
| 153 | - console.log(params); | |
| 154 | - | |
| 155 | 153 | //保存站点 |
| 156 | 154 | PublicFunctions.carParkSave(params,function(data) { |
| 157 | 155 | |
| ... | ... | @@ -274,8 +272,6 @@ var FormWizard = function() { |
| 274 | 272 | |
| 275 | 273 | if(baseResValue == 0) { |
| 276 | 274 | |
| 277 | - debugger; | |
| 278 | - | |
| 279 | 275 | $('.leftUtils').hide(); |
| 280 | 276 | |
| 281 | 277 | VmapWorlds.pointsCircle(p); | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-input-function.js
src/main/resources/static/pages/base/section/add.html
| ... | ... | @@ -20,6 +20,12 @@ |
| 20 | 20 | <span class="step-title"> 1 - 4 </span> |
| 21 | 21 | </span> |
| 22 | 22 | </div> |
| 23 | + | |
| 24 | + <div class="actions"> | |
| 25 | + <div class="btn-group btn-group-devided" data-toggle="buttons"> | |
| 26 | + <a class="btn btn-circle default" href="/pages/base/section/list.html" style="float: right;padding: 4px 23px;" data-pjax=""><i class="fa fa-reply"></i> 退出</a> | |
| 27 | + </div> | |
| 28 | + </div> | |
| 23 | 29 | </div> |
| 24 | 30 | <div class="portlet-body form"> |
| 25 | 31 | <!-- START FORM --> |
| ... | ... | @@ -104,9 +110,9 @@ |
| 104 | 110 | <label > |
| 105 | 111 | <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加 |
| 106 | 112 | </label> |
| 107 | - <label> | |
| 113 | + <!-- <label> | |
| 108 | 114 | <input type="radio" class="icheck" name="baseRes" value=2> 系统引用 |
| 109 | - </label> | |
| 115 | + </label> --> | |
| 110 | 116 | </div> |
| 111 | 117 | </div> |
| 112 | 118 | </div> |
| ... | ... | @@ -116,7 +122,7 @@ |
| 116 | 122 | <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 新增方式说明: </span></h5> |
| 117 | 123 | <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据路段的起点和终点名称自动生成一条折线走向.</span> </p> |
| 118 | 124 | <p><span class="help-block" style="color:#1bbc9b;"> b)手动添加:手动在地图上画出路段,然后双击鼠标右键保存.</span> </p> |
| 119 | - <p><span class="help-block" style="color:#1bbc9b;"> c)选择引用:从系统中选择已有的路段进行引用.</span> </p> | |
| 125 | + <!-- <p><span class="help-block" style="color:#1bbc9b;"> c)选择引用:从系统中选择已有的路段进行引用.</span> </p> --> | |
| 120 | 126 | </div> |
| 121 | 127 | </div> |
| 122 | 128 | |
| ... | ... | @@ -138,7 +144,9 @@ |
| 138 | 144 | |
| 139 | 145 | <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> |
| 140 | 146 | |
| 141 | - <input type="hidden" name="lineId" id="lineIdInput" value=""/> | |
| 147 | + <input type="hidden" name="lineId" id="lineIdInput" /> | |
| 148 | + | |
| 149 | + <input type="hidden" name="lineCode" id="lineCodeInput" /> | |
| 142 | 150 | |
| 143 | 151 | <!-- 线路名称 --> |
| 144 | 152 | <div class="form-body"> |
| ... | ... | @@ -153,7 +161,7 @@ |
| 153 | 161 | </div> |
| 154 | 162 | |
| 155 | 163 | <!-- 线路编码 --> |
| 156 | - <div class="form-body"> | |
| 164 | + <!-- <div class="form-body"> | |
| 157 | 165 | <div class="form-group"> |
| 158 | 166 | <label class="control-label col-md-3"> |
| 159 | 167 | <span class="required"> * </span>线路编码: |
| ... | ... | @@ -162,9 +170,9 @@ |
| 162 | 170 | <input type="text" class="form-control" name="lineCode" id="lineCodeInput"> |
| 163 | 171 | </div> |
| 164 | 172 | </div> |
| 165 | - </div> | |
| 173 | + </div> --> | |
| 166 | 174 | |
| 167 | - <!-- 站点名称 --> | |
| 175 | + <!-- 路段名称 --> | |
| 168 | 176 | <div class="form-body"> |
| 169 | 177 | <div class="form-group"> |
| 170 | 178 | <label class="control-label col-md-3"> |
| ... | ... | @@ -176,7 +184,7 @@ |
| 176 | 184 | </div> |
| 177 | 185 | </div> |
| 178 | 186 | |
| 179 | - <!-- 站点编码 --> | |
| 187 | + <!-- 路段编码 --> | |
| 180 | 188 | <div class="form-body"> |
| 181 | 189 | <div class="form-group"> |
| 182 | 190 | <label class="control-label col-md-3"> |
| ... | ... | @@ -198,7 +206,7 @@ |
| 198 | 206 | </div> |
| 199 | 207 | </div> |
| 200 | 208 | |
| 201 | - <!-- 站点序号 --> | |
| 209 | + <!-- 路段序号 --> | |
| 202 | 210 | <div class="form-body"> |
| 203 | 211 | <div class="form-group"> |
| 204 | 212 | <label class="control-label col-md-3"> |
| ... | ... | @@ -218,7 +226,7 @@ |
| 218 | 226 | <span class="required"> * </span>路段方向: |
| 219 | 227 | </label> |
| 220 | 228 | <div class="col-md-6"> |
| 221 | - <select name="directions" class="form-control" id="stationdirSelect"> | |
| 229 | + <select name="directions" class="form-control" id="sectionDirSelect"> | |
| 222 | 230 | <option value="">-- 请选择站点类型 --</option> |
| 223 | 231 | <option value="0">上行</option> |
| 224 | 232 | <option value="1">下行</option> |
| ... | ... | @@ -270,7 +278,7 @@ |
| 270 | 278 | </div> |
| 271 | 279 | </div> |
| 272 | 280 | |
| 273 | - <!-- 范围图形类型 --> | |
| 281 | + <!-- 是否撤销 --> | |
| 274 | 282 | <div class="form-body"> |
| 275 | 283 | <div class="form-group"> |
| 276 | 284 | <label class="col-md-3 control-label">是否撤销:</label> |
| ... | ... | @@ -307,31 +315,24 @@ |
| 307 | 315 | </div> |
| 308 | 316 | </div> |
| 309 | 317 | |
| 310 | - <div class="form-group"> | |
| 311 | - <label class="control-label col-md-3">线路编码:</label> | |
| 312 | - <div class="col-md-4"> | |
| 313 | - <p class="form-control-static" data-display="lineCode"> </p> | |
| 314 | - </div> | |
| 315 | - </div> | |
| 316 | - | |
| 317 | 318 | <div class="form-group"> |
| 318 | 319 | <label class="control-label col-md-3">路段名称:</label> |
| 319 | 320 | <div class="col-md-4"> |
| 320 | - <p class="form-control-static" data-display="stationName"> </p> | |
| 321 | + <p class="form-control-static" data-display="sectionName"> </p> | |
| 321 | 322 | </div> |
| 322 | 323 | </div> |
| 323 | 324 | |
| 324 | 325 | <div class="form-group"> |
| 325 | 326 | <label class="control-label col-md-3">路段编码:</label> |
| 326 | 327 | <div class="col-md-4"> |
| 327 | - <p class="form-control-static" data-display="stationCod"> </p> | |
| 328 | + <p class="form-control-static" data-display="sectionCode"> </p> | |
| 328 | 329 | </div> |
| 329 | 330 | </div> |
| 330 | 331 | |
| 331 | 332 | <div class="form-group"> |
| 332 | 333 | <label class="control-label col-md-3">上一路段:</label> |
| 333 | 334 | <div class="col-md-4"> |
| 334 | - <p class="form-control-static" data-display="stationRouteCode"> </p> | |
| 335 | + <p class="form-control-static" data-display="sectionrouteCode"> </p> | |
| 335 | 336 | </div> |
| 336 | 337 | </div> |
| 337 | 338 | |
| ... | ... | @@ -349,17 +350,25 @@ |
| 349 | 350 | </div> |
| 350 | 351 | </div> |
| 351 | 352 | |
| 353 | + | |
| 354 | + <div class="form-group"> | |
| 355 | + <label class="control-label col-md-3">路段线路:</label> | |
| 356 | + <div class="col-md-4"> | |
| 357 | + <p class="form-control-static" data-display="speedLimit"> </p> | |
| 358 | + </div> | |
| 359 | + </div> | |
| 360 | + | |
| 352 | 361 | <div class="form-group"> |
| 353 | 362 | <label class="control-label col-md-3">路段时长:</label> |
| 354 | 363 | <div class="col-md-4"> |
| 355 | - <p class="form-control-static" data-display="toTime"> </p> | |
| 364 | + <p class="form-control-static" data-display="sectionTime"> </p> | |
| 356 | 365 | </div> |
| 357 | 366 | </div> |
| 358 | 367 | |
| 359 | 368 | <div class="form-group"> |
| 360 | 369 | <label class="control-label col-md-3">路段长度:</label> |
| 361 | 370 | <div class="col-md-4"> |
| 362 | - <p class="form-control-static" data-display="distances"> </p> | |
| 371 | + <p class="form-control-static" data-display="sectionDistance"> </p> | |
| 363 | 372 | </div> |
| 364 | 373 | </div> |
| 365 | 374 | |
| ... | ... | @@ -406,47 +415,18 @@ |
| 406 | 415 | <!-- END FORM--> |
| 407 | 416 | </div> |
| 408 | 417 | </div> |
| 418 | + | |
| 419 | +<!-- 函数方法JS类库 --> | |
| 420 | +<script src="/pages/base/section/js/add-input-function.js"></script> | |
| 421 | + | |
| 422 | +<!-- 表单向导JS类库 --> | |
| 409 | 423 | <script src="/pages/base/section/js/add-form-wizard.js"></script> |
| 424 | + | |
| 425 | +<!-- 地图JS类库 --> | |
| 410 | 426 | <script src="/pages/base/section/js/add-vmap-world.js"></script> |
| 411 | -<script type="text/javascript"> | |
| 412 | - | |
| 413 | - var mapB = ''; | |
| 414 | - | |
| 415 | - var drawingManager = ''; | |
| 416 | - | |
| 417 | - // 定义表单 | |
| 418 | - var form = $('#submit_section_form'); | |
| 419 | - | |
| 420 | - // 定义表单异常 | |
| 421 | - var error = $('.alert-danger',form); | |
| 422 | - | |
| 423 | - // 定义表单成功 | |
| 424 | - var success = $('.alert-success',form); | |
| 425 | - | |
| 426 | - $(document).ready(function() { | |
| 427 | - | |
| 428 | - // 关闭左侧栏 | |
| 429 | - if (!$('body').hasClass('page-sidebar-closed')) { | |
| 430 | - | |
| 431 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 432 | - | |
| 433 | - } | |
| 434 | - | |
| 435 | - setTimeout(function(){ | |
| 436 | - | |
| 437 | - FormWizard.init(); | |
| 438 | - | |
| 439 | - mapB = VmapWorlds.init(); | |
| 440 | - | |
| 441 | - }, 500); | |
| 442 | - | |
| 443 | - }); | |
| 444 | - | |
| 445 | - // 提交 | |
| 446 | - $('.button-submit').on('click',function() { | |
| 447 | - | |
| 448 | - form.submit(); | |
| 449 | - | |
| 450 | - }); | |
| 451 | - | |
| 452 | -</script> | |
| 453 | 427 | \ No newline at end of file |
| 428 | + | |
| 429 | +<!-- 表单元素事件JS类库 --> | |
| 430 | +<script src="/pages/base/section/js/add-form-events.js"></script> | |
| 431 | + | |
| 432 | +<!-- reload事件 --> | |
| 433 | +<script src="/pages/base/section/js/add-form-reload.js"></script> | |
| 454 | 434 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/css/positions.css
src/main/resources/static/pages/base/section/editsection.html
| ... | ... | @@ -369,6 +369,14 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect |
| 369 | 369 | |
| 370 | 370 | var params = form.serializeJSON(); |
| 371 | 371 | |
| 372 | + params.createBy = Section.carParkCreateBy; | |
| 373 | + | |
| 374 | + // 定义日期格式 | |
| 375 | + var fs = 'YYYY-MM-DD HH:mm:ss' | |
| 376 | + | |
| 377 | + // 设置日期 | |
| 378 | + params.createDate = moment(Section.carParkCreateDate).format(fs); | |
| 379 | + | |
| 372 | 380 | error.hide(); |
| 373 | 381 | |
| 374 | 382 | ajaxd.sectionUpdate(params,function(resuntDate) { | ... | ... |
src/main/resources/static/pages/base/section/js/add-form-events.js
0 → 100644
| 1 | +$(function(){ | |
| 2 | + | |
| 3 | + // 提交 | |
| 4 | + $('.button-submit').on('click',function() { | |
| 5 | + | |
| 6 | + // 获取表单 | |
| 7 | + var formSubm = $('#submit_section_form'); | |
| 8 | + | |
| 9 | + formSubm.submit(); | |
| 10 | + | |
| 11 | + }); | |
| 12 | + | |
| 13 | + $('#oppenDrawingManager').on('click',function() { | |
| 14 | + | |
| 15 | + VmapWorlds.drawingManagerOpen(); | |
| 16 | + | |
| 17 | + }); | |
| 18 | + | |
| 19 | + $('#closeDrawingManager').on('click',function() { | |
| 20 | + | |
| 21 | + VmapWorlds.drawingManagerClose(); | |
| 22 | + | |
| 23 | + }); | |
| 24 | + | |
| 25 | + $('#lineSelect').on("change", function (e) { | |
| 26 | + | |
| 27 | + var lineSelectValue = $('#lineSelect').val(); | |
| 28 | + | |
| 29 | + if(lineSelectValue=='') { | |
| 30 | + | |
| 31 | + $('#lineCodeInput').val(''); | |
| 32 | + | |
| 33 | + $('#lineIdInput').val(''); | |
| 34 | + | |
| 35 | + }else { | |
| 36 | + | |
| 37 | + var lineSelectValueArray = lineSelectValue.split('_'); | |
| 38 | + | |
| 39 | + $('#lineIdInput').val(lineSelectValueArray[0]); | |
| 40 | + | |
| 41 | + $('#lineCodeInput').val(lineSelectValueArray[1]); | |
| 42 | + | |
| 43 | + PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(p) { | |
| 44 | + | |
| 45 | + var p_len = p.length; | |
| 46 | + | |
| 47 | + var options = '<option value="">请选择...</option>'; | |
| 48 | + | |
| 49 | + if(p_len>0) { | |
| 50 | + | |
| 51 | + $.each(p, function(i, g){ | |
| 52 | + | |
| 53 | + if(g.directions==0){ | |
| 54 | + | |
| 55 | + options += '<optgroup label="上行">'; | |
| 56 | + | |
| 57 | + options += '<option value="'+g.sectionrouteCode + '_' + g.directions +'">'+g.section.sectionName+'</option>' | |
| 58 | + | |
| 59 | + options += '</optgroup>'; | |
| 60 | + | |
| 61 | + }else if(g.directions==1) { | |
| 62 | + | |
| 63 | + options += '<optgroup label="下行">'; | |
| 64 | + | |
| 65 | + options += '<option value="'+g.sectionrouteCode + '_' + g.directions +'">'+g.section.sectionName+'</option>' | |
| 66 | + | |
| 67 | + options += '</optgroup>'; | |
| 68 | + | |
| 69 | + } | |
| 70 | + | |
| 71 | + }); | |
| 72 | + | |
| 73 | + } | |
| 74 | + | |
| 75 | + $('#sectionrouteCodeSelect').html(options).select2(); | |
| 76 | + | |
| 77 | + $('#sectionDirSelect').val(''); | |
| 78 | + | |
| 79 | + }); | |
| 80 | + } | |
| 81 | + }); | |
| 82 | + | |
| 83 | + $('#sectionrouteCodeSelect').on("change", function (e) { | |
| 84 | + | |
| 85 | + var stationrouteSelectValue = $('#sectionrouteCodeSelect').val(); | |
| 86 | + | |
| 87 | + if(stationrouteSelectValue==''){ | |
| 88 | + | |
| 89 | + $('#sectionDirSelect').val(''); | |
| 90 | + | |
| 91 | + }else{ | |
| 92 | + | |
| 93 | + var stationrouteSelectValueArray = stationrouteSelectValue.split('_'); | |
| 94 | + | |
| 95 | + $('#sectionDirSelect').val(stationrouteSelectValueArray[1]); | |
| 96 | + | |
| 97 | + } | |
| 98 | + | |
| 99 | + }); | |
| 100 | + | |
| 101 | +}); | |
| 0 | 102 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/add-form-reload.js
0 → 100644
| 1 | +/** | |
| 2 | + * | |
| 3 | + * @JSName : list.js(路段新增add.html页面js) | |
| 4 | + * | |
| 5 | + * @Author : bsth@lq | |
| 6 | + * | |
| 7 | + * @Description : TODO(路段新增add.html页面js) | |
| 8 | + * | |
| 9 | + * @Data : 2016年4月28日 上午9:21:17 | |
| 10 | + * | |
| 11 | + * @Version 公交调度系统BS版 0.1 | |
| 12 | + * | |
| 13 | + */ | |
| 14 | + | |
| 15 | +(function(){ | |
| 16 | + | |
| 17 | + // 关闭左侧栏 | |
| 18 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 19 | + | |
| 20 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 21 | + | |
| 22 | + } | |
| 23 | + | |
| 24 | + setTimeout(function(){ | |
| 25 | + | |
| 26 | + // 表单向导初始化 | |
| 27 | + FormWizard.init(); | |
| 28 | + | |
| 29 | + // 地图初始化 | |
| 30 | + var mapB = VmapWorlds.init(); | |
| 31 | + | |
| 32 | + /** 路段编码 */ | |
| 33 | + PublicFunctions.getSectionCode(function(sectionCode) { | |
| 34 | + | |
| 35 | + $('#sectionCodeInput').val(sectionCode); | |
| 36 | + | |
| 37 | + }); | |
| 38 | + | |
| 39 | + $('#destroySelect').val('0'); | |
| 40 | + | |
| 41 | + /** 线路下拉框初始化 */ | |
| 42 | + PublicFunctions.getLineAllInfo(function(array) { | |
| 43 | + | |
| 44 | + var opGroup = '<option value="">请选择...</option><optgroup label="线路">'; | |
| 45 | + | |
| 46 | + var len_ = array.length; | |
| 47 | + | |
| 48 | + if(len_>0) { | |
| 49 | + | |
| 50 | + $.each(array, function(i, g){ | |
| 51 | + | |
| 52 | + opGroup += '<option value="'+ g.id + '_' + g.lineCode +'">'+g.name+'</option>'; | |
| 53 | + | |
| 54 | + }); | |
| 55 | + | |
| 56 | + } | |
| 57 | + | |
| 58 | + opGroup += '</optgroup>'; | |
| 59 | + | |
| 60 | + $('#lineSelect').html(opGroup).select2(); | |
| 61 | + | |
| 62 | + }); | |
| 63 | + | |
| 64 | + var htm = '<option value="">请选择...</option>'; | |
| 65 | + | |
| 66 | + /** 路段序号初始化 */ | |
| 67 | + $('#sectionrouteCodeSelect').html(htm).select2(); | |
| 68 | + | |
| 69 | + }, 500); | |
| 70 | + | |
| 71 | +})(); | |
| 0 | 72 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/add-form-wizard.js
| ... | ... | @@ -17,6 +17,15 @@ var FormWizard = function() { |
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + // 定义表单 | |
| 21 | + var form = $('#submit_section_form'); | |
| 22 | + | |
| 23 | + // 定义表单异常 | |
| 24 | + var error = $('.alert-danger',form); | |
| 25 | + | |
| 26 | + // 定义表单成功 | |
| 27 | + var success = $('.alert-success',form); | |
| 28 | + | |
| 20 | 29 | // 表单验证 |
| 21 | 30 | form.validate({ |
| 22 | 31 | |
| ... | ... | @@ -50,9 +59,76 @@ var FormWizard = function() { |
| 50 | 59 | |
| 51 | 60 | // 最大长度 |
| 52 | 61 | maxlength: 20 |
| 62 | + }, | |
| 63 | + | |
| 64 | + // 线路名称 | |
| 65 | + 'line' : { | |
| 66 | + | |
| 67 | + // 必填项 | |
| 68 | + required : true | |
| 69 | + | |
| 70 | + }, | |
| 71 | + | |
| 72 | + // 路段名称 | |
| 73 | + 'sectionName' : { | |
| 74 | + | |
| 75 | + // 必填项 | |
| 76 | + required : true | |
| 77 | + | |
| 78 | + }, | |
| 79 | + | |
| 80 | + // 路段编码 | |
| 81 | + 'sectionCode' : { | |
| 82 | + | |
| 83 | + // 必填项 | |
| 84 | + required : true | |
| 85 | + | |
| 86 | + }, | |
| 87 | + | |
| 88 | + // 路段方向 | |
| 89 | + 'directions' : { | |
| 90 | + | |
| 91 | + // 必填项 | |
| 92 | + required : true | |
| 93 | + | |
| 94 | + }, | |
| 95 | + | |
| 96 | + // 路段时长 | |
| 97 | + 'sectionTime' : { | |
| 98 | + | |
| 99 | + // 必须输入合法的数字(负数,小数)。 | |
| 100 | + number : true | |
| 101 | + | |
| 102 | + }, | |
| 103 | + | |
| 104 | + // 路段距离 | |
| 105 | + 'sectionDistance' : { | |
| 106 | + | |
| 107 | + // 必须输入合法的数字(负数,小数)。 | |
| 108 | + number : true | |
| 109 | + | |
| 110 | + }, | |
| 111 | + | |
| 112 | + // 路段限速 | |
| 113 | + 'speedLimit' : { | |
| 114 | + | |
| 115 | + // 必填项 | |
| 116 | + required : true, | |
| 117 | + | |
| 118 | + // 必须输入合法的数字(负数,小数)。 | |
| 119 | + number : true | |
| 120 | + | |
| 121 | + | |
| 122 | + }, | |
| 123 | + | |
| 124 | + // 描述/说明 | |
| 125 | + 'descriptions' : { | |
| 126 | + | |
| 127 | + // 输入长度最多是 200 的字符串(汉字算一个字符)。 | |
| 128 | + maxlength: 200 | |
| 129 | + | |
| 53 | 130 | } |
| 54 | 131 | |
| 55 | - | |
| 56 | 132 | }, |
| 57 | 133 | |
| 58 | 134 | /** |
| ... | ... | @@ -113,13 +189,13 @@ var FormWizard = function() { |
| 113 | 189 | */ |
| 114 | 190 | submitHandler : function(f) { |
| 115 | 191 | |
| 116 | - console.log('submit'); | |
| 117 | - | |
| 118 | 192 | // 表单序列化 |
| 119 | 193 | var params = form.serializeJSON(); |
| 120 | 194 | |
| 195 | + console.log(params); | |
| 196 | + | |
| 121 | 197 | //保存站点 |
| 122 | - PublicFunctions.stationSave(params,function(data) { | |
| 198 | + PublicFunctions.sectionSave(params,function(data) { | |
| 123 | 199 | |
| 124 | 200 | if(data.status=='SUCCESS') { |
| 125 | 201 | |
| ... | ... | @@ -209,7 +285,6 @@ var FormWizard = function() { |
| 209 | 285 | |
| 210 | 286 | } |
| 211 | 287 | |
| 212 | - | |
| 213 | 288 | /** 如果为第一步隐藏返回按钮,否则显示返回按钮. */ |
| 214 | 289 | if (current == 1) { |
| 215 | 290 | |
| ... | ... | @@ -233,8 +308,11 @@ var FormWizard = function() { |
| 233 | 308 | |
| 234 | 309 | var paramsStationsArray = []; |
| 235 | 310 | |
| 236 | - paramsStationsArray[0] = stationStartValue;paramsStationsArray[1]=stationEndValue; | |
| 311 | + paramsStationsArray[0] = stationStartValue; | |
| 237 | 312 | |
| 313 | + paramsStationsArray[1]= stationEndValue; | |
| 314 | + | |
| 315 | + $('#sectionNameInput').val(stationStartValue + '至' + stationEndValue ); | |
| 238 | 316 | |
| 239 | 317 | if(baseResValue == 0) { |
| 240 | 318 | |
| ... | ... | @@ -242,52 +320,11 @@ var FormWizard = function() { |
| 242 | 320 | VmapWorlds.stationsNameToPoints(paramsStationsArray,function(resultJson) { |
| 243 | 321 | |
| 244 | 322 | // 根据坐标点获取两点之间的时间与距离 |
| 245 | - VmapWorlds.getDistanceAndTotime(resultJson,function(stationdataList) { | |
| 323 | + VmapWorlds.getDistanceAndDuration(resultJson,function(stationdataList) { | |
| 246 | 324 | |
| 247 | 325 | VmapWorlds.getSectionListPlonly(stationdataList,function(sectiondata) { |
| 248 | 326 | |
| 249 | - VmapWorlds.eachSectionList(sectiondata,function(successdata) { | |
| 250 | - | |
| 251 | - VmapWorlds.getFormPointEToWGS(stationdataList,function(stationdata) { | |
| 252 | - | |
| 253 | - var sectionList = successdata[0].points; | |
| 254 | - | |
| 255 | - var sectionDataLen_ = sectionList.length; | |
| 256 | - | |
| 257 | - var gPloygonGrid = ''; | |
| 258 | - | |
| 259 | - var bPloygonGrid = ''; | |
| 260 | - | |
| 261 | - console.log(successdata); | |
| 262 | - | |
| 263 | - for(var s = 0; s<sectionDataLen_;s++) { | |
| 264 | - | |
| 265 | - if(s==0){ | |
| 266 | - | |
| 267 | - gPloygonGrid = sectionList[s].WGSpotion.Lng + ' ' +sectionList[s].WGSpotion.Lat; | |
| 268 | - | |
| 269 | - bPloygonGrid = sectionList[s].lng + ' ' +sectionList[s].lat; | |
| 270 | - | |
| 271 | - }else{ | |
| 272 | - | |
| 273 | - gPloygonGrid = gPloygonGrid + ',' + sectionList[s].WGSpotion.Lng + ' ' +sectionList[s].WGSpotion.Lat; | |
| 274 | - | |
| 275 | - bPloygonGrid = bPloygonGrid + ',' + sectionList[s].lng + ' ' +sectionList[s].lat; | |
| 276 | - | |
| 277 | - } | |
| 278 | - | |
| 279 | - } | |
| 280 | - | |
| 281 | - gPloygonGrid = 'LINESTRING(' + gPloygonGrid + ')'; | |
| 282 | - | |
| 283 | - bPloygonGrid = 'LINESTRING(' + bPloygonGrid + ')'; | |
| 284 | - | |
| 285 | - $('#bsectionVectorInput').val(bPloygonGrid); | |
| 286 | - | |
| 287 | - $('#gsectionVectorInput').val(gPloygonGrid); | |
| 288 | - | |
| 289 | - }); | |
| 290 | - }); | |
| 327 | + $('#bsectionVectorInput').val(JSON.stringify(sectiondata)); | |
| 291 | 328 | |
| 292 | 329 | }); |
| 293 | 330 | }); |
| ... | ... | @@ -296,7 +333,11 @@ var FormWizard = function() { |
| 296 | 333 | |
| 297 | 334 | }else if(baseResValue ==1) { |
| 298 | 335 | |
| 299 | - VmapWorlds.drawingManagerOpen(mapB); | |
| 336 | + VmapWorlds.localSearchFromAdreesToPoint(stationStartValue); | |
| 337 | + | |
| 338 | + VmapWorlds.localSearchFromAdreesToPoint(stationEndValue); | |
| 339 | + | |
| 340 | + VmapWorlds.drawingManagerOpen(); | |
| 300 | 341 | |
| 301 | 342 | }else if(baseResValue ==2) { |
| 302 | 343 | |
| ... | ... | @@ -305,14 +346,6 @@ var FormWizard = function() { |
| 305 | 346 | |
| 306 | 347 | } |
| 307 | 348 | |
| 308 | - if(current == 3){ | |
| 309 | - | |
| 310 | - mapB.clearOverlays(); | |
| 311 | - | |
| 312 | - drawingManager.close(); | |
| 313 | - | |
| 314 | - } | |
| 315 | - | |
| 316 | 349 | /** 如果为最后一步显示提交按钮,隐藏下一步按钮,否则隐藏提交按钮,显示下一步按钮 */ |
| 317 | 350 | if (current >= total) { |
| 318 | 351 | |
| ... | ... | @@ -352,6 +385,8 @@ var FormWizard = function() { |
| 352 | 385 | /** 当一个导航标签被点击,返回错误的移动到该选项卡,并显示它的内容. */ |
| 353 | 386 | onTabClick: function (tab, navigation, index, clickedIndex) { |
| 354 | 387 | |
| 388 | + return false; | |
| 389 | + | |
| 355 | 390 | success.hide(); |
| 356 | 391 | |
| 357 | 392 | error.hide(); |
| ... | ... | @@ -379,11 +414,13 @@ var FormWizard = function() { |
| 379 | 414 | |
| 380 | 415 | } |
| 381 | 416 | |
| 382 | - mapB.clearOverlays(); | |
| 383 | - | |
| 384 | - circle = ''; | |
| 385 | - | |
| 386 | - drawingManager.close(); | |
| 417 | + if(index==2) { | |
| 418 | + | |
| 419 | + VmapWorlds.drawingManagerClose(); | |
| 420 | + | |
| 421 | + VmapWorlds.clearMarkAndOverlays(); | |
| 422 | + | |
| 423 | + } | |
| 387 | 424 | |
| 388 | 425 | handleTitle(tab, navigation, index); |
| 389 | 426 | }, |
| ... | ... | @@ -395,9 +432,13 @@ var FormWizard = function() { |
| 395 | 432 | |
| 396 | 433 | error.hide(); |
| 397 | 434 | |
| 398 | - mapB.clearOverlays(); | |
| 435 | + VmapWorlds.clearMarkAndOverlays(); | |
| 399 | 436 | |
| 400 | - drawingManager.close(); | |
| 437 | + if(index==0) { | |
| 438 | + | |
| 439 | + VmapWorlds.drawingManagerClose(); | |
| 440 | + | |
| 441 | + } | |
| 401 | 442 | |
| 402 | 443 | handleTitle(tab, navigation, index); |
| 403 | 444 | ... | ... |
src/main/resources/static/pages/base/section/js/add-input-function.js
0 → 100644
| 1 | +/** | |
| 2 | + * 函数 | |
| 3 | + * | |
| 4 | + */ | |
| 5 | + | |
| 6 | +var PublicFunctions = function () { | |
| 7 | + | |
| 8 | + var PubFun = { | |
| 9 | + | |
| 10 | + getSectionCode : function(callback) { | |
| 11 | + | |
| 12 | + $get('/section/getSectionCode',null,function(sectionCode) { | |
| 13 | + | |
| 14 | + callback && callback(sectionCode); | |
| 15 | + | |
| 16 | + }); | |
| 17 | + | |
| 18 | + }, | |
| 19 | + | |
| 20 | + getLineAllInfo : function(cb) { | |
| 21 | + | |
| 22 | + // 填充公司下拉框选择值 | |
| 23 | + $get('/line/all', null, function(array){ | |
| 24 | + | |
| 25 | + return cb && cb(array); | |
| 26 | + | |
| 27 | + }); | |
| 28 | + | |
| 29 | + }, | |
| 30 | + | |
| 31 | + getSectionRouteInfo : function(line,callback) { | |
| 32 | + | |
| 33 | + $get('/sectionroute/all',{'line.id_eq':line},function(result) { | |
| 34 | + | |
| 35 | + callback && callback(result); | |
| 36 | + | |
| 37 | + }); | |
| 38 | + | |
| 39 | + }, | |
| 40 | + | |
| 41 | + // 新增站点保存 | |
| 42 | + sectionSave : function(section,callback) { | |
| 43 | + | |
| 44 | + $post('/section/sectionSave',section,function(data) { | |
| 45 | + | |
| 46 | + callback && callback(data); | |
| 47 | + | |
| 48 | + }); | |
| 49 | + | |
| 50 | + } | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + return PubFun ; | |
| 55 | + | |
| 56 | +}(); | |
| 0 | 57 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/add-vmap-world.js
| 1 | 1 | var VmapWorlds = function() { |
| 2 | + | |
| 3 | + var mapB = '', drawingManager = ''; | |
| 2 | 4 | |
| 3 | 5 | var Bmap = { |
| 4 | 6 | |
| ... | ... | @@ -11,22 +13,22 @@ var VmapWorlds = function() { |
| 11 | 13 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 12 | 14 | |
| 13 | 15 | // 初始化百度地图 |
| 14 | - var map = new BMap.Map("bmap_basic"); | |
| 16 | + mapB = new BMap.Map("bmap_basic"); | |
| 15 | 17 | |
| 16 | 18 | //中心点和缩放级别 |
| 17 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 19 | + mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 18 | 20 | |
| 19 | 21 | //启用地图拖拽事件,默认启用(可不写) |
| 20 | - map.enableDragging(); | |
| 22 | + mapB.enableDragging(); | |
| 21 | 23 | |
| 22 | 24 | //启用地图滚轮放大缩小 |
| 23 | - map.enableScrollWheelZoom(); | |
| 25 | + mapB.enableScrollWheelZoom(); | |
| 24 | 26 | |
| 25 | 27 | //禁用鼠标双击放大 |
| 26 | - map.disableDoubleClickZoom(); | |
| 28 | + mapB.disableDoubleClickZoom(); | |
| 27 | 29 | |
| 28 | 30 | //启用键盘上下左右键移动地图 |
| 29 | - map.enableKeyboard(); | |
| 31 | + mapB.enableKeyboard(); | |
| 30 | 32 | |
| 31 | 33 | var styleOptions = { |
| 32 | 34 | |
| ... | ... | @@ -51,7 +53,7 @@ var VmapWorlds = function() { |
| 51 | 53 | }; |
| 52 | 54 | |
| 53 | 55 | // 创建鼠标绘制管理类 |
| 54 | - drawingManager = new BMapLib.DrawingManager(map, { | |
| 56 | + drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 55 | 57 | |
| 56 | 58 | //是否开启绘制模式 |
| 57 | 59 | isOpen : false, |
| ... | ... | @@ -79,139 +81,24 @@ var VmapWorlds = function() { |
| 79 | 81 | |
| 80 | 82 | // 添加绘画完成事件 |
| 81 | 83 | drawingManager.addEventListener('polylinecomplete', function(e) { |
| 82 | - | |
| 83 | - if (e.getPath().length <= 2) { | |
| 84 | - | |
| 85 | - // 弹出提示消息 | |
| 86 | - layer.msg('坐标点不能小于等于两个...'); | |
| 87 | - | |
| 88 | - // 清除地图覆盖物 | |
| 89 | - map.clearOverlays(); | |
| 90 | - | |
| 91 | - // 加载该线路下所有站点位置添加到地图上 | |
| 92 | - return false; | |
| 93 | - | |
| 94 | - }else { | |
| 95 | - | |
| 96 | - var pointE = e; | |
| 97 | - | |
| 98 | - var pointELen_ = pointE.getPath().length | |
| 99 | - | |
| 100 | - var PointsList = []; | |
| 101 | - | |
| 102 | - for ( var i = 0; i < pointELen_; i++) { | |
| 103 | - | |
| 104 | - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}}); | |
| 105 | - | |
| 106 | - } | |
| 107 | - | |
| 108 | - VmapWorlds.getFormPointEToWGS(PointsList,function(resultdata) { | |
| 109 | - | |
| 110 | - console.log(resultdata); | |
| 111 | - | |
| 112 | - | |
| 113 | - var gPloygonGrid = ''; | |
| 114 | - | |
| 115 | - var bPloygonGrid = ''; | |
| 116 | - | |
| 117 | - for(var k =0;k<resultdata.length;k++) { | |
| 118 | - | |
| 119 | - if(k==0) { | |
| 120 | - | |
| 121 | - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 122 | - | |
| 123 | - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 124 | - | |
| 125 | - }else { | |
| 126 | - | |
| 127 | - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 128 | - | |
| 129 | - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 130 | - | |
| 131 | - } | |
| 132 | - | |
| 133 | - } | |
| 134 | - | |
| 135 | - gPloygonGrid = 'LINESTRING(' + gPloygonGrid + ')'; | |
| 136 | - | |
| 137 | - bPloygonGrid = 'LINESTRING(' + bPloygonGrid + ')'; | |
| 138 | - | |
| 139 | - $('#bsectionVectorInput').val(bPloygonGrid); | |
| 140 | - | |
| 141 | - $('#gsectionVectorInput').val(gPloygonGrid); | |
| 142 | - | |
| 143 | - | |
| 144 | - }); | |
| 145 | - | |
| 146 | - | |
| 147 | - /* | |
| 148 | - // 多变行质心点 | |
| 149 | - var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; | |
| 150 | - | |
| 151 | - var PointsList = []; | |
| 152 | - | |
| 153 | - for ( var i = 0; i < pointE.getPath().length; i++) { | |
| 154 | - | |
| 155 | - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}}); | |
| 156 | - | |
| 157 | - } | |
| 158 | - | |
| 159 | - PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}}); | |
| 160 | - | |
| 161 | - var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}]; | |
| 162 | - | |
| 163 | - PublicFunctions.getFormPointEToWGS(PointsList,function(resultdata) { | |
| 164 | - | |
| 165 | - var gPloygonGrid = ''; | |
| 166 | - | |
| 167 | - var bPloygonGrid = ''; | |
| 168 | - | |
| 169 | - for(var k =0;k<resultdata.length;k++) { | |
| 170 | - | |
| 171 | - if(k==0) { | |
| 172 | - | |
| 173 | - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 174 | - | |
| 175 | - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 176 | - | |
| 177 | - }else { | |
| 178 | - | |
| 179 | - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 180 | - | |
| 181 | - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 182 | - | |
| 183 | - } | |
| 184 | - | |
| 185 | - } | |
| 186 | - | |
| 187 | - gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))'; | |
| 188 | - | |
| 189 | - bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))'; | |
| 190 | - | |
| 191 | - PublicFunctions.getFormPointEToWGS(centre,function(p) { | |
| 192 | - | |
| 193 | - var gLonx = p[0].WGSpotion.Lng; | |
| 194 | - | |
| 195 | - var gLaty = p[0].WGSpotion.Lat; | |
| 196 | - | |
| 197 | - PublicFunctions.setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d',''); | |
| 198 | - | |
| 199 | - }); | |
| 200 | - | |
| 201 | - });*/ | |
| 202 | - | |
| 203 | - } | |
| 204 | - | |
| 84 | + | |
| 85 | + drawingManager.close(); | |
| 86 | + | |
| 87 | + // 获取折线坐标集合 | |
| 88 | + var editPloyLineArray = e.getPath(); | |
| 89 | + | |
| 90 | + $('#bsectionVectorInput').val(JSON.stringify(editPloyLineArray)); | |
| 91 | + | |
| 205 | 92 | }); |
| 206 | 93 | |
| 207 | - return map; | |
| 94 | + return mapB; | |
| 208 | 95 | }, |
| 209 | 96 | |
| 210 | 97 | // 根据地理名称获取百度经纬度坐标 |
| 211 | - localSearchFromAdreesToPoint: function(Address,map,callback) { | |
| 98 | + localSearchFromAdreesToPoint: function(Address) { | |
| 212 | 99 | |
| 213 | 100 | // 创建一个搜索类实例 |
| 214 | - var localSearch = new BMap.LocalSearch(map); | |
| 101 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 215 | 102 | |
| 216 | 103 | // 检索完成后的回调函数。 |
| 217 | 104 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| ... | ... | @@ -226,19 +113,36 @@ var VmapWorlds = function() { |
| 226 | 113 | if(poi) { |
| 227 | 114 | |
| 228 | 115 | //获取经度和纬度 |
| 229 | - resultPoints = poi.point.lng + ' ' + poi.point.lat; | |
| 230 | - | |
| 231 | - callback && callback(resultPoints); | |
| 116 | + var stationNameChangePoint = new BMap.Point( poi.point.lng, poi.point.lat); | |
| 117 | + | |
| 118 | + marker = new BMap.Marker(stationNameChangePoint); | |
| 119 | + | |
| 120 | + var PanOptions ={noAnimation :true}; | |
| 121 | + | |
| 122 | + mapB.panTo(stationNameChangePoint,PanOptions); | |
| 123 | + | |
| 124 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 125 | + mapB.setZoom(16); | |
| 126 | + | |
| 127 | + mapB.panBy(-300,-50); | |
| 128 | + | |
| 129 | + // 将标注添加到地图中 | |
| 130 | + mapB.addOverlay(marker); | |
| 131 | + | |
| 132 | + //跳动的动画 | |
| 133 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 232 | 134 | |
| 233 | 135 | }else { |
| 234 | 136 | |
| 235 | - callback && callback(false); | |
| 137 | + // 弹出添加成功提示消息 | |
| 138 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 236 | 139 | |
| 237 | 140 | } |
| 238 | 141 | |
| 239 | 142 | }else { |
| 240 | 143 | |
| 241 | - callback && callback(false); | |
| 144 | + // 弹出添加成功提示消息 | |
| 145 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 242 | 146 | } |
| 243 | 147 | |
| 244 | 148 | }); |
| ... | ... | @@ -248,17 +152,6 @@ var VmapWorlds = function() { |
| 248 | 152 | |
| 249 | 153 | }, |
| 250 | 154 | |
| 251 | - // 打开绘画工具 | |
| 252 | - drawingManagerOpen : function(map) { | |
| 253 | - | |
| 254 | - // 打开鼠标绘画工具 | |
| 255 | - drawingManager.open(); | |
| 256 | - | |
| 257 | - // 设置属性 | |
| 258 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYLINE); | |
| 259 | - | |
| 260 | - }, | |
| 261 | - | |
| 262 | 155 | stationsNameToPoints : function(arra,callback) { |
| 263 | 156 | |
| 264 | 157 | // 获取长度 |
| ... | ... | @@ -316,18 +209,15 @@ var VmapWorlds = function() { |
| 316 | 209 | |
| 317 | 210 | }, |
| 318 | 211 | |
| 319 | - getDistanceAndTotime : function(stationList,cb) { | |
| 320 | - | |
| 321 | - stationList[0].distance = ''; | |
| 322 | - | |
| 323 | - stationList[0].duration = ''; | |
| 212 | + /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 213 | + getDistanceAndDuration : function(points,callback){ | |
| 324 | 214 | |
| 325 | 215 | // 获取长度 |
| 326 | - var len = stationList.length; | |
| 216 | + var len = points.length; | |
| 327 | 217 | |
| 328 | 218 | (function(){ |
| 329 | 219 | |
| 330 | - if (!arguments.callee.count) { | |
| 220 | + if (!arguments.callee.count) { | |
| 331 | 221 | |
| 332 | 222 | arguments.callee.count = 0; |
| 333 | 223 | |
| ... | ... | @@ -339,42 +229,69 @@ var VmapWorlds = function() { |
| 339 | 229 | |
| 340 | 230 | if (index >= len-1) { |
| 341 | 231 | |
| 342 | - cb && cb(stationList); | |
| 232 | + callback && callback(points); | |
| 233 | + | |
| 343 | 234 | return; |
| 344 | 235 | } |
| 345 | 236 | |
| 237 | + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 346 | 238 | var f = arguments.callee; |
| 347 | 239 | |
| 348 | - var poiOne = new BMap.Point(stationList[index].potion.lng,stationList[index].potion.lat); | |
| 240 | + // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 241 | + var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 349 | 242 | |
| 350 | - var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat); | |
| 243 | + // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 244 | + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 351 | 245 | |
| 352 | - var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onSearchComplete: searchComplete}); | |
| 246 | + var region = '上海'; | |
| 353 | 247 | |
| 354 | - transit.search(poiOne,poiTwo); | |
| 248 | + var origin_region = '上海'; | |
| 355 | 249 | |
| 356 | - function searchComplete(results){ | |
| 357 | - | |
| 358 | - var plan = results.getPlan(0); | |
| 359 | - | |
| 360 | - if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 361 | - | |
| 362 | - stationList[index+1].distance = ''; | |
| 363 | - | |
| 364 | - stationList[index+1].duration = ''; | |
| 365 | - | |
| 366 | - | |
| 367 | - }else { | |
| 368 | - | |
| 369 | - stationList[index+1].distance = plan.getDistance(true); | |
| 370 | - | |
| 371 | - stationList[index+1].duration = plan.getDuration(true); | |
| 372 | - | |
| 373 | - } | |
| 374 | - | |
| 375 | - f(); | |
| 376 | - } | |
| 250 | + var destination_region = '上海'; | |
| 251 | + | |
| 252 | + var output = 'json'; | |
| 253 | + | |
| 254 | + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 377 | 255 | |
| 256 | + /** | |
| 257 | + * @param :< origin:起点名称或经纬度;destination:终点名称或经纬度;origin_region:起始点所在城市,驾车导航时必填。 | |
| 258 | + * | |
| 259 | + * destination_region:终点所在城市,驾车导航时必填。output :表示输出类型,可设置为xml或json,默认为xml。> | |
| 260 | + * | |
| 261 | + * @returns :r <jsonp格式> | |
| 262 | + **/ | |
| 263 | + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 264 | + | |
| 265 | + /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 266 | + $.ajax({ | |
| 267 | + | |
| 268 | + // 百度地图根据坐标获取两点之间的时间与距离 | |
| 269 | + url: 'http://api.map.baidu.com/direction/v1?mode=transit', | |
| 270 | + | |
| 271 | + data: paramsB, | |
| 272 | + | |
| 273 | + dataType: 'jsonp', | |
| 274 | + | |
| 275 | + success: function(r){ | |
| 276 | + | |
| 277 | + if(r) { | |
| 278 | + | |
| 279 | + if(r.message=='ok') { | |
| 280 | + | |
| 281 | + // 获取距离(单位:米) | |
| 282 | + points[index+1].distance = r.result.taxi.distance; | |
| 283 | + | |
| 284 | + // 获取时间(单位:秒) | |
| 285 | + points[index+1].duration = r.result.taxi.duration; | |
| 286 | + | |
| 287 | + } | |
| 288 | + | |
| 289 | + } | |
| 290 | + | |
| 291 | + f(); | |
| 292 | + } | |
| 293 | + }); | |
| 294 | + | |
| 378 | 295 | })(); |
| 379 | 296 | |
| 380 | 297 | }, |
| ... | ... | @@ -419,15 +336,18 @@ var VmapWorlds = function() { |
| 419 | 336 | }else { |
| 420 | 337 | |
| 421 | 338 | var sectionArrayList = []; |
| 339 | + | |
| 422 | 340 | for (i = 0; i < results.length; i++){ |
| 423 | 341 | |
| 424 | 342 | sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath()); |
| 425 | 343 | |
| 426 | 344 | } |
| 427 | 345 | |
| 428 | - var sectionName = stationsPoint[index].name + '至' + stationsPoint[index+1].name; | |
| 429 | 346 | |
| 430 | - sectionList.push({sectionName:sectionName,points:sectionArrayList}); | |
| 347 | + sectionList = sectionArrayList; | |
| 348 | + /* var sectionName = stationsPoint[index].name + '至' + stationsPoint[index+1].name;*/ | |
| 349 | + | |
| 350 | + /* sectionList.push(sectionArrayList);*/ | |
| 431 | 351 | |
| 432 | 352 | } |
| 433 | 353 | |
| ... | ... | @@ -440,199 +360,27 @@ var VmapWorlds = function() { |
| 440 | 360 | |
| 441 | 361 | }, |
| 442 | 362 | |
| 443 | - eachSectionList : function(sectiondata,cb) { | |
| 444 | - | |
| 445 | - var dataLen_ = sectiondata.length; | |
| 446 | - | |
| 447 | - (function(){ | |
| 448 | - | |
| 449 | - if (!arguments.callee.count) { | |
| 450 | - | |
| 451 | - arguments.callee.count = 0; | |
| 452 | - | |
| 453 | - } | |
| 454 | - | |
| 455 | - arguments.callee.count++; | |
| 456 | - | |
| 457 | - var index_ = parseInt(arguments.callee.count) - 1; | |
| 458 | - | |
| 459 | - if (index_ > dataLen_ -1) { | |
| 460 | - | |
| 461 | - cb && cb(sectiondata); | |
| 462 | - return; | |
| 463 | - | |
| 464 | - } | |
| 465 | - | |
| 466 | - var p = arguments.callee; | |
| 467 | - | |
| 468 | - VmapWorlds.MuneBpointsArrayToWGS(sectiondata[index_].points,function(polyGonArray_) { | |
| 469 | - | |
| 470 | - sectiondata[index_].points = polyGonArray_; | |
| 471 | - | |
| 472 | - p(); | |
| 473 | - }); | |
| 474 | - | |
| 475 | - })(); | |
| 476 | - | |
| 477 | - }, | |
| 478 | - | |
| 479 | - MuneBpointsArrayToWGS : function(polyGonArray,callback) { | |
| 480 | - | |
| 481 | - if(polyGonArray) { | |
| 482 | - | |
| 483 | - // 获取长度 | |
| 484 | - var len = polyGonArray.length; | |
| 485 | - | |
| 486 | - (function(){ | |
| 487 | - | |
| 488 | - if (!arguments.callee.count) { | |
| 489 | - | |
| 490 | - arguments.callee.count = 0; | |
| 491 | - | |
| 492 | - } | |
| 493 | - | |
| 494 | - arguments.callee.count++; | |
| 495 | - | |
| 496 | - var index = parseInt(arguments.callee.count) - 1; | |
| 497 | - | |
| 498 | - if (index >= len) { | |
| 499 | - | |
| 500 | - callback && callback(polyGonArray); | |
| 501 | - | |
| 502 | - return; | |
| 503 | - } | |
| 504 | - | |
| 505 | - var f = arguments.callee; | |
| 506 | - | |
| 507 | - $.ajax({ | |
| 508 | - | |
| 509 | - // 百度坐标获取WGS坐标 | |
| 510 | - url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 511 | - | |
| 512 | - data: {lat: polyGonArray[index].lat , lng: polyGonArray[index].lng}, | |
| 513 | - | |
| 514 | - dataType: 'jsonp', | |
| 515 | - | |
| 516 | - success: function(r){ | |
| 517 | - | |
| 518 | - if(r) { | |
| 519 | - | |
| 520 | - polyGonArray[index].WGSpotion = r; | |
| 521 | - | |
| 522 | - } | |
| 523 | - | |
| 524 | - f(); | |
| 525 | - } | |
| 526 | - }); | |
| 527 | - | |
| 528 | - })(); | |
| 529 | - | |
| 530 | - }else { | |
| 531 | - | |
| 532 | - callback && callback(''); | |
| 533 | - | |
| 534 | - } | |
| 363 | + clearMarkAndOverlays : function() { | |
| 535 | 364 | |
| 365 | + // 清楚地图覆盖物 | |
| 366 | + mapB.clearOverlays(); | |
| 536 | 367 | |
| 537 | 368 | }, |
| 538 | 369 | |
| 539 | - getFormPointEToWGS: function(points,callback) { | |
| 370 | + drawingManagerClose : function() { | |
| 540 | 371 | |
| 541 | - // 获取长度 | |
| 542 | - var len = points.length; | |
| 543 | - | |
| 544 | - (function(){ | |
| 545 | - | |
| 546 | - if (!arguments.callee.count) { | |
| 547 | - | |
| 548 | - arguments.callee.count = 0; | |
| 549 | - | |
| 550 | - } | |
| 551 | - | |
| 552 | - arguments.callee.count++; | |
| 553 | - | |
| 554 | - var index = parseInt(arguments.callee.count) - 1; | |
| 555 | - | |
| 556 | - if (index >= len) { | |
| 557 | - | |
| 558 | - callback && callback(points); | |
| 559 | - | |
| 560 | - return; | |
| 561 | - } | |
| 562 | - | |
| 563 | - var f = arguments.callee; | |
| 564 | - | |
| 565 | - $.ajax({ | |
| 566 | - | |
| 567 | - url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 568 | - | |
| 569 | - data: {lat: points[index].potion.lat , lng: points[index].potion.lng}, | |
| 570 | - | |
| 571 | - dataType: 'jsonp', | |
| 572 | - | |
| 573 | - success: function(r){ | |
| 574 | - | |
| 575 | - if(r) { | |
| 576 | - | |
| 577 | - points[index].WGSpotion = r; | |
| 578 | - | |
| 579 | - } | |
| 580 | - | |
| 581 | - f(); | |
| 582 | - } | |
| 583 | - }); | |
| 584 | - | |
| 585 | - })(); | |
| 372 | + drawingManager.close(); | |
| 586 | 373 | |
| 587 | 374 | }, |
| 588 | 375 | |
| 589 | - getFormPointEToWGS: function(points,callback) { | |
| 376 | + // 打开绘画工具 | |
| 377 | + drawingManagerOpen : function() { | |
| 590 | 378 | |
| 591 | - // 获取长度 | |
| 592 | - var len = points.length; | |
| 379 | + // 打开鼠标绘画工具 | |
| 380 | + drawingManager.open(); | |
| 593 | 381 | |
| 594 | - (function(){ | |
| 595 | - | |
| 596 | - if (!arguments.callee.count) { | |
| 597 | - | |
| 598 | - arguments.callee.count = 0; | |
| 599 | - | |
| 600 | - } | |
| 601 | - | |
| 602 | - arguments.callee.count++; | |
| 603 | - | |
| 604 | - var index = parseInt(arguments.callee.count) - 1; | |
| 605 | - | |
| 606 | - if (index >= len) { | |
| 607 | - | |
| 608 | - callback && callback(points); | |
| 609 | - | |
| 610 | - return; | |
| 611 | - } | |
| 612 | - | |
| 613 | - var f = arguments.callee; | |
| 614 | - | |
| 615 | - $.ajax({ | |
| 616 | - | |
| 617 | - url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 618 | - | |
| 619 | - data: {lat: points[index].potion.lat , lng: points[index].potion.lng}, | |
| 620 | - | |
| 621 | - dataType: 'jsonp', | |
| 622 | - | |
| 623 | - success: function(r){ | |
| 624 | - | |
| 625 | - if(r) { | |
| 626 | - | |
| 627 | - points[index].WGSpotion = r; | |
| 628 | - | |
| 629 | - } | |
| 630 | - | |
| 631 | - f(); | |
| 632 | - } | |
| 633 | - }); | |
| 634 | - | |
| 635 | - })(); | |
| 382 | + // 设置属性 | |
| 383 | + drawingManager.setDrawingMode(BMAP_DRAWING_POLYLINE); | |
| 636 | 384 | |
| 637 | 385 | } |
| 638 | 386 | ... | ... |
src/main/resources/static/pages/base/section/js/section-ajax-getdata.js
src/main/resources/static/pages/base/section/js/section-positions-map.js
| ... | ... | @@ -62,7 +62,7 @@ var WorldsBMap = function () { |
| 62 | 62 | var point = new BMap.Point(lineArray[centerI].split(' ')[0],lineArray[centerI].split(' ')[1]); |
| 63 | 63 | |
| 64 | 64 | // 创建线路走向 |
| 65 | - polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 65 | + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "#5298ff",strokeWeight : 6,strokeOpacity :1,strokeStyle:'solid'}); | |
| 66 | 66 | |
| 67 | 67 | // 把折线添加到地图上 |
| 68 | 68 | mapValue.addOverlay(polyUpline); |
| ... | ... | @@ -105,7 +105,7 @@ var WorldsBMap = function () { |
| 105 | 105 | var infoWindow_target = new BMap.InfoWindow(htm, opts); |
| 106 | 106 | |
| 107 | 107 | // 自定义标注物图片 |
| 108 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 108 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif',new BMap.Size(20, 20)); | |
| 109 | 109 | |
| 110 | 110 | // 创建点 |
| 111 | 111 | marker = new BMap.Marker(point,{icon : icon_target}); |
| ... | ... | @@ -115,11 +115,6 @@ var WorldsBMap = function () { |
| 115 | 115 | |
| 116 | 116 | //开启信息窗口 |
| 117 | 117 | marker.openInfoWindow(infoWindow_target,point); |
| 118 | - /* setTimeout(function(){ | |
| 119 | - //开启信息窗口 | |
| 120 | - marker.openInfoWindow(infoWindow_target,point); | |
| 121 | - | |
| 122 | - },100);*/ | |
| 123 | 118 | |
| 124 | 119 | var PanOptions_ ={noAnimation :true}; |
| 125 | 120 | |
| ... | ... | @@ -127,7 +122,7 @@ var WorldsBMap = function () { |
| 127 | 122 | |
| 128 | 123 | mapValue.panTo(point,PanOptions_); |
| 129 | 124 | |
| 130 | - mapValue.panBy(500,-510,PanOptions_); | |
| 125 | + mapValue.panBy(0,-110,PanOptions_); | |
| 131 | 126 | |
| 132 | 127 | mapValue.setZoom(14); |
| 133 | 128 | ... | ... |
src/main/resources/static/pages/base/station/add.html
| ... | ... | @@ -111,7 +111,7 @@ |
| 111 | 111 | <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 新增方式说明: </span></h5> |
| 112 | 112 | <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据站点名称自动生成以150米为半径范围的圆.</span> </p> |
| 113 | 113 | <p><span class="help-block" style="color:#1bbc9b;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p> |
| 114 | - <p><span class="help-block" style="color:#1bbc9b;"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p> | |
| 114 | + <!-- <p><span class="help-block" style="color:#1bbc9b;"> c)选择引用:从系统中选择已有的站点进行引用.</span> </p> --> | |
| 115 | 115 | </div> |
| 116 | 116 | </div> |
| 117 | 117 | |
| ... | ... | @@ -120,7 +120,26 @@ |
| 120 | 120 | <!-- 站点位置 --> |
| 121 | 121 | <div class="tab-pane" id="tab2"> |
| 122 | 122 | <h3 class="block"> 站点位置 </h3> |
| 123 | - <div id="bmap_basic"></div> | |
| 123 | + <div id="bmap_basic"> | |
| 124 | + | |
| 125 | + <div class="leftUtils"> | |
| 126 | + <div class="btn-group" style="left: 100px;"> | |
| 127 | + <a class="btn btn-sm green-seagreen dropdown-toggle" style="width: 98px;" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> 绘制工具 | |
| 128 | + <i class="fa fa-angle-down"></i> | |
| 129 | + </a> | |
| 130 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 131 | + <li> | |
| 132 | + <a href="javascript:;" id="oppenDrawingManager"><i class="fa fa-pencil"></i> 打开 </a> | |
| 133 | + </li> | |
| 134 | + <li> | |
| 135 | + <a href="javascript:;" id = "closeDrawingManager"> <i class="fa fa-reply"></i> 关闭 </a> | |
| 136 | + </li> | |
| 137 | + | |
| 138 | + </ul> | |
| 139 | + </div> | |
| 140 | + </div> | |
| 141 | + | |
| 142 | + </div> | |
| 124 | 143 | </div> |
| 125 | 144 | |
| 126 | 145 | <!-- 站点信息 --> |
| ... | ... | @@ -255,14 +274,14 @@ |
| 255 | 274 | </div> |
| 256 | 275 | |
| 257 | 276 | <!-- 站点WGS经纬度 --> |
| 258 | - <div class="form-body"> | |
| 277 | + <!-- <div class="form-body"> | |
| 259 | 278 | <div class="form-group"> |
| 260 | 279 | <label class="col-md-3 control-label">站点WGS经纬度:</label> |
| 261 | 280 | <div class="col-md-6"> |
| 262 | 281 | <input type="text" class="form-control" name="gJwpoints" id="gJwpointsInput"> |
| 263 | 282 | </div> |
| 264 | 283 | </div> |
| 265 | - </div> | |
| 284 | + </div> --> | |
| 266 | 285 | |
| 267 | 286 | <!-- 范围图形类型 --> |
| 268 | 287 | <div class="form-body"> |
| ... | ... | @@ -508,176 +527,18 @@ |
| 508 | 527 | <!-- END FORM--> |
| 509 | 528 | </div> |
| 510 | 529 | </div> |
| 530 | + | |
| 531 | +<!-- 函数方法JS类库 --> | |
| 511 | 532 | <script src="/pages/base/station/js/add-input-function.js"></script> |
| 533 | + | |
| 534 | +<!-- 表单向导JS类库 --> | |
| 512 | 535 | <script src="/pages/base/station/js/add-form-wizard.js"></script> |
| 536 | + | |
| 537 | +<!-- 地图JS类库 --> | |
| 513 | 538 | <script src="/pages/base/station/js/add-vmap-world.js"></script> |
| 514 | -<script type="text/javascript"> | |
| 515 | - | |
| 516 | - var mapB = ''; | |
| 517 | - | |
| 518 | - var circle = ''; | |
| 519 | - | |
| 520 | - var drawingManager = ''; | |
| 521 | - | |
| 522 | - // 定义表单 | |
| 523 | - var form = $('#submit_station_form'); | |
| 524 | - | |
| 525 | - // 定义表单异常 | |
| 526 | - var error = $('.alert-danger',form); | |
| 527 | - | |
| 528 | - // 定义表单成功 | |
| 529 | - var success = $('.alert-success',form); | |
| 530 | - | |
| 531 | - $(document).ready(function() { | |
| 532 | - | |
| 533 | - // 关闭左侧栏 | |
| 534 | - if (!$('body').hasClass('page-sidebar-closed')) { | |
| 535 | - | |
| 536 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 537 | - | |
| 538 | - } | |
| 539 | - | |
| 540 | - setTimeout(function(){ | |
| 541 | - | |
| 542 | - FormWizard.init(); | |
| 543 | - | |
| 544 | - mapB = VmapWorlds.init(); | |
| 545 | - | |
| 546 | - PublicFunctions.getStationCode(function(stationCode) { | |
| 547 | - | |
| 548 | - $('#stationCodInput').val(stationCode); | |
| 549 | - | |
| 550 | - }); | |
| 551 | - | |
| 552 | - $('#destroySelect').val('0'); | |
| 553 | - | |
| 554 | - PublicFunctions.getLineAllInfo(function(array) { | |
| 555 | - | |
| 556 | - var opGroup = '<option value="">请选择...</option><optgroup label="线路">'; | |
| 557 | - | |
| 558 | - var len_ = array.length; | |
| 559 | - | |
| 560 | - if(len_>0) { | |
| 561 | - | |
| 562 | - $.each(array, function(i, g){ | |
| 563 | - | |
| 564 | - opGroup += '<option value="'+ g.id + '_' + g.lineCode +'">'+g.name+'</option>'; | |
| 565 | - | |
| 566 | - }); | |
| 567 | - | |
| 568 | - } | |
| 569 | - | |
| 570 | - opGroup += '</optgroup>'; | |
| 571 | - | |
| 572 | - $('#lineSelect').html(opGroup).select2(); | |
| 573 | - | |
| 574 | - }); | |
| 575 | - | |
| 576 | - var htm = '<option value="">请选择...</option>'; | |
| 577 | - | |
| 578 | - $('#stationrouteSelect').html(htm).select2(); | |
| 579 | - | |
| 580 | - $('#lineSelect').on("change", function (e) { | |
| 581 | - | |
| 582 | - var lineSelectValue = $('#lineSelect').val(); | |
| 583 | - | |
| 584 | - if(lineSelectValue=='') { | |
| 585 | - | |
| 586 | - $('#lineCodeInput').val(''); | |
| 587 | - | |
| 588 | - $('#lineIdInput').val(''); | |
| 589 | - | |
| 590 | - }else { | |
| 591 | - | |
| 592 | - var lineSelectValueArray = lineSelectValue.split('_'); | |
| 593 | - | |
| 594 | - $('#lineIdInput').val(lineSelectValueArray[0]); | |
| 595 | - | |
| 596 | - $('#lineCodeInput').val(lineSelectValueArray[1]); | |
| 597 | - | |
| 598 | - PublicFunctions.getStationRouteInfo(lineSelectValueArray[1],function(p) { | |
| 599 | - | |
| 600 | - var p_len = p.length; | |
| 601 | - | |
| 602 | - var options = '<option value="">请选择...</option>'; | |
| 603 | - | |
| 604 | - if(p_len>0) { | |
| 605 | - | |
| 606 | - $.each(p, function(i, g){ | |
| 607 | - | |
| 608 | - if(g.directions==0){ | |
| 609 | - | |
| 610 | - options += '<optgroup label="上行">'; | |
| 611 | - | |
| 612 | - options += '<option value="'+g.stationRouteCode + '_' + g.stationMark + '_' + g.directions +'">'+g.stationName+'</option>' | |
| 613 | - | |
| 614 | - options += '</optgroup>'; | |
| 615 | - | |
| 616 | - }else if(g.directions==1) { | |
| 617 | - | |
| 618 | - options += '<optgroup label="下行">'; | |
| 619 | - | |
| 620 | - options += '<option value="'+g.stationRouteCode + '_' + g.stationMark + '_' + g.directions +'">'+g.stationName+'</option>' | |
| 621 | - | |
| 622 | - options += '</optgroup>'; | |
| 623 | - | |
| 624 | - } | |
| 625 | - | |
| 626 | - }); | |
| 627 | - | |
| 628 | - } | |
| 629 | - | |
| 630 | - $('#stationrouteSelect').html(options).select2(); | |
| 631 | - | |
| 632 | - $('#stationMarkSelect').val(''); | |
| 633 | - | |
| 634 | - $('#stationdirSelect').val(''); | |
| 635 | - | |
| 636 | - }); | |
| 637 | - } | |
| 638 | - }); | |
| 639 | - | |
| 640 | - $('#stationrouteSelect').on("change", function (e) { | |
| 641 | - | |
| 642 | - var stationrouteSelectValue = $('#stationrouteSelect').val(); | |
| 643 | - | |
| 644 | - if(stationrouteSelectValue==''){ | |
| 645 | - | |
| 646 | - $('#stationMarkSelect').val(''); | |
| 647 | - | |
| 648 | - $('#stationdirSelect').val(''); | |
| 649 | - | |
| 650 | - }else{ | |
| 651 | - | |
| 652 | - var stationrouteSelectValueArray = stationrouteSelectValue.split('_'); | |
| 653 | - | |
| 654 | - var stationMarkStr = stationrouteSelectValueArray[1]; | |
| 655 | - | |
| 656 | - if(stationMarkStr == 'E') { | |
| 657 | - | |
| 658 | - $('#stationMarkSelect').val('E'); | |
| 659 | - | |
| 660 | - }else{ | |
| 661 | - | |
| 662 | - $('#stationMarkSelect').val('Z'); | |
| 663 | - | |
| 664 | - } | |
| 665 | - | |
| 666 | - $('#stationdirSelect').val(stationrouteSelectValueArray[2]); | |
| 667 | - | |
| 668 | - } | |
| 669 | - | |
| 670 | - }); | |
| 671 | - | |
| 672 | - }, 500); | |
| 673 | - | |
| 674 | - }); | |
| 675 | - | |
| 676 | - // 提交 | |
| 677 | - $('.button-submit').on('click',function() { | |
| 678 | - | |
| 679 | - form.submit(); | |
| 680 | - | |
| 681 | - }); | |
| 682 | - | |
| 683 | -</script> | |
| 684 | 539 | \ No newline at end of file |
| 540 | + | |
| 541 | +<!-- 表单元素事件JS类库 --> | |
| 542 | +<script src="/pages/base/station/js/add-form-events.js"></script> | |
| 543 | + | |
| 544 | +<!-- reload事件 --> | |
| 545 | +<script src="/pages/base/station/js/add-form-reload.js"></script> | |
| 685 | 546 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/station/js/add-form-events.js
0 → 100644
| 1 | +$(function(){ | |
| 2 | + | |
| 3 | + // 提交 | |
| 4 | + $('.button-submit').on('click',function() { | |
| 5 | + | |
| 6 | + // 获取表单 | |
| 7 | + var formSubm = $('#submit_station_form'); | |
| 8 | + | |
| 9 | + formSubm.submit(); | |
| 10 | + | |
| 11 | + }); | |
| 12 | + | |
| 13 | + $('#oppenDrawingManager').on('click',function() { | |
| 14 | + | |
| 15 | + VmapWorlds.drawingManagerOpen(); | |
| 16 | + | |
| 17 | + }); | |
| 18 | + | |
| 19 | + $('#closeDrawingManager').on('click',function() { | |
| 20 | + | |
| 21 | + VmapWorlds.drawingManagerClose(); | |
| 22 | + | |
| 23 | + }); | |
| 24 | + | |
| 25 | +}); | |
| 0 | 26 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/station/js/add-form-reload.js
0 → 100644
| 1 | +/** | |
| 2 | + * | |
| 3 | + * @JSName : list.js(站点新增add.html页面js) | |
| 4 | + * | |
| 5 | + * @Author : bsth@lq | |
| 6 | + * | |
| 7 | + * @Description : TODO(站点新增add.html页面js) | |
| 8 | + * | |
| 9 | + * @Data : 2016年4月28日 上午9:21:17 | |
| 10 | + * | |
| 11 | + * @Version 公交调度系统BS版 0.1 | |
| 12 | + * | |
| 13 | + */ | |
| 14 | + | |
| 15 | +(function(){ | |
| 16 | + | |
| 17 | + // 关闭左侧栏 | |
| 18 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 19 | + | |
| 20 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 21 | + | |
| 22 | + } | |
| 23 | + | |
| 24 | + setTimeout(function(){ | |
| 25 | + | |
| 26 | + FormWizard.init(); | |
| 27 | + | |
| 28 | + var mapB = VmapWorlds.init(); | |
| 29 | + | |
| 30 | + PublicFunctions.getStationCode(function(stationCode) { | |
| 31 | + | |
| 32 | + $('#stationCodInput').val(stationCode); | |
| 33 | + | |
| 34 | + }); | |
| 35 | + | |
| 36 | + $('#destroySelect').val('0'); | |
| 37 | + | |
| 38 | + PublicFunctions.getLineAllInfo(function(array) { | |
| 39 | + | |
| 40 | + var opGroup = '<option value="">请选择...</option><optgroup label="线路">'; | |
| 41 | + | |
| 42 | + var len_ = array.length; | |
| 43 | + | |
| 44 | + if(len_>0) { | |
| 45 | + | |
| 46 | + $.each(array, function(i, g){ | |
| 47 | + | |
| 48 | + opGroup += '<option value="'+ g.id + '_' + g.lineCode +'">'+g.name+'</option>'; | |
| 49 | + | |
| 50 | + }); | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + opGroup += '</optgroup>'; | |
| 55 | + | |
| 56 | + $('#lineSelect').html(opGroup).select2(); | |
| 57 | + | |
| 58 | + }); | |
| 59 | + | |
| 60 | + var htm = '<option value="">请选择...</option>'; | |
| 61 | + | |
| 62 | + $('#stationrouteSelect').html(htm).select2(); | |
| 63 | + | |
| 64 | + $('#lineSelect').on("change", function (e) { | |
| 65 | + | |
| 66 | + var lineSelectValue = $('#lineSelect').val(); | |
| 67 | + | |
| 68 | + if(lineSelectValue=='') { | |
| 69 | + | |
| 70 | + $('#lineCodeInput').val(''); | |
| 71 | + | |
| 72 | + $('#lineIdInput').val(''); | |
| 73 | + | |
| 74 | + }else { | |
| 75 | + | |
| 76 | + var lineSelectValueArray = lineSelectValue.split('_'); | |
| 77 | + | |
| 78 | + $('#lineIdInput').val(lineSelectValueArray[0]); | |
| 79 | + | |
| 80 | + $('#lineCodeInput').val(lineSelectValueArray[1]); | |
| 81 | + | |
| 82 | + PublicFunctions.getStationRouteInfo(lineSelectValueArray[1],function(p) { | |
| 83 | + | |
| 84 | + var p_len = p.length; | |
| 85 | + | |
| 86 | + var options = '<option value="">请选择...</option>'; | |
| 87 | + | |
| 88 | + if(p_len>0) { | |
| 89 | + | |
| 90 | + $.each(p, function(i, g){ | |
| 91 | + | |
| 92 | + if(g.directions==0){ | |
| 93 | + | |
| 94 | + options += '<optgroup label="上行">'; | |
| 95 | + | |
| 96 | + options += '<option value="'+g.stationRouteCode + '_' + g.stationMark + '_' + g.directions +'">'+g.stationName+'</option>' | |
| 97 | + | |
| 98 | + options += '</optgroup>'; | |
| 99 | + | |
| 100 | + }else if(g.directions==1) { | |
| 101 | + | |
| 102 | + options += '<optgroup label="下行">'; | |
| 103 | + | |
| 104 | + options += '<option value="'+g.stationRouteCode + '_' + g.stationMark + '_' + g.directions +'">'+g.stationName+'</option>' | |
| 105 | + | |
| 106 | + options += '</optgroup>'; | |
| 107 | + | |
| 108 | + } | |
| 109 | + | |
| 110 | + }); | |
| 111 | + | |
| 112 | + } | |
| 113 | + | |
| 114 | + $('#stationrouteSelect').html(options).select2(); | |
| 115 | + | |
| 116 | + $('#stationMarkSelect').val(''); | |
| 117 | + | |
| 118 | + $('#stationdirSelect').val(''); | |
| 119 | + | |
| 120 | + }); | |
| 121 | + } | |
| 122 | + }); | |
| 123 | + | |
| 124 | + $('#stationrouteSelect').on("change", function (e) { | |
| 125 | + | |
| 126 | + var stationrouteSelectValue = $('#stationrouteSelect').val(); | |
| 127 | + | |
| 128 | + if(stationrouteSelectValue==''){ | |
| 129 | + | |
| 130 | + $('#stationMarkSelect').val(''); | |
| 131 | + | |
| 132 | + $('#stationdirSelect').val(''); | |
| 133 | + | |
| 134 | + }else{ | |
| 135 | + | |
| 136 | + var stationrouteSelectValueArray = stationrouteSelectValue.split('_'); | |
| 137 | + | |
| 138 | + var stationMarkStr = stationrouteSelectValueArray[1]; | |
| 139 | + | |
| 140 | + if(stationMarkStr == 'E') { | |
| 141 | + | |
| 142 | + $('#stationMarkSelect').val('E'); | |
| 143 | + | |
| 144 | + }else{ | |
| 145 | + | |
| 146 | + $('#stationMarkSelect').val('Z'); | |
| 147 | + | |
| 148 | + } | |
| 149 | + | |
| 150 | + $('#stationdirSelect').val(stationrouteSelectValueArray[2]); | |
| 151 | + | |
| 152 | + } | |
| 153 | + | |
| 154 | + }); | |
| 155 | + | |
| 156 | + }, 500); | |
| 157 | + | |
| 158 | +})(); | |
| 0 | 159 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/station/js/add-form-wizard.js
| ... | ... | @@ -17,6 +17,15 @@ var FormWizard = function() { |
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + // 定义表单 | |
| 21 | + var form = $('#submit_station_form'); | |
| 22 | + | |
| 23 | + // 定义表单异常 | |
| 24 | + var error = $('.alert-danger',form); | |
| 25 | + | |
| 26 | + // 定义表单成功 | |
| 27 | + var success = $('.alert-success',form); | |
| 28 | + | |
| 20 | 29 | // 表单验证 |
| 21 | 30 | form.validate({ |
| 22 | 31 | |
| ... | ... | @@ -103,8 +112,6 @@ var FormWizard = function() { |
| 103 | 112 | */ |
| 104 | 113 | submitHandler : function(f) { |
| 105 | 114 | |
| 106 | - console.log('submit'); | |
| 107 | - | |
| 108 | 115 | // 表单序列化 |
| 109 | 116 | var params = form.serializeJSON(); |
| 110 | 117 | |
| ... | ... | @@ -221,79 +228,30 @@ var FormWizard = function() { |
| 221 | 228 | |
| 222 | 229 | $('#stationNameInput').val(stationNameV); |
| 223 | 230 | |
| 224 | - VmapWorlds.localSearchFromAdreesToPoint(stationNameV,mapB,function(Points) { | |
| 225 | - | |
| 226 | - if(Points) { | |
| 227 | - | |
| 228 | - var BJwpointsArray = Points.split(' '); | |
| 229 | - | |
| 230 | - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 231 | - | |
| 232 | - marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 233 | - | |
| 234 | - var PanOptions ={noAnimation :true}; | |
| 235 | - | |
| 236 | - mapB.panTo(stationNameChangePoint,PanOptions); | |
| 237 | - | |
| 238 | - mapB.panBy(0,100); | |
| 239 | - | |
| 240 | - // 将标注添加到地图中 | |
| 241 | - mapB.addOverlay(marker_stargt2); | |
| 242 | - | |
| 243 | - //跳动的动画 | |
| 244 | - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 245 | - | |
| 246 | - if(baseResValue == 0) { | |
| 247 | - | |
| 248 | - //创建圆 | |
| 249 | - circle = new BMap.Circle(stationNameChangePoint,150,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 250 | - | |
| 251 | - // 百度地图添加覆盖物圆 | |
| 252 | - mapB.addOverlay(circle); | |
| 253 | - | |
| 254 | - // 开启编辑功能 | |
| 255 | - circle.enableEditing(); | |
| 256 | - | |
| 257 | - // 编辑圆监听事件 | |
| 258 | - circle.addEventListener('remove',function() { | |
| 259 | - | |
| 260 | - // 清除marker | |
| 261 | - mapB.removeOverlay(marker_stargt2); | |
| 262 | - | |
| 263 | - // 返回圆形的半径,单位为米。 | |
| 264 | - var newRadius = circle.getRadius(); | |
| 265 | - | |
| 266 | - // 返回圆形的中心点坐标。 | |
| 267 | - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 268 | - | |
| 269 | - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 270 | - | |
| 271 | - // 中心百度坐标转WGS坐标 | |
| 272 | - PublicFunctions.getFormPointEToWGS(centre_New,function(p) { | |
| 273 | - | |
| 274 | - // 设置修改站点参数集合 | |
| 275 | - PublicFunctions.setFormInputValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius)); | |
| 276 | - | |
| 277 | - }); | |
| 278 | - | |
| 279 | - }); | |
| 280 | - | |
| 281 | - }else if(baseResValue ==1) { | |
| 282 | - | |
| 283 | - VmapWorlds.drawingManagerOpen(mapB); | |
| 284 | - | |
| 285 | - }else if(baseResValue ==2) { | |
| 286 | - | |
| 287 | - | |
| 288 | - } | |
| 289 | - | |
| 290 | - } | |
| 291 | - | |
| 292 | - }); | |
| 293 | - | |
| 294 | - } | |
| 231 | + VmapWorlds.localSearchFromAdreesToPoint(stationNameV,function(p) { | |
| 232 | + | |
| 233 | + if(p) { | |
| 234 | + | |
| 235 | + if(baseResValue == 0) { | |
| 236 | + | |
| 237 | + $('.leftUtils').hide(); | |
| 238 | + | |
| 239 | + VmapWorlds.pointsCircle(p); | |
| 240 | + | |
| 241 | + }else if(baseResValue ==1) { | |
| 242 | + | |
| 243 | + $('.leftUtils').show(); | |
| 244 | + | |
| 245 | + VmapWorlds.drawingManagerOpen(); | |
| 246 | + | |
| 247 | + } | |
| 248 | + } | |
| 249 | + | |
| 250 | + }); | |
| 251 | + | |
| 252 | + | |
| 295 | 253 | |
| 296 | - if(current == 3){ | |
| 254 | + /* if(current == 3){ | |
| 297 | 255 | |
| 298 | 256 | mapB.clearOverlays(); |
| 299 | 257 | |
| ... | ... | @@ -301,7 +259,7 @@ var FormWizard = function() { |
| 301 | 259 | |
| 302 | 260 | drawingManager.close(); |
| 303 | 261 | |
| 304 | - } | |
| 262 | + }*/ | |
| 305 | 263 | |
| 306 | 264 | /** 如果为最后一步显示提交按钮,隐藏下一步按钮,否则隐藏提交按钮,显示下一步按钮 */ |
| 307 | 265 | if (current >= total) { |
| ... | ... | @@ -369,11 +327,17 @@ var FormWizard = function() { |
| 369 | 327 | |
| 370 | 328 | } |
| 371 | 329 | |
| 372 | - mapB.clearOverlays(); | |
| 330 | + if(index==2) { | |
| 331 | + | |
| 332 | + VmapWorlds.clearMarkAndOverlays(); | |
| 333 | + | |
| 334 | + } | |
| 335 | + | |
| 336 | + /* mapB.clearOverlays(); | |
| 373 | 337 | |
| 374 | 338 | circle = ''; |
| 375 | 339 | |
| 376 | - drawingManager.close(); | |
| 340 | + drawingManager.close();*/ | |
| 377 | 341 | |
| 378 | 342 | handleTitle(tab, navigation, index); |
| 379 | 343 | }, |
| ... | ... | @@ -385,11 +349,13 @@ var FormWizard = function() { |
| 385 | 349 | |
| 386 | 350 | error.hide(); |
| 387 | 351 | |
| 388 | - mapB.clearOverlays(); | |
| 352 | + VmapWorlds.clearMarkAndOverlays(); | |
| 353 | + | |
| 354 | + /* mapB.clearOverlays(); | |
| 389 | 355 | |
| 390 | 356 | circle = ''; |
| 391 | 357 | |
| 392 | - drawingManager.close(); | |
| 358 | + drawingManager.close();*/ | |
| 393 | 359 | |
| 394 | 360 | handleTitle(tab, navigation, index); |
| 395 | 361 | ... | ... |
src/main/resources/static/pages/base/station/js/add-input-function.js
| 1 | 1 | /** |
| 2 | 2 | * 函数 |
| 3 | - * | |
| 4 | - * - - - - - - - 》 getCurrSelNode : 获取选中树节点数据函数 | |
| 5 | - * | |
| 6 | - * - - - - - - - 》 resjtreeDate : 刷新树函数函数 | |
| 7 | - * | |
| 8 | - * - - - - - - - 》 setFormInputValue : 新增站点参数集合赋值函数 | |
| 9 | - * | |
| 10 | - * - - - - - - - 》 editSetStationParmas : 编辑站点参数集合赋值函数 | |
| 11 | - * | |
| 12 | - * - - - - - - - 》 editSeteditStationParmasValue:编辑站点范围图形参数集合赋值函数 | |
| 13 | - * | |
| 14 | - * - - - - - - - 》 lineNameIsHaveInterval : 系统规划时线路名称是否为区间 | |
| 15 | - * | |
| 16 | - * - - - - - - - 》 systemLineStation:系统规划保存函数 | |
| 17 | - * | |
| 18 | - * - - - - - - - 》 stationRevoke :撤销站点 | |
| 19 | - * | |
| 20 | - * - - - - - - - 》 editLinePlan :编辑线路走向 | |
| 21 | - * | |
| 22 | - * - - - - - - - 》 setFormValue :编辑站点设置表单元素值 | |
| 23 | - * | |
| 24 | - * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标 | |
| 25 | 3 | */ |
| 26 | 4 | |
| 27 | 5 | var PublicFunctions = function () { |
| 28 | 6 | |
| 29 | 7 | var PubFun = { |
| 30 | 8 | |
| 31 | - // 原百度坐标转WGS坐标 | |
| 32 | - getFormPointEToWGS: function(points,callback) { | |
| 33 | - | |
| 34 | - // 获取长度 | |
| 35 | - var len = points.length; | |
| 36 | - | |
| 37 | - (function(){ | |
| 38 | - | |
| 39 | - if (!arguments.callee.count) { | |
| 40 | - | |
| 41 | - arguments.callee.count = 0; | |
| 42 | - | |
| 43 | - } | |
| 44 | - | |
| 45 | - arguments.callee.count++; | |
| 46 | - | |
| 47 | - var index = parseInt(arguments.callee.count) - 1; | |
| 48 | - | |
| 49 | - if (index >= len) { | |
| 50 | - | |
| 51 | - callback && callback(points); | |
| 52 | - | |
| 53 | - return; | |
| 54 | - } | |
| 55 | - | |
| 56 | - var f = arguments.callee; | |
| 57 | - | |
| 58 | - $.ajax({ | |
| 59 | - | |
| 60 | - url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 61 | - | |
| 62 | - data: {lat: points[index].potion.lat , lng: points[index].potion.lng}, | |
| 63 | - | |
| 64 | - dataType: 'jsonp', | |
| 65 | - | |
| 66 | - success: function(r){ | |
| 67 | - | |
| 68 | - if(r) { | |
| 69 | - | |
| 70 | - points[index].WGSpotion = r; | |
| 71 | - | |
| 72 | - } | |
| 73 | - | |
| 74 | - f(); | |
| 75 | - } | |
| 76 | - }); | |
| 77 | - | |
| 78 | - })(); | |
| 79 | - | |
| 80 | - }, | |
| 81 | - | |
| 82 | - /** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */ | |
| 83 | - setFormInputValue: function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) { | |
| 9 | + /** @param points:中心点 ;bPolygonGridValue:百度坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */ | |
| 10 | + setFormInputValue: function(points,bPolygonGridValue,shapesTypeValue,radiusValue) { | |
| 84 | 11 | |
| 85 | 12 | // 百度地图经纬度坐标中心点 |
| 86 | 13 | $('#bJwpointsInput').val(points); |
| 87 | 14 | |
| 88 | - // WGS经纬度 | |
| 89 | - $('#gJwpointsInput').val(gLonx + ' ' + gLaty); | |
| 90 | - | |
| 91 | 15 | // 百度坐标点图形集合 |
| 92 | 16 | $('#bPolygonGridInput').val(bPolygonGridValue); |
| 93 | 17 | |
| 94 | - // WGS坐标点图形集合 | |
| 95 | - $('#gPolygonGridInput').val(gPolygonGridVlaue); | |
| 96 | - | |
| 97 | 18 | // 图形类型 |
| 98 | 19 | $('#shapesTypeSelect').val(shapesTypeValue); |
| 99 | 20 | ... | ... |
src/main/resources/static/pages/base/station/js/add-vmap-world.js
| 1 | 1 | var VmapWorlds = function() { |
| 2 | 2 | |
| 3 | + var mapB = '', circle = '', drawingManager = '',circle='',marker=''; | |
| 4 | + | |
| 3 | 5 | var Bmap = { |
| 4 | 6 | |
| 5 | 7 | init : function() { |
| ... | ... | @@ -11,22 +13,22 @@ var VmapWorlds = function() { |
| 11 | 13 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 12 | 14 | |
| 13 | 15 | // 初始化百度地图 |
| 14 | - var map = new BMap.Map("bmap_basic"); | |
| 16 | + mapB = new BMap.Map("bmap_basic"); | |
| 15 | 17 | |
| 16 | 18 | //中心点和缩放级别 |
| 17 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 19 | + mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 18 | 20 | |
| 19 | 21 | //启用地图拖拽事件,默认启用(可不写) |
| 20 | - map.enableDragging(); | |
| 22 | + mapB.enableDragging(); | |
| 21 | 23 | |
| 22 | 24 | //启用地图滚轮放大缩小 |
| 23 | - map.enableScrollWheelZoom(); | |
| 25 | + mapB.enableScrollWheelZoom(); | |
| 24 | 26 | |
| 25 | 27 | //禁用鼠标双击放大 |
| 26 | - map.disableDoubleClickZoom(); | |
| 28 | + mapB.disableDoubleClickZoom(); | |
| 27 | 29 | |
| 28 | 30 | //启用键盘上下左右键移动地图 |
| 29 | - map.enableKeyboard(); | |
| 31 | + mapB.enableKeyboard(); | |
| 30 | 32 | |
| 31 | 33 | var styleOptions = { |
| 32 | 34 | |
| ... | ... | @@ -51,7 +53,7 @@ var VmapWorlds = function() { |
| 51 | 53 | }; |
| 52 | 54 | |
| 53 | 55 | // 创建鼠标绘制管理类 |
| 54 | - drawingManager = new BMapLib.DrawingManager(map, { | |
| 56 | + drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 55 | 57 | |
| 56 | 58 | //是否开启绘制模式 |
| 57 | 59 | isOpen : false, |
| ... | ... | @@ -98,70 +100,39 @@ var VmapWorlds = function() { |
| 98 | 100 | // 多变行质心点 |
| 99 | 101 | var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; |
| 100 | 102 | |
| 101 | - var PointsList = []; | |
| 102 | - | |
| 103 | - for ( var i = 0; i < pointE.getPath().length; i++) { | |
| 104 | - | |
| 105 | - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}}); | |
| 106 | - | |
| 107 | - } | |
| 103 | + var addPolyGonLen_ = pointE.getPath().length; | |
| 108 | 104 | |
| 109 | - PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}}); | |
| 105 | + var bPloygonGrid =''; | |
| 110 | 106 | |
| 111 | - var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}]; | |
| 112 | - | |
| 113 | - PublicFunctions.getFormPointEToWGS(PointsList,function(resultdata) { | |
| 114 | - | |
| 115 | - var gPloygonGrid = ''; | |
| 116 | - | |
| 117 | - var bPloygonGrid = ''; | |
| 107 | + for(var k =0;k<addPolyGonLen_;k++) { | |
| 118 | 108 | |
| 119 | - for(var k =0;k<resultdata.length;k++) { | |
| 109 | + if(k==0) { | |
| 120 | 110 | |
| 121 | - if(k==0) { | |
| 122 | - | |
| 123 | - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 124 | - | |
| 125 | - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 126 | - | |
| 127 | - }else { | |
| 128 | - | |
| 129 | - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 130 | - | |
| 131 | - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 132 | - | |
| 133 | - } | |
| 111 | + bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 134 | 112 | |
| 135 | - } | |
| 136 | - | |
| 137 | - gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))'; | |
| 138 | - | |
| 139 | - bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))'; | |
| 140 | - | |
| 141 | - PublicFunctions.getFormPointEToWGS(centre,function(p) { | |
| 142 | - | |
| 143 | - var gLonx = p[0].WGSpotion.Lng; | |
| 113 | + }else { | |
| 114 | + | |
| 115 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 144 | 116 | |
| 145 | - var gLaty = p[0].WGSpotion.Lat; | |
| 146 | - | |
| 147 | - PublicFunctions.setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d',''); | |
| 148 | - | |
| 149 | - }); | |
| 150 | - | |
| 151 | - }); | |
| 117 | + } | |
| 118 | + | |
| 119 | + } | |
| 120 | + | |
| 121 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 152 | 122 | |
| 123 | + PublicFunctions.setFormInputValue(addSttationPoints_,bPloygonGrid,'d',''); | |
| 153 | 124 | } |
| 154 | 125 | |
| 155 | 126 | }); |
| 156 | 127 | |
| 157 | - return map; | |
| 128 | + return mapB; | |
| 158 | 129 | }, |
| 159 | 130 | |
| 160 | 131 | // 根据地理名称获取百度经纬度坐标 |
| 161 | - localSearchFromAdreesToPoint: function(Address,map,callback) { | |
| 132 | + localSearchFromAdreesToPoint: function(Address,cb) { | |
| 162 | 133 | |
| 163 | 134 | // 创建一个搜索类实例 |
| 164 | - var localSearch = new BMap.LocalSearch(map); | |
| 135 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 165 | 136 | |
| 166 | 137 | // 检索完成后的回调函数。 |
| 167 | 138 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| ... | ... | @@ -176,19 +147,42 @@ var VmapWorlds = function() { |
| 176 | 147 | if(poi) { |
| 177 | 148 | |
| 178 | 149 | //获取经度和纬度 |
| 179 | - resultPoints = poi.point.lng + ' ' + poi.point.lat; | |
| 180 | - | |
| 181 | - callback && callback(resultPoints); | |
| 150 | + var stationNameChangePoint = new BMap.Point( poi.point.lng, poi.point.lat); | |
| 151 | + | |
| 152 | + marker = new BMap.Marker(stationNameChangePoint); | |
| 153 | + | |
| 154 | + var PanOptions ={noAnimation :true}; | |
| 155 | + | |
| 156 | + mapB.panTo(stationNameChangePoint,PanOptions); | |
| 157 | + | |
| 158 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 159 | + mapB.setZoom(18); | |
| 160 | + | |
| 161 | + mapB.panBy(0,-80); | |
| 162 | + | |
| 163 | + // 将标注添加到地图中 | |
| 164 | + mapB.addOverlay(marker); | |
| 165 | + | |
| 166 | + //跳动的动画 | |
| 167 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 168 | + | |
| 169 | + cb && cb(stationNameChangePoint); | |
| 182 | 170 | |
| 183 | 171 | }else { |
| 184 | 172 | |
| 185 | - callback && callback(false); | |
| 173 | + // 弹出添加成功提示消息 | |
| 174 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 175 | + | |
| 176 | + cb && cb(false); | |
| 186 | 177 | |
| 187 | 178 | } |
| 188 | 179 | |
| 189 | 180 | }else { |
| 190 | 181 | |
| 191 | - callback && callback(false); | |
| 182 | + // 弹出添加成功提示消息 | |
| 183 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 184 | + | |
| 185 | + cb && cb(false); | |
| 192 | 186 | } |
| 193 | 187 | |
| 194 | 188 | }); |
| ... | ... | @@ -198,6 +192,42 @@ var VmapWorlds = function() { |
| 198 | 192 | |
| 199 | 193 | }, |
| 200 | 194 | |
| 195 | + // 画圆 | |
| 196 | + pointsCircle : function(stationNameChangePoint) { | |
| 197 | + | |
| 198 | + //创建圆 | |
| 199 | + circle = new BMap.Circle(stationNameChangePoint,100,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 200 | + | |
| 201 | + // 百度地图添加覆盖物圆 | |
| 202 | + mapB.addOverlay(circle); | |
| 203 | + | |
| 204 | + // 开启编辑功能 | |
| 205 | + circle.enableEditing(); | |
| 206 | + | |
| 207 | + // 编辑圆监听事件 | |
| 208 | + circle.addEventListener('remove',function() { | |
| 209 | + | |
| 210 | + // 清除marker | |
| 211 | + mapB.removeOverlay(marker); | |
| 212 | + | |
| 213 | + /*VmapWorlds.clearMarkAndOverlays();*/ | |
| 214 | + | |
| 215 | + // 返回圆形的半径,单位为米。 | |
| 216 | + var newRadius = circle.getRadius(); | |
| 217 | + | |
| 218 | + // 返回圆形的中心点坐标。 | |
| 219 | + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 220 | + | |
| 221 | + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 222 | + | |
| 223 | + circle = ''; | |
| 224 | + | |
| 225 | + PublicFunctions.setFormInputValue(newCenter,'','r',Math.round(newRadius)); | |
| 226 | + | |
| 227 | + }); | |
| 228 | + | |
| 229 | + }, | |
| 230 | + | |
| 201 | 231 | // 打开绘画工具 |
| 202 | 232 | drawingManagerOpen : function(map) { |
| 203 | 233 | |
| ... | ... | @@ -207,6 +237,20 @@ var VmapWorlds = function() { |
| 207 | 237 | // 设置属性 |
| 208 | 238 | drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); |
| 209 | 239 | |
| 240 | + }, | |
| 241 | + | |
| 242 | + | |
| 243 | + drawingManagerClose : function() { | |
| 244 | + | |
| 245 | + drawingManager.close(); | |
| 246 | + | |
| 247 | + }, | |
| 248 | + | |
| 249 | + clearMarkAndOverlays : function() { | |
| 250 | + | |
| 251 | + // 清楚地图覆盖物 | |
| 252 | + mapB.clearOverlays(); | |
| 253 | + | |
| 210 | 254 | } |
| 211 | 255 | |
| 212 | 256 | } | ... | ... |
src/main/resources/static/pages/base/stationroute/css/img/blank.gif
0 → 100644
49 Bytes
src/main/resources/static/pages/base/stationroute/css/img/gjzd.png
0 → 100644
2.95 KB