layer.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import Bus from '@/utils/bus'
  2. const blueColor = '0,0.958507,1,1'
  3. const redColor = '0.583333,0.037082,0,1'
  4. const yellowColor = '0,0.583333,0.021181,1'
  5. /**
  6. * 降雨颜色
  7. * @param {*} val
  8. * @returns
  9. */
  10. export function getColorByWaterQuality(val: number) {
  11. if (!val) {
  12. return '1,1,1'
  13. }
  14. switch (val) {
  15. case 1:
  16. return '0,0.894330,1,1'
  17. case 2:
  18. return '0.362375,1,0.276435,1'
  19. case 3:
  20. return '0,0.583333,0.021181,1'
  21. case 4:
  22. return '0.583333,0.037082,0,1'
  23. case 5:
  24. return '0,0.583333,0.021181,1'
  25. default:
  26. return ''
  27. }
  28. }
  29. export function underWater(show = true) {
  30. let descriptor = {
  31. command: 'Underwater',
  32. data: {
  33. Type: show ? 'True' : 'False',
  34. },
  35. }
  36. Bus.emit('emitUIInteraction', descriptor)
  37. console.log('-- 水下地形:', JSON.stringify(descriptor))
  38. }
  39. export function taihuForecast(type = 'Windy', time: string, show = true) {
  40. debugger
  41. if (type === 'Windy') {
  42. windyIndex++
  43. if (windyIndex % 5 !== 0) {
  44. return
  45. }
  46. }
  47. let descriptor: any = {
  48. command: type,
  49. data: {
  50. Time: time,
  51. Display: show ? 'true' : 'false',
  52. },
  53. }
  54. Bus.emit('emitUIInteraction', descriptor)
  55. console.log('-- ' + type + ' 图层:', JSON.stringify(descriptor))
  56. }
  57. let windyIndex = -1
  58. export function closeTaihuForecast() {
  59. taihuForecast('Windy', '', false)
  60. taihuForecast('Humiture', '', false)
  61. windyIndex = -1
  62. }
  63. export function radarMap(url: any, show = true) {
  64. let descriptor = {
  65. command: 'RadarMap',
  66. data: {
  67. Url: url,
  68. Type: 'RadarMap',
  69. Display: show ? 'true' : 'false',
  70. },
  71. }
  72. Bus.emit('emitUIInteraction', descriptor)
  73. console.log('-- radarMap 图层:', JSON.stringify(descriptor))
  74. }