BIM管理

dev_xd
lj7788@126.com 2025-07-25 18:52:01 +08:00
parent add9f6a97a
commit e1891fbfa0
9 changed files with 496 additions and 114 deletions

View File

@ -255,7 +255,14 @@ function addModel(that, modelId, cb) {
});
}
that.modelLoaded = true;
that.initPlay();
let fnInit=()=>{
if(that.planLoaded){
that.initPlay();
}else{
setTimeout(fnInit,100);
}
};
fnInit();
}, 1000);
}
);
@ -279,6 +286,7 @@ function showBim(that, index) {
});
}
}
console.log(index,showFeatureIds,currFeatureIds)
if (showFeatureIds.length > 0) {
setFeatueVisible(showFeatureIds, true);
}

View File

@ -98,6 +98,7 @@ export default {
playTime: 500,
showPlan: true,
lastFeatureIds: [],
planLoaded:false,
};
},
beforeDestroy() {
@ -174,11 +175,13 @@ export default {
this.showPlan = !this.showPlan;
},
initPlay() {
if (!bim4DTools.getFirstFeatureId(this)) {
this.$message.error("未配置计划进度,无法播放!");
return;
}
let playIndex = bim4DTools.getCurrentTaskIndex(this);
console.log("--初始化播放---",playIndex)
if (playIndex > 0) {
bim4DTools.preparePlay(this);
this.doPlayPan(playIndex);
@ -211,6 +214,7 @@ export default {
return o;
});
this.hasLoad = true;
this.planLoaded=true;
});
}
},

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,13 @@
<script src="/cdn/echarts/echarts.min.js"></script>
<script src="/cdn/bim/sapi/BIMGISEngine.js"></script>
<script src="/cdn/bim/sapi/config.js?v=20240415"></script>
<link rel="stylesheet" href="/cesium/Widgets/widgets.css" />
<!-- <script src="/cesium/jquery-3.0.0.min.js"></script> -->
<script src="/cesium/Cesium.js?v=20230913"></script>
<script src="/cesium/BIMGISEngine-min.js?v=20230920"></script>
<script src="/cesium/initApi.js?v=20230920"></script>
<!--[if lt IE 11
]><script>
window.location.href = "/html/ie.html";

View File

@ -43,6 +43,8 @@
<script>
import { ElMessage, ElTooltip } from 'element-plus';
import { updateBimModel } from "@/api/bim/bimModel"
import SAPITools from './sapiTools.js'
import APITools from './apiTools.js'
export default {
props: {
me: {
@ -74,33 +76,11 @@ export default {
methods: {
doModelMove() {
ElMessage.info("左键单击选择移动位置,右键单击结束操作!");
let that = this;
api.Public.event("LEFT_CLICK", ((n) => {
api.Public.pickupCoordinate(true, ((n) => {
api.Public.convertWorldToCartographicLocation(n, m => {
api.Model.moveToPosition(m, 0, this.modelId)
if (this.saveData.rotateZ != 0) {
api.Model.rotate(0, 0, this.saveData.rotateZ, this.modelId)
}
that.movePoint = m;
});
}
))
if(this.me.bimCfg.clientApi){
APITools.moveToPosition(this);
}else{
APITools.moveToPosition(this);
}
)),
api.Public.event("RIGHT_CLICK", ((n) => {
api.Public.clearHandler(),
api.Public.pickupCoordinate(false);
ElMessage.info("已结束模型移动!"),
that.activeMenu = -1;
let pt = that.movePoint;
this.form.x = pt[0]
this.form.y = pt[1]
this.form.z = pt[2]
this.saveData.x = this.form.x;
this.saveData.y = this.form.y;
this.saveData.z = this.form.z;
}));
},
onCancel() {
this.resetPosition();

View File

@ -0,0 +1,64 @@
import { ElMessage, ElTooltip } from 'element-plus';
//初始化
function initEngine(that) {
let opt = {
container: "bimSettingContainer", //[必须]容器id
showfps: false, //[可选]显示fps
openearth: true, //[可选]开启gis场景
// imageryprovider: "tianditu_image", //[可选]gis底图
openterrain: false, //[可选]开启gis地形
maxspaceerror: 5000, //[可选]模型可视距离; 建议设置常规BIM时3000或更大、BIM启用LOD时100~1000、倾斜摄影,点云数据时0.1~0.5
loading: false, //[可选]gis模式加载动画
bgcolor: "#87CEFA", //[可选]bim模式场景背景色
selectedcolor: "#FFFF00", //[可选]选中构件颜色
throughwall: true, //[可选]相机是否穿墙
sitepath: "../Cesium/",//[可选]设置天空盒路径指向Cesium文件夹
editmode: true, //[可选]是否开启编辑模式
searchbox: true, //[可选]gis模型是否显示搜索框
mapbox: true, //[可选]gis模型是否显示地图选择
isRequestWebgl2: true, //[可选]是否使用webgl2进行渲染
colorBlendMode: 1, //0:HIGHLIGHT 1:REPLACE 2:MIX ,构件选中后的着色模式
secretkey: window.config.secretKey,
language: "zh-CN", // 语言国际化 中文简体(zh-CN)、中文繁体(zh-TW)、英文(en), 默认中文简体
targetFrameRate: 20, //目标渲染帧率 默认20
};
window.api = new API(opt);
console.log("初始化成功");
if (that.bimCfg.showGis) {
that.showGis = true;
that.doChangeGis();
} else if (that.bimCfg.background) {
api.Public.setGisState(false, that.bimCfg.background);
}
}
//模型偏移管理
function doModelMove(that) {
api.Public.pickupCoordinate(false);
api.Public.event("LEFT_CLICK", (t) => {
api.Feature.GetFeatureByEvent(t.position, e => {
if (e && e["id"]) {
let modelId = e.id.split("^")[0];
that.showMove = true;
that.$refs.moveModel.initData(modelId)
} else {
ElMessage.warning("请在模型上选点!");
}
});
});
}
//在地图上移动模型
function moveToPosition(that){
api.Public.event("LEFT_CLICK",(n)=>{
api.Public.pickupCoordinate(n.position,e=>{
api.Public.convertWorldToCartographicLocation(e,m=>{
console.log(e,m)
});
});
});
}
export default {
initEngine,
doModelMove,
moveToPosition
}

View File

@ -81,6 +81,8 @@ import MoveModel from "./MoveModel.vue";
import HideFeature from "./HideFeature.vue";
import { ElMessage, ElTooltip } from 'element-plus';
import { getProjectBimConfig } from "@/api/manage/proProjectInfo.js";
import SAPITools from './sapiTools.js'
import APITools from './apiTools.js'
export default {
components: {
ModelFloorTree,
@ -126,7 +128,7 @@ export default {
this.currentPrjId = this.userStore.currentPrjId;
this.currentComId = this.userStore.currentComId;
this.initLoadModel();
this.initEngine();
getProjectBimConfig(this.currentPrjId).then(d => {
let config = this.$tryToJson(d.msg, {});
this.bimCfg = {
@ -134,6 +136,11 @@ export default {
showGis: config.showGis || false,
clientApi: config.clientApi || false
}
if (this.bimCfg.clientApi) {
APITools.initEngine(this);
} else {
SAPITools.initEngine(this);
}
});
},
methods: {
@ -149,9 +156,13 @@ export default {
},
doChangeGis() {
if (this.showGis) {
api.Public.setGisState(true);
api.Public.setTerrainState(false, "http://113.201.2.107:9304/layer.json", false)
api.Public.setGisState(true);
if (this.bimCfg.clientApi) {
api.Public.setGisState(true);
} else {
api.Public.setGisState(true);
api.Public.setTerrainState(false, "http://113.201.2.107:9304/layer.json", false)
api.Public.setGisState(true);
}
} else {
let color = this.bimCfg.background || "rgba(135 ,206 ,250,1)"
api.Public.setGisState(false, color);
@ -228,19 +239,11 @@ export default {
},
doModelMove() {
ElMessage.info("请在场景中选择要移动的模型!");
api.Public.pickupCoordinate(false);
api.Public.event("LEFT_CLICK", (e) => {
api.Feature.getByPosition([e.x, e.y], (n) => {
if (n && n["id"]) {
let modelId = n.id.split("^")[0];
this.showMove = true;
this.$refs.moveModel.initData(modelId)
} else {
ElMessage.warning("请在模型上选点!");
}
});
});
if(this.bimCfg.clientApi){
APITools.doModelMove(this);
}else{
SAPITools.doModelMove(this);
}
},
NotificationPopup(parameter) {
@ -254,61 +257,7 @@ export default {
notifClose() {
this.activeMenu = -1;
},
initEngine() {
window.api = new SAPI(
{
serverIP: window.config.serverIP, //ip
port: window.config.port, //HTTP
useHttps: window.config.useHttps, //使Https
container: "bimSettingContainer", //[]id
secretKey: window.config.secretKey,
openEarth: window.config.openEarth, //[]Gis
bgColor: window.config.bgColor, //[]bim,
tintColor: window.config.tintColor, //[]osgb
sceneTime: window.config.sceneTime, //[]
cadMode: window.config.cadMode, // Cad
},
() => {
this.initSuccess = true;
console.log("初始化成功");
let mapOptions = {
imgs: {
//
top: "/cdn/bim/sapi/img/top.png",
bottom: "/cdn/bim/sapi/img/under.png",
east: "/cdn/bim/sapi/img/east.png",
south: "/cdn/bim/sapi/img/south.png",
west: "/cdn/bim/sapi/img/west.png",
north: "/cdn/bim/sapi/img/north.png",
},
offset: {
//
corner: GLENavigationCube.RightTop,
x: 25,
y: 20,
},
cube: {
hoverColor: "#7193dc", //
size: 32, //
hotPointSize: 7, //
cubeTextColor: "#4c4c4ccc", // cube
cubeStrokeColor: "#374769cc", // cube
cubeFillColor: "#374769cc", // cube
},
zoomRatios: 1, //
show: true, //
showAxes: true, // XYZ线
};
api.Plugin.initNavCube(mapOptions);
if (this.bimCfg.showGis) {
this.showGis = true;
this.doChangeGis();
} else if (this.bimCfg.background) {
api.Public.setGisState(false, this.bimCfg.background);
}
}
);
},
initLoadModel() {
getDefaultViewPoint(this.currentPrjId, 1).then(d => {
let pt = "";

View File

@ -0,0 +1,109 @@
import { ElMessage, ElTooltip } from 'element-plus';
//初始化
function initEngine(that) {
window.api = new SAPI(
{
serverIP: window.config.serverIP, //服务ip地址
port: window.config.port, //HTTP端口
useHttps: window.config.useHttps, //使用Https
container: "bimSettingContainer", //[必须]容器id
secretKey: window.config.secretKey,
openEarth: window.config.openEarth, //[可选]开启Gis场景
bgColor: window.config.bgColor, //[可选]bim场景背景色, 传值即为纯色天空盒
tintColor: window.config.tintColor, //[可选]osgb单体化颜色
sceneTime: window.config.sceneTime, //[可选]分别为当前时间、日出时间、日落时间
cadMode: window.config.cadMode, // 是否是Cad图纸预览模式
},
() => {
that.initSuccess = true;
console.log("初始化成功");
let mapOptions = {
imgs: {
// 六面图片
top: "/cdn/bim/sapi/img/top.png",
bottom: "/cdn/bim/sapi/img/under.png",
east: "/cdn/bim/sapi/img/east.png",
south: "/cdn/bim/sapi/img/south.png",
west: "/cdn/bim/sapi/img/west.png",
north: "/cdn/bim/sapi/img/north.png",
},
offset: {
// 屏幕坐标偏移
corner: GLENavigationCube.RightTop,
x: 25,
y: 20,
},
cube: {
hoverColor: "#7193dc", // 立方导航快鼠标移过显示颜色
size: 32, // 导航立方尺寸
hotPointSize: 7, // 导航立方棱角热点区域尺寸
cubeTextColor: "#4c4c4ccc", // cube 各个面文字颜色
cubeStrokeColor: "#374769cc", // cube 各个面边框颜色
cubeFillColor: "#374769cc", // cube 各个面填充颜色
},
zoomRatios: 1, // 缩放倍率
show: true, // 是否显示
showAxes: true, // 是否显示XYZ轴线
};
api.Plugin.initNavCube(mapOptions);
if (that.bimCfg.showGis) {
that.showGis = true;
that.doChangeGis();
} else if (that.bimCfg.background) {
api.Public.setGisState(false, that.bimCfg.background);
}
}
);
}
//模型偏移管理
function doModelMove(that) {
api.Public.pickupCoordinate(false);
api.Public.event("LEFT_CLICK", (e) => {
api.Feature.getByPosition([e.x, e.y], (n) => {
if (n && n["id"]) {
let modelId = n.id.split("^")[0];
that.showMove = true;
that.$refs.moveModel.initData(modelId)
} else {
ElMessage.warning("请在模型上选点!");
}
});
});
}
//在地图上移动模型
function moveToPosition(that){
api.Public.event("LEFT_CLICK", ((n) => {
api.Public.pickupCoordinate(true, ((n) => {
api.Public.convertWorldToCartographicLocation(n, m => {
api.Model.moveToPosition(m, 0, that.modelId)
if (that.saveData.rotateZ != 0) {
api.Model.rotate(0, 0, that.saveData.rotateZ, that.modelId)
}
that.movePoint = m;
});
}
))
}
)),
api.Public.event("RIGHT_CLICK", ((n) => {
api.Public.clearHandler(),
api.Public.pickupCoordinate(false);
ElMessage.info("已结束模型移动!"),
that.activeMenu = -1;
let pt = that.movePoint;
that.form.x = pt[0]
that.form.y = pt[1]
that.form.z = pt[2]
that.saveData.x = that.form.x;
that.saveData.y = that.form.y;
that.saveData.z = that.form.z;
}));
}
export default {
initEngine,
doModelMove,
moveToPosition
}

View File

@ -54,6 +54,20 @@ export default defineConfig(({ mode, command }) => {
"^/statics": "/",
},
},
"/cesium": {
target: `http://62.234.3.186`,
changeOrigin: true,
pathRewrite: {
"^/cesium": "/",
},
},
"/bimdata": {
target: `http://62.234.3.186`,
changeOrigin: true,
pathRewrite: {
"^/bimdata": "/",
},
},
"/cdn": {
target: `http://62.234.3.186`,
changeOrigin: true,