Commit d875f564dd8e699c425e9f54aaba5c659a9e56e6
1 parent
07705a0a
update...
Showing
15 changed files
with
1153 additions
and
73 deletions
src/main/java/com/bsth/controller/geo_data/GeoDataController.java
| 1 | package com.bsth.controller.geo_data; | 1 | package com.bsth.controller.geo_data; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.geo_data.GeoStation; | ||
| 3 | import com.bsth.service.geo_data.GeoDataService; | 4 | import com.bsth.service.geo_data.GeoDataService; |
| 4 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 6 | import org.springframework.web.bind.annotation.RequestParam; | 8 | import org.springframework.web.bind.annotation.RequestParam; |
| 7 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
| 8 | 10 | ||
| @@ -28,4 +30,9 @@ public class GeoDataController { | @@ -28,4 +30,9 @@ public class GeoDataController { | ||
| 28 | public Map<String, Object> findGeoRoad(@RequestParam String lineCode){ | 30 | public Map<String, Object> findGeoRoad(@RequestParam String lineCode){ |
| 29 | return geoDataService.findGeoRoad(lineCode); | 31 | return geoDataService.findGeoRoad(lineCode); |
| 30 | } | 32 | } |
| 33 | + | ||
| 34 | + @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST) | ||
| 35 | + public Map<String, Object> updateBufferInfo(GeoStation station){ | ||
| 36 | + return geoDataService.updateBufferInfo(station); | ||
| 37 | + } | ||
| 31 | } | 38 | } |
src/main/java/com/bsth/entity/geo_data/GeoRoad.java
| 1 | package com.bsth.entity.geo_data; | 1 | package com.bsth.entity.geo_data; |
| 2 | 2 | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 3 | /** | 7 | /** |
| 4 | * Created by panzhao on 2017/12/8. | 8 | * Created by panzhao on 2017/12/8. |
| 5 | */ | 9 | */ |
| @@ -21,8 +25,11 @@ public class GeoRoad { | @@ -21,8 +25,11 @@ public class GeoRoad { | ||
| 21 | 25 | ||
| 22 | private String crosesRoad; | 26 | private String crosesRoad; |
| 23 | 27 | ||
| 28 | + @JsonIgnore | ||
| 24 | private String gsectionVector; | 29 | private String gsectionVector; |
| 25 | 30 | ||
| 31 | + private List<String> bdCoords; | ||
| 32 | + | ||
| 26 | public int getId() { | 33 | public int getId() { |
| 27 | return id; | 34 | return id; |
| 28 | } | 35 | } |
| @@ -94,4 +101,12 @@ public class GeoRoad { | @@ -94,4 +101,12 @@ public class GeoRoad { | ||
| 94 | public void setGsectionVector(String gsectionVector) { | 101 | public void setGsectionVector(String gsectionVector) { |
| 95 | this.gsectionVector = gsectionVector; | 102 | this.gsectionVector = gsectionVector; |
| 96 | } | 103 | } |
| 104 | + | ||
| 105 | + public List<String> getBdCoords() { | ||
| 106 | + return bdCoords; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setBdCoords(List<String> bdCoords) { | ||
| 110 | + this.bdCoords = bdCoords; | ||
| 111 | + } | ||
| 97 | } | 112 | } |
src/main/java/com/bsth/service/geo_data/GeoDataService.java
| 1 | package com.bsth.service.geo_data; | 1 | package com.bsth.service.geo_data; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.geo_data.GeoStation; | ||
| 4 | + | ||
| 3 | import java.util.Map; | 5 | import java.util.Map; |
| 4 | 6 | ||
| 5 | /** | 7 | /** |
| @@ -12,4 +14,6 @@ public interface GeoDataService { | @@ -12,4 +14,6 @@ public interface GeoDataService { | ||
| 12 | 14 | ||
| 13 | 15 | ||
| 14 | Map<String, Object> findGeoRoad(String lineCode); | 16 | Map<String, Object> findGeoRoad(String lineCode); |
| 17 | + | ||
| 18 | + Map<String,Object> updateBufferInfo(GeoStation station); | ||
| 15 | } | 19 | } |
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
| @@ -4,6 +4,8 @@ import com.bsth.common.ResponseCode; | @@ -4,6 +4,8 @@ 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.TransGPS; | ||
| 8 | +import com.google.common.base.Splitter; | ||
| 7 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -11,6 +13,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; | @@ -11,6 +13,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 11 | import org.springframework.jdbc.core.JdbcTemplate; | 13 | import org.springframework.jdbc.core.JdbcTemplate; |
| 12 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
| 13 | 15 | ||
| 16 | +import java.util.ArrayList; | ||
| 14 | import java.util.HashMap; | 17 | import java.util.HashMap; |
| 15 | import java.util.List; | 18 | import java.util.List; |
| 16 | import java.util.Map; | 19 | import java.util.Map; |
| @@ -55,6 +58,9 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -55,6 +58,9 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 55 | 58 | ||
| 56 | List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); | 59 | List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class)); |
| 57 | 60 | ||
| 61 | + for(GeoRoad road : list){ | ||
| 62 | + road.setBdCoords(multiWgsToBd(road.getGsectionVector())); | ||
| 63 | + } | ||
| 58 | map.put("status", ResponseCode.SUCCESS); | 64 | map.put("status", ResponseCode.SUCCESS); |
| 59 | map.put("list", list); | 65 | map.put("list", list); |
| 60 | }catch (Exception e){ | 66 | }catch (Exception e){ |
| @@ -64,4 +70,64 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -64,4 +70,64 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 64 | } | 70 | } |
| 65 | return map; | 71 | return map; |
| 66 | } | 72 | } |
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * 编辑缓冲区信息 | ||
| 76 | + * @param station | ||
| 77 | + * @return | ||
| 78 | + */ | ||
| 79 | + @Override | ||
| 80 | + public Map<String, Object> updateBufferInfo(GeoStation station) { | ||
| 81 | + Map<String, Object> rs = new HashMap<>(); | ||
| 82 | + try{ | ||
| 83 | + //坐标转换 | ||
| 84 | + TransGPS.Location loc = TransGPS.LocationMake(station.getgLonx(), station.getgLaty()); | ||
| 85 | + loc = TransGPS.bd_decrypt(loc); | ||
| 86 | + loc = TransGPS.transformFromGCJToWGS(loc); | ||
| 87 | + station.setgLaty(Float.parseFloat(String.valueOf(loc.getLat()))); | ||
| 88 | + station.setgLonx(Float.parseFloat(String.valueOf(loc.getLng()))); | ||
| 89 | + | ||
| 90 | + String sql; | ||
| 91 | + if(station.getShapesType().equals("r")){ | ||
| 92 | + sql = "update bsth_c_station set g_lonx=?, g_laty=?, radius=? where station_cod=?"; | ||
| 93 | + int rsCount = jdbcTemplate.update(sql, station.getgLonx(), station.getgLaty(), station.getRadius(), station.getStationCode()); | ||
| 94 | + | ||
| 95 | + if(rsCount > 0){ | ||
| 96 | + sql = "SELECT t1.*, t2.g_lonx,g_laty,ST_AsText (g_polygon_grid) AS g_polygon_grid,radius,shapes_type FROM (SELECT id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions FROM bsth_c_ls_stationroute WHERE id="+station.getId()+" AND destroy = 0) t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod"; | ||
| 97 | + List list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | ||
| 98 | + | ||
| 99 | + rs.put("station", list.get(0)); | ||
| 100 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + }catch (Exception e){ | ||
| 105 | + logger.error("", e); | ||
| 106 | + rs.put("status", ResponseCode.ERROR); | ||
| 107 | + rs.put("msg", "服务器出现异常"); | ||
| 108 | + } | ||
| 109 | + return rs; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * wgs 坐标数组转 百度 | ||
| 114 | + * | ||
| 115 | + * @return | ||
| 116 | + */ | ||
| 117 | + private List<String> multiWgsToBd(String crdStr) { | ||
| 118 | + List<String> bdList = new ArrayList<>(); | ||
| 119 | + | ||
| 120 | + List<String> gList = Splitter.on(",").splitToList(crdStr.substring(11, crdStr.length() - 2)); | ||
| 121 | + TransGPS.Location location; | ||
| 122 | + //StringBuilder itemStr = new StringBuilder(); | ||
| 123 | + String[] cds; | ||
| 124 | + for(String gs : gList){ | ||
| 125 | + cds = gs.split(" "); | ||
| 126 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])))); | ||
| 127 | + //itemStr.append(location.getLng() + " " + location.getLat() + ","); | ||
| 128 | + | ||
| 129 | + bdList.add(location.getLng() + " " + location.getLat()); | ||
| 130 | + } | ||
| 131 | + return bdList; | ||
| 132 | + } | ||
| 67 | } | 133 | } |
src/main/resources/static/assets/js/TransGPS.js
| @@ -80,7 +80,7 @@ var TransGPS = (function(){ | @@ -80,7 +80,7 @@ var TransGPS = (function(){ | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | function bd_decrypt(lat, lng){ | 82 | function bd_decrypt(lat, lng){ |
| 83 | - var x = bdLoc.lng - 0.0065, y = bdLoc.lat - 0.006; | 83 | + var x = lng - 0.0065, y = lat - 0.006; |
| 84 | var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); | 84 | var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); |
| 85 | var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); | 85 | var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); |
| 86 | 86 | ||
| @@ -92,8 +92,12 @@ var TransGPS = (function(){ | @@ -92,8 +92,12 @@ var TransGPS = (function(){ | ||
| 92 | var gcj = transformFromWGSToGCJ(lat, lng); | 92 | var gcj = transformFromWGSToGCJ(lat, lng); |
| 93 | return bd_encrypt(gcj.lat, gcj.lng); | 93 | return bd_encrypt(gcj.lat, gcj.lng); |
| 94 | }, | 94 | }, |
| 95 | - transformFromWGSToGCJ: transformFromWGSToGCJ | ||
| 96 | - } | 95 | + transformFromWGSToGCJ: transformFromWGSToGCJ, |
| 96 | + bdToWgs: function (lat, lng) { | ||
| 97 | + var gcj = bd_decrypt(lat, lng); | ||
| 98 | + return transformFromGCJToWGS(gcj.lat, gcj.lng); | ||
| 99 | + } | ||
| 100 | + }; | ||
| 97 | 101 | ||
| 98 | return transGPS; | 102 | return transGPS; |
| 99 | })(); | 103 | })(); |
| 100 | \ No newline at end of file | 104 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
| @@ -135,21 +135,22 @@ div#map_wrap{ | @@ -135,21 +135,22 @@ div#map_wrap{ | ||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | .station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { | 137 | .station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { |
| 138 | - margin-top: 6px; | 138 | + margin-top: 0; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | .station_route>ul>li>a{ | 141 | .station_route>ul>li>a{ |
| 142 | color: #434343; | 142 | color: #434343; |
| 143 | - | ||
| 144 | overflow: hidden; | 143 | overflow: hidden; |
| 145 | text-overflow: ellipsis; | 144 | text-overflow: ellipsis; |
| 146 | white-space: nowrap; | 145 | white-space: nowrap; |
| 147 | display: inline-block; | 146 | display: inline-block; |
| 148 | width: calc(100% - 53px); | 147 | width: calc(100% - 53px); |
| 148 | + padding: 4px 0; | ||
| 149 | + vertical-align: middle;+0982/ | ||
| 149 | } | 150 | } |
| 151 | + | ||
| 150 | .ct_route_badge{ | 152 | .ct_route_badge{ |
| 151 | font-size: 11px; | 153 | font-size: 11px; |
| 152 | - background: #b6b6b6; | ||
| 153 | height: 18px; | 154 | height: 18px; |
| 154 | border-radius: 5px; | 155 | border-radius: 5px; |
| 155 | vertical-align: top; | 156 | vertical-align: top; |
| @@ -159,6 +160,10 @@ div#map_wrap{ | @@ -159,6 +160,10 @@ div#map_wrap{ | ||
| 159 | min-width: 18px; | 160 | min-width: 18px; |
| 160 | } | 161 | } |
| 161 | 162 | ||
| 163 | +.up_down_route_list>li:nth-of-type(2) .ct_route_badge{ | ||
| 164 | + background: #fb6464; | ||
| 165 | +} | ||
| 166 | + | ||
| 162 | .ct_route_badge.start{ | 167 | .ct_route_badge.start{ |
| 163 | margin-left: 0px; | 168 | margin-left: 0px; |
| 164 | } | 169 | } |
| @@ -182,9 +187,6 @@ div#map_wrap{ | @@ -182,9 +187,6 @@ div#map_wrap{ | ||
| 182 | margin-top: 0 !important; | 187 | margin-top: 0 !important; |
| 183 | } | 188 | } |
| 184 | 189 | ||
| 185 | -._route_info_wrap ul.uk-list li:nth-child(n+2) { | ||
| 186 | - margin-top: 4px; | ||
| 187 | -} | ||
| 188 | .pos_tb_icon{ | 190 | .pos_tb_icon{ |
| 189 | position: absolute; | 191 | position: absolute; |
| 190 | bottom: 15px; | 192 | bottom: 15px; |
| @@ -195,15 +197,19 @@ div#map_wrap{ | @@ -195,15 +197,19 @@ div#map_wrap{ | ||
| 195 | width: 48px; | 197 | width: 48px; |
| 196 | text-align: right; | 198 | text-align: right; |
| 197 | vertical-align: top; | 199 | vertical-align: top; |
| 200 | + margin-top: 3px; | ||
| 198 | } | 201 | } |
| 199 | 202 | ||
| 200 | .road_route>ul li a{ | 203 | .road_route>ul li a{ |
| 201 | color: #242424; | 204 | color: #242424; |
| 205 | + width: 100%; | ||
| 206 | + display: block; | ||
| 207 | + padding-left: 8px; | ||
| 202 | } | 208 | } |
| 203 | 209 | ||
| 204 | .road_route>ul{ | 210 | .road_route>ul{ |
| 205 | border-left: 1px solid #cbcbcb; | 211 | border-left: 1px solid #cbcbcb; |
| 206 | - padding-left: 10px; | 212 | + padding-left: 0; |
| 207 | padding-top: 10px; | 213 | padding-top: 10px; |
| 208 | } | 214 | } |
| 209 | 215 | ||
| @@ -219,4 +225,199 @@ span.sub_name { | @@ -219,4 +225,199 @@ span.sub_name { | ||
| 219 | text-overflow: ellipsis; | 225 | text-overflow: ellipsis; |
| 220 | white-space: nowrap; | 226 | white-space: nowrap; |
| 221 | display: inline-block; | 227 | display: inline-block; |
| 228 | +} | ||
| 229 | + | ||
| 230 | +#map_wrap img { | ||
| 231 | + max-width: none; | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +ul.uk-list.station_info_win { | ||
| 235 | + font-size: 14px; | ||
| 236 | + padding-left: 5px; | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | +.uk-list.station_info_win>li:nth-child(n+2), .uk-list.station_info_win>li>ul { | ||
| 240 | + margin-top: 7px; | ||
| 241 | +} | ||
| 242 | + | ||
| 243 | +ul.uk-list.station_info_win>li.s_name{ | ||
| 244 | + font-size: 16px; | ||
| 245 | + font-weight: 600; | ||
| 246 | + color: #e15428; | ||
| 247 | +} | ||
| 248 | + | ||
| 249 | +.up_down_route_list li.ct_active{ | ||
| 250 | + background: #91d9fa; | ||
| 251 | +} | ||
| 252 | + | ||
| 253 | +.up_down_route_list li.ct_active.first_road_active{ | ||
| 254 | + background: #fff; | ||
| 255 | +} | ||
| 256 | + | ||
| 257 | +.up_down_route_list li.ct_active.first_road_active>a{ | ||
| 258 | + background: #91d9fa; | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +.road_route .uk-list ul{ | ||
| 262 | + padding-left: 22px; | ||
| 263 | +} | ||
| 264 | + | ||
| 265 | +.road_route>ul>li>ul>li{ | ||
| 266 | + padding-left: 8px; | ||
| 267 | +} | ||
| 268 | + | ||
| 269 | +.ct_coord_str{ | ||
| 270 | + max-height: 300px; | ||
| 271 | + overflow: auto; | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 275 | + font-size: 14px; | ||
| 276 | + width: 170px !important; | ||
| 277 | + min-width: 70px; | ||
| 278 | + border: 1px solid #d2d2d2; | ||
| 279 | + overflow: hidden; | ||
| 280 | + border-radius: 0; | ||
| 281 | + background: #fff; | ||
| 282 | + color: #666; | ||
| 283 | + box-shadow: 0 5px 12px rgba(0,0,0,.15); | ||
| 284 | +} | ||
| 285 | + | ||
| 286 | +.main_left_panel_m_layer{ | ||
| 287 | + position: absolute; | ||
| 288 | + z-index: 10000; | ||
| 289 | + height: calc(100% - 20px); | ||
| 290 | + width: 300px; | ||
| 291 | + background: #ffffff85; | ||
| 292 | + top: 7px; | ||
| 293 | + left: 5px; | ||
| 294 | + display: none; | ||
| 295 | +} | ||
| 296 | + | ||
| 297 | +.buffer_edit_panel{ | ||
| 298 | + position: absolute; | ||
| 299 | + top: 5px; | ||
| 300 | + width: 360px; | ||
| 301 | + height: 120px; | ||
| 302 | + background: #ffffff; | ||
| 303 | + left: calc(50% - 170px); | ||
| 304 | + z-index: 999; | ||
| 305 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 306 | + display: none; | ||
| 307 | +} | ||
| 308 | +.buffer_edit_body{ | ||
| 309 | + padding: 5px; | ||
| 310 | +} | ||
| 311 | + | ||
| 312 | +.buffer_edit_body>.name{ | ||
| 313 | + font-weight: 600; | ||
| 314 | + color: #E91E63; | ||
| 315 | + margin-bottom: 0; | ||
| 316 | +} | ||
| 317 | + | ||
| 318 | +.buffer_edit_body .ct_row .uk-inline{ | ||
| 319 | + width: 167px; | ||
| 320 | + height: 30px; | ||
| 321 | + margin-right: 7px; | ||
| 322 | +} | ||
| 323 | + | ||
| 324 | +.buffer_edit_body .ct_row{ | ||
| 325 | + margin-top: 12px; | ||
| 326 | +} | ||
| 327 | + | ||
| 328 | +.buffer_edit_body .ct_row .uk-inline:last-child{ | ||
| 329 | + margin-right: 0; | ||
| 330 | +} | ||
| 331 | + | ||
| 332 | +.buffer_edit_body .ct_row .uk-inline input{ | ||
| 333 | + height: 30px; | ||
| 334 | +} | ||
| 335 | + | ||
| 336 | +.buffer_edit_body .ct_row .uk-form-icon-flip { | ||
| 337 | + font-size: 12px; | ||
| 338 | +} | ||
| 339 | + | ||
| 340 | +.buffer_edit_body .ct_row .uk-inline.btns{ | ||
| 341 | + text-align: right; | ||
| 342 | +} | ||
| 343 | +.buffer_edit_body .ct_row .uk-inline.btns .uk-button{ | ||
| 344 | + padding: 0 15px; | ||
| 345 | + height: 28px; | ||
| 346 | + line-height: 28px; | ||
| 347 | + vertical-align: top; | ||
| 348 | + margin-top: 2px; | ||
| 349 | +} | ||
| 350 | + | ||
| 351 | +.loading{ | ||
| 352 | + height: 100%; | ||
| 353 | + text-align: center; | ||
| 354 | + position: absolute; | ||
| 355 | + z-index: 10000; | ||
| 356 | + top: 0; | ||
| 357 | + left: 0; | ||
| 358 | + width: 100%; | ||
| 359 | + background: #ffffff78; | ||
| 360 | + display: flex; | ||
| 361 | +} | ||
| 362 | + | ||
| 363 | +.loading>div{ | ||
| 364 | + margin: auto; | ||
| 365 | + margin-top: calc(25% - 100px); | ||
| 366 | + background: #f9d56c; | ||
| 367 | + padding: 12px; | ||
| 368 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 369 | +} | ||
| 370 | + | ||
| 371 | +.loading>div>span{ | ||
| 372 | + vertical-align: top; | ||
| 373 | + margin-top: -6px; | ||
| 374 | + margin-right: 5px; | ||
| 375 | + font-size: 14px; | ||
| 376 | +} | ||
| 377 | +.uk-modal{ | ||
| 378 | + z-index: 10001; | ||
| 379 | +} | ||
| 380 | + | ||
| 381 | +.ct_route_badge.polygon{ | ||
| 382 | + | ||
| 383 | +} | ||
| 384 | + | ||
| 385 | +.shapes_type>div.uk-inline:nth-of-type(2){ | ||
| 386 | + width: 80px; | ||
| 387 | + margin-right: 0; | ||
| 388 | +} | ||
| 389 | + | ||
| 390 | +.shapes_type>div.uk-inline:first-child{ | ||
| 391 | + width: 84px; | ||
| 392 | +} | ||
| 393 | + | ||
| 394 | +.shapes_type>div.uk-inline:first-child select{ | ||
| 395 | + height: 30px; | ||
| 396 | +} | ||
| 397 | + | ||
| 398 | +.shapes_type.st_d>div.uk-inline:nth-of-type(2){ | ||
| 399 | + display: none; | ||
| 400 | +} | ||
| 401 | + | ||
| 402 | +.shapes_type.st_d>div.uk-inline:first-child{ | ||
| 403 | + width: 167px; | ||
| 404 | +} | ||
| 405 | + | ||
| 406 | +.draw_polygon_switch{ | ||
| 407 | + display: none; | ||
| 408 | +} | ||
| 409 | + | ||
| 410 | +.shapes_type.st_d>div.uk-inline:first-child select{ | ||
| 411 | + width: 107px; | ||
| 412 | +} | ||
| 413 | + | ||
| 414 | +.shapes_type.st_d .draw_polygon_switch{ | ||
| 415 | + display: inline-block; | ||
| 416 | + font-size: 12px; | ||
| 417 | + vertical-align: bottom; | ||
| 418 | + margin-left: 5px; | ||
| 419 | +} | ||
| 420 | + | ||
| 421 | +.shapes_type.st_d .draw_polygon_switch>a{ | ||
| 422 | + color: red; | ||
| 222 | } | 423 | } |
| 223 | \ No newline at end of file | 424 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_road_route.html
| @@ -2,14 +2,15 @@ | @@ -2,14 +2,15 @@ | ||
| 2 | <script id="geo_d_e_road_route-temp" type="text/html"> | 2 | <script id="geo_d_e_road_route-temp" type="text/html"> |
| 3 | <ul class="uk-list"> | 3 | <ul class="uk-list"> |
| 4 | {{each list as subArr i}} | 4 | {{each list as subArr i}} |
| 5 | - <li> | ||
| 6 | - <a>{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a> | 5 | + <li class="road_li_{{subArr[0].sectionCode}} first_road_active"> |
| 6 | + <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a> | ||
| 7 | 7 | ||
| 8 | {{if subArr.length > 1}} | 8 | {{if subArr.length > 1}} |
| 9 | {{each subArr as obj j}} | 9 | {{each subArr as obj j}} |
| 10 | <ul class="uk-list"> | 10 | <ul class="uk-list"> |
| 11 | {{if j > 0}} | 11 | {{if j > 0}} |
| 12 | - <li><a>{{obj.sectionName}}<span class="sub_name">{{obj.crosesRoad}}</span></a></li> | 12 | + <li class="road_li_{{obj.sectionCode}}"> |
| 13 | + <a data-code="{{obj.sectionCode}}" data-updown="{{obj.directions}}">{{obj.sectionName}}<span class="sub_name">{{obj.crosesRoad}}</span></a></li> | ||
| 13 | {{/if}} | 14 | {{/if}} |
| 14 | </ul> | 15 | </ul> |
| 15 | {{/each}} | 16 | {{/each}} |
| @@ -18,4 +19,20 @@ | @@ -18,4 +19,20 @@ | ||
| 18 | {{/each}} | 19 | {{/each}} |
| 19 | </ul> | 20 | </ul> |
| 20 | </script> | 21 | </script> |
| 22 | + | ||
| 23 | + <script id="geo_d_e_road_info_win-temp" type="text/html"> | ||
| 24 | + <ul class="uk-list station_info_win"> | ||
| 25 | + <li class="s_name">{{sectionName}}</li> | ||
| 26 | + <li>交叉路名: {{crosesRoad}}</li> | ||
| 27 | + <li>路段编号:{{sectionCode}}</li> | ||
| 28 | + <li>路由序号:{{sectionrouteCode}}</li> | ||
| 29 | + <li>坐标: | ||
| 30 | + <div class="ct_coord_str"> | ||
| 31 | + {{each bdCoords as coord i}} | ||
| 32 | + <code>{{coord}}</code><br> | ||
| 33 | + {{/each}} | ||
| 34 | + </div> | ||
| 35 | + </li> | ||
| 36 | + </ul> | ||
| 37 | + </script> | ||
| 21 | </div> | 38 | </div> |
| 22 | \ No newline at end of file | 39 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
| @@ -2,14 +2,92 @@ | @@ -2,14 +2,92 @@ | ||
| 2 | <script id="geo_d_e_station_route-temp" type="text/html"> | 2 | <script id="geo_d_e_station_route-temp" type="text/html"> |
| 3 | <ul class="uk-list"> | 3 | <ul class="uk-list"> |
| 4 | {{each list as s i}} | 4 | {{each list as s i}} |
| 5 | - <li> | 5 | + <li class="station_li_{{s.stationCode}}"> |
| 6 | <div class="ct_route_badge_wrap"> | 6 | <div class="ct_route_badge_wrap"> |
| 7 | - <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}}"> | 7 | + <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}"> |
| 8 | {{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> |
| 9 | </div> | 9 | </div> |
| 10 | - <a>{{s.stationName}}</a> | 10 | + <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> |
| 11 | </li> | 11 | </li> |
| 12 | {{/each}} | 12 | {{/each}} |
| 13 | </ul> | 13 | </ul> |
| 14 | </script> | 14 | </script> |
| 15 | + | ||
| 16 | + | ||
| 17 | + <script id="geo_d_e_station_info_win-temp" type="text/html"> | ||
| 18 | + <ul class="uk-list station_info_win"> | ||
| 19 | + <li class="s_name">{{stationName}}</li> | ||
| 20 | + <li>站点编码: {{stationCode}}</li> | ||
| 21 | + <li>站点类型: | ||
| 22 | + {{if stationMark=='B'}} | ||
| 23 | + 起点站 | ||
| 24 | + {{else if stationMark=='E'}} | ||
| 25 | + 终点站 | ||
| 26 | + {{else if stationMark=='Z'}} | ||
| 27 | + 中途站 | ||
| 28 | + {{/if}} | ||
| 29 | + </li> | ||
| 30 | + <li> | ||
| 31 | + 经度: {{gLaty}} | ||
| 32 | + </li> | ||
| 33 | + <li>纬度: {{gLonx}}</li> | ||
| 34 | + <li> | ||
| 35 | + 电子围栏类型: | ||
| 36 | + {{if shapesType=='r'}} | ||
| 37 | + 圆形 | ||
| 38 | + {{else if shapesType=='d'}} | ||
| 39 | + 多边形 | ||
| 40 | + {{/if}} | ||
| 41 | + </li> | ||
| 42 | + <li> | ||
| 43 | + {{if shapesType=='r'}} | ||
| 44 | + 半径:{{radius}} | ||
| 45 | + {{/if}} | ||
| 46 | + </li> | ||
| 47 | + <li>站序:{{index + 1}}</li> | ||
| 48 | + <li>路由序号:{{stationRouteCode}}</li> | ||
| 49 | + </ul> | ||
| 50 | + </script> | ||
| 51 | + | ||
| 52 | + <script id="geo_d_e_map_edit_buffer_panel-temp" type="text/html"> | ||
| 53 | + <div class="buffer_edit_panel uk-animation-slide-top-small"> | ||
| 54 | + <div class="buffer_edit_body" > | ||
| 55 | + <h6 class="name">{{stationName}}(缓冲区编辑)</h6> | ||
| 56 | + <form> | ||
| 57 | + <input type="hidden" value="{{id}}" name="id"> | ||
| 58 | + <input type="hidden" value="{{directions}}" name="directions"> | ||
| 59 | + <input type="hidden" value="{{stationCode}}" name="stationCode"> | ||
| 60 | + <input type="hidden" value="{{stationName}}" name="stationName"> | ||
| 61 | + <div class="ct_row"> | ||
| 62 | + <div class="uk-inline"> | ||
| 63 | + <span class="uk-form-icon uk-form-icon-flip" >经度</span> | ||
| 64 | + <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly> | ||
| 65 | + </div> | ||
| 66 | + <div class="uk-inline"> | ||
| 67 | + <span class="uk-form-icon uk-form-icon-flip" >纬度</span> | ||
| 68 | + <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + | ||
| 72 | + <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}"> | ||
| 73 | + <div class="uk-inline" > | ||
| 74 | + <select name="shapesType" class="uk-select"> | ||
| 75 | + <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option> | ||
| 76 | + <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option> | ||
| 77 | + </select> | ||
| 78 | + <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span> | ||
| 79 | + </div> | ||
| 80 | + <div class="uk-inline"> | ||
| 81 | + <span class="uk-form-icon uk-form-icon-flip" >半径</span> | ||
| 82 | + <input class="uk-input" name="radius" type="text" value="{{radius}}"> | ||
| 83 | + </div> | ||
| 84 | + <div class="uk-inline btns"> | ||
| 85 | + <button class="uk-button uk-button-primary submit">确定</button> | ||
| 86 | + <button class="uk-button uk-button-default cancel">取消</button> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | + </form> | ||
| 90 | + </div> | ||
| 91 | + </div> | ||
| 92 | + </script> | ||
| 15 | </div> | 93 | </div> |
| 16 | \ No newline at end of file | 94 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/map_op.html deleted
100644 → 0
src/main/resources/static/pages/base/geo_data_edit/js/map.js
| @@ -14,18 +14,422 @@ var gb_ct_map = function () { | @@ -14,18 +14,422 @@ var gb_ct_map = function () { | ||
| 14 | } | 14 | } |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | - map = new BMap.Map($(gb_map_consts.mapContainer)[0]); | 17 | + /** |
| 18 | + * 地图状态 | ||
| 19 | + * 1: 站点缓冲区编辑 | ||
| 20 | + */ | ||
| 21 | + var map_status=0; | ||
| 22 | + var editCircle; | ||
| 23 | + var editPolygon; | ||
| 24 | + | ||
| 25 | + map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false}); | ||
| 18 | //中心点和缩放级别 | 26 | //中心点和缩放级别 |
| 19 | - map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 13); | 27 | + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14); |
| 20 | map.enableScrollWheelZoom(); | 28 | map.enableScrollWheelZoom(); |
| 21 | 29 | ||
| 30 | + var roadPolylines = [], stationMarkers=[]; | ||
| 31 | + var _render = function (cb) { | ||
| 32 | + //绘制路段 | ||
| 33 | + _renderRoads(gb_road_route.getData()); | ||
| 34 | + //绘制站点 | ||
| 35 | + _renderStation(gb_station_route.getData()); | ||
| 36 | + | ||
| 37 | + changeUpDown(); | ||
| 38 | + | ||
| 39 | + //居中至上行中间站点 | ||
| 40 | + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)]; | ||
| 41 | + map.setCenter(cm.point); | ||
| 42 | + | ||
| 43 | + cb && cb(); | ||
| 44 | + }; | ||
| 45 | + | ||
| 46 | + var updownColor = function (updown) { | ||
| 47 | + return updown==0?'blue':'red'; | ||
| 48 | + }; | ||
| 49 | + var _renderRoads = function (data) { | ||
| 50 | + _renderPolyline(data[0], updownColor(0));//上行路段 | ||
| 51 | + _renderPolyline(data[1], updownColor(1));//下行路段 | ||
| 52 | + }; | ||
| 53 | + | ||
| 54 | + var _renderStation = function (data) { | ||
| 55 | + _renderStationMarket(data[0]);//上行站点 | ||
| 56 | + _renderStationMarket(data[1]);//下行站点 | ||
| 57 | + }; | ||
| 58 | + | ||
| 59 | + var _renderStationMarket = function (routes, color) { | ||
| 60 | + var marker; | ||
| 61 | + var array=[]; | ||
| 62 | + $.each(routes, function (i) { | ||
| 63 | + this.index = i; | ||
| 64 | + transCoord(this); | ||
| 65 | + marker=createStationMark(this); | ||
| 66 | + marker.stationCode = this.stationCode; | ||
| 67 | + marker.ct_data = this; | ||
| 68 | + map.addOverlay(marker); | ||
| 69 | + | ||
| 70 | + array.push(marker); | ||
| 71 | + }); | ||
| 72 | + | ||
| 73 | + stationMarkers.push(array); | ||
| 74 | + }; | ||
| 75 | + | ||
| 76 | + function transCoord(obj) { | ||
| 77 | + var coord = TransGPS.wgsToBD(obj.gLaty, obj.gLonx); | ||
| 78 | + obj.bd_lat = coord.lat; | ||
| 79 | + obj.bd_lon = coord.lng; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + var _renderPolyline = function (routes, color) { | ||
| 83 | + var pos, temps; | ||
| 84 | + var polyline, _pLines=[]; | ||
| 85 | + var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7}; | ||
| 86 | + $.each(routes, function (i, item) { | ||
| 87 | + | ||
| 88 | + pos = []; | ||
| 89 | + $.each(item.bdCoords, function () { | ||
| 90 | + temps = this.split(' '); | ||
| 91 | + pos.push(new BMap.Point(temps[0], temps[1])); | ||
| 92 | + }); | ||
| 93 | + polyline = new BMap.Polyline(pos, style); | ||
| 94 | + polyline.ct_data = item; | ||
| 95 | + polyline.ct_data.oldColor = color; | ||
| 96 | + map.addOverlay(polyline); | ||
| 97 | + | ||
| 98 | + polyline.addEventListener('mouseover', function(){ | ||
| 99 | + this.setStrokeColor('#20bd26'); | ||
| 100 | + }); | ||
| 101 | + polyline.addEventListener('mouseout', function(){ | ||
| 102 | + if(this!=road_win_show_p) | ||
| 103 | + this.setStrokeColor(color); | ||
| 104 | + }); | ||
| 105 | + polyline.addEventListener('click', function(e){ | ||
| 106 | + if(map_status!=1) | ||
| 107 | + openRoadInfoWin(this, e.point); | ||
| 108 | + }); | ||
| 109 | + _pLines.push(polyline); | ||
| 110 | + }); | ||
| 111 | + | ||
| 112 | + roadPolylines.push(_pLines); | ||
| 113 | + }; | ||
| 114 | + | ||
| 115 | + var road_win_show_p; | ||
| 116 | + function openRoadInfoWin(p, point) { | ||
| 117 | + var data = p.ct_data; | ||
| 118 | + var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data)); | ||
| 119 | + | ||
| 120 | + //close event | ||
| 121 | + win.addEventListener('close', function (e) { | ||
| 122 | + p.setStrokeColor(p.ct_data.oldColor); | ||
| 123 | + gb_road_route.clearFocus(); | ||
| 124 | + road_win_show_p = null; | ||
| 125 | + }); | ||
| 126 | + //open event | ||
| 127 | + win.addEventListener('open', function (e) { | ||
| 128 | + gb_road_route.focus(data); | ||
| 129 | + p.setStrokeColor('#20bd26'); | ||
| 130 | + road_win_show_p = p; | ||
| 131 | + }); | ||
| 132 | + | ||
| 133 | + map.openInfoWindow(win, point); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + function createStationMark(statio) { | ||
| 137 | + var point = new BMap.Point(statio.bd_lon, statio.bd_lat); | ||
| 138 | + var marker = new BMap.Marker(point); | ||
| 139 | + | ||
| 140 | + //根据站点名称 计算marker 宽度 | ||
| 141 | + var w = statio.stationName.length * 12 + 38 | ||
| 142 | + ,iw=w-2; | ||
| 143 | + var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,25)}) | ||
| 144 | + marker.setIcon(icon); | ||
| 145 | + marker.setShadow(null); | ||
| 146 | + //信息窗口 | ||
| 147 | + //var infoWin=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](statio), {offset: new BMap.Size(0,-13)}); | ||
| 148 | + //infoWin.ct_data = statio;//绑定数据 | ||
| 149 | + //marker.infoWin = infoWin; | ||
| 150 | + marker.addEventListener('click', function(){ | ||
| 151 | + if(map_status!=1) | ||
| 152 | + openStationInfoWin(this); | ||
| 153 | + //map.openInfoWindow(this.infoWin, this.point); | ||
| 154 | + }); | ||
| 155 | + //close event | ||
| 156 | + /*infoWin.addEventListener('close', function (e) { | ||
| 157 | + //if(map_status!=1) | ||
| 158 | + gb_station_route.clearFocus(); | ||
| 159 | + }); | ||
| 160 | + //open event | ||
| 161 | + infoWin.addEventListener('open', function (e) { | ||
| 162 | + gb_station_route.focus(this.ct_data); | ||
| 163 | + });*/ | ||
| 164 | + | ||
| 165 | + //mouseover | ||
| 166 | + marker.addEventListener('mouseover', function(){ | ||
| 167 | + setTop(this); | ||
| 168 | + }); | ||
| 169 | + return marker; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + var openStationInfoWin = function (m) { | ||
| 173 | + //ct_data | ||
| 174 | + 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)}); | ||
| 175 | + //close event | ||
| 176 | + win.addEventListener('close', function (e) { | ||
| 177 | + gb_station_route.clearFocus(); | ||
| 178 | + }); | ||
| 179 | + //open event | ||
| 180 | + win.addEventListener('open', function (e) { | ||
| 181 | + gb_station_route.focus(m.ct_data); | ||
| 182 | + }); | ||
| 183 | + | ||
| 184 | + map.openInfoWindow(win, m.point); | ||
| 185 | + }; | ||
| 186 | + | ||
| 187 | + //绘制站点icon | ||
| 188 | + function createStationIcon(station, w) { | ||
| 189 | + var canvas = $('<canvas></canvas>')[0]; | ||
| 190 | + var ctx = canvas.getContext('2d'); | ||
| 191 | + | ||
| 192 | + var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c'; | ||
| 193 | + //矩形 | ||
| 194 | + //ctx.roundRect(0, 0, w, 17, 1).stroke(); | ||
| 195 | + ctx.lineWidth="3"; | ||
| 196 | + ctx.rect(0, 0, w - 2, 19); | ||
| 197 | + ctx.fillStyle = '#fff'; | ||
| 198 | + ctx.fill(); | ||
| 199 | + ctx.strokeStyle = bg; | ||
| 200 | + ctx.stroke(); | ||
| 201 | + ctx.lineWidth="1"; | ||
| 202 | + | ||
| 203 | + //文字 | ||
| 204 | + ctx.font = "12px arial"; | ||
| 205 | + ctx.fillStyle = '#000'; | ||
| 206 | + ctx.fillText(station.stationName, 27, 14); | ||
| 207 | + | ||
| 208 | + //序号 | ||
| 209 | + ctx.beginPath(); | ||
| 210 | + ctx.rect(0, 0, 20, 19); | ||
| 211 | + ctx.fillStyle = bg; | ||
| 212 | + ctx.fill(); | ||
| 213 | + | ||
| 214 | + ctx.font = "12px arial"; | ||
| 215 | + ctx.fillStyle = '#fff'; | ||
| 216 | + var i = station.index + 1; | ||
| 217 | + var left = (i + '').length > 1?3:7; | ||
| 218 | + ctx.fillText(i, left, 14); | ||
| 219 | + | ||
| 220 | + //角 | ||
| 221 | + var c = w / 2; | ||
| 222 | + ctx.beginPath(); | ||
| 223 | + ctx.moveTo(c - 7, 16); | ||
| 224 | + ctx.lineTo(c, 24); | ||
| 225 | + ctx.lineTo(c + 7, 16); | ||
| 226 | + ctx.closePath(); | ||
| 227 | + | ||
| 228 | + ctx.fillStyle = bg; | ||
| 229 | + ctx.fill(); | ||
| 230 | + ctx.strokeStyle = '#fff'; | ||
| 231 | + ctx.stroke(); | ||
| 232 | + return canvas.toDataURL(); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + var changeUpDown = function () { | ||
| 236 | + var upDown = getUpDown(); | ||
| 237 | + $.each(roadPolylines[upDown==0?1:0], function () { | ||
| 238 | + this.hide(); | ||
| 239 | + }); | ||
| 240 | + $.each(roadPolylines[upDown], function () { | ||
| 241 | + this.show(); | ||
| 242 | + }); | ||
| 243 | + | ||
| 244 | + | ||
| 245 | + $.each(stationMarkers[upDown==0?1:0], function () { | ||
| 246 | + this.hide(); | ||
| 247 | + }); | ||
| 248 | + $.each(stationMarkers[upDown], function () { | ||
| 249 | + this.show(); | ||
| 250 | + }); | ||
| 251 | + }; | ||
| 252 | + | ||
| 253 | + /** | ||
| 254 | + * 定位到站点 | ||
| 255 | + * @param code | ||
| 256 | + */ | ||
| 257 | + var focusStation = function (code, updown) { | ||
| 258 | + var marker = getStationMarker(code, updown); | ||
| 259 | + if(marker){ | ||
| 260 | + openStationInfoWin(marker); | ||
| 261 | + } | ||
| 262 | + }; | ||
| 263 | + | ||
| 264 | + var getStationMarker = function (code, updown) { | ||
| 265 | + var array = stationMarkers[updown], | ||
| 266 | + marker; | ||
| 267 | + for(var i=0,m;m=array[i++];){ | ||
| 268 | + if(m.stationCode==code){ | ||
| 269 | + marker = m; | ||
| 270 | + break; | ||
| 271 | + } | ||
| 272 | + } | ||
| 273 | + return marker; | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + /** | ||
| 277 | + * 定位到路段 | ||
| 278 | + * @param code | ||
| 279 | + * @param updown | ||
| 280 | + */ | ||
| 281 | + var focusRoad = function (code, updown) { | ||
| 282 | + var array = roadPolylines[updown], | ||
| 283 | + polyline; | ||
| 284 | + for(var i=0,p;p=array[i++];){ | ||
| 285 | + if(p.ct_data.sectionCode==code){ | ||
| 286 | + polyline = p; | ||
| 287 | + break; | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + var cp = calcCenterPoint(p.ct_data.bdCoords); | ||
| 292 | + openRoadInfoWin(p, new BMap.Point(cp.longitude, cp.latitude)); | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + var calcCenterPoint = function (coords) { | ||
| 296 | + var array = [], strs; | ||
| 297 | + for(var i=0,item;item=coords[i++];){ | ||
| 298 | + strs = item.split(' '); | ||
| 299 | + array.push({latitude: strs[1], longitude: strs[0]}); | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + return geolib.getCenter(array); | ||
| 303 | + } | ||
| 22 | 304 | ||
| 23 | - var _render = function () { | ||
| 24 | - | 305 | + var exitEditBufferStatus = function (s) { |
| 306 | + map_status = 0; | ||
| 307 | + enabledOtherElem(); | ||
| 308 | + gb_station_route.hideEditPanel(); | ||
| 309 | + | ||
| 310 | + map.removeOverlay(editCircle); | ||
| 311 | + | ||
| 312 | + openStationInfoWin(getStationMarker(s.stationCode, s.directions)); | ||
| 25 | }; | 313 | }; |
| 26 | 314 | ||
| 315 | + /** | ||
| 316 | + * 编辑站点缓冲区 | ||
| 317 | + * @param station | ||
| 318 | + */ | ||
| 319 | + var editStationBuffer = function (s) { | ||
| 320 | + map_status = 1; | ||
| 321 | + map.closeInfoWindow();//关闭infoWindow | ||
| 322 | + gb_station_route.clearFocus(); | ||
| 323 | + gb_station_route.focus(s); | ||
| 324 | + clearOldOverlay(); | ||
| 325 | + disabledOtherElem(); | ||
| 326 | + gb_station_route.showEditPanel(s); | ||
| 327 | + | ||
| 328 | + var marker = getStationMarker(s.stationCode, s.directions); | ||
| 329 | + map.centerAndZoom(marker.point, 18); | ||
| 330 | + var bElem = openBufferOverlay(marker); | ||
| 331 | + | ||
| 332 | + if(s.shapesType=='r'){ | ||
| 333 | + //lineupdate | ||
| 334 | + bElem.addEventListener('lineupdate', function (e) { | ||
| 335 | + //console.log('lineupdatelineupdate', e); | ||
| 336 | + //var ec = e.target; | ||
| 337 | + //var radius = ec.getRadius().toFixed(2); | ||
| 338 | + //console.log('getRadius', ec.getRadius(), radius); | ||
| 339 | + gb_station_route.reWriteEditPanel(e.target); | ||
| 340 | + }); | ||
| 341 | + } | ||
| 342 | + }; | ||
| 343 | + | ||
| 344 | + var clearOldOverlay = function () { | ||
| 345 | + map.removeOverlay(editCircle); | ||
| 346 | + map.removeOverlay(editPolygon); | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + /** | ||
| 350 | + * 禁用其他元素 | ||
| 351 | + */ | ||
| 352 | + var disabledOtherElem = function () { | ||
| 353 | + $('.main_left_panel_m_layer').show(); | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + var enabledOtherElem = function () { | ||
| 357 | + $('.main_left_panel_m_layer').hide(); | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + var openBufferOverlay = function (m) { | ||
| 361 | + var elem; | ||
| 362 | + var data = m.ct_data; | ||
| 363 | + if(data.shapesType=='r'){ | ||
| 364 | + var circle = new BMap.Circle(m.point,data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/}); | ||
| 365 | + map.addOverlay(circle); | ||
| 366 | + circle.enableEditing(); | ||
| 367 | + } | ||
| 368 | + editCircle = circle; | ||
| 369 | + return circle; | ||
| 370 | + }; | ||
| 371 | + | ||
| 372 | + /** | ||
| 373 | + * 更新站点 | ||
| 374 | + * @param s | ||
| 375 | + */ | ||
| 376 | + function updateStation(s) { | ||
| 377 | + var m = getStationMarker(s.stationCode, s.directions); | ||
| 378 | + //更新位置 | ||
| 379 | + transCoord(s); | ||
| 380 | + m.ct_data = s; | ||
| 381 | + m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat)); | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + var topOverlay; | ||
| 385 | + function setTop(overlay){ | ||
| 386 | + if(topOverlay) | ||
| 387 | + topOverlay.setTop(false); | ||
| 388 | + overlay.setTop(true); | ||
| 389 | + topOverlay = overlay; | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + /** | ||
| 393 | + * 切换缓冲区类型 | ||
| 394 | + * @param v | ||
| 395 | + */ | ||
| 396 | + var _drawingManager; | ||
| 397 | + var changeShapeType = function (v) { | ||
| 398 | + if(v == 'd'){ | ||
| 399 | + map.removeOverlay(editCircle); | ||
| 400 | + | ||
| 401 | + _drawingManager = new BMapLib.DrawingManager(map,{}); | ||
| 402 | + _drawingManager.open(); | ||
| 403 | + _drawingManager.setDrawingMode('polygon'); | ||
| 404 | + | ||
| 405 | + //绘制结束事件 | ||
| 406 | + _drawingManager.addEventListener('polygoncomplete', function (e) { | ||
| 407 | + console.log('end ', e); | ||
| 408 | + gb_station_route.drawEnd(); | ||
| 409 | + }); | ||
| 410 | + } | ||
| 411 | + }; | ||
| 412 | + | ||
| 413 | + var exitDrawStatus = function () { | ||
| 414 | + if(_drawingManager) | ||
| 415 | + _drawingManager.close(); | ||
| 416 | + }; | ||
| 417 | + | ||
| 418 | + var openDrawStatus = function () { | ||
| 419 | + if(_drawingManager) | ||
| 420 | + _drawingManager.open(); | ||
| 421 | + }; | ||
| 27 | res_load_ep.emitLater('load_map'); | 422 | res_load_ep.emitLater('load_map'); |
| 28 | return { | 423 | return { |
| 29 | - _render: _render | 424 | + _render: _render, |
| 425 | + changeUpDown:changeUpDown, | ||
| 426 | + focusStation: focusStation, | ||
| 427 | + focusRoad: focusRoad, | ||
| 428 | + editStationBuffer: editStationBuffer, | ||
| 429 | + updateStation: updateStation, | ||
| 430 | + exitEditBufferStatus: exitEditBufferStatus, | ||
| 431 | + changeShapeType: changeShapeType, | ||
| 432 | + exitDrawStatus: exitDrawStatus, | ||
| 433 | + openDrawStatus: openDrawStatus | ||
| 30 | }; | 434 | }; |
| 31 | }(); | 435 | }(); |
| 32 | \ No newline at end of file | 436 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js
| @@ -4,7 +4,7 @@ var gb_road_route = function () { | @@ -4,7 +4,7 @@ var gb_road_route = function () { | ||
| 4 | var temps; | 4 | var temps; |
| 5 | var road_maps; | 5 | var road_maps; |
| 6 | //绘制线路路由 | 6 | //绘制线路路由 |
| 7 | - var init = function () { | 7 | + var init = function (cb) { |
| 8 | var lineCode = storage.getItem("geo_data_edit_line_code"); | 8 | var lineCode = storage.getItem("geo_data_edit_line_code"); |
| 9 | 9 | ||
| 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { | 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { |
| @@ -21,6 +21,8 @@ var gb_road_route = function () { | @@ -21,6 +21,8 @@ var gb_road_route = function () { | ||
| 21 | $('.up_down_route_list>li:first>.road_route').html(upHtmlStr); | 21 | $('.up_down_route_list>li:first>.road_route').html(upHtmlStr); |
| 22 | var downHtmlStr = temps['geo_d_e_road_route-temp']({list: downs}); | 22 | var downHtmlStr = temps['geo_d_e_road_route-temp']({list: downs}); |
| 23 | $('.up_down_route_list>li:last>.road_route').html(downHtmlStr); | 23 | $('.up_down_route_list>li:last>.road_route').html(downHtmlStr); |
| 24 | + | ||
| 25 | + cb && cb(); | ||
| 24 | }); | 26 | }); |
| 25 | 27 | ||
| 26 | //加载数据 | 28 | //加载数据 |
| @@ -39,21 +41,63 @@ var gb_road_route = function () { | @@ -39,21 +41,63 @@ var gb_road_route = function () { | ||
| 39 | }); | 41 | }); |
| 40 | }; | 42 | }; |
| 41 | 43 | ||
| 44 | + //路段单击 | ||
| 45 | + $('.up_down_route_list>li>.road_route').on('click', 'a[data-code]', function () { | ||
| 46 | + var code = $(this).data('code'), | ||
| 47 | + updown = $(this).data('updown'); | ||
| 48 | + | ||
| 49 | + clearFocus(); | ||
| 50 | + gb_ct_map.focusRoad(code, updown); | ||
| 51 | + }); | ||
| 52 | + | ||
| 42 | var _group = function (list) { | 53 | var _group = function (list) { |
| 43 | - var rs = [], tempArr=[]; | 54 | + var rs = [], tempArr = []; |
| 44 | 55 | ||
| 45 | var name; | 56 | var name; |
| 46 | - for(var i=0,obj;obj=list[i++];){ | ||
| 47 | - if(name && name!=obj.sectionName){ | 57 | + for (var i = 0, obj; obj = list[i++];) { |
| 58 | + if (name && name != obj.sectionName) { | ||
| 48 | rs.push(tempArr); | 59 | rs.push(tempArr); |
| 49 | - tempArr=[]; | 60 | + tempArr = []; |
| 50 | } | 61 | } |
| 51 | tempArr.push(obj); | 62 | tempArr.push(obj); |
| 52 | name = obj.sectionName | 63 | name = obj.sectionName |
| 53 | } | 64 | } |
| 54 | return rs; | 65 | return rs; |
| 55 | }; | 66 | }; |
| 56 | - | 67 | + |
| 68 | + var clearFocus = function () { | ||
| 69 | + $('.up_down_route_list>li>.road_route li.ct_active').removeClass('ct_active'); | ||
| 70 | + }; | ||
| 71 | + | ||
| 72 | + var focus = function (data) { | ||
| 73 | + //sectionCode | ||
| 74 | + var elem = $('.up_down_route_list>li>.road_route .road_li_' + data.sectionCode); | ||
| 75 | + elem.addClass('ct_active'); | ||
| 76 | + | ||
| 77 | + if (!isShow(elem)) { | ||
| 78 | + //定位滚动条 | ||
| 79 | + var cont = $('.up_down_route_list'), | ||
| 80 | + diff = cont.height() / 2; | ||
| 81 | + cont.animate({ | ||
| 82 | + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff | ||
| 83 | + }, 500); | ||
| 84 | + } | ||
| 85 | + }; | ||
| 86 | + | ||
| 87 | + var isShow = function (elem) { | ||
| 88 | + var wrap = $('.up_down_route_list'); | ||
| 89 | + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122; | ||
| 90 | + }; | ||
| 91 | + | ||
| 57 | res_load_ep.emitLater('load_road_route'); | 92 | res_load_ep.emitLater('load_road_route'); |
| 58 | - return {init: init}; | 93 | + return { |
| 94 | + init: init, getData: function () { | ||
| 95 | + return road_maps; | ||
| 96 | + }, | ||
| 97 | + getTemps: function () { | ||
| 98 | + return temps; | ||
| 99 | + }, | ||
| 100 | + clearFocus: clearFocus, | ||
| 101 | + focus: focus | ||
| 102 | + }; | ||
| 59 | }(); | 103 | }(); |
| 60 | \ No newline at end of file | 104 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
| @@ -4,7 +4,7 @@ var gb_station_route = function () { | @@ -4,7 +4,7 @@ var gb_station_route = function () { | ||
| 4 | var temps; | 4 | var temps; |
| 5 | var station_maps; | 5 | var station_maps; |
| 6 | //绘制线路路由 | 6 | //绘制线路路由 |
| 7 | - var init = function () { | 7 | + var init = function (cb) { |
| 8 | var lineCode = storage.getItem("geo_data_edit_line_code"); | 8 | var lineCode = storage.getItem("geo_data_edit_line_code"); |
| 9 | 9 | ||
| 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { | 10 | var ep = EventProxy.create("data", "temp", function (data, temp) { |
| @@ -16,6 +16,8 @@ var gb_station_route = function () { | @@ -16,6 +16,8 @@ var gb_station_route = function () { | ||
| 16 | $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); | 16 | $('.up_down_route_list>li:first>.station_route').html(upHtmlStr); |
| 17 | var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]}); | 17 | var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]}); |
| 18 | $('.up_down_route_list>li:last>.station_route').html(downHtmlStr); | 18 | $('.up_down_route_list>li:last>.station_route').html(downHtmlStr); |
| 19 | + | ||
| 20 | + cb && cb(); | ||
| 19 | }); | 21 | }); |
| 20 | 22 | ||
| 21 | //加载数据 | 23 | //加载数据 |
| @@ -34,8 +36,191 @@ var gb_station_route = function () { | @@ -34,8 +36,191 @@ var gb_station_route = function () { | ||
| 34 | }); | 36 | }); |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
| 39 | + //站点单击 | ||
| 40 | + $('.up_down_route_list>li>.station_route').on('click', 'a[data-code]', function () { | ||
| 41 | + var code = $(this).data('code'), | ||
| 42 | + updown = $(this).data('updown'); | ||
| 43 | + | ||
| 44 | + clearFocus(); | ||
| 45 | + gb_ct_map.focusStation(code, updown); | ||
| 46 | + }); | ||
| 47 | + | ||
| 48 | + var clearFocus = function () { | ||
| 49 | + $('.up_down_route_list>li>.station_route li.ct_active').removeClass('ct_active'); | ||
| 50 | + }; | ||
| 51 | + | ||
| 52 | + var focus = function (s) { | ||
| 53 | + var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode); | ||
| 54 | + elem.addClass('ct_active'); | ||
| 55 | + | ||
| 56 | + if (!isShow(elem)) { | ||
| 57 | + //定位滚动条 | ||
| 58 | + var cont = $('.up_down_route_list'), | ||
| 59 | + diff = cont.height() / 2; | ||
| 60 | + cont.animate({ | ||
| 61 | + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff | ||
| 62 | + }, 500); | ||
| 63 | + } | ||
| 64 | + }; | ||
| 65 | + | ||
| 66 | + var isShow = function (elem) { | ||
| 67 | + var wrap = $('.up_down_route_list'); | ||
| 68 | + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122; | ||
| 69 | + }; | ||
| 70 | + | ||
| 71 | + var getStation = function (code, updown) { | ||
| 72 | + var array = station_maps[updown]; | ||
| 73 | + for(var i=0,s;s=array[i++];){ | ||
| 74 | + if(s.stationCode==code) | ||
| 75 | + return s; | ||
| 76 | + } | ||
| 77 | + return null; | ||
| 78 | + }; | ||
| 79 | + | ||
| 80 | + var callbackHandler = { | ||
| 81 | + edit_buffer: function (station) { | ||
| 82 | + //编辑缓冲区 | ||
| 83 | + gb_ct_map.editStationBuffer(station); | ||
| 84 | + } | ||
| 85 | + }; | ||
| 86 | + | ||
| 87 | + $.contextMenu({ | ||
| 88 | + selector: '._route_info_wrap .up_down_route_list .station_route>ul>li', | ||
| 89 | + className: 'station-route-ct-menu', | ||
| 90 | + callback: function (key, options) { | ||
| 91 | + var aLink = options.$trigger.find('a[data-code]'); | ||
| 92 | + var code = aLink.data('code'), | ||
| 93 | + updown = aLink.data('updown'); | ||
| 94 | + var station = getStation(code, updown); | ||
| 95 | + callbackHandler[key] && callbackHandler[key](station); | ||
| 96 | + }, | ||
| 97 | + items: { | ||
| 98 | + 'edit_buffer': { | ||
| 99 | + name: '编辑缓冲区' | ||
| 100 | + }, | ||
| 101 | + 'sep1': '---------', | ||
| 102 | + 'edit': { | ||
| 103 | + name: '编辑基础信息' | ||
| 104 | + }, | ||
| 105 | + 'insert_before': { | ||
| 106 | + name: '新增站点(前)' | ||
| 107 | + }, | ||
| 108 | + 'insert_after': { | ||
| 109 | + name: '新增站点(后)' | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + }); | ||
| 113 | + | ||
| 114 | + var showEditPanel = function (s) { | ||
| 115 | + var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s); | ||
| 116 | + $('.ct_page').append(htmlStr); | ||
| 117 | + $('.buffer_edit_panel').show(); | ||
| 118 | + }; | ||
| 119 | + | ||
| 120 | + var hideEditPanel = function () { | ||
| 121 | + $('.buffer_edit_panel').remove(); | ||
| 122 | + }; | ||
| 123 | + | ||
| 124 | + var edPanelRunFlag; | ||
| 125 | + var ecObj; | ||
| 126 | + var reWriteEditPanel = function (ec) { | ||
| 127 | + if(edPanelRunFlag){ | ||
| 128 | + ecObj = ec; | ||
| 129 | + return; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + edPanelRunFlag = true; | ||
| 133 | + setTimeout(function () { | ||
| 134 | + var panel = $('.buffer_edit_panel'); | ||
| 135 | + $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径 | ||
| 136 | + | ||
| 137 | + var p = ecObj.getCenter(); | ||
| 138 | + $('[name=gLaty]', panel).val(p.lat); | ||
| 139 | + $('[name=gLonx]', panel).val(p.lng); | ||
| 140 | + edPanelRunFlag = false; | ||
| 141 | + }, 170); | ||
| 142 | + }; | ||
| 143 | + | ||
| 144 | + var update = function (s) { | ||
| 145 | + var array = station_maps[s.directions]; | ||
| 146 | + for(var i=0,item; item=array[i++];){ | ||
| 147 | + if(item.stationCode==s.stationCode){ | ||
| 148 | + s.index = i; | ||
| 149 | + array.splice(i, 1, s); | ||
| 150 | + break; | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + }; | ||
| 154 | + | ||
| 155 | + /** | ||
| 156 | + * 缓冲区编辑 取消 | ||
| 157 | + */ | ||
| 158 | + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.cancel', function (e) { | ||
| 159 | + var f = $(this).parents('form'); | ||
| 160 | + var data = f.serializeJSON(); | ||
| 161 | + | ||
| 162 | + gb_ct_map.exitEditBufferStatus(data); | ||
| 163 | + }); | ||
| 164 | + | ||
| 165 | + /** | ||
| 166 | + * 缓冲区编辑 切换缓冲区类型(圆形,多边形) | ||
| 167 | + */ | ||
| 168 | + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body select[name=shapesType]', function (e) { | ||
| 169 | + var v = $(this).val(); | ||
| 170 | + | ||
| 171 | + gb_ct_map.changeShapeType(v); | ||
| 172 | + if(v=='d'){ | ||
| 173 | + $('.buffer_edit_panel .shapes_type').addClass('st_d'); | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + // | ||
| 177 | + //UIkit.notification("使用鼠标在地图上绘制多边形,可点击上发“暂停绘制”链接,退出绘制模式,以拖拽地图", {status: 'primary', pos: 'bottom-center'}) | ||
| 178 | + } | ||
| 179 | + else{ | ||
| 180 | + $('.buffer_edit_panel .shapes_type').removeClass('st_d'); | ||
| 181 | + } | ||
| 182 | + }); | ||
| 183 | + | ||
| 184 | + /** | ||
| 185 | + * 缓冲区编辑 切换绘制模式 | ||
| 186 | + */ | ||
| 187 | + var drawPolygonSwitch = '.buffer_edit_panel>.buffer_edit_body .draw_polygon_switch'; | ||
| 188 | + $(document).on('click', drawPolygonSwitch, function (e) { | ||
| 189 | + var type = $(this).data('type'); | ||
| 190 | + if(type==1){ | ||
| 191 | + //退出绘制状态 | ||
| 192 | + gb_ct_map.exitDrawStatus(); | ||
| 193 | + $(this).data('type', 0).find('a').text('开始绘制'); | ||
| 194 | + } | ||
| 195 | + else if(type==0 || type==2){ | ||
| 196 | + gb_ct_map.openDrawStatus(); | ||
| 197 | + $(this).data('type', 1).find('a').text('暂停绘制'); | ||
| 198 | + } | ||
| 199 | + }); | ||
| 200 | + | ||
| 201 | + /** | ||
| 202 | + * 绘制结束 | ||
| 203 | + */ | ||
| 204 | + var drawEnd = function () { | ||
| 205 | + $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制'); | ||
| 206 | + }; | ||
| 207 | + | ||
| 208 | + | ||
| 37 | res_load_ep.emitLater('load_station_route'); | 209 | res_load_ep.emitLater('load_station_route'); |
| 38 | return { | 210 | return { |
| 39 | - init: init | 211 | + init: init, |
| 212 | + getData: function () { | ||
| 213 | + return station_maps; | ||
| 214 | + }, | ||
| 215 | + getTemps: function () { | ||
| 216 | + return temps; | ||
| 217 | + }, | ||
| 218 | + clearFocus: clearFocus, | ||
| 219 | + focus: focus, | ||
| 220 | + showEditPanel: showEditPanel, | ||
| 221 | + hideEditPanel: hideEditPanel, | ||
| 222 | + reWriteEditPanel: reWriteEditPanel, | ||
| 223 | + update: update, | ||
| 224 | + drawEnd: drawEnd | ||
| 40 | }; | 225 | }; |
| 41 | }(); | 226 | }(); |
| 42 | \ No newline at end of file | 227 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 事件代理,提交数据 | ||
| 3 | + */ | ||
| 4 | +var gb_data_submit = function () { | ||
| 5 | + | ||
| 6 | + /** | ||
| 7 | + * 缓冲区编辑提交 | ||
| 8 | + */ | ||
| 9 | + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.submit', function (e) { | ||
| 10 | + var f = $(this).parents('form'); | ||
| 11 | + var data = f.serializeJSON(); | ||
| 12 | + UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() { | ||
| 13 | + | ||
| 14 | + //console.log('aaa',f, f.serializeJSON()); | ||
| 15 | + show_run_text('正在提交缓冲区信息'); | ||
| 16 | + gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) { | ||
| 17 | + hide_run_text(); | ||
| 18 | + UIkit.notification("提交成功!", {status: 'success'}); | ||
| 19 | + | ||
| 20 | + //更新前端数据 | ||
| 21 | + gb_station_route.update(rs.station); | ||
| 22 | + gb_ct_map.updateStation(rs.station); | ||
| 23 | + | ||
| 24 | + //退出编辑模式 | ||
| 25 | + gb_ct_map.exitEditBufferStatus(rs.station); | ||
| 26 | + }); | ||
| 27 | + }, function () { | ||
| 28 | + console.log('Rejected.') | ||
| 29 | + }); | ||
| 30 | + return false; | ||
| 31 | + }); | ||
| 32 | + | ||
| 33 | + var show_run_text = function (t) { | ||
| 34 | + $('.text', $loadPanel).text(t); | ||
| 35 | + $loadPanel.show(); | ||
| 36 | + }; | ||
| 37 | + | ||
| 38 | + var hide_run_text = function () { | ||
| 39 | + $('.text', $loadPanel).text(''); | ||
| 40 | + $loadPanel.hide(); | ||
| 41 | + }; | ||
| 42 | + return {}; | ||
| 43 | +}(); | ||
| 0 | \ No newline at end of file | 44 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/main.html
| @@ -5,20 +5,22 @@ | @@ -5,20 +5,22 @@ | ||
| 5 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
| 6 | <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> | 6 | <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/> |
| 7 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" /> | 7 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" /> |
| 8 | - <!-- flatpickr --> | ||
| 9 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css"> | ||
| 10 | - <!-- tooltip css--> | ||
| 11 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" /> | ||
| 12 | - <link rel="stylesheet" href="/real_control_v2/css/pace.css" /> | ||
| 13 | - | 8 | + <!-- jquery contextMenu style --> |
| 9 | + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" /> | ||
| 10 | + <link rel="stylesheet" | ||
| 11 | + href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" | ||
| 12 | + type="text/css" /> | ||
| 14 | <!-- main css --> | 13 | <!-- main css --> |
| 15 | <link rel="stylesheet" href="/pages/base/geo_data_edit/css/mian.css" /> | 14 | <link rel="stylesheet" href="/pages/base/geo_data_edit/css/mian.css" /> |
| 16 | </head> | 15 | </head> |
| 17 | 16 | ||
| 18 | <body> | 17 | <body> |
| 18 | +<div class="loading"> | ||
| 19 | + <div><span uk-spinner></span><span class="text">正在加载...</span></div> | ||
| 20 | +</div> | ||
| 19 | <div class="ct_page" > | 21 | <div class="ct_page" > |
| 20 | - <div id="map_wrap"> | ||
| 21 | - </div> | 22 | + <div id="map_wrap"></div> |
| 23 | + <div class="main_left_panel_m_layer"></div> | ||
| 22 | <div class="main_left_panel"> | 24 | <div class="main_left_panel"> |
| 23 | <div class="_line_info"> | 25 | <div class="_line_info"> |
| 24 | <div class="_line_name"> | 26 | <div class="_line_name"> |
| @@ -93,18 +95,18 @@ | @@ -93,18 +95,18 @@ | ||
| 93 | <script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> | 95 | <script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script> |
| 94 | <!-- jquery.serializejson JSON序列化插件 --> | 96 | <!-- jquery.serializejson JSON序列化插件 --> |
| 95 | <script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> | 97 | <script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script> |
| 96 | -<!-- flatpickr --> | ||
| 97 | -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script> | ||
| 98 | -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script> | ||
| 99 | -<!-- qtip --> | ||
| 100 | -<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" ></script> | ||
| 101 | <!-- common js --> | 98 | <!-- common js --> |
| 102 | <script src="/real_control_v2/js/common.js"></script> | 99 | <script src="/real_control_v2/js/common.js"></script> |
| 103 | - | 100 | +<script src="/assets/js/TransGPS.js" ></script> |
| 101 | +<!-- Geolib --> | ||
| 102 | +<script src="/real_control_v2/geolib/geolib.js" ></script> | ||
| 103 | +<!-- jquery contextMenu --> | ||
| 104 | +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" ></script> | ||
| 104 | <script> | 105 | <script> |
| 106 | + var $loadPanel = $('body>.loading'); | ||
| 105 | //___________________________________ | 107 | //___________________________________ |
| 106 | var storage = window.localStorage; | 108 | var storage = window.localStorage; |
| 107 | - storage.setItem("geo_data_edit_line_code" , "12040"); | 109 | + storage.setItem("geo_data_edit_line_code" , "70123"); |
| 108 | //___________________________________ | 110 | //___________________________________ |
| 109 | 111 | ||
| 110 | top.document.title = "绘制线路"; | 112 | top.document.title = "绘制线路"; |
| @@ -115,19 +117,38 @@ | @@ -115,19 +117,38 @@ | ||
| 115 | window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); | 117 | window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen'); |
| 116 | }); | 118 | }); |
| 117 | 119 | ||
| 118 | - | 120 | + var gb_main_ep = new EventProxy() |
| 119 | //文件加载 | 121 | //文件加载 |
| 120 | var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' | 122 | var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route' |
| 121 | , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { | 123 | , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () { |
| 122 | 124 | ||
| 123 | - UIkit.notification('加载完成!!'); | 125 | + //UIkit.notification('加载完成!!'); |
| 126 | + var eq = gb_main_ep; | ||
| 124 | 127 | ||
| 125 | - //站点路由 | ||
| 126 | - gb_station_route.init(); | ||
| 127 | - //路段路由 | ||
| 128 | - gb_road_route.init(); | 128 | + //站点 |
| 129 | + gb_station_route.init(g_emit('init_road')); | ||
| 130 | + //路段 | ||
| 131 | + eq.once('init_road', function () { | ||
| 132 | + gb_road_route.init(g_emit('init_map')) | ||
| 133 | + }) | ||
| 134 | + //地图 | ||
| 135 | + eq.once('init_map', function () { | ||
| 136 | + gb_ct_map._render(g_emit('end')); | ||
| 137 | + }); | ||
| 138 | + | ||
| 139 | + eq.once('end', function () { | ||
| 140 | + $loadPanel.hide(); | ||
| 141 | + }); | ||
| 129 | }); | 142 | }); |
| 130 | 143 | ||
| 144 | + function g_emit(id) { | ||
| 145 | + console.log('g_emit [' + id + ']'); | ||
| 146 | + return function () { | ||
| 147 | + console.log('eq.emitLater(' + id + ')'); | ||
| 148 | + return gb_main_ep.emitLater(id); | ||
| 149 | + }; | ||
| 150 | + } | ||
| 151 | + | ||
| 131 | //滚动条 | 152 | //滚动条 |
| 132 | $('._route_info_wrap>ul.uk-switcher').perfectScrollbar({suppressScrollX: true}); | 153 | $('._route_info_wrap>ul.uk-switcher').perfectScrollbar({suppressScrollX: true}); |
| 133 | 154 | ||
| @@ -135,6 +156,15 @@ | @@ -135,6 +156,15 @@ | ||
| 135 | $('.pos_tb_icon a').on('click', function () { | 156 | $('.pos_tb_icon a').on('click', function () { |
| 136 | UIkit.notification('top top...'); | 157 | UIkit.notification('top top...'); |
| 137 | }); | 158 | }); |
| 159 | + | ||
| 160 | + function getUpDown(){ | ||
| 161 | + return $('._route_info_wrap>ul>li:first').hasClass('uk-active')?0:1; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + //切换上下行显示 | ||
| 165 | + $('.up_down_route_list').on('show', function () { | ||
| 166 | + gb_ct_map.changeUpDown(); | ||
| 167 | + }); | ||
| 138 | </script> | 168 | </script> |
| 139 | 169 | ||
| 140 | <!--- js --> | 170 | <!--- js --> |
| @@ -144,5 +174,8 @@ | @@ -144,5 +174,8 @@ | ||
| 144 | <script src="/pages/base/geo_data_edit/js/version_manage.js" ></script> | 174 | <script src="/pages/base/geo_data_edit/js/version_manage.js" ></script> |
| 145 | <script src="/pages/base/geo_data_edit/js/history_edit_logs.js" ></script> | 175 | <script src="/pages/base/geo_data_edit/js/history_edit_logs.js" ></script> |
| 146 | <script src="/pages/base/geo_data_edit/js/map.js" ></script> | 176 | <script src="/pages/base/geo_data_edit/js/map.js" ></script> |
| 177 | +<script src="/pages/base/geo_data_edit/js/submit.js" ></script> | ||
| 178 | +<script type="text/javascript" | ||
| 179 | + src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script> | ||
| 147 | </body> | 180 | </body> |
| 148 | </html> | 181 | </html> |
| 149 | \ No newline at end of file | 182 | \ No newline at end of file |
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
| @@ -321,27 +321,7 @@ var gb_schedule_context_menu = (function () { | @@ -321,27 +321,7 @@ var gb_schedule_context_menu = (function () { | ||
| 321 | }, | 321 | }, |
| 322 | 'lj_zrw': { | 322 | 'lj_zrw': { |
| 323 | name: '临加/子任务' | 323 | name: '临加/子任务' |
| 324 | - }/*, | ||
| 325 | - 'shortcut': { | ||
| 326 | - name: '...', | ||
| 327 | - items: { | ||
| 328 | - 'add_temp_sch':{ | ||
| 329 | - name: '新增临加班次' | ||
| 330 | - }, | ||
| 331 | - 'add_oil': { | ||
| 332 | - name: '(子任务)空驶进出场' | ||
| 333 | - }, | ||
| 334 | - 'add_sub_task_in': { | ||
| 335 | - name: '(子任务)进场' | ||
| 336 | - }, | ||
| 337 | - 'add_sub_task_out': { | ||
| 338 | - name: '(子任务)出场' | ||
| 339 | - }, | ||
| 340 | - 'add_sub_task_range_turn': { | ||
| 341 | - name: '(子任务)区间调头' | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | - }*/, | 324 | + }, |
| 345 | 'sep3': '---------', | 325 | 'sep3': '---------', |
| 346 | 'add_temp_sch': { | 326 | 'add_temp_sch': { |
| 347 | name: '添加临加班次' | 327 | name: '添加临加班次' |