h10_streetview_baidu.html 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html>
  2. <html class="no-js css-menubar" lang="zh-cn">
  3. <head>
  4. <title>弹窗子页面</title>
  5. <meta charset="utf-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  7. <!-- 移动设备 viewport -->
  8. <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui" />
  9. <meta name="author" content="火星科技 http://mars3d.cn " />
  10. <!-- 360浏览器默认使用Webkit内核 -->
  11. <meta name="renderer" content="webkit" />
  12. <!-- Chrome浏览器添加桌面快捷方式(安卓) -->
  13. <link rel="icon" type="image/png" href="../../img/favicon/favicon.png" />
  14. <meta name="mobile-web-app-capable" content="yes" />
  15. <!-- Safari浏览器添加到主屏幕(IOS) -->
  16. <link rel="icon" sizes="192x192" href="img/favicon/apple-touch-icon.png" />
  17. <meta name="apple-mobile-web-app-capable" content="yes" />
  18. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  19. <meta name="apple-mobile-web-app-title" content="火星科技MarsGIS" />
  20. <!-- Win8标题栏及ICON图标 -->
  21. <link rel="apple-touch-icon-precomposed" href="../../img/favicon/apple-touch-icon.png" />
  22. <meta name="msapplication-TileImage" content="../../img/favicon/app-icon72x72@2x.png" />
  23. <meta name="msapplication-TileColor" content="#62a8ea" />
  24. <!-- 第3方lib引入 -->
  25. <script type="text/javascript" src="../../lib/include-lib.js?time=20210803" libpath="../../lib/" include="jquery,haoutil"></script>
  26. <script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=qObioeG8HeeQVrOVAGScPVhDzlmv6rL9"></script>
  27. <style type="text/css">
  28. body,
  29. html {
  30. width: 100%;
  31. height: 100%;
  32. margin: 0;
  33. font-family: "微软雅黑";
  34. }
  35. #streetscapeMap {
  36. width: 100%;
  37. height: 100%;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div id="streetscapeMap"></div>
  43. <!--页面js-->
  44. <script>
  45. var panorama;
  46. $(document).ready(function () {
  47. var request = haoutil.system.getRequest();
  48. var baiduMpt = new BMap.Point(request.lng, request.lat);
  49. var map = new BMap.Map("streetscapeMap");
  50. map.centerAndZoom(baiduMpt, 15);
  51. map.addTileLayer(new BMap.PanoramaCoverageLayer());
  52. panorama = new BMap.Panorama("streetscapeMap");
  53. panorama.setPosition(baiduMpt); //根据经纬度坐标展示全景图
  54. panorama.setPov({ heading: -40, pitch: 6 });
  55. panorama.addEventListener("position_changed", function (e) {
  56. //全景图位置改变后,普通地图中心点也随之改变
  57. var pos = panorama.getPosition(); //街景变换返回触发的回调函数
  58. if (parent) {
  59. pos = parent.mars3d.PointTrans.bd2wgs([pos.lng, pos.lat]);
  60. parent.updateMarker({ lng: pos[0], lat: pos[1] });
  61. }
  62. // var pov = panorama.getPov()
  63. });
  64. });
  65. //外部传入坐标,更新街景
  66. function setPosition(point) {
  67. let bdPoint = parent.mars3d.PointTrans.wgs2bd([point.lng, point.lat]);
  68. panorama.setPosition(new BMap.Point(bdPoint[0], bdPoint[1])); //根据经纬度坐标展示全景图
  69. }
  70. </script>
  71. </body>
  72. </html>