三维地图实现地形起伏立体效果源代码
作者:互联网
三维地图服务器 下载地址:http://download.bigemap.com/bm3Dserver.rar (最新版)
安装以上SDK后,启动,启动面板上找到开发使用,如下图源代码:
//注释:安装地图服务器后,下列代码中的 http://bigemap.com 替换成 http://localhost ,其他不变
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8' />
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
<link href='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/Widgets/widgets.css' rel='stylesheet'/>
<script src='http://bigemap.com:9000/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script>
<style>
body { margin: 0; padding: 0; }
#container { position: absolute; top: 0; bottom: 0; width: 100%; }
.bmgl-widget-credits{display:none}
</style>
<title>part_test</title>
</head>
<body>
<div id='container'></div>
<script>
bmgl.Config.HTTP_URL = 'http://bigemap.com:9000';
var viewer = new bmgl.Viewer('container', {terrainId: 'bigemap.9af15d8e'});
viewer.camera.setView({
destination: bmgl.Cartesian3.fromDegrees(103.11275886321059,31.25777280451164,6000),
orientation: {"heading": 5.462412729374679, "roll": 6.280834231188946, "pitch": -0.3856971665320348}
});
viewer.scene.globe.depthTestAgainstTerrain = true;
viewer.entities.add({
position:bmgl.Cartesian3.fromDegrees(103.1060043615548,31.26417789512378,5540),
//设置角度,示例中没有旋转,所有全部设置的0。
orientation:bmgl.Transforms.headingPitchRollQuaternion(bmgl.Cartesian3.fromDegrees(103.1060043615548,31.26417789512378),new bmgl.HeadingPitchRoll(0, bmgl.Math.toRadians(0), 0)),
model:{
//heightReference:bmgl.HeightReference.CLAMP_TO_GROUND,
uri:'/bmgl/glb/satellite.glb',
maximumScale:0.1,
}
});
</script>
</body>
</html>
效果图:
标签:http,Cartesian3,viewer,三维,立体,fromDegrees,bmgl,源代码,com 来源: https://blog.51cto.com/u_15262562/2883419