Skip to content

Commit 743f946

Browse files
committed
v3.3.13
1 parent 7f3b19c commit 743f946

177 files changed

Lines changed: 2011 additions & 2035 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = {
4040
netcdfjs: "readonly",
4141
ol: "readonly",
4242
olcs: "readonly",
43+
mapv: "readonly",
4344

4445
map: "readonly",
4546
$: false,

js/index.js

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
"use script"; //开发环境建议开启严格模式
1+
"use script" //开发环境建议开启严格模式
22
//系统主入口
33

4-
var map; //地球对象
5-
var request; //传入的get参数
4+
var map //地球对象
5+
var request //传入的get参数
66

77
//地图
88
$(document).ready(function () {
99
//判断webgl支持
1010
if (!mars3d.Util.webglreport()) {
11-
mars3d.Util.webglerror();
11+
mars3d.Util.webglerror()
1212
}
1313

1414
//记录url传入参数
15-
request = haoutil.system.getRequest();
15+
request = haoutil.system.getRequest()
1616
if (window.top) {
1717
//有父级
18-
request = $.extend(request, haoutil.system.getRequest(window.top));
18+
request = $.extend(request, haoutil.system.getRequest(window.top))
1919
}
2020

21-
var configfile = "config/config.json"; //默认地址
21+
var configfile = "config/config.json" //默认地址
2222
if (request.config) {
2323
//url传入地址
24-
configfile = request.config;
24+
configfile = request.config
2525
}
2626

27-
haoutil.loading.show();
27+
haoutil.loading.show()
2828

2929
$.ajax({
3030
type: "get",
3131
dataType: "json",
3232
url: configfile,
3333
timeout: 0,
3434
success: function (data) {
35-
haoutil.loading.hide();
35+
haoutil.loading.hide()
3636

3737
//构建地图
38-
initMap(data.map3d);
38+
initMap(data.map3d)
3939

40-
setTimeout(removeMask, 3000); //欢迎UI关闭处理
40+
setTimeout(removeMask, 3000) //欢迎UI关闭处理
4141
},
4242
error: function (request, textStatus) {
43-
removeMask();
44-
haoutil.loading.hide();
45-
haoutil.alert("1.请检查文件内 json 语法是否存在问题。<br />2.请在浏览器输入文件url测试是否可以访问。", configfile + " 文件加载失败");
46-
console.log(textStatus, request);
47-
},
48-
});
43+
removeMask()
44+
haoutil.loading.hide()
45+
haoutil.alert("1.请检查文件内 json 语法是否存在问题。<br />2.请在浏览器输入文件url测试是否可以访问。", configfile + " 文件加载失败")
46+
console.log(textStatus, request)
47+
}
48+
})
4949

50-
initUI();
51-
});
50+
initUI()
51+
})
5252

5353
function removeMask() {
54-
$("#mask").remove();
54+
$("#mask").remove()
5555
}
5656

5757
//UI界面相关
5858
function initUI() {
59-
haoutil.oneMsg("首次访问系统无缓存会略慢,请耐心等待!", "load3d_tip");
59+
haoutil.oneMsg("首次访问系统无缓存会略慢,请耐心等待!", "load3d_tip")
6060
}
6161

6262
//初始化地图
@@ -65,43 +65,43 @@ function initMap(mapOptions) {
6565
// mapOptions = mars3d.Util.merge(mapOptions, {})
6666

6767
//创建三维地球场景
68-
map = new mars3d.Map("mars3dContainer", mapOptions);
68+
map = new mars3d.Map("mars3dContainer", mapOptions)
6969

7070
//构造widget
71-
initWidget(map);
71+
initWidget(map)
7272

7373
//如果有xyz传参,进行定位
7474
if (haoutil.isutil.isNotNull(request.x) && haoutil.isutil.isNotNull(request.y)) {
75-
map.setCameraView(request, { duration: 0, isWgs84: true });
75+
map.setCameraView(request, { duration: 0, isWgs84: true })
7676
}
7777

7878
//开场动画
7979
if (window.location.hostname.indexOf("127.0.0.1") == -1) {
80-
map.openFlyAnimation();
80+
map.openFlyAnimation()
8181
}
8282

8383
//针对不同终端的优化配置
8484
if (mars3d.Util.isPCBroswer()) {
85-
map.zoomFactor = 2.0; // 鼠标滚轮放大的步长参数
85+
map.zoomFactor = 2.0 // 鼠标滚轮放大的步长参数
8686

8787
// IE浏览器优化
8888
if (window.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
89-
map.viewer.targetFrameRate = 20; // 限制帧率
90-
map.scene.requestRenderMode = false; // 取消实时渲染
89+
map.viewer.targetFrameRate = 20 // 限制帧率
90+
map.scene.requestRenderMode = false // 取消实时渲染
9191
}
9292
} else {
93-
map.zoomFactor = 5.0; // 鼠标滚轮放大的步长参数
93+
map.zoomFactor = 5.0 // 鼠标滚轮放大的步长参数
9494

9595
// 移动设备上禁掉以下几个选项,可以相对更加流畅
96-
map.scene.requestRenderMode = false; // 取消实时渲染
97-
map.scene.fog.enabled = false;
98-
map.scene.skyAtmosphere.show = false;
99-
map.scene.globe.showGroundAtmosphere = false;
96+
map.scene.requestRenderMode = false // 取消实时渲染
97+
map.scene.fog.enabled = false
98+
map.scene.skyAtmosphere.show = false
99+
map.scene.globe.showGroundAtmosphere = false
100100
}
101101

102102
//二三维切换不用动画
103103
if (map.sceneModePicker) {
104-
map.sceneModePicker.viewModel.duration = 0.0;
104+
map.sceneModePicker.viewModel.duration = 0.0
105105
}
106106

107107
//webgl渲染失败后,刷新页面
@@ -110,56 +110,56 @@ function initMap(mapOptions) {
110110
// });
111111

112112
//绑定单击显示BIM的构件树
113-
bindShowTilesParts();
113+
bindShowTilesParts()
114114

115115
//下面可以继续加项目相关的其他代码
116116

117117
//演示:接收的widget内抛出的事件
118118
mars3d.widget.on("centerXY", function (event) {
119-
console.log("在widget进行了坐标定位", event);
120-
});
119+
console.log("在widget进行了坐标定位", event)
120+
})
121121
}
122122

123123
//初始化widget相关
124124
function initWidget(map) {
125-
haoutil.loading.show();
125+
haoutil.loading.show()
126126

127127
$.ajax({
128128
type: "get",
129129
dataType: "json",
130130
url: "config/widget.json",
131131
timeout: 0,
132132
success: function (widgetCfg) {
133-
haoutil.loading.hide();
133+
haoutil.loading.hide()
134134

135135
//url如果有传参时的处理
136136
if (haoutil.isutil.isNotNull(request.widget)) {
137137
if (request.onlyStart) {
138-
widgetCfg.openAtStart = [];
138+
widgetCfg.openAtStart = []
139139
}
140140
widgetCfg.openAtStart.push({
141141
uri: request.widget,
142142
name: request.name || "",
143143
windowOptions: {
144-
closeBtn: !request.onlyStart,
144+
closeBtn: !request.onlyStart
145145
},
146-
request: request,
147-
});
148-
map.flyHome({ duration: 0 });
146+
request: request
147+
})
148+
map.flyHome({ duration: 0 })
149149
}
150150
//初始化widget管理器
151-
mars3d.widget.init(map, widgetCfg, "./"); //tip: 第3个参数支持定义widget目录的相对路径。
151+
mars3d.widget.init(map, widgetCfg, "./") //tip: 第3个参数支持定义widget目录的相对路径。
152152

153153
if (window.lastWidgetItem) {
154-
activateWidget(lastWidgetItem);
155-
lastWidgetItem = null;
154+
activateWidget(lastWidgetItem)
155+
lastWidgetItem = null
156156
}
157157
},
158158
error: function (XMLHttpRequest, textStatus, errorThrown) {
159-
haoutil.loading.hide();
160-
haoutil.alert("config/widget.json文件加载失败!");
161-
},
162-
});
159+
haoutil.loading.hide()
160+
haoutil.alert("config/widget.json文件加载失败!")
161+
}
162+
})
163163

164164
//widget相关事件监听
165165
// mars3d.widget.on(mars3d.widget.EventType.load, function (event) {
@@ -169,11 +169,11 @@ function initWidget(map) {
169169
// console.log("创建了widet", event);
170170
// })
171171
mars3d.widget.on(mars3d.widget.EventType.activated, function (event) {
172-
console.log("激活了widget", event);
173-
});
172+
console.log("激活了widget", event)
173+
})
174174
mars3d.widget.on(mars3d.widget.EventType.disabled, function (event) {
175-
console.log("释放了widget", event);
176-
});
175+
console.log("释放了widget", event)
176+
})
177177
}
178178

179179
//bim构件的处理
@@ -182,51 +182,51 @@ function bindShowTilesParts() {
182182
map.on(mars3d.EventType.clickGraphic, function (event) {
183183
if (!(event.pickedObject instanceof Cesium.Cesium3DTileFeature)) {
184184
//不是BIM数据时跳出
185-
return;
185+
return
186186
}
187187

188-
let layer = event.layer;
188+
let layer = event.layer
189189
if (!layer.options.scenetree) {
190190
//未配置scenetree时跳出
191-
return;
191+
return
192192
}
193193

194-
var tilesParts = "widgets/tilesParts/widget.js";
194+
var tilesParts = "widgets/tilesParts/widget.js"
195195

196196
if (mars3d.widget.isActivate(tilesParts)) {
197-
var parts = mars3d.widget.getClass(tilesParts);
197+
var parts = mars3d.widget.getClass(tilesParts)
198198
if (parts.config.layerCfg == layer.options) {
199199
//当前已激活,并且单击了相同模型时跳出
200-
return;
200+
return
201201
}
202202
}
203203

204204
mars3d.widget.activate({
205205
name: layer.name + " 构件",
206206
uri: tilesParts,
207207
layerCfg: layer.options,
208-
disableOther: false,
209-
});
210-
});
208+
disableOther: false
209+
})
210+
})
211211
}
212212

213213
//外部页面调用
214-
var lastWidgetItem;
214+
var lastWidgetItem
215215
function activateWidget(item) {
216216
if (!map) {
217-
lastWidgetItem = item;
218-
return;
217+
lastWidgetItem = item
218+
return
219219
}
220-
mars3d.widget.activate(item);
220+
mars3d.widget.activate(item)
221221
}
222222
function disableWidget(item) {
223-
mars3d.widget.disable(item);
223+
mars3d.widget.disable(item)
224224
}
225225
function activateFunByMenu(fun) {
226-
eval(fun);
226+
eval(fun)
227227
}
228228

229229
function goHome() {
230-
mars3d.widget.disableAll();
231-
map.flyHome();
230+
mars3d.widget.disableAll()
231+
map.flyHome()
232232
}

0 commit comments

Comments
 (0)