Skip to content

Commit f12eaca

Browse files
committed
【FIX】有道示例缺陷。
1 parent 390ae8a commit f12eaca

File tree

6 files changed

+73
-24
lines changed

6 files changed

+73
-24
lines changed

examples/classic/analysis_mathExpression.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_mathExpression"></
5353
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
5454
<script>
5555
var map, baseLayer, resultLayer,
56-
host = window.isLocal ? window.server : "http://54.223.164.155:8090",
56+
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090",
5757
url = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图",
5858
url2 = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
5959

examples/classic/analysis_terrainCurvatureCalculation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_terrainCurvatureCa
4848
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
4949
<script>
5050
var map, baseLayer, layersID, resultLayer,
51-
host = window.isLocal ? window.server : "http://54.223.164.155:8090",
51+
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090",
5252
url = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图",
5353
url2 = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
5454

examples/classic/others_d3_dynamicPieChart.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@
1515
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
1616
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
1717
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
18-
<script type="text/javascript" exclude="iclient-classic" include="d3" src="../../dist/classic/include-classic.js"></script>
18+
<script type="text/javascript" exclude="iclient-classic" include="d3"
19+
src="../../dist/classic/include-classic.js"></script>
1920
<script type="text/javascript">
2021
var map, layer, utfgrid, control, d3Layer,
2122
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090",
2223
url = host + "/iserver/services/map-china400/rest/maps/China";
2324
var pieChartDom;
2425
var elementsDiv;
2526
var isMapMoving = false;
27+
2628
//判断浏览器是否支持 Svg
2729
function hasSVG() {
2830
var doc = document;
@@ -87,11 +89,12 @@
8789
//创建图表 div, 设置其基本属性, 并添加到 Elements 图层
8890
pieChartDom = document.createElement("div");
8991
pieChartDom.id = "piechart";
90-
pieChartDom.style.width = 128;
91-
pieChartDom.style.height = 128;
92+
pieChartDom.style.width = "128px";
93+
pieChartDom.style.height = "128px";
9294
pieChartDom.style.position = "absolute";
93-
pieChartDom.style.opacity = 0.8;
95+
pieChartDom.style.opacity = "0.8";
9496
elementsDiv.appendChild(pieChartDom);
97+
console.log(pieChartDom.style.width);
9598

9699
//创建 UTFGrid 图层,用于更新饼图数据
97100
utfgrid = new SuperMap.Layer.UTFGrid("UTFGridLayer", url,
@@ -113,6 +116,7 @@
113116
});
114117
map.addControl(control);
115118
}
119+
116120
$(document).ready(function () {
117121
init();
118122
});
@@ -145,13 +149,14 @@
145149
];
146150

147151
//取图表 div 大小作为创建图表的参数
148-
var width = parseFloat(pieChartDom.style.width),
149-
height = parseFloat(pieChartDom.style.height),
152+
// console.log(pieChartDom);
153+
var width = parseFloat(128),
154+
height = parseFloat(128),
150155
radius = Math.min(width, height) / 2;
151156

152157
//图表位置
153-
pieChartDom.style.left = pixel.x - width / 2;
154-
pieChartDom.style.top = pixel.y - height / 2;
158+
pieChartDom.style.left = pixel.x - width / 2+"px";
159+
pieChartDom.style.top = pixel.y - height / 2+"px";
155160

156161
var color = d3.scale.ordinal()
157162
.range(["#1874CD", "#87CEFA"]);
@@ -199,6 +204,7 @@
199204
}
200205
}
201206
};
207+
202208
//添加图层
203209
function addLayer() {
204210
var center = new SuperMap.LonLat(9733502.481499, 4614406.969325);

examples/classic/theme_ctl_landuseUnique.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
88
<title data-i18n="resources.title_landuseUnique"></title>
99
<style type="text/css">
10+
body {
11+
margin: 0;
12+
overflow: hidden;
13+
background: #fff;
14+
width: 100%;
15+
height: 100%
16+
}
17+
18+
#map {
19+
position: absolute;
20+
width: 100%;
21+
height: 100%;
22+
border: 1px solid #3473b7;
23+
}
1024
/*图例 style*/
1125
.legend {
1226
position: absolute;
@@ -67,7 +81,7 @@
6781
}
6882
</style>
6983
</head>
70-
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
84+
<body>
7185

7286
<div class='panel panel-primary editPane' id='editPane' style="z-index: 99999">
7387
<div class='panel-heading'>
@@ -83,7 +97,7 @@ <h5 class='panel-title text-center' data-i18n="resources.title_landuseUnique"></
8397
</div>
8498

8599
<div>
86-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
100+
<div id="map"></div>
87101
<div id="mapLegend" class="legend">
88102
<div class="legendTitle">
89103
<span data-i18n="resources.text_legend"></span>

examples/classic/theme_ctl_popDensityRange.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@
77
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
88
<title data-i18n="resources.title_popDensityRange"></title>
99
<style type="text/css">
10+
body {
11+
margin: 0;
12+
overflow: hidden;
13+
background: #fff;
14+
width: 100%;
15+
height: 100%
16+
}
1017

18+
#map {
19+
position: absolute;
20+
width: 100%;
21+
height: 100%;
22+
border: 1px solid #3473b7;
23+
}
1124
/*图例 style*/
1225
.legend {
1326
position: absolute;
@@ -68,7 +81,7 @@
6881
}
6982
</style>
7083
</head>
71-
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
84+
<body>
7285
<div class='panel panel-primary editPane' id='editPane' style="z-index: 99999">
7386
<div class='panel-heading'>
7487
<h5 class='panel-title text-center' data-i18n="resources.text_graduatedSymbol"></h5>
@@ -86,7 +99,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_graduatedSymbol"><
8699
</div>
87100
</div>
88101
<div>
89-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
102+
<div id="map" ></div>
90103
<div id="mapLegend" class="legend">
91104
<div class="legendTitle">
92105
<span data-i18n="resources.text_legend"></span>

examples/classic/vizLayer_cartoCSS_hightlight.html

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
z-index: 100;
3131
border-radius: 4px;
3232
}
33+
34+
.layerItems {
35+
border: 1px solid #999;
36+
display: none;
37+
position: absolute;
38+
z-index: 1000;
39+
background-color: rgba(255,255,255,0.5);
40+
padding-right: 20px;
41+
}
3342
</style>
3443
</head>
3544
<body>
@@ -38,10 +47,13 @@
3847
<h5 class='panel-title text-center' data-i18n="resources.text_cartoCSSHightlight"></h5></div>
3948
<div class='panel-body content'>
4049
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_cancelHighlight"
41-
onclick="layer.unHightlightFeatures();closeInfoWin();"/>
42-
<ul id='layerItems' style="display: none;position: absolute;"></ul>
50+
onclick="closeInfoWin();"/>
4351
</div>
4452
</div>
53+
<div class="layerItems">选择需要高亮的要素:
54+
<ul id='layerItems'></ul>
55+
</div>
56+
4557
<div id="map"></div>
4658
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
4759
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
@@ -57,7 +69,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_cartoCSSHightlight
5769
}
5870
</script>
5971
<script>
60-
var map, layer, layerItems, infowin, featureInfoes,
72+
var map, layer, layerItems,layerItemsContainer, infowin, featureInfoes,
6173
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090",
6274
url = host + "/iserver/services/map-china400/rest/maps/China";
6375
init();
@@ -67,6 +79,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_cartoCSSHightlight
6779
widgets.alert.showAlert(resources.msg_supportCanvas, false);
6880
return;
6981
}
82+
layerItemsContainer = document.getElementsByClassName('layerItems')[0];
7083
layerItems = document.getElementById('layerItems');
7184
map = new SuperMap.Map("map", {
7285
controls: [
@@ -96,29 +109,31 @@ <h5 class='panel-title text-center' data-i18n="resources.text_cartoCSSHightlight
96109
while (layerItems.firstChild) {
97110
layerItems.removeChild(layerItems.firstChild);
98111
}
99-
layerItems.style.top = evt.clientY + 'px';
100-
layerItems.style.left = evt.clientX + 'px';
112+
layerItemsContainer.style.top = evt.clientY + 'px';
113+
layerItemsContainer.style.left = evt.clientX + 'px';
101114
for (var i = 0, len = featureInfoes.length; i < len; i++) {
102115
var li = document.createElement('li');
103116
li.innerHTML = featureInfoes[i].cartoLayer.layerName;
117+
console.log(featureInfoes[i]);
104118
li.setAttribute('data-index', i);
105119
layerItems.appendChild(li);
106120
if (i !== (len - 1)) {
107121
li.style.borderBottom = '1px solid';
108122
}
109123
li.onclick = liClickHandle;
110124
}
111-
layerItems.style.display = 'block';
125+
126+
layerItemsContainer.style.display = 'block';
112127
} else {
113-
layerItems.style.display = 'none';
128+
layerItemsContainer.style.display = 'none';
114129
}
115130

116131
},
117132
'rightclick': function () {
118-
layerItems.style.display = 'none';
133+
layerItemsContainer.style.display = 'none';
119134
},
120135
'move': function () {
121-
layerItems.style.display = 'none';
136+
layerItemsContainer.style.display = 'none';
122137
}
123138
});
124139
}
@@ -131,7 +146,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_cartoCSSHightlight
131146
layer.highlightFeatures(featureInfoes[index]);
132147
var lonlat = map.getLonLatFromViewPortPx(featureInfoes.xy);
133148
openPopup(featureInfoes[index].feature, lonlat);
134-
layerItems.style.display = 'none';
149+
layerItemsContainer.style.display = 'none';
135150
}
136151

137152

@@ -171,6 +186,7 @@ <h5 class='panel-title text-center' data-i18n="resources.text_cartoCSSHightlight
171186
}
172187

173188
function closeInfoWin() {
189+
layer.unHightlightFeatures();
174190
if (infowin) {
175191
try {
176192
infowin.hide();

0 commit comments

Comments
 (0)