methodMap.js 897 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Author: yang jian fei
  3. * Email: 1294485765@qq.com
  4. * Created Date: Wednesday, April 20th 2022, 12:13:57 pm
  5. * Modified By: yang jian fei
  6. * Desc: desc
  7. * Copyright (c) 2022 瑞为
  8. */
  9. import { getConfig } from './util';
  10. const config = getConfig();
  11. const methods = {
  12. 'API': {
  13. '2.0': {
  14. setMapStyle: 'setMapStyle',
  15. NavigationControl: 'NavigationControl'
  16. },
  17. '3.0': {
  18. setMapStyle: 'setMapStyleV2',
  19. NavigationControl: 'NavigationControl'
  20. }
  21. },
  22. 'WebGL': {
  23. setMapStyle: 'setMapStyleV2',
  24. NavigationControl: 'NavigationControl3D'
  25. }
  26. }
  27. const getMapMethod = (method) => {
  28. const config = getConfig();
  29. if (config.type == 'WebGL') {
  30. return methods[config.type][method];
  31. } else {
  32. return methods[config.type][config.v][method];
  33. }
  34. }
  35. export default getMapMethod;