Commit 2c82f8207247834f6f5b0a435fc31a5b2be44d72
1 parent
41b11750
update
Showing
22 changed files
with
882 additions
and
114 deletions
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| 1 | package com.bsth.controller.realcontrol; | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | ||
| 3 | -import java.util.Map; | ||
| 4 | - | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 7 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | -import org.springframework.web.bind.annotation.RestController; | ||
| 11 | - | ||
| 12 | import com.bsth.controller.BaseController; | 3 | import com.bsth.controller.BaseController; |
| 13 | import com.bsth.entity.realcontrol.LineConfig; | 4 | import com.bsth.entity.realcontrol.LineConfig; |
| 14 | import com.bsth.service.realcontrol.LineConfigService; | 5 | import com.bsth.service.realcontrol.LineConfigService; |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.*; | ||
| 8 | + | ||
| 9 | +import java.util.Map; | ||
| 15 | 10 | ||
| 16 | @RestController | 11 | @RestController |
| 17 | @RequestMapping("/lineConfig") | 12 | @RequestMapping("/lineConfig") |
| @@ -39,4 +34,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | @@ -39,4 +34,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ | ||
| 39 | public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ | 34 | public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ |
| 40 | return lineConfigService.editOutTimeType(lineCode, type); | 35 | return lineConfigService.editOutTimeType(lineCode, type); |
| 41 | } | 36 | } |
| 37 | + | ||
| 38 | + @RequestMapping(value = "/getByLineCode") | ||
| 39 | + public LineConfig getByLineCode(@RequestParam String lineCode){ | ||
| 40 | + return lineConfigService.getByLineCode(lineCode); | ||
| 41 | + } | ||
| 42 | } | 42 | } |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
| @@ -26,4 +26,13 @@ public class RealMapController { | @@ -26,4 +26,13 @@ public class RealMapController { | ||
| 26 | public Map<String, Object> stationSpatialData(@RequestParam String idx){ | 26 | public Map<String, Object> stationSpatialData(@RequestParam String idx){ |
| 27 | return realMapService.stationSpatialData(idx); | 27 | return realMapService.stationSpatialData(idx); |
| 28 | } | 28 | } |
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 停车场 | ||
| 32 | + * @return | ||
| 33 | + */ | ||
| 34 | + @RequestMapping(value = "/carParkSpatialData") | ||
| 35 | + public Map<String, Object> carParkSpatialData(){ | ||
| 36 | + return realMapService.carParkSpatialData(); | ||
| 37 | + } | ||
| 29 | } | 38 | } |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata; | @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | +import com.bsth.Application; | ||
| 5 | import com.bsth.data.BasicData; | 6 | import com.bsth.data.BasicData; |
| 6 | import com.bsth.data.forecast.ForecastRealServer; | 7 | import com.bsth.data.forecast.ForecastRealServer; |
| 7 | import com.bsth.data.schedule.DayOfSchedule; | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| @@ -23,6 +24,7 @@ import org.springframework.stereotype.Component; | @@ -23,6 +24,7 @@ import org.springframework.stereotype.Component; | ||
| 23 | import java.io.BufferedReader; | 24 | import java.io.BufferedReader; |
| 24 | import java.io.InputStreamReader; | 25 | import java.io.InputStreamReader; |
| 25 | import java.util.*; | 26 | import java.util.*; |
| 27 | +import java.util.concurrent.TimeUnit; | ||
| 26 | 28 | ||
| 27 | /** | 29 | /** |
| 28 | * | 30 | * |
| @@ -65,7 +67,7 @@ public class GpsRealData implements CommandLineRunner{ | @@ -65,7 +67,7 @@ public class GpsRealData implements CommandLineRunner{ | ||
| 65 | @Override | 67 | @Override |
| 66 | public void run(String... arg0) throws Exception { | 68 | public void run(String... arg0) throws Exception { |
| 67 | logger.info("gpsDataLoader,20,6"); | 69 | logger.info("gpsDataLoader,20,6"); |
| 68 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); | 70 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); |
| 69 | } | 71 | } |
| 70 | 72 | ||
| 71 | public GpsEntity add(GpsEntity gps) { | 73 | public GpsEntity add(GpsEntity gps) { |
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
| 1 | package com.bsth.service.realcontrol; | 1 | package com.bsth.service.realcontrol; |
| 2 | 2 | ||
| 3 | -import java.util.Map; | ||
| 4 | - | ||
| 5 | import com.bsth.entity.realcontrol.LineConfig; | 3 | import com.bsth.entity.realcontrol.LineConfig; |
| 6 | import com.bsth.service.BaseService; | 4 | import com.bsth.service.BaseService; |
| 7 | 5 | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | public interface LineConfigService extends BaseService<LineConfig, Integer>{ | 8 | public interface LineConfigService extends BaseService<LineConfig, Integer>{ |
| 9 | 9 | ||
| 10 | Map<String, Object> check(String[] codeArray); | 10 | Map<String, Object> check(String[] codeArray); |
| @@ -15,4 +15,5 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ | @@ -15,4 +15,5 @@ public interface LineConfigService extends BaseService<LineConfig, Integer>{ | ||
| 15 | 15 | ||
| 16 | Map<String, Object> editOutTimeType(String lineCode, int type); | 16 | Map<String, Object> editOutTimeType(String lineCode, int type); |
| 17 | 17 | ||
| 18 | + LineConfig getByLineCode(String lineCode); | ||
| 18 | } | 19 | } |
src/main/java/com/bsth/service/realcontrol/RealMapService.java
| @@ -7,4 +7,6 @@ import java.util.Map; | @@ -7,4 +7,6 @@ import java.util.Map; | ||
| 7 | */ | 7 | */ |
| 8 | public interface RealMapService { | 8 | public interface RealMapService { |
| 9 | Map<String, Object> stationSpatialData(String idx); | 9 | Map<String, Object> stationSpatialData(String idx); |
| 10 | + | ||
| 11 | + Map<String,Object> carParkSpatialData(); | ||
| 10 | } | 12 | } |
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
| 1 | package com.bsth.service.realcontrol.impl; | 1 | package com.bsth.service.realcontrol.impl; |
| 2 | 2 | ||
| 3 | -import java.util.ArrayList; | ||
| 4 | -import java.util.HashMap; | ||
| 5 | -import java.util.List; | ||
| 6 | -import java.util.Map; | ||
| 7 | - | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.stereotype.Service; | ||
| 10 | - | ||
| 11 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 12 | import com.bsth.data.LineConfigData; | 4 | import com.bsth.data.LineConfigData; |
| 13 | import com.bsth.entity.realcontrol.LineConfig; | 5 | import com.bsth.entity.realcontrol.LineConfig; |
| 14 | import com.bsth.repository.realcontrol.LineConfigRepository; | 6 | import com.bsth.repository.realcontrol.LineConfigRepository; |
| 15 | import com.bsth.service.impl.BaseServiceImpl; | 7 | import com.bsth.service.impl.BaseServiceImpl; |
| 16 | import com.bsth.service.realcontrol.LineConfigService; | 8 | import com.bsth.service.realcontrol.LineConfigService; |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | + | ||
| 12 | +import java.util.ArrayList; | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 17 | 16 | ||
| 18 | @Service | 17 | @Service |
| 19 | public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService{ | 18 | public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> implements LineConfigService{ |
| @@ -78,4 +77,9 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | @@ -78,4 +77,9 @@ public class LineConfigServiceImpl extends BaseServiceImpl<LineConfig, Integer> | ||
| 78 | rs.put("type", type); | 77 | rs.put("type", type); |
| 79 | return rs; | 78 | return rs; |
| 80 | } | 79 | } |
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public LineConfig getByLineCode(String lineCode) { | ||
| 83 | + return lineConfigData.get(lineCode); | ||
| 84 | + } | ||
| 81 | } | 85 | } |
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
| @@ -2,6 +2,7 @@ package com.bsth.service.realcontrol.impl; | @@ -2,6 +2,7 @@ package com.bsth.service.realcontrol.impl; | ||
| 2 | 2 | ||
| 3 | import com.bsth.common.ResponseCode; | 3 | import com.bsth.common.ResponseCode; |
| 4 | import com.bsth.controller.realcontrol.dto.StationSpatialData; | 4 | import com.bsth.controller.realcontrol.dto.StationSpatialData; |
| 5 | +import com.bsth.entity.CarPark; | ||
| 5 | import com.bsth.service.realcontrol.RealMapService; | 6 | import com.bsth.service.realcontrol.RealMapService; |
| 6 | import com.google.common.base.Splitter; | 7 | import com.google.common.base.Splitter; |
| 7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| @@ -52,4 +53,22 @@ public class RealMapServiceImpl implements RealMapService { | @@ -52,4 +53,22 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 52 | 53 | ||
| 53 | return rs; | 54 | return rs; |
| 54 | } | 55 | } |
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public Map<String, Object> carParkSpatialData() { | ||
| 59 | + Map<String, Object> rs = new HashMap(); | ||
| 60 | + | ||
| 61 | + try { | ||
| 62 | + String sql = "select ID, AREA,PARK_CODE,PARK_NAME,ST_AsText(G_PARK_POINT) as G_PARK_POINT,G_CENTER_POINT,RADIUS,SHAPES_TYPE from bsth_c_car_park WHERE destroy=0"; | ||
| 63 | + | ||
| 64 | + List<CarPark> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CarPark.class)); | ||
| 65 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 66 | + rs.put("list", list); | ||
| 67 | + } catch (Exception e) { | ||
| 68 | + logger.error("", e); | ||
| 69 | + rs.put("status", ResponseCode.ERROR); | ||
| 70 | + rs.put("msg", "查询停车场空间数据出现异常!"); | ||
| 71 | + } | ||
| 72 | + return rs; | ||
| 73 | + } | ||
| 55 | } | 74 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -276,8 +276,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -276,8 +276,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 276 | return rs; | 276 | return rs; |
| 277 | } | 277 | } |
| 278 | //截取工号 | 278 | //截取工号 |
| 279 | - if(t.getsGh().indexOf("-") != -1){ | ||
| 280 | - t.setsGh(t.getsGh().split("-")[1]); | 279 | + if(t.getjGh().indexOf("-") != -1){ |
| 280 | + t.setjGh(t.getjGh().split("-")[1]); | ||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | t.setScheduleDateStr(schDate); | 283 | t.setScheduleDateStr(schDate); |
| @@ -1631,7 +1631,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1631,7 +1631,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1631 | */ | 1631 | */ |
| 1632 | @Override | 1632 | @Override |
| 1633 | public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) { | 1633 | public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) { |
| 1634 | - Map<String, Object> rs = new HashMap<>(); | 1634 | + Map<String, Object> rs = new HashMap<>() |
| 1635 | + ,tempMap = new HashMap<>(); | ||
| 1635 | List<ScheduleRealInfo> list = new ArrayList<>(); | 1636 | List<ScheduleRealInfo> list = new ArrayList<>(); |
| 1636 | 1637 | ||
| 1637 | ScheduleRealInfo sch,next; | 1638 | ScheduleRealInfo sch,next; |
| @@ -1639,20 +1640,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1639,20 +1640,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1639 | if(StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) | 1640 | if(StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) |
| 1640 | continue; | 1641 | continue; |
| 1641 | 1642 | ||
| 1642 | - sch = dayOfSchedule.get(dc.getSchId()); | 1643 | + /*sch = dayOfSchedule.get(dc.getSchId()); |
| 1643 | if(sch==null) | 1644 | if(sch==null) |
| 1644 | continue; | 1645 | continue; |
| 1645 | 1646 | ||
| 1646 | sch.setDfsjAll(dc.getNew_dfsj()); | 1647 | sch.setDfsjAll(dc.getNew_dfsj()); |
| 1647 | //重新计算终点时间 | 1648 | //重新计算终点时间 |
| 1648 | sch.calcEndTime(); | 1649 | sch.calcEndTime(); |
| 1649 | - list.add(sch); | 1650 | + list.add(sch);*/ |
| 1651 | + tempMap = outgoAdjust(dc.getSchId(),"", dc.getNew_dfsj()); | ||
| 1650 | 1652 | ||
| 1651 | - next=dayOfSchedule.next(sch); | ||
| 1652 | - if(next.getQdzName().equals(sch.getZdzName())){ | 1653 | + if(tempMap.get("status").equals(ResponseCode.SUCCESS)){ |
| 1654 | + list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); | ||
| 1655 | + } | ||
| 1656 | + //next=dayOfSchedule.next(sch); | ||
| 1657 | + /*if(next.getQdzName().equals(sch.getZdzName())){ | ||
| 1653 | next.setQdzArrDateJH(sch.getZdsj()); | 1658 | next.setQdzArrDateJH(sch.getZdsj()); |
| 1654 | list.add(next); | 1659 | list.add(next); |
| 1655 | - } | 1660 | + }*/ |
| 1656 | } | 1661 | } |
| 1657 | 1662 | ||
| 1658 | rs.put("status", ResponseCode.SUCCESS); | 1663 | rs.put("status", ResponseCode.SUCCESS); |
src/main/resources/static/real_control_v2/assets/js/GeoUtils_min.js
0 → 100644
| 1 | +var BMapLib=window.BMapLib=BMapLib||{};(function(){var a=6370996.81;var b=BMapLib.GeoUtils=function(){};b.isPointInRect=function(f,g){if(!(f instanceof BMap.Point)||!(g instanceof BMap.Bounds)){return false}var e=g.getSouthWest();var h=g.getNorthEast();return(f.lng>=e.lng&&f.lng<=h.lng&&f.lat>=e.lat&&f.lat<=h.lat)};b.isPointInCircle=function(e,h){if(!(e instanceof BMap.Point)||!(h instanceof BMap.Circle)){return false}var i=h.getCenter();var g=h.getRadius();var f=b.getDistance(e,i);if(f<=g){return true}else{return false}};b.isPointOnPolyline=function(f,h){if(!(f instanceof BMap.Point)||!(h instanceof BMap.Polyline)){return false}var e=h.getBounds();if(!this.isPointInRect(f,e)){return false}var m=h.getPath();for(var k=0;k<m.length-1;k++){var l=m[k];var j=m[k+1];if(f.lng>=Math.min(l.lng,j.lng)&&f.lng<=Math.max(l.lng,j.lng)&&f.lat>=Math.min(l.lat,j.lat)&&f.lat<=Math.max(l.lat,j.lat)){var g=(l.lng-f.lng)*(j.lat-f.lat)-(j.lng-f.lng)*(l.lat-f.lat);if(g<2e-10&&g>-2e-10){return true}}}return false};b.isPointInPolygon=function(o,l){if(!(o instanceof BMap.Point)||!(l instanceof BMap.Polygon)){return false}var k=l.getBounds();if(!this.isPointInRect(o,k)){return false}var t=l.getPath();var h=t.length;var n=true;var j=0;var g=2e-10;var s,q;var e=o;s=t[0];for(var f=1;f<=h;++f){if(e.equals(s)){return n}q=t[f%h];if(e.lat<Math.min(s.lat,q.lat)||e.lat>Math.max(s.lat,q.lat)){s=q;continue}if(e.lat>Math.min(s.lat,q.lat)&&e.lat<Math.max(s.lat,q.lat)){if(e.lng<=Math.max(s.lng,q.lng)){if(s.lat==q.lat&&e.lng>=Math.min(s.lng,q.lng)){return n}if(s.lng==q.lng){if(s.lng==e.lng){return n}else{++j}}else{var r=(e.lat-s.lat)*(q.lng-s.lng)/(q.lat-s.lat)+s.lng;if(Math.abs(e.lng-r)<g){return n}if(e.lng<r){++j}}}}else{if(e.lat==q.lat&&e.lng<=q.lng){var m=t[(f+1)%h];if(e.lat>=Math.min(s.lat,m.lat)&&e.lat<=Math.max(s.lat,m.lat)){++j}else{j+=2}}}s=q}if(j%2==0){return false}else{return true}};b.degreeToRad=function(e){return Math.PI*e/180};b.radToDegree=function(e){return(180*e)/Math.PI};function d(g,f,e){if(f!=null){g=Math.max(g,f)}if(e!=null){g=Math.min(g,e)}return g}function c(g,f,e){while(g>e){g-=e-f}while(g<f){g+=e-f}return g}b.getDistance=function(j,h){if(!(j instanceof BMap.Point)||!(h instanceof BMap.Point)){return 0}j.lng=c(j.lng,-180,180);j.lat=d(j.lat,-74,74);h.lng=c(h.lng,-180,180);h.lat=d(h.lat,-74,74);var f,e,i,g;f=b.degreeToRad(j.lng);i=b.degreeToRad(j.lat);e=b.degreeToRad(h.lng);g=b.degreeToRad(h.lat);return a*Math.acos((Math.sin(i)*Math.sin(g)+Math.cos(i)*Math.cos(g)*Math.cos(e-f)))};b.getPolylineDistance=function(f){if(f instanceof BMap.Polyline||f instanceof Array){var l;if(f instanceof BMap.Polyline){l=f.getPath()}else{l=f}if(l.length<2){return 0}var j=0;for(var h=0;h<l.length-1;h++){var k=l[h];var g=l[h+1];var e=b.getDistance(k,g);j+=e}return j}else{return 0}};b.getPolygonArea=function(t){if(!(t instanceof BMap.Polygon)&&!(t instanceof Array)){return 0}var R;if(t instanceof BMap.Polygon){R=t.getPath()}else{R=t}if(R.length<3){return 0}var w=0;var D=0;var C=0;var L=0;var J=0;var F=0;var E=0;var S=0;var H=0;var p=0;var T=0;var I=0;var q=0;var e=0;var M=0;var v=0;var K=0;var N=0;var s=0;var O=0;var l=0;var g=0;var z=0;var Q=0;var G=0;var j=0;var A=0;var o=0;var m=0;var y=0;var x=0;var h=0;var k=0;var f=0;var n=a;var B=R.length;for(var P=0;P<B;P++){if(P==0){D=R[B-1].lng*Math.PI/180;C=R[B-1].lat*Math.PI/180;L=R[0].lng*Math.PI/180;J=R[0].lat*Math.PI/180;F=R[1].lng*Math.PI/180;E=R[1].lat*Math.PI/180}else{if(P==B-1){D=R[B-2].lng*Math.PI/180;C=R[B-2].lat*Math.PI/180;L=R[B-1].lng*Math.PI/180;J=R[B-1].lat*Math.PI/180;F=R[0].lng*Math.PI/180;E=R[0].lat*Math.PI/180}else{D=R[P-1].lng*Math.PI/180;C=R[P-1].lat*Math.PI/180;L=R[P].lng*Math.PI/180;J=R[P].lat*Math.PI/180;F=R[P+1].lng*Math.PI/180;E=R[P+1].lat*Math.PI/180}}S=Math.cos(J)*Math.cos(L);H=Math.cos(J)*Math.sin(L);p=Math.sin(J);T=Math.cos(C)*Math.cos(D);I=Math.cos(C)*Math.sin(D);q=Math.sin(C);e=Math.cos(E)*Math.cos(F);M=Math.cos(E)*Math.sin(F);v=Math.sin(E);K=(S*S+H*H+p*p)/(S*T+H*I+p*q);N=(S*S+H*H+p*p)/(S*e+H*M+p*v);s=K*T-S;O=K*I-H;l=K*q-p;g=N*e-S;z=N*M-H;Q=N*v-p;m=(g*s+z*O+Q*l)/(Math.sqrt(g*g+z*z+Q*Q)*Math.sqrt(s*s+O*O+l*l));m=Math.acos(m);G=z*l-Q*O;j=0-(g*l-Q*s);A=g*O-z*s;if(S!=0){o=G/S}else{if(H!=0){o=j/H}else{o=A/p}}if(o>0){y+=m;k++}else{x+=m;h++}}var u,r;u=y+(2*Math.PI*h-x);r=(2*Math.PI*k-y)+x;if(y>x){if((u-(B-2)*Math.PI)<1){f=u}else{f=r}}else{if((r-(B-2)*Math.PI)<1){f=r}else{f=u}}w=(f-(B-2)*Math.PI)*n*n;return w}})(); | ||
| 0 | \ No newline at end of file | 2 | \ No newline at end of file |
src/main/resources/static/real_control_v2/css/main.css
src/main/resources/static/real_control_v2/css/north.css
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/multi_dftz.html
| @@ -48,7 +48,17 @@ | @@ -48,7 +48,17 @@ | ||
| 48 | <script> | 48 | <script> |
| 49 | (function() { | 49 | (function() { |
| 50 | var modal = '#schedule-multi-dftz-modal'; | 50 | var modal = '#schedule-multi-dftz-modal'; |
| 51 | + var lineConfig; | ||
| 52 | + var dateStr = moment().format('YYYY-MM-DD'); | ||
| 53 | + | ||
| 51 | $(modal).on('init', function(e, data) { | 54 | $(modal).on('init', function(e, data) { |
| 55 | + var firstSch = data.list[0]; | ||
| 56 | + //获取线路配置信息 | ||
| 57 | + $.get('/lineConfig/getByLineCode', {lineCode: firstSch.xlBm}, function (config) { | ||
| 58 | + //console.log('线路配置', config); | ||
| 59 | + lineConfig=config; | ||
| 60 | + }); | ||
| 61 | + | ||
| 52 | var bodyHtml = template('schedule-multi-dftz-table-temp', data); | 62 | var bodyHtml = template('schedule-multi-dftz-table-temp', data); |
| 53 | $('.multi-dftz-table .ct_table_body', modal).html(bodyHtml); | 63 | $('.multi-dftz-table .ct_table_body', modal).html(bodyHtml); |
| 54 | 64 | ||
| @@ -93,8 +103,8 @@ | @@ -93,8 +103,8 @@ | ||
| 93 | }); | 103 | }); |
| 94 | 104 | ||
| 95 | var valChange = function() { | 105 | var valChange = function() { |
| 96 | - var old = moment($(this).data('old'), "HH:mm"), | ||
| 97 | - now = moment($(this).val(), "HH:mm"), | 106 | + var old = correctDate(moment(dateStr+$(this).data('old'), "YYYY-MM-DDHH:mm")), |
| 107 | + now = correctDate(moment(dateStr+$(this).val(), "YYYY-MM-DDHH:mm")), | ||
| 98 | diff = now.diff(old) / 1000 / 60, | 108 | diff = now.diff(old) / 1000 / 60, |
| 99 | span = $(this).next('.modify-num'); | 109 | span = $(this).next('.modify-num'); |
| 100 | 110 | ||
| @@ -104,6 +114,17 @@ | @@ -104,6 +114,17 @@ | ||
| 104 | span.text(''); | 114 | span.text(''); |
| 105 | } else | 115 | } else |
| 106 | span.addClass('negative').text('-' + Math.abs(diff)); | 116 | span.addClass('negative').text('-' + Math.abs(diff)); |
| 117 | + }; | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + function correctDate(d){ | ||
| 121 | + //小于线路运营开始时间,加一天 | ||
| 122 | + if(lineConfig){ | ||
| 123 | + var time = d.format('HH:mm'); | ||
| 124 | + if(time < lineConfig.startOpt) | ||
| 125 | + d.add(1, 'days'); | ||
| 126 | + } | ||
| 127 | + return d; | ||
| 107 | } | 128 | } |
| 108 | 129 | ||
| 109 | //drag.... | 130 | //drag.... |
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
| @@ -320,10 +320,56 @@ | @@ -320,10 +320,56 @@ | ||
| 320 | background: rgba(255, 255, 255, 0.98); | 320 | background: rgba(255, 255, 255, 0.98); |
| 321 | box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | 321 | box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); |
| 322 | display: none; | 322 | display: none; |
| 323 | + | ||
| 324 | + padding-top: 10px; | ||
| 323 | } | 325 | } |
| 324 | 326 | ||
| 325 | .station-route-tree{ | 327 | .station-route-tree{ |
| 328 | + height: 100%; | ||
| 329 | + overflow: auto; | ||
| 330 | + padding: 0 0 0 9px; | ||
| 331 | +} | ||
| 332 | + | ||
| 333 | +.top-right-toggle{ | ||
| 334 | + position: absolute; | ||
| 335 | + right: 2px; | ||
| 336 | + top: 2px; | ||
| 337 | +} | ||
| 338 | + | ||
| 339 | +.top-right-toggle ul.uk-subnav{ | ||
| 340 | + display: none; | ||
| 341 | +} | ||
| 342 | + | ||
| 343 | +.top-right-toggle ul.uk-subnav>li{ | ||
| 344 | + padding-left: 0; | ||
| 345 | +} | ||
| 346 | + | ||
| 347 | +.top-right-toggle ul.uk-subnav>li>a{ | ||
| 348 | + padding: 0 3px; | ||
| 349 | + font-size: 13px; | ||
| 350 | +} | ||
| 351 | + | ||
| 352 | +.real_spatial_body{ | ||
| 326 | width: 100%; | 353 | width: 100%; |
| 327 | height: 100%; | 354 | height: 100%; |
| 355 | + transition: all .3s ease; | ||
| 356 | +} | ||
| 357 | + | ||
| 358 | +.real_spatial_body.show-tab{ | ||
| 359 | + height: calc(100% - 28px); | ||
| 360 | + margin-top: 28px; | ||
| 361 | +} | ||
| 362 | + | ||
| 363 | +.real_spatial_body #spatial-tree-content{ | ||
| 364 | + height: 100%; | ||
| 365 | +} | ||
| 366 | + | ||
| 367 | +.real_spatial_body #spatial-tree-content li.car-park-item, | ||
| 368 | +.real_spatial_body #spatial-tree-content li.station-route-item{ | ||
| 369 | + height: 100%; | ||
| 328 | overflow: auto; | 370 | overflow: auto; |
| 371 | +} | ||
| 372 | + | ||
| 373 | +#spatial-tree-content .jstree-default .jstree-anchor{ | ||
| 374 | + font-size: 13px; | ||
| 329 | } | 375 | } |
| 330 | \ No newline at end of file | 376 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_config.html
| @@ -14,8 +14,8 @@ | @@ -14,8 +14,8 @@ | ||
| 14 | <span class="uk-form-label">空间数据</span> | 14 | <span class="uk-form-label">空间数据</span> |
| 15 | <div class="uk-form-controls"> | 15 | <div class="uk-form-controls"> |
| 16 | <label><input type="checkbox" name="spatial_data_station" {{if spatialData.station}}checked{{/if}}> 站点</label> | 16 | <label><input type="checkbox" name="spatial_data_station" {{if spatialData.station}}checked{{/if}}> 站点</label> |
| 17 | - <label><input type="checkbox" {{if spatialData.electronicFence}}checked{{/if}}> 电子围栏</label> | ||
| 18 | - <label><input type="checkbox" {{if spatialData.carPark}}checked{{/if}}> 停车场</label> | 17 | + <label><input type="checkbox" name="spatial_electronicFence" {{if spatialData.electronicFence}}checked{{/if}}> 电子围栏</label> |
| 18 | + <label><input type="checkbox" name="spatial_data_carPark" {{if spatialData.carPark}}checked{{/if}}> 停车场</label> | ||
| 19 | </div> | 19 | </div> |
| 20 | </div> | 20 | </div> |
| 21 | 21 |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
| 1 | <div> | 1 | <div> |
| 2 | <script id="map-win-gps-detail-temp" type="text/html"> | 2 | <script id="map-win-gps-detail-temp" type="text/html"> |
| 3 | - <div class="gps_info_win" > | 3 | + <div class="gps_info_win"> |
| 4 | <h4>{{nbbm}}</h4> | 4 | <h4>{{nbbm}}</h4> |
| 5 | <h5> | 5 | <h5> |
| 6 | {{lineName}} | 6 | {{lineName}} |
| @@ -23,5 +23,64 @@ | @@ -23,5 +23,64 @@ | ||
| 23 | <a href="javascript:;" style="float: right;">轨迹回放</a> | 23 | <a href="javascript:;" style="float: right;">轨迹回放</a> |
| 24 | </div> | 24 | </div> |
| 25 | </script> | 25 | </script> |
| 26 | -</div> | ||
| 27 | -<!-- 2222 --> | ||
| 28 | \ No newline at end of file | 26 | \ No newline at end of file |
| 27 | + | ||
| 28 | + <script id="map-win-station-detail-temp" type="text/html"> | ||
| 29 | + <div class="gps_info_win"> | ||
| 30 | + <h4>{{stationName}}</h4> | ||
| 31 | + <p>方向: | ||
| 32 | + {{if directions==0}} | ||
| 33 | + 上行 | ||
| 34 | + {{else if directions==1}} | ||
| 35 | + 下行 | ||
| 36 | + {{/if}} | ||
| 37 | + </p> | ||
| 38 | + <p>站点编码: {{stationCode}}</p> | ||
| 39 | + <p>站点类型: | ||
| 40 | + {{if stationMark=='B'}} | ||
| 41 | + 起点站 | ||
| 42 | + {{else if stationMark=='E'}} | ||
| 43 | + 终点站 | ||
| 44 | + {{else if stationMark=='Z'}} | ||
| 45 | + 中途站 | ||
| 46 | + {{/if}} | ||
| 47 | + </p> | ||
| 48 | + <p> | ||
| 49 | + 经度: {{lon}} | ||
| 50 | + </p> | ||
| 51 | + <p>纬度: {{lat}}</p> | ||
| 52 | + {{if distances > 0}} | ||
| 53 | + <p>到站距离: {{distances}} 公里</p> | ||
| 54 | + {{/if}} | ||
| 55 | + <p> | ||
| 56 | + 电子围栏类型: | ||
| 57 | + {{if shapesType=='r'}} | ||
| 58 | + 圆形 | ||
| 59 | + {{else if shapesType=='d'}} | ||
| 60 | + 多边形 | ||
| 61 | + {{/if}} | ||
| 62 | + </p> | ||
| 63 | + <p> | ||
| 64 | + {{if shapesType=='r'}} | ||
| 65 | + 半径:{{radius}} | ||
| 66 | + {{else if shapesType=='d'}} | ||
| 67 | + 面积:{{_polygonArea}} 平方米 | ||
| 68 | + {{/if}} | ||
| 69 | + </p> | ||
| 70 | + </div> | ||
| 71 | + </script> | ||
| 72 | + | ||
| 73 | + <script id="map-win-carpark-detail-temp" type="text/html"> | ||
| 74 | + <div class="gps_info_win"> | ||
| 75 | + <h4>{{parkName}}</h4> | ||
| 76 | + <p>停车场编码: {{parkCode}}</p> | ||
| 77 | + <p>面积:{{area}}</p> | ||
| 78 | + <p> | ||
| 79 | + {{if shapesType=='r'}} | ||
| 80 | + 电子围栏半径:{{radius}} | ||
| 81 | + {{else if shapesType=='d'}} | ||
| 82 | + 电子围栏面积:{{_polygonArea}} 平方米 | ||
| 83 | + {{/if}} | ||
| 84 | + </p> | ||
| 85 | + </div> | ||
| 86 | + </script> | ||
| 87 | +</div> | ||
| 29 | \ No newline at end of file | 88 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/js/config.js
| @@ -84,7 +84,9 @@ var gb_map_config = (function () { | @@ -84,7 +84,9 @@ var gb_map_config = (function () { | ||
| 84 | var handler = { | 84 | var handler = { |
| 85 | map_type: changeMapType, | 85 | map_type: changeMapType, |
| 86 | traffic: trafficSwitch, | 86 | traffic: trafficSwitch, |
| 87 | - spatial_data_station: spatial_data_station | 87 | + spatial_data_station: spatial_data_station, |
| 88 | + spatial_data_carPark: spatial_data_carPark, | ||
| 89 | + spatial_electronicFence: spatial_electronicFence | ||
| 88 | }; | 90 | }; |
| 89 | 91 | ||
| 90 | //切换地图类型 | 92 | //切换地图类型 |
| @@ -113,7 +115,26 @@ var gb_map_config = (function () { | @@ -113,7 +115,26 @@ var gb_map_config = (function () { | ||
| 113 | //空间数据 站点 | 115 | //空间数据 站点 |
| 114 | function spatial_data_station(val) { | 116 | function spatial_data_station(val) { |
| 115 | defaultConfig.spatialData.station=this.checked; | 117 | defaultConfig.spatialData.station=this.checked; |
| 116 | - gb_map_spatial_data.refresh(); | 118 | + if(!this.checked) |
| 119 | + gb_map_imap.call('hideAllStationMarker'); | ||
| 120 | + gb_map_spatial_data.refresh('station', this.checked); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + //空间数据 停车场 | ||
| 124 | + function spatial_data_carPark(val) { | ||
| 125 | + defaultConfig.spatialData.carPark=this.checked; | ||
| 126 | + if(!this.checked) | ||
| 127 | + gb_map_imap.call('hideDrawCarpark'); | ||
| 128 | + gb_map_spatial_data.refresh('carPark', this.checked); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + //空间数据 电子围栏 | ||
| 132 | + function spatial_electronicFence(val) { | ||
| 133 | + defaultConfig.spatialData.electronicFence=this.checked; | ||
| 134 | + if(this.checked) | ||
| 135 | + gb_map_overlay_mge.drawElectronicFence(); | ||
| 136 | + else | ||
| 137 | + gb_map_imap.call('hideAllCircles'); | ||
| 117 | } | 138 | } |
| 118 | 139 | ||
| 119 | function recursion_get_attr(data, attr) { | 140 | function recursion_get_attr(data, attr) { |
src/main/resources/static/real_control_v2/mapmonitor/js/gps_tree.js
| @@ -24,8 +24,9 @@ var gb_map_gps_tree = (function () { | @@ -24,8 +24,9 @@ var gb_map_gps_tree = (function () { | ||
| 24 | cb && cb(); | 24 | cb && cb(); |
| 25 | }) | 25 | }) |
| 26 | .on('activate_node.jstree', function (e, n) { | 26 | .on('activate_node.jstree', function (e, n) { |
| 27 | + //console.log('activate_node.jstree', e, n); | ||
| 27 | var node = n.node; | 28 | var node = n.node; |
| 28 | - if(node.a_attr && node.a_attr.type=='device'){ | 29 | + if(node.a_attr && node.a_attr.type=='device' && node.state.checked){ |
| 29 | var device = node.a_attr.device; | 30 | var device = node.a_attr.device; |
| 30 | gb_map_overlay_mge._focus(device); | 31 | gb_map_overlay_mge._focus(device); |
| 31 | } | 32 | } |
| @@ -55,6 +56,10 @@ var gb_map_gps_tree = (function () { | @@ -55,6 +56,10 @@ var gb_map_gps_tree = (function () { | ||
| 55 | } | 56 | } |
| 56 | } | 57 | } |
| 57 | }, | 58 | }, |
| 59 | + //local storage里的key | ||
| 60 | + 'state':{ | ||
| 61 | + 'key': 'jstree_map_devices' | ||
| 62 | + }, | ||
| 58 | 'plugins': ['checkbox', 'contextmenu', 'state'] | 63 | 'plugins': ['checkbox', 'contextmenu', 'state'] |
| 59 | }); | 64 | }); |
| 60 | }; | 65 | }; |
src/main/resources/static/real_control_v2/mapmonitor/js/map/iMap.js
| @@ -34,6 +34,7 @@ var gb_map_imap = (function () { | @@ -34,6 +34,7 @@ var gb_map_imap = (function () { | ||
| 34 | alertErr('不存在的地图实例' + mapName); | 34 | alertErr('不存在的地图实例' + mapName); |
| 35 | }, | 35 | }, |
| 36 | createCarIcon: createCarIcon, | 36 | createCarIcon: createCarIcon, |
| 37 | + createStationIcon: createStationIcon, | ||
| 37 | call: function (f, opts) { | 38 | call: function (f, opts) { |
| 38 | var instance = maps[currentMap].instance; | 39 | var instance = maps[currentMap].instance; |
| 39 | if (instance[f]) | 40 | if (instance[f]) |
| @@ -66,11 +67,50 @@ var gb_map_imap = (function () { | @@ -66,11 +67,50 @@ var gb_map_imap = (function () { | ||
| 66 | //文字 | 67 | //文字 |
| 67 | ctx.font = "14px arial"; | 68 | ctx.font = "14px arial"; |
| 68 | ctx.fillStyle = "#fff"; | 69 | ctx.fillStyle = "#fff"; |
| 69 | - ctx.fillText(gps.nbbm, 8, 18); | 70 | + ctx.fillText(gps.nbbm, 4, 18); |
| 70 | 71 | ||
| 71 | return canvas.toDataURL(); | 72 | return canvas.toDataURL(); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| 75 | + //绘制站点icon | ||
| 76 | + function createStationIcon(station, w) { | ||
| 77 | + var canvas = $('<canvas></canvas>')[0]; | ||
| 78 | + var ctx = canvas.getContext('2d'); | ||
| 79 | + | ||
| 80 | +/* var color=station.directions==0?'#125688':'#fb1804' | ||
| 81 | + ,bg='rgba(255, 255, 255, 0.87)';*/ | ||
| 82 | + | ||
| 83 | + var color='#fff', | ||
| 84 | + bg=station.directions==0?'#125688':'#fb1804'; | ||
| 85 | + //矩形 | ||
| 86 | + //ctx.roundRect(0, 0, w, 17, 1).stroke(); | ||
| 87 | + ctx.rect(-1,-1,w,17); | ||
| 88 | + ctx.fillStyle = bg; | ||
| 89 | + ctx.fill(); | ||
| 90 | + //ctx.lineWidth = 1; | ||
| 91 | + //ctx.strokeStyle=color; | ||
| 92 | + //ctx.stroke(); | ||
| 93 | + | ||
| 94 | + //文字 | ||
| 95 | + ctx.font = "12px arial"; | ||
| 96 | + ctx.fillStyle = color; | ||
| 97 | + ctx.fillText(station.stationName, 2, 12); | ||
| 98 | + | ||
| 99 | + //角 | ||
| 100 | + var c=w/2; | ||
| 101 | + ctx.beginPath(); | ||
| 102 | + ctx.moveTo(c - 7,16); | ||
| 103 | + ctx.lineTo(c,24); | ||
| 104 | + ctx.lineTo(c + 7,16); | ||
| 105 | + ctx.closePath(); | ||
| 106 | + | ||
| 107 | + ctx.fillStyle = bg; | ||
| 108 | + ctx.fill(); | ||
| 109 | + ctx.strokeStyle='#fff'; | ||
| 110 | + ctx.stroke(); | ||
| 111 | + return canvas.toDataURL(); | ||
| 112 | + } | ||
| 113 | + | ||
| 74 | function color(g) { | 114 | function color(g) { |
| 75 | var colours = {}; | 115 | var colours = {}; |
| 76 | switch (g.state) { | 116 | switch (g.state) { |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
| @@ -2,15 +2,20 @@ | @@ -2,15 +2,20 @@ | ||
| 2 | var gb_map_baidu = (function(){ | 2 | var gb_map_baidu = (function(){ |
| 3 | 3 | ||
| 4 | var map; | 4 | var map; |
| 5 | - var realMarkers = {}; | ||
| 6 | var topMarker; | 5 | var topMarker; |
| 7 | //实时路况是否打开 | 6 | //实时路况是否打开 |
| 8 | - var traffVisible; | ||
| 9 | - //线路 Polyline | ||
| 10 | - var linePolyline; | ||
| 11 | - | 7 | + //var traffVisible; |
| 8 | + var realMarkers = {}; | ||
| 9 | + //路段对照 | ||
| 12 | var polylines={}; | 10 | var polylines={}; |
| 13 | - var buffAreas = {}; | 11 | + //站点merker |
| 12 | + var stationMarkers = {}; | ||
| 13 | + //电子围栏对照 | ||
| 14 | + var electronicFences = {}; | ||
| 15 | + //停车场对照 | ||
| 16 | + var carparks = {}; | ||
| 17 | + //var buffAreas = {}; | ||
| 18 | + | ||
| 14 | 19 | ||
| 15 | var ctrl; | 20 | var ctrl; |
| 16 | var baiduInstance = { | 21 | var baiduInstance = { |
| @@ -51,15 +56,17 @@ var gb_map_baidu = (function(){ | @@ -51,15 +56,17 @@ var gb_map_baidu = (function(){ | ||
| 51 | 56 | ||
| 52 | //$('#tcWrap.maplibTc').addClass('animated bounceInLeft'); | 57 | //$('#tcWrap.maplibTc').addClass('animated bounceInLeft'); |
| 53 | //$('.maplibTcBtn_deskTop.anchorTR').remove(); | 58 | //$('.maplibTcBtn_deskTop.anchorTR').remove(); |
| 59 | +/* //缩放事件 | ||
| 60 | + map.addEventListener("zoomend", function(type, target){ | ||
| 61 | + //console.log('zoomend', type, target, map.getZoom()); | ||
| 62 | + //刷新站点marker | ||
| 63 | + refreshStation(); | ||
| 64 | + });*/ | ||
| 54 | }, | 65 | }, |
| 55 | destroy: function(){ | 66 | destroy: function(){ |
| 56 | realMarkers = {}; | 67 | realMarkers = {}; |
| 57 | - linePolyline = []; | ||
| 58 | - }/*, | ||
| 59 | - clear: function(){ | ||
| 60 | - realMarkers = {}; | ||
| 61 | - map.clearOverlays(); | ||
| 62 | - }*/, | 68 | + //linePolyline = []; |
| 69 | + }, | ||
| 63 | //画线路图层 | 70 | //画线路图层 |
| 64 | drawLine: function(opt){ | 71 | drawLine: function(opt){ |
| 65 | if(polylines[opt.id]) | 72 | if(polylines[opt.id]) |
| @@ -105,15 +112,7 @@ var gb_map_baidu = (function(){ | @@ -105,15 +112,7 @@ var gb_map_baidu = (function(){ | ||
| 105 | var pos=polylines[opt.id].getPath(); | 112 | var pos=polylines[opt.id].getPath(); |
| 106 | console.log('定位到中心,,,', pos[parseInt(pos.length / 2)]); | 113 | console.log('定位到中心,,,', pos[parseInt(pos.length / 2)]); |
| 107 | map.setCenter(pos[parseInt(pos.length / 2)]); | 114 | map.setCenter(pos[parseInt(pos.length / 2)]); |
| 108 | - }/*, | ||
| 109 | - removeLine: function(opts){ | ||
| 110 | - var polyline=polylines[opts.key]; | ||
| 111 | - if(polyline){ | ||
| 112 | - map.removeOverlay(polyline); | ||
| 113 | - polylines[opts.key]=null; | ||
| 114 | - delete polylines[opts.key]; | ||
| 115 | - } | ||
| 116 | - }*/, | 115 | + }, |
| 117 | //绘制GPS信号 | 116 | //绘制GPS信号 |
| 118 | drawRealGpsMarker: function(opts){ | 117 | drawRealGpsMarker: function(opts){ |
| 119 | var gpsArray = opts.gpsList; | 118 | var gpsArray = opts.gpsList; |
| @@ -139,6 +138,65 @@ var gb_map_baidu = (function(){ | @@ -139,6 +138,65 @@ var gb_map_baidu = (function(){ | ||
| 139 | } | 138 | } |
| 140 | }); | 139 | }); |
| 141 | }, | 140 | }, |
| 141 | + //绘制站点marker | ||
| 142 | + drawStationMarker: function (opt) { | ||
| 143 | + this.hideAllStationMarker(); | ||
| 144 | + | ||
| 145 | + var array=opt.list, marker; | ||
| 146 | + $.each(array, function () { | ||
| 147 | + if(stationMarkers[this.stationCode]){ | ||
| 148 | + stationMarkers[this.stationCode].show(); | ||
| 149 | + return true; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + transCoord(this); | ||
| 153 | + marker=createStationMark(this); | ||
| 154 | + map.addOverlay(marker); | ||
| 155 | + stationMarkers[this.stationCode]=marker; | ||
| 156 | + }); | ||
| 157 | + }, | ||
| 158 | + hideAllStationMarker: function () { | ||
| 159 | + for(var code in stationMarkers){ | ||
| 160 | + stationMarkers[code].hide(); | ||
| 161 | + } | ||
| 162 | + }, | ||
| 163 | + //绘制停车场 | ||
| 164 | + drawCarpark: function (opt) { | ||
| 165 | + var list = opt.list; | ||
| 166 | + var config = gb_map_config.getConfig() | ||
| 167 | + ,color = config.section.color.up; | ||
| 168 | + | ||
| 169 | + this.hideDrawCarpark(); | ||
| 170 | + $.each(list, function () { | ||
| 171 | + if(carparks[this.parkCode]){ | ||
| 172 | + carparks[this.parkCode].show(); | ||
| 173 | + return true; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + transMultiWGSToBd(this); | ||
| 177 | + var polygon = new BMap.Polygon(this.bdPoints, {strokeColor: color, strokeWeight: 1}); | ||
| 178 | + map.addOverlay(polygon); | ||
| 179 | + carparks[this.parkCode]=polygon; | ||
| 180 | + | ||
| 181 | + //中心点 | ||
| 182 | + var ts = this.gCenterPoint.split(' ') | ||
| 183 | + ,coord = TransGPS.wgsToBD(parseFloat(ts[1]), parseFloat(ts[0])); | ||
| 184 | + polygon._centerPoint = new BMap.Point(coord.lng, coord.lat); | ||
| 185 | + | ||
| 186 | + //info window | ||
| 187 | + polygon.infoWin = new BMap.InfoWindow(gb_map_overlay_mge.map_carpark_win_temp(this), {}); | ||
| 188 | + polygon.addEventListener('click', function(){ | ||
| 189 | + console.log('aaa', this); | ||
| 190 | + map.openInfoWindow(this.infoWin, this._centerPoint); | ||
| 191 | + }); | ||
| 192 | + }); | ||
| 193 | + }, | ||
| 194 | + //隐藏停车场 | ||
| 195 | + hideDrawCarpark: function () { | ||
| 196 | + for(var code in carparks){ | ||
| 197 | + carparks[code].hide(); | ||
| 198 | + } | ||
| 199 | + }, | ||
| 142 | clearAll: function () { | 200 | clearAll: function () { |
| 143 | //清除所有覆盖物 | 201 | //清除所有覆盖物 |
| 144 | realMarkers = {}; | 202 | realMarkers = {}; |
| @@ -165,45 +223,86 @@ var gb_map_baidu = (function(){ | @@ -165,45 +223,86 @@ var gb_map_baidu = (function(){ | ||
| 165 | } | 223 | } |
| 166 | }); | 224 | }); |
| 167 | }, | 225 | }, |
| 168 | - //定位到marker | 226 | + //定位到车辆 marker |
| 169 | goToMarker: function(opts){ | 227 | goToMarker: function(opts){ |
| 170 | var deviceId = opts.deviceId | 228 | var deviceId = opts.deviceId |
| 171 | ,m = realMarkers[deviceId]; | 229 | ,m = realMarkers[deviceId]; |
| 172 | if(m){ | 230 | if(m){ |
| 173 | - map.panTo(m.point); | ||
| 174 | - setTop(m); | 231 | + map.panTo(m.point, {noAnimation: true}); |
| 232 | + //setTop(m); | ||
| 233 | + } | ||
| 234 | + }, | ||
| 235 | + //定位到站点 | ||
| 236 | + goToStation: function (stationCode) { | ||
| 237 | + var m = stationMarkers[stationCode]; | ||
| 238 | + if(m){ | ||
| 239 | + map.panTo(m.point, {noAnimation: true}); | ||
| 240 | + map.openInfoWindow(m.infoWin, m.point); | ||
| 241 | + } | ||
| 242 | + }, | ||
| 243 | + //定位到停车场 | ||
| 244 | + goToCarpark: function (parkCode) { | ||
| 245 | + var polygon = carparks[parkCode]; | ||
| 246 | + if(polygon){ | ||
| 247 | + map.panTo(polygon._centerPoint, {noAnimation: true}); | ||
| 248 | + map.openInfoWindow(polygon.infoWin, polygon._centerPoint); | ||
| 175 | } | 249 | } |
| 176 | }, | 250 | }, |
| 177 | - //打开信息窗口 | 251 | + //打开车辆信息窗口 |
| 178 | openWindow: function(opts){ | 252 | openWindow: function(opts){ |
| 179 | var deviceId = opts.deviceId | 253 | var deviceId = opts.deviceId |
| 180 | ,m = realMarkers[deviceId]; | 254 | ,m = realMarkers[deviceId]; |
| 181 | bdOpenWindow(m); | 255 | bdOpenWindow(m); |
| 182 | }, | 256 | }, |
| 257 | + //打开站点信息窗口 | ||
| 258 | + openStationWin: function (opt) { | ||
| 259 | + | ||
| 260 | + }, | ||
| 183 | //绘制圆形 | 261 | //绘制圆形 |
| 184 | - drawCircle: function(opts){ | ||
| 185 | - var coord = TransGPS.wgsToBD(opts.lat, opts.lon); | ||
| 186 | - var circle = new BMap.Circle(new BMap.Point(coord.lng, coord.lat), opts.radius); | ||
| 187 | - if(opts.color) | ||
| 188 | - circle.setStrokeColor(opts.color); | ||
| 189 | - if(opts.weight) | ||
| 190 | - circle.setStrokeWeight(opts.weight); | 262 | + drawCircle: function(opt){ |
| 263 | + if(electronicFences[opt.id]){ | ||
| 264 | + electronicFences[opt.id].show(); | ||
| 265 | + return; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + var coord = TransGPS.wgsToBD(opt.lat, opt.lon); | ||
| 269 | + var circle = new BMap.Circle(new BMap.Point(coord.lng, coord.lat), opt.radius); | ||
| 270 | + circle.setStrokeColor(opt.color); | ||
| 271 | + circle.setStrokeWeight(opt.weight); | ||
| 191 | 272 | ||
| 192 | map.addOverlay(circle); | 273 | map.addOverlay(circle); |
| 193 | - buffAreas[opts.id] = circle; | 274 | + electronicFences[opt.id] = circle; |
| 275 | + }, | ||
| 276 | + hideAllCircles: function () { | ||
| 277 | + for(var code in electronicFences){ | ||
| 278 | + electronicFences[code].hide(); | ||
| 279 | + } | ||
| 194 | }, | 280 | }, |
| 195 | //绘制多边形 | 281 | //绘制多边形 |
| 196 | - drawPolygon: function(opts){ | ||
| 197 | - var wgs,coord, points = []; | ||
| 198 | - $.each(opts.cds, function(){ | ||
| 199 | - wgs = this.split(' '); | ||
| 200 | - coord = TransGPS.wgsToBD(parseFloat(wgs[1]), parseFloat(wgs[0])); | ||
| 201 | - points.push(new BMap.Point(coord.lng, coord.lat)); | ||
| 202 | - }); | 282 | + drawPolygon: function(opt){ |
| 283 | + var station = opt.station | ||
| 284 | + ,code = station.stationCode; | ||
| 285 | + if(electronicFences[code]){ | ||
| 286 | + electronicFences[code].show(); | ||
| 287 | + return; | ||
| 288 | + } | ||
| 203 | 289 | ||
| 204 | - var polygon = new BMap.Polygon(points, {strokeColor: opts.color, strokeWeight: opts.weight, strokeOpacity: 0.7}); | 290 | + transMultiWGSToBd(station); |
| 291 | + var polygon = new BMap.Polygon(station.bdPoints, {strokeColor: opt.color, strokeWeight: opt.weight}); | ||
| 205 | map.addOverlay(polygon); | 292 | map.addOverlay(polygon); |
| 206 | - buffAreas[opts.id] = polygon; | 293 | + electronicFences[code]=polygon; |
| 294 | + | ||
| 295 | +/* | ||
| 296 | + //计算多边形面积 | ||
| 297 | + var area=BMapLib.GeoUtils.getPolygonArea(polygon); | ||
| 298 | + if(!isNaN(area)) | ||
| 299 | + polygon._polygonArea=area+'米'; | ||
| 300 | + else | ||
| 301 | + polygon._polygonArea='计算失败'; | ||
| 302 | + | ||
| 303 | + polygon.addEventListener('click', function(){ | ||
| 304 | + map.openInfoWindow(this.infoWin, marker.point); | ||
| 305 | + });*/ | ||
| 207 | }, | 306 | }, |
| 208 | //删除缓冲区 | 307 | //删除缓冲区 |
| 209 | clearBuffArea: function(code){ | 308 | clearBuffArea: function(code){ |
| @@ -214,6 +313,65 @@ var gb_map_baidu = (function(){ | @@ -214,6 +313,65 @@ var gb_map_baidu = (function(){ | ||
| 214 | } | 313 | } |
| 215 | }; | 314 | }; |
| 216 | 315 | ||
| 316 | + function transMultiWGSToBd(obj) { | ||
| 317 | + if(!obj._gPoints) | ||
| 318 | + return; | ||
| 319 | + var bdPoints = [],coord; | ||
| 320 | + $.each(obj._gPoints, function () { | ||
| 321 | + coord = TransGPS.wgsToBD(this.lat, this.lng); | ||
| 322 | + bdPoints.push(new BMap.Point(coord.lng, coord.lat)); | ||
| 323 | + }); | ||
| 324 | + | ||
| 325 | + obj.bdPoints=bdPoints; | ||
| 326 | + } | ||
| 327 | + | ||
| 328 | +/* function transCoordCarpark(carpark) { | ||
| 329 | + var pStr = carpark.gParkPoint.substring(9, carpark.gParkPoint.length - 2); | ||
| 330 | + var pArr = filterPolygonCoords(pStr.split(',')), coord, points=[]; | ||
| 331 | + | ||
| 332 | + $.each(pArr, function (i, str) { | ||
| 333 | + var c = str.split(' '); | ||
| 334 | + coord = TransGPS.wgsToBD(parseFloat(c[1]), parseFloat(c[0])); | ||
| 335 | + points.push(new BMap.Point(coord.lng, coord.lat)); | ||
| 336 | + }); | ||
| 337 | + carpark.bdPoints=points; | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + function transPolygonStation(opt) { | ||
| 341 | + var pStr = opt.polygon.substring(9, opt.polygon.length - 2); | ||
| 342 | + var pArr = filterPolygonCoords(pStr.split(',')), coord, points=[]; | ||
| 343 | + | ||
| 344 | + $.each(pArr, function (i, str) { | ||
| 345 | + var c = str.split(' '); | ||
| 346 | + coord = TransGPS.wgsToBD(parseFloat(c[1]), parseFloat(c[0])); | ||
| 347 | + points.push(new BMap.Point(coord.lng, coord.lat)); | ||
| 348 | + }); | ||
| 349 | + opt.bdPoints=points; | ||
| 350 | + }*/ | ||
| 351 | + | ||
| 352 | +/* //处理多边形点数组 | ||
| 353 | + function filterPolygonCoords(pArr) { | ||
| 354 | + var newArr=[]; | ||
| 355 | + //去掉已闭合的尾 | ||
| 356 | + var end=pArr.length - 1; | ||
| 357 | + if(pArr.length > 1 && pArr[0] == pArr[end]) | ||
| 358 | + pArr = pArr.slice(0, end); | ||
| 359 | + | ||
| 360 | + //去掉连续的重复点 | ||
| 361 | + var last; | ||
| 362 | + $.each(pArr, function (i, str) { | ||
| 363 | + if(last){ | ||
| 364 | + if(last != str) | ||
| 365 | + newArr.push(str); | ||
| 366 | + } | ||
| 367 | + else | ||
| 368 | + newArr.push(str); | ||
| 369 | + last = str; | ||
| 370 | + }); | ||
| 371 | + | ||
| 372 | + return newArr; | ||
| 373 | + }*/ | ||
| 374 | + | ||
| 217 | function transCoord(gps) { | 375 | function transCoord(gps) { |
| 218 | var coord = TransGPS.wgsToBD(gps.lat, gps.lon); | 376 | var coord = TransGPS.wgsToBD(gps.lat, gps.lon); |
| 219 | gps.bd_lat = coord.lat; | 377 | gps.bd_lat = coord.lat; |
| @@ -231,9 +389,10 @@ var gb_map_baidu = (function(){ | @@ -231,9 +389,10 @@ var gb_map_baidu = (function(){ | ||
| 231 | var marker = new BMap.Marker(point); | 389 | var marker = new BMap.Marker(point); |
| 232 | 390 | ||
| 233 | //根据编码长度 计算marker 宽度 | 391 | //根据编码长度 计算marker 宽度 |
| 234 | - var w = gpsData.nbbm.length * 10; | 392 | + var w = calcGpsMarkerWidth(gpsData.nbbm);//gpsData.nbbm.length * 10; |
| 235 | marker.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gpsData, w), new BMap.Size(w,25))); | 393 | marker.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gpsData, w), new BMap.Size(w,25))); |
| 236 | 394 | ||
| 395 | + marker._icon_width=w; | ||
| 237 | marker.infoWindow = new BMap.InfoWindow(bd_gps_info_win_opts); | 396 | marker.infoWindow = new BMap.InfoWindow(bd_gps_info_win_opts); |
| 238 | marker.gpsData = gpsData; | 397 | marker.gpsData = gpsData; |
| 239 | //click | 398 | //click |
| @@ -241,8 +400,52 @@ var gb_map_baidu = (function(){ | @@ -241,8 +400,52 @@ var gb_map_baidu = (function(){ | ||
| 241 | bdOpenWindow(this); | 400 | bdOpenWindow(this); |
| 242 | }); | 401 | }); |
| 243 | //mouseover | 402 | //mouseover |
| 244 | - marker.addEventListener('mouseover', function(){ | 403 | + /*marker.addEventListener('mouseover', function(){ |
| 245 | setTop(this); | 404 | setTop(this); |
| 405 | + });*/ | ||
| 406 | + marker.setTop(true); | ||
| 407 | + return marker; | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + //为每个数字定义宽度 | ||
| 411 | +/* var icon_num_width=[ | ||
| 412 | + 7,6,7,7,7,7,7,7,7,7 | ||
| 413 | + ];*/ | ||
| 414 | + function calcGpsMarkerWidth(nbbm) { | ||
| 415 | + var width=0; | ||
| 416 | + $.each(nbbm.split(''), function () { | ||
| 417 | + if(!isNaN(this)) | ||
| 418 | + width += 7;//icon_num_width[this]; | ||
| 419 | + else if(this=='-') | ||
| 420 | + width += 10; | ||
| 421 | + else | ||
| 422 | + width += 16; | ||
| 423 | + }); | ||
| 424 | + return width; | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + function createStationMark(statio) { | ||
| 428 | + var point = new BMap.Point(statio.bd_lon, statio.bd_lat); | ||
| 429 | + var marker = new BMap.Marker(point); | ||
| 430 | + | ||
| 431 | + //根据编码长度 计算marker 宽度 | ||
| 432 | + var w = statio.stationName.length * 12 + 4 | ||
| 433 | + ,iw=w-2; | ||
| 434 | + var icon = new BMap.Icon(gb_map_imap.createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,24)}) | ||
| 435 | + marker.setIcon(icon); | ||
| 436 | + | ||
| 437 | + //信息窗口 | ||
| 438 | + marker.infoWin=new BMap.InfoWindow(gb_map_overlay_mge.map_station_win_temp(statio), {}); | ||
| 439 | + marker.addEventListener('click', function(){ | ||
| 440 | + map.openInfoWindow(this.infoWin, this.point); | ||
| 441 | + }); | ||
| 442 | + | ||
| 443 | + //mouseover | ||
| 444 | + marker.addEventListener('mouseover', function(){ | ||
| 445 | + this.setTop(true); | ||
| 446 | + }); | ||
| 447 | + marker.addEventListener('mouseout', function () { | ||
| 448 | + this.setTop(false); | ||
| 246 | }); | 449 | }); |
| 247 | return marker; | 450 | return marker; |
| 248 | } | 451 | } |
| @@ -269,12 +472,18 @@ var gb_map_baidu = (function(){ | @@ -269,12 +472,18 @@ var gb_map_baidu = (function(){ | ||
| 269 | }); | 472 | }); |
| 270 | }*/ | 473 | }*/ |
| 271 | 474 | ||
| 475 | +/* function refreshStation() { | ||
| 476 | + //console.log('refreshStation', map.getZoom()); | ||
| 477 | + var zoom=map.getZoom(); | ||
| 478 | + | ||
| 479 | + }*/ | ||
| 480 | + | ||
| 272 | function moveMarker(m, gps){ | 481 | function moveMarker(m, gps){ |
| 273 | m.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat)); | 482 | m.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat)); |
| 274 | m.gpsData = gps; | 483 | m.gpsData = gps; |
| 275 | //重新设置icon | 484 | //重新设置icon |
| 276 | //根据编码长度 计算marker 宽度 | 485 | //根据编码长度 计算marker 宽度 |
| 277 | - var w = gps.nbbm.length * 10; | 486 | + var w = m._icon_width;//calcGpsMarkerWidth(gps.nbbm);//gps.nbbm.length * 10; |
| 278 | m.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gps, w), new BMap.Size(w,25))); | 487 | m.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gps, w), new BMap.Size(w,25))); |
| 279 | 488 | ||
| 280 | //更新 infoWindow | 489 | //更新 infoWindow |
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
| @@ -106,18 +106,105 @@ var gb_map_overlay_mge = (function () { | @@ -106,18 +106,105 @@ var gb_map_overlay_mge = (function () { | ||
| 106 | //打开信息窗口 | 106 | //打开信息窗口 |
| 107 | gb_map_imap.call('openWindow',{deviceId: deviceId}); | 107 | gb_map_imap.call('openWindow',{deviceId: deviceId}); |
| 108 | }; | 108 | }; |
| 109 | + | ||
| 110 | + //站点获得焦点 | ||
| 111 | + var _focus_station = function (station) { | ||
| 112 | + gb_map_imap.call('goToStation', station.stationCode); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + //停车场获得焦点 | ||
| 116 | + var _focus_carpark = function (carpark) { | ||
| 117 | + //console.log('_focus_carpark', carpark); | ||
| 118 | + gb_map_imap.call('goToCarpark', carpark.parkCode); | ||
| 119 | + } | ||
| 109 | 120 | ||
| 110 | function getCheckedDevice() { | 121 | function getCheckedDevice() { |
| 111 | return gb_map_gps_tree.getChecked().filter(deviceFilter); | 122 | return gb_map_gps_tree.getChecked().filter(deviceFilter); |
| 112 | } | 123 | } |
| 124 | + | ||
| 125 | + //绘制站点 | ||
| 126 | + var drawStation = function () { | ||
| 127 | + var list = gb_map_spatial_data.getCheckedStation(); | ||
| 128 | + //绘制站点 | ||
| 129 | + gb_map_imap.call('drawStationMarker', {list: list}); | ||
| 130 | + //绘制电子围栏 | ||
| 131 | + drawElectronicFence(list); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + //绘制电子围栏 | ||
| 135 | + var drawElectronicFence = function (list) { | ||
| 136 | + var config = gb_map_config.getConfig().spatialData; | ||
| 137 | + if(!config.electronicFence) | ||
| 138 | + return; | ||
| 139 | + | ||
| 140 | + if(!list){ | ||
| 141 | + list = gb_map_spatial_data.getCheckedStation(); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + gb_map_imap.call('hideAllCircles'); | ||
| 146 | + $.each(list, function () { | ||
| 147 | + fun=this.shapesType=='r'?drawCircle:drawPolygon; | ||
| 148 | + fun(this); | ||
| 149 | + }); | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + //绘制停车场 | ||
| 153 | + var drawCarpark = function () { | ||
| 154 | + var list = gb_map_spatial_data.gteCheckedCarpark(); | ||
| 155 | + gb_map_imap.call('drawCarpark', {list: list}); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + var drawCircle=function (data) { | ||
| 159 | + var config = gb_map_config.getConfig().section.color; | ||
| 160 | + var color = data.directions==0?config.up:config.down; | ||
| 161 | + | ||
| 162 | + var opt = { | ||
| 163 | + lon: data.lon, | ||
| 164 | + lat: data.lat, | ||
| 165 | + text: data.stationName, | ||
| 166 | + color: color, | ||
| 167 | + weight: 2, | ||
| 168 | + radius: parseFloat(data.radius), | ||
| 169 | + id: data.stationCode | ||
| 170 | + }; | ||
| 171 | + | ||
| 172 | + gb_map_imap.call('drawCircle', opt); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + var drawPolygon=function (data) { | ||
| 176 | + var config = gb_map_config.getConfig().section.color; | ||
| 177 | + var color = data.directions==0?config.up:config.down; | ||
| 178 | + | ||
| 179 | + var opt = { | ||
| 180 | + //id:data.stationCode, | ||
| 181 | + color: color, | ||
| 182 | + weight: 2, | ||
| 183 | + station: data | ||
| 184 | + }; | ||
| 185 | + | ||
| 186 | + gb_map_imap.call('drawPolygon', opt); | ||
| 187 | + } | ||
| 188 | + | ||
| 113 | return { | 189 | return { |
| 114 | init: init, | 190 | init: init, |
| 115 | refresh: showOverlayByChecks, | 191 | refresh: showOverlayByChecks, |
| 116 | _focus: _focus, | 192 | _focus: _focus, |
| 193 | + _focus_station: _focus_station, | ||
| 194 | + _focus_carpark: _focus_carpark, | ||
| 117 | map_gps_win_temp: function (data) { | 195 | map_gps_win_temp: function (data) { |
| 118 | return temps['map-win-gps-detail-temp'](data); | 196 | return temps['map-win-gps-detail-temp'](data); |
| 119 | }, | 197 | }, |
| 198 | + map_station_win_temp: function (data) { | ||
| 199 | + return temps['map-win-station-detail-temp'](data); | ||
| 200 | + }, | ||
| 201 | + map_carpark_win_temp: function (data) { | ||
| 202 | + return temps['map-win-carpark-detail-temp'](data); | ||
| 203 | + }, | ||
| 120 | reDraw: reDraw, | 204 | reDraw: reDraw, |
| 121 | - getCheckedDevice: getCheckedDevice | 205 | + getCheckedDevice: getCheckedDevice, |
| 206 | + drawStation: drawStation, | ||
| 207 | + drawElectronicFence: drawElectronicFence, | ||
| 208 | + drawCarpark: drawCarpark | ||
| 122 | }; | 209 | }; |
| 123 | })(); | 210 | })(); |
| 124 | \ No newline at end of file | 211 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/js/spatial_data.js
| @@ -13,13 +13,28 @@ var gb_map_spatial_data = (function () { | @@ -13,13 +13,28 @@ var gb_map_spatial_data = (function () { | ||
| 13 | return str.substr(1); | 13 | return str.substr(1); |
| 14 | })(); | 14 | })(); |
| 15 | 15 | ||
| 16 | + var cont = '#spatial-tree-content'; | ||
| 16 | //线路站点路由数据 | 17 | //线路站点路由数据 |
| 17 | var lineStationArr; | 18 | var lineStationArr; |
| 18 | 19 | ||
| 20 | + //停车场数据 | ||
| 21 | + var carparkArr; | ||
| 19 | 22 | ||
| 20 | var init = function () { | 23 | var init = function () { |
| 24 | + //加载站点路由数据 | ||
| 21 | gb_common.$get('/realMap/stationSpatialData', {idx: line_idx}, function (rs) { | 25 | gb_common.$get('/realMap/stationSpatialData', {idx: line_idx}, function (rs) { |
| 22 | var list = rs.list; | 26 | var list = rs.list; |
| 27 | + $.each(list, function () { | ||
| 28 | + this.lat = this.gLaty; | ||
| 29 | + this.lon = this.gLonx; | ||
| 30 | + delete this.gLaty; | ||
| 31 | + delete this.gLonx; | ||
| 32 | + if(this.shapesType=='d'){ | ||
| 33 | + var calcRs = calcPolygonArea(this.gPolygonGrid); | ||
| 34 | + this._polygonArea = calcRs._polygonArea; | ||
| 35 | + this._gPoints = calcRs._gPoints; | ||
| 36 | + } | ||
| 37 | + }); | ||
| 23 | //排序 | 38 | //排序 |
| 24 | list.sort(function (a, b) { | 39 | list.sort(function (a, b) { |
| 25 | return a.stationRouteCode - b.stationRouteCode; | 40 | return a.stationRouteCode - b.stationRouteCode; |
| @@ -31,42 +46,232 @@ var gb_map_spatial_data = (function () { | @@ -31,42 +46,232 @@ var gb_map_spatial_data = (function () { | ||
| 31 | lineStationArr[lineCode] = gb_common.groupBy(lineStationArr[lineCode], 'directions'); | 46 | lineStationArr[lineCode] = gb_common.groupBy(lineStationArr[lineCode], 'directions'); |
| 32 | } | 47 | } |
| 33 | 48 | ||
| 49 | + ep.emitLater('station'); | ||
| 50 | + }); | ||
| 51 | + | ||
| 52 | + //加载停车场数据 | ||
| 53 | + gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { | ||
| 54 | + carparkArr = rs.list; | ||
| 55 | + $.each(carparkArr, function () { | ||
| 56 | + if(this.shapesType=='d'){ | ||
| 57 | + var calcRs = calcPolygonArea(this.gParkPoint); | ||
| 58 | + this._polygonArea = calcRs._polygonArea; | ||
| 59 | + this._gPoints = calcRs._gPoints; | ||
| 60 | + } | ||
| 61 | + }); | ||
| 62 | + ep.emitLater('carpark'); | ||
| 63 | + }); | ||
| 64 | + | ||
| 65 | + var ep = EventProxy.create('station', 'carpark', function () { | ||
| 66 | + $(".real_spatial_panel").resizable({ | ||
| 67 | + maxHeight: '100%', | ||
| 68 | + minHeight: 18 | ||
| 69 | + }); | ||
| 70 | + | ||
| 71 | + //绘制站点路由树 | ||
| 72 | + $('.station-route-tree', cont) | ||
| 73 | + //state插件 状态恢复完成 | ||
| 74 | + .on('state_ready.jstree', function () { | ||
| 75 | + //绑定checkbox状态切换事件 | ||
| 76 | + $(this).on('check_node.jstree uncheck_node.jstree', gb_map_overlay_mge.drawStation); | ||
| 77 | + }) | ||
| 78 | + .on('activate_node.jstree', function (e, n) { | ||
| 79 | + var node = n.node; | ||
| 80 | + if(node.state.checked) | ||
| 81 | + gb_map_overlay_mge._focus_station(node.data); | ||
| 82 | + }) | ||
| 83 | + .jstree({ | ||
| 84 | + 'core': { | ||
| 85 | + 'data': get_st_route_tree_data() | ||
| 86 | + }, | ||
| 87 | + 'checkbox': { | ||
| 88 | + 'keep_selected_style': false, | ||
| 89 | + 'whole_node': false, | ||
| 90 | + 'tie_selection': false | ||
| 91 | + }, | ||
| 92 | + //local storage里的key | ||
| 93 | + 'state': { | ||
| 94 | + 'key': 'jstree_map_station_route' | ||
| 95 | + }, | ||
| 96 | + 'plugins': ['checkbox', 'state'] | ||
| 97 | + }); | ||
| 98 | + | ||
| 99 | + | ||
| 100 | + //停车场 | ||
| 101 | + $('.carpark-panel', cont) | ||
| 102 | + .on('state_ready.jstree', function () { | ||
| 103 | + //绑定checkbox状态切换事件 | ||
| 104 | + $(this).on('check_node.jstree uncheck_node.jstree', gb_map_overlay_mge.drawCarpark); | ||
| 105 | + }) | ||
| 106 | + .on('activate_node.jstree', function (e, n) { | ||
| 107 | + var node = n.node; | ||
| 108 | + if(node.state.checked) | ||
| 109 | + gb_map_overlay_mge._focus_carpark(node.data); | ||
| 110 | + }) | ||
| 111 | + .jstree({ | ||
| 112 | + 'core': { | ||
| 113 | + 'data': get_st_carpark_tree_data() | ||
| 114 | + }, | ||
| 115 | + 'checkbox': { | ||
| 116 | + 'keep_selected_style': false, | ||
| 117 | + 'whole_node': false, | ||
| 118 | + 'tie_selection': false | ||
| 119 | + }, | ||
| 120 | + //local storage里的key | ||
| 121 | + 'state': { | ||
| 122 | + 'key': 'jstree_map_carpark' | ||
| 123 | + }, | ||
| 124 | + 'plugins': ['checkbox', 'state'] | ||
| 125 | + }); | ||
| 126 | + | ||
| 34 | refresh(); | 127 | refresh(); |
| 35 | }); | 128 | }); |
| 36 | } | 129 | } |
| 37 | 130 | ||
| 38 | - var refresh = function () { | 131 | + //计算多边形面积 |
| 132 | + function calcPolygonArea(polygonStr) { | ||
| 133 | + var pStr = polygonStr.substring(9, polygonStr.length - 2); | ||
| 134 | + var array = pStr.split(','); | ||
| 135 | + var newArr=[]; | ||
| 136 | + | ||
| 137 | + //递归去掉闭合的尾 | ||
| 138 | + (function () { | ||
| 139 | + var f = arguments.callee; | ||
| 140 | + var end=array.length - 1; | ||
| 141 | + if(array.length > 1 && array[0] == array[end]){ | ||
| 142 | + array = array.slice(0, end); | ||
| 143 | + f(); | ||
| 144 | + } | ||
| 145 | + })(); | ||
| 146 | + | ||
| 147 | + //去掉连续的重复点 | ||
| 148 | + var last; | ||
| 149 | + $.each(array, function (i, str) { | ||
| 150 | + if(last){ | ||
| 151 | + if(last != str) | ||
| 152 | + newArr.push(str); | ||
| 153 | + } | ||
| 154 | + else | ||
| 155 | + newArr.push(str); | ||
| 156 | + last = str; | ||
| 157 | + }); | ||
| 158 | + | ||
| 159 | + var gPoints=[],ts; | ||
| 160 | + $.each(newArr, function (i, c) { | ||
| 161 | + ts=c.split(' '); | ||
| 162 | + gPoints.push({ | ||
| 163 | + lat: parseFloat(ts[1]), | ||
| 164 | + lng: parseFloat(ts[0]) | ||
| 165 | + }); | ||
| 166 | + }); | ||
| 167 | + | ||
| 168 | + //用百度geo工具库计算面积 | ||
| 169 | + var _polygonArea = BMapLib.GeoUtils.getPolygonArea(gPoints); | ||
| 170 | + return {_polygonArea: _polygonArea.toFixed(2), _gPoints: gPoints}; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + var refresh = function (type, checked) { | ||
| 39 | if (!triggerElem()) | 174 | if (!triggerElem()) |
| 40 | return; | 175 | return; |
| 41 | 176 | ||
| 42 | - //绘制站点路由树 | ||
| 43 | - $('.station-route-tree').jstree({ | ||
| 44 | - 'core': { | ||
| 45 | - 'data': get_st_route_tree_data() | ||
| 46 | - }, | ||
| 47 | - 'checkbox': { | ||
| 48 | - 'keep_selected_style': false, | ||
| 49 | - 'whole_node': false, | ||
| 50 | - 'tie_selection': false | ||
| 51 | - }, | ||
| 52 | - 'plugins': ['checkbox', 'state'] | ||
| 53 | - }); | 177 | + if ((type == 'carPark' && checked) || (type == 'station' && !checked)) { |
| 178 | + //显示停车场面板 | ||
| 179 | + $('.car-park-item', cont).addClass('uk-active'); | ||
| 180 | + $('li.cp-tab-btn', '.real_spatial_panel').addClass('uk-active'); | ||
| 181 | + $('.carpark-panel', cont).jstree(true).check_all(); | ||
| 182 | + | ||
| 183 | + //绘制停车场 | ||
| 184 | + gb_map_overlay_mge.drawCarpark(); | ||
| 185 | + } | ||
| 186 | + else { | ||
| 187 | + //显示站点路由面板 | ||
| 188 | + $('.station-route-item', cont).addClass('uk-active'); | ||
| 189 | + $('li.sr-tab-btn', '.real_spatial_panel').addClass('uk-active'); | ||
| 190 | + | ||
| 191 | + //选中相关站点路由树 | ||
| 192 | + var chs = gb_map_overlay_mge.getCheckedDevice(); | ||
| 193 | + var idx = {}; | ||
| 194 | + $.each(chs, function () { | ||
| 195 | + idx[this.data.lineId + '_' + this.data.upDown] = 1; | ||
| 196 | + }); | ||
| 197 | + | ||
| 198 | + var treeObj = $('.station-route-tree', cont).jstree(true); | ||
| 199 | + for (var id in idx) { | ||
| 200 | + treeObj.check_node(treeObj.get_node(id + '_st')); | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + //drawStation(); | ||
| 204 | + gb_map_overlay_mge.drawStation(); | ||
| 205 | + } | ||
| 54 | } | 206 | } |
| 55 | 207 | ||
| 56 | var triggerElem = function () { | 208 | var triggerElem = function () { |
| 57 | - var config = gb_map_config.getConfig().spatialData | ||
| 58 | - , elem = $('.real_spatial_panel'); | 209 | + var config = gb_map_config.getConfig().spatialData; |
| 59 | 210 | ||
| 60 | - for (var att in config) { | ||
| 61 | - if (config[att]) { | ||
| 62 | - elem.show(); | ||
| 63 | - return true; | ||
| 64 | - } | 211 | + if(config.station || config.carPark){ |
| 212 | + showPanel(); | ||
| 213 | + return true; | ||
| 65 | } | 214 | } |
| 66 | - elem.hide(); | 215 | + hidePanel(); |
| 216 | + gb_map_imap.call('hideAllStationMarker'); | ||
| 217 | + gb_map_imap.call('hideDrawCarpark'); | ||
| 67 | return false; | 218 | return false; |
| 68 | } | 219 | } |
| 69 | 220 | ||
| 221 | + var animationend = 'webkitAnimationEnd animationend'; | ||
| 222 | + var showPanel = function () { | ||
| 223 | + var elem = $('.real_spatial_panel'); | ||
| 224 | + var config = gb_map_config.getConfig().spatialData; | ||
| 225 | + | ||
| 226 | + if (config.station && config.carPark) { | ||
| 227 | + anim_show($('.uk-subnav', elem), 'uk-animation-scale-up'); | ||
| 228 | + $('.real_spatial_body', elem).addClass('show-tab'); | ||
| 229 | + } | ||
| 230 | + else { | ||
| 231 | + $('.uk-subnav', elem).hide(); | ||
| 232 | + $('.real_spatial_body', elem).removeClass('show-tab'); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + $('li.uk-active', elem).removeClass('uk-active'); | ||
| 236 | + | ||
| 237 | + if (!elem.is(":hidden")) | ||
| 238 | + return; | ||
| 239 | + | ||
| 240 | + anim_show(elem, 'uk-animation-slide-left'); | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + var hidePanel = function () { | ||
| 244 | + var elem = $('.real_spatial_panel'); | ||
| 245 | + elem.hide(); | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + function anim_show(e, anim) { | ||
| 249 | + e.addClass(anim).show().one(animationend, function () { | ||
| 250 | + $(this).removeClass(anim); | ||
| 251 | + }); | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + function getCheckedStation() { | ||
| 255 | + var list = []; | ||
| 256 | + var chs = $('.station-route-tree', cont).jstree(true).get_checked(true); | ||
| 257 | + chs = chs.filter(function (item) { | ||
| 258 | + return item.data; | ||
| 259 | + }); | ||
| 260 | + $.each(chs, function () { | ||
| 261 | + list.push(this.data); | ||
| 262 | + }); | ||
| 263 | + return list; | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + function gteCheckedCarpark() { | ||
| 267 | + var list = []; | ||
| 268 | + var chs = $('.carpark-panel', cont).jstree(true).get_checked(true); | ||
| 269 | + $.each(chs, function () { | ||
| 270 | + list.push(this.data); | ||
| 271 | + }); | ||
| 272 | + return list; | ||
| 273 | + } | ||
| 274 | + | ||
| 70 | var get_st_route_tree_data = function () { | 275 | var get_st_route_tree_data = function () { |
| 71 | var treeData = []; | 276 | var treeData = []; |
| 72 | 277 | ||
| @@ -74,14 +279,17 @@ var gb_map_spatial_data = (function () { | @@ -74,14 +279,17 @@ var gb_map_spatial_data = (function () { | ||
| 74 | name = gb_data_basic.codeToLine[lineCode].name; | 279 | name = gb_data_basic.codeToLine[lineCode].name; |
| 75 | treeData.push({ | 280 | treeData.push({ |
| 76 | 'text': name, | 281 | 'text': name, |
| 282 | + 'open': true, | ||
| 77 | 'children': [ | 283 | 'children': [ |
| 78 | { | 284 | { |
| 79 | 'text': '上行', | 285 | 'text': '上行', |
| 80 | 'children': grabs(lineStationArr[lineCode][0]), | 286 | 'children': grabs(lineStationArr[lineCode][0]), |
| 287 | + 'id': lineCode + '_0_st' | ||
| 81 | }, | 288 | }, |
| 82 | { | 289 | { |
| 83 | 'text': '下行', | 290 | 'text': '下行', |
| 84 | 'children': grabs(lineStationArr[lineCode][1]), | 291 | 'children': grabs(lineStationArr[lineCode][1]), |
| 292 | + 'id': lineCode + '_1_st' | ||
| 85 | } | 293 | } |
| 86 | ] | 294 | ] |
| 87 | }) | 295 | }) |
| @@ -89,6 +297,19 @@ var gb_map_spatial_data = (function () { | @@ -89,6 +297,19 @@ var gb_map_spatial_data = (function () { | ||
| 89 | return treeData; | 297 | return treeData; |
| 90 | }; | 298 | }; |
| 91 | 299 | ||
| 300 | + var get_st_carpark_tree_data = function () { | ||
| 301 | + var treeData = []; | ||
| 302 | + | ||
| 303 | + $.each(carparkArr, function () { | ||
| 304 | + treeData.push({ | ||
| 305 | + 'text': this.parkName, | ||
| 306 | + 'data': this | ||
| 307 | + }); | ||
| 308 | + }); | ||
| 309 | + | ||
| 310 | + return treeData; | ||
| 311 | + } | ||
| 312 | + | ||
| 92 | var grabs = function (array) { | 313 | var grabs = function (array) { |
| 93 | if (!array) | 314 | if (!array) |
| 94 | return; | 315 | return; |
| @@ -96,7 +317,7 @@ var gb_map_spatial_data = (function () { | @@ -96,7 +317,7 @@ var gb_map_spatial_data = (function () { | ||
| 96 | $.each(array, function () { | 317 | $.each(array, function () { |
| 97 | rs.push({ | 318 | rs.push({ |
| 98 | 'text': this.stationName, | 319 | 'text': this.stationName, |
| 99 | - 'data': {}, | 320 | + 'data': this, |
| 100 | 'icon': false | 321 | 'icon': false |
| 101 | }); | 322 | }); |
| 102 | }); | 323 | }); |
| @@ -105,6 +326,8 @@ var gb_map_spatial_data = (function () { | @@ -105,6 +326,8 @@ var gb_map_spatial_data = (function () { | ||
| 105 | 326 | ||
| 106 | return { | 327 | return { |
| 107 | refresh: refresh, | 328 | refresh: refresh, |
| 108 | - init: init | 329 | + init: init, |
| 330 | + getCheckedStation:getCheckedStation, | ||
| 331 | + gteCheckedCarpark: gteCheckedCarpark | ||
| 109 | }; | 332 | }; |
| 110 | })(); | 333 | })(); |
| 111 | \ No newline at end of file | 334 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/real.html
| @@ -25,16 +25,29 @@ | @@ -25,16 +25,29 @@ | ||
| 25 | <div class="real_bl_cont"> | 25 | <div class="real_bl_cont"> |
| 26 | 26 | ||
| 27 | </div> | 27 | </div> |
| 28 | - <div class="real_br_cont map_config_wrap"> | ||
| 29 | - </div> | 28 | + <div class="real_br_cont map_config_wrap"></div> |
| 30 | </div> | 29 | </div> |
| 31 | 30 | ||
| 32 | -<div class="real_spatial_panel uk-animation-scale"> | ||
| 33 | - <div class="station-route-tree"> | ||
| 34 | - | 31 | +<div class="real_spatial_panel"> |
| 32 | + <div class="top-right-toggle"> | ||
| 33 | + <ul class="uk-subnav uk-subnav-pill" data-uk-switcher="{connect:'#spatial-tree-content'}"> | ||
| 34 | + <li class="sr-tab-btn"><a>站点</a></li> | ||
| 35 | + <li class="cp-tab-btn"><a>停车场</a></li> | ||
| 36 | + </ul> | ||
| 37 | + </div> | ||
| 38 | + <div class="real_spatial_body"> | ||
| 39 | + <ul id="spatial-tree-content" class="uk-switcher"> | ||
| 40 | + <li class="station-route-item"> | ||
| 41 | + <div class="station-route-tree"></div> | ||
| 42 | + </li> | ||
| 43 | + <li class="car-park-item"> | ||
| 44 | + <div class="carpark-panel"></div> | ||
| 45 | + </li> | ||
| 46 | + </ul> | ||
| 35 | </div> | 47 | </div> |
| 36 | </div> | 48 | </div> |
| 37 | 49 | ||
| 50 | +<script src="/real_control_v2/assets/js/GeoUtils_min.js"></script> | ||
| 38 | <script src="/real_control_v2/mapmonitor/js/config.js"></script> | 51 | <script src="/real_control_v2/mapmonitor/js/config.js"></script> |
| 39 | <script src="/real_control_v2/mapmonitor/js/gps_tree.js"></script> | 52 | <script src="/real_control_v2/mapmonitor/js/gps_tree.js"></script> |
| 40 | <script src="/real_control_v2/mapmonitor/js/spatial_data.js"></script> | 53 | <script src="/real_control_v2/mapmonitor/js/spatial_data.js"></script> |