Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

TerrainFactory.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-01-21 15:54:56
  4. */
  5. import { Cesium } from '@dc-modules/namespace'
  6. import TerrainType from './TerrainType'
  7. class TerrainFactory {
  8. /**
  9. * Create ellipsoid terrain
  10. * @param options
  11. * @returns {module:cesium.EllipsoidTerrainProvider}
  12. */
  13. static createEllipsoidTerrain(options) {
  14. return new Cesium.EllipsoidTerrainProvider(options)
  15. }
  16. /**
  17. * Create url terrain
  18. * @param options
  19. * @returns {module:cesium.CesiumTerrainProvider}
  20. */
  21. static createUrlTerrain(options) {
  22. return new Cesium.CesiumTerrainProvider(options)
  23. }
  24. /**
  25. * Create google terrain
  26. * @param options
  27. * @returns {module:cesium.GoogleEarthEnterpriseTerrainProvider}
  28. */
  29. static createGoogleTerrain(options) {
  30. return new Cesium.GoogleEarthEnterpriseTerrainProvider(options)
  31. }
  32. /**
  33. * Create arcgis terrain
  34. * @param options
  35. * @returns {module:cesium.ArcGISTiledElevationTerrainProvider}
  36. */
  37. static createArcgisTerrain(options) {
  38. return new Cesium.ArcGISTiledElevationTerrainProvider(options)
  39. }
  40. /**
  41. * Create vr terrain
  42. * @param options
  43. * @returns {module:cesium.VRTheWorldTerrainProvider}
  44. */
  45. static createVRTerrain(options) {
  46. return new Cesium.VRTheWorldTerrainProvider(options)
  47. }
  48. /**
  49. * Create Terrain
  50. * @param type
  51. * @param options
  52. * @returns {any}
  53. */
  54. static createTerrain(type, options) {
  55. let terrain = undefined
  56. switch (type) {
  57. case TerrainType.NONE:
  58. terrain = this.createEllipsoidTerrain(options)
  59. break
  60. case TerrainType.XYZ:
  61. terrain = this.createUrlTerrain(options)
  62. break
  63. case TerrainType.GOOGLE:
  64. terrain = this.createGoogleTerrain(options)
  65. break
  66. case TerrainType.ARCGIS:
  67. terrain = this.createArcgisTerrain(options)
  68. break
  69. case TerrainType.VR:
  70. terrain = this.createVRTerrain(options)
  71. break
  72. default:
  73. break
  74. }
  75. return terrain
  76. }
  77. }
  78. export default TerrainFactory