From b419209310112939039b6e2935bee6c53cdf7a52 Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Thu, 25 Jul 2019 14:30:48 +0800
Subject: [PATCH] 新增无人机飞行轨迹地图页面
---
src/main/webapp/view/uavTrajectory.jsp | 141 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 141 insertions(+), 0 deletions(-)
diff --git a/src/main/webapp/view/uavTrajectory.jsp b/src/main/webapp/view/uavTrajectory.jsp
new file mode 100644
index 0000000..6ce96b6
--- /dev/null
+++ b/src/main/webapp/view/uavTrajectory.jsp
@@ -0,0 +1,141 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<!DOCTYPE html>
+<head>
+ <meta charset="utf-8"/>
+ <title></title>
+ <script type="text/javascript"
+ src="http://api.map.baidu.com/api?v=2.0&ak=rER1sgBIcQxkfNSlm2wmBGZGgEERrooM"></script>
+ <script type="text/javascript" src="/js/jquery.min.js"></script>
+</head>
+<style type="text/css">
+ body,
+ html,
+ #mapCanvas {
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ margin: 0;
+ z-index: 0;
+ font-size: 14px;
+ font-family: "������������";
+ }
+
+ .main_body {
+ border: 0;
+ margin: 0;
+ width: 100%;
+ height: 100%;
+ position: relative;
+ }
+
+ * {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ }
+</style>
+
+<body>
+<div class="main_body">
+ <div id="mapCanvas"></div> <!-- ������������ -->
+ <!-- ���sensorInfo,regionCode,regionName,monitorPoint,device-->
+ <div id="uavTrajectoryParams" style="display: none;">
+ ${requestScope.uavTrajectoryParams}
+ </div>
+</div>
+</body>
+</html>
+
+<script type="text/javascript">
+ var moralMap = {};
+ /*var defaultParam = {
+ minZoom: 12,
+ maxZoom: 20
+ };*/
+ var mapStyle = {
+ features: ["road", "building", "water", "land"], // ������������������poi
+ style: "normal" // ������������������������������
+ };
+ var params = $.parseJSON($("#uavTrajectoryParams").html());
+ moralMap['params'] = params;
+ var sensorInfo = params["sensorInfo"];
+ //var map = new BMap.Map("mapCanvas", defaultParam);
+ var map = new BMap.Map("mapCanvas", { enableMapClick: false });
+ var trackPoints = []; //���������������������������������������������������������������
+ if (sensorInfo.length > 0) {
+ $.each(sensorInfo, function (item, value) {
+ trackPoints.push(new BMap.Point(value.e76, value.e77));
+ })
+ for (var i = 0; i < trackPoints.length - 1; i++) {
+ var startPoint = trackPoints[i];
+ var endPoint = trackPoints[i + 1];
+ showPath(startPoint, endPoint);
+ }
+ $.each(sensorInfo, function (item, value) {
+ if(item==0){
+ map.centerAndZoom(new BMap.Point(value.e76, value.e77), 17);
+ }
+ var flyingPoint = new BMap.Point(value.e76, value.e77);
+ var marker = new BMap.Marker(flyingPoint);
+ var infoWindow = new BMap.InfoWindow("���������"+value.uavDate
+ +"</br> ���������"+value.e76
+ +"</br> ���������"+value.e77
+ +"</br> ���������"+value.e78
+ +"</br> ������x���"+value.e79
+ +"</br> ������y���"+value.e80
+ +"</br> ������z���"+value.e81,
+ { enableMessage: false, width: 30, height: 130 });
+ marker.addEventListener("click", function ()
+ {
+ this.openInfoWindow(infoWindow);
+ });
+ map.addOverlay(marker);
+ var label = new BMap.Label(item + 1, {position: flyingPoint, offset: item<=8?new BMap.Size(-5, -22):new BMap.Size(-9, -22)});
+ label.setStyle({
+ color: "#fff",
+ fontSize: "10px",
+ backgroundColor: "0.05",
+ border: "0",
+ fontWeight: "bold"
+ });
+ map.addOverlay(label);
+ });
+ }
+
+ var longitude;
+ var latitude;
+ var point;
+ if (sensorInfo.length == 0) {
+ longitude = 120.987287;
+ latitude = 31.391562;
+ point = new BMap.Point(longitude, latitude);
+ map.centerAndZoom(point, 17);
+ }
+ map.setCurrentCity("������");
+ map.setMapStyle(mapStyle);
+ map.enableScrollWheelZoom(true); // ������������������������
+ var navigation = new BMap.NavigationControl({
+ anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
+ type: BMAP_NAVIGATION_CONTROL_LARGE
+ });
+ map.addControl(navigation);
+ map.addControl(new BMap.ScaleControl());
+
+ function showPath(startPoint, endPoint) {
+ var walking = new BMap.WalkingRoute(map, {renderOptions:{map: map, autoViewport: true},
+ onMarkersSet:function(routes) {
+ map.removeOverlay(routes[0].marker); //������������
+ map.removeOverlay(routes[1].marker);//������������
+ }
+ });
+ var polyline = new BMap.Polyline([
+ startPoint,
+ endPoint
+ ],
+ {strokeColor: "green", strokeWeight: 2, strokeOpacity: 1}
+ );
+ map.addOverlay(polyline);// ���������������
+ }
+
+</script>
--
Gitblit v1.8.0