console
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>二维热力图+轨迹模拟</title>
<link rel="stylesheet" href="http://bos3d.bimwinner.com/static/latest/BOS2D.min.css" />
<style>
body {
margin: 0;
overflow: hidden;
position: fixed;
}
</style>
</head>
<body>
<div id="viewport" class="viewport"></div>
<script>
const html = document.querySelector("html");
document.querySelector(".viewport").style.width = html.clientWidth + 'px';
document.querySelector(".viewport").style.height = html.clientHeight - 1+ 'px';
</script>
<script src="http://bos3d.bimwinner.com/static/latest/BOS3D.min.js"></script>
<script src="http://bos3d.bimwinner.com/static/UI/latest/BOS3DUI.min.js"></script>
<script>
const option = { host: "https://bos3d.bimwinner.com", viewport: "viewport" };
const viewer3D = new BOS3D.Viewer(option);
new BOS3DUI({
viewer3D,
BOS3D: window.BOS3D,
})
viewer3D.addView("M1615890402767", "gddb77ab4f1f476c91f3eb7cf1a63021");
viewer3D.registerModelEventListener(BOS3D.EVENTS.ON_LOAD_COMPLETE, () => {
const h = new BOS3D.Plugins.Heatmap({
viewer3D
})
const rst = h.createHeatmap({
data: {
min: 0,
max: 100,
data: [
{
point: {x: 26651.700823949748, y: -32133.094955135122, z: 42},
value: 80,
radius: 30000
},
{
point: {x: 379.8189240790052, y: -27685.34857659035, z: 42},
value: 100,
radius: 30000
},
{
point: {x: 23603.079806100544, y: 9585.953967723255, z: 42},
value: 40,
radius: 40000
},
{
point: {x: 63157.09560730366, y: 6856.162473555919, z: 42},
value: 60,
radius: 40000
},
{
point: {x: 70000, y: -30000, z: 42},
value: 100,
radius: 60000
},
]
},
boundary:[
{x: 30864.43440182326, y: -34493.74721712923, z: 42},
{x: 25598.614225799116, y: -37053.1214585997, z: 42},
{x: 23498.64557495223, y: -37040.001103125, z: 42},
{x: -3145.9157675804418, y: -31636.401063108045, z: 42},
{x: -3046.4438224296973, y: 12681.490945523648, z: 42},
{x: -407.51196405891096, y: 15247.172727697078, z: 42},
{x: 65146.2941727892, y: 20789.83431643361, z: 42},
{x: 65180.2625432263, y: 20506.768165837762, z: 42},
{x: 73284.23143088985, y: 5524.939574159096, z: 42},
{x: 73284.23143088985, y: -34493.74721712923, z: 42},
]
})
console.info(rst)
// 飞机
const debug = false;
const vec3 = BOS3D.THREE.Vector3;
const s = new BOS3D.Plugins.TrackSimulator({
viewer3D,
modelKey: "M1593746014551"
})
const trackId = s.addTrack({
componentKey: "M1593746014551_93",
points: [
// O = (-2151, 39533, 100000), r=130000
new vec3(127849, 39533, 100000),
new vec3(-2151, 169533, 100000),
new vec3(-132151, 39533, 100000),
new vec3(-2151, -90467, 100000),
],
debug,
closed: true,
})
s.startMove({
trackId,
startDir: new vec3(1897, -2950, 0),
pointFn: (_1, percent) => parseFloat((percent + 0.001).toFixed(3))
})
.then(console.info)
.catch(console.error)
})
viewer3D.registerModelEventListener(BOS3D.EVENTS.ON_CLICK_PICK, e => {
if (e.intersectInfo) {
console.info(e.intersectInfo.point)
}
})
</script>
</body>
</html>