Commit 78baa86de4a2c7f3f260d22a97727925804dd9a7
1 parent
439176c9
update
Showing
33 changed files
with
1343 additions
and
320 deletions
pom.xml
| ... | ... | @@ -225,6 +225,12 @@ |
| 225 | 225 | <artifactId>spring-boot-devtools</artifactId> |
| 226 | 226 | <optional>true</optional> |
| 227 | 227 | </dependency>--> |
| 228 | + <dependency> | |
| 229 | + <groupId>com.vividsolutions</groupId> | |
| 230 | + <artifactId>jts</artifactId> | |
| 231 | + <version>1.13</version> | |
| 232 | + </dependency> | |
| 233 | + | |
| 228 | 234 | </dependencies> |
| 229 | 235 | |
| 230 | 236 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/controller/gps/GpsController.java
| 1 | 1 | package com.bsth.controller.gps; |
| 2 | 2 | |
| 3 | -import java.util.List; | |
| 4 | -import java.util.Map; | |
| 5 | - | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.web.bind.annotation.*; | |
| 8 | - | |
| 9 | 3 | import com.bsth.data.BasicData; |
| 10 | 4 | import com.bsth.data.gpsdata.GpsEntity; |
| 11 | 5 | import com.bsth.data.gpsdata.GpsRealData; |
| 12 | 6 | import com.bsth.service.gps.GpsService; |
| 13 | 7 | import com.google.common.base.Splitter; |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.web.bind.annotation.*; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Map; | |
| 14 | 13 | |
| 15 | 14 | @RestController |
| 16 | 15 | @RequestMapping("gps") |
| ... | ... | @@ -70,7 +69,7 @@ public class GpsController { |
| 70 | 69 | return gpsService.history(nbbmArray, st, et); |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | - /*@RequestMapping(value = "/arrival/ram") | |
| 72 | + /*@RequestMapping(value = "/analyse/ram") | |
| 74 | 73 | public List<ArrivalInfo> ramData(@RequestParam String nbbm) { |
| 75 | 74 | return ArrivalDataBuffer.allMap.get(nbbm); |
| 76 | 75 | }*/ |
| ... | ... | @@ -84,4 +83,9 @@ public class GpsController { |
| 84 | 83 | public Map<String, Object> findBuffAeraByCode(@RequestParam String code,@RequestParam String type){ |
| 85 | 84 | return gpsService.findBuffAeraByCode(code, type); |
| 86 | 85 | } |
| 86 | + | |
| 87 | + @RequestMapping(value = "/findRoadSpeed") | |
| 88 | + public Map<String, Object> findRoadSpeed(@RequestParam String lineCode){ | |
| 89 | + return gpsService.findRoadSpeed(lineCode); | |
| 90 | + } | |
| 87 | 91 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -74,6 +74,9 @@ public class GpsEntity { |
| 74 | 74 | /** 是否起终点站 */ |
| 75 | 75 | private boolean sEPoint; |
| 76 | 76 | |
| 77 | + /** 站内 */ | |
| 78 | + private boolean instation; | |
| 79 | + | |
| 77 | 80 | public Integer getCompanyCode() { |
| 78 | 81 | return companyCode; |
| 79 | 82 | } |
| ... | ... | @@ -249,4 +252,12 @@ public class GpsEntity { |
| 249 | 252 | public void setsEPoint(boolean sEPoint) { |
| 250 | 253 | this.sEPoint = sEPoint; |
| 251 | 254 | } |
| 255 | + | |
| 256 | + public boolean isInstation() { | |
| 257 | + return instation; | |
| 258 | + } | |
| 259 | + | |
| 260 | + public void setInstation(boolean instation) { | |
| 261 | + this.instation = instation; | |
| 262 | + } | |
| 252 | 263 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -67,7 +67,7 @@ public class GpsRealData implements CommandLineRunner{ |
| 67 | 67 | @Override |
| 68 | 68 | public void run(String... arg0) throws Exception { |
| 69 | 69 | logger.info("gpsDataLoader,20,6"); |
| 70 | - Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); | |
| 70 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 15, TimeUnit.SECONDS); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public GpsEntity add(GpsEntity gps) { |
| ... | ... | @@ -208,20 +208,6 @@ public class GpsRealData implements CommandLineRunner{ |
| 208 | 208 | |
| 209 | 209 | //纠正走向 |
| 210 | 210 | correctUpdown(gps); |
| 211 | - /*if(issEPoint(gps)) | |
| 212 | - continue; | |
| 213 | - | |
| 214 | - //如果走向未知,尝试根据站点纠正走向 | |
| 215 | - if(gps.getUpDown() == -1){ | |
| 216 | - updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 217 | - if(updown != null) | |
| 218 | - gps.setUpDown(updown); | |
| 219 | - } | |
| 220 | - //如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向 | |
| 221 | - updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 222 | - if(updown != null && !gps.getUpDown().equals(updown)){ | |
| 223 | - gps.setUpDown(updown); | |
| 224 | - }*/ | |
| 225 | 211 | } |
| 226 | 212 | } else |
| 227 | 213 | logger.error("result is null"); |
| ... | ... | @@ -271,19 +257,9 @@ public class GpsRealData implements CommandLineRunner{ |
| 271 | 257 | Integer updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); |
| 272 | 258 | if(updown != null && !updown.equals(gps.getUpDown())) |
| 273 | 259 | gps.setUpDown(updown); |
| 274 | - /*//如果走向未知,尝试根据站点纠正走向 | |
| 275 | - if(gps.getUpDown() == -1){ | |
| 276 | - | |
| 277 | - }*/ | |
| 278 | 260 | |
| 279 | 261 | if(isSEPoint(gps)) |
| 280 | 262 | return; |
| 281 | - | |
| 282 | - /*//如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向 | |
| 283 | - updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 284 | - if(updown != null && !gps.getUpDown().equals(updown)){ | |
| 285 | - gps.setUpDown(updown); | |
| 286 | - }*/ | |
| 287 | 263 | } |
| 288 | 264 | } |
| 289 | 265 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/analyse/CircleQueue.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.analyse; | |
| 2 | + | |
| 3 | +import java.util.Arrays; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 循环队列 | |
| 7 | + * Created by panzhao on 2016/12/23. | |
| 8 | + */ | |
| 9 | +public class CircleQueue<T> { | |
| 10 | + | |
| 11 | + /** | |
| 12 | + * (循环队列)数组的容量 | |
| 13 | + */ | |
| 14 | + public int capacity; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 数组:保存循环队列的元素 | |
| 18 | + */ | |
| 19 | + public Object[] elementData; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 队头(先进先出) | |
| 23 | + */ | |
| 24 | + public int head = 0; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 队尾 | |
| 28 | + */ | |
| 29 | + public int tail = 0; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 以指定长度的数组来创建循环队列 | |
| 33 | + * | |
| 34 | + * @param initSize | |
| 35 | + */ | |
| 36 | + public CircleQueue(final int initSize) { | |
| 37 | + capacity = initSize; | |
| 38 | + elementData = new Object[capacity]; | |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 获取循环队列的大小(包含元素的个数) | |
| 43 | + */ | |
| 44 | + public int size() { | |
| 45 | + if (isEmpty()) { | |
| 46 | + return 0; | |
| 47 | + } else if (isFull()) { | |
| 48 | + return capacity; | |
| 49 | + } else { | |
| 50 | + return tail + 1; | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 插入队尾一个元素 | |
| 56 | + */ | |
| 57 | + public void add(final T element) { | |
| 58 | + if (isEmpty()) { | |
| 59 | + elementData[0] = element; | |
| 60 | + } else if (isFull()) { | |
| 61 | + elementData[head] = element; | |
| 62 | + head++; | |
| 63 | + tail++; | |
| 64 | + head = head == capacity ? 0 : head; | |
| 65 | + tail = tail == capacity ? 0 : tail; | |
| 66 | + } else { | |
| 67 | + elementData[tail + 1] = element; | |
| 68 | + tail++; | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + public boolean isEmpty() { | |
| 73 | + return tail == head && tail == 0 && elementData[tail] == null; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public boolean isFull() { | |
| 77 | + return head != 0 && head - tail == 1 || head == 0 && tail == capacity - 1; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void clear() { | |
| 81 | + Arrays.fill(elementData, null); | |
| 82 | + head = 0; | |
| 83 | + tail = 0; | |
| 84 | + } | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * @return 取 循环队列里的值(先进的index=0) | |
| 88 | + */ | |
| 89 | + public Object[] getQueue() { | |
| 90 | + final Object[] elementDataSort = new Object[capacity]; | |
| 91 | + final Object[] elementDataCopy = elementData.clone(); | |
| 92 | + if (isEmpty()) { | |
| 93 | + } else if (isFull()) { | |
| 94 | + int indexMax = capacity; | |
| 95 | + int indexSort = 0; | |
| 96 | + for (int i = head; i < indexMax;) { | |
| 97 | + elementDataSort[indexSort] = elementDataCopy[i]; | |
| 98 | + indexSort++; | |
| 99 | + i++; | |
| 100 | + if (i == capacity) { | |
| 101 | + i = 0; | |
| 102 | + indexMax = head; | |
| 103 | + } | |
| 104 | + } | |
| 105 | + } else { | |
| 106 | + for (int i = 0; i < tail; i++) { | |
| 107 | + elementDataSort[i] = elementDataCopy[i]; | |
| 108 | + } | |
| 109 | + } | |
| 110 | + return elementDataSort; | |
| 111 | + } | |
| 112 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/analyse/GeoCacheData.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.analyse; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 4 | +import com.google.common.collect.ArrayListMultimap; | |
| 5 | +import com.vividsolutions.jts.geom.Coordinate; | |
| 6 | +import com.vividsolutions.jts.geom.GeometryFactory; | |
| 7 | +import com.vividsolutions.jts.geom.LineString; | |
| 8 | +import org.apache.commons.lang3.StringUtils; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 11 | +import org.springframework.jdbc.core.RowMapper; | |
| 12 | +import org.springframework.stereotype.Component; | |
| 13 | + | |
| 14 | +import java.sql.ResultSet; | |
| 15 | +import java.sql.SQLException; | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * Created by panzhao on 2016/12/23. | |
| 22 | + */ | |
| 23 | +@Component | |
| 24 | +public class GeoCacheData { | |
| 25 | + | |
| 26 | + //每辆车缓存最后50条gps | |
| 27 | + private static final int CACHE_SIZE = 50; | |
| 28 | + private static Map<String, CircleQueue<GpsEntity>> gpsCacheMap = new HashMap<>(); | |
| 29 | + | |
| 30 | + //线路路段走向 | |
| 31 | + private static ArrayListMultimap<String, LineString> sectionCacheMap; | |
| 32 | + | |
| 33 | + //线路站点路由 | |
| 34 | + private static ArrayListMultimap<String, StationRoute> stationCacheMap; | |
| 35 | + | |
| 36 | + @Autowired | |
| 37 | + JdbcTemplate jdbcTemplate; | |
| 38 | + | |
| 39 | + public void loadData(){ | |
| 40 | + final GeometryFactory geometryFactory = new GeometryFactory(); | |
| 41 | + //加载站点路由 | |
| 42 | + String sql = "select r.LINE_CODE,r.DIRECTIONS,r.STATION_CODE,r.STATION_MARK,s.SHAPES_TYPE,s.G_LONX,s.G_LATY,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID,s.RADIUS from bsth_c_stationroute r left join bsth_c_station s on r.station=s.id"; | |
| 43 | + List<StationRoute> routeList = jdbcTemplate.query(sql, new RowMapper<StationRoute>() { | |
| 44 | + @Override | |
| 45 | + public StationRoute mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 46 | + StationRoute sRoute = new StationRoute(); | |
| 47 | + sRoute.setCode(rs.getString("STATION_CODE")); | |
| 48 | + sRoute.setLineCode(rs.getString("LINE_CODE")); | |
| 49 | + sRoute.setDirections(rs.getInt("DIRECTIONS")); | |
| 50 | + sRoute.setPoint(geometryFactory.createPoint(new Coordinate(rs.getFloat("G_LONX"), rs.getFloat("G_LATY")))); | |
| 51 | + sRoute.setRadius(rs.getFloat("RADIUS")); | |
| 52 | + | |
| 53 | + String shapesType = rs.getString("SHAPES_TYPE"); | |
| 54 | + //多边形电子围栏 | |
| 55 | + if(StringUtils.isNotEmpty(shapesType) && shapesType.equals("d")){ | |
| 56 | + geometryFactory.createPolygon(parsePolygon(rs.getString("G_POLYGON_GRID"))); | |
| 57 | + } | |
| 58 | + return sRoute; | |
| 59 | + } | |
| 60 | + }); | |
| 61 | + //按线路和走向分组 | |
| 62 | + if(routeList.size() > 0){ | |
| 63 | + ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create(); | |
| 64 | + for(StationRoute sr : routeList){ | |
| 65 | + tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr); | |
| 66 | + } | |
| 67 | + stationCacheMap = tempMap; | |
| 68 | + } | |
| 69 | + | |
| 70 | + System.out.println(stationCacheMap); | |
| 71 | + } | |
| 72 | + | |
| 73 | + public Coordinate[] parsePolygon(String polygonStr){ | |
| 74 | + String[] coords = polygonStr.substring(11, polygonStr.length() - 2).split(",") | |
| 75 | + ,temps; | |
| 76 | + | |
| 77 | + Coordinate[] cds = new Coordinate[coords.length]; | |
| 78 | + int len = coords.length; | |
| 79 | + for(int i = 0; i < len; i++){ | |
| 80 | + temps = coords[i].split(" "); | |
| 81 | + cds[i] = new Coordinate(Float.parseFloat(temps[0]), Float.parseFloat(temps[1])); | |
| 82 | + } | |
| 83 | + return cds; | |
| 84 | + } | |
| 85 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/analyse/GpsAnalyse.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.analyse; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 4 | +import com.vividsolutions.jts.geom.GeometryFactory; | |
| 5 | + | |
| 6 | +import java.util.concurrent.ExecutorService; | |
| 7 | +import java.util.concurrent.Executors; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 分析gps状态信息 | |
| 11 | + * Created by panzhao on 2016/12/23. | |
| 12 | + */ | |
| 13 | +public class GpsAnalyse { | |
| 14 | + | |
| 15 | + //线程池 | |
| 16 | + ExecutorService threadPool = Executors.newFixedThreadPool(50); | |
| 17 | + | |
| 18 | + private static GeometryFactory geometryFactory = new GeometryFactory(); | |
| 19 | + | |
| 20 | + public void start(GpsEntity gps){ | |
| 21 | + threadPool.execute(new ArrivalMatchThread(gps)); | |
| 22 | + } | |
| 23 | + | |
| 24 | + public class ArrivalMatchThread implements Runnable{ | |
| 25 | + | |
| 26 | + private GpsEntity gps; | |
| 27 | + | |
| 28 | + public ArrivalMatchThread(GpsEntity gps){ | |
| 29 | + this.gps = gps; | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public void run() { | |
| 34 | + //CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getNbbm()); | |
| 35 | + | |
| 36 | + //站内还是站外 | |
| 37 | + //Point p = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon())); | |
| 38 | + | |
| 39 | + /*if(queue == null){ | |
| 40 | + //首个GPS点 | |
| 41 | + queue = new CircleQueue<>(CACHE_SIZE); | |
| 42 | + queue.add(gps); | |
| 43 | + }*/ | |
| 44 | + } | |
| 45 | + } | |
| 46 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/analyse/StationRoute.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.analyse; | |
| 2 | + | |
| 3 | +import com.vividsolutions.jts.geom.Point; | |
| 4 | +import com.vividsolutions.jts.geom.Polygon; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * | |
| 8 | + * Created by panzhao on 2016/12/23. | |
| 9 | + */ | |
| 10 | +public class StationRoute { | |
| 11 | + | |
| 12 | + /** 线路编码 */ | |
| 13 | + private String lineCode; | |
| 14 | + | |
| 15 | + /** 上下行 */ | |
| 16 | + private int directions; | |
| 17 | + | |
| 18 | + /** 站点编码 */ | |
| 19 | + private String code; | |
| 20 | + | |
| 21 | + /** 路由顺序 */ | |
| 22 | + private int routeSort; | |
| 23 | + | |
| 24 | + /** 站点位置 */ | |
| 25 | + private Point point; | |
| 26 | + | |
| 27 | + /** 圆形半径 */ | |
| 28 | + private Float radius; | |
| 29 | + | |
| 30 | + /** 多边形电子围栏 */ | |
| 31 | + private Polygon polygon; | |
| 32 | + | |
| 33 | + public String getCode() { | |
| 34 | + return code; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setCode(String code) { | |
| 38 | + this.code = code; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public int getRouteSort() { | |
| 42 | + return routeSort; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setRouteSort(int routeSort) { | |
| 46 | + this.routeSort = routeSort; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public Point getPoint() { | |
| 50 | + return point; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setPoint(Point point) { | |
| 54 | + this.point = point; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Float getRadius() { | |
| 58 | + return radius; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setRadius(Float radius) { | |
| 62 | + this.radius = radius; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public Polygon getPolygon() { | |
| 66 | + return polygon; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setPolygon(Polygon polygon) { | |
| 70 | + this.polygon = polygon; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public String getLineCode() { | |
| 74 | + return lineCode; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setLineCode(String lineCode) { | |
| 78 | + this.lineCode = lineCode; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public int getDirections() { | |
| 82 | + return directions; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setDirections(int directions) { | |
| 86 | + this.directions = directions; | |
| 87 | + } | |
| 88 | +} | ... | ... |
src/main/java/com/bsth/service/gps/GpsService.java
| ... | ... | @@ -14,4 +14,6 @@ public interface GpsService { |
| 14 | 14 | Map<String, Object> search(Map<String, Object> map, int page, int size, String order, String direction); |
| 15 | 15 | |
| 16 | 16 | Map<String,Object> removeRealGps(String device); |
| 17 | + | |
| 18 | + Map<String,Object> findRoadSpeed(String lineCode); | |
| 17 | 19 | } | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| 1 | 1 | package com.bsth.service.gps; |
| 2 | 2 | |
| 3 | -import java.lang.reflect.Field; | |
| 4 | -import java.sql.Connection; | |
| 5 | -import java.sql.PreparedStatement; | |
| 6 | -import java.sql.ResultSet; | |
| 7 | -import java.util.ArrayList; | |
| 8 | -import java.util.Calendar; | |
| 9 | -import java.util.Collection; | |
| 10 | -import java.util.Collections; | |
| 11 | -import java.util.Comparator; | |
| 12 | -import java.util.Date; | |
| 13 | -import java.util.HashMap; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.Map; | |
| 16 | - | |
| 17 | -import org.apache.commons.lang3.StringUtils; | |
| 18 | -import org.slf4j.Logger; | |
| 19 | -import org.slf4j.LoggerFactory; | |
| 20 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | -import org.springframework.stereotype.Service; | |
| 22 | - | |
| 23 | 3 | import com.bsth.common.ResponseCode; |
| 24 | 4 | import com.bsth.data.BasicData; |
| 25 | 5 | import com.bsth.data.arrival.ArrivalEntity; |
| ... | ... | @@ -31,6 +11,19 @@ import com.bsth.util.DateUtils; |
| 31 | 11 | import com.bsth.util.TransGPS; |
| 32 | 12 | import com.bsth.util.TransGPS.Location; |
| 33 | 13 | import com.bsth.util.db.DBUtils_MS; |
| 14 | +import org.apache.commons.lang3.StringUtils; | |
| 15 | +import org.slf4j.Logger; | |
| 16 | +import org.slf4j.LoggerFactory; | |
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | +import org.springframework.dao.DataAccessException; | |
| 19 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 20 | +import org.springframework.stereotype.Service; | |
| 21 | + | |
| 22 | +import java.lang.reflect.Field; | |
| 23 | +import java.sql.Connection; | |
| 24 | +import java.sql.PreparedStatement; | |
| 25 | +import java.sql.ResultSet; | |
| 26 | +import java.util.*; | |
| 34 | 27 | |
| 35 | 28 | @Service |
| 36 | 29 | public class GpsServiceImpl implements GpsService { |
| ... | ... | @@ -51,6 +44,9 @@ public class GpsServiceImpl implements GpsService { |
| 51 | 44 | @Autowired |
| 52 | 45 | GpsRealData gpsRealData; |
| 53 | 46 | |
| 47 | + @Autowired | |
| 48 | + JdbcTemplate jdbcTemplate; | |
| 49 | + | |
| 54 | 50 | // 历史gps查询 |
| 55 | 51 | @Override |
| 56 | 52 | public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { |
| ... | ... | @@ -199,9 +195,9 @@ public class GpsServiceImpl implements GpsService { |
| 199 | 195 | inv = inv.substring(0, inv.length() - 1); |
| 200 | 196 | |
| 201 | 197 | // 查询到离站数据 |
| 202 | - Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv); | |
| 198 | + //Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv); | |
| 203 | 199 | |
| 204 | - String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO from bsth_c_gps_info where days_year=? and device_id in (" | |
| 200 | + String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS from bsth_c_gps_info where days_year=? and device_id in (" | |
| 205 | 201 | + inv + ") and ts > ? and ts < ?"; |
| 206 | 202 | try { |
| 207 | 203 | conn = DBUtils_MS.getConnection(); |
| ... | ... | @@ -235,15 +231,19 @@ public class GpsServiceImpl implements GpsService { |
| 235 | 231 | map.put("ts", rs.getLong("TS")); |
| 236 | 232 | map.put("timestamp", rs.getLong("TS")); |
| 237 | 233 | map.put("stopNo", rs.getString("STOP_NO")); |
| 234 | + map.put("direction", rs.getFloat("DIRECTION")); | |
| 235 | + | |
| 236 | + map.put("lineId", rs.getString("LINE_ID")); | |
| 237 | + map.put("speed", rs.getFloat("SPEED_GPS")); | |
| 238 | 238 | |
| 239 | 239 | inOutStop = rs.getInt("INOUT_STOP"); |
| 240 | 240 | map.put("inout_stop", inOutStop); |
| 241 | 241 | |
| 242 | - arrival = arrivalMap.get(rs.getString("DEVICE_ID") + "_" + rs.getLong("TS")); | |
| 243 | - if (arrival != null) { | |
| 244 | - map.put("inout_stop_info", arrival); | |
| 245 | - map.put("inout_stop", arrival.getInOut()); | |
| 246 | - } | |
| 242 | + /*analyse = arrivalMap.get(rs.getString("DEVICE_ID") + "_" + rs.getLong("TS")); | |
| 243 | + if (analyse != null) { | |
| 244 | + map.put("inout_stop_info", analyse); | |
| 245 | + map.put("inout_stop", analyse.getInOut()); | |
| 246 | + }*/ | |
| 247 | 247 | map.put("nbbm", BasicData.deviceId2NbbmMap.get(rs.getString("DEVICE_ID"))); |
| 248 | 248 | map.put("state", 0); |
| 249 | 249 | // 上下行 |
| ... | ... | @@ -388,6 +388,22 @@ public class GpsServiceImpl implements GpsService { |
| 388 | 388 | return rs; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | + @Override | |
| 392 | + public Map<String, Object> findRoadSpeed(String lineCode) { | |
| 393 | + Map<String, Object> rs = new HashMap<>(); | |
| 394 | + | |
| 395 | + try { | |
| 396 | + String sql = "select ID, ST_AsText(GROAD_VECTOR) as GROAD_VECTOR,ROAD_CODE,ROAD_NAME,SPEED from bsth_c_road where road_code in(select section_code from bsth_c_sectionroute where line_code=? and destroy=0)"; | |
| 397 | + List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, lineCode); | |
| 398 | + rs.put("status", ResponseCode.SUCCESS); | |
| 399 | + rs.put("roads", list); | |
| 400 | + } catch (DataAccessException e) { | |
| 401 | + logger.error("", e); | |
| 402 | + rs.put("status", ResponseCode.ERROR); | |
| 403 | + } | |
| 404 | + return rs; | |
| 405 | + } | |
| 406 | + | |
| 391 | 407 | private void sortGpsList(final Field f, List<GpsEntity> rs) { |
| 392 | 408 | Collections.sort(rs, new Comparator<GpsEntity>() { |
| 393 | 409 | ... | ... |
src/main/resources/static/pages/control/lineallot/allot.html
| ... | ... | @@ -404,8 +404,8 @@ $(function(){ |
| 404 | 404 | var f = arguments.callee |
| 405 | 405 | ,item = lsData[i]; |
| 406 | 406 | |
| 407 | - //$.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | |
| 408 | - $.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | |
| 407 | + $.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | |
| 408 | + //$.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | |
| 409 | 409 | if(rs && rs.lineId){ |
| 410 | 410 | cacheData[item.lineCode] = rs; |
| 411 | 411 | i ++; | ... | ... |
src/main/resources/static/real_control_v2/assets/plugins/uikit-2.27.1/components/progress.gradient.min.css
0 → 100644
| 1 | +/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ | |
| 2 | +.uk-progress{box-sizing:border-box;height:20px;margin-bottom:15px;background:#f7f7f7;overflow:hidden;line-height:20px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.07),inset 0 2px 2px rgba(0,0,0,.07);border-radius:4px}*+.uk-progress{margin-top:15px}.uk-progress-bar{width:0;height:100%;background:#009dd8;float:left;-webkit-transition:width .6s ease;transition:width .6s ease;font-size:12px;color:#fff;text-align:center;background-image:-webkit-linear-gradient(top,#00b4f5,#008dc5);background-image:linear-gradient(to bottom,#00b4f5,#008dc5);box-shadow:inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 0 1px rgba(0,0,0,.1);text-shadow:0 -1px 0 rgba(0,0,0,.2)}.uk-progress-mini{height:6px}.uk-progress-small{height:12px}.uk-progress-success .uk-progress-bar{background-color:#82bb42;background-image:-webkit-linear-gradient(top,#9fd256,#6fac34);background-image:linear-gradient(to bottom,#9fd256,#6fac34)}.uk-progress-warning .uk-progress-bar{background-color:#f9a124;background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406)}.uk-progress-danger .uk-progress-bar{background-color:#d32c46;background-image:-webkit-linear-gradient(top,#ee465a,#c11a39);background-image:linear-gradient(to bottom,#ee465a,#c11a39)}.uk-progress-striped .uk-progress-bar{background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:30px 30px}.uk-progress-striped.uk-active .uk-progress-bar{-webkit-animation:uk-progress-bar-stripes 2s linear infinite;animation:uk-progress-bar-stripes 2s linear infinite}@-webkit-keyframes uk-progress-bar-stripes{0%{background-position:0 0}100%{background-position:30px 0}}@keyframes uk-progress-bar-stripes{0%{background-position:0 0}100%{background-position:30px 0}}.uk-progress-mini,.uk-progress-small{border-radius:500px} | |
| 0 | 3 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/geo/calc_station_space.html
| ... | ... | @@ -109,7 +109,6 @@ |
| 109 | 109 | if(upSuccess && downSuccess){ |
| 110 | 110 | window.localStorage.setItem('control_route_distance_' + sch.xlBm, JSON.stringify(locData)); |
| 111 | 111 | //刷新父页面 |
| 112 | - console.log('$(drawer).parents', $(drawer).parents('.uk-modal')); | |
| 113 | 112 | $(drawer).parents('.uk-modal').trigger('refresh_station_space'); |
| 114 | 113 | } |
| 115 | 114 | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_inpark.html
| ... | ... | @@ -388,8 +388,9 @@ |
| 388 | 388 | |
| 389 | 389 | //营运开始时间 |
| 390 | 390 | $('input[name=startDate]', serviceForm).val(sch.dfsj); |
| 391 | + | |
| 391 | 392 | //营运班次类型 |
| 392 | - $('input[name=type1]', serviceForm).val(sch['sflj']?'临加':'正常'); | |
| 393 | + $('select[name=type1]', serviceForm).val(sch['sflj']?'临加':'正常'); | |
| 393 | 394 | } |
| 394 | 395 | |
| 395 | 396 | //点击 路径 | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/station_route_spacing_chart.html
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | $('.delete_route_spacing_link', drawer).on('click', function () { |
| 24 | 24 | alt_confirm('确定要删除【'+sch.xlName+'】基于空间坐标计算的站间距数据?', function () { |
| 25 | 25 | window.localStorage.removeItem('control_route_distance_' + sch.xlBm); |
| 26 | + $(drawer).parents('.uk-modal').trigger('refresh_station_space'); | |
| 26 | 27 | toGeoCalcPage(); |
| 27 | 28 | }, '确定删除'); |
| 28 | 29 | }); | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_gps.js
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
src/main/resources/static/real_control_v2/js/north/toolbar.js
| ... | ... | @@ -68,6 +68,9 @@ var gb_northToolbar = (function() { |
| 68 | 68 | }, |
| 69 | 69 | sch_exec_rate: function () { |
| 70 | 70 | open_modal('/real_control_v2/fragments/north/nav/charts/sch_exec_rate.html', {}, modal_opts); |
| 71 | + }, | |
| 72 | + gps_play_back: function () { | |
| 73 | + gb_map_play_back.initParams(); | |
| 71 | 74 | } |
| 72 | 75 | } |
| 73 | 76 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/utils/svg_chart_map.js
| ... | ... | @@ -3,22 +3,25 @@ var gb_svg_map_util = (function () { |
| 3 | 3 | var drawLine = function (map, gps) { |
| 4 | 4 | //从storage里获取路段路由数据 |
| 5 | 5 | var routes = JSON.parse(storage.getItem(gps.lineId + '_route')), |
| 6 | - updown = gps.upDown == 0 ? 'up' : 'down', | |
| 7 | - pots = [], | |
| 8 | - tempArr; | |
| 6 | + updown = gps.upDown == 0 ? 'up_bd' : 'down_bd', | |
| 7 | + pos = [], | |
| 8 | + temps; | |
| 9 | 9 | |
| 10 | - $.each(routes[updown].split(','), function () { | |
| 11 | - tempArr = this.split(' '); | |
| 12 | - pots.push(new BMap.Point(tempArr[0], tempArr[1])); | |
| 13 | - }); | |
| 10 | + $.each(routes[updown], function (i, item) { | |
| 14 | 11 | |
| 15 | - var polyline = new BMap.Polyline(pots, { | |
| 16 | - strokeWeight: 6, | |
| 17 | - strokeOpacity: 0.5, | |
| 18 | - strokeColor: gps.upDown == 0 ? 'blue' : 'red' | |
| 19 | - }); | |
| 12 | + pos = []; | |
| 13 | + $.each(item.split(','), function () { | |
| 14 | + temps = this.split(' '); | |
| 15 | + pos.push(new BMap.Point(temps[0], temps[1])); | |
| 16 | + }); | |
| 17 | + var polyline = new BMap.Polyline(pos, { | |
| 18 | + strokeWeight: 6, | |
| 19 | + strokeOpacity: 0.5, | |
| 20 | + strokeColor: gps.upDown == 0 ? 'blue' : 'red' | |
| 21 | + }); | |
| 22 | + map.addOverlay(polyline); | |
| 20 | 23 | |
| 21 | - map.addOverlay(polyline); | |
| 24 | + }); | |
| 22 | 25 | |
| 23 | 26 | $.each(gb_data_basic.stationRoutes(gps.lineId), function (i) { |
| 24 | 27 | if (this.directions == gps.upDown) { | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
| ... | ... | @@ -94,18 +94,9 @@ input[type=checkbox].disabled{ |
| 94 | 94 | |
| 95 | 95 | /**/ |
| 96 | 96 | .real_bottom_panel{ |
| 97 | -/* position: absolute !important; | |
| 98 | - height: 180px; | |
| 99 | - width: 100%; | |
| 100 | - width: calc(100% - 342px); | |
| 101 | - bottom: 2px !important; | |
| 102 | - left: 0px !important; | |
| 103 | - background: #fff; | |
| 104 | - box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | |
| 105 | - border: 1px solid #bfbcbc;*/ | |
| 106 | 97 | |
| 107 | 98 | position: absolute !important; |
| 108 | - height: 124px; | |
| 99 | + height: 256px; | |
| 109 | 100 | bottom: 2px !important; |
| 110 | 101 | background: #fff; |
| 111 | 102 | box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); |
| ... | ... | @@ -247,7 +238,7 @@ input[type=checkbox].disabled{ |
| 247 | 238 | } |
| 248 | 239 | |
| 249 | 240 | .gps_info_win p{ |
| 250 | - margin: 9px 0; | |
| 241 | + margin: 6px 0; | |
| 251 | 242 | font-size: 13px; |
| 252 | 243 | } |
| 253 | 244 | |
| ... | ... | @@ -452,4 +443,132 @@ input[type=checkbox].disabled{ |
| 452 | 443 | |
| 453 | 444 | #spatial-tree-content .jstree-default .jstree-anchor{ |
| 454 | 445 | font-size: 13px; |
| 455 | -} | |
| 456 | 446 | \ No newline at end of file |
| 447 | +} | |
| 448 | + | |
| 449 | +#map-playback-modal .uk-modal-dialog{ | |
| 450 | + width: 600px; | |
| 451 | +} | |
| 452 | + | |
| 453 | +#map-playback-modal .play-back-run-modal{ | |
| 454 | + transition: all .5s ease; | |
| 455 | + width: 1400px; | |
| 456 | + max-width: 90%; | |
| 457 | +} | |
| 458 | + | |
| 459 | +.play-back-run-modal>h1{ | |
| 460 | + transition: all .7s ease; | |
| 461 | + font-size: 22px; | |
| 462 | + line-height: 22px; | |
| 463 | +} | |
| 464 | + | |
| 465 | +#playback_run_body{ | |
| 466 | + height: 680px; | |
| 467 | + max-height: 780px; | |
| 468 | +} | |
| 469 | + | |
| 470 | +#playback_run_body .pb_footer_tools{ | |
| 471 | + animation-delay: .1s; | |
| 472 | + position: absolute; | |
| 473 | + width: 100%; | |
| 474 | + height: 68px; | |
| 475 | + background: #ffffff; | |
| 476 | + bottom: 0; | |
| 477 | + margin-left: -20px; | |
| 478 | + box-shadow: 1px 0px 5px 0 rgba(0,0,0,0.16), -1px 0px 10px 0 rgba(0,0,0,0.12); | |
| 479 | +} | |
| 480 | + | |
| 481 | +#playback_run_body .pb_footer_tools .uk-progress{ | |
| 482 | + width: 75%; | |
| 483 | + margin: 25px 15px 0 1%; | |
| 484 | + cursor: pointer; | |
| 485 | +} | |
| 486 | + | |
| 487 | +#playback_run_body .pb_footer_tools>div{ | |
| 488 | + display: inline-block; | |
| 489 | +} | |
| 490 | + | |
| 491 | +.pb_tools_icon{ | |
| 492 | + vertical-align: top; | |
| 493 | + font-size: 32px; | |
| 494 | + margin: 15px 5px 0 5px; | |
| 495 | +} | |
| 496 | + | |
| 497 | +.pb_tools_icon i{ | |
| 498 | + cursor: pointer; | |
| 499 | +} | |
| 500 | + | |
| 501 | +.pb_log_panel{ | |
| 502 | + animation-delay: .1s; | |
| 503 | + position: absolute; | |
| 504 | + width: 300px; | |
| 505 | + height: 600px; | |
| 506 | + background: white; | |
| 507 | + right: 0; | |
| 508 | + bottom: 80px; | |
| 509 | + box-shadow: 1px 0px 5px 0 rgba(0,0,0,0.16), -1px 0px 10px 0 rgba(0,0,0,0.12); | |
| 510 | +} | |
| 511 | + | |
| 512 | +#playback_run_body .map_wrap{ | |
| 513 | + height: 100%; | |
| 514 | + width: calc(100% + 40px); | |
| 515 | + margin-left: -20px; | |
| 516 | +} | |
| 517 | + | |
| 518 | + | |
| 519 | +.pb_log_panel .ct_table dl dt:nth-of-type(1), .pb_log_panel .ct_table dl dd:nth-of-type(1) { | |
| 520 | + width: 24%; | |
| 521 | +} | |
| 522 | +.pb_log_panel .ct_table dl dt:nth-of-type(2), .pb_log_panel .ct_table dl dd:nth-of-type(2) { | |
| 523 | + width: 14%; | |
| 524 | +} | |
| 525 | +.pb_log_panel .ct_table dl dt:nth-of-type(3), .pb_log_panel .ct_table dl dd:nth-of-type(3) { | |
| 526 | + width: 44%; | |
| 527 | +} | |
| 528 | +.pb_log_panel .ct_table dl dt:nth-of-type(4), .pb_log_panel .ct_table dl dd:nth-of-type(4) { | |
| 529 | + width: 16%; | |
| 530 | +} | |
| 531 | + | |
| 532 | +.pb_log_panel .ct_table .ct_table_body dl:last-child dd{ | |
| 533 | + border-bottom: 1px solid #dedede; | |
| 534 | +} | |
| 535 | + | |
| 536 | +.ui-slider-tip{ | |
| 537 | + position: absolute; | |
| 538 | + visibility: hidden; | |
| 539 | + bottom: 50px; | |
| 540 | + display: block; | |
| 541 | + width: 54px; | |
| 542 | + height: 20px; | |
| 543 | + line-height: 20px; | |
| 544 | + background: white; | |
| 545 | + border-radius: 3px; | |
| 546 | + box-shadow: 0 0 3px rgba(0, 0, 0, 0.72); | |
| 547 | + text-align: center; | |
| 548 | + font-size: 12px; | |
| 549 | + /*opacity: 0;*/ | |
| 550 | + /*transition: all .3s ease;*/ | |
| 551 | + color: #333; | |
| 552 | +} | |
| 553 | + | |
| 554 | +.ui-slider-tip:after{ | |
| 555 | + content: " "; | |
| 556 | + width: 0; | |
| 557 | + height: 0; | |
| 558 | + border: 5px solid rgba(255, 255, 255, 0); | |
| 559 | + border-top-color: #d3d3d3; | |
| 560 | + position: absolute; | |
| 561 | + bottom: -10px; | |
| 562 | + left: 50%; | |
| 563 | + margin-left: -5px; | |
| 564 | +} | |
| 565 | + | |
| 566 | +/* | |
| 567 | +.pb_log_item>div{ | |
| 568 | + display: inline-block; | |
| 569 | +}*/ | |
| 570 | + | |
| 571 | +/* | |
| 572 | +.pb_tools_icon i:hover{ | |
| 573 | + color: #787676; | |
| 574 | + box-shadow: 1px 0px 5px 0 rgba(0,0,0,0.16), -1px 0px 10px 0 rgba(0,0,0,0.12); | |
| 575 | +}*/ | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_config.html
| ... | ... | @@ -23,10 +23,17 @@ |
| 23 | 23 | <span class="uk-form-label">车辆图标</span> |
| 24 | 24 | <div class="uk-form-controls"> |
| 25 | 25 | <label><input name="carIcon_angle" type="checkbox" {{if carIcon.angle}}checked{{/if}}> 标示角度</label> |
| 26 | - <label><input class="disabled" disabled type="checkbox" {{if carIcon.converge}}checked{{/if}}> 聚合</label> | |
| 26 | + <!--<label><input class="disabled" disabled type="checkbox" {{if carIcon.converge}}checked{{/if}}> 聚合</label>--> | |
| 27 | + </div> | |
| 28 | + </div> | |
| 29 | + <div class="uk-form-row"> | |
| 30 | + <span class="uk-form-label">异常警报</span> | |
| 31 | + <div class="uk-form-controls"> | |
| 32 | + <label><input type="checkbox" {{if abnormalPrint.speeding}}checked{{/if}}> 超速</label> | |
| 33 | + <label><input type="checkbox" {{if abnormalPrint.outBounds}}checked{{/if}}> 越界</label> | |
| 34 | + <label><input type="checkbox" {{if abnormalPrint.largeMargin}}checked{{/if}}> 大间隔</label> | |
| 27 | 35 | </div> |
| 28 | 36 | </div> |
| 29 | - | |
| 30 | 37 | <div class="uk-form-row"> |
| 31 | 38 | <span class="uk-form-label">车辆颜色</span> |
| 32 | 39 | <div class="uk-form-controls"> |
| ... | ... | @@ -71,15 +78,6 @@ |
| 71 | 78 | </div> |
| 72 | 79 | </div> |
| 73 | 80 | </div> |
| 74 | - | |
| 75 | - <div class="uk-form-row"> | |
| 76 | - <span class="uk-form-label">异常警报输出</span> | |
| 77 | - <div class="uk-form-controls"> | |
| 78 | - <label><input class="disabled" disabled type="checkbox" {{if abnormalPrint.speeding}}checked{{/if}}> 超速</label> | |
| 79 | - <label><input class="disabled" disabled type="checkbox" {{if abnormalPrint.outBounds}}checked{{/if}}> 越界</label> | |
| 80 | - <label><input class="disabled" disabled type="checkbox" {{if abnormalPrint.largeMargin}}checked{{/if}}> 大间隔</label> | |
| 81 | - </div> | |
| 82 | - </div> | |
| 83 | 81 | </form> |
| 84 | 82 | </script> |
| 85 | 83 | </div> | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
| 1 | 1 | <div> |
| 2 | 2 | <script id="map-win-gps-detail-temp" type="text/html"> |
| 3 | - <div class="gps_info_win"> | |
| 3 | + <div class="gps_info_win" style="width: 200px;"> | |
| 4 | 4 | <h4>{{nbbm}}</h4> |
| 5 | 5 | <h5> |
| 6 | 6 | {{lineName}} |
| 7 | - ({{if stationName!=null}} | |
| 8 | - {{stationName}} | |
| 7 | + </h5> | |
| 8 | + <h5> | |
| 9 | + {{if stationName!=null}} | |
| 10 | + {{stationName}} 站 | |
| 9 | 11 | {{else}} |
| 10 | 12 | 未知站点 |
| 11 | - {{/if}}) | |
| 13 | + {{/if}} | |
| 12 | 14 | </h5> |
| 15 | + <p>设备状态:正常</p> | |
| 16 | + <p>设备号:{{deviceId}}</p> | |
| 13 | 17 | <p>速度:{{speed}}</p> |
| 14 | 18 | <p>角度:{{direction}}</p> |
| 15 | 19 | <p>经度:{{lon}}</p> |
| ... | ... | @@ -20,7 +24,7 @@ |
| 20 | 24 | {{if expectStopTime!=null}} |
| 21 | 25 | <a href="javascript:;" style="color: #07D;margin-right: 7px;">预计 {{expectStopTime}} 分钟到达终点</a> |
| 22 | 26 | {{/if}} |
| 23 | - <a href="javascript:;" style="float: right;">轨迹回放</a> | |
| 27 | + <a href="javascript:;" style="float: right;" onclick="javascript:gb_map_play_back.initParams('{{deviceId}}', '{{nbbm}}');">轨迹回放</a> | |
| 24 | 28 | </div> |
| 25 | 29 | </script> |
| 26 | 30 | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback/before_form.html
0 → 100644
| 1 | +<div class="uk-alert uk-alert-success">开始~结束时间最大间隔24小时</div> | |
| 2 | +<div style="width: 68%;margin: auto;" id="playback_before_form"> | |
| 3 | + <form class="uk-form uk-form-horizontal" style="margin-bottom: 0 !important;"> | |
| 4 | + <div class="uk-grid"> | |
| 5 | + <div class="uk-width-1-1"> | |
| 6 | + <div class="uk-form-row"> | |
| 7 | + <label class="uk-form-label">车辆编码</label> | |
| 8 | + <div class="uk-form-controls"> | |
| 9 | + <div class="uk-autocomplete uk-form autocomplete-nbbm"> | |
| 10 | + <input name="nbbm" required/> | |
| 11 | + </div> | |
| 12 | + </div> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + </div> | |
| 16 | + <div class="uk-grid"> | |
| 17 | + <div class="uk-width-2-3"> | |
| 18 | + <div class="uk-form-row"> | |
| 19 | + <label class="uk-form-label">开始时间</label> | |
| 20 | + <div class="uk-form-controls"> | |
| 21 | + <input name="sDate" type="date" required/> | |
| 22 | + </div> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + <div class="uk-width-1-3" style="padding-left: 15px;"> | |
| 26 | + <div class="uk-form-row"> | |
| 27 | + <div class="uk-form-controls" style="margin-left: 0;"> | |
| 28 | + <input name="sTime" type="time" required/> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + <div class="uk-grid"> | |
| 34 | + <div class="uk-width-2-3"> | |
| 35 | + <div class="uk-form-row"> | |
| 36 | + <label class="uk-form-label">结束时间</label> | |
| 37 | + <div class="uk-form-controls"> | |
| 38 | + <input name="eDate" type="date" required/> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | + </div> | |
| 42 | + <div class="uk-width-1-3" style="padding-left: 15px;"> | |
| 43 | + <div class="uk-form-row"> | |
| 44 | + <div class="uk-form-controls" style="margin-left: 0;"> | |
| 45 | + <input name="eTime" type="time" required/> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + </div> | |
| 50 | + | |
| 51 | + <div style="text-align: center;margin-top: 25px;"> | |
| 52 | + <button class="uk-button uk-button-large uk-button-primary" type="submit"><i | |
| 53 | + class="uk-icon-play-circle"> </i> 开始回放 | |
| 54 | + </button> | |
| 55 | + </div> | |
| 56 | + <i class="uk-icon-spinner uk-icon-spin" | |
| 57 | + style="font-size: 18px;color: rgb(213, 31, 31);position: absolute;bottom: 25px;left: calc(50% + 70px);display: none;"></i> | |
| 58 | + </form> | |
| 59 | + | |
| 60 | + <script> | |
| 61 | + (function () { | |
| 62 | + $('#playback_before_form').on('init_form', function (e, data) { | |
| 63 | + //车辆 autocomplete | |
| 64 | + $.get('/basic/cars', function (rs) { | |
| 65 | + gb_common.carAutocomplete($('#playback_before_form .autocomplete-nbbm'), rs); | |
| 66 | + }); | |
| 67 | + | |
| 68 | + if (data.nbbm) | |
| 69 | + $('[name=nbbm]', this).val(data.nbbm); | |
| 70 | + //默认时间 | |
| 71 | + var m = moment() | |
| 72 | + , rq = 'YYYY-MM-DD', sj = 'HH:mm'; | |
| 73 | + $('[name=eDate]', this).val(m.format(rq)); | |
| 74 | + $('[name=eTime]', this).val(m.format('HH:mm')); | |
| 75 | + $('[name=sDate]', this).val(m.subtract(2, 'hour').format(rq)); | |
| 76 | + $('[name=sTime]', this).val(m.format(sj)); | |
| 77 | + | |
| 78 | + //test | |
| 79 | + $('[name=nbbm]', this).val('W9H-003'); | |
| 80 | + $('[name=eDate]', this).val('2016-12-10'); | |
| 81 | + $('[name=eTime]', this).val('09:00'); | |
| 82 | + $('[name=sDate]', this).val('2016-12-10'); | |
| 83 | + $('[name=sTime]', this).val('07:00'); | |
| 84 | + }); | |
| 85 | + | |
| 86 | + var ONE_DAY = 1000 * 60 * 60 * 24; | |
| 87 | + var f = $('form', '#playback_before_form').formValidation({ | |
| 88 | + framework: 'uikit', | |
| 89 | + locale: 'zh_CN' | |
| 90 | + }); | |
| 91 | + f.on('success.form.fv', function (e) { | |
| 92 | + e.preventDefault(); | |
| 93 | + disabledBtn(); | |
| 94 | + var data = $(this).serializeJSON(); | |
| 95 | + | |
| 96 | + //校验时间间隔 | |
| 97 | + var fs = 'YYYY-MM-DDHH:mm'; | |
| 98 | + var st = moment(data.sDate + data.sTime, fs).format('X'); | |
| 99 | + var et = moment(data.eDate + data.eTime, fs).format('X'); | |
| 100 | + | |
| 101 | + if (et < st) | |
| 102 | + return abortSubmit('结束时间小于开始时间???'); | |
| 103 | + else if ((et - st) > ONE_DAY) | |
| 104 | + return abortSubmit('时间间隔不能超过24小时!'); | |
| 105 | + else if (et == st) | |
| 106 | + return abortSubmit('一点时间间隔都不给???'); | |
| 107 | + | |
| 108 | + $('#playback_before_form i.uk-icon-spinner').show(); | |
| 109 | + $.ajax({ | |
| 110 | + url: '/gps/gpsHistory/multiple', | |
| 111 | + traditional: true, | |
| 112 | + data: {nbbmArray: [data.nbbm], st: st, et: et}, | |
| 113 | + success: function (rs) { | |
| 114 | + if (!rs || rs.length == 0) | |
| 115 | + return abortSubmit('失败,服务器没有返回轨迹数据!'); | |
| 116 | + | |
| 117 | + //排序 | |
| 118 | + rs.sort(function (a, b) { | |
| 119 | + return a.timestamp - b.timestamp; | |
| 120 | + }); | |
| 121 | + //格式化时间 | |
| 122 | + $.each(rs, function () { | |
| 123 | + var mom = moment(this.timestamp); | |
| 124 | + this.timeStr = mom.format('HH:mm.ss'); | |
| 125 | + this.timeStr2 = mom.format('YYYY-MM-DD HH:mm.ss'); | |
| 126 | + }); | |
| 127 | + | |
| 128 | + //获取路段信息 | |
| 129 | + if (!rs[0] || !rs[0].lineId) | |
| 130 | + return notify_err('首个点位无效....'); | |
| 131 | + | |
| 132 | + jsQueryRoads(rs[0].lineId, function (roads) { | |
| 133 | + //gps关联到路段 | |
| 134 | + matchRoad(rs, roads); | |
| 135 | + | |
| 136 | + var f = $('#playback_before_form'); | |
| 137 | + var fileName = $('[name=nbbm]', f).val() + '轨迹数据' | |
| 138 | + + $('[name=sDate]', f).val() + $('[name=sTime]', f).val() + '至' | |
| 139 | + + $('[name=eDate]', f).val() + $('[name=eTime]', f).val() + '.xls'; | |
| 140 | + | |
| 141 | + $('#playback_before_form').parents('.uk-modal').trigger('show_play_body', { | |
| 142 | + gpsList: rs, | |
| 143 | + roads: roads, | |
| 144 | + lineCode: rs[0].lineId, | |
| 145 | + fileName: fileName.replace(new RegExp(/-/g),'').replace(new RegExp(/:/g),'') | |
| 146 | + }); | |
| 147 | + }); | |
| 148 | + } | |
| 149 | + }); | |
| 150 | + }); | |
| 151 | + | |
| 152 | + function abortSubmit(t) { | |
| 153 | + $('#playback_before_form i.uk-icon-spinner').hide(); | |
| 154 | + notify_err(t); | |
| 155 | + $('form button[type=submit]', '#playback_before_form').removeClass('disabled').removeAttr('disabled'); | |
| 156 | + } | |
| 157 | + | |
| 158 | + function disabledBtn() { | |
| 159 | + $('form button[type=submit]', '#playback_before_form').addClass('disabled').attr('disabled', 'disabled'); | |
| 160 | + } | |
| 161 | + | |
| 162 | + function jsQueryRoads(lineCode, cb) { | |
| 163 | + gb_common.$get('/gps/findRoadSpeed', {lineCode: lineCode}, function (rs) { | |
| 164 | + //处理路段坐标集合 | |
| 165 | + var roads = rs.roads; | |
| 166 | + var cds, coordArray, array; | |
| 167 | + | |
| 168 | + for (var i = 0, road; road = roads[i++];) { | |
| 169 | + cds = road['GROAD_VECTOR']; | |
| 170 | + cds = cds.substring(11, cds.length - 1); | |
| 171 | + coordArray = cds.split(','); | |
| 172 | + | |
| 173 | + array = []; | |
| 174 | + | |
| 175 | + for (var j = 0, cd; cd = coordArray[j++];) { | |
| 176 | + var cdArray = cd.split(' '); | |
| 177 | + | |
| 178 | + //wgs84 to baidu | |
| 179 | + var bdCd = TransGPS.wgsToBD(parseFloat(cdArray[1]), parseFloat(cdArray[0])); | |
| 180 | + array.push({ | |
| 181 | + longitude: bdCd.lng, | |
| 182 | + latitude: bdCd.lat | |
| 183 | + }); | |
| 184 | + } | |
| 185 | + road.coords = array; | |
| 186 | + } | |
| 187 | + cb && cb(roads); | |
| 188 | + }); | |
| 189 | + } | |
| 190 | + | |
| 191 | + | |
| 192 | + function matchRoad(gpsArray, roads) { | |
| 193 | + var rs; | |
| 194 | + $.each(gpsArray, function () { | |
| 195 | + rs = gpsMatchRoad(this, roads); | |
| 196 | + this.road = rs.road; | |
| 197 | + this.minDistance = rs.min; | |
| 198 | + }); | |
| 199 | + } | |
| 200 | + | |
| 201 | + function gpsMatchRoad(gps, roads) { | |
| 202 | + var point = {latitude: gps.bd_lat, longitude: gps.bd_lon}; | |
| 203 | + | |
| 204 | + var min, road; | |
| 205 | + $.each(roads, function () { | |
| 206 | + | |
| 207 | + var len = this.coords.length; | |
| 208 | + for (var i = 0; i < len - 1; i++) { | |
| 209 | + //点到线的距离 | |
| 210 | + var distance = geolib.getDistanceFromLine(point, this.coords[i], this.coords[i + 1]); | |
| 211 | + if (min > distance || min == null) { | |
| 212 | + min = distance; | |
| 213 | + road = this; | |
| 214 | + } | |
| 215 | + } | |
| 216 | + }); | |
| 217 | + | |
| 218 | + return {road: road, min: min}; | |
| 219 | + } | |
| 220 | + })(); | |
| 221 | + </script> | |
| 222 | +</div> | |
| 0 | 223 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback/main.html
0 → 100644
| 1 | +<div class="uk-modal ct-form-modal" id="map-playback-modal"> | |
| 2 | + <div class="uk-modal-dialog" > | |
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | + <h1>轨迹回放</h1> | |
| 5 | + <div class="pb_modal_body"></div> | |
| 6 | + </div> | |
| 7 | + <script> | |
| 8 | + (function () { | |
| 9 | + var modal = '#map-playback-modal'; | |
| 10 | + | |
| 11 | + $(modal).on('show_form', function (e, data) { | |
| 12 | + $('.pb_modal_body', modal).load('/real_control_v2/mapmonitor/fragments/playback/before_form.html', function () { | |
| 13 | + $('#playback_before_form', modal).trigger('init_form', data); | |
| 14 | + }); | |
| 15 | + }); | |
| 16 | + | |
| 17 | + //show播放界面 | |
| 18 | + $(modal).on('show_play_body', function (e, data) { | |
| 19 | + $('.pb_modal_body', modal).empty(); | |
| 20 | + $('.uk-modal-dialog', modal).addClass('play-back-run-modal').one('transitionend', function () { | |
| 21 | + //最小宽度 | |
| 22 | + $(this).css('min-width', '1280px'); | |
| 23 | + }); | |
| 24 | + $('.pb_modal_body', modal).load('/real_control_v2/mapmonitor/fragments/playback/run.html', function () { | |
| 25 | + $('#playback_run_body', modal).trigger('init', data); | |
| 26 | + }); | |
| 27 | + }); | |
| 28 | + })(); | |
| 29 | + </script> | |
| 30 | +</div> | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback/run.html
0 → 100644
| 1 | +<div id="playback_run_body"> | |
| 2 | + <div class="map_wrap"></div> | |
| 3 | + <!-- 日志输出 --> | |
| 4 | + <div class="pb_log_panel uk-animation-slide-right" style="overflow: auto;"> | |
| 5 | + <div class="ct_table" style="height: calc(100% - 30px);"> | |
| 6 | + <div class="ct_table_head"> | |
| 7 | + <dl> | |
| 8 | + <dt>时间</dt> | |
| 9 | + <dt>速度</dt> | |
| 10 | + <dt>路段</dt> | |
| 11 | + <dt>状态</dt> | |
| 12 | + </dl> | |
| 13 | + </div> | |
| 14 | + <div class="ct_table_body"> | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + </div> | |
| 18 | + <div class="pb_footer_tools uk-animation-slide-bottom" onselectstart="return false;" style="-moz-user-select:none;"> | |
| 19 | + <span class="ui-slider-tip">08:30.50</span> | |
| 20 | + <div class="uk-progress uk-progress-small uk-progress-success uk-progress-striped"> | |
| 21 | + <div class="uk-progress-bar" style="width: 0;"></div> | |
| 22 | + </div> | |
| 23 | + | |
| 24 | + <div class="pb_tools_icon"> | |
| 25 | + <div class="uk-button-group"> | |
| 26 | + <a class="uk-button" data-uk-tooltip title="快退" data-type="rewind"><i class="uk-icon-fast-backward"></i></a> | |
| 27 | + <a class="uk-button" data-uk-tooltip title="停止" data-type="stop"><i class="uk-icon-stop"></i></a> | |
| 28 | + <a class="uk-button play-btn" data-type="play"><i class="uk-icon-play"></i></a> | |
| 29 | + <a class="uk-button" data-uk-tooltip title="快进" data-type="fast_forward"><i class="uk-icon-fast-forward"></i></a> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + | |
| 33 | + <div class="pb_tools_icon"> | |
| 34 | + <div class="uk-button-dropdown" data-uk-dropdown="{mode:'hover', pos:'top-left'}"> | |
| 35 | + <button class="uk-button"><i class="uk-icon-cog"> </i> 工具 <i class="uk-icon-caret-down"></i></button> | |
| 36 | + <div class="uk-dropdown uk-dropdown-bottom uk-dropdown-small" style="top: 30px; left: 0px;"> | |
| 37 | + <ul class="uk-nav uk-nav-dropdown pb_dropdown_tool"> | |
| 38 | + <!--<li><a>显示站点</a></li> | |
| 39 | + <li><a>显示电子围栏</a></li> | |
| 40 | + <li class="uk-nav-divider"></li> | |
| 41 | + <li><a>关闭日志输出</a></li> | |
| 42 | + <li class="uk-nav-divider"></li>--> | |
| 43 | + <li><a data-name="exportExcel" href="javascript:;" >导出轨迹</a></li> | |
| 44 | + </ul> | |
| 45 | + </div> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + | |
| 50 | + <script> | |
| 51 | + (function () { | |
| 52 | + | |
| 53 | + var logTemp = template.compile('{{each list as gps i}}<dl data-code="{{gps.road.ROAD_CODE}}">' + | |
| 54 | + '<dd>{{gps.timeStr}}</dd>' + | |
| 55 | + '<dd>{{gps.speed}}</dd>' + | |
| 56 | + '<dd>{{gps.road.ROAD_NAME}}</dd><dd>正常</dd></dl>{{/each}}'); | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + var _body = '#playback_run_body' | |
| 61 | + , map, gpsArray, roads, marker, width, trailArray = [], trailPolyline; | |
| 62 | + | |
| 63 | + var upRoutePos = [], downRoutePos = []; | |
| 64 | + var storage = window.localStorage; | |
| 65 | + var lineCode; | |
| 66 | + | |
| 67 | + //进度条 | |
| 68 | + var progress = $('.pb_footer_tools .uk-progress', _body); | |
| 69 | + var bar = $('.uk-progress-bar', progress); | |
| 70 | + var step; | |
| 71 | + var prsTip = $('.ui-slider-tip', _body); | |
| 72 | + progress.mousemove(function (e) { | |
| 73 | + var x = e.offsetX; | |
| 74 | + var i = parseInt(x / step); | |
| 75 | + var time = moment(gpsArray[i].timestamp).format('HH:mm.ss'); | |
| 76 | + | |
| 77 | + prsTip.text(time).css('left', x - 11).css('visibility', 'visible'); | |
| 78 | + }).mouseout(function () { | |
| 79 | + prsTip.css('visibility', 'hidden') | |
| 80 | + }).on('click', function (e) { | |
| 81 | + var x = e.offsetX; | |
| 82 | + goto(parseInt(x / step)); | |
| 83 | + }); | |
| 84 | + | |
| 85 | + $(_body).on('init', function (e, data) { | |
| 86 | + roads = data.roads; | |
| 87 | + lineCode = data.lineCode; | |
| 88 | + | |
| 89 | + setTimeout(function () { | |
| 90 | + initMap(data.gpsList); | |
| 91 | + len = gpsArray.length; | |
| 92 | + step = progress.width() / gpsArray.length; | |
| 93 | + }, 600); | |
| 94 | + | |
| 95 | + //导出的文件名 | |
| 96 | + $('a[data-name=exportExcel]').attr('download', data.fileName); | |
| 97 | + }); | |
| 98 | + | |
| 99 | + $('.pb_tools_icon a.uk-button', _body).on('click', function () { | |
| 100 | + var type = $(this).data('type'); | |
| 101 | + switch (type) { | |
| 102 | + case 'play': | |
| 103 | + play(); | |
| 104 | + break; | |
| 105 | + case 'pause': | |
| 106 | + pause(); | |
| 107 | + break; | |
| 108 | + case 'fast_forward': | |
| 109 | + goto(index + 10); | |
| 110 | + break; | |
| 111 | + case 'rewind': | |
| 112 | + goto(index - 10); | |
| 113 | + break; | |
| 114 | + case 'stop': | |
| 115 | + pause(); | |
| 116 | + break; | |
| 117 | + } | |
| 118 | + }); | |
| 119 | + | |
| 120 | + $('.pb_dropdown_tool li a', _body).on('click', function () { | |
| 121 | + var name = $(this).data('name'); | |
| 122 | + switch (name) { | |
| 123 | + case 'exportExcel': | |
| 124 | + var base64Str = gb_map_play_back.listToExcel(gpsArray); | |
| 125 | + $(this).attr('href', base64Str); | |
| 126 | + break; | |
| 127 | + } | |
| 128 | + }); | |
| 129 | + | |
| 130 | + function goto(ei) { | |
| 131 | + if(ei < 0 || ei >= len) | |
| 132 | + return; | |
| 133 | + | |
| 134 | + bar.css('width', ei * step); | |
| 135 | + var gps = gpsArray[ei]; | |
| 136 | + //重新定位marker | |
| 137 | + try { | |
| 138 | + drawLine(gps.direction); | |
| 139 | + } catch (e) { | |
| 140 | + console.log(e); | |
| 141 | + } | |
| 142 | + var point = new BMap.Point(gps.bd_lon, gps.bd_lat); | |
| 143 | + marker.setPosition(point); | |
| 144 | + marker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75))); | |
| 145 | + | |
| 146 | + //重新填充轨迹线,更新日志面板 | |
| 147 | + trailArray = []; | |
| 148 | + var logs = []; | |
| 149 | + for (var i = 0; i <= ei; i++) { | |
| 150 | + trailArray.push(new BMap.Point(gpsArray[i].bd_lon, gpsArray[i].bd_lat)); | |
| 151 | + if(i > 0 && logs[logs.length - 1].road.ROAD_CODE == gpsArray[i].road.ROAD_CODE) | |
| 152 | + logs.pop(); | |
| 153 | + | |
| 154 | + logs.push(gpsArray[i]); | |
| 155 | + } | |
| 156 | + trailPolyline.setPath(trailArray); | |
| 157 | + | |
| 158 | + index = ei; | |
| 159 | + map.panTo(marker.getPosition()); | |
| 160 | + //更新日志面板 | |
| 161 | + logPanel.empty().html(logTemp({list: logs})); | |
| 162 | + logWrap.scrollTop(logWrap[0].scrollHeight); | |
| 163 | + } | |
| 164 | + | |
| 165 | + //播放 | |
| 166 | + function play() { | |
| 167 | + $('.play-btn', _body) | |
| 168 | + .data('type', 'pause') | |
| 169 | + .find('i') | |
| 170 | + .removeClass('uk-icon-play') | |
| 171 | + .addClass('uk-icon-pause'); | |
| 172 | + pauseFlag = false; | |
| 173 | + progress.addClass('uk-active'); | |
| 174 | + run(); | |
| 175 | + | |
| 176 | + //定时居中 | |
| 177 | + fixedToCenter(); | |
| 178 | + } | |
| 179 | + | |
| 180 | + var toCenterTimer; | |
| 181 | + | |
| 182 | + function fixedToCenter() { | |
| 183 | + toCenterTimer = setInterval(function () { | |
| 184 | + map.panTo(marker.getPosition()); | |
| 185 | + }, 5000); | |
| 186 | + } | |
| 187 | + | |
| 188 | + //暂停 | |
| 189 | + var pauseFlag; | |
| 190 | + | |
| 191 | + function pause() { | |
| 192 | + $('.play-btn', _body) | |
| 193 | + .data('type', 'play') | |
| 194 | + .find('i') | |
| 195 | + .removeClass('uk-icon-pause') | |
| 196 | + .addClass('uk-icon-play'); | |
| 197 | + pauseFlag = true; | |
| 198 | + progress.removeClass('uk-active'); | |
| 199 | + clearInterval(toCenterTimer); | |
| 200 | + } | |
| 201 | + | |
| 202 | + var index = 1; | |
| 203 | + var len; | |
| 204 | + | |
| 205 | + function run() { | |
| 206 | + //暂停 | |
| 207 | + if (pauseFlag) { | |
| 208 | + pauseFlag = false; | |
| 209 | + return | |
| 210 | + } | |
| 211 | + //结束 | |
| 212 | + if (index >= len) { | |
| 213 | + bar.css('width', '100%') | |
| 214 | + pause(); | |
| 215 | + return; | |
| 216 | + } | |
| 217 | + | |
| 218 | + //marker 移动 | |
| 219 | + var gps = gpsArray[index]; | |
| 220 | + | |
| 221 | + //线路走向 | |
| 222 | + if (gps.direction != gpsArray[index - 1].direction || index == 1) | |
| 223 | + drawLine(gps.direction); | |
| 224 | + | |
| 225 | + var point = new BMap.Point(gps.bd_lon, gps.bd_lat); | |
| 226 | + marker.setPosition(point); | |
| 227 | + marker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75))); | |
| 228 | + | |
| 229 | + //轨迹线 | |
| 230 | + trailArray.push(point); | |
| 231 | + trailPolyline.setPath(trailArray); | |
| 232 | + | |
| 233 | + //进度条 | |
| 234 | + bar.css('width', step * index); | |
| 235 | + | |
| 236 | + //日志输出 | |
| 237 | + logWrite(gps, gpsArray[index - 1]); | |
| 238 | + | |
| 239 | + index++; | |
| 240 | + setTimeout(run, 1000); | |
| 241 | + } | |
| 242 | + | |
| 243 | + //初始化地图 | |
| 244 | + function initMap(data) { | |
| 245 | + gpsArray = data; | |
| 246 | + var firstPoint = new BMap.Point(data[0].bd_lon, data[0].bd_lat); | |
| 247 | + map = new BMap.Map($('.map_wrap', _body)[0]); | |
| 248 | + map.centerAndZoom(firstPoint, 17); | |
| 249 | + map.enableScrollWheelZoom(); | |
| 250 | + | |
| 251 | + //创建车辆marker | |
| 252 | + marker = new BMap.Marker(firstPoint); | |
| 253 | + width = gb_map_imap.calcGpsMarkerWidth(data[0].nbbm); | |
| 254 | + //渲染icon | |
| 255 | + marker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(data[0], width), new BMap.Size(width, 75))); | |
| 256 | + marker.disableMassClear(); | |
| 257 | + map.addOverlay(marker); | |
| 258 | + | |
| 259 | + //线路图层 数据 | |
| 260 | + var routeCache = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 261 | + upRoutePos = initRoutePosData(routeCache.up_bd); | |
| 262 | + downRoutePos = initRoutePosData(routeCache.down_bd); | |
| 263 | + | |
| 264 | + trailArray.push(firstPoint); | |
| 265 | + drawTrailLine(); | |
| 266 | + //输出第一个点 | |
| 267 | + logWrite(data[0], null); | |
| 268 | + } | |
| 269 | + | |
| 270 | + function drawTrailLine() { | |
| 271 | + trailPolyline = new BMap.Polyline(trailArray, {strokeWeight: 3, strokeColor: 'black'}); | |
| 272 | + map.addOverlay(trailPolyline); | |
| 273 | + } | |
| 274 | + | |
| 275 | + function initRoutePosData(routeStr) { | |
| 276 | + var array = [], temps; | |
| 277 | + $.each(routeStr, function (i, item) { | |
| 278 | + var pos = []; | |
| 279 | + $.each(item.split(','), function () { | |
| 280 | + temps = this.split(' '); | |
| 281 | + pos.push(new BMap.Point(temps[0], temps[1])); | |
| 282 | + }); | |
| 283 | + array.push(pos); | |
| 284 | + }); | |
| 285 | + return array; | |
| 286 | + } | |
| 287 | + | |
| 288 | + function drawLine(updown) { | |
| 289 | + map.clearOverlays(); | |
| 290 | + | |
| 291 | + var pos = updown == 0 ? upRoutePos : downRoutePos; | |
| 292 | + $.each(pos, function () { | |
| 293 | + map.addOverlay(new BMap.Polyline(this, {strokeWeight: 12, strokeColor: 'rgba(0, 0, 255, 0.6)'})); | |
| 294 | + }); | |
| 295 | + | |
| 296 | + drawTrailLine(); | |
| 297 | + } | |
| 298 | + | |
| 299 | + //日志输出 | |
| 300 | + var logWrap = $('.pb_log_panel', _body); | |
| 301 | + var logPanel = $('.pb_log_panel .ct_table_body', _body); | |
| 302 | + gb_ct_table.fixedHead(logWrap); | |
| 303 | + | |
| 304 | + function logWrite(gps, prve) { | |
| 305 | + var code = gps.road.ROAD_CODE; | |
| 306 | + if (!prve || code != prve.road.ROAD_CODE) { | |
| 307 | + logPanel.append('<dl data-code="' + code + '" ><dd>' + gps.timeStr + '</dd><dd>' + gps.speed + '</dd><dd>' + gps.road.ROAD_NAME + '</dd><dd>正常</dd></dl>'); | |
| 308 | + } | |
| 309 | + else { | |
| 310 | + var dds = logPanel.find('dl[data-code=' + code + ']').last().find('dd'); | |
| 311 | + $(dds[0]).text(gps.timeStr); | |
| 312 | + $(dds[1]).text(gps.speed); | |
| 313 | + } | |
| 314 | + | |
| 315 | + logWrap.scrollTop(logWrap[0].scrollHeight); | |
| 316 | + } | |
| 317 | + })(); | |
| 318 | + </script> | |
| 319 | +</div> | |
| 0 | 320 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map/iMap.js
| ... | ... | @@ -18,7 +18,7 @@ var gb_map_imap = (function () { |
| 18 | 18 | return; |
| 19 | 19 | if (maps[mapName]) { |
| 20 | 20 | //原地图 destroy |
| 21 | - if(currentMap){ | |
| 21 | + if (currentMap) { | |
| 22 | 22 | var oldMap = maps[currentMap].instance; |
| 23 | 23 | oldMap.destroy && oldMap.destroy(); |
| 24 | 24 | } |
| ... | ... | @@ -33,7 +33,7 @@ var gb_map_imap = (function () { |
| 33 | 33 | createCarIcon: createCarIcon, |
| 34 | 34 | busIcon: '/real_control_v2/assets/imgs/bus1-R.png', |
| 35 | 35 | _color: color, |
| 36 | - //createCarIcon_angle: createCarIcon_angle, | |
| 36 | + createCarIconRotation: createCarIconRotation, | |
| 37 | 37 | createStationIcon: createStationIcon, |
| 38 | 38 | call: function (f, opts) { |
| 39 | 39 | var instance = maps[currentMap].instance; |
| ... | ... | @@ -42,6 +42,18 @@ var gb_map_imap = (function () { |
| 42 | 42 | else |
| 43 | 43 | alertErr('当前地图实例不支持操作:' + f); |
| 44 | 44 | return mapProxy; |
| 45 | + }, | |
| 46 | + calcGpsMarkerWidth: function (nbbm) { | |
| 47 | + var width = 0; | |
| 48 | + $.each(nbbm.split(''), function () { | |
| 49 | + if (!isNaN(this)) | |
| 50 | + width += 7;//icon_num_width[this]; | |
| 51 | + else if (this == '-') | |
| 52 | + width += 10; | |
| 53 | + else | |
| 54 | + width += 16; | |
| 55 | + }); | |
| 56 | + return width; | |
| 45 | 57 | } |
| 46 | 58 | }; |
| 47 | 59 | |
| ... | ... | @@ -72,67 +84,102 @@ var gb_map_imap = (function () { |
| 72 | 84 | return canvas.toDataURL(); |
| 73 | 85 | } |
| 74 | 86 | |
| 75 | - //绘制车辆icon 带角度 | |
| 76 | -/* var busIcon='data:image/png;base64,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'; | |
| 77 | - function createCarIcon_angle(gps, w) { | |
| 87 | + | |
| 88 | + //绘制车辆icon 带角度标示 | |
| 89 | + function createCarIconRotation(gps, w) { | |
| 90 | + if (!w) | |
| 91 | + w = 70; | |
| 92 | + | |
| 78 | 93 | var canvas = $('<canvas></canvas>')[0]; |
| 94 | + canvas.width = w; | |
| 95 | + canvas.height = 75; | |
| 79 | 96 | var ctx = canvas.getContext('2d'); |
| 80 | 97 | |
| 81 | - //旋转画布 | |
| 98 | + var colours = color(gps); | |
| 99 | + //ctx.shadowOffsetX = 5; // 阴影Y轴偏移 | |
| 100 | + //ctx.shadowOffsetY = 5; // 阴影X轴偏移 | |
| 101 | + //ctx.shadowBlur = 1; // 模糊尺寸 | |
| 102 | + //ctx.shadowColor = colours.shadow; // 颜色 | |
| 82 | 103 | |
| 83 | - //console.log('gps', gps);direction | |
| 84 | - //车辆角度图片 | |
| 85 | - var img = new Image(); | |
| 86 | - img.src = busIcon; | |
| 104 | + ctx.roundRect(0, 0, w, 24, 5).stroke(); | |
| 105 | + ctx.fillStyle = colours.bgColor; | |
| 106 | + ctx.fill(); | |
| 107 | + //文字 | |
| 108 | + ctx.font = "14px arial"; | |
| 109 | + ctx.fillStyle = "#fff"; | |
| 110 | + ctx.fillText(gps.nbbm, 4, 17); | |
| 87 | 111 | |
| 112 | + //角度图标 | |
| 113 | + var img = new Image(); | |
| 114 | + img.src = rotationIcon(colours.bgColor); | |
| 88 | 115 | ctx.save(); |
| 89 | - ctx.translate(w/2, 25); | |
| 90 | - ctx.rotate(-((gps.direction+300) * Math.PI / 180)); | |
| 116 | + ctx.translate(canvas.width / 2, canvas.height / 2); | |
| 117 | + ctx.rotate(gps.direction * Math.PI / 180); | |
| 118 | + ctx.drawImage(img, -img.width / 2, -img.width / 2); | |
| 119 | + ctx.restore(); | |
| 91 | 120 | |
| 92 | - ctx.drawImage(img,-12, 0); | |
| 121 | + return canvas.toDataURL(); | |
| 122 | + } | |
| 93 | 123 | |
| 94 | - ctx.restore(); | |
| 95 | 124 | |
| 96 | - var colours = color(gps); | |
| 125 | + function rotationIcon(color) { | |
| 126 | + var canvas = $('<canvas></canvas>')[0]; | |
| 127 | + canvas.width = 25; | |
| 128 | + canvas.height = 25; | |
| 97 | 129 | |
| 98 | - ctx.shadowOffsetX = 5; // 阴影Y轴偏移 | |
| 99 | - ctx.shadowOffsetY = 5; // 阴影X轴偏移 | |
| 100 | - ctx.shadowBlur = 1; // 模糊尺寸 | |
| 101 | - ctx.shadowColor = colours.shadow; // 颜色 | |
| 130 | + var ctx = canvas.getContext('2d'); | |
| 102 | 131 | |
| 103 | - //绘制背景 | |
| 104 | - if (!w) | |
| 105 | - w = 70; | |
| 132 | + ctx.beginPath(); | |
| 133 | + ctx.strokeStyle = color; | |
| 134 | + var circle = { | |
| 135 | + x: 12.5, //圆心的x轴坐标值 | |
| 136 | + y: 12.5, //圆心的y轴坐标值 | |
| 137 | + r: 12 //圆的半径 | |
| 138 | + }; | |
| 139 | + //以canvas中的坐标点(100,100)为圆心,绘制一个半径为50px的圆形 | |
| 140 | + ctx.arc(circle.x, circle.y, circle.r, 0, Math.PI * 2, true); | |
| 141 | + //按照指定的路径绘制弧线 | |
| 142 | + ctx.stroke(); | |
| 143 | + ctx.fillStyle = "#ffffff"; | |
| 144 | + ctx.fill(); | |
| 106 | 145 | |
| 107 | - ctx.roundRect(0, 0, w, 25, 5).stroke(); | |
| 108 | - ctx.fillStyle = colours.bgColor; | |
| 146 | + //下方矩形 | |
| 147 | + ctx.beginPath(); | |
| 148 | + ctx.fillStyle = color; | |
| 149 | + ctx.fillRect(5, 16, 15, 4); | |
| 150 | + | |
| 151 | + ctx.rect(5, 11, 7.5, 8); | |
| 152 | + ctx.rect(12.5, 11, 7.5, 8); | |
| 153 | + ctx.strokeStyle = color; | |
| 154 | + ctx.stroke(); | |
| 155 | + | |
| 156 | + //上方三角形 | |
| 157 | + ctx.beginPath(); | |
| 158 | + ctx.fillStyle = "#111111"; | |
| 159 | + ctx.moveTo(12.5, 3); | |
| 160 | + ctx.lineTo(6.5, 7.5); | |
| 161 | + ctx.lineTo(18.5, 7.5); | |
| 162 | + ctx.closePath(); | |
| 109 | 163 | ctx.fill(); |
| 110 | - //文字 | |
| 111 | - ctx.font = "14px arial"; | |
| 112 | - ctx.fillStyle = "#fff"; | |
| 113 | - ctx.fillText(gps.nbbm, 4, 18); | |
| 114 | 164 | |
| 115 | 165 | return canvas.toDataURL(); |
| 116 | - }*/ | |
| 166 | + } | |
| 117 | 167 | |
| 118 | 168 | //绘制站点icon |
| 119 | 169 | function createStationIcon(station, w) { |
| 120 | 170 | var canvas = $('<canvas></canvas>')[0]; |
| 121 | 171 | var ctx = canvas.getContext('2d'); |
| 122 | 172 | |
| 123 | -/* var color=station.directions==0?'#125688':'#fb1804' | |
| 124 | - ,bg='rgba(255, 255, 255, 0.87)';*/ | |
| 173 | + /* var color=station.directions==0?'#125688':'#fb1804' | |
| 174 | + ,bg='rgba(255, 255, 255, 0.87)';*/ | |
| 125 | 175 | |
| 126 | - var color='#fff', | |
| 127 | - bg=station.directions==0?'#125688':'#fb1804'; | |
| 176 | + var color = '#fff', | |
| 177 | + bg = station.directions == 0 ? '#125688' : '#fb1804'; | |
| 128 | 178 | //矩形 |
| 129 | 179 | //ctx.roundRect(0, 0, w, 17, 1).stroke(); |
| 130 | - ctx.rect(-1,-1,w,17); | |
| 180 | + ctx.rect(-1, -1, w, 17); | |
| 131 | 181 | ctx.fillStyle = bg; |
| 132 | 182 | ctx.fill(); |
| 133 | - //ctx.lineWidth = 1; | |
| 134 | - //ctx.strokeStyle=color; | |
| 135 | - //ctx.stroke(); | |
| 136 | 183 | |
| 137 | 184 | //文字 |
| 138 | 185 | ctx.font = "12px arial"; |
| ... | ... | @@ -140,16 +187,16 @@ var gb_map_imap = (function () { |
| 140 | 187 | ctx.fillText(station.stationName, 2, 12); |
| 141 | 188 | |
| 142 | 189 | //角 |
| 143 | - var c=w/2; | |
| 190 | + var c = w / 2; | |
| 144 | 191 | ctx.beginPath(); |
| 145 | - ctx.moveTo(c - 7,16); | |
| 146 | - ctx.lineTo(c,24); | |
| 147 | - ctx.lineTo(c + 7,16); | |
| 192 | + ctx.moveTo(c - 7, 16); | |
| 193 | + ctx.lineTo(c, 24); | |
| 194 | + ctx.lineTo(c + 7, 16); | |
| 148 | 195 | ctx.closePath(); |
| 149 | 196 | |
| 150 | 197 | ctx.fillStyle = bg; |
| 151 | 198 | ctx.fill(); |
| 152 | - ctx.strokeStyle='#fff'; | |
| 199 | + ctx.strokeStyle = '#fff'; | |
| 153 | 200 | ctx.stroke(); |
| 154 | 201 | return canvas.toDataURL(); |
| 155 | 202 | } | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
| ... | ... | @@ -3,8 +3,6 @@ var gb_map_baidu = (function(){ |
| 3 | 3 | |
| 4 | 4 | var map; |
| 5 | 5 | var topMarker; |
| 6 | - //实时路况是否打开 | |
| 7 | - //var traffVisible; | |
| 8 | 6 | var realMarkers = {}; |
| 9 | 7 | //路段对照 |
| 10 | 8 | var polylines={}; |
| ... | ... | @@ -14,8 +12,6 @@ var gb_map_baidu = (function(){ |
| 14 | 12 | var electronicFences = {}; |
| 15 | 13 | //停车场对照 |
| 16 | 14 | var carparks = {}; |
| 17 | - //var buffAreas = {}; | |
| 18 | - | |
| 19 | 15 | |
| 20 | 16 | var ctrl; |
| 21 | 17 | var baiduInstance = { |
| ... | ... | @@ -31,42 +27,12 @@ var gb_map_baidu = (function(){ |
| 31 | 27 | map.enableScrollWheelZoom(); |
| 32 | 28 | |
| 33 | 29 | cb && cb(); |
| 34 | - //window.localStorage.setItem('real_map', 'baidu'); | |
| 35 | - | |
| 36 | 30 | // 路况控件 |
| 37 | 31 | ctrl = new BMapLib.TrafficControl(); |
| 38 | 32 | map.addControl(ctrl); |
| 39 | - | |
| 40 | - /*$(gb_map_consts.trafficBtn).on('click', function() { | |
| 41 | - if (traffVisible) { | |
| 42 | - ctrl.hide(); | |
| 43 | - traffVisible = false; | |
| 44 | - showLinePolyline(); | |
| 45 | - } else { | |
| 46 | - ctrl.show(); | |
| 47 | - traffVisible = true; | |
| 48 | - hideLinePolyline(); | |
| 49 | - } | |
| 50 | - }); | |
| 51 | - //百度路况控件自身关闭按钮 | |
| 52 | - $('.portlet-fullscreen').on('click', '.maplibTc .maplibTcClose', function(){ | |
| 53 | - traffVisible = false; | |
| 54 | - showLinePolyline(); | |
| 55 | - });*/ | |
| 56 | - | |
| 57 | - //$('#tcWrap.maplibTc').addClass('animated bounceInLeft'); | |
| 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 | - });*/ | |
| 65 | 33 | }, |
| 66 | 34 | destroy: function(){ |
| 67 | 35 | this.clearAll(); |
| 68 | - //realMarkers = {}; | |
| 69 | - //linePolyline = []; | |
| 70 | 36 | }, |
| 71 | 37 | //画线路图层 |
| 72 | 38 | drawLine: function(opt){ |
| ... | ... | @@ -91,21 +57,6 @@ var gb_map_baidu = (function(){ |
| 91 | 57 | |
| 92 | 58 | //根据ID保存映射 |
| 93 | 59 | polylines[opt.id]=_pLines; |
| 94 | - /*$.each(route.split(','), function(){ | |
| 95 | - temps = this.split(' '); | |
| 96 | - pos.push(new BMap.Point(temps[0], temps[1])); | |
| 97 | - });*/ | |
| 98 | - | |
| 99 | - /*var polyline = new BMap.Polyline(pos, opt.style); | |
| 100 | - //根据ID保存映射 | |
| 101 | - polylines[opt.id]=polyline; | |
| 102 | - if(opt.hide) | |
| 103 | - polyline.hide(); | |
| 104 | - map.addOverlay(polyline);*/ | |
| 105 | - | |
| 106 | - //延迟居中,避免多次调用时抖动 | |
| 107 | - //delayToCenter(pos[parseInt(pos.length / 2)]); | |
| 108 | - //map.panTo(pos[parseInt(pos.length / 2)]); | |
| 109 | 60 | }, |
| 110 | 61 | traffic: function (enable) { |
| 111 | 62 | if(enable) |
| ... | ... | @@ -133,8 +84,6 @@ var gb_map_baidu = (function(){ |
| 133 | 84 | centerToLine: function (opt) { |
| 134 | 85 | var _pLines = polylines[opt.id]; |
| 135 | 86 | delayToCenter(_pLines[parseInt(_pLines.length/2)].getPath()[0]); |
| 136 | - //var pos=polylines[opt.id].getPath(); | |
| 137 | - //delayToCenter(pos[parseInt(pos.length / 2)]); | |
| 138 | 87 | }, |
| 139 | 88 | //绘制GPS信号 |
| 140 | 89 | drawRealGpsMarker: function(opts){ |
| ... | ... | @@ -157,12 +106,6 @@ var gb_map_baidu = (function(){ |
| 157 | 106 | map.addOverlay(marker); |
| 158 | 107 | //设备号和marker映射 |
| 159 | 108 | realMarkers[gps.deviceId] = marker; |
| 160 | - /*//新上线的设备,默认隐藏 | |
| 161 | - if(gps.newNodeHide){ | |
| 162 | - marker.hide(); | |
| 163 | - gps.newNodeHide=null; | |
| 164 | - delete gps.newNodeHide; | |
| 165 | - }*/ | |
| 166 | 109 | } |
| 167 | 110 | } |
| 168 | 111 | }); |
| ... | ... | @@ -228,10 +171,10 @@ var gb_map_baidu = (function(){ |
| 228 | 171 | clearAll: function () { |
| 229 | 172 | //清除所有覆盖物 |
| 230 | 173 | realMarkers = {}; |
| 231 | - polylines={}; | |
| 232 | - stationMarkers={}; | |
| 233 | - electronicFences={}; | |
| 234 | - carparks={}; | |
| 174 | + polylines = {}; | |
| 175 | + stationMarkers = {}; | |
| 176 | + electronicFences = {}; | |
| 177 | + carparks = {}; | |
| 235 | 178 | map.clearOverlays(); |
| 236 | 179 | }, |
| 237 | 180 | showGpsMarker:function (opt) { |
| ... | ... | @@ -284,6 +227,11 @@ var gb_map_baidu = (function(){ |
| 284 | 227 | ,m = realMarkers[deviceId]; |
| 285 | 228 | bdOpenWindow(m); |
| 286 | 229 | }, |
| 230 | + closeWin: function (deviceId) { | |
| 231 | + var m = realMarkers[deviceId]; | |
| 232 | + if(m) | |
| 233 | + map.closeInfoWindow(m.infoWindow) | |
| 234 | + }, | |
| 287 | 235 | //打开站点信息窗口 |
| 288 | 236 | openStationWin: function (opt) { |
| 289 | 237 | |
| ... | ... | @@ -362,7 +310,7 @@ var gb_map_baidu = (function(){ |
| 362 | 310 | var marker = new BMap.Marker(point); |
| 363 | 311 | |
| 364 | 312 | //根据编码长度 计算marker 宽度 |
| 365 | - var w = calcGpsMarkerWidth(gpsData.nbbm);//gpsData.nbbm.length * 10; | |
| 313 | + var w = gb_map_imap.calcGpsMarkerWidth(gpsData.nbbm);//gpsData.nbbm.length * 10; | |
| 366 | 314 | //渲染icon |
| 367 | 315 | renderIcon(marker, gpsData, w); |
| 368 | 316 | |
| ... | ... | @@ -374,9 +322,9 @@ var gb_map_baidu = (function(){ |
| 374 | 322 | bdOpenWindow(this); |
| 375 | 323 | }); |
| 376 | 324 | //mouseover |
| 377 | - /*marker.addEventListener('mouseover', function(){ | |
| 325 | + marker.addEventListener('mouseover', function(){ | |
| 378 | 326 | setTop(this); |
| 379 | - });*/ | |
| 327 | + }); | |
| 380 | 328 | marker.setTop(true); |
| 381 | 329 | return marker; |
| 382 | 330 | } |
| ... | ... | @@ -385,36 +333,11 @@ var gb_map_baidu = (function(){ |
| 385 | 333 | var config = gb_map_config.getConfig(); |
| 386 | 334 | |
| 387 | 335 | //如果需要标识角度 |
| 388 | - if(config.carIcon.angle){ | |
| 389 | - | |
| 390 | - var icon = new BMap.Icon(gb_map_imap.busIcon, new BMap.Size(24,24)); | |
| 391 | - var label = new BMap.Label(gpsData.nbbm,{offset:new BMap.Size(-(w/2-10),-24)}); | |
| 392 | - var color=gb_map_imap._color(gpsData).bgColor; | |
| 393 | - | |
| 394 | - label.setStyle({borderColor: color,borderRadius: '5px', padding: '1px 2px', color: '#fff', backgroundColor: color, font: 14}); | |
| 395 | - marker.setIcon(icon); | |
| 396 | - marker.setLabel(label); | |
| 397 | - //旋转角度 | |
| 398 | - marker.setRotation(gpsData.direction-90); | |
| 399 | - | |
| 400 | - } | |
| 336 | + if(config.carIcon.angle) | |
| 337 | + marker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gpsData, w), new BMap.Size(w,75))); | |
| 401 | 338 | else |
| 402 | 339 | marker.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gpsData, w), new BMap.Size(w,25))); |
| 403 | 340 | } |
| 404 | - | |
| 405 | - | |
| 406 | - function calcGpsMarkerWidth(nbbm) { | |
| 407 | - var width=0; | |
| 408 | - $.each(nbbm.split(''), function () { | |
| 409 | - if(!isNaN(this)) | |
| 410 | - width += 7; | |
| 411 | - else if(this=='-') | |
| 412 | - width += 10; | |
| 413 | - else | |
| 414 | - width += 16; | |
| 415 | - }); | |
| 416 | - return width; | |
| 417 | - } | |
| 418 | 341 | |
| 419 | 342 | function createStationMark(statio) { |
| 420 | 343 | var point = new BMap.Point(statio.bd_lon, statio.bd_lat); |
| ... | ... | @@ -448,16 +371,8 @@ var gb_map_baidu = (function(){ |
| 448 | 371 | m.gpsData = gps; |
| 449 | 372 | //重新设置icon |
| 450 | 373 | //根据编码长度 计算marker 宽度 |
| 451 | - var w = m._icon_width;//calcGpsMarkerWidth(gps.nbbm);//gps.nbbm.length * 10; | |
| 452 | - | |
| 374 | + var w = m._icon_width; | |
| 453 | 375 | renderIcon(m, gps, w); |
| 454 | - /*//如果需要标识角度 | |
| 455 | - if(config.carIcon.angle) | |
| 456 | - m.setIcon(new BMap.Icon(gb_map_imap.createCarIcon_angle(gps, w), new BMap.Size(w,50))); | |
| 457 | - else | |
| 458 | - m.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gps, w), new BMap.Size(w,25)));*/ | |
| 459 | - //m.setIcon(new BMap.Icon(gb_map_imap.createCarIcon(gps, w), new BMap.Size(w,25))); | |
| 460 | - | |
| 461 | 376 | //更新 infoWindow |
| 462 | 377 | if(m.infoWindow.isOpen()){ |
| 463 | 378 | bdOpenWindow(m); |
| ... | ... | @@ -465,6 +380,9 @@ var gb_map_baidu = (function(){ |
| 465 | 380 | } |
| 466 | 381 | |
| 467 | 382 | function setTop(m){ |
| 383 | + if(gb_map_config.getConfig().spatialData.station) | |
| 384 | + return; | |
| 385 | + | |
| 468 | 386 | if(topMarker) |
| 469 | 387 | topMarker.setTop(false); |
| 470 | 388 | m.setTop(true); | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/gaode.js
| ... | ... | @@ -20,9 +20,7 @@ var gb_map_gaode = (function() { |
| 20 | 20 | var stationMarkers={}; |
| 21 | 21 | var electronicFences={}; |
| 22 | 22 | var carparks={}; |
| 23 | - //实时路况是否显示 | |
| 24 | - //var traffVisible; | |
| 25 | - //var trafficLayer; | |
| 23 | + | |
| 26 | 24 | var gaodeInstance = { |
| 27 | 25 | init : function(cb) { |
| 28 | 26 | var $mapCon = $(gb_map_consts.mapContainer); |
| ... | ... | @@ -35,9 +33,6 @@ var gb_map_gaode = (function() { |
| 35 | 33 | map.setZoomAndCenter(13, [ gb_map_consts.center_point.lng, gb_map_consts.center_point.lat ]); |
| 36 | 34 | // 加载完成 |
| 37 | 35 | AMap.event.addListener(map, 'complete', function() { |
| 38 | - //window.localStorage.setItem('real_map', 'gaode'); | |
| 39 | - /*storage.setItem('real_map', REAL_GAODE_TEXT); | |
| 40 | - $('.sk-cube-grid._center').remove();*/ | |
| 41 | 36 | cb && cb(); |
| 42 | 37 | }); |
| 43 | 38 | |
| ... | ... | @@ -45,20 +40,6 @@ var gb_map_gaode = (function() { |
| 45 | 40 | trafficLayer = new AMap.TileLayer.Traffic(); |
| 46 | 41 | trafficLayer.setMap(map); |
| 47 | 42 | trafficLayer.hide(); |
| 48 | - | |
| 49 | - /*$(gb_map_consts.trafficBtn).on('click', function() { | |
| 50 | - if (traffVisible) { | |
| 51 | - trafficLayer.hide(); | |
| 52 | - traffVisible = false; | |
| 53 | - $(this).removeClass('active'); | |
| 54 | - showLinePolyline(); | |
| 55 | - } else { | |
| 56 | - trafficLayer.show(); | |
| 57 | - traffVisible = true; | |
| 58 | - $(this).addClass('active'); | |
| 59 | - hideLinePolyline(); | |
| 60 | - } | |
| 61 | - });*/ | |
| 62 | 43 | }, |
| 63 | 44 | setStyle : function() { |
| 64 | 45 | $('.mapRightWrap').addClass('gaode'); |
| ... | ... | @@ -106,29 +87,9 @@ var gb_map_gaode = (function() { |
| 106 | 87 | }); |
| 107 | 88 | |
| 108 | 89 | polylines[opt.id]=_pLines; |
| 109 | - | |
| 110 | - /*var pos = [], temps; | |
| 111 | - var route = opt.upDown==0?opt.route.up_gcj:opt.route.down_gcj; | |
| 112 | - | |
| 113 | - $.each(route.split(','), function(){ | |
| 114 | - temps = this.split(' '); | |
| 115 | - pos.push([temps[0], temps[1]]); | |
| 116 | - }); | |
| 117 | - | |
| 118 | - opt.style.path=pos; | |
| 119 | - var polyline = new AMap.Polyline(opt.style); | |
| 120 | - //根据ID保存映射 | |
| 121 | - polylines[opt.id]=polyline; | |
| 122 | - if(opt.hide) | |
| 123 | - polyline.hide(); | |
| 124 | - | |
| 125 | - polyline.setMap(map);*/ | |
| 126 | 90 | }, |
| 127 | 91 | //定位到线路中间点 |
| 128 | 92 | centerToLine: function (opt) { |
| 129 | - //var pos=polylines[opt.id].getPath(); | |
| 130 | - //map.setCenter(pos[parseInt(pos.length / 2)]); | |
| 131 | - | |
| 132 | 93 | var _pLines = polylines[opt.id]; |
| 133 | 94 | map.setCenter(_pLines[parseInt(_pLines.length/2)].getPath()[0]); |
| 134 | 95 | }, |
| ... | ... | @@ -316,6 +277,11 @@ var gb_map_gaode = (function() { |
| 316 | 277 | var deviceId = opts.deviceId |
| 317 | 278 | ,m = realMarkers[deviceId]; |
| 318 | 279 | openWindow(m); |
| 280 | + }, | |
| 281 | + closeWin: function (deviceId) { | |
| 282 | + var m = realMarkers[deviceId]; | |
| 283 | + if(m) | |
| 284 | + m.infoWindow.close(); | |
| 319 | 285 | } |
| 320 | 286 | }; |
| 321 | 287 | |
| ... | ... | @@ -327,7 +293,7 @@ var gb_map_gaode = (function() { |
| 327 | 293 | |
| 328 | 294 | function createGDMarkerByGps(gps){ |
| 329 | 295 | //根据编码长度 计算marker 宽度 |
| 330 | - var w = calcGpsMarkerWidth(gps.nbbm); | |
| 296 | + var w = gb_map_imap.calcGpsMarkerWidth(gps.nbbm); | |
| 331 | 297 | |
| 332 | 298 | var marker = new AMap.Marker({ |
| 333 | 299 | map: map, |
| ... | ... | @@ -362,21 +328,19 @@ var gb_map_gaode = (function() { |
| 362 | 328 | |
| 363 | 329 | //如果需要标识角度 |
| 364 | 330 | if(config.carIcon.angle) { |
| 365 | - marker.setIcon(gb_map_imap.busIcon); | |
| 366 | - marker.setAngle(gps.direction - 90); | |
| 367 | - | |
| 368 | - marker.setLabel({ | |
| 369 | - content: gps.nbbm, | |
| 370 | - offset: new AMap.Pixel(-20, -20), | |
| 371 | - }); | |
| 331 | + marker.setIcon(new AMap.Icon({ | |
| 332 | + size: new AMap.Size(w, 75), //图标大小 | |
| 333 | + image: gb_map_imap.createCarIconRotation(gps, w) | |
| 334 | + })); | |
| 335 | + marker.setOffset(new AMap.Pixel(-(w / 2), -35)); | |
| 372 | 336 | } |
| 373 | 337 | else{ |
| 374 | 338 | marker.setIcon(new AMap.Icon({ |
| 375 | 339 | size: new AMap.Size(w, 25), //图标大小 |
| 376 | 340 | image: gb_map_imap.createCarIcon(gps, w) |
| 377 | 341 | })); |
| 342 | + marker.setOffset(new AMap.Pixel(-(w / 2), -12.5)); | |
| 378 | 343 | } |
| 379 | - marker.setOffset(new AMap.Pixel(-(w / 2), -12.5)); | |
| 380 | 344 | } |
| 381 | 345 | |
| 382 | 346 | //创建站点marker |
| ... | ... | @@ -425,27 +389,10 @@ var gb_map_gaode = (function() { |
| 425 | 389 | //渲染icon |
| 426 | 390 | renderIcon(marker, gps, w); |
| 427 | 391 | |
| 428 | - /*m.setIcon(new AMap.Icon({ | |
| 429 | - size: new AMap.Size(w, 25), | |
| 430 | - image: gb_map_imap.createCarIcon(gps, w) | |
| 431 | - }));*/ | |
| 432 | - | |
| 433 | 392 | if(m.infoWindow.getIsOpen()) |
| 434 | 393 | openWindow(m); |
| 435 | 394 | } |
| 436 | 395 | |
| 437 | - function calcGpsMarkerWidth(nbbm) { | |
| 438 | - var width=0; | |
| 439 | - $.each(nbbm.split(''), function () { | |
| 440 | - if(!isNaN(this)) | |
| 441 | - width += 7;//icon_num_width[this]; | |
| 442 | - else if(this=='-') | |
| 443 | - width += 10; | |
| 444 | - else | |
| 445 | - width += 16; | |
| 446 | - }); | |
| 447 | - return width; | |
| 448 | - } | |
| 449 | 396 | |
| 450 | 397 | function transMultiWGSToGCJ(obj) { |
| 451 | 398 | if(!obj._gPoints) |
| ... | ... | @@ -466,7 +413,6 @@ var gb_map_gaode = (function() { |
| 466 | 413 | gps.lineName = gb_data_basic.lineCode2NameAll()[gps.lineId]; |
| 467 | 414 | //时间 |
| 468 | 415 | gps.dateStr = moment(gps.timestamp).format('YYYY-MM-DD HH:mm:ss'); |
| 469 | -//{size: AMap.Size(290,255)} | |
| 470 | 416 | marker.infoWindow.setContent(gb_map_overlay_mge.map_gps_win_temp(gps)); |
| 471 | 417 | marker.infoWindow.open(map, marker.getPosition()); |
| 472 | 418 | } | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
| ... | ... | @@ -203,11 +203,11 @@ var gb_map_overlay_mge = (function () { |
| 203 | 203 | |
| 204 | 204 | //地图居中至合理的位置 |
| 205 | 205 | var centerToRational=function () { |
| 206 | - /*var chs=getCheckedDevice(); | |
| 206 | + var chs=getCheckedDevice(); | |
| 207 | 207 | if(chs && chs.length > 0){ |
| 208 | 208 | var id=chs[0].data.lineId+'_'+chs[0].data.upDown; |
| 209 | 209 | gb_map_imap.call('centerToLine', {id: id}); |
| 210 | - }*/ | |
| 210 | + } | |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | return { | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/playback.js
0 → 100644
| 1 | +/* 地图模块 轨迹回放 */ | |
| 2 | + | |
| 3 | +var gb_map_play_back = (function () { | |
| 4 | + | |
| 5 | + var dom; | |
| 6 | + $.get('/real_control_v2/mapmonitor/fragments/playback/main.html', function (rs) { | |
| 7 | + dom = rs; | |
| 8 | + }); | |
| 9 | + | |
| 10 | + var initParams = function (deviceId, nbbm) { | |
| 11 | + //关闭infowindow | |
| 12 | + if (deviceId) | |
| 13 | + gb_map_imap.call('closeWin', deviceId); | |
| 14 | + | |
| 15 | + //show modal | |
| 16 | + var modal = '#map-playback-modal'; | |
| 17 | + $(document.body).append(dom); | |
| 18 | + UIkit.modal(modal, {bgclose: false}).show(); | |
| 19 | + $(modal).trigger('show_form', {deviceId: deviceId, nbbm: nbbm}); | |
| 20 | + }; | |
| 21 | + | |
| 22 | + //导出excel | |
| 23 | + var listToExcel = function (list) { | |
| 24 | + var temp = '<html>' + | |
| 25 | + ' <head> '+ | |
| 26 | + ' </head>' + | |
| 27 | + ' <body>' + | |
| 28 | + ' <table border="1">' + | |
| 29 | + ' <tr><th>序号</th><th>车辆</th><th>所在道路</th><th>经度</th><th>纬度</th><th>时间</th><th>速度</th></tr>' + | |
| 30 | + ' {{each list as gps i}}' + | |
| 31 | + ' <tr><td>{{i+1}}</td><td>{{gps.nbbm}}</td><td>{{gps.road.ROAD_NAME}}</td><td>{{gps.bd_lon}}</td><td>{{gps.bd_lat}}</td><td>{{gps.timeStr2}}</td><td>{{gps.speed}}</td></tr>' + | |
| 32 | + ' {{/each}}' + | |
| 33 | + ' </table>' + | |
| 34 | + ' </body>' + | |
| 35 | + ' </html>'; | |
| 36 | + | |
| 37 | + var rs = template.compile(temp)({list: list}); | |
| 38 | + | |
| 39 | + var uri = 'data:application/vnd.ms-excel;base64,'; | |
| 40 | + return uri + base64(rs); | |
| 41 | + //location.href = uri + base64(rs); | |
| 42 | + }; | |
| 43 | + | |
| 44 | + | |
| 45 | + function base64(string) { | |
| 46 | + return window.btoa(unescape(encodeURIComponent(string))); | |
| 47 | + } | |
| 48 | + | |
| 49 | + return { | |
| 50 | + initParams: initParams, | |
| 51 | + listToExcel: listToExcel | |
| 52 | + } | |
| 53 | +})(); | |
| 0 | 54 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/real.js
| ... | ... | @@ -10,10 +10,10 @@ var mapmonitor_load_ep = EventProxy.create('load_iMap', 'load_baidu', 'load_gaod |
| 10 | 10 | .changeMap(gb_map_config.getConfig().map_type); |
| 11 | 11 | |
| 12 | 12 | //init tree |
| 13 | - /* gb_map_gps_tree.init(function () { | |
| 13 | + gb_map_gps_tree.init(function () { | |
| 14 | 14 | gb_map_overlay_mge.init(); |
| 15 | 15 | gb_map_spatial_data.init(); |
| 16 | - });*/ | |
| 16 | + }); | |
| 17 | 17 | |
| 18 | 18 | /* |
| 19 | 19 | $(".real_bottom_panel").resizable({ | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/real.html
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/spectrum/spectrum.css"/> |
| 4 | 4 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/form-advanced.gradient.min.css"/> |
| 5 | 5 | <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/> |
| 6 | +<link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/progress.gradient.min.css"> | |
| 6 | 7 | |
| 7 | 8 | <div class="map-system-msg"> |
| 8 | 9 | <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank"> |
| ... | ... | @@ -17,6 +18,10 @@ |
| 17 | 18 | $('.map-system-msg').addClass('flex-left'); |
| 18 | 19 | return false; |
| 19 | 20 | }); |
| 21 | + | |
| 22 | + setTimeout(function () { | |
| 23 | + $('.map-system-msg-close').trigger('click'); | |
| 24 | + }, 2000); | |
| 20 | 25 | </script> |
| 21 | 26 | |
| 22 | 27 | <div id="real_map_container"></div> |
| ... | ... | @@ -73,4 +78,6 @@ |
| 73 | 78 | <script src="/real_control_v2/assets/plugins/jquery.ui/mouse.js"></script> |
| 74 | 79 | <script src="/real_control_v2/assets/plugins/jquery.ui/resizable.js"></script> |
| 75 | 80 | <!-- 颜色选择器 --> |
| 76 | -<script src="/real_control_v2/assets/plugins/spectrum/spectrum.js"></script> | |
| 77 | 81 | \ No newline at end of file |
| 82 | +<script src="/real_control_v2/assets/plugins/spectrum/spectrum.js"></script> | |
| 83 | +<!-- play back --> | |
| 84 | +<script src="/real_control_v2/mapmonitor/js/playback.js"></script> | |
| 78 | 85 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/real_monitor/js/gps_play_back.js
| ... | ... | @@ -5,7 +5,7 @@ var gb_map_playback = (function() { |
| 5 | 5 | }; |
| 6 | 6 | |
| 7 | 7 | var temps; |
| 8 | - $.get('/real_control_v2/mapmonitor/real_monitor/fragments/playback.html', function(dom) { | |
| 8 | + $.get('/real_control_v2/mapmonitor/real_monitor/fragments/main.html', function(dom) { | |
| 9 | 9 | temps= gb_common.compileTempByDom(dom); |
| 10 | 10 | }); |
| 11 | 11 | ... | ... |