|
74 | 74 | color: #1890ff; |
75 | 75 | } |
76 | 76 |
|
77 | | - #land-use-count { |
78 | | - margin-left: auto; |
79 | | - color: #777; |
80 | | - line-height: 26px; |
81 | | - white-space: nowrap; |
82 | | - } |
83 | | - |
84 | 77 | #land-use-list { |
85 | 78 | max-height: calc(100vh - 150px); |
86 | 79 | padding: 6px 12px 10px; |
@@ -130,7 +123,6 @@ <h3 data-i18n="resources.text_displayFiltersLandUseType"></h3> |
130 | 123 | <div id="land-use-toolbar"> |
131 | 124 | <button type="button" id="select-all" data-i18n="resources.text_displayFiltersSelectAll"></button> |
132 | 125 | <button type="button" id="select-none" data-i18n="resources.text_displayFiltersSelectNone"></button> |
133 | | - <span id="land-use-count"></span> |
134 | 126 | </div> |
135 | 127 | <div id="land-use-list"> |
136 | 128 | <p class="land-use-loading" data-i18n="resources.text_displayFiltersLoading"></p> |
@@ -260,44 +252,46 @@ <h3 data-i18n="resources.text_displayFiltersLandUseType"></h3> |
260 | 252 | list.appendChild(message); |
261 | 253 | } |
262 | 254 |
|
263 | | - // function createMap() { |
264 | | - // map = new mapboxgl.Map({ |
265 | | - // container: 'map', |
266 | | - // style: { |
267 | | - // version: 8, |
268 | | - // sources: { |
269 | | - // 'land-use-raster': createRasterSource() |
270 | | - // }, |
271 | | - // layers: [ |
272 | | - // { |
273 | | - // id: rasterLayerId, |
274 | | - // type: 'raster', |
275 | | - // source: rasterSourceId, |
276 | | - // minzoom: 0, |
277 | | - // maxzoom: 22 |
278 | | - // } |
279 | | - // ] |
280 | | - // }, |
281 | | - // crs: 'EPSG:4326', |
282 | | - // center: [117.08, 40.04], |
283 | | - // zoom: 7 |
284 | | - // }); |
| 255 | + // 方式一:手动创建地图和图层。 |
| 256 | + function createMap() { |
| 257 | + map = new mapboxgl.Map({ |
| 258 | + container: 'map', |
| 259 | + style: { |
| 260 | + version: 8, |
| 261 | + sources: { |
| 262 | + 'land-use-raster': createRasterSource() |
| 263 | + }, |
| 264 | + layers: [ |
| 265 | + { |
| 266 | + id: rasterLayerId, |
| 267 | + type: 'raster', |
| 268 | + source: rasterSourceId, |
| 269 | + minzoom: 0, |
| 270 | + maxzoom: 22 |
| 271 | + } |
| 272 | + ] |
| 273 | + }, |
| 274 | + crs: 'EPSG:4326', |
| 275 | + center: [117.08, 40.04], |
| 276 | + zoom: 7 |
| 277 | + }); |
285 | 278 |
|
286 | | - // map.addControl(new mapboxgl.NavigationControl(), 'top-left'); |
287 | | - // } |
| 279 | + map.addControl(new mapboxgl.NavigationControl(), 'top-left'); |
| 280 | + } |
288 | 281 |
|
289 | 282 | /* |
| 283 | + * 方式二:使用 mapboxgl.supermap.initMap 根据服务信息创建地图和图层。 |
290 | 284 | */ |
291 | | - function createMap() { |
292 | | - return mapboxgl.supermap.initMap(mapUrl, { |
293 | | - displayFilters: getDisplayFilters(), |
294 | | - }).then(function (result) { |
295 | | - map = result.map; |
296 | | - rasterSourceId = 'smaples-source'; |
297 | | - rasterLayerId = 'sample-layer'; |
298 | | - map.addControl(new mapboxgl.NavigationControl(), 'top-left'); |
299 | | - }); |
300 | | - } |
| 285 | + // function createMap() { |
| 286 | + // return mapboxgl.supermap.initMap(mapUrl, { |
| 287 | + // displayFilters: getDisplayFilters(), |
| 288 | + // }).then(function (result) { |
| 289 | + // map = result.map; |
| 290 | + // rasterSourceId = 'smaples-source'; |
| 291 | + // rasterLayerId = 'sample-layer'; |
| 292 | + // map.addControl(new mapboxgl.NavigationControl(), 'top-left'); |
| 293 | + // }); |
| 294 | + // } |
301 | 295 |
|
302 | 296 | function loadLandUseTypes() { |
303 | 297 | new mapboxgl.supermap.LayerInfoService(mapUrl).getLayersInfo().then(function (serviceResult) { |
|
0 commit comments