|
@@ -5,45 +5,13 @@
|
|
|
<img :src="require('@assets/png/3dmap.png')" alt="">
|
|
|
</div>
|
|
|
<div class="three-html-layer">
|
|
|
- <div
|
|
|
+ <div v-for="(info, index) of htmlLayer" :key="index"
|
|
|
class="three-html-dom fan-info"
|
|
|
- :id="htmlLayer[0].id"
|
|
|
- v-show="htmlLayer[0].show"
|
|
|
- :style="'left: ' + htmlLayer[0].x + 'px; top: ' + htmlLayer[0].y + 'px;'"
|
|
|
+ :id="info.id"
|
|
|
+ v-show="info.show"
|
|
|
+ :style="'left: ' + info.x + 'px; top: ' + info.y + 'px;'"
|
|
|
>
|
|
|
- <div class="fan-name">麻黄山</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="three-html-dom fan-info"
|
|
|
- :id="htmlLayer[1].id"
|
|
|
- v-show="htmlLayer[1].show"
|
|
|
- :style="'left: ' + htmlLayer[1].x + 'px; top: ' + htmlLayer[1].y + 'px;'"
|
|
|
- >
|
|
|
- <div class="fan-name">牛首山</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="three-html-dom fan-info"
|
|
|
- :id="htmlLayer[2].id"
|
|
|
- v-show="htmlLayer[2].show"
|
|
|
- :style="'left: ' + htmlLayer[2].x + 'px; top: ' + htmlLayer[2].y + 'px;'"
|
|
|
- >
|
|
|
- <div class="fan-name">青山</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="three-html-dom fan-info"
|
|
|
- :id="htmlLayer[3].id"
|
|
|
- v-show="htmlLayer[3].show"
|
|
|
- :style="'left: ' + htmlLayer[3].x + 'px; top: ' + htmlLayer[3].y + 'px;'"
|
|
|
- >
|
|
|
- <div class="fan-name">石板泉</div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class="three-html-dom fan-info"
|
|
|
- :id="htmlLayer[4].id"
|
|
|
- v-show="htmlLayer[4].show"
|
|
|
- :style="'left: ' + htmlLayer[4].x + 'px; top: ' + htmlLayer[4].y + 'px;'"
|
|
|
- >
|
|
|
- <div class="fan-name">香山</div>
|
|
|
+ <div class="fan-name">{{info.name}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -87,6 +55,7 @@ export default {
|
|
|
ox: 50,
|
|
|
oy: 10,
|
|
|
position: null,
|
|
|
+ name: "麻黄山",
|
|
|
},
|
|
|
{ // 牛首山
|
|
|
id: "fan-nss",
|
|
@@ -96,6 +65,7 @@ export default {
|
|
|
ox: 35,
|
|
|
oy: 0,
|
|
|
position: null,
|
|
|
+ name: "牛首山",
|
|
|
},
|
|
|
{ // 青山
|
|
|
id: "fan-qs",
|
|
@@ -105,15 +75,17 @@ export default {
|
|
|
ox: 60,
|
|
|
oy: 10,
|
|
|
position: null,
|
|
|
+ name: "青山",
|
|
|
},
|
|
|
{ // 石板泉
|
|
|
id: "fan-sbq",
|
|
|
x: 0,
|
|
|
y: 0,
|
|
|
show: true,
|
|
|
- ox: 45,
|
|
|
+ ox: 40,
|
|
|
oy: 0,
|
|
|
position: null,
|
|
|
+ name: "石板泉",
|
|
|
},
|
|
|
{ // 香山
|
|
|
id: "fan-qs",
|
|
@@ -123,6 +95,57 @@ export default {
|
|
|
ox: 25,
|
|
|
oy: 20,
|
|
|
position: null,
|
|
|
+ name: "香山",
|
|
|
+ },
|
|
|
+ { // 大武口
|
|
|
+ id: "light-dwk",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 0,
|
|
|
+ oy: 110,
|
|
|
+ position: null,
|
|
|
+ name: "大武口",
|
|
|
+ },
|
|
|
+ { // 平罗
|
|
|
+ id: "light-pl",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: 30,
|
|
|
+ oy: 100,
|
|
|
+ position: null,
|
|
|
+ name: "平罗",
|
|
|
+ },
|
|
|
+ { // 马场湖
|
|
|
+ id: "light-mch",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: -120,
|
|
|
+ oy: 110,
|
|
|
+ position: null,
|
|
|
+ name: "马场湖",
|
|
|
+ },
|
|
|
+ { // 宣和
|
|
|
+ id: "light-xh",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: -90,
|
|
|
+ oy: 120,
|
|
|
+ position: null,
|
|
|
+ name: "宣和",
|
|
|
+ },
|
|
|
+ { // 海子井
|
|
|
+ id: "light-hzj",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ show: true,
|
|
|
+ ox: -80,
|
|
|
+ oy: 150,
|
|
|
+ position: null,
|
|
|
+ name: "海子井",
|
|
|
},
|
|
|
],
|
|
|
circleXY: [
|
|
@@ -264,17 +287,32 @@ export default {
|
|
|
"static/3d/fanvar.gltf",
|
|
|
(gltf) => {
|
|
|
gltf.scene.position.set(17, 10, -12);
|
|
|
- console.log(gltf);
|
|
|
+ // console.log(gltf);
|
|
|
scene.add(gltf.scene);
|
|
|
let rootNode = gltf.scene.children[0];
|
|
|
let fan = gltf.scene.children[0].children[0];
|
|
|
rootNode.remove(fan);
|
|
|
this.setFanPosition(rootNode, fan);
|
|
|
+ },
|
|
|
+ (xhr) => {},
|
|
|
+ function(error) {
|
|
|
+ console.error("load error!" + error.getWebGLErrorMessage());
|
|
|
+ }
|
|
|
+ );
|
|
|
+ loaderGround.load(
|
|
|
+ "static/3d/lightvar.gltf",
|
|
|
+ (gltf) => {
|
|
|
+ gltf.scene.position.set(17, 10, -12);
|
|
|
+ // console.log(gltf);
|
|
|
+ scene.add(gltf.scene);
|
|
|
+ let rootNode = gltf.scene.children[0];
|
|
|
+ let light = gltf.scene.children[0].children[0];
|
|
|
+ rootNode.remove(light);
|
|
|
+ this.setLightPosition(rootNode, light);
|
|
|
scene.onAfterRender = () => {
|
|
|
this.$emit("when");
|
|
|
this.$refs.pageLoading.hide();
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
(xhr) => {},
|
|
|
function(error) {
|
|
@@ -292,6 +330,18 @@ export default {
|
|
|
transparent: true,
|
|
|
});
|
|
|
},
|
|
|
+ // 改变元素的颜色(光伏)
|
|
|
+ changeElColor: function (obj, colorName) {
|
|
|
+ let color = this.colors.find(t => t.colorName == colorName || t.state == colorName || t.stateName == colorName).color;
|
|
|
+ for (let i = 1; i <= 6; i++) {
|
|
|
+ let el = obj.getObjectByName(`${obj.name}_item_${i}`);
|
|
|
+ el.material = new THREE.MeshBasicMaterial({
|
|
|
+ color: color,
|
|
|
+ opacity: 0.8,
|
|
|
+ transparent: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
// 设置风机name
|
|
|
setFanName: function (obj, name) {
|
|
|
obj.name = name;
|
|
@@ -326,7 +376,7 @@ export default {
|
|
|
setFanPosition: function (rootNode, obj) {
|
|
|
// 麻黄山
|
|
|
let fan_mhs = obj.clone(true);
|
|
|
- fan_mhs.position.set(8, 5, -3);
|
|
|
+ fan_mhs.position.set(10, 5, -4);
|
|
|
this.setFanName(fan_mhs, "fan_mhs");
|
|
|
rootNode.add(fan_mhs);
|
|
|
// this.initCylinderGeometry(fan_mhs.position);
|
|
@@ -340,14 +390,14 @@ export default {
|
|
|
this.htmlLayer[1].position = fan_nss.position;
|
|
|
// 青山
|
|
|
let fan_qs = obj.clone(true);
|
|
|
- fan_qs.position.set(12, 5, -11);
|
|
|
+ fan_qs.position.set(15, 5, -9);
|
|
|
this.setFanName(fan_qs, "fan_qs");
|
|
|
rootNode.add(fan_qs);
|
|
|
// this.initCylinderGeometry(fan_qs.position);
|
|
|
this.htmlLayer[2].position = fan_qs.position;
|
|
|
// 石板泉
|
|
|
let fan_sbq = obj.clone(true);
|
|
|
- fan_sbq.position.set(4, 5, -15);
|
|
|
+ fan_sbq.position.set(4, 5, -2);
|
|
|
this.setFanName(fan_sbq, "fan_sbq");
|
|
|
rootNode.add(fan_sbq);
|
|
|
// this.initCylinderGeometry(fan_sbq.position);
|
|
@@ -380,6 +430,81 @@ export default {
|
|
|
// 设置位置
|
|
|
this.setEveryHTML();
|
|
|
},
|
|
|
+ // 设置光伏name
|
|
|
+ setLightName: function (obj, name) {
|
|
|
+ obj.name = name;
|
|
|
+ obj.userData.name = name;
|
|
|
+ let Box661 = obj.getObjectByName("Box661");
|
|
|
+ let Box668 = obj.getObjectByName("Box668");
|
|
|
+ let Box669 = obj.getObjectByName("Box669");
|
|
|
+ let Box664 = obj.getObjectByName("Box664");
|
|
|
+ let Box667 = obj.getObjectByName("Box667");
|
|
|
+ let Box670 = obj.getObjectByName("Box670");
|
|
|
+ Box661.name = `${name}_item_1`;
|
|
|
+ Box661.userData.name = `${name}_item_1`;
|
|
|
+ Box668.name = `${name}_item_2`;
|
|
|
+ Box668.userData.name = `${name}_item_2`;
|
|
|
+ Box669.name = `${name}_item_3`;
|
|
|
+ Box669.userData.name = `${name}_item_3`;
|
|
|
+ Box664.name = `${name}_item_4`;
|
|
|
+ Box664.userData.name = `${name}_item_4`;
|
|
|
+ Box667.name = `${name}_item_5`;
|
|
|
+ Box667.userData.name = `${name}_item_5`;
|
|
|
+ Box670.name = `${name}_item_6`;
|
|
|
+ Box670.userData.name = `${name}_item_6`;
|
|
|
+ },
|
|
|
+ // 设置光伏位置 颜色
|
|
|
+ setLightPosition: function (rootNode, obj) {
|
|
|
+ let Box660 = obj.getObjectByName("Box660");
|
|
|
+ let Box666 = obj.getObjectByName("Box666");
|
|
|
+ let Box662 = obj.getObjectByName("Box662");
|
|
|
+ let Box663 = obj.getObjectByName("Box663");
|
|
|
+ let Box659 = obj.getObjectByName("Box659");
|
|
|
+ let Box665 = obj.getObjectByName("Box665");
|
|
|
+ obj.remove(Box660);
|
|
|
+ obj.remove(Box666);
|
|
|
+ obj.remove(Box662);
|
|
|
+ obj.remove(Box663);
|
|
|
+ obj.remove(Box659);
|
|
|
+ obj.remove(Box665);
|
|
|
+ // 大武口
|
|
|
+ let light_dwk = obj.clone(true);
|
|
|
+ light_dwk.position.set(-6, 0.13, -53);
|
|
|
+ this.setLightName(light_dwk, "light_dwk");
|
|
|
+ rootNode.add(light_dwk);
|
|
|
+ this.htmlLayer[5].position = light_dwk.position;
|
|
|
+ // 平罗
|
|
|
+ let light_pl = obj.clone(true);
|
|
|
+ light_pl.position.set(-3, 0.13, -60);
|
|
|
+ this.setLightName(light_pl, "light_pl");
|
|
|
+ rootNode.add(light_pl);
|
|
|
+ this.htmlLayer[6].position = light_pl.position;
|
|
|
+ // 马场湖
|
|
|
+ let light_mch = obj.clone(true);
|
|
|
+ light_mch.position.set(-27, 2, -30);
|
|
|
+ this.setLightName(light_mch, "light_mch");
|
|
|
+ rootNode.add(light_mch);
|
|
|
+ this.htmlLayer[7].position = light_mch.position;
|
|
|
+ // 宣和
|
|
|
+ let light_xh = obj.clone(true);
|
|
|
+ light_xh.position.set(-18, 4, -27);
|
|
|
+ this.setLightName(light_xh, "light_xh");
|
|
|
+ rootNode.add(light_xh);
|
|
|
+ this.htmlLayer[8].position = light_xh.position;
|
|
|
+ // 海子井
|
|
|
+ let light_hzj = obj.clone(true);
|
|
|
+ light_hzj.position.set(-10, 2, -26);
|
|
|
+ this.setLightName(light_hzj, "light_hzj");
|
|
|
+ rootNode.add(light_hzj);
|
|
|
+ this.htmlLayer[9].position = light_hzj.position;
|
|
|
+
|
|
|
+ // 改变颜色
|
|
|
+ this.changeElColor(light_dwk, 'green'); // 大武口
|
|
|
+ this.changeElColor(light_pl, '离线'); // 平罗
|
|
|
+ this.changeElColor(light_mch, 'yx'); // 马场湖
|
|
|
+ this.changeElColor(light_xh, 'red'); // 宣和
|
|
|
+ this.changeElColor(light_hzj, '受累'); // 海子井
|
|
|
+ },
|
|
|
// 创建一个圆柱
|
|
|
initCylinderGeometry: function(position, cr=2) {
|
|
|
let geometry = new THREE.CylinderGeometry(cr, cr, 7, 64);
|
|
@@ -477,6 +602,7 @@ export default {
|
|
|
.three-model {
|
|
|
position: relative;
|
|
|
overflow: hidden;
|
|
|
+ left: -112px;
|
|
|
|
|
|
.map-3d {
|
|
|
position: absolute;
|