mirror of https://gitee.com/antv-l7/antv-l7
108 lines
2.2 KiB
HTML
108 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<meta name="geometry" content="diagram">
|
|
<link rel="stylesheet" href="./assets/common.css">
|
|
|
|
<title>extrude Polygon</title>
|
|
<style>
|
|
#map { position:absolute; top:0; bottom:0; width:100%; }
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id = 'gui' style="position:absolute;top:0px;right:0px;z-index:2;"></div>
|
|
<div id="map"></div>
|
|
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
|
|
<script src="./assets/jquery-3.2.1.min.js"></script>
|
|
<script src="./assets/dat.gui.min.js"></script>
|
|
<script src="../build/l7.js"></script>
|
|
<script>
|
|
var mapinstance = new AMap.Map('map',{
|
|
center: [121.576757,31.279873 ],
|
|
viewMode: '3D',
|
|
pitch: 0,
|
|
zoom: 12,
|
|
maxZoom:20,
|
|
minZoom:0,
|
|
});
|
|
|
|
const scene = new L7.Scene({
|
|
map:mapinstance,
|
|
mapStyle: 'dark', // 样式URL
|
|
});
|
|
const testdata =[ {
|
|
'type': 'Polygon',
|
|
'geometryCoord': [
|
|
[
|
|
[
|
|
115.1806640625,
|
|
30.637912028341123
|
|
],
|
|
[
|
|
114.9609375,
|
|
29.152161283318915
|
|
],
|
|
[
|
|
117.79541015625001,
|
|
27.430289738862594
|
|
],
|
|
[
|
|
118.740234375,
|
|
29.420460341013133
|
|
],
|
|
[
|
|
117.46582031249999,
|
|
31.50362930577303
|
|
],
|
|
[
|
|
115.1806640625,
|
|
30.637912028341123
|
|
]
|
|
]
|
|
]
|
|
}
|
|
]
|
|
|
|
scene.on('loaded', () => {
|
|
|
|
|
|
citylayer = scene.PolygonLayer()
|
|
.source(testdata,{
|
|
parser:{
|
|
type:'json',
|
|
coordinates:'geometryCoord'
|
|
}
|
|
})
|
|
.color('red')
|
|
.shape('fill')
|
|
.active(true)
|
|
.style({
|
|
opacity: 1.0
|
|
})
|
|
.render();
|
|
citylayer = scene.LineLayer()
|
|
.source(testdata,{
|
|
parser:{
|
|
type:'json',
|
|
coordinates:'geometryCoord'
|
|
}
|
|
})
|
|
.color('#fff')
|
|
.shape('line')
|
|
.size(4)
|
|
.active(true)
|
|
.style({
|
|
opacity: 1.0
|
|
})
|
|
.render();
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|