123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- /**
- * [ONEMAP.M.toolShiZi]
- * @return {[object]}
- */
- define(['html!templates/tools/toolShiZi',
- 'css!styles/user'
- ],function(tplLayout){
- var status = {
- userContentShow:false,
- shiZi:false
- }
- function init(){
- unSubscribe();
- subscribe();
- bindEvents();
- setLayout();
- };
- function setLayout(){
- if(!status.shiZi){
- $(tplLayout).appendTo($("#wrapper"));
- status.shiZi = true;
- }
- if($(".tools-shiZi").hasClass("cur")){
- remove({ modName: "cleanMap" });
- }
- else{
- if(map23DData.display.map3D){
- $("#shiZi").addClass("active")
- }
- $(".tools-shiZi").addClass("cur");
- addPolyLine()
- ONEMAP.C.publisher.publish('1', 'jingzhi');
- }
- };
- function addPolyLine(){
- var Arr = [
- [map2DViewer.map.getCenter().lat,-360],
- [map2DViewer.map.getCenter().lat,360]
- ]
- var Brr = [
- [-90,map2DViewer.map.getCenter().lng],
- [90,map2DViewer.map.getCenter().lng]
- ]
- var a = L.polyline(Arr,{color: '#04cfed', weight: 2, opacity: 1}).addTo(map2DViewer.map);
- ONEMAP.D.Szguid = a._leaflet_id;
- var b = L.polyline(Brr,{color: '#04cfed', weight: 2, opacity: 1}).addTo(map2DViewer.map);
- ONEMAP.D.Szguid2 = b._leaflet_id;
- }
- function updateLatlng(){
- var Arr = [
- [map2DViewer.map.getCenter().lat,-360],
- [map2DViewer.map.getCenter().lat,360]
- ]
- var Brr = [
- [-90,map2DViewer.map.getCenter().lng],
- [90,map2DViewer.map.getCenter().lng]
- ]
- map2DViewer.map._layers[ONEMAP.D.Szguid].setLatLngs(Arr)
- map2DViewer.map._layers[ONEMAP.D.Szguid2].setLatLngs(Brr)
- }
- function remove(options){
- if(options.modName == "cleanMap"){
- $(".tools-shiZi").removeClass("cur");
- $("#shiZi").removeClass("active")
- if(map2DViewer.map._layers[ONEMAP.D.Szguid]){
- map2DViewer.map.removeLayer(map2DViewer.map._layers[ONEMAP.D.Szguid]);
- map2DViewer.map.removeLayer(map2DViewer.map._layers[ONEMAP.D.Szguid2]);
- }
- unSubscribe()
- ONEMAP.C.publisher.publish('0', 'jingzhi');
- }
- }
- function fullMap(option){
- // if(option){
- // $("#userContent").fadeOut('slow')
- // }else{
- // $("#userContent").fadeIn('slow')
- // }
- }
- function change23D(options){
- // if($(".tools-shiZi").hasClass("cur")){
- // } else{
- remove({ modName: "cleanMap" });
- $(".tools-shiZi").removeClass("cur")
- $("#shiZi").removeClass("active")
- // }
-
- // if(options == '2d'){
- // $('#userContent').removeClass('class3d');
- // }else{
- // $('#userContent').addClass('class3d');
- // }
- }
- function subscribe(){
- // ONEMAP.C.publisher.subscribe(closeLeft, 'layout::closeLeft');
- ONEMAP.C.publisher.subscribe(change23D,'change23D');
- ONEMAP.C.publisher.subscribe(fullMap, 'layout::fullMap');
- ONEMAP.C.publisher.subscribe(remove, 'tools:active');
- ONEMAP.C.publisher.subscribe(updateLatlng, 'map2DMoveIng');
- // ONEMAP.C.publisher.subscribe(updateLatlng, 'map2DMoveEnd');
- };
- function unSubscribe(){
- ONEMAP.C.publisher.unSubscribe(remove, 'tools:active');
- ONEMAP.C.publisher.unSubscribe(updateLatlng, 'map2DMoveIng');
- }
- function bindEvents(){
-
- };
- return ONEMAP.M.toolShiZi = {
- init:init
- }
- })
|