Commit f46edaf7dcaaf3b49145991d37cb547df83f83ab

Authored by 潘钊
1 parent 9ca70c2c

update...

src/main/java/com/bsth/controller/geo_data/GeoDataController.java
@@ -40,4 +40,10 @@ public class GeoDataController { @@ -40,4 +40,10 @@ public class GeoDataController {
40 public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){ 40 public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){
41 return geoDataService.updateStationName(map); 41 return geoDataService.updateStationName(map);
42 } 42 }
  43 +
  44 + @RequestMapping(value = "addNewStationRoute",method = RequestMethod.POST)
  45 + public Map<String, Object> addNewStationRoute(@RequestParam String lineCode,@RequestParam int versions,@RequestParam int upDown
  46 + ,@RequestParam String stationName,@RequestParam Float lat,@RequestParam Float lng,@RequestParam int prevRouteId){
  47 + return geoDataService.addNewStationRoute(lineCode, upDown, versions, stationName, lat, lng, prevRouteId);
  48 + }
43 } 49 }
44 \ No newline at end of file 50 \ No newline at end of file
src/main/java/com/bsth/service/geo_data/GeoDataService.java
@@ -18,4 +18,6 @@ public interface GeoDataService { @@ -18,4 +18,6 @@ public interface GeoDataService {
18 Map<String, Object> updateBufferInfo(GeoStation station); 18 Map<String, Object> updateBufferInfo(GeoStation station);
19 19
20 Map<String, Object> updateStationName(Map<String, Object> map); 20 Map<String, Object> updateStationName(Map<String, Object> map);
  21 +
  22 + Map<String,Object> addNewStationRoute(String lineCode, int upDown,int versions, String stationName, Float lat, Float lng, int prevRouteId);
21 } 23 }
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
@@ -4,11 +4,13 @@ import com.bsth.common.ResponseCode; @@ -4,11 +4,13 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.entity.geo_data.GeoRoad; 4 import com.bsth.entity.geo_data.GeoRoad;
5 import com.bsth.entity.geo_data.GeoStation; 5 import com.bsth.entity.geo_data.GeoStation;
6 import com.bsth.service.geo_data.GeoDataService; 6 import com.bsth.service.geo_data.GeoDataService;
  7 +import com.bsth.util.GetUIDAndCode;
7 import com.bsth.util.TransGPS; 8 import com.bsth.util.TransGPS;
8 import com.google.common.base.Splitter; 9 import com.google.common.base.Splitter;
9 import org.slf4j.Logger; 10 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
12 import org.springframework.jdbc.core.BeanPropertyRowMapper; 14 import org.springframework.jdbc.core.BeanPropertyRowMapper;
13 import org.springframework.jdbc.core.JdbcTemplate; 15 import org.springframework.jdbc.core.JdbcTemplate;
14 import org.springframework.jdbc.datasource.DataSourceTransactionManager; 16 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@@ -17,10 +19,9 @@ import org.springframework.transaction.TransactionDefinition; @@ -17,10 +19,9 @@ import org.springframework.transaction.TransactionDefinition;
17 import org.springframework.transaction.TransactionStatus; 19 import org.springframework.transaction.TransactionStatus;
18 import org.springframework.transaction.support.DefaultTransactionDefinition; 20 import org.springframework.transaction.support.DefaultTransactionDefinition;
19 21
20 -import java.util.ArrayList;  
21 -import java.util.HashMap;  
22 -import java.util.List;  
23 -import java.util.Map; 22 +import java.sql.PreparedStatement;
  23 +import java.sql.SQLException;
  24 +import java.util.*;
24 25
25 /** 26 /**
26 * Created by panzhao on 2017/12/8. 27 * Created by panzhao on 2017/12/8.
@@ -166,6 +167,120 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -166,6 +167,120 @@ public class GeoDataServiceImpl implements GeoDataService {
166 return rs; 167 return rs;
167 } 168 }
168 169
  170 + @Override
  171 + public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId) {
  172 + Map<String, Object> rs = new HashMap<>();
  173 +
  174 + //编程式事务
  175 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  176 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  177 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  178 + TransactionStatus status = tran.getTransaction(def);
  179 + try {
  180 + //根据站点编码,查询站点ID
  181 + int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class);
  182 +
  183 + String sql = "select * from bsth_c_ls_stationroute where line_code='"+lineCode+"' and line="+lineId+" and directions="+upDown+" and destroy=0 and versions=" + versions;
  184 + List<SaveStationRouteDTO> routes = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SaveStationRouteDTO.class));
  185 +
  186 +
  187 + //按路由顺序排列
  188 + Collections.sort(routes, new StationRouteComp());
  189 +
  190 + //存一份百度坐标,保持现有数据结构完整性
  191 + TransGPS.Location bcLoc = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(String.valueOf(lng)), Double.parseDouble(String.valueOf(lat)))));
  192 + //insert 站点
  193 + long sCode = GetUIDAndCode.getStationId();
  194 + jdbcTemplate.update("insert into bsth_c_station(id, station_cod, station_name, db_type, b_jwpoints, g_lonx, g_laty, destroy, radius, shapes_type, versions) " +
  195 + " values(?,?,?,?,?,?,?,?,?,?,?)", sCode, sCode, stationName, "b", bcLoc.getLng() + " " + bcLoc.getLat(), lng, lat, 0, 88, "r", 1);
  196 +
  197 +
  198 + SaveStationRouteDTO sr;
  199 + int currentNo = -1,
  200 + no = 100, step = 100;
  201 +
  202 + if(prevRouteId == -1){
  203 + //起点站
  204 + currentNo = no;
  205 + no += step;
  206 + }
  207 + //重新排序路由
  208 + for(int i = 0, size = routes.size(); i < size; i ++){
  209 + sr = routes.get(i);
  210 + if(sr.getId().intValue() == prevRouteId){
  211 + no+=step;
  212 + currentNo = no;
  213 + }
  214 + sr.setStationRouteCode(no+=step);
  215 + }
  216 +
  217 + sr = new SaveStationRouteDTO();
  218 + sr.setLine(lineId);
  219 + sr.setLineCode(lineCode);
  220 + sr.setDirections(upDown);
  221 + sr.setVersions(versions);
  222 + sr.setStationRouteCode(currentNo);
  223 + sr.setStation(sCode);
  224 + sr.setStationCode(sCode + "");
  225 + sr.setStationName(stationName);
  226 + sr.setDistances(0d);
  227 + sr.setToTime(0d);
  228 + Date d = new Date();
  229 + sr.setCreateDate(d);
  230 + sr.setUpdateDate(d);
  231 + sr.setDestroy(0);
  232 +
  233 + routes.add(sr);
  234 +
  235 + //重新标记mark
  236 + Collections.sort(routes, new StationRouteComp());
  237 + for(int i = 0, size = routes.size(); i < size; i ++){
  238 + routes.get(i).setStationMark("Z");
  239 + }
  240 + routes.get(0).setStationMark("B");
  241 + routes.get(routes.size() - 1).setStationMark("E");
  242 +
  243 + final List<SaveStationRouteDTO> saveList = routes;
  244 + //insert 路由
  245 + jdbcTemplate.update("delete bsth_c_ls_stationroute where line_code='"+lineCode+"' and line="+lineId+" and directions="+upDown+" and destroy=0 and versions=" + versions);
  246 + jdbcTemplate.batchUpdate("insert into bsth_c_ls_stationroute(line, station, station_name, station_route_code, line_code, station_code, station_mark, distances, to_time, destroy, versions, create_date, update_date,directions) " +
  247 + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  248 + @Override
  249 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  250 + SaveStationRouteDTO sr = saveList.get(i);
  251 + ps.setInt(1, sr.getLine());
  252 + ps.setLong(2, sr.getStation());
  253 + ps.setString(3, sr.getStationName());
  254 + ps.setInt(4, sr.getStationRouteCode());
  255 + ps.setString(5, sr.getLineCode());
  256 + ps.setString(6, sr.getStationCode());
  257 + ps.setString(7, sr.getStationMark());
  258 + ps.setDouble(8, sr.getDistances());
  259 + ps.setDouble(9, sr.getToTime());
  260 + ps.setInt(10, sr.getDestroy());
  261 + ps.setInt(11, sr.getVersions());
  262 + ps.setTimestamp(12, new java.sql.Timestamp(sr.getCreateDate().getTime()));
  263 + ps.setTimestamp(13, new java.sql.Timestamp(sr.getUpdateDate().getTime()));
  264 + ps.setInt(14, sr.getDirections());
  265 + }
  266 +
  267 + @Override
  268 + public int getBatchSize() {
  269 + return saveList.size();
  270 + }
  271 + });
  272 +
  273 + tran.commit(status);
  274 + rs.put("status", ResponseCode.SUCCESS);
  275 + } catch (Exception e) {
  276 + tran.rollback(status);
  277 + logger.error("", e);
  278 + rs.put("status", ResponseCode.ERROR);
  279 + rs.put("msg", "服务器出现异常");
  280 + }
  281 + return rs;
  282 + }
  283 +
169 284
170 /** 285 /**
171 * 根据路由ID 获取站点 286 * 根据路由ID 获取站点
@@ -223,4 +338,11 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -223,4 +338,11 @@ public class GeoDataServiceImpl implements GeoDataService {
223 return bdList; 338 return bdList;
224 } 339 }
225 340
  341 + private static class StationRouteComp implements Comparator<SaveStationRouteDTO> {
  342 +
  343 + @Override
  344 + public int compare(SaveStationRouteDTO s1, SaveStationRouteDTO s2) {
  345 + return s1.getStationRouteCode() - s2.getStationRouteCode();
  346 + }
  347 + }
226 } 348 }
227 \ No newline at end of file 349 \ No newline at end of file
src/main/java/com/bsth/service/geo_data/impl/SaveStationRouteDTO.java 0 → 100644
  1 +package com.bsth.service.geo_data.impl;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * 站点路由 jdbc 入库数据
  7 + * Created by panzhao on 2017/12/14.
  8 + */
  9 +public class SaveStationRouteDTO {
  10 +
  11 + //站点路由ID
  12 + private Integer id;
  13 +
  14 + // 站点路由序号
  15 + private Integer stationRouteCode;
  16 +
  17 + // 站点编码
  18 + private String stationCode;
  19 +
  20 + // 站点名称
  21 + private String stationName;
  22 +
  23 + // 线路编码
  24 + private String lineCode;
  25 +
  26 + /**
  27 + * 站点类型
  28 + *
  29 + * ------ B:起点站
  30 + *
  31 + * ------ Z:中途站
  32 + *
  33 + * ------ E:终点站
  34 + *
  35 + * ------ T:停车场
  36 + *
  37 + */
  38 + private String stationMark;
  39 +
  40 + // 站点路由出站序号
  41 + private Integer outStationNmber;
  42 +
  43 + // 站点路由到站距离
  44 + private Double distances;
  45 +
  46 + // 站点路由到站时间
  47 + private Double toTime;
  48 +
  49 + // 首班时间
  50 + private String firstTime;
  51 +
  52 + // 末班时间
  53 + private String endTime;
  54 +
  55 + // 站点路由方向
  56 + private Integer directions;
  57 +
  58 + // 版本号
  59 + private Integer versions;
  60 +
  61 + // 是否撤销
  62 + private Integer destroy;
  63 +
  64 + // 描述
  65 + private String descriptions;
  66 +
  67 + // 创建人
  68 + private Integer createBy;
  69 +
  70 + // 修改人
  71 + private Integer updateBy;
  72 +
  73 + // 创建日期
  74 + private Date createDate;
  75 +
  76 + // 修改日期
  77 + private Date updateDate;
  78 +
  79 + // 站点ID
  80 + private long station;
  81 +
  82 + // 线路ID
  83 + private int line;
  84 +
  85 + public Integer getId() {
  86 + return id;
  87 + }
  88 +
  89 + public void setId(Integer id) {
  90 + this.id = id;
  91 + }
  92 +
  93 + public Integer getStationRouteCode() {
  94 + return stationRouteCode;
  95 + }
  96 +
  97 + public void setStationRouteCode(Integer stationRouteCode) {
  98 + this.stationRouteCode = stationRouteCode;
  99 + }
  100 +
  101 + public String getStationCode() {
  102 + return stationCode;
  103 + }
  104 +
  105 + public void setStationCode(String stationCode) {
  106 + this.stationCode = stationCode;
  107 + }
  108 +
  109 + public String getStationName() {
  110 + return stationName;
  111 + }
  112 +
  113 + public void setStationName(String stationName) {
  114 + this.stationName = stationName;
  115 + }
  116 +
  117 + public String getLineCode() {
  118 + return lineCode;
  119 + }
  120 +
  121 + public void setLineCode(String lineCode) {
  122 + this.lineCode = lineCode;
  123 + }
  124 +
  125 + public String getStationMark() {
  126 + return stationMark;
  127 + }
  128 +
  129 + public void setStationMark(String stationMark) {
  130 + this.stationMark = stationMark;
  131 + }
  132 +
  133 + public Integer getOutStationNmber() {
  134 + return outStationNmber;
  135 + }
  136 +
  137 + public void setOutStationNmber(Integer outStationNmber) {
  138 + this.outStationNmber = outStationNmber;
  139 + }
  140 +
  141 + public Double getDistances() {
  142 + return distances;
  143 + }
  144 +
  145 + public void setDistances(Double distances) {
  146 + this.distances = distances;
  147 + }
  148 +
  149 + public Double getToTime() {
  150 + return toTime;
  151 + }
  152 +
  153 + public void setToTime(Double toTime) {
  154 + this.toTime = toTime;
  155 + }
  156 +
  157 + public String getFirstTime() {
  158 + return firstTime;
  159 + }
  160 +
  161 + public void setFirstTime(String firstTime) {
  162 + this.firstTime = firstTime;
  163 + }
  164 +
  165 + public String getEndTime() {
  166 + return endTime;
  167 + }
  168 +
  169 + public void setEndTime(String endTime) {
  170 + this.endTime = endTime;
  171 + }
  172 +
  173 + public Integer getDirections() {
  174 + return directions;
  175 + }
  176 +
  177 + public void setDirections(Integer directions) {
  178 + this.directions = directions;
  179 + }
  180 +
  181 + public Integer getVersions() {
  182 + return versions;
  183 + }
  184 +
  185 + public void setVersions(Integer versions) {
  186 + this.versions = versions;
  187 + }
  188 +
  189 + public Integer getDestroy() {
  190 + return destroy;
  191 + }
  192 +
  193 + public void setDestroy(Integer destroy) {
  194 + this.destroy = destroy;
  195 + }
  196 +
  197 + public String getDescriptions() {
  198 + return descriptions;
  199 + }
  200 +
  201 + public void setDescriptions(String descriptions) {
  202 + this.descriptions = descriptions;
  203 + }
  204 +
  205 + public Integer getCreateBy() {
  206 + return createBy;
  207 + }
  208 +
  209 + public void setCreateBy(Integer createBy) {
  210 + this.createBy = createBy;
  211 + }
  212 +
  213 + public Integer getUpdateBy() {
  214 + return updateBy;
  215 + }
  216 +
  217 + public void setUpdateBy(Integer updateBy) {
  218 + this.updateBy = updateBy;
  219 + }
  220 +
  221 + public Date getCreateDate() {
  222 + return createDate;
  223 + }
  224 +
  225 + public void setCreateDate(Date createDate) {
  226 + this.createDate = createDate;
  227 + }
  228 +
  229 + public Date getUpdateDate() {
  230 + return updateDate;
  231 + }
  232 +
  233 + public void setUpdateDate(Date updateDate) {
  234 + this.updateDate = updateDate;
  235 + }
  236 +
  237 + public long getStation() {
  238 + return station;
  239 + }
  240 +
  241 + public void setStation(long station) {
  242 + this.station = station;
  243 + }
  244 +
  245 + public int getLine() {
  246 + return line;
  247 + }
  248 +
  249 + public void setLine(int line) {
  250 + this.line = line;
  251 + }
  252 +}
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
1 -<<<<<<< HEAD  
2 /* ^_^ baidu map hide logo */ 1 /* ^_^ baidu map hide logo */
3 .anchorBL, .anchorBL, .amap-logo, .amap-copyright { 2 .anchorBL, .anchorBL, .amap-logo, .amap-copyright {
4 display: none; 3 display: none;
@@ -37,8 +36,8 @@ div#map_wrap{ @@ -37,8 +36,8 @@ div#map_wrap{
37 .main_rt_tools_panel{ 36 .main_rt_tools_panel{
38 position: absolute; 37 position: absolute;
39 z-index: 99; 38 z-index: 99;
40 - top: 7px;  
41 - right: 7px; 39 + top: 20px;
  40 + right: 77px;
42 background: #ffffff; 41 background: #ffffff;
43 box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48); 42 box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48);
44 padding: 0 12px; 43 padding: 0 12px;
@@ -461,7 +460,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { @@ -461,7 +460,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
461 460
462 .add_station_search_point_wrap{ 461 .add_station_search_point_wrap{
463 width: 390px; 462 width: 390px;
464 - height: 140px; 463 + height: 126px;
465 position: absolute; 464 position: absolute;
466 top: 10px; 465 top: 10px;
467 left: calc(50% - 200px); 466 left: calc(50% - 200px);
@@ -480,428 +479,4 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { @@ -480,428 +479,4 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
480 479
481 .add_station_search_point_wrap .buffer_edit_body .ct_row { 480 .add_station_search_point_wrap .buffer_edit_body .ct_row {
482 margin-top: 8px; 481 margin-top: 8px;
483 -=======  
484 -/* ^_^ baidu map hide logo */  
485 -.anchorBL, .anchorBL, .amap-logo, .amap-copyright {  
486 - display: none;  
487 -}  
488 -  
489 -html,body{  
490 - height: 100%;  
491 -}  
492 -.ct_page{  
493 - padding: 0;  
494 - height: 100%;  
495 -}  
496 -  
497 -div#map_wrap{  
498 - height: 100%;  
499 -}  
500 -  
501 -.main_left_panel{  
502 - position: absolute;  
503 - z-index: 999;  
504 - height: calc(100% - 20px);  
505 - width: 300px;  
506 - background: #fffffff5;  
507 - top: 7px;  
508 - left: 5px;  
509 - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);  
510 -}  
511 -.main_lt_search_panel{  
512 - position: absolute;  
513 - z-index: 99;  
514 - top: 10px;  
515 - left: 330px;  
516 - background: #fffffff5;  
517 - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);  
518 -}  
519 -.main_rt_tools_panel{  
520 - position: absolute;  
521 - z-index: 99;  
522 - top: 7px;  
523 - right: 7px;  
524 - background: #ffffff;  
525 - box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48);  
526 - padding: 0 12px;  
527 - text-align: center;  
528 - border-radius: 7px;  
529 - height: 28px;  
530 -}  
531 -  
532 -.main_rt_tools_panel>._icon{  
533 - margin: 0 9px;  
534 -}  
535 -.search_input{  
536 - width: 250px;  
537 - height: 42px;  
538 -}  
539 -  
540 -.search_input::placeholder{  
541 - color: grey;  
542 - font-size: 12px;  
543 -}  
544 -  
545 -._line_info{  
546 - width: 100%;  
547 - height: 90px;  
548 - background: white;  
549 - box-shadow: 0px -2px 15px rgba(90, 90, 90, 0.48);  
550 -}  
551 -  
552 -._line_name{  
553 - padding: 10px 0 0 15px;  
554 - font-weight: 600;  
555 - font-family: 微软雅黑;  
556 - font-size: 18px;  
557 - color: #484848;  
558 - position: relative;  
559 -}  
560 -  
561 -._version_dropdown_wrap{  
562 - padding: 4px 0 0 15px;  
563 -}  
564 -._version_text{  
565 - font-size: 14px;  
566 - color: #0aae0a;  
567 -}  
568 -._version_dropdown_wrap li.uk-active>a{  
569 - color: #0aae0a;  
570 -}  
571 -.uk-nav-header:not(:first-child) {  
572 - margin-top: 10px;  
573 -}  
574 -.add_line_version_icon{  
575 - position: absolute;  
576 - right: 18px;  
577 - top: 10px;  
578 -}  
579 -.clock_enable_version{  
580 - padding: 4px 0 0 15px;  
581 - font-size: 13px;  
582 - color: #ef4f4f;  
583 -}  
584 -  
585 -.clock_enable_version>a.uk-icon{  
586 - vertical-align: top;  
587 - margin-top: 6px;  
588 -}  
589 -._route_info_wrap{  
590 - height: calc(100% - 100px);  
591 - padding-top: 10px;  
592 -}  
593 -  
594 -._route_info_wrap .uk-tab>li>a{  
595 - padding: 9px 5px;  
596 -}  
597 -._route_info_wrap>ul.uk-tab{  
598 - padding-left: 10px;  
599 - margin-bottom: 0;  
600 -}  
601 -.rt_show_version_txt{  
602 - position: absolute;  
603 - right: 7px;  
604 - bottom: 7px;  
605 - font-size: 12px;  
606 -}  
607 -.rt_show_version_txt{  
608 - position: absolute;  
609 - right: 7px;  
610 - bottom: 7px;  
611 - font-size: 12px;  
612 - padding: 5px 8px;  
613 -}  
614 -.station_route>ul{  
615 - padding: 0 0 0 30px;  
616 - font-size: 14px;  
617 - width: calc(100% - 38px);  
618 -}  
619 -  
620 -.station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul {  
621 - margin-top: 0;  
622 -}  
623 -  
624 -.station_route>ul>li>a{  
625 - color: #434343;  
626 - overflow: hidden;  
627 - text-overflow: ellipsis;  
628 - white-space: nowrap;  
629 - display: inline-block;  
630 - width: calc(100% - 53px);  
631 - padding: 4px 0;  
632 - vertical-align: middle;+0982/  
633 -}  
634 -  
635 -.ct_route_badge{  
636 - font-size: 11px;  
637 - height: 18px;  
638 - border-radius: 5px;  
639 - vertical-align: top;  
640 - margin-top: 1px;  
641 - padding: 0 4px;  
642 - margin-right: 3px;  
643 - min-width: 18px;  
644 -}  
645 -  
646 -.up_down_route_list>li:nth-of-type(2) .ct_route_badge{  
647 - background: #fb6464;  
648 -}  
649 -  
650 -.ct_route_badge.start{  
651 - margin-left: 0px;  
652 -}  
653 -.ct_route_badge.end{  
654 - margin-left: 0px;  
655 -}  
656 -.road_route{  
657 - padding-left: 30px;  
658 - width: calc(100% - 25px);  
659 - font-size: 14px;  
660 - color: #242424;  
661 - border-top: 1px solid #d5d5d5;  
662 - padding-top: 0;  
663 -}  
664 -._route_info_wrap>ul.uk-switcher{  
665 - overflow: auto;  
666 - height: calc(100% - 62px);  
667 - margin-bottom: 0;  
668 - position: relative;  
669 - padding-top: 20px;  
670 - margin-top: 0 !important;  
671 -}  
672 -  
673 -.pos_tb_icon{  
674 - position: absolute;  
675 - bottom: 15px;  
676 - right: 15px;  
677 -}  
678 -.ct_route_badge_wrap{  
679 - display: inline-block;  
680 - width: 48px;  
681 - text-align: right;  
682 - vertical-align: top;  
683 - margin-top: 3px;  
684 -}  
685 -  
686 -.road_route>ul li a{  
687 - color: #242424;  
688 - width: 100%;  
689 - display: block;  
690 - padding-left: 8px;  
691 -}  
692 -  
693 -.road_route>ul{  
694 - border-left: 1px solid #cbcbcb;  
695 - padding-left: 0;  
696 - padding-top: 10px;  
697 -}  
698 -  
699 -span.sub_name {  
700 - font-size: 12px;  
701 - color: #777676;  
702 - margin-left: 5px;  
703 -}  
704 -  
705 -.road_route>ul>li{  
706 - width: calc(100% - 10px);  
707 - overflow: hidden;  
708 - text-overflow: ellipsis;  
709 - white-space: nowrap;  
710 - display: inline-block;  
711 -}  
712 -  
713 -#map_wrap img {  
714 - max-width: none;  
715 -}  
716 -  
717 -ul.uk-list.station_info_win {  
718 - font-size: 14px;  
719 - padding-left: 5px;  
720 -}  
721 -  
722 -.uk-list.station_info_win>li:nth-child(n+2), .uk-list.station_info_win>li>ul {  
723 - margin-top: 7px;  
724 -}  
725 -  
726 -ul.uk-list.station_info_win>li.s_name{  
727 - font-size: 16px;  
728 - font-weight: 600;  
729 - color: #e15428;  
730 -}  
731 -  
732 -.up_down_route_list li.ct_active{  
733 - background: #91d9fa;  
734 -}  
735 -  
736 -.up_down_route_list li.ct_active.first_road_active{  
737 - background: #fff;  
738 -}  
739 -  
740 -.up_down_route_list li.ct_active.first_road_active>a{  
741 - background: #91d9fa;  
742 -}  
743 -  
744 -.road_route .uk-list ul{  
745 - padding-left: 22px;  
746 -}  
747 -  
748 -.road_route>ul>li>ul>li{  
749 - padding-left: 8px;  
750 -}  
751 -  
752 -.ct_coord_str{  
753 - max-height: 300px;  
754 - overflow: auto;  
755 -}  
756 -  
757 -ul.context-menu-list.station-route-ct-menu.context-menu-root {  
758 - font-size: 14px;  
759 - width: 170px !important;  
760 - min-width: 70px;  
761 - border: 1px solid #d2d2d2;  
762 - overflow: hidden;  
763 - border-radius: 0;  
764 - background: #fff;  
765 - color: #666;  
766 - box-shadow: 0 5px 12px rgba(0,0,0,.15);  
767 -}  
768 -  
769 -.main_left_panel_m_layer{  
770 - position: absolute;  
771 - z-index: 10000;  
772 - height: calc(100% - 20px);  
773 - width: 300px;  
774 - background: #ffffff85;  
775 - top: 7px;  
776 - left: 5px;  
777 - display: none;  
778 -}  
779 -  
780 -.buffer_edit_panel{  
781 - position: absolute;  
782 - top: 5px;  
783 - width: 360px;  
784 - height: 120px;  
785 - background: #ffffff;  
786 - left: calc(50% - 170px);  
787 - z-index: 999;  
788 - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);  
789 - display: none;  
790 -}  
791 -.buffer_edit_body{  
792 - padding: 5px;  
793 -}  
794 -  
795 -.buffer_edit_body>.name{  
796 - font-weight: 600;  
797 - color: #E91E63;  
798 - margin-bottom: 0;  
799 -}  
800 -  
801 -.buffer_edit_body .ct_row .uk-inline{  
802 - width: 167px;  
803 - height: 30px;  
804 - margin-right: 7px;  
805 -}  
806 -  
807 -.buffer_edit_body .ct_row{  
808 - margin-top: 12px;  
809 -}  
810 -  
811 -.buffer_edit_body .ct_row .uk-inline:last-child{  
812 - margin-right: 0;  
813 -}  
814 -  
815 -.buffer_edit_body .ct_row .uk-inline input{  
816 - height: 30px;  
817 -}  
818 -  
819 -.buffer_edit_body .ct_row .uk-form-icon-flip {  
820 - font-size: 12px;  
821 -}  
822 -  
823 -.buffer_edit_body .ct_row .uk-inline.btns{  
824 - text-align: right;  
825 -}  
826 -.buffer_edit_body .ct_row .uk-inline.btns .uk-button{  
827 - padding: 0 15px;  
828 - height: 28px;  
829 - line-height: 28px;  
830 - vertical-align: top;  
831 - margin-top: 2px;  
832 -}  
833 -  
834 -.loading{  
835 - height: 100%;  
836 - text-align: center;  
837 - position: absolute;  
838 - z-index: 10000;  
839 - top: 0;  
840 - left: 0;  
841 - width: 100%;  
842 - background: #ffffff78;  
843 - display: flex;  
844 -}  
845 -  
846 -.loading>div{  
847 - margin: auto;  
848 - margin-top: calc(25% - 100px);  
849 - background: #f9d56c;  
850 - padding: 12px;  
851 - box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);  
852 -}  
853 -  
854 -.loading>div>span{  
855 - vertical-align: top;  
856 - margin-top: -6px;  
857 - margin-right: 5px;  
858 - font-size: 14px;  
859 -}  
860 -.uk-modal{  
861 - z-index: 10001;  
862 -}  
863 -  
864 -.ct_route_badge.polygon{  
865 -  
866 -}  
867 -  
868 -.shapes_type>div.uk-inline:nth-of-type(2){  
869 - width: 80px;  
870 - margin-right: 0;  
871 -}  
872 -  
873 -.shapes_type>div.uk-inline:first-child{  
874 - width: 84px;  
875 -}  
876 -  
877 -.shapes_type>div.uk-inline:first-child select{  
878 - height: 30px;  
879 -}  
880 -  
881 -.shapes_type.st_d>div.uk-inline:nth-of-type(2){  
882 - display: none;  
883 -}  
884 -  
885 -.shapes_type.st_d>div.uk-inline:first-child{  
886 - width: 167px;  
887 -}  
888 -  
889 -.draw_polygon_switch{  
890 - display: none;  
891 -}  
892 -  
893 -.shapes_type.st_d>div.uk-inline:first-child select{  
894 - width: 107px;  
895 -}  
896 -  
897 -.shapes_type.st_d .draw_polygon_switch{  
898 - display: inline-block;  
899 - font-size: 12px;  
900 - vertical-align: bottom;  
901 - margin-left: 5px;  
902 -}  
903 -  
904 -.shapes_type.st_d .draw_polygon_switch>a{  
905 - color: red;  
906 ->>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f  
907 } 482 }
908 \ No newline at end of file 483 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
1 -<<<<<<< HEAD  
2 <div> 1 <div>
3 <script id="geo_d_e_station_route-temp" type="text/html"> 2 <script id="geo_d_e_station_route-temp" type="text/html">
4 <ul class="uk-list"> 3 <ul class="uk-list">
5 {{each list as s i}} 4 {{each list as s i}}
6 - <li class="station_li_{{s.stationCode}}">  
7 - <div class="ct_route_badge_wrap"> 5 + <li class="s_r_item" data-code="{{s.stationCode}}" data-id="{{s.id}}">
  6 + <div class="ct_route_badge_wrap">
8 <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if s.shapesType=='d'}}polygon{{/if}}"> 7 <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if s.shapesType=='d'}}polygon{{/if}}">
9 {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span> 8 {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span>
10 - </div>  
11 - <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a>  
12 - </li> 9 + </div>
  10 + <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a>
  11 + </li>
13 {{/each}} 12 {{/each}}
14 </ul> 13 </ul>
15 </script> 14 </script>
@@ -69,34 +68,34 @@ @@ -69,34 +68,34 @@
69 <input type="hidden" value="{{directions}}" name="directions"> 68 <input type="hidden" value="{{directions}}" name="directions">
70 <input type="hidden" value="{{stationCode}}" name="stationCode"> 69 <input type="hidden" value="{{stationCode}}" name="stationCode">
71 <input type="hidden" value="{{stationName}}" name="stationName"> 70 <input type="hidden" value="{{stationName}}" name="stationName">
72 - <div class="ct_row">  
73 - <div class="uk-inline">  
74 - <span class="uk-form-icon uk-form-icon-flip" >经度</span>  
75 - <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly>  
76 - </div>  
77 - <div class="uk-inline">  
78 - <span class="uk-form-icon uk-form-icon-flip" >纬度</span>  
79 - <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly> 71 + <div class="ct_row">
  72 + <div class="uk-inline">
  73 + <span class="uk-form-icon uk-form-icon-flip" >经度</span>
  74 + <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly>
  75 + </div>
  76 + <div class="uk-inline">
  77 + <span class="uk-form-icon uk-form-icon-flip" >纬度</span>
  78 + <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly>
  79 + </div>
80 </div> 80 </div>
81 - </div>  
82 81
83 - <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}">  
84 - <div class="uk-inline" >  
85 - <select name="shapesType" class="uk-select">  
86 - <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option>  
87 - <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option>  
88 - </select>  
89 - <span class="draw_polygon_switch" data-type="{{shapesType=='d'?'3':'1'}}"><a>{{shapesType=='d'?'重新绘制':'暂停绘制'}}</a></span>  
90 - </div>  
91 - <div class="uk-inline">  
92 - <span class="uk-form-icon uk-form-icon-flip" >半径</span>  
93 - <input class="uk-input" name="radius" type="text" value="{{radius}}">  
94 - </div>  
95 - <div class="uk-inline btns">  
96 - <button class="uk-button uk-button-primary submit">确定</button>  
97 - <button class="uk-button uk-button-default cancel">取消</button> 82 + <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}">
  83 + <div class="uk-inline" >
  84 + <select name="shapesType" class="uk-select">
  85 + <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option>
  86 + <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option>
  87 + </select>
  88 + <span class="draw_polygon_switch" data-type="{{shapesType=='d'?'3':'1'}}"><a>{{shapesType=='d'?'重新绘制':'暂停绘制'}}</a></span>
  89 + </div>
  90 + <div class="uk-inline">
  91 + <span class="uk-form-icon uk-form-icon-flip" >半径</span>
  92 + <input class="uk-input" name="radius" type="text" value="{{radius}}">
  93 + </div>
  94 + <div class="uk-inline btns">
  95 + <button class="uk-button uk-button-primary submit">确定</button>
  96 + <button class="uk-button uk-button-default cancel">取消</button>
  97 + </div>
98 </div> 98 </div>
99 - </div>  
100 </form> 99 </form>
101 </div> 100 </div>
102 </div> 101 </div>
@@ -119,7 +118,7 @@ @@ -119,7 +118,7 @@
119 <script id="geo_d_e_add_station_panel-temp" type="text/html"> 118 <script id="geo_d_e_add_station_panel-temp" type="text/html">
120 <li class="station_li_transient"> 119 <li class="station_li_transient">
121 <div class="ct_route_badge_wrap"> 120 <div class="ct_route_badge_wrap">
122 - <span class="uk-badge ct_route_badge ">?</span> 121 + <span class="uk-badge ct_route_badge ">?</span>
123 </div> 122 </div>
124 <div class="ul_li_input"> 123 <div class="ul_li_input">
125 <form> 124 <form>
@@ -136,6 +135,7 @@ @@ -136,6 +135,7 @@
136 <div class="_title">为 {{name}} 选择一个坐标位置</div> 135 <div class="_title">为 {{name}} 选择一个坐标位置</div>
137 <div class="buffer_edit_body"> 136 <div class="buffer_edit_body">
138 <form> 137 <form>
  138 + <input type="hidden" value="{{name}}" name="stationName">
139 <div class="ct_row"> 139 <div class="ct_row">
140 <div class="uk-inline"> 140 <div class="uk-inline">
141 <span class="uk-form-icon uk-form-icon-flip" >经度</span> 141 <span class="uk-form-icon uk-form-icon-flip" >经度</span>
@@ -146,123 +146,20 @@ @@ -146,123 +146,20 @@
146 <input class="uk-input" name="gLonx" type="text" readonly> 146 <input class="uk-input" name="gLonx" type="text" readonly>
147 </div> 147 </div>
148 </div> 148 </div>
149 - <div class="ct_row shapes_type "> 149 + <div class="ct_row ">
150 <div class="uk-inline" > 150 <div class="uk-inline" >
151 - <select name="shapesType" class="uk-select">  
152 - <option value="r" >圆形</option>  
153 - <option value="d" >多边形</option>  
154 - </select>  
155 - <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span>  
156 - </div>  
157 - <div class="uk-inline">  
158 - <span class="uk-form-icon uk-form-icon-flip" >半径</span>  
159 - <input class="uk-input" name="radius" type="text" > 151 + <div class="ct_row" style="color: #5e5d5d;font-size: 12px;">
  152 + <span uk-icon="icon: question;ratio:.7;" style="vertical-align: top;margin-top: 2px;"></span>
  153 + 双击地图可拾取坐标点位
  154 + </div>
160 </div> 155 </div>
161 <div class="uk-inline btns"> 156 <div class="uk-inline btns">
162 <button class="uk-button uk-button-primary submit">确定</button> 157 <button class="uk-button uk-button-primary submit">确定</button>
163 <button class="uk-button uk-button-default cancel">取消</button> 158 <button class="uk-button uk-button-default cancel">取消</button>
164 </div> 159 </div>
165 </div> 160 </div>
166 - <div class="ct_row" style="color: #5e5d5d;font-size: 12px;">  
167 - <span uk-icon="icon: question;ratio:.7;" style="vertical-align: top;margin-top: 2px;"></span>  
168 - 双击地图拾取坐标点位  
169 - </div>  
170 - </form>  
171 - </div>  
172 - </div>  
173 - </script>  
174 -=======  
175 -<div>  
176 - <script id="geo_d_e_station_route-temp" type="text/html">  
177 - <ul class="uk-list">  
178 - {{each list as s i}}  
179 - <li class="station_li_{{s.stationCode}}">  
180 - <div class="ct_route_badge_wrap">  
181 - <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}">  
182 - {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span>  
183 - </div>  
184 - <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a>  
185 - </li>  
186 - {{/each}}  
187 - </ul>  
188 - </script>  
189 -  
190 -  
191 - <script id="geo_d_e_station_info_win-temp" type="text/html">  
192 - <ul class="uk-list station_info_win">  
193 - <li class="s_name">{{stationName}}</li>  
194 - <li>站点编码: {{stationCode}}</li>  
195 - <li>站点类型:  
196 - {{if stationMark=='B'}}  
197 - 起点站  
198 - {{else if stationMark=='E'}}  
199 - 终点站  
200 - {{else if stationMark=='Z'}}  
201 - 中途站  
202 - {{/if}}  
203 - </li>  
204 - <li>  
205 - 经度: {{gLaty}}  
206 - </li>  
207 - <li>纬度: {{gLonx}}</li>  
208 - <li>  
209 - 电子围栏类型:  
210 - {{if shapesType=='r'}}  
211 - 圆形  
212 - {{else if shapesType=='d'}}  
213 - 多边形  
214 - {{/if}}  
215 - </li>  
216 - <li>  
217 - {{if shapesType=='r'}}  
218 - 半径:{{radius}}  
219 - {{/if}}  
220 - </li>  
221 - <li>站序:{{index + 1}}</li>  
222 - <li>路由序号:{{stationRouteCode}}</li>  
223 - </ul>  
224 - </script>  
225 -  
226 - <script id="geo_d_e_map_edit_buffer_panel-temp" type="text/html">  
227 - <div class="buffer_edit_panel uk-animation-slide-top-small">  
228 - <div class="buffer_edit_body" >  
229 - <h6 class="name">{{stationName}}(缓冲区编辑)</h6>  
230 - <form>  
231 - <input type="hidden" value="{{id}}" name="id">  
232 - <input type="hidden" value="{{directions}}" name="directions">  
233 - <input type="hidden" value="{{stationCode}}" name="stationCode">  
234 - <input type="hidden" value="{{stationName}}" name="stationName">  
235 - <div class="ct_row">  
236 - <div class="uk-inline">  
237 - <span class="uk-form-icon uk-form-icon-flip" >经度</span>  
238 - <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly>  
239 - </div>  
240 - <div class="uk-inline">  
241 - <span class="uk-form-icon uk-form-icon-flip" >纬度</span>  
242 - <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly>  
243 - </div>  
244 - </div>  
245 -  
246 - <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}">  
247 - <div class="uk-inline" >  
248 - <select name="shapesType" class="uk-select">  
249 - <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option>  
250 - <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option>  
251 - </select>  
252 - <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span>  
253 - </div>  
254 - <div class="uk-inline">  
255 - <span class="uk-form-icon uk-form-icon-flip" >半径</span>  
256 - <input class="uk-input" name="radius" type="text" value="{{radius}}">  
257 - </div>  
258 - <div class="uk-inline btns">  
259 - <button class="uk-button uk-button-primary submit">确定</button>  
260 - <button class="uk-button uk-button-default cancel">取消</button>  
261 - </div>  
262 - </div>  
263 </form> 161 </form>
264 </div> 162 </div>
265 </div> 163 </div>
266 </script> 164 </script>
267 ->>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f  
268 </div> 165 </div>
269 \ No newline at end of file 166 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/js/map.js
1 -<<<<<<< HEAD  
2 <!-- 地图操作 --> 1 <!-- 地图操作 -->
3 2
4 var gb_ct_map = function () { 3 var gb_ct_map = function () {
5 4
6 //初始化地图 5 //初始化地图
7 - if(!window.BMap){ 6 + if (!window.BMap) {
8 alert('地图没有加载成功,请确认是否能正常连接外网!!'); 7 alert('地图没有加载成功,请确认是否能正常连接外网!!');
9 } 8 }
10 var gb_map_consts = { 9 var gb_map_consts = {
@@ -19,7 +18,7 @@ var gb_ct_map = function () { @@ -19,7 +18,7 @@ var gb_ct_map = function () {
19 * 地图状态 18 * 地图状态
20 * 1: 站点缓冲区编辑 19 * 1: 站点缓冲区编辑
21 */ 20 */
22 - var map_status=0; 21 + var map_status = 0;
23 var editCircle; 22 var editCircle;
24 var editPolygon; 23 var editPolygon;
25 var dragMarker; 24 var dragMarker;
@@ -29,7 +28,11 @@ var gb_ct_map = function () { @@ -29,7 +28,11 @@ var gb_ct_map = function () {
29 map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14); 28 map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14);
30 map.enableScrollWheelZoom(); 29 map.enableScrollWheelZoom();
31 30
32 - var roadPolylines = [], stationMarkers=[]; 31 + var stCtrl = new BMap.PanoramaControl(); //构造全景控件
  32 + stCtrl.setOffset(new BMap.Size(20, 20));
  33 + map.addControl(stCtrl);//添加全景控件
  34 +
  35 + var roadPolylines = [], stationMarkers = [];
33 var _render = function (cb) { 36 var _render = function (cb) {
34 //绘制路段 37 //绘制路段
35 _renderRoads(gb_road_route.getData()); 38 _renderRoads(gb_road_route.getData());
@@ -46,7 +49,7 @@ var gb_ct_map = function () { @@ -46,7 +49,7 @@ var gb_ct_map = function () {
46 }; 49 };
47 50
48 var updownColor = function (updown) { 51 var updownColor = function (updown) {
49 - return updown==0?'blue':'red'; 52 + return updown == 0 ? 'blue' : 'red';
50 }; 53 };
51 var _renderRoads = function (data) { 54 var _renderRoads = function (data) {
52 _renderPolyline(data[0], updownColor(0));//上行路段 55 _renderPolyline(data[0], updownColor(0));//上行路段
@@ -57,17 +60,17 @@ var gb_ct_map = function () { @@ -57,17 +60,17 @@ var gb_ct_map = function () {
57 _renderStationMarket(data[0]);//上行站点 60 _renderStationMarket(data[0]);//上行站点
58 _renderStationMarket(data[1]);//下行站点 61 _renderStationMarket(data[1]);//下行站点
59 }; 62 };
60 - 63 +
61 var _renderStationMarket = function (routes, color) { 64 var _renderStationMarket = function (routes, color) {
62 var marker; 65 var marker;
63 - var array=[]; 66 + var array = [];
64 $.each(routes, function (i) { 67 $.each(routes, function (i) {
65 this.index = i; 68 this.index = i;
66 transCoord(this); 69 transCoord(this);
67 - marker=createStationMark(this); 70 + marker = createStationMark(this);
68 marker.stationCode = this.stationCode; 71 marker.stationCode = this.stationCode;
69 marker.ct_data = this; 72 marker.ct_data = this;
70 - marker.ct_source='1'; 73 + marker.ct_source = '1';
71 map.addOverlay(marker); 74 map.addOverlay(marker);
72 75
73 array.push(marker); 76 array.push(marker);
@@ -84,8 +87,8 @@ var gb_ct_map = function () { @@ -84,8 +87,8 @@ var gb_ct_map = function () {
84 87
85 var _renderPolyline = function (routes, color) { 88 var _renderPolyline = function (routes, color) {
86 var pos, temps; 89 var pos, temps;
87 - var polyline, _pLines=[];  
88 - var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7}; 90 + var polyline, _pLines = [];
  91 + var style = {strokeWeight: 7, strokeColor: color, strokeOpacity: .7};
89 $.each(routes, function (i, item) { 92 $.each(routes, function (i, item) {
90 93
91 pos = []; 94 pos = [];
@@ -96,18 +99,18 @@ var gb_ct_map = function () { @@ -96,18 +99,18 @@ var gb_ct_map = function () {
96 polyline = new BMap.Polyline(pos, style); 99 polyline = new BMap.Polyline(pos, style);
97 polyline.ct_data = item; 100 polyline.ct_data = item;
98 polyline.ct_data.oldColor = color; 101 polyline.ct_data.oldColor = color;
99 - polyline.ct_source='1'; 102 + polyline.ct_source = '1';
100 map.addOverlay(polyline); 103 map.addOverlay(polyline);
101 104
102 - polyline.addEventListener('mouseover', function(){ 105 + polyline.addEventListener('mouseover', function () {
103 this.setStrokeColor('#20bd26'); 106 this.setStrokeColor('#20bd26');
104 }); 107 });
105 - polyline.addEventListener('mouseout', function(){  
106 - if(this!=road_win_show_p) 108 + polyline.addEventListener('mouseout', function () {
  109 + if (this != road_win_show_p)
107 this.setStrokeColor(color); 110 this.setStrokeColor(color);
108 }); 111 });
109 - polyline.addEventListener('click', function(e){  
110 - if(map_status!=1) 112 + polyline.addEventListener('click', function (e) {
  113 + if (map_status != 1)
111 openRoadInfoWin(this, e.point); 114 openRoadInfoWin(this, e.point);
112 }); 115 });
113 _pLines.push(polyline); 116 _pLines.push(polyline);
@@ -117,6 +120,7 @@ var gb_ct_map = function () { @@ -117,6 +120,7 @@ var gb_ct_map = function () {
117 }; 120 };
118 121
119 var road_win_show_p; 122 var road_win_show_p;
  123 +
120 function openRoadInfoWin(p, point) { 124 function openRoadInfoWin(p, point) {
121 var data = p.ct_data; 125 var data = p.ct_data;
122 var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data)); 126 var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data));
@@ -143,31 +147,18 @@ var gb_ct_map = function () { @@ -143,31 +147,18 @@ var gb_ct_map = function () {
143 147
144 //根据站点名称 计算marker 宽度 148 //根据站点名称 计算marker 宽度
145 var w = statio.stationName.length * 12 + 38 149 var w = statio.stationName.length * 12 + 38
146 - ,iw=w-2;  
147 - var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,25)}) 150 + , iw = w - 2;
  151 + var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw, 24), {anchor: new BMap.Size(iw / 2, 25)})
148 marker.setIcon(icon); 152 marker.setIcon(icon);
149 marker.setShadow(null); 153 marker.setShadow(null);
150 - //信息窗口  
151 - //var infoWin=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](statio), {offset: new BMap.Size(0,-13)});  
152 - //infoWin.ct_data = statio;//绑定数据  
153 - //marker.infoWin = infoWin;  
154 - marker.addEventListener('click', function(){  
155 - if(map_status!=1) 154 +
  155 + marker.addEventListener('click', function () {
  156 + if (map_status != 1)
156 openStationInfoWin(this); 157 openStationInfoWin(this);
157 - //map.openInfoWindow(this.infoWin, this.point);  
158 - });  
159 - //close event  
160 - /*infoWin.addEventListener('close', function (e) {  
161 - //if(map_status!=1)  
162 - gb_station_route.clearFocus();  
163 }); 158 });
164 - //open event  
165 - infoWin.addEventListener('open', function (e) {  
166 - gb_station_route.focus(this.ct_data);  
167 - });*/  
168 159
169 //mouseover 160 //mouseover
170 - marker.addEventListener('mouseover', function(){ 161 + marker.addEventListener('mouseover', function () {
171 setTop(this); 162 setTop(this);
172 }); 163 });
173 return marker; 164 return marker;
@@ -175,7 +166,7 @@ var gb_ct_map = function () { @@ -175,7 +166,7 @@ var gb_ct_map = function () {
175 166
176 var openStationInfoWin = function (m) { 167 var openStationInfoWin = function (m) {
177 //ct_data 168 //ct_data
178 - var win=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](m.ct_data), {offset: new BMap.Size(0,-13)}); 169 + var win = new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](m.ct_data), {offset: new BMap.Size(0, -13)});
179 //close event 170 //close event
180 win.addEventListener('close', function (e) { 171 win.addEventListener('close', function (e) {
181 gb_station_route.clearFocus(); 172 gb_station_route.clearFocus();
@@ -189,20 +180,21 @@ var gb_ct_map = function () { @@ -189,20 +180,21 @@ var gb_ct_map = function () {
189 }; 180 };
190 181
191 //绘制站点icon 182 //绘制站点icon
192 - function createStationIcon(station, w) { 183 + function createStationIcon(station, w, bg) {
193 var canvas = $('<canvas></canvas>')[0]; 184 var canvas = $('<canvas></canvas>')[0];
194 var ctx = canvas.getContext('2d'); 185 var ctx = canvas.getContext('2d');
195 186
196 - var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c'; 187 + if(!bg)
  188 + bg = station.directions == 0 ? '#5757fc' : '#fc4c4c';
197 //矩形 189 //矩形
198 //ctx.roundRect(0, 0, w, 17, 1).stroke(); 190 //ctx.roundRect(0, 0, w, 17, 1).stroke();
199 - ctx.lineWidth="3"; 191 + ctx.lineWidth = "3";
200 ctx.rect(0, 0, w - 2, 19); 192 ctx.rect(0, 0, w - 2, 19);
201 ctx.fillStyle = '#fff'; 193 ctx.fillStyle = '#fff';
202 ctx.fill(); 194 ctx.fill();
203 ctx.strokeStyle = bg; 195 ctx.strokeStyle = bg;
204 ctx.stroke(); 196 ctx.stroke();
205 - ctx.lineWidth="1"; 197 + ctx.lineWidth = "1";
206 198
207 //文字 199 //文字
208 ctx.font = "12px arial"; 200 ctx.font = "12px arial";
@@ -217,8 +209,11 @@ var gb_ct_map = function () { @@ -217,8 +209,11 @@ var gb_ct_map = function () {
217 209
218 ctx.font = "12px arial"; 210 ctx.font = "12px arial";
219 ctx.fillStyle = '#fff'; 211 ctx.fillStyle = '#fff';
220 - var i = station.index + 1;  
221 - var left = (i + '').length > 1?3:7; 212 +
  213 + var i = station.index;
  214 + if(!isNaN(i))
  215 + i ++;
  216 + var left = (i + '').length > 1 ? 3 : 7;
222 ctx.fillText(i, left, 14); 217 ctx.fillText(i, left, 14);
223 218
224 //角 219 //角
@@ -238,7 +233,7 @@ var gb_ct_map = function () { @@ -238,7 +233,7 @@ var gb_ct_map = function () {
238 233
239 var changeUpDown = function () { 234 var changeUpDown = function () {
240 var upDown = getUpDown(); 235 var upDown = getUpDown();
241 - $.each(roadPolylines[upDown==0?1:0], function () { 236 + $.each(roadPolylines[upDown == 0 ? 1 : 0], function () {
242 this.hide(); 237 this.hide();
243 }); 238 });
244 $.each(roadPolylines[upDown], function () { 239 $.each(roadPolylines[upDown], function () {
@@ -246,7 +241,7 @@ var gb_ct_map = function () { @@ -246,7 +241,7 @@ var gb_ct_map = function () {
246 }); 241 });
247 242
248 243
249 - $.each(stationMarkers[upDown==0?1:0], function () { 244 + $.each(stationMarkers[upDown == 0 ? 1 : 0], function () {
250 this.hide(); 245 this.hide();
251 }); 246 });
252 $.each(stationMarkers[upDown], function () { 247 $.each(stationMarkers[upDown], function () {
@@ -260,22 +255,22 @@ var gb_ct_map = function () { @@ -260,22 +255,22 @@ var gb_ct_map = function () {
260 */ 255 */
261 var focusStation = function (code, updown) { 256 var focusStation = function (code, updown) {
262 var marker = getStationMarker(code, updown); 257 var marker = getStationMarker(code, updown);
263 - if(marker){ 258 + if (marker) {
264 openStationInfoWin(marker); 259 openStationInfoWin(marker);
265 } 260 }
266 }; 261 };
267 - 262 +
268 var getStationMarker = function (code, updown) { 263 var getStationMarker = function (code, updown) {
269 var array = stationMarkers[updown], 264 var array = stationMarkers[updown],
270 marker; 265 marker;
271 - for(var i=0,m;m=array[i++];){  
272 - if(m.stationCode==code){ 266 + for (var i = 0, m; m = array[i++];) {
  267 + if (m.stationCode == code) {
273 marker = m; 268 marker = m;
274 break; 269 break;
275 } 270 }
276 } 271 }
277 return marker; 272 return marker;
278 - } 273 + };
279 274
280 /** 275 /**
281 * 定位到路段 276 * 定位到路段
@@ -285,8 +280,8 @@ var gb_ct_map = function () { @@ -285,8 +280,8 @@ var gb_ct_map = function () {
285 var focusRoad = function (code, updown) { 280 var focusRoad = function (code, updown) {
286 var array = roadPolylines[updown], 281 var array = roadPolylines[updown],
287 polyline; 282 polyline;
288 - for(var i=0,p;p=array[i++];){  
289 - if(p.ct_data.sectionCode==code){ 283 + for (var i = 0, p; p = array[i++];) {
  284 + if (p.ct_data.sectionCode == code) {
290 polyline = p; 285 polyline = p;
291 break; 286 break;
292 } 287 }
@@ -298,14 +293,14 @@ var gb_ct_map = function () { @@ -298,14 +293,14 @@ var gb_ct_map = function () {
298 293
299 var calcCenterPoint = function (coords) { 294 var calcCenterPoint = function (coords) {
300 var array = [], strs; 295 var array = [], strs;
301 - for(var i=0,item;item=coords[i++];){ 296 + for (var i = 0, item; item = coords[i++];) {
302 strs = item.split(' '); 297 strs = item.split(' ');
303 array.push({latitude: strs[1], longitude: strs[0]}); 298 array.push({latitude: strs[1], longitude: strs[0]});
304 } 299 }
305 300
306 return geolib.getCenter(array); 301 return geolib.getCenter(array);
307 }; 302 };
308 - 303 +
309 var exitEditBufferStatus = function (s) { 304 var exitEditBufferStatus = function (s) {
310 map_status = 0; 305 map_status = 0;
311 //enabledOtherElem(); 306 //enabledOtherElem();
@@ -338,14 +333,14 @@ var gb_ct_map = function () { @@ -338,14 +333,14 @@ var gb_ct_map = function () {
338 map.centerAndZoom(marker.point, 18); 333 map.centerAndZoom(marker.point, 18);
339 var bElem = openBufferOverlay(marker); 334 var bElem = openBufferOverlay(marker);
340 335
341 - if(s.shapesType=='r'){ 336 + if (s.shapesType == 'r') {
342 //lineupdate 337 //lineupdate
343 bElem.addEventListener('lineupdate', function (e) { 338 bElem.addEventListener('lineupdate', function (e) {
344 //console.log('lineupdatelineupdate 1111', e); 339 //console.log('lineupdatelineupdate 1111', e);
345 gb_station_route.reWriteEditPanel(e.target); 340 gb_station_route.reWriteEditPanel(e.target);
346 }); 341 });
347 } 342 }
348 - else if(s.shapesType=='d'){ 343 + else if (s.shapesType == 'd') {
349 //调整多边形 344 //调整多边形
350 345
351 } 346 }
@@ -360,13 +355,13 @@ var gb_ct_map = function () { @@ -360,13 +355,13 @@ var gb_ct_map = function () {
360 }; 355 };
361 356
362 var dragMarkerDragEvent = function () { 357 var dragMarkerDragEvent = function () {
363 - if(editPolygon){  
364 - if(!BMapLib.GeoUtils.isPointInPolygon(this.point, editPolygon)) 358 + if (editPolygon) {
  359 + if (!BMapLib.GeoUtils.isPointInPolygon(this.point, editPolygon))
365 dragMarker.setPosition(dragMarker._old_point);//还原位置 360 dragMarker.setPosition(dragMarker._old_point);//还原位置
366 361
367 gb_station_route.reWriteEditPanel(this, true); 362 gb_station_route.reWriteEditPanel(this, true);
368 } 363 }
369 - else if(editCircle){ 364 + else if (editCircle) {
370 editCircle.disableEditing(); 365 editCircle.disableEditing();
371 //缓冲区跟随点位运动 366 //缓冲区跟随点位运动
372 editCircle.setCenter(this.point); 367 editCircle.setCenter(this.point);
@@ -375,7 +370,7 @@ var gb_ct_map = function () { @@ -375,7 +370,7 @@ var gb_ct_map = function () {
375 }; 370 };
376 371
377 var reSetDragMarker = function () { 372 var reSetDragMarker = function () {
378 - if(dragMarker){ 373 + if (dragMarker) {
379 dragMarker.setPosition(dragMarker._old_point); 374 dragMarker.setPosition(dragMarker._old_point);
380 dragMarker.removeEventListener('dragging', dragMarkerDragEvent); 375 dragMarker.removeEventListener('dragging', dragMarkerDragEvent);
381 dragMarker.disableDragging(); 376 dragMarker.disableDragging();
@@ -384,9 +379,9 @@ var gb_ct_map = function () { @@ -384,9 +379,9 @@ var gb_ct_map = function () {
384 }; 379 };
385 380
386 381
387 -/* var removeDragMarkerEvent = function () {  
388 - dragMarker.removeEventListener('dragging', dragMarkerDragEvent);  
389 - };*/ 382 + /* var removeDragMarkerEvent = function () {
  383 + dragMarker.removeEventListener('dragging', dragMarkerDragEvent);
  384 + };*/
390 385
391 /** 386 /**
392 * 禁用其他元素 387 * 禁用其他元素
@@ -398,15 +393,15 @@ var gb_ct_map = function () { @@ -398,15 +393,15 @@ var gb_ct_map = function () {
398 var openBufferOverlay = function (m) { 393 var openBufferOverlay = function (m) {
399 var elem; 394 var elem;
400 var data = m.ct_data; 395 var data = m.ct_data;
401 - if(data.shapesType=='r'){  
402 - elem = new BMap.Circle(m.point,data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/}); 396 + if (data.shapesType == 'r') {
  397 + elem = new BMap.Circle(m.point, data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/});
403 editCircle = elem; 398 editCircle = elem;
404 } 399 }
405 - else if(data.shapesType=='d'){ 400 + else if (data.shapesType == 'd') {
406 var array = data.bdCoords; 401 var array = data.bdCoords;
407 var pos = []; 402 var pos = [];
408 var temp = []; 403 var temp = [];
409 - for(var i=0,c;c=array[i++];){ 404 + for (var i = 0, c; c = array[i++];) {
410 temp = c.split(' '); 405 temp = c.split(' ');
411 pos.push(new BMap.Point(temp[0], temp[1])); 406 pos.push(new BMap.Point(temp[0], temp[1]));
412 } 407 }
@@ -435,8 +430,9 @@ var gb_ct_map = function () { @@ -435,8 +430,9 @@ var gb_ct_map = function () {
435 } 430 }
436 431
437 var topOverlay; 432 var topOverlay;
438 - function setTop(overlay){  
439 - if(topOverlay) 433 +
  434 + function setTop(overlay) {
  435 + if (topOverlay)
440 topOverlay.setTop(false); 436 topOverlay.setTop(false);
441 overlay.setTop(true); 437 overlay.setTop(true);
442 topOverlay = overlay; 438 topOverlay = overlay;
@@ -450,8 +446,8 @@ var gb_ct_map = function () { @@ -450,8 +446,8 @@ var gb_ct_map = function () {
450 var changeShapeType = function (v) { 446 var changeShapeType = function (v) {
451 clearEditBuffer(); 447 clearEditBuffer();
452 448
453 - if(v == 'd'){  
454 - _drawingManager = new BMapLib.DrawingManager(map,{}); 449 + if (v == 'd') {
  450 + _drawingManager = new BMapLib.DrawingManager(map, {});
455 _drawingManager.open(); 451 _drawingManager.open();
456 _drawingManager.enableCalculate(); 452 _drawingManager.enableCalculate();
457 _drawingManager.setDrawingMode('polygon'); 453 _drawingManager.setDrawingMode('polygon');
@@ -462,7 +458,7 @@ var gb_ct_map = function () { @@ -462,7 +458,7 @@ var gb_ct_map = function () {
462 gb_station_route.drawEnd(); 458 gb_station_route.drawEnd();
463 }); 459 });
464 } 460 }
465 - else if(v == 'r'){ 461 + else if (v == 'r') {
466 updateDragRadius(80); 462 updateDragRadius(80);
467 463
468 //圆形编辑事件 reWriteEditPanel 464 //圆形编辑事件 reWriteEditPanel
@@ -470,13 +466,13 @@ var gb_ct_map = function () { @@ -470,13 +466,13 @@ var gb_ct_map = function () {
470 gb_station_route.reWriteEditPanel(e.target); 466 gb_station_route.reWriteEditPanel(e.target);
471 }); 467 });
472 /*map.removeOverlay(editCircle); 468 /*map.removeOverlay(editCircle);
473 - map.removeOverlay(editPolygon); 469 + map.removeOverlay(editPolygon);
474 470
475 - //以站点为中心,生成一个默认的圆  
476 - var marker = getStationMarker(s.stationCode, s.directions);  
477 - editCircle = new BMap.Circle(marker.point,s.radius?s.radius:50, {strokeColor: '#E91E63'});  
478 - editCircle.enableEditing();  
479 - map.addOverlay(editCircle);*/ 471 + //以站点为中心,生成一个默认的圆
  472 + var marker = getStationMarker(s.stationCode, s.directions);
  473 + editCircle = new BMap.Circle(marker.point,s.radius?s.radius:50, {strokeColor: '#E91E63'});
  474 + editCircle.enableEditing();
  475 + map.addOverlay(editCircle);*/
480 } 476 }
481 }; 477 };
482 478
@@ -488,13 +484,13 @@ var gb_ct_map = function () { @@ -488,13 +484,13 @@ var gb_ct_map = function () {
488 }; 484 };
489 485
490 var updateDragRadius = function (radius) { 486 var updateDragRadius = function (radius) {
491 - if(!editCircle){ 487 + if (!editCircle) {
492 clearOtherOverlay(); 488 clearOtherOverlay();
493 var s = gb_station_route.getRealEditStation(); 489 var s = gb_station_route.getRealEditStation();
494 490
495 //以站点为中心,生成一个默认的圆 491 //以站点为中心,生成一个默认的圆
496 var marker = getStationMarker(s.stationCode, s.directions); 492 var marker = getStationMarker(s.stationCode, s.directions);
497 - var circle = new BMap.Circle(marker.point,s.radius?s.radius:80, {strokeColor: '#E91E63'}); 493 + var circle = new BMap.Circle(marker.point, s.radius ? s.radius : 80, {strokeColor: '#E91E63'});
498 494
499 setTimeout(function () { 495 setTimeout(function () {
500 circle.enableEditing(); 496 circle.enableEditing();
@@ -508,14 +504,14 @@ var gb_ct_map = function () { @@ -508,14 +504,14 @@ var gb_ct_map = function () {
508 }; 504 };
509 505
510 var exitDrawStatus = function () { 506 var exitDrawStatus = function () {
511 - if(_drawingManager){ 507 + if (_drawingManager) {
512 clearOtherOverlay(); 508 clearOtherOverlay();
513 _drawingManager.close(); 509 _drawingManager.close();
514 } 510 }
515 }; 511 };
516 512
517 var openDrawStatus = function () { 513 var openDrawStatus = function () {
518 - if(_drawingManager){ 514 + if (_drawingManager) {
519 clearOtherOverlay(); 515 clearOtherOverlay();
520 _drawingManager.open(); 516 _drawingManager.open();
521 } 517 }
@@ -523,8 +519,8 @@ var gb_ct_map = function () { @@ -523,8 +519,8 @@ var gb_ct_map = function () {
523 519
524 var clearOtherOverlay = function () { 520 var clearOtherOverlay = function () {
525 var all = map.getOverlays(); 521 var all = map.getOverlays();
526 - for(var i=0,obj; obj=all[i++];){  
527 - if(obj.ct_source && obj.ct_source=='1') 522 + for (var i = 0, obj; obj = all[i++];) {
  523 + if (obj.ct_source && obj.ct_source == '1')
528 continue; 524 continue;
529 map.removeOverlay(obj); 525 map.removeOverlay(obj);
530 //obj = null; 526 //obj = null;
@@ -545,462 +541,85 @@ var gb_ct_map = function () { @@ -545,462 +541,85 @@ var gb_ct_map = function () {
545 541
546 //按名称定位地图位置 542 //按名称定位地图位置
547 var local = new BMap.LocalSearch(map, { 543 var local = new BMap.LocalSearch(map, {
548 - renderOptions:{map: map}, 544 + renderOptions: {map: map},
549 onMarkersSet: function (pos) { 545 onMarkersSet: function (pos) {
550 - console.log('onMarkersSet', pos); 546 + var old_m = pos[0].marker;
  547 + var point = old_m.point;
  548 + //清除默认的点
  549 + map.removeOverlay(old_m);
  550 + //进入新增点位 地图选点模式
  551 + startSearchPoint(point, name);
551 } 552 }
552 }); 553 });
  554 + local.setPageCapacity(1);
553 local.search(name + "-公交车站"); 555 local.search(name + "-公交车站");
554 }; 556 };
555 557
556 - res_load_ep.emitLater('load_map');  
557 - return {  
558 - _render: _render,  
559 - changeUpDown:changeUpDown,  
560 - focusStation: focusStation,  
561 - focusRoad: focusRoad,  
562 - editStationBuffer: editStationBuffer,  
563 - updateStation: updateStation,  
564 - exitEditBufferStatus: exitEditBufferStatus,  
565 - changeShapeType: changeShapeType,  
566 - exitDrawStatus: exitDrawStatus,  
567 - openDrawStatus: openDrawStatus,  
568 - getDrawPolygon: function () {  
569 - return editPolygon;  
570 - },  
571 - updateDragRadius: updateDragRadius,  
572 - closeInfoWin: closeInfoWin,  
573 - showAddPointPanel: showAddPointPanel,  
574 - resetMapStatus: function () {  
575 - map_status = 0;  
576 - }  
577 - };  
578 -=======  
579 -<!-- 地图操作 --> 558 + var a_s_p_maeker;
  559 + var startSearchPoint = function (point, name) {
  560 + var m = createYellowStation(point, name);
  561 + m.enableDragging();
  562 + map.addOverlay(m);
580 563
581 -var gb_ct_map = function () { 564 + _updateSearchPoint(m);
  565 + m.addEventListener('dragging', function () {
  566 + _updateSearchPoint(this);
  567 + });
582 568
583 - //初始化地图  
584 - if(!window.BMap){  
585 - alert('地图没有加载成功,请确认是否能正常连接外网!!');  
586 - }  
587 - var gb_map_consts = {  
588 - mapContainer: '#map_wrap',  
589 - center_point: {  
590 - lng: 121.544336,  
591 - lat: 31.221315  
592 - } 569 + //监听地图双击事件
  570 + map.disableDoubleClickZoom();
  571 + map.addEventListener('dblclick', pickupPoint);
  572 +
  573 + a_s_p_maeker = m;
593 }; 574 };
594 575
595 /** 576 /**
596 - * 地图状态  
597 - * 1: 站点缓冲区编辑 577 + * 拾取坐标点位
598 */ 578 */
599 - var map_status=0;  
600 - var editCircle;  
601 - var editPolygon;  
602 -  
603 - map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false});  
604 - //中心点和缩放级别  
605 - map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14);  
606 - map.enableScrollWheelZoom();  
607 -  
608 - var roadPolylines = [], stationMarkers=[];  
609 - var _render = function (cb) {  
610 - //绘制路段  
611 - _renderRoads(gb_road_route.getData());  
612 - //绘制站点  
613 - _renderStation(gb_station_route.getData());  
614 -  
615 - changeUpDown();  
616 -  
617 - //居中至上行中间站点  
618 - var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];  
619 - map.setCenter(cm.point);  
620 -  
621 - cb && cb();  
622 - };  
623 -  
624 - var updownColor = function (updown) {  
625 - return updown==0?'blue':'red';  
626 - };  
627 - var _renderRoads = function (data) {  
628 - _renderPolyline(data[0], updownColor(0));//上行路段  
629 - _renderPolyline(data[1], updownColor(1));//下行路段  
630 - };  
631 -  
632 - var _renderStation = function (data) {  
633 - _renderStationMarket(data[0]);//上行站点  
634 - _renderStationMarket(data[1]);//下行站点  
635 - };  
636 -  
637 - var _renderStationMarket = function (routes, color) {  
638 - var marker;  
639 - var array=[];  
640 - $.each(routes, function (i) {  
641 - this.index = i;  
642 - transCoord(this);  
643 - marker=createStationMark(this);  
644 - marker.stationCode = this.stationCode;  
645 - marker.ct_data = this;  
646 - map.addOverlay(marker); 579 + var pickupPoint = function (e) {
  580 + console.log('pickupPointpickupPoint', e);
  581 + var point = e.point;
647 582
648 - array.push(marker);  
649 - });  
650 -  
651 - stationMarkers.push(array); 583 + a_s_p_maeker.setPosition(point);
  584 + _updateSearchPoint(a_s_p_maeker);
652 }; 585 };
653 586
654 - function transCoord(obj) {  
655 - var coord = TransGPS.wgsToBD(obj.gLaty, obj.gLonx);  
656 - obj.bd_lat = coord.lat;  
657 - obj.bd_lon = coord.lng;  
658 - }  
659 -  
660 - var _renderPolyline = function (routes, color) {  
661 - var pos, temps;  
662 - var polyline, _pLines=[];  
663 - var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7};  
664 - $.each(routes, function (i, item) {  
665 -  
666 - pos = [];  
667 - $.each(item.bdCoords, function () {  
668 - temps = this.split(' ');  
669 - pos.push(new BMap.Point(temps[0], temps[1]));  
670 - });  
671 - polyline = new BMap.Polyline(pos, style);  
672 - polyline.ct_data = item;  
673 - polyline.ct_data.oldColor = color;  
674 - map.addOverlay(polyline);  
675 -  
676 - polyline.addEventListener('mouseover', function(){  
677 - this.setStrokeColor('#20bd26');  
678 - });  
679 - polyline.addEventListener('mouseout', function(){  
680 - if(this!=road_win_show_p)  
681 - this.setStrokeColor(color);  
682 - });  
683 - polyline.addEventListener('click', function(e){  
684 - if(map_status!=1)  
685 - openRoadInfoWin(this, e.point);  
686 - });  
687 - _pLines.push(polyline);  
688 - });  
689 -  
690 - roadPolylines.push(_pLines); 587 + var _updateSearchPoint = function (m) {
  588 + gb_station_route.reWriteSearchPointPanel(m.point);
691 }; 589 };
692 -  
693 - var road_win_show_p;  
694 - function openRoadInfoWin(p, point) {  
695 - var data = p.ct_data;  
696 - var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data));  
697 -  
698 - //close event  
699 - win.addEventListener('close', function (e) {  
700 - p.setStrokeColor(p.ct_data.oldColor);  
701 - gb_road_route.clearFocus();  
702 - road_win_show_p = null;  
703 - });  
704 - //open event  
705 - win.addEventListener('open', function (e) {  
706 - gb_road_route.focus(data);  
707 - p.setStrokeColor('#20bd26');  
708 - road_win_show_p = p;  
709 - });  
710 -  
711 - map.openInfoWindow(win, point);  
712 - }  
713 -  
714 - function createStationMark(statio) {  
715 - var point = new BMap.Point(statio.bd_lon, statio.bd_lat); 590 + /**
  591 + * 创建一个黄色的,带添加的站点marker
  592 + * @param point
  593 + * @returns {BMap.Marker}
  594 + */
  595 + function createYellowStation(point, name) {
716 var marker = new BMap.Marker(point); 596 var marker = new BMap.Marker(point);
717 597
718 //根据站点名称 计算marker 宽度 598 //根据站点名称 计算marker 宽度
719 - var w = statio.stationName.length * 12 + 38  
720 - ,iw=w-2;  
721 - var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,25)}) 599 + var w = name.length * 12 + 38
  600 + , iw = w - 2;
  601 + var icon = new BMap.Icon(createStationIcon({
  602 + stationName: name, index: '?'
  603 + }, w, '#ff9800'), new BMap.Size(iw, 24), {anchor: new BMap.Size(iw / 2, 25)});
722 marker.setIcon(icon); 604 marker.setIcon(icon);
723 marker.setShadow(null); 605 marker.setShadow(null);
724 - //信息窗口  
725 - //var infoWin=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](statio), {offset: new BMap.Size(0,-13)});  
726 - //infoWin.ct_data = statio;//绑定数据  
727 - //marker.infoWin = infoWin;  
728 - marker.addEventListener('click', function(){  
729 - if(map_status!=1) 606 +
  607 + marker.addEventListener('click', function () {
  608 + if (map_status != 1)
730 openStationInfoWin(this); 609 openStationInfoWin(this);
731 - //map.openInfoWindow(this.infoWin, this.point);  
732 - });  
733 - //close event  
734 - /*infoWin.addEventListener('close', function (e) {  
735 - //if(map_status!=1)  
736 - gb_station_route.clearFocus();  
737 }); 610 });
738 - //open event  
739 - infoWin.addEventListener('open', function (e) {  
740 - gb_station_route.focus(this.ct_data);  
741 - });*/  
742 611
743 //mouseover 612 //mouseover
744 - marker.addEventListener('mouseover', function(){ 613 + marker.addEventListener('mouseover', function () {
745 setTop(this); 614 setTop(this);
746 }); 615 });
747 return marker; 616 return marker;
748 } 617 }
749 618
750 - var openStationInfoWin = function (m) {  
751 - //ct_data  
752 - var win=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](m.ct_data), {offset: new BMap.Size(0,-13)});  
753 - //close event  
754 - win.addEventListener('close', function (e) {  
755 - gb_station_route.clearFocus();  
756 - });  
757 - //open event  
758 - win.addEventListener('open', function (e) {  
759 - gb_station_route.focus(m.ct_data);  
760 - });  
761 -  
762 - map.openInfoWindow(win, m.point);  
763 - };  
764 -  
765 - //绘制站点icon  
766 - function createStationIcon(station, w) {  
767 - var canvas = $('<canvas></canvas>')[0];  
768 - var ctx = canvas.getContext('2d');  
769 -  
770 - var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c';  
771 - //矩形  
772 - //ctx.roundRect(0, 0, w, 17, 1).stroke();  
773 - ctx.lineWidth="3";  
774 - ctx.rect(0, 0, w - 2, 19);  
775 - ctx.fillStyle = '#fff';  
776 - ctx.fill();  
777 - ctx.strokeStyle = bg;  
778 - ctx.stroke();  
779 - ctx.lineWidth="1";  
780 -  
781 - //文字  
782 - ctx.font = "12px arial";  
783 - ctx.fillStyle = '#000';  
784 - ctx.fillText(station.stationName, 27, 14);  
785 -  
786 - //序号  
787 - ctx.beginPath();  
788 - ctx.rect(0, 0, 20, 19);  
789 - ctx.fillStyle = bg;  
790 - ctx.fill();  
791 -  
792 - ctx.font = "12px arial";  
793 - ctx.fillStyle = '#fff';  
794 - var i = station.index + 1;  
795 - var left = (i + '').length > 1?3:7;  
796 - ctx.fillText(i, left, 14);  
797 -  
798 - //角  
799 - var c = w / 2;  
800 - ctx.beginPath();  
801 - ctx.moveTo(c - 7, 16);  
802 - ctx.lineTo(c, 24);  
803 - ctx.lineTo(c + 7, 16);  
804 - ctx.closePath();  
805 -  
806 - ctx.fillStyle = bg;  
807 - ctx.fill();  
808 - ctx.strokeStyle = '#fff';  
809 - ctx.stroke();  
810 - return canvas.toDataURL();  
811 - }  
812 -  
813 - var changeUpDown = function () {  
814 - var upDown = getUpDown();  
815 - $.each(roadPolylines[upDown==0?1:0], function () {  
816 - this.hide();  
817 - });  
818 - $.each(roadPolylines[upDown], function () {  
819 - this.show();  
820 - });  
821 -  
822 -  
823 - $.each(stationMarkers[upDown==0?1:0], function () {  
824 - this.hide();  
825 - });  
826 - $.each(stationMarkers[upDown], function () {  
827 - this.show();  
828 - });  
829 - };  
830 -  
831 - /**  
832 - * 定位到站点  
833 - * @param code  
834 - */  
835 - var focusStation = function (code, updown) {  
836 - var marker = getStationMarker(code, updown);  
837 - if(marker){  
838 - openStationInfoWin(marker);  
839 - }  
840 - };  
841 -  
842 - var getStationMarker = function (code, updown) {  
843 - var array = stationMarkers[updown],  
844 - marker;  
845 - for(var i=0,m;m=array[i++];){  
846 - if(m.stationCode==code){  
847 - marker = m;  
848 - break;  
849 - }  
850 - }  
851 - return marker;  
852 - }  
853 -  
854 - /**  
855 - * 定位到路段  
856 - * @param code  
857 - * @param updown  
858 - */  
859 - var focusRoad = function (code, updown) {  
860 - var array = roadPolylines[updown],  
861 - polyline;  
862 - for(var i=0,p;p=array[i++];){  
863 - if(p.ct_data.sectionCode==code){  
864 - polyline = p;  
865 - break;  
866 - }  
867 - }  
868 -  
869 - var cp = calcCenterPoint(p.ct_data.bdCoords);  
870 - openRoadInfoWin(p, new BMap.Point(cp.longitude, cp.latitude));  
871 - }  
872 -  
873 - var calcCenterPoint = function (coords) {  
874 - var array = [], strs;  
875 - for(var i=0,item;item=coords[i++];){  
876 - strs = item.split(' ');  
877 - array.push({latitude: strs[1], longitude: strs[0]});  
878 - }  
879 -  
880 - return geolib.getCenter(array);  
881 - }  
882 -  
883 - var exitEditBufferStatus = function (s) {  
884 - map_status = 0;  
885 - enabledOtherElem();  
886 - gb_station_route.hideEditPanel();  
887 -  
888 - map.removeOverlay(editCircle);  
889 -  
890 - openStationInfoWin(getStationMarker(s.stationCode, s.directions));  
891 - };  
892 -  
893 - /**  
894 - * 编辑站点缓冲区  
895 - * @param station  
896 - */  
897 - var editStationBuffer = function (s) {  
898 - map_status = 1;  
899 - map.closeInfoWindow();//关闭infoWindow  
900 - gb_station_route.clearFocus();  
901 - gb_station_route.focus(s);  
902 - clearOldOverlay();  
903 - disabledOtherElem();  
904 - gb_station_route.showEditPanel(s);  
905 -  
906 - var marker = getStationMarker(s.stationCode, s.directions);  
907 - map.centerAndZoom(marker.point, 18);  
908 - var bElem = openBufferOverlay(marker);  
909 -  
910 - if(s.shapesType=='r'){  
911 - //lineupdate  
912 - bElem.addEventListener('lineupdate', function (e) {  
913 - //console.log('lineupdatelineupdate', e);  
914 - //var ec = e.target;  
915 - //var radius = ec.getRadius().toFixed(2);  
916 - //console.log('getRadius', ec.getRadius(), radius);  
917 - gb_station_route.reWriteEditPanel(e.target);  
918 - });  
919 - }  
920 - };  
921 -  
922 - var clearOldOverlay = function () {  
923 - map.removeOverlay(editCircle);  
924 - map.removeOverlay(editPolygon);  
925 - }  
926 -  
927 - /**  
928 - * 禁用其他元素  
929 - */  
930 - var disabledOtherElem = function () {  
931 - $('.main_left_panel_m_layer').show();  
932 - }  
933 -  
934 - var enabledOtherElem = function () {  
935 - $('.main_left_panel_m_layer').hide();  
936 - }  
937 -  
938 - var openBufferOverlay = function (m) {  
939 - var elem;  
940 - var data = m.ct_data;  
941 - if(data.shapesType=='r'){  
942 - var circle = new BMap.Circle(m.point,data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/});  
943 - map.addOverlay(circle);  
944 - circle.enableEditing();  
945 - }  
946 - editCircle = circle;  
947 - return circle;  
948 - };  
949 -  
950 - /**  
951 - * 更新站点  
952 - * @param s  
953 - */  
954 - function updateStation(s) {  
955 - var m = getStationMarker(s.stationCode, s.directions);  
956 - //更新位置  
957 - transCoord(s);  
958 - m.ct_data = s;  
959 - m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat));  
960 - }  
961 -  
962 - var topOverlay;  
963 - function setTop(overlay){  
964 - if(topOverlay)  
965 - topOverlay.setTop(false);  
966 - overlay.setTop(true);  
967 - topOverlay = overlay;  
968 - }  
969 -  
970 - /**  
971 - * 切换缓冲区类型  
972 - * @param v  
973 - */  
974 - var _drawingManager;  
975 - var changeShapeType = function (v) {  
976 - if(v == 'd'){  
977 - map.removeOverlay(editCircle);  
978 -  
979 - _drawingManager = new BMapLib.DrawingManager(map,{});  
980 - _drawingManager.open();  
981 - _drawingManager.setDrawingMode('polygon');  
982 -  
983 - //绘制结束事件  
984 - _drawingManager.addEventListener('polygoncomplete', function (e) {  
985 - console.log('end ', e);  
986 - gb_station_route.drawEnd();  
987 - });  
988 - }  
989 - };  
990 -  
991 - var exitDrawStatus = function () {  
992 - if(_drawingManager)  
993 - _drawingManager.close();  
994 - };  
995 -  
996 - var openDrawStatus = function () {  
997 - if(_drawingManager)  
998 - _drawingManager.open();  
999 - };  
1000 res_load_ep.emitLater('load_map'); 619 res_load_ep.emitLater('load_map');
1001 return { 620 return {
1002 _render: _render, 621 _render: _render,
1003 - changeUpDown:changeUpDown, 622 + changeUpDown: changeUpDown,
1004 focusStation: focusStation, 623 focusStation: focusStation,
1005 focusRoad: focusRoad, 624 focusRoad: focusRoad,
1006 editStationBuffer: editStationBuffer, 625 editStationBuffer: editStationBuffer,
@@ -1008,7 +627,18 @@ var gb_ct_map = function () { @@ -1008,7 +627,18 @@ var gb_ct_map = function () {
1008 exitEditBufferStatus: exitEditBufferStatus, 627 exitEditBufferStatus: exitEditBufferStatus,
1009 changeShapeType: changeShapeType, 628 changeShapeType: changeShapeType,
1010 exitDrawStatus: exitDrawStatus, 629 exitDrawStatus: exitDrawStatus,
1011 - openDrawStatus: openDrawStatus 630 + openDrawStatus: openDrawStatus,
  631 + getDrawPolygon: function () {
  632 + return editPolygon;
  633 + },
  634 + updateDragRadius: updateDragRadius,
  635 + closeInfoWin: closeInfoWin,
  636 + showAddPointPanel: showAddPointPanel,
  637 + resetMapStatus: function () {
  638 + map_status = 0;
  639 + clearOtherOverlay();
  640 + map.removeEventListener('dblclick', pickupPoint);
  641 + map.enableDoubleClickZoom();
  642 + }
1012 }; 643 };
1013 ->>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f  
1014 }(); 644 }();
1015 \ No newline at end of file 645 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
1 -<<<<<<< HEAD  
2 <!-- 站点路由 --> 1 <!-- 站点路由 -->
3 var gb_station_route = function () { 2 var gb_station_route = function () {
4 3
@@ -11,7 +10,6 @@ var gb_station_route = function () { @@ -11,7 +10,6 @@ var gb_station_route = function () {
11 var ep = EventProxy.create("data", "temp", function (data, temp) { 10 var ep = EventProxy.create("data", "temp", function (data, temp) {
12 station_maps = data; 11 station_maps = data;
13 temps = temp; 12 temps = temp;
14 - console.log('station', station_maps);  
15 //渲染页面 13 //渲染页面
16 var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]}); 14 var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]});
17 $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); 15 $('.up_down_route_list>li:first>.station_route').html(upHtmlStr);
@@ -51,7 +49,7 @@ var gb_station_route = function () { @@ -51,7 +49,7 @@ var gb_station_route = function () {
51 }; 49 };
52 50
53 var focus = function (s) { 51 var focus = function (s) {
54 - var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode); 52 + var elem = $('.up_down_route_list>li>.station_route .s_r_item[data-code='+s.stationCode+']');
55 elem.addClass('ct_active'); 53 elem.addClass('ct_active');
56 54
57 if (!isShow(elem)) { 55 if (!isShow(elem)) {
@@ -97,9 +95,10 @@ var gb_station_route = function () { @@ -97,9 +95,10 @@ var gb_station_route = function () {
97 }; 95 };
98 96
99 var getStationLI = function (s) { 97 var getStationLI = function (s) {
100 - return $('.up_down_route_list>li:eq('+s.directions+')>.station_route .station_li_' + s.stationCode); 98 + return $('.up_down_route_list>li:eq('+s.directions+')>.station_route .s_r_item[data-code='+s.stationCode+']');
101 }; 99 };
102 100
  101 + var addPrevId;//添加站点路由的上一个站点ID
103 var insert_station_before = function (station) { 102 var insert_station_before = function (station) {
104 //在之前插入站点 103 //在之前插入站点
105 var cell = getStationLI(station); 104 var cell = getStationLI(station);
@@ -125,6 +124,13 @@ var gb_station_route = function () { @@ -125,6 +124,13 @@ var gb_station_route = function () {
125 $('.main_left_panel_m_layer').show(); 124 $('.main_left_panel_m_layer').show();
126 gb_ct_map.showAddPointPanel(name); 125 gb_ct_map.showAddPointPanel(name);
127 }); 126 });
  127 +
  128 + //上一个站点的ID
  129 + var $prev = addCell.prev('.s_r_item');
  130 + if($prev.length > 0)
  131 + addPrevId = $prev.data('id');
  132 + else
  133 + addPrevId = -1;
128 }; 134 };
129 135
130 var realEditStation; 136 var realEditStation;
@@ -176,8 +182,8 @@ var gb_station_route = function () { @@ -176,8 +182,8 @@ var gb_station_route = function () {
176 var edPanelRunFlag; 182 var edPanelRunFlag;
177 var ecObj; 183 var ecObj;
178 var reWriteEditPanel = function (ec, isPolygon) { 184 var reWriteEditPanel = function (ec, isPolygon) {
  185 + ecObj = ec;
179 if(edPanelRunFlag){ 186 if(edPanelRunFlag){
180 - ecObj = ec;  
181 return; 187 return;
182 } 188 }
183 189
@@ -195,7 +201,7 @@ var gb_station_route = function () { @@ -195,7 +201,7 @@ var gb_station_route = function () {
195 $('[name=gLaty]', panel).val(p.lat); 201 $('[name=gLaty]', panel).val(p.lat);
196 $('[name=gLonx]', panel).val(p.lng); 202 $('[name=gLonx]', panel).val(p.lng);
197 edPanelRunFlag = false; 203 edPanelRunFlag = false;
198 - }, 170); 204 + }, 200);
199 }; 205 };
200 206
201 var update = function (s) { 207 var update = function (s) {
@@ -294,234 +300,25 @@ var gb_station_route = function () { @@ -294,234 +300,25 @@ var gb_station_route = function () {
294 $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制'); 300 $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制');
295 }; 301 };
296 302
297 - res_load_ep.emitLater('load_station_route');  
298 - return {  
299 - init: init,  
300 - getData: function () {  
301 - return station_maps;  
302 - },  
303 - getTemps: function () {  
304 - return temps;  
305 - },  
306 - clearFocus: clearFocus,  
307 - focus: focus,  
308 - showEditPanel: showEditPanel,  
309 - reWriteEditPanel: reWriteEditPanel,  
310 - update: update,  
311 - drawEnd: drawEnd,  
312 - getRealEditStation: function () {  
313 - return realEditStation;  
314 - }  
315 - };  
316 -=======  
317 -<!-- 站点路由 -->  
318 -var gb_station_route = function () {  
319 -  
320 - var temps;  
321 - var station_maps;  
322 - //绘制线路路由  
323 - var init = function (cb) {  
324 - var lineCode = storage.getItem("geo_data_edit_line_code");  
325 -  
326 - var ep = EventProxy.create("data", "temp", function (data, temp) {  
327 - station_maps = data;  
328 - temps = temp;  
329 - console.log('station', station_maps);  
330 - //渲染页面  
331 - var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]});  
332 - $('.up_down_route_list>li:first>.station_route').html(upHtmlStr);  
333 - var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]});  
334 - $('.up_down_route_list>li:last>.station_route').html(downHtmlStr);  
335 -  
336 - cb && cb();  
337 - });  
338 -  
339 - //加载数据  
340 - gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode}, function (rs) {  
341 - rs.list.sort(function (a, b) {  
342 - return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode);  
343 - });  
344 - ep.emit('data', gb_common.groupBy(rs.list, 'directions'));  
345 - });  
346 -  
347 - //加载模板片段  
348 - $.get('/pages/base/geo_data_edit/fragments/f_station_route.html', function (dom) {  
349 - ep.emit('temp', gb_common.compileTempByDom(dom, {  
350 - compress: true  
351 - }));  
352 - });  
353 - };  
354 -  
355 - //站点单击  
356 - $('.up_down_route_list>li>.station_route').on('click', 'a[data-code]', function () {  
357 - var code = $(this).data('code'),  
358 - updown = $(this).data('updown');  
359 -  
360 - clearFocus();  
361 - gb_ct_map.focusStation(code, updown);  
362 - });  
363 -  
364 - var clearFocus = function () {  
365 - $('.up_down_route_list>li>.station_route li.ct_active').removeClass('ct_active');  
366 - };  
367 -  
368 - var focus = function (s) {  
369 - var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode);  
370 - elem.addClass('ct_active');  
371 -  
372 - if (!isShow(elem)) {  
373 - //定位滚动条  
374 - var cont = $('.up_down_route_list'),  
375 - diff = cont.height() / 2;  
376 - cont.animate({  
377 - scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff  
378 - }, 500);  
379 - }  
380 - };  
381 -  
382 - var isShow = function (elem) {  
383 - var wrap = $('.up_down_route_list');  
384 - return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122;  
385 - };  
386 -  
387 - var getStation = function (code, updown) {  
388 - var array = station_maps[updown];  
389 - for(var i=0,s;s=array[i++];){  
390 - if(s.stationCode==code)  
391 - return s;  
392 - }  
393 - return null;  
394 - };  
395 -  
396 - var callbackHandler = {  
397 - edit_buffer: function (station) {  
398 - //编辑缓冲区  
399 - gb_ct_map.editStationBuffer(station);  
400 - }  
401 - };  
402 303
403 - $.contextMenu({  
404 - selector: '._route_info_wrap .up_down_route_list .station_route>ul>li',  
405 - className: 'station-route-ct-menu',  
406 - callback: function (key, options) {  
407 - var aLink = options.$trigger.find('a[data-code]');  
408 - var code = aLink.data('code'),  
409 - updown = aLink.data('updown');  
410 - var station = getStation(code, updown);  
411 - callbackHandler[key] && callbackHandler[key](station);  
412 - },  
413 - items: {  
414 - 'edit_buffer': {  
415 - name: '编辑缓冲区'  
416 - },  
417 - 'sep1': '---------',  
418 - 'edit': {  
419 - name: '编辑基础信息'  
420 - },  
421 - 'insert_before': {  
422 - name: '新增站点(前)'  
423 - },  
424 - 'insert_after': {  
425 - name: '新增站点(后)'  
426 - }  
427 - }  
428 - });  
429 -  
430 - var showEditPanel = function (s) {  
431 - var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s);  
432 - $('.ct_page').append(htmlStr);  
433 - $('.buffer_edit_panel').show();  
434 - };  
435 -  
436 - var hideEditPanel = function () {  
437 - $('.buffer_edit_panel').remove();  
438 - };  
439 -  
440 - var edPanelRunFlag;  
441 - var ecObj;  
442 - var reWriteEditPanel = function (ec) {  
443 - if(edPanelRunFlag){  
444 - ecObj = ec; 304 + var spcPanelRunFlag;
  305 + var spcPoint;
  306 + var reWriteSearchPointPanel = function (point) {
  307 + spcPoint = point;
  308 + if(spcPanelRunFlag){
445 return; 309 return;
446 } 310 }
447 311
448 - edPanelRunFlag = true; 312 + spcPanelRunFlag = true;
449 setTimeout(function () { 313 setTimeout(function () {
450 - var panel = $('.buffer_edit_panel');  
451 - $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径 314 + var panel = $('.add_station_search_point_wrap .buffer_edit_body');
452 315
453 - var p = ecObj.getCenter();  
454 - $('[name=gLaty]', panel).val(p.lat);  
455 - $('[name=gLonx]', panel).val(p.lng);  
456 - edPanelRunFlag = false;  
457 - }, 170); 316 + $('[name=gLaty]', panel).val(spcPoint.lat);
  317 + $('[name=gLonx]', panel).val(spcPoint.lng);
  318 + spcPanelRunFlag = false;
  319 + }, 200);
458 }; 320 };
459 321
460 - var update = function (s) {  
461 - var array = station_maps[s.directions];  
462 - for(var i=0,item; item=array[i++];){  
463 - if(item.stationCode==s.stationCode){  
464 - s.index = i;  
465 - array.splice(i, 1, s);  
466 - break;  
467 - }  
468 - }  
469 - };  
470 -  
471 - /**  
472 - * 缓冲区编辑 取消  
473 - */  
474 - $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.cancel', function (e) {  
475 - var f = $(this).parents('form');  
476 - var data = f.serializeJSON();  
477 -  
478 - gb_ct_map.exitEditBufferStatus(data);  
479 - });  
480 -  
481 - /**  
482 - * 缓冲区编辑 切换缓冲区类型(圆形,多边形)  
483 - */  
484 - $(document).on('click', '.buffer_edit_panel>.buffer_edit_body select[name=shapesType]', function (e) {  
485 - var v = $(this).val();  
486 -  
487 - gb_ct_map.changeShapeType(v);  
488 - if(v=='d'){  
489 - $('.buffer_edit_panel .shapes_type').addClass('st_d');  
490 -  
491 -  
492 - //  
493 - //UIkit.notification("使用鼠标在地图上绘制多边形,可点击上发“暂停绘制”链接,退出绘制模式,以拖拽地图", {status: 'primary', pos: 'bottom-center'})  
494 - }  
495 - else{  
496 - $('.buffer_edit_panel .shapes_type').removeClass('st_d');  
497 - }  
498 - });  
499 -  
500 - /**  
501 - * 缓冲区编辑 切换绘制模式  
502 - */  
503 - var drawPolygonSwitch = '.buffer_edit_panel>.buffer_edit_body .draw_polygon_switch';  
504 - $(document).on('click', drawPolygonSwitch, function (e) {  
505 - var type = $(this).data('type');  
506 - if(type==1){  
507 - //退出绘制状态  
508 - gb_ct_map.exitDrawStatus();  
509 - $(this).data('type', 0).find('a').text('开始绘制');  
510 - }  
511 - else if(type==0 || type==2){  
512 - gb_ct_map.openDrawStatus();  
513 - $(this).data('type', 1).find('a').text('暂停绘制');  
514 - }  
515 - });  
516 -  
517 - /**  
518 - * 绘制结束  
519 - */  
520 - var drawEnd = function () {  
521 - $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制');  
522 - };  
523 -  
524 -  
525 res_load_ep.emitLater('load_station_route'); 322 res_load_ep.emitLater('load_station_route');
526 return { 323 return {
527 init: init, 324 init: init,
@@ -534,10 +331,15 @@ var gb_station_route = function () { @@ -534,10 +331,15 @@ var gb_station_route = function () {
534 clearFocus: clearFocus, 331 clearFocus: clearFocus,
535 focus: focus, 332 focus: focus,
536 showEditPanel: showEditPanel, 333 showEditPanel: showEditPanel,
537 - hideEditPanel: hideEditPanel,  
538 reWriteEditPanel: reWriteEditPanel, 334 reWriteEditPanel: reWriteEditPanel,
539 update: update, 335 update: update,
540 - drawEnd: drawEnd 336 + drawEnd: drawEnd,
  337 + getRealEditStation: function () {
  338 + return realEditStation;
  339 + },
  340 + reWriteSearchPointPanel: reWriteSearchPointPanel,
  341 + getAddPrevId: function () {
  342 + return addPrevId;
  343 + }
541 }; 344 };
542 ->>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f  
543 }(); 345 }();
544 \ No newline at end of file 346 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
1 -<<<<<<< HEAD  
2 /** 1 /**
3 * 事件代理,提交数据 2 * 事件代理,提交数据
4 */ 3 */
@@ -61,45 +60,29 @@ var gb_data_submit = function () { @@ -61,45 +60,29 @@ var gb_data_submit = function () {
61 }); 60 });
62 }); 61 });
63 62
64 - var show_run_text = function (t) {  
65 - $('.text', $loadPanel).text(t);  
66 - $loadPanel.show();  
67 - };  
68 -  
69 - var hide_run_text = function () {  
70 - $('.text', $loadPanel).text('');  
71 - $loadPanel.hide();  
72 - };  
73 - return {};  
74 -=======  
75 -/**  
76 - * 事件代理,提交数据  
77 - */  
78 -var gb_data_submit = function () {  
79 -  
80 /** 63 /**
81 - * 缓冲区编辑提交 64 + * 新增站点提交
82 */ 65 */
83 - $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.submit', function (e) { 66 + $(document).on('click', '.add_station_search_point_wrap .buffer_edit_body button.submit', function (e) {
84 var f = $(this).parents('form'); 67 var f = $(this).parents('form');
85 var data = f.serializeJSON(); 68 var data = f.serializeJSON();
86 - UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() {  
87 69
88 - //console.log('aaa',f, f.serializeJSON());  
89 - show_run_text('正在提交缓冲区信息');  
90 - gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) {  
91 - hide_run_text();  
92 - UIkit.notification("提交成功!", {status: 'success'}); 70 + UIkit.modal.confirm('确定新增站点【'+data.stationName+'】?').then(function() {
  71 + data.lineCode = storage.getItem('geo_data_edit_line_code');
  72 + data.versions = storage.getItem('geo_data_edit_line_version');
  73 + data.upDown = getUpDown();
  74 + data.prevRouteId = gb_station_route.getAddPrevId();
  75 + data.lng = data.gLonx;
  76 + data.lat = data.gLaty;
93 77
94 - //更新前端数据  
95 - gb_station_route.update(rs.station);  
96 - gb_ct_map.updateStation(rs.station);  
97 -  
98 - //退出编辑模式  
99 - gb_ct_map.exitEditBufferStatus(rs.station); 78 + delete data.gLonx;
  79 + delete data.gLaty;
  80 + //console.log('data', data);
  81 + //添加
  82 + gb_common.$post('/_geo_data/addNewStationRoute', data, function (rs) {
  83 + hide_run_text();
  84 + UIkit.notification("修改成功!", {status: 'success'});
100 }); 85 });
101 - }, function () {  
102 - console.log('Rejected.')  
103 }); 86 });
104 return false; 87 return false;
105 }); 88 });
@@ -113,6 +96,9 @@ var gb_data_submit = function () { @@ -113,6 +96,9 @@ var gb_data_submit = function () {
113 $('.text', $loadPanel).text(''); 96 $('.text', $loadPanel).text('');
114 $loadPanel.hide(); 97 $loadPanel.hide();
115 }; 98 };
  99 +
  100 + function getUpDown(){
  101 + return $('._route_info_wrap>ul>li:first').hasClass('uk-active')?0:1;
  102 + }
116 return {}; 103 return {};
117 ->>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f  
118 }(); 104 }();
119 \ No newline at end of file 105 \ No newline at end of file
src/main/resources/static/pages/base/geo_data_edit/main.html
@@ -109,6 +109,7 @@ @@ -109,6 +109,7 @@
109 //___________________________________ 109 //___________________________________
110 var storage = window.localStorage; 110 var storage = window.localStorage;
111 storage.setItem("geo_data_edit_line_code" , "70123"); 111 storage.setItem("geo_data_edit_line_code" , "70123");
  112 + storage.setItem("geo_data_edit_line_version" , "1");
112 //___________________________________ 113 //___________________________________
113 114
114 top.document.title = "绘制线路"; 115 top.document.title = "绘制线路";
@@ -119,7 +120,7 @@ @@ -119,7 +120,7 @@
119 window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); 120 window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen');
120 }); 121 });
121 122
122 - var gb_main_ep = new EventProxy() 123 + var gb_main_ep = new EventProxy();
123 //文件加载 124 //文件加载
124 var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' 125 var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route'
125 , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { 126 , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () {