|
@@ -313,6 +313,7 @@ export default {
|
|
|
if (
|
|
|
[
|
|
|
"视频融合",
|
|
|
+ "门禁管理",
|
|
|
"安防门禁",
|
|
|
"防爆扩音",
|
|
|
"埋地泄漏",
|
|
@@ -654,72 +655,84 @@ export default {
|
|
|
},
|
|
|
showBuildingInfo(layerId, show) {
|
|
|
this.buildingInfoLayerId = "layer_" + layerId;
|
|
|
- let dataSource = addNewDatasource(this.buildingInfoLayerId);
|
|
|
- if (show) {
|
|
|
- if (dataSource.entities.values.length == 0) {
|
|
|
- this.buildingInfo.forEach((d) => {
|
|
|
- dataSource.entities.add(
|
|
|
- new Entity({
|
|
|
- id: "buildingName_" + d.id,
|
|
|
- //name: d.name,
|
|
|
- position: Cartesian3.fromDegrees(d.x, d.y, d.z),
|
|
|
- label: {
|
|
|
- text: d.name,
|
|
|
- show: new CallbackProperty((time, result) => {
|
|
|
- return this.buildingNameShowProperty(d.id);
|
|
|
- }),
|
|
|
- font: "18px Helvetica",
|
|
|
- style: LabelStyle.FILL_AND_OUTLINE,
|
|
|
- pixelOffset: new Cartesian2(0, -18),
|
|
|
- fillColor: Color.WHITE,
|
|
|
- outlineColor: Color.BLACK,
|
|
|
- outlineWidth: 2,
|
|
|
- horizontalOrigin: HorizontalOrigin.CENTER,
|
|
|
- verticalOrigin: VerticalOrigin.TOP,
|
|
|
- //scaleByDistance: new NearFarScalar(1, 2.6, 800, 0),
|
|
|
- },
|
|
|
- properties: new PropertyBag({
|
|
|
- type: "buildingName",
|
|
|
- details: d,
|
|
|
- }),
|
|
|
- })
|
|
|
- );
|
|
|
- dataSource.entities.add(
|
|
|
- new Entity({
|
|
|
- id: "buildingPerson_" + d.id,
|
|
|
- //name: d.name,
|
|
|
- position: Cartesian3.fromDegrees(d.x, d.y, d.z),
|
|
|
- label: {
|
|
|
- text: new CallbackProperty((time, result) => {
|
|
|
- return this.getPersonCount(d.id);
|
|
|
- }),
|
|
|
- show: new CallbackProperty((time, result) => {
|
|
|
- return this.buildingNameShowProperty(d.id);
|
|
|
- }),
|
|
|
- font: "18px Helvetica",
|
|
|
- style: LabelStyle.FILL,
|
|
|
- pixelOffset: new Cartesian2(0, -42),
|
|
|
- fillColor: Color.WHITE,
|
|
|
- backgroundColor: Color.DARKBLUE, //Color.WHITE, //背景颜色
|
|
|
- showBackground: true, //是否显示背景颜色
|
|
|
- outlineColor: Color.BLACK,
|
|
|
- outlineWidth: 2,
|
|
|
- horizontalOrigin: HorizontalOrigin.CENTER,
|
|
|
- verticalOrigin: VerticalOrigin.TOP,
|
|
|
- //scaleByDistance: new NearFarScalar(1, 2.6, 800, 0),
|
|
|
- },
|
|
|
- properties: new PropertyBag({
|
|
|
- type: "buildingPerson",
|
|
|
- details: d,
|
|
|
- }),
|
|
|
- })
|
|
|
- );
|
|
|
- });
|
|
|
+ const viewer = getViewer();
|
|
|
+ const D = viewer.dataSources.getByName(this.buildingInfoLayerId);
|
|
|
+ if (D.length > 0) {
|
|
|
+ console.log("建筑名称:", D);
|
|
|
+ if (show) {
|
|
|
+ D[0].show = true;
|
|
|
} else {
|
|
|
- dataSource.show = true;
|
|
|
+ D[0].show = false;
|
|
|
}
|
|
|
} else {
|
|
|
- dataSource.show = false;
|
|
|
+ const dataSource = addNewDatasource(this.buildingInfoLayerId);
|
|
|
+ console.log("Params", layerId, show, dataSource);
|
|
|
+ if (show) {
|
|
|
+ if (dataSource.entities.values.length == 0) {
|
|
|
+ this.buildingInfo.forEach((d) => {
|
|
|
+ dataSource.entities.add(
|
|
|
+ new Entity({
|
|
|
+ id: "buildingName_" + d.id,
|
|
|
+ //name: d.name,
|
|
|
+ position: Cartesian3.fromDegrees(d.x, d.y, d.z),
|
|
|
+ label: {
|
|
|
+ text: d.name,
|
|
|
+ show: new CallbackProperty((time, result) => {
|
|
|
+ return this.buildingNameShowProperty(d.id);
|
|
|
+ }),
|
|
|
+ font: "16px Helvetica",
|
|
|
+ style: LabelStyle.FILL_AND_OUTLINE,
|
|
|
+ pixelOffset: new Cartesian2(0, -18),
|
|
|
+ fillColor: Color.WHITE,
|
|
|
+ outlineColor: Color.BLACK,
|
|
|
+ outlineWidth: 2,
|
|
|
+ backgroundColor: Color.DARKBLUE, //Color.WHITE, //背景颜色
|
|
|
+ showBackground: true, //是否显示背景颜色
|
|
|
+ horizontalOrigin: HorizontalOrigin.CENTER,
|
|
|
+ verticalOrigin: VerticalOrigin.TOP,
|
|
|
+ //scaleByDistance: new NearFarScalar(1, 2.6, 800, 0),
|
|
|
+ },
|
|
|
+ properties: new PropertyBag({
|
|
|
+ type: "buildingName",
|
|
|
+ details: d,
|
|
|
+ }),
|
|
|
+ })
|
|
|
+ );
|
|
|
+ // dataSource.entities.add(
|
|
|
+ // new Entity({
|
|
|
+ // id: "buildingPerson_" + d.id,
|
|
|
+ // //name: d.name,
|
|
|
+ // position: Cartesian3.fromDegrees(d.x, d.y, d.z),
|
|
|
+ // label: {
|
|
|
+ // text: new CallbackProperty((time, result) => {
|
|
|
+ // return this.getPersonCount(d.id);
|
|
|
+ // }),
|
|
|
+ // show: new CallbackProperty((time, result) => {
|
|
|
+ // return this.buildingNameShowProperty(d.id);
|
|
|
+ // }),
|
|
|
+ // font: "18px Helvetica",
|
|
|
+ // style: LabelStyle.FILL,
|
|
|
+ // pixelOffset: new Cartesian2(0, -42),
|
|
|
+ // fillColor: Color.WHITE,
|
|
|
+ // backgroundColor: Color.DARKBLUE, //Color.WHITE, //背景颜色
|
|
|
+ // showBackground: true, //是否显示背景颜色
|
|
|
+ // outlineColor: Color.BLACK,
|
|
|
+ // outlineWidth: 2,
|
|
|
+ // horizontalOrigin: HorizontalOrigin.CENTER,
|
|
|
+ // verticalOrigin: VerticalOrigin.TOP,
|
|
|
+ // //scaleByDistance: new NearFarScalar(1, 2.6, 800, 0),
|
|
|
+ // },
|
|
|
+ // properties: new PropertyBag({
|
|
|
+ // type: "buildingPerson",
|
|
|
+ // details: d,
|
|
|
+ // }),
|
|
|
+ // })
|
|
|
+ // );
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ dataSource.show = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
showBuildingInfoByBuildId(layerId, show) {
|