|
|
@ -80,9 +80,16 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
map.on(mars3d.EventType.click, function (e) {
|
|
|
|
map.on(mars3d.EventType.click, function (e) {
|
|
|
|
// if (!e.id ) {
|
|
|
|
if (!e.id) {
|
|
|
|
// map.getLayerById("dth").clear(); //清除单体化
|
|
|
|
// map.getLayerById("dth").clear(); //清除单体化
|
|
|
|
// }
|
|
|
|
// _this.mapLayer.network.eachGraphic((graphic) => {
|
|
|
|
|
|
|
|
// graphic.closeHighlight();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
_this.$store.commit("CHANGE_QUERY", {
|
|
|
|
|
|
|
|
buildingid: undefined,
|
|
|
|
|
|
|
|
deptId: undefined,
|
|
|
|
|
|
|
|
}); //存储全局参数
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//图层组
|
|
|
|
//图层组
|
|
|
@ -114,8 +121,6 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.addbuildingLayer();
|
|
|
|
this.addbuildingLayer();
|
|
|
|
|
|
|
|
|
|
|
|
// this.addDTH();
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//商铺面
|
|
|
|
//商铺面
|
|
|
|
addshop() {
|
|
|
|
addshop() {
|
|
|
@ -313,13 +318,6 @@ export default {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.mapLayer.plane.addGraphic(polygon);
|
|
|
|
this.mapLayer.plane.addGraphic(polygon);
|
|
|
|
|
|
|
|
|
|
|
|
polygon.on(mars3d.EventType.highlightClose, function (e) {
|
|
|
|
|
|
|
|
// _this.$store.commit("CHANGE_QUERY", {
|
|
|
|
|
|
|
|
// buildingid: undefined,
|
|
|
|
|
|
|
|
//deptId: undefined,
|
|
|
|
|
|
|
|
//}); //存储全局参数
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const point = new mars3d.graphic.BillboardEntity({
|
|
|
|
const point = new mars3d.graphic.BillboardEntity({
|
|
|
|
id: item.attr["幢号"],
|
|
|
|
id: item.attr["幢号"],
|
|
|
|
position: polygon.centerPoint,
|
|
|
|
position: polygon.centerPoint,
|
|
|
@ -357,27 +355,23 @@ export default {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
point.on(mars3d.EventType.click, async function (e) {
|
|
|
|
point.on(mars3d.EventType.click, async function (e) {
|
|
|
|
let buildingItem = _this.mapLayer.plane.getGraphicByAttr(e.id);
|
|
|
|
let buildingItem = _this.mapLayer.plane.getGraphicByAttr(e.id);
|
|
|
|
// if (_this.mapLayer.tiles3dLayer.show) {
|
|
|
|
if (
|
|
|
|
// const geojson = buildingItem.toGeoJSON();
|
|
|
|
_this.mapLayer.tiles3dLayer &&
|
|
|
|
// _this.map
|
|
|
|
_this.mapLayer.tiles3dLayer.show
|
|
|
|
// .getLayerById("dth")
|
|
|
|
) {
|
|
|
|
// .loadGeoJSON(geojson, { clear: true });
|
|
|
|
const geojson = buildingItem.toGeoJSON();
|
|
|
|
// } else {
|
|
|
|
_this.map
|
|
|
|
// buildingItem.openHighlight({
|
|
|
|
.getLayerById("dth")
|
|
|
|
// color: "#FFA200",
|
|
|
|
.loadGeoJSON(geojson, { clear: true });
|
|
|
|
// opacity: 0.3,
|
|
|
|
} else {
|
|
|
|
// outline: true,
|
|
|
|
buildingItem.openHighlight({
|
|
|
|
// outlineColor: "#F5DC02",
|
|
|
|
color: "#FFA200",
|
|
|
|
// outlineWidth: 2,
|
|
|
|
opacity: 0.3,
|
|
|
|
// });
|
|
|
|
outline: true,
|
|
|
|
// }
|
|
|
|
outlineColor: "#F5DC02",
|
|
|
|
buildingItem.openHighlight({
|
|
|
|
outlineWidth: 2,
|
|
|
|
color: "#FFA200",
|
|
|
|
});
|
|
|
|
opacity: 0.3,
|
|
|
|
}
|
|
|
|
outline: true,
|
|
|
|
|
|
|
|
outlineColor: "#F5DC02",
|
|
|
|
|
|
|
|
outlineWidth: 2,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
let deptData = await _this.getDeptId({
|
|
|
|
let deptData = await _this.getDeptId({
|
|
|
|
xiaoquId: _this.xiaoquId,
|
|
|
|
xiaoquId: _this.xiaoquId,
|
|
|
|
deptName: e.target.attr.yuanName,
|
|
|
|
deptName: e.target.attr.yuanName,
|
|
|
@ -428,6 +422,11 @@ export default {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if (show && this.mapLayer.network.length > 0) {
|
|
|
|
if (show && this.mapLayer.network.length > 0) {
|
|
|
|
this.mapLayer.network.show = true;
|
|
|
|
this.mapLayer.network.show = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.mapLayer.network.eachGraphic((graphic) => {
|
|
|
|
|
|
|
|
// graphic.closeHighlight();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
let networkItem = this.mapLayer.network.getGraphicById(show);
|
|
|
|
let networkItem = this.mapLayer.network.getGraphicById(show);
|
|
|
|
networkItem.openHighlight({
|
|
|
|
networkItem.openHighlight({
|
|
|
|
type: "click",
|
|
|
|
type: "click",
|
|
|
@ -463,28 +462,36 @@ export default {
|
|
|
|
center: this.config.viewHome,
|
|
|
|
center: this.config.viewHome,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.map.addLayer(this.mapLayer.tiles3dLayer);
|
|
|
|
this.map.addLayer(this.mapLayer.tiles3dLayer);
|
|
|
|
|
|
|
|
this.addDTH();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (show && this.mapLayer.tiles3dLayer)
|
|
|
|
if (show && this.mapLayer.tiles3dLayer) {
|
|
|
|
|
|
|
|
this.handle3dPoint("3d");
|
|
|
|
this.mapLayer.tiles3dLayer.show = true;
|
|
|
|
this.mapLayer.tiles3dLayer.show = true;
|
|
|
|
if (!show && this.mapLayer.tiles3dLayer)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!show && this.mapLayer.tiles3dLayer) {
|
|
|
|
|
|
|
|
this.handle3dPoint("2d");
|
|
|
|
this.mapLayer.tiles3dLayer.show = false;
|
|
|
|
this.mapLayer.tiles3dLayer.show = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//2D - 3D点处理
|
|
|
|
//2D - 3D点处理
|
|
|
|
handle3dPoint() {
|
|
|
|
handle3dPoint(type) {
|
|
|
|
this.mapLayer.tiles3dLayer.show = true;
|
|
|
|
|
|
|
|
//修改二维图标成为三维
|
|
|
|
//修改二维图标成为三维
|
|
|
|
this.mapLayer.planePoint.eachGraphic((graphic) => {
|
|
|
|
this.mapLayer.planePoint.eachGraphic((graphic) => {
|
|
|
|
let attr = graphic.attr;
|
|
|
|
|
|
|
|
var centerPoint = graphic.centerPoint;
|
|
|
|
var centerPoint = graphic.centerPoint;
|
|
|
|
centerPoint.alt = Number(attr.floorNum) * 3 + 10;
|
|
|
|
if (type == "3d") {
|
|
|
|
|
|
|
|
let attr = graphic.attr;
|
|
|
|
|
|
|
|
centerPoint.alt = Number(attr.floorNum) * 3 + 10;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
graphic.setOptions({
|
|
|
|
graphic.setOptions({
|
|
|
|
position: centerPoint,
|
|
|
|
position: centerPoint,
|
|
|
|
style: {
|
|
|
|
style: {
|
|
|
|
width: 30,
|
|
|
|
width: type == "3d" ? 30 : 46,
|
|
|
|
height: 30,
|
|
|
|
height: type == "3d" ? 30 : 42,
|
|
|
|
clampToGround: false,
|
|
|
|
clampToGround: type == "3d" ? false : true,
|
|
|
|
label: {
|
|
|
|
label: {
|
|
|
|
clampToGround: false, //贴地
|
|
|
|
clampToGround: type == "3d" ? false : true,
|
|
|
|
height: centerPoint.alt,
|
|
|
|
height: centerPoint.alt,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|