components_fire_layer_react.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8" />
  8. <title data-i18n="resources.title_componentsFireLayer_React"></title>
  9. <script type="text/javascript" include="react,jquery" src="../js/include-web.js"></script>
  10. <script include="antd,three,iclient-mapboxgl-react,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  11. <style>
  12. html,
  13. body {
  14. height: 100%;
  15. margin: 0;
  16. padding: 0;
  17. }
  18. #main {
  19. height: 100%;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div id="main"></div>
  25. <script type="text/babel">
  26. var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
  27. var attribution =
  28. "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  29. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  30. " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
  31. var SmWebMap = SuperMap.Components.SmWebMap;
  32. var SmFireLayer = SuperMap.Components.SmFireLayer;
  33. var mapOptions = {
  34. container: 'map',
  35. style: {
  36. version: 8,
  37. sources: {
  38. 'raster-tiles': {
  39. attribution: attribution,
  40. type: 'raster',
  41. tiles: [host + '/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}'],
  42. tileSize: 256
  43. },
  44. buildings: {
  45. type: 'geojson',
  46. data: 'https://iclient.supermap.io/examples/data/buildings.json'
  47. }
  48. },
  49. layers: [
  50. {
  51. id: 'simple-tiles',
  52. type: 'raster',
  53. source: 'raster-tiles',
  54. minzoom: 0,
  55. maxzoom: 22
  56. },
  57. {
  58. id: '3d-buildings',
  59. source: 'buildings',
  60. type: 'fill-extrusion',
  61. paint: {
  62. 'fill-extrusion-color': [
  63. 'case',
  64. ['<', ['get', 'height'], 2],
  65. '#fbb03b',
  66. ['<', ['get', 'height'], 4],
  67. '#223b53',
  68. ['<', ['get', 'height'], 8],
  69. '#15D1F2',
  70. ['<', ['get', 'height'], 16],
  71. '#15D1F2',
  72. '#3bb2d0'
  73. ],
  74. 'fill-extrusion-height': ['*', ['get', 'height'], 5],
  75. 'fill-extrusion-opacity': 0.6
  76. }
  77. }
  78. ]
  79. },
  80. center: [116.45423056455218, 39.91980158816503],
  81. zoom: 14.27415578362124,
  82. bearing: 0.8568,
  83. pitch: 60
  84. };
  85. $.get('../data/fire.json', function(features) {
  86. var features = features;
  87. ReactDOM.render(
  88. <SmWebMap mapOptions={mapOptions}>
  89. <SmFireLayer features={features} modelScale={5.41843220338983e-6} />
  90. </SmWebMap>,
  91. document.getElementById('main')
  92. );
  93. });
  94. </script>
  95. </body>
  96. </html>