tedp
Version:
terra dp init
109 lines (89 loc) • 2.66 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="./dist/tumap.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
#mapContainer{
position:absolute;
width:100%;
height:100%;
}
.control-box{
position:absolute;
right:10px;
top:5px;
background:rgba(0,0,0,.5);
border:1px solid rgba(255,255,255,.8);
border-radius: 6px;
overflow: hidden;
color:#fff;
font-size:13px;
padding: 5px;
box-sizing: border-box;
}
.control-box>span{
margin-left: 5px;
}
.input-text{
width:200px;
height:25px;
line-height:25px;
box-sizing: border-box;
}
.control-button{
height:25px;
line-height:25px;
cursor: pointer;
padding: 2px 5px;
box-sizing: border-box;
margin-left:5px;
}
</style>
</head>
<body>
<!--地图容器-->
<div id="mapContainer"></div>
<div class="control-box">
<input class="control-button" type="button" value="创建光圈" onclick="create()" >
<input class="control-button" type="button" value="移除" onclick="remove()" >
</div>
<script type="text/javascript">
var map = TUMap.createMap({
//地图容器
id:"mapContainer",
//UE4服务地址 必须设置 当前示例以地址栏地址 为服务地址 ,用户需要替换为自己的服务地址
url:window.parent.window.exampleServerUrl ,//"http://localhost:81/",
onInit:function(){
create();
}
}) ;
//标签数组
var layerObject = null ;
//创建标签
function create(){
layerObject = map.createCircleArea({
location:new TUVector3(0, 0, 0),//中心点
radius:15000,
type: 2, //0上浮横格,1实色,2箭头,3三角
color:"#ff0000",
height:15000, //默认5000
brightness:10 //默认10
}) ;
//移动下位置
map.focusOn(new TUVector3(-265,269,376), new TURotator(0,-45,-45), 52450 );
}
//删除
function remove(){
console.log("=====layerObject==================>>>"+layerObject)
if(layerObject)
layerObject.removeFromMap();
}
</script>
</body>
</html>