0803f52641a8cc5758bc309057eae055341a5637.svn-base
1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var IsAddMCICtrl = false;
function InitMCICtrl() {
if (!IsAddMCICtrl) {
if ($("#MCIdialog").attr("id") == undefined)
BuildMCIAlert();
else {
$.parser.parse($("#MCIdialog")); //局部重新渲染
$("#MCIdialog").dialog("open");
}
IsAddMCICtrl = true;
} else {
$("#MCIdialog").dialog("close");
}
}
function BuildMCIAlert() {
var sb = '<div id="MCIdialog" class="easyui-dialog" title="地图容器信息" style="left:900px;top:140px;width: 160px; height: 210px;padding: 5px;overflow:hidden" resizable="true">' +
'<div id="toolspanelMCI">' +
'<button class="functionButton" id="resolution" style="width:100px;" onclick="getCurResolution()" >当前分辨率</button><br />'+
' <button class="functionButton" id="bound" style="width:100px;" onclick="getCurBound()">当前地图范围</button><br />' +
' <button class="functionButton" id="view" style="width:100px;" onclick="getMapDivInfo()">当前视窗范围</button><br />' +
' </div>';
$("#main").append(sb);
$("#MCIdialog").dialog({ closed: false, onClose: function () { closeMCI(); } });
}
function closeMCI() {
IsAddMCICtrl = false;
}
function getCurResolution() {
var curResolution = map.getResolution();
$.messager.alert("当前分辨率", "当前分辨率:" + curResolution, "info");
}
function getCurBound() {
var curMapBound = map.getExtent();
var curBoundArr = curMapBound.toString().split(",");
$.messager.alert("当前地图范围","地图范围:"+curBoundArr[0] + "," + curBoundArr[1] + ",</br>" + curBoundArr[2] + "," + curBoundArr[3], "");
}
function getMapDivInfo() {
var viewSize = map.getSize();
$.messager.alert("当前视窗范围", "当前视窗高:" + viewSize.h + " 宽:" + viewSize.w, "info");
}