$('#SearchArea input[type="button"]').prop('disabled',true);var oMap=(function(){if(!$('#afmap')[0]){return null;} var aSearchBounds=null;var oSearchBounds=null;var aResultBounds=null;var oResultBounds=null;var aSearchCenter=[[35.88,136.2],[35.43,136.92]];var oSearchCenter=new cRectangle(aSearchCenter[0],aSearchCenter[1]);var center=oSearchCenter.center();var searchArea={bounds:aSearchBounds,rectangle:oSearchBounds};var resultArea={bounds:aResultBounds,rectangle:oResultBounds};var opt={center:center,zoomControl:true,sidebar:{id:'afmap-sidebar'},searchArea:searchArea,resultArea:resultArea,maxZoom:16};var oMap=new cMap('afmap',opt);oMap.event_on('contextmenu',function(e){onContextMenu(e);});map_infos['map']=oMap;console_log("HighPrecisionBehavioralSegments");if(!oMap.isExists('HighPrecisionBehavioralSegments')){Promise.all([oMap.initTileAsync('HighPrecisionBehavioralSegments.0','af_segment',true).then(function(layer){var id=oMap.updateOverlayLayers('HighPrecisionBehavioralSegments',layer);var checkbox=$('#chkHighPrecisionBehavioralSegments');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;})]);};console_log("Tyousatis_tile1");if(!oMap.isExists('Tyousatis_tile1')){Promise.all([oMap.initTileAsync('Tyousatis_tile1.0','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile1',layer);var checkbox=$('#chkTyousatis_tile1');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;}),oMap.initTileAsync('Tyousatis_tile1.1','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile1',layer);var checkbox=$('#chkTyousatis_tile1');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;}),oMap.initTileAsync('Tyousatis_tile1.2','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile1',layer);var checkbox=$('#chkTyousatis_tile1');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;})]);};console_log("Tyousatis_tile2");if(!oMap.isExists('Tyousatis_tile2')){Promise.all([oMap.initTileAsync('Tyousatis_tile2.0','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile2',layer);var checkbox=$('#chkTyousatis_tile2');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;}),oMap.initTileAsync('Tyousatis_tile2.1','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile2',layer);var checkbox=$('#chkTyousatis_tile2');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;})]);};console_log("Tyousatis_tile3");if(!oMap.isExists('Tyousatis_tile3')){Promise.all([oMap.initTileAsync('Tyousatis_tile3.0','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile3',layer);var checkbox=$('#chkTyousatis_tile3');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;}),oMap.initTileAsync('Tyousatis_tile3.1','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile3',layer);var checkbox=$('#chkTyousatis_tile3');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;}),oMap.initTileAsync('Tyousatis_tile3.2','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile3',layer);var checkbox=$('#chkTyousatis_tile3');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;})]);};console_log("Tyousatis_tile4");if(!oMap.isExists('Tyousatis_tile4')){Promise.all([oMap.initTileAsync('Tyousatis_tile4.0','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('Tyousatis_tile4',layer);var checkbox=$('#chkTyousatis_tile4');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;})]);};console_log("TrenchPhoto");if(!oMap.isExists('TrenchPhoto')){Promise.all([oMap.initGeoJSON('TrenchPhoto.0','af_tyousati',true).then(function(layer){var id=oMap.updateOverlayLayers('TrenchPhoto',layer);var checkbox=$('#chkTrenchPhoto');if(checkbox.length){checkbox.prop('checked',true);checkbox.triggerHandler('click');}return id;})]);};console_log("Offshores");if(!oMap.isExists('Offshores')){Promise.all([oMap.initGeoJSON('Offshores.0','af_overlay',false).then(function(layer){var id=oMap.updateOverlayLayers('Offshores',layer);var checkbox=$('#chkOffshores');if(checkbox.length){checkbox.prop('checked',false);checkbox.triggerHandler('click');}return id;})]);};console_log("Toshikens");if(!oMap.isExists('Toshikens')){Promise.all([oMap.initKML('Toshikens.0','af_overlay',false).then(function(layer){var id=oMap.updateOverlayLayers('Toshikens',layer);var checkbox=$('#chkToshikens');if(checkbox.length){checkbox.prop('checked',false);checkbox.triggerHandler('click');}return id;})]);};console_log("AfZufuku");if(!oMap.isExists('AfZufuku')){Promise.all([oMap.initTileAsync('AfZufuku.0','af_overlay',false).then(function(layer){var id=oMap.updateOverlayLayers('AfZufuku',layer);var checkbox=$('#chkAfZufuku');if(checkbox.length){checkbox.prop('checked',false);checkbox.triggerHandler('click');}return id;}),oMap.initTileAsync('AfZufuku.1','af_overlay',false).then(function(layer){var id=oMap.updateOverlayLayers('AfZufuku',layer);var checkbox=$('#chkAfZufuku');if(checkbox.length){checkbox.prop('checked',false);checkbox.triggerHandler('click');}return id;})]);};return oMap;}());var tileInfos={Seamless:{uri:'https://gbank.gsj.jp/seamless/v2/api/1.2.1/tiles/{z}/{y}/{x}.png',opt:{attribution:"日本シームレス地質図詳細版",opacity:0.6,pane:'af_overlay'}},Epicenters:{uri:'https://gbank.gsj.jp/subsurface/tiledb/work.hypo/images.{year}/{z}/{y}/{x}.png',opt:{attribution:'地震の震央 ({year})',opacity:0.6,pane:'af_overlay'}}};function _initTile(id,param){return new Promise(function(resolve,reject){var info=$.extend(true,{},tileInfos[id]);if(!!param){year=param.year;info.opt.year=year;info.opt.attribution=info.opt.attribution.replace(/{year}/g,year);} resolve(L.tileLayer(info.uri,info.opt));});} function onChkLegend(chk,id){console_log('chk : '+id);var isChecked;if((typeof chk)==='boolean'){isChecked=chk;}else{isChecked=chk.checked;} if(id==='SearchArea'){$('#SearchArea input[type="button"]').prop('disabled',!isChecked);} if((!isChecked)||(!tileInfos[id])){oMap.show(id,isChecked);return;} index=null;param=null;if(id==='Epicenters'){year=$('#SelEpicentersYear').val();index=year;param={year:year};} oMap.show(id,false);if(!oMap.isExists(id,index)){_initTile(id,param).then(function(layer){return oMap.updateOverlayLayers(id,layer,index);}).then(function(id){oMap.show(id,true,index);});}else{oMap.show(id,true,index);}} function onSelLegendEpicenters(sel){checked=$('#ChkEpicenters').prop('checked');if(!checked){return;} year=sel.value;var id='Epicenters';oMap.show(id,false);if(!oMap.isExists(id,year)){_initTile(id,{year:year}).then(function(layer){return oMap.updateOverlayLayers(id,layer,year);}).then(function(id){oMap.show(id,true,year);});}else{oMap.show(id,true,year);} return;} function onSearchAreaChkLegend(chk){var isChecked;if((typeof chk)==='boolean'){isChecked=chk;}else{isChecked=chk.checked;} $('#SearchArea input[type="button"]').prop('disabled',!isChecked);if(isChecked) {oMap.showSearchArea();oMap.event_off('click');}else{oMap.hideSearchArea();oMap.event_on('click',function(e){onClick(e);});}} function onResultAreaChkLegend(chk){var isChecked;if((typeof chk)==='boolean'){isChecked=chk;}else{isChecked=chk.checked;} return isChecked?oMap.showResultArea():oMap.hideResultArea();} function onContextMenu(e){var oDeg={'lon':e.latlng.lng,'lat':e.latlng.lat};var aaa=oMap._map.closePopup();var oLonLat=new cLonLat(oDeg,'ja');var oInfos=oLonLat.Infos();var content=""+""+""+""+"
緯度:"+oInfos.lat+"
経度:"+oInfos.lon+"
十進表記:"+oInfos.latlon+"
"+"
緯度経度をクリップボードにコピー
";oMap._ContextMenu=oMap.openPopup(oDeg.lat,oDeg.lon,content);AddHandler();} function AddHandler(){$(".leaflet-popup").each(function(index,element){var $CBLL=$("#ClipBoardLatLon",$(element));try{$CBLL.zclip({path:"https://gbank.gsj.jp/activefault/CYBER/ZeroClipboard.swf?v=20180202073522",setHandCursor:false,beforeCopy:function(){var $this=$(this);$this.removeClass('btnOff');$this.addClass('btnOn');},copy:function(){var $this=$(this);return $this.attr('title');},afterCopy:function(){var $this=$(this);$this.removeClass('btnOn');$this.addClass('btnOff');}});}catch(e){if(typeof(clipboardData)!="undefined"){$CBLL.on('click',function(){var $this=$(this);$this.removeClass('btnOff');$this.addClass('btnOn');clipboardData.setData("Text",$this.attr('title'));setTimeout(function(){$this.removeClass('btnOn');$this.addClass('btnOff');},100);});}}});}