|
@@ -42,26 +42,29 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
initMap() {
|
|
|
+ window._AMapSecurityConfig = {
|
|
|
+ securityJsCode: '4a6a8d8ea053d9aa8f4677ee1179fe57', // 密钥
|
|
|
+ };
|
|
|
AMapLoader.load({
|
|
|
key:"58f9d9f14f2700689ddbc618495693b7", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
- // version:"2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
- plugins:['AMap.ToolBar','AMap.DistrictSearch','AMap.Object3DLayer','AMap.Object3D'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
|
+ version:"1.4.15", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
|
+ // plugins:['AMap.ToolBar','AMap.DistrictSearch','AMap.Object3DLayer','AMap.Object3D'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
|
}).then((AMap)=>{
|
|
|
this.map = new AMap.Map("container",{ //设置地图容器id
|
|
|
- // viewMode:"3D", //是否为3D地图模式
|
|
|
+ viewMode:"3D", //是否为3D地图模式
|
|
|
zoom:this.zoom, //初始化地图级别
|
|
|
center:this.lngLat, //初始化地图中心点位置
|
|
|
layers: [new AMap.TileLayer.Satellite(), new AMap.TileLayer.RoadNet()],
|
|
|
// mapStyle: 'amap://styles/db9efe6a1745ac24b7269b862f359536'
|
|
|
});
|
|
|
this.$nextTick(()=>{
|
|
|
- this.getMap();
|
|
|
+ this.getMap(AMap);
|
|
|
})
|
|
|
}).catch(e=>{
|
|
|
console.log(e);
|
|
|
})
|
|
|
},
|
|
|
- getMap() {
|
|
|
+ getMap(AMap) {
|
|
|
let that = this;
|
|
|
// console.log('AMap',AMap);
|
|
|
AMap.plugin(['AMap.DistrictSearch'], function () {
|
|
@@ -77,8 +80,8 @@ export default {
|
|
|
})
|
|
|
|
|
|
district.search(that.adcode, function(status, result) {
|
|
|
- console.log('result',result);
|
|
|
- console.log('result.districtList',result.districtList);
|
|
|
+ // console.log('result',result);
|
|
|
+ // console.log('result.districtList',result.districtList);
|
|
|
if(!result.districtList){
|
|
|
return
|
|
|
}
|
|
@@ -97,38 +100,44 @@ export default {
|
|
|
fillColor: '#CCF3FF',
|
|
|
strokeColor: '#CC66CC'
|
|
|
})
|
|
|
- console.log('polygon',polygon);
|
|
|
+ // console.log('polygon',polygon);
|
|
|
polygons.push(polygon)
|
|
|
}
|
|
|
|
|
|
|
|
|
- //object3Dlayer可以看做一个容器,用来放多个3d对象
|
|
|
- let object3Dlayer = new AMap.Object3DLayer();
|
|
|
- //把object3Dlayer添加到map对象中
|
|
|
- that.map.add(object3Dlayer);
|
|
|
- var wall = new AMap.Object3D.Wall({
|
|
|
- //版块边界线
|
|
|
- path: bounds,
|
|
|
- //墙的高度
|
|
|
- height: 80000,
|
|
|
- //墙的颜色
|
|
|
- color: "#0dcdd1",
|
|
|
- });
|
|
|
- //wall 有两个面,该属性表示哪个面可见,可选值:back ,front ,both表示两面 默认为front
|
|
|
- wall.backOrFront = 'both';
|
|
|
- // 是否允许使用透明颜色
|
|
|
- wall.transparent = true;
|
|
|
- //将wall放到object3Dlayer中
|
|
|
- object3Dlayer.add(wall);
|
|
|
- console.log('object3Dlayer');
|
|
|
+ // //object3Dlayer可以看做一个容器,用来放多个3d对象
|
|
|
+ // let object3Dlayer = new AMap.Object3DLayer();
|
|
|
+ // //把object3Dlayer添加到map对象中
|
|
|
+ // that.map.add(object3Dlayer);
|
|
|
+ // var wall = new AMap.Object3D.Wall({
|
|
|
+ // //版块边界线
|
|
|
+ // path: bounds,
|
|
|
+ // //墙的高度
|
|
|
+ // height: 80000,
|
|
|
+ // //墙的颜色
|
|
|
+ // color: "#0dcdd1",
|
|
|
+ // });
|
|
|
+ // //wall 有两个面,该属性表示哪个面可见,可选值:back ,front ,both表示两面 默认为front
|
|
|
+ // wall.backOrFront = 'both';
|
|
|
+ // // 是否允许使用透明颜色
|
|
|
+ // wall.transparent = true;
|
|
|
+ // //将wall放到object3Dlayer中
|
|
|
+ // object3Dlayer.add(wall);
|
|
|
+ // console.log('object3Dlayer');
|
|
|
|
|
|
|
|
|
// 地图自适应
|
|
|
that.map.setFitView()
|
|
|
+ console.log('AMap.Object3DLayer',AMap.Object3DLayer);
|
|
|
+ AMap.plugin(['AMap.Object3DLayer','AMap.Object3D'], function () {
|
|
|
+ console.log('2222');
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
};
|