qa-prevention-gwj-vue/static/mapshow.html

479 lines
11 KiB
HTML
Raw Normal View History

2023-11-06 18:11:01 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>hello-jsmap</title>
<script src="http://192.168.0.31:8089/joysuch/jsmap/jsmap.js" type="text/javascript"></script>
<link type="text/css" href="http://192.168.0.31:8089/joysuch/jsmap/jsmap.css" rel="stylesheet"/>
<!-- <script src="http://mapdemo.joysuch.com/lib/jsmap/jsmap.js" type="text/javascript"></script>-->
<!-- <link type="text/css" href="http://mapdemo.joysuch.com/lib/jsmap/jsmap.css" rel="stylesheet"/>-->
<link rel="stylesheet" href="http://192.168.0.31:8089/joysuch/LocalAssets/css/animation/pop.css">
<link rel="stylesheet" href="http://192.168.0.31:8089/joysuch/LocalAssets/css/animation/loading.css">
<link rel="stylesheet" href="http://192.168.0.31:8089/joysuch/LocalAssets/css/dom.css">
<style>
.jsmap-animation-point,
.jsmap-animation-point:after,
.jsmap-animation-point:before,
.jsmap-animation-point p,
.jsmap-animation-point p:after,
.jsmap-animation-point p:before {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.jsmap-animation-point {
width: 10px;
height: 10px;
border-radius: 50%;
border: 1px solid hsla(0, 0%, 100%, 0.5);
cursor: pointer;
color: #0ff;
background: currentColor;
z-index: 3;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
box-shadow: 0 0 2em currentColor, 0 0 0.5em currentColor;
position: absolute;
}
.jsmap-animation-point:after,
.jsmap-animation-point:before,
.jsmap-animation-point p:after,
.jsmap-animation-point p:before {
content: "";
position: absolute;
width: 100%;
height: 100%;
left: 50%;
top: 50%;
border-radius: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.jsmap-animation-point:after,
.jsmap-animation-point:before {
border: 1px solid;
-webkit-animation: jsmap-mapAni 1s ease infinite;
-moz-animation: jsmap-mapAni 1s ease infinite;
-o-animation: jsmap-mapAni 1s ease infinite;
-ms-animation: jsmap-mapAni 1s ease infinite;
animation: jsmap-mapAni 1s ease infinite;
}
.jsmap-animation-point p:before {
border: 1px solid;
}
.jsmap-animation-point p {
position: absolute;
left: 50%;
top: 50%;
width: 0;
height: 0;
border-radius: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-animation: jsmap-mapAni 2s ease infinite;
-moz-animation: jsmap-mapAni 2s ease infinite;
-o-animation: jsmap-mapAni 2s ease infinite;
-ms-animation: jsmap-mapAni 2s ease infinite;
animation: jsmap-mapAni 2s ease infinite;
}
@-webkit-keyframes jsmap-mapAni {
0% {
width: 0;
height: 0;
opacity: 1;
filter: alpha(opacity=1);
}
25% {
width: 12px;
height: 12px;
opacity: 0.7;
filter: alpha(opacity=70);
}
50% {
width: 20px;
height: 20px;
opacity: 0.5;
filter: alpha(opacity=50);
}
75% {
width: 30px;
height: 30px;
opacity: 0.2;
filter: alpha(opacity=20);
}
to {
width: 40px;
height: 40px;
opacity: 0;
filter: alpha(opacity=0);
}
}
@-moz-keyframes jsmap-mapAni {
0% {
width: 0;
height: 0;
opacity: 1;
filter: alpha(opacity=1);
}
25% {
width: 12px;
height: 12px;
opacity: 0.7;
filter: alpha(opacity=70);
}
50% {
width: 20px;
height: 20px;
opacity: 0.5;
filter: alpha(opacity=50);
}
75% {
width: 30px;
height: 30px;
opacity: 0.2;
filter: alpha(opacity=20);
}
to {
width: 40px;
height: 40px;
opacity: 0;
filter: alpha(opacity=0);
}
}
@-o-keyframes jsmap-mapAni {
0% {
width: 0;
height: 0;
opacity: 1;
filter: alpha(opacity=1);
}
25% {
width: 12px;
height: 12px;
opacity: 0.7;
filter: alpha(opacity=70);
}
50% {
width: 20px;
height: 20px;
opacity: 0.5;
filter: alpha(opacity=50);
}
75% {
width: 30px;
height: 30px;
opacity: 0.2;
filter: alpha(opacity=20);
}
to {
width: 40px;
height: 40px;
opacity: 0;
filter: alpha(opacity=0);
}
}
@-ms-keyframes jsmap-mapAni {
0% {
width: 0;
height: 0;
opacity: 1;
filter: alpha(opacity=1);
}
25% {
width: 12px;
height: 12px;
opacity: 0.7;
filter: alpha(opacity=70);
}
50% {
width: 20px;
height: 20px;
opacity: 0.5;
filter: alpha(opacity=50);
}
75% {
width: 30px;
height: 30px;
opacity: 0.2;
filter: alpha(opacity=20);
}
to {
width: 40px;
height: 40px;
opacity: 0;
filter: alpha(opacity=0);
}
}
@keyframes jsmap-mapAni {
0% {
width: 0;
height: 0;
opacity: 1;
filter: alpha(opacity=1);
}
25% {
width: 12px;
height: 12px;
opacity: 0.7;
filter: alpha(opacity=70);
}
50% {
width: 20px;
height: 20px;
opacity: 0.5;
filter: alpha(opacity=50);
}
75% {
width: 30px;
height: 30px;
opacity: 0.2;
filter: alpha(opacity=20);
}
to {
width: 40px;
height: 40px;
opacity: 0;
filter: alpha(opacity=0);
}
}
</style>
</head>
<body>
<div id='mapContainer'></div>
<script type="text/javascript">
//定义全局map变量
var map = null;
//定义地图ID变量
var mapID = '100930';
//定义循环的起始变量
var i = 0;
//定义点标注全局变量
var domMarker = null;
window.onload = function () {
window.addEventListener('message', function (e) {
//加载地图
// console.info('地图加载完成')
// console.info(mapData)
openMap(e.data);
add(e.data);
});
};
window.addEventListener('unload', function (e) {
//销毁地图
map.destroy();
map = null;
});
//打开地图
function openMap(mapData) {
//初始化参数
var mapOptions = {
//必要,地图容器
container: 'mapContainer',
//必要,地图类型
mapType: jsmap.JSMapType.MAP_3D,
//必要,地图路径
// mapServerURL: 'http://mapdemo.joysuch.com',
mapServerURL: 'http://192.168.0.31:8089/joysuch/jsmap/data/map',
openingAnimation: false,
enableLighting: true,
enableShadows: true,
viewOptions: {
center: {
x: Number(mapData.longitude),
y: Number(mapData.latitude),
z: 0.016594102424956802
},
distance: 370.01629618875734,
rotate: 0,
tilt: 90
},
imageryProvider: jsmap.JSImageryProviderType.IMAGE_TDT,
};
//初始化地图对象
map = new jsmap.JSMap(mapOptions);
//打开map服务器的地图数据和主题
map.openMapById(mapID);
//地图加载完成事件
map.on("loadComplete", e => {
var compassControl = new jsmap.JSCompassControl({
position: jsmap.JSControlPosition.LEFT_TOP,
offset: {
x: 10,
y: 20
}
});
var zoomControl = new jsmap.JSZoomControl({
position: jsmap.JSControlPosition.LEFT_TOP,
offset: {
x: 40,
y: 10
}
});
if (document.documentElement.clientWidth >= 600) {
map.addControl(compassControl);
map.addControl(zoomControl);
}
});
}
//添加标注
function add(mapData) {
var content = '<div>' +
'<div class="wrapper">' +
'<div class="row cf">' +
'<div class="span">' +
'<div class="location_indicator"></div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div>' +
'<div class="divpoint divpoint-theme-29baf1">' +
'<div class="divpoint-wrap">' +
'<div class="area">' +
'<div class="arrow-lt"></div>' +
'<div class="b-t"></div>' +
'<div class="b-r"></div>' +
'<div class="b-b"></div>' +
'<div class="b-l"></div>' +
'<div class="arrow-rb"></div>' +
'<div class="label-wrap">' +
'<div class="title">' + mapData.name + '</div>' +
'<div class="label-content">';
if (mapData.number) {
content +=
'<div class="data-li">' +
'<div class="data-label">编号:</div>' +
'<div class="data-value">' +
'<span class="label-tag data-value-status-1">' + mapData.number + '</span>' +
'</div>' +
'</div>';
}
if (mapData.workcontent) {
content +=
'<div class="data-li">' +
'<div class="data-label">作业内容:</div>' +
'<div class="data-value">' +
'<span class="label-tag data-value-status-1">' + mapData.workcontent + '</span>' +
'</div>' +
'</div>';
}
if (mapData.address) {
content +=
'<div class="data-li">' +
'<div class="data-label">地址:</div>' +
'<div class="data-value">' +
'<span class="label-tag data-value-status-1">' + mapData.address + '</span>' +
'</div>' +
'</div>';
}
content +=
'<div class="data-li">' +
'<div class="data-label">经度:</div>' +
'<div class="data-value">' +
'<span class="label-num">' + mapData.longitude + '</span>' +
'</div>' +
'</div>' +
'<div class="data-li">' +
'<div class="data-label">纬度:</div>' +
'<div class="data-value">' +
'<span class="label-num">' + mapData.latitude + '</span>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="b-t-l"></div>' +
'<div class="b-b-r"></div>' +
'</div>' +
'<div class="arrow"></div>' +
'</div>' +
'</div>';
domMarker = new jsmap.JSDomMarker({
id: i,
position: {
x: Number(mapData.longitude),
y: Number(mapData.latitude),
z: 1
}, //坐标
floorId: 1, //楼层id,默认为1地面
pointerEvents: 'none',
content: content,
offset: jsmap.JSControlPosition.LEFT_BOTTOM,
marginOffset: {
x: 0,
y: 0
},
properties: {
type: 0,
},//属性设置
callback: (node) => {
// console.log(node);
} //回调事件
});
map.addMarker(domMarker);
}
</script>
</body>
</html>