atlasSearch.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. /**
  2. * [ATLAS.M.atlasCategory]
  3. * @return {[object]}
  4. */
  5. define(['html!templates/atlas/atlasCategory',
  6. 'css!styles/atlas/atlasCategory'],
  7. function (tplLayout) {
  8. /**
  9. * 模块数据 用于数据存储和外部调用
  10. * @type {Object}
  11. */
  12. var modValue = {
  13. options: {
  14. type: 1,
  15. page: 1,
  16. pageSize: 20,
  17. searchWord: ''
  18. },
  19. //图集列表
  20. atlasCategoryData: null,
  21. domMarker: ""
  22. }
  23. // 模拟数据
  24. var mn_data = {
  25. "guid": "",
  26. "initial_zoom": 6,
  27. "center_lat": 31.0331660206555,
  28. "center_lon": 107.20230990329375,
  29. "max-zoom": 19,
  30. "min-zoom": 1,
  31. "zoom": 5,
  32. "name": ""
  33. }
  34. /**
  35. * 初始化并订阅事件
  36. * @return {[type]} [description]
  37. */
  38. function init(type, dataArr) {
  39. bindEvent();
  40. subscribe();
  41. }
  42. /**
  43. * 界面事件绑定
  44. * @return {[type]} [description]
  45. */
  46. function bindEvent() {
  47. //console.log("获取keyword:"+ONEMAP.D.user.searchKeyWord);
  48. modValue.options.searchWord = ONEMAP.D.user.searchKeyWord;
  49. // 先获取单幅图的搜索结果
  50. getAtlasCategory();
  51. $("#placePanel .thematic-content .thematic-title li").unbind('click').bind('click', function () {
  52. if ($(this).text() == "单幅图") {
  53. modValue.options.type = 1;
  54. ONEMAP.D.user.searchType = modValue.options.type;
  55. // getAtlasCategory();
  56. }
  57. else if ($(this).text() == "地图对") {
  58. modValue.options.type = 2;
  59. ONEMAP.D.user.searchType = modValue.options.type;
  60. }
  61. else if ($(this).text() == "系列图") {
  62. modValue.options.type = 3;
  63. ONEMAP.D.user.searchType = modValue.options.type;
  64. }
  65. else if ($(this).text() == "地图集") {
  66. modValue.options.type = 4;
  67. ONEMAP.D.user.searchType = modValue.options.type;
  68. }
  69. // modValue.options.type = parseInt($(this).index()) + 1;
  70. // ONEMAP.D.user.searchType = modValue.options.type;
  71. $("#placePanel .thematic-content li").removeClass('active');
  72. $(this).addClass("active");
  73. getAtlasCategory("li");
  74. // $("#placePanel .more a").click()
  75. //
  76. // if(parseInt($("#openSTSideContent").css("right")) != 0){
  77. // var idx = modValue.options.type;
  78. // console.log(idx);
  79. // if(idx == 1){
  80. // ONEMAP.D.user.searchType = 1;
  81. // require(['modDir/atlas/atlasList'], function(atlasList) {
  82. // atlasList.init(101);
  83. // });
  84. // }
  85. // else if(idx > 1 && idx < 5){
  86. // ONEMAP.D.user.searchType = 2;
  87. // require(['modDir/atlas/atlasList'], function(atlasList) {
  88. // atlasList.init();
  89. // require(['modDir/atlas/atlasCategory'], function(atlasCategory) {
  90. // ONEMAP.C.publisher.publish('handShow','layout::sideBar');
  91. // atlasCategory.init(idx,"search");
  92. // });
  93. // });
  94. // }
  95. // }
  96. // var idx = modValue.options.type;
  97. // if(idx == 1){
  98. // ONEMAP.D.user.searchType = 1;
  99. // require(['modDir/atlas/atlasList'], function(atlasList) {
  100. // atlasList.init(101);
  101. // });
  102. // }
  103. // else if(idx > 1 && idx < 5){
  104. // require(['modDir/atlas/atlasCategory'], function(atlasCategory) {
  105. // ONEMAP.C.publisher.publish('handShow','layout::sideBar');
  106. // atlasCategory.init(idx,"search");
  107. // });
  108. // }
  109. })
  110. }
  111. /**
  112. * 界面重置
  113. * @return {[type]} [description]
  114. */
  115. function layoutResize() {
  116. var marginWidth = (parseInt($('#atlasList').width() - 10) % 308 / parseInt($('#atlasList').width() / 308) / 2);
  117. $('#atlasList li').css({ marginLeft: marginWidth, marginRight: marginWidth });
  118. $('.atlas-list').css({ height: $('body').height() - 190 });
  119. $(".atlas-list").mCustomScrollbar('update');
  120. }
  121. /**
  122. * 获取图集列表
  123. * @type {Function}
  124. * @private
  125. */
  126. function getAtlasCategory(option) {
  127. ONEMAP.V.loading.load();
  128. var ajaxUrl = onemapUrlConfig.thematicDataUrl +
  129. '/shelf/products?types=[' + modValue.options.type + ']' +
  130. '&page=' + modValue.options.page +
  131. '&pagesize=' + modValue.options.pageSize +
  132. '&search=' + encodeURIComponent(modValue.options.searchWord);
  133. // //console.log(ajaxUrl);
  134. $.ajax({
  135. type: "get",
  136. dataType: 'jsonp',
  137. url: ajaxUrl,
  138. success: function (data) {
  139. ONEMAP.V.loading.loaded();
  140. if (data.length > 0) {
  141. // console.log(data);
  142. if (data[0]['type'] === modValue.options.type) {
  143. modValue.atlasCategoryData = data[0];
  144. if (option == "li") {
  145. setAtlasCategoryListXin();
  146. } else {
  147. setAtlasCategoryList();
  148. }
  149. }
  150. } else {
  151. ONEMAP.C.publisher.publish({ type: 'error', message: '获取图集列表数据失败!' }, 'noteBar::add');
  152. }
  153. },
  154. error: function (data) {
  155. ONEMAP.V.loading.loaded();
  156. ONEMAP.C.publisher.publish({ type: 'error', message: '获取图集列表数据失败!' }, 'noteBar::add');
  157. }
  158. });
  159. }
  160. /**
  161. * 获取地图对信息并直接跳转地图对比
  162. * @private
  163. */
  164. function showCompare(aid) {
  165. ONEMAP.V.loading.load();
  166. var ajaxUrl = onemapUrlConfig.thematicDataUrl + '/production/product_category?' +
  167. 'production_id=' + aid;
  168. var windowOpen = window.open();
  169. var atlasUrl = onemapUrlConfig.atlasLibraryUrl;
  170. var openUrl;
  171. var num = 0;
  172. $.ajax({
  173. type: "get",
  174. dataType: 'jsonp',
  175. url: ajaxUrl,
  176. success: function (data) {
  177. ONEMAP.V.loading.loaded();
  178. if (data.category.length > 1) {
  179. openUrl = atlasUrl + '/atlasView.html?viewType=' + modValue.options.type +
  180. '&left=' + data.category[0].list[0]['guid'] +
  181. '&right=' + data.category[1].list[0]['guid'] +
  182. '&serialize=' + ONEMAP.C.encryption.enCode(JSON.stringify(modValue.options));
  183. } else {
  184. openUrl = atlasUrl + '/atlasView.html?viewType=' + modValue.options.type +
  185. '&left=' + data.category[0].list[0]['guid'] +
  186. '&right=' + data.category[0].list[1]['guid'] +
  187. '&serialize=' + ONEMAP.C.encryption.enCode(JSON.stringify(modValue.options));
  188. }
  189. },
  190. error: function (data) {
  191. ONEMAP.V.loading.loaded();
  192. ONEMAP.C.publisher.publish({ type: 'error', message: '获取地图对数据失败!' }, 'noteBar::add');
  193. }
  194. });
  195. var utime = setInterval(function () {
  196. if (openUrl) {
  197. windowOpen.location = openUrl;
  198. clearInterval(utime);
  199. } else if (num > 20) {
  200. windowOpen.close();
  201. clearInterval(utime);
  202. }
  203. num++
  204. }, 200);
  205. }
  206. /**
  207. * 设置地图集列表
  208. * @type {Function}
  209. * @private
  210. */
  211. function setAtlasCategoryList() {
  212. // console.log("set list");
  213. // console.log(modValue.atlasCategoryData);
  214. // 去atlaslist里面查询zoom范围等信息
  215. // 查询单幅图
  216. require(['modDir/atlas/atlasList'], function (atlasList) {
  217. atlasList.init(102);
  218. });
  219. // 查询地图库
  220. require(['modDir/atlas/atlasCategory'], function (atlasCategory) {
  221. // ONEMAP.C.publisher.publish('handShow','layout::sideBar');
  222. atlasCategory.init(203, "search");
  223. });
  224. if (modValue.atlasCategoryData.products.length > 0) {
  225. $("#placePanel .thematic-content").show();
  226. var ul = $('<ul class="thematic-list"></ul>');
  227. // 取前三项
  228. var ul_three = $('<ul class="thematic-list"></ul>');
  229. $("#thematicCategoryList").hide();
  230. $.each(modValue.atlasCategoryData.products, function (index, val) {
  231. // console.log(val); //無坐標的product信息
  232. var atlas = val;
  233. var li = $('<li aid="' + atlas.guid + '" layer="' + atlas + '">' +
  234. '<img src="' + onemapUrlConfig.thematicDataUrl + '/production/thumb?' +
  235. 'production_id=' + atlas.guid + '&thumb_id=' + atlas.thumb_min_id + '&v=' + onemapVersion + '"/>' +
  236. '<span class="cover"></span><span class="name">' + atlas.name + '</span></li>');
  237. li.appendTo(ul);
  238. if (index < 3) {
  239. var liC = li.clone();
  240. liC.appendTo(ul_three);
  241. }
  242. // //console.log(ul_three);
  243. });
  244. $("#placePanel .thematic-content .thematic-title li").eq(modValue.options.type - 1).show();
  245. // console.log(modValue.options.type);
  246. // 将搜索结果的前三项插入到搜索面板下面
  247. $("#placePanel .thematic-search-list").empty().append(ul_three);
  248. // ONEMAP.D.user.searchKeyWordAtlasResult = ul;
  249. $("#placePanel .thematic-list li").unbind('click').bind('click', function () {
  250. $("#placePanel .thematic-list li").removeClass('li-select');
  251. $(this).addClass('li-select');
  252. //如果是地图对,直接进入对比阅读
  253. if (modValue.options.type === 2) {
  254. showCompare($(this).attr('aid'));
  255. } else if (modValue.options.type === 1) {//进入单幅图
  256. // console.log("asdfasdf");
  257. ONEMAP.D.user.searchType = 1;
  258. $("#thematicCategoryList").show();
  259. // $(this).attr("load", 1);
  260. modValue.domMarker = $(this);
  261. mn_data.guid = $(this).attr('aid');
  262. mn_data.name = $(this).find(".name").text();
  263. // 添加图层
  264. // console.log(ONEMAP.D.user.searchKeyWordAtlasResult);
  265. var a = ONEMAP.D.user.searchKeyWordAtlasResult;
  266. // console.log(a);
  267. for (var i = 0; i < a.length; i++) {
  268. if (mn_data.guid == a[i].guid) {
  269. // 查重
  270. var checkChongMing = ONEMAP.M.myLayerActions.checkChongMing(a[i].name);
  271. var layerLength = ONEMAP.M.myLayers.checkLength();
  272. if (checkChongMing && layerLength < map23DConfig.layerMaxLength) {
  273. addLayer(a[i]);
  274. // console.log("yes");
  275. var options = {
  276. action: "add",
  277. DOM: {
  278. guid: modValue.currentOverLayerGuid,
  279. type: "layer",
  280. name: mn_data.name
  281. },
  282. mod: "test",
  283. testLayerID: mn_data.guid
  284. }
  285. // 添加到我的图层
  286. ONEMAP.M.myLayers.myLayerControl(options);
  287. ONEMAP.D.overLayerCount++;
  288. // //console.log(options);
  289. ONEMAP.C.publisher.subscribe(layerAction, options.DOM.guid);
  290. }
  291. else {
  292. ONEMAP.C.publisher.publish({ type: 'warning', message: '图层已加载或图层数量已达上限' }, 'noteBar::add');
  293. }
  294. }
  295. }
  296. // addLayer(mn_data);
  297. } else {//进入图集
  298. showAtlas($(this).attr('aid'));
  299. }
  300. })
  301. //(点击更多时再插入到侧边栏中)
  302. $("#placePanel .more a").unbind('click').bind('click', function () {
  303. ONEMAP.D.panelMore = true;
  304. var idx;
  305. var li = $("#placePanel .thematic-title li");
  306. for (var i = 0; i < li.length; i++) {
  307. if (li.eq(i).hasClass("active")) {
  308. idx = i + 1;
  309. }
  310. }
  311. // //console.log(ONEMAP.D.user.searchKeyWordAtlasResult);
  312. // var idx = modValue.options.type;
  313. // console.log(idx);
  314. if (idx == 1) {
  315. ONEMAP.D.user.searchType = 1;
  316. require(['modDir/atlas/atlasList'], function (atlasList) {
  317. atlasList.init(101);
  318. });
  319. }
  320. else if (idx > 1 && idx < 5) {
  321. // ONEMAP.D.user.searchType = 2;
  322. // require(['modDir/atlas/atlasList'], function(atlasList) {
  323. // atlasList.init();
  324. require(['modDir/atlas/atlasCategory'], function (atlasCategory) {
  325. ONEMAP.C.publisher.publish('handShow', 'layout::sideBar');
  326. atlasCategory.init(idx, "search");
  327. });
  328. // });
  329. }
  330. })
  331. // $("#thematicResultsList .item-list").empty().append(ul);
  332. layoutResize();
  333. } else if (ONEMAP.C.ditukuSearchResult == true) {
  334. // console.log("dituku has sth.");
  335. }
  336. else {
  337. // console.log("empty");
  338. // ONEMAP.D.user.searchKeyWordAtlasResult = "";
  339. // $("#placePanel .thematic-search-list").empty();
  340. // $('<div id="noListData">地图库暂无此数据!</div>').appendTo($('#atlasList'));
  341. // $("#placePanel .thematic-search-list").empty().html("地图库暂无此数据");
  342. // ONEMAP.C.publisher.publish({type:'warning',message:'地图库暂无此数据!'},'noteBar::add');
  343. // $("#placePanel .thematic-content").hide();
  344. }
  345. }
  346. function setAtlasCategoryListXin() {
  347. if (modValue.atlasCategoryData.products.length > 0) {
  348. $("#placePanel .thematic-content").show();
  349. var ul = $('<ul class="thematic-list"></ul>');
  350. // 取前三项
  351. var ul_three = $('<ul class="thematic-list"></ul>');
  352. $("#thematicCategoryList").hide();
  353. $.each(modValue.atlasCategoryData.products, function (index, val) {
  354. // console.log(val); //無坐標的product信息
  355. var atlas = val;
  356. var li = $('<li aid="' + atlas.guid + '" layer="' + atlas + '">' +
  357. '<img src="' + onemapUrlConfig.thematicDataUrl + '/production/thumb?' +
  358. 'production_id=' + atlas.guid + '&thumb_id=' + atlas.thumb_min_id + '&v=' + onemapVersion + '"/>' +
  359. '<span class="cover"></span><span class="name">' + atlas.name + '</span></li>');
  360. li.appendTo(ul);
  361. if (index < 3) {
  362. console.log(atlas)
  363. var liC = li.clone();
  364. liC.appendTo(ul_three);
  365. }
  366. // //console.log(ul_three);
  367. });
  368. $("#placePanel .thematic-content .thematic-title li").eq(modValue.options.type - 1).show();
  369. // console.log(modValue.options.type);
  370. // 将搜索结果的前三项插入到搜索面板下面
  371. $("#placePanel .thematic-search-list").empty().append(ul_three);
  372. // ONEMAP.D.user.searchKeyWordAtlasResult = ul;
  373. $("#placePanel .thematic-list li").unbind('click').bind('click', function () {
  374. $("#placePanel .thematic-list li").removeClass('li-select');
  375. $(this).addClass('li-select');
  376. //如果是地图对,直接进入对比阅读
  377. if (modValue.options.type === 2) {
  378. showCompare($(this).attr('aid'));
  379. } else if (modValue.options.type === 1) {//进入单幅图
  380. // console.log("asdfasdf");
  381. ONEMAP.D.user.searchType = 1;
  382. $("#thematicCategoryList").show();
  383. // $(this).attr("load", 1);
  384. modValue.domMarker = $(this);
  385. mn_data.guid = $(this).attr('aid');
  386. mn_data.name = $(this).find(".name").text();
  387. // 添加图层
  388. // console.log(ONEMAP.D.user.searchKeyWordAtlasResult);
  389. var a = ONEMAP.D.user.searchKeyWordAtlasResult;
  390. // console.log(a);
  391. for (var i = 0; i < a.length; i++) {
  392. if (mn_data.guid == a[i].guid) {
  393. // 查重
  394. var checkChongMing = ONEMAP.M.myLayerActions.checkChongMing(a[i].name);
  395. var layerLength = ONEMAP.M.myLayers.checkLength();
  396. if (checkChongMing && layerLength < map23DConfig.layerMaxLength) {
  397. addLayer(a[i]);
  398. // console.log("yes");
  399. var options = {
  400. action: "add",
  401. DOM: {
  402. guid: modValue.currentOverLayerGuid,
  403. type: "layer",
  404. name: mn_data.name
  405. },
  406. mod: "test",
  407. testLayerID: mn_data.guid,
  408. layerData: mn_data
  409. }
  410. // 添加到我的图层
  411. ONEMAP.M.myLayers.myLayerControl(options);
  412. ONEMAP.D.overLayerCount++;
  413. // //console.log(options);
  414. ONEMAP.C.publisher.subscribe(layerAction, options.DOM.guid);
  415. }
  416. else if (!checkChongMing) {
  417. ONEMAP.C.publisher.publish({ type: 'warning', message: '图层已加载' }, 'noteBar::add');
  418. // 判断图层控制是否显示
  419. if (!$("#layerControlMenu").hasClass("bl")) {
  420. $("#layerControlMenu").addClass("bl");
  421. // $("#layerControlMenu .myLayers").addClass("active");
  422. }
  423. if (parseInt($("#layerControlMenu").css("left")) < 0) {
  424. $("#layerControlMenu").css("left", "0");
  425. }
  426. break;
  427. }
  428. else {
  429. ONEMAP.C.publisher.publish({ type: 'warning', message: '图层数量已达上限' }, 'noteBar::add');
  430. }
  431. }
  432. }
  433. } else {//进入图集
  434. showAtlas($(this).attr('aid'));
  435. }
  436. })
  437. //(点击更多时再插入到侧边栏中)
  438. $("#placePanel .more a").unbind('click').bind('click', function () {
  439. ONEMAP.D.panelMore = true;
  440. var idx;
  441. var li = $("#placePanel .thematic-title li");
  442. for (var i = 0; i < li.length; i++) {
  443. if (li.eq(i).hasClass("active")) {
  444. idx = i + 1;
  445. }
  446. }
  447. if (idx == 1) {
  448. ONEMAP.D.user.searchType = 1;
  449. require(['modDir/atlas/atlasList'], function (atlasList) {
  450. atlasList.init(101);
  451. });
  452. }
  453. else if (idx > 1 && idx < 5) {
  454. require(['modDir/atlas/atlasCategory'], function (atlasCategory) {
  455. ONEMAP.C.publisher.publish('handShow', 'layout::sideBar');
  456. atlasCategory.init(idx, "search");
  457. });
  458. }
  459. })
  460. if (ONEMAP.D.panelMore) {
  461. $("#placePanel .more a").click();
  462. }
  463. layoutResize();
  464. } else if (ONEMAP.C.ditukuSearchResult == true) {
  465. }
  466. }
  467. function showAtlas(aid) {
  468. var atlasUrl = onemapUrlConfig.atlasLibraryUrl;
  469. var windowOpen = window.open();
  470. var openUrl = atlasUrl + '/atlasView.html?viewType=' + modValue.options.type + '&' +
  471. 'productionId=' + aid + '&serialize=' + ONEMAP.C.encryption.enCode(JSON.stringify(modValue.options));
  472. windowOpen.location = openUrl;
  473. }
  474. // 添加图层
  475. function addLayer(data) {
  476. //添加到23D地图上
  477. modValue.currentOverLayerGuid = map23DControl.tileLayer({
  478. action: 'add',
  479. layer: {
  480. url2D: onemapUrlConfig.thematicTileUrl + '/' + data.guid + '?l={z}&x={x}&y={y}',
  481. url3D: onemapUrlConfig.thematicTileFo3DUrl + '/' + data.guid + '?z=%d&x=%d&y=%d',
  482. minZoom: data['min_zoom'],
  483. maxZoom: data['max_zoom'],
  484. maxNativeZoom: data['max_zoom'],
  485. attribution: '',
  486. opacity: 1,
  487. imageType: 'png',
  488. name: data.name,
  489. guid: data.guid
  490. }
  491. })
  492. map2DViewer.map.setZoomScope(data['min_zoom'], data['max_zoom']);
  493. if (typeof (data['max_zoom']) != "undefined") {
  494. ONEMAP.M.myLayers.zoomActions("add", data['min_zoom'], data['max_zoom'], data['center_lat'], data['center_lon'], data['initial_zoom'], data.name);
  495. }
  496. else {
  497. ONEMAP.M.myLayers.zoomActions("add", 1, 19, map23DData.view.center['lat'], map23DData.view.center['lng'], data['initial_zoom'], data.name);
  498. }
  499. map23DControl.setView({
  500. // center: {
  501. // lat: data['center_lat'],
  502. // lng: data['center_lon']
  503. // },
  504. zoom: data['initial_zoom']
  505. })
  506. }
  507. // 监听图层操作动作
  508. function layerAction(options) {
  509. //console.log(options);
  510. //console.log(modValue.ids);
  511. if (options.action == "remove") {
  512. //console.log("remove");
  513. removeLayer(options.guid);
  514. }
  515. else if (options.action == "opacity") {
  516. var opt = options.options.opacity;
  517. setOpacity(options.guid, opt);
  518. }
  519. else if (options.action == "up" || options.action == "down") {
  520. ONEMAP.M.myLayerActions.changeFloor();
  521. }
  522. }
  523. // 移除图层
  524. function removeLayer(data) {
  525. // modValue.domMarker.attr("load",0);
  526. if (data) {
  527. //modValue.thematicControlHtml.remove();
  528. map23DControl.tileLayer({
  529. action: 'remove',
  530. guid: data
  531. })
  532. data = null;
  533. // map2DViewer.map.removeControl(overLayerOpacityControl);
  534. overLayerOpacityControl = null;
  535. }
  536. ONEMAP.D.overLayerCount--;
  537. if (ONEMAP.D.overLayerCount == 0) {
  538. map2DViewer.map.setZoomScope(1, 19);
  539. }
  540. }
  541. // 设置透明度
  542. function setOpacity(zid, opt) {
  543. map23DControl.tileLayer({
  544. action: 'update',
  545. guid: zid,
  546. layer: {
  547. opacity: opt
  548. }
  549. })
  550. }
  551. // 更改层级
  552. function changeFloor() {
  553. var li = $("#layerControlMenu .myLayers .mn-content li");
  554. var layer = $("#mapHolder #map2DWrap .leaflet-layer");
  555. var liLength = li.length;
  556. var zidArr = new Array();
  557. for (var i = 0; i < liLength; i++) {
  558. zidArr.push(li.eq(i).attr("zid"));
  559. for (var j = 0; j < layer.length; j++) {
  560. if (layer.eq(j).attr("zid") == zidArr[i]) {
  561. layer.eq(j).css("z-index", layer.length - i);
  562. }
  563. }
  564. }
  565. }
  566. /**
  567. * 注册订阅
  568. * @type {Function}
  569. * 推送:ATLAS.C.publisher.publish(options,'atlasCategory::type');
  570. * 订阅:ATLAS.C.publisher.subscribe(layoutResize,'sideBarLayoutChange');
  571. */
  572. function subscribe() {
  573. ONEMAP.C.publisher.subscribe(function () {
  574. map.invalidateSize();
  575. }, 'atlasView::layoutResize');
  576. }
  577. /**
  578. * 取消订阅
  579. * @type {Function}
  580. * 取消订阅:ATLAS.C.publisher.unSubscribe(layoutResize,'sideBarLayoutChange');
  581. */
  582. function unSubscribe() { }
  583. /**
  584. * 模块移除
  585. * @return {[type]} [description]
  586. */
  587. function remove() {
  588. //取消订阅
  589. //unSubscribe();
  590. }
  591. return ONEMAP.M.atlasCategory = {
  592. init: init,
  593. layoutResize: layoutResize
  594. }
  595. });