3d-2d高亮处理

master
许宏杰 8 months ago
parent 6328052a3a
commit d60835a100

@ -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,
}, },
}, },

@ -94,6 +94,8 @@ export default {
console.log(networkName); console.log(networkName);
} }
this.$store.commit("CHANGE_QUERY", { parentid: e });
this.$store.commit("CHANGE_QUERY_MAP", { networkName: networkName }); this.$store.commit("CHANGE_QUERY_MAP", { networkName: networkName });
}, },
handleMapLayer(e) { handleMapLayer(e) {

@ -78,7 +78,7 @@ export default {
return !this.queryParamsXiaoqu.parentid && return !this.queryParamsXiaoqu.parentid &&
!this.queryParamsXiaoqu.buildingid !this.queryParamsXiaoqu.buildingid
? "小区简介" ? "小区简介"
: this.queryParamsXiaoqu.parentid : this.queryParamsXiaoqu.parentid && !this.queryParamsXiaoqu.buildingid
? "网格简介" ? "网格简介"
: "统计分析"; : "统计分析";
}, },

Loading…
Cancel
Save