You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

roaming_path.html 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1.0">
  6. <title>dc-example</title>
  7. <script src='/libs/dc-sdk/dc.min.js'></script>
  8. <script src="../dat.gui.min.js"></script>
  9. <link href='/libs/dc-sdk/dc.min.css' type='text/css' rel='stylesheet'>
  10. <link href='../index.css' type='text/css' rel='stylesheet'>
  11. </head>
  12. <body>
  13. <div id="viewer-container" class="viewer-container"></div>
  14. <div class="btn-box">
  15. <ul>
  16. <li><button onclick="play(1)">路径一</button></li>
  17. <li><button onclick="play(2)">路径二</button></li>
  18. <li><button onclick="stop()">结束</button></li>
  19. </ul>
  20. </div>
  21. <script>
  22. let viewer = undefined
  23. let rc = undefined
  24. let path_one = undefined
  25. let path_two = undefined
  26. function play(num){
  27. rc.activate(num===1 ? path_one : path_two,{
  28. pitch:-30
  29. })
  30. }
  31. function stop() {
  32. rc.deactivate()
  33. }
  34. function initViewer() {
  35. viewer = new DC.Viewer('viewer-container')
  36. let baseLayer = DC.ImageryLayerFactory.createAmapImageryLayer({
  37. style:"img",
  38. crs:"WGS84"
  39. })
  40. viewer.addBaseLayer(baseLayer)
  41. rc = new DC.RoamingController(viewer)
  42. path_one = new DC.RoamingPath("120.38105869, 31.10115627;120.38105869,32.10115627",60)
  43. path_two = new DC.RoamingPath("122.38105869, 31.10115627;121.38105869, 31.10115627",100)
  44. rc.addPaths([path_one,path_two])
  45. }
  46. DC.ready({
  47. baseUrl:'../libs/dc-sdk/resources/'
  48. }).then(initViewer)
  49. </script>
  50. </body>
  51. </html>