-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
205 lines (171 loc) · 6.1 KB
/
index.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="app.css?t=20190508221457">
<title>Document</title>
</head>
<body>
<div class="container">
<!-- 左侧 Banner -->
<div class="side">
<!-- 404 -->
<div class="banner">
<span class="not-exsit">不存在</span>
<!-- <img src="images/LiZhiCool.jpg" alt=""> -->
<div class="bg"></div>
<div></div>
</div>
</div>
<div class="main">
<div class="header">
<img src="" alt="" class="logo">
<div class="nav">
<a
href="https://weibo.com/p/1005055976663270/home?from=page_100505_profile&wvr=6&mod=data&is_all=1#place">About
叁叁肆</a>
</div>
</div>
<div class="map-box">
<!-- 地图区域 -->
<div id="container"></div>
</div>
</div>
</div>
<script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.14&key=680781460568aed39b7982094c0f6a03&plugin=Map3D,AMap.DistrictLayer,AMap.Scale,AMap.ToolBar"></script>
<script>
console.log('地图初始化!');
var SOC = 'CHN'
var colors = {};
var GDPSpeed = {
'520000': 10,//贵州
'540000': 10,//西藏
'530000': 8.5,//云南
'500000': 8.5,//重庆
'360000': 8.5,//江西
'340000': 8.0,//安徽
'510000': 7.5,//四川
'350000': 8.5,//福建
'430000': 8.0,//湖南
'420000': 7.5, //湖北
'410000': 7.5,//河南
'330000': 7.0,//浙江
'640000': 7.5,//宁夏
'650000': 7.0,//新疆
'440000': 7.0,//广东
'370000': 7.0,//山东
'450000': 7.3,//广西
'630000': 7.0,//青海
'320000': 7.0,//江苏
'140000': 6.5,//山西
'460000': 7,// 海南
'310000': 6.5,//上海
'110000': 6.5, // 北京
'130000': 6.5, // 河北
'230000': 6, // 黑龙江
'220000': 6,// 吉林
'210000': 6.5, //辽宁
'150000': 6.5,//内蒙古
'120000': 5,// 天津
'620000': 6,// 甘肃
'610000': 8.5,// 甘肃
}
var getColorByDGP = function (adcode) {
if (!colors[adcode]) {
var gdp = GDPSpeed[adcode];
if (!gdp) {
colors[adcode] = 'rgb(227,227,227)'
} else {
var rg = 255 - Math.floor((gdp - 5) / 5 * 255);
colors[adcode] = 'rgb(' + rg + ',' + rg + ',255)';
}
}
return colors[adcode]
}
var disCountry = new AMap.DistrictLayer.Country({
zIndex: 10,
// opacity: 1, //透明度
SOC: 'CHN',
depth: 1,
styles: {
'nation-stroke': '#22ffff',
'coastline-stroke': [0.8, 0.63, 0.94, 1],
'province-stroke': 'white',
'city-stroke': 'rgba(255,255,255,0.5)',//中国特有字段
'fill': function (props) {//中国特有字段
return getColorByDGP(props.adcode_pro)
}
}
})
var disProvince = new AMap.DistrictLayer.Province({
zIndex: 12,
adcode: [130000],
depth: 2,
styles: {
'fill': function (properties) {
// properties为可用于做样式映射的字段,包含
// NAME_CHN:中文名称
// adcode_pro
// adcode_cit
// adcode
var adcode = properties.adcode;
return getColorByAdcode(adcode);
},
'province-stroke': 'cornflowerblue',
'city-stroke': 'white', // 中国地级市边界
'county-stroke': 'rgba(255,255,255,0.5)' // 中国区县边界
}
})
var map = new AMap.Map('container', {
mapStyle: 'amap://styles/90346cc0e942938e7bc3fc166e300dd6', //设置地图的显示样式
zoom: 4,
zooms: [4, 10], // 设置可见级别,[最小级别,最大级别]
center: [105.804852, 34.405203],//中心点坐标
// showIndoorMap: false,
// isHotspot: false,
// defaultCursor: 'pointer',
// touchZoomCenter: 1,
// pitch: 0,
layers: [
new AMap.TileLayer,
disCountry,
],
// viewMode: '3D',
// resizeEnable: true
});
disCountry.on('mouseover', showInfoOver);
function showInfoOver(e) {
var text = '鼠标移入覆盖物!'
console.log(text);
//document.querySelector("#text").innerText = text;
}
map.on('contextmenu', showInfoRightClick);
function showInfoRightClick(e) {
console.log('right');
toggleZoom();
}
function toggleZoom() {
if (map.getZoom() == 4) {
console.log("4:", map.getZoom());
map.setZoom(6);
disProvince.setMap(map);
} else if (map.getZoom() == 6) {
map.setZoom(4);
} else {
console.log("else");
}
}
var getColorByAdcode = function (adcode) {
if (!colors[adcode]) {
var gb = Math.random() * 155 + 50;
colors[adcode] = 'rgb(' + gb + ',' + gb + ',255)';
}
return colors[adcode];
};
console.log('地图初始化完成!')
</script>
</body>
</html>