toolLDZZ.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. define(function(){
  2. /**
  3. * 状态值
  4. * @type {Boolean}
  5. * @default false
  6. * @private
  7. */
  8. var status = {
  9. initialized:false,//是否初始化
  10. veiwHeightType:null
  11. };
  12. /**
  13. * 模块数据 用于数据存储和外部调用
  14. * @type {Object}
  15. * 数据存放
  16. */
  17. var modValue = {
  18. };
  19. /**
  20. * 三维高度测量初始化
  21. */
  22. function init(){
  23. if(!status.initialized){
  24. subscribe();
  25. status.initialized = true;
  26. }
  27. ONEMAP.C.publisher.publish({
  28. modName: 'toolLDZZ'
  29. }, 'tools:active');
  30. };
  31. /**
  32. * 注册监听事件
  33. */
  34. function subscribe(){
  35. ONEMAP.C.publisher.subscribe(remove, 'change23D');
  36. ONEMAP.C.publisher.subscribe(remove,'tools:active');
  37. };
  38. /**
  39. * 通视分析加载或移除
  40. */
  41. function remove(options){
  42. if(options.modName != 'toolLDZZ'){
  43. $(".tools-LDZZ").removeClass('cur');
  44. //removetoolLDZZ();
  45. }else{
  46. if($(".tools-LDZZ").hasClass('cur')){
  47. $(".tools-LDZZ").removeClass('cur');
  48. removetoolLDZZ();
  49. }else{
  50. $(".tools-LDZZ").addClass('cur');
  51. addtoolLDZZ();
  52. }
  53. }
  54. }
  55. /**
  56. *移除通视分析
  57. */
  58. function removetoolLDZZ(){
  59. locaSpaceMap.Globe.Action = 0; //使鼠标动作返回普通浏览状态
  60. locaSpaceMap.Refresh();
  61. $('#coverHeightLDZZ').hide();
  62. };
  63. /**
  64. * 加载通视分析
  65. */
  66. function addtoolLDZZ(){
  67. $('#coverHeightLDZZ').show();
  68. $('#coverHeightLDZZ .cancel').unbind('click').bind('click',function(){
  69. $('#coverHeightLDZZ').hide();
  70. $(".tools-LDZZ").removeClass('cur');
  71. removetoolLDZZ();
  72. });
  73. $('#coverHeightLDZZ .sure').unbind('click').bind('click',function(){
  74. var height = parseInt($('#coverHeightLDZZ .input').val());
  75. if(height>0 && height<1000){
  76. $('#coverHeightLDZZ').hide();
  77. locaSpaceMap.Globe.CenterHeightOfViewEnvelopeAnalysis = height;
  78. locaSpaceMap.Globe.Action=14;
  79. locaSpaceMap.Refresh();
  80. $(".tools-LDZZ").removeClass('cur');
  81. }else {
  82. alert('请输入大于0小于1000的高度值');
  83. }
  84. });
  85. };
  86. return ONEMAP.M.toolTSFX = {
  87. init:init
  88. }
  89. })