controler_attribution.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  8. <title data-i18n="resources.title_attribution"></title>
  9. </head>
  10. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  11. <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
  12. <script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
  13. <script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
  14. <script type="text/javascript">
  15. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  16. var map, layerWorld, url = host + "/iserver/services/map-world/rest/maps/World";
  17. map = new SuperMap.Map("map", {
  18. controls: [
  19. new SuperMap.Control.Navigation({
  20. dragPanOptions: {
  21. enableKinetic: true
  22. }
  23. }),
  24. new SuperMap.Control.LayerSwitcher()
  25. ]
  26. });
  27. //初始化版权控件类
  28. attribution = new SuperMap.Control.Attribution();
  29. layerWorld = new SuperMap.Layer.TiledDynamicRESTLayer("World", url); //获取World地图服务地址
  30. layerWorld.events.on({"layerInitialized": addLayer});
  31. function addLayer() {
  32. map.addLayers([layerWorld]);
  33. layerWorld.attribution = "powered by <a target='_blank' href='http://www.supermap.com/cn" + "'>SuperMap</a> |detail in <a style='white-space: nowrap' target='_blank' href='" + url + "'>World</a>";
  34. map.addControl(attribution);
  35. map.setCenter(new SuperMap.LonLat(80, 40), 4);
  36. }
  37. </script>
  38. </body>
  39. </html>