選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

roaming_path.html 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. <link href="/libs/dc-sdk/dc.min.css" type="text/css" rel="stylesheet" />
  9. <link href="../index.css" type="text/css" rel="stylesheet" />
  10. </head>
  11. <body>
  12. <div id="viewer-container" class="viewer-container"></div>
  13. <div class="btn-box">
  14. <ul>
  15. <li><button onclick="play(1)">路径一</button></li>
  16. <li><button onclick="play(2)">路径二</button></li>
  17. <li><button onclick="stop()">结束</button></li>
  18. </ul>
  19. </div>
  20. <script>
  21. DC.config.baseUrl = '../libs/dc-sdk/resources/'
  22. let viewer = new DC.Viewer('viewer-container')
  23. let baseLayer = DC.ImageryLayerFactory.createAMapImageryLayer({
  24. style: 'img',
  25. crs: 'WGS84',
  26. })
  27. viewer.addBaseLayer(baseLayer)
  28. let rc = new DC.RoamingController(viewer)
  29. let path_one = new DC.RoamingPath(
  30. '120.38105869, 31.10115627;120.38105869,32.10115627',
  31. 60
  32. )
  33. let path_two = new DC.RoamingPath(
  34. '122.38105869, 31.10115627;121.38105869, 31.10115627',
  35. 100
  36. )
  37. rc.addPaths([path_one, path_two])
  38. function play(num) {
  39. rc.activate(num === 1 ? path_one : path_two, {
  40. pitch: -30,
  41. })
  42. }
  43. function stop() {
  44. rc.deactivate()
  45. }
  46. </script>
  47. </body>
  48. </html>