egovamap 0.35.21 → 0.35.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +16 -16
- package/egovamap/EGovaScene.js +195 -195
- package/egovamap/GeometryTrans.js +96 -96
- package/egovamap/RingsConvert.js +181 -181
- package/egovamap/coordconvert/CoordConvConfig.js +7 -7
- package/egovamap/egovaglobe.js +12 -0
- package/egovamap/egovamap.css +97 -97
- package/egovamap/egovamapMEx.js +2 -1
- package/egovamap/egovamms.js +566 -566
- package/egovamap/egovamobile.js +1 -0
- package/egovamap/globe.html +34 -34
- package/egovamap/globe.jsp +17 -17
- package/egovamap/map.html +47 -47
- package/egovamap/map.jsp +58 -58
- package/egovamap/mapUtils.js +543 -543
- package/egovamap/mapswich.css +157 -157
- package/egovamap/mapswich.js +165 -165
- package/egovamap/mms.jsp +71 -71
- package/index.js +2 -2
- package/map.html +72 -72
- package/package.json +1 -1
package/egovamap/egovamms.js
CHANGED
|
@@ -1,566 +1,566 @@
|
|
|
1
|
-
var scene = null;
|
|
2
|
-
|
|
3
|
-
function checkServerURL(url, callback) {
|
|
4
|
-
var proxyList = url.split(";");
|
|
5
|
-
if (proxyList.length <= 1) {
|
|
6
|
-
eUrban.global.mmsServerURL = url;
|
|
7
|
-
callback();
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
var params = { isLoad: false };
|
|
11
|
-
for (var i in proxyList) {
|
|
12
|
-
checkProxy(proxyList[i], params, callback);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function checkProxy(proxyUrl, params, callback) {
|
|
17
|
-
var img = new Image();
|
|
18
|
-
if (proxyUrl.indexOf("http://") < 0) {
|
|
19
|
-
proxyUrl = window.location.origin + "/" + proxyUrl;
|
|
20
|
-
}
|
|
21
|
-
img.src = proxyUrl + "/symbol/1_1_1.png";
|
|
22
|
-
img.onload = function (e1) {
|
|
23
|
-
if (!params.isLoad) {
|
|
24
|
-
params.isLoad = true;
|
|
25
|
-
eUrban.global.mmsServerURL = proxyUrl;
|
|
26
|
-
callback();
|
|
27
|
-
}
|
|
28
|
-
img = null;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var EGovaMMSMap = function (
|
|
33
|
-
$container,
|
|
34
|
-
pScene,
|
|
35
|
-
prefix,
|
|
36
|
-
mmsParams,
|
|
37
|
-
mapConfig,
|
|
38
|
-
mmsType
|
|
39
|
-
) {
|
|
40
|
-
var that = this;
|
|
41
|
-
scene = pScene;
|
|
42
|
-
var parentScene = "parentScene" || "MMSMap";
|
|
43
|
-
var msgPrefix = prefix || "MMS";
|
|
44
|
-
var proxyURL = eUrban.global.rootPath + "/home/gis/proxy.htm";
|
|
45
|
-
|
|
46
|
-
that.mmsVisible = false;
|
|
47
|
-
that.mmsLoaded = false;
|
|
48
|
-
that.isLoading = false;
|
|
49
|
-
that.mapConfig = mapConfig;
|
|
50
|
-
that.mmsType = mmsType;
|
|
51
|
-
that.$mmsMapFrame = null;
|
|
52
|
-
that.mmsMapContainer = null;
|
|
53
|
-
that.mapContainer = null;
|
|
54
|
-
that.curPointX = null;
|
|
55
|
-
that.curPointY = null;
|
|
56
|
-
that.mmsMapContainer =
|
|
57
|
-
$container.getElementsByClassName(".mmsmap-container")[0];
|
|
58
|
-
|
|
59
|
-
if (that.mmsMapContainer) {
|
|
60
|
-
var mmsMapHTML =
|
|
61
|
-
'<iframe class="mmsmap-iframe" webkitAllowFullScreen="true" mozallowfullscreen="true" allowFullScreen="true"></iframe>';
|
|
62
|
-
var element = document.createElement("div");
|
|
63
|
-
element.classList.add("mmsmap-container");
|
|
64
|
-
element.innerHTML = mmsMapHTML;
|
|
65
|
-
$container.appendChild(element);
|
|
66
|
-
that.mmsMapContainer = element;
|
|
67
|
-
}
|
|
68
|
-
that.$mmsMapFrame =
|
|
69
|
-
that.mmsMapContainer.getElementsByClassName("mmsmap-iframe")[0];
|
|
70
|
-
that.mapContainer = $container.getElementsByClassName("emap-container")[0];
|
|
71
|
-
|
|
72
|
-
that.init = function () {
|
|
73
|
-
if (!that.isLoading) {
|
|
74
|
-
that.isLoading = true;
|
|
75
|
-
if (that.mmsType == 1) {
|
|
76
|
-
checkServerURL(mmsParams.mmsServerURL, function () {
|
|
77
|
-
var mmsAPIURL =
|
|
78
|
-
eUrban.global.mmsServerURL +
|
|
79
|
-
"/library/mms/api/MMSAPI.js";
|
|
80
|
-
var mmsCCDPicURL =
|
|
81
|
-
eUrban.global.mmsServerURL + "/mmspic/Image";
|
|
82
|
-
var mmsSymbolURL = eUrban.global.mmsServerURL + "/symbol";
|
|
83
|
-
var mmsWsdlURL =
|
|
84
|
-
eUrban.global.mmsServerURL + "/ws/MMSInspector?wsdl";
|
|
85
|
-
|
|
86
|
-
var mmsConfig = {
|
|
87
|
-
panoID: "eGovaMMS",
|
|
88
|
-
mmsApiUrl: mmsAPIURL,
|
|
89
|
-
mmsServerUrl: eUrban.global.mmsServerURL,
|
|
90
|
-
mmsPicUrl: mmsCCDPicURL,
|
|
91
|
-
mmsSymbolUrl: mmsSymbolURL,
|
|
92
|
-
mediaRootUrl: mmsParams.mmsMediaURL,
|
|
93
|
-
mmsWsdlUrl: mmsWsdlURL,
|
|
94
|
-
proxyUrl: proxyURL,
|
|
95
|
-
};
|
|
96
|
-
var prefix =
|
|
97
|
-
"msgPrefix=" +
|
|
98
|
-
msgPrefix +
|
|
99
|
-
"&parentScene=" +
|
|
100
|
-
parentScene +
|
|
101
|
-
"&proxyUrl=" +
|
|
102
|
-
proxyURL;
|
|
103
|
-
for (var item in mmsConfig) {
|
|
104
|
-
prefix += "&" + item + "=" + mmsConfig[item];
|
|
105
|
-
}
|
|
106
|
-
if (typeof mmsParams.simpleMode !== "undefined") {
|
|
107
|
-
prefix = prefix + "&simpleMode=true";
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
//违建系统无底部工具栏
|
|
111
|
-
var pageUrl = window.document.URL;
|
|
112
|
-
var bottom = 20;
|
|
113
|
-
if (pageUrl.indexOf("ibmain") > 0) {
|
|
114
|
-
bottom = -10;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
var mmsMapUrl =
|
|
118
|
-
eUrban.global.rootPath +
|
|
119
|
-
"/library/urban/egovamap/mms.jsp?" +
|
|
120
|
-
prefix;
|
|
121
|
-
if (
|
|
122
|
-
msgPrefix == "mappage0" ||
|
|
123
|
-
msgPrefix == "egovamappage0_gis"
|
|
124
|
-
) {
|
|
125
|
-
//仅主页上的实景设置控件样式
|
|
126
|
-
mmsMapUrl +=
|
|
127
|
-
"&navi={visible:true,left:20,top:60}&toolbar={visible:true,top:60}&footer={visible:true,bottom:" +
|
|
128
|
-
bottom +
|
|
129
|
-
"}&toolBarDefine=104,105";
|
|
130
|
-
} else {
|
|
131
|
-
mmsMapUrl +=
|
|
132
|
-
"&navi={visible:true,left:10,top:20}&toolbar={visible:true,top:20}&toolBarDefine=104,105";
|
|
133
|
-
}
|
|
134
|
-
var encodeUrl = encodeURI(mmsMapUrl);
|
|
135
|
-
that.$mmsMapFrame.src = encodeUrl;
|
|
136
|
-
});
|
|
137
|
-
} else if (that.mmsType == 2) {
|
|
138
|
-
//立得实景
|
|
139
|
-
var mapHTML =
|
|
140
|
-
'<div id="desktop-closemms"><div class="desktop-closemms-img"></div><div class="desktop-closemms-tips">关闭实景</div></div>';
|
|
141
|
-
$container.appendChild(mapHTML);
|
|
142
|
-
|
|
143
|
-
that.desktopclosemms = $container.find("#desktop-closemms");
|
|
144
|
-
if (that.desktopclosemms !== "undefined") {
|
|
145
|
-
that.desktopclosemms.click(function (e) {
|
|
146
|
-
that.desktopclosemms[0].style.display = "none";
|
|
147
|
-
that.closeMMS();
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (that.mapContainer) {
|
|
154
|
-
that.mapContainer.onmouseover = function (evt) {
|
|
155
|
-
if (that.mmsVisible) {
|
|
156
|
-
that.mapContainer.style.height = "300px";
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
that.mapContainer.onmouseout = function (evt) {
|
|
160
|
-
if (that.mmsVisible) {
|
|
161
|
-
that.mapContainer.style.height = "140px";
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
//绑定地图事件
|
|
167
|
-
that.bindEvent("setMMSEyePreviewCallback", that.setMMSEyePreview); //地图眼睛拖动预览回调
|
|
168
|
-
that.bindEvent("setMMSEyePositionCallback", that.setMMSEyePosition); //地图眼睛点击回调
|
|
169
|
-
that.bindEvent("setMMSEyePositionAngleCallback", that.setMMSAngle); //地图眼睛转动回调
|
|
170
|
-
//that.bindEvent("identifyPartCallback", that.identifyPart); //地图点击部件回调
|
|
171
|
-
// 实景加载完毕后
|
|
172
|
-
that.bindEvent("mmsLoadedCallback", that.onMmsLoaded);
|
|
173
|
-
that.bindEvent("mmsAirPanoLocateCallback", that.mmsAirPanoLocateByID);
|
|
174
|
-
that.bindEvent("mmsAirPanoCompareCallback", that.setAirPanoCompare);
|
|
175
|
-
};
|
|
176
|
-
/* 绑定事件 */
|
|
177
|
-
that.bindEvent = function (msgId, msgHandler, stopOnTop) {
|
|
178
|
-
if (scene == null) return;
|
|
179
|
-
scene.on(msgPrefix + ":" + msgId, msgHandler, parentScene, stopOnTop);
|
|
180
|
-
};
|
|
181
|
-
/* 触发事件 */
|
|
182
|
-
that.fireEvent = function (msgId, msgData, stopOnTop) {
|
|
183
|
-
if (scene == null) return;
|
|
184
|
-
scene.fire(msgPrefix + ":" + msgId, msgData, parentScene, stopOnTop);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
that.dispatchSceneEvent = function (msgId, msgData) {
|
|
188
|
-
if (scene == null) return;
|
|
189
|
-
scene.fire(
|
|
190
|
-
msgPrefix + ":" + msgId,
|
|
191
|
-
{ args: msgData },
|
|
192
|
-
parentScene,
|
|
193
|
-
false
|
|
194
|
-
);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
that.onMmsLoaded = function () {
|
|
198
|
-
that.mmsLoaded = true;
|
|
199
|
-
console.info("----------mmsLoadedCallback");
|
|
200
|
-
//绑定实景事件
|
|
201
|
-
that.bindEvent("setPanoEyePreviewCallback", that.setGISEyePreview); // 实景预览回调
|
|
202
|
-
that.bindEvent("getlocateroutemmspointsCallback", that.drawTrackLine); // 实景定位回调
|
|
203
|
-
that.bindEvent("getlocatemmspointsCallback", that.setGISEyePosition); // 实景位置更新回调
|
|
204
|
-
that.bindEvent("panorotateCallback", that.setGISEyeAngle); // 实景转动回调
|
|
205
|
-
that.bindEvent("partClickCallback", that.panoPartClick); //地图点击部件回调
|
|
206
|
-
|
|
207
|
-
// that.bindEvent('eventClickCallback', eventClick);
|
|
208
|
-
that.bindEvent("mmsClosePanoCallback", that.closeMMS);
|
|
209
|
-
that.bindEvent("mmsFullScreenCallback", that.fullScreenMMS);
|
|
210
|
-
// flex
|
|
211
|
-
that.bindEvent("mmsInitCompleteCallback", that.mmsFlexInitComplete);
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* 实景窗口关闭
|
|
216
|
-
*/
|
|
217
|
-
that.closeMMS = function (evt) {
|
|
218
|
-
that.mmsVisible = false;
|
|
219
|
-
that.mmsMapContainer.style.height = "0";
|
|
220
|
-
|
|
221
|
-
if (that.mapContainer) {
|
|
222
|
-
that.mapContainer.style.height = "100%";
|
|
223
|
-
that.mapContainer.style.width = "100%";
|
|
224
|
-
that.mapContainer.style.bottom = "0px";
|
|
225
|
-
that.mapContainer.style.right = "0px";
|
|
226
|
-
that.mapContainer.style.backgroundColor = "#ffffff";
|
|
227
|
-
|
|
228
|
-
that.dispatchSceneEvent("clearGraphic", ["MMSFeature"]);
|
|
229
|
-
that.dispatchSceneEvent("clearGraphic", ["", "mms"]);
|
|
230
|
-
|
|
231
|
-
//恢复地图工具条
|
|
232
|
-
var param = { visible: true };
|
|
233
|
-
that.fireEvent("changeControlParam", { args: ["toolbar", param] });
|
|
234
|
-
if (that.mapConfig && that.mapConfig.params) {
|
|
235
|
-
var params = that.mapConfig.params;
|
|
236
|
-
if (params["geocode"]) {
|
|
237
|
-
var type = "geocode";
|
|
238
|
-
that.fireEvent("changeControlParam", {
|
|
239
|
-
args: [type, param],
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
//触发实景弹框关闭事件
|
|
245
|
-
that.fireEvent("closeMMSPanel", { args: [] });
|
|
246
|
-
|
|
247
|
-
//地图重新缩放定位到原来的中心点
|
|
248
|
-
setTimeout(center, 800);
|
|
249
|
-
function center() {
|
|
250
|
-
if (that.curPointX != null && that.curPointY != null) {
|
|
251
|
-
that.dispatchSceneEvent("centerAndZoom", [
|
|
252
|
-
that.curPointX,
|
|
253
|
-
that.curPointY,
|
|
254
|
-
]);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* 实景窗口最大化
|
|
262
|
-
*/
|
|
263
|
-
that.fullScreenMMS = function () {
|
|
264
|
-
if (that.mapContainer) {
|
|
265
|
-
that.mapContainer.style.width = "333px";
|
|
266
|
-
that.mapContainer.style.height = "140px";
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
that.showMMSView = function () {
|
|
271
|
-
if (that.mmsMapContainer) {
|
|
272
|
-
that.mmsVisible = true;
|
|
273
|
-
that.mmsMapContainer.style.height = "100%";
|
|
274
|
-
that.mmsMapContainer.style.display = "block";
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
/** *****************************GIS地图调用MMS地图************************ */
|
|
279
|
-
/**
|
|
280
|
-
* 实景预览
|
|
281
|
-
*
|
|
282
|
-
* @param res
|
|
283
|
-
*/
|
|
284
|
-
that.setMMSEyePreview = function (evt) {
|
|
285
|
-
var res = evt.args;
|
|
286
|
-
var pos = res[0];
|
|
287
|
-
var x = pos.x;
|
|
288
|
-
var y = pos.y;
|
|
289
|
-
// EGovaMMSAPI.setMMSEyePreview(x, y);
|
|
290
|
-
if (that.mmsType == 1) {
|
|
291
|
-
that.dispatchSceneEvent("setPanoEyePreview", [x, y]);
|
|
292
|
-
} else if (that.mmsType == 2) {
|
|
293
|
-
that.$mmsMapFrame.contentWindow.trueVision.showVisionByLngLat(x, y);
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* 响应地图点击,触发实景定位
|
|
299
|
-
*
|
|
300
|
-
* @param res
|
|
301
|
-
*/
|
|
302
|
-
that.setMMSEyePosition = function (evt) {
|
|
303
|
-
if (that.mmsType == 1) {
|
|
304
|
-
if (!that.mmsLoaded) {
|
|
305
|
-
console.error("----------mmsLoaded:failed!");
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
var res = evt.args;
|
|
310
|
-
if (!that.mmsVisible) {
|
|
311
|
-
// 初次定位时调整布局
|
|
312
|
-
that.mmsVisible = true;
|
|
313
|
-
that.mmsMapContainer.style.height = "100%";
|
|
314
|
-
// that.mmsMapContainer.style.top = "0px";
|
|
315
|
-
// that.mmsMapContainer.style.bottom = "0px";
|
|
316
|
-
that.mmsMapContainer.style.display = "block";
|
|
317
|
-
|
|
318
|
-
if (that.mapContainer) {
|
|
319
|
-
that.mapContainer.style.height = "140px";
|
|
320
|
-
that.mapContainer.style.width = "333px";
|
|
321
|
-
that.mapContainer.style.backgroundColor = "#F2EFE9";
|
|
322
|
-
that.mapContainer.style.bottom = "30px"; //msgPrefix == 'mappage0' ? '57px' : '25px';
|
|
323
|
-
that.mapContainer.style.right = "1px";
|
|
324
|
-
//隐藏地图工具条
|
|
325
|
-
that.fireEvent("changeControlParam", {
|
|
326
|
-
args: [
|
|
327
|
-
"toolbar",
|
|
328
|
-
{
|
|
329
|
-
visible: true,
|
|
330
|
-
items: "zoomin,zoomout,pan,fullextent,mmseye",
|
|
331
|
-
},
|
|
332
|
-
],
|
|
333
|
-
});
|
|
334
|
-
that.fireEvent("changeControlParam", {
|
|
335
|
-
args: ["geocode", { visible: false }],
|
|
336
|
-
});
|
|
337
|
-
//触发实景弹框已打开事件
|
|
338
|
-
that.fireEvent("openedMMSPanel", { args: [] });
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
var pos = res[0];
|
|
342
|
-
var x = pos.x;
|
|
343
|
-
var y = pos.y;
|
|
344
|
-
// EGovaMMSAPI.mmsPanoLocateByXY(x, y);
|
|
345
|
-
if (that.mmsType == 1) {
|
|
346
|
-
that.dispatchSceneEvent("mmsPanoLocateByXY", [x, y]); //mmsAirPanoLocate
|
|
347
|
-
} else if (that.mmsType == 2) {
|
|
348
|
-
that.desktopclosemms[0].style.display = "block";
|
|
349
|
-
if (!that.mmsLoaded) {
|
|
350
|
-
that.$mmsMapFrame.src =
|
|
351
|
-
eUrban.global.rootPath +
|
|
352
|
-
"/other/mms/truemap/TrueVisionDMI/trueVision/index.htm?x=" +
|
|
353
|
-
x +
|
|
354
|
-
"&y=" +
|
|
355
|
-
y;
|
|
356
|
-
that.mmsLoaded = true;
|
|
357
|
-
} else {
|
|
358
|
-
that.$mmsMapFrame.contentWindow.truevision.showVisionByLngLat(
|
|
359
|
-
x,
|
|
360
|
-
y
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* 响应地图眼睛拖动事件,触发实景旋转
|
|
368
|
-
*
|
|
369
|
-
* @param res
|
|
370
|
-
*/
|
|
371
|
-
that.setMMSAngle = function (evt) {
|
|
372
|
-
if (!that.mmsLoaded) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
var res = evt.args;
|
|
376
|
-
var angle = res[0].angle;
|
|
377
|
-
// EGovaMMSAPI.rotationView(angle);
|
|
378
|
-
that.dispatchSceneEvent("rotatePanoView", [angle]);
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* i查询
|
|
383
|
-
*
|
|
384
|
-
* @param res
|
|
385
|
-
*/
|
|
386
|
-
that.identifyPart = function (evt) {
|
|
387
|
-
if (!that.mmsLoaded) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
var res = evt.args;
|
|
391
|
-
// EGovaMMSAPI.mmsPartLocateByObjectCode(res[0], res[1].x,
|
|
392
|
-
// res[1].y);
|
|
393
|
-
that.dispatchSceneEvent("mmsPartLocateByObjectCode", [
|
|
394
|
-
res[0],
|
|
395
|
-
res[1].x,
|
|
396
|
-
res[1].y,
|
|
397
|
-
]);
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
/** *******************************MMS地图调用GIS地图********************************** */
|
|
401
|
-
/**
|
|
402
|
-
* 响应实景组件预览事件,触发地图事件显示实景缩略图
|
|
403
|
-
*
|
|
404
|
-
* @param res
|
|
405
|
-
*/
|
|
406
|
-
that.setGISEyePreview = function (evt) {
|
|
407
|
-
that.dispatchSceneEvent("setMMSEyePreview", evt.args);
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* 响应实景组件定位后,在地图绘制实景轨迹线
|
|
412
|
-
*
|
|
413
|
-
* @param res
|
|
414
|
-
*/
|
|
415
|
-
that.drawTrackLine = function (evt) {
|
|
416
|
-
var points = evt.args;
|
|
417
|
-
var length = points.length;
|
|
418
|
-
var feature = [],
|
|
419
|
-
trackPoint;
|
|
420
|
-
for (var i = 0; i < length; i++) {
|
|
421
|
-
trackPoint = {};
|
|
422
|
-
trackPoint.x = Number(points[i].x);
|
|
423
|
-
trackPoint.y = Number(points[i].y);
|
|
424
|
-
feature.push(trackPoint);
|
|
425
|
-
}
|
|
426
|
-
var style = {
|
|
427
|
-
type: "esriSMS",
|
|
428
|
-
style: "esriSMSCircle",
|
|
429
|
-
color: [255, 0, 0, 255],
|
|
430
|
-
size: 8,
|
|
431
|
-
};
|
|
432
|
-
that.dispatchSceneEvent("clearAllGraphics", []);
|
|
433
|
-
// that.dispatchSceneEvent('centerAndZoom', [matchPoint.x,
|
|
434
|
-
// matchPoint.y, 5]);
|
|
435
|
-
that.dispatchSceneEvent("locateFeatureByCoords", [
|
|
436
|
-
feature,
|
|
437
|
-
"polygon",
|
|
438
|
-
"MMSFeature",
|
|
439
|
-
style,
|
|
440
|
-
style,
|
|
441
|
-
false,
|
|
442
|
-
]);
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* 响应实景点变换后,更新地图
|
|
447
|
-
*
|
|
448
|
-
* @param res
|
|
449
|
-
*/
|
|
450
|
-
that.setGISEyePosition = function (evt) {
|
|
451
|
-
var data = evt.args;
|
|
452
|
-
that.curPointX = data[0].x;
|
|
453
|
-
that.curPointY = data[0].y;
|
|
454
|
-
that.dispatchSceneEvent("clearGraphic", ["labelFeature"]);
|
|
455
|
-
that.dispatchSceneEvent("setMMSEyePosition", [
|
|
456
|
-
data[0].x,
|
|
457
|
-
data[0].y,
|
|
458
|
-
data[1],
|
|
459
|
-
]);
|
|
460
|
-
// dispatchSceneEvent('centerAndZoom', [data[0].x, data[0].y], 5);
|
|
461
|
-
setTimeout(center, 800);
|
|
462
|
-
function center() {
|
|
463
|
-
that.dispatchSceneEvent("centerAndZoom", [data[0].x, data[0].y], 5);
|
|
464
|
-
}
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* 响应实景旋转,触发地图眼睛转动
|
|
469
|
-
*
|
|
470
|
-
* @param res
|
|
471
|
-
*/
|
|
472
|
-
that.setGISEyeAngle = function (evt) {
|
|
473
|
-
var data = evt.args;
|
|
474
|
-
if (!data.length) {
|
|
475
|
-
data = [data];
|
|
476
|
-
}
|
|
477
|
-
that.dispatchSceneEvent("setMMSEyePosition", data);
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* 实景中点击部件标注,触发地图高亮显示
|
|
482
|
-
*
|
|
483
|
-
* @param res
|
|
484
|
-
*/
|
|
485
|
-
that.panoPartClick = function (evt) {
|
|
486
|
-
var data = evt.args;
|
|
487
|
-
var layerID = data[0];
|
|
488
|
-
var x = data[1];
|
|
489
|
-
var y = data[2];
|
|
490
|
-
var uniqueCode = data[3];
|
|
491
|
-
var label = [{ x: x, y: y }];
|
|
492
|
-
var style = {
|
|
493
|
-
type: "esriSMS",
|
|
494
|
-
style: "esriSMSCircle",
|
|
495
|
-
color: [0, 0, 255, 255],
|
|
496
|
-
size: 12,
|
|
497
|
-
};
|
|
498
|
-
that.dispatchSceneEvent("clearGraphic", ["labelFeature"]);
|
|
499
|
-
that.dispatchSceneEvent("locateFeatureByCoords", [
|
|
500
|
-
label,
|
|
501
|
-
"polygon",
|
|
502
|
-
"labelFeature",
|
|
503
|
-
style,
|
|
504
|
-
style,
|
|
505
|
-
true,
|
|
506
|
-
]);
|
|
507
|
-
that.dispatchSceneEvent("showMapLayers", [10634, 5, 0]); // 需与GIS统一layerid
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* 实景flex客户端初始化后回调函数
|
|
512
|
-
*
|
|
513
|
-
* @param res
|
|
514
|
-
*/
|
|
515
|
-
that.mmsFlexInitComplete = function (returnStr) {
|
|
516
|
-
// alert("mmsInitCompleteCallback");
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
that.locateEvent = function (eventID, x, y, z) {
|
|
520
|
-
that.dispatchSceneEvent("locateEvent", [eventID, x, y, z]);
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
that.mmsAirPanoLocateByID = function (evt) {
|
|
524
|
-
var res = evt.args;
|
|
525
|
-
if (!that.mmsVisible) {
|
|
526
|
-
// 初次定位时调整布局
|
|
527
|
-
that.mmsVisible = true;
|
|
528
|
-
that.mmsMapContainer.style.height = "100%";
|
|
529
|
-
// that.mmsMapContainer.style.top = "0px";
|
|
530
|
-
// that.mmsMapContainer.style.bottom = "0px";
|
|
531
|
-
that.mmsMapContainer.style.display = "block";
|
|
532
|
-
|
|
533
|
-
if (that.mapContainer) {
|
|
534
|
-
that.mapContainer.style.height = "140px";
|
|
535
|
-
that.mapContainer.style.width = "333px";
|
|
536
|
-
that.mapContainer.style.backgroundColor = "#F2EFE9";
|
|
537
|
-
that.mapContainer.style.bottom = "30px"; //msgPrefix == 'mappage0' ? '57px' :
|
|
538
|
-
that.mapContainer.style.right = "1px";
|
|
539
|
-
//隐藏地图工具条
|
|
540
|
-
that.fireEvent("changeControlParam", {
|
|
541
|
-
args: [
|
|
542
|
-
"toolbar",
|
|
543
|
-
{
|
|
544
|
-
visible: true,
|
|
545
|
-
items: "zoomin,zoomout,pan,fullextent,mmseye",
|
|
546
|
-
},
|
|
547
|
-
],
|
|
548
|
-
});
|
|
549
|
-
that.fireEvent("changeControlParam", {
|
|
550
|
-
args: ["geocode", { visible: false }],
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
var pointID = res[0];
|
|
555
|
-
// EGovaMMSAPI.mmsAirPanoLocateByID(pointID);
|
|
556
|
-
that.dispatchSceneEvent("mmsAirPanoLocateByID", [pointID]);
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
that.setAirPanoCompare = function (evt) {
|
|
560
|
-
var callback = evt.args[0];
|
|
561
|
-
that.dispatchSceneEvent("setAirPanoCompareCallback", [callback]);
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
that.init();
|
|
565
|
-
};
|
|
566
|
-
export default EGovaMMSMap;
|
|
1
|
+
var scene = null;
|
|
2
|
+
|
|
3
|
+
function checkServerURL(url, callback) {
|
|
4
|
+
var proxyList = url.split(";");
|
|
5
|
+
if (proxyList.length <= 1) {
|
|
6
|
+
eUrban.global.mmsServerURL = url;
|
|
7
|
+
callback();
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
var params = { isLoad: false };
|
|
11
|
+
for (var i in proxyList) {
|
|
12
|
+
checkProxy(proxyList[i], params, callback);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function checkProxy(proxyUrl, params, callback) {
|
|
17
|
+
var img = new Image();
|
|
18
|
+
if (proxyUrl.indexOf("http://") < 0) {
|
|
19
|
+
proxyUrl = window.location.origin + "/" + proxyUrl;
|
|
20
|
+
}
|
|
21
|
+
img.src = proxyUrl + "/symbol/1_1_1.png";
|
|
22
|
+
img.onload = function (e1) {
|
|
23
|
+
if (!params.isLoad) {
|
|
24
|
+
params.isLoad = true;
|
|
25
|
+
eUrban.global.mmsServerURL = proxyUrl;
|
|
26
|
+
callback();
|
|
27
|
+
}
|
|
28
|
+
img = null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var EGovaMMSMap = function (
|
|
33
|
+
$container,
|
|
34
|
+
pScene,
|
|
35
|
+
prefix,
|
|
36
|
+
mmsParams,
|
|
37
|
+
mapConfig,
|
|
38
|
+
mmsType
|
|
39
|
+
) {
|
|
40
|
+
var that = this;
|
|
41
|
+
scene = pScene;
|
|
42
|
+
var parentScene = "parentScene" || "MMSMap";
|
|
43
|
+
var msgPrefix = prefix || "MMS";
|
|
44
|
+
var proxyURL = eUrban.global.rootPath + "/home/gis/proxy.htm";
|
|
45
|
+
|
|
46
|
+
that.mmsVisible = false;
|
|
47
|
+
that.mmsLoaded = false;
|
|
48
|
+
that.isLoading = false;
|
|
49
|
+
that.mapConfig = mapConfig;
|
|
50
|
+
that.mmsType = mmsType;
|
|
51
|
+
that.$mmsMapFrame = null;
|
|
52
|
+
that.mmsMapContainer = null;
|
|
53
|
+
that.mapContainer = null;
|
|
54
|
+
that.curPointX = null;
|
|
55
|
+
that.curPointY = null;
|
|
56
|
+
that.mmsMapContainer =
|
|
57
|
+
$container.getElementsByClassName(".mmsmap-container")[0];
|
|
58
|
+
|
|
59
|
+
if (that.mmsMapContainer) {
|
|
60
|
+
var mmsMapHTML =
|
|
61
|
+
'<iframe class="mmsmap-iframe" webkitAllowFullScreen="true" mozallowfullscreen="true" allowFullScreen="true"></iframe>';
|
|
62
|
+
var element = document.createElement("div");
|
|
63
|
+
element.classList.add("mmsmap-container");
|
|
64
|
+
element.innerHTML = mmsMapHTML;
|
|
65
|
+
$container.appendChild(element);
|
|
66
|
+
that.mmsMapContainer = element;
|
|
67
|
+
}
|
|
68
|
+
that.$mmsMapFrame =
|
|
69
|
+
that.mmsMapContainer.getElementsByClassName("mmsmap-iframe")[0];
|
|
70
|
+
that.mapContainer = $container.getElementsByClassName("emap-container")[0];
|
|
71
|
+
|
|
72
|
+
that.init = function () {
|
|
73
|
+
if (!that.isLoading) {
|
|
74
|
+
that.isLoading = true;
|
|
75
|
+
if (that.mmsType == 1) {
|
|
76
|
+
checkServerURL(mmsParams.mmsServerURL, function () {
|
|
77
|
+
var mmsAPIURL =
|
|
78
|
+
eUrban.global.mmsServerURL +
|
|
79
|
+
"/library/mms/api/MMSAPI.js";
|
|
80
|
+
var mmsCCDPicURL =
|
|
81
|
+
eUrban.global.mmsServerURL + "/mmspic/Image";
|
|
82
|
+
var mmsSymbolURL = eUrban.global.mmsServerURL + "/symbol";
|
|
83
|
+
var mmsWsdlURL =
|
|
84
|
+
eUrban.global.mmsServerURL + "/ws/MMSInspector?wsdl";
|
|
85
|
+
|
|
86
|
+
var mmsConfig = {
|
|
87
|
+
panoID: "eGovaMMS",
|
|
88
|
+
mmsApiUrl: mmsAPIURL,
|
|
89
|
+
mmsServerUrl: eUrban.global.mmsServerURL,
|
|
90
|
+
mmsPicUrl: mmsCCDPicURL,
|
|
91
|
+
mmsSymbolUrl: mmsSymbolURL,
|
|
92
|
+
mediaRootUrl: mmsParams.mmsMediaURL,
|
|
93
|
+
mmsWsdlUrl: mmsWsdlURL,
|
|
94
|
+
proxyUrl: proxyURL,
|
|
95
|
+
};
|
|
96
|
+
var prefix =
|
|
97
|
+
"msgPrefix=" +
|
|
98
|
+
msgPrefix +
|
|
99
|
+
"&parentScene=" +
|
|
100
|
+
parentScene +
|
|
101
|
+
"&proxyUrl=" +
|
|
102
|
+
proxyURL;
|
|
103
|
+
for (var item in mmsConfig) {
|
|
104
|
+
prefix += "&" + item + "=" + mmsConfig[item];
|
|
105
|
+
}
|
|
106
|
+
if (typeof mmsParams.simpleMode !== "undefined") {
|
|
107
|
+
prefix = prefix + "&simpleMode=true";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//违建系统无底部工具栏
|
|
111
|
+
var pageUrl = window.document.URL;
|
|
112
|
+
var bottom = 20;
|
|
113
|
+
if (pageUrl.indexOf("ibmain") > 0) {
|
|
114
|
+
bottom = -10;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var mmsMapUrl =
|
|
118
|
+
eUrban.global.rootPath +
|
|
119
|
+
"/library/urban/egovamap/mms.jsp?" +
|
|
120
|
+
prefix;
|
|
121
|
+
if (
|
|
122
|
+
msgPrefix == "mappage0" ||
|
|
123
|
+
msgPrefix == "egovamappage0_gis"
|
|
124
|
+
) {
|
|
125
|
+
//仅主页上的实景设置控件样式
|
|
126
|
+
mmsMapUrl +=
|
|
127
|
+
"&navi={visible:true,left:20,top:60}&toolbar={visible:true,top:60}&footer={visible:true,bottom:" +
|
|
128
|
+
bottom +
|
|
129
|
+
"}&toolBarDefine=104,105";
|
|
130
|
+
} else {
|
|
131
|
+
mmsMapUrl +=
|
|
132
|
+
"&navi={visible:true,left:10,top:20}&toolbar={visible:true,top:20}&toolBarDefine=104,105";
|
|
133
|
+
}
|
|
134
|
+
var encodeUrl = encodeURI(mmsMapUrl);
|
|
135
|
+
that.$mmsMapFrame.src = encodeUrl;
|
|
136
|
+
});
|
|
137
|
+
} else if (that.mmsType == 2) {
|
|
138
|
+
//立得实景
|
|
139
|
+
var mapHTML =
|
|
140
|
+
'<div id="desktop-closemms"><div class="desktop-closemms-img"></div><div class="desktop-closemms-tips">关闭实景</div></div>';
|
|
141
|
+
$container.appendChild(mapHTML);
|
|
142
|
+
|
|
143
|
+
that.desktopclosemms = $container.find("#desktop-closemms");
|
|
144
|
+
if (that.desktopclosemms !== "undefined") {
|
|
145
|
+
that.desktopclosemms.click(function (e) {
|
|
146
|
+
that.desktopclosemms[0].style.display = "none";
|
|
147
|
+
that.closeMMS();
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (that.mapContainer) {
|
|
154
|
+
that.mapContainer.onmouseover = function (evt) {
|
|
155
|
+
if (that.mmsVisible) {
|
|
156
|
+
that.mapContainer.style.height = "300px";
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
that.mapContainer.onmouseout = function (evt) {
|
|
160
|
+
if (that.mmsVisible) {
|
|
161
|
+
that.mapContainer.style.height = "140px";
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
//绑定地图事件
|
|
167
|
+
that.bindEvent("setMMSEyePreviewCallback", that.setMMSEyePreview); //地图眼睛拖动预览回调
|
|
168
|
+
that.bindEvent("setMMSEyePositionCallback", that.setMMSEyePosition); //地图眼睛点击回调
|
|
169
|
+
that.bindEvent("setMMSEyePositionAngleCallback", that.setMMSAngle); //地图眼睛转动回调
|
|
170
|
+
//that.bindEvent("identifyPartCallback", that.identifyPart); //地图点击部件回调
|
|
171
|
+
// 实景加载完毕后
|
|
172
|
+
that.bindEvent("mmsLoadedCallback", that.onMmsLoaded);
|
|
173
|
+
that.bindEvent("mmsAirPanoLocateCallback", that.mmsAirPanoLocateByID);
|
|
174
|
+
that.bindEvent("mmsAirPanoCompareCallback", that.setAirPanoCompare);
|
|
175
|
+
};
|
|
176
|
+
/* 绑定事件 */
|
|
177
|
+
that.bindEvent = function (msgId, msgHandler, stopOnTop) {
|
|
178
|
+
if (scene == null) return;
|
|
179
|
+
scene.on(msgPrefix + ":" + msgId, msgHandler, parentScene, stopOnTop);
|
|
180
|
+
};
|
|
181
|
+
/* 触发事件 */
|
|
182
|
+
that.fireEvent = function (msgId, msgData, stopOnTop) {
|
|
183
|
+
if (scene == null) return;
|
|
184
|
+
scene.fire(msgPrefix + ":" + msgId, msgData, parentScene, stopOnTop);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
that.dispatchSceneEvent = function (msgId, msgData) {
|
|
188
|
+
if (scene == null) return;
|
|
189
|
+
scene.fire(
|
|
190
|
+
msgPrefix + ":" + msgId,
|
|
191
|
+
{ args: msgData },
|
|
192
|
+
parentScene,
|
|
193
|
+
false
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
that.onMmsLoaded = function () {
|
|
198
|
+
that.mmsLoaded = true;
|
|
199
|
+
console.info("----------mmsLoadedCallback");
|
|
200
|
+
//绑定实景事件
|
|
201
|
+
that.bindEvent("setPanoEyePreviewCallback", that.setGISEyePreview); // 实景预览回调
|
|
202
|
+
that.bindEvent("getlocateroutemmspointsCallback", that.drawTrackLine); // 实景定位回调
|
|
203
|
+
that.bindEvent("getlocatemmspointsCallback", that.setGISEyePosition); // 实景位置更新回调
|
|
204
|
+
that.bindEvent("panorotateCallback", that.setGISEyeAngle); // 实景转动回调
|
|
205
|
+
that.bindEvent("partClickCallback", that.panoPartClick); //地图点击部件回调
|
|
206
|
+
|
|
207
|
+
// that.bindEvent('eventClickCallback', eventClick);
|
|
208
|
+
that.bindEvent("mmsClosePanoCallback", that.closeMMS);
|
|
209
|
+
that.bindEvent("mmsFullScreenCallback", that.fullScreenMMS);
|
|
210
|
+
// flex
|
|
211
|
+
that.bindEvent("mmsInitCompleteCallback", that.mmsFlexInitComplete);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 实景窗口关闭
|
|
216
|
+
*/
|
|
217
|
+
that.closeMMS = function (evt) {
|
|
218
|
+
that.mmsVisible = false;
|
|
219
|
+
that.mmsMapContainer.style.height = "0";
|
|
220
|
+
|
|
221
|
+
if (that.mapContainer) {
|
|
222
|
+
that.mapContainer.style.height = "100%";
|
|
223
|
+
that.mapContainer.style.width = "100%";
|
|
224
|
+
that.mapContainer.style.bottom = "0px";
|
|
225
|
+
that.mapContainer.style.right = "0px";
|
|
226
|
+
that.mapContainer.style.backgroundColor = "#ffffff";
|
|
227
|
+
|
|
228
|
+
that.dispatchSceneEvent("clearGraphic", ["MMSFeature"]);
|
|
229
|
+
that.dispatchSceneEvent("clearGraphic", ["", "mms"]);
|
|
230
|
+
|
|
231
|
+
//恢复地图工具条
|
|
232
|
+
var param = { visible: true };
|
|
233
|
+
that.fireEvent("changeControlParam", { args: ["toolbar", param] });
|
|
234
|
+
if (that.mapConfig && that.mapConfig.params) {
|
|
235
|
+
var params = that.mapConfig.params;
|
|
236
|
+
if (params["geocode"]) {
|
|
237
|
+
var type = "geocode";
|
|
238
|
+
that.fireEvent("changeControlParam", {
|
|
239
|
+
args: [type, param],
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//触发实景弹框关闭事件
|
|
245
|
+
that.fireEvent("closeMMSPanel", { args: [] });
|
|
246
|
+
|
|
247
|
+
//地图重新缩放定位到原来的中心点
|
|
248
|
+
setTimeout(center, 800);
|
|
249
|
+
function center() {
|
|
250
|
+
if (that.curPointX != null && that.curPointY != null) {
|
|
251
|
+
that.dispatchSceneEvent("centerAndZoom", [
|
|
252
|
+
that.curPointX,
|
|
253
|
+
that.curPointY,
|
|
254
|
+
]);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* 实景窗口最大化
|
|
262
|
+
*/
|
|
263
|
+
that.fullScreenMMS = function () {
|
|
264
|
+
if (that.mapContainer) {
|
|
265
|
+
that.mapContainer.style.width = "333px";
|
|
266
|
+
that.mapContainer.style.height = "140px";
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
that.showMMSView = function () {
|
|
271
|
+
if (that.mmsMapContainer) {
|
|
272
|
+
that.mmsVisible = true;
|
|
273
|
+
that.mmsMapContainer.style.height = "100%";
|
|
274
|
+
that.mmsMapContainer.style.display = "block";
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/** *****************************GIS地图调用MMS地图************************ */
|
|
279
|
+
/**
|
|
280
|
+
* 实景预览
|
|
281
|
+
*
|
|
282
|
+
* @param res
|
|
283
|
+
*/
|
|
284
|
+
that.setMMSEyePreview = function (evt) {
|
|
285
|
+
var res = evt.args;
|
|
286
|
+
var pos = res[0];
|
|
287
|
+
var x = pos.x;
|
|
288
|
+
var y = pos.y;
|
|
289
|
+
// EGovaMMSAPI.setMMSEyePreview(x, y);
|
|
290
|
+
if (that.mmsType == 1) {
|
|
291
|
+
that.dispatchSceneEvent("setPanoEyePreview", [x, y]);
|
|
292
|
+
} else if (that.mmsType == 2) {
|
|
293
|
+
that.$mmsMapFrame.contentWindow.trueVision.showVisionByLngLat(x, y);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* 响应地图点击,触发实景定位
|
|
299
|
+
*
|
|
300
|
+
* @param res
|
|
301
|
+
*/
|
|
302
|
+
that.setMMSEyePosition = function (evt) {
|
|
303
|
+
if (that.mmsType == 1) {
|
|
304
|
+
if (!that.mmsLoaded) {
|
|
305
|
+
console.error("----------mmsLoaded:failed!");
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
var res = evt.args;
|
|
310
|
+
if (!that.mmsVisible) {
|
|
311
|
+
// 初次定位时调整布局
|
|
312
|
+
that.mmsVisible = true;
|
|
313
|
+
that.mmsMapContainer.style.height = "100%";
|
|
314
|
+
// that.mmsMapContainer.style.top = "0px";
|
|
315
|
+
// that.mmsMapContainer.style.bottom = "0px";
|
|
316
|
+
that.mmsMapContainer.style.display = "block";
|
|
317
|
+
|
|
318
|
+
if (that.mapContainer) {
|
|
319
|
+
that.mapContainer.style.height = "140px";
|
|
320
|
+
that.mapContainer.style.width = "333px";
|
|
321
|
+
that.mapContainer.style.backgroundColor = "#F2EFE9";
|
|
322
|
+
that.mapContainer.style.bottom = "30px"; //msgPrefix == 'mappage0' ? '57px' : '25px';
|
|
323
|
+
that.mapContainer.style.right = "1px";
|
|
324
|
+
//隐藏地图工具条
|
|
325
|
+
that.fireEvent("changeControlParam", {
|
|
326
|
+
args: [
|
|
327
|
+
"toolbar",
|
|
328
|
+
{
|
|
329
|
+
visible: true,
|
|
330
|
+
items: "zoomin,zoomout,pan,fullextent,mmseye",
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
});
|
|
334
|
+
that.fireEvent("changeControlParam", {
|
|
335
|
+
args: ["geocode", { visible: false }],
|
|
336
|
+
});
|
|
337
|
+
//触发实景弹框已打开事件
|
|
338
|
+
that.fireEvent("openedMMSPanel", { args: [] });
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
var pos = res[0];
|
|
342
|
+
var x = pos.x;
|
|
343
|
+
var y = pos.y;
|
|
344
|
+
// EGovaMMSAPI.mmsPanoLocateByXY(x, y);
|
|
345
|
+
if (that.mmsType == 1) {
|
|
346
|
+
that.dispatchSceneEvent("mmsPanoLocateByXY", [x, y]); //mmsAirPanoLocate
|
|
347
|
+
} else if (that.mmsType == 2) {
|
|
348
|
+
that.desktopclosemms[0].style.display = "block";
|
|
349
|
+
if (!that.mmsLoaded) {
|
|
350
|
+
that.$mmsMapFrame.src =
|
|
351
|
+
eUrban.global.rootPath +
|
|
352
|
+
"/other/mms/truemap/TrueVisionDMI/trueVision/index.htm?x=" +
|
|
353
|
+
x +
|
|
354
|
+
"&y=" +
|
|
355
|
+
y;
|
|
356
|
+
that.mmsLoaded = true;
|
|
357
|
+
} else {
|
|
358
|
+
that.$mmsMapFrame.contentWindow.truevision.showVisionByLngLat(
|
|
359
|
+
x,
|
|
360
|
+
y
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* 响应地图眼睛拖动事件,触发实景旋转
|
|
368
|
+
*
|
|
369
|
+
* @param res
|
|
370
|
+
*/
|
|
371
|
+
that.setMMSAngle = function (evt) {
|
|
372
|
+
if (!that.mmsLoaded) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
var res = evt.args;
|
|
376
|
+
var angle = res[0].angle;
|
|
377
|
+
// EGovaMMSAPI.rotationView(angle);
|
|
378
|
+
that.dispatchSceneEvent("rotatePanoView", [angle]);
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* i查询
|
|
383
|
+
*
|
|
384
|
+
* @param res
|
|
385
|
+
*/
|
|
386
|
+
that.identifyPart = function (evt) {
|
|
387
|
+
if (!that.mmsLoaded) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
var res = evt.args;
|
|
391
|
+
// EGovaMMSAPI.mmsPartLocateByObjectCode(res[0], res[1].x,
|
|
392
|
+
// res[1].y);
|
|
393
|
+
that.dispatchSceneEvent("mmsPartLocateByObjectCode", [
|
|
394
|
+
res[0],
|
|
395
|
+
res[1].x,
|
|
396
|
+
res[1].y,
|
|
397
|
+
]);
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/** *******************************MMS地图调用GIS地图********************************** */
|
|
401
|
+
/**
|
|
402
|
+
* 响应实景组件预览事件,触发地图事件显示实景缩略图
|
|
403
|
+
*
|
|
404
|
+
* @param res
|
|
405
|
+
*/
|
|
406
|
+
that.setGISEyePreview = function (evt) {
|
|
407
|
+
that.dispatchSceneEvent("setMMSEyePreview", evt.args);
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* 响应实景组件定位后,在地图绘制实景轨迹线
|
|
412
|
+
*
|
|
413
|
+
* @param res
|
|
414
|
+
*/
|
|
415
|
+
that.drawTrackLine = function (evt) {
|
|
416
|
+
var points = evt.args;
|
|
417
|
+
var length = points.length;
|
|
418
|
+
var feature = [],
|
|
419
|
+
trackPoint;
|
|
420
|
+
for (var i = 0; i < length; i++) {
|
|
421
|
+
trackPoint = {};
|
|
422
|
+
trackPoint.x = Number(points[i].x);
|
|
423
|
+
trackPoint.y = Number(points[i].y);
|
|
424
|
+
feature.push(trackPoint);
|
|
425
|
+
}
|
|
426
|
+
var style = {
|
|
427
|
+
type: "esriSMS",
|
|
428
|
+
style: "esriSMSCircle",
|
|
429
|
+
color: [255, 0, 0, 255],
|
|
430
|
+
size: 8,
|
|
431
|
+
};
|
|
432
|
+
that.dispatchSceneEvent("clearAllGraphics", []);
|
|
433
|
+
// that.dispatchSceneEvent('centerAndZoom', [matchPoint.x,
|
|
434
|
+
// matchPoint.y, 5]);
|
|
435
|
+
that.dispatchSceneEvent("locateFeatureByCoords", [
|
|
436
|
+
feature,
|
|
437
|
+
"polygon",
|
|
438
|
+
"MMSFeature",
|
|
439
|
+
style,
|
|
440
|
+
style,
|
|
441
|
+
false,
|
|
442
|
+
]);
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* 响应实景点变换后,更新地图
|
|
447
|
+
*
|
|
448
|
+
* @param res
|
|
449
|
+
*/
|
|
450
|
+
that.setGISEyePosition = function (evt) {
|
|
451
|
+
var data = evt.args;
|
|
452
|
+
that.curPointX = data[0].x;
|
|
453
|
+
that.curPointY = data[0].y;
|
|
454
|
+
that.dispatchSceneEvent("clearGraphic", ["labelFeature"]);
|
|
455
|
+
that.dispatchSceneEvent("setMMSEyePosition", [
|
|
456
|
+
data[0].x,
|
|
457
|
+
data[0].y,
|
|
458
|
+
data[1],
|
|
459
|
+
]);
|
|
460
|
+
// dispatchSceneEvent('centerAndZoom', [data[0].x, data[0].y], 5);
|
|
461
|
+
setTimeout(center, 800);
|
|
462
|
+
function center() {
|
|
463
|
+
that.dispatchSceneEvent("centerAndZoom", [data[0].x, data[0].y], 5);
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* 响应实景旋转,触发地图眼睛转动
|
|
469
|
+
*
|
|
470
|
+
* @param res
|
|
471
|
+
*/
|
|
472
|
+
that.setGISEyeAngle = function (evt) {
|
|
473
|
+
var data = evt.args;
|
|
474
|
+
if (!data.length) {
|
|
475
|
+
data = [data];
|
|
476
|
+
}
|
|
477
|
+
that.dispatchSceneEvent("setMMSEyePosition", data);
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* 实景中点击部件标注,触发地图高亮显示
|
|
482
|
+
*
|
|
483
|
+
* @param res
|
|
484
|
+
*/
|
|
485
|
+
that.panoPartClick = function (evt) {
|
|
486
|
+
var data = evt.args;
|
|
487
|
+
var layerID = data[0];
|
|
488
|
+
var x = data[1];
|
|
489
|
+
var y = data[2];
|
|
490
|
+
var uniqueCode = data[3];
|
|
491
|
+
var label = [{ x: x, y: y }];
|
|
492
|
+
var style = {
|
|
493
|
+
type: "esriSMS",
|
|
494
|
+
style: "esriSMSCircle",
|
|
495
|
+
color: [0, 0, 255, 255],
|
|
496
|
+
size: 12,
|
|
497
|
+
};
|
|
498
|
+
that.dispatchSceneEvent("clearGraphic", ["labelFeature"]);
|
|
499
|
+
that.dispatchSceneEvent("locateFeatureByCoords", [
|
|
500
|
+
label,
|
|
501
|
+
"polygon",
|
|
502
|
+
"labelFeature",
|
|
503
|
+
style,
|
|
504
|
+
style,
|
|
505
|
+
true,
|
|
506
|
+
]);
|
|
507
|
+
that.dispatchSceneEvent("showMapLayers", [10634, 5, 0]); // 需与GIS统一layerid
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* 实景flex客户端初始化后回调函数
|
|
512
|
+
*
|
|
513
|
+
* @param res
|
|
514
|
+
*/
|
|
515
|
+
that.mmsFlexInitComplete = function (returnStr) {
|
|
516
|
+
// alert("mmsInitCompleteCallback");
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
that.locateEvent = function (eventID, x, y, z) {
|
|
520
|
+
that.dispatchSceneEvent("locateEvent", [eventID, x, y, z]);
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
that.mmsAirPanoLocateByID = function (evt) {
|
|
524
|
+
var res = evt.args;
|
|
525
|
+
if (!that.mmsVisible) {
|
|
526
|
+
// 初次定位时调整布局
|
|
527
|
+
that.mmsVisible = true;
|
|
528
|
+
that.mmsMapContainer.style.height = "100%";
|
|
529
|
+
// that.mmsMapContainer.style.top = "0px";
|
|
530
|
+
// that.mmsMapContainer.style.bottom = "0px";
|
|
531
|
+
that.mmsMapContainer.style.display = "block";
|
|
532
|
+
|
|
533
|
+
if (that.mapContainer) {
|
|
534
|
+
that.mapContainer.style.height = "140px";
|
|
535
|
+
that.mapContainer.style.width = "333px";
|
|
536
|
+
that.mapContainer.style.backgroundColor = "#F2EFE9";
|
|
537
|
+
that.mapContainer.style.bottom = "30px"; //msgPrefix == 'mappage0' ? '57px' :
|
|
538
|
+
that.mapContainer.style.right = "1px";
|
|
539
|
+
//隐藏地图工具条
|
|
540
|
+
that.fireEvent("changeControlParam", {
|
|
541
|
+
args: [
|
|
542
|
+
"toolbar",
|
|
543
|
+
{
|
|
544
|
+
visible: true,
|
|
545
|
+
items: "zoomin,zoomout,pan,fullextent,mmseye",
|
|
546
|
+
},
|
|
547
|
+
],
|
|
548
|
+
});
|
|
549
|
+
that.fireEvent("changeControlParam", {
|
|
550
|
+
args: ["geocode", { visible: false }],
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
var pointID = res[0];
|
|
555
|
+
// EGovaMMSAPI.mmsAirPanoLocateByID(pointID);
|
|
556
|
+
that.dispatchSceneEvent("mmsAirPanoLocateByID", [pointID]);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
that.setAirPanoCompare = function (evt) {
|
|
560
|
+
var callback = evt.args[0];
|
|
561
|
+
that.dispatchSceneEvent("setAirPanoCompareCallback", [callback]);
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
that.init();
|
|
565
|
+
};
|
|
566
|
+
export default EGovaMMSMap;
|