65 lines
2.8 KiB
JavaScript
65 lines
2.8 KiB
JavaScript
function loadEngine(that, elId, apiName, cb) {
|
|
console.log("开始初始化...");
|
|
window[apiName] = new SAPI(
|
|
{
|
|
serverIP: window.config.serverIP, //服务ip地址
|
|
port: window.config.port, //HTTP端口
|
|
useHttps: window.config.useHttps, //使用Https
|
|
container: elId, //[必须]容器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("初始化成功");
|
|
setTimeout(() => {
|
|
cb && cb();
|
|
}, 1000);
|
|
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轴线
|
|
};
|
|
let api = window[apiName]
|
|
api.Plugin.initNavCube(mapOptions);
|
|
if (that.bimCfg.showGis) {
|
|
api.Public.setGisState(true);
|
|
api.Public.setTerrainState(false, "http://113.201.2.107:9304/layer.json", false)
|
|
api.Public.setGisState(true);
|
|
} else if (that.bimCfg.background) {
|
|
api.Public.setGisState(false, that.bimCfg.background);
|
|
}
|
|
}
|
|
);
|
|
}
|
|
|
|
export default {
|
|
loadEngine
|
|
} |