您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TencentImageryProvider.js 1017B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-01-21 18:10:47
  4. */
  5. import { Cesium } from '@dc-modules/namespace'
  6. import ImageryType from '../ImageryType'
  7. const IMG_URL =
  8. 'https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400'
  9. const ELEC_URL =
  10. 'https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid={style}&scene=0&version=347'
  11. class TencentImageryProvider extends Cesium.UrlTemplateImageryProvider {
  12. constructor(options = {}) {
  13. let url = options.style === 'img' ? IMG_URL : ELEC_URL
  14. options['url'] = url.replace('{style}', options.style || 1)
  15. options['subdomains'] = options.subdomains || ['1', '2', '3']
  16. if (options.style === 'img') {
  17. options['customTags'] = {
  18. sx: (imageryProvider, x, y, level) => {
  19. return x >> 4
  20. },
  21. sy: (imageryProvider, x, y, level) => {
  22. return ((1 << level) - y) >> 4
  23. }
  24. }
  25. }
  26. super(options)
  27. }
  28. }
  29. ImageryType.TENCENT = 'tencent'
  30. export default TencentImageryProvider