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.

AmapImageryProvider.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-01-15 20:31:28
  4. */
  5. import { Cesium } from '@dc-modules/namespace'
  6. import ImageryType from '../ImageryType'
  7. import AmapMercatorTilingScheme from '../tiling-scheme/AmapMercatorTilingScheme'
  8. const TILE_URL = {
  9. img: '//webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
  10. elec:
  11. '//webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',
  12. cva:
  13. '//webst{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}'
  14. }
  15. class AmapImageryProvider extends Cesium.UrlTemplateImageryProvider {
  16. constructor(options = {}) {
  17. options['url'] =
  18. options.url ||
  19. [
  20. options.protocol || '',
  21. TILE_URL[options.style] || TILE_URL['elec']
  22. ].join('')
  23. options['subdomains'] = options.subdomains || ['01', '02', '03', '04']
  24. if (options.crs === 'WGS84') {
  25. options['tilingScheme'] = new AmapMercatorTilingScheme()
  26. }
  27. super(options)
  28. }
  29. }
  30. ImageryType.AMAP = 'amap'
  31. export default AmapImageryProvider