updateBrowser.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /**
  2. * 应用唯一全局对象
  3. * @namespace ONEMAP
  4. * @type {*|Object}
  5. */
  6. var ONEMAP = ONEMAP || {}; //全局变量
  7. /**
  8. * 模块对象
  9. * @namespace ONEMAP.M
  10. * @type {Object}
  11. */
  12. ONEMAP.M = {}; //模块
  13. /**
  14. * 视图对象
  15. * @namespace ONEMAP.V
  16. * @type {Object}
  17. */
  18. ONEMAP.V = {}; //视图
  19. /**
  20. * 管理对象
  21. * @namespace ONEMAP.C
  22. * @type {Object}
  23. */
  24. ONEMAP.C = {}; //管理
  25. /**
  26. * 共用工具对象
  27. * @namespace ONEMAP.T
  28. * @type {Object}
  29. */
  30. ONEMAP.T = {}; //共用
  31. /**
  32. * 数据对象
  33. * @namespace ONEMAP.D
  34. * @type {Object}
  35. */
  36. ONEMAP.D = {}; //数据
  37. //专题图数据
  38. ONEMAP.D.Thematic = {};
  39. //地图显示专题图数据集
  40. ONEMAP.D.ThematicInMapData = {};
  41. //浏览器类型
  42. ONEMAP.M.liuLanQi = "";
  43. //自定义重要目标与事件
  44. ONEMAP.M.diyData = "";
  45. //require 配置
  46. require.config({
  47. baseUrl: "./",
  48. waitSeconds: 25,
  49. urlArgs: "v=" + onemapVersion,
  50. paths: {
  51. text: "scripts/vendor/require/text",
  52. html: "scripts/vendor/require/html",
  53. css: "scripts/vendor/require/css",
  54. image: "scripts/vendor/require/image",
  55. async: "scripts/vendor/require/async",
  56. font: "scripts/vendor/require/font",
  57. modDir: "scripts/mod",
  58. meteoDir:"scripts/meteo",
  59. layoutDir: "scripts/layout",
  60. vendorDir: "scripts/vendor"
  61. }
  62. });
  63. require([''],
  64. function(update) {
  65. // alert(222);
  66. $.ajaxSetup({ cache: false });
  67. //系统初始化离线或在线
  68. if(map23DConfig.netType == 1){
  69. $.each(map23DConfigIntranet,function(i,t){
  70. map23DConfig[i] = t
  71. })
  72. $.each(onemapUrlConfigIntranet,function(i,t){
  73. onemapUrlConfig[i] = t
  74. })
  75. }else{
  76. $.each(map23DConfigNetwork,function(i,t){
  77. map23DConfig[i]= t
  78. })
  79. $.each(onemapUrlConfigNetwork,function(i,t){
  80. onemapUrlConfig[i] = t
  81. })
  82. }
  83. $(function(){
  84. var map = L.map('mapHolder',{
  85. center:[39,116],
  86. zoom:4
  87. })
  88. L.tileLayer(map23DConfig.tileServerUrl+'/gr?l={z}&x={x}&y={y}', {
  89. minZoom:1,
  90. maxZoom:19,
  91. subdomains:'123456789'
  92. }).addTo(map);
  93. L.tileLayer(map23DConfig.tileServerUrl+'/go?l={z}&x={x}&y={y}', {
  94. minZoom:1,
  95. maxZoom:19,
  96. subdomains:'123456789'
  97. }).addTo(map);
  98. var zoom = $("<div class='zoomControl'>"+map.getZoom()+"</div>");
  99. zoom.appendTo($("#mapHolder .leaflet-control-zoom"));
  100. $("#tiShiGengXin").show();
  101. $("#update .close").bind("click",function(){
  102. $("#update").hide();
  103. })
  104. $("#updateWin7 .close").bind("click",function(){
  105. $("#updateWin7").hide();
  106. })
  107. $("#tiShiGengXin a").bind("click",function(){
  108. $(".updateV").show();
  109. })
  110. //ie6-8 避免不兼容..
  111. $(".baseSatellite").bind("click",function(){
  112. $(".leaflet-layer").remove();
  113. L.tileLayer(map23DConfig.tileServerUrl+'/gr?l={z}&x={x}&y={y}', {
  114. minZoom:1,
  115. maxZoom:19,
  116. subdomains:'123456789'
  117. }).addTo(map);
  118. L.tileLayer(map23DConfig.tileServerUrl+'/go?l={z}&x={x}&y={y}', {
  119. minZoom:1,
  120. maxZoom:19,
  121. subdomains:'123456789'
  122. }).addTo(map);
  123. })
  124. $(".baseTerrain").bind("click",function(){
  125. $(".leaflet-layer").remove();
  126. L.tileLayer(map23DConfig.tileServerUrl+'/gt?l={z}&x={x}&y={y}', {
  127. minZoom:1,
  128. maxZoom:19,
  129. subdomains:'123456789'
  130. }).addTo(map);
  131. })
  132. $(".baseStreet").bind("click",function(){
  133. $(".leaflet-layer").remove();
  134. L.tileLayer(map23DConfig.tileServerUrl+'/gm?l={z}&x={x}&y={y}', {
  135. minZoom:1,
  136. maxZoom:19,
  137. subdomains:'123456789'
  138. }).addTo(map);
  139. })
  140. map.on("zoomend",function(e){
  141. $(".zoomControl").text(map.getZoom());
  142. })
  143. })
  144. });