Skip to content

Commit 5306345

Browse files
committed
fix classic 示例部分缺陷。 review by caoxinke.
1 parent d156a15 commit 5306345

File tree

4 files changed

+43
-27
lines changed

4 files changed

+43
-27
lines changed

examples/classic/plot_symbolExtendProperty.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
.popupWindow {
4646
position: absolute;
4747
right: 10px;
48-
top: 242px;
48+
top: 280px;
4949
width: 220px;
5050
background: #FFF;
5151
z-index: 9999;

examples/classic/theme_ctl_GraphBar3D.html

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ <h5 class='panel-title text-center'>三维柱状图</h5>
3030
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
3131
<script type="text/javascript" exclude="iclient-classic" include="Bar3D" src="../../dist/include-classic.js"></script>
3232
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
33+
3334
<script src='../data/chinaConsumptionLevel.js'></script>
3435
<script type="text/javascript">
35-
var map, layer, themeLayer;
36+
var map, layer, themeLayer, infowin, infowinPosition;
3637
var host = window.isLocal ? window.server : "http://117.122.248.69:8090",
3738
url = host + "/iserver/services/map-china400/rest/maps/China_4326";
38-
// 信息框 div
39-
var infoDom = document.createElement("div");
40-
infoDom.style.position = "absolute";
41-
infoDom.id = "infowin";
4239

4340
// 统计图模块要求浏览器支持 Canvas 渲染
4441
if (!document.createElement('canvas').getContext) {
@@ -141,6 +138,16 @@ <h5 class='panel-title text-center'>三维柱状图</h5>
141138
closeInfoWin();
142139
}
143140

141+
// 注册地图 mousemove,用于获取当前鼠标在地图中的像素位置
142+
map.events.on({
143+
"mousemove": function (e) {
144+
infowinPosition = e.xy.clone();
145+
// 偏移
146+
infowinPosition.x += 40;
147+
infowinPosition.y -= 25;
148+
}
149+
});
150+
144151
// 显示地图弹窗
145152
function showInfoWin(e) {
146153
// e.target 是图形对象,即数据的可视化对象,三维柱状图中是指三维柱条;
@@ -154,8 +161,8 @@ <h5 class='panel-title text-center'>三维柱状图</h5>
154161
var info = e.target.dataInfo;
155162

156163
// 弹窗内容
157-
var contentHTML = "<div style='padding: 2px; color: #000; background-color: #d1eeee';'>";
158-
contentHTML += "<strong>" + fea.attributes.NAME + "</strong>";
164+
var contentHTML = "<div style='color: #000; background-color: #fff'>";
165+
contentHTML += "省级行政区名称:<br><strong>" + fea.attributes.NAME + "</strong>";
159166

160167
contentHTML += "<hr style='margin: 3px'>";
161168
switch (info.field) {
@@ -179,29 +186,38 @@ <h5 class='panel-title text-center'>三维柱状图</h5>
179186
}
180187
contentHTML += "</div>";
181188

182-
infoDom.style.left = e.event.clientX + 40 + "px";
183-
infoDom.style.top = e.event.clientY - 25 + "px";
184-
infoDom.innerHTML = contentHTML;
185-
document.body.appendChild(infoDom);
189+
// 弹出框大小
190+
var infowinSize = (SuperMap.Browser.name == "firefox") ? new SuperMap.Size(150, 105) : new SuperMap.Size(140, 90);
191+
192+
// 弹出窗地理位置
193+
var lonLat = map.getLonLatFromPixel(infowinPosition);
194+
infowin = new SuperMap.Popup(
195+
"infowin",
196+
lonLat,
197+
infowinSize,
198+
contentHTML,
199+
false,
200+
false,
201+
null);
202+
infowin.setBackgroundColor("#fff");
203+
infowin.setOpacity(0.8);
204+
if (infowin) map.removePopup(infowin);
205+
map.addPopup(infowin);
186206
}
187207
}
188208

189-
// 移除信息窗 div
209+
// 移除和销毁地图弹窗
190210
function closeInfoWin() {
191-
// infoDom 是否是 body 的子节点
192-
if (isFatcher(document.body, infoDom)) {
193-
document.body.removeChild(infoDom);
194-
}
195-
}
196-
// 判断父节点
197-
function isFatcher(p, c) {
198-
while (c.parentNode) {
199-
c = c.parentNode;
200-
if (c == p)
201-
return true;
211+
if (infowin) {
212+
try {
213+
map.removePopup(infowin);
214+
}
215+
catch (e) {
216+
widgets.alert.showAlert(e.message,false);
217+
}
202218
}
203-
return false;
204219
}
220+
205221
</script>
206222
</body>
207223
</html>

examples/classic/topologyValidatorJobService.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ <h3 class='panel-title'>拓扑检查分析</h3>
6060
</div>
6161
<script type="text/javascript" src="../../dist/include-classic.js"></script>
6262
<script type="text/javascript">
63-
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
63+
var host = window.isLocal ? window.server : "http://117.122.248.69:8090";
6464
var resultLayer,
6565
processingsUrl = host + "/iserver/services/distributedanalyst/rest/v1/jobs",
6666
mapURL = host + "/iserver/services/map-world/rest/maps/World",

examples/classic/vizLayer_heatmapColorManual.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
.row {
3535
position: absolute;
3636
right: 25px;
37-
top: 260px;
37+
top: 300px;
3838
background: #FFF;
3939
z-index: 100;
4040
border-top-width: 0px;

0 commit comments

Comments
 (0)