changeTileVersion.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_changeTileVersion"></title>
  9. <script type="text/javascript" src="../js/include-web.js"></script>
  10. <script type="text/javascript" include="iclient-ol-css" src="../../dist/ol/include-ol.js"></script>
  11. </head>
  12. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  13. <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
  14. <script type="text/javascript">
  15. var baseLayer, url = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/map-ChinaProvinces/rest/maps/ChinaProvinces";
  16. var map = new ol.Map({
  17. target: 'map',
  18. controls: ol.control.defaults({attributionOptions: {collapsed: false}})
  19. .extend([new ol.supermap.control.Logo()]),
  20. view: new ol.View({
  21. center: [104.79, 33.03],
  22. zoom: 4,
  23. projection: 'EPSG:4326',
  24. multiWorld: true
  25. })
  26. });
  27. baseLayer = new ol.source.TileSuperMapRest({
  28. origin: [-180, 90],
  29. url: url,
  30. wrapX: true
  31. });
  32. map.addLayer(new ol.layer.Tile({
  33. source: baseLayer,
  34. projection: 'EPSG:4326'
  35. }));
  36. var control = new ol.supermap.control.ChangeTileVersion({
  37. layer: baseLayer,
  38. orientation: "horizontal"
  39. });
  40. control.setMap(map);
  41. map.addControl(control);
  42. </script>
  43. </body>
  44. </html>