tianditu.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. /**
  2. * [ONEMAP.M.projectController]
  3. * @return {[object]}
  4. */
  5. define(function(tplLayout) {
  6. /**
  7. * 初始化并订阅事件
  8. * @return {[type]} [description]
  9. */
  10. /**
  11. * 模块数据 用于数据存储和外部调用
  12. * @type {Object}
  13. * 数据存放
  14. */
  15. var modValue = {
  16. }
  17. /**
  18. * 状态值
  19. * @type {Boolean}
  20. * @default false
  21. * @private
  22. */
  23. var status = {
  24. initialized: false,
  25. isShowChild: false,
  26. connect: false,
  27. webSocketState: false,
  28. tdmapContent: false
  29. };
  30. function init() {
  31. if (!status.initialized) {
  32. subscribe();
  33. bindEvent();
  34. status.initialized = true;
  35. status.tdmapContent = true;
  36. // $("#TDMap").parent().find(".menu-content").show();
  37. }
  38. setDixingList();
  39. if(status.tdmapContent){
  40. $("#menu .tdmapContent").addClass("active");
  41. $(this).addClass("active");
  42. status.tdmapContent = false;
  43. }
  44. else{
  45. $("#menu .tdmapContent").removeClass("active");
  46. $(this).removeClass("active");
  47. status.tdmapContent = true;
  48. }
  49. ONEMAP.C.publisher.publish({
  50. modName: 'TDMap'
  51. }, 'menuListClick');
  52. }
  53. function bindEvent(){
  54. $(".zhuanTi").unbind('click').bind('click',function(){
  55. setDixingList();
  56. if(status.tdmapContent){
  57. $("#menu .tdmapContent").addClass("active");
  58. $(this).addClass("active");
  59. status.tdmapContent = false;
  60. }
  61. else{
  62. $("#menu .tdmapContent").removeClass("active");
  63. $(this).removeClass("active");
  64. status.tdmapContent = true;
  65. }
  66. console.log(ONEMAP.D.globalSettingData);
  67. console.log(ONEMAP.D.globalSettingData.map2DThematicSetting);
  68. var secData = ONEMAP.D.globalSettingData.map2DThematicSetting;
  69. var secLength = ONEMAP.D.globalSettingData.map2DThematicSetting.length;
  70. // console.log(secLength);
  71. var ul = $('<ul class="im-3"></ul>');
  72. for(var i=0;i<secLength;i++){
  73. var secDlist = '<li class="p3 clearfix">'+secData[i].name+'</li>';
  74. ul.append(secDlist);
  75. }
  76. var data = ul.html();
  77. $(".zhuanTi").parent().addClass("active");
  78. $(".zhuanTi").parent().find(".im-3").html(data);
  79. })
  80. }
  81. //添加地形图组
  82. function setDixingList() {
  83. $(".tdmapContent").html("");
  84. var zt = $(".tdmapContent");
  85. var category = ONEMAP.D.globalSettingData.map2DThematicCategory;
  86. for (var i = 0; i < category.length; i++) {
  87. if(category[i] == "天地图"){
  88. var liHtml = $('<section class="item"><div class="sectionbg"><span class="translate">' + category[i] + '</span></div></section>')
  89. var linkcontent = $('<ul class="linkContent" style="display:none"></ul>');
  90. $(ONEMAP.D.globalSettingData.map2DThematicSetting).each(function(index, el) {
  91. if(el.category===category[i] && el.category=="天地图"){
  92. var thematicLink = $('<li class="item thematic-layer-link"><div class="linkLibg"></div><input type="checkbox" class="zt-cbx"/><span class="translate">' + el.name + '</span></li>');
  93. thematicLink.find("input").bind('change', el, function(e) {
  94. if (!$(this).is(":checked")) {
  95. $(this).removeClass('selected');
  96. if(ONEMAP.M.toolWeatherMap){
  97. ONEMAP.M.toolWeatherMap.remove();
  98. }
  99. // 从我的图层中移除
  100. var guid = $(this).attr("layer");
  101. // console.log(guid);
  102. var options = {
  103. action: "remove",
  104. DOMid: guid
  105. }
  106. ONEMAP.M.myLayers.myLayerControl(options); // 移除数据层
  107. removeCurrentOverLayerGai(guid);
  108. } else {
  109. // console.log(el);
  110. // console.log(el.type);
  111. // console.log(e.data.type);
  112. ONEMAP.C.publisher.publish('2D', 'layout::mapStyle');
  113. if(el.type == "otherOrigin"){
  114. el.guid = map23DControl.buildGuid("zhuanTi");
  115. }
  116. if(ONEMAP.M.toolWeatherMap){
  117. ONEMAP.M.toolWeatherMap.remove();
  118. }
  119. // removeCurrentOverLayer();
  120. if(e.data.type === "weatherMap"){
  121. //获取云图图集列表数据
  122. var weatherData;
  123. $.ajax({
  124. type:'get',
  125. dataType: 'jsonp',
  126. url: el.productUrl+'/production/product_category?production_id='+el.guid,
  127. beforeSend: ONEMAP.V.loading.load(),
  128. success: function(data) {
  129. weatherData = data;
  130. //添加云图控件
  131. addWeatherControl(weatherData,e.data);
  132. },
  133. error: function(data) {
  134. //console.log("有点小失败");
  135. },
  136. completer: ONEMAP.V.loading.loaded()
  137. })
  138. $('#userThematicList .selected').removeClass('selected');
  139. $(this).addClass('selected');
  140. }else if(e.data.type === "thematicOrigin"){
  141. // console.log("thema");
  142. // 专题一张图(中国地图、海图)
  143. url2D = e.data.url + '/' + e.data.guid + '?l={z}&x={x}&y={y}';
  144. url3D = e.data.url + '/' + e.data.guid + '?z=%d&x=%d&y=%d';
  145. modValue.currentOverLayerGuid = map23DControl.tileLayer({
  146. action: 'add',
  147. layer: {
  148. url2D: url2D,
  149. url3D: url3D,
  150. imageType: 'png',
  151. name:e.data.name,
  152. minZoom:e.data.min_zoom||1,
  153. maxZoom:e.data.max_zoom||19,
  154. guid:e.data.guid
  155. }
  156. })
  157. // 添加到我的图层
  158. var options = {
  159. action: "add",
  160. DOM:{
  161. guid: modValue.currentOverLayerGuid,
  162. type: el.type,
  163. name: el.name,
  164. },
  165. mod: el.type
  166. }
  167. $(this).attr("layer",options.DOM.guid);
  168. $(this).attr("class","zt-cbx " + options.DOM.guid);
  169. modValue.DOMid = ONEMAP.M.myLayers.myLayerControl(options); // 添加信息到“我的图层”
  170. ONEMAP.C.publisher.subscribe(layerAction, options.DOM.guid);
  171. //S 优化
  172. //添加图层透明度控件
  173. // overLayerOpacityControl = new L.Control.LayerOpacity(
  174. // map2DViewer.layers[modValue.currentOverLayerGuid], {
  175. // showFavBtn: false,
  176. // closeCallback: function() {
  177. // removeCurrentOverLayer();
  178. // $('#userThematicList .selected').removeClass('selected');
  179. // }
  180. // }
  181. // ).addTo(map2DViewer.map);
  182. thematicControl(
  183. map2DViewer.layers[modValue.currentOverLayerGuid], {
  184. data: e.data,
  185. showFavBtn: false,
  186. closeCallback: function() {
  187. removeCurrentOverLayer();
  188. $('#userThematicList .selected').removeClass('selected');
  189. }
  190. })
  191. ONEMAP.D.overLayerCount++;
  192. map2DViewer.map.setZoomScope(e.data['min_zoom'], e.data['max_zoom']);
  193. map23DControl.setView({
  194. center: {
  195. lat: e.data['center'].lat,
  196. lng: e.data['center'].lng
  197. },
  198. zoom: e.data['zoom'],
  199. tilt: 0
  200. })
  201. $('#userThematicList .selected').removeClass('selected');
  202. $(this).addClass('selected');
  203. //E 优化
  204. }else if(e.data.type === "vectorOrigin"){
  205. var cartodbF = new cartodbParseF();
  206. cartodbF.getVizInfo({
  207. vizUrl:e.data['url']
  208. },function(tileData){
  209. var tdTileLayerUrl = tileData['templateUrl'].replace('{z}/{x}/{y}', '%d/%d/%d');
  210. modValue.currentOverLayerGuid = map23DControl.tileLayer({
  211. action: 'add',
  212. layer: {
  213. url2D: tileData['templateUrl'],
  214. url3D: tdTileLayerUrl,
  215. imageType: 'png',
  216. name:e.data.name,
  217. minZoom:e.data.min_zoom||1,
  218. maxZoom:e.data.max_zoom||19
  219. }
  220. })
  221. map2DViewer.layers[modValue.currentOverLayerGuid]['utfgrids'] = [];
  222. //添加utfgrid
  223. _.each(tileData.utfgridUrl,function(el,index) {
  224. var aGridLayer = new L.UtfGrid(el+'?callback={cb}');
  225. map2DViewer.layers[modValue.currentOverLayerGuid]['utfgrids'].push(aGridLayer);
  226. aGridLayer.layerNum=index;
  227. aGridLayer.on('click', function (e) {
  228. L.DomEvent.stopPropagation(e);
  229. if(e.data){
  230. var layerNum = e.target._map._layers[e.target._leaflet_id].layerNum;
  231. $.ajax({
  232. url: tileData.serverApiUrl+'/v1/map/'+tileData.layergroupid+'/'+layerNum+'/attributes/'+e.data.cartodb_id,
  233. type: 'GET',
  234. dataType: 'jsonp'
  235. })
  236. .done(function(data) {
  237. if(data){
  238. var popupContent = $('<div></div>');
  239. _.each(data,function(pel,pindex) {
  240. popupContent.append('<div><strong>'+pindex+'</strong>:'+pel+'</div>')
  241. });
  242. var popup = L.popup()
  243. .setLatLng(e.latlng)
  244. .setContent(popupContent.get(0))
  245. .openOn(map2DViewer.map);
  246. }
  247. });
  248. }
  249. });
  250. aGridLayer.addTo(map2DViewer.map);
  251. });
  252. //S 优化
  253. //添加图层透明度控件
  254. overLayerOpacityControl = new L.Control.LayerOpacity(
  255. map2DViewer.layers[modValue.currentOverLayerGuid], {
  256. showFavBtn: false,
  257. closeCallback: function() {
  258. if(map2DViewer.layers[modValue.currentOverLayerGuid]['utfgrids'].length>0){
  259. _.each(map2DViewer.layers[modValue.currentOverLayerGuid]['utfgrids'],function(lel) {
  260. map2DViewer.map.removeLayer(lel);
  261. });
  262. }
  263. removeCurrentOverLayer();
  264. $('#userThematicList .selected').removeClass('selected');
  265. }
  266. }
  267. ).addTo(map2DViewer.map);
  268. thematicControl(
  269. map2DViewer.layers[modValue.currentOverLayerGuid], {
  270. data: e.data,
  271. showFavBtn: false,
  272. closeCallback: function() {
  273. removeCurrentOverLayer();
  274. $('#userThematicList .selected').removeClass('selected');
  275. }
  276. })
  277. ONEMAP.D.overLayerCount++;
  278. map2DViewer.map.setZoomScope(e.data['min_zoom'], e.data['max_zoom']);
  279. map23DControl.setView({
  280. center: {
  281. lat: e.data['center'].lat,
  282. lng: e.data['center'].lng
  283. },
  284. zoom: e.data['zoom'],
  285. tilt: 0
  286. })
  287. $('#userThematicList .selected').removeClass('selected');
  288. $(this).addClass('selected');
  289. //E 优化
  290. });
  291. // 天地图
  292. }else{
  293. // console.log("other 天地图");
  294. var tdTileLayerUrl = e.data['url'].replace('?x={x}&y={y}&z={z}', '?z=%d&x=%d&y=%d');
  295. tdTileLayerUrl = tdTileLayerUrl.replace('?z={z}&x={x}&y={y}', '?z=%d&x=%d&y=%d');
  296. tdTileLayerUrl = tdTileLayerUrl.replace('{z}/{y}/{x}', '%d/%d/%d');
  297. modValue.currentOverLayerGuid = map23DControl.tileLayer({
  298. action: 'add',
  299. layer: {
  300. url2D: e.data['url'],
  301. url3D: tdTileLayerUrl,
  302. imageType: 'png',
  303. name:e.data.name,
  304. minZoom:e.data.min_zoom||1,
  305. maxZoom:e.data.max_zoom||19
  306. }
  307. })
  308. // 添加到我的图层
  309. var options = {
  310. action: "add",
  311. DOM:{
  312. guid: modValue.currentOverLayerGuid,
  313. type: el.type,
  314. name: el.name,
  315. },
  316. mod: el.type
  317. }
  318. $(this).attr("layer",options.DOM.guid);
  319. $(this).attr("class","zt-cbx " + options.DOM.guid);
  320. modValue.DOMid = ONEMAP.M.myLayers.myLayerControl(options); // 添加信息到“我的图层”
  321. ONEMAP.C.publisher.subscribe(layerAction, options.DOM.guid);
  322. //S 优化
  323. //添加图层透明度控件
  324. // overLayerOpacityControl = new L.Control.LayerOpacity(
  325. // map2DViewer.layers[modValue.currentOverLayerGuid], {
  326. // showFavBtn: false,
  327. // closeCallback: function() {
  328. // removeCurrentOverLayer();
  329. // $('#userThematicList .selected').removeClass('selected');
  330. // }
  331. // }
  332. // ).addTo(map2DViewer.map);
  333. thematicControl(
  334. map2DViewer.layers[modValue.currentOverLayerGuid], {
  335. data: e.data,
  336. showFavBtn: false,
  337. closeCallback: function() {
  338. removeCurrentOverLayer();
  339. $('#userThematicList .selected').removeClass('selected');
  340. }
  341. })
  342. ONEMAP.D.overLayerCount++;
  343. map2DViewer.map.setZoomScope(e.data['min_zoom'], e.data['max_zoom']);
  344. map23DControl.setView({
  345. center: {
  346. lat: e.data['center'].lat,
  347. lng: e.data['center'].lng
  348. },
  349. zoom: e.data['zoom'],
  350. tilt: 0
  351. })
  352. $('#userThematicList .selected').removeClass('selected');
  353. $(this).addClass('selected');
  354. //E 优化
  355. }
  356. }
  357. });
  358. thematicLink.appendTo(linkcontent);
  359. }
  360. });
  361. liHtml.find('.sectionbg').bind('click',function(){
  362. $(this).parent().find('.linkContent').toggle();
  363. if($(this).hasClass('open')){
  364. $(this).removeClass('open');
  365. }else{
  366. $(this).addClass('open');
  367. $(this).parent().siblings().find('.linkContent').hide();
  368. $(this).parent().siblings().find('.sectionbg').removeClass('open');
  369. }
  370. })
  371. linkcontent.appendTo(liHtml);
  372. // liHtml.appendTo($("#userThematicList"));
  373. liHtml.appendTo(zt);
  374. }
  375. }
  376. // zt.html($("#userThematicList").html());
  377. // $("#userThematicList section").eq(0).find('.linkContent').show();
  378. // $("#userThematicList section").eq(0).find('.sectionbg').addClass('open');
  379. //更新滚动条
  380. // $('#userThematic .ii-body').mCustomScrollbar('update');
  381. }
  382. //添加三维专题图控制条
  383. function thematicControl(layer, options) {
  384. modValue.thematicControlHtml = $("<div class='thematicControl'>" +
  385. "<iframe frameborder='0' class='cover-iframe'></iframe>" +
  386. "</div>");
  387. var cover_content = $("<div class='cover-content'></div>");
  388. cover_content.appendTo(modValue.thematicControlHtml);
  389. if (options.showFavBtn || !options.onlyShow) {
  390. var optionsWrap = $("<div class='options-wrap'></div>");
  391. optionsWrap.appendTo(cover_content);
  392. }
  393. $("<div class='thematicName'>名称:" + options.data.name + "</div>").appendTo(cover_content);
  394. if (options.atlas) {
  395. var atlasHtml = $("<a class='info_Btntd'>详情</a>");
  396. atlasHtml.appendTo(optionsWrap);
  397. atlasHtml.bind('click', function() {
  398. });
  399. }
  400. if (options.showFavBtn) {
  401. var favBtnHtml = $("<a class='fav_abtntd'>收藏</a>");
  402. favBtnHtml.appendTo(optionsWrap);
  403. favBtnHtml.bind('click', function() {
  404. });
  405. }
  406. if (!options.onlyShow) {
  407. var closeBtnHtml = $("<a class='close_abtntd'>关闭</a>");
  408. closeBtnHtml.appendTo(optionsWrap);
  409. closeBtnHtml.bind('click', function() {
  410. options.closeCallback();
  411. modValue.thematicControlHtml.remove();
  412. })
  413. }
  414. modValue.thematicControlHtml.appendTo($('#thematicControlContent'));
  415. };
  416. function removeCurrentOverLayer() {
  417. if (modValue.currentOverLayerGuid) {
  418. modValue.thematicControlHtml.remove();
  419. map23DControl.tileLayer({
  420. action: 'remove',
  421. guid: modValue.currentOverLayerGuid
  422. })
  423. modValue.currentOverLayerGuid = null;
  424. // map2DViewer.map.removeControl(overLayerOpacityControl);
  425. overLayerOpacityControl = null;
  426. }
  427. ONEMAP.D.overLayerCount--;
  428. if (ONEMAP.D.overLayerCount == 0) {
  429. map2DViewer.map.setZoomScope(1, 19);
  430. }
  431. }
  432. function removeCurrentOverLayerGai(guid) {
  433. if (guid) {
  434. modValue.thematicControlHtml.remove();
  435. map23DControl.tileLayer({
  436. action: 'remove',
  437. guid: guid
  438. })
  439. guid = null;
  440. // map2DViewer.map.removeControl(overLayerOpacityControl);
  441. overLayerOpacityControl = null;
  442. }
  443. ONEMAP.D.overLayerCount--;
  444. if (ONEMAP.D.overLayerCount == 0) {
  445. map2DViewer.map.setZoomScope(1, 19);
  446. }
  447. }
  448. /**
  449. * 设置界面
  450. */
  451. function setLayout() {
  452. }
  453. /**
  454. * 界面重置
  455. * @return {[type]} [description]
  456. */
  457. function layoutResize(options) {
  458. if (options.modName != "TDMap") {
  459. remove();
  460. } else {
  461. if (status.isShowChild) {
  462. remove();
  463. $("#menu #TDMap").removeClass('active');
  464. } else {
  465. $("#menu #TDMap").addClass('active');
  466. status.isShowChild = true;
  467. }
  468. }
  469. }
  470. /**
  471. * 模块移除
  472. * @return {[type]} [description]
  473. */
  474. function remove() {
  475. //取消订阅
  476. unSubscribe();
  477. $("#menu #TDMap").removeClass('active');
  478. status.isShowChild = false;
  479. }
  480. /**
  481. * 注册订阅
  482. * @type {Function}
  483. * 推送:ONEMAP.C.publisher.publish(options,'moduleName::type');
  484. * 订阅:ONEMAP.C.publisher.subscribe(layoutResize,'sideBarLayoutChange');
  485. */
  486. function subscribe() {
  487. ONEMAP.C.publisher.subscribe(layoutResize, 'menuListClick');
  488. // ONEMAP.C.publisher.subscribe(remove, 'cleanMap');
  489. }
  490. /**
  491. * 取消订阅
  492. * @type {Function}
  493. * 取消订阅:ONEMAP.C.publisher.unSubscribe(layoutResize,'sideBarLayoutChange');
  494. */
  495. function unSubscribe() {
  496. }
  497. // 监听图层操作动作
  498. function layerAction(options){
  499. // console.log(options);
  500. // console.log(modValue.ids);
  501. if(options.action == "remove"){
  502. // console.log("remove");
  503. removeLayer(options.guid);
  504. }
  505. else if(options.action == "opacity"){
  506. var opt = options.options.opacity;
  507. setOpacity(options.guid,opt);
  508. }
  509. else if(options.action == "up" || options.action == "down"){
  510. ONEMAP.M.myLayerActions.changeFloor();
  511. }
  512. }
  513. // 更改层级
  514. function changeFloor(){
  515. var li = $("#layerControlMenu .myLayers .mn-content li");
  516. var layer = $("#mapHolder #map2DWrap .leaflet-layer");
  517. var liLength = li.length;
  518. var zidArr = new Array();
  519. for(var i=0;i<liLength;i++){
  520. zidArr.push(li.eq(i).attr("zid"));
  521. for(var j=0;j<layer.length;j++){
  522. if(layer.eq(j).attr("zid") == zidArr[i]){
  523. layer.eq(j).css("z-index",layer.length-i);
  524. }
  525. }
  526. }
  527. }
  528. // 设置透明度
  529. function setOpacity(zid,opt){
  530. map23DControl.tileLayer({
  531. action: 'update',
  532. guid: zid,
  533. layer: {
  534. opacity: opt
  535. }
  536. })
  537. }
  538. // 检查我的图层是否为空
  539. function checkLayerNull(){
  540. // 我的图层暂无数据时
  541. if(typeof($("#layerControlMenu .myLayers .mn-content li").eq(0).html()) == "undefined"){
  542. $("#layerControlMenu .mn-content p.tip-none").show();
  543. }
  544. else{
  545. $("#layerControlMenu .mn-content p.tip-none").hide();
  546. }
  547. }
  548. // 添加图层
  549. function addLayer(data){
  550. $("#layerControlMenu .mn-content p.tip-none").hide();
  551. //添加到23D地图上
  552. modValue.currentOverLayerGuid = map23DControl.tileLayer({
  553. action: 'add',
  554. layer: {
  555. url2D: onemapUrlConfig.thematicTileUrl + '/' + data.guid + '?l={z}&x={x}&y={y}',
  556. url3D: onemapUrlConfig.thematicTileFo3DUrl + '/' + data.guid + '?z=%d&x=%d&y=%d',
  557. minZoom: data['min_zoom'],
  558. maxZoom: data['max_zoom'],
  559. maxNativeZoom: data['max_zoom'],
  560. attribution: '',
  561. opacity: 1,
  562. imageType: 'png',
  563. name:data.name,
  564. guid:data.guid
  565. }
  566. })
  567. map23DControl.setView({
  568. center: {
  569. lat: data['center_lat'],
  570. lng: data['center_lon']
  571. },
  572. zoom: data['zoom']
  573. })
  574. map2DViewer.map.setZoomScope(data['min_zoom'],data['max_zoom']);
  575. }
  576. // 移除图层
  577. function removeLayer(data){
  578. if (data) {
  579. modValue.thematicControlHtml.remove();
  580. map23DControl.tileLayer({
  581. action: 'remove',
  582. guid: data
  583. })
  584. data = null;
  585. // map2DViewer.map.removeControl(overLayerOpacityControl);
  586. overLayerOpacityControl = null;
  587. }
  588. ONEMAP.D.overLayerCount--;
  589. if (ONEMAP.D.overLayerCount == 0) {
  590. map2DViewer.map.setZoomScope(1, 19);
  591. }
  592. }
  593. // 更改层级
  594. function changeFloor(){
  595. var li = $("#layerControlMenu .myLayers .mn-content li");
  596. var layer = $("#mapHolder #map2DWrap .leaflet-layer");
  597. var liLength = li.length;
  598. var zidArr = new Array();
  599. for(var i=0;i<liLength;i++){
  600. zidArr.push(li.eq(i).attr("zid"));
  601. for(var j=0;j<layer.length;j++){
  602. if(layer.eq(j).attr("zid") == zidArr[i]){
  603. layer.eq(j).css("z-index",layer.length-i);
  604. }
  605. }
  606. }
  607. }
  608. return ONEMAP.M.tianditu = {
  609. init: init
  610. }
  611. });