跳到主要内容
版本:9.1.0

构建三维椎体

基于坐标点位构建椎体模型。

show
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8"/>
<title>构建三维椎体</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}

</style>
<script src="https://delivery.mapmost.com/cdn/sdk/webgl/v9.1.0/mapmost-webgl-min.js"></script>
</head>

<body>
<div id="map"></div>
<script>
let map = new mapmost.Map({
container: 'map',
style: "<your style url>",
center: [120.61735758125678, 31.29522164911073],
zoom: 15,
pitch: 59.48725112156901,
bearing: -54.10626584095007,
userId: '***', // 授权码
});

map.on('load', function () {

let options = {
id: 'model_id',
type: 'model',
callback: function (group, layer) {
let frustum = layer.addPyramid({
topColor: ["rgb(0,100,255)", "rgb(0,0,255)"],
// baseColor: 0x0000ff,
opacity: 0.6,
side: "DoubleSide",
topPoint: [120.622, 31.294, 300],
basePoints: [
[120.621, 31.295, 20],
[120.623, 31.295, 20],
[120.624, 31.294, 20],
[120.623, 31.293, 20],
[120.621, 31.293, 20],
]
})
frustum.setRotation({x: 90, y: 0, z: 0})
frustum.addFrame(0x0000FF)
}
};
map.addLayer(options);
})
</script>
</body>

</html>