Commit 51d73d3b03c5854ca28511d718493e6950c0ac2e
1 parent
52eb029a
1.解决报站语音生成在centos7下异常问题
2.百度地图商用key替换 3.js压缩兼容es6
Showing
21 changed files
with
6217 additions
and
6039 deletions
pom.xml
| ... | ... | @@ -419,10 +419,23 @@ |
| 419 | 419 | <version>1.5.3</version> |
| 420 | 420 | </dependency> |
| 421 | 421 | |
| 422 | + <!-- 核心依赖 --> | |
| 422 | 423 | <dependency> |
| 423 | 424 | <groupId>org.bytedeco</groupId> |
| 424 | - <artifactId>javacv-platform</artifactId> | |
| 425 | - <version>1.5.11</version> | |
| 425 | + <artifactId>javacv</artifactId> | |
| 426 | + <version>1.5.5</version> | |
| 427 | + </dependency> | |
| 428 | + <dependency> | |
| 429 | + <groupId>org.bytedeco</groupId> | |
| 430 | + <artifactId>javacpp</artifactId> | |
| 431 | + <version>1.5.5</version> | |
| 432 | + </dependency> | |
| 433 | + <!-- Linux x86_64平台特定的FFmpeg依赖 --> | |
| 434 | + <dependency> | |
| 435 | + <groupId>org.bytedeco</groupId> | |
| 436 | + <artifactId>ffmpeg</artifactId> | |
| 437 | + <version>4.3.2-1.5.5</version> | |
| 438 | + <classifier>${javacpp.platform}</classifier> | |
| 426 | 439 | </dependency> |
| 427 | 440 | </dependencies> |
| 428 | 441 | |
| ... | ... | @@ -496,6 +509,7 @@ |
| 496 | 509 | |
| 497 | 510 | <properties> |
| 498 | 511 | <start-class>com.bsth.Application</start-class> |
| 512 | + <!-- 平台配置,只打包Linux x86_64平台的jar包 --> | |
| 499 | 513 | <javacpp.platform>linux-x86_64</javacpp.platform> |
| 500 | 514 | </properties> |
| 501 | 515 | </project> | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -8,7 +8,6 @@ import com.bsth.service.StationRouteService; |
| 8 | 8 | import com.bsth.util.*; |
| 9 | 9 | import com.bsth.util.Geo.GeoUtils; |
| 10 | 10 | import com.bsth.util.Geo.Point; |
| 11 | -import com.bsth.util.PackTarGZUtils; | |
| 12 | 11 | import com.bsth.util.db.DBUtils_MS; |
| 13 | 12 | import com.google.common.base.Splitter; |
| 14 | 13 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -27,19 +26,19 @@ import java.util.zip.ZipEntry; |
| 27 | 26 | import java.util.zip.ZipOutputStream; |
| 28 | 27 | |
| 29 | 28 | /** |
| 30 | - * | |
| 29 | + * | |
| 31 | 30 | * @ClassName: StationRouteServiceImpl(站点路由service业务层实现类) |
| 32 | - * | |
| 31 | + * | |
| 33 | 32 | * @Extends : BaseService |
| 34 | - * | |
| 33 | + * | |
| 35 | 34 | * @Description: TODO(站点路由service业务层) |
| 36 | - * | |
| 35 | + * | |
| 37 | 36 | * @Author bsth@lq |
| 38 | - * | |
| 37 | + * | |
| 39 | 38 | * @Date 2016年5月03日 上午9:21:17 |
| 40 | 39 | * |
| 41 | 40 | * @Version 公交调度系统BS版 0.1 |
| 42 | - * | |
| 41 | + * | |
| 43 | 42 | */ |
| 44 | 43 | |
| 45 | 44 | @Service |
| ... | ... | @@ -50,16 +49,16 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 50 | 49 | |
| 51 | 50 | @Value("${path.speech.line}") |
| 52 | 51 | private String linePathPattern; |
| 53 | - | |
| 52 | + | |
| 54 | 53 | @Autowired |
| 55 | 54 | private StationRouteRepository stationRouteRepository; |
| 56 | - | |
| 55 | + | |
| 57 | 56 | @Autowired |
| 58 | 57 | private SectionRouteRepository sectionRouteRepository; |
| 59 | - | |
| 58 | + | |
| 60 | 59 | @Autowired |
| 61 | 60 | private LineRepository lineRepository; |
| 62 | - | |
| 61 | + | |
| 63 | 62 | @Autowired |
| 64 | 63 | private StationRepository stationRepository; |
| 65 | 64 | |
| ... | ... | @@ -72,6 +71,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 72 | 71 | @Autowired |
| 73 | 72 | private LsSectionRouteRepository lsSectionRouteRepository; |
| 74 | 73 | |
| 74 | + @Autowired | |
| 75 | + private LineRegionRepository lineRegionRepository; | |
| 76 | + @Autowired | |
| 77 | + private LineVersionsRepository lineVersionsRepository; | |
| 78 | + | |
| 75 | 79 | @Override |
| 76 | 80 | public Iterable<StationRoute> list(Map<String, Object> map) { |
| 77 | 81 | List<Sort.Order> orders = new ArrayList<>(); |
| ... | ... | @@ -80,7 +84,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 80 | 84 | |
| 81 | 85 | return stationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(orders)); |
| 82 | 86 | } |
| 83 | - | |
| 87 | + | |
| 84 | 88 | @Override |
| 85 | 89 | public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) { |
| 86 | 90 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| ... | ... | @@ -132,12 +136,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 132 | 136 | } |
| 133 | 137 | return resultMap; |
| 134 | 138 | } |
| 135 | - | |
| 139 | + | |
| 136 | 140 | /** |
| 137 | 141 | * @Description :TODO(查询树站点与路段数据) |
| 138 | - * | |
| 142 | + * | |
| 139 | 143 | * @param map <line.id_eq:线路ID; directions_eq:方向> |
| 140 | - * | |
| 144 | + * | |
| 141 | 145 | * @return List<Map<String, Object>> |
| 142 | 146 | */ |
| 143 | 147 | @Override |
| ... | ... | @@ -151,26 +155,26 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 151 | 155 | |
| 152 | 156 | return result; |
| 153 | 157 | } |
| 154 | - | |
| 158 | + | |
| 155 | 159 | @Override |
| 156 | 160 | public Map<String, Object> systemQuote(Map<String, Object> map) { |
| 157 | 161 | Map<String, Object> resultmap = new HashMap<>(); |
| 158 | 162 | try{ |
| 159 | - | |
| 163 | + | |
| 160 | 164 | StationRoute route = new StationRoute(); |
| 161 | - | |
| 165 | + | |
| 162 | 166 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); |
| 163 | - | |
| 167 | + | |
| 164 | 168 | Integer stationId = map.get("stationId").equals("") ? null : Integer.parseInt(map.get("stationId").toString()); |
| 165 | - | |
| 169 | + | |
| 166 | 170 | Line line = lineRepository.findById(lineId).get(); |
| 167 | - | |
| 171 | + | |
| 168 | 172 | Station station = stationRepository.findById(stationId).get(); |
| 169 | - | |
| 173 | + | |
| 170 | 174 | route.setLine(line); |
| 171 | - | |
| 175 | + | |
| 172 | 176 | route.setStation(station); |
| 173 | - | |
| 177 | + | |
| 174 | 178 | //baseRepository.save(t); |
| 175 | 179 | resultmap.put("status", ResponseCode.SUCCESS); |
| 176 | 180 | }catch(Exception e){ |
| ... | ... | @@ -179,13 +183,13 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 179 | 183 | } |
| 180 | 184 | return resultmap; |
| 181 | 185 | } |
| 182 | - | |
| 186 | + | |
| 183 | 187 | /** |
| 184 | 188 | * @Description :TODO(查询线路某方向下的站点序号与类型) |
| 185 | - * | |
| 189 | + * | |
| 186 | 190 | * @param map <lineId:线路ID; direction:方向;stationRouteCode:站点编码> |
| 187 | - * | |
| 188 | - * @return List<Map<String, Object>> | |
| 191 | + * | |
| 192 | + * @return List<Map<String, Object>> | |
| 189 | 193 | */ |
| 190 | 194 | @Override |
| 191 | 195 | public List<Map<String, Object>> findUpStationRouteCode(Map<String, Object> map) { |
| ... | ... | @@ -300,40 +304,40 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 300 | 304 | |
| 301 | 305 | /** |
| 302 | 306 | * @Description :TODO(查询线路某方向下所有站点的中心百度坐标) |
| 303 | - * | |
| 307 | + * | |
| 304 | 308 | * @param map <lineId:线路ID; direction:方向> |
| 305 | - * | |
| 306 | - * @return List<Map<String, Object>> | |
| 309 | + * | |
| 310 | + * @return List<Map<String, Object>> | |
| 307 | 311 | */ |
| 308 | 312 | @Override |
| 309 | 313 | public List<Map<String, Object>> getStationRouteCenterPoints(Map<String, Object> map) { |
| 310 | - | |
| 314 | + | |
| 311 | 315 | List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); |
| 312 | - | |
| 316 | + | |
| 313 | 317 | // 线路ID |
| 314 | 318 | Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString()); |
| 315 | - | |
| 319 | + | |
| 316 | 320 | // 方向 |
| 317 | 321 | Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString()); |
| 318 | - | |
| 322 | + | |
| 319 | 323 | List<Object[]> list = stationRouteRepository.getSelectStationRouteCenterPoints(lineId, direction); |
| 320 | - | |
| 324 | + | |
| 321 | 325 | if(list.size()>0) { |
| 322 | - | |
| 326 | + | |
| 323 | 327 | for(int i = 0;i<list.size();i++) { |
| 324 | - | |
| 328 | + | |
| 325 | 329 | Map<String, Object> tempM = new HashMap<String,Object>(); |
| 326 | - | |
| 330 | + | |
| 327 | 331 | tempM.put("bJwpoints", list.get(i)[0]); |
| 328 | - | |
| 332 | + | |
| 329 | 333 | tempM.put("stationName", list.get(i)[1]); |
| 330 | - | |
| 334 | + | |
| 331 | 335 | resultList.add(tempM); |
| 332 | - | |
| 336 | + | |
| 333 | 337 | } |
| 334 | - | |
| 338 | + | |
| 335 | 339 | } |
| 336 | - | |
| 340 | + | |
| 337 | 341 | return resultList; |
| 338 | 342 | } |
| 339 | 343 | |
| ... | ... | @@ -351,7 +355,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 351 | 355 | } |
| 352 | 356 | map.put("destroy_eq", 0); |
| 353 | 357 | List<LsStationRoute> stationRoutes = lsStationRouteRepository.findAll(new CustomerSpecs<>(map), Sort.by(Direction.ASC, "stationRouteCode")); |
| 354 | - | |
| 358 | + | |
| 355 | 359 | List<Map<String, Object>> resultList = new ArrayList<>(); |
| 356 | 360 | |
| 357 | 361 | int len = stationRoutes.size(); |
| ... | ... | @@ -362,44 +366,44 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 362 | 366 | } |
| 363 | 367 | return resultList; |
| 364 | 368 | } |
| 365 | - | |
| 369 | + | |
| 366 | 370 | /** |
| 367 | 371 | * @Description :TODO(撤销站点) |
| 368 | - * | |
| 372 | + * | |
| 369 | 373 | * @param map <lineId:线路ID; destroy:是否撤销(0:否;1:是)> |
| 370 | - * | |
| 374 | + * | |
| 371 | 375 | * @return Map<String, Object> <SUCCESS ; ERROR> |
| 372 | 376 | */ |
| 373 | 377 | @Override |
| 374 | 378 | public Map<String, Object> stationRouteIsDestroy(Map<String, Object> map) { |
| 375 | 379 | Map<String, Object> resultMap = new HashMap<String,Object>(); |
| 376 | - | |
| 380 | + | |
| 377 | 381 | try { |
| 378 | - | |
| 382 | + | |
| 379 | 383 | Integer stationRouteId = map.get("stationRouteId").equals("") ? 0 : Integer.parseInt(map.get("stationRouteId").toString()); |
| 380 | - | |
| 384 | + | |
| 381 | 385 | Integer destroy = map.get("destroy").equals("") ? 0 : Integer.parseInt(map.get("destroy").toString()); |
| 382 | 386 | |
| 383 | 387 | lsStationRouteRepository.deleteById(stationRouteId); |
| 384 | 388 | |
| 385 | 389 | resultMap.put("status", ResponseCode.SUCCESS); |
| 386 | - | |
| 390 | + | |
| 387 | 391 | } catch (Exception e) { |
| 388 | - | |
| 392 | + | |
| 389 | 393 | resultMap.put("status", ResponseCode.ERROR); |
| 390 | - | |
| 394 | + | |
| 391 | 395 | logger.error("save erro.", e); |
| 392 | - | |
| 396 | + | |
| 393 | 397 | } |
| 394 | - | |
| 398 | + | |
| 395 | 399 | return resultMap; |
| 396 | 400 | } |
| 397 | - | |
| 401 | + | |
| 398 | 402 | /** |
| 399 | 403 | * @Description : TODO(根据线路ID生成行单) |
| 400 | - * | |
| 404 | + * | |
| 401 | 405 | * @param map <lineId:线路ID> |
| 402 | - * | |
| 406 | + * | |
| 403 | 407 | * @return Map<String, Object> <SUCCESS ; ERROR ; NOTDATA> |
| 404 | 408 | */ |
| 405 | 409 | @Override |
| ... | ... | @@ -409,10 +413,13 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 409 | 413 | try { |
| 410 | 414 | // 获取线路ID |
| 411 | 415 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 416 | + Integer version = lineVersionsRepository.findCurrentVersion(lineId); | |
| 417 | + Map<String, Object> param = new HashMap<>(); | |
| 418 | + param.put("line_eq", lineId); | |
| 419 | + param.put("version_eq", version); | |
| 412 | 420 | /** 查询线路信息 @param:<lineId:线路ID> */ |
| 413 | 421 | Line line = lineRepository.findById(lineId).get(); |
| 414 | 422 | |
| 415 | - | |
| 416 | 423 | Business company = businessRepository.findByBusinessCode(line.getCompany()).get(0); |
| 417 | 424 | |
| 418 | 425 | Integer fileVersions = lineRepository.findfileVersions(lineId); |
| ... | ... | @@ -426,13 +433,15 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 426 | 433 | // Integer fileVersions = map.get("fileVersions").equals("") ? 1 : Integer.parseInt(map.get("fileVersions").toString());// 没有输入就默认1 |
| 427 | 434 | /** 查询线路信息下的站点路由信息 @param:<lineId:线路ID> */ |
| 428 | 435 | List<Object[]> objects = stationRouteRepository.usingSingle(lineId); |
| 436 | + List<LineRegion> lineRegions = lineRegionRepository.findAll(new CustomerSpecs<>(param)); | |
| 429 | 437 | if (objects.size()>0) { |
| 430 | -// // 报站音频 | |
| 431 | -// Set<String> languages = new HashSet<>(); | |
| 432 | -// languages.add("cn"); | |
| 433 | -// languages.add("sh"); | |
| 434 | -// languages.add("en"); | |
| 435 | -// InputStream tts = ttsAndZip(objects, line, languages); | |
| 438 | + // 报站音频 | |
| 439 | + Set<String> languages = new HashSet<>(); | |
| 440 | + languages.add("cn"); | |
| 441 | + languages.add("sh"); | |
| 442 | + languages.add("en"); | |
| 443 | + ttsAndZip(objects, line, languages, lineRegions); | |
| 444 | + | |
| 436 | 445 | /** 获取配置文件里的ftp登录参数 */ |
| 437 | 446 | Map<String, Object> FTPParamMap = readPropertiesGetFTPParam(); |
| 438 | 447 | // 压缩文件名 |
| ... | ... | @@ -497,12 +506,25 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 497 | 506 | |
| 498 | 507 | input = new ByteArrayInputStream(textStr.getBytes("gbk")); |
| 499 | 508 | |
| 509 | + // 线路文件上传(全程) | |
| 500 | 510 | clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", textFileName, input); |
| 501 | - | |
| 502 | -// textFile.delete(); | |
| 503 | - | |
| 504 | -// clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode())); | |
| 505 | -// clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode()), tts); | |
| 511 | + String linePath = String.format(linePathPattern, lineId), voicePath = String.format("%s%s.zip", linePath, lineId); | |
| 512 | + // 报站文件上传(全程) | |
| 513 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s.zip", line.getLineCode())); | |
| 514 | + clientUtils.FTPUpLoadFromDisk(new File(voicePath), String.format("%s.zip", line.getLineCode()), url, port, username, password, remotePath + "/voice/"); | |
| 515 | + | |
| 516 | + // 线路区间 | |
| 517 | + if (lineRegions.size() > 0) { | |
| 518 | + FTPClientUtils.deleteFileByPrefix(String.format("%s-", line.getLineCode()), url, port, username, password, String.format("%s/voice/", remotePath)); | |
| 519 | + for (LineRegion lineRegion : lineRegions) { | |
| 520 | + voicePath = String.format("%s%s-%d.zip", linePath, lineId, lineRegion.getSeq()); | |
| 521 | + textStr = String.format("%s\r\n%s", head, subLine2Ftp(lineRegion)); | |
| 522 | + input = new ByteArrayInputStream(textStr.getBytes("gbk")); | |
| 523 | + clientUtils.uploadFile(url, port, username, password, remotePath + "/voice/", String.format("%s-%d.txt", line.getLineCode(), lineRegion.getSeq()), input); | |
| 524 | + clientUtils.deleteFtpFile(url, port, username, password, remotePath + "/voice/", String.format("%s-%d.zip", line.getLineCode(), lineRegion.getSeq())); | |
| 525 | + clientUtils.FTPUpLoadFromDisk(new File(voicePath), String.format("%s-%d.zip", line.getLineCode(), lineRegion.getSeq()), url, port, username, password, remotePath + "/voice/"); | |
| 526 | + } | |
| 527 | + } | |
| 506 | 528 | |
| 507 | 529 | resultMap.put("status", ResponseCode.SUCCESS); |
| 508 | 530 | }else { |
| ... | ... | @@ -515,22 +537,22 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 515 | 537 | return resultMap; |
| 516 | 538 | } |
| 517 | 539 | } |
| 518 | - | |
| 540 | + | |
| 519 | 541 | /** |
| 520 | 542 | * @Description : TODO(形成行单文件内容) |
| 521 | - * | |
| 543 | + * | |
| 522 | 544 | * @param objects :站点路由信息 |
| 523 | - * | |
| 545 | + * | |
| 524 | 546 | * {[0]:g_lonx(GPS经度);[1]:g_laty(GPS纬度);[2]:b_jwpoints(百度经纬度坐标) |
| 525 | - * | |
| 547 | + * | |
| 526 | 548 | * [3]:station_mark(站点类型);[4]:station_route_code(站点序号);[5]:station_cod(站点编码); |
| 527 | - * | |
| 549 | + * | |
| 528 | 550 | * [6]:distances(站点距离);[7]:station_name(站点名称);[8]:directions(方向)} |
| 529 | - * | |
| 551 | + * | |
| 530 | 552 | * @param lineId :线路ID |
| 531 | - * | |
| 553 | + * | |
| 532 | 554 | * @return String |
| 533 | - */ | |
| 555 | + */ | |
| 534 | 556 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 535 | 557 | |
| 536 | 558 | // 返回值String |
| ... | ... | @@ -545,34 +567,34 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 545 | 567 | defaultZdxh ++ ; |
| 546 | 568 | // 经度 |
| 547 | 569 | String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 548 | - | |
| 570 | + | |
| 549 | 571 | // 纬度 |
| 550 | 572 | String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 551 | - | |
| 573 | + | |
| 552 | 574 | Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); |
| 553 | - | |
| 575 | + | |
| 554 | 576 | lat = "\t" + lat; |
| 555 | - | |
| 577 | + | |
| 556 | 578 | // 站点类型 |
| 557 | 579 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); |
| 558 | - | |
| 580 | + | |
| 559 | 581 | String stationMake = ""; |
| 560 | - | |
| 582 | + | |
| 561 | 583 | if(stationMakeStr.equals("E")) { |
| 562 | 584 | stationMake = "\t2"; |
| 563 | 585 | }else { |
| 564 | 586 | stationMake ="\t1"; |
| 565 | 587 | } |
| 566 | - | |
| 567 | - // 站点序号 | |
| 588 | + | |
| 589 | + // 站点序号 | |
| 568 | 590 | // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); |
| 569 | 591 | String stationNo = String.valueOf(defaultZdxh); |
| 570 | - | |
| 592 | + | |
| 571 | 593 | stationNo = "\t" + stationNo; |
| 572 | - | |
| 594 | + | |
| 573 | 595 | // 站点编码 |
| 574 | 596 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 575 | - | |
| 597 | + | |
| 576 | 598 | int len = stationCode.length(); |
| 577 | 599 | if(len<8) { |
| 578 | 600 | int dx = 8 - len; |
| ... | ... | @@ -584,24 +606,24 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 584 | 606 | }else if(len>8){ |
| 585 | 607 | stationCode = stationCode.substring(8); |
| 586 | 608 | } |
| 587 | - | |
| 609 | + | |
| 588 | 610 | stationCode = "\t" +stationCode; |
| 589 | - | |
| 611 | + | |
| 590 | 612 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 591 | - | |
| 613 | + | |
| 592 | 614 | String tempDistc = String.valueOf((int) dis); |
| 593 | - | |
| 615 | + | |
| 594 | 616 | // 站点距离 |
| 595 | 617 | String staitondistance = "\t" + tempDistc; |
| 596 | - | |
| 618 | + | |
| 597 | 619 | // 站点名称 |
| 598 | 620 | String stationName = objects.get(i)[7].equals("") ? "" : objects.get(i)[7].toString(); |
| 599 | - | |
| 621 | + | |
| 600 | 622 | stationName = "\t" +stationName; |
| 601 | - | |
| 623 | + | |
| 602 | 624 | // 限速 |
| 603 | 625 | // String sleepStr = " " + "60"; |
| 604 | - | |
| 626 | + | |
| 605 | 627 | // 限速 |
| 606 | 628 | String sleepStr = ""; |
| 607 | 629 | // 方向 |
| ... | ... | @@ -631,16 +653,16 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 631 | 653 | } |
| 632 | 654 | } |
| 633 | 655 | } |
| 634 | - if(sleepStr.equals("")) | |
| 656 | + if(sleepStr.equals("")) | |
| 635 | 657 | sleepStr = "\t" + "60"; |
| 636 | 658 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 637 | 659 | } |
| 638 | - | |
| 660 | + | |
| 639 | 661 | } |
| 640 | 662 | return stationRStr; |
| 641 | - | |
| 663 | + | |
| 642 | 664 | } |
| 643 | - | |
| 665 | + | |
| 644 | 666 | public String newTextVoiceFileToFTP(List<Object[]> objects,Integer lineId) { |
| 645 | 667 | |
| 646 | 668 | // 返回值String |
| ... | ... | @@ -655,34 +677,34 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 655 | 677 | defaultZdxh ++ ; |
| 656 | 678 | // 经度 |
| 657 | 679 | String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 658 | - | |
| 680 | + | |
| 659 | 681 | // 纬度 |
| 660 | 682 | String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 661 | - | |
| 683 | + | |
| 662 | 684 | Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); |
| 663 | - | |
| 685 | + | |
| 664 | 686 | lat = "\t" + lat; |
| 665 | - | |
| 687 | + | |
| 666 | 688 | // 站点类型 |
| 667 | 689 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); |
| 668 | - | |
| 690 | + | |
| 669 | 691 | String stationMake = ""; |
| 670 | - | |
| 692 | + | |
| 671 | 693 | if(stationMakeStr.equals("E")) { |
| 672 | 694 | stationMake = "\t2"; |
| 673 | 695 | }else { |
| 674 | 696 | stationMake ="\t1"; |
| 675 | 697 | } |
| 676 | - | |
| 677 | - // 站点序号 | |
| 698 | + | |
| 699 | + // 站点序号 | |
| 678 | 700 | // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); |
| 679 | 701 | String stationNo = String.valueOf(defaultZdxh); |
| 680 | - | |
| 702 | + | |
| 681 | 703 | stationNo = "\t" + stationNo; |
| 682 | - | |
| 704 | + | |
| 683 | 705 | // 站点编码 |
| 684 | 706 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 685 | - | |
| 707 | + | |
| 686 | 708 | int len = stationCode.length(); |
| 687 | 709 | if(len<8) { |
| 688 | 710 | int dx = 8 - len; |
| ... | ... | @@ -694,31 +716,31 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 694 | 716 | }else if(len>8){ |
| 695 | 717 | stationCode = stationCode.substring(8); |
| 696 | 718 | } |
| 697 | - | |
| 719 | + | |
| 698 | 720 | stationCode = "\t" +stationCode; |
| 699 | - | |
| 721 | + | |
| 700 | 722 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 701 | - | |
| 723 | + | |
| 702 | 724 | String tempDistc = String.valueOf((int) dis); |
| 703 | - | |
| 725 | + | |
| 704 | 726 | // 站点距离 |
| 705 | 727 | String staitondistance = "\t" + tempDistc; |
| 706 | - | |
| 728 | + | |
| 707 | 729 | // 站点名称 |
| 708 | 730 | String stationName = objects.get(i)[7].equals("") ? " " : objects.get(i)[7].toString(); |
| 709 | - | |
| 731 | + | |
| 710 | 732 | String stationNameEn = " "; |
| 711 | 733 | if(objects.get(i)[9] != null){ |
| 712 | 734 | stationNameEn = objects.get(i)[9].equals("") ? " " : objects.get(i)[9].toString(); |
| 713 | 735 | } |
| 714 | - | |
| 715 | - | |
| 736 | + | |
| 737 | + | |
| 716 | 738 | stationName = "\t" +stationName; |
| 717 | 739 | stationNameEn = "\t" +stationNameEn; |
| 718 | - | |
| 740 | + | |
| 719 | 741 | // 限速 |
| 720 | 742 | // String sleepStr = " " + "60"; |
| 721 | - | |
| 743 | + | |
| 722 | 744 | // 限速 |
| 723 | 745 | String sleepStr = ""; |
| 724 | 746 | // 方向 |
| ... | ... | @@ -751,16 +773,16 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 751 | 773 | } |
| 752 | 774 | } |
| 753 | 775 | } |
| 754 | - if(sleepStr.equals("")) | |
| 776 | + if(sleepStr.equals("")) | |
| 755 | 777 | sleepStr = "\t" + "60"; |
| 756 | 778 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + stationNameEn + enterStr; |
| 757 | 779 | } |
| 758 | - | |
| 780 | + | |
| 759 | 781 | } |
| 760 | 782 | return stationRStr; |
| 761 | - | |
| 783 | + | |
| 762 | 784 | } |
| 763 | - | |
| 785 | + | |
| 764 | 786 | public String hxTextFileToFtp(List<Object[]> objects,Integer lineId) { |
| 765 | 787 | String restStr = ""; |
| 766 | 788 | // windows下的文本文件换行符 |
| ... | ... | @@ -773,10 +795,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 773 | 795 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { |
| 774 | 796 | // 经度 |
| 775 | 797 | String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 776 | - | |
| 798 | + | |
| 777 | 799 | // 纬度 |
| 778 | 800 | String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 779 | - | |
| 801 | + | |
| 780 | 802 | Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); |
| 781 | 803 | lat = "\t" + lat; |
| 782 | 804 | // 站点类型 |
| ... | ... | @@ -787,7 +809,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 787 | 809 | }else { |
| 788 | 810 | stationMake ="\t1"; |
| 789 | 811 | } |
| 790 | - // 站点序号 | |
| 812 | + // 站点序号 | |
| 791 | 813 | // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); |
| 792 | 814 | String stationNo = "\t" + xh; |
| 793 | 815 | // 站点编码 |
| ... | ... | @@ -843,7 +865,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 843 | 865 | } |
| 844 | 866 | } |
| 845 | 867 | } |
| 846 | - if(sleepStr.equals("")) | |
| 868 | + if(sleepStr.equals("")) | |
| 847 | 869 | sleepStr = "\t" + "60"; |
| 848 | 870 | xh++; |
| 849 | 871 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| ... | ... | @@ -853,70 +875,70 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 853 | 875 | System.out.println(restStr); |
| 854 | 876 | return restStr; |
| 855 | 877 | } |
| 856 | - | |
| 878 | + | |
| 857 | 879 | public boolean isPointOnPolyline (Map<String, Object> point, List<Map<String, Object>> listMap ){ |
| 858 | - | |
| 880 | + | |
| 859 | 881 | boolean success = false; |
| 860 | - | |
| 882 | + | |
| 861 | 883 | for(int l = 0; l < listMap.size() - 1; l ++){ |
| 862 | - | |
| 884 | + | |
| 863 | 885 | Map<String, Object> tempM = listMap.get(l); |
| 864 | - | |
| 886 | + | |
| 865 | 887 | Map<String, Object> nextTempM = listMap.get(l+1); |
| 866 | - | |
| 888 | + | |
| 867 | 889 | if (Double.valueOf(point.get("lng").toString())>= Math.min(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && Double.valueOf(point.get("lng").toString()) <= Math.max(Double.valueOf(tempM.get("lng").toString()), Double.valueOf(nextTempM.get("lng").toString())) && |
| 868 | 890 | Double.valueOf(point.get("lat").toString()) >= Math.min(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString())) && Double.valueOf(point.get("lat").toString()) <= Math.max(Double.valueOf(tempM.get("lat").toString()), Double.valueOf(nextTempM.get("lat").toString()))){ |
| 869 | - | |
| 870 | - | |
| 871 | - double precision = (Double.valueOf(tempM.get("lng").toString()) - Double.valueOf(point.get("lng").toString())) * (Double.valueOf(nextTempM.get("lat").toString()) - Double.valueOf(point.get("lat").toString())) - | |
| 891 | + | |
| 892 | + | |
| 893 | + double precision = (Double.valueOf(tempM.get("lng").toString()) - Double.valueOf(point.get("lng").toString())) * (Double.valueOf(nextTempM.get("lat").toString()) - Double.valueOf(point.get("lat").toString())) - | |
| 872 | 894 | (Double.valueOf(nextTempM.get("lng").toString()) - Double.valueOf(tempM.get("lng").toString())) * (Double.valueOf(tempM.get("lat").toString()) - Double.valueOf(nextTempM.get("lat").toString())); |
| 873 | - | |
| 895 | + | |
| 874 | 896 | if(precision < 2e-10 && precision > -2e-10){ |
| 875 | - | |
| 897 | + | |
| 876 | 898 | //实质判断是否接近0 |
| 877 | 899 | success = true; |
| 878 | - | |
| 879 | - } | |
| 880 | - | |
| 900 | + | |
| 901 | + } | |
| 902 | + | |
| 881 | 903 | } |
| 882 | - | |
| 904 | + | |
| 883 | 905 | } |
| 884 | - | |
| 906 | + | |
| 885 | 907 | return success; |
| 886 | 908 | } |
| 887 | - | |
| 909 | + | |
| 888 | 910 | /** |
| 889 | 911 | * @Description:TOOD(获取FTP登录参数) 这里暂时只做一个map值返回,以后可以作为ftp登录类提出来 |
| 890 | - * | |
| 912 | + * | |
| 891 | 913 | * @return : Map<String, Object> <url:IP;port:端口;username:用户名;password:密码;remotePath:相对路径> |
| 892 | 914 | */ |
| 893 | 915 | public Map<String, Object> readPropertiesGetFTPParam(){ |
| 894 | - | |
| 916 | + | |
| 895 | 917 | // 返回值map |
| 896 | 918 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| 897 | - | |
| 919 | + | |
| 898 | 920 | Properties env = new Properties(); |
| 899 | - | |
| 921 | + | |
| 900 | 922 | try { |
| 901 | - | |
| 923 | + | |
| 902 | 924 | env.load(DBUtils_MS.class.getClassLoader().getResourceAsStream("ftp.properties")); |
| 903 | - | |
| 925 | + | |
| 904 | 926 | resultMap.put("url", env.getProperty("ftp.url")); |
| 905 | - | |
| 927 | + | |
| 906 | 928 | resultMap.put("port", env.getProperty("ftp.port")); |
| 907 | - | |
| 929 | + | |
| 908 | 930 | resultMap.put("username", env.getProperty("ftp.username")); |
| 909 | - | |
| 931 | + | |
| 910 | 932 | resultMap.put("password", env.getProperty("ftp.password")); |
| 911 | - | |
| 933 | + | |
| 912 | 934 | resultMap.put("remotePath", env.getProperty("ftp.path")); |
| 913 | - | |
| 935 | + | |
| 914 | 936 | } catch (Exception e) { |
| 915 | 937 | |
| 916 | 938 | e.printStackTrace(); |
| 917 | - | |
| 939 | + | |
| 918 | 940 | } |
| 919 | - | |
| 941 | + | |
| 920 | 942 | return resultMap ; |
| 921 | 943 | } |
| 922 | 944 | |
| ... | ... | @@ -943,7 +965,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 943 | 965 | } |
| 944 | 966 | //过滤部分字段 |
| 945 | 967 | /*String jsonStr = JSON.toJSONString(list, new PropertyFilter() { |
| 946 | - | |
| 968 | + | |
| 947 | 969 | @Override |
| 948 | 970 | public boolean apply(Object object, String name, Object value) { |
| 949 | 971 | if(name.equals("line")) |
| ... | ... | @@ -951,14 +973,14 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 951 | 973 | return true; |
| 952 | 974 | } |
| 953 | 975 | });*/ |
| 954 | - | |
| 976 | + | |
| 955 | 977 | rs.put("status", ResponseCode.SUCCESS); |
| 956 | 978 | rs.put("list", list); |
| 957 | 979 | }catch(Exception e){ |
| 958 | 980 | logger.error("", e); |
| 959 | 981 | rs.put("status", ResponseCode.ERROR); |
| 960 | 982 | } |
| 961 | - | |
| 983 | + | |
| 962 | 984 | return rs; |
| 963 | 985 | } |
| 964 | 986 | |
| ... | ... | @@ -1047,7 +1069,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1047 | 1069 | * @param line |
| 1048 | 1070 | * @param languages 语言 如:cn、en、sh |
| 1049 | 1071 | */ |
| 1050 | - private InputStream ttsAndZip(List<Object[]> objects, Line line, Set<String> languages) throws Exception { | |
| 1072 | + private void ttsAndZip(List<Object[]> objects, Line line, Set<String> languages, List<LineRegion> lineRegions) throws Exception { | |
| 1051 | 1073 | String lineId = line.getLineCode(); |
| 1052 | 1074 | StringBuilder cnBuilder = new StringBuilder(line.getName()).append("[p1000]"), enBuilder = new StringBuilder("Hello[p1000]"); |
| 1053 | 1075 | int ups = 0, downs = 0; |
| ... | ... | @@ -1082,47 +1104,90 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1082 | 1104 | // 文本转语音并进行分割 |
| 1083 | 1105 | // 音频存放及压缩文件路径 |
| 1084 | 1106 | String linePath = String.format(linePathPattern, lineId), voicePath = String.format("%s%s.zip", linePath, lineId); |
| 1085 | - try { | |
| 1086 | - String path = String.format("%scn.mp3", linePath); | |
| 1087 | - IFlyUtils.textToSpeechCn(cnBuilder.toString(), path); | |
| 1088 | - AudioOperationUtils.splitBySilence(path, String.format("%scn", linePath), 500, -40); | |
| 1089 | - } catch (Exception e) { | |
| 1090 | - throw new RuntimeException(e); | |
| 1091 | - } | |
| 1092 | - if (languages.contains("sh")) { | |
| 1093 | - try { | |
| 1094 | - String path = String.format("%ssh.mp3", linePath); | |
| 1095 | - IFlyUtils.textToSpeechSh(cnBuilder.toString(), path); | |
| 1096 | - AudioOperationUtils.splitBySilence(path, String.format("%ssh", linePath), 500, -40); | |
| 1097 | - } catch (Exception e) { | |
| 1098 | - throw new RuntimeException(e); | |
| 1099 | - } | |
| 1100 | - } | |
| 1101 | - if (languages.contains("en")) { | |
| 1107 | + // 先清理历史生成的文件 | |
| 1108 | + cleanHistoryAudio(new File(linePath)); | |
| 1109 | + for (String language : languages) { | |
| 1102 | 1110 | try { |
| 1103 | - String path = String.format("%sen.mp3", linePath); | |
| 1104 | - IFlyUtils.textToSpeechEn(enBuilder.toString(), path); | |
| 1105 | - AudioOperationUtils.splitBySilence(path, String.format("%sen", linePath), 500, -40); | |
| 1111 | + String path = String.format("%s%s.mp3", linePath, language); | |
| 1112 | + if ("cn".equals(language) || "sh".equals(language)) { | |
| 1113 | + IFlyUtils.textToSpeech(cnBuilder.toString(), language, path); | |
| 1114 | + } else if ("en".equals(language)) { | |
| 1115 | + IFlyUtils.textToSpeech(enBuilder.toString(), language, path); | |
| 1116 | + } | |
| 1117 | + AudioOperationUtils.splitBySilence(path, String.format("%s%s", linePath, language), 500, -40); | |
| 1106 | 1118 | } catch (Exception e) { |
| 1107 | 1119 | throw new RuntimeException(e); |
| 1108 | 1120 | } |
| 1109 | 1121 | } |
| 1110 | - // 删除原线路音频 | |
| 1111 | - File file = new File(linePath); | |
| 1112 | - for (File f : file.listFiles()) { | |
| 1113 | - if (f.isFile() && f.getName().endsWith(".mp3")) { | |
| 1114 | - file.delete(); | |
| 1122 | + | |
| 1123 | + // 合并每站起步、到达语音(全程) | |
| 1124 | + int seq = 1; | |
| 1125 | + List<SeqStationLevel> seqs = new ArrayList<>(); | |
| 1126 | + for (int i = seq;i <= ups;i++) { | |
| 1127 | + seqs.add(new SeqStationLevel(i, i)); | |
| 1128 | + } | |
| 1129 | + seq = merge(lineId, "0", seq, seqs, languages); | |
| 1130 | + if (line.getLinePlayType() != 1) { | |
| 1131 | + seqs.clear(); | |
| 1132 | + for (int i = seq;i <= ups + downs;i++) { | |
| 1133 | + seqs.add(new SeqStationLevel(i, i, 1)); | |
| 1134 | + } | |
| 1135 | + merge(lineId, "0", seq, seqs, languages); | |
| 1136 | + } | |
| 1137 | + zipAudio(String.format("%s%s/", linePath, "0"), voicePath); | |
| 1138 | + | |
| 1139 | + // 线路区间 | |
| 1140 | + Map<String, List<SeqStationLevel>> region2map = new HashMap<>(); | |
| 1141 | + for (LineRegion lineRegion : lineRegions) { | |
| 1142 | + for (int i = 0;i < objects.size();i++) { | |
| 1143 | + Object[] objArr = objects.get(i); | |
| 1144 | + String stationCode = (String) objArr[5]; | |
| 1145 | + int direction = (int) objArr[8]; | |
| 1146 | + if (lineRegion.getDirection() == direction) { | |
| 1147 | + for (int j = 0;j < lineRegion.getStationRoutes().size();j++) { | |
| 1148 | + LsStationRoute stationRoute = lineRegion.getStationRoutes().get(j); | |
| 1149 | + if (stationCode.equals(stationRoute.getStationCode())) { | |
| 1150 | + List<SeqStationLevel> map = region2map.get(lineRegion.getSeq().toString()); | |
| 1151 | + if (map == null) { | |
| 1152 | + map = new ArrayList<>(); | |
| 1153 | + region2map.put(lineRegion.getSeq().toString(), map); | |
| 1154 | + } | |
| 1155 | + map.add(new SeqStationLevel(j + 1, i + 1, direction)); | |
| 1156 | + break; | |
| 1157 | + } | |
| 1158 | + } | |
| 1159 | + } | |
| 1115 | 1160 | } |
| 1116 | 1161 | } |
| 1162 | + for (Map.Entry<String, List<SeqStationLevel>> entry : region2map.entrySet()) { | |
| 1163 | + String subLineId = entry.getKey(); | |
| 1164 | + List<SeqStationLevel> map = entry.getValue(); | |
| 1165 | + seq = 1; | |
| 1166 | + merge(lineId, subLineId, seq, map, languages); | |
| 1167 | + zipAudio(String.format("%s%s/", linePath, subLineId), String.format("%s%s-%s.zip", linePath, lineId, subLineId)); | |
| 1168 | + } | |
| 1169 | + } | |
| 1117 | 1170 | |
| 1118 | - // 合并每站起步、到达语音 | |
| 1119 | - int seq = 1, startSeq = 1, direction = 0; | |
| 1120 | - seq = merge(lineId, seq, startSeq, direction, ups, languages); | |
| 1121 | - startSeq = ups + 1; | |
| 1122 | - direction = 1; | |
| 1123 | - merge(lineId, seq, startSeq, direction, ups + downs, languages); | |
| 1171 | + private void cleanHistoryAudio(File file) throws Exception { | |
| 1172 | + if (file.isDirectory()) { | |
| 1173 | + File[] files = file.listFiles(); | |
| 1174 | + for (File f : files) { | |
| 1175 | + cleanHistoryAudio(f); | |
| 1176 | + } | |
| 1177 | + } else { | |
| 1178 | + if (file.getName().endsWith(".mp3") || file.getName().endsWith(".zip")) { | |
| 1179 | + file.delete(); | |
| 1180 | + } | |
| 1181 | + } | |
| 1182 | + } | |
| 1124 | 1183 | |
| 1125 | - // 压缩音频到zip | |
| 1184 | + /** | |
| 1185 | + * 压缩音频到zip | |
| 1186 | + * @param subLinePath 子线路文件夹 | |
| 1187 | + * @param voicePath 语音报站文件压缩包路径 | |
| 1188 | + */ | |
| 1189 | + private void zipAudio(String subLinePath, String voicePath) throws Exception { | |
| 1190 | + File file = new File(subLinePath); | |
| 1126 | 1191 | ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(voicePath)); |
| 1127 | 1192 | for (File f : file.listFiles()) { |
| 1128 | 1193 | if (f.isFile() && f.getName().endsWith(".mp3")) { |
| ... | ... | @@ -1138,8 +1203,6 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1138 | 1203 | } |
| 1139 | 1204 | zos.flush(); |
| 1140 | 1205 | zos.close(); |
| 1141 | - | |
| 1142 | - return new FileInputStream(voicePath); | |
| 1143 | 1206 | } |
| 1144 | 1207 | |
| 1145 | 1208 | private static void addFileToZip(ZipOutputStream zos, File file) throws IOException { |
| ... | ... | @@ -1157,21 +1220,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1157 | 1220 | fis.close(); |
| 1158 | 1221 | } |
| 1159 | 1222 | |
| 1160 | - private int merge(String lineId, int seq, int startSeq, int direction, int terminal, Set<String> languages) throws Exception { | |
| 1161 | - for (int i = startSeq;i <= terminal;i++) { | |
| 1162 | - if (i > startSeq) { | |
| 1163 | - if (i == startSeq + 1) { | |
| 1223 | + /** | |
| 1224 | + * | |
| 1225 | + * @param lineId 线路编码 | |
| 1226 | + * @param seq 线路站级序号(全局) | |
| 1227 | + * @param seqs 当前方向站级序号 | |
| 1228 | + * @param languages 语种 | |
| 1229 | + * @return | |
| 1230 | + * @throws Exception | |
| 1231 | + */ | |
| 1232 | + private int merge(String lineId, String subLineId, int seq, List<SeqStationLevel> seqs, Set<String> languages) throws Exception { | |
| 1233 | + SeqStationLevel startSeq = seqs.get(0), terminal = seqs.get(seqs.size() - 1); | |
| 1234 | + for (int i = 0;i < seqs.size();i++) { | |
| 1235 | + SeqStationLevel current = seqs.get(i); | |
| 1236 | + if (current.getStationLevel() > startSeq.getStationLevel()) { | |
| 1237 | + if (i == 1) { | |
| 1164 | 1238 | // 生成首站 |
| 1165 | - mergeOriginStart(lineId, seq, i, direction, terminal, languages); | |
| 1166 | - mergeNormalArrive(lineId, seq, i, direction, terminal, languages); | |
| 1167 | - } else if (i == terminal) { | |
| 1239 | + mergeOriginStart(lineId, subLineId, seq, current, current.getDirection(), terminal, languages); | |
| 1240 | + mergeNormalArrive(lineId, subLineId, seq, current, current.getDirection(), terminal, languages); | |
| 1241 | + } else if (current.getStationLevel() == terminal.getStationLevel()) { | |
| 1168 | 1242 | // 生成终点站 |
| 1169 | - mergeNormalStart(lineId, seq, i, direction, terminal, languages); | |
| 1170 | - mergeTerminalArrive(lineId, seq, i, direction, terminal, languages); | |
| 1243 | + mergeNormalStart(lineId, subLineId, seq, current, current.getDirection(), terminal, languages); | |
| 1244 | + mergeTerminalArrive(lineId, subLineId, seq, current, current.getDirection(), terminal, languages); | |
| 1171 | 1245 | } else { |
| 1172 | 1246 | // 生成中途站 |
| 1173 | - mergeNormalStart(lineId, seq, i, direction, terminal, languages); | |
| 1174 | - mergeNormalArrive(lineId, seq, i, direction, terminal, languages); | |
| 1247 | + mergeNormalStart(lineId, subLineId, seq, current, current.getDirection(), terminal, languages); | |
| 1248 | + mergeNormalArrive(lineId, subLineId, seq, current, current.getDirection(), terminal, languages); | |
| 1175 | 1249 | } |
| 1176 | 1250 | seq++; |
| 1177 | 1251 | } |
| ... | ... | @@ -1180,9 +1254,11 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1180 | 1254 | return seq; |
| 1181 | 1255 | } |
| 1182 | 1256 | |
| 1183 | - private void mergeOriginStart(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | |
| 1257 | + private void mergeOriginStart(String lineId, String subLineId, int seq, SeqStationLevel current, int direction, SeqStationLevel terminal, Set<String> languages) throws Exception { | |
| 1258 | + // 子线路路径 | |
| 1184 | 1259 | String linePath = String.format(linePathPattern, lineId); |
| 1185 | - List<String> arr = Arrays.asList(commonPath + "cn_origin_1.mp3", linePath + String.format("cn/%03d.mp3", 0), commonPath + "cn_origin_2.mp3", linePath + String.format("cn/%03d.mp3", terminal), commonPath + "sh_origin_1.mp3", linePath + String.format("sh/%03d.mp3", 0), commonPath + "sh_origin_2.mp3", linePath + String.format("cn/%03d.mp3", terminal), commonPath + "cn_start_1.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_start_2.mp3", commonPath + "sh_start_1.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_start_2.mp3", commonPath + "en_1.mp3", linePath + String.format("en/%03d.mp3", stationLevel), commonPath + "cn_start_3.mp3", commonPath + "sh_start_3.mp3"); | |
| 1260 | + String subLinePath = String.format("%s%s/", linePath, subLineId); | |
| 1261 | + List<String> arr = Arrays.asList(commonPath + "cn_origin_1.mp3", linePath + String.format("cn/%03d.mp3", 0), commonPath + "cn_origin_2.mp3", linePath + String.format("cn/%03d.mp3", terminal.getStationLevel()), commonPath + "sh_origin_1.mp3", linePath + String.format("sh/%03d.mp3", 0), commonPath + "sh_origin_2.mp3", linePath + String.format("cn/%03d.mp3", terminal.getStationLevel()), commonPath + "cn_start_1.mp3", linePath + String.format("cn/%03d.mp3", current.getStationLevel()), commonPath + "cn_start_2.mp3", commonPath + "sh_start_1.mp3", linePath + String.format("sh/%03d.mp3", current.getStationLevel()), commonPath + "sh_start_2.mp3", commonPath + "en_1.mp3", linePath + String.format("en/%03d.mp3", current.getStationLevel()), commonPath + "cn_start_3.mp3", commonPath + "sh_start_3.mp3"); | |
| 1186 | 1262 | List<String> inputPaths = new ArrayList<>(); |
| 1187 | 1263 | for (String path : arr) { |
| 1188 | 1264 | for (String lang : languages) { |
| ... | ... | @@ -1192,12 +1268,13 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1192 | 1268 | } |
| 1193 | 1269 | } |
| 1194 | 1270 | } |
| 1195 | - AudioOperationUtils.merge(inputPaths, String.format("%s%03da%s-%03d-%s-Start.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | |
| 1271 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03da%s-%03d-%s-Start.mp3", subLinePath, seq, direction == 0 ? "u" : "d", direction == 0 ? current.getSeq() : terminal.getSeq() - current.getSeq() + 1, direction == 0 ? "Up" : "Dn")); | |
| 1196 | 1272 | } |
| 1197 | 1273 | |
| 1198 | - private void mergeNormalStart(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | |
| 1274 | + private void mergeNormalStart(String lineId, String subLineId, int seq, SeqStationLevel current, int direction, SeqStationLevel terminal, Set<String> languages) throws Exception { | |
| 1199 | 1275 | String linePath = String.format(linePathPattern, lineId); |
| 1200 | - List<String> arr = Arrays.asList(commonPath + "cn_start.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_start_2.mp3", commonPath + "sh_start_1.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_start_2.mp3", commonPath + "en_1.mp3", linePath + String.format("en/%03d.mp3", stationLevel), commonPath + "cn_start_3.mp3", commonPath + "sh_start_3.mp3"); | |
| 1276 | + String subLinePath = String.format("%s%s/", linePath, subLineId); | |
| 1277 | + List<String> arr = Arrays.asList(commonPath + "cn_start.mp3", linePath + String.format("cn/%03d.mp3", current.getStationLevel()), commonPath + "cn_start_2.mp3", commonPath + "sh_start_1.mp3", linePath + String.format("sh/%03d.mp3", current.getStationLevel()), commonPath + "sh_start_2.mp3", commonPath + "en_1.mp3", linePath + String.format("en/%03d.mp3", current.getStationLevel()), commonPath + "cn_start_3.mp3", commonPath + "sh_start_3.mp3"); | |
| 1201 | 1278 | List<String> inputPaths = new ArrayList<>(); |
| 1202 | 1279 | for (String path : arr) { |
| 1203 | 1280 | for (String lang : languages) { |
| ... | ... | @@ -1207,26 +1284,27 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1207 | 1284 | } |
| 1208 | 1285 | } |
| 1209 | 1286 | } |
| 1210 | - AudioOperationUtils.merge(inputPaths, String.format("%s%03da%s-%03d-%s-Start.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | |
| 1287 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03da%s-%03d-%s-Start.mp3", subLinePath, seq, direction == 0 ? "u" : "d", direction == 0 ? current.getSeq() : terminal.getSeq() - current.getSeq() + 1, direction == 0 ? "Up" : "Dn")); | |
| 1211 | 1288 | } |
| 1212 | 1289 | |
| 1213 | - private void mergeNormalArrive(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | |
| 1290 | + private void mergeNormalArrive(String lineId, String subLineId, int seq, SeqStationLevel current, int direction, SeqStationLevel terminal, Set<String> languages) throws Exception { | |
| 1214 | 1291 | String linePath = String.format(linePathPattern, lineId); |
| 1215 | - List<String> arr = new ArrayList<>(Arrays.asList(commonPath + "cn_arrive.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_arrive_1.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_arrive_1.mp3", commonPath + "en_2.mp3", linePath + String.format("en/%03d.mp3", stationLevel))); | |
| 1292 | + String subLinePath = String.format("%s%s/", linePath, subLineId); | |
| 1293 | + List<String> arr = new ArrayList<>(Arrays.asList(commonPath + "cn_arrive.mp3", linePath + String.format("cn/%03d.mp3", current.getStationLevel()), commonPath + "cn_arrive_1.mp3", linePath + String.format("sh/%03d.mp3", current.getStationLevel()), commonPath + "sh_arrive_1.mp3", commonPath + "en_2.mp3", linePath + String.format("en/%03d.mp3", current.getStationLevel()))); | |
| 1216 | 1294 | List<String> inputPaths = new ArrayList<>(); |
| 1217 | 1295 | if (languages.contains("sh")) { |
| 1218 | 1296 | for (int i = 0;i < 3;i++) { |
| 1219 | 1297 | arr.add(linePath + String.format("cn/%03d.mp3", 0)); |
| 1220 | 1298 | arr.add(commonPath + "cn_origin_2.mp3"); |
| 1221 | - arr.add(linePath + String.format("cn/%03d.mp3", terminal)); | |
| 1299 | + arr.add(linePath + String.format("cn/%03d.mp3", terminal.getStationLevel())); | |
| 1222 | 1300 | arr.add(linePath + String.format("sh/%03d.mp3", 0)); |
| 1223 | 1301 | arr.add(commonPath + "sh_origin_2.mp3"); |
| 1224 | - arr.add(linePath + String.format("sh/%03d.mp3", terminal)); | |
| 1302 | + arr.add(linePath + String.format("sh/%03d.mp3", terminal.getStationLevel())); | |
| 1225 | 1303 | } |
| 1226 | 1304 | } else { |
| 1227 | 1305 | arr.add(linePath + String.format("cn/%03d.mp3", 0)); |
| 1228 | 1306 | arr.add(commonPath + "cn_origin_2.mp3"); |
| 1229 | - arr.add(linePath + String.format("cn/%03d.mp3", terminal)); | |
| 1307 | + arr.add(linePath + String.format("cn/%03d.mp3", terminal.getStationLevel())); | |
| 1230 | 1308 | } |
| 1231 | 1309 | for (String path : arr) { |
| 1232 | 1310 | for (String lang : languages) { |
| ... | ... | @@ -1236,12 +1314,13 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1236 | 1314 | } |
| 1237 | 1315 | } |
| 1238 | 1316 | } |
| 1239 | - AudioOperationUtils.merge(inputPaths, String.format("%s%03db%s-%03d-%s-Arrive.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | |
| 1317 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03db%s-%03d-%s-Arrive.mp3", subLinePath, seq, direction == 0 ? "u" : "d", direction == 0 ? current.getSeq() : terminal.getSeq() - current.getSeq() + 1, direction == 0 ? "Up" : "Dn")); | |
| 1240 | 1318 | } |
| 1241 | 1319 | |
| 1242 | - private void mergeTerminalArrive(String lineId, int seq, int stationLevel, int direction, int terminal, Set<String> languages) throws Exception { | |
| 1320 | + private void mergeTerminalArrive(String lineId, String subLineId, int seq, SeqStationLevel current, int direction, SeqStationLevel terminal, Set<String> languages) throws Exception { | |
| 1243 | 1321 | String linePath = String.format(linePathPattern, lineId); |
| 1244 | - List<String> arr = Arrays.asList(commonPath + "cn_terminal.mp3", linePath + String.format("cn/%03d.mp3", stationLevel), commonPath + "cn_arrive_1.mp3", commonPath + "sh_terminal.mp3", linePath + String.format("sh/%03d.mp3", stationLevel), commonPath + "sh_arrive_1.mp3", commonPath + "en_3.mp3", linePath + String.format("en/%03d.mp3", stationLevel), commonPath + "terminal_music.mp3"); | |
| 1322 | + String subLinePath = String.format("%s%s/", linePath, subLineId); | |
| 1323 | + List<String> arr = Arrays.asList(commonPath + "cn_terminal.mp3", linePath + String.format("cn/%03d.mp3", current.getStationLevel()), commonPath + "cn_arrive_1.mp3", commonPath + "sh_terminal.mp3", linePath + String.format("sh/%03d.mp3", current.getStationLevel()), commonPath + "sh_arrive_1.mp3", commonPath + "en_3.mp3", linePath + String.format("en/%03d.mp3", current.getStationLevel()), commonPath + "terminal_music.mp3"); | |
| 1245 | 1324 | List<String> inputPaths = new ArrayList<>(); |
| 1246 | 1325 | for (String path : arr) { |
| 1247 | 1326 | for (String lang : languages) { |
| ... | ... | @@ -1251,7 +1330,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1251 | 1330 | } |
| 1252 | 1331 | } |
| 1253 | 1332 | } |
| 1254 | - AudioOperationUtils.merge(inputPaths, String.format("%s%03db%s-%03d-%s-Arrive.mp3", linePath, seq, direction == 0 ? "u" : "d", direction == 0 ? stationLevel : terminal - stationLevel + 1, direction == 0 ? "Up" : "Dn")); | |
| 1333 | + AudioOperationUtils.merge(inputPaths, String.format("%s%03db%s-%03d-%s-Arrive.mp3", subLinePath, seq, direction == 0 ? "u" : "d", direction == 0 ? current.getSeq() : terminal.getSeq() - current.getSeq() + 1, direction == 0 ? "Up" : "Dn")); | |
| 1255 | 1334 | } |
| 1256 | 1335 | |
| 1257 | 1336 | private void description() { |
| ... | ... | @@ -1276,4 +1355,50 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 1276 | 1355 | // 终点站(沪) (sh_terminal.mp3) |
| 1277 | 1356 | // 终点音乐 (terminal_music.mp3) |
| 1278 | 1357 | } |
| 1358 | + | |
| 1359 | + /** | |
| 1360 | + * 站序和站级的影响,全程和区间时会不一致 | |
| 1361 | + */ | |
| 1362 | + private final static class SeqStationLevel { | |
| 1363 | + | |
| 1364 | + private Integer seq; | |
| 1365 | + | |
| 1366 | + private Integer stationLevel; | |
| 1367 | + | |
| 1368 | + private int direction; | |
| 1369 | + | |
| 1370 | + private SeqStationLevel(Integer seq, Integer stationLevel) { | |
| 1371 | + this(seq, stationLevel, 0); | |
| 1372 | + } | |
| 1373 | + | |
| 1374 | + private SeqStationLevel(Integer seq, Integer stationLevel, int direction) { | |
| 1375 | + this.seq = seq; | |
| 1376 | + this.stationLevel = stationLevel; | |
| 1377 | + this.direction = direction; | |
| 1378 | + } | |
| 1379 | + | |
| 1380 | + public Integer getSeq() { | |
| 1381 | + return seq; | |
| 1382 | + } | |
| 1383 | + | |
| 1384 | + public void setSeq(Integer seq) { | |
| 1385 | + this.seq = seq; | |
| 1386 | + } | |
| 1387 | + | |
| 1388 | + public Integer getStationLevel() { | |
| 1389 | + return stationLevel; | |
| 1390 | + } | |
| 1391 | + | |
| 1392 | + public void setStationLevel(Integer stationLevel) { | |
| 1393 | + this.stationLevel = stationLevel; | |
| 1394 | + } | |
| 1395 | + | |
| 1396 | + public int getDirection() { | |
| 1397 | + return direction; | |
| 1398 | + } | |
| 1399 | + | |
| 1400 | + public void setDirection(int direction) { | |
| 1401 | + this.direction = direction; | |
| 1402 | + } | |
| 1403 | + } | |
| 1279 | 1404 | } | ... | ... |
src/main/java/com/bsth/util/FTPClientUtils.java
| 1 | -package com.bsth.util; | |
| 2 | - | |
| 3 | -import java.io.ByteArrayInputStream; | |
| 4 | -import java.io.File; | |
| 5 | -import java.io.FileInputStream; | |
| 6 | -import java.io.FileNotFoundException; | |
| 7 | -import java.io.FileOutputStream; | |
| 8 | -import java.io.IOException; | |
| 9 | -import java.io.InputStream; | |
| 10 | -import java.io.OutputStream; | |
| 11 | -import java.io.UnsupportedEncodingException; | |
| 12 | - | |
| 13 | -import org.apache.commons.net.ftp.FTPClient; | |
| 14 | -import org.apache.commons.net.ftp.FTPFile; | |
| 15 | -import org.apache.commons.net.ftp.FTPReply; | |
| 16 | -/** | |
| 17 | - * @Description: 向FTP服务器上传文件 | |
| 18 | - * | |
| 19 | - * @Version 1.0 2016-06-21 4:31:09 by 李强 | |
| 20 | - * | |
| 21 | - */ | |
| 22 | -public class FTPClientUtils { | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * @param url FTP服务器hostname; | |
| 26 | - * | |
| 27 | - * - - - - port FTP服务器端口; | |
| 28 | - * | |
| 29 | - * - - - - username FTP登录账号; | |
| 30 | - * | |
| 31 | - * - - - - password FTP登录密码 ; | |
| 32 | - * | |
| 33 | - * - - - - path FTP服务器保存目录; | |
| 34 | - * | |
| 35 | - * - - - - filename 上传到FTP服务器上的文件名 | |
| 36 | - * | |
| 37 | - * - - - - input 输入流; | |
| 38 | - * | |
| 39 | - * @return 成功返回true,否则返回false | |
| 40 | - * | |
| 41 | - */ | |
| 42 | - public boolean uploadFile(String url,int port,String username, String password, String path, String filename, InputStream input) { | |
| 43 | - | |
| 44 | - boolean success = false; | |
| 45 | - | |
| 46 | - FTPClient ftp = new FTPClient(); | |
| 47 | - | |
| 48 | - try { | |
| 49 | - | |
| 50 | - int reply; | |
| 51 | - | |
| 52 | - //连接FTP服务器,如果采用默认端口,可以使用ftp.connect(url)的方式直接连接FTP服务器 | |
| 53 | - ftp.connect(url, port); | |
| 54 | - | |
| 55 | - //登录 | |
| 56 | - ftp.login(username, password); | |
| 57 | - | |
| 58 | - reply = ftp.getReplyCode(); | |
| 59 | - | |
| 60 | - if (!FTPReply.isPositiveCompletion(reply)) { | |
| 61 | - | |
| 62 | - ftp.disconnect(); | |
| 63 | - | |
| 64 | - return success; | |
| 65 | - | |
| 66 | - } | |
| 67 | - | |
| 68 | - ftp.changeWorkingDirectory(path); | |
| 69 | - ftp.setFileType(FTPClient.BINARY_FILE_TYPE); | |
| 70 | - ftp.enterLocalPassiveMode(); | |
| 71 | - success = ftp.storeFile(new String(filename.getBytes("gbk"),"gbk"), input); | |
| 72 | - /*success = ftp.storeFile(filename, input); */ | |
| 73 | - input.close(); | |
| 74 | - | |
| 75 | - ftp.logout(); | |
| 76 | - | |
| 77 | - // success = true; | |
| 78 | - | |
| 79 | - } catch (IOException e) { | |
| 80 | - | |
| 81 | - e.printStackTrace(); | |
| 82 | - | |
| 83 | - } finally { | |
| 84 | - | |
| 85 | - if (ftp.isConnected()) { | |
| 86 | - | |
| 87 | - try { | |
| 88 | - | |
| 89 | - ftp.disconnect(); | |
| 90 | - | |
| 91 | - } catch (IOException ioe) { | |
| 92 | - | |
| 93 | - } | |
| 94 | - | |
| 95 | - } | |
| 96 | - | |
| 97 | - } | |
| 98 | - | |
| 99 | - return success; | |
| 100 | - } | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * @Description : TOOD(将本地文件上传到FTP服务器上) | |
| 104 | - * | |
| 105 | - * @param file | |
| 106 | - * | |
| 107 | - * @param name | |
| 108 | - * | |
| 109 | - * @param url | |
| 110 | - * | |
| 111 | - * @param port | |
| 112 | - * | |
| 113 | - * @param username | |
| 114 | - * | |
| 115 | - * @param password | |
| 116 | - * | |
| 117 | - * @param remotePath | |
| 118 | - * | |
| 119 | - */ | |
| 120 | - public void FTPUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){ | |
| 121 | - | |
| 122 | - try { | |
| 123 | - FileInputStream in=new FileInputStream(file); | |
| 124 | - | |
| 125 | - boolean flag = uploadFile(url, port,username, password, remotePath, name, in); | |
| 126 | - | |
| 127 | - /* boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", name, in);*/ | |
| 128 | - | |
| 129 | - /* boolean flag = uploadFile("222.66.0.205", 21, "transport", "transport123", "ftptest/", name, in);*/ | |
| 130 | - | |
| 131 | - } catch (FileNotFoundException e) { | |
| 132 | - | |
| 133 | - e.printStackTrace(); | |
| 134 | - | |
| 135 | - } | |
| 136 | - | |
| 137 | - } | |
| 138 | - | |
| 139 | - // 在FTP服务器上生成一个文件,并将一个字符串写入到该文件中 | |
| 140 | - public void testUpLoadFromString(){ | |
| 141 | - | |
| 142 | - try { | |
| 143 | - | |
| 144 | - String str = "test ftp "+ "\r\n"+ "ccccc dddd"; | |
| 145 | - | |
| 146 | - InputStream input = new ByteArrayInputStream(str.getBytes("utf-8")); | |
| 147 | - | |
| 148 | - uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "test.txt", input); | |
| 149 | - | |
| 150 | - } catch (UnsupportedEncodingException e) { | |
| 151 | - | |
| 152 | - e.printStackTrace(); | |
| 153 | - | |
| 154 | - } | |
| 155 | - | |
| 156 | - } | |
| 157 | - | |
| 158 | - /** | |
| 159 | - * @Description (删除FTP上的文件) | |
| 160 | - * | |
| 161 | - * @param url FTP服务器IP地址 | |
| 162 | - * | |
| 163 | - * @param port FTP服务器端口 | |
| 164 | - * | |
| 165 | - * @param username FTP服务器登录名 | |
| 166 | - * | |
| 167 | - * @param password FTP服务器密码 | |
| 168 | - * | |
| 169 | - * @param remotePath 远程文件路径 | |
| 170 | - * | |
| 171 | - * @param fileName 待删除的文件名 | |
| 172 | - * | |
| 173 | - * @return boolean | |
| 174 | - */ | |
| 175 | - public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | |
| 176 | - | |
| 177 | - boolean success = false; | |
| 178 | - | |
| 179 | - FTPClient ftp = new FTPClient(); | |
| 180 | - | |
| 181 | - try { | |
| 182 | - | |
| 183 | - int reply; | |
| 184 | - | |
| 185 | - // 连接FTP服务器 | |
| 186 | - if (port > -1) | |
| 187 | - | |
| 188 | - ftp.connect(url, port); | |
| 189 | - | |
| 190 | - else | |
| 191 | - | |
| 192 | - ftp.connect(url); | |
| 193 | - | |
| 194 | - // 登录 | |
| 195 | - ftp.login(username, password); | |
| 196 | - | |
| 197 | - reply = ftp.getReplyCode(); | |
| 198 | - | |
| 199 | - if (!FTPReply.isPositiveCompletion(reply)) { | |
| 200 | - | |
| 201 | - ftp.disconnect(); | |
| 202 | - | |
| 203 | - return success; | |
| 204 | - } | |
| 205 | - | |
| 206 | - // 转移到FTP服务器目录 | |
| 207 | - | |
| 208 | - ftp.changeWorkingDirectory(remotePath); | |
| 209 | - | |
| 210 | - /*success = ftp.deleteFile(fileName);*/ | |
| 211 | - | |
| 212 | - success = ftp.deleteFile(new String(fileName.getBytes("gbk"),"gbk")); | |
| 213 | - | |
| 214 | - ftp.logout(); | |
| 215 | - | |
| 216 | - } catch (IOException e){ | |
| 217 | - | |
| 218 | - e.printStackTrace(); | |
| 219 | - | |
| 220 | - success = false; | |
| 221 | - | |
| 222 | - } finally { | |
| 223 | - | |
| 224 | - if (ftp.isConnected()) { | |
| 225 | - | |
| 226 | - try { | |
| 227 | - | |
| 228 | - ftp.disconnect(); | |
| 229 | - | |
| 230 | - } catch (IOException e) { | |
| 231 | - | |
| 232 | - e.printStackTrace(); | |
| 233 | - | |
| 234 | - } | |
| 235 | - } | |
| 236 | - } | |
| 237 | - | |
| 238 | - return success; | |
| 239 | - } | |
| 240 | - | |
| 241 | - public static File GetFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | |
| 242 | - | |
| 243 | - FTPClient ftp = new FTPClient(); | |
| 244 | - | |
| 245 | - /*File destFile = new File(fileName); */ | |
| 246 | - | |
| 247 | - File destFile = new File(fileName); | |
| 248 | - | |
| 249 | - InputStream in = null; | |
| 250 | - | |
| 251 | - OutputStream out = null; | |
| 252 | - | |
| 253 | - try { | |
| 254 | - | |
| 255 | - int reply; | |
| 256 | - | |
| 257 | - // 连接FTP服务器 | |
| 258 | - if (port > -1) | |
| 259 | - | |
| 260 | - ftp.connect(url, port); | |
| 261 | - | |
| 262 | - else | |
| 263 | - | |
| 264 | - ftp.connect(url); | |
| 265 | - | |
| 266 | - // 登录 | |
| 267 | - ftp.login(username, password); | |
| 268 | - | |
| 269 | - reply = ftp.getReplyCode(); | |
| 270 | - | |
| 271 | - if (!FTPReply.isPositiveCompletion(reply)) { | |
| 272 | - | |
| 273 | - ftp.disconnect(); | |
| 274 | - | |
| 275 | - } | |
| 276 | - | |
| 277 | - // 转移到FTP服务器目录 | |
| 278 | - | |
| 279 | - ftp.changeWorkingDirectory(remotePath); | |
| 280 | - | |
| 281 | - ftp.enterLocalPassiveMode(); | |
| 282 | - | |
| 283 | - FTPFile[] fs = ftp.listFiles(); | |
| 284 | - | |
| 285 | - System.out.println(fs.length); | |
| 286 | - | |
| 287 | - /* for (FTPFile ff : fs) { | |
| 288 | - //解决中文乱码问题,两次解码 | |
| 289 | - byte[] bytes=ff.getName().getBytes("gbk"); | |
| 290 | - String fn=new String(bytes,"gbk"); | |
| 291 | - if (fn.equals(fileName)) { | |
| 292 | - //6.写操作,将其写入到本地文件中 | |
| 293 | - File localFile = new File(ff.getName()); | |
| 294 | - | |
| 295 | - | |
| 296 | - OutputStream is = new FileOutputStream(localFile); | |
| 297 | - ftp.retrieveFile(ff.getName(), is); | |
| 298 | - is.close(); | |
| 299 | - } | |
| 300 | - } */ | |
| 301 | - | |
| 302 | - /* File srcFile = new File(fileName); */ | |
| 303 | - | |
| 304 | - /* File srcFile = new File(new String(fileName.getBytes("gbk"),"gbk"));*/ | |
| 305 | - | |
| 306 | - int byteread = 0; // 读取的字节数 | |
| 307 | - | |
| 308 | - /* in = ftp.retrieveFileStream(remotePath + fileName);*/ | |
| 309 | - | |
| 310 | - in = ftp.retrieveFileStream(new String(fileName.getBytes("gbk"),"gbk")); | |
| 311 | - | |
| 312 | - | |
| 313 | - out = new FileOutputStream(destFile); | |
| 314 | - | |
| 315 | - byte[] buffer = new byte[1024]; | |
| 316 | - | |
| 317 | - while ((byteread = in.read(buffer)) != -1) { | |
| 318 | - | |
| 319 | - out.write(buffer, 0, byteread); | |
| 320 | - | |
| 321 | - } | |
| 322 | - | |
| 323 | - out.flush(); | |
| 324 | - ftp.logout(); | |
| 325 | - | |
| 326 | - } catch (IOException e){ | |
| 327 | - | |
| 328 | - e.printStackTrace(); | |
| 329 | - | |
| 330 | - } finally { | |
| 331 | - | |
| 332 | - try { | |
| 333 | - | |
| 334 | - if (out != null) | |
| 335 | - | |
| 336 | - out.close(); | |
| 337 | - | |
| 338 | - if (in != null) | |
| 339 | - | |
| 340 | - in.close(); | |
| 341 | - | |
| 342 | - } catch (IOException e) { | |
| 343 | - | |
| 344 | - e.printStackTrace(); | |
| 345 | - | |
| 346 | - } | |
| 347 | - | |
| 348 | - if (ftp.isConnected()) { | |
| 349 | - | |
| 350 | - try { | |
| 351 | - | |
| 352 | - ftp.disconnect(); | |
| 353 | - | |
| 354 | - } catch (IOException e) { | |
| 355 | - | |
| 356 | - e.printStackTrace(); | |
| 357 | - | |
| 358 | - } | |
| 359 | - } | |
| 360 | - } | |
| 361 | - | |
| 362 | - return destFile; | |
| 363 | - } | |
| 364 | - | |
| 365 | - | |
| 366 | - public static void main(String[] args) { | |
| 367 | - | |
| 368 | - FTPClientUtils clientUtils = new FTPClientUtils(); | |
| 369 | - | |
| 370 | - Test test= new Test(); | |
| 371 | - | |
| 372 | - File[] sources = new File[] {new File("E:/20079.txt")}; | |
| 373 | - | |
| 374 | - File target = new File("release_package.tar.gz"); | |
| 375 | - | |
| 376 | - File targetFile = test.pack(sources, target); | |
| 377 | - | |
| 378 | - /* clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | |
| 379 | - | |
| 380 | - | |
| 381 | - /** 删除文件 */ | |
| 382 | - /*boolean a =clientUtils.deleteFtpFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "release_package.tar.gz");*/ | |
| 383 | - | |
| 384 | - } | |
| 385 | -} | |
| 1 | +package com.bsth.util; | |
| 2 | + | |
| 3 | +import java.io.ByteArrayInputStream; | |
| 4 | +import java.io.File; | |
| 5 | +import java.io.FileInputStream; | |
| 6 | +import java.io.FileNotFoundException; | |
| 7 | +import java.io.FileOutputStream; | |
| 8 | +import java.io.IOException; | |
| 9 | +import java.io.InputStream; | |
| 10 | +import java.io.OutputStream; | |
| 11 | +import java.io.UnsupportedEncodingException; | |
| 12 | + | |
| 13 | +import org.apache.commons.net.ftp.FTPClient; | |
| 14 | +import org.apache.commons.net.ftp.FTPFile; | |
| 15 | +import org.apache.commons.net.ftp.FTPReply; | |
| 16 | +/** | |
| 17 | + * @Description: 向FTP服务器上传文件 | |
| 18 | + * | |
| 19 | + * @Version 1.0 2016-06-21 4:31:09 by 李强 | |
| 20 | + * | |
| 21 | + */ | |
| 22 | +public class FTPClientUtils { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * @param url FTP服务器hostname; | |
| 26 | + * | |
| 27 | + * - - - - port FTP服务器端口; | |
| 28 | + * | |
| 29 | + * - - - - username FTP登录账号; | |
| 30 | + * | |
| 31 | + * - - - - password FTP登录密码 ; | |
| 32 | + * | |
| 33 | + * - - - - path FTP服务器保存目录; | |
| 34 | + * | |
| 35 | + * - - - - filename 上传到FTP服务器上的文件名 | |
| 36 | + * | |
| 37 | + * - - - - input 输入流; | |
| 38 | + * | |
| 39 | + * @return 成功返回true,否则返回false | |
| 40 | + * | |
| 41 | + */ | |
| 42 | + public boolean uploadFile(String url,int port,String username, String password, String path, String filename, InputStream input) { | |
| 43 | + | |
| 44 | + boolean success = false; | |
| 45 | + | |
| 46 | + FTPClient ftp = new FTPClient(); | |
| 47 | + | |
| 48 | + try { | |
| 49 | + | |
| 50 | + int reply; | |
| 51 | + | |
| 52 | + //连接FTP服务器,如果采用默认端口,可以使用ftp.connect(url)的方式直接连接FTP服务器 | |
| 53 | + ftp.connect(url, port); | |
| 54 | + | |
| 55 | + //登录 | |
| 56 | + ftp.login(username, password); | |
| 57 | + | |
| 58 | + reply = ftp.getReplyCode(); | |
| 59 | + | |
| 60 | + if (!FTPReply.isPositiveCompletion(reply)) { | |
| 61 | + | |
| 62 | + ftp.disconnect(); | |
| 63 | + | |
| 64 | + return success; | |
| 65 | + | |
| 66 | + } | |
| 67 | + | |
| 68 | + ftp.changeWorkingDirectory(path); | |
| 69 | + ftp.setFileType(FTPClient.BINARY_FILE_TYPE); | |
| 70 | + ftp.enterLocalPassiveMode(); | |
| 71 | + success = ftp.storeFile(new String(filename.getBytes("gbk"),"gbk"), input); | |
| 72 | + /*success = ftp.storeFile(filename, input); */ | |
| 73 | + input.close(); | |
| 74 | + | |
| 75 | + ftp.logout(); | |
| 76 | + | |
| 77 | + // success = true; | |
| 78 | + | |
| 79 | + } catch (IOException e) { | |
| 80 | + | |
| 81 | + e.printStackTrace(); | |
| 82 | + | |
| 83 | + } finally { | |
| 84 | + | |
| 85 | + if (ftp.isConnected()) { | |
| 86 | + | |
| 87 | + try { | |
| 88 | + | |
| 89 | + ftp.disconnect(); | |
| 90 | + | |
| 91 | + } catch (IOException ioe) { | |
| 92 | + | |
| 93 | + } | |
| 94 | + | |
| 95 | + } | |
| 96 | + | |
| 97 | + } | |
| 98 | + | |
| 99 | + return success; | |
| 100 | + } | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * @Description : TOOD(将本地文件上传到FTP服务器上) | |
| 104 | + * | |
| 105 | + * @param file | |
| 106 | + * | |
| 107 | + * @param name | |
| 108 | + * | |
| 109 | + * @param url | |
| 110 | + * | |
| 111 | + * @param port | |
| 112 | + * | |
| 113 | + * @param username | |
| 114 | + * | |
| 115 | + * @param password | |
| 116 | + * | |
| 117 | + * @param remotePath | |
| 118 | + * | |
| 119 | + */ | |
| 120 | + public void FTPUpLoadFromDisk(File file,String name,String url, int port, String username, String password, String remotePath){ | |
| 121 | + | |
| 122 | + try { | |
| 123 | + FileInputStream in=new FileInputStream(file); | |
| 124 | + | |
| 125 | + boolean flag = uploadFile(url, port,username, password, remotePath, name, in); | |
| 126 | + | |
| 127 | + /* boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", name, in);*/ | |
| 128 | + | |
| 129 | + /* boolean flag = uploadFile("222.66.0.205", 21, "transport", "transport123", "ftptest/", name, in);*/ | |
| 130 | + | |
| 131 | + } catch (FileNotFoundException e) { | |
| 132 | + | |
| 133 | + e.printStackTrace(); | |
| 134 | + | |
| 135 | + } | |
| 136 | + | |
| 137 | + } | |
| 138 | + | |
| 139 | + // 在FTP服务器上生成一个文件,并将一个字符串写入到该文件中 | |
| 140 | + public void testUpLoadFromString(){ | |
| 141 | + | |
| 142 | + try { | |
| 143 | + | |
| 144 | + String str = "test ftp "+ "\r\n"+ "ccccc dddd"; | |
| 145 | + | |
| 146 | + InputStream input = new ByteArrayInputStream(str.getBytes("utf-8")); | |
| 147 | + | |
| 148 | + uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "test.txt", input); | |
| 149 | + | |
| 150 | + } catch (UnsupportedEncodingException e) { | |
| 151 | + | |
| 152 | + e.printStackTrace(); | |
| 153 | + | |
| 154 | + } | |
| 155 | + | |
| 156 | + } | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * @Description (删除FTP上的文件) | |
| 160 | + * | |
| 161 | + * @param url FTP服务器IP地址 | |
| 162 | + * | |
| 163 | + * @param port FTP服务器端口 | |
| 164 | + * | |
| 165 | + * @param username FTP服务器登录名 | |
| 166 | + * | |
| 167 | + * @param password FTP服务器密码 | |
| 168 | + * | |
| 169 | + * @param remotePath 远程文件路径 | |
| 170 | + * | |
| 171 | + * @param fileName 待删除的文件名 | |
| 172 | + * | |
| 173 | + * @return boolean | |
| 174 | + */ | |
| 175 | + public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | |
| 176 | + | |
| 177 | + boolean success = false; | |
| 178 | + | |
| 179 | + FTPClient ftp = new FTPClient(); | |
| 180 | + | |
| 181 | + try { | |
| 182 | + | |
| 183 | + int reply; | |
| 184 | + | |
| 185 | + // 连接FTP服务器 | |
| 186 | + if (port > -1) | |
| 187 | + | |
| 188 | + ftp.connect(url, port); | |
| 189 | + | |
| 190 | + else | |
| 191 | + | |
| 192 | + ftp.connect(url); | |
| 193 | + | |
| 194 | + // 登录 | |
| 195 | + ftp.login(username, password); | |
| 196 | + | |
| 197 | + reply = ftp.getReplyCode(); | |
| 198 | + | |
| 199 | + if (!FTPReply.isPositiveCompletion(reply)) { | |
| 200 | + | |
| 201 | + ftp.disconnect(); | |
| 202 | + | |
| 203 | + return success; | |
| 204 | + } | |
| 205 | + | |
| 206 | + // 转移到FTP服务器目录 | |
| 207 | + | |
| 208 | + ftp.changeWorkingDirectory(remotePath); | |
| 209 | + | |
| 210 | + /*success = ftp.deleteFile(fileName);*/ | |
| 211 | + | |
| 212 | + success = ftp.deleteFile(new String(fileName.getBytes("gbk"),"gbk")); | |
| 213 | + | |
| 214 | + ftp.logout(); | |
| 215 | + | |
| 216 | + } catch (IOException e){ | |
| 217 | + | |
| 218 | + e.printStackTrace(); | |
| 219 | + | |
| 220 | + success = false; | |
| 221 | + | |
| 222 | + } finally { | |
| 223 | + | |
| 224 | + if (ftp.isConnected()) { | |
| 225 | + | |
| 226 | + try { | |
| 227 | + | |
| 228 | + ftp.disconnect(); | |
| 229 | + | |
| 230 | + } catch (IOException e) { | |
| 231 | + | |
| 232 | + e.printStackTrace(); | |
| 233 | + | |
| 234 | + } | |
| 235 | + } | |
| 236 | + } | |
| 237 | + | |
| 238 | + return success; | |
| 239 | + } | |
| 240 | + | |
| 241 | + public static File GetFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | |
| 242 | + | |
| 243 | + FTPClient ftp = new FTPClient(); | |
| 244 | + | |
| 245 | + /*File destFile = new File(fileName); */ | |
| 246 | + | |
| 247 | + File destFile = new File(fileName); | |
| 248 | + | |
| 249 | + InputStream in = null; | |
| 250 | + | |
| 251 | + OutputStream out = null; | |
| 252 | + | |
| 253 | + try { | |
| 254 | + | |
| 255 | + int reply; | |
| 256 | + | |
| 257 | + // 连接FTP服务器 | |
| 258 | + if (port > -1) | |
| 259 | + | |
| 260 | + ftp.connect(url, port); | |
| 261 | + | |
| 262 | + else | |
| 263 | + | |
| 264 | + ftp.connect(url); | |
| 265 | + | |
| 266 | + // 登录 | |
| 267 | + ftp.login(username, password); | |
| 268 | + | |
| 269 | + reply = ftp.getReplyCode(); | |
| 270 | + | |
| 271 | + if (!FTPReply.isPositiveCompletion(reply)) { | |
| 272 | + | |
| 273 | + ftp.disconnect(); | |
| 274 | + | |
| 275 | + } | |
| 276 | + | |
| 277 | + // 转移到FTP服务器目录 | |
| 278 | + | |
| 279 | + ftp.changeWorkingDirectory(remotePath); | |
| 280 | + | |
| 281 | + ftp.enterLocalPassiveMode(); | |
| 282 | + | |
| 283 | + FTPFile[] fs = ftp.listFiles(); | |
| 284 | + | |
| 285 | + System.out.println(fs.length); | |
| 286 | + | |
| 287 | + /* for (FTPFile ff : fs) { | |
| 288 | + //解决中文乱码问题,两次解码 | |
| 289 | + byte[] bytes=ff.getName().getBytes("gbk"); | |
| 290 | + String fn=new String(bytes,"gbk"); | |
| 291 | + if (fn.equals(fileName)) { | |
| 292 | + //6.写操作,将其写入到本地文件中 | |
| 293 | + File localFile = new File(ff.getName()); | |
| 294 | + | |
| 295 | + | |
| 296 | + OutputStream is = new FileOutputStream(localFile); | |
| 297 | + ftp.retrieveFile(ff.getName(), is); | |
| 298 | + is.close(); | |
| 299 | + } | |
| 300 | + } */ | |
| 301 | + | |
| 302 | + /* File srcFile = new File(fileName); */ | |
| 303 | + | |
| 304 | + /* File srcFile = new File(new String(fileName.getBytes("gbk"),"gbk"));*/ | |
| 305 | + | |
| 306 | + int byteread = 0; // 读取的字节数 | |
| 307 | + | |
| 308 | + /* in = ftp.retrieveFileStream(remotePath + fileName);*/ | |
| 309 | + | |
| 310 | + in = ftp.retrieveFileStream(new String(fileName.getBytes("gbk"),"gbk")); | |
| 311 | + | |
| 312 | + | |
| 313 | + out = new FileOutputStream(destFile); | |
| 314 | + | |
| 315 | + byte[] buffer = new byte[1024]; | |
| 316 | + | |
| 317 | + while ((byteread = in.read(buffer)) != -1) { | |
| 318 | + | |
| 319 | + out.write(buffer, 0, byteread); | |
| 320 | + | |
| 321 | + } | |
| 322 | + | |
| 323 | + out.flush(); | |
| 324 | + ftp.logout(); | |
| 325 | + | |
| 326 | + } catch (IOException e){ | |
| 327 | + | |
| 328 | + e.printStackTrace(); | |
| 329 | + | |
| 330 | + } finally { | |
| 331 | + | |
| 332 | + try { | |
| 333 | + | |
| 334 | + if (out != null) | |
| 335 | + | |
| 336 | + out.close(); | |
| 337 | + | |
| 338 | + if (in != null) | |
| 339 | + | |
| 340 | + in.close(); | |
| 341 | + | |
| 342 | + } catch (IOException e) { | |
| 343 | + | |
| 344 | + e.printStackTrace(); | |
| 345 | + | |
| 346 | + } | |
| 347 | + | |
| 348 | + if (ftp.isConnected()) { | |
| 349 | + | |
| 350 | + try { | |
| 351 | + | |
| 352 | + ftp.disconnect(); | |
| 353 | + | |
| 354 | + } catch (IOException e) { | |
| 355 | + | |
| 356 | + e.printStackTrace(); | |
| 357 | + | |
| 358 | + } | |
| 359 | + } | |
| 360 | + } | |
| 361 | + | |
| 362 | + return destFile; | |
| 363 | + } | |
| 364 | + | |
| 365 | + public static boolean deleteFileByPrefix(String prefix, String url, int port, String username, String password, String remotePath) { | |
| 366 | + boolean flag = false; | |
| 367 | + FTPClient ftp = new FTPClient(); | |
| 368 | + try { | |
| 369 | + int reply; | |
| 370 | + if (port > -1) { | |
| 371 | + ftp.connect(url, port); | |
| 372 | + } else { | |
| 373 | + ftp.connect(url); | |
| 374 | + } | |
| 375 | + ftp.login(username, password); | |
| 376 | + reply = ftp.getReplyCode(); | |
| 377 | + if (!FTPReply.isPositiveCompletion(reply)) { | |
| 378 | + ftp.disconnect(); | |
| 379 | + return flag; | |
| 380 | + } | |
| 381 | + ftp.enterLocalPassiveMode(); | |
| 382 | + ftp.changeWorkingDirectory(remotePath); | |
| 383 | + for (FTPFile file : ftp.listFiles()) { | |
| 384 | + if (file.getName().startsWith(prefix)) { | |
| 385 | + ftp.deleteFile(file.getName()); | |
| 386 | + } | |
| 387 | + } | |
| 388 | + ftp.logout(); | |
| 389 | + } catch (IOException e){ | |
| 390 | + e.printStackTrace(); | |
| 391 | + } finally { | |
| 392 | + if (ftp.isConnected()) { | |
| 393 | + try { | |
| 394 | + ftp.disconnect(); | |
| 395 | + } catch (IOException e) { | |
| 396 | + e.printStackTrace(); | |
| 397 | + } | |
| 398 | + } | |
| 399 | + } | |
| 400 | + | |
| 401 | + return flag; | |
| 402 | + } | |
| 403 | + | |
| 404 | + | |
| 405 | + public static void main(String[] args) { | |
| 406 | + | |
| 407 | + FTPClientUtils clientUtils = new FTPClientUtils(); | |
| 408 | + | |
| 409 | + Test test= new Test(); | |
| 410 | + | |
| 411 | + File[] sources = new File[] {new File("E:/20079.txt")}; | |
| 412 | + | |
| 413 | + File target = new File("release_package.tar.gz"); | |
| 414 | + | |
| 415 | + File targetFile = test.pack(sources, target); | |
| 416 | + | |
| 417 | + /* clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/ | |
| 418 | + | |
| 419 | + | |
| 420 | + /** 删除文件 */ | |
| 421 | + /*boolean a =clientUtils.deleteFtpFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "release_package.tar.gz");*/ | |
| 422 | + | |
| 423 | + } | |
| 424 | +} | ... | ... |
src/main/java/com/bsth/util/IFlyUtils.java
| ... | ... | @@ -31,65 +31,36 @@ public class IFlyUtils { |
| 31 | 31 | |
| 32 | 32 | private final static String appId = "b4b21ad4"; |
| 33 | 33 | |
| 34 | - /** | |
| 35 | - * 生成普通话语音 | |
| 36 | - * text以","进行分割 | |
| 37 | - * @param text | |
| 38 | - */ | |
| 39 | - public static void textToSpeechCn(String text, String outputPath) throws Exception { | |
| 34 | + private static Map<String, String> language2vcn = new HashMap<>(); | |
| 35 | + | |
| 36 | + static { | |
| 37 | + language2vcn.put("cn", "x4_lingxiaoshan_profnews"); | |
| 38 | + language2vcn.put("sh", "x3_ziling"); | |
| 39 | + language2vcn.put("en", "x4_enus_luna_assist"); | |
| 40 | + } | |
| 41 | + | |
| 42 | + public static void textToSpeech(String text, String language, String outputPath) throws Exception { | |
| 40 | 43 | File file = new File(outputPath); |
| 41 | 44 | if (!file.getParentFile().exists()) { |
| 42 | 45 | file.getParentFile().mkdirs(); |
| 43 | 46 | } |
| 44 | - String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); | |
| 45 | - SpeechRequest request = new SpeechRequest(); | |
| 46 | - request.getCommon().put("app_id", appId); | |
| 47 | - request.getBusiness().put("aue", "lame"); | |
| 48 | - request.getBusiness().put("sfl", 1); | |
| 49 | - request.getBusiness().put("vcn", "x4_lingxiaoshan_profnews"); | |
| 50 | - request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK"))); | |
| 51 | - request.getData().put("status", 2); | |
| 52 | - websocketWork(wsUrl, request, new FileOutputStream(file)); | |
| 53 | - while (!request.isCompleted()) { | |
| 54 | - Thread.sleep(500); | |
| 47 | + String vcn = language2vcn.get(language); | |
| 48 | + if (vcn == null) { | |
| 49 | + throw new IllegalArgumentException("Language is not supported: " + language); | |
| 55 | 50 | } |
| 56 | - } | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 生成上海话语音 | |
| 60 | - * text以","进行分割 | |
| 61 | - * @param text | |
| 62 | - */ | |
| 63 | - public static void textToSpeechSh(String text, String outputPath) throws Exception { | |
| 64 | 51 | String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); |
| 65 | 52 | SpeechRequest request = new SpeechRequest(); |
| 66 | 53 | request.getCommon().put("app_id", appId); |
| 67 | 54 | request.getBusiness().put("aue", "lame"); |
| 68 | 55 | request.getBusiness().put("sfl", 1); |
| 69 | - request.getBusiness().put("vcn", "x3_ziling"); | |
| 70 | - request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes("GBK"))); | |
| 71 | - request.getData().put("status", 2); | |
| 72 | - websocketWork(wsUrl, request, new FileOutputStream(outputPath)); | |
| 73 | - while (!request.isCompleted()) { | |
| 74 | - Thread.sleep(500); | |
| 56 | + request.getBusiness().put("vcn", vcn); | |
| 57 | + String charset = "GBK"; | |
| 58 | + if (language.equals("en")) { | |
| 59 | + charset = "UTF-8"; | |
| 75 | 60 | } |
| 76 | - } | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * 生成英语语音 | |
| 80 | - * text以","进行分割 | |
| 81 | - * @param text | |
| 82 | - */ | |
| 83 | - public static void textToSpeechEn(String text, String outputPath) throws Exception { | |
| 84 | - String wsUrl = getAuthUrl("https://tts-api.xfyun.cn/v2/tts", apiKey, apiSecret).replace("https://", "wss://"); | |
| 85 | - SpeechRequest request = new SpeechRequest(); | |
| 86 | - request.getCommon().put("app_id", appId); | |
| 87 | - request.getBusiness().put("aue", "lame"); | |
| 88 | - request.getBusiness().put("sfl", 1); | |
| 89 | - request.getBusiness().put("vcn", "x4_enus_luna_assist"); | |
| 90 | - request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(StandardCharsets.UTF_8))); | |
| 61 | + request.getData().put("text", Base64.getEncoder().encodeToString(text.replace(",", "[p1000]").getBytes(charset))); | |
| 91 | 62 | request.getData().put("status", 2); |
| 92 | - websocketWork(wsUrl, request, new FileOutputStream(outputPath)); | |
| 63 | + websocketWork(wsUrl, request, new FileOutputStream(file)); | |
| 93 | 64 | while (!request.isCompleted()) { |
| 94 | 65 | Thread.sleep(500); |
| 95 | 66 | } | ... | ... |
src/main/resources/application-dev.properties
| 1 | 1 | server.port=9088 |
| 2 | 2 | |
| 3 | -# dubbo服务化使用开关flag | |
| 3 | +# dubbo����ʹ�ÿ���flag | |
| 4 | 4 | dubbo.use=false |
| 5 | 5 | |
| 6 | 6 | #JPA |
| ... | ... | @@ -9,21 +9,14 @@ spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.Im |
| 9 | 9 | spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy |
| 10 | 10 | spring.jpa.database= MYSQL |
| 11 | 11 | spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true |
| 12 | -spring.jpa.show-sql= true | |
| 12 | +spring.jpa.show-sql= false | |
| 13 | 13 | spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect |
| 14 | 14 | |
| 15 | 15 | #DATABASE |
| 16 | 16 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 17 | -#spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 18 | -##spring.datasource.url= jdbc:mysql://192.168.168.222/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 19 | -#spring.datasource.username= root | |
| 20 | -#spring.datasource.password= | |
| 21 | -spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 17 | +spring.datasource.url= jdbc:mysql://192.168.168.152/control_lg?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 22 | 18 | spring.datasource.username= root |
| 23 | -spring.datasource.password= root | |
| 24 | -#spring.datasource.url= jdbc:mysql://192.168.168.241/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 25 | -#spring.datasource.username= root | |
| 26 | -#spring.datasource.password= root2jsp | |
| 19 | +spring.datasource.password= root2jsp | |
| 27 | 20 | spring.datasource.type= com.zaxxer.hikari.HikariDataSource |
| 28 | 21 | |
| 29 | 22 | #DATASOURCE SETTING |
| ... | ... | @@ -39,17 +32,17 @@ spring.datasource.hikari.validation-timeout= 3000 |
| 39 | 32 | spring.datasource.hikari.register-mbeans=true |
| 40 | 33 | |
| 41 | 34 | kafka.use= false |
| 42 | -spring.kafka.consumer.bootstrap-servers= localhost:9092 | |
| 43 | -spring.kafka.consumer.group-id= schedule-system | |
| 35 | +spring.kafka.consumer.bootstrap-servers= 192.170.100.114:9092,192.170.100.114:9093,192.170.100.114:9094 | |
| 36 | +spring.kafka.consumer.group-id= schedule-system-test | |
| 44 | 37 | spring.kafka.consumer.auto-offset-reset= latest |
| 45 | 38 | spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer |
| 46 | 39 | spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer |
| 47 | 40 | |
| 48 | 41 | sso.enabled= false |
| 49 | -sso.systemcode = SYS0019 | |
| 50 | -sso.http.url.login= http://180.169.154.251:28090/portal/index.html#/login | |
| 51 | -sso.http.url.logout= http://180.169.154.251:18080/information/api/v1/logout | |
| 52 | -sso.http.url.auth= http://180.169.154.251:18080/information/authenticate/authorityAuthentication | |
| 42 | +sso.systemcode = SYS0023 | |
| 43 | +sso.http.url.login= https://112.64.45.51/portal/index.html#/login | |
| 44 | +sso.http.url.logout= https://112.64.45.51/information/api/v1/logout | |
| 45 | +sso.http.url.auth= https://112.64.45.51/information/authenticate/authorityAuthentication | |
| 53 | 46 | |
| 54 | -path.speech.common = /data/control/speech/common/ | |
| 55 | -path.speech.line = /data/control/speech/%s/ | |
| 56 | 47 | \ No newline at end of file |
| 48 | +path.speech.common = D:/speech/common/ | |
| 49 | +path.speech.line = D:/speech/%s/ | |
| 57 | 50 | \ No newline at end of file | ... | ... |
src/main/resources/fatso/handle_real_ctl.js
| 1 | -/** | |
| 2 | - * 处理线调文件 | |
| 3 | - */ | |
| 4 | -var fs = require('fs') | |
| 5 | - , cheerio = require('cheerio') | |
| 6 | - , minifier = require('./minifier') | |
| 7 | - , crypto = require("crypto") | |
| 8 | - , CleanCSS = require('clean-css') | |
| 9 | - , UglifyJS = require("uglify-js"); | |
| 10 | -; | |
| 11 | - | |
| 12 | -var platform = process.platform; | |
| 13 | -var iswin = platform=='win32'; | |
| 14 | -var sp = platform=='win32'?'\\':'/'; | |
| 15 | -//不参与的目录 | |
| 16 | -var pName = 'bsth_control' | |
| 17 | - , path = process.cwd() | |
| 18 | - //根目录 | |
| 19 | - , root = path.substr(0, path.indexOf(sp + 'src'+sp+'main')) | |
| 20 | - , workspace = root.substr(0, root.lastIndexOf(sp + pName)) | |
| 21 | - //临时目录 | |
| 22 | - , dest = (workspace + sp + pName + '@fatso_copy')//.replace(/\//g, '\\') | |
| 23 | - , _static = sp + 'src'+sp+'main'+sp+'resources'+sp+'static'; | |
| 24 | - | |
| 25 | - | |
| 26 | -var mainFile = dest + _static + sp + 'real_control_v2'+sp+'main.html'; | |
| 27 | -var aloneMapWrapFile = dest + _static + sp + 'real_control_v2'+sp+'alone_page'+sp+'map'+sp+'alone_wrap.html'; | |
| 28 | -var aloneHomeWrapFile = dest + _static + sp + 'real_control_v2'+sp+'alone_page'+sp+'home'+sp+'home_wrap.html'; | |
| 29 | -var mapFile = dest + _static + sp + 'real_control_v2'+sp+'mapmonitor'+sp+'real.html'; | |
| 30 | -var realCtl = { | |
| 31 | - /** | |
| 32 | - * 处理线调首页 | |
| 33 | - */ | |
| 34 | - handleMain: function (cb) { | |
| 35 | - //处理main.html | |
| 36 | - var data = fs.readFileSync(mainFile, 'utf-8'), | |
| 37 | - $ = cheerio.load(data); | |
| 38 | - handleCss($, function () { | |
| 39 | - handleJs($, mainFile, cb); | |
| 40 | - }); | |
| 41 | - | |
| 42 | - | |
| 43 | - }, | |
| 44 | - /** | |
| 45 | - * 处理地图模块 | |
| 46 | - * @param cb | |
| 47 | - */ | |
| 48 | - handleMap: function (cb) { | |
| 49 | - //读取文件 | |
| 50 | - var data = fs.readFileSync(mapFile, 'utf-8') | |
| 51 | - , $ = cheerio.load(data); | |
| 52 | - | |
| 53 | - handleCss($, function () { | |
| 54 | - handleJs($, mapFile, cb); | |
| 55 | - }); | |
| 56 | - }, | |
| 57 | - /** | |
| 58 | - * 处理单屏地图页面 | |
| 59 | - * @param cb | |
| 60 | - */ | |
| 61 | - handleAlonePage: function (cb) { | |
| 62 | - var data = fs.readFileSync(aloneMapWrapFile, 'utf-8'); | |
| 63 | - var $ = cheerio.load(data); | |
| 64 | - handleCss($, function () { | |
| 65 | - handleJs($, aloneMapWrapFile, cb); | |
| 66 | - }); | |
| 67 | - }, | |
| 68 | - /** | |
| 69 | - * 处理单屏主页 | |
| 70 | - * @param cb | |
| 71 | - */ | |
| 72 | - handleAloneHomePage: function (cb) { | |
| 73 | - var data = fs.readFileSync(aloneHomeWrapFile, 'utf-8'); | |
| 74 | - var $ = cheerio.load(data); | |
| 75 | - handleCss($, function () { | |
| 76 | - handleJs($, aloneHomeWrapFile, cb); | |
| 77 | - }); | |
| 78 | - } | |
| 79 | - | |
| 80 | -}; | |
| 81 | - | |
| 82 | -/** | |
| 83 | - * 处理css | |
| 84 | - * @type {any} | |
| 85 | - */ | |
| 86 | -var handleCss = function ($, cb) { | |
| 87 | - var cssArray = $('link[rel=stylesheet][merge]'); | |
| 88 | - //按 merge 值分组 | |
| 89 | - var cssMap = {}, mergeName; | |
| 90 | - for (var i = 0, c; c = cssArray[i++];) { | |
| 91 | - mergeName = $(c).attr('merge'); | |
| 92 | - if (!cssMap[mergeName]) | |
| 93 | - cssMap[mergeName] = []; | |
| 94 | - cssMap[mergeName].push(dest + _static + $(c).attr('href')); | |
| 95 | - //remove | |
| 96 | - $(c).remove(); | |
| 97 | - } | |
| 98 | - //按 merge 合并压缩css | |
| 99 | - var ks = get_keys(cssMap), index = 0; | |
| 100 | - (function () { | |
| 101 | - if (index >= ks.length) { | |
| 102 | - cb && cb(); | |
| 103 | - return; | |
| 104 | - } | |
| 105 | - var k = ks[index]; | |
| 106 | - index++; | |
| 107 | - var f = arguments.callee; | |
| 108 | - //合并css | |
| 109 | - new CleanCSS().minify(cssMap[k], function (error, out) { | |
| 110 | - var data = out.styles; | |
| 111 | - var fName = (k + '_' + md5(data)) + '.css'; | |
| 112 | - //写入 assets css 目录下 | |
| 113 | - var descFile = dest + _static + sp + 'real_control_v2'+sp+'assets'+sp+'css' + sp + fName; | |
| 114 | - fs.open(descFile, 'a', function (err, fd) { | |
| 115 | - | |
| 116 | - fs.write(fd, data, function () { | |
| 117 | - var tag = '<link rel="stylesheet" href="/real_control_v2/assets/css/' + fName + '"/>'; | |
| 118 | - if ($('head').length > 0) | |
| 119 | - $('head').append(tag); | |
| 120 | - else { | |
| 121 | - if($('link').length > 0) | |
| 122 | - $('link').last().before(tag); | |
| 123 | - else | |
| 124 | - $('div').first().before(tag); | |
| 125 | - } | |
| 126 | - console.log(k + ' css', '结束,下一个'); | |
| 127 | - f(); | |
| 128 | - }); | |
| 129 | - }); | |
| 130 | - }); | |
| 131 | - })(); | |
| 132 | -}; | |
| 133 | - | |
| 134 | -/** | |
| 135 | - * 处理js | |
| 136 | - */ | |
| 137 | -var handleJs = function ($, file, cb) { | |
| 138 | - var scriptArray = $('script[merge]'); | |
| 139 | - //按 merge 值分组 | |
| 140 | - var jsMap = {}, mergeName; | |
| 141 | - for (var i = 0, s; s = scriptArray[i++];) { | |
| 142 | - mergeName = $(s).attr('merge'); | |
| 143 | - if (!jsMap[mergeName]) | |
| 144 | - jsMap[mergeName] = []; | |
| 145 | - jsMap[mergeName].push(dest + _static + $(s).attr('src')); | |
| 146 | - //remove | |
| 147 | - $(s).remove(); | |
| 148 | - } | |
| 149 | - | |
| 150 | - //按 merge 合并压缩js | |
| 151 | - var ks = get_keys(jsMap), index = 0; | |
| 152 | - (function () { | |
| 153 | - if (index >= ks.length) { | |
| 154 | - write(file, $.html()); | |
| 155 | - console.log(file + ' 结束'.green); | |
| 156 | - cb && cb(); | |
| 157 | - return; | |
| 158 | - } | |
| 159 | - var k = ks[index]; | |
| 160 | - index++; | |
| 161 | - var f = arguments.callee; | |
| 162 | - //合并压缩js | |
| 163 | - var result = UglifyJS.minify(jsMap[k]); | |
| 164 | - var data = result.code; | |
| 165 | - var fName = (k + '_' + md5(data)) + '.js'; | |
| 166 | - //写入 assets js 目录下 | |
| 167 | - var descFile = dest + _static + sp + 'real_control_v2'+sp+'assets'+sp+'js' + sp + fName; | |
| 168 | - fs.open(descFile, 'a', function (err, fd) { | |
| 169 | - | |
| 170 | - fs.write(fd, data, function () { | |
| 171 | - var tag = '<script src="/real_control_v2/assets/js/' + fName + '"></script>'; | |
| 172 | - if ($('body').length > 0) | |
| 173 | - $('body').append(tag); | |
| 174 | - else { | |
| 175 | - //没有body 就写在尾部 | |
| 176 | - $('*').last().after(tag); | |
| 177 | - } | |
| 178 | - console.log(k + ' js', '结束,下一个'); | |
| 179 | - f(); | |
| 180 | - }); | |
| 181 | - }); | |
| 182 | - })(); | |
| 183 | -}; | |
| 184 | - | |
| 185 | -var get_keys = function (json) { | |
| 186 | - var array = []; | |
| 187 | - for (var key in json) { | |
| 188 | - array.push(key); | |
| 189 | - } | |
| 190 | - return array; | |
| 191 | -}; | |
| 192 | - | |
| 193 | -function md5(text) { | |
| 194 | - return crypto.createHash("md5").update(text).digest("hex"); | |
| 195 | -} | |
| 196 | - | |
| 197 | -function write(file, text) { | |
| 198 | - fs.writeFile(file, text, function (err) { | |
| 199 | - if (err) { | |
| 200 | - console.log(err.toString().red); | |
| 201 | - process.exit(); | |
| 202 | - } | |
| 203 | - console.log(file.green); | |
| 204 | - }); | |
| 205 | -} | |
| 206 | - | |
| 1 | +/** | |
| 2 | + * 处理线调文件 | |
| 3 | + */ | |
| 4 | +var fs = require('fs') | |
| 5 | + , cheerio = require('cheerio') | |
| 6 | + , minifier = require('./minifier') | |
| 7 | + , crypto = require("crypto") | |
| 8 | + , CleanCSS = require('clean-css'); | |
| 9 | +; | |
| 10 | + | |
| 11 | +var platform = process.platform; | |
| 12 | +var iswin = platform=='win32'; | |
| 13 | +var sp = platform=='win32'?'\\':'/'; | |
| 14 | +//不参与的目录 | |
| 15 | +var pName = 'bsth_control' | |
| 16 | + , path = process.cwd() | |
| 17 | + //根目录 | |
| 18 | + , root = path.substr(0, path.indexOf(sp + 'src'+sp+'main')) | |
| 19 | + , workspace = root.substr(0, root.lastIndexOf(sp + pName)) | |
| 20 | + //临时目录 | |
| 21 | + , dest = (workspace + sp + pName + '@fatso_copy')//.replace(/\//g, '\\') | |
| 22 | + , _static = sp + 'src'+sp+'main'+sp+'resources'+sp+'static'; | |
| 23 | + | |
| 24 | + | |
| 25 | +var mainFile = dest + _static + sp + 'real_control_v2'+sp+'main.html'; | |
| 26 | +var aloneMapWrapFile = dest + _static + sp + 'real_control_v2'+sp+'alone_page'+sp+'map'+sp+'alone_wrap.html'; | |
| 27 | +var aloneHomeWrapFile = dest + _static + sp + 'real_control_v2'+sp+'alone_page'+sp+'home'+sp+'home_wrap.html'; | |
| 28 | +var mapFile = dest + _static + sp + 'real_control_v2'+sp+'mapmonitor'+sp+'real.html'; | |
| 29 | +var realCtl = { | |
| 30 | + /** | |
| 31 | + * 处理线调首页 | |
| 32 | + */ | |
| 33 | + handleMain: function (cb) { | |
| 34 | + //处理main.html | |
| 35 | + var data = fs.readFileSync(mainFile, 'utf-8'), | |
| 36 | + $ = cheerio.load(data); | |
| 37 | + handleCss($, function () { | |
| 38 | + handleJs($, mainFile, cb); | |
| 39 | + }); | |
| 40 | + | |
| 41 | + | |
| 42 | + }, | |
| 43 | + /** | |
| 44 | + * 处理地图模块 | |
| 45 | + * @param cb | |
| 46 | + */ | |
| 47 | + handleMap: function (cb) { | |
| 48 | + //读取文件 | |
| 49 | + var data = fs.readFileSync(mapFile, 'utf-8') | |
| 50 | + , $ = cheerio.load(data); | |
| 51 | + | |
| 52 | + handleCss($, function () { | |
| 53 | + handleJs($, mapFile, cb); | |
| 54 | + }); | |
| 55 | + }, | |
| 56 | + /** | |
| 57 | + * 处理单屏地图页面 | |
| 58 | + * @param cb | |
| 59 | + */ | |
| 60 | + handleAlonePage: function (cb) { | |
| 61 | + var data = fs.readFileSync(aloneMapWrapFile, 'utf-8'); | |
| 62 | + var $ = cheerio.load(data); | |
| 63 | + handleCss($, function () { | |
| 64 | + handleJs($, aloneMapWrapFile, cb); | |
| 65 | + }); | |
| 66 | + }, | |
| 67 | + /** | |
| 68 | + * 处理单屏主页 | |
| 69 | + * @param cb | |
| 70 | + */ | |
| 71 | + handleAloneHomePage: function (cb) { | |
| 72 | + var data = fs.readFileSync(aloneHomeWrapFile, 'utf-8'); | |
| 73 | + var $ = cheerio.load(data); | |
| 74 | + handleCss($, function () { | |
| 75 | + handleJs($, aloneHomeWrapFile, cb); | |
| 76 | + }); | |
| 77 | + } | |
| 78 | + | |
| 79 | +}; | |
| 80 | + | |
| 81 | +/** | |
| 82 | + * 处理css | |
| 83 | + * @type {any} | |
| 84 | + */ | |
| 85 | +var handleCss = function ($, cb) { | |
| 86 | + var cssArray = $('link[rel=stylesheet][merge]'); | |
| 87 | + //按 merge 值分组 | |
| 88 | + var cssMap = {}, mergeName; | |
| 89 | + for (var i = 0, c; c = cssArray[i++];) { | |
| 90 | + mergeName = $(c).attr('merge'); | |
| 91 | + if (!cssMap[mergeName]) | |
| 92 | + cssMap[mergeName] = []; | |
| 93 | + cssMap[mergeName].push(dest + _static + $(c).attr('href')); | |
| 94 | + //remove | |
| 95 | + $(c).remove(); | |
| 96 | + } | |
| 97 | + //按 merge 合并压缩css | |
| 98 | + var ks = get_keys(cssMap), index = 0; | |
| 99 | + (function () { | |
| 100 | + if (index >= ks.length) { | |
| 101 | + cb && cb(); | |
| 102 | + return; | |
| 103 | + } | |
| 104 | + var k = ks[index]; | |
| 105 | + index++; | |
| 106 | + var f = arguments.callee; | |
| 107 | + //合并css | |
| 108 | + new CleanCSS().minify(cssMap[k], function (error, out) { | |
| 109 | + var data = out.styles; | |
| 110 | + var fName = (k + '_' + md5(data)) + '.css'; | |
| 111 | + //写入 assets css 目录下 | |
| 112 | + var descFile = dest + _static + sp + 'real_control_v2'+sp+'assets'+sp+'css' + sp + fName; | |
| 113 | + fs.open(descFile, 'a', function (err, fd) { | |
| 114 | + | |
| 115 | + fs.write(fd, data, function () { | |
| 116 | + var tag = '<link rel="stylesheet" href="/real_control_v2/assets/css/' + fName + '"/>'; | |
| 117 | + if ($('head').length > 0) | |
| 118 | + $('head').append(tag); | |
| 119 | + else { | |
| 120 | + if($('link').length > 0) | |
| 121 | + $('link').last().before(tag); | |
| 122 | + else | |
| 123 | + $('div').first().before(tag); | |
| 124 | + } | |
| 125 | + console.log(k + ' css', '结束,下一个'); | |
| 126 | + f(); | |
| 127 | + }); | |
| 128 | + }); | |
| 129 | + }); | |
| 130 | + })(); | |
| 131 | +}; | |
| 132 | + | |
| 133 | +/** | |
| 134 | + * 处理js | |
| 135 | + */ | |
| 136 | +var handleJs = function ($, file, cb) { | |
| 137 | + var scriptArray = $('script[merge]'); | |
| 138 | + //按 merge 值分组 | |
| 139 | + var jsMap = {}, mergeName; | |
| 140 | + for (var i = 0, s; s = scriptArray[i++];) { | |
| 141 | + mergeName = $(s).attr('merge'); | |
| 142 | + if (!jsMap[mergeName]) | |
| 143 | + jsMap[mergeName] = []; | |
| 144 | + jsMap[mergeName].push(dest + _static + $(s).attr('src')); | |
| 145 | + //remove | |
| 146 | + $(s).remove(); | |
| 147 | + } | |
| 148 | + | |
| 149 | + //按 merge 合并压缩js | |
| 150 | + var ks = get_keys(jsMap), index = 0; | |
| 151 | + (function () { | |
| 152 | + if (index >= ks.length) { | |
| 153 | + write(file, $.html()); | |
| 154 | + console.log(file + ' 结束'); // 移除.green调用 | |
| 155 | + cb && cb(); | |
| 156 | + return; | |
| 157 | + } | |
| 158 | + var k = ks[index]; | |
| 159 | + index++; | |
| 160 | + var f = arguments.callee; | |
| 161 | + //合并压缩js | |
| 162 | + try { | |
| 163 | + // 先合并文件内容 | |
| 164 | + let code = ''; | |
| 165 | + for(let j = 0; j < jsMap[k].length; j++) { | |
| 166 | + code += fs.readFileSync(jsMap[k][j], 'utf8') + '\n'; | |
| 167 | + } | |
| 168 | + // 使用Terser压缩 | |
| 169 | + var data = minifier.mini(code); | |
| 170 | + if (code !== '' && data === '') { | |
| 171 | + console.error('压缩出错') | |
| 172 | + process.exit(); | |
| 173 | + } | |
| 174 | + var fName = (k + '_' + md5(data)) + '.js'; | |
| 175 | + //写入 assets js 目录下 | |
| 176 | + var descFile = dest + _static + sp + 'real_control_v2'+sp+'assets'+sp+'js' + sp + fName; | |
| 177 | + fs.open(descFile, 'a', function (err, fd) { | |
| 178 | + fs.write(fd, data, function () { | |
| 179 | + var tag = '<script src="/real_control_v2/assets/js/' + fName + '"></script>'; | |
| 180 | + if ($('body').length > 0) | |
| 181 | + $('body').append(tag); | |
| 182 | + else { | |
| 183 | + //没有body 就写在尾部 | |
| 184 | + $('*').last().after(tag); | |
| 185 | + } | |
| 186 | + console.log(k + ' js', '结束,下一个'); | |
| 187 | + f(); | |
| 188 | + }); | |
| 189 | + }); | |
| 190 | + } catch (e) { | |
| 191 | + console.error('合并压缩错误:', e); | |
| 192 | + process.exit(); | |
| 193 | + } | |
| 194 | + })(); | |
| 195 | +}; | |
| 196 | + | |
| 197 | +var get_keys = function (json) { | |
| 198 | + var array = []; | |
| 199 | + for (var key in json) { | |
| 200 | + array.push(key); | |
| 201 | + } | |
| 202 | + return array; | |
| 203 | +}; | |
| 204 | + | |
| 205 | +function md5(text) { | |
| 206 | + return crypto.createHash("md5").update(text).digest("hex"); | |
| 207 | +} | |
| 208 | + | |
| 209 | +function write(file, text) { | |
| 210 | + fs.writeFile(file, text, function (err) { | |
| 211 | + if (err) { | |
| 212 | + console.log(err.toString()); // 移除.red调用 | |
| 213 | + process.exit(); | |
| 214 | + } | |
| 215 | + console.log(file); // 移除.green调用 | |
| 216 | + }); | |
| 217 | +} | |
| 218 | + | |
| 207 | 219 | module.exports = realCtl; |
| 208 | 220 | \ No newline at end of file | ... | ... |
src/main/resources/fatso/minifier.js
| 1 | -/** | |
| 2 | - * @author PanZhao | |
| 3 | - * @date 2016年3月17日 下午12:44:06 | |
| 4 | - */ | |
| 5 | -var fs = require('fs'); | |
| 6 | -var UglifyJS = require("uglify-js"); | |
| 7 | - | |
| 8 | -var platform = process.platform; | |
| 9 | -var iswin = platform=='win32'; | |
| 10 | -var separator = platform=='win32'?'\\':'/'; | |
| 11 | -var minifier = { | |
| 12 | - | |
| 13 | - mergeAndMini: function(fileArray,scriptString, root, file){ | |
| 14 | - var len = fileArray.length; | |
| 15 | - for(var i = 0; i < len; i ++){ | |
| 16 | - fileArray[i] = root + fileArray[i].split('/').join(separator); | |
| 17 | - } | |
| 18 | - | |
| 19 | - var result, indoorRs; | |
| 20 | - | |
| 21 | - try { | |
| 22 | - if(fileArray && len > 0) | |
| 23 | - result = UglifyJS.minify(fileArray); | |
| 24 | - | |
| 25 | - if(scriptString) | |
| 26 | - indoorRs = UglifyJS.minify(scriptString, {fromString: true}); | |
| 27 | - } catch (e) { | |
| 28 | - console.log(e); | |
| 29 | - console.log(file.red); | |
| 30 | - process.exit(); | |
| 31 | - } | |
| 32 | - | |
| 33 | - return {outside: result?result.code:'', inside: indoorRs?indoorRs.code:''}; | |
| 34 | - }, | |
| 35 | - mini: function(file){ | |
| 36 | - return UglifyJS.minify(file).code; | |
| 37 | - } | |
| 38 | -} | |
| 39 | - | |
| 1 | +var fs = require('fs'); | |
| 2 | +var Terser = require('terser'); | |
| 3 | + | |
| 4 | +var platform = process.platform; | |
| 5 | +var iswin = platform=='win32'; | |
| 6 | +var separator = platform=='win32'?'\\':'/'; | |
| 7 | +var minifier = { | |
| 8 | + | |
| 9 | + mergeAndMini: function(fileArray, scriptString, root, file) { | |
| 10 | + var len = fileArray.length; | |
| 11 | + for(var i = 0; i < len; i ++){ | |
| 12 | + fileArray[i] = root + fileArray[i].split('/').join(separator); | |
| 13 | + } | |
| 14 | + | |
| 15 | + var result, indoorRs; | |
| 16 | + | |
| 17 | + try { | |
| 18 | + if(fileArray && len > 0) { | |
| 19 | + // Terser可以直接接受文件路径数组 | |
| 20 | + result = Terser.minify_sync(fs.readFileSync(fileArray[0], 'utf8')); | |
| 21 | + // 如果有多个文件,需要先合并内容 | |
| 22 | + if(len > 1) { | |
| 23 | + let code = ''; | |
| 24 | + for(let j = 0; j < len; j++) { | |
| 25 | + code += fs.readFileSync(fileArray[j], 'utf8') + '\n'; | |
| 26 | + } | |
| 27 | + result = Terser.minify_sync(code); | |
| 28 | + } | |
| 29 | + } | |
| 30 | + | |
| 31 | + if(scriptString) { | |
| 32 | + // Terser不需要fromString选项,直接传递代码字符串 | |
| 33 | + indoorRs = Terser.minify_sync(scriptString); | |
| 34 | + } | |
| 35 | + } catch (e) { | |
| 36 | + console.log(e); | |
| 37 | + console.log(file); // 移除.red调用,除非有chalk等库 | |
| 38 | + process.exit(); | |
| 39 | + } | |
| 40 | + | |
| 41 | + return {outside: result && !result.error ? result.code : '', inside: indoorRs && !indoorRs.error ? indoorRs.code : ''}; | |
| 42 | + }, | |
| 43 | + | |
| 44 | + mini: function(file) { | |
| 45 | + try { | |
| 46 | + // 检查file是文件路径还是代码字符串 | |
| 47 | + if(typeof file === 'string' && fs.existsSync(file)) { | |
| 48 | + const code = fs.readFileSync(file, 'utf8'); | |
| 49 | + const result = Terser.minify_sync(code); | |
| 50 | + return result && !result.error ? result.code : ''; | |
| 51 | + } else { | |
| 52 | + // 假设是代码字符串 | |
| 53 | + const result = Terser.minify_sync(file); | |
| 54 | + return result && !result.error ? result.code : ''; | |
| 55 | + } | |
| 56 | + } catch (e) { | |
| 57 | + console.log(e); | |
| 58 | + return ''; | |
| 59 | + } | |
| 60 | + } | |
| 61 | +}; | |
| 62 | + | |
| 40 | 63 | module.exports = minifier; |
| 41 | 64 | \ No newline at end of file | ... | ... |
src/main/resources/fatso/package.json
| 1 | -{ | |
| 2 | - "name": "fatso", | |
| 3 | - "version": "1.0.0", | |
| 4 | - "description": "子页面js检查、合并、压缩等处理", | |
| 5 | - "main": "start.js", | |
| 6 | - "scripts": { | |
| 7 | - "test": "echo \"Error: no test specified\" && exit 1" | |
| 8 | - }, | |
| 9 | - "author": "panzhaov5", | |
| 10 | - "license": "ISC", | |
| 11 | - "dependencies": { | |
| 12 | - "cheerio": "^0.20.0", | |
| 13 | - "clean-css": "^4.0.12", | |
| 14 | - "colors": "^1.3.3", | |
| 15 | - "eventproxy": "^0.3.4", | |
| 16 | - "uglify-js": "^2.6.2" | |
| 17 | - } | |
| 18 | -} | |
| 1 | +{ | |
| 2 | + "name": "fatso", | |
| 3 | + "version": "1.0.0", | |
| 4 | + "description": "子页面js检查、合并、压缩等处理", | |
| 5 | + "main": "start.js", | |
| 6 | + "scripts": { | |
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | |
| 8 | + }, | |
| 9 | + "author": "panzhaov5", | |
| 10 | + "license": "ISC", | |
| 11 | + "dependencies": { | |
| 12 | + "cheerio": "^0.20.0", | |
| 13 | + "clean-css": "^4.0.12", | |
| 14 | + "colors": "^1.3.3", | |
| 15 | + "eventproxy": "^0.3.4", | |
| 16 | + "terser": "^5.44.0", | |
| 17 | + "uglify-js": "^2.6.2" | |
| 18 | + } | |
| 19 | +} | ... | ... |
src/main/resources/static/gpsTest/test.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html> | |
| 3 | -<head> | |
| 4 | -<meta charset="UTF-8"> | |
| 5 | -<title>GPS点测试</title> | |
| 6 | -<meta name=”renderer” content=”webkit”> | |
| 7 | -<meta http-equiv=”X-UA-Compatible” content=”IE=Edge,chrome=1″> | |
| 8 | - | |
| 9 | -<meta http-equiv="Pragma" content="no-cache"> | |
| 10 | -<meta http-equiv="Cache-control" content="no-cache"> | |
| 11 | -<meta http-equiv="Cache" content="no-cache"> | |
| 12 | -<head> | |
| 13 | -<!-- select2 下拉框插件 --> | |
| 14 | -<link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" | |
| 15 | - rel="stylesheet" type="text/css" /> | |
| 16 | -<style type="text/css"> | |
| 17 | -html,body { | |
| 18 | - height: 100%; | |
| 19 | - overflow: hidden; | |
| 20 | -} | |
| 21 | - | |
| 22 | -#mapContainer { | |
| 23 | - width: 100%; | |
| 24 | - height: calc(100% - 93px); | |
| 25 | -} | |
| 26 | - | |
| 27 | -form { | |
| 28 | - padding: 25px; | |
| 29 | -} | |
| 30 | - | |
| 31 | -form .item { | |
| 32 | - display: inline-block; | |
| 33 | -} | |
| 34 | - | |
| 35 | -form .item input { | |
| 36 | - height: 26px; | |
| 37 | - width: 110px; | |
| 38 | -} | |
| 39 | - | |
| 40 | -form .item select { | |
| 41 | - height: 32px; | |
| 42 | -} | |
| 43 | -</style> | |
| 44 | -</head> | |
| 45 | -<body> | |
| 46 | - <form action=""> | |
| 47 | - <div class="item"> | |
| 48 | - 线路: <select name="xl" style="width: 150px;"> | |
| 49 | - </select> | |
| 50 | - </div> | |
| 51 | - <div class="item"> | |
| 52 | - 方向: <select name="directions" style="width: 70px;"> | |
| 53 | - <option value="0">上行</option> | |
| 54 | - <option value="1">下行</option> | |
| 55 | - </select> | |
| 56 | - </div> | |
| 57 | - <div class="item"> | |
| 58 | - 设备号: <input name="device" value="059L0903" /> | |
| 59 | - </div> | |
| 60 | - <div class="item"> | |
| 61 | - 开始时间戳: <input type="number" name="startTime" value="1461380940000" /> | |
| 62 | - </div> | |
| 63 | - <div class="item"> | |
| 64 | - 结束时间戳: <input type="number" name="endTime" value="1461381960000" /> | |
| 65 | - </div> | |
| 66 | - <div class="item"> | |
| 67 | - <input type="button" value="查询GPS轨迹" onclick="searchGps()"> | |
| 68 | - </div> | |
| 69 | - <div class="item"> | |
| 70 | - <input type="button" value="开启测距" onclick="myDis.open();" | |
| 71 | - style="width: 75px" /> <input type="button" value="关闭测距" | |
| 72 | - onclick="myDis.close()" style="width: 75px" /> | |
| 73 | - | |
| 74 | - </div> | |
| 75 | - | |
| 76 | - <div class="item"> | |
| 77 | - <a target="_blank" href="http://tool.chinaz.com/Tools/unixtime.aspx" | |
| 78 | - style="font-size: 12px; color: red;">毫秒时间戳转换</a> | |
| 79 | - </div> | |
| 80 | - </form> | |
| 81 | - | |
| 82 | - <div id="mapContainer"></div> | |
| 83 | - <script src="/assets/plugins/pinyin.js"></script> | |
| 84 | - <script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | |
| 85 | - <script src="/assets/plugins/jquery.serializejson.js"></script> | |
| 86 | - <script | |
| 87 | - src="//api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 88 | - <script type="text/javascript" | |
| 89 | - src="//api.map.baidu.com/library/DistanceTool/1.2/src/DistanceTool_min.js"></script> | |
| 90 | - <!-- moment.js 日期处理类库 --> | |
| 91 | - <script src="/assets/plugins/moment-with-locales.js"></script> | |
| 92 | - <!-- select2 下拉框 --> | |
| 93 | - <script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script> | |
| 94 | - <script> | |
| 95 | - | |
| 96 | - var inMark = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAA1CAYAAABSrotqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAGW0lEQVRYw62XX2wc1RWHv3vv7NhrQkKCIa0poaKRmjdUFUGr+IH+ITy0Kg/0qVRV1ZamVV95al94oPSBVmoRUZTIKRFBLW1aapBK6gIChYTgFJRQHoITqCCO7eC1vY7t2Z1/954+zK69Xs9mx4mPdLWjmTvnO79z7zl3VlHAvv3XmXuM8R4EBpVSu1DqpiQRBJlH5APn5KQ4NzzycP/pbr7U1R5+6y+Vr2njP6EVX1FKoRTZAOJUQMBlP4gIIrwtNvnlyMO3vL4u4AND49vMjZsOaqMfUgpMA+ZEiBJIrJAkQslT+B4YrXACzknj1x4N6rWfnfrJ7XNdgd888NEOs+XmEaPVLq0zRVEiRGnmsGlJsnKtFfT4ih5PIQJWwDr3QRJUHzix9wsXOwLvOzDW72269ZQxeqcxIAL1WLAtoDzgMlgr+vwsG6kTrOXDoDL91Xcf/eLM8pxWuJT7j4hSO5UC66AW5cM6mXNCEDmsA60UAjv9rf1HWoU1L9Tg0OT3dU/5Wd9TeFpRiwWRFZhNhSvTMbX5hDh0uNhR6jWUb/LYvL0H460kSyko+xrrhCgVJAp/MPrzgecAMVkuH/PuuHv335VSW3s8TZgIrgUWzKdMXagRLqU4KygF4gRnhSiwLFZivF6N32tWAhTwPUWSCmhz18RC3z4+fsNpgN3f+/H9oO4ESO3qNNaupFQ+qWeRa5U7AGY/rlO7kq5Kb+qkUUrqzru/+8M9zTXUeKUHs92miG3LmlhhbjJCGVVoVCdCnG3ZyamgVRaQLvV+B9AeoJUu3QtgdLZWy6mspgigzdpyFS+/ZwTVhBv7/WyOgDbZBtTa3NMEKqX0Dsg6RqvFoUN3cOyczr2f1F3+FtbmDkB5gEKzFQFr215OBe3lO9Yu33GSrg47XUnxtiYQRKUgpdadCaAbnSMfmK+8Pf3L74ssATSAtorSt7a/vKnPUA87pMhTa9cAKJfzMwKysAwU56aUWQvcssUQJ/lA6aBw8xaPJHe+m4asLERcOpb3cvkGg1/SeEatGSZn+CVFeZPJDQRnxwDJgDY5nzcniIXbBkq5zo3Jyqg5PAMDAz5BlL/oLo0uLAOT4MqZvEnWCbEoPjfgU/LUKoDRK/BSSXHbgE8kqmOzt+HiGUA8QBY+Ov127823u0YAq1VGDno0n9/hs7BoWQocSSKIQKmk6OvTbN5sqAZCLeqw3uBmz791ChBFdmL4g4dnziptdnXYYhit2FxWlH2N72WHcmqhFjkW61c/xsTZc6OP3PIlIPayAHA2Dt/wem/oCLROqAZCNchU5B3AnczF9dcBR0sKxQZzI4U9rNOS+vwrDWHLJ76bOH7gTZBwo2GCBDOv/OF4Q+EyUCb+sW/JJeGxDQfG4b8vjRwK2hUKYNPF6gsbDUyC6lHAtgMB3NTfnv5ns+dtkL6F2eF9/6KRznagXDyxvyZx9PJG4WxUf+niif01Wtr8KiBgo8VPj24UMA5mXqAlne1AAPfhc79+DZHZ66aJq0wM/eJVWtKZB5Tqu0frNlr80/Xy0jB4fmbsZNQVCNj6+LlDoFxh7+2mkHjy3OFGOtse5U2H3sE/Xn5ZeT33dfJ5tdYmNjk5+tPt9wMhbd8Fed8DAqTJwuyhaxWYLM4MASk5HyGdPkDshT8/+hLiLq8XJuIu/+/Ir4bz0nk1oMyNHgttuPTseoGuvnh4/uzwqtorBATszNnXDqyvoUu48N6rB2mrvSJAAHd+/48mbVgr3AhsGDw/NvTIFG2lUBQoQFr/5L2nipSIgAvH//s0HTZL01QXPwro3X3o8rAu9expfdBeFpJGx0b3fvYhckqhqMJllVFl/PfdFNanx5/qpq6IwmZQvYPPTB9XpvTlPIWSxqOjez/z9YY6181ZN3NAEs5d+k2nCfHc5JNA0g1WVGGLyspbynh3tSp0aXLm9N7tg0XUFVXYVJlG81NPrlE3P/k7srUr1OyLAgHS/zzxjRex9v3mDbHp+2d/u+fFBrBwqoqaUKnEYfXS480b4dzk41QqMV125vWYBvoGn5l+596Dn74D9K0z6MY/4M7WvqkESOPK+GNRlsRm3eXNK+SwVYkPlBpBacA05uvGfVgpBSFr2K4RRALE5GykTif+toZT1WFu87pVSft1Asy1q70WhYrVwOa4ZoXred7JOq7h/wF6az0ukZgX/AAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wNy0yNVQyMTo1MDo0MyswODowMOgS43cAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTMtMTEtMjBUMjI6NDc6MTErMDg6MDAou1syAAAATnRFWHRzb2Z0d2FyZQBJbWFnZU1hZ2ljayA2LjguOC0xMCBRMTYgeDg2XzY0IDIwMTUtMDctMTkgaHR0cDovL3d3dy5pbWFnZW1hZ2ljay5vcmcFDJw1AAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAA1Mwmpb+QAAAAWdEVYdFRodW1iOjpJbWFnZTo6V2lkdGgAMjgpleAmAAAAGXRFWHRUaHVtYjo6TWltZXR5cGUAaW1hZ2UvcG5nP7JWTgAAABd0RVh0VGh1bWI6Ok1UaW1lADEzODQ5NTg4MzEXUMEwAAAAE3RFWHRUaHVtYjo6U2l6ZQA0LjUzS0JC/AyPiAAAAFp0RVh0VGh1bWI6OlVSSQBmaWxlOi8vL2hvbWUvd3d3cm9vdC93d3cuZWFzeWljb24ubmV0L2Nkbi1pbWcuZWFzeWljb24uY24vc3JjLzExMjk3LzExMjk3NzIucG5nqXNeUQAAAABJRU5ErkJggg=='; | |
| 97 | - var outMark = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAvCAMAAAC18jgTAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABO1BMVEUAAAAiu4ggv40gvowgvowgvosgvowfvo0jv44hv40gvosgvowcxo4fvowgvowdvYogv4whvo0gvowhvYwrqoAhv4wnxIkgv4wA//8gvIshvosgvowhvIshvowgvowrv5Ugv4ohvosgvowhv4wgv4whvYwXuYsgvowgvowiu4gfvo0zzJkhvowktpIgvowgv40hvo0gv4wgvowAqqogvosgvowjv4sgvowivIskv4khvowgvYsiu44hvosfvI0hv4sgvYofvowgvowgv40gv4wjuYsgvowhvowfvIsgvYsgvo0hvoxAv4Agv4wgvowgvoshvo0mv4whvowgvowfwo8gv4wgv40duokAAAAfvYsgvYwAAAAAAAAAAAAAAAAAAAAAAAAAAAAYjGUYj2kAAAAAAAAAAAAgvoz///9v2GMAAAAAZ3RSTlMAD1eZyOr4miSc950Jivoj0i/pfAarDaoBWH3JLuv5DDDL0ZunbQvu/h6CBbQO5jhOkNwDtfAsz0Qc42EtdUGLYKKOwsYW7/s5f7nMBCj9N40U8/YZh48aAaOmAggNERMWF0lLGBkanzLKGQAAAAFiS0dEaMts9CIAAAGZSURBVDjLfZRnW8IwFIUvyN6FUlCx4AZxKw7cA/eeKKNUwfz/f2ChZNAmnC+U+54m9548KQCRwznicns8bpfX6QC7fP4AIgoEfRYcCkfQgCLhEMujMWRTLEq55EYcuSXyPpcbjv4aoRgSKGb2EUZChXvzRcSGSHfaIP0fT0iyLCXitOI38qP5JBWzKSVFE3OAk/I0HiudJMVR8JL1FRqMQgb3ggs/Jthox3B1HIg3wxoyuDoBKn6UWYOMqyp4uIYsNfC3yNEtJoc3OQXT3DFJmDNMUCkaFI1yFubmqcMedb4AsMAeVqaYzbGHtWj4l5bFx51f6a64mhca/OaeayK+3m9qY5PPS1tk7G0eV3doMLtlToN7bLT7JZvhYPByHqoWfmS93ceD/CRtNcApy89kG4fiOeXlCucLAoULzC+vgCvSxjUIdGPy2zuR4b53jx8eQagn5gi5en5B6PVtiAHeEfoYxqHiUT9FrNrT17f5a8O1eqOptXT951fXW1qzUa9ZXtfanU7nry/jsa1VuSsYtjZ3BdIDFin/A1AVNdoKDyAYAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTA3LTI1VDIxOjUwOjQzKzA4OjAw6BLjdwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMy0xMS0yMFQyMjo0NzoxMyswODowML8kShsAAABOdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOC44LTEwIFExNiB4ODZfNjQgMjAxNS0wNy0xOSBodHRwOi8vd3d3LmltYWdlbWFnaWNrLm9yZwUMnDUAAAAYdEVYdFRodW1iOjpEb2N1bWVudDo6UGFnZXMAMaf/uy8AAAAXdEVYdFRodW1iOjpJbWFnZTo6SGVpZ2h0ADQ3F9+avAAAABZ0RVh0VGh1bWI6OkltYWdlOjpXaWR0aAAzMtBbOHkAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9wbmc/slZOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTM4NDk1ODgzM/leoBwAAAATdEVYdFRodW1iOjpTaXplADQuMDFLQkKe5chzAAAAWnRFWHRUaHVtYjo6VVJJAGZpbGU6Ly8vaG9tZS93d3dyb290L3d3dy5lYXN5aWNvbi5uZXQvY2RuLWltZy5lYXN5aWNvbi5jbi9zcmMvMTEyOTcvMTEyOTc4Ni5wbmetpUpEAAAAAElFTkSuQmCC'; | |
| 98 | - | |
| 99 | - var inOuts = [outMark, inMark]; | |
| 100 | - | |
| 101 | - var stationCodeMap = {}; | |
| 102 | - | |
| 103 | - var map = new BMap.Map("mapContainer"); | |
| 104 | - map.centerAndZoom(new BMap.Point(121.544336, 31.221315), 15); | |
| 105 | - map.enableScrollWheelZoom(); | |
| 106 | - //中心点和缩放级别 | |
| 107 | - map.setCurrentCity("上海"); | |
| 108 | - var myDis = new BMapLib.DistanceTool(map); | |
| 109 | - | |
| 110 | - | |
| 111 | - $.get('/line/all', function(rs){ | |
| 112 | - var data = []; | |
| 113 | - $.each(rs, function(){ | |
| 114 | - data.push({id: this.id, text: this.name}); | |
| 115 | - }); | |
| 116 | - | |
| 117 | - initPinYinSelect2('select[name=xl]', data); | |
| 118 | - }); | |
| 119 | - | |
| 120 | - function searchGps(){ | |
| 121 | - var params = $('form').serializeJSON(); | |
| 122 | - //查询线路路由站点 | |
| 123 | - $.get('/test/gps/route', params, function(rs){ | |
| 124 | - var array = rs[0].children[0].children | |
| 125 | - ,coords,circle, cdsArray, points, polygon; | |
| 126 | - //画出站点 | |
| 127 | - console.log(array); | |
| 128 | - $.each(array, function(){ | |
| 129 | - stationCodeMap[this.stationStationCod] = this.name; | |
| 130 | - if(this.stationShapesType === 'r'){ | |
| 131 | - //画圆 | |
| 132 | - coords = this.stationBJwpoints.split(' '); | |
| 133 | - circle = new BMap.Circle(new BMap.Point(coords[0], coords[1]),this.stationRadius); | |
| 134 | - circle.setStrokeColor('red'); | |
| 135 | - circle.setStrokeWeight(2) | |
| 136 | - map.addOverlay(circle); | |
| 137 | - } | |
| 138 | - else if(this.stationShapesType === 'd'){ | |
| 139 | - //画多边形 | |
| 140 | - coords = this.stationBPolygonGrid.substring(9, this.stationBPolygonGrid.length - 2); | |
| 141 | - cdsArray = coords.split(','); | |
| 142 | - points = []; | |
| 143 | - $.each(cdsArray, function(){ | |
| 144 | - coords = this.split(' '); | |
| 145 | - points.push(new BMap.Point(coords[0], coords[1])); | |
| 146 | - }); | |
| 147 | - | |
| 148 | - polygon = new BMap.Polygon(points, {strokeColor:"red", strokeWeight:2, strokeOpacity:0.5}); | |
| 149 | - map.addOverlay(polygon); | |
| 150 | - } | |
| 151 | - }); | |
| 152 | - coords = array[array.length / 2].stationBJwpoints.split(' '); | |
| 153 | - map.setCenter(new BMap.Point(coords[0], coords[1])) | |
| 154 | - }); | |
| 155 | - | |
| 156 | - //查询gps点 | |
| 157 | - $.get('/gps/history/' + params.device, params, function(gpsArray){ | |
| 158 | - console.log(stationCodeMap); | |
| 159 | - var marker, label, point, state, text; | |
| 160 | - $.each(gpsArray, function(){ | |
| 161 | - point = new BMap.Point(this.lon, this.lat); | |
| 162 | - marker = new BMap.Marker(point); | |
| 163 | - state = this.inout_stop; | |
| 164 | - | |
| 165 | - if(state == 0 || state == 1){ | |
| 166 | - text = state == 0?'出':'进'; | |
| 167 | - | |
| 168 | - console.log(stationCodeMap[this.stopNo], this); | |
| 169 | - marker.setIcon(new BMap.Icon(inOuts[this.inout_stop], new BMap.Size(25,25))); | |
| 170 | - label = new BMap.Label( | |
| 171 | - stationCodeMap[this.stopNo] + '/' +moment(this.ts).format('HH:mm.ss') + ' -'+text | |
| 172 | - , {position: point, offset: new BMap.Size(-25,-18)}); | |
| 173 | - marker.setLabel(label); | |
| 174 | - } | |
| 175 | - else{ | |
| 176 | - label = new BMap.Label(moment(this.ts).format('HH:mm.ss') | |
| 177 | - , {position: point, offset: new BMap.Size(-25,-18)}); | |
| 178 | - marker.setLabel(label); | |
| 179 | - } | |
| 180 | - | |
| 181 | - map.addOverlay(marker); | |
| 182 | - }); | |
| 183 | - }); | |
| 184 | - } | |
| 185 | - | |
| 186 | - | |
| 187 | - /** | |
| 188 | - * 支持拼音搜索的select2 | |
| 189 | - * @param selector | |
| 190 | - * @param data | |
| 191 | - */ | |
| 192 | - function initPinYinSelect2(selector, data, cb){ | |
| 193 | - | |
| 194 | - $.each(data, function(){ | |
| 195 | - this.fullChars = pinyin.getFullChars(this.text).toUpperCase(); | |
| 196 | - this.camelChars = pinyin.getCamelChars(this.text); | |
| 197 | - }); | |
| 198 | - | |
| 199 | - $.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) { | |
| 200 | - $(selector).select2({ | |
| 201 | - data: data, | |
| 202 | - matcher: oldMatcher(function(term, text, item){ | |
| 203 | - var upTerm = term.toUpperCase(); | |
| 204 | - if(item.fullChars.indexOf(upTerm) != -1 | |
| 205 | - || item.camelChars.indexOf(upTerm) != -1) | |
| 206 | - return true; | |
| 207 | - | |
| 208 | - return text.indexOf(term) != -1; | |
| 209 | - }) | |
| 210 | - }); | |
| 211 | - | |
| 212 | - cb && cb(); | |
| 213 | - }); | |
| 214 | - | |
| 215 | - return $(selector); | |
| 216 | - } | |
| 217 | -</script> | |
| 218 | -</body> | |
| 219 | -</html> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html> | |
| 3 | +<head> | |
| 4 | +<meta charset="UTF-8"> | |
| 5 | +<title>GPS点测试</title> | |
| 6 | +<meta name=”renderer” content=”webkit”> | |
| 7 | +<meta http-equiv=”X-UA-Compatible” content=”IE=Edge,chrome=1″> | |
| 8 | + | |
| 9 | +<meta http-equiv="Pragma" content="no-cache"> | |
| 10 | +<meta http-equiv="Cache-control" content="no-cache"> | |
| 11 | +<meta http-equiv="Cache" content="no-cache"> | |
| 12 | +<head> | |
| 13 | +<!-- select2 下拉框插件 --> | |
| 14 | +<link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" | |
| 15 | + rel="stylesheet" type="text/css" /> | |
| 16 | +<style type="text/css"> | |
| 17 | +html,body { | |
| 18 | + height: 100%; | |
| 19 | + overflow: hidden; | |
| 20 | +} | |
| 21 | + | |
| 22 | +#mapContainer { | |
| 23 | + width: 100%; | |
| 24 | + height: calc(100% - 93px); | |
| 25 | +} | |
| 26 | + | |
| 27 | +form { | |
| 28 | + padding: 25px; | |
| 29 | +} | |
| 30 | + | |
| 31 | +form .item { | |
| 32 | + display: inline-block; | |
| 33 | +} | |
| 34 | + | |
| 35 | +form .item input { | |
| 36 | + height: 26px; | |
| 37 | + width: 110px; | |
| 38 | +} | |
| 39 | + | |
| 40 | +form .item select { | |
| 41 | + height: 32px; | |
| 42 | +} | |
| 43 | +</style> | |
| 44 | +</head> | |
| 45 | +<body> | |
| 46 | + <form action=""> | |
| 47 | + <div class="item"> | |
| 48 | + 线路: <select name="xl" style="width: 150px;"> | |
| 49 | + </select> | |
| 50 | + </div> | |
| 51 | + <div class="item"> | |
| 52 | + 方向: <select name="directions" style="width: 70px;"> | |
| 53 | + <option value="0">上行</option> | |
| 54 | + <option value="1">下行</option> | |
| 55 | + </select> | |
| 56 | + </div> | |
| 57 | + <div class="item"> | |
| 58 | + 设备号: <input name="device" value="059L0903" /> | |
| 59 | + </div> | |
| 60 | + <div class="item"> | |
| 61 | + 开始时间戳: <input type="number" name="startTime" value="1461380940000" /> | |
| 62 | + </div> | |
| 63 | + <div class="item"> | |
| 64 | + 结束时间戳: <input type="number" name="endTime" value="1461381960000" /> | |
| 65 | + </div> | |
| 66 | + <div class="item"> | |
| 67 | + <input type="button" value="查询GPS轨迹" onclick="searchGps()"> | |
| 68 | + </div> | |
| 69 | + <div class="item"> | |
| 70 | + <input type="button" value="开启测距" onclick="myDis.open();" | |
| 71 | + style="width: 75px" /> <input type="button" value="关闭测距" | |
| 72 | + onclick="myDis.close()" style="width: 75px" /> | |
| 73 | + | |
| 74 | + </div> | |
| 75 | + | |
| 76 | + <div class="item"> | |
| 77 | + <a target="_blank" href="http://tool.chinaz.com/Tools/unixtime.aspx" | |
| 78 | + style="font-size: 12px; color: red;">毫秒时间戳转换</a> | |
| 79 | + </div> | |
| 80 | + </form> | |
| 81 | + | |
| 82 | + <div id="mapContainer"></div> | |
| 83 | + <script src="/assets/plugins/pinyin.js"></script> | |
| 84 | + <script src="/metronic_v4.5.4/plugins/jquery.min.js"></script> | |
| 85 | + <script src="/assets/plugins/jquery.serializejson.js"></script> | |
| 86 | + <script | |
| 87 | + src="//api.map.baidu.com/api?v=2.0&ak=1TgEKvYqohJyeGXnN6yHSSTb4psOarQw"></script> | |
| 88 | + <script type="text/javascript" | |
| 89 | + src="//api.map.baidu.com/library/DistanceTool/1.2/src/DistanceTool_min.js"></script> | |
| 90 | + <!-- moment.js 日期处理类库 --> | |
| 91 | + <script src="/assets/plugins/moment-with-locales.js"></script> | |
| 92 | + <!-- select2 下拉框 --> | |
| 93 | + <script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script> | |
| 94 | + <script> | |
| 95 | + | |
| 96 | + var inMark = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAA1CAYAAABSrotqAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAGW0lEQVRYw62XX2wc1RWHv3vv7NhrQkKCIa0poaKRmjdUFUGr+IH+ITy0Kg/0qVRV1ZamVV95al94oPSBVmoRUZTIKRFBLW1aapBK6gIChYTgFJRQHoITqCCO7eC1vY7t2Z1/954+zK69Xs9mx4mPdLWjmTvnO79z7zl3VlHAvv3XmXuM8R4EBpVSu1DqpiQRBJlH5APn5KQ4NzzycP/pbr7U1R5+6y+Vr2njP6EVX1FKoRTZAOJUQMBlP4gIIrwtNvnlyMO3vL4u4AND49vMjZsOaqMfUgpMA+ZEiBJIrJAkQslT+B4YrXACzknj1x4N6rWfnfrJ7XNdgd888NEOs+XmEaPVLq0zRVEiRGnmsGlJsnKtFfT4ih5PIQJWwDr3QRJUHzix9wsXOwLvOzDW72269ZQxeqcxIAL1WLAtoDzgMlgr+vwsG6kTrOXDoDL91Xcf/eLM8pxWuJT7j4hSO5UC66AW5cM6mXNCEDmsA60UAjv9rf1HWoU1L9Tg0OT3dU/5Wd9TeFpRiwWRFZhNhSvTMbX5hDh0uNhR6jWUb/LYvL0H460kSyko+xrrhCgVJAp/MPrzgecAMVkuH/PuuHv335VSW3s8TZgIrgUWzKdMXagRLqU4KygF4gRnhSiwLFZivF6N32tWAhTwPUWSCmhz18RC3z4+fsNpgN3f+/H9oO4ESO3qNNaupFQ+qWeRa5U7AGY/rlO7kq5Kb+qkUUrqzru/+8M9zTXUeKUHs92miG3LmlhhbjJCGVVoVCdCnG3ZyamgVRaQLvV+B9AeoJUu3QtgdLZWy6mspgigzdpyFS+/ZwTVhBv7/WyOgDbZBtTa3NMEKqX0Dsg6RqvFoUN3cOyczr2f1F3+FtbmDkB5gEKzFQFr215OBe3lO9Yu33GSrg47XUnxtiYQRKUgpdadCaAbnSMfmK+8Pf3L74ssATSAtorSt7a/vKnPUA87pMhTa9cAKJfzMwKysAwU56aUWQvcssUQJ/lA6aBw8xaPJHe+m4asLERcOpb3cvkGg1/SeEatGSZn+CVFeZPJDQRnxwDJgDY5nzcniIXbBkq5zo3Jyqg5PAMDAz5BlL/oLo0uLAOT4MqZvEnWCbEoPjfgU/LUKoDRK/BSSXHbgE8kqmOzt+HiGUA8QBY+Ov127823u0YAq1VGDno0n9/hs7BoWQocSSKIQKmk6OvTbN5sqAZCLeqw3uBmz791ChBFdmL4g4dnziptdnXYYhit2FxWlH2N72WHcmqhFjkW61c/xsTZc6OP3PIlIPayAHA2Dt/wem/oCLROqAZCNchU5B3AnczF9dcBR0sKxQZzI4U9rNOS+vwrDWHLJ76bOH7gTZBwo2GCBDOv/OF4Q+EyUCb+sW/JJeGxDQfG4b8vjRwK2hUKYNPF6gsbDUyC6lHAtgMB3NTfnv5ns+dtkL6F2eF9/6KRznagXDyxvyZx9PJG4WxUf+niif01Wtr8KiBgo8VPj24UMA5mXqAlne1AAPfhc79+DZHZ66aJq0wM/eJVWtKZB5Tqu0frNlr80/Xy0jB4fmbsZNQVCNj6+LlDoFxh7+2mkHjy3OFGOtse5U2H3sE/Xn5ZeT33dfJ5tdYmNjk5+tPt9wMhbd8Fed8DAqTJwuyhaxWYLM4MASk5HyGdPkDshT8/+hLiLq8XJuIu/+/Ir4bz0nk1oMyNHgttuPTseoGuvnh4/uzwqtorBATszNnXDqyvoUu48N6rB2mrvSJAAHd+/48mbVgr3AhsGDw/NvTIFG2lUBQoQFr/5L2nipSIgAvH//s0HTZL01QXPwro3X3o8rAu9expfdBeFpJGx0b3fvYhckqhqMJllVFl/PfdFNanx5/qpq6IwmZQvYPPTB9XpvTlPIWSxqOjez/z9YY6181ZN3NAEs5d+k2nCfHc5JNA0g1WVGGLyspbynh3tSp0aXLm9N7tg0XUFVXYVJlG81NPrlE3P/k7srUr1OyLAgHS/zzxjRex9v3mDbHp+2d/u+fFBrBwqoqaUKnEYfXS480b4dzk41QqMV125vWYBvoGn5l+596Dn74D9K0z6MY/4M7WvqkESOPK+GNRlsRm3eXNK+SwVYkPlBpBacA05uvGfVgpBSFr2K4RRALE5GykTif+toZT1WFu87pVSft1Asy1q70WhYrVwOa4ZoXred7JOq7h/wF6az0ukZgX/AAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0wNy0yNVQyMTo1MDo0MyswODowMOgS43cAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTMtMTEtMjBUMjI6NDc6MTErMDg6MDAou1syAAAATnRFWHRzb2Z0d2FyZQBJbWFnZU1hZ2ljayA2LjguOC0xMCBRMTYgeDg2XzY0IDIwMTUtMDctMTkgaHR0cDovL3d3dy5pbWFnZW1hZ2ljay5vcmcFDJw1AAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAA1Mwmpb+QAAAAWdEVYdFRodW1iOjpJbWFnZTo6V2lkdGgAMjgpleAmAAAAGXRFWHRUaHVtYjo6TWltZXR5cGUAaW1hZ2UvcG5nP7JWTgAAABd0RVh0VGh1bWI6Ok1UaW1lADEzODQ5NTg4MzEXUMEwAAAAE3RFWHRUaHVtYjo6U2l6ZQA0LjUzS0JC/AyPiAAAAFp0RVh0VGh1bWI6OlVSSQBmaWxlOi8vL2hvbWUvd3d3cm9vdC93d3cuZWFzeWljb24ubmV0L2Nkbi1pbWcuZWFzeWljb24uY24vc3JjLzExMjk3LzExMjk3NzIucG5nqXNeUQAAAABJRU5ErkJggg=='; | |
| 97 | + var outMark = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAvCAMAAAC18jgTAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABO1BMVEUAAAAiu4ggv40gvowgvowgvosgvowfvo0jv44hv40gvosgvowcxo4fvowgvowdvYogv4whvo0gvowhvYwrqoAhv4wnxIkgv4wA//8gvIshvosgvowhvIshvowgvowrv5Ugv4ohvosgvowhv4wgv4whvYwXuYsgvowgvowiu4gfvo0zzJkhvowktpIgvowgv40hvo0gv4wgvowAqqogvosgvowjv4sgvowivIskv4khvowgvYsiu44hvosfvI0hv4sgvYofvowgvowgv40gv4wjuYsgvowhvowfvIsgvYsgvo0hvoxAv4Agv4wgvowgvoshvo0mv4whvowgvowfwo8gv4wgv40duokAAAAfvYsgvYwAAAAAAAAAAAAAAAAAAAAAAAAAAAAYjGUYj2kAAAAAAAAAAAAgvoz///9v2GMAAAAAZ3RSTlMAD1eZyOr4miSc950Jivoj0i/pfAarDaoBWH3JLuv5DDDL0ZunbQvu/h6CBbQO5jhOkNwDtfAsz0Qc42EtdUGLYKKOwsYW7/s5f7nMBCj9N40U8/YZh48aAaOmAggNERMWF0lLGBkanzLKGQAAAAFiS0dEaMts9CIAAAGZSURBVDjLfZRnW8IwFIUvyN6FUlCx4AZxKw7cA/eeKKNUwfz/f2ChZNAmnC+U+54m9548KQCRwznicns8bpfX6QC7fP4AIgoEfRYcCkfQgCLhEMujMWRTLEq55EYcuSXyPpcbjv4aoRgSKGb2EUZChXvzRcSGSHfaIP0fT0iyLCXitOI38qP5JBWzKSVFE3OAk/I0HiudJMVR8JL1FRqMQgb3ggs/Jthox3B1HIg3wxoyuDoBKn6UWYOMqyp4uIYsNfC3yNEtJoc3OQXT3DFJmDNMUCkaFI1yFubmqcMedb4AsMAeVqaYzbGHtWj4l5bFx51f6a64mhca/OaeayK+3m9qY5PPS1tk7G0eV3doMLtlToN7bLT7JZvhYPByHqoWfmS93ceD/CRtNcApy89kG4fiOeXlCucLAoULzC+vgCvSxjUIdGPy2zuR4b53jx8eQagn5gi5en5B6PVtiAHeEfoYxqHiUT9FrNrT17f5a8O1eqOptXT951fXW1qzUa9ZXtfanU7nry/jsa1VuSsYtjZ3BdIDFin/A1AVNdoKDyAYAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTA3LTI1VDIxOjUwOjQzKzA4OjAw6BLjdwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMy0xMS0yMFQyMjo0NzoxMyswODowML8kShsAAABOdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOC44LTEwIFExNiB4ODZfNjQgMjAxNS0wNy0xOSBodHRwOi8vd3d3LmltYWdlbWFnaWNrLm9yZwUMnDUAAAAYdEVYdFRodW1iOjpEb2N1bWVudDo6UGFnZXMAMaf/uy8AAAAXdEVYdFRodW1iOjpJbWFnZTo6SGVpZ2h0ADQ3F9+avAAAABZ0RVh0VGh1bWI6OkltYWdlOjpXaWR0aAAzMtBbOHkAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9wbmc/slZOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTM4NDk1ODgzM/leoBwAAAATdEVYdFRodW1iOjpTaXplADQuMDFLQkKe5chzAAAAWnRFWHRUaHVtYjo6VVJJAGZpbGU6Ly8vaG9tZS93d3dyb290L3d3dy5lYXN5aWNvbi5uZXQvY2RuLWltZy5lYXN5aWNvbi5jbi9zcmMvMTEyOTcvMTEyOTc4Ni5wbmetpUpEAAAAAElFTkSuQmCC'; | |
| 98 | + | |
| 99 | + var inOuts = [outMark, inMark]; | |
| 100 | + | |
| 101 | + var stationCodeMap = {}; | |
| 102 | + | |
| 103 | + var map = new BMap.Map("mapContainer"); | |
| 104 | + map.centerAndZoom(new BMap.Point(121.544336, 31.221315), 15); | |
| 105 | + map.enableScrollWheelZoom(); | |
| 106 | + //中心点和缩放级别 | |
| 107 | + map.setCurrentCity("上海"); | |
| 108 | + var myDis = new BMapLib.DistanceTool(map); | |
| 109 | + | |
| 110 | + | |
| 111 | + $.get('/line/all', function(rs){ | |
| 112 | + var data = []; | |
| 113 | + $.each(rs, function(){ | |
| 114 | + data.push({id: this.id, text: this.name}); | |
| 115 | + }); | |
| 116 | + | |
| 117 | + initPinYinSelect2('select[name=xl]', data); | |
| 118 | + }); | |
| 119 | + | |
| 120 | + function searchGps(){ | |
| 121 | + var params = $('form').serializeJSON(); | |
| 122 | + //查询线路路由站点 | |
| 123 | + $.get('/test/gps/route', params, function(rs){ | |
| 124 | + var array = rs[0].children[0].children | |
| 125 | + ,coords,circle, cdsArray, points, polygon; | |
| 126 | + //画出站点 | |
| 127 | + console.log(array); | |
| 128 | + $.each(array, function(){ | |
| 129 | + stationCodeMap[this.stationStationCod] = this.name; | |
| 130 | + if(this.stationShapesType === 'r'){ | |
| 131 | + //画圆 | |
| 132 | + coords = this.stationBJwpoints.split(' '); | |
| 133 | + circle = new BMap.Circle(new BMap.Point(coords[0], coords[1]),this.stationRadius); | |
| 134 | + circle.setStrokeColor('red'); | |
| 135 | + circle.setStrokeWeight(2) | |
| 136 | + map.addOverlay(circle); | |
| 137 | + } | |
| 138 | + else if(this.stationShapesType === 'd'){ | |
| 139 | + //画多边形 | |
| 140 | + coords = this.stationBPolygonGrid.substring(9, this.stationBPolygonGrid.length - 2); | |
| 141 | + cdsArray = coords.split(','); | |
| 142 | + points = []; | |
| 143 | + $.each(cdsArray, function(){ | |
| 144 | + coords = this.split(' '); | |
| 145 | + points.push(new BMap.Point(coords[0], coords[1])); | |
| 146 | + }); | |
| 147 | + | |
| 148 | + polygon = new BMap.Polygon(points, {strokeColor:"red", strokeWeight:2, strokeOpacity:0.5}); | |
| 149 | + map.addOverlay(polygon); | |
| 150 | + } | |
| 151 | + }); | |
| 152 | + coords = array[array.length / 2].stationBJwpoints.split(' '); | |
| 153 | + map.setCenter(new BMap.Point(coords[0], coords[1])) | |
| 154 | + }); | |
| 155 | + | |
| 156 | + //查询gps点 | |
| 157 | + $.get('/gps/history/' + params.device, params, function(gpsArray){ | |
| 158 | + console.log(stationCodeMap); | |
| 159 | + var marker, label, point, state, text; | |
| 160 | + $.each(gpsArray, function(){ | |
| 161 | + point = new BMap.Point(this.lon, this.lat); | |
| 162 | + marker = new BMap.Marker(point); | |
| 163 | + state = this.inout_stop; | |
| 164 | + | |
| 165 | + if(state == 0 || state == 1){ | |
| 166 | + text = state == 0?'出':'进'; | |
| 167 | + | |
| 168 | + console.log(stationCodeMap[this.stopNo], this); | |
| 169 | + marker.setIcon(new BMap.Icon(inOuts[this.inout_stop], new BMap.Size(25,25))); | |
| 170 | + label = new BMap.Label( | |
| 171 | + stationCodeMap[this.stopNo] + '/' +moment(this.ts).format('HH:mm.ss') + ' -'+text | |
| 172 | + , {position: point, offset: new BMap.Size(-25,-18)}); | |
| 173 | + marker.setLabel(label); | |
| 174 | + } | |
| 175 | + else{ | |
| 176 | + label = new BMap.Label(moment(this.ts).format('HH:mm.ss') | |
| 177 | + , {position: point, offset: new BMap.Size(-25,-18)}); | |
| 178 | + marker.setLabel(label); | |
| 179 | + } | |
| 180 | + | |
| 181 | + map.addOverlay(marker); | |
| 182 | + }); | |
| 183 | + }); | |
| 184 | + } | |
| 185 | + | |
| 186 | + | |
| 187 | + /** | |
| 188 | + * 支持拼音搜索的select2 | |
| 189 | + * @param selector | |
| 190 | + * @param data | |
| 191 | + */ | |
| 192 | + function initPinYinSelect2(selector, data, cb){ | |
| 193 | + | |
| 194 | + $.each(data, function(){ | |
| 195 | + this.fullChars = pinyin.getFullChars(this.text).toUpperCase(); | |
| 196 | + this.camelChars = pinyin.getCamelChars(this.text); | |
| 197 | + }); | |
| 198 | + | |
| 199 | + $.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) { | |
| 200 | + $(selector).select2({ | |
| 201 | + data: data, | |
| 202 | + matcher: oldMatcher(function(term, text, item){ | |
| 203 | + var upTerm = term.toUpperCase(); | |
| 204 | + if(item.fullChars.indexOf(upTerm) != -1 | |
| 205 | + || item.camelChars.indexOf(upTerm) != -1) | |
| 206 | + return true; | |
| 207 | + | |
| 208 | + return text.indexOf(term) != -1; | |
| 209 | + }) | |
| 210 | + }); | |
| 211 | + | |
| 212 | + cb && cb(); | |
| 213 | + }); | |
| 214 | + | |
| 215 | + return $(selector); | |
| 216 | + } | |
| 217 | +</script> | |
| 218 | +</body> | |
| 219 | +</html> | ... | ... |
src/main/resources/static/index.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html lang="zh"> | |
| 3 | -<head> | |
| 4 | - <meta name="renderer" content="webkit" /> | |
| 5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
| 6 | - <meta charset="UTF-8"> | |
| 7 | - <title>调度系统</title> | |
| 8 | - | |
| 9 | - <meta http-equiv="Pragma" content="no-cache"> | |
| 10 | - <meta http-equiv="Cache-control" content="no-cache"> | |
| 11 | - <meta http-equiv="Cache" content="no-cache"> | |
| 12 | - | |
| 13 | - <!-- Font Awesome 图标字体 --> | |
| 14 | - <link | |
| 15 | - href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css" | |
| 16 | - rel="stylesheet" type="text/css" /> | |
| 17 | - <!-- Bootstrap style --> | |
| 18 | - <link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css" | |
| 19 | - rel="stylesheet" type="text/css" /> | |
| 20 | - <!-- jsTree 数插件 --> | |
| 21 | - <link | |
| 22 | - href="/metronic_v4.5.4/plugins/jstree/dist/themes/default/style.min.css" | |
| 23 | - rel="stylesheet" type="text/css" /> | |
| 24 | - <!-- MULTI-select 多选下拉框美化 --> | |
| 25 | - <link | |
| 26 | - href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" | |
| 27 | - rel="stylesheet" type="text/css" /> | |
| 28 | - | |
| 29 | - <!-- editable --> | |
| 30 | - <link | |
| 31 | - href="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css" | |
| 32 | - rel="stylesheet" type="text/css" /> | |
| 33 | - <!-- METRONIC style --> | |
| 34 | - <link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" | |
| 35 | - rel="stylesheet" type="text/css" id="style_color" /> | |
| 36 | - <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" | |
| 37 | - type="text/css" /> | |
| 38 | - <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" | |
| 39 | - type="text/css" /> | |
| 40 | - <link href="/metronic_v4.5.4/layout4/css/layout.min.css" | |
| 41 | - rel="stylesheet" type="text/css" /> | |
| 42 | - <link href="/metronic_v4.5.4/layout4/css/custom.min.css" | |
| 43 | - rel="stylesheet" type="text/css" /> | |
| 44 | - <!-- select2 下拉框插件 --> | |
| 45 | - <link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" | |
| 46 | - rel="stylesheet" type="text/css" /> | |
| 47 | - <link | |
| 48 | - href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" | |
| 49 | - rel="stylesheet" type="text/css" /> | |
| 50 | - <!-- layer 弹层 插件 --> | |
| 51 | - <link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" | |
| 52 | - rel="stylesheet" type="text/css" /> | |
| 53 | - <!-- fileinput 上传 插件 --> | |
| 54 | - <link href="/assets/plugins/fileinput/css/fileinput.min.css" | |
| 55 | - rel="stylesheet" type="text/css" /> | |
| 56 | - <!-- iCheck 单选框和复选框 --> | |
| 57 | - <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" | |
| 58 | - rel="stylesheet" type="text/css" /> | |
| 59 | - <!-- 日期控件 --> | |
| 60 | - <link | |
| 61 | - href="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/css/bootstrap-datetimepicker.min.css" | |
| 62 | - rel="stylesheet" type="text/css" /> | |
| 63 | - <!-- table 表格控件 --> | |
| 64 | - <!--<link rel="stylesheet"--> | |
| 65 | - <!--href="//api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"--> | |
| 66 | - <!--type="text/css" />--> | |
| 67 | - <link href="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet" type="text/css"/> | |
| 68 | - <!-- handsontable样式 --> | |
| 69 | - <link rel="stylesheet" | |
| 70 | - href="/assets/bower_components/handsontable/dist/handsontable.full.css" /> | |
| 71 | - <!-- sweetalert样式 --> | |
| 72 | - <link rel="stylesheet" | |
| 73 | - href="/assets/bower_components/sweetalert/dist/sweetalert.css" /> | |
| 74 | - <!-- schedule计划调度AngularJS模块主css --> | |
| 75 | - <link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" | |
| 76 | - type="text/css" /> | |
| 77 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 78 | - | |
| 79 | - <!-- CSS动画 --> | |
| 80 | - <link | |
| 81 | - href="/metronic_v4.5.4/plugins/tipso/css/animate.css" | |
| 82 | - rel="stylesheet" type="text/css" /> | |
| 83 | - | |
| 84 | - <!-- 提示工具样式 --> | |
| 85 | - <link | |
| 86 | - href="/metronic_v4.5.4/plugins/tipso/css/tipso.css" | |
| 87 | - rel="stylesheet" type="text/css" /> | |
| 88 | - | |
| 89 | - <style type="text/css"> | |
| 90 | - .searchForm { | |
| 91 | - | |
| 92 | - } | |
| 93 | - | |
| 94 | - .searchForm .form-group .control-label { | |
| 95 | - padding-right: 0px; | |
| 96 | - text-align: right; | |
| 97 | - margin-top: 7px; | |
| 98 | - } | |
| 99 | - | |
| 100 | - .searchForm .form-group>div { | |
| 101 | - padding-left: 10px; | |
| 102 | - padding-right: 0px; | |
| 103 | - } | |
| 104 | - | |
| 105 | - .searchForm .row>div { | |
| 106 | - padding-left: 0px; | |
| 107 | - padding-right: 0px; | |
| 108 | - padding: 5px 0 5px 0; | |
| 109 | - width: 270px; | |
| 110 | - display: inline-block; | |
| 111 | - } | |
| 112 | - | |
| 113 | - .searchForm .form-actions { | |
| 114 | - | |
| 115 | - } | |
| 116 | - | |
| 117 | - tr.row-active td { | |
| 118 | - border-bottom: 1px solid blue !important; | |
| 119 | - color: blue; | |
| 120 | - } | |
| 121 | - | |
| 122 | - .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | |
| 123 | - { | |
| 124 | - font-size: 14px; | |
| 125 | - } | |
| 126 | - | |
| 127 | - .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | |
| 128 | - { | |
| 129 | - padding: 6px 26px; | |
| 130 | - } | |
| 131 | - | |
| 132 | - .ms-container .ms-list { | |
| 133 | - height: 306px; | |
| 134 | - } | |
| 135 | - | |
| 136 | - .ms-container .ms-selectable,.ms-container .ms-selection { | |
| 137 | - width: 47%; | |
| 138 | - } | |
| 139 | - | |
| 140 | - .ms-container { | |
| 141 | - width: 470px; | |
| 142 | - margin: auto; | |
| 143 | - } | |
| 144 | - | |
| 145 | - .multi-custom-header-left { | |
| 146 | - text-align: center; | |
| 147 | - padding: 7px; | |
| 148 | - color: #3B3F51; | |
| 149 | - } | |
| 150 | - | |
| 151 | - .multi-custom-header-right { | |
| 152 | - text-align: center; | |
| 153 | - padding: 7px; | |
| 154 | - font-weight: bold; | |
| 155 | - color: #36C6D3; | |
| 156 | - } | |
| 157 | - | |
| 158 | - .mt-element-list .list-simple.mt-list-container ul>.mt-list-item>.list-item-content | |
| 159 | - { | |
| 160 | - padding: 0 55px 0 0px; | |
| 161 | - } | |
| 162 | - | |
| 163 | - .mt-element-list .list-simple.mt-list-container ul>.mt-list-item { | |
| 164 | - padding: 3.3px 0; | |
| 165 | - } | |
| 166 | - | |
| 167 | - #route-container { | |
| 168 | - display: none; | |
| 169 | - } | |
| 170 | - | |
| 171 | - .page-content.active { | |
| 172 | - display: block !important; | |
| 173 | - } | |
| 174 | - | |
| 175 | - .page-header.navbar .page-logo .logo-default { | |
| 176 | - margin: 0; | |
| 177 | - } | |
| 178 | - | |
| 179 | - .page-header.navbar .top-menu .navbar-nav>li.dropdown.open .dropdown-toggle | |
| 180 | - { | |
| 181 | - background-color: #284a99; | |
| 182 | - } | |
| 183 | - | |
| 184 | - .page-header.navbar .page-logo { | |
| 185 | - padding-right: 10px; | |
| 186 | - } | |
| 187 | - | |
| 188 | - .page-logo .logo-default.logo-default-text { | |
| 189 | - font-weight: 600; | |
| 190 | - color: white !important; | |
| 191 | - margin-top: 19px !important; | |
| 192 | - font-size: 24px; | |
| 193 | - text-decoration: none; | |
| 194 | - } | |
| 195 | - | |
| 196 | - .page-logo .logo-default.logo-default-text:HOVER { | |
| 197 | - color: #dedede !important; | |
| 198 | - } | |
| 199 | - | |
| 200 | - body,.page-content-wrapper,#pjax-container{ | |
| 201 | - height: 100%; | |
| 202 | - } | |
| 203 | - html{ | |
| 204 | - height: 90%; | |
| 205 | - } | |
| 206 | - .page-container{ | |
| 207 | - height: 100%; | |
| 208 | - } | |
| 209 | - </style> | |
| 210 | - | |
| 211 | - <!-- ocLazyLoading载入文件的位置 --> | |
| 212 | - <link id="ng_load_plugins_before" /> | |
| 213 | - | |
| 214 | -</head> | |
| 215 | -<body | |
| 216 | - class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo page-sidebar-fixed"> | |
| 217 | -<div class="page-header navbar navbar-fixed-top" | |
| 218 | - style="background: linear-gradient(to bottom, #124e78, #125688);"> | |
| 219 | - <div class="page-header-inner "> | |
| 220 | - <!-- LOGO --> | |
| 221 | - <div class="page-logo"> | |
| 222 | - <a href="index.html" class="logo-default logo-default-text"> | |
| 223 | - 浦东公交调度系统 </a> | |
| 224 | - <div class="menu-toggler sidebar-toggler"></div> | |
| 225 | - </div> | |
| 226 | - <!-- END LOGO --> | |
| 227 | - <a href="javascript:;" class="menu-toggler responsive-toggler" | |
| 228 | - data-toggle="collapse" data-target=".navbar-collapse"> </a> | |
| 229 | - <div class="page-top"> | |
| 230 | - <div class="top-menu"> | |
| 231 | - <ul class="nav navbar-nav pull-right"> | |
| 232 | - <!-- 信息通知区 --> | |
| 233 | - <li | |
| 234 | - class="dropdown dropdown-extended dropdown-notification dropdown-dark" | |
| 235 | - id="header_notification_bar"><a href="javascript:;" | |
| 236 | - class="dropdown-toggle" data-toggle="dropdown" | |
| 237 | - data-hover="dropdown" data-close-others="true"> <i | |
| 238 | - class="fa fa-bell"></i> <span class="badge badge-success"> | |
| 239 | - 0 </span> | |
| 240 | - </a> | |
| 241 | - <ul class="dropdown-menu" style="max-width: 345px; width: 345px;"> | |
| 242 | - <li class="external"> | |
| 243 | - <h3> | |
| 244 | - 今日 <span class="bold">0 条</span> 通知 | |
| 245 | - </h3> <a href="javascript:;">查看全部</a> | |
| 246 | - </li> | |
| 247 | - <li> | |
| 248 | - <ul class="dropdown-menu-list scroller" style="height: 250px;" | |
| 249 | - data-handle-color="#637283"> | |
| 250 | - </ul> | |
| 251 | - </li> | |
| 252 | - </ul></li> | |
| 253 | - <li class="dropdown dropdown-user dropdown-dark"><a | |
| 254 | - href="javascript:;" class="dropdown-toggle" | |
| 255 | - data-toggle="dropdown" data-hover="dropdown" | |
| 256 | - data-close-others="true"> <span id="indexTopUName" | |
| 257 | - class="username username-hide-on-mobile" | |
| 258 | - style="vertical-align: middle;"> <i class="fa fa-user"></i></span> | |
| 259 | - </a> | |
| 260 | - <ul class="dropdown-menu dropdown-menu-default"> | |
| 261 | - <li><a href="javascript:;"> <i class="fa fa-user"></i> | |
| 262 | - 我的信息 | |
| 263 | - </a></li> | |
| 264 | - <li><a href="javascript:;" id="changePWD"> <i | |
| 265 | - class="fa fa-unlock-alt"></i> 修改密码 | |
| 266 | - </a></li> | |
| 267 | - <li class="divider"></li> | |
| 268 | - <li><a href="javascript:;"> <i class="fa fa-lock"></i> | |
| 269 | - 锁屏 | |
| 270 | - </a></li> | |
| 271 | - <li><a href="/logout"> <i class="fa fa-key"></i> 注销登陆 | |
| 272 | - </a></li> | |
| 273 | - </ul></li> | |
| 274 | - </ul> | |
| 275 | - </div> | |
| 276 | - </div> | |
| 277 | - </div> | |
| 278 | -</div> | |
| 279 | -<div class="page-container"> | |
| 280 | - <div class="page-sidebar-wrapper"> | |
| 281 | - <div class="page-sidebar navbar-collapse collapse"> | |
| 282 | - <ul class="page-sidebar-menu page-sidebar-menu-fixed" | |
| 283 | - data-keep-expanded="false" data-auto-scroll="true" | |
| 284 | - data-slide-speed="200" id="leftMenuSidebar"> | |
| 285 | - </ul> | |
| 286 | - </div> | |
| 287 | - </div> | |
| 288 | - <div class="page-content-wrapper"> | |
| 289 | - <div id="pjax-container" class="page-content"></div> | |
| 290 | - | |
| 291 | - <div id="route-container"> | |
| 292 | - <div ng-app="ScheduleApp"> | |
| 293 | - <div ng-controller="ScheduleAppController"> | |
| 294 | - | |
| 295 | - <!-- loading widget --> | |
| 296 | - <div id="loadingWidget" class="flyover mask" loading-widget> | |
| 297 | - <div class="alert alert-info"> | |
| 298 | - <strong>载入中......</strong> | |
| 299 | - </div> | |
| 300 | - </div> | |
| 301 | - | |
| 302 | - <div ui-view class="uv"></div> | |
| 303 | - </div> | |
| 304 | - </div> | |
| 305 | - </div> | |
| 306 | - </div> | |
| 307 | -</div> | |
| 308 | - | |
| 309 | -<script id="menu_list_temp" type="text/html"> | |
| 310 | - {{each list as group i}} | |
| 311 | - <li class="heading"> | |
| 312 | - <h3 class="uppercase">{{group.name}}</h3> | |
| 313 | - </li> | |
| 314 | - {{each group.children as dir j}} | |
| 315 | - <li class="nav-item"> | |
| 316 | - <a href="javascript:;" class="nav-link nav-toggle "> | |
| 317 | - <i class="{{dir.icon}}"></i> | |
| 318 | - <span class="title">{{dir.name}}</span> | |
| 319 | - <span class="arrow"></span> | |
| 320 | - </a> | |
| 321 | - <ul class="sub-menu"> | |
| 322 | - {{each dir.children as module s}} | |
| 323 | - <li class="nav-item "> | |
| 324 | - {{if module.container=="pjax-container"}} | |
| 325 | - <a href="/pages/{{module.path}}" class="nav-link " data-pjax> | |
| 326 | - <span class="title">{{module.name}}</span> | |
| 327 | - </a> | |
| 328 | - {{else}} | |
| 329 | - <a href="{{module.path}}" class="nav-link " data-angularjs> | |
| 330 | - <span class="title">{{module.name}}</span> | |
| 331 | - </a> | |
| 332 | - {{/if}} | |
| 333 | - </li> | |
| 334 | - {{/each}} | |
| 335 | - </ul> | |
| 336 | - </li> | |
| 337 | - {{/each}} | |
| 338 | - {{/each}} | |
| 339 | - | |
| 340 | -</script> | |
| 341 | -<script> | |
| 342 | - delete window.require; | |
| 343 | - delete window.exports; | |
| 344 | - delete window.module; | |
| 345 | -</script> | |
| 346 | -<!-- jQuery --> | |
| 347 | -<script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script> | |
| 348 | -<!-- bootstrap --> | |
| 349 | -<script src="/metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js" | |
| 350 | - data-exclude=1></script> | |
| 351 | -<script src="/pages/forms/statement/js/jquery.autocompleter.js"></script> | |
| 352 | -<script src="/pages/forms/statement/js/jquery.PrintArea.js"></script> | |
| 353 | -<!-- MTRONIC JS --> | |
| 354 | -<script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script> | |
| 355 | -<script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" | |
| 356 | - data-exclude=1></script> | |
| 357 | -<!-- 虚拟滚动条 --> | |
| 358 | -<script | |
| 359 | - src="/metronic_v4.5.4/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script> | |
| 360 | -<!-- jsTree 树插件 --> | |
| 361 | -<script src="/metronic_v4.5.4/plugins/jstree/dist/jstree.min.js"></script> | |
| 362 | -<!-- bootstrap-hover-dropDown --> | |
| 363 | -<script | |
| 364 | - src="/metronic_v4.5.4/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"></script> | |
| 365 | -<!-- jquery.validate 表单验证 --> | |
| 366 | -<script | |
| 367 | - src="/metronic_v4.5.4/plugins/jquery-validation/js/jquery.validate.min.js"></script> | |
| 368 | -<script | |
| 369 | - src="/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js"></script> | |
| 370 | -<!-- 向导式插件 --> | |
| 371 | -<script | |
| 372 | - src="/metronic_v4.5.4//plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script> | |
| 373 | -<!-- iCheck 单选框和复选框 --> | |
| 374 | -<script src="/metronic_v4.5.4/plugins/icheck/icheck.min.js"></script> | |
| 375 | -<!-- select2 下拉框 --> | |
| 376 | -<script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script> | |
| 377 | -<!-- MULTI SELECT 多选下拉框 --> | |
| 378 | -<script | |
| 379 | - src="/metronic_v4.5.4/plugins/jquery-multi-select/js/jquery.multi-select.js"></script> | |
| 380 | -<!-- editable.js --> | |
| 381 | -<script | |
| 382 | - src="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js"></script> | |
| 383 | -<!-- PJAX --> | |
| 384 | -<script src="/assets/plugins/jquery.pjax.js"></script> | |
| 385 | -<!-- layer 弹层 --> | |
| 386 | -<script src="/assets/plugins/layer-v2.4/layer/layer.js" data-exclude=1></script> | |
| 387 | -<!-- fileinput 上传 --> | |
| 388 | -<script src="/assets/plugins/fileinput/canvas-to-blob.min.js"></script> | |
| 389 | -<script src="/assets/plugins/fileinput/purify.min.js"></script> | |
| 390 | -<script src="/assets/plugins/fileinput/sortable.min.js"></script> | |
| 391 | -<script src="/assets/plugins/fileinput/fileinput.min.js"></script> | |
| 392 | -<script src="/assets/plugins/fileinput/fileinput_locale_zh.js"></script> | |
| 393 | -<!-- jquery.purl URL解析 --> | |
| 394 | -<script src="/assets/plugins/purl.js"></script> | |
| 395 | -<!-- jquery.serializejson JSON序列化插件 --> | |
| 396 | -<script src="/assets/plugins/jquery.serializejson.js"></script> | |
| 397 | -<!-- art-template 模版引擎 --> | |
| 398 | -<script src="/assets/plugins/template.js"></script> | |
| 399 | -<!-- jquery.pageinator 分页 --> | |
| 400 | -<script src="/assets/plugins/jqPaginator.min.js"></script> | |
| 401 | -<!-- moment.js 日期处理类库 --> | |
| 402 | -<script src="/assets/plugins/moment-with-locales.js"></script> | |
| 403 | - | |
| 404 | -<script src="/assets/plugins/pinyin.js"></script> | |
| 405 | -<!-- 日期控件 --> | |
| 406 | -<script | |
| 407 | - src="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/js/bootstrap-datetimepicker.min.js"></script> | |
| 408 | -<!-- 表格控件 --> | |
| 409 | -<script src="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script> | |
| 410 | -<!-- 统计图控件 --> | |
| 411 | -<!--<script src="/assets/global/getEchart.js"></script> | |
| 412 | -<script src="/assets/global/echarts.js"></script> --> | |
| 413 | -<script src="/assets/js/common.js"></script> | |
| 414 | -<script src="/assets/js/dictionary.js"></script> | |
| 415 | -<!-- tipso JS --> | |
| 416 | -<script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> | |
| 417 | -<script data-exclude=1> | |
| 418 | - //初始打开的片段地址 | |
| 419 | - var initFragment = "^_^initFragment^_^"; | |
| 420 | - //静态文件目录 | |
| 421 | - var dir = '/pages/'; | |
| 422 | - //片段容器 | |
| 423 | - var pjaxContainer = '#pjax-container' | |
| 424 | - , angJsContainer = '#route-container'; | |
| 425 | - | |
| 426 | - $(document).ajaxError(function (event, jqxhr, settings, thrownError) { | |
| 427 | - if(jqxhr.status == 403){ | |
| 428 | - layer.closeAll(); | |
| 429 | - layer.alert(jqxhr.message?jqxhr.message:'访问被拒绝', {icon: 2, title: '操作失败'}); | |
| 430 | - } | |
| 431 | - }); | |
| 432 | - | |
| 433 | - $(function () { | |
| 434 | - $.ajax({ | |
| 435 | - url: '/user/isWeakCipher', | |
| 436 | - type: 'POST', | |
| 437 | - async: false, | |
| 438 | - success: function (result,status,xhr) { | |
| 439 | - if (result.data == 1) { | |
| 440 | - $.get('/pages/permission/user/forceChangePWD.html', function (content) { | |
| 441 | - layer.open({ | |
| 442 | - type: 1, | |
| 443 | - area: ['600px', '360px'], | |
| 444 | - content: content, | |
| 445 | - title: '修改密码', | |
| 446 | - shift: 5, | |
| 447 | - scrollbar: false, | |
| 448 | - closeBtn: 0, | |
| 449 | - success: function () { | |
| 450 | - } | |
| 451 | - }); | |
| 452 | - }); | |
| 453 | - } | |
| 454 | - } | |
| 455 | - }); | |
| 456 | - | |
| 457 | - $.ajax({ | |
| 458 | - url: '/user/isRealName', | |
| 459 | - type: 'POST', | |
| 460 | - async: false, | |
| 461 | - success: function (result,status,xhr) { | |
| 462 | - if (result.data == 0) { | |
| 463 | - $.get('/pages/permission/user/jobCode.html', function (content) { | |
| 464 | - layer.open({ | |
| 465 | - type: 1, | |
| 466 | - area: ['600px', '360px'], | |
| 467 | - content: content, | |
| 468 | - title: '设置工号(后期统一登录平台接入)', | |
| 469 | - shift: 5, | |
| 470 | - scrollbar: false, | |
| 471 | - success: function () { | |
| 472 | - } | |
| 473 | - }); | |
| 474 | - }); | |
| 475 | - } | |
| 476 | - } | |
| 477 | - }); | |
| 478 | - | |
| 479 | - $.get('/user/currentUser', function (user) { | |
| 480 | - $('#indexTopUName').text(user.userName); | |
| 481 | - }); | |
| 482 | - | |
| 483 | - //带 data-pjax 的链接由pjax加载 | |
| 484 | - $(document).pjax('a[data-pjax]', pjaxContainer); | |
| 485 | - | |
| 486 | - //pjax左菜单点击事件 | |
| 487 | - $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () { | |
| 488 | - setTitle(this); | |
| 489 | - | |
| 490 | - $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 491 | - $(this).parent().addClass('active'); | |
| 492 | - showPjax(); | |
| 493 | - }); | |
| 494 | - | |
| 495 | - //angularjs左菜单点击事件 | |
| 496 | - $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () { | |
| 497 | - setTitle(this); | |
| 498 | - | |
| 499 | - $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 500 | - $(this).parent().addClass('active'); | |
| 501 | - showAngJs(); | |
| 502 | - }); | |
| 503 | - | |
| 504 | - //加载左菜单栏 | |
| 505 | - $get('/module/findByCurrentUser', null, | |
| 506 | - function (ms) { | |
| 507 | - var treeArray = createTreeData(ms); | |
| 508 | - treeArray.sort(function (a, b) { | |
| 509 | - return a.createDate - b.createDate; | |
| 510 | - }); | |
| 511 | - var menuHtml = template('menu_list_temp', {list: treeArray}); | |
| 512 | - $('#leftMenuSidebar').html(menuHtml); | |
| 513 | - | |
| 514 | - //----------- 检查URL ---------------- | |
| 515 | - var h = location.hash; | |
| 516 | - if (initFragment && initFragment != '') { | |
| 517 | - showPjax(); | |
| 518 | - //普通片段 | |
| 519 | - loadPage(initFragment); | |
| 520 | - //选中菜单 | |
| 521 | - $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 522 | - if (urlPattern($(item).attr('href'), initFragment)) { | |
| 523 | - activeLeftMenu(item); | |
| 524 | - } | |
| 525 | - }); | |
| 526 | - } else if (h) { | |
| 527 | - //angularjs片段 | |
| 528 | - showAngJs(); | |
| 529 | - //选中菜单 | |
| 530 | - $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 531 | - if ($(item).attr('href') == h) { | |
| 532 | - activeLeftMenu(item); | |
| 533 | - } | |
| 534 | - }); | |
| 535 | - } | |
| 536 | - else { | |
| 537 | - //加载主页 | |
| 538 | - loadPage('/pages/home.html'); | |
| 539 | - } | |
| 540 | - }); | |
| 541 | - | |
| 542 | - //修改密码 | |
| 543 | - $('#changePWD').on('click', function () { | |
| 544 | - $.get('/pages/permission/user/changePWD.html', function (content) { | |
| 545 | - layer.open({ | |
| 546 | - type: 1, | |
| 547 | - area: ['600px', '360px'], | |
| 548 | - content: content, | |
| 549 | - title: '修改密码', | |
| 550 | - shift: 5, | |
| 551 | - scrollbar: false, | |
| 552 | - success: function () { | |
| 553 | - } | |
| 554 | - }); | |
| 555 | - }); | |
| 556 | - }); | |
| 557 | - }); | |
| 558 | - | |
| 559 | - //modal关闭时销毁dom | |
| 560 | - $(document).on('hidden.bs.modal', '.modal', function () { | |
| 561 | - $(this).remove(); | |
| 562 | - }); | |
| 563 | - | |
| 564 | - //pjax加载完成事件 | |
| 565 | - $(document).on('pjax:success', function () { | |
| 566 | - var dicts = $(pjaxContainer).find('.nt-dictionary'); | |
| 567 | - dictionaryUtils.transformDom(dicts); | |
| 568 | - }); | |
| 569 | - | |
| 570 | - function loadPage(url) { | |
| 571 | - $.pjax({url: url, container: pjaxContainer}) | |
| 572 | - } | |
| 573 | - | |
| 574 | - function urlPattern(a, b) { | |
| 575 | - var r; | |
| 576 | - try { | |
| 577 | - r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/')); | |
| 578 | - } catch (e) { | |
| 579 | - r = false; | |
| 580 | - } | |
| 581 | - return r; | |
| 582 | - } | |
| 583 | - | |
| 584 | - function showPjax() { | |
| 585 | - $(angJsContainer).removeClass('page-content active').hide(); | |
| 586 | - $(pjaxContainer).addClass('page-content active'); | |
| 587 | - } | |
| 588 | - | |
| 589 | - function showAngJs() { | |
| 590 | - $(pjaxContainer).html('').removeClass('page-content active').hide(); | |
| 591 | - $(angJsContainer).addClass('page-content active'); | |
| 592 | - } | |
| 593 | - | |
| 594 | - function activeLeftMenu(item) { | |
| 595 | - $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open'); | |
| 596 | - setTitle(item); | |
| 597 | - } | |
| 598 | - | |
| 599 | - function setTitle(menuItem){ | |
| 600 | - document.title = $('span.title', menuItem).text(); | |
| 601 | - } | |
| 602 | - | |
| 603 | -</script> | |
| 604 | -<!-- d3 --> | |
| 605 | -<script src="/assets/js/d3.min.js" data-exclude=1></script> | |
| 606 | -<!-- webSocket JS --> | |
| 607 | -<script src="/assets/js/sockjs.min.js"></script> | |
| 608 | - | |
| 609 | -<!-- TODO:angularJS相关库 --> | |
| 610 | - | |
| 611 | -<!-- angularJS相关库 --> | |
| 612 | -<!-- 这个是基于angularjs 1.4.10修改的版本,主要是修改了history控制部分,用于兼容route和pjax的同时操作history的冲突 --> | |
| 613 | -<script src="/assets/js/angular.js" data-autocephaly=1></script> | |
| 614 | -<script src="/assets/bower_components/angular-i18n/angular-locale_zh-cn.js" data-autocephaly=1></script> | |
| 615 | -<script | |
| 616 | - src="/assets/bower_components/angular-resource/angular-resource.min.js" | |
| 617 | - data-exclude=1></script> | |
| 618 | -<script | |
| 619 | - src="/assets/bower_components/angular-sanitize/angular-sanitize.min.js" | |
| 620 | - data-exclude=1></script> | |
| 621 | -<script | |
| 622 | - src="/assets/bower_components/angular-animate/angular-animate.min.js" | |
| 623 | - data-exclude=1></script> | |
| 624 | -<script | |
| 625 | - src="/assets/bower_components/angular-touch/angular-touch.min.js" | |
| 626 | - data-exclude=1></script> | |
| 627 | -<script | |
| 628 | - src="/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js" | |
| 629 | - data-exclude=1></script> | |
| 630 | -<script | |
| 631 | - src="/assets/bower_components/oclazyload/dist/ocLazyLoad.min.js" | |
| 632 | - data-exclude=1></script> | |
| 633 | -<script | |
| 634 | - src="/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js" | |
| 635 | - data-exclude=1></script> | |
| 636 | -<!-- handsontable相关js --> | |
| 637 | -<script | |
| 638 | - src="/assets/bower_components/handsontable/dist/handsontable.full.js"></script> | |
| 639 | -<script | |
| 640 | - src="/assets/bower_components/ngHandsontable/dist/ngHandsontable.js"></script> | |
| 641 | -<!-- sweetalert相关js --> | |
| 642 | -<script src="/assets/bower_components/sweetalert/dist/sweetalert.min.js"></script> | |
| 643 | -<script src="/assets/bower_components/ng-sweet-alert/ng-sweet-alert.js"></script> | |
| 644 | - | |
| 645 | -<!-- schedule计划调度AngularJS模块主JS --> | |
| 646 | -<script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script> | |
| 647 | -<script | |
| 648 | - src="/pages/scheduleApp/module/common/prj-common-globalservice.js" | |
| 649 | - data-exclude=1></script> | |
| 650 | -<script src="/pages/scheduleApp/module/common/prj-common-filter.js" | |
| 651 | - data-exclude=1></script> | |
| 652 | -<script src="/pages/scheduleApp/module/common/prj-common-directive.js" | |
| 653 | - data-exclude=1></script> | |
| 654 | -<script | |
| 655 | - src="/pages/scheduleApp/module/common/prj-common-ui-route-state.js" | |
| 656 | - data-exclude=1></script> | |
| 657 | - | |
| 658 | -<!-- 地图相关 --> | |
| 659 | -<!-- 百度 --> | |
| 660 | -<script | |
| 661 | - src="//api.map.baidu.com/api?v=3.0&ak=IGGrr4UjwIYzatoCRFKEL8sT" | |
| 662 | - data-exclude=1></script> | |
| 663 | -<script | |
| 664 | - src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" | |
| 665 | - data-exclude=1></script> | |
| 666 | -<script type="text/javascript" | |
| 667 | - src="//api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" | |
| 668 | - data-exclude=1></script> | |
| 669 | -<script type="text/javascript" | |
| 670 | - src="//api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js " | |
| 671 | - data-exclude=1></script> | |
| 672 | -<script src="/assets/js/baidu/TextIconOverlay.js" data-exclude=1></script> | |
| 673 | -<script src="/assets/js/baidu//MarkerClusterer.js" data-exclude=1></script> | |
| 674 | -<!-- 高德 --> | |
| 675 | -<script | |
| 676 | - src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" | |
| 677 | - data-exclude=1></script> | |
| 678 | -<!-- echarts4 --> | |
| 679 | -<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | |
| 680 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 681 | -<!-- RSA加密 --> | |
| 682 | -<script src="/assets/plugins/jsencrypt.min.js"></script> | |
| 683 | -<script src="/assets/js/eventproxy.js"></script> | |
| 684 | -<!-- 线路路由信息操作 --> | |
| 685 | -<script src="/pages/base/stationroute/js/routes-operation.js"></script> | |
| 686 | -<script src="/pages/base/stationroute/js/routes-service.js"></script> | |
| 687 | -<script src="/assets/js/CoordinateConverter.js"></script> | |
| 688 | -</body> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html lang="zh"> | |
| 3 | +<head> | |
| 4 | + <meta name="renderer" content="webkit" /> | |
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | |
| 6 | + <meta charset="UTF-8"> | |
| 7 | + <title>调度系统</title> | |
| 8 | + | |
| 9 | + <meta http-equiv="Pragma" content="no-cache"> | |
| 10 | + <meta http-equiv="Cache-control" content="no-cache"> | |
| 11 | + <meta http-equiv="Cache" content="no-cache"> | |
| 12 | + | |
| 13 | + <!-- Font Awesome 图标字体 --> | |
| 14 | + <link | |
| 15 | + href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css" | |
| 16 | + rel="stylesheet" type="text/css" /> | |
| 17 | + <!-- Bootstrap style --> | |
| 18 | + <link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css" | |
| 19 | + rel="stylesheet" type="text/css" /> | |
| 20 | + <!-- jsTree 数插件 --> | |
| 21 | + <link | |
| 22 | + href="/metronic_v4.5.4/plugins/jstree/dist/themes/default/style.min.css" | |
| 23 | + rel="stylesheet" type="text/css" /> | |
| 24 | + <!-- MULTI-select 多选下拉框美化 --> | |
| 25 | + <link | |
| 26 | + href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" | |
| 27 | + rel="stylesheet" type="text/css" /> | |
| 28 | + | |
| 29 | + <!-- editable --> | |
| 30 | + <link | |
| 31 | + href="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css" | |
| 32 | + rel="stylesheet" type="text/css" /> | |
| 33 | + <!-- METRONIC style --> | |
| 34 | + <link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" | |
| 35 | + rel="stylesheet" type="text/css" id="style_color" /> | |
| 36 | + <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" | |
| 37 | + type="text/css" /> | |
| 38 | + <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" | |
| 39 | + type="text/css" /> | |
| 40 | + <link href="/metronic_v4.5.4/layout4/css/layout.min.css" | |
| 41 | + rel="stylesheet" type="text/css" /> | |
| 42 | + <link href="/metronic_v4.5.4/layout4/css/custom.min.css" | |
| 43 | + rel="stylesheet" type="text/css" /> | |
| 44 | + <!-- select2 下拉框插件 --> | |
| 45 | + <link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" | |
| 46 | + rel="stylesheet" type="text/css" /> | |
| 47 | + <link | |
| 48 | + href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" | |
| 49 | + rel="stylesheet" type="text/css" /> | |
| 50 | + <!-- layer 弹层 插件 --> | |
| 51 | + <link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" | |
| 52 | + rel="stylesheet" type="text/css" /> | |
| 53 | + <!-- fileinput 上传 插件 --> | |
| 54 | + <link href="/assets/plugins/fileinput/css/fileinput.min.css" | |
| 55 | + rel="stylesheet" type="text/css" /> | |
| 56 | + <!-- iCheck 单选框和复选框 --> | |
| 57 | + <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" | |
| 58 | + rel="stylesheet" type="text/css" /> | |
| 59 | + <!-- 日期控件 --> | |
| 60 | + <link | |
| 61 | + href="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/css/bootstrap-datetimepicker.min.css" | |
| 62 | + rel="stylesheet" type="text/css" /> | |
| 63 | + <!-- table 表格控件 --> | |
| 64 | + <!--<link rel="stylesheet"--> | |
| 65 | + <!--href="//api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"--> | |
| 66 | + <!--type="text/css" />--> | |
| 67 | + <link href="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet" type="text/css"/> | |
| 68 | + <!-- handsontable样式 --> | |
| 69 | + <link rel="stylesheet" | |
| 70 | + href="/assets/bower_components/handsontable/dist/handsontable.full.css" /> | |
| 71 | + <!-- sweetalert样式 --> | |
| 72 | + <link rel="stylesheet" | |
| 73 | + href="/assets/bower_components/sweetalert/dist/sweetalert.css" /> | |
| 74 | + <!-- schedule计划调度AngularJS模块主css --> | |
| 75 | + <link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" | |
| 76 | + type="text/css" /> | |
| 77 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 78 | + | |
| 79 | + <!-- CSS动画 --> | |
| 80 | + <link | |
| 81 | + href="/metronic_v4.5.4/plugins/tipso/css/animate.css" | |
| 82 | + rel="stylesheet" type="text/css" /> | |
| 83 | + | |
| 84 | + <!-- 提示工具样式 --> | |
| 85 | + <link | |
| 86 | + href="/metronic_v4.5.4/plugins/tipso/css/tipso.css" | |
| 87 | + rel="stylesheet" type="text/css" /> | |
| 88 | + | |
| 89 | + <style type="text/css"> | |
| 90 | + .searchForm { | |
| 91 | + | |
| 92 | + } | |
| 93 | + | |
| 94 | + .searchForm .form-group .control-label { | |
| 95 | + padding-right: 0px; | |
| 96 | + text-align: right; | |
| 97 | + margin-top: 7px; | |
| 98 | + } | |
| 99 | + | |
| 100 | + .searchForm .form-group>div { | |
| 101 | + padding-left: 10px; | |
| 102 | + padding-right: 0px; | |
| 103 | + } | |
| 104 | + | |
| 105 | + .searchForm .row>div { | |
| 106 | + padding-left: 0px; | |
| 107 | + padding-right: 0px; | |
| 108 | + padding: 5px 0 5px 0; | |
| 109 | + width: 270px; | |
| 110 | + display: inline-block; | |
| 111 | + } | |
| 112 | + | |
| 113 | + .searchForm .form-actions { | |
| 114 | + | |
| 115 | + } | |
| 116 | + | |
| 117 | + tr.row-active td { | |
| 118 | + border-bottom: 1px solid blue !important; | |
| 119 | + color: blue; | |
| 120 | + } | |
| 121 | + | |
| 122 | + .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | |
| 123 | + { | |
| 124 | + font-size: 14px; | |
| 125 | + } | |
| 126 | + | |
| 127 | + .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | |
| 128 | + { | |
| 129 | + padding: 6px 26px; | |
| 130 | + } | |
| 131 | + | |
| 132 | + .ms-container .ms-list { | |
| 133 | + height: 306px; | |
| 134 | + } | |
| 135 | + | |
| 136 | + .ms-container .ms-selectable,.ms-container .ms-selection { | |
| 137 | + width: 47%; | |
| 138 | + } | |
| 139 | + | |
| 140 | + .ms-container { | |
| 141 | + width: 470px; | |
| 142 | + margin: auto; | |
| 143 | + } | |
| 144 | + | |
| 145 | + .multi-custom-header-left { | |
| 146 | + text-align: center; | |
| 147 | + padding: 7px; | |
| 148 | + color: #3B3F51; | |
| 149 | + } | |
| 150 | + | |
| 151 | + .multi-custom-header-right { | |
| 152 | + text-align: center; | |
| 153 | + padding: 7px; | |
| 154 | + font-weight: bold; | |
| 155 | + color: #36C6D3; | |
| 156 | + } | |
| 157 | + | |
| 158 | + .mt-element-list .list-simple.mt-list-container ul>.mt-list-item>.list-item-content | |
| 159 | + { | |
| 160 | + padding: 0 55px 0 0px; | |
| 161 | + } | |
| 162 | + | |
| 163 | + .mt-element-list .list-simple.mt-list-container ul>.mt-list-item { | |
| 164 | + padding: 3.3px 0; | |
| 165 | + } | |
| 166 | + | |
| 167 | + #route-container { | |
| 168 | + display: none; | |
| 169 | + } | |
| 170 | + | |
| 171 | + .page-content.active { | |
| 172 | + display: block !important; | |
| 173 | + } | |
| 174 | + | |
| 175 | + .page-header.navbar .page-logo .logo-default { | |
| 176 | + margin: 0; | |
| 177 | + } | |
| 178 | + | |
| 179 | + .page-header.navbar .top-menu .navbar-nav>li.dropdown.open .dropdown-toggle | |
| 180 | + { | |
| 181 | + background-color: #284a99; | |
| 182 | + } | |
| 183 | + | |
| 184 | + .page-header.navbar .page-logo { | |
| 185 | + padding-right: 10px; | |
| 186 | + } | |
| 187 | + | |
| 188 | + .page-logo .logo-default.logo-default-text { | |
| 189 | + font-weight: 600; | |
| 190 | + color: white !important; | |
| 191 | + margin-top: 19px !important; | |
| 192 | + font-size: 24px; | |
| 193 | + text-decoration: none; | |
| 194 | + } | |
| 195 | + | |
| 196 | + .page-logo .logo-default.logo-default-text:HOVER { | |
| 197 | + color: #dedede !important; | |
| 198 | + } | |
| 199 | + | |
| 200 | + body,.page-content-wrapper,#pjax-container{ | |
| 201 | + height: 100%; | |
| 202 | + } | |
| 203 | + html{ | |
| 204 | + height: 90%; | |
| 205 | + } | |
| 206 | + .page-container{ | |
| 207 | + height: 100%; | |
| 208 | + } | |
| 209 | + </style> | |
| 210 | + | |
| 211 | + <!-- ocLazyLoading载入文件的位置 --> | |
| 212 | + <link id="ng_load_plugins_before" /> | |
| 213 | + | |
| 214 | +</head> | |
| 215 | +<body | |
| 216 | + class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo page-sidebar-fixed"> | |
| 217 | +<div class="page-header navbar navbar-fixed-top" | |
| 218 | + style="background: linear-gradient(to bottom, #124e78, #125688);"> | |
| 219 | + <div class="page-header-inner "> | |
| 220 | + <!-- LOGO --> | |
| 221 | + <div class="page-logo"> | |
| 222 | + <a href="index.html" class="logo-default logo-default-text"> | |
| 223 | + 浦东公交调度系统 </a> | |
| 224 | + <div class="menu-toggler sidebar-toggler"></div> | |
| 225 | + </div> | |
| 226 | + <!-- END LOGO --> | |
| 227 | + <a href="javascript:;" class="menu-toggler responsive-toggler" | |
| 228 | + data-toggle="collapse" data-target=".navbar-collapse"> </a> | |
| 229 | + <div class="page-top"> | |
| 230 | + <div class="top-menu"> | |
| 231 | + <ul class="nav navbar-nav pull-right"> | |
| 232 | + <!-- 信息通知区 --> | |
| 233 | + <li | |
| 234 | + class="dropdown dropdown-extended dropdown-notification dropdown-dark" | |
| 235 | + id="header_notification_bar"><a href="javascript:;" | |
| 236 | + class="dropdown-toggle" data-toggle="dropdown" | |
| 237 | + data-hover="dropdown" data-close-others="true"> <i | |
| 238 | + class="fa fa-bell"></i> <span class="badge badge-success"> | |
| 239 | + 0 </span> | |
| 240 | + </a> | |
| 241 | + <ul class="dropdown-menu" style="max-width: 345px; width: 345px;"> | |
| 242 | + <li class="external"> | |
| 243 | + <h3> | |
| 244 | + 今日 <span class="bold">0 条</span> 通知 | |
| 245 | + </h3> <a href="javascript:;">查看全部</a> | |
| 246 | + </li> | |
| 247 | + <li> | |
| 248 | + <ul class="dropdown-menu-list scroller" style="height: 250px;" | |
| 249 | + data-handle-color="#637283"> | |
| 250 | + </ul> | |
| 251 | + </li> | |
| 252 | + </ul></li> | |
| 253 | + <li class="dropdown dropdown-user dropdown-dark"><a | |
| 254 | + href="javascript:;" class="dropdown-toggle" | |
| 255 | + data-toggle="dropdown" data-hover="dropdown" | |
| 256 | + data-close-others="true"> <span id="indexTopUName" | |
| 257 | + class="username username-hide-on-mobile" | |
| 258 | + style="vertical-align: middle;"> <i class="fa fa-user"></i></span> | |
| 259 | + </a> | |
| 260 | + <ul class="dropdown-menu dropdown-menu-default"> | |
| 261 | + <li><a href="javascript:;"> <i class="fa fa-user"></i> | |
| 262 | + 我的信息 | |
| 263 | + </a></li> | |
| 264 | + <li><a href="javascript:;" id="changePWD"> <i | |
| 265 | + class="fa fa-unlock-alt"></i> 修改密码 | |
| 266 | + </a></li> | |
| 267 | + <li class="divider"></li> | |
| 268 | + <li><a href="javascript:;"> <i class="fa fa-lock"></i> | |
| 269 | + 锁屏 | |
| 270 | + </a></li> | |
| 271 | + <li><a href="/logout"> <i class="fa fa-key"></i> 注销登陆 | |
| 272 | + </a></li> | |
| 273 | + </ul></li> | |
| 274 | + </ul> | |
| 275 | + </div> | |
| 276 | + </div> | |
| 277 | + </div> | |
| 278 | +</div> | |
| 279 | +<div class="page-container"> | |
| 280 | + <div class="page-sidebar-wrapper"> | |
| 281 | + <div class="page-sidebar navbar-collapse collapse"> | |
| 282 | + <ul class="page-sidebar-menu page-sidebar-menu-fixed" | |
| 283 | + data-keep-expanded="false" data-auto-scroll="true" | |
| 284 | + data-slide-speed="200" id="leftMenuSidebar"> | |
| 285 | + </ul> | |
| 286 | + </div> | |
| 287 | + </div> | |
| 288 | + <div class="page-content-wrapper"> | |
| 289 | + <div id="pjax-container" class="page-content"></div> | |
| 290 | + | |
| 291 | + <div id="route-container"> | |
| 292 | + <div ng-app="ScheduleApp"> | |
| 293 | + <div ng-controller="ScheduleAppController"> | |
| 294 | + | |
| 295 | + <!-- loading widget --> | |
| 296 | + <div id="loadingWidget" class="flyover mask" loading-widget> | |
| 297 | + <div class="alert alert-info"> | |
| 298 | + <strong>载入中......</strong> | |
| 299 | + </div> | |
| 300 | + </div> | |
| 301 | + | |
| 302 | + <div ui-view class="uv"></div> | |
| 303 | + </div> | |
| 304 | + </div> | |
| 305 | + </div> | |
| 306 | + </div> | |
| 307 | +</div> | |
| 308 | + | |
| 309 | +<script id="menu_list_temp" type="text/html"> | |
| 310 | + {{each list as group i}} | |
| 311 | + <li class="heading"> | |
| 312 | + <h3 class="uppercase">{{group.name}}</h3> | |
| 313 | + </li> | |
| 314 | + {{each group.children as dir j}} | |
| 315 | + <li class="nav-item"> | |
| 316 | + <a href="javascript:;" class="nav-link nav-toggle "> | |
| 317 | + <i class="{{dir.icon}}"></i> | |
| 318 | + <span class="title">{{dir.name}}</span> | |
| 319 | + <span class="arrow"></span> | |
| 320 | + </a> | |
| 321 | + <ul class="sub-menu"> | |
| 322 | + {{each dir.children as module s}} | |
| 323 | + <li class="nav-item "> | |
| 324 | + {{if module.container=="pjax-container"}} | |
| 325 | + <a href="/pages/{{module.path}}" class="nav-link " data-pjax> | |
| 326 | + <span class="title">{{module.name}}</span> | |
| 327 | + </a> | |
| 328 | + {{else}} | |
| 329 | + <a href="{{module.path}}" class="nav-link " data-angularjs> | |
| 330 | + <span class="title">{{module.name}}</span> | |
| 331 | + </a> | |
| 332 | + {{/if}} | |
| 333 | + </li> | |
| 334 | + {{/each}} | |
| 335 | + </ul> | |
| 336 | + </li> | |
| 337 | + {{/each}} | |
| 338 | + {{/each}} | |
| 339 | + | |
| 340 | +</script> | |
| 341 | +<script> | |
| 342 | + delete window.require; | |
| 343 | + delete window.exports; | |
| 344 | + delete window.module; | |
| 345 | +</script> | |
| 346 | +<!-- jQuery --> | |
| 347 | +<script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script> | |
| 348 | +<!-- bootstrap --> | |
| 349 | +<script src="/metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js" | |
| 350 | + data-exclude=1></script> | |
| 351 | +<script src="/pages/forms/statement/js/jquery.autocompleter.js"></script> | |
| 352 | +<script src="/pages/forms/statement/js/jquery.PrintArea.js"></script> | |
| 353 | +<!-- MTRONIC JS --> | |
| 354 | +<script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script> | |
| 355 | +<script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" | |
| 356 | + data-exclude=1></script> | |
| 357 | +<!-- 虚拟滚动条 --> | |
| 358 | +<script | |
| 359 | + src="/metronic_v4.5.4/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script> | |
| 360 | +<!-- jsTree 树插件 --> | |
| 361 | +<script src="/metronic_v4.5.4/plugins/jstree/dist/jstree.min.js"></script> | |
| 362 | +<!-- bootstrap-hover-dropDown --> | |
| 363 | +<script | |
| 364 | + src="/metronic_v4.5.4/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"></script> | |
| 365 | +<!-- jquery.validate 表单验证 --> | |
| 366 | +<script | |
| 367 | + src="/metronic_v4.5.4/plugins/jquery-validation/js/jquery.validate.min.js"></script> | |
| 368 | +<script | |
| 369 | + src="/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js"></script> | |
| 370 | +<!-- 向导式插件 --> | |
| 371 | +<script | |
| 372 | + src="/metronic_v4.5.4//plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script> | |
| 373 | +<!-- iCheck 单选框和复选框 --> | |
| 374 | +<script src="/metronic_v4.5.4/plugins/icheck/icheck.min.js"></script> | |
| 375 | +<!-- select2 下拉框 --> | |
| 376 | +<script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script> | |
| 377 | +<!-- MULTI SELECT 多选下拉框 --> | |
| 378 | +<script | |
| 379 | + src="/metronic_v4.5.4/plugins/jquery-multi-select/js/jquery.multi-select.js"></script> | |
| 380 | +<!-- editable.js --> | |
| 381 | +<script | |
| 382 | + src="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js"></script> | |
| 383 | +<!-- PJAX --> | |
| 384 | +<script src="/assets/plugins/jquery.pjax.js"></script> | |
| 385 | +<!-- layer 弹层 --> | |
| 386 | +<script src="/assets/plugins/layer-v2.4/layer/layer.js" data-exclude=1></script> | |
| 387 | +<!-- fileinput 上传 --> | |
| 388 | +<script src="/assets/plugins/fileinput/canvas-to-blob.min.js"></script> | |
| 389 | +<script src="/assets/plugins/fileinput/purify.min.js"></script> | |
| 390 | +<script src="/assets/plugins/fileinput/sortable.min.js"></script> | |
| 391 | +<script src="/assets/plugins/fileinput/fileinput.min.js"></script> | |
| 392 | +<script src="/assets/plugins/fileinput/fileinput_locale_zh.js"></script> | |
| 393 | +<!-- jquery.purl URL解析 --> | |
| 394 | +<script src="/assets/plugins/purl.js"></script> | |
| 395 | +<!-- jquery.serializejson JSON序列化插件 --> | |
| 396 | +<script src="/assets/plugins/jquery.serializejson.js"></script> | |
| 397 | +<!-- art-template 模版引擎 --> | |
| 398 | +<script src="/assets/plugins/template.js"></script> | |
| 399 | +<!-- jquery.pageinator 分页 --> | |
| 400 | +<script src="/assets/plugins/jqPaginator.min.js"></script> | |
| 401 | +<!-- moment.js 日期处理类库 --> | |
| 402 | +<script src="/assets/plugins/moment-with-locales.js"></script> | |
| 403 | + | |
| 404 | +<script src="/assets/plugins/pinyin.js"></script> | |
| 405 | +<!-- 日期控件 --> | |
| 406 | +<script | |
| 407 | + src="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/js/bootstrap-datetimepicker.min.js"></script> | |
| 408 | +<!-- 表格控件 --> | |
| 409 | +<script src="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script> | |
| 410 | +<!-- 统计图控件 --> | |
| 411 | +<!--<script src="/assets/global/getEchart.js"></script> | |
| 412 | +<script src="/assets/global/echarts.js"></script> --> | |
| 413 | +<script src="/assets/js/common.js"></script> | |
| 414 | +<script src="/assets/js/dictionary.js"></script> | |
| 415 | +<!-- tipso JS --> | |
| 416 | +<script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> | |
| 417 | +<script data-exclude=1> | |
| 418 | + //初始打开的片段地址 | |
| 419 | + var initFragment = "^_^initFragment^_^"; | |
| 420 | + //静态文件目录 | |
| 421 | + var dir = '/pages/'; | |
| 422 | + //片段容器 | |
| 423 | + var pjaxContainer = '#pjax-container' | |
| 424 | + , angJsContainer = '#route-container'; | |
| 425 | + | |
| 426 | + $(document).ajaxError(function (event, jqxhr, settings, thrownError) { | |
| 427 | + if(jqxhr.status == 403){ | |
| 428 | + layer.closeAll(); | |
| 429 | + layer.alert(jqxhr.message?jqxhr.message:'访问被拒绝', {icon: 2, title: '操作失败'}); | |
| 430 | + } | |
| 431 | + }); | |
| 432 | + | |
| 433 | + $(function () { | |
| 434 | + $.ajax({ | |
| 435 | + url: '/user/isWeakCipher', | |
| 436 | + type: 'POST', | |
| 437 | + async: false, | |
| 438 | + success: function (result,status,xhr) { | |
| 439 | + if (result.data == 1) { | |
| 440 | + $.get('/pages/permission/user/forceChangePWD.html', function (content) { | |
| 441 | + layer.open({ | |
| 442 | + type: 1, | |
| 443 | + area: ['600px', '360px'], | |
| 444 | + content: content, | |
| 445 | + title: '修改密码', | |
| 446 | + shift: 5, | |
| 447 | + scrollbar: false, | |
| 448 | + closeBtn: 0, | |
| 449 | + success: function () { | |
| 450 | + } | |
| 451 | + }); | |
| 452 | + }); | |
| 453 | + } | |
| 454 | + } | |
| 455 | + }); | |
| 456 | + | |
| 457 | + $.ajax({ | |
| 458 | + url: '/user/isRealName', | |
| 459 | + type: 'POST', | |
| 460 | + async: false, | |
| 461 | + success: function (result,status,xhr) { | |
| 462 | + if (result.data == 0) { | |
| 463 | + $.get('/pages/permission/user/jobCode.html', function (content) { | |
| 464 | + layer.open({ | |
| 465 | + type: 1, | |
| 466 | + area: ['600px', '360px'], | |
| 467 | + content: content, | |
| 468 | + title: '设置工号(后期统一登录平台接入)', | |
| 469 | + shift: 5, | |
| 470 | + scrollbar: false, | |
| 471 | + success: function () { | |
| 472 | + } | |
| 473 | + }); | |
| 474 | + }); | |
| 475 | + } | |
| 476 | + } | |
| 477 | + }); | |
| 478 | + | |
| 479 | + $.get('/user/currentUser', function (user) { | |
| 480 | + $('#indexTopUName').text(user.userName); | |
| 481 | + }); | |
| 482 | + | |
| 483 | + //带 data-pjax 的链接由pjax加载 | |
| 484 | + $(document).pjax('a[data-pjax]', pjaxContainer); | |
| 485 | + | |
| 486 | + //pjax左菜单点击事件 | |
| 487 | + $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () { | |
| 488 | + setTitle(this); | |
| 489 | + | |
| 490 | + $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 491 | + $(this).parent().addClass('active'); | |
| 492 | + showPjax(); | |
| 493 | + }); | |
| 494 | + | |
| 495 | + //angularjs左菜单点击事件 | |
| 496 | + $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () { | |
| 497 | + setTitle(this); | |
| 498 | + | |
| 499 | + $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 500 | + $(this).parent().addClass('active'); | |
| 501 | + showAngJs(); | |
| 502 | + }); | |
| 503 | + | |
| 504 | + //加载左菜单栏 | |
| 505 | + $get('/module/findByCurrentUser', null, | |
| 506 | + function (ms) { | |
| 507 | + var treeArray = createTreeData(ms); | |
| 508 | + treeArray.sort(function (a, b) { | |
| 509 | + return a.createDate - b.createDate; | |
| 510 | + }); | |
| 511 | + var menuHtml = template('menu_list_temp', {list: treeArray}); | |
| 512 | + $('#leftMenuSidebar').html(menuHtml); | |
| 513 | + | |
| 514 | + //----------- 检查URL ---------------- | |
| 515 | + var h = location.hash; | |
| 516 | + if (initFragment && initFragment != '') { | |
| 517 | + showPjax(); | |
| 518 | + //普通片段 | |
| 519 | + loadPage(initFragment); | |
| 520 | + //选中菜单 | |
| 521 | + $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 522 | + if (urlPattern($(item).attr('href'), initFragment)) { | |
| 523 | + activeLeftMenu(item); | |
| 524 | + } | |
| 525 | + }); | |
| 526 | + } else if (h) { | |
| 527 | + //angularjs片段 | |
| 528 | + showAngJs(); | |
| 529 | + //选中菜单 | |
| 530 | + $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 531 | + if ($(item).attr('href') == h) { | |
| 532 | + activeLeftMenu(item); | |
| 533 | + } | |
| 534 | + }); | |
| 535 | + } | |
| 536 | + else { | |
| 537 | + //加载主页 | |
| 538 | + loadPage('/pages/home.html'); | |
| 539 | + } | |
| 540 | + }); | |
| 541 | + | |
| 542 | + //修改密码 | |
| 543 | + $('#changePWD').on('click', function () { | |
| 544 | + $.get('/pages/permission/user/changePWD.html', function (content) { | |
| 545 | + layer.open({ | |
| 546 | + type: 1, | |
| 547 | + area: ['600px', '360px'], | |
| 548 | + content: content, | |
| 549 | + title: '修改密码', | |
| 550 | + shift: 5, | |
| 551 | + scrollbar: false, | |
| 552 | + success: function () { | |
| 553 | + } | |
| 554 | + }); | |
| 555 | + }); | |
| 556 | + }); | |
| 557 | + }); | |
| 558 | + | |
| 559 | + //modal关闭时销毁dom | |
| 560 | + $(document).on('hidden.bs.modal', '.modal', function () { | |
| 561 | + $(this).remove(); | |
| 562 | + }); | |
| 563 | + | |
| 564 | + //pjax加载完成事件 | |
| 565 | + $(document).on('pjax:success', function () { | |
| 566 | + var dicts = $(pjaxContainer).find('.nt-dictionary'); | |
| 567 | + dictionaryUtils.transformDom(dicts); | |
| 568 | + }); | |
| 569 | + | |
| 570 | + function loadPage(url) { | |
| 571 | + $.pjax({url: url, container: pjaxContainer}) | |
| 572 | + } | |
| 573 | + | |
| 574 | + function urlPattern(a, b) { | |
| 575 | + var r; | |
| 576 | + try { | |
| 577 | + r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/')); | |
| 578 | + } catch (e) { | |
| 579 | + r = false; | |
| 580 | + } | |
| 581 | + return r; | |
| 582 | + } | |
| 583 | + | |
| 584 | + function showPjax() { | |
| 585 | + $(angJsContainer).removeClass('page-content active').hide(); | |
| 586 | + $(pjaxContainer).addClass('page-content active'); | |
| 587 | + } | |
| 588 | + | |
| 589 | + function showAngJs() { | |
| 590 | + $(pjaxContainer).html('').removeClass('page-content active').hide(); | |
| 591 | + $(angJsContainer).addClass('page-content active'); | |
| 592 | + } | |
| 593 | + | |
| 594 | + function activeLeftMenu(item) { | |
| 595 | + $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open'); | |
| 596 | + setTitle(item); | |
| 597 | + } | |
| 598 | + | |
| 599 | + function setTitle(menuItem){ | |
| 600 | + document.title = $('span.title', menuItem).text(); | |
| 601 | + } | |
| 602 | + | |
| 603 | +</script> | |
| 604 | +<!-- d3 --> | |
| 605 | +<script src="/assets/js/d3.min.js" data-exclude=1></script> | |
| 606 | +<!-- webSocket JS --> | |
| 607 | +<script src="/assets/js/sockjs.min.js"></script> | |
| 608 | + | |
| 609 | +<!-- TODO:angularJS相关库 --> | |
| 610 | + | |
| 611 | +<!-- angularJS相关库 --> | |
| 612 | +<!-- 这个是基于angularjs 1.4.10修改的版本,主要是修改了history控制部分,用于兼容route和pjax的同时操作history的冲突 --> | |
| 613 | +<script src="/assets/js/angular.js" data-autocephaly=1></script> | |
| 614 | +<script src="/assets/bower_components/angular-i18n/angular-locale_zh-cn.js" data-autocephaly=1></script> | |
| 615 | +<script | |
| 616 | + src="/assets/bower_components/angular-resource/angular-resource.min.js" | |
| 617 | + data-exclude=1></script> | |
| 618 | +<script | |
| 619 | + src="/assets/bower_components/angular-sanitize/angular-sanitize.min.js" | |
| 620 | + data-exclude=1></script> | |
| 621 | +<script | |
| 622 | + src="/assets/bower_components/angular-animate/angular-animate.min.js" | |
| 623 | + data-exclude=1></script> | |
| 624 | +<script | |
| 625 | + src="/assets/bower_components/angular-touch/angular-touch.min.js" | |
| 626 | + data-exclude=1></script> | |
| 627 | +<script | |
| 628 | + src="/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js" | |
| 629 | + data-exclude=1></script> | |
| 630 | +<script | |
| 631 | + src="/assets/bower_components/oclazyload/dist/ocLazyLoad.min.js" | |
| 632 | + data-exclude=1></script> | |
| 633 | +<script | |
| 634 | + src="/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js" | |
| 635 | + data-exclude=1></script> | |
| 636 | +<!-- handsontable相关js --> | |
| 637 | +<script | |
| 638 | + src="/assets/bower_components/handsontable/dist/handsontable.full.js"></script> | |
| 639 | +<script | |
| 640 | + src="/assets/bower_components/ngHandsontable/dist/ngHandsontable.js"></script> | |
| 641 | +<!-- sweetalert相关js --> | |
| 642 | +<script src="/assets/bower_components/sweetalert/dist/sweetalert.min.js"></script> | |
| 643 | +<script src="/assets/bower_components/ng-sweet-alert/ng-sweet-alert.js"></script> | |
| 644 | + | |
| 645 | +<!-- schedule计划调度AngularJS模块主JS --> | |
| 646 | +<script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script> | |
| 647 | +<script | |
| 648 | + src="/pages/scheduleApp/module/common/prj-common-globalservice.js" | |
| 649 | + data-exclude=1></script> | |
| 650 | +<script src="/pages/scheduleApp/module/common/prj-common-filter.js" | |
| 651 | + data-exclude=1></script> | |
| 652 | +<script src="/pages/scheduleApp/module/common/prj-common-directive.js" | |
| 653 | + data-exclude=1></script> | |
| 654 | +<script | |
| 655 | + src="/pages/scheduleApp/module/common/prj-common-ui-route-state.js" | |
| 656 | + data-exclude=1></script> | |
| 657 | + | |
| 658 | +<!-- 地图相关 --> | |
| 659 | +<!-- 百度 --> | |
| 660 | +<script | |
| 661 | + src="//api.map.baidu.com/api?v=3.0&ak=1TgEKvYqohJyeGXnN6yHSSTb4psOarQw" | |
| 662 | + data-exclude=1></script> | |
| 663 | +<script | |
| 664 | + src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" | |
| 665 | + data-exclude=1></script> | |
| 666 | +<script type="text/javascript" | |
| 667 | + src="//api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" | |
| 668 | + data-exclude=1></script> | |
| 669 | +<script type="text/javascript" | |
| 670 | + src="//api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js " | |
| 671 | + data-exclude=1></script> | |
| 672 | +<script src="/assets/js/baidu/TextIconOverlay.js" data-exclude=1></script> | |
| 673 | +<script src="/assets/js/baidu//MarkerClusterer.js" data-exclude=1></script> | |
| 674 | +<!-- 高德 --> | |
| 675 | +<script | |
| 676 | + src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" | |
| 677 | + data-exclude=1></script> | |
| 678 | +<!-- echarts4 --> | |
| 679 | +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | |
| 680 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 681 | +<!-- RSA加密 --> | |
| 682 | +<script src="/assets/plugins/jsencrypt.min.js"></script> | |
| 683 | +<script src="/assets/js/eventproxy.js"></script> | |
| 684 | +<!-- 线路路由信息操作 --> | |
| 685 | +<script src="/pages/base/stationroute/js/routes-operation.js"></script> | |
| 686 | +<script src="/pages/base/stationroute/js/routes-service.js"></script> | |
| 687 | +<script src="/assets/js/CoordinateConverter.js"></script> | |
| 688 | +</body> | |
| 689 | 689 | </html> |
| 690 | 690 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-vmap-world.js
| 1 | -var addCarParkVmapWorlds = function() { | |
| 2 | - var mapB = '', circle = '', drawingManager = '',circle='',marker=''; | |
| 3 | - var Bmap = { | |
| 4 | - init : function() { | |
| 5 | - // 设置中心点, | |
| 6 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 7 | - // 百度API Key | |
| 8 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | |
| 9 | - // 初始化百度地图 | |
| 10 | - mapB = new BMap.Map("addCarParkbmap_basic"); | |
| 11 | - //中心点和缩放级别 | |
| 12 | - mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 13 | - //启用地图拖拽事件,默认启用(可不写) | |
| 14 | - mapB.enableDragging(); | |
| 15 | - //启用地图滚轮放大缩小 | |
| 16 | - mapB.enableScrollWheelZoom(); | |
| 17 | - //禁用鼠标双击放大 | |
| 18 | - mapB.disableDoubleClickZoom(); | |
| 19 | - //启用键盘上下左右键移动地图 | |
| 20 | - mapB.enableKeyboard(); | |
| 21 | - var styleOptions = { | |
| 22 | - //边线颜色。 | |
| 23 | - strokeColor : "blue", | |
| 24 | - //填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 25 | - fillColor : "blue", | |
| 26 | - //边线的宽度,以像素为单位。 | |
| 27 | - strokeWeight : 3, | |
| 28 | - //边线透明度,取值范围0 - 1。 | |
| 29 | - strokeOpacity : 0.8, | |
| 30 | - //填充的透明度,取值范围0 - 1。 | |
| 31 | - fillOpacity : 0.6, | |
| 32 | - //边线的样式,solid或dashed。 | |
| 33 | - strokeStyle : 'solid' | |
| 34 | - }; | |
| 35 | - // 创建鼠标绘制管理类 | |
| 36 | - drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 37 | - //是否开启绘制模式 | |
| 38 | - isOpen : false, | |
| 39 | - //是否显示工具栏 | |
| 40 | - enableDrawingTool : false, | |
| 41 | - drawingToolOptions : { | |
| 42 | - //位置 | |
| 43 | - anchor : BMAP_ANCHOR_TOP_RIGHT, | |
| 44 | - //偏离值 | |
| 45 | - offset : new BMap.Size(5, 5), | |
| 46 | - //工具栏缩放比例 | |
| 47 | - scale : 0.8 | |
| 48 | - }, | |
| 49 | - //线的样式 | |
| 50 | - polygonOptions : styleOptions | |
| 51 | - }); | |
| 52 | - // 添加绘画完成事件 | |
| 53 | - drawingManager.addEventListener('polygoncomplete', function(e) { | |
| 54 | - drawingManager.close(); | |
| 55 | - if (e.getPath().length <= 2) { | |
| 56 | - // 弹出提示消息 | |
| 57 | - layer.msg('坐标点不能小于等于两个...'); | |
| 58 | - // 清除地图覆盖物 | |
| 59 | - mapB.clearOverlays(); | |
| 60 | - drawingManager.open(); | |
| 61 | - return false; | |
| 62 | - }else { | |
| 63 | - var pointE = e; | |
| 64 | - // 多变行质心点 | |
| 65 | - var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; | |
| 66 | - var addPolyGonLen_ = pointE.getPath().length; | |
| 67 | - for(var k =0;k<addPolyGonLen_;k++) { | |
| 68 | - if(k==0) { | |
| 69 | - bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 70 | - }else { | |
| 71 | - bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 72 | - } | |
| 73 | - } | |
| 74 | - bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 75 | - PublicFunctions.setFormInputValue(addSttationPoints_,bPloygonGrid,'d',''); | |
| 76 | - } | |
| 77 | - }); | |
| 78 | - return mapB; | |
| 79 | - }, | |
| 80 | - // 根据地理名称获取百度经纬度坐标 | |
| 81 | - localSearchFromAdreesToPoint: function(Address,cb) { | |
| 82 | - // 创建一个搜索类实例 | |
| 83 | - var localSearch = new BMap.LocalSearch(mapB); | |
| 84 | - // 检索完成后的回调函数。 | |
| 85 | - localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 86 | - var resultPoints = ''; | |
| 87 | - if(searchResult) { | |
| 88 | - // 返回索引指定的结果。索引0表示第1条结果 | |
| 89 | - var poi = searchResult.getPoi(0); | |
| 90 | - if(poi) { | |
| 91 | - //获取经度和纬度 | |
| 92 | - var stationNameChangePoint = new BMap.Point( poi.point.lng, poi.point.lat); | |
| 93 | - marker = new BMap.Marker(stationNameChangePoint); | |
| 94 | - var PanOptions ={noAnimation :true}; | |
| 95 | - mapB.panTo(stationNameChangePoint,PanOptions); | |
| 96 | - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 97 | - mapB.setZoom(18); | |
| 98 | - mapB.panBy(0,-80); | |
| 99 | - // 将标注添加到地图中 | |
| 100 | - mapB.addOverlay(marker); | |
| 101 | - //跳动的动画 | |
| 102 | - marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 103 | - cb && cb(stationNameChangePoint); | |
| 104 | - }else { | |
| 105 | - // 弹出添加成功提示消息 | |
| 106 | - layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 107 | - cb && cb(false); | |
| 108 | - } | |
| 109 | - }else { | |
| 110 | - // 弹出添加成功提示消息 | |
| 111 | - layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 112 | - cb && cb(false); | |
| 113 | - } | |
| 114 | - }); | |
| 115 | - // 根据检索词发起检索。 | |
| 116 | - localSearch.search(Address); | |
| 117 | - }, | |
| 118 | - | |
| 119 | - // 画圆 | |
| 120 | - pointsCircle : function(stationNameChangePoint) { | |
| 121 | - //创建圆 | |
| 122 | - circle = new BMap.Circle(stationNameChangePoint,100,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 123 | - // 百度地图添加覆盖物圆 | |
| 124 | - mapB.addOverlay(circle); | |
| 125 | - // 开启编辑功能 | |
| 126 | - circle.enableEditing(); | |
| 127 | - // 编辑圆监听事件 | |
| 128 | - circle.addEventListener('remove',function() { | |
| 129 | - // 清除marker | |
| 130 | - mapB.removeOverlay(marker); | |
| 131 | - // 返回圆形的半径,单位为米。 | |
| 132 | - var newRadius = circle.getRadius(); | |
| 133 | - // 返回圆形的中心点坐标。 | |
| 134 | - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 135 | - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 136 | - circle = ''; | |
| 137 | - PublicFunctions.setFormInputValue(newCenter,'','r',Math.round(newRadius)); | |
| 138 | - }); | |
| 139 | - }, | |
| 140 | - // 打开绘画工具 | |
| 141 | - drawingManagerOpen : function() { | |
| 142 | - // 打开鼠标绘画工具 | |
| 143 | - drawingManager.open(); | |
| 144 | - // 设置属性 | |
| 145 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 146 | - }, | |
| 147 | - drawingManagerClose : function() { | |
| 148 | - drawingManager.close(); | |
| 149 | - }, | |
| 150 | - clearMarkAndOverlays : function() { | |
| 151 | - // 清楚地图覆盖物 | |
| 152 | - mapB.clearOverlays(); | |
| 153 | - } | |
| 154 | - } | |
| 155 | - return Bmap; | |
| 1 | +var addCarParkVmapWorlds = function() { | |
| 2 | + var mapB = '', circle = '', drawingManager = '',circle='',marker=''; | |
| 3 | + var Bmap = { | |
| 4 | + init : function() { | |
| 5 | + // 设置中心点, | |
| 6 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 7 | + // 百度API Key | |
| 8 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw'; | |
| 9 | + // 初始化百度地图 | |
| 10 | + mapB = new BMap.Map("addCarParkbmap_basic"); | |
| 11 | + //中心点和缩放级别 | |
| 12 | + mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 13 | + //启用地图拖拽事件,默认启用(可不写) | |
| 14 | + mapB.enableDragging(); | |
| 15 | + //启用地图滚轮放大缩小 | |
| 16 | + mapB.enableScrollWheelZoom(); | |
| 17 | + //禁用鼠标双击放大 | |
| 18 | + mapB.disableDoubleClickZoom(); | |
| 19 | + //启用键盘上下左右键移动地图 | |
| 20 | + mapB.enableKeyboard(); | |
| 21 | + var styleOptions = { | |
| 22 | + //边线颜色。 | |
| 23 | + strokeColor : "blue", | |
| 24 | + //填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 25 | + fillColor : "blue", | |
| 26 | + //边线的宽度,以像素为单位。 | |
| 27 | + strokeWeight : 3, | |
| 28 | + //边线透明度,取值范围0 - 1。 | |
| 29 | + strokeOpacity : 0.8, | |
| 30 | + //填充的透明度,取值范围0 - 1。 | |
| 31 | + fillOpacity : 0.6, | |
| 32 | + //边线的样式,solid或dashed。 | |
| 33 | + strokeStyle : 'solid' | |
| 34 | + }; | |
| 35 | + // 创建鼠标绘制管理类 | |
| 36 | + drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 37 | + //是否开启绘制模式 | |
| 38 | + isOpen : false, | |
| 39 | + //是否显示工具栏 | |
| 40 | + enableDrawingTool : false, | |
| 41 | + drawingToolOptions : { | |
| 42 | + //位置 | |
| 43 | + anchor : BMAP_ANCHOR_TOP_RIGHT, | |
| 44 | + //偏离值 | |
| 45 | + offset : new BMap.Size(5, 5), | |
| 46 | + //工具栏缩放比例 | |
| 47 | + scale : 0.8 | |
| 48 | + }, | |
| 49 | + //线的样式 | |
| 50 | + polygonOptions : styleOptions | |
| 51 | + }); | |
| 52 | + // 添加绘画完成事件 | |
| 53 | + drawingManager.addEventListener('polygoncomplete', function(e) { | |
| 54 | + drawingManager.close(); | |
| 55 | + if (e.getPath().length <= 2) { | |
| 56 | + // 弹出提示消息 | |
| 57 | + layer.msg('坐标点不能小于等于两个...'); | |
| 58 | + // 清除地图覆盖物 | |
| 59 | + mapB.clearOverlays(); | |
| 60 | + drawingManager.open(); | |
| 61 | + return false; | |
| 62 | + }else { | |
| 63 | + var pointE = e; | |
| 64 | + // 多变行质心点 | |
| 65 | + var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; | |
| 66 | + var addPolyGonLen_ = pointE.getPath().length; | |
| 67 | + for(var k =0;k<addPolyGonLen_;k++) { | |
| 68 | + if(k==0) { | |
| 69 | + bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 70 | + }else { | |
| 71 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 75 | + PublicFunctions.setFormInputValue(addSttationPoints_,bPloygonGrid,'d',''); | |
| 76 | + } | |
| 77 | + }); | |
| 78 | + return mapB; | |
| 79 | + }, | |
| 80 | + // 根据地理名称获取百度经纬度坐标 | |
| 81 | + localSearchFromAdreesToPoint: function(Address,cb) { | |
| 82 | + // 创建一个搜索类实例 | |
| 83 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 84 | + // 检索完成后的回调函数。 | |
| 85 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 86 | + var resultPoints = ''; | |
| 87 | + if(searchResult) { | |
| 88 | + // 返回索引指定的结果。索引0表示第1条结果 | |
| 89 | + var poi = searchResult.getPoi(0); | |
| 90 | + if(poi) { | |
| 91 | + //获取经度和纬度 | |
| 92 | + var stationNameChangePoint = new BMap.Point( poi.point.lng, poi.point.lat); | |
| 93 | + marker = new BMap.Marker(stationNameChangePoint); | |
| 94 | + var PanOptions ={noAnimation :true}; | |
| 95 | + mapB.panTo(stationNameChangePoint,PanOptions); | |
| 96 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 97 | + mapB.setZoom(18); | |
| 98 | + mapB.panBy(0,-80); | |
| 99 | + // 将标注添加到地图中 | |
| 100 | + mapB.addOverlay(marker); | |
| 101 | + //跳动的动画 | |
| 102 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 103 | + cb && cb(stationNameChangePoint); | |
| 104 | + }else { | |
| 105 | + // 弹出添加成功提示消息 | |
| 106 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 107 | + cb && cb(false); | |
| 108 | + } | |
| 109 | + }else { | |
| 110 | + // 弹出添加成功提示消息 | |
| 111 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 112 | + cb && cb(false); | |
| 113 | + } | |
| 114 | + }); | |
| 115 | + // 根据检索词发起检索。 | |
| 116 | + localSearch.search(Address); | |
| 117 | + }, | |
| 118 | + | |
| 119 | + // 画圆 | |
| 120 | + pointsCircle : function(stationNameChangePoint) { | |
| 121 | + //创建圆 | |
| 122 | + circle = new BMap.Circle(stationNameChangePoint,100,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 123 | + // 百度地图添加覆盖物圆 | |
| 124 | + mapB.addOverlay(circle); | |
| 125 | + // 开启编辑功能 | |
| 126 | + circle.enableEditing(); | |
| 127 | + // 编辑圆监听事件 | |
| 128 | + circle.addEventListener('remove',function() { | |
| 129 | + // 清除marker | |
| 130 | + mapB.removeOverlay(marker); | |
| 131 | + // 返回圆形的半径,单位为米。 | |
| 132 | + var newRadius = circle.getRadius(); | |
| 133 | + // 返回圆形的中心点坐标。 | |
| 134 | + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 135 | + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 136 | + circle = ''; | |
| 137 | + PublicFunctions.setFormInputValue(newCenter,'','r',Math.round(newRadius)); | |
| 138 | + }); | |
| 139 | + }, | |
| 140 | + // 打开绘画工具 | |
| 141 | + drawingManagerOpen : function() { | |
| 142 | + // 打开鼠标绘画工具 | |
| 143 | + drawingManager.open(); | |
| 144 | + // 设置属性 | |
| 145 | + drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 146 | + }, | |
| 147 | + drawingManagerClose : function() { | |
| 148 | + drawingManager.close(); | |
| 149 | + }, | |
| 150 | + clearMarkAndOverlays : function() { | |
| 151 | + // 清楚地图覆盖物 | |
| 152 | + mapB.clearOverlays(); | |
| 153 | + } | |
| 154 | + } | |
| 155 | + return Bmap; | |
| 156 | 156 | }(); |
| 157 | 157 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/js/carpark-positions-map.js
| 1 | -/** | |
| 2 | - * 百度地图 | |
| 3 | - * | |
| 4 | - */ | |
| 5 | - | |
| 6 | -var CarParkPWorldsBMap = function () { | |
| 7 | - | |
| 8 | - var mapValue='',drawingManager='',marker='',circle='',polygon=''; | |
| 9 | - | |
| 10 | - var Bmap = { | |
| 11 | - init : function() { | |
| 12 | - // 设置中心点, | |
| 13 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 14 | - // 百度API Key | |
| 15 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | |
| 16 | - // 初始化百度地图 | |
| 17 | - mapValue = new BMap.Map("carParkbmap_basic"); | |
| 18 | - //中心点和缩放级别 | |
| 19 | - mapValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 20 | - //启用地图拖拽事件,默认启用(可不写) | |
| 21 | - mapValue.enableDragging(); | |
| 22 | - //启用地图滚轮放大缩小 | |
| 23 | - mapValue.enableScrollWheelZoom(); | |
| 24 | - //禁用鼠标双击放大 | |
| 25 | - mapValue.disableDoubleClickZoom(); | |
| 26 | - //启用键盘上下左右键移动地图 | |
| 27 | - mapValue.enableKeyboard(); | |
| 28 | - var styleOptions = { | |
| 29 | - //边线颜色。 | |
| 30 | - strokeColor : "blue", | |
| 31 | - //填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 32 | - fillColor : "blue", | |
| 33 | - //边线的宽度,以像素为单位。 | |
| 34 | - strokeWeight : 3, | |
| 35 | - //边线透明度,取值范围0 - 1。 | |
| 36 | - strokeOpacity : 0.8, | |
| 37 | - //填充的透明度,取值范围0 - 1。 | |
| 38 | - fillOpacity : 0.6, | |
| 39 | - //边线的样式,solid或dashed。 | |
| 40 | - strokeStyle : 'solid' | |
| 41 | - }; | |
| 42 | - // 创建鼠标绘制管理类 | |
| 43 | - drawingManager = new BMapLib.DrawingManager(mapValue, { | |
| 44 | - //是否开启绘制模式 | |
| 45 | - isOpen : false, | |
| 46 | - //是否显示工具栏 | |
| 47 | - enableDrawingTool : false, | |
| 48 | - drawingToolOptions : { | |
| 49 | - //位置 | |
| 50 | - anchor : BMAP_ANCHOR_TOP_RIGHT, | |
| 51 | - //偏离值 | |
| 52 | - offset : new BMap.Size(5, 5), | |
| 53 | - //工具栏缩放比例 | |
| 54 | - scale : 0.8 | |
| 55 | - }, | |
| 56 | - //线的样式 | |
| 57 | - polygonOptions : styleOptions | |
| 58 | - }); | |
| 59 | - // 添加绘画完成事件 | |
| 60 | - drawingManager.addEventListener('polygoncomplete', function(e) { | |
| 61 | - drawingManager.close(); | |
| 62 | - if (e.getPath().length <= 2) { | |
| 63 | - // 弹出提示消息 | |
| 64 | - layer.msg('坐标点不能小于等于两个...'); | |
| 65 | - // 清除地图覆盖物 | |
| 66 | - Bmap.clearMarkAndOverlays(); | |
| 67 | - // 加载该线路下所有站点位置添加到地图上 | |
| 68 | - return false; | |
| 69 | - }else { | |
| 70 | - var pointE = e; | |
| 71 | - // 多变行质心点 | |
| 72 | - var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; | |
| 73 | - var addPolyGonLen_ = pointE.getPath().length; | |
| 74 | - for(var k =0;k<addPolyGonLen_;k++) { | |
| 75 | - if(k==0) { | |
| 76 | - bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 77 | - }else { | |
| 78 | - bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 79 | - } | |
| 80 | - | |
| 81 | - } | |
| 82 | - bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 83 | - /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 84 | - EditCarParkObj.setCarParkBcenterPoint(addSttationPoints_); | |
| 85 | - /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 86 | - EditCarParkObj.setCarParkShapesType('d'); | |
| 87 | - /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 88 | - EditCarParkObj.setCarParkRadius(''); | |
| 89 | - /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 90 | - EditCarParkObj.setCarParkBparkPoint(bPloygonGrid); | |
| 91 | - $.get('edit.html', function(m){ | |
| 92 | - $(pjaxContainer).append(m); | |
| 93 | - $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [CarParkPWorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 94 | - }); | |
| 95 | - } | |
| 96 | - }); | |
| 97 | - return mapValue; | |
| 98 | - }, | |
| 99 | - openDrawingManager : function() { | |
| 100 | - // 清楚地图覆盖物 | |
| 101 | - // mapValue.clearOverlays(); | |
| 102 | - // 打开鼠标绘画工具 | |
| 103 | - drawingManager.open(); | |
| 104 | - // 设置属性 | |
| 105 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 106 | - }, | |
| 107 | - drawingManagerClose : function() { | |
| 108 | - drawingManager.close(); | |
| 109 | - }, | |
| 110 | - localSearchFromAdreesToPoint: function(Address) { | |
| 111 | - // 创建一个搜索类实例 | |
| 112 | - var localSearch = new BMap.LocalSearch(mapValue); | |
| 113 | - // 检索完成后的回调函数。 | |
| 114 | - localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 115 | - var resultPoints = ''; | |
| 116 | - if(searchResult) { | |
| 117 | - // 返回索引指定的结果。索引0表示第1条结果 | |
| 118 | - var poi = searchResult.getPoi(0); | |
| 119 | - if(poi) { | |
| 120 | - //获取经度和纬度 | |
| 121 | - var Points = poi.point.lng + ' ' + poi.point.lat; | |
| 122 | - var BJwpointsArray = Points.split(' '); | |
| 123 | - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 124 | - var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 125 | - var PanOptions ={noAnimation :true}; | |
| 126 | - mapValue.panTo(stationNameChangePoint,PanOptions); | |
| 127 | - mapValue.panBy(0,-200); | |
| 128 | - // 将标注添加到地图中 | |
| 129 | - mapValue.addOverlay(marker_stargt2); | |
| 130 | - //跳动的动画 | |
| 131 | - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 132 | - } | |
| 133 | - } | |
| 134 | - }); | |
| 135 | - // 根据检索词发起检索。 | |
| 136 | - localSearch.search(Address); | |
| 137 | - }, | |
| 138 | - /** 画圆 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 139 | - pointsCircle : function(r,point,htm,opts) { | |
| 140 | - //创建圆 | |
| 141 | - circle = new BMap.Circle(point,r[0].carParkRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 142 | - // 允许覆盖物在map.clearOverlays方法中被清除 | |
| 143 | - circle.enableMassClear(); | |
| 144 | - // 百度地图添加覆盖物圆 | |
| 145 | - mapValue.addOverlay(circle); | |
| 146 | - // 创建信息窗口 | |
| 147 | - infoWindow = new BMap.InfoWindow(htm, opts); | |
| 148 | - // 自定义标注物图片 | |
| 149 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 150 | - // 创建点 | |
| 151 | - marker = new BMap.Marker(point,{icon : icon_target}); | |
| 152 | - // 把标注添物加到地图上 | |
| 153 | - mapValue.addOverlay(marker); | |
| 154 | - setTimeout(function(){ | |
| 155 | - //开启信息窗口 | |
| 156 | - marker.openInfoWindow(infoWindow,point); | |
| 157 | - },100); | |
| 158 | - // 是否在平移过程中禁止动画。(自1.2新增) | |
| 159 | - var PanOptions_ ={noAnimation :true}; | |
| 160 | - // 将地图的中心点更改为给定的点。 | |
| 161 | - mapValue.panTo(point,PanOptions_); | |
| 162 | - // 添加标志物监听事件 | |
| 163 | - marker.addEventListener("click",function() { | |
| 164 | - //开启信息窗口 | |
| 165 | - marker.openInfoWindow(infoWindow,point); | |
| 166 | - }); | |
| 167 | - }, | |
| 168 | - | |
| 169 | - /** 画多边形 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 170 | - pointsPolygon : function(r,pointPolygon,htm,opts_polygon) { | |
| 171 | - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 172 | - mapValue.setZoom(17); | |
| 173 | - // 获取多边形坐标字符串 | |
| 174 | - var stationBPolygonGrid = r[0].carParkBparkPoint; | |
| 175 | - // 截取多边形坐标字符串 | |
| 176 | - var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | |
| 177 | - // 按逗号切割 | |
| 178 | - var pointPolygonArray = stationBPolygonGridStr.split(','); | |
| 179 | - // 多边形坐标集合 | |
| 180 | - var polygonP = []; | |
| 181 | - for(var v = 0;v<pointPolygonArray.length;v++) { | |
| 182 | - polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | |
| 183 | - } | |
| 184 | - // 画多边形 | |
| 185 | - polygon = new BMap.Polygon(polygonP, { | |
| 186 | - // 线条显色 | |
| 187 | - strokeColor : "blue", | |
| 188 | - // 边线的宽度,以像素为单位。 | |
| 189 | - strokeWeight : 2, | |
| 190 | - // 边线透明度,取值范围0 - 1。 | |
| 191 | - strokeOpacity : 0.5 | |
| 192 | - }); | |
| 193 | - // 增加地图覆盖物多边形 | |
| 194 | - mapValue.addOverlay(polygon); | |
| 195 | - // 创建信息窗口 | |
| 196 | - infoWindow = new BMap.InfoWindow(htm, opts_polygon); | |
| 197 | - // 自定义标注物图片 | |
| 198 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 199 | - // 创建点 | |
| 200 | - marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | |
| 201 | - // 把标注添物加到地图上 | |
| 202 | - mapValue.addOverlay(marker); | |
| 203 | - // 是否在平移过程中禁止动画。(自1.2新增) | |
| 204 | - var PanOptions_ ={noAnimation :true}; | |
| 205 | - // 将地图的中心点更改为给定的点。 | |
| 206 | - mapValue.panTo(pointPolygon,PanOptions_); | |
| 207 | - // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | |
| 208 | - mapValue.panBy(10,-250,PanOptions_); | |
| 209 | - //开启信息窗口 | |
| 210 | - marker.openInfoWindow(infoWindow,pointPolygon); | |
| 211 | - }, | |
| 212 | - | |
| 213 | - // 编辑图形 | |
| 214 | - editShapes : function(stationShapesTypeV,mindex) { | |
| 215 | - // 关闭信息窗口 | |
| 216 | - marker.closeInfoWindow(); | |
| 217 | - // 清除marker | |
| 218 | - mapValue.removeOverlay(marker); | |
| 219 | - // 编辑圆 | |
| 220 | - if(stationShapesTypeV =='r') { | |
| 221 | - // 开启编辑功能 | |
| 222 | - circle.enableEditing(); | |
| 223 | - // 编辑圆监听事件 | |
| 224 | - circle.addEventListener('dblclick',function() { | |
| 225 | - // 关闭提示弹出层 | |
| 226 | - layer.close(mindex); | |
| 227 | - // 返回圆形的半径,单位为米。 | |
| 228 | - var newRadius = circle.getRadius(); | |
| 229 | - // 返回圆形的中心点坐标。 | |
| 230 | - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 231 | - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 232 | - /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 233 | - EditCarParkObj.setCarParkBcenterPoint(newCenter); | |
| 234 | - /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 235 | - EditCarParkObj.setCarParkShapesType('r'); | |
| 236 | - /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 237 | - EditCarParkObj.setCarParkRadius(Math.round(newRadius)); | |
| 238 | - /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 239 | - EditCarParkObj.setCarParkBparkPoint(''); | |
| 240 | - // 加载编辑页面 | |
| 241 | - $.get('edit.html', function(m){ | |
| 242 | - $(pjaxContainer).append(m); | |
| 243 | - $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [CarParkPWorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 244 | - }); | |
| 245 | - }); | |
| 246 | - // 编辑多变行 | |
| 247 | - }else if(stationShapesTypeV =='d') { | |
| 248 | - // 开启编辑功能(自 1.1 新增) | |
| 249 | - polygon.enableEditing(); | |
| 250 | - // 添加多变行编辑事件 | |
| 251 | - polygon.addEventListener('dblclick',function(e) { | |
| 252 | - // 获取编辑的多边形对象 | |
| 253 | - var edit_pointE = polygon; | |
| 254 | - var edit_bPloygonGrid = ""; | |
| 255 | - var editPolyGonLen_ = edit_pointE.getPath().length; | |
| 256 | - for(var k =0;k<editPolyGonLen_;k++) { | |
| 257 | - if(k==0) { | |
| 258 | - edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 259 | - }else { | |
| 260 | - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 261 | - } | |
| 262 | - } | |
| 263 | - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | |
| 264 | - // 多边形中心点 | |
| 265 | - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | |
| 266 | - /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 267 | - EditCarParkObj.setCarParkBcenterPoint(centre_points); | |
| 268 | - /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 269 | - EditCarParkObj.setCarParkShapesType('d'); | |
| 270 | - /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 271 | - EditCarParkObj.setCarParkRadius(''); | |
| 272 | - /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 273 | - EditCarParkObj.setCarParkBparkPoint(edit_bPloygonGrid); | |
| 274 | - $.get('edit.html', function(m){ | |
| 275 | - $(pjaxContainer).append(m); | |
| 276 | - $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [CarParkPWorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 277 | - }); | |
| 278 | - }); | |
| 279 | - } | |
| 280 | - }, | |
| 281 | - clearMarkAndOverlays : function() { | |
| 282 | - // 清楚地图覆盖物 | |
| 283 | - mapValue.clearOverlays(); | |
| 284 | - } | |
| 285 | - } | |
| 286 | - return Bmap; | |
| 1 | +/** | |
| 2 | + * 百度地图 | |
| 3 | + * | |
| 4 | + */ | |
| 5 | + | |
| 6 | +var CarParkPWorldsBMap = function () { | |
| 7 | + | |
| 8 | + var mapValue='',drawingManager='',marker='',circle='',polygon=''; | |
| 9 | + | |
| 10 | + var Bmap = { | |
| 11 | + init : function() { | |
| 12 | + // 设置中心点, | |
| 13 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 14 | + // 百度API Key | |
| 15 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw'; | |
| 16 | + // 初始化百度地图 | |
| 17 | + mapValue = new BMap.Map("carParkbmap_basic"); | |
| 18 | + //中心点和缩放级别 | |
| 19 | + mapValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 20 | + //启用地图拖拽事件,默认启用(可不写) | |
| 21 | + mapValue.enableDragging(); | |
| 22 | + //启用地图滚轮放大缩小 | |
| 23 | + mapValue.enableScrollWheelZoom(); | |
| 24 | + //禁用鼠标双击放大 | |
| 25 | + mapValue.disableDoubleClickZoom(); | |
| 26 | + //启用键盘上下左右键移动地图 | |
| 27 | + mapValue.enableKeyboard(); | |
| 28 | + var styleOptions = { | |
| 29 | + //边线颜色。 | |
| 30 | + strokeColor : "blue", | |
| 31 | + //填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 32 | + fillColor : "blue", | |
| 33 | + //边线的宽度,以像素为单位。 | |
| 34 | + strokeWeight : 3, | |
| 35 | + //边线透明度,取值范围0 - 1。 | |
| 36 | + strokeOpacity : 0.8, | |
| 37 | + //填充的透明度,取值范围0 - 1。 | |
| 38 | + fillOpacity : 0.6, | |
| 39 | + //边线的样式,solid或dashed。 | |
| 40 | + strokeStyle : 'solid' | |
| 41 | + }; | |
| 42 | + // 创建鼠标绘制管理类 | |
| 43 | + drawingManager = new BMapLib.DrawingManager(mapValue, { | |
| 44 | + //是否开启绘制模式 | |
| 45 | + isOpen : false, | |
| 46 | + //是否显示工具栏 | |
| 47 | + enableDrawingTool : false, | |
| 48 | + drawingToolOptions : { | |
| 49 | + //位置 | |
| 50 | + anchor : BMAP_ANCHOR_TOP_RIGHT, | |
| 51 | + //偏离值 | |
| 52 | + offset : new BMap.Size(5, 5), | |
| 53 | + //工具栏缩放比例 | |
| 54 | + scale : 0.8 | |
| 55 | + }, | |
| 56 | + //线的样式 | |
| 57 | + polygonOptions : styleOptions | |
| 58 | + }); | |
| 59 | + // 添加绘画完成事件 | |
| 60 | + drawingManager.addEventListener('polygoncomplete', function(e) { | |
| 61 | + drawingManager.close(); | |
| 62 | + if (e.getPath().length <= 2) { | |
| 63 | + // 弹出提示消息 | |
| 64 | + layer.msg('坐标点不能小于等于两个...'); | |
| 65 | + // 清除地图覆盖物 | |
| 66 | + Bmap.clearMarkAndOverlays(); | |
| 67 | + // 加载该线路下所有站点位置添加到地图上 | |
| 68 | + return false; | |
| 69 | + }else { | |
| 70 | + var pointE = e; | |
| 71 | + // 多变行质心点 | |
| 72 | + var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; | |
| 73 | + var addPolyGonLen_ = pointE.getPath().length; | |
| 74 | + for(var k =0;k<addPolyGonLen_;k++) { | |
| 75 | + if(k==0) { | |
| 76 | + bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 77 | + }else { | |
| 78 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 79 | + } | |
| 80 | + | |
| 81 | + } | |
| 82 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 83 | + /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 84 | + EditCarParkObj.setCarParkBcenterPoint(addSttationPoints_); | |
| 85 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 86 | + EditCarParkObj.setCarParkShapesType('d'); | |
| 87 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 88 | + EditCarParkObj.setCarParkRadius(''); | |
| 89 | + /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 90 | + EditCarParkObj.setCarParkBparkPoint(bPloygonGrid); | |
| 91 | + $.get('edit.html', function(m){ | |
| 92 | + $(pjaxContainer).append(m); | |
| 93 | + $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [CarParkPWorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 94 | + }); | |
| 95 | + } | |
| 96 | + }); | |
| 97 | + return mapValue; | |
| 98 | + }, | |
| 99 | + openDrawingManager : function() { | |
| 100 | + // 清楚地图覆盖物 | |
| 101 | + // mapValue.clearOverlays(); | |
| 102 | + // 打开鼠标绘画工具 | |
| 103 | + drawingManager.open(); | |
| 104 | + // 设置属性 | |
| 105 | + drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 106 | + }, | |
| 107 | + drawingManagerClose : function() { | |
| 108 | + drawingManager.close(); | |
| 109 | + }, | |
| 110 | + localSearchFromAdreesToPoint: function(Address) { | |
| 111 | + // 创建一个搜索类实例 | |
| 112 | + var localSearch = new BMap.LocalSearch(mapValue); | |
| 113 | + // 检索完成后的回调函数。 | |
| 114 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 115 | + var resultPoints = ''; | |
| 116 | + if(searchResult) { | |
| 117 | + // 返回索引指定的结果。索引0表示第1条结果 | |
| 118 | + var poi = searchResult.getPoi(0); | |
| 119 | + if(poi) { | |
| 120 | + //获取经度和纬度 | |
| 121 | + var Points = poi.point.lng + ' ' + poi.point.lat; | |
| 122 | + var BJwpointsArray = Points.split(' '); | |
| 123 | + var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 124 | + var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 125 | + var PanOptions ={noAnimation :true}; | |
| 126 | + mapValue.panTo(stationNameChangePoint,PanOptions); | |
| 127 | + mapValue.panBy(0,-200); | |
| 128 | + // 将标注添加到地图中 | |
| 129 | + mapValue.addOverlay(marker_stargt2); | |
| 130 | + //跳动的动画 | |
| 131 | + marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 132 | + } | |
| 133 | + } | |
| 134 | + }); | |
| 135 | + // 根据检索词发起检索。 | |
| 136 | + localSearch.search(Address); | |
| 137 | + }, | |
| 138 | + /** 画圆 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 139 | + pointsCircle : function(r,point,htm,opts) { | |
| 140 | + //创建圆 | |
| 141 | + circle = new BMap.Circle(point,r[0].carParkRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 142 | + // 允许覆盖物在map.clearOverlays方法中被清除 | |
| 143 | + circle.enableMassClear(); | |
| 144 | + // 百度地图添加覆盖物圆 | |
| 145 | + mapValue.addOverlay(circle); | |
| 146 | + // 创建信息窗口 | |
| 147 | + infoWindow = new BMap.InfoWindow(htm, opts); | |
| 148 | + // 自定义标注物图片 | |
| 149 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 150 | + // 创建点 | |
| 151 | + marker = new BMap.Marker(point,{icon : icon_target}); | |
| 152 | + // 把标注添物加到地图上 | |
| 153 | + mapValue.addOverlay(marker); | |
| 154 | + setTimeout(function(){ | |
| 155 | + //开启信息窗口 | |
| 156 | + marker.openInfoWindow(infoWindow,point); | |
| 157 | + },100); | |
| 158 | + // 是否在平移过程中禁止动画。(自1.2新增) | |
| 159 | + var PanOptions_ ={noAnimation :true}; | |
| 160 | + // 将地图的中心点更改为给定的点。 | |
| 161 | + mapValue.panTo(point,PanOptions_); | |
| 162 | + // 添加标志物监听事件 | |
| 163 | + marker.addEventListener("click",function() { | |
| 164 | + //开启信息窗口 | |
| 165 | + marker.openInfoWindow(infoWindow,point); | |
| 166 | + }); | |
| 167 | + }, | |
| 168 | + | |
| 169 | + /** 画多边形 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 170 | + pointsPolygon : function(r,pointPolygon,htm,opts_polygon) { | |
| 171 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 172 | + mapValue.setZoom(17); | |
| 173 | + // 获取多边形坐标字符串 | |
| 174 | + var stationBPolygonGrid = r[0].carParkBparkPoint; | |
| 175 | + // 截取多边形坐标字符串 | |
| 176 | + var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | |
| 177 | + // 按逗号切割 | |
| 178 | + var pointPolygonArray = stationBPolygonGridStr.split(','); | |
| 179 | + // 多边形坐标集合 | |
| 180 | + var polygonP = []; | |
| 181 | + for(var v = 0;v<pointPolygonArray.length;v++) { | |
| 182 | + polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | |
| 183 | + } | |
| 184 | + // 画多边形 | |
| 185 | + polygon = new BMap.Polygon(polygonP, { | |
| 186 | + // 线条显色 | |
| 187 | + strokeColor : "blue", | |
| 188 | + // 边线的宽度,以像素为单位。 | |
| 189 | + strokeWeight : 2, | |
| 190 | + // 边线透明度,取值范围0 - 1。 | |
| 191 | + strokeOpacity : 0.5 | |
| 192 | + }); | |
| 193 | + // 增加地图覆盖物多边形 | |
| 194 | + mapValue.addOverlay(polygon); | |
| 195 | + // 创建信息窗口 | |
| 196 | + infoWindow = new BMap.InfoWindow(htm, opts_polygon); | |
| 197 | + // 自定义标注物图片 | |
| 198 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 199 | + // 创建点 | |
| 200 | + marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | |
| 201 | + // 把标注添物加到地图上 | |
| 202 | + mapValue.addOverlay(marker); | |
| 203 | + // 是否在平移过程中禁止动画。(自1.2新增) | |
| 204 | + var PanOptions_ ={noAnimation :true}; | |
| 205 | + // 将地图的中心点更改为给定的点。 | |
| 206 | + mapValue.panTo(pointPolygon,PanOptions_); | |
| 207 | + // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | |
| 208 | + mapValue.panBy(10,-250,PanOptions_); | |
| 209 | + //开启信息窗口 | |
| 210 | + marker.openInfoWindow(infoWindow,pointPolygon); | |
| 211 | + }, | |
| 212 | + | |
| 213 | + // 编辑图形 | |
| 214 | + editShapes : function(stationShapesTypeV,mindex) { | |
| 215 | + // 关闭信息窗口 | |
| 216 | + marker.closeInfoWindow(); | |
| 217 | + // 清除marker | |
| 218 | + mapValue.removeOverlay(marker); | |
| 219 | + // 编辑圆 | |
| 220 | + if(stationShapesTypeV =='r') { | |
| 221 | + // 开启编辑功能 | |
| 222 | + circle.enableEditing(); | |
| 223 | + // 编辑圆监听事件 | |
| 224 | + circle.addEventListener('dblclick',function() { | |
| 225 | + // 关闭提示弹出层 | |
| 226 | + layer.close(mindex); | |
| 227 | + // 返回圆形的半径,单位为米。 | |
| 228 | + var newRadius = circle.getRadius(); | |
| 229 | + // 返回圆形的中心点坐标。 | |
| 230 | + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 231 | + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 232 | + /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 233 | + EditCarParkObj.setCarParkBcenterPoint(newCenter); | |
| 234 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 235 | + EditCarParkObj.setCarParkShapesType('r'); | |
| 236 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 237 | + EditCarParkObj.setCarParkRadius(Math.round(newRadius)); | |
| 238 | + /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 239 | + EditCarParkObj.setCarParkBparkPoint(''); | |
| 240 | + // 加载编辑页面 | |
| 241 | + $.get('edit.html', function(m){ | |
| 242 | + $(pjaxContainer).append(m); | |
| 243 | + $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [CarParkPWorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 244 | + }); | |
| 245 | + }); | |
| 246 | + // 编辑多变行 | |
| 247 | + }else if(stationShapesTypeV =='d') { | |
| 248 | + // 开启编辑功能(自 1.1 新增) | |
| 249 | + polygon.enableEditing(); | |
| 250 | + // 添加多变行编辑事件 | |
| 251 | + polygon.addEventListener('dblclick',function(e) { | |
| 252 | + // 获取编辑的多边形对象 | |
| 253 | + var edit_pointE = polygon; | |
| 254 | + var edit_bPloygonGrid = ""; | |
| 255 | + var editPolyGonLen_ = edit_pointE.getPath().length; | |
| 256 | + for(var k =0;k<editPolyGonLen_;k++) { | |
| 257 | + if(k==0) { | |
| 258 | + edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 259 | + }else { | |
| 260 | + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 261 | + } | |
| 262 | + } | |
| 263 | + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | |
| 264 | + // 多边形中心点 | |
| 265 | + var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | |
| 266 | + /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 267 | + EditCarParkObj.setCarParkBcenterPoint(centre_points); | |
| 268 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 269 | + EditCarParkObj.setCarParkShapesType('d'); | |
| 270 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 271 | + EditCarParkObj.setCarParkRadius(''); | |
| 272 | + /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 273 | + EditCarParkObj.setCarParkBparkPoint(edit_bPloygonGrid); | |
| 274 | + $.get('edit.html', function(m){ | |
| 275 | + $(pjaxContainer).append(m); | |
| 276 | + $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [CarParkPWorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 277 | + }); | |
| 278 | + }); | |
| 279 | + } | |
| 280 | + }, | |
| 281 | + clearMarkAndOverlays : function() { | |
| 282 | + // 清楚地图覆盖物 | |
| 283 | + mapValue.clearOverlays(); | |
| 284 | + } | |
| 285 | + } | |
| 286 | + return Bmap; | |
| 287 | 287 | }(); |
| 288 | 288 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/add-vmap-world.js
| 1 | -var SectionVmapWorlds = function() { | |
| 2 | - var mapB = '', drawingManager = ''; | |
| 3 | - var Bmap = { | |
| 4 | - init : function() { | |
| 5 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425};// 设置中心点. | |
| 6 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';// 百度API Key | |
| 7 | - mapB = new BMap.Map("sectionBmap_basic");// 初始化百度地图 | |
| 8 | - mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);//中心点和缩放级别 | |
| 9 | - mapB.enableDragging(); //启用地图拖拽事件,默认启用(可不写) | |
| 10 | - mapB.enableScrollWheelZoom(); //启用地图滚轮放大缩小 | |
| 11 | - mapB.disableDoubleClickZoom();//禁用鼠标双击放大 | |
| 12 | - mapB.enableKeyboard();//启用键盘上下左右键移动地图 | |
| 13 | - var styleOptions = { | |
| 14 | - strokeColor : "blue",//边线颜色。 | |
| 15 | - fillColor : "blue",//填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 16 | - strokeWeight : 3,//边线的宽度,以像素为单位。 | |
| 17 | - strokeOpacity : 0.8,//边线的宽度,以像素为单位。 | |
| 18 | - fillOpacity : 0.6,//填充的透明度,取值范围0 - 1。 | |
| 19 | - strokeStyle : 'solid' //边线的样式,solid或dashed。 | |
| 20 | - }; | |
| 21 | - // 创建鼠标绘制管理类 | |
| 22 | - drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 23 | - isOpen : false,//是否开启绘制模式 | |
| 24 | - enableDrawingTool : false,//是否显示工具栏 | |
| 25 | - drawingToolOptions : { | |
| 26 | - anchor : BMAP_ANCHOR_TOP_RIGHT,//位置 | |
| 27 | - offset : new BMap.Size(5, 5),//偏离值 | |
| 28 | - scale : 0.8//工具栏缩放比例 | |
| 29 | - | |
| 30 | - }, | |
| 31 | - polylineOptions : styleOptions//线的样式 | |
| 32 | - }); | |
| 33 | - // 添加绘画完成事件 | |
| 34 | - drawingManager.addEventListener('polylinecomplete', function(polyline) { | |
| 35 | - drawingManager.close(); | |
| 36 | - $('#bsectionVectorInput').val(Bmap.points2Wkt(polyline.getPath())); | |
| 37 | - }); | |
| 38 | - return mapB; | |
| 39 | - }, | |
| 40 | - points2Wkt: function (points) { | |
| 41 | - var wkt = new Array(); | |
| 42 | - for (var i = 0;i < points.length;i++) { | |
| 43 | - wkt.push(points[i].lng + ' ' + points[i].lat); | |
| 44 | - } | |
| 45 | - | |
| 46 | - return 'LINESTRING(' + wkt.join(',') + ')'; | |
| 47 | - }, | |
| 48 | - // 根据地理名称获取百度经纬度坐标进行定位. | |
| 49 | - localSearchFromAdreesToPoint: function(Address) { | |
| 50 | - // 创建一个搜索类实例 | |
| 51 | - var localSearch = new BMap.LocalSearch(mapB); | |
| 52 | - // 检索完成后的回调函数。 | |
| 53 | - localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 54 | - var resultPoints = ''; | |
| 55 | - if(searchResult) { | |
| 56 | - // 返回索引指定的结果。索引0表示第1条结果 | |
| 57 | - var poi = searchResult.getPoi(0), point; | |
| 58 | - if (poi) { | |
| 59 | - point = poi.point; | |
| 60 | - marker = new BMap.Marker(point); | |
| 61 | - var opt = {noAnimation :true}; | |
| 62 | - mapB.panTo(point, opt); | |
| 63 | - mapB.setZoom(16); | |
| 64 | - mapB.panBy(-300,-50); | |
| 65 | - // 将标注添加到地图中 | |
| 66 | - mapB.addOverlay(marker); | |
| 67 | - //跳动的动画 | |
| 68 | - marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 69 | - }else { | |
| 70 | - // 弹出添加成功提示消息 | |
| 71 | - layer.msg('无法获取【'+Address+'】地理位置!'); | |
| 72 | - } | |
| 73 | - }else { | |
| 74 | - // 弹出添加成功提示消息 | |
| 75 | - layer.msg('无法获取【'+Address+'】地理位置!'); | |
| 76 | - } | |
| 77 | - }); | |
| 78 | - // 根据检索词发起检索。 | |
| 79 | - localSearch.search(Address); | |
| 80 | - }, | |
| 81 | - // 根据名称获取坐标. | |
| 82 | - sectionsNameToPoints : function(sectionNames, callback) { | |
| 83 | - var args = new Array(); | |
| 84 | - for (var i = 0;i < sectionNames.length;i++) { | |
| 85 | - args.push('searchComplete' + i); | |
| 86 | - } | |
| 87 | - args.push(function() { | |
| 88 | - callback(arguments); | |
| 89 | - }) | |
| 90 | - var proxy = EventProxy.create(args); | |
| 91 | - sectionNames.forEach(function(item, idx) { | |
| 92 | - var localSearch = new BMap.LocalSearch(mapB); | |
| 93 | - localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 94 | - var poi = searchResult.getPoi(0), point; | |
| 95 | - if (poi) { | |
| 96 | - point = poi.point; | |
| 97 | - } else { | |
| 98 | - layer.msg('未获取到[' + item + ']对应的坐标点!'); | |
| 99 | - } | |
| 100 | - proxy.emit('searchComplete' + idx, point); | |
| 101 | - }); | |
| 102 | - localSearch.search(item); | |
| 103 | - }) | |
| 104 | - }, | |
| 105 | - // 获取路段几何图形坐标集合. | |
| 106 | - getSectionListPlonly : function(points, callback) { | |
| 107 | - var transit = new BMap.DrivingRoute(mapB, { | |
| 108 | - renderOptions: { | |
| 109 | - map: mapB, | |
| 110 | - enableDragging: false | |
| 111 | - }, | |
| 112 | - onPolylinesSet: function(routes) { | |
| 113 | - if (transit.getStatus() == BMAP_STATUS_SUCCESS) { | |
| 114 | - var sections = []; | |
| 115 | - for (var i = 0; i < routes.length; i++) { | |
| 116 | - mapB.removeOverlay(routes[i].getPolyline()); | |
| 117 | - sections = sections.concat(routes[i].getPolyline().getPath()); | |
| 118 | - } | |
| 119 | - var polyline = new BMap.Polyline(sections, { | |
| 120 | - strokeColor: "red", | |
| 121 | - strokeWeight: 6, | |
| 122 | - strokeOpacity: 0.7, | |
| 123 | - enableEditing: true | |
| 124 | - }); | |
| 125 | - mapB.addOverlay(polyline); | |
| 126 | - polyline.addEventListener('rightclick', function(event) { | |
| 127 | - callback && callback(Bmap.points2Wkt(event.target().getPath())); | |
| 128 | - }) | |
| 129 | - callback && callback(Bmap.points2Wkt(sections)); | |
| 130 | - } | |
| 131 | - }, | |
| 132 | - onMarkersSet: function (pois) { | |
| 133 | - if (transit.getStatus() == BMAP_STATUS_SUCCESS) { | |
| 134 | - for (var i = 0; i < pois.length; i++){ | |
| 135 | - mapB.removeOverlay(pois[i].marker); | |
| 136 | - } | |
| 137 | - } | |
| 138 | - } | |
| 139 | - }); | |
| 140 | - transit.search(points[0], points[1]); | |
| 141 | - }, | |
| 142 | - // 清楚地图覆盖物 | |
| 143 | - clearMarkAndOverlays : function() { | |
| 144 | - mapB.clearOverlays(); | |
| 145 | - }, | |
| 146 | - // 关闭绘画工具. | |
| 147 | - drawingManagerClose : function() { | |
| 148 | - drawingManager.close(); | |
| 149 | - }, | |
| 150 | - // 打开绘画工具. | |
| 151 | - drawingManagerOpen : function() { | |
| 152 | - drawingManager.open();// 打开鼠标绘画工具. | |
| 153 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYLINE);// 设置属性. | |
| 154 | - } | |
| 155 | - } | |
| 156 | - | |
| 157 | - return Bmap; | |
| 158 | - | |
| 1 | +var SectionVmapWorlds = function() { | |
| 2 | + var mapB = '', drawingManager = ''; | |
| 3 | + var Bmap = { | |
| 4 | + init : function() { | |
| 5 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425};// 设置中心点. | |
| 6 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw';// 百度API Key | |
| 7 | + mapB = new BMap.Map("sectionBmap_basic");// 初始化百度地图 | |
| 8 | + mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);//中心点和缩放级别 | |
| 9 | + mapB.enableDragging(); //启用地图拖拽事件,默认启用(可不写) | |
| 10 | + mapB.enableScrollWheelZoom(); //启用地图滚轮放大缩小 | |
| 11 | + mapB.disableDoubleClickZoom();//禁用鼠标双击放大 | |
| 12 | + mapB.enableKeyboard();//启用键盘上下左右键移动地图 | |
| 13 | + var styleOptions = { | |
| 14 | + strokeColor : "blue",//边线颜色。 | |
| 15 | + fillColor : "blue",//填充颜色。当参数为空时,圆形将没有填充效果。 | |
| 16 | + strokeWeight : 3,//边线的宽度,以像素为单位。 | |
| 17 | + strokeOpacity : 0.8,//边线的宽度,以像素为单位。 | |
| 18 | + fillOpacity : 0.6,//填充的透明度,取值范围0 - 1。 | |
| 19 | + strokeStyle : 'solid' //边线的样式,solid或dashed。 | |
| 20 | + }; | |
| 21 | + // 创建鼠标绘制管理类 | |
| 22 | + drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 23 | + isOpen : false,//是否开启绘制模式 | |
| 24 | + enableDrawingTool : false,//是否显示工具栏 | |
| 25 | + drawingToolOptions : { | |
| 26 | + anchor : BMAP_ANCHOR_TOP_RIGHT,//位置 | |
| 27 | + offset : new BMap.Size(5, 5),//偏离值 | |
| 28 | + scale : 0.8//工具栏缩放比例 | |
| 29 | + | |
| 30 | + }, | |
| 31 | + polylineOptions : styleOptions//线的样式 | |
| 32 | + }); | |
| 33 | + // 添加绘画完成事件 | |
| 34 | + drawingManager.addEventListener('polylinecomplete', function(polyline) { | |
| 35 | + drawingManager.close(); | |
| 36 | + $('#bsectionVectorInput').val(Bmap.points2Wkt(polyline.getPath())); | |
| 37 | + }); | |
| 38 | + return mapB; | |
| 39 | + }, | |
| 40 | + points2Wkt: function (points) { | |
| 41 | + var wkt = new Array(); | |
| 42 | + for (var i = 0;i < points.length;i++) { | |
| 43 | + wkt.push(points[i].lng + ' ' + points[i].lat); | |
| 44 | + } | |
| 45 | + | |
| 46 | + return 'LINESTRING(' + wkt.join(',') + ')'; | |
| 47 | + }, | |
| 48 | + // 根据地理名称获取百度经纬度坐标进行定位. | |
| 49 | + localSearchFromAdreesToPoint: function(Address) { | |
| 50 | + // 创建一个搜索类实例 | |
| 51 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 52 | + // 检索完成后的回调函数。 | |
| 53 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 54 | + var resultPoints = ''; | |
| 55 | + if(searchResult) { | |
| 56 | + // 返回索引指定的结果。索引0表示第1条结果 | |
| 57 | + var poi = searchResult.getPoi(0), point; | |
| 58 | + if (poi) { | |
| 59 | + point = poi.point; | |
| 60 | + marker = new BMap.Marker(point); | |
| 61 | + var opt = {noAnimation :true}; | |
| 62 | + mapB.panTo(point, opt); | |
| 63 | + mapB.setZoom(16); | |
| 64 | + mapB.panBy(-300,-50); | |
| 65 | + // 将标注添加到地图中 | |
| 66 | + mapB.addOverlay(marker); | |
| 67 | + //跳动的动画 | |
| 68 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 69 | + }else { | |
| 70 | + // 弹出添加成功提示消息 | |
| 71 | + layer.msg('无法获取【'+Address+'】地理位置!'); | |
| 72 | + } | |
| 73 | + }else { | |
| 74 | + // 弹出添加成功提示消息 | |
| 75 | + layer.msg('无法获取【'+Address+'】地理位置!'); | |
| 76 | + } | |
| 77 | + }); | |
| 78 | + // 根据检索词发起检索。 | |
| 79 | + localSearch.search(Address); | |
| 80 | + }, | |
| 81 | + // 根据名称获取坐标. | |
| 82 | + sectionsNameToPoints : function(sectionNames, callback) { | |
| 83 | + var args = new Array(); | |
| 84 | + for (var i = 0;i < sectionNames.length;i++) { | |
| 85 | + args.push('searchComplete' + i); | |
| 86 | + } | |
| 87 | + args.push(function() { | |
| 88 | + callback(arguments); | |
| 89 | + }) | |
| 90 | + var proxy = EventProxy.create(args); | |
| 91 | + sectionNames.forEach(function(item, idx) { | |
| 92 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 93 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 94 | + var poi = searchResult.getPoi(0), point; | |
| 95 | + if (poi) { | |
| 96 | + point = poi.point; | |
| 97 | + } else { | |
| 98 | + layer.msg('未获取到[' + item + ']对应的坐标点!'); | |
| 99 | + } | |
| 100 | + proxy.emit('searchComplete' + idx, point); | |
| 101 | + }); | |
| 102 | + localSearch.search(item); | |
| 103 | + }) | |
| 104 | + }, | |
| 105 | + // 获取路段几何图形坐标集合. | |
| 106 | + getSectionListPlonly : function(points, callback) { | |
| 107 | + var transit = new BMap.DrivingRoute(mapB, { | |
| 108 | + renderOptions: { | |
| 109 | + map: mapB, | |
| 110 | + enableDragging: false | |
| 111 | + }, | |
| 112 | + onPolylinesSet: function(routes) { | |
| 113 | + if (transit.getStatus() == BMAP_STATUS_SUCCESS) { | |
| 114 | + var sections = []; | |
| 115 | + for (var i = 0; i < routes.length; i++) { | |
| 116 | + mapB.removeOverlay(routes[i].getPolyline()); | |
| 117 | + sections = sections.concat(routes[i].getPolyline().getPath()); | |
| 118 | + } | |
| 119 | + var polyline = new BMap.Polyline(sections, { | |
| 120 | + strokeColor: "red", | |
| 121 | + strokeWeight: 6, | |
| 122 | + strokeOpacity: 0.7, | |
| 123 | + enableEditing: true | |
| 124 | + }); | |
| 125 | + mapB.addOverlay(polyline); | |
| 126 | + polyline.addEventListener('rightclick', function(event) { | |
| 127 | + callback && callback(Bmap.points2Wkt(event.target().getPath())); | |
| 128 | + }) | |
| 129 | + callback && callback(Bmap.points2Wkt(sections)); | |
| 130 | + } | |
| 131 | + }, | |
| 132 | + onMarkersSet: function (pois) { | |
| 133 | + if (transit.getStatus() == BMAP_STATUS_SUCCESS) { | |
| 134 | + for (var i = 0; i < pois.length; i++){ | |
| 135 | + mapB.removeOverlay(pois[i].marker); | |
| 136 | + } | |
| 137 | + } | |
| 138 | + } | |
| 139 | + }); | |
| 140 | + transit.search(points[0], points[1]); | |
| 141 | + }, | |
| 142 | + // 清楚地图覆盖物 | |
| 143 | + clearMarkAndOverlays : function() { | |
| 144 | + mapB.clearOverlays(); | |
| 145 | + }, | |
| 146 | + // 关闭绘画工具. | |
| 147 | + drawingManagerClose : function() { | |
| 148 | + drawingManager.close(); | |
| 149 | + }, | |
| 150 | + // 打开绘画工具. | |
| 151 | + drawingManagerOpen : function() { | |
| 152 | + drawingManager.open();// 打开鼠标绘画工具. | |
| 153 | + drawingManager.setDrawingMode(BMAP_DRAWING_POLYLINE);// 设置属性. | |
| 154 | + } | |
| 155 | + } | |
| 156 | + | |
| 157 | + return Bmap; | |
| 158 | + | |
| 159 | 159 | }(); |
| 160 | 160 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/list.html
| 1 | -<link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> | |
| 2 | -<link rel="stylesheet" href="/assets/plugins/layer-v2.4/layer/skin/layer.css"> | |
| 3 | -<style> | |
| 4 | - .region-station-head td { | |
| 5 | - height: 42px; | |
| 6 | - line-height: 42px; | |
| 7 | - font-size: 16px; | |
| 8 | - white-space: nowrap; | |
| 9 | - overflow: hidden; | |
| 10 | - text-overflow: ellipsis; | |
| 11 | - font-family: 微软雅黑; | |
| 12 | - color: #2765A7; | |
| 13 | - text-align: center; | |
| 14 | - } | |
| 15 | - | |
| 16 | - .region-station-body td { | |
| 17 | - display: inline-block; | |
| 18 | - font-size: 14px; | |
| 19 | - white-space: nowrap; | |
| 20 | - overflow: hidden; | |
| 21 | - text-overflow: ellipsis; | |
| 22 | - border-bottom: 1px solid #dddddd; | |
| 23 | - text-indent: 5px; | |
| 24 | - text-align: center; | |
| 25 | - height: 30px; | |
| 26 | - line-height: 30px; | |
| 27 | - } | |
| 28 | - | |
| 29 | - .region-station-body::-webkit-scrollbar { /*滚动条整体样式*/ | |
| 30 | - width: 1px; | |
| 31 | - } | |
| 32 | - .region-station-body::-webkit-scrollbar-button{ | |
| 33 | - display: none; | |
| 34 | - } | |
| 35 | - .region-station-body::-webkit-scrollbar-thumb{ | |
| 36 | - border-radius: 20px; | |
| 37 | - background: rgba(0,0,0,0.3); | |
| 38 | - } | |
| 39 | - .region-station-body::-webkit-scrollbar-track{ | |
| 40 | - background: #edca95; | |
| 41 | - } | |
| 42 | -</style> | |
| 43 | - | |
| 44 | -<div class="mian-portlet-body"> | |
| 45 | - <!-- 地图 --> | |
| 46 | - <div id="routes_list_map_container" class="bmaps"></div> | |
| 47 | - <!-- 搜索框 --> | |
| 48 | - | |
| 49 | - <div class="search_panel"> | |
| 50 | - <div class="search_input_panel"> | |
| 51 | - <input class="search_input" type="text" placeholder="输入位置搜索" id="searchInput"> | |
| 52 | - <span class="fa fa-close fa-lg clear hide" aria-hidden="true"></span > | |
| 53 | - </div> | |
| 54 | - <div class="search_button_panel"> | |
| 55 | - <button class="fa fa-search fa-lg search_button" > | |
| 56 | - </button > | |
| 57 | - </div> | |
| 58 | - </div> | |
| 59 | - <div class="esc_edit_div" id="esc_edit_div" style="display: none"> | |
| 60 | - <button class="esc_edit_btn" >退出编辑模式</button > | |
| 61 | - </div> | |
| 62 | - <!-- 搜索下拉框--> | |
| 63 | - <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;z-index: 199;"></div> | |
| 64 | - <!-- 路径规划路段 --> | |
| 65 | - <input class="hand" id="routePlanning" /> | |
| 66 | - <div class="portlet box protlet-box"> | |
| 67 | - <div class="protlet-box-layer"></div> | |
| 68 | - <!-- 左边标题栏 --> | |
| 69 | - <div class="portlet-title"> | |
| 70 | - <div class="caption"> | |
| 71 | - <!-- 途径站点 --> | |
| 72 | - </div> | |
| 73 | - | |
| 74 | - <div class="versions" style="float:right;"> | |
| 75 | - <select id="versions" style="height:30px;width:200px;margin-top:5px;"> </select> | |
| 76 | - </div> | |
| 77 | - | |
| 78 | - <!--<div class="tools"> | |
| 79 | - <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> | |
| 80 | - </div>--> | |
| 81 | - </div> | |
| 82 | - <!-- 左边栏 --> | |
| 83 | - <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 520px;"> | |
| 84 | - <div class="row"> | |
| 85 | - <!-- 上下行栏 --> | |
| 86 | - <div class="col-md-3 col-sm-3 col-xs-3"> | |
| 87 | - <ul class="nav nav-tabs tabs-left" id="leftUpOrDown"> | |
| 88 | - <li class="active"> | |
| 89 | - <a href="#stationUp" data-toggle="tab" id="upLine" aria-expanded="true"> 上行 </a> | |
| 90 | - </li> | |
| 91 | - <li class=""> | |
| 92 | - <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a> | |
| 93 | - </li> | |
| 94 | - <li class=""> | |
| 95 | - <a href="#inoutCarpark" data-toggle="tab" id="inoutLine" aria-expanded="false"> 进出场路径 </a> | |
| 96 | - </li> | |
| 97 | - <li class="" style="display: none;"> | |
| 98 | - <a href="#regionDesignTab" data-toggle="tab" id="regionDesign" aria-expanded="false"> 线路区间规划 </a> | |
| 99 | - </li> | |
| 100 | - </ul> | |
| 101 | - </div> | |
| 102 | - <div class="col-md-9 col-sm-9 col-xs-9"> | |
| 103 | - <div class="tab-content"> | |
| 104 | - <!-- 左边栏上行 --> | |
| 105 | - <div class="tab-pane active in" id="stationUp" data-direction="0"> | |
| 106 | - <div class="portlet-body" id="uptreeMobal" style="display: none"> | |
| 107 | - <div class="table-toolbar"> | |
| 108 | - <div class="row"> | |
| 109 | - | |
| 110 | - <div class="col-md-6" style="float: right;"> | |
| 111 | - <div class="btn-group" style="float: right;"> | |
| 112 | - <div class="actions module_tools"> | |
| 113 | - <div class="btn-group"> | |
| 114 | - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 115 | - <i class="fa fa-angle-down"></i> | |
| 116 | - </a> --> | |
| 117 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 118 | - <i class="fa fa-share"></i> | |
| 119 | - <span>上行操作</span> | |
| 120 | - <i class="fa fa-angle-down"></i> | |
| 121 | - </a> | |
| 122 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 123 | - <li> | |
| 124 | - <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a> | |
| 125 | - </li> | |
| 126 | - <li class="divider"> </li> | |
| 127 | - <!--<li> | |
| 128 | - <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a> | |
| 129 | - </li> | |
| 130 | - <li class="divider"> </li> | |
| 131 | - <li> | |
| 132 | - <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a> | |
| 133 | - </li> | |
| 134 | - <li class="divider"> </li> | |
| 135 | - <li> | |
| 136 | - <a href="javascript:;" id="addUpSection"><i class="fa fa-plus"></i> 添加路段</a> | |
| 137 | - </li> | |
| 138 | - <li class="divider"> </li>--> | |
| 139 | - <li> | |
| 140 | - <a href="javascript:;" id="batchUpDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | |
| 141 | - </li> | |
| 142 | - <li class="divider"> </li> | |
| 143 | - <li> | |
| 144 | - <a href="javascript:;" id="upBatchRecover"><i class="fa fa-recycle"></i> 批量恢复</a> | |
| 145 | - </li> | |
| 146 | - <li class="divider"> </li> | |
| 147 | - <li> | |
| 148 | - <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | |
| 149 | - </li> | |
| 150 | - <li class="divider"> </li> | |
| 151 | - <li> | |
| 152 | - <a href="javascript:;" id="wrenchUpDis"><i class="fa fa-wrench"></i> 设置上行站距</a> | |
| 153 | - </li> | |
| 154 | - <li class="divider"> </li> | |
| 155 | - <li> | |
| 156 | - <a href="javascript:;" id="circularRouteHandle"><i class="fa fa-refresh"></i> 环线首末统一</a> | |
| 157 | - </li> | |
| 158 | - <li class="divider"> </li> | |
| 159 | - <li> | |
| 160 | - <a href="javascript:;" id="quoteDown"><i class="fa fa-long-arrow-down"></i> 引用下行路段</a> | |
| 161 | - </li> | |
| 162 | - <!-- <li class="divider"> </li> | |
| 163 | - <!-- <li> | |
| 164 | - <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a> | |
| 165 | - </li> --> | |
| 166 | - <!-- <li> | |
| 167 | - <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a> | |
| 168 | - </li> --> | |
| 169 | - </ul> | |
| 170 | - </div> | |
| 171 | - </div> | |
| 172 | - </div> | |
| 173 | - </div> | |
| 174 | - </div> | |
| 175 | - </div> | |
| 176 | - <!-- 树 --> | |
| 177 | - <div class="portlet-body" > | |
| 178 | - <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 179 | - </div> | |
| 180 | - </div> | |
| 181 | - <!-- 无上行站点添加方式 --> | |
| 182 | - <div id="upToolsMobal" class="portlet-body" style="display:none"> | |
| 183 | - <div class="row"> | |
| 184 | - <div class="col-md-6" style="float: right;"> | |
| 185 | - <div class="btn-group" style="float: right;"> | |
| 186 | - <div class="actions"> | |
| 187 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 188 | - <i class="fa fa-share"></i> | |
| 189 | - <span>上行规划选择</span> | |
| 190 | - <i class="fa fa-angle-down"></i> | |
| 191 | - </a> | |
| 192 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 193 | - <li> | |
| 194 | - <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | |
| 195 | - </li> | |
| 196 | - <li class="divider"> </li> | |
| 197 | - <li> | |
| 198 | - <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | |
| 199 | - </li> | |
| 200 | - <li class="divider"> </li> | |
| 201 | - <li> | |
| 202 | - <a class="gpsRoute" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | |
| 203 | - </li> | |
| 204 | - </ul> | |
| 205 | - </div> | |
| 206 | - </div> | |
| 207 | - </div> | |
| 208 | - </div> | |
| 209 | - <div class="row" style="margin-top: 10px;"> | |
| 210 | - <div class="col-md-12"> | |
| 211 | - <!-- 提示 --> | |
| 212 | - <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | |
| 213 | - <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点. | |
| 214 | - </div> | |
| 215 | - </div> | |
| 216 | - </div> | |
| 217 | - </div> | |
| 218 | - | |
| 219 | - </div> | |
| 220 | - | |
| 221 | - <!-- 下行 --> | |
| 222 | - <div class="tab-pane fade" id="stationDown" data-direction="1"> | |
| 223 | - <div class="portlet-body" id="DowntreeMobal" style="display: none"> | |
| 224 | - <div class="table-toolbar"> | |
| 225 | - <div class="row"> | |
| 226 | - <div class="col-md-6" style="float: right;"> | |
| 227 | - <div class="btn-group" style="float: right;"> | |
| 228 | - <div class="actions module_tools"> | |
| 229 | - <div class="btn-group"> | |
| 230 | - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 231 | - <i class="fa fa-angle-down"></i> | |
| 232 | - </a> --> | |
| 233 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 234 | - <i class="fa fa-share"></i> | |
| 235 | - <span>下行操作</span> | |
| 236 | - <i class="fa fa-angle-down"></i> | |
| 237 | - </a> | |
| 238 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 239 | - <li> | |
| 240 | - <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a> | |
| 241 | - </li> | |
| 242 | - <li class="divider"> </li> | |
| 243 | - <!--<li> | |
| 244 | - <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a> | |
| 245 | - </li> | |
| 246 | - <li class="divider"> </li> | |
| 247 | - <li> | |
| 248 | - <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a> | |
| 249 | - </li> | |
| 250 | - <li class="divider"> </li> | |
| 251 | - <li> | |
| 252 | - <a href="javascript:;" id="addDownSection"><i class="fa fa-plus"></i> 添加路段</a> | |
| 253 | - </li> | |
| 254 | - <li class="divider"> </li>--> | |
| 255 | - <li> | |
| 256 | - <a href="javascript:;" id="batchDownDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | |
| 257 | - </li> | |
| 258 | - <li class="divider"> </li> | |
| 259 | - <li> | |
| 260 | - <a href="javascript:;" id="downBatchRecover"><i class="fa fa-recycle"></i> 批量恢复</a> | |
| 261 | - </li> | |
| 262 | - <li class="divider"> </li> | |
| 263 | - <li> | |
| 264 | - <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | |
| 265 | - </li> | |
| 266 | - <li class="divider"> </li> | |
| 267 | - <li> | |
| 268 | - <a href="javascript:;" id="wrenchDownDis"><i class="fa fa-wrench"></i> 设置下行站距</a> | |
| 269 | - </li> | |
| 270 | - <li class="divider"> </li> | |
| 271 | - <li> | |
| 272 | - <a href="javascript:;" id="quoteUp"><i class="fa fa-long-arrow-up"></i> 引用上行路段</a> | |
| 273 | - </li> | |
| 274 | - <!-- <li> | |
| 275 | - <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a> | |
| 276 | - </li> --> | |
| 277 | - </ul> | |
| 278 | - </div> | |
| 279 | - </div> | |
| 280 | - </div> | |
| 281 | - </div> | |
| 282 | - </div> | |
| 283 | - </div> | |
| 284 | - <!-- 树 --> | |
| 285 | - <div class="portlet-body"> | |
| 286 | - <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 287 | - </div> | |
| 288 | - </div> | |
| 289 | - <!-- 无上行站点添加方式 --> | |
| 290 | - <div id="downToolsMobal" class="portlet-body" style="display:none"> | |
| 291 | - <div class="row"> | |
| 292 | - <div class="col-md-6" style="float: right;"> | |
| 293 | - <div class="btn-group" style="float: right;"> | |
| 294 | - <div class="actions"> | |
| 295 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 296 | - <i class="fa fa-share"></i> | |
| 297 | - <span>下行规划选择</span> | |
| 298 | - <i class="fa fa-angle-down"></i> | |
| 299 | - </a> | |
| 300 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 301 | - <li> | |
| 302 | - <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | |
| 303 | - </li> | |
| 304 | - <li class="divider"> </li> | |
| 305 | - <li> | |
| 306 | - <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | |
| 307 | - </li> | |
| 308 | - <li class="divider"> </li> | |
| 309 | - <li> | |
| 310 | - <a class="gpsRoute" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | |
| 311 | - </li> | |
| 312 | - </ul> | |
| 313 | - </div> | |
| 314 | - </div> | |
| 315 | - </div> | |
| 316 | - </div> | |
| 317 | - <div class="row" style="margin-top: 10px;"> | |
| 318 | - <div class="col-md-12"> | |
| 319 | - <!-- 提示 --> | |
| 320 | - <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | |
| 321 | - <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点. | |
| 322 | - </div> | |
| 323 | - </div> | |
| 324 | - </div> | |
| 325 | - </div> | |
| 326 | - </div> | |
| 327 | - | |
| 328 | - <!-- 进出场路径 --> | |
| 329 | - <div class="tab-pane fade" id="inoutCarpark" data-direction="3"> | |
| 330 | - <div class="portlet-body" id="InoutCarparktreeMobal"> | |
| 331 | - <div class="table-toolbar"> | |
| 332 | - <div class="row"> | |
| 333 | - <div class="col-md-6" style="float: right;"> | |
| 334 | - <div class="btn-group" style="float: right;"> | |
| 335 | - <div class="actions module_tools"> | |
| 336 | - <div class="btn-group"> | |
| 337 | - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 338 | - <i class="fa fa-angle-down"></i> | |
| 339 | - </a> --> | |
| 340 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 341 | - <i class="fa fa-share"></i> | |
| 342 | - <span>进出场路径规划</span> | |
| 343 | - <i class="fa fa-angle-down"></i> | |
| 344 | - </a> | |
| 345 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 346 | - <li> | |
| 347 | - <a href="javascript:;" id="historyGps"><i class="fa fa-wrench"></i> 历史GPS路径规划</a> | |
| 348 | - </li> | |
| 349 | - </ul> | |
| 350 | - </div> | |
| 351 | - </div> | |
| 352 | - </div> | |
| 353 | - </div> | |
| 354 | - </div> | |
| 355 | - </div> | |
| 356 | - <!-- 树 --> | |
| 357 | - <div class="portlet-body inout-search"></div> | |
| 358 | - <div class="portlet-body"> | |
| 359 | - <div id="inout_carpark_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 360 | - </div> | |
| 361 | - </div> | |
| 362 | - </div> | |
| 363 | - <div class="tab-pane fade" id="regionDesignTab" data-direction="4"> | |
| 364 | - <div class="portlet-body" id="regionDesignTool"> | |
| 365 | - <!-- 树 --> | |
| 366 | - <div class="portlet-body"> | |
| 367 | - <div class="form-horizontal"> | |
| 368 | - <div class="form-group"> | |
| 369 | - <div class="col-md-7 col-sm-6 col-xs-7"> | |
| 370 | - <select id="regionSelect" style="height:30px;width:150px;"> | |
| 371 | - <option>无线路区间</option> | |
| 372 | - </select> | |
| 373 | - </div> | |
| 374 | - <div class="col-md-2 col-sm-2 col-xs-2"> | |
| 375 | - <input type="button" value="编辑" id="regionEditBtn"/> | |
| 376 | - </div> | |
| 377 | - <div class="col-md-2 col-sm-2 col-xs-2"> | |
| 378 | - <input type="button" value="新增" id="regionAddBtn"/> | |
| 379 | - </div> | |
| 380 | - </div> | |
| 381 | - </div> | |
| 382 | - </div> | |
| 383 | - <div class="portlet-body"> | |
| 384 | - <div id="regionDesignContent" style="height: auto;max-height: 500px;"> | |
| 385 | - <div> | |
| 386 | - <table style="width: 100%;"> | |
| 387 | - <thead> | |
| 388 | - <tr class="region-station-head"> | |
| 389 | - <td style="width: 10%;">#</td> | |
| 390 | - <td style="width: 60%;">站点</td> | |
| 391 | - <td style="width: 30%;white-space: nowrap">上下行</td> | |
| 392 | - </tr> | |
| 393 | - </thead> | |
| 394 | - </table> | |
| 395 | - </div> | |
| 396 | - | |
| 397 | - <div class="region-station-body" style="overflow-y: auto; height: 450px;"> | |
| 398 | - <table id="region-station-body-table" style="width: 100%; border: 1px solid #dddddd;"> | |
| 399 | - </table> | |
| 400 | - </div> | |
| 401 | - </div> | |
| 402 | - </div> | |
| 403 | - </div> | |
| 404 | - </div> | |
| 405 | - </div> | |
| 406 | - </div> | |
| 407 | - </div> | |
| 408 | - </div> | |
| 409 | - </div> | |
| 410 | -</div> | |
| 411 | - | |
| 412 | -<script id="add_draw_polyline-temp" type="text/html"> | |
| 413 | - <div class="add_road_search_point_wrap "> | |
| 414 | - <div class="buffer_edit_body" > | |
| 415 | - <div class="_title">绘制路段</div> | |
| 416 | - <div class="form-horizontal" id="add_station_form"> | |
| 417 | - <input type="hidden" value="{{id}}" name="id"> | |
| 418 | - <input type="hidden" id="bsectionVectorInput"> <!--路段--> | |
| 419 | - | |
| 420 | - <div class="form-group"> | |
| 421 | - <div class="col-md-12"> | |
| 422 | - <input type="text" class="input-medium" name="sectionName" id="sectionNameInput" placeholder="路段名"> | |
| 423 | - </div> | |
| 424 | - </div> | |
| 425 | - | |
| 426 | - <div class="form-group"> | |
| 427 | - <div class="col-md-5"> | |
| 428 | - <span class="draw_polyline_switch"><a>暂停绘制</a></span> | |
| 429 | - </div> | |
| 430 | - <div class="col-md-6 btns"> | |
| 431 | - <button class="sbmint-btn btn-sm" id="addSectionSbmintBtn">确定</button> | |
| 432 | - <button class="cancel-btn btn-sm" id="addSectionCancelBtn">取消</button> | |
| 433 | - </div> | |
| 434 | - </div> | |
| 435 | - </div> | |
| 436 | - </div> | |
| 437 | - </div> | |
| 438 | -</script> | |
| 439 | - | |
| 440 | -<script id="inout-carpark-search-form" type="text/html"> | |
| 441 | - <div class="form-horizontal"> | |
| 442 | - <div class="form-group"> | |
| 443 | - <div class="col-md-3 col-sm-3 col-xs-3"> | |
| 444 | - <label class="uk-form-label">起点</label> | |
| 445 | - </div> | |
| 446 | - <div class="col-md-9 col-sm-9 col-xs-9"> | |
| 447 | - <select class="form-control" name="startPoint" id="startPoint"></select> | |
| 448 | - </div> | |
| 449 | - </div> | |
| 450 | - <div class="form-group"> | |
| 451 | - <div class="col-md-3 col-sm-3 col-xs-3"> | |
| 452 | - <label class="uk-form-label">终点</label> | |
| 453 | - </div> | |
| 454 | - <div class="col-md-9 col-sm-9 col-xs-9"> | |
| 455 | - <select class="form-control" name="endPoint" id="endPoint"></select> | |
| 456 | - </div> | |
| 457 | - </div> | |
| 458 | - <div class="form-group"> | |
| 459 | - <div class="col-md-6"></div> | |
| 460 | - <div class="col-md-6 btns"> | |
| 461 | - <button class="btn-sm" style="float: right;" id="inoutSearch">搜索</button> | |
| 462 | - </div> | |
| 463 | - </div> | |
| 464 | - </div> | |
| 465 | -</script> | |
| 466 | -<script id="line-region-station-template" type="text/html"> | |
| 467 | - {{each list as obj i}} | |
| 468 | - <tr data-idx="{{i}}"> | |
| 469 | - <td style="width: 10%;"> | |
| 470 | - {{i+1}} | |
| 471 | - </td> | |
| 472 | - <td style="width: 60%;" title="{{obj.stationName}}"> | |
| 473 | - {{obj.stationName}} | |
| 474 | - </td> | |
| 475 | - <td style="width: 30%;"> | |
| 476 | - {{if obj.directions == 0}} | |
| 477 | - 上行 | |
| 478 | - {{else}} | |
| 479 | - 下行 | |
| 480 | - {{/if}} | |
| 481 | - </td> | |
| 482 | - </tr> | |
| 483 | - {{/each}} | |
| 484 | - {{if list.length == 0}} | |
| 485 | - <tr> | |
| 486 | - <td style="width: 100%;" colspan="3">无站点信息</td> | |
| 487 | - </tr> | |
| 488 | - {{/if}} | |
| 489 | -</script> | |
| 490 | -<script type="text/javascript"> | |
| 491 | - $(document).ready(function () { | |
| 492 | - RoutesOperation.initPage(); | |
| 493 | - RoutesOperation.initMap(); | |
| 494 | - RoutesOperation.initStationDrawingManager(); | |
| 495 | - | |
| 496 | - // 百度地图API功能 | |
| 497 | - function G(id) { | |
| 498 | - return document.getElementById(id); | |
| 499 | - } | |
| 500 | - var baiduMap = RoutesOperation.getBaiduMap(); | |
| 501 | - var ac = new BMap.Autocomplete({"input": "searchInput" ,"location": baiduMap}); | |
| 502 | - | |
| 503 | - ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件 | |
| 504 | - var str = ""; | |
| 505 | - var _value = e.fromitem.value; | |
| 506 | - var value = ""; | |
| 507 | - if (e.fromitem.index > -1) { | |
| 508 | - value = _value.province + _value.city + _value.district + _value.street + _value.business; | |
| 509 | - } | |
| 510 | - str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value; | |
| 511 | - | |
| 512 | - value = ""; | |
| 513 | - if (e.toitem.index > -1) { | |
| 514 | - _value = e.toitem.value; | |
| 515 | - value = _value.province + _value.city + _value.district + _value.street + _value.business; | |
| 516 | - } | |
| 517 | - str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value; | |
| 518 | - G("searchResultPanel").innerHTML = str; | |
| 519 | - }); | |
| 520 | - | |
| 521 | - var myValue; | |
| 522 | - ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件 | |
| 523 | - var _value = e.item.value; | |
| 524 | - myValue = _value.province + _value.city + _value.district + _value.street + _value.business; | |
| 525 | - G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; | |
| 526 | - | |
| 527 | - setPlace(); | |
| 528 | - }); | |
| 529 | - | |
| 530 | - function setPlace(){ | |
| 531 | - // myMap.clearOverlays(); //清除地图上所有覆盖物 | |
| 532 | - var local = new BMap.LocalSearch(myMap, { //智能搜索 | |
| 533 | - onSearchComplete: myFun | |
| 534 | - }); | |
| 535 | - function myFun(){ | |
| 536 | - var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point; | |
| 537 | - if(pp) { | |
| 538 | - myMap.centerAndZoom(pp, 20); | |
| 539 | - myMap.addOverlay(new BMap.Marker(pp)); //添加标注 | |
| 540 | - } else { | |
| 541 | - layer.msg('找不到您输入的位置!') | |
| 542 | - } | |
| 543 | - } | |
| 544 | - local.search(myValue); | |
| 545 | - } | |
| 546 | - $("#searchInput").on('input propertychange change', function () { | |
| 547 | - if($("#searchInput").val() != null && $("#searchInput").val() != "") | |
| 548 | - $('.search_panel .clear').removeClass('hide'); | |
| 549 | - else { | |
| 550 | - // WorldsBMap.clearOtherOverlay(); | |
| 551 | - $('.search_panel .clear').addClass('hide'); | |
| 552 | - } | |
| 553 | - }); | |
| 554 | - | |
| 555 | - $('.search_panel .clear').on('click',function () { | |
| 556 | - // WorldsBMap.clearOtherOverlay(); | |
| 557 | - $("#searchInput").val(''); | |
| 558 | - $("#searchInput").change(); | |
| 559 | - }); | |
| 560 | - $('.search_panel .search_button').on('click',function () { | |
| 561 | - myValue = $("#searchInput").val(); | |
| 562 | - setPlace(); | |
| 563 | - }); | |
| 564 | - | |
| 565 | - $('#historyGps').on('click', function() { | |
| 566 | - $.get('/pages/base/stationroute/list_template.html', function (content) { | |
| 567 | - window.layerIdx = layer.open({ | |
| 568 | - type: 1, | |
| 569 | - move: false, | |
| 570 | - area: ['800px', '600px'], | |
| 571 | - content: content, | |
| 572 | - title: '选择班次(为前一天班次,请选择GPS自动完成的班次)', | |
| 573 | - shift: 5, | |
| 574 | - scrollbar: false, | |
| 575 | - success: function () { | |
| 576 | - } | |
| 577 | - }); | |
| 578 | - }); | |
| 579 | - }); | |
| 580 | - }); | |
| 1 | +<link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> | |
| 2 | +<link rel="stylesheet" href="/assets/plugins/layer-v2.4/layer/skin/layer.css"> | |
| 3 | +<style> | |
| 4 | + .region-station-head td { | |
| 5 | + height: 42px; | |
| 6 | + line-height: 42px; | |
| 7 | + font-size: 16px; | |
| 8 | + white-space: nowrap; | |
| 9 | + overflow: hidden; | |
| 10 | + text-overflow: ellipsis; | |
| 11 | + font-family: 微软雅黑; | |
| 12 | + color: #2765A7; | |
| 13 | + text-align: center; | |
| 14 | + } | |
| 15 | + | |
| 16 | + .region-station-body td { | |
| 17 | + display: inline-block; | |
| 18 | + font-size: 14px; | |
| 19 | + white-space: nowrap; | |
| 20 | + overflow: hidden; | |
| 21 | + text-overflow: ellipsis; | |
| 22 | + border-bottom: 1px solid #dddddd; | |
| 23 | + text-indent: 5px; | |
| 24 | + text-align: center; | |
| 25 | + height: 30px; | |
| 26 | + line-height: 30px; | |
| 27 | + } | |
| 28 | + | |
| 29 | + .region-station-body::-webkit-scrollbar { /*滚动条整体样式*/ | |
| 30 | + width: 1px; | |
| 31 | + } | |
| 32 | + .region-station-body::-webkit-scrollbar-button{ | |
| 33 | + display: none; | |
| 34 | + } | |
| 35 | + .region-station-body::-webkit-scrollbar-thumb{ | |
| 36 | + border-radius: 20px; | |
| 37 | + background: rgba(0,0,0,0.3); | |
| 38 | + } | |
| 39 | + .region-station-body::-webkit-scrollbar-track{ | |
| 40 | + background: #edca95; | |
| 41 | + } | |
| 42 | +</style> | |
| 43 | + | |
| 44 | +<div class="mian-portlet-body"> | |
| 45 | + <!-- 地图 --> | |
| 46 | + <div id="routes_list_map_container" class="bmaps"></div> | |
| 47 | + <!-- 搜索框 --> | |
| 48 | + | |
| 49 | + <div class="search_panel"> | |
| 50 | + <div class="search_input_panel"> | |
| 51 | + <input class="search_input" type="text" placeholder="输入位置搜索" id="searchInput"> | |
| 52 | + <span class="fa fa-close fa-lg clear hide" aria-hidden="true"></span > | |
| 53 | + </div> | |
| 54 | + <div class="search_button_panel"> | |
| 55 | + <button class="fa fa-search fa-lg search_button" > | |
| 56 | + </button > | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + <div class="esc_edit_div" id="esc_edit_div" style="display: none"> | |
| 60 | + <button class="esc_edit_btn" >退出编辑模式</button > | |
| 61 | + </div> | |
| 62 | + <!-- 搜索下拉框--> | |
| 63 | + <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;z-index: 199;"></div> | |
| 64 | + <!-- 路径规划路段 --> | |
| 65 | + <input class="hand" id="routePlanning" /> | |
| 66 | + <div class="portlet box protlet-box"> | |
| 67 | + <div class="protlet-box-layer"></div> | |
| 68 | + <!-- 左边标题栏 --> | |
| 69 | + <div class="portlet-title"> | |
| 70 | + <div class="caption"> | |
| 71 | + <!-- 途径站点 --> | |
| 72 | + </div> | |
| 73 | + | |
| 74 | + <div class="versions" style="float:right;"> | |
| 75 | + <select id="versions" style="height:30px;width:200px;margin-top:5px;"> </select> | |
| 76 | + </div> | |
| 77 | + | |
| 78 | + <!--<div class="tools"> | |
| 79 | + <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> | |
| 80 | + </div>--> | |
| 81 | + </div> | |
| 82 | + <!-- 左边栏 --> | |
| 83 | + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 520px;"> | |
| 84 | + <div class="row"> | |
| 85 | + <!-- 上下行栏 --> | |
| 86 | + <div class="col-md-3 col-sm-3 col-xs-3"> | |
| 87 | + <ul class="nav nav-tabs tabs-left" id="leftUpOrDown"> | |
| 88 | + <li class="active"> | |
| 89 | + <a href="#stationUp" data-toggle="tab" id="upLine" aria-expanded="true"> 上行 </a> | |
| 90 | + </li> | |
| 91 | + <li class=""> | |
| 92 | + <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a> | |
| 93 | + </li> | |
| 94 | + <li class=""> | |
| 95 | + <a href="#inoutCarpark" data-toggle="tab" id="inoutLine" aria-expanded="false"> 进出场路径 </a> | |
| 96 | + </li> | |
| 97 | + <li class=""> | |
| 98 | + <a href="#regionDesignTab" data-toggle="tab" id="regionDesign" aria-expanded="false"> 线路区间规划 </a> | |
| 99 | + </li> | |
| 100 | + </ul> | |
| 101 | + </div> | |
| 102 | + <div class="col-md-9 col-sm-9 col-xs-9"> | |
| 103 | + <div class="tab-content"> | |
| 104 | + <!-- 左边栏上行 --> | |
| 105 | + <div class="tab-pane active in" id="stationUp" data-direction="0"> | |
| 106 | + <div class="portlet-body" id="uptreeMobal" style="display: none"> | |
| 107 | + <div class="table-toolbar"> | |
| 108 | + <div class="row"> | |
| 109 | + | |
| 110 | + <div class="col-md-6" style="float: right;"> | |
| 111 | + <div class="btn-group" style="float: right;"> | |
| 112 | + <div class="actions module_tools"> | |
| 113 | + <div class="btn-group"> | |
| 114 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 115 | + <i class="fa fa-angle-down"></i> | |
| 116 | + </a> --> | |
| 117 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 118 | + <i class="fa fa-share"></i> | |
| 119 | + <span>上行操作</span> | |
| 120 | + <i class="fa fa-angle-down"></i> | |
| 121 | + </a> | |
| 122 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 123 | + <li> | |
| 124 | + <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a> | |
| 125 | + </li> | |
| 126 | + <li class="divider"> </li> | |
| 127 | + <!--<li> | |
| 128 | + <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a> | |
| 129 | + </li> | |
| 130 | + <li class="divider"> </li> | |
| 131 | + <li> | |
| 132 | + <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a> | |
| 133 | + </li> | |
| 134 | + <li class="divider"> </li> | |
| 135 | + <li> | |
| 136 | + <a href="javascript:;" id="addUpSection"><i class="fa fa-plus"></i> 添加路段</a> | |
| 137 | + </li> | |
| 138 | + <li class="divider"> </li>--> | |
| 139 | + <li> | |
| 140 | + <a href="javascript:;" id="batchUpDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | |
| 141 | + </li> | |
| 142 | + <li class="divider"> </li> | |
| 143 | + <li> | |
| 144 | + <a href="javascript:;" id="upBatchRecover"><i class="fa fa-recycle"></i> 批量恢复</a> | |
| 145 | + </li> | |
| 146 | + <li class="divider"> </li> | |
| 147 | + <li> | |
| 148 | + <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | |
| 149 | + </li> | |
| 150 | + <li class="divider"> </li> | |
| 151 | + <li> | |
| 152 | + <a href="javascript:;" id="wrenchUpDis"><i class="fa fa-wrench"></i> 设置上行站距</a> | |
| 153 | + </li> | |
| 154 | + <li class="divider"> </li> | |
| 155 | + <li> | |
| 156 | + <a href="javascript:;" id="circularRouteHandle"><i class="fa fa-refresh"></i> 环线首末统一</a> | |
| 157 | + </li> | |
| 158 | + <li class="divider"> </li> | |
| 159 | + <li> | |
| 160 | + <a href="javascript:;" id="quoteDown"><i class="fa fa-long-arrow-down"></i> 引用下行路段</a> | |
| 161 | + </li> | |
| 162 | + <!-- <li class="divider"> </li> | |
| 163 | + <!-- <li> | |
| 164 | + <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a> | |
| 165 | + </li> --> | |
| 166 | + <!-- <li> | |
| 167 | + <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a> | |
| 168 | + </li> --> | |
| 169 | + </ul> | |
| 170 | + </div> | |
| 171 | + </div> | |
| 172 | + </div> | |
| 173 | + </div> | |
| 174 | + </div> | |
| 175 | + </div> | |
| 176 | + <!-- 树 --> | |
| 177 | + <div class="portlet-body" > | |
| 178 | + <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 179 | + </div> | |
| 180 | + </div> | |
| 181 | + <!-- 无上行站点添加方式 --> | |
| 182 | + <div id="upToolsMobal" class="portlet-body" style="display:none"> | |
| 183 | + <div class="row"> | |
| 184 | + <div class="col-md-6" style="float: right;"> | |
| 185 | + <div class="btn-group" style="float: right;"> | |
| 186 | + <div class="actions"> | |
| 187 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 188 | + <i class="fa fa-share"></i> | |
| 189 | + <span>上行规划选择</span> | |
| 190 | + <i class="fa fa-angle-down"></i> | |
| 191 | + </a> | |
| 192 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 193 | + <li> | |
| 194 | + <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | |
| 195 | + </li> | |
| 196 | + <li class="divider"> </li> | |
| 197 | + <li> | |
| 198 | + <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | |
| 199 | + </li> | |
| 200 | + <li class="divider"> </li> | |
| 201 | + <li> | |
| 202 | + <a class="gpsRoute" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | |
| 203 | + </li> | |
| 204 | + </ul> | |
| 205 | + </div> | |
| 206 | + </div> | |
| 207 | + </div> | |
| 208 | + </div> | |
| 209 | + <div class="row" style="margin-top: 10px;"> | |
| 210 | + <div class="col-md-12"> | |
| 211 | + <!-- 提示 --> | |
| 212 | + <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | |
| 213 | + <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点. | |
| 214 | + </div> | |
| 215 | + </div> | |
| 216 | + </div> | |
| 217 | + </div> | |
| 218 | + | |
| 219 | + </div> | |
| 220 | + | |
| 221 | + <!-- 下行 --> | |
| 222 | + <div class="tab-pane fade" id="stationDown" data-direction="1"> | |
| 223 | + <div class="portlet-body" id="DowntreeMobal" style="display: none"> | |
| 224 | + <div class="table-toolbar"> | |
| 225 | + <div class="row"> | |
| 226 | + <div class="col-md-6" style="float: right;"> | |
| 227 | + <div class="btn-group" style="float: right;"> | |
| 228 | + <div class="actions module_tools"> | |
| 229 | + <div class="btn-group"> | |
| 230 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 231 | + <i class="fa fa-angle-down"></i> | |
| 232 | + </a> --> | |
| 233 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 234 | + <i class="fa fa-share"></i> | |
| 235 | + <span>下行操作</span> | |
| 236 | + <i class="fa fa-angle-down"></i> | |
| 237 | + </a> | |
| 238 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 239 | + <li> | |
| 240 | + <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a> | |
| 241 | + </li> | |
| 242 | + <li class="divider"> </li> | |
| 243 | + <!--<li> | |
| 244 | + <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a> | |
| 245 | + </li> | |
| 246 | + <li class="divider"> </li> | |
| 247 | + <li> | |
| 248 | + <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a> | |
| 249 | + </li> | |
| 250 | + <li class="divider"> </li> | |
| 251 | + <li> | |
| 252 | + <a href="javascript:;" id="addDownSection"><i class="fa fa-plus"></i> 添加路段</a> | |
| 253 | + </li> | |
| 254 | + <li class="divider"> </li>--> | |
| 255 | + <li> | |
| 256 | + <a href="javascript:;" id="batchDownDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | |
| 257 | + </li> | |
| 258 | + <li class="divider"> </li> | |
| 259 | + <li> | |
| 260 | + <a href="javascript:;" id="downBatchRecover"><i class="fa fa-recycle"></i> 批量恢复</a> | |
| 261 | + </li> | |
| 262 | + <li class="divider"> </li> | |
| 263 | + <li> | |
| 264 | + <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | |
| 265 | + </li> | |
| 266 | + <li class="divider"> </li> | |
| 267 | + <li> | |
| 268 | + <a href="javascript:;" id="wrenchDownDis"><i class="fa fa-wrench"></i> 设置下行站距</a> | |
| 269 | + </li> | |
| 270 | + <li class="divider"> </li> | |
| 271 | + <li> | |
| 272 | + <a href="javascript:;" id="quoteUp"><i class="fa fa-long-arrow-up"></i> 引用上行路段</a> | |
| 273 | + </li> | |
| 274 | + <!-- <li> | |
| 275 | + <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a> | |
| 276 | + </li> --> | |
| 277 | + </ul> | |
| 278 | + </div> | |
| 279 | + </div> | |
| 280 | + </div> | |
| 281 | + </div> | |
| 282 | + </div> | |
| 283 | + </div> | |
| 284 | + <!-- 树 --> | |
| 285 | + <div class="portlet-body"> | |
| 286 | + <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 287 | + </div> | |
| 288 | + </div> | |
| 289 | + <!-- 无上行站点添加方式 --> | |
| 290 | + <div id="downToolsMobal" class="portlet-body" style="display:none"> | |
| 291 | + <div class="row"> | |
| 292 | + <div class="col-md-6" style="float: right;"> | |
| 293 | + <div class="btn-group" style="float: right;"> | |
| 294 | + <div class="actions"> | |
| 295 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 296 | + <i class="fa fa-share"></i> | |
| 297 | + <span>下行规划选择</span> | |
| 298 | + <i class="fa fa-angle-down"></i> | |
| 299 | + </a> | |
| 300 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 301 | + <li> | |
| 302 | + <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | |
| 303 | + </li> | |
| 304 | + <li class="divider"> </li> | |
| 305 | + <li> | |
| 306 | + <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | |
| 307 | + </li> | |
| 308 | + <li class="divider"> </li> | |
| 309 | + <li> | |
| 310 | + <a class="gpsRoute" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | |
| 311 | + </li> | |
| 312 | + </ul> | |
| 313 | + </div> | |
| 314 | + </div> | |
| 315 | + </div> | |
| 316 | + </div> | |
| 317 | + <div class="row" style="margin-top: 10px;"> | |
| 318 | + <div class="col-md-12"> | |
| 319 | + <!-- 提示 --> | |
| 320 | + <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | |
| 321 | + <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点. | |
| 322 | + </div> | |
| 323 | + </div> | |
| 324 | + </div> | |
| 325 | + </div> | |
| 326 | + </div> | |
| 327 | + | |
| 328 | + <!-- 进出场路径 --> | |
| 329 | + <div class="tab-pane fade" id="inoutCarpark" data-direction="3"> | |
| 330 | + <div class="portlet-body" id="InoutCarparktreeMobal"> | |
| 331 | + <div class="table-toolbar"> | |
| 332 | + <div class="row"> | |
| 333 | + <div class="col-md-6" style="float: right;"> | |
| 334 | + <div class="btn-group" style="float: right;"> | |
| 335 | + <div class="actions module_tools"> | |
| 336 | + <div class="btn-group"> | |
| 337 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | |
| 338 | + <i class="fa fa-angle-down"></i> | |
| 339 | + </a> --> | |
| 340 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | |
| 341 | + <i class="fa fa-share"></i> | |
| 342 | + <span>进出场路径规划</span> | |
| 343 | + <i class="fa fa-angle-down"></i> | |
| 344 | + </a> | |
| 345 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | |
| 346 | + <li> | |
| 347 | + <a href="javascript:;" id="historyGps"><i class="fa fa-wrench"></i> 历史GPS路径规划</a> | |
| 348 | + </li> | |
| 349 | + </ul> | |
| 350 | + </div> | |
| 351 | + </div> | |
| 352 | + </div> | |
| 353 | + </div> | |
| 354 | + </div> | |
| 355 | + </div> | |
| 356 | + <!-- 树 --> | |
| 357 | + <div class="portlet-body inout-search"></div> | |
| 358 | + <div class="portlet-body"> | |
| 359 | + <div id="inout_carpark_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | |
| 360 | + </div> | |
| 361 | + </div> | |
| 362 | + </div> | |
| 363 | + <div class="tab-pane fade" id="regionDesignTab" data-direction="4"> | |
| 364 | + <div class="portlet-body" id="regionDesignTool"> | |
| 365 | + <!-- 树 --> | |
| 366 | + <div class="portlet-body"> | |
| 367 | + <div class="form-horizontal"> | |
| 368 | + <div class="form-group"> | |
| 369 | + <div class="col-md-7 col-sm-6 col-xs-7"> | |
| 370 | + <select id="regionSelect" style="height:30px;width:150px;"> | |
| 371 | + <option>无线路区间</option> | |
| 372 | + </select> | |
| 373 | + </div> | |
| 374 | + <div class="col-md-2 col-sm-2 col-xs-2"> | |
| 375 | + <input type="button" value="编辑" id="regionEditBtn"/> | |
| 376 | + </div> | |
| 377 | + <div class="col-md-2 col-sm-2 col-xs-2"> | |
| 378 | + <input type="button" value="新增" id="regionAddBtn"/> | |
| 379 | + </div> | |
| 380 | + </div> | |
| 381 | + </div> | |
| 382 | + </div> | |
| 383 | + <div class="portlet-body"> | |
| 384 | + <div id="regionDesignContent" style="height: auto;max-height: 500px;"> | |
| 385 | + <div> | |
| 386 | + <table style="width: 100%;"> | |
| 387 | + <thead> | |
| 388 | + <tr class="region-station-head"> | |
| 389 | + <td style="width: 10%;">#</td> | |
| 390 | + <td style="width: 60%;">站点</td> | |
| 391 | + <td style="width: 30%;white-space: nowrap">上下行</td> | |
| 392 | + </tr> | |
| 393 | + </thead> | |
| 394 | + </table> | |
| 395 | + </div> | |
| 396 | + | |
| 397 | + <div class="region-station-body" style="overflow-y: auto; height: 450px;"> | |
| 398 | + <table id="region-station-body-table" style="width: 100%; border: 1px solid #dddddd;"> | |
| 399 | + </table> | |
| 400 | + </div> | |
| 401 | + </div> | |
| 402 | + </div> | |
| 403 | + </div> | |
| 404 | + </div> | |
| 405 | + </div> | |
| 406 | + </div> | |
| 407 | + </div> | |
| 408 | + </div> | |
| 409 | + </div> | |
| 410 | +</div> | |
| 411 | + | |
| 412 | +<script id="add_draw_polyline-temp" type="text/html"> | |
| 413 | + <div class="add_road_search_point_wrap "> | |
| 414 | + <div class="buffer_edit_body" > | |
| 415 | + <div class="_title">绘制路段</div> | |
| 416 | + <div class="form-horizontal" id="add_station_form"> | |
| 417 | + <input type="hidden" value="{{id}}" name="id"> | |
| 418 | + <input type="hidden" id="bsectionVectorInput"> <!--路段--> | |
| 419 | + | |
| 420 | + <div class="form-group"> | |
| 421 | + <div class="col-md-12"> | |
| 422 | + <input type="text" class="input-medium" name="sectionName" id="sectionNameInput" placeholder="路段名"> | |
| 423 | + </div> | |
| 424 | + </div> | |
| 425 | + | |
| 426 | + <div class="form-group"> | |
| 427 | + <div class="col-md-5"> | |
| 428 | + <span class="draw_polyline_switch"><a>暂停绘制</a></span> | |
| 429 | + </div> | |
| 430 | + <div class="col-md-6 btns"> | |
| 431 | + <button class="sbmint-btn btn-sm" id="addSectionSbmintBtn">确定</button> | |
| 432 | + <button class="cancel-btn btn-sm" id="addSectionCancelBtn">取消</button> | |
| 433 | + </div> | |
| 434 | + </div> | |
| 435 | + </div> | |
| 436 | + </div> | |
| 437 | + </div> | |
| 438 | +</script> | |
| 439 | + | |
| 440 | +<script id="inout-carpark-search-form" type="text/html"> | |
| 441 | + <div class="form-horizontal"> | |
| 442 | + <div class="form-group"> | |
| 443 | + <div class="col-md-3 col-sm-3 col-xs-3"> | |
| 444 | + <label class="uk-form-label">起点</label> | |
| 445 | + </div> | |
| 446 | + <div class="col-md-9 col-sm-9 col-xs-9"> | |
| 447 | + <select class="form-control" name="startPoint" id="startPoint"></select> | |
| 448 | + </div> | |
| 449 | + </div> | |
| 450 | + <div class="form-group"> | |
| 451 | + <div class="col-md-3 col-sm-3 col-xs-3"> | |
| 452 | + <label class="uk-form-label">终点</label> | |
| 453 | + </div> | |
| 454 | + <div class="col-md-9 col-sm-9 col-xs-9"> | |
| 455 | + <select class="form-control" name="endPoint" id="endPoint"></select> | |
| 456 | + </div> | |
| 457 | + </div> | |
| 458 | + <div class="form-group"> | |
| 459 | + <div class="col-md-6"></div> | |
| 460 | + <div class="col-md-6 btns"> | |
| 461 | + <button class="btn-sm" style="float: right;" id="inoutSearch">搜索</button> | |
| 462 | + </div> | |
| 463 | + </div> | |
| 464 | + </div> | |
| 465 | +</script> | |
| 466 | +<script id="line-region-station-template" type="text/html"> | |
| 467 | + {{each list as obj i}} | |
| 468 | + <tr data-idx="{{i}}"> | |
| 469 | + <td style="width: 10%;"> | |
| 470 | + {{i+1}} | |
| 471 | + </td> | |
| 472 | + <td style="width: 60%;" title="{{obj.stationName}}"> | |
| 473 | + {{obj.stationName}} | |
| 474 | + </td> | |
| 475 | + <td style="width: 30%;"> | |
| 476 | + {{if obj.directions == 0}} | |
| 477 | + 上行 | |
| 478 | + {{else}} | |
| 479 | + 下行 | |
| 480 | + {{/if}} | |
| 481 | + </td> | |
| 482 | + </tr> | |
| 483 | + {{/each}} | |
| 484 | + {{if list.length == 0}} | |
| 485 | + <tr> | |
| 486 | + <td style="width: 100%;" colspan="3">无站点信息</td> | |
| 487 | + </tr> | |
| 488 | + {{/if}} | |
| 489 | +</script> | |
| 490 | +<script type="text/javascript"> | |
| 491 | + $(document).ready(function () { | |
| 492 | + RoutesOperation.initPage(); | |
| 493 | + RoutesOperation.initMap(); | |
| 494 | + RoutesOperation.initStationDrawingManager(); | |
| 495 | + | |
| 496 | + // 百度地图API功能 | |
| 497 | + function G(id) { | |
| 498 | + return document.getElementById(id); | |
| 499 | + } | |
| 500 | + var baiduMap = RoutesOperation.getBaiduMap(); | |
| 501 | + var ac = new BMap.Autocomplete({"input": "searchInput" ,"location": baiduMap}); | |
| 502 | + | |
| 503 | + ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件 | |
| 504 | + var str = ""; | |
| 505 | + var _value = e.fromitem.value; | |
| 506 | + var value = ""; | |
| 507 | + if (e.fromitem.index > -1) { | |
| 508 | + value = _value.province + _value.city + _value.district + _value.street + _value.business; | |
| 509 | + } | |
| 510 | + str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value; | |
| 511 | + | |
| 512 | + value = ""; | |
| 513 | + if (e.toitem.index > -1) { | |
| 514 | + _value = e.toitem.value; | |
| 515 | + value = _value.province + _value.city + _value.district + _value.street + _value.business; | |
| 516 | + } | |
| 517 | + str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value; | |
| 518 | + G("searchResultPanel").innerHTML = str; | |
| 519 | + }); | |
| 520 | + | |
| 521 | + var myValue; | |
| 522 | + ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件 | |
| 523 | + var _value = e.item.value; | |
| 524 | + myValue = _value.province + _value.city + _value.district + _value.street + _value.business; | |
| 525 | + G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; | |
| 526 | + | |
| 527 | + setPlace(); | |
| 528 | + }); | |
| 529 | + | |
| 530 | + function setPlace(){ | |
| 531 | + // myMap.clearOverlays(); //清除地图上所有覆盖物 | |
| 532 | + var local = new BMap.LocalSearch(myMap, { //智能搜索 | |
| 533 | + onSearchComplete: myFun | |
| 534 | + }); | |
| 535 | + function myFun(){ | |
| 536 | + var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point; | |
| 537 | + if(pp) { | |
| 538 | + myMap.centerAndZoom(pp, 20); | |
| 539 | + myMap.addOverlay(new BMap.Marker(pp)); //添加标注 | |
| 540 | + } else { | |
| 541 | + layer.msg('找不到您输入的位置!') | |
| 542 | + } | |
| 543 | + } | |
| 544 | + local.search(myValue); | |
| 545 | + } | |
| 546 | + $("#searchInput").on('input propertychange change', function () { | |
| 547 | + if($("#searchInput").val() != null && $("#searchInput").val() != "") | |
| 548 | + $('.search_panel .clear').removeClass('hide'); | |
| 549 | + else { | |
| 550 | + // WorldsBMap.clearOtherOverlay(); | |
| 551 | + $('.search_panel .clear').addClass('hide'); | |
| 552 | + } | |
| 553 | + }); | |
| 554 | + | |
| 555 | + $('.search_panel .clear').on('click',function () { | |
| 556 | + // WorldsBMap.clearOtherOverlay(); | |
| 557 | + $("#searchInput").val(''); | |
| 558 | + $("#searchInput").change(); | |
| 559 | + }); | |
| 560 | + $('.search_panel .search_button').on('click',function () { | |
| 561 | + myValue = $("#searchInput").val(); | |
| 562 | + setPlace(); | |
| 563 | + }); | |
| 564 | + | |
| 565 | + $('#historyGps').on('click', function() { | |
| 566 | + $.get('/pages/base/stationroute/list_template.html', function (content) { | |
| 567 | + window.layerIdx = layer.open({ | |
| 568 | + type: 1, | |
| 569 | + move: false, | |
| 570 | + area: ['800px', '600px'], | |
| 571 | + content: content, | |
| 572 | + title: '选择班次(为前一天班次,请选择GPS自动完成的班次)', | |
| 573 | + shift: 5, | |
| 574 | + scrollbar: false, | |
| 575 | + success: function () { | |
| 576 | + } | |
| 577 | + }); | |
| 578 | + }); | |
| 579 | + }); | |
| 580 | + }); | |
| 581 | 581 | </script> |
| 582 | 582 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/js/map.js
| 1 | -/** | |
| 2 | - * 百度地图 | |
| 3 | - * | |
| 4 | - * - - - - - -》init:地图初始化 | |
| 5 | - * | |
| 6 | - * - - - - - -》getDistanceAndDuration:获取距离与时间 | |
| 7 | - * | |
| 8 | - * - - - - - -》drawingUpline:在地图上画出上行线路走向 | |
| 9 | - * | |
| 10 | - * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划) | |
| 11 | - */ | |
| 12 | - | |
| 13 | -var BasicMap = function () { | |
| 14 | - | |
| 15 | - /** BasicMap 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数; | |
| 16 | - * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/ | |
| 17 | - var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false; | |
| 18 | - | |
| 19 | - var Bmap = { | |
| 20 | - | |
| 21 | - init : function() { | |
| 22 | - | |
| 23 | - // 设置中心点, | |
| 24 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 25 | - | |
| 26 | - // 百度API Key | |
| 27 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | |
| 28 | - | |
| 29 | - // 初始化百度地图 | |
| 30 | - mapBValue = new BMap.Map("BasicMap"); | |
| 31 | - | |
| 32 | - //中心点和缩放级别 | |
| 33 | - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat),15); | |
| 34 | - | |
| 35 | - //启用地图拖拽事件,默认启用(可不写) | |
| 36 | - mapBValue.enableDragging(); | |
| 37 | - | |
| 38 | - //启用地图滚轮放大缩小 | |
| 39 | - mapBValue.enableScrollWheelZoom(); | |
| 40 | - | |
| 41 | - //禁用鼠标双击放大 | |
| 42 | - mapBValue.disableDoubleClickZoom(); | |
| 43 | - | |
| 44 | - //启用键盘上下左右键移动地图 | |
| 45 | - mapBValue.enableKeyboard(); | |
| 46 | - | |
| 47 | - return mapBValue; | |
| 48 | - }, | |
| 49 | - /** 获取第一个切路段的点 @return Point*/ | |
| 50 | - getFirstPoint : function() { | |
| 51 | - return firstPoint; | |
| 52 | - }, | |
| 53 | - /** 获取地图对象 @return 地图对象map */ | |
| 54 | - getmapBValue : function() { | |
| 55 | - | |
| 56 | - return mapBValue; | |
| 57 | - | |
| 58 | - }, | |
| 59 | - | |
| 60 | - getPolyUpline : function() { | |
| 61 | - | |
| 62 | - return polyUpline; | |
| 63 | - }, | |
| 64 | - | |
| 65 | - /** 获取截取过的路段 @return 路段对象List */ | |
| 66 | - getSectionList : function() { | |
| 67 | - | |
| 68 | - return sectionList; | |
| 69 | - | |
| 70 | - }, | |
| 71 | - setSectionList : function(list) { | |
| 72 | - | |
| 73 | - sectionList = list; | |
| 74 | - }, | |
| 75 | - initCutSectionPoint : function() { | |
| 76 | - sectionList = []; | |
| 77 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 78 | - $('#section_table tbody').html(tbodyHtml); | |
| 79 | - }, | |
| 80 | - /** 获取切路段的点下标 @return int*/ | |
| 81 | - setPointIndex : function(index) { | |
| 82 | - pointIndex = index; | |
| 83 | - }, | |
| 84 | - getPointIndex : function() { | |
| 85 | - | |
| 86 | - return pointIndex; | |
| 87 | - | |
| 88 | - }, | |
| 89 | - /** 获取路段是否在编辑状态 @return boolean*/ | |
| 90 | - getIsEditStatus : function() { | |
| 91 | - return iseditStatus; | |
| 92 | - }, | |
| 93 | - setIsEditStatus : function(v) { | |
| 94 | - iseditStatus = v ; | |
| 95 | - }, | |
| 96 | - | |
| 97 | - /** 获取路段是否在截取状态 @return boolean*/ | |
| 98 | - getIsCutSection : function() { | |
| 99 | - return isCutSection; | |
| 100 | - }, | |
| 101 | - setIsCutSection : function(v) { | |
| 102 | - isCutSection = v ; | |
| 103 | - }, | |
| 104 | - | |
| 105 | - /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 106 | - getDistanceAndDuration : function(points,callback){ | |
| 107 | - | |
| 108 | - // 获取长度 | |
| 109 | - var len = points.length; | |
| 110 | - (function(){ | |
| 111 | - | |
| 112 | - if (!arguments.callee.count) { | |
| 113 | - | |
| 114 | - arguments.callee.count = 0; | |
| 115 | - | |
| 116 | - } | |
| 117 | - | |
| 118 | - arguments.callee.count++; | |
| 119 | - | |
| 120 | - var index = parseInt(arguments.callee.count) - 1; | |
| 121 | - | |
| 122 | - if (index >= len-1) { | |
| 123 | - | |
| 124 | - callback && callback(points); | |
| 125 | - | |
| 126 | - return; | |
| 127 | - } | |
| 128 | - | |
| 129 | - // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 130 | - var f = arguments.callee; | |
| 131 | - // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 132 | - var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 133 | - | |
| 134 | - // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 135 | - var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 136 | - var region = '上海'; | |
| 137 | - | |
| 138 | - var origin_region = '上海'; | |
| 139 | - | |
| 140 | - var destination_region = '上海'; | |
| 141 | - | |
| 142 | - var output = 'json'; | |
| 143 | - | |
| 144 | - var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 145 | - | |
| 146 | - /** | |
| 147 | - * origin:起点名称或经纬度; | |
| 148 | - * | |
| 149 | - * destination:终点名称或经纬度; | |
| 150 | - * | |
| 151 | - * origin_region:起始点所在城市,驾车导航时必填。 | |
| 152 | - * | |
| 153 | - * destination_region:终点所在城市,驾车导航时必填。 | |
| 154 | - * | |
| 155 | - * output :表示输出类型,可设置为xml或json,默认为xml。 | |
| 156 | - * | |
| 157 | - **/ | |
| 158 | - var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 159 | - | |
| 160 | - /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 161 | - $.ajax({ | |
| 162 | - | |
| 163 | - // 百度地图根据坐标获取两点之间的时间与距离 | |
| 164 | - url: '//api.map.baidu.com/direction/v1?mode=transit', | |
| 165 | - | |
| 166 | - data: paramsB, | |
| 167 | - | |
| 168 | - dataType: 'jsonp', | |
| 169 | - | |
| 170 | - success: function(r){ | |
| 171 | - | |
| 172 | - if(r) { | |
| 173 | - | |
| 174 | - if(r.message=='ok') { | |
| 175 | - | |
| 176 | - if(r.result.taxi==null) { | |
| 177 | - | |
| 178 | - // 获取距离(单位:米) | |
| 179 | - points[index+1].distance = 0; | |
| 180 | - | |
| 181 | - // 获取时间(单位:秒) | |
| 182 | - points[index+1].duration = 0; | |
| 183 | - | |
| 184 | - }else { | |
| 185 | - | |
| 186 | - // 获取距离(单位:米) | |
| 187 | - points[index+1].distance = r.result.taxi.distance; | |
| 188 | - | |
| 189 | - // 获取时间(单位:秒) | |
| 190 | - points[index+1].duration = r.result.taxi.duration; | |
| 191 | - | |
| 192 | - } | |
| 193 | - | |
| 194 | - | |
| 195 | - } | |
| 196 | - | |
| 197 | - } | |
| 198 | - | |
| 199 | - f(); | |
| 200 | - } | |
| 201 | - }); | |
| 202 | - | |
| 203 | - })(); | |
| 204 | - | |
| 205 | - }, | |
| 206 | - // 在地图上画出上行线路走向 | |
| 207 | - drawingUpline01 : function (polylineArray,polyline_center,data) { | |
| 208 | - var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | |
| 209 | - // 创建线路走向 | |
| 210 | - polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 211 | - polyUpline01.data = data; | |
| 212 | - // 把折线添加到地图上 | |
| 213 | - mapBValue.addOverlay(polyUpline01); | |
| 214 | - var sectionPoint = []; | |
| 215 | - // 线路单击事件 | |
| 216 | - polyUpline01.addEventListener('click',function(e) { | |
| 217 | - if(BasicMap.getIsEditStatus()) { | |
| 218 | - layer.msg('请先保存正在编辑的路段信息...'); | |
| 219 | - return false; | |
| 220 | - } | |
| 221 | - if(BasicMap.getIsCutSection()) { | |
| 222 | - layer.msg('请先撤销所有切路段的点...'); | |
| 223 | - return false; | |
| 224 | - } | |
| 225 | - polyUpline01.enableEditing(); | |
| 226 | - BasicMap.setIsEditStatus(true); | |
| 227 | - }); | |
| 228 | - | |
| 229 | - // 添加路段双击事件 | |
| 230 | - polyUpline01.addEventListener("dblclick",function(e){ | |
| 231 | - if(BasicMap.getIsCutSection()) { | |
| 232 | - layer.msg('请先撤销所有切路段的点...'); | |
| 233 | - return false; | |
| 234 | - } | |
| 235 | - BasicMap.setIsEditStatus(false); | |
| 236 | - // 关闭 | |
| 237 | - layer.closeAll(); | |
| 238 | - polyUpline01.disableEditing(); | |
| 239 | - EditSectionObj.setEitdSection(polyUpline01.data); | |
| 240 | - // 获取折线坐标集合 | |
| 241 | - var editPloyLineArray = polyUpline01.getPath(); | |
| 242 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 243 | - sectionList = []; | |
| 244 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 245 | - // 截取路段 | |
| 246 | - $('#section_table tbody').html(tbodyHtml); | |
| 247 | - // 加载修改路段弹出层mobal页面 | |
| 248 | - $.get('editsection.html', function(m){ | |
| 249 | - $(pjaxContainer).append(m); | |
| 250 | - $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [BasicMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 251 | - }); | |
| 252 | - }); | |
| 253 | - | |
| 254 | - // 路段右击事件 | |
| 255 | - var editSection = function(e,ee,marker){ | |
| 256 | - if(BasicMap.getIsEditStatus()) { | |
| 257 | - layer.msg('请先保存正在编辑的路段信息...'); | |
| 258 | - return false; | |
| 259 | - } | |
| 260 | - var lng = e.lng; | |
| 261 | - var lat = e.lat; | |
| 262 | - var sectionName = null; | |
| 263 | - var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点 | |
| 264 | - marker.isFlag = true; | |
| 265 | - if(pointIndex == 0) { | |
| 266 | - sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 267 | - layer.msg('进入切路段状态,请选择本路段的终点!'); | |
| 268 | - mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 269 | - firstPoint = {lng:lng, lat:lat}; | |
| 270 | - pointIndex++; | |
| 271 | - EditSectionObj.setEitdSection(polyUpline01.data); | |
| 272 | - // 获取折线坐标集合 | |
| 273 | - var editPloyLineArray = polyUpline01.getPath(); | |
| 274 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 275 | - } else if (pointIndex > 0) { | |
| 276 | - layer.prompt({title: '请输入路段名!'}, function(sectionName, index){ | |
| 277 | - pointList = []; | |
| 278 | - sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 279 | - pointList[0] = sectionPoint[pointIndex-1]; | |
| 280 | - pointList[1] = sectionPoint[pointIndex]; | |
| 281 | - sectionList.push({name:sectionName, section:pointList}); | |
| 282 | - layer.close(index); | |
| 283 | - layer.msg('路段截取成功,请选择下一个路段的终点'); | |
| 284 | - mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 285 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 286 | - // 截取路段 | |
| 287 | - $('#section_table tbody').html(tbodyHtml); | |
| 288 | - pointIndex++; | |
| 289 | - }); | |
| 290 | - } | |
| 291 | - BasicMap.setIsCutSection(true); | |
| 292 | - } | |
| 293 | - var markerMenu=new BMap.ContextMenu(); | |
| 294 | - markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01))); | |
| 295 | - polyUpline01.addContextMenu(markerMenu); | |
| 296 | - | |
| 297 | - | |
| 298 | - var PanOptions_ ={noAnimation :true}; | |
| 299 | - mapBValue.reset(); | |
| 300 | - mapBValue.panTo(polyline_center,PanOptions_); | |
| 301 | - mapBValue.panBy(500,-510,PanOptions_); | |
| 302 | - mapBValue.setZoom(14); | |
| 303 | - }, | |
| 304 | - // 删除点刷新cutSectionTable | |
| 305 | - refreshCutSectionTable : function() { | |
| 306 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 307 | - $('#section_table tbody').html(tbodyHtml); | |
| 308 | - }, | |
| 309 | - // 删除点刷新覆盖物 | |
| 310 | - deleteCutSectionPoint : function(point) { | |
| 311 | - var lng = point.lng; | |
| 312 | - var lat = point.lat; | |
| 313 | - var allOverlay = mapBValue.getOverlays(); | |
| 314 | - // 删除最后一个点 | |
| 315 | - for (var i = 0; i < allOverlay.length -1; i++){ | |
| 316 | - if(allOverlay[i].isFlag) { | |
| 317 | - if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){ | |
| 318 | - mapBValue.removeOverlay(allOverlay[i]); | |
| 319 | - break; | |
| 320 | - } | |
| 321 | - } | |
| 322 | - } | |
| 323 | - }, | |
| 324 | - /** 在地图上画点 @param:<point_center:中心坐标点> */ | |
| 325 | - drawingUpStationPoint : function(point_center,stationName,s) { | |
| 326 | - | |
| 327 | - // 自定义标注物图片 | |
| 328 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | |
| 329 | - | |
| 330 | - var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | |
| 331 | - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 332 | - + '</div>' | |
| 333 | - + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | |
| 334 | - | |
| 335 | - | |
| 336 | - var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | |
| 337 | - "anchor" : new BMap.Size(-10,8), | |
| 338 | - "enableDragging" : true}); | |
| 339 | - | |
| 340 | - | |
| 341 | - myRichMarker1.disableDragging(); | |
| 342 | - mapBValue.addOverlay(myRichMarker1); | |
| 343 | - | |
| 344 | - | |
| 345 | - // 创建标注物 | |
| 346 | - marker = new BMap.Marker(point_center,{icon : icon_target}); | |
| 347 | - | |
| 348 | - // 允许覆盖物在map.clearOverlays方法中被清除。 | |
| 349 | - marker.enableMassClear(); | |
| 350 | - | |
| 351 | - mapBValue.addOverlay(marker); | |
| 352 | - }, | |
| 353 | - | |
| 354 | - // 根据站点坐标匹配库中的公交站点(手动规划) | |
| 355 | - stationsPointsToLibraryPoint : function(arra,callback) { | |
| 356 | - // 获取长度 | |
| 357 | - var len = arra.length; | |
| 358 | - var station = {}; | |
| 359 | - var stationList = []; | |
| 360 | - (function(){ | |
| 361 | - if (!arguments.callee.count) { | |
| 362 | - arguments.callee.count = 0; | |
| 363 | - } | |
| 364 | - arguments.callee.count++; | |
| 365 | - var index = parseInt(arguments.callee.count) - 1; | |
| 366 | - if (index >= len) { | |
| 367 | - callback && callback(stationList); | |
| 368 | - return ; | |
| 369 | - } | |
| 370 | - var f = arguments.callee; | |
| 371 | - station = arra[index]; | |
| 372 | - if(arra[index].name!=''){ | |
| 373 | - $.get('/station/matchStation',station,function(result) { | |
| 374 | - var centerPointWkt = result.centerPointWkt, idx = centerPointWkt.indexOf('POINT('); | |
| 375 | - centerPointWkt = idx > -1 ? centerPointWkt.substring(6, centerPointWkt.length - 1) : centerPointWkt; | |
| 376 | - var coordinates = centerPointWkt.split(' '); | |
| 377 | - stationList.push({name: result.name ,wgs: arra[index].wgs, potion: {lng: coordinates[0], lat: coordinates[1]}, isHave: result.isHave, id: result.id}); | |
| 378 | - f(); | |
| 379 | - }); | |
| 380 | - }else { | |
| 381 | - f(); | |
| 382 | - } | |
| 383 | - })() | |
| 384 | - }, | |
| 385 | - clearMarkAndOverlays : function() { | |
| 386 | - | |
| 387 | - // 清楚地图覆盖物 | |
| 388 | - mapBValue.clearOverlays(); | |
| 389 | - | |
| 390 | - mapBValue.removeOverlay(); | |
| 391 | - | |
| 392 | - } | |
| 393 | - | |
| 394 | - } | |
| 395 | - | |
| 396 | - return Bmap; | |
| 397 | - | |
| 1 | +/** | |
| 2 | + * 百度地图 | |
| 3 | + * | |
| 4 | + * - - - - - -》init:地图初始化 | |
| 5 | + * | |
| 6 | + * - - - - - -》getDistanceAndDuration:获取距离与时间 | |
| 7 | + * | |
| 8 | + * - - - - - -》drawingUpline:在地图上画出上行线路走向 | |
| 9 | + * | |
| 10 | + * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划) | |
| 11 | + */ | |
| 12 | + | |
| 13 | +var BasicMap = function () { | |
| 14 | + | |
| 15 | + /** BasicMap 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数; | |
| 16 | + * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/ | |
| 17 | + var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false; | |
| 18 | + | |
| 19 | + var Bmap = { | |
| 20 | + | |
| 21 | + init : function() { | |
| 22 | + | |
| 23 | + // 设置中心点, | |
| 24 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 25 | + | |
| 26 | + // 百度API Key | |
| 27 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw'; | |
| 28 | + | |
| 29 | + // 初始化百度地图 | |
| 30 | + mapBValue = new BMap.Map("BasicMap"); | |
| 31 | + | |
| 32 | + //中心点和缩放级别 | |
| 33 | + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat),15); | |
| 34 | + | |
| 35 | + //启用地图拖拽事件,默认启用(可不写) | |
| 36 | + mapBValue.enableDragging(); | |
| 37 | + | |
| 38 | + //启用地图滚轮放大缩小 | |
| 39 | + mapBValue.enableScrollWheelZoom(); | |
| 40 | + | |
| 41 | + //禁用鼠标双击放大 | |
| 42 | + mapBValue.disableDoubleClickZoom(); | |
| 43 | + | |
| 44 | + //启用键盘上下左右键移动地图 | |
| 45 | + mapBValue.enableKeyboard(); | |
| 46 | + | |
| 47 | + return mapBValue; | |
| 48 | + }, | |
| 49 | + /** 获取第一个切路段的点 @return Point*/ | |
| 50 | + getFirstPoint : function() { | |
| 51 | + return firstPoint; | |
| 52 | + }, | |
| 53 | + /** 获取地图对象 @return 地图对象map */ | |
| 54 | + getmapBValue : function() { | |
| 55 | + | |
| 56 | + return mapBValue; | |
| 57 | + | |
| 58 | + }, | |
| 59 | + | |
| 60 | + getPolyUpline : function() { | |
| 61 | + | |
| 62 | + return polyUpline; | |
| 63 | + }, | |
| 64 | + | |
| 65 | + /** 获取截取过的路段 @return 路段对象List */ | |
| 66 | + getSectionList : function() { | |
| 67 | + | |
| 68 | + return sectionList; | |
| 69 | + | |
| 70 | + }, | |
| 71 | + setSectionList : function(list) { | |
| 72 | + | |
| 73 | + sectionList = list; | |
| 74 | + }, | |
| 75 | + initCutSectionPoint : function() { | |
| 76 | + sectionList = []; | |
| 77 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 78 | + $('#section_table tbody').html(tbodyHtml); | |
| 79 | + }, | |
| 80 | + /** 获取切路段的点下标 @return int*/ | |
| 81 | + setPointIndex : function(index) { | |
| 82 | + pointIndex = index; | |
| 83 | + }, | |
| 84 | + getPointIndex : function() { | |
| 85 | + | |
| 86 | + return pointIndex; | |
| 87 | + | |
| 88 | + }, | |
| 89 | + /** 获取路段是否在编辑状态 @return boolean*/ | |
| 90 | + getIsEditStatus : function() { | |
| 91 | + return iseditStatus; | |
| 92 | + }, | |
| 93 | + setIsEditStatus : function(v) { | |
| 94 | + iseditStatus = v ; | |
| 95 | + }, | |
| 96 | + | |
| 97 | + /** 获取路段是否在截取状态 @return boolean*/ | |
| 98 | + getIsCutSection : function() { | |
| 99 | + return isCutSection; | |
| 100 | + }, | |
| 101 | + setIsCutSection : function(v) { | |
| 102 | + isCutSection = v ; | |
| 103 | + }, | |
| 104 | + | |
| 105 | + /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 106 | + getDistanceAndDuration : function(points,callback){ | |
| 107 | + | |
| 108 | + // 获取长度 | |
| 109 | + var len = points.length; | |
| 110 | + (function(){ | |
| 111 | + | |
| 112 | + if (!arguments.callee.count) { | |
| 113 | + | |
| 114 | + arguments.callee.count = 0; | |
| 115 | + | |
| 116 | + } | |
| 117 | + | |
| 118 | + arguments.callee.count++; | |
| 119 | + | |
| 120 | + var index = parseInt(arguments.callee.count) - 1; | |
| 121 | + | |
| 122 | + if (index >= len-1) { | |
| 123 | + | |
| 124 | + callback && callback(points); | |
| 125 | + | |
| 126 | + return; | |
| 127 | + } | |
| 128 | + | |
| 129 | + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 130 | + var f = arguments.callee; | |
| 131 | + // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 132 | + var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 133 | + | |
| 134 | + // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 135 | + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 136 | + var region = '上海'; | |
| 137 | + | |
| 138 | + var origin_region = '上海'; | |
| 139 | + | |
| 140 | + var destination_region = '上海'; | |
| 141 | + | |
| 142 | + var output = 'json'; | |
| 143 | + | |
| 144 | + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 145 | + | |
| 146 | + /** | |
| 147 | + * origin:起点名称或经纬度; | |
| 148 | + * | |
| 149 | + * destination:终点名称或经纬度; | |
| 150 | + * | |
| 151 | + * origin_region:起始点所在城市,驾车导航时必填。 | |
| 152 | + * | |
| 153 | + * destination_region:终点所在城市,驾车导航时必填。 | |
| 154 | + * | |
| 155 | + * output :表示输出类型,可设置为xml或json,默认为xml。 | |
| 156 | + * | |
| 157 | + **/ | |
| 158 | + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 159 | + | |
| 160 | + /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 161 | + $.ajax({ | |
| 162 | + | |
| 163 | + // 百度地图根据坐标获取两点之间的时间与距离 | |
| 164 | + url: '//api.map.baidu.com/direction/v1?mode=transit', | |
| 165 | + | |
| 166 | + data: paramsB, | |
| 167 | + | |
| 168 | + dataType: 'jsonp', | |
| 169 | + | |
| 170 | + success: function(r){ | |
| 171 | + | |
| 172 | + if(r) { | |
| 173 | + | |
| 174 | + if(r.message=='ok') { | |
| 175 | + | |
| 176 | + if(r.result.taxi==null) { | |
| 177 | + | |
| 178 | + // 获取距离(单位:米) | |
| 179 | + points[index+1].distance = 0; | |
| 180 | + | |
| 181 | + // 获取时间(单位:秒) | |
| 182 | + points[index+1].duration = 0; | |
| 183 | + | |
| 184 | + }else { | |
| 185 | + | |
| 186 | + // 获取距离(单位:米) | |
| 187 | + points[index+1].distance = r.result.taxi.distance; | |
| 188 | + | |
| 189 | + // 获取时间(单位:秒) | |
| 190 | + points[index+1].duration = r.result.taxi.duration; | |
| 191 | + | |
| 192 | + } | |
| 193 | + | |
| 194 | + | |
| 195 | + } | |
| 196 | + | |
| 197 | + } | |
| 198 | + | |
| 199 | + f(); | |
| 200 | + } | |
| 201 | + }); | |
| 202 | + | |
| 203 | + })(); | |
| 204 | + | |
| 205 | + }, | |
| 206 | + // 在地图上画出上行线路走向 | |
| 207 | + drawingUpline01 : function (polylineArray,polyline_center,data) { | |
| 208 | + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | |
| 209 | + // 创建线路走向 | |
| 210 | + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 211 | + polyUpline01.data = data; | |
| 212 | + // 把折线添加到地图上 | |
| 213 | + mapBValue.addOverlay(polyUpline01); | |
| 214 | + var sectionPoint = []; | |
| 215 | + // 线路单击事件 | |
| 216 | + polyUpline01.addEventListener('click',function(e) { | |
| 217 | + if(BasicMap.getIsEditStatus()) { | |
| 218 | + layer.msg('请先保存正在编辑的路段信息...'); | |
| 219 | + return false; | |
| 220 | + } | |
| 221 | + if(BasicMap.getIsCutSection()) { | |
| 222 | + layer.msg('请先撤销所有切路段的点...'); | |
| 223 | + return false; | |
| 224 | + } | |
| 225 | + polyUpline01.enableEditing(); | |
| 226 | + BasicMap.setIsEditStatus(true); | |
| 227 | + }); | |
| 228 | + | |
| 229 | + // 添加路段双击事件 | |
| 230 | + polyUpline01.addEventListener("dblclick",function(e){ | |
| 231 | + if(BasicMap.getIsCutSection()) { | |
| 232 | + layer.msg('请先撤销所有切路段的点...'); | |
| 233 | + return false; | |
| 234 | + } | |
| 235 | + BasicMap.setIsEditStatus(false); | |
| 236 | + // 关闭 | |
| 237 | + layer.closeAll(); | |
| 238 | + polyUpline01.disableEditing(); | |
| 239 | + EditSectionObj.setEitdSection(polyUpline01.data); | |
| 240 | + // 获取折线坐标集合 | |
| 241 | + var editPloyLineArray = polyUpline01.getPath(); | |
| 242 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 243 | + sectionList = []; | |
| 244 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 245 | + // 截取路段 | |
| 246 | + $('#section_table tbody').html(tbodyHtml); | |
| 247 | + // 加载修改路段弹出层mobal页面 | |
| 248 | + $.get('editsection.html', function(m){ | |
| 249 | + $(pjaxContainer).append(m); | |
| 250 | + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [BasicMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 251 | + }); | |
| 252 | + }); | |
| 253 | + | |
| 254 | + // 路段右击事件 | |
| 255 | + var editSection = function(e,ee,marker){ | |
| 256 | + if(BasicMap.getIsEditStatus()) { | |
| 257 | + layer.msg('请先保存正在编辑的路段信息...'); | |
| 258 | + return false; | |
| 259 | + } | |
| 260 | + var lng = e.lng; | |
| 261 | + var lat = e.lat; | |
| 262 | + var sectionName = null; | |
| 263 | + var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点 | |
| 264 | + marker.isFlag = true; | |
| 265 | + if(pointIndex == 0) { | |
| 266 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 267 | + layer.msg('进入切路段状态,请选择本路段的终点!'); | |
| 268 | + mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 269 | + firstPoint = {lng:lng, lat:lat}; | |
| 270 | + pointIndex++; | |
| 271 | + EditSectionObj.setEitdSection(polyUpline01.data); | |
| 272 | + // 获取折线坐标集合 | |
| 273 | + var editPloyLineArray = polyUpline01.getPath(); | |
| 274 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 275 | + } else if (pointIndex > 0) { | |
| 276 | + layer.prompt({title: '请输入路段名!'}, function(sectionName, index){ | |
| 277 | + pointList = []; | |
| 278 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 279 | + pointList[0] = sectionPoint[pointIndex-1]; | |
| 280 | + pointList[1] = sectionPoint[pointIndex]; | |
| 281 | + sectionList.push({name:sectionName, section:pointList}); | |
| 282 | + layer.close(index); | |
| 283 | + layer.msg('路段截取成功,请选择下一个路段的终点'); | |
| 284 | + mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 285 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 286 | + // 截取路段 | |
| 287 | + $('#section_table tbody').html(tbodyHtml); | |
| 288 | + pointIndex++; | |
| 289 | + }); | |
| 290 | + } | |
| 291 | + BasicMap.setIsCutSection(true); | |
| 292 | + } | |
| 293 | + var markerMenu=new BMap.ContextMenu(); | |
| 294 | + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01))); | |
| 295 | + polyUpline01.addContextMenu(markerMenu); | |
| 296 | + | |
| 297 | + | |
| 298 | + var PanOptions_ ={noAnimation :true}; | |
| 299 | + mapBValue.reset(); | |
| 300 | + mapBValue.panTo(polyline_center,PanOptions_); | |
| 301 | + mapBValue.panBy(500,-510,PanOptions_); | |
| 302 | + mapBValue.setZoom(14); | |
| 303 | + }, | |
| 304 | + // 删除点刷新cutSectionTable | |
| 305 | + refreshCutSectionTable : function() { | |
| 306 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 307 | + $('#section_table tbody').html(tbodyHtml); | |
| 308 | + }, | |
| 309 | + // 删除点刷新覆盖物 | |
| 310 | + deleteCutSectionPoint : function(point) { | |
| 311 | + var lng = point.lng; | |
| 312 | + var lat = point.lat; | |
| 313 | + var allOverlay = mapBValue.getOverlays(); | |
| 314 | + // 删除最后一个点 | |
| 315 | + for (var i = 0; i < allOverlay.length -1; i++){ | |
| 316 | + if(allOverlay[i].isFlag) { | |
| 317 | + if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){ | |
| 318 | + mapBValue.removeOverlay(allOverlay[i]); | |
| 319 | + break; | |
| 320 | + } | |
| 321 | + } | |
| 322 | + } | |
| 323 | + }, | |
| 324 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | |
| 325 | + drawingUpStationPoint : function(point_center,stationName,s) { | |
| 326 | + | |
| 327 | + // 自定义标注物图片 | |
| 328 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | |
| 329 | + | |
| 330 | + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | |
| 331 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 332 | + + '</div>' | |
| 333 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | |
| 334 | + | |
| 335 | + | |
| 336 | + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | |
| 337 | + "anchor" : new BMap.Size(-10,8), | |
| 338 | + "enableDragging" : true}); | |
| 339 | + | |
| 340 | + | |
| 341 | + myRichMarker1.disableDragging(); | |
| 342 | + mapBValue.addOverlay(myRichMarker1); | |
| 343 | + | |
| 344 | + | |
| 345 | + // 创建标注物 | |
| 346 | + marker = new BMap.Marker(point_center,{icon : icon_target}); | |
| 347 | + | |
| 348 | + // 允许覆盖物在map.clearOverlays方法中被清除。 | |
| 349 | + marker.enableMassClear(); | |
| 350 | + | |
| 351 | + mapBValue.addOverlay(marker); | |
| 352 | + }, | |
| 353 | + | |
| 354 | + // 根据站点坐标匹配库中的公交站点(手动规划) | |
| 355 | + stationsPointsToLibraryPoint : function(arra,callback) { | |
| 356 | + // 获取长度 | |
| 357 | + var len = arra.length; | |
| 358 | + var station = {}; | |
| 359 | + var stationList = []; | |
| 360 | + (function(){ | |
| 361 | + if (!arguments.callee.count) { | |
| 362 | + arguments.callee.count = 0; | |
| 363 | + } | |
| 364 | + arguments.callee.count++; | |
| 365 | + var index = parseInt(arguments.callee.count) - 1; | |
| 366 | + if (index >= len) { | |
| 367 | + callback && callback(stationList); | |
| 368 | + return ; | |
| 369 | + } | |
| 370 | + var f = arguments.callee; | |
| 371 | + station = arra[index]; | |
| 372 | + if(arra[index].name!=''){ | |
| 373 | + $.get('/station/matchStation',station,function(result) { | |
| 374 | + var centerPointWkt = result.centerPointWkt, idx = centerPointWkt.indexOf('POINT('); | |
| 375 | + centerPointWkt = idx > -1 ? centerPointWkt.substring(6, centerPointWkt.length - 1) : centerPointWkt; | |
| 376 | + var coordinates = centerPointWkt.split(' '); | |
| 377 | + stationList.push({name: result.name ,wgs: arra[index].wgs, potion: {lng: coordinates[0], lat: coordinates[1]}, isHave: result.isHave, id: result.id}); | |
| 378 | + f(); | |
| 379 | + }); | |
| 380 | + }else { | |
| 381 | + f(); | |
| 382 | + } | |
| 383 | + })() | |
| 384 | + }, | |
| 385 | + clearMarkAndOverlays : function() { | |
| 386 | + | |
| 387 | + // 清楚地图覆盖物 | |
| 388 | + mapBValue.clearOverlays(); | |
| 389 | + | |
| 390 | + mapBValue.removeOverlay(); | |
| 391 | + | |
| 392 | + } | |
| 393 | + | |
| 394 | + } | |
| 395 | + | |
| 396 | + return Bmap; | |
| 397 | + | |
| 398 | 398 | }(); |
| 399 | 399 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/js/outbound-map.js
| 1 | -/** | |
| 2 | - * 百度地图 | |
| 3 | - * | |
| 4 | - * - - - - - -》init:地图初始化 | |
| 5 | - * | |
| 6 | - * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据 | |
| 7 | - * | |
| 8 | - * - - - - - -》getDistanceAndDuration:获取距离与时间 | |
| 9 | - * | |
| 10 | - * - - - - - -》pointsPolygon:地图画多边行 | |
| 11 | - * | |
| 12 | - * - - - - - -》pointsCircle:画圆 | |
| 13 | - * | |
| 14 | - * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标 | |
| 15 | - * | |
| 16 | - * - - - - - -》drawingUpline:在地图上画出上行线路走向 | |
| 17 | - * | |
| 18 | - * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划) | |
| 19 | - * | |
| 20 | - * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划) | |
| 21 | - * | |
| 22 | - * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划) | |
| 23 | - */ | |
| 24 | - | |
| 25 | -var WorldsBMap = function () { | |
| 26 | - | |
| 27 | - /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆 */ | |
| 28 | - var mapBValue = '';polygon='',polyUpline='',circle='',iseditStatus = false; | |
| 29 | - | |
| 30 | - var Bmap = { | |
| 31 | - | |
| 32 | - init : function() { | |
| 33 | - | |
| 34 | - // 设置中心点, | |
| 35 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 36 | - | |
| 37 | - // 百度API Key | |
| 38 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | |
| 39 | - | |
| 40 | - // 初始化百度地图 | |
| 41 | - mapBValue = new BMap.Map("bmap_basic"); | |
| 42 | - | |
| 43 | - //中心点和缩放级别 | |
| 44 | - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 45 | - | |
| 46 | - //启用地图拖拽事件,默认启用(可不写) | |
| 47 | - mapBValue.enableDragging(); | |
| 48 | - | |
| 49 | - //启用地图滚轮放大缩小 | |
| 50 | - mapBValue.enableScrollWheelZoom(); | |
| 51 | - | |
| 52 | - //禁用鼠标双击放大 | |
| 53 | - mapBValue.disableDoubleClickZoom(); | |
| 54 | - | |
| 55 | - //启用键盘上下左右键移动地图 | |
| 56 | - mapBValue.enableKeyboard(); | |
| 57 | - | |
| 58 | - return mapBValue; | |
| 59 | - }, | |
| 60 | - | |
| 61 | - /** 获取地图对象 @return 地图对象map */ | |
| 62 | - getmapBValue : function() { | |
| 63 | - | |
| 64 | - return mapBValue; | |
| 65 | - | |
| 66 | - }, | |
| 67 | - | |
| 68 | - getPolygon : function(){ | |
| 69 | - | |
| 70 | - return polygon; | |
| 71 | - }, | |
| 72 | - | |
| 73 | - getPolyUpline : function() { | |
| 74 | - | |
| 75 | - return polyUpline; | |
| 76 | - }, | |
| 77 | - | |
| 78 | - getCircle : function() { | |
| 79 | - | |
| 80 | - return circle; | |
| 81 | - }, | |
| 82 | - | |
| 83 | - getIsEditStatus : function() { | |
| 84 | - return iseditStatus; | |
| 85 | - }, | |
| 86 | - | |
| 87 | - setIsEditStatus : function(v) { | |
| 88 | - iseditStatus = v ; | |
| 89 | - }, | |
| 90 | - | |
| 91 | - initDrawingManager: function(map,styleOptions) { | |
| 92 | - | |
| 93 | - }, | |
| 94 | - | |
| 95 | - getDrawingManagerObj : function() { | |
| 96 | - | |
| 97 | - return drawingManagerInitV; | |
| 98 | - }, | |
| 99 | - | |
| 100 | - // 从百度地图抓去站点与路段数据 | |
| 101 | - lineInfoPanl : function(lineNameValue,i,cb) { | |
| 102 | - | |
| 103 | - /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */ | |
| 104 | - WorldsBMap.getBmapStationNames(lineNameValue,i,function(BusLine){ | |
| 105 | - | |
| 106 | - return cb && cb(BusLine); | |
| 107 | - | |
| 108 | - }); | |
| 109 | - | |
| 110 | - }, | |
| 111 | - | |
| 112 | - /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 113 | - getDistanceAndDuration : function(points,callback){ | |
| 114 | - | |
| 115 | - // 获取长度 | |
| 116 | - var len = points.length; | |
| 117 | - | |
| 118 | - (function(){ | |
| 119 | - | |
| 120 | - if (!arguments.callee.count) { | |
| 121 | - | |
| 122 | - arguments.callee.count = 0; | |
| 123 | - | |
| 124 | - } | |
| 125 | - | |
| 126 | - arguments.callee.count++; | |
| 127 | - | |
| 128 | - var index = parseInt(arguments.callee.count) - 1; | |
| 129 | - | |
| 130 | - if (index >= len-1) { | |
| 131 | - | |
| 132 | - callback && callback(points); | |
| 133 | - | |
| 134 | - return; | |
| 135 | - } | |
| 136 | - | |
| 137 | - // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 138 | - var f = arguments.callee; | |
| 139 | - | |
| 140 | - // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 141 | - var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 142 | - | |
| 143 | - // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 144 | - var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 145 | - | |
| 146 | - var region = '上海'; | |
| 147 | - | |
| 148 | - var origin_region = '上海'; | |
| 149 | - | |
| 150 | - var destination_region = '上海'; | |
| 151 | - | |
| 152 | - var output = 'json'; | |
| 153 | - | |
| 154 | - var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 155 | - | |
| 156 | - /** | |
| 157 | - * origin:起点名称或经纬度; | |
| 158 | - * | |
| 159 | - * destination:终点名称或经纬度; | |
| 160 | - * | |
| 161 | - * origin_region:起始点所在城市,驾车导航时必填。 | |
| 162 | - * | |
| 163 | - * destination_region:终点所在城市,驾车导航时必填。 | |
| 164 | - * | |
| 165 | - * output :表示输出类型,可设置为xml或json,默认为xml。 | |
| 166 | - * | |
| 167 | - **/ | |
| 168 | - var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 169 | - | |
| 170 | - /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 171 | - $.ajax({ | |
| 172 | - | |
| 173 | - // 百度地图根据坐标获取两点之间的时间与距离 | |
| 174 | - url: '//api.map.baidu.com/direction/v1?mode=transit', | |
| 175 | - | |
| 176 | - data: paramsB, | |
| 177 | - | |
| 178 | - dataType: 'jsonp', | |
| 179 | - | |
| 180 | - success: function(r){ | |
| 181 | - | |
| 182 | - if(r) { | |
| 183 | - | |
| 184 | - if(r.message=='ok') { | |
| 185 | - | |
| 186 | - if(r.result.taxi==null) { | |
| 187 | - | |
| 188 | - // 获取距离(单位:米) | |
| 189 | - points[index+1].distance = 0; | |
| 190 | - | |
| 191 | - // 获取时间(单位:秒) | |
| 192 | - points[index+1].duration = 0; | |
| 193 | - | |
| 194 | - }else { | |
| 195 | - | |
| 196 | - // 获取距离(单位:米) | |
| 197 | - points[index+1].distance = r.result.taxi.distance; | |
| 198 | - | |
| 199 | - // 获取时间(单位:秒) | |
| 200 | - points[index+1].duration = r.result.taxi.duration; | |
| 201 | - | |
| 202 | - } | |
| 203 | - | |
| 204 | - | |
| 205 | - } | |
| 206 | - | |
| 207 | - } | |
| 208 | - | |
| 209 | - f(); | |
| 210 | - } | |
| 211 | - }); | |
| 212 | - | |
| 213 | - })(); | |
| 214 | - | |
| 215 | - }, | |
| 216 | - | |
| 217 | - // 地图画多边形 | |
| 218 | - pointsPolygon : function(objStation) { | |
| 219 | - | |
| 220 | - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 221 | - mapBValue.setZoom(15); | |
| 222 | - | |
| 223 | - // 如果不为空 | |
| 224 | - if(objStation) { | |
| 225 | - | |
| 226 | - // 获取中心点坐标字符串 | |
| 227 | - var testpointStr = objStation.stationBJwpoints; | |
| 228 | - | |
| 229 | - // 按空格切割中心点坐标字符串 | |
| 230 | - var BJwpointsPolygon = testpointStr.split(' '); | |
| 231 | - | |
| 232 | - // 中心点坐标 | |
| 233 | - var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]); | |
| 234 | - | |
| 235 | - // 获取多边形坐标字符串 | |
| 236 | - var stationBPolygonGrid = objStation.stationBPolygonGrid; | |
| 237 | - | |
| 238 | - // 截取多边形坐标字符串 | |
| 239 | - var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | |
| 240 | - | |
| 241 | - // 按逗号切割 | |
| 242 | - var pointPolygonArray = stationBPolygonGridStr.split(','); | |
| 243 | - | |
| 244 | - // 多边形坐标集合 | |
| 245 | - var polygonP = []; | |
| 246 | - | |
| 247 | - for(var v = 0;v<pointPolygonArray.length;v++) { | |
| 248 | - | |
| 249 | - polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | |
| 250 | - | |
| 251 | - } | |
| 252 | - | |
| 253 | - // 画多边形 | |
| 254 | - polygon = new BMap.Polygon(polygonP, { | |
| 255 | - | |
| 256 | - // 线条显色 | |
| 257 | - strokeColor : "blue", | |
| 258 | - | |
| 259 | - // 边线的宽度,以像素为单位。 | |
| 260 | - strokeWeight : 2, | |
| 261 | - | |
| 262 | - // 边线透明度,取值范围0 - 1。 | |
| 263 | - strokeOpacity : 0.5 | |
| 264 | - }); | |
| 265 | - | |
| 266 | - // 增加地图覆盖物多边形 | |
| 267 | - mapBValue.addOverlay(polygon); | |
| 268 | - | |
| 269 | - // 信息窗口属性 | |
| 270 | - var opts_polygon = { | |
| 271 | - | |
| 272 | - // 信息窗口宽度 | |
| 273 | - width : 200, | |
| 274 | - | |
| 275 | - // 信息窗口高度 | |
| 276 | - height : 400, | |
| 277 | - | |
| 278 | - // 信息窗位置偏移值。 | |
| 279 | - offset: new BMap.Size(500,20), | |
| 280 | - | |
| 281 | - //标题 | |
| 282 | - title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | |
| 283 | - | |
| 284 | - //设置不允许信窗发送短息 | |
| 285 | - enableMessage : false, | |
| 286 | - | |
| 287 | - //是否开启点击地图关闭信息窗口 | |
| 288 | - enableCloseOnClick : false | |
| 289 | - }; | |
| 290 | - | |
| 291 | - var markTypeStr = ''; | |
| 292 | - | |
| 293 | - if(objStation.stationRouteStationMark=='B') { | |
| 294 | - | |
| 295 | - markTypeStr='起点站'; | |
| 296 | - | |
| 297 | - }else if(objStation.stationRouteStationMark=='Z') { | |
| 298 | - | |
| 299 | - markTypeStr ='中途站'; | |
| 300 | - | |
| 301 | - | |
| 302 | - }else if(objStation.stationRouteStationMark=='E') { | |
| 303 | - | |
| 304 | - markTypeStr='终点站'; | |
| 305 | - | |
| 306 | - } | |
| 307 | - | |
| 308 | - var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | |
| 309 | - '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' + | |
| 310 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' + | |
| 311 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | |
| 312 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' + | |
| 313 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' + | |
| 314 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | |
| 315 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | |
| 316 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' + | |
| 317 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationRouteVersions + '</span>' + | |
| 318 | - '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD;'+ | |
| 319 | - 'overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ | |
| 320 | - objStation.stationRouteDescriptions +'" >说明/描述:' + objStation.stationRouteDescriptions + '</span>' ; | |
| 321 | - | |
| 322 | - // 创建信息窗口 | |
| 323 | - var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon); | |
| 324 | - // 自定义标注物图片 | |
| 325 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 326 | - | |
| 327 | - // 创建点 | |
| 328 | - marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | |
| 329 | - | |
| 330 | - // 把标注添物加到地图上 | |
| 331 | - mapBValue.addOverlay(marker); | |
| 332 | - | |
| 333 | - // 是否在平移过程中禁止动画。(自1.2新增) | |
| 334 | - var PanOptions_ ={noAnimation :true}; | |
| 335 | - | |
| 336 | - // 将地图的中心点更改为给定的点。 | |
| 337 | - mapBValue.panTo(pointPolygon,PanOptions_); | |
| 338 | - | |
| 339 | - // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | |
| 340 | - mapBValue.panBy(10,-150,PanOptions_); | |
| 341 | - | |
| 342 | - //开启信息窗口 | |
| 343 | - mapBValue.openInfoWindow(infoWindow_target,pointPolygon); | |
| 344 | - | |
| 345 | - } | |
| 346 | - | |
| 347 | - }, | |
| 348 | - | |
| 349 | - editPolyUpline : function() { | |
| 350 | - // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | |
| 351 | - polyUpline.disableMassClear(); | |
| 352 | - WorldsBMap.clearMarkAndOverlays(); | |
| 353 | - // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | |
| 354 | - polyUpline.enableMassClear(); | |
| 355 | - // 开启线路编辑 | |
| 356 | - polyUpline.enableEditing(); | |
| 357 | - // 添加双击折线保存事件 | |
| 358 | - polyUpline.addEventListener('dblclick',function(e) { | |
| 359 | - // 关闭 | |
| 360 | - layer.closeAll(); | |
| 361 | - polyUpline.disableEditing(); | |
| 362 | - // 获取折线坐标集合 | |
| 363 | - var editPloyLineArray = polyUpline.getPath(); | |
| 364 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 365 | - polyUpline= ''; | |
| 366 | - // 加载修改路段弹出层mobal页面 | |
| 367 | - $.get('editsection.html', function(m){ | |
| 368 | - $(pjaxContainer).append(m); | |
| 369 | - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 370 | - }); | |
| 371 | - }); | |
| 372 | - }, | |
| 373 | - | |
| 374 | - // 画圆 | |
| 375 | - pointsCircle : function(objStation) { | |
| 376 | - | |
| 377 | - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 378 | - mapBValue.setZoom(16); | |
| 379 | - | |
| 380 | - if(objStation) { | |
| 381 | - | |
| 382 | - // 清除地图覆盖物 | |
| 383 | - mapBValue.clearOverlays(); | |
| 384 | - | |
| 385 | - // 获取中心坐标点字符串分割 | |
| 386 | - var BJwpoints = objStation.stationBJwpoints.split(' '); | |
| 387 | - | |
| 388 | - // 中心坐标点 | |
| 389 | - var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); | |
| 390 | - | |
| 391 | - //创建圆 | |
| 392 | - circle = new BMap.Circle(point,objStation.stationRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 393 | - | |
| 394 | - // 允许覆盖物在map.clearOverlays方法中被清除 | |
| 395 | - circle.enableMassClear(); | |
| 396 | - | |
| 397 | - // 百度地图添加覆盖物圆 | |
| 398 | - mapBValue.addOverlay(circle); | |
| 399 | - | |
| 400 | - // 信息窗口参数属性 | |
| 401 | - var opts = { | |
| 402 | - | |
| 403 | - // 信息窗口宽度 | |
| 404 | - width : 200, | |
| 405 | - | |
| 406 | - // 信息窗口高度 | |
| 407 | - height : 450, | |
| 408 | - | |
| 409 | - // 信息窗位置偏移值。 | |
| 410 | - offset: new BMap.Size(500,120), | |
| 411 | - | |
| 412 | - //标题 | |
| 413 | - title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | |
| 414 | - | |
| 415 | - //设置不允许信窗发送短息 | |
| 416 | - enableMessage : false, | |
| 417 | - | |
| 418 | - //是否开启点击地图关闭信息窗口 | |
| 419 | - enableCloseOnClick : false, | |
| 420 | - | |
| 421 | - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | |
| 422 | - enableAutoPan:false | |
| 423 | - }; | |
| 424 | - | |
| 425 | - var markTypeStr = ''; | |
| 426 | - | |
| 427 | - if(objStation.stationRouteStationMark=='B') { | |
| 428 | - | |
| 429 | - markTypeStr='起点站'; | |
| 430 | - | |
| 431 | - }else if(objStation.stationRouteStationMark=='Z') { | |
| 432 | - | |
| 433 | - markTypeStr ='中途站'; | |
| 434 | - | |
| 435 | - | |
| 436 | - }else if(objStation.stationRouteStationMark=='E') { | |
| 437 | - | |
| 438 | - markTypeStr='终点站'; | |
| 439 | - | |
| 440 | - } | |
| 441 | - | |
| 442 | - var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | |
| 443 | - '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' + | |
| 444 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' + | |
| 445 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | |
| 446 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' + | |
| 447 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' + | |
| 448 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | |
| 449 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | |
| 450 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' + | |
| 451 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationRouteVersions + '</span>' + | |
| 452 | - '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD;'+ | |
| 453 | - 'overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ | |
| 454 | - objStation.stationRouteDescriptions +'" >说明/描述:' + objStation.stationRouteDescriptions + '</span>' ; | |
| 455 | - | |
| 456 | - // 创建信息窗口 | |
| 457 | - var infoWindow_target = new BMap.InfoWindow(htm, opts); | |
| 458 | - // 自定义标注物图片 | |
| 459 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 460 | - | |
| 461 | - // 创建点 | |
| 462 | - marker = new BMap.Marker(point,{icon : icon_target}); | |
| 463 | - | |
| 464 | - // 把标注添物加到地图上 | |
| 465 | - mapBValue.addOverlay(marker); | |
| 466 | - | |
| 467 | - setTimeout(function(){ | |
| 468 | - //开启信息窗口 | |
| 469 | - marker.openInfoWindow(infoWindow_target,point); | |
| 470 | - | |
| 471 | - },100); | |
| 472 | - | |
| 473 | - // 是否在平移过程中禁止动画。(自1.2新增) | |
| 474 | - var PanOptions_ ={noAnimation :true}; | |
| 475 | - | |
| 476 | - // 将地图的中心点更改为给定的点。 | |
| 477 | - mapBValue.panTo(point,PanOptions_); | |
| 478 | - | |
| 479 | - mapBValue.panBy(10,-200,PanOptions_); | |
| 480 | - | |
| 481 | - // 添加标志物监听事件 | |
| 482 | - marker.addEventListener("click",function() { | |
| 483 | - | |
| 484 | - //开启信息窗口 | |
| 485 | - marker.openInfoWindow(infoWindow_target,point); | |
| 486 | - | |
| 487 | - }); | |
| 488 | - | |
| 489 | - } | |
| 490 | - | |
| 491 | - }, | |
| 492 | - | |
| 493 | - // 根据地理名称获取百度经纬度坐标 | |
| 494 | - localSearchFromAdreesToPoint: function(Address,callback) { | |
| 495 | - | |
| 496 | - // 创建一个搜索类实例 | |
| 497 | - var localSearch = new BMap.LocalSearch(mapBValue); | |
| 498 | - | |
| 499 | - // 检索完成后的回调函数。 | |
| 500 | - localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 501 | - | |
| 502 | - var resultPoints = ''; | |
| 503 | - | |
| 504 | - if(searchResult) { | |
| 505 | - | |
| 506 | - // 返回索引指定的结果。索引0表示第1条结果 | |
| 507 | - var poi = searchResult.getPoi(0); | |
| 508 | - | |
| 509 | - if(poi) { | |
| 510 | - | |
| 511 | - //获取经度和纬度 | |
| 512 | - resultPoints = poi.point.lng + ' ' + poi.point.lat; | |
| 513 | - | |
| 514 | - callback && callback(resultPoints); | |
| 515 | - | |
| 516 | - }else { | |
| 517 | - | |
| 518 | - callback && callback(false); | |
| 519 | - | |
| 520 | - } | |
| 521 | - | |
| 522 | - }else { | |
| 523 | - | |
| 524 | - callback && callback(false); | |
| 525 | - } | |
| 526 | - | |
| 527 | - }); | |
| 528 | - | |
| 529 | - // 根据检索词发起检索。 | |
| 530 | - localSearch.search(Address); | |
| 531 | - | |
| 532 | - }, | |
| 533 | - | |
| 534 | - // 编辑图形 | |
| 535 | - editShapes : function(editStationName,stationShapesTypeV,mindex) { | |
| 536 | - | |
| 537 | - // 关闭信息窗口 | |
| 538 | - marker.closeInfoWindow(); | |
| 539 | - | |
| 540 | - // 清除marker | |
| 541 | - mapBValue.removeOverlay(marker); | |
| 542 | - | |
| 543 | - // 编辑圆 | |
| 544 | - if(stationShapesTypeV =='r') { | |
| 545 | - | |
| 546 | - // 开启编辑功能 | |
| 547 | - circle.enableEditing(); | |
| 548 | - | |
| 549 | - // 编辑圆监听事件 | |
| 550 | - circle.addEventListener('dblclick',function() { | |
| 551 | - | |
| 552 | - // 关闭提示弹出层 | |
| 553 | - layer.close(mindex); | |
| 554 | - | |
| 555 | - // 返回圆形的半径,单位为米。 | |
| 556 | - var newRadius = circle.getRadius(); | |
| 557 | - | |
| 558 | - // 返回圆形的中心点坐标。 | |
| 559 | - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 560 | - | |
| 561 | - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 562 | - | |
| 563 | - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | |
| 564 | - EditStationObj.setEitdStationBJwpoints(newCenter); | |
| 565 | - | |
| 566 | - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | |
| 567 | - EditStationObj.setEitdStationShapesType('r'); | |
| 568 | - | |
| 569 | - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ | |
| 570 | - EditStationObj.setEitdStationRadius(Math.round(newRadius)); | |
| 571 | - | |
| 572 | - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | |
| 573 | - EditStationObj.setEitdBPolygonGrid(''); | |
| 574 | - | |
| 575 | - // 加载编辑页面 | |
| 576 | - $.get('edit.html', function(m){ | |
| 577 | - | |
| 578 | - $(pjaxContainer).append(m); | |
| 579 | - | |
| 580 | - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]); | |
| 581 | - | |
| 582 | - }); | |
| 583 | - | |
| 584 | - }); | |
| 585 | - | |
| 586 | - // 编辑多变行 | |
| 587 | - }else if(stationShapesTypeV =='d') { | |
| 588 | - | |
| 589 | - // 开启编辑功能(自 1.1 新增) | |
| 590 | - polygon.enableEditing(); | |
| 591 | - | |
| 592 | - // 添加多变行编辑事件 | |
| 593 | - polygon.addEventListener('dblclick',function(e) { | |
| 594 | - | |
| 595 | - // 获取编辑的多边形对象 | |
| 596 | - var edit_pointE = polygon; | |
| 597 | - | |
| 598 | - var edit_bPloygonGrid = ""; | |
| 599 | - | |
| 600 | - var editPolyGonLen_ = edit_pointE.getPath().length; | |
| 601 | - | |
| 602 | - for(var k =0;k<editPolyGonLen_;k++) { | |
| 603 | - | |
| 604 | - if(k==0) { | |
| 605 | - | |
| 606 | - edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 607 | - | |
| 608 | - }else { | |
| 609 | - | |
| 610 | - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 611 | - | |
| 612 | - } | |
| 613 | - | |
| 614 | - } | |
| 615 | - | |
| 616 | - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | |
| 617 | - | |
| 618 | - // 多边形中心点 | |
| 619 | - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | |
| 620 | - | |
| 621 | - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | |
| 622 | - EditStationObj.setEitdStationBJwpoints(centre_points); | |
| 623 | - | |
| 624 | - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | |
| 625 | - EditStationObj.setEitdStationShapesType('d'); | |
| 626 | - | |
| 627 | - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ | |
| 628 | - EditStationObj.setEitdStationRadius(''); | |
| 629 | - | |
| 630 | - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | |
| 631 | - EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); | |
| 632 | - | |
| 633 | - $.get('edit.html', function(m){ | |
| 634 | - | |
| 635 | - $(pjaxContainer).append(m); | |
| 636 | - | |
| 637 | - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]); | |
| 638 | - | |
| 639 | - }); | |
| 640 | - | |
| 641 | - }); | |
| 642 | - | |
| 643 | - } | |
| 644 | - | |
| 645 | - }, | |
| 646 | - | |
| 647 | - // 在地图上画出上行线路走向 | |
| 648 | - drawingUpline : function (polylineArray,polyline_center,data) { | |
| 649 | - /*WorldsBMap.clearMarkAndOverlays();*/ | |
| 650 | - polyUpline = ''; | |
| 651 | - // 创建线路走向 | |
| 652 | - polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 653 | - // polyUpline.data = data; | |
| 654 | - // 把折线添加到地图上 | |
| 655 | - mapBValue.addOverlay(polyUpline); | |
| 656 | - /*var ceter_index = Math.round(resultdata.length / 2); | |
| 657 | - | |
| 658 | - var ceterPointsStr = resultdata[ceter_index].bJwpoints; | |
| 659 | - | |
| 660 | - var ceterPointsArray = ceterPointsStr.split(' '); | |
| 661 | - | |
| 662 | - var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);*/ | |
| 663 | - var PanOptions_ ={noAnimation :true}; | |
| 664 | - mapBValue.reset(); | |
| 665 | - mapBValue.panTo(polyline_center,PanOptions_); | |
| 666 | - mapBValue.panBy(500,-510,PanOptions_); | |
| 667 | - mapBValue.setZoom(14); | |
| 668 | - }, | |
| 669 | - | |
| 670 | - //在地图上画出公交位置。 | |
| 671 | - drawingBus :function(lon,lat){ | |
| 672 | - var point = new BMap.Point(lon,lat); | |
| 673 | - var myIcon = new BMap.Icon("/pages/excep/img/bus.png", new BMap.Size(300,157)); | |
| 674 | - var marker = new BMap.Marker(point,{icon:myIcon}); // 创建标注 | |
| 675 | - mapBValue.addOverlay(marker); | |
| 676 | - marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画 | |
| 677 | - }, | |
| 678 | - | |
| 679 | - // 在地图上画出上行线路走向 | |
| 680 | - drawingUpline01 : function (polylineArray,polyline_center,data) { | |
| 681 | - var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | |
| 682 | - // 创建线路走向 | |
| 683 | - polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 684 | - polyUpline01.data = data; | |
| 685 | - // 把折线添加到地图上 | |
| 686 | - mapBValue.addOverlay(polyUpline01); | |
| 687 | - polyUpline01.addEventListener('click',function(e) { | |
| 688 | - if(WorldsBMap.getIsEditStatus()) { | |
| 689 | - layer.msg('请先保存正在编辑的路段信息...'); | |
| 690 | - return false; | |
| 691 | - } | |
| 692 | - polyUpline01.enableEditing(); | |
| 693 | - WorldsBMap.setIsEditStatus(true); | |
| 694 | - }); | |
| 695 | - // 添加双击折线保存事件 | |
| 696 | - polyUpline01.addEventListener('dblclick',function(e) { | |
| 697 | - WorldsBMap.setIsEditStatus(false); | |
| 698 | - // 关闭 | |
| 699 | - layer.closeAll(); | |
| 700 | - polyUpline01.disableEditing(); | |
| 701 | - EditSectionObj.setEitdSection(polyUpline01.data); | |
| 702 | - // 获取折线坐标集合 | |
| 703 | - var editPloyLineArray = polyUpline01.getPath(); | |
| 704 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 705 | - // polyUpline= ''; | |
| 706 | - // 加载修改路段弹出层mobal页面 | |
| 707 | - $.get('editsection.html', function(m){ | |
| 708 | - $(pjaxContainer).append(m); | |
| 709 | - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 710 | - }); | |
| 711 | - }); | |
| 712 | - var PanOptions_ ={noAnimation :true}; | |
| 713 | - mapBValue.reset(); | |
| 714 | - mapBValue.panTo(polyline_center,PanOptions_); | |
| 715 | - mapBValue.panBy(500,-510,PanOptions_); | |
| 716 | - mapBValue.setZoom(14); | |
| 717 | - }, | |
| 718 | - | |
| 719 | - /** 在地图上画点 @param:<point_center:中心坐标点> */ | |
| 720 | - drawingUpStationPoint : function(point_center,stationName,s) { | |
| 721 | - | |
| 722 | - // 自定义标注物图片 | |
| 723 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | |
| 724 | - | |
| 725 | - var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | |
| 726 | - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 727 | - + '</div>' | |
| 728 | - + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | |
| 729 | - | |
| 730 | - | |
| 731 | - var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | |
| 732 | - "anchor" : new BMap.Size(-10,8), | |
| 733 | - "enableDragging" : true}); | |
| 734 | - | |
| 735 | - | |
| 736 | - myRichMarker1.disableDragging(); | |
| 737 | - mapBValue.addOverlay(myRichMarker1); | |
| 738 | - | |
| 739 | - | |
| 740 | - // 创建标注物 | |
| 741 | - marker = new BMap.Marker(point_center,{icon : icon_target}); | |
| 742 | - | |
| 743 | - // 允许覆盖物在map.clearOverlays方法中被清除。 | |
| 744 | - marker.enableMassClear(); | |
| 745 | - | |
| 746 | - mapBValue.addOverlay(marker); | |
| 747 | - }, | |
| 748 | - | |
| 749 | - // 站点名称获取百度坐标(手动规划) | |
| 750 | - stationsNameToPoints : function(arra,callback) { | |
| 751 | - // 获取长度 | |
| 752 | - var len = arra.length; | |
| 753 | - var stationList = []; | |
| 754 | - (function(){ | |
| 755 | - if (!arguments.callee.count) { | |
| 756 | - arguments.callee.count = 0; | |
| 757 | - } | |
| 758 | - arguments.callee.count++; | |
| 759 | - var index = parseInt(arguments.callee.count) - 1; | |
| 760 | - if (index >= len) { | |
| 761 | - callback && callback(stationList); | |
| 762 | - return ; | |
| 763 | - } | |
| 764 | - var f = arguments.callee; | |
| 765 | - if(arra[index].name!=''){ | |
| 766 | - var localSearch = new BMap.LocalSearch(mapBValue); | |
| 767 | - localSearch.search(arra[index].name); | |
| 768 | - localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 769 | - var poi = searchResult.getPoi(0); | |
| 770 | - if(poi) { | |
| 771 | - stationList.push({name:arra[index].name.replace('公交车站',''),wgs:arra[index].wgs,potion:{lng:poi.point.lng,lat:poi.point.lat}}); | |
| 772 | - }else { | |
| 773 | - stationList.push({name:arra[index].name.replace('公交车站',''),wgs:arra[index].wgs,potion:{lng:arra[index].wgs.x,lat:arra[index].wgs.y}}); | |
| 774 | - } | |
| 775 | - f(); | |
| 776 | - }); | |
| 777 | - }else { | |
| 778 | - f(); | |
| 779 | - } | |
| 780 | - })(); | |
| 781 | - }, | |
| 782 | - | |
| 783 | - // 根据坐标点获取两点之间的时间与距离(手动规划) | |
| 784 | - getDistanceAndTotime : function(stationList,cb) { | |
| 785 | - | |
| 786 | - stationList[0].distance = ''; | |
| 787 | - | |
| 788 | - stationList[0].duration = ''; | |
| 789 | - | |
| 790 | - // var sectionList = []; | |
| 791 | - | |
| 792 | - // 获取长度 | |
| 793 | - var len = stationList.length; | |
| 794 | - | |
| 795 | - (function(){ | |
| 796 | - | |
| 797 | - if (!arguments.callee.count) { | |
| 798 | - | |
| 799 | - arguments.callee.count = 0; | |
| 800 | - | |
| 801 | - } | |
| 802 | - | |
| 803 | - arguments.callee.count++; | |
| 804 | - | |
| 805 | - var index = parseInt(arguments.callee.count) - 1; | |
| 806 | - | |
| 807 | - if (index >= len-1) { | |
| 808 | - | |
| 809 | - // cb && cb(stationList,sectionList); | |
| 810 | - cb && cb(stationList); | |
| 811 | - return; | |
| 812 | - } | |
| 813 | - | |
| 814 | - var f = arguments.callee; | |
| 815 | - | |
| 816 | - var poiOne = new BMap.Point(stationList[index].potion.lng,stationList[index].potion.lat); | |
| 817 | - | |
| 818 | - var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat); | |
| 819 | - | |
| 820 | - var transit = new BMap.TransitRoute(mapBValue, {renderOptions: {map: mapBValue},onSearchComplete: searchComplete}); | |
| 821 | - | |
| 822 | - transit.search(poiOne,poiTwo); | |
| 823 | - | |
| 824 | - function searchComplete(results){ | |
| 825 | - | |
| 826 | - var plan = results.getPlan(0); | |
| 827 | - | |
| 828 | - if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 829 | - | |
| 830 | - stationList[index+1].distance = ''; | |
| 831 | - | |
| 832 | - stationList[index+1].duration = ''; | |
| 833 | - | |
| 834 | - // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:''}); | |
| 835 | - | |
| 836 | - }else { | |
| 837 | - | |
| 838 | - stationList[index+1].distance = plan.getDistance(true); | |
| 839 | - | |
| 840 | - stationList[index+1].duration = plan.getDuration(true); | |
| 841 | - | |
| 842 | - // var line = plan.getRoute(0); | |
| 843 | - | |
| 844 | - // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:line.getPath()}); | |
| 845 | - | |
| 846 | - } | |
| 847 | - | |
| 848 | - f(); | |
| 849 | - } | |
| 850 | - | |
| 851 | - })(); | |
| 852 | - | |
| 853 | - }, | |
| 854 | - | |
| 855 | - // 根据坐标点获取两点之间的折线路段(手动规划) | |
| 856 | - getSectionListPlonly : function(stationsPoint,cb) { | |
| 857 | - | |
| 858 | - var len = stationsPoint.length; | |
| 859 | - | |
| 860 | - var sectionList = []; | |
| 861 | - | |
| 862 | - (function(){ | |
| 863 | - | |
| 864 | - if (!arguments.callee.count) { | |
| 865 | - | |
| 866 | - arguments.callee.count = 0; | |
| 867 | - | |
| 868 | - } | |
| 869 | - | |
| 870 | - arguments.callee.count++; | |
| 871 | - | |
| 872 | - var index = parseInt(arguments.callee.count) - 1; | |
| 873 | - | |
| 874 | - if (index >= len-1 ) { | |
| 875 | - | |
| 876 | - cb && cb(sectionList); | |
| 877 | - return; | |
| 878 | - } | |
| 879 | - | |
| 880 | - var f = arguments.callee; | |
| 881 | - | |
| 882 | - var poiOne = new BMap.Point(stationsPoint[index].potion.lng,stationsPoint[index].potion.lat); | |
| 883 | - | |
| 884 | - var poiTwo = new BMap.Point(stationsPoint[index+1].potion.lng,stationsPoint[index+1].potion.lat); | |
| 885 | - | |
| 886 | - /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/ | |
| 887 | - | |
| 888 | - var transit = new BMap.DrivingRoute(mapBValue, {renderOptions: {map: mapBValue},onPolylinesSet: searchPolylinesSet}); | |
| 889 | - | |
| 890 | - function searchPolylinesSet(results){ | |
| 891 | - | |
| 892 | - if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 893 | - | |
| 894 | - | |
| 895 | - }else { | |
| 896 | - | |
| 897 | - var sectionArrayList = []; | |
| 898 | - for (i = 0; i < results.length; i++){ | |
| 899 | - | |
| 900 | - // console.log(results[i].getPolyline().getPath()); | |
| 901 | - sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath()); | |
| 902 | - | |
| 903 | - } | |
| 904 | - | |
| 905 | - var sectionName = stationsPoint[index].name + '至' + stationsPoint[index+1].name; | |
| 906 | - | |
| 907 | - sectionList.push({sectionName:sectionName,points:sectionArrayList}); | |
| 908 | - | |
| 909 | - } | |
| 910 | - | |
| 911 | - f(); | |
| 912 | - } | |
| 913 | - | |
| 914 | - transit.search(poiOne,poiTwo); | |
| 915 | - | |
| 916 | - })(); | |
| 917 | - | |
| 918 | - }, | |
| 919 | - | |
| 920 | - localtionPoint : function(stationNameV) { | |
| 921 | - | |
| 922 | - WorldsBMap.localSearchFromAdreesToPoint(stationNameV,function(Points) { | |
| 923 | - | |
| 924 | - if(Points) { | |
| 925 | - | |
| 926 | - var BJwpointsArray = Points.split(' '); | |
| 927 | - | |
| 928 | - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 929 | - | |
| 930 | - var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 931 | - | |
| 932 | - var PanOptions ={noAnimation :true}; | |
| 933 | - | |
| 934 | - mapBValue.panTo(stationNameChangePoint,PanOptions); | |
| 935 | - | |
| 936 | - mapBValue.panBy(0,-100); | |
| 937 | - | |
| 938 | - // 将标注添加到地图中 | |
| 939 | - mapBValue.addOverlay(marker_stargt2); | |
| 940 | - | |
| 941 | - //跳动的动画 | |
| 942 | - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 943 | - | |
| 944 | - } | |
| 945 | - | |
| 946 | - }); | |
| 947 | - | |
| 948 | - }, | |
| 949 | - | |
| 950 | - /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ | |
| 951 | - getBmapStationNames : function(lineNameValue,i,callback) { | |
| 952 | - | |
| 953 | - var busline = new BMap.BusLineSearch(mapBValue,{ | |
| 954 | - | |
| 955 | - // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 | |
| 956 | - onGetBusListComplete:function(BusListResult) { | |
| 957 | - | |
| 958 | - // 如果不为空 | |
| 959 | - if(BusListResult){ | |
| 960 | - | |
| 961 | - //获取第一个公交列表显示到map上 | |
| 962 | - var fstLine = BusListResult.getBusListItem(i); | |
| 963 | - | |
| 964 | - /*if(fstLine==undefined){ | |
| 965 | - | |
| 966 | - layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | |
| 967 | - | |
| 968 | - layer.closeAll(); | |
| 969 | - | |
| 970 | - if(i==0){ | |
| 971 | - | |
| 972 | - $('#upToolsMobal').show(); | |
| 973 | - | |
| 974 | - }else if(i==1){ | |
| 975 | - | |
| 976 | - $('#downToolsMobal').show(); | |
| 977 | - | |
| 978 | - } | |
| 979 | - | |
| 980 | - return; | |
| 981 | - }); | |
| 982 | - | |
| 983 | - }*/ | |
| 984 | - | |
| 985 | - if(fstLine==undefined){ | |
| 986 | - | |
| 987 | - | |
| 988 | - callback && callback(null); | |
| 989 | - | |
| 990 | - } | |
| 991 | - | |
| 992 | - busline.getBusLine(fstLine); | |
| 993 | - | |
| 994 | - } | |
| 995 | - | |
| 996 | - }, | |
| 997 | - | |
| 998 | - //设置公交线路查询后的回调函数.参数:rs: BusLine类型 | |
| 999 | - onGetBusLineComplete: function(BusLine){ | |
| 1000 | - | |
| 1001 | - // 如果不为空 | |
| 1002 | - if(BusLine){ | |
| 1003 | - | |
| 1004 | - callback && callback(BusLine); | |
| 1005 | - | |
| 1006 | - } | |
| 1007 | - | |
| 1008 | - } | |
| 1009 | - | |
| 1010 | - }); | |
| 1011 | - | |
| 1012 | - busline.getBusList(lineNameValue); | |
| 1013 | - | |
| 1014 | - }, | |
| 1015 | - | |
| 1016 | - clearMarkAndOverlays : function() { | |
| 1017 | - | |
| 1018 | - // 清楚地图覆盖物 | |
| 1019 | - mapBValue.clearOverlays(); | |
| 1020 | - | |
| 1021 | - mapBValue.removeOverlay(); | |
| 1022 | - | |
| 1023 | - } | |
| 1024 | - | |
| 1025 | - } | |
| 1026 | - | |
| 1027 | - return Bmap; | |
| 1028 | - | |
| 1 | +/** | |
| 2 | + * 百度地图 | |
| 3 | + * | |
| 4 | + * - - - - - -》init:地图初始化 | |
| 5 | + * | |
| 6 | + * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据 | |
| 7 | + * | |
| 8 | + * - - - - - -》getDistanceAndDuration:获取距离与时间 | |
| 9 | + * | |
| 10 | + * - - - - - -》pointsPolygon:地图画多边行 | |
| 11 | + * | |
| 12 | + * - - - - - -》pointsCircle:画圆 | |
| 13 | + * | |
| 14 | + * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标 | |
| 15 | + * | |
| 16 | + * - - - - - -》drawingUpline:在地图上画出上行线路走向 | |
| 17 | + * | |
| 18 | + * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划) | |
| 19 | + * | |
| 20 | + * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划) | |
| 21 | + * | |
| 22 | + * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划) | |
| 23 | + */ | |
| 24 | + | |
| 25 | +var WorldsBMap = function () { | |
| 26 | + | |
| 27 | + /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆 */ | |
| 28 | + var mapBValue = '';polygon='',polyUpline='',circle='',iseditStatus = false; | |
| 29 | + | |
| 30 | + var Bmap = { | |
| 31 | + | |
| 32 | + init : function() { | |
| 33 | + | |
| 34 | + // 设置中心点, | |
| 35 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 36 | + | |
| 37 | + // 百度API Key | |
| 38 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw'; | |
| 39 | + | |
| 40 | + // 初始化百度地图 | |
| 41 | + mapBValue = new BMap.Map("bmap_basic"); | |
| 42 | + | |
| 43 | + //中心点和缩放级别 | |
| 44 | + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 45 | + | |
| 46 | + //启用地图拖拽事件,默认启用(可不写) | |
| 47 | + mapBValue.enableDragging(); | |
| 48 | + | |
| 49 | + //启用地图滚轮放大缩小 | |
| 50 | + mapBValue.enableScrollWheelZoom(); | |
| 51 | + | |
| 52 | + //禁用鼠标双击放大 | |
| 53 | + mapBValue.disableDoubleClickZoom(); | |
| 54 | + | |
| 55 | + //启用键盘上下左右键移动地图 | |
| 56 | + mapBValue.enableKeyboard(); | |
| 57 | + | |
| 58 | + return mapBValue; | |
| 59 | + }, | |
| 60 | + | |
| 61 | + /** 获取地图对象 @return 地图对象map */ | |
| 62 | + getmapBValue : function() { | |
| 63 | + | |
| 64 | + return mapBValue; | |
| 65 | + | |
| 66 | + }, | |
| 67 | + | |
| 68 | + getPolygon : function(){ | |
| 69 | + | |
| 70 | + return polygon; | |
| 71 | + }, | |
| 72 | + | |
| 73 | + getPolyUpline : function() { | |
| 74 | + | |
| 75 | + return polyUpline; | |
| 76 | + }, | |
| 77 | + | |
| 78 | + getCircle : function() { | |
| 79 | + | |
| 80 | + return circle; | |
| 81 | + }, | |
| 82 | + | |
| 83 | + getIsEditStatus : function() { | |
| 84 | + return iseditStatus; | |
| 85 | + }, | |
| 86 | + | |
| 87 | + setIsEditStatus : function(v) { | |
| 88 | + iseditStatus = v ; | |
| 89 | + }, | |
| 90 | + | |
| 91 | + initDrawingManager: function(map,styleOptions) { | |
| 92 | + | |
| 93 | + }, | |
| 94 | + | |
| 95 | + getDrawingManagerObj : function() { | |
| 96 | + | |
| 97 | + return drawingManagerInitV; | |
| 98 | + }, | |
| 99 | + | |
| 100 | + // 从百度地图抓去站点与路段数据 | |
| 101 | + lineInfoPanl : function(lineNameValue,i,cb) { | |
| 102 | + | |
| 103 | + /** 根据线路名称与方向从百度地图获取站点与路段 @param lineNameValue:线路名称;i:方向<0:上行;1:下行> */ | |
| 104 | + WorldsBMap.getBmapStationNames(lineNameValue,i,function(BusLine){ | |
| 105 | + | |
| 106 | + return cb && cb(BusLine); | |
| 107 | + | |
| 108 | + }); | |
| 109 | + | |
| 110 | + }, | |
| 111 | + | |
| 112 | + /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 113 | + getDistanceAndDuration : function(points,callback){ | |
| 114 | + | |
| 115 | + // 获取长度 | |
| 116 | + var len = points.length; | |
| 117 | + | |
| 118 | + (function(){ | |
| 119 | + | |
| 120 | + if (!arguments.callee.count) { | |
| 121 | + | |
| 122 | + arguments.callee.count = 0; | |
| 123 | + | |
| 124 | + } | |
| 125 | + | |
| 126 | + arguments.callee.count++; | |
| 127 | + | |
| 128 | + var index = parseInt(arguments.callee.count) - 1; | |
| 129 | + | |
| 130 | + if (index >= len-1) { | |
| 131 | + | |
| 132 | + callback && callback(points); | |
| 133 | + | |
| 134 | + return; | |
| 135 | + } | |
| 136 | + | |
| 137 | + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 138 | + var f = arguments.callee; | |
| 139 | + | |
| 140 | + // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 141 | + var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 142 | + | |
| 143 | + // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 144 | + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 145 | + | |
| 146 | + var region = '上海'; | |
| 147 | + | |
| 148 | + var origin_region = '上海'; | |
| 149 | + | |
| 150 | + var destination_region = '上海'; | |
| 151 | + | |
| 152 | + var output = 'json'; | |
| 153 | + | |
| 154 | + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 155 | + | |
| 156 | + /** | |
| 157 | + * origin:起点名称或经纬度; | |
| 158 | + * | |
| 159 | + * destination:终点名称或经纬度; | |
| 160 | + * | |
| 161 | + * origin_region:起始点所在城市,驾车导航时必填。 | |
| 162 | + * | |
| 163 | + * destination_region:终点所在城市,驾车导航时必填。 | |
| 164 | + * | |
| 165 | + * output :表示输出类型,可设置为xml或json,默认为xml。 | |
| 166 | + * | |
| 167 | + **/ | |
| 168 | + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 169 | + | |
| 170 | + /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 171 | + $.ajax({ | |
| 172 | + | |
| 173 | + // 百度地图根据坐标获取两点之间的时间与距离 | |
| 174 | + url: '//api.map.baidu.com/direction/v1?mode=transit', | |
| 175 | + | |
| 176 | + data: paramsB, | |
| 177 | + | |
| 178 | + dataType: 'jsonp', | |
| 179 | + | |
| 180 | + success: function(r){ | |
| 181 | + | |
| 182 | + if(r) { | |
| 183 | + | |
| 184 | + if(r.message=='ok') { | |
| 185 | + | |
| 186 | + if(r.result.taxi==null) { | |
| 187 | + | |
| 188 | + // 获取距离(单位:米) | |
| 189 | + points[index+1].distance = 0; | |
| 190 | + | |
| 191 | + // 获取时间(单位:秒) | |
| 192 | + points[index+1].duration = 0; | |
| 193 | + | |
| 194 | + }else { | |
| 195 | + | |
| 196 | + // 获取距离(单位:米) | |
| 197 | + points[index+1].distance = r.result.taxi.distance; | |
| 198 | + | |
| 199 | + // 获取时间(单位:秒) | |
| 200 | + points[index+1].duration = r.result.taxi.duration; | |
| 201 | + | |
| 202 | + } | |
| 203 | + | |
| 204 | + | |
| 205 | + } | |
| 206 | + | |
| 207 | + } | |
| 208 | + | |
| 209 | + f(); | |
| 210 | + } | |
| 211 | + }); | |
| 212 | + | |
| 213 | + })(); | |
| 214 | + | |
| 215 | + }, | |
| 216 | + | |
| 217 | + // 地图画多边形 | |
| 218 | + pointsPolygon : function(objStation) { | |
| 219 | + | |
| 220 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 221 | + mapBValue.setZoom(15); | |
| 222 | + | |
| 223 | + // 如果不为空 | |
| 224 | + if(objStation) { | |
| 225 | + | |
| 226 | + // 获取中心点坐标字符串 | |
| 227 | + var testpointStr = objStation.stationBJwpoints; | |
| 228 | + | |
| 229 | + // 按空格切割中心点坐标字符串 | |
| 230 | + var BJwpointsPolygon = testpointStr.split(' '); | |
| 231 | + | |
| 232 | + // 中心点坐标 | |
| 233 | + var pointPolygon = new BMap.Point(BJwpointsPolygon[0], BJwpointsPolygon[1]); | |
| 234 | + | |
| 235 | + // 获取多边形坐标字符串 | |
| 236 | + var stationBPolygonGrid = objStation.stationBPolygonGrid; | |
| 237 | + | |
| 238 | + // 截取多边形坐标字符串 | |
| 239 | + var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | |
| 240 | + | |
| 241 | + // 按逗号切割 | |
| 242 | + var pointPolygonArray = stationBPolygonGridStr.split(','); | |
| 243 | + | |
| 244 | + // 多边形坐标集合 | |
| 245 | + var polygonP = []; | |
| 246 | + | |
| 247 | + for(var v = 0;v<pointPolygonArray.length;v++) { | |
| 248 | + | |
| 249 | + polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | |
| 250 | + | |
| 251 | + } | |
| 252 | + | |
| 253 | + // 画多边形 | |
| 254 | + polygon = new BMap.Polygon(polygonP, { | |
| 255 | + | |
| 256 | + // 线条显色 | |
| 257 | + strokeColor : "blue", | |
| 258 | + | |
| 259 | + // 边线的宽度,以像素为单位。 | |
| 260 | + strokeWeight : 2, | |
| 261 | + | |
| 262 | + // 边线透明度,取值范围0 - 1。 | |
| 263 | + strokeOpacity : 0.5 | |
| 264 | + }); | |
| 265 | + | |
| 266 | + // 增加地图覆盖物多边形 | |
| 267 | + mapBValue.addOverlay(polygon); | |
| 268 | + | |
| 269 | + // 信息窗口属性 | |
| 270 | + var opts_polygon = { | |
| 271 | + | |
| 272 | + // 信息窗口宽度 | |
| 273 | + width : 200, | |
| 274 | + | |
| 275 | + // 信息窗口高度 | |
| 276 | + height : 400, | |
| 277 | + | |
| 278 | + // 信息窗位置偏移值。 | |
| 279 | + offset: new BMap.Size(500,20), | |
| 280 | + | |
| 281 | + //标题 | |
| 282 | + title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | |
| 283 | + | |
| 284 | + //设置不允许信窗发送短息 | |
| 285 | + enableMessage : false, | |
| 286 | + | |
| 287 | + //是否开启点击地图关闭信息窗口 | |
| 288 | + enableCloseOnClick : false | |
| 289 | + }; | |
| 290 | + | |
| 291 | + var markTypeStr = ''; | |
| 292 | + | |
| 293 | + if(objStation.stationRouteStationMark=='B') { | |
| 294 | + | |
| 295 | + markTypeStr='起点站'; | |
| 296 | + | |
| 297 | + }else if(objStation.stationRouteStationMark=='Z') { | |
| 298 | + | |
| 299 | + markTypeStr ='中途站'; | |
| 300 | + | |
| 301 | + | |
| 302 | + }else if(objStation.stationRouteStationMark=='E') { | |
| 303 | + | |
| 304 | + markTypeStr='终点站'; | |
| 305 | + | |
| 306 | + } | |
| 307 | + | |
| 308 | + var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | |
| 309 | + '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' + | |
| 310 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' + | |
| 311 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | |
| 312 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' + | |
| 313 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' + | |
| 314 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | |
| 315 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | |
| 316 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' + | |
| 317 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationRouteVersions + '</span>' + | |
| 318 | + '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD;'+ | |
| 319 | + 'overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ | |
| 320 | + objStation.stationRouteDescriptions +'" >说明/描述:' + objStation.stationRouteDescriptions + '</span>' ; | |
| 321 | + | |
| 322 | + // 创建信息窗口 | |
| 323 | + var infoWindow_target = new BMap.InfoWindow(htm, opts_polygon); | |
| 324 | + // 自定义标注物图片 | |
| 325 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 326 | + | |
| 327 | + // 创建点 | |
| 328 | + marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | |
| 329 | + | |
| 330 | + // 把标注添物加到地图上 | |
| 331 | + mapBValue.addOverlay(marker); | |
| 332 | + | |
| 333 | + // 是否在平移过程中禁止动画。(自1.2新增) | |
| 334 | + var PanOptions_ ={noAnimation :true}; | |
| 335 | + | |
| 336 | + // 将地图的中心点更改为给定的点。 | |
| 337 | + mapBValue.panTo(pointPolygon,PanOptions_); | |
| 338 | + | |
| 339 | + // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | |
| 340 | + mapBValue.panBy(10,-150,PanOptions_); | |
| 341 | + | |
| 342 | + //开启信息窗口 | |
| 343 | + mapBValue.openInfoWindow(infoWindow_target,pointPolygon); | |
| 344 | + | |
| 345 | + } | |
| 346 | + | |
| 347 | + }, | |
| 348 | + | |
| 349 | + editPolyUpline : function() { | |
| 350 | + // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | |
| 351 | + polyUpline.disableMassClear(); | |
| 352 | + WorldsBMap.clearMarkAndOverlays(); | |
| 353 | + // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | |
| 354 | + polyUpline.enableMassClear(); | |
| 355 | + // 开启线路编辑 | |
| 356 | + polyUpline.enableEditing(); | |
| 357 | + // 添加双击折线保存事件 | |
| 358 | + polyUpline.addEventListener('dblclick',function(e) { | |
| 359 | + // 关闭 | |
| 360 | + layer.closeAll(); | |
| 361 | + polyUpline.disableEditing(); | |
| 362 | + // 获取折线坐标集合 | |
| 363 | + var editPloyLineArray = polyUpline.getPath(); | |
| 364 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 365 | + polyUpline= ''; | |
| 366 | + // 加载修改路段弹出层mobal页面 | |
| 367 | + $.get('editsection.html', function(m){ | |
| 368 | + $(pjaxContainer).append(m); | |
| 369 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 370 | + }); | |
| 371 | + }); | |
| 372 | + }, | |
| 373 | + | |
| 374 | + // 画圆 | |
| 375 | + pointsCircle : function(objStation) { | |
| 376 | + | |
| 377 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 378 | + mapBValue.setZoom(16); | |
| 379 | + | |
| 380 | + if(objStation) { | |
| 381 | + | |
| 382 | + // 清除地图覆盖物 | |
| 383 | + mapBValue.clearOverlays(); | |
| 384 | + | |
| 385 | + // 获取中心坐标点字符串分割 | |
| 386 | + var BJwpoints = objStation.stationBJwpoints.split(' '); | |
| 387 | + | |
| 388 | + // 中心坐标点 | |
| 389 | + var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); | |
| 390 | + | |
| 391 | + //创建圆 | |
| 392 | + circle = new BMap.Circle(point,objStation.stationRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 393 | + | |
| 394 | + // 允许覆盖物在map.clearOverlays方法中被清除 | |
| 395 | + circle.enableMassClear(); | |
| 396 | + | |
| 397 | + // 百度地图添加覆盖物圆 | |
| 398 | + mapBValue.addOverlay(circle); | |
| 399 | + | |
| 400 | + // 信息窗口参数属性 | |
| 401 | + var opts = { | |
| 402 | + | |
| 403 | + // 信息窗口宽度 | |
| 404 | + width : 200, | |
| 405 | + | |
| 406 | + // 信息窗口高度 | |
| 407 | + height : 450, | |
| 408 | + | |
| 409 | + // 信息窗位置偏移值。 | |
| 410 | + offset: new BMap.Size(500,120), | |
| 411 | + | |
| 412 | + //标题 | |
| 413 | + title : '<h4 style="color:#FFFFFF">'+objStation.stationStationName+'站详情</h4>', | |
| 414 | + | |
| 415 | + //设置不允许信窗发送短息 | |
| 416 | + enableMessage : false, | |
| 417 | + | |
| 418 | + //是否开启点击地图关闭信息窗口 | |
| 419 | + enableCloseOnClick : false, | |
| 420 | + | |
| 421 | + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | |
| 422 | + enableAutoPan:false | |
| 423 | + }; | |
| 424 | + | |
| 425 | + var markTypeStr = ''; | |
| 426 | + | |
| 427 | + if(objStation.stationRouteStationMark=='B') { | |
| 428 | + | |
| 429 | + markTypeStr='起点站'; | |
| 430 | + | |
| 431 | + }else if(objStation.stationRouteStationMark=='Z') { | |
| 432 | + | |
| 433 | + markTypeStr ='中途站'; | |
| 434 | + | |
| 435 | + | |
| 436 | + }else if(objStation.stationRouteStationMark=='E') { | |
| 437 | + | |
| 438 | + markTypeStr='终点站'; | |
| 439 | + | |
| 440 | + } | |
| 441 | + | |
| 442 | + var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | |
| 443 | + '<span style="color:#DDD;font-size: 15px;">站点名称:' + objStation.stationStationName + '</span>' + | |
| 444 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + objStation.stationStationCod + '</span>' + | |
| 445 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + objStation.stationRouteStationRouteCode + '</span>' + | |
| 446 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' + | |
| 447 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + objStation.stationBJwpoints + '</span>' + | |
| 448 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">到站时间:' + objStation.stationRouteToTime + ' 分钟</span>' + | |
| 449 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">到站距离:' + objStation.stationRouteDistances + ' 公里</span>' + | |
| 450 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + objStation.stationRadius + '</span>' + | |
| 451 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + objStation.stationRouteVersions + '</span>' + | |
| 452 | + '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD;'+ | |
| 453 | + 'overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ | |
| 454 | + objStation.stationRouteDescriptions +'" >说明/描述:' + objStation.stationRouteDescriptions + '</span>' ; | |
| 455 | + | |
| 456 | + // 创建信息窗口 | |
| 457 | + var infoWindow_target = new BMap.InfoWindow(htm, opts); | |
| 458 | + // 自定义标注物图片 | |
| 459 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 460 | + | |
| 461 | + // 创建点 | |
| 462 | + marker = new BMap.Marker(point,{icon : icon_target}); | |
| 463 | + | |
| 464 | + // 把标注添物加到地图上 | |
| 465 | + mapBValue.addOverlay(marker); | |
| 466 | + | |
| 467 | + setTimeout(function(){ | |
| 468 | + //开启信息窗口 | |
| 469 | + marker.openInfoWindow(infoWindow_target,point); | |
| 470 | + | |
| 471 | + },100); | |
| 472 | + | |
| 473 | + // 是否在平移过程中禁止动画。(自1.2新增) | |
| 474 | + var PanOptions_ ={noAnimation :true}; | |
| 475 | + | |
| 476 | + // 将地图的中心点更改为给定的点。 | |
| 477 | + mapBValue.panTo(point,PanOptions_); | |
| 478 | + | |
| 479 | + mapBValue.panBy(10,-200,PanOptions_); | |
| 480 | + | |
| 481 | + // 添加标志物监听事件 | |
| 482 | + marker.addEventListener("click",function() { | |
| 483 | + | |
| 484 | + //开启信息窗口 | |
| 485 | + marker.openInfoWindow(infoWindow_target,point); | |
| 486 | + | |
| 487 | + }); | |
| 488 | + | |
| 489 | + } | |
| 490 | + | |
| 491 | + }, | |
| 492 | + | |
| 493 | + // 根据地理名称获取百度经纬度坐标 | |
| 494 | + localSearchFromAdreesToPoint: function(Address,callback) { | |
| 495 | + | |
| 496 | + // 创建一个搜索类实例 | |
| 497 | + var localSearch = new BMap.LocalSearch(mapBValue); | |
| 498 | + | |
| 499 | + // 检索完成后的回调函数。 | |
| 500 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 501 | + | |
| 502 | + var resultPoints = ''; | |
| 503 | + | |
| 504 | + if(searchResult) { | |
| 505 | + | |
| 506 | + // 返回索引指定的结果。索引0表示第1条结果 | |
| 507 | + var poi = searchResult.getPoi(0); | |
| 508 | + | |
| 509 | + if(poi) { | |
| 510 | + | |
| 511 | + //获取经度和纬度 | |
| 512 | + resultPoints = poi.point.lng + ' ' + poi.point.lat; | |
| 513 | + | |
| 514 | + callback && callback(resultPoints); | |
| 515 | + | |
| 516 | + }else { | |
| 517 | + | |
| 518 | + callback && callback(false); | |
| 519 | + | |
| 520 | + } | |
| 521 | + | |
| 522 | + }else { | |
| 523 | + | |
| 524 | + callback && callback(false); | |
| 525 | + } | |
| 526 | + | |
| 527 | + }); | |
| 528 | + | |
| 529 | + // 根据检索词发起检索。 | |
| 530 | + localSearch.search(Address); | |
| 531 | + | |
| 532 | + }, | |
| 533 | + | |
| 534 | + // 编辑图形 | |
| 535 | + editShapes : function(editStationName,stationShapesTypeV,mindex) { | |
| 536 | + | |
| 537 | + // 关闭信息窗口 | |
| 538 | + marker.closeInfoWindow(); | |
| 539 | + | |
| 540 | + // 清除marker | |
| 541 | + mapBValue.removeOverlay(marker); | |
| 542 | + | |
| 543 | + // 编辑圆 | |
| 544 | + if(stationShapesTypeV =='r') { | |
| 545 | + | |
| 546 | + // 开启编辑功能 | |
| 547 | + circle.enableEditing(); | |
| 548 | + | |
| 549 | + // 编辑圆监听事件 | |
| 550 | + circle.addEventListener('dblclick',function() { | |
| 551 | + | |
| 552 | + // 关闭提示弹出层 | |
| 553 | + layer.close(mindex); | |
| 554 | + | |
| 555 | + // 返回圆形的半径,单位为米。 | |
| 556 | + var newRadius = circle.getRadius(); | |
| 557 | + | |
| 558 | + // 返回圆形的中心点坐标。 | |
| 559 | + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 560 | + | |
| 561 | + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 562 | + | |
| 563 | + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | |
| 564 | + EditStationObj.setEitdStationBJwpoints(newCenter); | |
| 565 | + | |
| 566 | + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | |
| 567 | + EditStationObj.setEitdStationShapesType('r'); | |
| 568 | + | |
| 569 | + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ | |
| 570 | + EditStationObj.setEitdStationRadius(Math.round(newRadius)); | |
| 571 | + | |
| 572 | + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | |
| 573 | + EditStationObj.setEitdBPolygonGrid(''); | |
| 574 | + | |
| 575 | + // 加载编辑页面 | |
| 576 | + $.get('edit.html', function(m){ | |
| 577 | + | |
| 578 | + $(pjaxContainer).append(m); | |
| 579 | + | |
| 580 | + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]); | |
| 581 | + | |
| 582 | + }); | |
| 583 | + | |
| 584 | + }); | |
| 585 | + | |
| 586 | + // 编辑多变行 | |
| 587 | + }else if(stationShapesTypeV =='d') { | |
| 588 | + | |
| 589 | + // 开启编辑功能(自 1.1 新增) | |
| 590 | + polygon.enableEditing(); | |
| 591 | + | |
| 592 | + // 添加多变行编辑事件 | |
| 593 | + polygon.addEventListener('dblclick',function(e) { | |
| 594 | + | |
| 595 | + // 获取编辑的多边形对象 | |
| 596 | + var edit_pointE = polygon; | |
| 597 | + | |
| 598 | + var edit_bPloygonGrid = ""; | |
| 599 | + | |
| 600 | + var editPolyGonLen_ = edit_pointE.getPath().length; | |
| 601 | + | |
| 602 | + for(var k =0;k<editPolyGonLen_;k++) { | |
| 603 | + | |
| 604 | + if(k==0) { | |
| 605 | + | |
| 606 | + edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 607 | + | |
| 608 | + }else { | |
| 609 | + | |
| 610 | + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 611 | + | |
| 612 | + } | |
| 613 | + | |
| 614 | + } | |
| 615 | + | |
| 616 | + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | |
| 617 | + | |
| 618 | + // 多边形中心点 | |
| 619 | + var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | |
| 620 | + | |
| 621 | + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */ | |
| 622 | + EditStationObj.setEitdStationBJwpoints(centre_points); | |
| 623 | + | |
| 624 | + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */ | |
| 625 | + EditStationObj.setEitdStationShapesType('d'); | |
| 626 | + | |
| 627 | + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */ | |
| 628 | + EditStationObj.setEitdStationRadius(''); | |
| 629 | + | |
| 630 | + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | |
| 631 | + EditStationObj.setEitdBPolygonGrid(edit_bPloygonGrid); | |
| 632 | + | |
| 633 | + $.get('edit.html', function(m){ | |
| 634 | + | |
| 635 | + $(pjaxContainer).append(m); | |
| 636 | + | |
| 637 | + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]); | |
| 638 | + | |
| 639 | + }); | |
| 640 | + | |
| 641 | + }); | |
| 642 | + | |
| 643 | + } | |
| 644 | + | |
| 645 | + }, | |
| 646 | + | |
| 647 | + // 在地图上画出上行线路走向 | |
| 648 | + drawingUpline : function (polylineArray,polyline_center,data) { | |
| 649 | + /*WorldsBMap.clearMarkAndOverlays();*/ | |
| 650 | + polyUpline = ''; | |
| 651 | + // 创建线路走向 | |
| 652 | + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 653 | + // polyUpline.data = data; | |
| 654 | + // 把折线添加到地图上 | |
| 655 | + mapBValue.addOverlay(polyUpline); | |
| 656 | + /*var ceter_index = Math.round(resultdata.length / 2); | |
| 657 | + | |
| 658 | + var ceterPointsStr = resultdata[ceter_index].bJwpoints; | |
| 659 | + | |
| 660 | + var ceterPointsArray = ceterPointsStr.split(' '); | |
| 661 | + | |
| 662 | + var polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);*/ | |
| 663 | + var PanOptions_ ={noAnimation :true}; | |
| 664 | + mapBValue.reset(); | |
| 665 | + mapBValue.panTo(polyline_center,PanOptions_); | |
| 666 | + mapBValue.panBy(500,-510,PanOptions_); | |
| 667 | + mapBValue.setZoom(14); | |
| 668 | + }, | |
| 669 | + | |
| 670 | + //在地图上画出公交位置。 | |
| 671 | + drawingBus :function(lon,lat){ | |
| 672 | + var point = new BMap.Point(lon,lat); | |
| 673 | + var myIcon = new BMap.Icon("/pages/excep/img/bus.png", new BMap.Size(300,157)); | |
| 674 | + var marker = new BMap.Marker(point,{icon:myIcon}); // 创建标注 | |
| 675 | + mapBValue.addOverlay(marker); | |
| 676 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画 | |
| 677 | + }, | |
| 678 | + | |
| 679 | + // 在地图上画出上行线路走向 | |
| 680 | + drawingUpline01 : function (polylineArray,polyline_center,data) { | |
| 681 | + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | |
| 682 | + // 创建线路走向 | |
| 683 | + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 684 | + polyUpline01.data = data; | |
| 685 | + // 把折线添加到地图上 | |
| 686 | + mapBValue.addOverlay(polyUpline01); | |
| 687 | + polyUpline01.addEventListener('click',function(e) { | |
| 688 | + if(WorldsBMap.getIsEditStatus()) { | |
| 689 | + layer.msg('请先保存正在编辑的路段信息...'); | |
| 690 | + return false; | |
| 691 | + } | |
| 692 | + polyUpline01.enableEditing(); | |
| 693 | + WorldsBMap.setIsEditStatus(true); | |
| 694 | + }); | |
| 695 | + // 添加双击折线保存事件 | |
| 696 | + polyUpline01.addEventListener('dblclick',function(e) { | |
| 697 | + WorldsBMap.setIsEditStatus(false); | |
| 698 | + // 关闭 | |
| 699 | + layer.closeAll(); | |
| 700 | + polyUpline01.disableEditing(); | |
| 701 | + EditSectionObj.setEitdSection(polyUpline01.data); | |
| 702 | + // 获取折线坐标集合 | |
| 703 | + var editPloyLineArray = polyUpline01.getPath(); | |
| 704 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 705 | + // polyUpline= ''; | |
| 706 | + // 加载修改路段弹出层mobal页面 | |
| 707 | + $.get('editsection.html', function(m){ | |
| 708 | + $(pjaxContainer).append(m); | |
| 709 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 710 | + }); | |
| 711 | + }); | |
| 712 | + var PanOptions_ ={noAnimation :true}; | |
| 713 | + mapBValue.reset(); | |
| 714 | + mapBValue.panTo(polyline_center,PanOptions_); | |
| 715 | + mapBValue.panBy(500,-510,PanOptions_); | |
| 716 | + mapBValue.setZoom(14); | |
| 717 | + }, | |
| 718 | + | |
| 719 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | |
| 720 | + drawingUpStationPoint : function(point_center,stationName,s) { | |
| 721 | + | |
| 722 | + // 自定义标注物图片 | |
| 723 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | |
| 724 | + | |
| 725 | + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | |
| 726 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 727 | + + '</div>' | |
| 728 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | |
| 729 | + | |
| 730 | + | |
| 731 | + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | |
| 732 | + "anchor" : new BMap.Size(-10,8), | |
| 733 | + "enableDragging" : true}); | |
| 734 | + | |
| 735 | + | |
| 736 | + myRichMarker1.disableDragging(); | |
| 737 | + mapBValue.addOverlay(myRichMarker1); | |
| 738 | + | |
| 739 | + | |
| 740 | + // 创建标注物 | |
| 741 | + marker = new BMap.Marker(point_center,{icon : icon_target}); | |
| 742 | + | |
| 743 | + // 允许覆盖物在map.clearOverlays方法中被清除。 | |
| 744 | + marker.enableMassClear(); | |
| 745 | + | |
| 746 | + mapBValue.addOverlay(marker); | |
| 747 | + }, | |
| 748 | + | |
| 749 | + // 站点名称获取百度坐标(手动规划) | |
| 750 | + stationsNameToPoints : function(arra,callback) { | |
| 751 | + // 获取长度 | |
| 752 | + var len = arra.length; | |
| 753 | + var stationList = []; | |
| 754 | + (function(){ | |
| 755 | + if (!arguments.callee.count) { | |
| 756 | + arguments.callee.count = 0; | |
| 757 | + } | |
| 758 | + arguments.callee.count++; | |
| 759 | + var index = parseInt(arguments.callee.count) - 1; | |
| 760 | + if (index >= len) { | |
| 761 | + callback && callback(stationList); | |
| 762 | + return ; | |
| 763 | + } | |
| 764 | + var f = arguments.callee; | |
| 765 | + if(arra[index].name!=''){ | |
| 766 | + var localSearch = new BMap.LocalSearch(mapBValue); | |
| 767 | + localSearch.search(arra[index].name); | |
| 768 | + localSearch.setSearchCompleteCallback(function (searchResult) { | |
| 769 | + var poi = searchResult.getPoi(0); | |
| 770 | + if(poi) { | |
| 771 | + stationList.push({name:arra[index].name.replace('公交车站',''),wgs:arra[index].wgs,potion:{lng:poi.point.lng,lat:poi.point.lat}}); | |
| 772 | + }else { | |
| 773 | + stationList.push({name:arra[index].name.replace('公交车站',''),wgs:arra[index].wgs,potion:{lng:arra[index].wgs.x,lat:arra[index].wgs.y}}); | |
| 774 | + } | |
| 775 | + f(); | |
| 776 | + }); | |
| 777 | + }else { | |
| 778 | + f(); | |
| 779 | + } | |
| 780 | + })(); | |
| 781 | + }, | |
| 782 | + | |
| 783 | + // 根据坐标点获取两点之间的时间与距离(手动规划) | |
| 784 | + getDistanceAndTotime : function(stationList,cb) { | |
| 785 | + | |
| 786 | + stationList[0].distance = ''; | |
| 787 | + | |
| 788 | + stationList[0].duration = ''; | |
| 789 | + | |
| 790 | + // var sectionList = []; | |
| 791 | + | |
| 792 | + // 获取长度 | |
| 793 | + var len = stationList.length; | |
| 794 | + | |
| 795 | + (function(){ | |
| 796 | + | |
| 797 | + if (!arguments.callee.count) { | |
| 798 | + | |
| 799 | + arguments.callee.count = 0; | |
| 800 | + | |
| 801 | + } | |
| 802 | + | |
| 803 | + arguments.callee.count++; | |
| 804 | + | |
| 805 | + var index = parseInt(arguments.callee.count) - 1; | |
| 806 | + | |
| 807 | + if (index >= len-1) { | |
| 808 | + | |
| 809 | + // cb && cb(stationList,sectionList); | |
| 810 | + cb && cb(stationList); | |
| 811 | + return; | |
| 812 | + } | |
| 813 | + | |
| 814 | + var f = arguments.callee; | |
| 815 | + | |
| 816 | + var poiOne = new BMap.Point(stationList[index].potion.lng,stationList[index].potion.lat); | |
| 817 | + | |
| 818 | + var poiTwo = new BMap.Point(stationList[index+1].potion.lng,stationList[index+1].potion.lat); | |
| 819 | + | |
| 820 | + var transit = new BMap.TransitRoute(mapBValue, {renderOptions: {map: mapBValue},onSearchComplete: searchComplete}); | |
| 821 | + | |
| 822 | + transit.search(poiOne,poiTwo); | |
| 823 | + | |
| 824 | + function searchComplete(results){ | |
| 825 | + | |
| 826 | + var plan = results.getPlan(0); | |
| 827 | + | |
| 828 | + if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 829 | + | |
| 830 | + stationList[index+1].distance = ''; | |
| 831 | + | |
| 832 | + stationList[index+1].duration = ''; | |
| 833 | + | |
| 834 | + // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:''}); | |
| 835 | + | |
| 836 | + }else { | |
| 837 | + | |
| 838 | + stationList[index+1].distance = plan.getDistance(true); | |
| 839 | + | |
| 840 | + stationList[index+1].duration = plan.getDuration(true); | |
| 841 | + | |
| 842 | + // var line = plan.getRoute(0); | |
| 843 | + | |
| 844 | + // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:line.getPath()}); | |
| 845 | + | |
| 846 | + } | |
| 847 | + | |
| 848 | + f(); | |
| 849 | + } | |
| 850 | + | |
| 851 | + })(); | |
| 852 | + | |
| 853 | + }, | |
| 854 | + | |
| 855 | + // 根据坐标点获取两点之间的折线路段(手动规划) | |
| 856 | + getSectionListPlonly : function(stationsPoint,cb) { | |
| 857 | + | |
| 858 | + var len = stationsPoint.length; | |
| 859 | + | |
| 860 | + var sectionList = []; | |
| 861 | + | |
| 862 | + (function(){ | |
| 863 | + | |
| 864 | + if (!arguments.callee.count) { | |
| 865 | + | |
| 866 | + arguments.callee.count = 0; | |
| 867 | + | |
| 868 | + } | |
| 869 | + | |
| 870 | + arguments.callee.count++; | |
| 871 | + | |
| 872 | + var index = parseInt(arguments.callee.count) - 1; | |
| 873 | + | |
| 874 | + if (index >= len-1 ) { | |
| 875 | + | |
| 876 | + cb && cb(sectionList); | |
| 877 | + return; | |
| 878 | + } | |
| 879 | + | |
| 880 | + var f = arguments.callee; | |
| 881 | + | |
| 882 | + var poiOne = new BMap.Point(stationsPoint[index].potion.lng,stationsPoint[index].potion.lat); | |
| 883 | + | |
| 884 | + var poiTwo = new BMap.Point(stationsPoint[index+1].potion.lng,stationsPoint[index+1].potion.lat); | |
| 885 | + | |
| 886 | + /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/ | |
| 887 | + | |
| 888 | + var transit = new BMap.DrivingRoute(mapBValue, {renderOptions: {map: mapBValue},onPolylinesSet: searchPolylinesSet}); | |
| 889 | + | |
| 890 | + function searchPolylinesSet(results){ | |
| 891 | + | |
| 892 | + if (transit.getStatus() != BMAP_STATUS_SUCCESS){ | |
| 893 | + | |
| 894 | + | |
| 895 | + }else { | |
| 896 | + | |
| 897 | + var sectionArrayList = []; | |
| 898 | + for (i = 0; i < results.length; i++){ | |
| 899 | + | |
| 900 | + // console.log(results[i].getPolyline().getPath()); | |
| 901 | + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath()); | |
| 902 | + | |
| 903 | + } | |
| 904 | + | |
| 905 | + var sectionName = stationsPoint[index].name + '至' + stationsPoint[index+1].name; | |
| 906 | + | |
| 907 | + sectionList.push({sectionName:sectionName,points:sectionArrayList}); | |
| 908 | + | |
| 909 | + } | |
| 910 | + | |
| 911 | + f(); | |
| 912 | + } | |
| 913 | + | |
| 914 | + transit.search(poiOne,poiTwo); | |
| 915 | + | |
| 916 | + })(); | |
| 917 | + | |
| 918 | + }, | |
| 919 | + | |
| 920 | + localtionPoint : function(stationNameV) { | |
| 921 | + | |
| 922 | + WorldsBMap.localSearchFromAdreesToPoint(stationNameV,function(Points) { | |
| 923 | + | |
| 924 | + if(Points) { | |
| 925 | + | |
| 926 | + var BJwpointsArray = Points.split(' '); | |
| 927 | + | |
| 928 | + var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 929 | + | |
| 930 | + var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 931 | + | |
| 932 | + var PanOptions ={noAnimation :true}; | |
| 933 | + | |
| 934 | + mapBValue.panTo(stationNameChangePoint,PanOptions); | |
| 935 | + | |
| 936 | + mapBValue.panBy(0,-100); | |
| 937 | + | |
| 938 | + // 将标注添加到地图中 | |
| 939 | + mapBValue.addOverlay(marker_stargt2); | |
| 940 | + | |
| 941 | + //跳动的动画 | |
| 942 | + marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 943 | + | |
| 944 | + } | |
| 945 | + | |
| 946 | + }); | |
| 947 | + | |
| 948 | + }, | |
| 949 | + | |
| 950 | + /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/ | |
| 951 | + getBmapStationNames : function(lineNameValue,i,callback) { | |
| 952 | + | |
| 953 | + var busline = new BMap.BusLineSearch(mapBValue,{ | |
| 954 | + | |
| 955 | + // 设置公交列表查询后的回调函数。参数:rs: BusListResult类型 | |
| 956 | + onGetBusListComplete:function(BusListResult) { | |
| 957 | + | |
| 958 | + // 如果不为空 | |
| 959 | + if(BusListResult){ | |
| 960 | + | |
| 961 | + //获取第一个公交列表显示到map上 | |
| 962 | + var fstLine = BusListResult.getBusListItem(i); | |
| 963 | + | |
| 964 | + /*if(fstLine==undefined){ | |
| 965 | + | |
| 966 | + layer.confirm('系统无法生成该线路【'+lineNameValue+'】的站点与路段!请点击返回选择其它方式规划', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){ | |
| 967 | + | |
| 968 | + layer.closeAll(); | |
| 969 | + | |
| 970 | + if(i==0){ | |
| 971 | + | |
| 972 | + $('#upToolsMobal').show(); | |
| 973 | + | |
| 974 | + }else if(i==1){ | |
| 975 | + | |
| 976 | + $('#downToolsMobal').show(); | |
| 977 | + | |
| 978 | + } | |
| 979 | + | |
| 980 | + return; | |
| 981 | + }); | |
| 982 | + | |
| 983 | + }*/ | |
| 984 | + | |
| 985 | + if(fstLine==undefined){ | |
| 986 | + | |
| 987 | + | |
| 988 | + callback && callback(null); | |
| 989 | + | |
| 990 | + } | |
| 991 | + | |
| 992 | + busline.getBusLine(fstLine); | |
| 993 | + | |
| 994 | + } | |
| 995 | + | |
| 996 | + }, | |
| 997 | + | |
| 998 | + //设置公交线路查询后的回调函数.参数:rs: BusLine类型 | |
| 999 | + onGetBusLineComplete: function(BusLine){ | |
| 1000 | + | |
| 1001 | + // 如果不为空 | |
| 1002 | + if(BusLine){ | |
| 1003 | + | |
| 1004 | + callback && callback(BusLine); | |
| 1005 | + | |
| 1006 | + } | |
| 1007 | + | |
| 1008 | + } | |
| 1009 | + | |
| 1010 | + }); | |
| 1011 | + | |
| 1012 | + busline.getBusList(lineNameValue); | |
| 1013 | + | |
| 1014 | + }, | |
| 1015 | + | |
| 1016 | + clearMarkAndOverlays : function() { | |
| 1017 | + | |
| 1018 | + // 清楚地图覆盖物 | |
| 1019 | + mapBValue.clearOverlays(); | |
| 1020 | + | |
| 1021 | + mapBValue.removeOverlay(); | |
| 1022 | + | |
| 1023 | + } | |
| 1024 | + | |
| 1025 | + } | |
| 1026 | + | |
| 1027 | + return Bmap; | |
| 1028 | + | |
| 1029 | 1029 | }(); |
| 1030 | 1030 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/excep/js/speeding-map.js
| 1 | -/** | |
| 2 | - * 百度地图 | |
| 3 | - * | |
| 4 | - * - - - - - -》init:地图初始化 | |
| 5 | - * | |
| 6 | - * - - - - - -》getDistanceAndDuration:获取距离与时间 | |
| 7 | - * | |
| 8 | - * - - - - - -》drawingUpline:在地图上画出上行线路走向 | |
| 9 | - * | |
| 10 | - * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划) | |
| 11 | - */ | |
| 12 | - | |
| 13 | -var SpeedingMap = function () { | |
| 14 | - | |
| 15 | - /** SpeedingMap 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数; | |
| 16 | - * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/ | |
| 17 | - var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false; | |
| 18 | - | |
| 19 | - var Bmap = { | |
| 20 | - | |
| 21 | - init : function() { | |
| 22 | - | |
| 23 | - // 设置中心点, | |
| 24 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 25 | - | |
| 26 | - // 百度API Key | |
| 27 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | |
| 28 | - | |
| 29 | - // 初始化百度地图 | |
| 30 | - mapBValue = new BMap.Map("speedingMap"); | |
| 31 | - | |
| 32 | - //中心点和缩放级别 | |
| 33 | - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat),15); | |
| 34 | - | |
| 35 | - //启用地图拖拽事件,默认启用(可不写) | |
| 36 | - mapBValue.enableDragging(); | |
| 37 | - | |
| 38 | - //启用地图滚轮放大缩小 | |
| 39 | - mapBValue.enableScrollWheelZoom(); | |
| 40 | - | |
| 41 | - //禁用鼠标双击放大 | |
| 42 | - mapBValue.disableDoubleClickZoom(); | |
| 43 | - | |
| 44 | - //启用键盘上下左右键移动地图 | |
| 45 | - mapBValue.enableKeyboard(); | |
| 46 | - | |
| 47 | - return mapBValue; | |
| 48 | - }, | |
| 49 | - /** 获取第一个切路段的点 @return Point*/ | |
| 50 | - getFirstPoint : function() { | |
| 51 | - return firstPoint; | |
| 52 | - }, | |
| 53 | - /** 获取地图对象 @return 地图对象map */ | |
| 54 | - getmapBValue : function() { | |
| 55 | - | |
| 56 | - return mapBValue; | |
| 57 | - | |
| 58 | - }, | |
| 59 | - | |
| 60 | - getPolyUpline : function() { | |
| 61 | - | |
| 62 | - return polyUpline; | |
| 63 | - }, | |
| 64 | - | |
| 65 | - /** 获取截取过的路段 @return 路段对象List */ | |
| 66 | - getSectionList : function() { | |
| 67 | - | |
| 68 | - return sectionList; | |
| 69 | - | |
| 70 | - }, | |
| 71 | - setSectionList : function(list) { | |
| 72 | - | |
| 73 | - sectionList = list; | |
| 74 | - }, | |
| 75 | - initCutSectionPoint : function() { | |
| 76 | - sectionList = []; | |
| 77 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 78 | - $('#section_table tbody').html(tbodyHtml); | |
| 79 | - }, | |
| 80 | - /** 获取切路段的点下标 @return int*/ | |
| 81 | - setPointIndex : function(index) { | |
| 82 | - pointIndex = index; | |
| 83 | - }, | |
| 84 | - getPointIndex : function() { | |
| 85 | - | |
| 86 | - return pointIndex; | |
| 87 | - | |
| 88 | - }, | |
| 89 | - /** 获取路段是否在编辑状态 @return boolean*/ | |
| 90 | - getIsEditStatus : function() { | |
| 91 | - return iseditStatus; | |
| 92 | - }, | |
| 93 | - setIsEditStatus : function(v) { | |
| 94 | - iseditStatus = v ; | |
| 95 | - }, | |
| 96 | - | |
| 97 | - /** 获取路段是否在截取状态 @return boolean*/ | |
| 98 | - getIsCutSection : function() { | |
| 99 | - return isCutSection; | |
| 100 | - }, | |
| 101 | - setIsCutSection : function(v) { | |
| 102 | - isCutSection = v ; | |
| 103 | - }, | |
| 104 | - | |
| 105 | - /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 106 | - getDistanceAndDuration : function(points,callback){ | |
| 107 | - | |
| 108 | - // 获取长度 | |
| 109 | - var len = points.length; | |
| 110 | - (function(){ | |
| 111 | - | |
| 112 | - if (!arguments.callee.count) { | |
| 113 | - | |
| 114 | - arguments.callee.count = 0; | |
| 115 | - | |
| 116 | - } | |
| 117 | - | |
| 118 | - arguments.callee.count++; | |
| 119 | - | |
| 120 | - var index = parseInt(arguments.callee.count) - 1; | |
| 121 | - | |
| 122 | - if (index >= len-1) { | |
| 123 | - | |
| 124 | - callback && callback(points); | |
| 125 | - | |
| 126 | - return; | |
| 127 | - } | |
| 128 | - | |
| 129 | - // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 130 | - var f = arguments.callee; | |
| 131 | - // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 132 | - var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 133 | - | |
| 134 | - // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 135 | - var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 136 | - var region = '上海'; | |
| 137 | - | |
| 138 | - var origin_region = '上海'; | |
| 139 | - | |
| 140 | - var destination_region = '上海'; | |
| 141 | - | |
| 142 | - var output = 'json'; | |
| 143 | - | |
| 144 | - var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 145 | - | |
| 146 | - /** | |
| 147 | - * origin:起点名称或经纬度; | |
| 148 | - * | |
| 149 | - * destination:终点名称或经纬度; | |
| 150 | - * | |
| 151 | - * origin_region:起始点所在城市,驾车导航时必填。 | |
| 152 | - * | |
| 153 | - * destination_region:终点所在城市,驾车导航时必填。 | |
| 154 | - * | |
| 155 | - * output :表示输出类型,可设置为xml或json,默认为xml。 | |
| 156 | - * | |
| 157 | - **/ | |
| 158 | - var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 159 | - | |
| 160 | - /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 161 | - $.ajax({ | |
| 162 | - | |
| 163 | - // 百度地图根据坐标获取两点之间的时间与距离 | |
| 164 | - url: '//api.map.baidu.com/direction/v1?mode=transit', | |
| 165 | - | |
| 166 | - data: paramsB, | |
| 167 | - | |
| 168 | - dataType: 'jsonp', | |
| 169 | - | |
| 170 | - success: function(r){ | |
| 171 | - | |
| 172 | - if(r) { | |
| 173 | - | |
| 174 | - if(r.message=='ok') { | |
| 175 | - | |
| 176 | - if(r.result.taxi==null) { | |
| 177 | - | |
| 178 | - // 获取距离(单位:米) | |
| 179 | - points[index+1].distance = 0; | |
| 180 | - | |
| 181 | - // 获取时间(单位:秒) | |
| 182 | - points[index+1].duration = 0; | |
| 183 | - | |
| 184 | - }else { | |
| 185 | - | |
| 186 | - // 获取距离(单位:米) | |
| 187 | - points[index+1].distance = r.result.taxi.distance; | |
| 188 | - | |
| 189 | - // 获取时间(单位:秒) | |
| 190 | - points[index+1].duration = r.result.taxi.duration; | |
| 191 | - | |
| 192 | - } | |
| 193 | - | |
| 194 | - | |
| 195 | - } | |
| 196 | - | |
| 197 | - } | |
| 198 | - | |
| 199 | - f(); | |
| 200 | - } | |
| 201 | - }); | |
| 202 | - | |
| 203 | - })(); | |
| 204 | - | |
| 205 | - }, | |
| 206 | - // 在地图上画出上行线路走向 | |
| 207 | - drawingUpline01 : function (polylineArray,polyline_center,data) { | |
| 208 | - var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | |
| 209 | - // 创建线路走向 | |
| 210 | - polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 211 | - polyUpline01.data = data; | |
| 212 | - // 把折线添加到地图上 | |
| 213 | - mapBValue.addOverlay(polyUpline01); | |
| 214 | - var sectionPoint = []; | |
| 215 | - // 线路单击事件 | |
| 216 | - polyUpline01.addEventListener('click',function(e) { | |
| 217 | - if(SpeedingMap.getIsEditStatus()) { | |
| 218 | - layer.msg('请先保存正在编辑的路段信息...'); | |
| 219 | - return false; | |
| 220 | - } | |
| 221 | - if(SpeedingMap.getIsCutSection()) { | |
| 222 | - layer.msg('请先撤销所有切路段的点...'); | |
| 223 | - return false; | |
| 224 | - } | |
| 225 | - polyUpline01.enableEditing(); | |
| 226 | - SpeedingMap.setIsEditStatus(true); | |
| 227 | - }); | |
| 228 | - | |
| 229 | - // 添加路段双击事件 | |
| 230 | - polyUpline01.addEventListener("dblclick",function(e){ | |
| 231 | - if(SpeedingMap.getIsCutSection()) { | |
| 232 | - layer.msg('请先撤销所有切路段的点...'); | |
| 233 | - return false; | |
| 234 | - } | |
| 235 | - SpeedingMap.setIsEditStatus(false); | |
| 236 | - // 关闭 | |
| 237 | - layer.closeAll(); | |
| 238 | - polyUpline01.disableEditing(); | |
| 239 | - EditSectionObj.setEitdSection(polyUpline01.data); | |
| 240 | - // 获取折线坐标集合 | |
| 241 | - var editPloyLineArray = polyUpline01.getPath(); | |
| 242 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 243 | - sectionList = []; | |
| 244 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 245 | - // 截取路段 | |
| 246 | - $('#section_table tbody').html(tbodyHtml); | |
| 247 | - // 加载修改路段弹出层mobal页面 | |
| 248 | - $.get('editsection.html', function(m){ | |
| 249 | - $(pjaxContainer).append(m); | |
| 250 | - $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [SpeedingMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 251 | - }); | |
| 252 | - }); | |
| 253 | - | |
| 254 | - // 路段右击事件 | |
| 255 | - var editSection = function(e,ee,marker){ | |
| 256 | - if(SpeedingMap.getIsEditStatus()) { | |
| 257 | - layer.msg('请先保存正在编辑的路段信息...'); | |
| 258 | - return false; | |
| 259 | - } | |
| 260 | - var lng = e.lng; | |
| 261 | - var lat = e.lat; | |
| 262 | - var sectionName = null; | |
| 263 | - var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点 | |
| 264 | - marker.isFlag = true; | |
| 265 | - if(pointIndex == 0) { | |
| 266 | - sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 267 | - layer.msg('进入切路段状态,请选择本路段的终点!'); | |
| 268 | - mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 269 | - firstPoint = {lng:lng, lat:lat}; | |
| 270 | - pointIndex++; | |
| 271 | - EditSectionObj.setEitdSection(polyUpline01.data); | |
| 272 | - // 获取折线坐标集合 | |
| 273 | - var editPloyLineArray = polyUpline01.getPath(); | |
| 274 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 275 | - } else if (pointIndex > 0) { | |
| 276 | - layer.prompt({title: '请输入路段名!'}, function(sectionName, index){ | |
| 277 | - pointList = []; | |
| 278 | - sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 279 | - pointList[0] = sectionPoint[pointIndex-1]; | |
| 280 | - pointList[1] = sectionPoint[pointIndex]; | |
| 281 | - sectionList.push({name:sectionName, section:pointList}); | |
| 282 | - layer.close(index); | |
| 283 | - layer.msg('路段截取成功,请选择下一个路段的终点'); | |
| 284 | - mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 285 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 286 | - // 截取路段 | |
| 287 | - $('#section_table tbody').html(tbodyHtml); | |
| 288 | - pointIndex++; | |
| 289 | - }); | |
| 290 | - } | |
| 291 | - SpeedingMap.setIsCutSection(true); | |
| 292 | - } | |
| 293 | - var markerMenu=new BMap.ContextMenu(); | |
| 294 | - markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01))); | |
| 295 | - polyUpline01.addContextMenu(markerMenu); | |
| 296 | - | |
| 297 | - | |
| 298 | - var PanOptions_ ={noAnimation :true}; | |
| 299 | - mapBValue.reset(); | |
| 300 | - mapBValue.panTo(polyline_center,PanOptions_); | |
| 301 | - mapBValue.panBy(500,-510,PanOptions_); | |
| 302 | - mapBValue.setZoom(14); | |
| 303 | - }, | |
| 304 | - // 删除点刷新cutSectionTable | |
| 305 | - refreshCutSectionTable : function() { | |
| 306 | - var tbodyHtml = template('section_list',{list : sectionList}); | |
| 307 | - $('#section_table tbody').html(tbodyHtml); | |
| 308 | - }, | |
| 309 | - // 删除点刷新覆盖物 | |
| 310 | - deleteCutSectionPoint : function(point) { | |
| 311 | - var lng = point.lng; | |
| 312 | - var lat = point.lat; | |
| 313 | - var allOverlay = mapBValue.getOverlays(); | |
| 314 | - // 删除最后一个点 | |
| 315 | - for (var i = 0; i < allOverlay.length -1; i++){ | |
| 316 | - if(allOverlay[i].isFlag) { | |
| 317 | - if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){ | |
| 318 | - mapBValue.removeOverlay(allOverlay[i]); | |
| 319 | - break; | |
| 320 | - } | |
| 321 | - } | |
| 322 | - } | |
| 323 | - }, | |
| 324 | - /** 在地图上画点 @param:<point_center:中心坐标点> */ | |
| 325 | - drawingUpStationPoint : function(point_center,stationName,s) { | |
| 326 | - | |
| 327 | - // 自定义标注物图片 | |
| 328 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | |
| 329 | - | |
| 330 | - var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | |
| 331 | - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 332 | - + '</div>' | |
| 333 | - + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | |
| 334 | - | |
| 335 | - | |
| 336 | - var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | |
| 337 | - "anchor" : new BMap.Size(-10,8), | |
| 338 | - "enableDragging" : true}); | |
| 339 | - | |
| 340 | - | |
| 341 | - myRichMarker1.disableDragging(); | |
| 342 | - mapBValue.addOverlay(myRichMarker1); | |
| 343 | - | |
| 344 | - | |
| 345 | - // 创建标注物 | |
| 346 | - marker = new BMap.Marker(point_center,{icon : icon_target}); | |
| 347 | - | |
| 348 | - // 允许覆盖物在map.clearOverlays方法中被清除。 | |
| 349 | - marker.enableMassClear(); | |
| 350 | - | |
| 351 | - mapBValue.addOverlay(marker); | |
| 352 | - }, | |
| 353 | - | |
| 354 | - // 根据站点坐标匹配库中的公交站点(手动规划) | |
| 355 | - stationsPointsToLibraryPoint : function(arra,callback) { | |
| 356 | - // 获取长度 | |
| 357 | - var len = arra.length; | |
| 358 | - var station = {}; | |
| 359 | - var stationList = []; | |
| 360 | - (function(){ | |
| 361 | - if (!arguments.callee.count) { | |
| 362 | - arguments.callee.count = 0; | |
| 363 | - } | |
| 364 | - arguments.callee.count++; | |
| 365 | - var index = parseInt(arguments.callee.count) - 1; | |
| 366 | - if (index >= len) { | |
| 367 | - callback && callback(stationList); | |
| 368 | - return ; | |
| 369 | - } | |
| 370 | - var f = arguments.callee; | |
| 371 | - station = arra[index]; | |
| 372 | - if(arra[index].name!=''){ | |
| 373 | - $.get('/station/matchStation',station,function(result) { | |
| 374 | - var centerPointWkt = result.centerPointWkt, idx = centerPointWkt.indexOf('POINT('); | |
| 375 | - centerPointWkt = idx > -1 ? centerPointWkt.substring(6, centerPointWkt.length - 1) : centerPointWkt; | |
| 376 | - var coordinates = centerPointWkt.split(' '); | |
| 377 | - stationList.push({name: result.name ,wgs: arra[index].wgs, potion: {lng: coordinates[0], lat: coordinates[1]}, isHave: result.isHave, id: result.id}); | |
| 378 | - f(); | |
| 379 | - }); | |
| 380 | - }else { | |
| 381 | - f(); | |
| 382 | - } | |
| 383 | - })() | |
| 384 | - }, | |
| 385 | - clearMarkAndOverlays : function() { | |
| 386 | - | |
| 387 | - // 清楚地图覆盖物 | |
| 388 | - mapBValue.clearOverlays(); | |
| 389 | - | |
| 390 | - mapBValue.removeOverlay(); | |
| 391 | - | |
| 392 | - } | |
| 393 | - | |
| 394 | - } | |
| 395 | - | |
| 396 | - return Bmap; | |
| 397 | - | |
| 1 | +/** | |
| 2 | + * 百度地图 | |
| 3 | + * | |
| 4 | + * - - - - - -》init:地图初始化 | |
| 5 | + * | |
| 6 | + * - - - - - -》getDistanceAndDuration:获取距离与时间 | |
| 7 | + * | |
| 8 | + * - - - - - -》drawingUpline:在地图上画出上行线路走向 | |
| 9 | + * | |
| 10 | + * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划) | |
| 11 | + */ | |
| 12 | + | |
| 13 | +var SpeedingMap = function () { | |
| 14 | + | |
| 15 | + /** SpeedingMap 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数; | |
| 16 | + * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/ | |
| 17 | + var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false; | |
| 18 | + | |
| 19 | + var Bmap = { | |
| 20 | + | |
| 21 | + init : function() { | |
| 22 | + | |
| 23 | + // 设置中心点, | |
| 24 | + var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 25 | + | |
| 26 | + // 百度API Key | |
| 27 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw'; | |
| 28 | + | |
| 29 | + // 初始化百度地图 | |
| 30 | + mapBValue = new BMap.Map("speedingMap"); | |
| 31 | + | |
| 32 | + //中心点和缩放级别 | |
| 33 | + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat),15); | |
| 34 | + | |
| 35 | + //启用地图拖拽事件,默认启用(可不写) | |
| 36 | + mapBValue.enableDragging(); | |
| 37 | + | |
| 38 | + //启用地图滚轮放大缩小 | |
| 39 | + mapBValue.enableScrollWheelZoom(); | |
| 40 | + | |
| 41 | + //禁用鼠标双击放大 | |
| 42 | + mapBValue.disableDoubleClickZoom(); | |
| 43 | + | |
| 44 | + //启用键盘上下左右键移动地图 | |
| 45 | + mapBValue.enableKeyboard(); | |
| 46 | + | |
| 47 | + return mapBValue; | |
| 48 | + }, | |
| 49 | + /** 获取第一个切路段的点 @return Point*/ | |
| 50 | + getFirstPoint : function() { | |
| 51 | + return firstPoint; | |
| 52 | + }, | |
| 53 | + /** 获取地图对象 @return 地图对象map */ | |
| 54 | + getmapBValue : function() { | |
| 55 | + | |
| 56 | + return mapBValue; | |
| 57 | + | |
| 58 | + }, | |
| 59 | + | |
| 60 | + getPolyUpline : function() { | |
| 61 | + | |
| 62 | + return polyUpline; | |
| 63 | + }, | |
| 64 | + | |
| 65 | + /** 获取截取过的路段 @return 路段对象List */ | |
| 66 | + getSectionList : function() { | |
| 67 | + | |
| 68 | + return sectionList; | |
| 69 | + | |
| 70 | + }, | |
| 71 | + setSectionList : function(list) { | |
| 72 | + | |
| 73 | + sectionList = list; | |
| 74 | + }, | |
| 75 | + initCutSectionPoint : function() { | |
| 76 | + sectionList = []; | |
| 77 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 78 | + $('#section_table tbody').html(tbodyHtml); | |
| 79 | + }, | |
| 80 | + /** 获取切路段的点下标 @return int*/ | |
| 81 | + setPointIndex : function(index) { | |
| 82 | + pointIndex = index; | |
| 83 | + }, | |
| 84 | + getPointIndex : function() { | |
| 85 | + | |
| 86 | + return pointIndex; | |
| 87 | + | |
| 88 | + }, | |
| 89 | + /** 获取路段是否在编辑状态 @return boolean*/ | |
| 90 | + getIsEditStatus : function() { | |
| 91 | + return iseditStatus; | |
| 92 | + }, | |
| 93 | + setIsEditStatus : function(v) { | |
| 94 | + iseditStatus = v ; | |
| 95 | + }, | |
| 96 | + | |
| 97 | + /** 获取路段是否在截取状态 @return boolean*/ | |
| 98 | + getIsCutSection : function() { | |
| 99 | + return isCutSection; | |
| 100 | + }, | |
| 101 | + setIsCutSection : function(v) { | |
| 102 | + isCutSection = v ; | |
| 103 | + }, | |
| 104 | + | |
| 105 | + /** 获取距离与时间 @param <points:坐标点集合> */ | |
| 106 | + getDistanceAndDuration : function(points,callback){ | |
| 107 | + | |
| 108 | + // 获取长度 | |
| 109 | + var len = points.length; | |
| 110 | + (function(){ | |
| 111 | + | |
| 112 | + if (!arguments.callee.count) { | |
| 113 | + | |
| 114 | + arguments.callee.count = 0; | |
| 115 | + | |
| 116 | + } | |
| 117 | + | |
| 118 | + arguments.callee.count++; | |
| 119 | + | |
| 120 | + var index = parseInt(arguments.callee.count) - 1; | |
| 121 | + | |
| 122 | + if (index >= len-1) { | |
| 123 | + | |
| 124 | + callback && callback(points); | |
| 125 | + | |
| 126 | + return; | |
| 127 | + } | |
| 128 | + | |
| 129 | + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。) | |
| 130 | + var f = arguments.callee; | |
| 131 | + // 起点坐标 <坐标格式:40.056878,116.30815> | |
| 132 | + var origin = points[index].potion.lat + ',' + points[index].potion.lng; | |
| 133 | + | |
| 134 | + // 终点坐标 <坐标格式:40.056878,116.30815> | |
| 135 | + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng; | |
| 136 | + var region = '上海'; | |
| 137 | + | |
| 138 | + var origin_region = '上海'; | |
| 139 | + | |
| 140 | + var destination_region = '上海'; | |
| 141 | + | |
| 142 | + var output = 'json'; | |
| 143 | + | |
| 144 | + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk'; | |
| 145 | + | |
| 146 | + /** | |
| 147 | + * origin:起点名称或经纬度; | |
| 148 | + * | |
| 149 | + * destination:终点名称或经纬度; | |
| 150 | + * | |
| 151 | + * origin_region:起始点所在城市,驾车导航时必填。 | |
| 152 | + * | |
| 153 | + * destination_region:终点所在城市,驾车导航时必填。 | |
| 154 | + * | |
| 155 | + * output :表示输出类型,可设置为xml或json,默认为xml。 | |
| 156 | + * | |
| 157 | + **/ | |
| 158 | + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My}; | |
| 159 | + | |
| 160 | + /** @description :未认证开发者默认配额为:2000次/天。 */ | |
| 161 | + $.ajax({ | |
| 162 | + | |
| 163 | + // 百度地图根据坐标获取两点之间的时间与距离 | |
| 164 | + url: '//api.map.baidu.com/direction/v1?mode=transit', | |
| 165 | + | |
| 166 | + data: paramsB, | |
| 167 | + | |
| 168 | + dataType: 'jsonp', | |
| 169 | + | |
| 170 | + success: function(r){ | |
| 171 | + | |
| 172 | + if(r) { | |
| 173 | + | |
| 174 | + if(r.message=='ok') { | |
| 175 | + | |
| 176 | + if(r.result.taxi==null) { | |
| 177 | + | |
| 178 | + // 获取距离(单位:米) | |
| 179 | + points[index+1].distance = 0; | |
| 180 | + | |
| 181 | + // 获取时间(单位:秒) | |
| 182 | + points[index+1].duration = 0; | |
| 183 | + | |
| 184 | + }else { | |
| 185 | + | |
| 186 | + // 获取距离(单位:米) | |
| 187 | + points[index+1].distance = r.result.taxi.distance; | |
| 188 | + | |
| 189 | + // 获取时间(单位:秒) | |
| 190 | + points[index+1].duration = r.result.taxi.duration; | |
| 191 | + | |
| 192 | + } | |
| 193 | + | |
| 194 | + | |
| 195 | + } | |
| 196 | + | |
| 197 | + } | |
| 198 | + | |
| 199 | + f(); | |
| 200 | + } | |
| 201 | + }); | |
| 202 | + | |
| 203 | + })(); | |
| 204 | + | |
| 205 | + }, | |
| 206 | + // 在地图上画出上行线路走向 | |
| 207 | + drawingUpline01 : function (polylineArray,polyline_center,data) { | |
| 208 | + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId; | |
| 209 | + // 创建线路走向 | |
| 210 | + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 211 | + polyUpline01.data = data; | |
| 212 | + // 把折线添加到地图上 | |
| 213 | + mapBValue.addOverlay(polyUpline01); | |
| 214 | + var sectionPoint = []; | |
| 215 | + // 线路单击事件 | |
| 216 | + polyUpline01.addEventListener('click',function(e) { | |
| 217 | + if(SpeedingMap.getIsEditStatus()) { | |
| 218 | + layer.msg('请先保存正在编辑的路段信息...'); | |
| 219 | + return false; | |
| 220 | + } | |
| 221 | + if(SpeedingMap.getIsCutSection()) { | |
| 222 | + layer.msg('请先撤销所有切路段的点...'); | |
| 223 | + return false; | |
| 224 | + } | |
| 225 | + polyUpline01.enableEditing(); | |
| 226 | + SpeedingMap.setIsEditStatus(true); | |
| 227 | + }); | |
| 228 | + | |
| 229 | + // 添加路段双击事件 | |
| 230 | + polyUpline01.addEventListener("dblclick",function(e){ | |
| 231 | + if(SpeedingMap.getIsCutSection()) { | |
| 232 | + layer.msg('请先撤销所有切路段的点...'); | |
| 233 | + return false; | |
| 234 | + } | |
| 235 | + SpeedingMap.setIsEditStatus(false); | |
| 236 | + // 关闭 | |
| 237 | + layer.closeAll(); | |
| 238 | + polyUpline01.disableEditing(); | |
| 239 | + EditSectionObj.setEitdSection(polyUpline01.data); | |
| 240 | + // 获取折线坐标集合 | |
| 241 | + var editPloyLineArray = polyUpline01.getPath(); | |
| 242 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 243 | + sectionList = []; | |
| 244 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 245 | + // 截取路段 | |
| 246 | + $('#section_table tbody').html(tbodyHtml); | |
| 247 | + // 加载修改路段弹出层mobal页面 | |
| 248 | + $.get('editsection.html', function(m){ | |
| 249 | + $(pjaxContainer).append(m); | |
| 250 | + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [SpeedingMap,GetAjaxData,EditSectionObj,PublicFunctions]); | |
| 251 | + }); | |
| 252 | + }); | |
| 253 | + | |
| 254 | + // 路段右击事件 | |
| 255 | + var editSection = function(e,ee,marker){ | |
| 256 | + if(SpeedingMap.getIsEditStatus()) { | |
| 257 | + layer.msg('请先保存正在编辑的路段信息...'); | |
| 258 | + return false; | |
| 259 | + } | |
| 260 | + var lng = e.lng; | |
| 261 | + var lat = e.lat; | |
| 262 | + var sectionName = null; | |
| 263 | + var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点 | |
| 264 | + marker.isFlag = true; | |
| 265 | + if(pointIndex == 0) { | |
| 266 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 267 | + layer.msg('进入切路段状态,请选择本路段的终点!'); | |
| 268 | + mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 269 | + firstPoint = {lng:lng, lat:lat}; | |
| 270 | + pointIndex++; | |
| 271 | + EditSectionObj.setEitdSection(polyUpline01.data); | |
| 272 | + // 获取折线坐标集合 | |
| 273 | + var editPloyLineArray = polyUpline01.getPath(); | |
| 274 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 275 | + } else if (pointIndex > 0) { | |
| 276 | + layer.prompt({title: '请输入路段名!'}, function(sectionName, index){ | |
| 277 | + pointList = []; | |
| 278 | + sectionPoint[pointIndex] = {lng:lng , lat:lat}; | |
| 279 | + pointList[0] = sectionPoint[pointIndex-1]; | |
| 280 | + pointList[1] = sectionPoint[pointIndex]; | |
| 281 | + sectionList.push({name:sectionName, section:pointList}); | |
| 282 | + layer.close(index); | |
| 283 | + layer.msg('路段截取成功,请选择下一个路段的终点'); | |
| 284 | + mapBValue.addOverlay(marker);// 添加覆盖物 | |
| 285 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 286 | + // 截取路段 | |
| 287 | + $('#section_table tbody').html(tbodyHtml); | |
| 288 | + pointIndex++; | |
| 289 | + }); | |
| 290 | + } | |
| 291 | + SpeedingMap.setIsCutSection(true); | |
| 292 | + } | |
| 293 | + var markerMenu=new BMap.ContextMenu(); | |
| 294 | + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01))); | |
| 295 | + polyUpline01.addContextMenu(markerMenu); | |
| 296 | + | |
| 297 | + | |
| 298 | + var PanOptions_ ={noAnimation :true}; | |
| 299 | + mapBValue.reset(); | |
| 300 | + mapBValue.panTo(polyline_center,PanOptions_); | |
| 301 | + mapBValue.panBy(500,-510,PanOptions_); | |
| 302 | + mapBValue.setZoom(14); | |
| 303 | + }, | |
| 304 | + // 删除点刷新cutSectionTable | |
| 305 | + refreshCutSectionTable : function() { | |
| 306 | + var tbodyHtml = template('section_list',{list : sectionList}); | |
| 307 | + $('#section_table tbody').html(tbodyHtml); | |
| 308 | + }, | |
| 309 | + // 删除点刷新覆盖物 | |
| 310 | + deleteCutSectionPoint : function(point) { | |
| 311 | + var lng = point.lng; | |
| 312 | + var lat = point.lat; | |
| 313 | + var allOverlay = mapBValue.getOverlays(); | |
| 314 | + // 删除最后一个点 | |
| 315 | + for (var i = 0; i < allOverlay.length -1; i++){ | |
| 316 | + if(allOverlay[i].isFlag) { | |
| 317 | + if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){ | |
| 318 | + mapBValue.removeOverlay(allOverlay[i]); | |
| 319 | + break; | |
| 320 | + } | |
| 321 | + } | |
| 322 | + } | |
| 323 | + }, | |
| 324 | + /** 在地图上画点 @param:<point_center:中心坐标点> */ | |
| 325 | + drawingUpStationPoint : function(point_center,stationName,s) { | |
| 326 | + | |
| 327 | + // 自定义标注物图片 | |
| 328 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10)); | |
| 329 | + | |
| 330 | + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">' | |
| 331 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | |
| 332 | + + '</div>' | |
| 333 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>'; | |
| 334 | + | |
| 335 | + | |
| 336 | + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{ | |
| 337 | + "anchor" : new BMap.Size(-10,8), | |
| 338 | + "enableDragging" : true}); | |
| 339 | + | |
| 340 | + | |
| 341 | + myRichMarker1.disableDragging(); | |
| 342 | + mapBValue.addOverlay(myRichMarker1); | |
| 343 | + | |
| 344 | + | |
| 345 | + // 创建标注物 | |
| 346 | + marker = new BMap.Marker(point_center,{icon : icon_target}); | |
| 347 | + | |
| 348 | + // 允许覆盖物在map.clearOverlays方法中被清除。 | |
| 349 | + marker.enableMassClear(); | |
| 350 | + | |
| 351 | + mapBValue.addOverlay(marker); | |
| 352 | + }, | |
| 353 | + | |
| 354 | + // 根据站点坐标匹配库中的公交站点(手动规划) | |
| 355 | + stationsPointsToLibraryPoint : function(arra,callback) { | |
| 356 | + // 获取长度 | |
| 357 | + var len = arra.length; | |
| 358 | + var station = {}; | |
| 359 | + var stationList = []; | |
| 360 | + (function(){ | |
| 361 | + if (!arguments.callee.count) { | |
| 362 | + arguments.callee.count = 0; | |
| 363 | + } | |
| 364 | + arguments.callee.count++; | |
| 365 | + var index = parseInt(arguments.callee.count) - 1; | |
| 366 | + if (index >= len) { | |
| 367 | + callback && callback(stationList); | |
| 368 | + return ; | |
| 369 | + } | |
| 370 | + var f = arguments.callee; | |
| 371 | + station = arra[index]; | |
| 372 | + if(arra[index].name!=''){ | |
| 373 | + $.get('/station/matchStation',station,function(result) { | |
| 374 | + var centerPointWkt = result.centerPointWkt, idx = centerPointWkt.indexOf('POINT('); | |
| 375 | + centerPointWkt = idx > -1 ? centerPointWkt.substring(6, centerPointWkt.length - 1) : centerPointWkt; | |
| 376 | + var coordinates = centerPointWkt.split(' '); | |
| 377 | + stationList.push({name: result.name ,wgs: arra[index].wgs, potion: {lng: coordinates[0], lat: coordinates[1]}, isHave: result.isHave, id: result.id}); | |
| 378 | + f(); | |
| 379 | + }); | |
| 380 | + }else { | |
| 381 | + f(); | |
| 382 | + } | |
| 383 | + })() | |
| 384 | + }, | |
| 385 | + clearMarkAndOverlays : function() { | |
| 386 | + | |
| 387 | + // 清楚地图覆盖物 | |
| 388 | + mapBValue.clearOverlays(); | |
| 389 | + | |
| 390 | + mapBValue.removeOverlay(); | |
| 391 | + | |
| 392 | + } | |
| 393 | + | |
| 394 | + } | |
| 395 | + | |
| 396 | + return Bmap; | |
| 397 | + | |
| 398 | 398 | }(); |
| 399 | 399 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/mapmonitor/real/js/map_platform_old.js
| 1 | -var realMap = (function() { | |
| 2 | - | |
| 3 | - function getJSONP(url, data ,callback){ | |
| 4 | - $.ajax({ | |
| 5 | - url:url, | |
| 6 | - data: data, | |
| 7 | - dataType:'jsonp', | |
| 8 | - success:callback, | |
| 9 | - error: function(e){ | |
| 10 | - alert('error: jsonp,' + url); | |
| 11 | - } | |
| 12 | - }); | |
| 13 | - } | |
| 14 | - | |
| 15 | - /** | |
| 16 | - * 透明点,用于替换隐藏百度Marker的icon | |
| 17 | - */ | |
| 18 | - var tmIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAbSURBVHjaYvz//z8DAwMDAxMDFAAAAAD//wMAMAYDAW/BVI8AAAAASUVORK5CYII='; | |
| 19 | - | |
| 20 | - var REAL_BAIDU_TEXT = '百度地图', REAL_GAODE_TEXT = '高德地图'; | |
| 21 | - | |
| 22 | - // 中心点 (上海市浦东新区政府) | |
| 23 | - var CENTER_POINT = { | |
| 24 | - lng : 121.544336, | |
| 25 | - lat : 31.221315 | |
| 26 | - }; | |
| 27 | - | |
| 28 | - // 图层容器 | |
| 29 | - var mapContainer = $('#mapContainer'); | |
| 30 | - // 路况按钮 | |
| 31 | - var trafficBtn = $('#trafficItem'); | |
| 32 | - | |
| 33 | - var storage = window.localStorage; | |
| 34 | - | |
| 35 | - var currentMap; | |
| 36 | - | |
| 37 | - var city = "上海"; | |
| 38 | - | |
| 39 | - //百度API Key | |
| 40 | - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; | |
| 41 | - | |
| 42 | - var bd_gps_info_win_opts = { | |
| 43 | - width : 190, | |
| 44 | - height: 255, | |
| 45 | - enableMessage:true | |
| 46 | - }; | |
| 47 | - | |
| 48 | - //线路路由 | |
| 49 | - var polylines; | |
| 50 | - | |
| 51 | - //百度 -轨迹回放点聚合 | |
| 52 | - //var historyClusterer; | |
| 53 | - | |
| 54 | - var markerClusterer; | |
| 55 | - | |
| 56 | - //设备号和marker对照 | |
| 57 | - var markersMap; | |
| 58 | - var real_map = { | |
| 59 | - getMap: function(){ | |
| 60 | - return currentMap; | |
| 61 | - }, | |
| 62 | - init: function(){ | |
| 63 | - var m = storage.getItem('real_map'); | |
| 64 | - if(m && m == REAL_GAODE_TEXT) | |
| 65 | - real_map.gaode.init(); | |
| 66 | - else | |
| 67 | - real_map.baidu.init(); | |
| 68 | - }, | |
| 69 | - //百度地图 | |
| 70 | - baidu : { | |
| 71 | - //初始化 | |
| 72 | - init : function() { | |
| 73 | - real_map.setText(REAL_BAIDU_TEXT); | |
| 74 | - | |
| 75 | - var map = new BMap.Map(mapContainer[0]); | |
| 76 | - //中心点和缩放级别 | |
| 77 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 78 | - map.enableScrollWheelZoom(); | |
| 79 | - //加载完成 | |
| 80 | - map.addEventListener("tilesloaded", function() { | |
| 81 | - layer.closeAll(); | |
| 82 | - storage.setItem('real_map', REAL_BAIDU_TEXT); | |
| 83 | - }); | |
| 84 | - | |
| 85 | - // 路况控件 | |
| 86 | - var ctrl = new BMapLib.TrafficControl(); | |
| 87 | - map.addControl(ctrl); | |
| 88 | - | |
| 89 | - //historyClusterer = new BMapLib.MarkerClusterer(map, {isAverangeCenter : true,minClusterSize : 2}) | |
| 90 | - var isVisible; | |
| 91 | - trafficBtn.on('click', function() { | |
| 92 | - if (isVisible) { | |
| 93 | - ctrl.hide(); | |
| 94 | - isVisible = false; | |
| 95 | - //调整线路路由透明度 | |
| 96 | - $.each(polylines, function(){ | |
| 97 | - this.setStrokeOpacity(0.5); | |
| 98 | - }); | |
| 99 | - } else { | |
| 100 | - ctrl.show(); | |
| 101 | - isVisible = true; | |
| 102 | - //调整线路路由透明度 | |
| 103 | - $.each(polylines, function(){ | |
| 104 | - this.setStrokeOpacity(0.1); | |
| 105 | - }); | |
| 106 | - } | |
| 107 | - }); | |
| 108 | - //百度路况控件自身关闭按钮 | |
| 109 | - $('.portlet-fullscreen').on('click', '.maplibTc .maplibTcClose', function(){ | |
| 110 | - isVisible = false; | |
| 111 | - //调整线路路由透明度 | |
| 112 | - $.each(polylines, function(){ | |
| 113 | - this.setStrokeOpacity(0.5); | |
| 114 | - }); | |
| 115 | - }); | |
| 116 | - | |
| 117 | - $('#tcWrap.maplibTc').addClass('animated bounceInLeft'); | |
| 118 | - $('.maplibTcBtn_deskTop.anchorTR').remove(); | |
| 119 | - | |
| 120 | - //保存当前地图实例和名称 | |
| 121 | - currentMap = { | |
| 122 | - map: map, | |
| 123 | - mapName: REAL_BAIDU_TEXT, | |
| 124 | - fName : 'baidu' | |
| 125 | - } | |
| 126 | - | |
| 127 | - }, | |
| 128 | - clear: function(){ | |
| 129 | - currentMap.map.clearOverlays(); | |
| 130 | - markerClusterer && markerClusterer.clearMarkers(); | |
| 131 | - | |
| 132 | - }, | |
| 133 | - change : function() { | |
| 134 | - if(currentMap.mapName == REAL_BAIDU_TEXT) | |
| 135 | - return; | |
| 136 | - | |
| 137 | - showMsg(REAL_BAIDU_TEXT); | |
| 138 | - | |
| 139 | - real_map.destroy(); | |
| 140 | - real_map.baidu.init(); | |
| 141 | - }, | |
| 142 | - autocomplete: function(input, cb){ | |
| 143 | - var ac = new BMap.Autocomplete({ | |
| 144 | - 'location' : realMap.getMap().map, | |
| 145 | - 'input': input, | |
| 146 | - 'onSearchComplete': function(result){ | |
| 147 | - //隐藏默认的提示框 | |
| 148 | - ac.hide(); | |
| 149 | - cb && cb({type: 'baidu', result: result.wr}); | |
| 150 | - } | |
| 151 | - }); | |
| 152 | - | |
| 153 | - $('#' + input).on('keyup', function(){ | |
| 154 | - if(this.value == ''){ | |
| 155 | - $('.search_result').html(''); | |
| 156 | - return; | |
| 157 | - } | |
| 158 | - }); | |
| 159 | - | |
| 160 | - }, | |
| 161 | - setPlace: function(val){ | |
| 162 | - var map = currentMap.map; | |
| 163 | - map.clearOverlays(); | |
| 164 | - var local = new BMap.LocalSearch(map, { | |
| 165 | - onSearchComplete: function(){ | |
| 166 | - var poi = local.getResults().getPoi(0); | |
| 167 | - if(!poi){ | |
| 168 | - return; | |
| 169 | - } | |
| 170 | - var pp = poi.point; | |
| 171 | - map.centerAndZoom(pp, 18); | |
| 172 | - map.addOverlay(new BMap.Marker(pp)); | |
| 173 | - } | |
| 174 | - }); | |
| 175 | - | |
| 176 | - local.search(val); | |
| 177 | - }, | |
| 178 | - drawLine: function(route){ | |
| 179 | - var map = currentMap.map; | |
| 180 | - map.clearOverlays(); | |
| 181 | - polylines = []; | |
| 182 | - //画线路 | |
| 183 | - //从localStorage里读取路由信息 | |
| 184 | - //var route = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 185 | - var upLineOps = {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5} | |
| 186 | - ,downLineOps = {strokeColor:"red", strokeWeight:6, strokeOpacity:0.5}; | |
| 187 | - | |
| 188 | - var upPos = [], downPos = [], tempArray; | |
| 189 | - //上行 | |
| 190 | - if(route.up){ | |
| 191 | - $.each(route.up.split(','), function(){ | |
| 192 | - tempArray = this.split(' '); | |
| 193 | - upPos.push(new BMap.Point(tempArray[0], tempArray[1])); | |
| 194 | - }); | |
| 195 | - | |
| 196 | - var upLine = new BMap.Polyline(upPos, upLineOps); | |
| 197 | - map.addOverlay(upLine); | |
| 198 | - | |
| 199 | - polylines.push(upLine); | |
| 200 | - map.panTo(upPos[parseInt(upPos.length / 2)]); | |
| 201 | - } | |
| 202 | - //下行 | |
| 203 | - if(route.down){ | |
| 204 | - $.each(route.down.split(','), function(){ | |
| 205 | - tempArray = this.split(' '); | |
| 206 | - downPos.push(new BMap.Point(tempArray[0], tempArray[1])); | |
| 207 | - }); | |
| 208 | - | |
| 209 | - var downLine = new BMap.Polyline(downPos, downLineOps); | |
| 210 | - map.addOverlay(downLine); | |
| 211 | - polylines.push(downLine); | |
| 212 | - | |
| 213 | - } | |
| 214 | - }, | |
| 215 | - //批量将GPS信号画到地图上 | |
| 216 | - drawGpsMarker: function(gpsList){ | |
| 217 | - markersMap = {}; | |
| 218 | - var map = currentMap.map; | |
| 219 | - | |
| 220 | - markerClusterer && markerClusterer.clearMarkers(); | |
| 221 | - markerClusterer = new BMapLib.MarkerClusterer(map, {isAverangeCenter : true,minClusterSize : 3}); | |
| 222 | - real_map.baidu.coordsConvert(gpsList, function(){ | |
| 223 | - //绘制车辆位置 | |
| 224 | - var marker; | |
| 225 | - $.each(gpsList, function(i, gpsData){ | |
| 226 | - marker = createBDMarkerByGps(gpsData) | |
| 227 | - map.addOverlay(marker); | |
| 228 | - //marker加入点聚合 | |
| 229 | - markerClusterer.addMarker(marker); | |
| 230 | - | |
| 231 | - markersMap[gpsData.deviceId] = marker; | |
| 232 | - }); | |
| 233 | - | |
| 234 | - }); | |
| 235 | - }, | |
| 236 | - goToMarker: function(deviceId){ | |
| 237 | - var m = markersMap[deviceId]; | |
| 238 | - if(m){ | |
| 239 | - currentMap.map.panTo(m.point); | |
| 240 | - setTimeout(function(){ | |
| 241 | - bdOpenWindow(m); | |
| 242 | - }, 500); | |
| 243 | - } | |
| 244 | - }, | |
| 245 | - coordsConvert: function(list, cb){ | |
| 246 | - if(list.length > 100) | |
| 247 | - list = list.slice(0, 100); | |
| 248 | - | |
| 249 | - var coords = ''; | |
| 250 | - //拼接GPS坐标,一次性转换 | |
| 251 | - for (var i = 0, item; item = list[i++];) | |
| 252 | - coords += item.lon + ',' + item.lat + ';'; | |
| 253 | - coords = coords.substring(0, coords.length - 1); | |
| 254 | - getJSONP('//api.map.baidu.com/geoconv/v1/',{coords: coords, ak: bdKey} | |
| 255 | - ,function(rt){ | |
| 256 | - $.each(rt.result, function(j, bdCoord){ | |
| 257 | - list[j].bd_coord = bdCoord; | |
| 258 | - }); | |
| 259 | - cb&&cb(); | |
| 260 | - }); | |
| 261 | - }, | |
| 262 | - //绘制轨迹回放 marker | |
| 263 | - addHistoryMarker: function(gps){ | |
| 264 | - | |
| 265 | - var marker = bdHistoryMarker(gps); | |
| 266 | - currentMap.map.addOverlay(marker); | |
| 267 | - | |
| 268 | - //historyClusterer.addMarker(marker); | |
| 269 | - return marker; | |
| 270 | - }, | |
| 271 | - //移动marker | |
| 272 | - moveMarker: function(marker , gps){ | |
| 273 | - marker.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat)); | |
| 274 | - //重新设置颜色 | |
| 275 | - marker.getLabel().setStyle({borderColor: bgColor(gps), backgroundColor: bgColor(gps)}); | |
| 276 | - }, | |
| 277 | - //居中marker | |
| 278 | - markerToCenter: function(marker){ | |
| 279 | - currentMap.map.panTo(marker.getPosition()); | |
| 280 | - }, | |
| 281 | - //删除marker | |
| 282 | - removeMarker: function(marker){ | |
| 283 | - currentMap.map.removeOverlay(marker); | |
| 284 | - } | |
| 285 | - }, | |
| 286 | - //高德地图 | |
| 287 | - gaode : { | |
| 288 | - init : function() { | |
| 289 | - var mapLoadAnim = '<div class="sk-cube-grid _center">'+ | |
| 290 | - '<div class="sk-cube sk-cube1"></div>'+ | |
| 291 | - '<div class="sk-cube sk-cube2"></div>'+ | |
| 292 | - '<div class="sk-cube sk-cube3"></div>'+ | |
| 293 | - '<div class="sk-cube sk-cube4"></div>'+ | |
| 294 | - '<div class="sk-cube sk-cube5"></div>'+ | |
| 295 | - '<div class="sk-cube sk-cube6"></div>'+ | |
| 296 | - '<div class="sk-cube sk-cube7"></div>'+ | |
| 297 | - '<div class="sk-cube sk-cube8"></div>'+ | |
| 298 | - '<div class="sk-cube sk-cube9"></div>'+ | |
| 299 | - '</div>'; | |
| 300 | - | |
| 301 | - mapContainer.html(mapLoadAnim); | |
| 302 | - | |
| 303 | - real_map.gaode.setStyle(); | |
| 304 | - real_map.setText(REAL_GAODE_TEXT); | |
| 305 | - | |
| 306 | - var map = new AMap.Map(mapContainer[0]); | |
| 307 | - // 地图中心和缩放级别 | |
| 308 | - map.setZoomAndCenter(14, [ CENTER_POINT.lng,CENTER_POINT.lat ]); | |
| 309 | - //加载完成 | |
| 310 | - AMap.event.addListener(map, 'complete', function() { | |
| 311 | - layer.closeAll(); | |
| 312 | - storage.setItem('real_map', REAL_GAODE_TEXT); | |
| 313 | - $('.sk-cube-grid._center').remove(); | |
| 314 | - }); | |
| 315 | - | |
| 316 | - // 实时路况图层 | |
| 317 | - var trafficLayer = new AMap.TileLayer.Traffic(); | |
| 318 | - trafficLayer.setMap(map); | |
| 319 | - trafficLayer.hide(); | |
| 320 | - | |
| 321 | - var isVisible; | |
| 322 | - trafficBtn.on('click', function() { | |
| 323 | - if (isVisible) { | |
| 324 | - trafficLayer.hide(); | |
| 325 | - isVisible = false; | |
| 326 | - $(this).removeClass('active'); | |
| 327 | - | |
| 328 | - //调整线路路由透明度 | |
| 329 | - $.each(polylines, function(){ | |
| 330 | - this.setOptions({strokeOpacity: 0.5}); | |
| 331 | - }); | |
| 332 | - } else { | |
| 333 | - trafficLayer.show(); | |
| 334 | - isVisible = true; | |
| 335 | - $(this).addClass('active'); | |
| 336 | - | |
| 337 | - //调整线路路由透明度 | |
| 338 | - $.each(polylines, function(){ | |
| 339 | - this.setOptions({strokeOpacity: 0.1}); | |
| 340 | - }); | |
| 341 | - } | |
| 342 | - }); | |
| 343 | - | |
| 344 | - //保存当前地图实例和名称 | |
| 345 | - currentMap = { | |
| 346 | - map: map, | |
| 347 | - mapName: REAL_GAODE_TEXT, | |
| 348 | - fName : 'gaode' | |
| 349 | - } | |
| 350 | - | |
| 351 | - }, | |
| 352 | - change : function() { | |
| 353 | - if(currentMap.mapName == REAL_GAODE_TEXT) | |
| 354 | - return; | |
| 355 | - | |
| 356 | - showMsg(REAL_GAODE_TEXT); | |
| 357 | - | |
| 358 | - real_map.destroy(); | |
| 359 | - real_map.gaode.init(); | |
| 360 | - }, | |
| 361 | - setStyle : function() { | |
| 362 | - $('.mapRightWrap').addClass('gaode'); | |
| 363 | - $('.mapTools').addClass('gaode'); | |
| 364 | - $('.leftUtils').addClass('gaode'); | |
| 365 | - }, | |
| 366 | - clearStyle : function() { | |
| 367 | - $('.mapRightWrap').removeClass('gaode'); | |
| 368 | - $('.mapTools').removeClass('gaode'); | |
| 369 | - $('.leftUtils').removeClass('gaode'); | |
| 370 | - }, | |
| 371 | - autocomplete: function(input, cb){ | |
| 372 | - | |
| 373 | - AMap.plugin('AMap.Autocomplete',function(){ | |
| 374 | - var autoOptions = { | |
| 375 | - city: city | |
| 376 | - }; | |
| 377 | - autocomplete= new AMap.Autocomplete(autoOptions); | |
| 378 | - | |
| 379 | - $('#' + input).on('keyup', function(){ | |
| 380 | - if(this.value == ''){ | |
| 381 | - $('.search_result').html(''); | |
| 382 | - return; | |
| 383 | - } | |
| 384 | - autocomplete.search(this.value, function(status, result){ | |
| 385 | - cb & cb({type: 'gaode', result: result.tips}); | |
| 386 | - }); | |
| 387 | - }); | |
| 388 | - }); | |
| 389 | - }, | |
| 390 | - setPlace: function(val){ | |
| 391 | - var map = currentMap.map; | |
| 392 | - | |
| 393 | - AMap.plugin(['AMap.PlaceSearch'],function(){ | |
| 394 | - var placeSearch = new AMap.PlaceSearch({ | |
| 395 | - city:city, | |
| 396 | - map:map, | |
| 397 | - pageSize: 1 | |
| 398 | - }); | |
| 399 | - | |
| 400 | - placeSearch.search(val); | |
| 401 | - }); | |
| 402 | - }, | |
| 403 | - drawLine: function(route){ | |
| 404 | - polylines = []; | |
| 405 | - var map = currentMap.map; | |
| 406 | - map.clearMap(); | |
| 407 | - | |
| 408 | - //var route = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 409 | - var upArr = [], downArr = []; | |
| 410 | - | |
| 411 | - var upLineOps = {path: upArr, strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5} | |
| 412 | - ,downLineOps = {path: downArr, strokeColor:"red", strokeWeight:6, strokeOpacity:0.5}; | |
| 413 | - | |
| 414 | - //上行 | |
| 415 | - if(route.up){ | |
| 416 | - $.each(route.up_gcj.split(','), function(){ | |
| 417 | - tempArray = this.split(' '); | |
| 418 | - upArr.push([tempArray[0], tempArray[1]]); | |
| 419 | - }); | |
| 420 | - var upLine = new AMap.Polyline(upLineOps); | |
| 421 | - //保存线条引用 | |
| 422 | - polylines.push(upLine); | |
| 423 | - | |
| 424 | - upLine.setMap(map); | |
| 425 | - map.setCenter(upArr[parseInt(upArr.length / 2)]); | |
| 426 | - | |
| 427 | - } | |
| 428 | - //下行 | |
| 429 | - if(route.down){ | |
| 430 | - $.each(route.down_gcj.split(','), function(){ | |
| 431 | - tempArray = this.split(' '); | |
| 432 | - downArr.push([tempArray[0], tempArray[1]]); | |
| 433 | - }); | |
| 434 | - var downLine = new AMap.Polyline(downLineOps); | |
| 435 | - //保存线条引用 | |
| 436 | - polylines.push(downLine); | |
| 437 | - | |
| 438 | - downLine.setMap(map); | |
| 439 | - } | |
| 440 | - }, | |
| 441 | - drawGpsMarker: function(gpsList){ | |
| 442 | - } | |
| 443 | - }, | |
| 444 | - setText : function(text) { | |
| 445 | - $('.leftUtils span.dropdown-toggle').html( | |
| 446 | - text + ' <i class="fa fa-angle-down"></i>'); | |
| 447 | - }, | |
| 448 | - destroy : function() { | |
| 449 | - trafficBtn.unbind('click'); | |
| 450 | - | |
| 451 | - //如果当前地图实例有destroy方法即执行 | |
| 452 | - var map = currentMap.map; | |
| 453 | - map.destroy && map.destroy(); | |
| 454 | - | |
| 455 | - if (currentMap.mapName == REAL_GAODE_TEXT) { | |
| 456 | - // 如果前一个地图是高德,清除相关样式 | |
| 457 | - real_map.gaode.clearStyle(); | |
| 458 | - } | |
| 459 | - } | |
| 460 | - } | |
| 461 | - | |
| 462 | - function showMsg(text){ | |
| 463 | - layer.msg('正在切换到' + text + '...', {icon : 16,shade : [ 0.6, '#393D49' ],time : 0}); | |
| 464 | - } | |
| 465 | - | |
| 466 | - /** | |
| 467 | - * 颜色 | |
| 468 | - */ | |
| 469 | - var bgColor = function(g){ | |
| 470 | - if(g.state == 0){ | |
| 471 | - if(g.upDown == 0) | |
| 472 | - return '#5E96D2'; | |
| 473 | - else if(g.upDown == 1) | |
| 474 | - return '#C92121'; | |
| 475 | - else | |
| 476 | - return 'red'; | |
| 477 | - } | |
| 478 | - else | |
| 479 | - return "rgb(171, 171, 171)"; | |
| 480 | - } | |
| 481 | - | |
| 482 | - var tColor = function(g){ | |
| 483 | - if(g.state == 0) | |
| 484 | - return "#fff"; | |
| 485 | - else | |
| 486 | - return "rgb(229, 229, 229)"; | |
| 487 | - } | |
| 488 | - | |
| 489 | - function createBDMarkerByGps(gpsData){ | |
| 490 | - //marker | |
| 491 | - var point = new BMap.Point(gpsData.bd_coord.x, gpsData.bd_coord.y) | |
| 492 | - //label | |
| 493 | - ,label = new BMap.Label(gpsData.nbbm.replace('-',''), {position: point, offset: new BMap.Size(-20,8)}); | |
| 494 | - label.setStyle({borderColor: bgColor(gpsData), padding: '6px 6px 4px 6px', color: tColor(gpsData), backgroundColor: bgColor(gpsData)}); | |
| 495 | - var marker = new BMap.Marker(point); | |
| 496 | - marker.setLabel(label); | |
| 497 | - //icon | |
| 498 | - marker.setIcon(new BMap.Icon(tmIcon, new BMap.Size(25,25))); | |
| 499 | - //window 绑定到 label | |
| 500 | - marker.infoWindow = new BMap.InfoWindow(bd_gps_info_win_opts); | |
| 501 | - //数据绑定到label | |
| 502 | - marker.gpsData = gpsData; | |
| 503 | - | |
| 504 | - //mouseover | |
| 505 | - label.addEventListener('mouseover', function(){ | |
| 506 | - bdOpenWindow(marker); | |
| 507 | - }); | |
| 508 | - return marker; | |
| 509 | - } | |
| 510 | - | |
| 511 | - function bdHistoryMarker(gps){ | |
| 512 | - //marker | |
| 513 | - var point = new BMap.Point(gps.bd_lon, gps.bd_lat) | |
| 514 | - //label | |
| 515 | - ,label = new BMap.Label(gps.nbbm, {position: point, offset: new BMap.Size(-20,8)}); | |
| 516 | - label.setStyle({borderColor: bgColor(gps), padding: '6px 6px 4px 6px', color: tColor(gps), backgroundColor: bgColor(gps)}); | |
| 517 | - var marker = new BMap.Marker(point); | |
| 518 | - marker.setLabel(label); | |
| 519 | - //icon | |
| 520 | - marker.setIcon(new BMap.Icon(tmIcon, new BMap.Size(25,25))); | |
| 521 | -/* //window 绑定到 label | |
| 522 | - marker.infoWindow = new BMap.InfoWindow(bd_gps_info_win_opts); | |
| 523 | - //数据绑定到label | |
| 524 | - marker.gpsData = gpsData; | |
| 525 | - | |
| 526 | - //mouseover | |
| 527 | - label.addEventListener('mouseover', function(){ | |
| 528 | - bdOpenWindow(marker); | |
| 529 | - });*/ | |
| 530 | - return marker; | |
| 531 | - } | |
| 532 | - | |
| 533 | - function bdOpenWindow(marker){ | |
| 534 | - marker.infoWindow.setContent(template('gps_info_win_temp', marker.gpsData)); | |
| 535 | - currentMap.map.openInfoWindow(marker.infoWindow, marker.point); | |
| 536 | - } | |
| 537 | - return real_map; | |
| 1 | +var realMap = (function() { | |
| 2 | + | |
| 3 | + function getJSONP(url, data ,callback){ | |
| 4 | + $.ajax({ | |
| 5 | + url:url, | |
| 6 | + data: data, | |
| 7 | + dataType:'jsonp', | |
| 8 | + success:callback, | |
| 9 | + error: function(e){ | |
| 10 | + alert('error: jsonp,' + url); | |
| 11 | + } | |
| 12 | + }); | |
| 13 | + } | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 透明点,用于替换隐藏百度Marker的icon | |
| 17 | + */ | |
| 18 | + var tmIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAbSURBVHjaYvz//z8DAwMDAxMDFAAAAAD//wMAMAYDAW/BVI8AAAAASUVORK5CYII='; | |
| 19 | + | |
| 20 | + var REAL_BAIDU_TEXT = '百度地图', REAL_GAODE_TEXT = '高德地图'; | |
| 21 | + | |
| 22 | + // 中心点 (上海市浦东新区政府) | |
| 23 | + var CENTER_POINT = { | |
| 24 | + lng : 121.544336, | |
| 25 | + lat : 31.221315 | |
| 26 | + }; | |
| 27 | + | |
| 28 | + // 图层容器 | |
| 29 | + var mapContainer = $('#mapContainer'); | |
| 30 | + // 路况按钮 | |
| 31 | + var trafficBtn = $('#trafficItem'); | |
| 32 | + | |
| 33 | + var storage = window.localStorage; | |
| 34 | + | |
| 35 | + var currentMap; | |
| 36 | + | |
| 37 | + var city = "上海"; | |
| 38 | + | |
| 39 | + //百度API Key | |
| 40 | + var bdKey = '1TgEKvYqohJyeGXnN6yHSSTb4psOarQw'; | |
| 41 | + | |
| 42 | + var bd_gps_info_win_opts = { | |
| 43 | + width : 190, | |
| 44 | + height: 255, | |
| 45 | + enableMessage:true | |
| 46 | + }; | |
| 47 | + | |
| 48 | + //线路路由 | |
| 49 | + var polylines; | |
| 50 | + | |
| 51 | + //百度 -轨迹回放点聚合 | |
| 52 | + //var historyClusterer; | |
| 53 | + | |
| 54 | + var markerClusterer; | |
| 55 | + | |
| 56 | + //设备号和marker对照 | |
| 57 | + var markersMap; | |
| 58 | + var real_map = { | |
| 59 | + getMap: function(){ | |
| 60 | + return currentMap; | |
| 61 | + }, | |
| 62 | + init: function(){ | |
| 63 | + var m = storage.getItem('real_map'); | |
| 64 | + if(m && m == REAL_GAODE_TEXT) | |
| 65 | + real_map.gaode.init(); | |
| 66 | + else | |
| 67 | + real_map.baidu.init(); | |
| 68 | + }, | |
| 69 | + //百度地图 | |
| 70 | + baidu : { | |
| 71 | + //初始化 | |
| 72 | + init : function() { | |
| 73 | + real_map.setText(REAL_BAIDU_TEXT); | |
| 74 | + | |
| 75 | + var map = new BMap.Map(mapContainer[0]); | |
| 76 | + //中心点和缩放级别 | |
| 77 | + map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 78 | + map.enableScrollWheelZoom(); | |
| 79 | + //加载完成 | |
| 80 | + map.addEventListener("tilesloaded", function() { | |
| 81 | + layer.closeAll(); | |
| 82 | + storage.setItem('real_map', REAL_BAIDU_TEXT); | |
| 83 | + }); | |
| 84 | + | |
| 85 | + // 路况控件 | |
| 86 | + var ctrl = new BMapLib.TrafficControl(); | |
| 87 | + map.addControl(ctrl); | |
| 88 | + | |
| 89 | + //historyClusterer = new BMapLib.MarkerClusterer(map, {isAverangeCenter : true,minClusterSize : 2}) | |
| 90 | + var isVisible; | |
| 91 | + trafficBtn.on('click', function() { | |
| 92 | + if (isVisible) { | |
| 93 | + ctrl.hide(); | |
| 94 | + isVisible = false; | |
| 95 | + //调整线路路由透明度 | |
| 96 | + $.each(polylines, function(){ | |
| 97 | + this.setStrokeOpacity(0.5); | |
| 98 | + }); | |
| 99 | + } else { | |
| 100 | + ctrl.show(); | |
| 101 | + isVisible = true; | |
| 102 | + //调整线路路由透明度 | |
| 103 | + $.each(polylines, function(){ | |
| 104 | + this.setStrokeOpacity(0.1); | |
| 105 | + }); | |
| 106 | + } | |
| 107 | + }); | |
| 108 | + //百度路况控件自身关闭按钮 | |
| 109 | + $('.portlet-fullscreen').on('click', '.maplibTc .maplibTcClose', function(){ | |
| 110 | + isVisible = false; | |
| 111 | + //调整线路路由透明度 | |
| 112 | + $.each(polylines, function(){ | |
| 113 | + this.setStrokeOpacity(0.5); | |
| 114 | + }); | |
| 115 | + }); | |
| 116 | + | |
| 117 | + $('#tcWrap.maplibTc').addClass('animated bounceInLeft'); | |
| 118 | + $('.maplibTcBtn_deskTop.anchorTR').remove(); | |
| 119 | + | |
| 120 | + //保存当前地图实例和名称 | |
| 121 | + currentMap = { | |
| 122 | + map: map, | |
| 123 | + mapName: REAL_BAIDU_TEXT, | |
| 124 | + fName : 'baidu' | |
| 125 | + } | |
| 126 | + | |
| 127 | + }, | |
| 128 | + clear: function(){ | |
| 129 | + currentMap.map.clearOverlays(); | |
| 130 | + markerClusterer && markerClusterer.clearMarkers(); | |
| 131 | + | |
| 132 | + }, | |
| 133 | + change : function() { | |
| 134 | + if(currentMap.mapName == REAL_BAIDU_TEXT) | |
| 135 | + return; | |
| 136 | + | |
| 137 | + showMsg(REAL_BAIDU_TEXT); | |
| 138 | + | |
| 139 | + real_map.destroy(); | |
| 140 | + real_map.baidu.init(); | |
| 141 | + }, | |
| 142 | + autocomplete: function(input, cb){ | |
| 143 | + var ac = new BMap.Autocomplete({ | |
| 144 | + 'location' : realMap.getMap().map, | |
| 145 | + 'input': input, | |
| 146 | + 'onSearchComplete': function(result){ | |
| 147 | + //隐藏默认的提示框 | |
| 148 | + ac.hide(); | |
| 149 | + cb && cb({type: 'baidu', result: result.wr}); | |
| 150 | + } | |
| 151 | + }); | |
| 152 | + | |
| 153 | + $('#' + input).on('keyup', function(){ | |
| 154 | + if(this.value == ''){ | |
| 155 | + $('.search_result').html(''); | |
| 156 | + return; | |
| 157 | + } | |
| 158 | + }); | |
| 159 | + | |
| 160 | + }, | |
| 161 | + setPlace: function(val){ | |
| 162 | + var map = currentMap.map; | |
| 163 | + map.clearOverlays(); | |
| 164 | + var local = new BMap.LocalSearch(map, { | |
| 165 | + onSearchComplete: function(){ | |
| 166 | + var poi = local.getResults().getPoi(0); | |
| 167 | + if(!poi){ | |
| 168 | + return; | |
| 169 | + } | |
| 170 | + var pp = poi.point; | |
| 171 | + map.centerAndZoom(pp, 18); | |
| 172 | + map.addOverlay(new BMap.Marker(pp)); | |
| 173 | + } | |
| 174 | + }); | |
| 175 | + | |
| 176 | + local.search(val); | |
| 177 | + }, | |
| 178 | + drawLine: function(route){ | |
| 179 | + var map = currentMap.map; | |
| 180 | + map.clearOverlays(); | |
| 181 | + polylines = []; | |
| 182 | + //画线路 | |
| 183 | + //从localStorage里读取路由信息 | |
| 184 | + //var route = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 185 | + var upLineOps = {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5} | |
| 186 | + ,downLineOps = {strokeColor:"red", strokeWeight:6, strokeOpacity:0.5}; | |
| 187 | + | |
| 188 | + var upPos = [], downPos = [], tempArray; | |
| 189 | + //上行 | |
| 190 | + if(route.up){ | |
| 191 | + $.each(route.up.split(','), function(){ | |
| 192 | + tempArray = this.split(' '); | |
| 193 | + upPos.push(new BMap.Point(tempArray[0], tempArray[1])); | |
| 194 | + }); | |
| 195 | + | |
| 196 | + var upLine = new BMap.Polyline(upPos, upLineOps); | |
| 197 | + map.addOverlay(upLine); | |
| 198 | + | |
| 199 | + polylines.push(upLine); | |
| 200 | + map.panTo(upPos[parseInt(upPos.length / 2)]); | |
| 201 | + } | |
| 202 | + //下行 | |
| 203 | + if(route.down){ | |
| 204 | + $.each(route.down.split(','), function(){ | |
| 205 | + tempArray = this.split(' '); | |
| 206 | + downPos.push(new BMap.Point(tempArray[0], tempArray[1])); | |
| 207 | + }); | |
| 208 | + | |
| 209 | + var downLine = new BMap.Polyline(downPos, downLineOps); | |
| 210 | + map.addOverlay(downLine); | |
| 211 | + polylines.push(downLine); | |
| 212 | + | |
| 213 | + } | |
| 214 | + }, | |
| 215 | + //批量将GPS信号画到地图上 | |
| 216 | + drawGpsMarker: function(gpsList){ | |
| 217 | + markersMap = {}; | |
| 218 | + var map = currentMap.map; | |
| 219 | + | |
| 220 | + markerClusterer && markerClusterer.clearMarkers(); | |
| 221 | + markerClusterer = new BMapLib.MarkerClusterer(map, {isAverangeCenter : true,minClusterSize : 3}); | |
| 222 | + real_map.baidu.coordsConvert(gpsList, function(){ | |
| 223 | + //绘制车辆位置 | |
| 224 | + var marker; | |
| 225 | + $.each(gpsList, function(i, gpsData){ | |
| 226 | + marker = createBDMarkerByGps(gpsData) | |
| 227 | + map.addOverlay(marker); | |
| 228 | + //marker加入点聚合 | |
| 229 | + markerClusterer.addMarker(marker); | |
| 230 | + | |
| 231 | + markersMap[gpsData.deviceId] = marker; | |
| 232 | + }); | |
| 233 | + | |
| 234 | + }); | |
| 235 | + }, | |
| 236 | + goToMarker: function(deviceId){ | |
| 237 | + var m = markersMap[deviceId]; | |
| 238 | + if(m){ | |
| 239 | + currentMap.map.panTo(m.point); | |
| 240 | + setTimeout(function(){ | |
| 241 | + bdOpenWindow(m); | |
| 242 | + }, 500); | |
| 243 | + } | |
| 244 | + }, | |
| 245 | + coordsConvert: function(list, cb){ | |
| 246 | + if(list.length > 100) | |
| 247 | + list = list.slice(0, 100); | |
| 248 | + | |
| 249 | + var coords = ''; | |
| 250 | + //拼接GPS坐标,一次性转换 | |
| 251 | + for (var i = 0, item; item = list[i++];) | |
| 252 | + coords += item.lon + ',' + item.lat + ';'; | |
| 253 | + coords = coords.substring(0, coords.length - 1); | |
| 254 | + getJSONP('//api.map.baidu.com/geoconv/v1/',{coords: coords, ak: bdKey} | |
| 255 | + ,function(rt){ | |
| 256 | + $.each(rt.result, function(j, bdCoord){ | |
| 257 | + list[j].bd_coord = bdCoord; | |
| 258 | + }); | |
| 259 | + cb&&cb(); | |
| 260 | + }); | |
| 261 | + }, | |
| 262 | + //绘制轨迹回放 marker | |
| 263 | + addHistoryMarker: function(gps){ | |
| 264 | + | |
| 265 | + var marker = bdHistoryMarker(gps); | |
| 266 | + currentMap.map.addOverlay(marker); | |
| 267 | + | |
| 268 | + //historyClusterer.addMarker(marker); | |
| 269 | + return marker; | |
| 270 | + }, | |
| 271 | + //移动marker | |
| 272 | + moveMarker: function(marker , gps){ | |
| 273 | + marker.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat)); | |
| 274 | + //重新设置颜色 | |
| 275 | + marker.getLabel().setStyle({borderColor: bgColor(gps), backgroundColor: bgColor(gps)}); | |
| 276 | + }, | |
| 277 | + //居中marker | |
| 278 | + markerToCenter: function(marker){ | |
| 279 | + currentMap.map.panTo(marker.getPosition()); | |
| 280 | + }, | |
| 281 | + //删除marker | |
| 282 | + removeMarker: function(marker){ | |
| 283 | + currentMap.map.removeOverlay(marker); | |
| 284 | + } | |
| 285 | + }, | |
| 286 | + //高德地图 | |
| 287 | + gaode : { | |
| 288 | + init : function() { | |
| 289 | + var mapLoadAnim = '<div class="sk-cube-grid _center">'+ | |
| 290 | + '<div class="sk-cube sk-cube1"></div>'+ | |
| 291 | + '<div class="sk-cube sk-cube2"></div>'+ | |
| 292 | + '<div class="sk-cube sk-cube3"></div>'+ | |
| 293 | + '<div class="sk-cube sk-cube4"></div>'+ | |
| 294 | + '<div class="sk-cube sk-cube5"></div>'+ | |
| 295 | + '<div class="sk-cube sk-cube6"></div>'+ | |
| 296 | + '<div class="sk-cube sk-cube7"></div>'+ | |
| 297 | + '<div class="sk-cube sk-cube8"></div>'+ | |
| 298 | + '<div class="sk-cube sk-cube9"></div>'+ | |
| 299 | + '</div>'; | |
| 300 | + | |
| 301 | + mapContainer.html(mapLoadAnim); | |
| 302 | + | |
| 303 | + real_map.gaode.setStyle(); | |
| 304 | + real_map.setText(REAL_GAODE_TEXT); | |
| 305 | + | |
| 306 | + var map = new AMap.Map(mapContainer[0]); | |
| 307 | + // 地图中心和缩放级别 | |
| 308 | + map.setZoomAndCenter(14, [ CENTER_POINT.lng,CENTER_POINT.lat ]); | |
| 309 | + //加载完成 | |
| 310 | + AMap.event.addListener(map, 'complete', function() { | |
| 311 | + layer.closeAll(); | |
| 312 | + storage.setItem('real_map', REAL_GAODE_TEXT); | |
| 313 | + $('.sk-cube-grid._center').remove(); | |
| 314 | + }); | |
| 315 | + | |
| 316 | + // 实时路况图层 | |
| 317 | + var trafficLayer = new AMap.TileLayer.Traffic(); | |
| 318 | + trafficLayer.setMap(map); | |
| 319 | + trafficLayer.hide(); | |
| 320 | + | |
| 321 | + var isVisible; | |
| 322 | + trafficBtn.on('click', function() { | |
| 323 | + if (isVisible) { | |
| 324 | + trafficLayer.hide(); | |
| 325 | + isVisible = false; | |
| 326 | + $(this).removeClass('active'); | |
| 327 | + | |
| 328 | + //调整线路路由透明度 | |
| 329 | + $.each(polylines, function(){ | |
| 330 | + this.setOptions({strokeOpacity: 0.5}); | |
| 331 | + }); | |
| 332 | + } else { | |
| 333 | + trafficLayer.show(); | |
| 334 | + isVisible = true; | |
| 335 | + $(this).addClass('active'); | |
| 336 | + | |
| 337 | + //调整线路路由透明度 | |
| 338 | + $.each(polylines, function(){ | |
| 339 | + this.setOptions({strokeOpacity: 0.1}); | |
| 340 | + }); | |
| 341 | + } | |
| 342 | + }); | |
| 343 | + | |
| 344 | + //保存当前地图实例和名称 | |
| 345 | + currentMap = { | |
| 346 | + map: map, | |
| 347 | + mapName: REAL_GAODE_TEXT, | |
| 348 | + fName : 'gaode' | |
| 349 | + } | |
| 350 | + | |
| 351 | + }, | |
| 352 | + change : function() { | |
| 353 | + if(currentMap.mapName == REAL_GAODE_TEXT) | |
| 354 | + return; | |
| 355 | + | |
| 356 | + showMsg(REAL_GAODE_TEXT); | |
| 357 | + | |
| 358 | + real_map.destroy(); | |
| 359 | + real_map.gaode.init(); | |
| 360 | + }, | |
| 361 | + setStyle : function() { | |
| 362 | + $('.mapRightWrap').addClass('gaode'); | |
| 363 | + $('.mapTools').addClass('gaode'); | |
| 364 | + $('.leftUtils').addClass('gaode'); | |
| 365 | + }, | |
| 366 | + clearStyle : function() { | |
| 367 | + $('.mapRightWrap').removeClass('gaode'); | |
| 368 | + $('.mapTools').removeClass('gaode'); | |
| 369 | + $('.leftUtils').removeClass('gaode'); | |
| 370 | + }, | |
| 371 | + autocomplete: function(input, cb){ | |
| 372 | + | |
| 373 | + AMap.plugin('AMap.Autocomplete',function(){ | |
| 374 | + var autoOptions = { | |
| 375 | + city: city | |
| 376 | + }; | |
| 377 | + autocomplete= new AMap.Autocomplete(autoOptions); | |
| 378 | + | |
| 379 | + $('#' + input).on('keyup', function(){ | |
| 380 | + if(this.value == ''){ | |
| 381 | + $('.search_result').html(''); | |
| 382 | + return; | |
| 383 | + } | |
| 384 | + autocomplete.search(this.value, function(status, result){ | |
| 385 | + cb & cb({type: 'gaode', result: result.tips}); | |
| 386 | + }); | |
| 387 | + }); | |
| 388 | + }); | |
| 389 | + }, | |
| 390 | + setPlace: function(val){ | |
| 391 | + var map = currentMap.map; | |
| 392 | + | |
| 393 | + AMap.plugin(['AMap.PlaceSearch'],function(){ | |
| 394 | + var placeSearch = new AMap.PlaceSearch({ | |
| 395 | + city:city, | |
| 396 | + map:map, | |
| 397 | + pageSize: 1 | |
| 398 | + }); | |
| 399 | + | |
| 400 | + placeSearch.search(val); | |
| 401 | + }); | |
| 402 | + }, | |
| 403 | + drawLine: function(route){ | |
| 404 | + polylines = []; | |
| 405 | + var map = currentMap.map; | |
| 406 | + map.clearMap(); | |
| 407 | + | |
| 408 | + //var route = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 409 | + var upArr = [], downArr = []; | |
| 410 | + | |
| 411 | + var upLineOps = {path: upArr, strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5} | |
| 412 | + ,downLineOps = {path: downArr, strokeColor:"red", strokeWeight:6, strokeOpacity:0.5}; | |
| 413 | + | |
| 414 | + //上行 | |
| 415 | + if(route.up){ | |
| 416 | + $.each(route.up_gcj.split(','), function(){ | |
| 417 | + tempArray = this.split(' '); | |
| 418 | + upArr.push([tempArray[0], tempArray[1]]); | |
| 419 | + }); | |
| 420 | + var upLine = new AMap.Polyline(upLineOps); | |
| 421 | + //保存线条引用 | |
| 422 | + polylines.push(upLine); | |
| 423 | + | |
| 424 | + upLine.setMap(map); | |
| 425 | + map.setCenter(upArr[parseInt(upArr.length / 2)]); | |
| 426 | + | |
| 427 | + } | |
| 428 | + //下行 | |
| 429 | + if(route.down){ | |
| 430 | + $.each(route.down_gcj.split(','), function(){ | |
| 431 | + tempArray = this.split(' '); | |
| 432 | + downArr.push([tempArray[0], tempArray[1]]); | |
| 433 | + }); | |
| 434 | + var downLine = new AMap.Polyline(downLineOps); | |
| 435 | + //保存线条引用 | |
| 436 | + polylines.push(downLine); | |
| 437 | + | |
| 438 | + downLine.setMap(map); | |
| 439 | + } | |
| 440 | + }, | |
| 441 | + drawGpsMarker: function(gpsList){ | |
| 442 | + } | |
| 443 | + }, | |
| 444 | + setText : function(text) { | |
| 445 | + $('.leftUtils span.dropdown-toggle').html( | |
| 446 | + text + ' <i class="fa fa-angle-down"></i>'); | |
| 447 | + }, | |
| 448 | + destroy : function() { | |
| 449 | + trafficBtn.unbind('click'); | |
| 450 | + | |
| 451 | + //如果当前地图实例有destroy方法即执行 | |
| 452 | + var map = currentMap.map; | |
| 453 | + map.destroy && map.destroy(); | |
| 454 | + | |
| 455 | + if (currentMap.mapName == REAL_GAODE_TEXT) { | |
| 456 | + // 如果前一个地图是高德,清除相关样式 | |
| 457 | + real_map.gaode.clearStyle(); | |
| 458 | + } | |
| 459 | + } | |
| 460 | + } | |
| 461 | + | |
| 462 | + function showMsg(text){ | |
| 463 | + layer.msg('正在切换到' + text + '...', {icon : 16,shade : [ 0.6, '#393D49' ],time : 0}); | |
| 464 | + } | |
| 465 | + | |
| 466 | + /** | |
| 467 | + * 颜色 | |
| 468 | + */ | |
| 469 | + var bgColor = function(g){ | |
| 470 | + if(g.state == 0){ | |
| 471 | + if(g.upDown == 0) | |
| 472 | + return '#5E96D2'; | |
| 473 | + else if(g.upDown == 1) | |
| 474 | + return '#C92121'; | |
| 475 | + else | |
| 476 | + return 'red'; | |
| 477 | + } | |
| 478 | + else | |
| 479 | + return "rgb(171, 171, 171)"; | |
| 480 | + } | |
| 481 | + | |
| 482 | + var tColor = function(g){ | |
| 483 | + if(g.state == 0) | |
| 484 | + return "#fff"; | |
| 485 | + else | |
| 486 | + return "rgb(229, 229, 229)"; | |
| 487 | + } | |
| 488 | + | |
| 489 | + function createBDMarkerByGps(gpsData){ | |
| 490 | + //marker | |
| 491 | + var point = new BMap.Point(gpsData.bd_coord.x, gpsData.bd_coord.y) | |
| 492 | + //label | |
| 493 | + ,label = new BMap.Label(gpsData.nbbm.replace('-',''), {position: point, offset: new BMap.Size(-20,8)}); | |
| 494 | + label.setStyle({borderColor: bgColor(gpsData), padding: '6px 6px 4px 6px', color: tColor(gpsData), backgroundColor: bgColor(gpsData)}); | |
| 495 | + var marker = new BMap.Marker(point); | |
| 496 | + marker.setLabel(label); | |
| 497 | + //icon | |
| 498 | + marker.setIcon(new BMap.Icon(tmIcon, new BMap.Size(25,25))); | |
| 499 | + //window 绑定到 label | |
| 500 | + marker.infoWindow = new BMap.InfoWindow(bd_gps_info_win_opts); | |
| 501 | + //数据绑定到label | |
| 502 | + marker.gpsData = gpsData; | |
| 503 | + | |
| 504 | + //mouseover | |
| 505 | + label.addEventListener('mouseover', function(){ | |
| 506 | + bdOpenWindow(marker); | |
| 507 | + }); | |
| 508 | + return marker; | |
| 509 | + } | |
| 510 | + | |
| 511 | + function bdHistoryMarker(gps){ | |
| 512 | + //marker | |
| 513 | + var point = new BMap.Point(gps.bd_lon, gps.bd_lat) | |
| 514 | + //label | |
| 515 | + ,label = new BMap.Label(gps.nbbm, {position: point, offset: new BMap.Size(-20,8)}); | |
| 516 | + label.setStyle({borderColor: bgColor(gps), padding: '6px 6px 4px 6px', color: tColor(gps), backgroundColor: bgColor(gps)}); | |
| 517 | + var marker = new BMap.Marker(point); | |
| 518 | + marker.setLabel(label); | |
| 519 | + //icon | |
| 520 | + marker.setIcon(new BMap.Icon(tmIcon, new BMap.Size(25,25))); | |
| 521 | +/* //window 绑定到 label | |
| 522 | + marker.infoWindow = new BMap.InfoWindow(bd_gps_info_win_opts); | |
| 523 | + //数据绑定到label | |
| 524 | + marker.gpsData = gpsData; | |
| 525 | + | |
| 526 | + //mouseover | |
| 527 | + label.addEventListener('mouseover', function(){ | |
| 528 | + bdOpenWindow(marker); | |
| 529 | + });*/ | |
| 530 | + return marker; | |
| 531 | + } | |
| 532 | + | |
| 533 | + function bdOpenWindow(marker){ | |
| 534 | + marker.infoWindow.setContent(template('gps_info_win_temp', marker.gpsData)); | |
| 535 | + currentMap.map.openInfoWindow(marker.infoWindow, marker.point); | |
| 536 | + } | |
| 537 | + return real_map; | |
| 538 | 538 | })(); |
| 539 | 539 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/alone_page/home/home_wrap.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html lang="zh-cn"> | |
| 3 | - | |
| 4 | -<head> | |
| 5 | - <meta charset="UTF-8"> | |
| 6 | - <title>主页模拟图</title> | |
| 7 | - <!-- uikit core style--> | |
| 8 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" /> | |
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" merge="plugins"/> | |
| 10 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" merge="plugins"/> | |
| 11 | - <link rel="stylesheet" | |
| 12 | - href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 13 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" merge="plugins"/> | |
| 14 | - | |
| 15 | - <!-- main style --> | |
| 16 | - <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | |
| 17 | - <!-- home style --> | |
| 18 | - <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 19 | - | |
| 20 | - <!-- custom table --> | |
| 21 | - <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 22 | - <!-- jquery contextMenu style --> | |
| 23 | - <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" merge="plugins"/> | |
| 24 | - <!-- formvalidation style --> | |
| 25 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css" merge="plugins"/> | |
| 26 | - <!-- js tree --> | |
| 27 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 28 | - <!-- tooltip css--> | |
| 29 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" merge="plugins"/> | |
| 30 | - <link rel="stylesheet" href="/real_control_v2/css/pace.css" merge="plugins"/> | |
| 31 | - | |
| 32 | - <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 33 | - <!-- perfect-scrollbar style --> | |
| 34 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 35 | - <!-- layer 3.0.3 --> | |
| 36 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 37 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 38 | - | |
| 39 | - | |
| 40 | - <style> | |
| 41 | - .main-container{ | |
| 42 | - height: 100% !important; | |
| 43 | - } | |
| 44 | - | |
| 45 | - #main-tab-content{ | |
| 46 | - padding: 0 !important; | |
| 47 | - list-style: none; | |
| 48 | - } | |
| 49 | - | |
| 50 | - .home-panel{ | |
| 51 | - | |
| 52 | - } | |
| 53 | - | |
| 54 | - #home-main-content{ | |
| 55 | - padding: 0 !important; | |
| 56 | - } | |
| 57 | - | |
| 58 | - #main-tab-content>.home-panel>#home-main-content{ | |
| 59 | - overflow: inherit !important; | |
| 60 | - } | |
| 61 | - </style> | |
| 62 | -</head> | |
| 63 | - | |
| 64 | -<body> | |
| 65 | -<!--<div class="main-container" style="height: 100%;"> | |
| 66 | -</div>--> | |
| 67 | -<div class="main-container"> | |
| 68 | - <ul id="main-tab-content"> | |
| 69 | - <li class="home-panel"></li> | |
| 70 | - </ul> | |
| 71 | -</div> | |
| 72 | - | |
| 73 | - | |
| 74 | -<!-- 地图相关 --> | |
| 75 | -<script src="//api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 76 | -<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 77 | -<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 78 | -<script src="/assets/js/CoordinateConverter.js" merge="plugins"></script> | |
| 79 | -<!-- jquery --> | |
| 80 | -<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 81 | -<!-- jquery actual --> | |
| 82 | -<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 83 | -<!-- jquery.serializejson JSON序列化插件 --> | |
| 84 | -<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | |
| 85 | -<!-- moment.js 日期处理类库 --> | |
| 86 | -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 87 | -<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 88 | - | |
| 89 | -<!-- flatpickr --> | |
| 90 | -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 91 | -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 92 | - | |
| 93 | -<!-- perfect-scrollbar --> | |
| 94 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 95 | -<!-- common js --> | |
| 96 | -<script src="/real_control_v2/js/common.js"></script> | |
| 97 | -<!-- art-template 模版引擎 --> | |
| 98 | -<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 99 | -<!-- d3 --> | |
| 100 | -<script src="/assets/js/d3.min.js"></script> | |
| 101 | -<!-- EventProxy --> | |
| 102 | -<script src="/assets/js/eventproxy.js"></script> | |
| 103 | -<!-- Geolib --> | |
| 104 | -<script src="/real_control_v2/geolib/geolib.js" merge="plugins"></script> | |
| 105 | - | |
| 106 | -<script> | |
| 107 | - | |
| 108 | - | |
| 109 | - var res_load_ep = EventProxy.create('load_home_layout', 'load_home_line_panel', 'load_data_basic', 'data-basic', function () { | |
| 110 | - //加载主页 | |
| 111 | - gb_home_layout.layout(function () { | |
| 112 | - gb_home_line_panel.init(function () { | |
| 113 | - //gps自刷新 | |
| 114 | - gb_data_gps.fixedTimeRefresh(); | |
| 115 | - | |
| 116 | - $('.uk-icon-send-o.home_alone_page').remove(); | |
| 117 | - }); | |
| 118 | - }); | |
| 119 | - }); | |
| 120 | - | |
| 121 | - function connectArr(arr, separator, transFun) { | |
| 122 | - var rs = ''; | |
| 123 | - $.each(arr, function (i, item) { | |
| 124 | - if (transFun) | |
| 125 | - item = transFun(item); | |
| 126 | - rs += (separator + item); | |
| 127 | - }); | |
| 128 | - return rs.substr(separator.length); | |
| 129 | - } | |
| 130 | - | |
| 131 | - var isArray = function (obj) { | |
| 132 | - return Object.prototype.toString.call(obj) === '[object Array]'; | |
| 133 | - }; | |
| 134 | - | |
| 135 | - var gb_form_validation_opts = { | |
| 136 | - framework: 'uikit', | |
| 137 | - locale: 'zh_CN', | |
| 138 | - icon: { | |
| 139 | - valid: 'uk-icon-check', | |
| 140 | - invalid: 'uk-icon-times', | |
| 141 | - validating: 'uk-icon-refresh' | |
| 142 | - } | |
| 143 | - }; | |
| 144 | - | |
| 145 | -</script> | |
| 146 | - | |
| 147 | -<!-- uikit core --> | |
| 148 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 149 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 150 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js" merge="uikit_js"></script> | |
| 151 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 152 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 153 | - | |
| 154 | - | |
| 155 | -<!-- jquery contextMenu --> | |
| 156 | -<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" merge="plugins"></script> | |
| 157 | -<script src="/real_control_v2/assets/js/jquery.ui.position.min.js" merge="plugins"></script> | |
| 158 | -<!-- formvalidation- --> | |
| 159 | -<script src="/real_control_v2/assets/plugins/formvalidation/formValidation.min.js" merge="plugins"></script> | |
| 160 | -<script src="/real_control_v2/assets/plugins/formvalidation/zh_CN.js" merge="plugins"></script> | |
| 161 | -<script src="/real_control_v2/assets/plugins/formvalidation/uikit.min.js" merge="plugins"></script> | |
| 162 | -<!-- js tree --> | |
| 163 | -<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 164 | -<!-- simple pinyin --> | |
| 165 | -<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 166 | -<!-- qtip --> | |
| 167 | -<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" merge="plugins"></script> | |
| 168 | -<!-- layer 3.0.3 --> | |
| 169 | -<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 170 | - | |
| 171 | -<!-- 数据 --> | |
| 172 | -<script src="/real_control_v2/alone_page/home/alone_data_basic.js" merge="custom_js"></script> | |
| 173 | -<script src="/real_control_v2/alone_page/home/alone_data_gps.js" merge="custom_js"></script> | |
| 174 | -<script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> | |
| 175 | -<!-- 线路模拟图 --> | |
| 176 | -<script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> | |
| 177 | -<script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> | |
| 178 | -<script src="/real_control_v2/js/utils/svg_chart_tooltip.js" merge="custom_js"></script> | |
| 179 | -<script src="/real_control_v2/js/utils/svg_chart_map.js" merge="custom_js"></script> | |
| 180 | - | |
| 181 | -<!-- custom table js --> | |
| 182 | -<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 183 | -<!-- home js --> | |
| 184 | -<script src="/real_control_v2/js/home/layout.js" merge="custom_js"></script> | |
| 185 | -<script src="/real_control_v2/js/home/line_panel.js" merge="custom_js"></script> | |
| 186 | -<script src="/real_control_v2/js/home/context_menu.js" merge="custom_js"></script> | |
| 187 | - | |
| 188 | - | |
| 189 | -<!-- 模态框扩展 --> | |
| 190 | -<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 191 | - | |
| 192 | -</body> | |
| 193 | - | |
| 194 | -</html> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html lang="zh-cn"> | |
| 3 | + | |
| 4 | +<head> | |
| 5 | + <meta charset="UTF-8"> | |
| 6 | + <title>主页模拟图</title> | |
| 7 | + <!-- uikit core style--> | |
| 8 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" /> | |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" merge="plugins"/> | |
| 10 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" merge="plugins"/> | |
| 11 | + <link rel="stylesheet" | |
| 12 | + href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 13 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" merge="plugins"/> | |
| 14 | + | |
| 15 | + <!-- main style --> | |
| 16 | + <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | |
| 17 | + <!-- home style --> | |
| 18 | + <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 19 | + | |
| 20 | + <!-- custom table --> | |
| 21 | + <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 22 | + <!-- jquery contextMenu style --> | |
| 23 | + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" merge="plugins"/> | |
| 24 | + <!-- formvalidation style --> | |
| 25 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css" merge="plugins"/> | |
| 26 | + <!-- js tree --> | |
| 27 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 28 | + <!-- tooltip css--> | |
| 29 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" merge="plugins"/> | |
| 30 | + <link rel="stylesheet" href="/real_control_v2/css/pace.css" merge="plugins"/> | |
| 31 | + | |
| 32 | + <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 33 | + <!-- perfect-scrollbar style --> | |
| 34 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 35 | + <!-- layer 3.0.3 --> | |
| 36 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 37 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 38 | + | |
| 39 | + | |
| 40 | + <style> | |
| 41 | + .main-container{ | |
| 42 | + height: 100% !important; | |
| 43 | + } | |
| 44 | + | |
| 45 | + #main-tab-content{ | |
| 46 | + padding: 0 !important; | |
| 47 | + list-style: none; | |
| 48 | + } | |
| 49 | + | |
| 50 | + .home-panel{ | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + #home-main-content{ | |
| 55 | + padding: 0 !important; | |
| 56 | + } | |
| 57 | + | |
| 58 | + #main-tab-content>.home-panel>#home-main-content{ | |
| 59 | + overflow: inherit !important; | |
| 60 | + } | |
| 61 | + </style> | |
| 62 | +</head> | |
| 63 | + | |
| 64 | +<body> | |
| 65 | +<!--<div class="main-container" style="height: 100%;"> | |
| 66 | +</div>--> | |
| 67 | +<div class="main-container"> | |
| 68 | + <ul id="main-tab-content"> | |
| 69 | + <li class="home-panel"></li> | |
| 70 | + </ul> | |
| 71 | +</div> | |
| 72 | + | |
| 73 | + | |
| 74 | +<!-- 地图相关 --> | |
| 75 | +<script src="//api.map.baidu.com/api?v=2.0&ak=1TgEKvYqohJyeGXnN6yHSSTb4psOarQw"></script> | |
| 76 | +<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 77 | +<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 78 | +<script src="/assets/js/CoordinateConverter.js" merge="plugins"></script> | |
| 79 | +<!-- jquery --> | |
| 80 | +<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 81 | +<!-- jquery actual --> | |
| 82 | +<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 83 | +<!-- jquery.serializejson JSON序列化插件 --> | |
| 84 | +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | |
| 85 | +<!-- moment.js 日期处理类库 --> | |
| 86 | +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 87 | +<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 88 | + | |
| 89 | +<!-- flatpickr --> | |
| 90 | +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 91 | +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 92 | + | |
| 93 | +<!-- perfect-scrollbar --> | |
| 94 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 95 | +<!-- common js --> | |
| 96 | +<script src="/real_control_v2/js/common.js"></script> | |
| 97 | +<!-- art-template 模版引擎 --> | |
| 98 | +<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 99 | +<!-- d3 --> | |
| 100 | +<script src="/assets/js/d3.min.js"></script> | |
| 101 | +<!-- EventProxy --> | |
| 102 | +<script src="/assets/js/eventproxy.js"></script> | |
| 103 | +<!-- Geolib --> | |
| 104 | +<script src="/real_control_v2/geolib/geolib.js" merge="plugins"></script> | |
| 105 | + | |
| 106 | +<script> | |
| 107 | + | |
| 108 | + | |
| 109 | + var res_load_ep = EventProxy.create('load_home_layout', 'load_home_line_panel', 'load_data_basic', 'data-basic', function () { | |
| 110 | + //加载主页 | |
| 111 | + gb_home_layout.layout(function () { | |
| 112 | + gb_home_line_panel.init(function () { | |
| 113 | + //gps自刷新 | |
| 114 | + gb_data_gps.fixedTimeRefresh(); | |
| 115 | + | |
| 116 | + $('.uk-icon-send-o.home_alone_page').remove(); | |
| 117 | + }); | |
| 118 | + }); | |
| 119 | + }); | |
| 120 | + | |
| 121 | + function connectArr(arr, separator, transFun) { | |
| 122 | + var rs = ''; | |
| 123 | + $.each(arr, function (i, item) { | |
| 124 | + if (transFun) | |
| 125 | + item = transFun(item); | |
| 126 | + rs += (separator + item); | |
| 127 | + }); | |
| 128 | + return rs.substr(separator.length); | |
| 129 | + } | |
| 130 | + | |
| 131 | + var isArray = function (obj) { | |
| 132 | + return Object.prototype.toString.call(obj) === '[object Array]'; | |
| 133 | + }; | |
| 134 | + | |
| 135 | + var gb_form_validation_opts = { | |
| 136 | + framework: 'uikit', | |
| 137 | + locale: 'zh_CN', | |
| 138 | + icon: { | |
| 139 | + valid: 'uk-icon-check', | |
| 140 | + invalid: 'uk-icon-times', | |
| 141 | + validating: 'uk-icon-refresh' | |
| 142 | + } | |
| 143 | + }; | |
| 144 | + | |
| 145 | +</script> | |
| 146 | + | |
| 147 | +<!-- uikit core --> | |
| 148 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 149 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 150 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js" merge="uikit_js"></script> | |
| 151 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 152 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 153 | + | |
| 154 | + | |
| 155 | +<!-- jquery contextMenu --> | |
| 156 | +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" merge="plugins"></script> | |
| 157 | +<script src="/real_control_v2/assets/js/jquery.ui.position.min.js" merge="plugins"></script> | |
| 158 | +<!-- formvalidation- --> | |
| 159 | +<script src="/real_control_v2/assets/plugins/formvalidation/formValidation.min.js" merge="plugins"></script> | |
| 160 | +<script src="/real_control_v2/assets/plugins/formvalidation/zh_CN.js" merge="plugins"></script> | |
| 161 | +<script src="/real_control_v2/assets/plugins/formvalidation/uikit.min.js" merge="plugins"></script> | |
| 162 | +<!-- js tree --> | |
| 163 | +<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 164 | +<!-- simple pinyin --> | |
| 165 | +<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 166 | +<!-- qtip --> | |
| 167 | +<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" merge="plugins"></script> | |
| 168 | +<!-- layer 3.0.3 --> | |
| 169 | +<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 170 | + | |
| 171 | +<!-- 数据 --> | |
| 172 | +<script src="/real_control_v2/alone_page/home/alone_data_basic.js" merge="custom_js"></script> | |
| 173 | +<script src="/real_control_v2/alone_page/home/alone_data_gps.js" merge="custom_js"></script> | |
| 174 | +<script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> | |
| 175 | +<!-- 线路模拟图 --> | |
| 176 | +<script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> | |
| 177 | +<script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> | |
| 178 | +<script src="/real_control_v2/js/utils/svg_chart_tooltip.js" merge="custom_js"></script> | |
| 179 | +<script src="/real_control_v2/js/utils/svg_chart_map.js" merge="custom_js"></script> | |
| 180 | + | |
| 181 | +<!-- custom table js --> | |
| 182 | +<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 183 | +<!-- home js --> | |
| 184 | +<script src="/real_control_v2/js/home/layout.js" merge="custom_js"></script> | |
| 185 | +<script src="/real_control_v2/js/home/line_panel.js" merge="custom_js"></script> | |
| 186 | +<script src="/real_control_v2/js/home/context_menu.js" merge="custom_js"></script> | |
| 187 | + | |
| 188 | + | |
| 189 | +<!-- 模态框扩展 --> | |
| 190 | +<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 191 | + | |
| 192 | +</body> | |
| 193 | + | |
| 194 | +</html> | ... | ... |
src/main/resources/static/real_control_v2/alone_page/map/alone_wrap.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html lang="zh-cn"> | |
| 3 | - | |
| 4 | -<head> | |
| 5 | - <meta charset="UTF-8"> | |
| 6 | - <title>地图监控 v2.0</title> | |
| 7 | - <!-- uikit core style--> | |
| 8 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css"/> | |
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" | |
| 10 | - merge="plugins"/> | |
| 11 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" | |
| 12 | - merge="plugins"/> | |
| 13 | - <link rel="stylesheet" | |
| 14 | - href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 15 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" | |
| 16 | - merge="plugins"/> | |
| 17 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" | |
| 18 | - merge="plugins"/> | |
| 19 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" | |
| 20 | - merge="plugins"/> | |
| 21 | - | |
| 22 | - <!-- main style --> | |
| 23 | - <link rel="stylesheet" href="/real_control_v2/css/main.css"/> | |
| 24 | - <!-- north style --> | |
| 25 | - <link rel="stylesheet" href="/real_control_v2/css/north.css" merge="custom_style"/> | |
| 26 | - <!-- home style --> | |
| 27 | - <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 28 | - | |
| 29 | - <!-- js tree --> | |
| 30 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 31 | - | |
| 32 | - <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 33 | - <!-- perfect-scrollbar style --> | |
| 34 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" | |
| 35 | - merge="plugins"/> | |
| 36 | - <!-- layer 3.0.3 --> | |
| 37 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 38 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 39 | - | |
| 40 | - <!-- flatpickr --> | |
| 41 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" merge="plugins"/> | |
| 42 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"/> | |
| 43 | - | |
| 44 | - <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 45 | - | |
| 46 | - <style> | |
| 47 | - .main-container .map-panel{ | |
| 48 | - position: absolute; | |
| 49 | - top:0; | |
| 50 | - left: 0; | |
| 51 | - width: 20px; | |
| 52 | - z-index: 999; | |
| 53 | - height: 20px; | |
| 54 | - } | |
| 55 | - </style> | |
| 56 | -</head> | |
| 57 | - | |
| 58 | -<body> | |
| 59 | -<div class="main-container" style="height: 100%;"> | |
| 60 | - <span style="position: absolute;left: calc(50% - 35px);top: calc(45% - 35px);">加载中...</span> | |
| 61 | -</div> | |
| 62 | -<!-- 地图相关 --> | |
| 63 | -<script src="//api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 64 | -<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 65 | -<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 66 | -<script src="/assets/js/CoordinateConverter.js" merge="plugins"></script> | |
| 67 | -<!-- 高德 --> | |
| 68 | -<script src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | |
| 69 | -<!-- jquery --> | |
| 70 | -<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 71 | -<!-- jquery actual --> | |
| 72 | -<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 73 | -<!-- moment.js 日期处理类库 --> | |
| 74 | -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 75 | -<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 76 | - | |
| 77 | -<!-- flatpickr --> | |
| 78 | -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 79 | -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 80 | - | |
| 81 | -<!-- perfect-scrollbar --> | |
| 82 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 83 | -<!-- common js --> | |
| 84 | -<script src="/real_control_v2/js/common.js"></script> | |
| 85 | -<!-- art-template 模版引擎 --> | |
| 86 | -<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 87 | -<!-- d3 --> | |
| 88 | -<script src="/assets/js/d3.min.js"></script> | |
| 89 | -<!-- EventProxy --> | |
| 90 | -<script src="/assets/js/eventproxy.js"></script> | |
| 91 | -<!-- uikit core --> | |
| 92 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 93 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 94 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 95 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js" merge="uikit_js"></script> | |
| 96 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" merge="uikit_js"></script> | |
| 97 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 98 | - | |
| 99 | -<!-- js tree --> | |
| 100 | -<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 101 | -<!-- layer 3.0.3 --> | |
| 102 | -<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 103 | - | |
| 104 | -<!-- 模态框扩展 --> | |
| 105 | -<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 106 | - | |
| 107 | -<script src="/real_control_v2/alone_page/map/alone_data_basic.js" merge="custom_js"></script> | |
| 108 | -<script src="/real_control_v2/alone_page/map/alone_data_gps.js" merge="custom_js"></script> | |
| 109 | -<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 110 | -<!-- jquery.serializejson JSON序列化插件 --> | |
| 111 | -<script src="/assets/plugins/jquery.serializejson.js" merge="uikit_js"></script> | |
| 112 | - | |
| 113 | -<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 114 | -</body> | |
| 115 | -<script> | |
| 116 | - gb_data_gps.fixedTimeRefresh(); | |
| 117 | - var res_load_ep = EventProxy.create('data-basic', function () { | |
| 118 | - | |
| 119 | - //嵌入地图页面 | |
| 120 | - $('.main-container').load('/real_control_v2/mapmonitor/real.html', function () { | |
| 121 | - $('.map-system-msg.flex-left').remove(); | |
| 122 | - | |
| 123 | - $(this).append('<span class="map-panel"></span>');//判断里有JS判定这个容器是否显示 | |
| 124 | - }); | |
| 125 | - }); | |
| 126 | - | |
| 127 | - var isArray = function (obj) { | |
| 128 | - return Object.prototype.toString.call(obj) === '[object Array]'; | |
| 129 | - }; | |
| 130 | -</script> | |
| 131 | -</html> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html lang="zh-cn"> | |
| 3 | + | |
| 4 | +<head> | |
| 5 | + <meta charset="UTF-8"> | |
| 6 | + <title>地图监控 v2.0</title> | |
| 7 | + <!-- uikit core style--> | |
| 8 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css"/> | |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" | |
| 10 | + merge="plugins"/> | |
| 11 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" | |
| 12 | + merge="plugins"/> | |
| 13 | + <link rel="stylesheet" | |
| 14 | + href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 15 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" | |
| 16 | + merge="plugins"/> | |
| 17 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" | |
| 18 | + merge="plugins"/> | |
| 19 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" | |
| 20 | + merge="plugins"/> | |
| 21 | + | |
| 22 | + <!-- main style --> | |
| 23 | + <link rel="stylesheet" href="/real_control_v2/css/main.css"/> | |
| 24 | + <!-- north style --> | |
| 25 | + <link rel="stylesheet" href="/real_control_v2/css/north.css" merge="custom_style"/> | |
| 26 | + <!-- home style --> | |
| 27 | + <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 28 | + | |
| 29 | + <!-- js tree --> | |
| 30 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 31 | + | |
| 32 | + <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 33 | + <!-- perfect-scrollbar style --> | |
| 34 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" | |
| 35 | + merge="plugins"/> | |
| 36 | + <!-- layer 3.0.3 --> | |
| 37 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 38 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 39 | + | |
| 40 | + <!-- flatpickr --> | |
| 41 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" merge="plugins"/> | |
| 42 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"/> | |
| 43 | + | |
| 44 | + <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 45 | + | |
| 46 | + <style> | |
| 47 | + .main-container .map-panel{ | |
| 48 | + position: absolute; | |
| 49 | + top:0; | |
| 50 | + left: 0; | |
| 51 | + width: 20px; | |
| 52 | + z-index: 999; | |
| 53 | + height: 20px; | |
| 54 | + } | |
| 55 | + </style> | |
| 56 | +</head> | |
| 57 | + | |
| 58 | +<body> | |
| 59 | +<div class="main-container" style="height: 100%;"> | |
| 60 | + <span style="position: absolute;left: calc(50% - 35px);top: calc(45% - 35px);">加载中...</span> | |
| 61 | +</div> | |
| 62 | +<!-- 地图相关 --> | |
| 63 | +<script src="//api.map.baidu.com/api?v=2.0&ak=1TgEKvYqohJyeGXnN6yHSSTb4psOarQw"></script> | |
| 64 | +<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 65 | +<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 66 | +<script src="/assets/js/CoordinateConverter.js" merge="plugins"></script> | |
| 67 | +<!-- 高德 --> | |
| 68 | +<script src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | |
| 69 | +<!-- jquery --> | |
| 70 | +<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 71 | +<!-- jquery actual --> | |
| 72 | +<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 73 | +<!-- moment.js 日期处理类库 --> | |
| 74 | +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 75 | +<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 76 | + | |
| 77 | +<!-- flatpickr --> | |
| 78 | +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 79 | +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 80 | + | |
| 81 | +<!-- perfect-scrollbar --> | |
| 82 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 83 | +<!-- common js --> | |
| 84 | +<script src="/real_control_v2/js/common.js"></script> | |
| 85 | +<!-- art-template 模版引擎 --> | |
| 86 | +<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 87 | +<!-- d3 --> | |
| 88 | +<script src="/assets/js/d3.min.js"></script> | |
| 89 | +<!-- EventProxy --> | |
| 90 | +<script src="/assets/js/eventproxy.js"></script> | |
| 91 | +<!-- uikit core --> | |
| 92 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 93 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 94 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 95 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js" merge="uikit_js"></script> | |
| 96 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" merge="uikit_js"></script> | |
| 97 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 98 | + | |
| 99 | +<!-- js tree --> | |
| 100 | +<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 101 | +<!-- layer 3.0.3 --> | |
| 102 | +<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 103 | + | |
| 104 | +<!-- 模态框扩展 --> | |
| 105 | +<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 106 | + | |
| 107 | +<script src="/real_control_v2/alone_page/map/alone_data_basic.js" merge="custom_js"></script> | |
| 108 | +<script src="/real_control_v2/alone_page/map/alone_data_gps.js" merge="custom_js"></script> | |
| 109 | +<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 110 | +<!-- jquery.serializejson JSON序列化插件 --> | |
| 111 | +<script src="/assets/plugins/jquery.serializejson.js" merge="uikit_js"></script> | |
| 112 | + | |
| 113 | +<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 114 | +</body> | |
| 115 | +<script> | |
| 116 | + gb_data_gps.fixedTimeRefresh(); | |
| 117 | + var res_load_ep = EventProxy.create('data-basic', function () { | |
| 118 | + | |
| 119 | + //嵌入地图页面 | |
| 120 | + $('.main-container').load('/real_control_v2/mapmonitor/real.html', function () { | |
| 121 | + $('.map-system-msg.flex-left').remove(); | |
| 122 | + | |
| 123 | + $(this).append('<span class="map-panel"></span>');//判断里有JS判定这个容器是否显示 | |
| 124 | + }); | |
| 125 | + }); | |
| 126 | + | |
| 127 | + var isArray = function (obj) { | |
| 128 | + return Object.prototype.toString.call(obj) === '[object Array]'; | |
| 129 | + }; | |
| 130 | +</script> | |
| 131 | +</html> | ... | ... |
src/main/resources/static/real_control_v2/main.html
| 1 | -<!DOCTYPE html> | |
| 2 | -<html lang="zh-cn"> | |
| 3 | - | |
| 4 | -<head> | |
| 5 | - <meta charset="UTF-8"> | |
| 6 | - <title>线路调度 v2.0</title> | |
| 7 | - <!-- uikit core style--> | |
| 8 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" /> | |
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" merge="plugins"/> | |
| 10 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" merge="plugins"/> | |
| 11 | - <link rel="stylesheet" | |
| 12 | - href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 13 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" merge="plugins"/> | |
| 14 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" merge="plugins"/> | |
| 15 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" merge="plugins"/> | |
| 16 | - | |
| 17 | - <!-- main style --> | |
| 18 | - <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | |
| 19 | - <!-- north style --> | |
| 20 | - <link rel="stylesheet" href="/real_control_v2/css/north.css" merge="custom_style"/> | |
| 21 | - <!-- home style --> | |
| 22 | - <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 23 | - <!-- line style --> | |
| 24 | - <link rel="stylesheet" href="/real_control_v2/css/line_schedule.css" merge="custom_style"/> | |
| 25 | - <link rel="stylesheet" href="/real_control_v2/css/line_schedule_table.css" merge="custom_style"/> | |
| 26 | - | |
| 27 | - <link rel="stylesheet" href="/real_control_v2/css/sch_autocomp_result.css" merge="custom_style"/> | |
| 28 | - <!-- custom table --> | |
| 29 | - <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 30 | - <!-- jquery contextMenu style --> | |
| 31 | - <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" merge="plugins"/> | |
| 32 | - <!-- formvalidation style --> | |
| 33 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css" merge="plugins"/> | |
| 34 | - <!-- js tree --> | |
| 35 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 36 | - <!-- tooltip css--> | |
| 37 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" merge="plugins"/> | |
| 38 | - <link rel="stylesheet" href="/real_control_v2/css/pace.css" merge="plugins"/> | |
| 39 | - | |
| 40 | - <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 41 | - <!-- perfect-scrollbar style --> | |
| 42 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 43 | - <!-- layer 3.0.3 --> | |
| 44 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 45 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 46 | - | |
| 47 | - <!-- flatpickr --> | |
| 48 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" merge="plugins"> | |
| 49 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"> | |
| 50 | -</head> | |
| 51 | - | |
| 52 | -<body> | |
| 53 | -<div class="north uk-width-1-1 uk-panel-box"> | |
| 54 | - <div class="uk-grid uk-grid-match"> | |
| 55 | - <div class="uk-width-4-10"> | |
| 56 | - <div class="uk-panel"> | |
| 57 | - <h2 class="north-logo"> | |
| 58 | - <!--<i class="uk-icon-life-ring"></i>--> 浦东公交线路调度 | |
| 59 | - </h2> | |
| 60 | - </div> | |
| 61 | - </div> | |
| 62 | - <div class="uk-width-6-10"> | |
| 63 | - <div class="uk-panel uk-width north-toolbar"></div> | |
| 64 | - </div> | |
| 65 | - </div> | |
| 66 | - <div class="north-tabs"></div> | |
| 67 | -</div> | |
| 68 | - | |
| 69 | -<div class="main-container"> | |
| 70 | - <div class="load-panel"> | |
| 71 | - <i class="uk-icon-spinner uk-icon-spin"></i> | |
| 72 | - 正在加载数据 | |
| 73 | - </div> | |
| 74 | -</div> | |
| 75 | - | |
| 76 | -<script> | |
| 77 | -/* var gb_beforeunload_fun = function (e) { | |
| 78 | - var confirmationMessage = "\o/"; | |
| 79 | - (e || window.event).returnValue = confirmationMessage; | |
| 80 | - return confirmationMessage; | |
| 81 | - } | |
| 82 | - window.addEventListener("beforeunload", gb_beforeunload_fun);*/ | |
| 83 | - | |
| 84 | - delete window.exports; | |
| 85 | - delete window.module; | |
| 86 | - | |
| 87 | - var ipcMain; | |
| 88 | - //是否处于electron环境下 | |
| 89 | - var isElectron = (function () { | |
| 90 | - try { | |
| 91 | - if (process.versions.electron) | |
| 92 | - return true; | |
| 93 | - else | |
| 94 | - return false; | |
| 95 | - } | |
| 96 | - catch (e) { | |
| 97 | - return false; | |
| 98 | - } | |
| 99 | - })(); | |
| 100 | - | |
| 101 | - if (isElectron) { | |
| 102 | - var link = document.createElement("link"); | |
| 103 | - link.type = "text/css"; | |
| 104 | - link.rel = "stylesheet"; | |
| 105 | - link.href = "/real_control_v2/css/electron.css"; | |
| 106 | - document.getElementsByTagName("head")[0].appendChild(link); | |
| 107 | - | |
| 108 | - ipcMain = require('electron').ipcRenderer; | |
| 109 | - } | |
| 110 | -</script> | |
| 111 | - | |
| 112 | -<!-- 地图相关 --> | |
| 113 | -<script src="//api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | |
| 114 | -<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 115 | -<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 116 | -<script src="/assets/js/CoordinateConverter.js" merge="plugins"></script> | |
| 117 | -<!-- 高德 --> | |
| 118 | -<script src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | |
| 119 | -<!-- jquery --> | |
| 120 | -<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 121 | -<!-- jquery actual --> | |
| 122 | -<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 123 | -<!-- jquery.serializejson JSON序列化插件 --> | |
| 124 | -<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | |
| 125 | -<!-- moment.js 日期处理类库 --> | |
| 126 | -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 127 | -<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 128 | -<!-- jquery.pageinator 分页 --> | |
| 129 | -<script src="/assets/plugins/jqPaginator.min.js"></script> | |
| 130 | - | |
| 131 | -<!-- flatpickr --> | |
| 132 | -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 133 | -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 134 | - | |
| 135 | -<!-- perfect-scrollbar --> | |
| 136 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 137 | -<!-- common js --> | |
| 138 | -<script src="/real_control_v2/js/common.js"></script> | |
| 139 | -<!-- art-template 模版引擎 --> | |
| 140 | -<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 141 | -<!-- d3 --> | |
| 142 | -<script src="/assets/js/d3.min.js"></script> | |
| 143 | -<!-- EventProxy --> | |
| 144 | -<script src="/assets/js/eventproxy.js"></script> | |
| 145 | -<!-- main js --> | |
| 146 | -<script src="/real_control_v2/js/main.js"></script> | |
| 147 | -<!-- uikit core --> | |
| 148 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 149 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 150 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js" merge="uikit_js"></script> | |
| 151 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 152 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js" merge="uikit_js"></script> | |
| 153 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" merge="uikit_js"></script> | |
| 154 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js" merge="uikit_js"></script> | |
| 155 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js" merge="uikit_js"></script> | |
| 156 | -<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 157 | - | |
| 158 | - | |
| 159 | -<!-- jquery contextMenu --> | |
| 160 | -<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" merge="plugins"></script> | |
| 161 | -<script src="/real_control_v2/assets/js/jquery.ui.position.min.js" merge="plugins"></script> | |
| 162 | -<!-- formvalidation- --> | |
| 163 | -<script src="/real_control_v2/assets/plugins/formvalidation/formValidation.min.js" merge="plugins"></script> | |
| 164 | -<script src="/real_control_v2/assets/plugins/formvalidation/zh_CN.js" merge="plugins"></script> | |
| 165 | -<script src="/real_control_v2/assets/plugins/formvalidation/uikit.min.js" merge="plugins"></script> | |
| 166 | -<!-- js tree --> | |
| 167 | -<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 168 | -<!-- simple pinyin --> | |
| 169 | -<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 170 | -<!-- qtip --> | |
| 171 | -<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" merge="plugins"></script> | |
| 172 | -<!-- layer 3.0.3 --> | |
| 173 | -<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 174 | - | |
| 175 | -<!-- 数据 --> | |
| 176 | -<script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script> | |
| 177 | -<script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script> | |
| 178 | -<script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> | |
| 179 | -<script src="/real_control_v2/js/data/data_line_config.js" merge="custom_js"></script> | |
| 180 | -<!-- 线路模拟图 --> | |
| 181 | -<script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> | |
| 182 | -<script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> | |
| 183 | -<script src="/real_control_v2/js/utils/svg_chart_tooltip.js" merge="custom_js"></script> | |
| 184 | -<script src="/real_control_v2/js/utils/svg_chart_map.js" merge="custom_js"></script> | |
| 185 | - | |
| 186 | -<!-- custom table js --> | |
| 187 | -<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 188 | -<!-- north js --> | |
| 189 | -<script src="/real_control_v2/js/north/toolbar.js" merge="custom_js"></script> | |
| 190 | -<script src="/real_control_v2/js/north/tabs.js" merge="custom_js"></script> | |
| 191 | -<script src="/real_control_v2/js/north/second_timer.js" merge="custom_js"></script> | |
| 192 | -<!-- home js --> | |
| 193 | -<script src="/real_control_v2/js/home/layout.js" merge="custom_js"></script> | |
| 194 | -<script src="/real_control_v2/js/home/line_panel.js" merge="custom_js"></script> | |
| 195 | -<script src="/real_control_v2/js/home/context_menu.js" merge="custom_js"></script> | |
| 196 | -<!-- line schedule js --> | |
| 197 | -<script src="/real_control_v2/js/line_schedule/legend.js" merge="custom_js"></script> | |
| 198 | -<script src="/real_control_v2/js/line_schedule/layout.js" merge="custom_js"></script> | |
| 199 | -<script src="/real_control_v2/js/line_schedule/sch_table.js" merge="custom_js"></script> | |
| 200 | -<script src="/real_control_v2/js/line_schedule/context_menu.js" merge="custom_js"></script> | |
| 201 | -<script src="/real_control_v2/js/line_schedule/dbclick.js" merge="custom_js"></script> | |
| 202 | -<script src="/real_control_v2/js/line_schedule/search.js" merge="custom_js"></script> | |
| 203 | -<script src="/real_control_v2/js/line_schedule/badge_tooltip.js" merge="custom_js"></script> | |
| 204 | -<script src="/real_control_v2/js/line_schedule/mileage_count.js" merge="custom_js"></script> | |
| 205 | - | |
| 206 | -<!-- 字典相关 --> | |
| 207 | -<script src="/assets/js/dictionary.js" merge="custom_js"></script> | |
| 208 | -<!-- websocket --> | |
| 209 | -<script src="/real_control_v2/assets/plugins/sockjs-client/sockjs.min.js"></script> | |
| 210 | -<script src="/real_control_v2/js/websocket/sch_websocket.js" merge="custom_js"></script> | |
| 211 | -<!-- tts --> | |
| 212 | -<script src="/real_control_v2/js/utils/tts.js" merge="custom_js"></script> | |
| 213 | - | |
| 214 | -<!-- echart --> | |
| 215 | -<script src="/real_control_v2/assets/echarts-3/echarts.js" merge="plugins"></script> | |
| 216 | -<!-- Geolib --> | |
| 217 | -<script src="/real_control_v2/geolib/geolib.js" merge="plugins"></script> | |
| 218 | - | |
| 219 | -<script src="/real_control_v2/js/signal_state/signal_state.js" merge="custom_js"></script> | |
| 220 | -<script src="/real_control_v2/js/utils/dispatch_pattern.js" merge="custom_js"></script> | |
| 221 | - | |
| 222 | -<!-- 处理表单片段嵌入问题 --> | |
| 223 | -<script src="/real_control_v2/js/forms/form_embed.js" merge="custom_js"></script> | |
| 224 | -<!-- 模态框扩展 --> | |
| 225 | -<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 226 | - | |
| 227 | -<!-- #### 安全驾驶 start ### --> | |
| 228 | -<div class="multi_plat_msg_pop_wrap" ></div> | |
| 229 | -<script id="sd_plat_msg_template" type="text/html"> | |
| 230 | - <div class="multi_plat_msg_pop uk-animation-slide-bottom" data-type="{{type}}" data-nbbm="{{clzbh}}" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}" data-ts="{{ts}}"> | |
| 231 | - <div> | |
| 232 | - <span class="title">异常 {{clzbh}}</span> | |
| 233 | - <br/> | |
| 234 | - <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> | |
| 235 | - <span class="desc">--安全驾驶监管平台</span> | |
| 236 | - </div> | |
| 237 | - </div> | |
| 238 | -</script> | |
| 239 | -<script id="cp_plat_msg_template" type="text/html"> | |
| 240 | - <div class="multi_plat_msg_pop uk-animation-slide-bottom" data-type="{{type}}" data-id="{{id}}" data-title="{{responseState}}" data-ts="{{ts}}"> | |
| 241 | - <div> | |
| 242 | - <span class="title">应急预案</span> | |
| 243 | - <br/> | |
| 244 | - <span class="text"> {{instructionsContent}}</span> | |
| 245 | - <span class="desc">--应急预案平台</span> | |
| 246 | - </div> | |
| 247 | - </div> | |
| 248 | -</script> | |
| 249 | -<script id="mt_plat_msg_template" type="text/html"> | |
| 250 | - <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #0aae0a;" data-type="{{type}}" data-confirm="维修保养计划" data-line="{{line}}" data-zbh="{{zbh}}" data-bydj="{{bydj}}" data-bysj="{{dateTimeStr}}" data-bydd="{{bydd}}"> | |
| 251 | - <div> | |
| 252 | - <span class="title">维修保养计划</span> | |
| 253 | - <br/> | |
| 254 | - <span class="text"> {{zbh}} {{timeStr}} 进场保养</span> | |
| 255 | - <span class="desc">--浦东公交维修库</span> | |
| 256 | - </div> | |
| 257 | - </div> | |
| 258 | -</script> | |
| 259 | -<script id="ces_plat_msg_template" type="text/html"> | |
| 260 | - <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #00ccff;" data-type="{{type}}" data-zbh="{{nbbm}}" data-start="{{startTimestamp}}" data-end="{{endTimestamp}}"> | |
| 261 | - <div> | |
| 262 | - <span class="title">车辆异常停车</span> | |
| 263 | - <br/> | |
| 264 | - <span class="text"> {{line}} {{nbbm}} 在 {{address}} 异常停车</span> | |
| 265 | - <span class="desc">--企业信息化运行监控中心</span> | |
| 266 | - </div> | |
| 267 | - </div> | |
| 268 | -</script> | |
| 269 | -<script id="inoutpark_plat_msg_template" type="text/html"> | |
| 270 | - <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #FF7F24;" data-type="{{type}}" data-zbh="{{nbbm}}"> | |
| 271 | - <div> | |
| 272 | - <span class="title">{{errType}}私自绕改道</span> | |
| 273 | - <br/> | |
| 274 | - <span class="text"> {{line}} {{nbbm}} 在 {{findTime}} {{errType}}私自绕改道,<br/>请到运管中心处理</span> | |
| 275 | - <span class="desc" style="color: #ffffff">--浦东公交运管中心管理系统</span> | |
| 276 | - </div> | |
| 277 | - </div> | |
| 278 | -</script> | |
| 279 | - | |
| 280 | -<script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> | |
| 281 | -<script src="/real_control_v2/js/con_plan/conPlan.js" merge="custom_js"></script> | |
| 282 | -<script src="/real_control_v2/js/mt_plan/mtPlan.js" merge="custom_js"></script> | |
| 283 | -<script src="/real_control_v2/js/platform/carErrorStop.js" merge="custom_js"></script> | |
| 284 | -<script src="/real_control_v2/js/platform/inoutPark.js" merge="custom_js"></script> | |
| 285 | -<!-- #### 安全驾驶 end ### --> | |
| 286 | - | |
| 287 | -<!-- 打电话 --> | |
| 288 | -<script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> | |
| 289 | - | |
| 290 | -<script id="voip_call_info_panel-temp" type="text/html"> | |
| 291 | - <div class="voip_call_info_panel" style="{{style}}"> | |
| 292 | - <p class="_title">VOIP</p> | |
| 293 | - <form class="uk-form uk-form-horizontal"> | |
| 294 | - | |
| 295 | - <div class="uk-form-row"> | |
| 296 | - <label class="uk-form-label" >工号:</label> | |
| 297 | - <div class="uk-form-controls"> | |
| 298 | - <input type="text" name="agentID" value="1002" disabled> | |
| 299 | - </div> | |
| 300 | - </div> | |
| 301 | - <div class="uk-form-row"> | |
| 302 | - <label class="uk-form-label">分机号:</label> | |
| 303 | - <div class="uk-form-controls"> | |
| 304 | - <input type="text" name="dn" value="" > | |
| 305 | - </div> | |
| 306 | - </div> | |
| 307 | - <div class="uk-form-row"> | |
| 308 | - <label class="uk-form-label" >自编号:</label> | |
| 309 | - <div class="uk-form-controls"> | |
| 310 | - <input type="text" value="{{nbbm}}" disabled> | |
| 311 | - </div> | |
| 312 | - </div> | |
| 313 | - <div class="uk-form-row"> | |
| 314 | - <label class="uk-form-label" >SIM号:</label> | |
| 315 | - <div class="uk-form-controls"> | |
| 316 | - <input type="text" name="simNo" disabled> | |
| 317 | - </div> | |
| 318 | - </div> | |
| 319 | - <hr> | |
| 320 | - <h4 class="state_txt"> | |
| 321 | - <button class="uk-button uk-button-large" type="button" disabled>获取SIM卡号...</button> | |
| 322 | - </h4> | |
| 323 | - </form> | |
| 324 | - </div> | |
| 325 | -</script> | |
| 326 | -</body> | |
| 327 | - | |
| 328 | -</html> | |
| 1 | +<!DOCTYPE html> | |
| 2 | +<html lang="zh-cn"> | |
| 3 | + | |
| 4 | +<head> | |
| 5 | + <meta charset="UTF-8"> | |
| 6 | + <title>线路调度 v2.0</title> | |
| 7 | + <!-- uikit core style--> | |
| 8 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" /> | |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" merge="plugins"/> | |
| 10 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" merge="plugins"/> | |
| 11 | + <link rel="stylesheet" | |
| 12 | + href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" merge="plugins"/> | |
| 13 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" merge="plugins"/> | |
| 14 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" merge="plugins"/> | |
| 15 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" merge="plugins"/> | |
| 16 | + | |
| 17 | + <!-- main style --> | |
| 18 | + <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | |
| 19 | + <!-- north style --> | |
| 20 | + <link rel="stylesheet" href="/real_control_v2/css/north.css" merge="custom_style"/> | |
| 21 | + <!-- home style --> | |
| 22 | + <link rel="stylesheet" href="/real_control_v2/css/home.css" merge="custom_style"/> | |
| 23 | + <!-- line style --> | |
| 24 | + <link rel="stylesheet" href="/real_control_v2/css/line_schedule.css" merge="custom_style"/> | |
| 25 | + <link rel="stylesheet" href="/real_control_v2/css/line_schedule_table.css" merge="custom_style"/> | |
| 26 | + | |
| 27 | + <link rel="stylesheet" href="/real_control_v2/css/sch_autocomp_result.css" merge="custom_style"/> | |
| 28 | + <!-- custom table --> | |
| 29 | + <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" merge="custom_style"/> | |
| 30 | + <!-- jquery contextMenu style --> | |
| 31 | + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" merge="plugins"/> | |
| 32 | + <!-- formvalidation style --> | |
| 33 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css" merge="plugins"/> | |
| 34 | + <!-- js tree --> | |
| 35 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" merge="plugins"/> | |
| 36 | + <!-- tooltip css--> | |
| 37 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" merge="plugins"/> | |
| 38 | + <link rel="stylesheet" href="/real_control_v2/css/pace.css" merge="plugins"/> | |
| 39 | + | |
| 40 | + <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" merge="custom_style"/> | |
| 41 | + <!-- perfect-scrollbar style --> | |
| 42 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | |
| 43 | + <!-- layer 3.0.3 --> | |
| 44 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" merge="plugins"/> | |
| 45 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" merge="plugins"/> | |
| 46 | + | |
| 47 | + <!-- flatpickr --> | |
| 48 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" merge="plugins"> | |
| 49 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" merge="plugins"> | |
| 50 | +</head> | |
| 51 | + | |
| 52 | +<body> | |
| 53 | +<div class="north uk-width-1-1 uk-panel-box"> | |
| 54 | + <div class="uk-grid uk-grid-match"> | |
| 55 | + <div class="uk-width-4-10"> | |
| 56 | + <div class="uk-panel"> | |
| 57 | + <h2 class="north-logo"> | |
| 58 | + <!--<i class="uk-icon-life-ring"></i>--> 浦东公交线路调度 | |
| 59 | + </h2> | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | + <div class="uk-width-6-10"> | |
| 63 | + <div class="uk-panel uk-width north-toolbar"></div> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | + <div class="north-tabs"></div> | |
| 67 | +</div> | |
| 68 | + | |
| 69 | +<div class="main-container"> | |
| 70 | + <div class="load-panel"> | |
| 71 | + <i class="uk-icon-spinner uk-icon-spin"></i> | |
| 72 | + 正在加载数据 | |
| 73 | + </div> | |
| 74 | +</div> | |
| 75 | + | |
| 76 | +<script> | |
| 77 | +/* var gb_beforeunload_fun = function (e) { | |
| 78 | + var confirmationMessage = "\o/"; | |
| 79 | + (e || window.event).returnValue = confirmationMessage; | |
| 80 | + return confirmationMessage; | |
| 81 | + } | |
| 82 | + window.addEventListener("beforeunload", gb_beforeunload_fun);*/ | |
| 83 | + | |
| 84 | + delete window.exports; | |
| 85 | + delete window.module; | |
| 86 | + | |
| 87 | + var ipcMain; | |
| 88 | + //是否处于electron环境下 | |
| 89 | + var isElectron = (function () { | |
| 90 | + try { | |
| 91 | + if (process.versions.electron) | |
| 92 | + return true; | |
| 93 | + else | |
| 94 | + return false; | |
| 95 | + } | |
| 96 | + catch (e) { | |
| 97 | + return false; | |
| 98 | + } | |
| 99 | + })(); | |
| 100 | + | |
| 101 | + if (isElectron) { | |
| 102 | + var link = document.createElement("link"); | |
| 103 | + link.type = "text/css"; | |
| 104 | + link.rel = "stylesheet"; | |
| 105 | + link.href = "/real_control_v2/css/electron.css"; | |
| 106 | + document.getElementsByTagName("head")[0].appendChild(link); | |
| 107 | + | |
| 108 | + ipcMain = require('electron').ipcRenderer; | |
| 109 | + } | |
| 110 | +</script> | |
| 111 | + | |
| 112 | +<!-- 地图相关 --> | |
| 113 | +<script src="//api.map.baidu.com/api?v=2.0&ak=1TgEKvYqohJyeGXnN6yHSSTb4psOarQw"></script> | |
| 114 | +<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | |
| 115 | +<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | |
| 116 | +<script src="/assets/js/CoordinateConverter.js" merge="plugins"></script> | |
| 117 | +<!-- 高德 --> | |
| 118 | +<script src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | |
| 119 | +<!-- jquery --> | |
| 120 | +<script src="/real_control_v2/assets/js/jquery.min.js"></script> | |
| 121 | +<!-- jquery actual --> | |
| 122 | +<script src="/real_control_v2/assets/js/jquery.actual.min.js" merge="plugins"></script> | |
| 123 | +<!-- jquery.serializejson JSON序列化插件 --> | |
| 124 | +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | |
| 125 | +<!-- moment.js 日期处理类库 --> | |
| 126 | +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | |
| 127 | +<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script> | |
| 128 | +<!-- jquery.pageinator 分页 --> | |
| 129 | +<script src="/assets/plugins/jqPaginator.min.js"></script> | |
| 130 | + | |
| 131 | +<!-- flatpickr --> | |
| 132 | +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" merge="plugins"></script> | |
| 133 | +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" merge="plugins"></script> | |
| 134 | + | |
| 135 | +<!-- perfect-scrollbar --> | |
| 136 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 137 | +<!-- common js --> | |
| 138 | +<script src="/real_control_v2/js/common.js"></script> | |
| 139 | +<!-- art-template 模版引擎 --> | |
| 140 | +<script src="/assets/plugins/template.js" merge="plugins"></script> | |
| 141 | +<!-- d3 --> | |
| 142 | +<script src="/assets/js/d3.min.js"></script> | |
| 143 | +<!-- EventProxy --> | |
| 144 | +<script src="/assets/js/eventproxy.js"></script> | |
| 145 | +<!-- main js --> | |
| 146 | +<script src="/real_control_v2/js/main.js"></script> | |
| 147 | +<!-- uikit core --> | |
| 148 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" merge="uikit_js"></script> | |
| 149 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" merge="uikit_js"></script> | |
| 150 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js" merge="uikit_js"></script> | |
| 151 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js" merge="uikit_js"></script> | |
| 152 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js" merge="uikit_js"></script> | |
| 153 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" merge="uikit_js"></script> | |
| 154 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js" merge="uikit_js"></script> | |
| 155 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js" merge="uikit_js"></script> | |
| 156 | +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" merge="uikit_js"></script> | |
| 157 | + | |
| 158 | + | |
| 159 | +<!-- jquery contextMenu --> | |
| 160 | +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" merge="plugins"></script> | |
| 161 | +<script src="/real_control_v2/assets/js/jquery.ui.position.min.js" merge="plugins"></script> | |
| 162 | +<!-- formvalidation- --> | |
| 163 | +<script src="/real_control_v2/assets/plugins/formvalidation/formValidation.min.js" merge="plugins"></script> | |
| 164 | +<script src="/real_control_v2/assets/plugins/formvalidation/zh_CN.js" merge="plugins"></script> | |
| 165 | +<script src="/real_control_v2/assets/plugins/formvalidation/uikit.min.js" merge="plugins"></script> | |
| 166 | +<!-- js tree --> | |
| 167 | +<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" merge="plugins"></script> | |
| 168 | +<!-- simple pinyin --> | |
| 169 | +<script src="/assets/plugins/pinyin.js" merge="plugins"></script> | |
| 170 | +<!-- qtip --> | |
| 171 | +<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" merge="plugins"></script> | |
| 172 | +<!-- layer 3.0.3 --> | |
| 173 | +<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js" merge="plugins"></script> | |
| 174 | + | |
| 175 | +<!-- 数据 --> | |
| 176 | +<script src="/real_control_v2/js/data/data_basic.js" merge="custom_js"></script> | |
| 177 | +<script src="/real_control_v2/js/data/data_gps.js" merge="custom_js"></script> | |
| 178 | +<script src="/real_control_v2/js/data/gps_abnormal.js" merge="custom_js"></script> | |
| 179 | +<script src="/real_control_v2/js/data/data_line_config.js" merge="custom_js"></script> | |
| 180 | +<!-- 线路模拟图 --> | |
| 181 | +<script src="/real_control_v2/js/utils/svg_chart.js" merge="custom_js"></script> | |
| 182 | +<script src="/real_control_v2/js/utils/svg_data_convert.js" merge="custom_js"></script> | |
| 183 | +<script src="/real_control_v2/js/utils/svg_chart_tooltip.js" merge="custom_js"></script> | |
| 184 | +<script src="/real_control_v2/js/utils/svg_chart_map.js" merge="custom_js"></script> | |
| 185 | + | |
| 186 | +<!-- custom table js --> | |
| 187 | +<script src="/real_control_v2/js/utils/ct_table.js" merge="custom_js"></script> | |
| 188 | +<!-- north js --> | |
| 189 | +<script src="/real_control_v2/js/north/toolbar.js" merge="custom_js"></script> | |
| 190 | +<script src="/real_control_v2/js/north/tabs.js" merge="custom_js"></script> | |
| 191 | +<script src="/real_control_v2/js/north/second_timer.js" merge="custom_js"></script> | |
| 192 | +<!-- home js --> | |
| 193 | +<script src="/real_control_v2/js/home/layout.js" merge="custom_js"></script> | |
| 194 | +<script src="/real_control_v2/js/home/line_panel.js" merge="custom_js"></script> | |
| 195 | +<script src="/real_control_v2/js/home/context_menu.js" merge="custom_js"></script> | |
| 196 | +<!-- line schedule js --> | |
| 197 | +<script src="/real_control_v2/js/line_schedule/legend.js" merge="custom_js"></script> | |
| 198 | +<script src="/real_control_v2/js/line_schedule/layout.js" merge="custom_js"></script> | |
| 199 | +<script src="/real_control_v2/js/line_schedule/sch_table.js" merge="custom_js"></script> | |
| 200 | +<script src="/real_control_v2/js/line_schedule/context_menu.js" merge="custom_js"></script> | |
| 201 | +<script src="/real_control_v2/js/line_schedule/dbclick.js" merge="custom_js"></script> | |
| 202 | +<script src="/real_control_v2/js/line_schedule/search.js" merge="custom_js"></script> | |
| 203 | +<script src="/real_control_v2/js/line_schedule/badge_tooltip.js" merge="custom_js"></script> | |
| 204 | +<script src="/real_control_v2/js/line_schedule/mileage_count.js" merge="custom_js"></script> | |
| 205 | + | |
| 206 | +<!-- 字典相关 --> | |
| 207 | +<script src="/assets/js/dictionary.js" merge="custom_js"></script> | |
| 208 | +<!-- websocket --> | |
| 209 | +<script src="/real_control_v2/assets/plugins/sockjs-client/sockjs.min.js"></script> | |
| 210 | +<script src="/real_control_v2/js/websocket/sch_websocket.js" merge="custom_js"></script> | |
| 211 | +<!-- tts --> | |
| 212 | +<script src="/real_control_v2/js/utils/tts.js" merge="custom_js"></script> | |
| 213 | + | |
| 214 | +<!-- echart --> | |
| 215 | +<script src="/real_control_v2/assets/echarts-3/echarts.js" merge="plugins"></script> | |
| 216 | +<!-- Geolib --> | |
| 217 | +<script src="/real_control_v2/geolib/geolib.js" merge="plugins"></script> | |
| 218 | + | |
| 219 | +<script src="/real_control_v2/js/signal_state/signal_state.js" merge="custom_js"></script> | |
| 220 | +<script src="/real_control_v2/js/utils/dispatch_pattern.js" merge="custom_js"></script> | |
| 221 | + | |
| 222 | +<!-- 处理表单片段嵌入问题 --> | |
| 223 | +<script src="/real_control_v2/js/forms/form_embed.js" merge="custom_js"></script> | |
| 224 | +<!-- 模态框扩展 --> | |
| 225 | +<script src="/real_control_v2/js/modal_extend.js" merge="custom_js"></script> | |
| 226 | + | |
| 227 | +<!-- #### 安全驾驶 start ### --> | |
| 228 | +<div class="multi_plat_msg_pop_wrap" ></div> | |
| 229 | +<script id="sd_plat_msg_template" type="text/html"> | |
| 230 | + <div class="multi_plat_msg_pop uk-animation-slide-bottom" data-type="{{type}}" data-nbbm="{{clzbh}}" data-type="{{yczltype}}" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}" data-ts="{{ts}}"> | |
| 231 | + <div> | |
| 232 | + <span class="title">异常 {{clzbh}}</span> | |
| 233 | + <br/> | |
| 234 | + <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span> | |
| 235 | + <span class="desc">--安全驾驶监管平台</span> | |
| 236 | + </div> | |
| 237 | + </div> | |
| 238 | +</script> | |
| 239 | +<script id="cp_plat_msg_template" type="text/html"> | |
| 240 | + <div class="multi_plat_msg_pop uk-animation-slide-bottom" data-type="{{type}}" data-id="{{id}}" data-title="{{responseState}}" data-ts="{{ts}}"> | |
| 241 | + <div> | |
| 242 | + <span class="title">应急预案</span> | |
| 243 | + <br/> | |
| 244 | + <span class="text"> {{instructionsContent}}</span> | |
| 245 | + <span class="desc">--应急预案平台</span> | |
| 246 | + </div> | |
| 247 | + </div> | |
| 248 | +</script> | |
| 249 | +<script id="mt_plat_msg_template" type="text/html"> | |
| 250 | + <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #0aae0a;" data-type="{{type}}" data-confirm="维修保养计划" data-line="{{line}}" data-zbh="{{zbh}}" data-bydj="{{bydj}}" data-bysj="{{dateTimeStr}}" data-bydd="{{bydd}}"> | |
| 251 | + <div> | |
| 252 | + <span class="title">维修保养计划</span> | |
| 253 | + <br/> | |
| 254 | + <span class="text"> {{zbh}} {{timeStr}} 进场保养</span> | |
| 255 | + <span class="desc">--浦东公交维修库</span> | |
| 256 | + </div> | |
| 257 | + </div> | |
| 258 | +</script> | |
| 259 | +<script id="ces_plat_msg_template" type="text/html"> | |
| 260 | + <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #00ccff;" data-type="{{type}}" data-zbh="{{nbbm}}" data-start="{{startTimestamp}}" data-end="{{endTimestamp}}"> | |
| 261 | + <div> | |
| 262 | + <span class="title">车辆异常停车</span> | |
| 263 | + <br/> | |
| 264 | + <span class="text"> {{line}} {{nbbm}} 在 {{address}} 异常停车</span> | |
| 265 | + <span class="desc">--企业信息化运行监控中心</span> | |
| 266 | + </div> | |
| 267 | + </div> | |
| 268 | +</script> | |
| 269 | +<script id="inoutpark_plat_msg_template" type="text/html"> | |
| 270 | + <div class="multi_plat_msg_pop uk-animation-slide-bottom" style="background-color: #FF7F24;" data-type="{{type}}" data-zbh="{{nbbm}}"> | |
| 271 | + <div> | |
| 272 | + <span class="title">{{errType}}私自绕改道</span> | |
| 273 | + <br/> | |
| 274 | + <span class="text"> {{line}} {{nbbm}} 在 {{findTime}} {{errType}}私自绕改道,<br/>请到运管中心处理</span> | |
| 275 | + <span class="desc" style="color: #ffffff">--浦东公交运管中心管理系统</span> | |
| 276 | + </div> | |
| 277 | + </div> | |
| 278 | +</script> | |
| 279 | + | |
| 280 | +<script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> | |
| 281 | +<script src="/real_control_v2/js/con_plan/conPlan.js" merge="custom_js"></script> | |
| 282 | +<script src="/real_control_v2/js/mt_plan/mtPlan.js" merge="custom_js"></script> | |
| 283 | +<script src="/real_control_v2/js/platform/carErrorStop.js" merge="custom_js"></script> | |
| 284 | +<script src="/real_control_v2/js/platform/inoutPark.js" merge="custom_js"></script> | |
| 285 | +<!-- #### 安全驾驶 end ### --> | |
| 286 | + | |
| 287 | +<!-- 打电话 --> | |
| 288 | +<script src="/real_control_v2/js/safe_driv/call_phone.js" ></script> | |
| 289 | + | |
| 290 | +<script id="voip_call_info_panel-temp" type="text/html"> | |
| 291 | + <div class="voip_call_info_panel" style="{{style}}"> | |
| 292 | + <p class="_title">VOIP</p> | |
| 293 | + <form class="uk-form uk-form-horizontal"> | |
| 294 | + | |
| 295 | + <div class="uk-form-row"> | |
| 296 | + <label class="uk-form-label" >工号:</label> | |
| 297 | + <div class="uk-form-controls"> | |
| 298 | + <input type="text" name="agentID" value="1002" disabled> | |
| 299 | + </div> | |
| 300 | + </div> | |
| 301 | + <div class="uk-form-row"> | |
| 302 | + <label class="uk-form-label">分机号:</label> | |
| 303 | + <div class="uk-form-controls"> | |
| 304 | + <input type="text" name="dn" value="" > | |
| 305 | + </div> | |
| 306 | + </div> | |
| 307 | + <div class="uk-form-row"> | |
| 308 | + <label class="uk-form-label" >自编号:</label> | |
| 309 | + <div class="uk-form-controls"> | |
| 310 | + <input type="text" value="{{nbbm}}" disabled> | |
| 311 | + </div> | |
| 312 | + </div> | |
| 313 | + <div class="uk-form-row"> | |
| 314 | + <label class="uk-form-label" >SIM号:</label> | |
| 315 | + <div class="uk-form-controls"> | |
| 316 | + <input type="text" name="simNo" disabled> | |
| 317 | + </div> | |
| 318 | + </div> | |
| 319 | + <hr> | |
| 320 | + <h4 class="state_txt"> | |
| 321 | + <button class="uk-button uk-button-large" type="button" disabled>获取SIM卡号...</button> | |
| 322 | + </h4> | |
| 323 | + </form> | |
| 324 | + </div> | |
| 325 | +</script> | |
| 326 | +</body> | |
| 327 | + | |
| 328 | +</html> | ... | ... |