模型添加更新了
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
119042
public/devicesModel/dev2.obj
119042
public/devicesModel/dev2.obj
File diff suppressed because it is too large
Load Diff
275869
public/devicesModel/dev3.obj
275869
public/devicesModel/dev3.obj
File diff suppressed because it is too large
Load Diff
40418
public/devicesModel/fan.obj
Normal file
40418
public/devicesModel/fan.obj
Normal file
File diff suppressed because it is too large
Load Diff
35249
public/devicesModel/sensors.obj
Normal file
35249
public/devicesModel/sensors.obj
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
BIN
src/assets/images/tunnel/tunnel-length-icon.png
Normal file
BIN
src/assets/images/tunnel/tunnel-length-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -125,6 +125,13 @@ html, body, #app, .el-container, .el-aside, .el-main {
|
|||||||
background-image: url('../images/topAndDown/sp_icon_zyc.png');
|
background-image: url('../images/topAndDown/sp_icon_zyc.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tunnel-length{
|
||||||
|
position: absolute;
|
||||||
|
top: 13%;
|
||||||
|
left: 36%;
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
|
||||||
.shrink-left {
|
.shrink-left {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 1095px;
|
top: 1095px;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
CSS3DSprite,
|
CSS3DSprite,
|
||||||
} from "three/addons/renderers/CSS3DRenderer.js";
|
} from "three/addons/renderers/CSS3DRenderer.js";
|
||||||
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";
|
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";
|
||||||
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader"
|
|
||||||
import DevInfo from "./childComp/DevInfo.vue";
|
import DevInfo from "./childComp/DevInfo.vue";
|
||||||
import EditDev from "./childComp/EditDev.vue";
|
import EditDev from "./childComp/EditDev.vue";
|
||||||
import { onMounted, reactive, ref } from "vue";
|
import { onMounted, reactive, ref } from "vue";
|
||||||
@@ -33,7 +32,6 @@ const edit = ref(null);
|
|||||||
const num = 10000;
|
const num = 10000;
|
||||||
let demo; //定义demo全局变量
|
let demo; //定义demo全局变量
|
||||||
const loader = new OBJLoader();
|
const loader = new OBJLoader();
|
||||||
let hdrLoader = new RGBELoader();
|
|
||||||
let backColorSet = three.sRGBEncoding;
|
let backColorSet = three.sRGBEncoding;
|
||||||
// 模版挂载后
|
// 模版挂载后
|
||||||
onMounted(handleMounted);
|
onMounted(handleMounted);
|
||||||
@@ -49,18 +47,25 @@ async function handleMounted() {
|
|||||||
lClickCallback(demo); //左键回调
|
lClickCallback(demo); //左键回调
|
||||||
rClickCallback(demo); //右键回调
|
rClickCallback(demo); //右键回调
|
||||||
//加载HDR背景图片
|
//加载HDR背景图片
|
||||||
demo.loadBackground(hdrLoader, backColorSet)
|
demo.loadBackground(backColorSet)
|
||||||
// 初始化设备模型
|
// 初始化设备模型
|
||||||
try {
|
try {
|
||||||
const deviceList = [];
|
const deviceList = [];
|
||||||
let result = await loadModel("/devicesModel/Camera.obj");
|
let result = await loadModel("/devicesModel/camera.obj");
|
||||||
deviceList.push(result);
|
deviceList.push(result);
|
||||||
result = await loadModel("/devicesModel/box_device.obj");
|
modelEffectProcess(result);
|
||||||
|
result = await loadModel("/devicesModel/fan.obj");
|
||||||
deviceList.push(result);
|
deviceList.push(result);
|
||||||
result = await loadModel("/devicesModel/dev2.obj");
|
modelEffectProcess(result);
|
||||||
|
result = await loadModel("/devicesModel/sensors.obj");
|
||||||
deviceList.push(result);
|
deviceList.push(result);
|
||||||
result = await loadModel("/devicesModel/dev3.obj");
|
modelEffectProcess(result);
|
||||||
|
result = await loadModel("/devicesModel/sensors.obj");
|
||||||
deviceList.push(result);
|
deviceList.push(result);
|
||||||
|
modelEffectProcess(result);
|
||||||
|
result = await loadModel("/devicesModel/sensors.obj");
|
||||||
|
deviceList.push(result);
|
||||||
|
modelEffectProcess(result);
|
||||||
// 给对象初加载设备模型
|
// 给对象初加载设备模型
|
||||||
demo.initDevicesModel(deviceList);
|
demo.initDevicesModel(deviceList);
|
||||||
console.info("设备模型加载完毕");
|
console.info("设备模型加载完毕");
|
||||||
@@ -86,6 +91,15 @@ function loadModel(path) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function modelEffectProcess(model) {
|
||||||
|
model.traverse((v) => {
|
||||||
|
v.material = new three.MeshBasicMaterial
|
||||||
|
v.material.color = new three.Color(0xC0C0C0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let hasDevice = ref(true);
|
let hasDevice = ref(true);
|
||||||
let devInfo = reactive({
|
let devInfo = reactive({
|
||||||
meshId: null,
|
meshId: null,
|
||||||
|
|||||||
@@ -3,12 +3,8 @@
|
|||||||
<div class="title">编辑设备</div>
|
<div class="title">编辑设备</div>
|
||||||
<div class="divice-list">
|
<div class="divice-list">
|
||||||
<ul>
|
<ul>
|
||||||
<li
|
<li v-for="(item, key) of devicesList" :key="key" @click="checkDev(key)"
|
||||||
v-for="(item, key) of devicesList"
|
:class="{ 'li-active': checkIndex === key }">
|
||||||
:key="key"
|
|
||||||
@click="checkDev(key)"
|
|
||||||
:class="{ 'li-active': checkIndex === key }"
|
|
||||||
>
|
|
||||||
<img :src="item.devImgUrl" />
|
<img :src="item.devImgUrl" />
|
||||||
<div>{{ item.devName + key }}</div>
|
<div>{{ item.devName + key }}</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -28,12 +24,32 @@ const params = defineProps(["hasDev", "meshId"]);
|
|||||||
// 定义需要发射的事件
|
// 定义需要发射的事件
|
||||||
const emit = defineEmits(["addDev", "removeDev"]);
|
const emit = defineEmits(["addDev", "removeDev"]);
|
||||||
// 挂载后加所有的设备模型
|
// 挂载后加所有的设备模型
|
||||||
const devItem = {
|
const cameradevItem = {
|
||||||
devName: "传感器",
|
devName: "摄像头",
|
||||||
devImgUrl: "/images/camera.jpg",
|
devImgUrl: "/images/camera.jpg",
|
||||||
devState: "未开启",
|
devState: "未开启",
|
||||||
};
|
};
|
||||||
const list = [devItem, devItem, devItem, devItem];
|
const fandevItem = {
|
||||||
|
devName: "风机",
|
||||||
|
devImgUrl: "/images/camera.jpg",
|
||||||
|
devState: "未开启",
|
||||||
|
};
|
||||||
|
const WindsensorsdevItem = {
|
||||||
|
devName: "风压传感器",
|
||||||
|
devImgUrl: "/images/camera.jpg",
|
||||||
|
devState: "未开启",
|
||||||
|
};
|
||||||
|
const GassensorsdevItem = {
|
||||||
|
devName: "气体传感器",
|
||||||
|
devImgUrl: "/images/camera.jpg",
|
||||||
|
devState: "未开启",
|
||||||
|
};
|
||||||
|
const TemsensorsdevItem = {
|
||||||
|
devName: "温度传感器",
|
||||||
|
devImgUrl: "/images/camera.jpg",
|
||||||
|
devState: "未开启",
|
||||||
|
};
|
||||||
|
const list = [cameradevItem, fandevItem, WindsensorsdevItem, GassensorsdevItem, TemsensorsdevItem];
|
||||||
const devicesList = reactive(list);
|
const devicesList = reactive(list);
|
||||||
|
|
||||||
const checkIndex = ref(-1);
|
const checkIndex = ref(-1);
|
||||||
@@ -68,12 +84,15 @@ function removeDev() {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option-btn {
|
.option-btn {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -81,9 +100,11 @@ function removeDev() {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divice-list {
|
.divice-list {
|
||||||
height: 240px;
|
height: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divice-list ul {
|
.divice-list ul {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
@@ -92,12 +113,14 @@ function removeDev() {
|
|||||||
gap: 7px;
|
gap: 7px;
|
||||||
align-content: first baseline;
|
align-content: first baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divice-list ul li {
|
.divice-list ul li {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.li-active {
|
.li-active {
|
||||||
background: rgb(224, 114, 114);
|
background: rgb(224, 114, 114);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ export default function (devInfo) {
|
|||||||
const dev = this.deviceList[devInfo.checkIndex].clone(); //克隆对应的moxin
|
const dev = this.deviceList[devInfo.checkIndex].clone(); //克隆对应的moxin
|
||||||
const p = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
const p = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||||
dev.position.copy(p);
|
dev.position.copy(p);
|
||||||
|
// console.log(this.targetPoint);
|
||||||
|
modelEffectProcess(dev, this.targetPoint)
|
||||||
this.scene.add(dev);
|
this.scene.add(dev);
|
||||||
this.targetPoint.hasDevice = true; //标记还存在设备
|
this.targetPoint.hasDevice = true; //标记还存在设备
|
||||||
// 附着点记录信息
|
// 附着点记录信息
|
||||||
@@ -15,16 +17,35 @@ export default function (devInfo) {
|
|||||||
return this.targetPoint.info;
|
return this.targetPoint.info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modelEffectProcess(model, point) {
|
||||||
|
if (model.children[0].name == "camera") {
|
||||||
|
console.log(model);
|
||||||
|
console.log(point);
|
||||||
|
model.scale.set(0.1, 0.1, 0.1)
|
||||||
|
|
||||||
|
}
|
||||||
|
if (model.children[0].name == "fan") {
|
||||||
|
console.log(model);
|
||||||
|
console.log(point);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (model.children[0].name == "sensors") {
|
||||||
|
console.log(model);
|
||||||
|
console.log(point);
|
||||||
|
|
||||||
|
model.scale.set(0.2, 0.2, 0.2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function transformPosition(position, distance) {
|
function transformPosition(position, distance) {
|
||||||
return `${equal(position.charAt(position.lastIndexOf("_") + 1))}边隧道${equal(
|
return `${equal(position.charAt(position.lastIndexOf("_") + 1))}边隧道${equal(
|
||||||
position.charAt(position.lastIndexOf("_") + 2)
|
position.charAt(position.lastIndexOf("_") + 2)
|
||||||
)}侧设备约${
|
)}侧设备约${(Number(
|
||||||
(Number(
|
position.substring(position.indexOf("_") + 1, position.lastIndexOf("_"))
|
||||||
position.substring(position.indexOf("_") + 1, position.lastIndexOf("_"))
|
) +
|
||||||
) +
|
1) *
|
||||||
1) *
|
distance
|
||||||
distance
|
}米处`;
|
||||||
}米处`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function equal(str) {
|
function equal(str) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ function handleLoadedDevice(model) {
|
|||||||
const wp = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
const wp = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
|
||||||
model.position.copy(wp);
|
model.position.copy(wp);
|
||||||
this.targetPoint.visible = false;
|
this.targetPoint.visible = false;
|
||||||
|
model.scale = 0.1
|
||||||
|
|
||||||
this.scene.add(model);
|
this.scene.add(model);
|
||||||
if (model.name === "camera") {
|
if (model.name === "camera") {
|
||||||
@@ -20,6 +21,7 @@ function handleLoadedDevice(model) {
|
|||||||
model.translateZ(4);
|
model.translateZ(4);
|
||||||
model.translateY(-0.5);
|
model.translateY(-0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加的信息请求或初始化的信息
|
// 添加的信息请求或初始化的信息
|
||||||
this.targetPoint.info = {
|
this.targetPoint.info = {
|
||||||
name: "摄像头",
|
name: "摄像头",
|
||||||
|
|||||||
@@ -372,12 +372,7 @@ export default class Demo {
|
|||||||
setDistance(distance = 10) {
|
setDistance(distance = 10) {
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
}
|
}
|
||||||
loadBackground(hdrLoader, backColorSet) {
|
loadBackground(backColorSet) {
|
||||||
// hdrLoader.load("/images/background/background.hdr", (texture) => {
|
|
||||||
// texture.mapping = this.THREE.EquirectangularReflectionMapping;
|
|
||||||
// this.scene.background = texture;
|
|
||||||
// this.scene.environment = texture;
|
|
||||||
// })
|
|
||||||
this.scene.background = new this.THREE.TextureLoader().load("/images/background/background.png", function (texture) {
|
this.scene.background = new this.THREE.TextureLoader().load("/images/background/background.png", function (texture) {
|
||||||
texture.encoding = backColorSet;
|
texture.encoding = backColorSet;
|
||||||
});
|
});
|
||||||
|
|||||||
45
src/components/manageLength/index.vue
Normal file
45
src/components/manageLength/index.vue
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tunnel-length">
|
||||||
|
<!-- 加上点击事件 -->
|
||||||
|
<div class="tunnel-length-container">
|
||||||
|
<!-- 显示长度 -->
|
||||||
|
<div class="tunnel-length-font">当前长度:</div>
|
||||||
|
<!-- 包到下面的盒子 -->
|
||||||
|
<div>
|
||||||
|
<!-- 插入图片 -->
|
||||||
|
<div>
|
||||||
|
<img src="../../assets/images/tunnel/tunnel-length-icon.png" alt="">
|
||||||
|
<!-- 正方形覆盖 -->
|
||||||
|
<div></div>
|
||||||
|
<!-- 长方形覆盖 -->
|
||||||
|
<div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tunnel-length-container {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tunnel-length-font {
|
||||||
|
position: absolute;
|
||||||
|
left: 40%;
|
||||||
|
top: -33%;
|
||||||
|
color: #0BE9FA;
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="box-top">
|
<div class="box-top">
|
||||||
<manage-btn v-model="selectIndex" @select="manageSelect"/>
|
<manage-btn v-model="selectIndex" @select="manageSelect" />
|
||||||
<div class="tunnel-title"></div>
|
<div class="tunnel-title"></div>
|
||||||
|
<manage-length class="tunnel-length"></manage-length>
|
||||||
<div class="top-right">
|
<div class="top-right">
|
||||||
<div class="current-site">
|
<div class="current-site">
|
||||||
当前站点:<span>{{ currentSite }}</span>
|
当前站点:<span>{{ currentSite }}</span>
|
||||||
@@ -15,37 +16,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<tunnel-scene id="tunnel-box"/>
|
<tunnel-scene id="tunnel-box" />
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<el-drawer
|
<el-drawer v-model="drawerLeft" direction="ltr" modal-class="modal-box" :modal="false" :show-close="false"
|
||||||
v-model="drawerLeft"
|
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||||
direction="ltr"
|
<fan-info />
|
||||||
modal-class="modal-box"
|
<transducer-list />
|
||||||
:modal="false"
|
<used-ele />
|
||||||
:show-close="false"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
:close-on-press-escape="false"
|
|
||||||
>
|
|
||||||
<fan-info/>
|
|
||||||
<transducer-list/>
|
|
||||||
<used-ele/>
|
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
|
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
|
||||||
<div v-else class="shrink-left" @click="closeLeft"></div>
|
<div v-else class="shrink-left" @click="closeLeft"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<el-drawer
|
<el-drawer v-model="drawerRight" direction="rtl" modal-class="modal-box" :modal="false" :show-close="false"
|
||||||
v-model="drawerRight"
|
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||||
direction="rtl"
|
<wind-pressure-list />
|
||||||
modal-class="modal-box"
|
<air-info />
|
||||||
:modal="false"
|
<bad-gas-info />
|
||||||
:show-close="false"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
:close-on-press-escape="false"
|
|
||||||
>
|
|
||||||
<wind-pressure-list/>
|
|
||||||
<air-info/>
|
|
||||||
<bad-gas-info/>
|
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
|
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
|
||||||
<div v-else class="shrink-right" @click="closeRight"></div>
|
<div v-else class="shrink-right" @click="closeRight"></div>
|
||||||
@@ -55,7 +42,7 @@
|
|||||||
<div class="arrow" @click="previousBtn"></div>
|
<div class="arrow" @click="previousBtn"></div>
|
||||||
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false">
|
<el-carousel height="150px" type="card" ref="tunnelBtn" :autoplay="false">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<el-carousel-item v-for="(item,index) in tunnelList" :key="item.value">
|
<el-carousel-item v-for="(item, index) in tunnelList" :key="item.value">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</el-carousel-item>
|
</el-carousel-item>
|
||||||
</div>
|
</div>
|
||||||
@@ -76,8 +63,9 @@ import WindPressureList from "@/components/content/windPressure/WindPressureList
|
|||||||
import AirInfo from "@/components/content/airInfo/AirInfo.vue";
|
import AirInfo from "@/components/content/airInfo/AirInfo.vue";
|
||||||
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
|
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
|
||||||
import ManageBtn from "@/components/manageBtn/index.vue";
|
import ManageBtn from "@/components/manageBtn/index.vue";
|
||||||
import {dateFormat} from "@/utils/date.js";
|
import ManageLength from "@/components/manageLength/index.vue";
|
||||||
import {useAuthStore} from '@/store/userstore.js'
|
import { dateFormat } from "@/utils/date.js";
|
||||||
|
import { useAuthStore } from '@/store/userstore.js'
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -87,7 +75,7 @@ const drawerRight = ref(true)
|
|||||||
const currentSite = ref('松江站')
|
const currentSite = ref('松江站')
|
||||||
const currentUser = ref('admin')
|
const currentUser = ref('admin')
|
||||||
const currentDate = ref(dateFormat())
|
const currentDate = ref(dateFormat())
|
||||||
const tunnelBtn=ref()
|
const tunnelBtn = ref()
|
||||||
const tunnelList = ref([
|
const tunnelList = ref([
|
||||||
{
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
@@ -135,6 +123,4 @@ const nextBtn = () => {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user