// 測地系変換 function ZdcEmapTky2Wgs(lat, lon) { return ZDC.tkyTowgs(new ZDC.LatLon(lat, lon)); } function ZdcEmapWgs2Tky(lat, lon) { return ZDC.wgsTotky(new ZDC.LatLon(lat, lon)); } //現在地 var ZdcEmapMyLocation; function ZdcEmapSetMyLocation(lat_wgs, lon_wgs, wgs) { if (wgs) { ZdcEmapMyLocation = new ZDC.LatLon(lat_wgs, lon_wgs); } else { ZdcEmapMyLocation = ZdcEmapWgs2Tky(lat_wgs, lon_wgs); } } // 地図 var ZdcEmapMapObj = null; // 地図余白領域 var ZdcEmapAnyDispPx = 0; var ZdcEmapAnyDispPy = 0; // マーカー var ZdcEmapListMarkers = []; var ZdcEmapMrkClickFunc = null; // マーカークラスター var ZdcEmapMapShopMrkClstObj = null; var ZdcEmapMrkClstClickFunc = null; //var ZdcEmapListPointMarkers = []; //var ZdcEmapScaleType = "1"; var ZdcEmapWindowWidth = 0; var ZdcEmapWindowHeight = 0; // // 検索終了後に動作する関数 var ZdcEmapResultAfterFunc = null; // 吹き出し var ZdcEmapMsg = null; // アイコン情報 var ZdcEmapIconImg = new Array(); var ZdcEmapIconW = new Array(); var ZdcEmapIconH = new Array(); var ZdcEmapIconOffsetX = new Array(); var ZdcEmapIconOffsetY = new Array(); ZdcEmapIconImg['@SHOP'] = 'https://global.map.japanpost.jp/smt/it/search/img/000000.gif';ZdcEmapIconW['@SHOP'] = 11;ZdcEmapIconH['@SHOP'] = 11;ZdcEmapIconOffsetX['@SHOP'] = 6;ZdcEmapIconOffsetY['@SHOP'] = 6;ZdcEmapIconImg['@NEW'] = 'https://global.map.japanpost.jp/smt/it/search/img/new.gif';ZdcEmapIconW['@NEW'] = 23;ZdcEmapIconH['@NEW'] = 10;ZdcEmapIconOffsetX['@NEW'] = 12;ZdcEmapIconOffsetY['@NEW'] = 5;ZdcEmapIconImg['@SEL'] = 'https://global.map.japanpost.jp/smt/it/search/img/icon_cursor/0003.gif';ZdcEmapIconW['@SEL'] = 51;ZdcEmapIconH['@SEL'] = 50;ZdcEmapIconOffsetX['@SEL'] = 26;ZdcEmapIconOffsetY['@SEL'] = 25;ZdcEmapIconImg['@SELB'] = 'https://global.map.japanpost.jp/smt/it/search/img/icon_cursor/0000.gif';ZdcEmapIconW['@SELB'] = 51;ZdcEmapIconH['@SELB'] = 50;ZdcEmapIconOffsetX['@SELB'] = 26;ZdcEmapIconOffsetY['@SELB'] = 25;ZdcEmapIconImg['@TP'] = 'https://global.map.japanpost.jp/smt/it/search/img/tp11.gif';ZdcEmapIconW['@TP'] = 11;ZdcEmapIconH['@TP'] = 11;ZdcEmapIconOffsetX['@TP'] = 6;ZdcEmapIconOffsetY['@TP'] = 6;ZdcEmapIconImg['01'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=01';ZdcEmapIconW['01'] = 30;ZdcEmapIconH['01'] = 30;ZdcEmapIconOffsetX['01'] = 15;ZdcEmapIconOffsetY['01'] = 15;ZdcEmapIconImg['02'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=02';ZdcEmapIconW['02'] = 24;ZdcEmapIconH['02'] = 24;ZdcEmapIconOffsetX['02'] = 12;ZdcEmapIconOffsetY['02'] = 12;ZdcEmapIconImg['03'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=03';ZdcEmapIconW['03'] = 24;ZdcEmapIconH['03'] = 24;ZdcEmapIconOffsetX['03'] = 12;ZdcEmapIconOffsetY['03'] = 12;ZdcEmapIconImg['04'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=04';ZdcEmapIconW['04'] = 24;ZdcEmapIconH['04'] = 24;ZdcEmapIconOffsetX['04'] = 12;ZdcEmapIconOffsetY['04'] = 12;ZdcEmapIconImg['05'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=05';ZdcEmapIconW['05'] = 24;ZdcEmapIconH['05'] = 24;ZdcEmapIconOffsetX['05'] = 12;ZdcEmapIconOffsetY['05'] = 12;ZdcEmapIconImg['06'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=06';ZdcEmapIconW['06'] = 24;ZdcEmapIconH['06'] = 24;ZdcEmapIconOffsetX['06'] = 12;ZdcEmapIconOffsetY['06'] = 12;ZdcEmapIconImg['07'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=07';ZdcEmapIconW['07'] = 24;ZdcEmapIconH['07'] = 24;ZdcEmapIconOffsetX['07'] = 12;ZdcEmapIconOffsetY['07'] = 12;ZdcEmapIconImg['08'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=08';ZdcEmapIconW['08'] = 24;ZdcEmapIconH['08'] = 24;ZdcEmapIconOffsetX['08'] = 12;ZdcEmapIconOffsetY['08'] = 12;ZdcEmapIconImg['10'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=10';ZdcEmapIconW['10'] = 24;ZdcEmapIconH['10'] = 24;ZdcEmapIconOffsetX['10'] = 12;ZdcEmapIconOffsetY['10'] = 12;ZdcEmapIconImg['11'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=11';ZdcEmapIconW['11'] = 24;ZdcEmapIconH['11'] = 24;ZdcEmapIconOffsetX['11'] = 12;ZdcEmapIconOffsetY['11'] = 12;ZdcEmapIconImg['12'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=12';ZdcEmapIconW['12'] = 24;ZdcEmapIconH['12'] = 24;ZdcEmapIconOffsetX['12'] = 12;ZdcEmapIconOffsetY['12'] = 12;ZdcEmapIconImg['99'] = 'https://map.japanpost.jp/cgi/icon_select.cgi?cid=search&icon_id=99';ZdcEmapIconW['99'] = 30;ZdcEmapIconH['99'] = 30;ZdcEmapIconOffsetX['99'] = 15;ZdcEmapIconOffsetY['99'] = 15; var ZdcEmapSearchFirst = null;//位置決定後の最初の検索か否か var ZdcEmapSearchRetry = null;//地図範囲で検索した結果が0件だった場合に、半径指定で再検索 var ZdcEmapSearchRetryVCnt = 0;//分布地図再検索後、最初のn件が入りきる縮尺に変更する var ZdcEmapSearchCond = null; //絞り込み条件 var ZdcEmapSearchPoint = null;//検索した位置を保持 var ZdcEmapSearchScale = null;//検索した縮尺を保持 var ZdcEmapSearchClickFlg = 0;//最寄検索中に更に地図移動した場合のコンフリクト防止フラグ var ZdcEmapLastOrientation = null;//ウィンドウ縦横 var ZdcEmapSearchFirstInitLvFlg = null; //------------------------------------------------------------- //自動検索のイベント管理 //------------------------------------------------------------- var ZdcEmapSearchEventFlg = 0; var ZdcEmapSearchEventFunc = null; var ZdcEmapSearchEventIdle; var ZdcEmapBoundsChanged = null; var ZdcEmapSearchShopCancel = null; var ZdcEmapSearchEventCenterChangeAvailable = 1; function ZdcEmapInit(init_lat, init_lon, init_lv, nmapflg, wgs, fmt){ var i, len; ZdcEmapWindowWidth = window.innerWidth; ZdcEmapWindowHeight = window.innerHeight; //ZdcEmapLastOrientation = window.orientation; ZdcEmapLastOrientation = 999; if (fmt != 'deg') { init_lat = ZDC.msTodeg(init_lat); init_lon = ZDC.msTodeg(init_lon); } if (wgs) { var latlng = new google.maps.LatLng(init_lat, init_lon); } else { var latlon = ZdcEmapTky2Wgs(init_lat, init_lon); var latlng = new google.maps.LatLng(latlon.lat, latlon.lon); } // add 2011/08/10 H.osamoto [ if (nmapflg && 45 > 0) { ZdcEmapWindowHeight = ZdcEmapWindowHeight - 45; ZdcEmapAnyDispPx = 45; } if (!nmapflg && 45 > 0) { ZdcEmapWindowHeight = ZdcEmapWindowHeight - 45; ZdcEmapAnyDispPx = 45; } // add 2011/08/10 H.osamoto ] // add 2011/12/26 K.Masuda [ if (nmapflg && 0 > 0) { ZdcEmapWindowWidth = ZdcEmapWindowWidth - 0; ZdcEmapAnyDispPy = 0; } if (!nmapflg && 0 > 0) { ZdcEmapWindowWidth = ZdcEmapWindowWidth - 0; ZdcEmapAnyDispPy = 0; } // add 2011/12/26 K.Masuda ] document.getElementById("ZdcEmapMap").setAttribute( 'style', 'postion:absolute; top:0px; left:0px; width:' + ZdcEmapWindowWidth + 'px; height:' + ZdcEmapWindowHeight + 'px; z-index:0;' ); if (!init_lv || init_lv == 0) { init_lv = 18; } init_lv = init_lv - 1; var opts = { zoom: init_lv ,center: latlng ,mapTypeId: google.maps.MapTypeId.ROADMAP ,maxZoom: 22 ,minZoom: 5 ,mapTypeControl: false ,scaleControl: true ,zoomControl: true ,zoomControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT } ,streetViewControl: false }; ZdcEmapMapObj = new google.maps.Map(document.getElementById("ZdcEmapMap"), opts); // POIアイコン吹き出し無効 var mapStylePoiBusiness = new google.maps.StyledMapType([ { featureType: "poi.attraction" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } , { featureType: "poi.government" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } , { featureType: "poi.medical" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } , { featureType: "poi.park" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } , { featureType: "poi.place_of_worship" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } , { featureType: "poi.school" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } , { featureType: "poi.sports_complex" ,elementType: "labels" ,stylers: [{ visibility: "on" }] } ], { name: "Poi Business" }); ZdcEmapMapObj.mapTypes.set("poi_business", mapStylePoiBusiness); ZdcEmapMapObj.setMapTypeId("poi_business"); ZdcEmapMapObj.setClickableIcons(false); // フキダシ表示用オブジェクト ZdcEmapMsg = new google.maps.InfoWindow(); ZdcEmapMsg.set("noSuppress", true); // マーカークラスター } function ZdcEmapShopMapInit(kid, lat, lon, icnno, nflg, lvl, mode, wgs) { var mrk,tmp; if (lvl && lvl != 0) { //lvl = EncRealZoom(lvl); ZdcEmapMapObj.setZoom(lvl - 1); } else if(18 > 0) { //lvl = EncRealZoom(18); ZdcEmapMapObj.setZoom(lvl - 1); } //店舗アイコンを表示する if (ZdcEmapIconImg[icnno] == null) icnno = "@TP"; if (mode == "nomsgbox") { mrk = ZdcEmapMakeMrk(0, lat, lon, ZdcEmapIconW[icnno], ZdcEmapIconH[icnno], ZdcEmapIconW['@NEW'], ZdcEmapIconH['@NEW'], ZdcEmapIconOffsetX[icnno], ZdcEmapIconOffsetY[icnno], ZdcEmapIconW[icnno]-ZdcEmapIconW['@NEW'], ZdcEmapIconH[icnno], 0, -8, ZdcEmapIconImg[icnno], ZdcEmapIconImg["@NEW"], kid, icnno, nflg, null ,null ,wgs ); } else { mrk = ZdcEmapMakeMrk(0, lat, lon, ZdcEmapIconW[icnno], ZdcEmapIconH[icnno], ZdcEmapIconW['@NEW'], ZdcEmapIconH['@NEW'], ZdcEmapIconOffsetX[icnno], ZdcEmapIconOffsetY[icnno], ZdcEmapIconW[icnno]-ZdcEmapIconW['@NEW'], ZdcEmapIconH[icnno], 0, -8, ZdcEmapIconImg[icnno], ZdcEmapIconImg["@NEW"], kid, icnno, nflg, function() { ZdcEmapShopMsg(0, 1, 'detail'); } ,null ,wgs ); } ZdcEmapListMarkers[0] = mrk; mrk.marker.setZIndex(100); mrk.marker.setMap(ZdcEmapMapObj); if(mrk.tooltip != null) mrk.tooltip.setMap(ZdcEmapMapObj); if (mode == '') { ZdcEmapShopMsg(0, 1, 'detail'); } } //アイコン登録(API2.0用) function ZdcEmapMakeMrk(id, lat, lon, sizew, sizeh, shadowsizew, shadowsizeh, offsetx, offsety, shdoffsetx, shdoffsety, msgoffsetx, msgoffsety, image, shadowimage, data1, data2, nflg, mouseclickmarker , lvl , wgs ) { lat = ZDC.msTodeg(lat); lon = ZDC.msTodeg(lon); if (!wgs) { var latlon_wgs = ZdcEmapTky2Wgs(lat, lon); var latlng = new google.maps.LatLng(latlon_wgs.lat, latlon_wgs.lon); } else { var latlng = new google.maps.LatLng(lat, lon); } if(image.substr(image.length - 4, 4) != '.gif'){ var ts = new Date().getTime(); image += image.indexOf('?') < 0 ? '?' : '&' + 'dummy=' + ts + '.gif'; } var marker = new google.maps.Marker({ icon : new google.maps.MarkerImage( image, new google.maps.Size(sizew, sizeh), new google.maps.Point(0, 0), new google.maps.Point(offsetx, offsety) ), optimized : false, position : latlng }); marker.data = {id: id}; if(typeof mouseclickmarker == 'function') google.maps.event.addListener(marker, "click", mouseclickmarker); var tooltip = null; if(nflg == 1){ var tooltip = new google.maps.Marker({ icon : new google.maps.MarkerImage( shadowimage, new google.maps.Size(shadowsizew, shadowsizeh), new google.maps.Point(0, 0), new google.maps.Point(shdoffsetx, shdoffsety) ), optimized : false, position : latlng }); tooltip.data = {id: id}; if(typeof mouseclickmarker == 'function') google.maps.event.addListener(tooltip, "click", mouseclickmarker); } return { 'id': id, 'marker': marker, 'tooltip': tooltip, 'data1': data1, 'data2': data2, 'w': sizew, 'h': sizeh } } //フキダシ表示 //function ZdcEmapShopMsg(id, link, maptype, overlap) { mod 2016/04/14 N.Wada function ZdcEmapShopMsg(id, link, maptype) { ZdcEmapReadOn(); ZdcEmapShopMsgClose(); //デザイン var obj = ZdcEmapListMarkers[id]; //フキダシを表示させる var url = "http://127.0.0.1/smt/it/search/shop_msg.htm?cid=search&kid="+obj.data1; //url += ""; // add 2012/01/11 Y.Matsukawa mod 2012/09/10 Y.Matsukawa url += ""; url += "&https_req=1"; if (link) url += "&link="+link; if (maptype) url += "&maptype="+maptype; url += "&PARENT_HTTP_HOST=global.map.japanpost.jp"; ZdcEmapHttpRequestHtml(url, function(html,status){ if(status) html = "Siamo spiacenti, ma il server è al momento sovraccarico. Si prega di riprovare più tardi. msg["+status+"]"; ZdcEmapSearchEventCenterChangeAvailable = 0; //ZdcEmapMsg.setHtml(html); //ZdcEmapMsg.moveLatLon(obj.marker.getLatLon()); //ZdcEmapMsg.open(); ZdcEmapMsg.setContent(html); ZdcEmapMsg.open(ZdcEmapMapObj, obj.marker); ZdcEmapReadOff(); }, false, 2); } //フキダシ表示(マーカークラスタ用) function ZdcEmapShopMsgCluster(mCluster, link, maptype) { ZdcEmapReadOn(); ZdcEmapShopMsgClose(); var markers = mCluster.getMarkers(); if(markers.length == 0) return; //フキダシを表示させる var kidprm = ""; for (var i=0; i 0)) { //opts.latlon = ZDC.degToms(box.getMin().lat) // + "," + ZDC.degToms(box.getMin().lon) // + "," + ZDC.degToms(box.getMax().lat) // + "," + ZDC.degToms(box.getMax().lon); opts.latlon = ZDC.degToms(boxmin.lat) + "," + ZDC.degToms(boxmin.lon) + "," + ZDC.degToms(boxmax.lat) + "," + ZDC.degToms(boxmax.lon); opts.radius = 50000; } else { ZdcEmapSearchFirst = 0; opts.radius = 50000; } if (cond) opts.jkn = cond; opts.pos = 1; opts.minCount = 1; opts.maxCount = 50; opts.limitCount = 50; opts.timeout = 60000; opts.cols = "NAME,COL_184,COL_192,COL_193"; ZdcEmapNearShop2.opts = opts; //アイコンを表示する ZdcEmapNearShop2.search(opts,ZdcEmapSearchShopResult); } //検索結果の処理 function ZdcEmapSearchShopResult(result) { var i,item,mrk,tmp,icnt,maxlat=0,maxlon=0,minlat=999999999,minlon=999999999; //var tooltip_w,tooltip_h,tooltip_offset_x,tooltip_offset_y; // add 2011/08/10 H.Osamoto //吹き出し削除 ZdcEmapShopMsgClose(); // マーカークラスター削除 // マーカー削除 for(i = 0; i < ZdcEmapListMarkers.length; i++){ //ZdcEmapMapObj.removeWidget(ZdcEmapListMarkers[i].marker); ZdcEmapListMarkers[i].marker.setMap(null); if(ZdcEmapListMarkers[i].tooltip) { //ZdcEmapMapObj.removeWidget(ZdcEmapListMarkers[i].tooltip); ZdcEmapListMarkers[i].tooltip.setMap(null); } } ZdcEmapListMarkers = []; //エラー処理 if(result.status != 0 && result.status != 3 && result.status != 5 && result.status != 9) { alert("Ricerca fallita listres["+result.status+"]"); ZdcEmapSearchEventStart(); ZdcEmapReadOff(); return; } //地図に置く icnt = result.items.length; if (icnt > 0) { for (i=icnt-1; i>=0; i--) { item = result.items[i]; if(!item.icon) break; if(item.nflg == 1) tmp = ZdcEmapIconImg["@NEW"]; else tmp = ""; // add 2011/08/10 H.Osamoto [ // アイコン位置を指定する場合は通常のnewアイコン表示処理を行わない //if (tooltip_w && tooltip_h) { // tmp = ""; //} // 無効なアイコンIDの場合は透明アイコンに差し替え add 2012/11/15 Y.Matsukawa if (ZdcEmapIconImg[item.icon] == null) ZdcEmapIconImg[item.icon] = ZdcEmapIconImg["@TP"]; // add 2011/08/10 H.Osamoto ] item.lat_wgs = item.col_192; item.lon_wgs = item.col_193; // if (item.lat_wgs) item.lat_wgs = ZDC.msTodeg(item.lat_wgs); // if (item.lon_wgs) item.lon_wgs = ZDC.msTodeg(item.lon_wgs); var wgs = false; if (item.lat_wgs && item.lon_wgs) { item.lat = item.lat_wgs; item.lon = item.lon_wgs; wgs = true; } mrk = ZdcEmapMakeMrk(i, item.lat, item.lon, ZdcEmapIconW[item.icon], ZdcEmapIconH[item.icon], ZdcEmapIconW['@NEW'], ZdcEmapIconH['@NEW'], //ZdcEmapIconOffsetX[item.icon],ZdcEmapIconOffsetY[item.icon],ZdcEmapIconW[item.icon]-ZdcEmapIconW['@NEW'],ZdcEmapIconH[item.icon],0,-8, ZdcEmapIconOffsetX[item.icon], ZdcEmapIconOffsetY[item.icon], ZdcEmapIconW['@NEW']-ZdcEmapIconOffsetX[item.icon], ZdcEmapIconOffsetY[item.icon]*-1, 0, -8, ZdcEmapIconImg[item.icon], tmp, item.id, item.icon, item.nflg, function() { if (typeof ZdcEmapMrkClickFunc === "function") { ZdcEmapMrkClickFunc(this.data.id); } else { //ZdcEmapShopMsg(this.data.id, 1, 'bunpu', ""); mod 2016/04/14 N.Wada ZdcEmapShopMsg(this.data.id, 1, 'bunpu'); } }, item.lvl ,wgs ); // add 2011/08/10 H.osamoto [ mrk.marker.setMap(ZdcEmapMapObj); ZdcEmapListMarkers[i] = mrk; if(mrk.tooltip != null) mrk.tooltip.setMap(ZdcEmapMapObj); // add 2011/08/10 H.osamoto ] //最大最小緯度経度取得 ZdcEmapSearchRetry = 0; if (ZdcEmapSearchRetryVCnt) { if (i+1 <= ZdcEmapSearchRetryVCnt) { if(item.lat > maxlat) maxlat = item.lat; if(item.lon > maxlon) maxlon = item.lon; if(item.lat < minlat) minlat = item.lat; if(item.lon < minlon) minlon = item.lon; } } else { if(item.lat > maxlat) maxlat = item.lat; if(item.lon > maxlon) maxlon = item.lon; if(item.lat < minlat) minlat = item.lat; if(item.lon < minlon) minlon = item.lon; } } // マーカークラスター生成 var p = ZdcEmapMapObj.getCenter(); var center = ZdcEmapWgs2Tky(p.lat(), p.lng()); if(wgs) center = new ZDC.LatLon(p.lat(), p.lng()); ZdcEmapSearchRetryVCnt = 0; // add 2011/06/29 Y.Matsukawa [ if(ZdcEmapSearchClickFlg) { ZdcEmapSearchClickFlg = 0; // add 2011/06/29 Y.Matsukawa ] //初期検索時は画面移動 if(ZdcEmapListMarkers.length > 0){ if(16 == 0) { //拠点が収まる範囲に移動 ZdcEmapMapMoveBoxCenterFixed(ZDC.msTodeg(minlat), ZDC.msTodeg(minlon), ZDC.msTodeg(maxlat), ZDC.msTodeg(maxlon), center.lat, center.lon, wgs); ZdcEmapSearchShopCancel = 1; } } else { //検索半径の縮尺に移動 var rx = parseInt((450000 / (11 * 1000)) * 50000);//CGIと計算をあわせる var ry = parseInt((300000 / (9 * 1000)) * 50000);//〃 ZdcEmapMapMoveBoxCenterFixed( center.lat - ZDC.msTodeg(rx), center.lon - ZDC.msTodeg(ry), center.lat + ZDC.msTodeg(rx), center.lon + ZDC.msTodeg(ry), center.lat, center.lon ); } } } else { if (ZdcEmapSearchRetry) { ZdcEmapSearchRetry = 0; ZdcEmapSearchFirst = 1; ZdcEmapSearchClickFlg = 1; ZdcEmapSearchPoint = null;//必ず再検索させるため ZdcEmapSearchRetryVCnt = 0; ZdcEmapReadOff(); ZdcEmapSearchShop(ZdcEmapSearchCond); return; } } ZdcEmapSearchEventStart(); //検索位置を保持 ZdcEmapSearchPoint = ZdcEmapMapObj.getCenter(); ZdcEmapSearchScale = ZdcEmapMapObj.getZoom(); ZdcEmapReadOff(); if (ZdcEmapSearchFirst == 1 && 14 > 0) { ZdcEmapSearchFirst = 0; if (ZdcEmapListMarkers.length == 0) { ZdcEmapMapObj.setZoom(14); } } else { if (ZdcEmapListMarkers.length == 0) { ZdcEampVisibleNotFound(); google.maps.event.addListenerOnce(ZdcEmapMapObj, "bounds_changed", ZdcEampHiddenNotFound); } } if (typeof ZdcEmapResultAfterFunc === "function") ZdcEmapResultAfterFunc(); } // 検索イベント開始 function ZdcEmapSearchEventStart() { ZdcEmapSearchEventFlg = 1; } // 検索イベント停止 function ZdcEmapSearchEventStop() { ZdcEmapSearchEventFlg = 0; } //検索実行 function ZdcEmapSearchEventAction() { if(!ZdcEmapSearchEventFlg) return; //if(ZdcEmapMapObj.getUserMsgOpenStatus()) return;//フキダシ表示中は検索しない if (!ZdcEmapSearchEventCenterChangeAvailable) { ZdcEmapSearchEventCenterChangeAvailable = 1; return; } eval(ZdcEmapSearchEventFunc); } //検索イベント追加 function ZdcEmapSearchEventAdd(func) { ZdcEmapSearchEventDel(); ZdcEmapSearchEventFunc = func; ZdcEmapSearchEventIdle = google.maps.event.addListener(ZdcEmapMapObj, "idle", ZdcEmapSearchEventAction); } //検索イベント削除 function ZdcEmapSearchEventDel() { ZdcEmapSearchEventStop(); //if(ZdcEmapSearchEventDragmapend) ZDC.removeListener(ZdcEmapSearchEventDragmapend); //if(ZdcEmapSearchEventChangezoomend) ZDC.removeListener(ZdcEmapSearchEventChangezoomend); //ZdcEmapSearchEventDragmapend = null; ////ZdcEmapSearchEventScrollmapend = null; //ZdcEmapSearchEventChangezoomend = null; if(ZdcEmapSearchEventIdle) google.maps.event.removeListener(ZdcEmapSearchEventIdle); ZdcEmapSearchEventIdle = null; delete ZdcEmapSearchEventFunc; } // 読み込み中制御 var ZdcEmapReading = 0;//読み込み中・処理中フラグ function ZdcEmapReadOn() { ZdcEmapReading ++; //if(ZdcEmapReading == 1) ZdcEmapMapObj.visibleZdcWait(); if(ZdcEmapReading == 1) ZdcEampVisibleWait(); } function ZdcEmapReadOff() { if(ZdcEmapReading <= 0) return; ZdcEmapReading --; //if(ZdcEmapReading == 0) ZdcEmapMapObj.hiddenZdcWait(); if(ZdcEmapReading == 0) ZdcEampHiddenWait(); } function ZdcEampVisibleWait() { var wait = document.getElementById("ZdcEmapWait"); if (!wait) return; wait.style.left = (ZdcEmapWindowWidth / 2 + (-60))+'px'; wait.style.top = (ZdcEmapWindowHeight / 2 + (-15))+'px'; // wait.style.width = 121; // wait.style.height = 31; wait.style.display = "block"; } function ZdcEampHiddenWait() { var wait = document.getElementById("ZdcEmapWait"); if (!wait) return; // wait.style.width = 0; // wait.style.height = 0; wait.style.display = "none"; } function ZdcEampVisibleNotFound() { var nf = document.getElementById("ZdcEmapNotFound"); if (!nf) return; nf.style.left = (ZdcEmapWindowWidth / 2 + (-130))+'px'; nf.style.top = (ZdcEmapWindowHeight / 2 + (0))+'px'; nf.style.display = "block"; } function ZdcEampHiddenNotFound() { var nf = document.getElementById("ZdcEmapNotFound"); if (!nf) return; nf.style.display = "none"; } //拠点案内用の独自UI function ZdcEmapOriginalUI(lat, lon) { var elmZoom = document.getElementById("mapZoom"), elmMoveMyLoc = document.getElementById("mapMoveMyLocation"), elmInitPos = document.getElementById("mapInitPosition"), elmSrchRoute = document.getElementById("mapSearchRoute"), elmSelectRoute, timer_id, counter = 0, i, len, neki, optgroup, option; function mapControlAdd(element, position) { var control; if (!element) return; control = document.createElement('div'); control.appendChild(element); control.index = 1; ZdcEmapMapObj.controls[position].push(control); } mapControlAdd(elmZoom, google.maps.ControlPosition.RIGHT_BOTTOM); mapControlAdd(elmMoveMyLoc, google.maps.ControlPosition.LEFT_BOTTOM); mapControlAdd(elmInitPos, google.maps.ControlPosition.LEFT_BOTTOM); mapControlAdd(elmSrchRoute, google.maps.ControlPosition.TOP_CENTER); if (elmSrchRoute) { // 最寄り駅検索 ZdcEmapStation(lat,lon); // 検索終了後にプルダウンに最寄り駅を追加 (function setSelectRouteNekiList() { timer_id = setTimeout( setSelectRouteNekiList, 100 ); if ( ZdcEmapNekiList && (elmSelectRoute = document.getElementById("selectRoute")) ) { if ( timer_id ) clearTimeout( timer_id ); if ( (len = ZdcEmapNekiList.length) > 0) { optgroup = document.createElement('optgroup'); optgroup.setAttribute("label", "周辺の駅から"); for( i = 0; i < len; i++ ){ neki = ZdcEmapNekiList[i]; option = document.createElement('option'); option.value = "eki,"+i; option.appendChild(document.createTextNode(neki.text)); optgroup.appendChild(option); } elmSelectRoute.appendChild(optgroup); } } if (counter >= 9) { clearTimeout( timer_id ); } counter++; }()); } } //地図ズームイン function ZdcEmapZoomIn() { ZdcEmapMapObj.setZoom(ZdcEmapMapObj.getZoom() + 1); } //地図ズームアウト function ZdcEmapZoomOut() { ZdcEmapMapObj.setZoom(ZdcEmapMapObj.getZoom() - 1); } //--------------------------------------------------------------------------- // Landscape(横表示/縦表示)で地図サイズを切り替えます。 // onLoad 時と、onorientationchange 時にコールされます。 //--------------------------------------------------------------------------- function ZdcEmapChangeOrientation() { ZdcEmapWindowHeight = ZdcEmapWindowHeight - ZdcEmapAnyDispPx; // add 2011/08/26 H.osamoto ZdcEmapWindowWidth = ZdcEmapWindowWidth - ZdcEmapAnyDispPy; // add 2011/12/26 K.Masuda var mapDom = document.getElementById('ZdcEmapMap'); mapDom.style.width = ZdcEmapWindowWidth + 'px'; mapDom.style.height = ZdcEmapWindowHeight + 'px'; google.maps.event.trigger(ZdcEmapMapObj, 'resize'); } window.onload = function() { ZdcEmapWindowWidth = window.innerWidth; ZdcEmapWindowHeight = window.innerHeight; }; //------------------------------------------------------------- //最寄駅検索 //------------------------------------------------------------- var ZdcEmapNekiLat; var ZdcEmapNekiLon; var ZdcEmapNekiList; //駅検索メイン処理 function ZdcEmapStation(lat, lon) { ZdcEmapReadOn(); // var tmplatlon; if (lat && lon){ tmplatlon = new ZDC.LatLon(Number(lat), Number(lon)); } else { tmplatlon = ZdcEmapWgs2Tky(ZdcEmapMapObj.getCenter().lat(), ZdcEmapMapObj.getCenter().lng()); } ZdcEmapNekiLat = tmplatlon.lat; ZdcEmapNekiLon = tmplatlon.lon; var ival = { latlon: tmplatlon, radius: 5000, datum: "TOKYO", limit: "0"+","+"10" }; ZDC.Search.getStationByLatLon(ival, function(stt, res){ ZdcGetNearStationResult(stt, res); }); } function ZdcGetNearStationResult(stt, res) { var i, len = res.item.length, item; //エラー処理 if(stt.code != "000" || stt.text != "ok") { ZdcEmapNekiList = null; alert("Ricerca fallita ekires["+stt.code+","+stt.text+"]"); ZdcEmapSearchEventStart(); ZdcEmapListObj.innerHTML = ""; ZdcEmapReadOff(); return; } ZdcEmapNekiList = []; if ( len > 0 ) { for( i=0; i < len; i++ ){ item = res.item[i]; ZdcEmapNekiList.push({ lat: item.poi.latlon.lat, lon: item.poi.latlon.lon, text: item.poi.text }); } } ZdcEmapReadOff(); } var ZdcEmapRouteType = null; var ZdcEmapRouteCase = null; var ZdcEmapRoutePoint1 = null; var ZdcEmapRoutePoint2 = null; var ZdcEmapRouteSearchShopDetailEventClicked = null; function ZdcEmapChangeRouteType(type) { var elmWalkOn = document.getElementById("mapRouteTypeWalkOn"), elmWalkOff = document.getElementById("mapRouteTypeWalkOff"), elmCarOn = document.getElementById("mapRouteTypeCarOn"), elmCarOff = document.getElementById("mapRouteTypeCarOff"); ZdcEmapRouteType = type; switch (ZdcEmapRouteType) { case 1: elmWalkOn.style.display = ""; elmWalkOff.style.display = "none"; elmCarOn.style.display = "none"; elmCarOff.style.display = ""; break; case 2: elmWalkOn.style.display = "none"; elmWalkOff.style.display = ""; elmCarOn.style.display = ""; elmCarOff.style.display = "none"; break; default: break; } if (ZdcEmapRoutePoint1 && ZdcEmapRoutePoint2) { ZdcEmapRouteSearch(ZdcEmapRoutePoint1.lat, ZdcEmapRoutePoint1.lon, ZdcEmapRoutePoint2.lat, ZdcEmapRoutePoint2.lon); } } function ZdcEmapChangeRouteCase(lat, lon) { var selectElem, selectedValue, tmpAry, neki, element; if(ZdcEmapRouteSearchShopDetailEventClicked) google.maps.event.removeListener(ZdcEmapRouteSearchShopDetailEventClicked); ZdcEmapMapObj.setOptions({ draggableCursor: null }); selectElem = document.getElementById("selectRoute") selectedValue = selectElem.options[selectElem.selectedIndex].value; if (!selectedValue) { ZdcEmapRoutePoint1 = null; ZdcEmapRoutePoint2 = null; ZdcEmapRouteClear(); return; } tmpAry = selectedValue.split(","); ZdcEmapRouteCase = tmpAry[0].trim(); switch (ZdcEmapRouteCase) { case 'free': ZdcEmapMapObj.setOptions({ draggableCursor: 'crosshair' }); ZdcEmapRouteSearchShopDetailEventClicked = google.maps.event.addListener(ZdcEmapMapObj, 'click', function(e) { var latlon = ZdcEmapWgs2Tky(e.latLng.lat(), e.latLng.lng()); ZdcEmapRouteSearch(latlon.lat, latlon.lon, lat, lon) }); break; case 'myloc': if ((element = document.getElementById("mapRouteMyLocation"))) { element.click(); } break; case 'eki': neki = ZdcEmapNekiList[tmpAry[1].trim()]; if (neki.lat && neki.lon) { ZdcEmapRouteSearch(neki.lat, neki.lon, lat, lon) } break; default: break; } } function ZdcEmapRouteSearchMyLoc(e_lat, e_lon, wgs) { if (!ZdcEmapMyLocation) return; ZdcEmapRouteSearch(ZdcEmapMyLocation.lat, ZdcEmapMyLocation.lon, e_lat, e_lon, wgs); } function ZdcEmapRouteSearch(s_lat, s_lon, e_lat, e_lon, wgs) { if(ZdcEmapRouteType == 0) return; ZdcEmapRouteClear(); ZdcEampVisibleWait(); //パラメーターの設定 ZdcEmapRoutePoint1 = new ZDC.LatLon(s_lat, s_lon); ZdcEmapRoutePoint2 = new ZDC.LatLon(e_lat, e_lon); if (!ZdcEmapRouteType) ZdcEmapRouteType = 1; if(ZdcEmapRouteType == 1) ZdcEmapRouteSearchWalkApi2(ZdcEmapRoutePoint1, ZdcEmapRoutePoint2, wgs); if(ZdcEmapRouteType == 2) ZdcEmapRouteSearchCarApi2(ZdcEmapRoutePoint1, ZdcEmapRoutePoint2, wgs); } // 歩行者ルート検索(API2.0用) function ZdcEmapRouteSearchWalkApi2(p1, p2, wgs) { ZdcEmapReadOn(); /* スタート地点の緯度経度 */ from = p1; /* ゴール地点の緯度経度 */ to = p2; /* 歩行者の速さを80m/minとする */ var walk_speed = 80; var datum = 'TOKYO'; if (wgs) datum = 'WGS84'; ZDC.Search.getRouteByWalk({ from: from, to: to , datum: datum , station: "bothoff" // mod 2022/09/15 M.date },function(status, res) { if (status.code == '000') { /* 取得成功 */ ZdcEmapRouteWrite(status, res, 1, wgs); } else { /* 取得失敗 */ if(ZdcEmapRouteType == 1) { if (from.lat != to.lat || from.lon != to.lon) { } // ルート検索終了 ZdcEmapReadOff(); //失敗だった場合自動車で再検索する ZdcEmapRouteSearchCarApi2(ZdcEmapRoutePoint1,ZdcEmapRoutePoint2); } else { ZdcEampHiddenWait(); alert('Calcolo percorso fallito [' + status.code + ']'); // ルート検索終了 ZdcEmapReadOff(); } return; } }); } // 自動車ルート検索(API2.0用) function ZdcEmapRouteSearchCarApi2(p1, p2, wgs) { ZdcEmapReadOn(); /* スタート地点の緯度経度 */ from = p1; /* ゴール地点の緯度経度 */ to = p2; var datum = 'TOKYO'; if (wgs) datum = 'WGS84'; ZDC.Search.getRouteByDrive({ from: from, to: to , datum: datum },function(status, res) { if (status.code == '000') { /* 取得成功 */ ZdcEmapRouteWrite(status, res, 2, wgs); } else { ZdcEampHiddenWait(); /* 取得失敗 */ alert('Calcolo percorso fallito [' + status.code + ']'); // ルート検索終了 ZdcEmapReadOff(); } }); } // ルート描画 var ZdcEmapRoutePolyline = []; var ZdcEmapRouteStartFlag; var ZdcEmapRouteEndFlag; function ZdcEmapRouteWrite(status, res, stype, wgs) { ZdcEmapShopMsgClose(); /* スタートとゴールのアイコンを地図に重畳します */ var latlon_wgs; if (wgs) { latlon_wgs = new ZDC.LatLon(from.lat,from.lon); } else { latlon_wgs = ZdcEmapTky2Wgs(from.lat,from.lon); } ZdcEmapRouteStartFlag = new google.maps.Marker({ icon : new google.maps.MarkerImage( 'https://global.map.japanpost.jp/smt/it/search/company/search/img/icon_start.png', new google.maps.Size(54, 36), new google.maps.Point(0, 0), new google.maps.Point(13, 34) ), optimized : false, position : new google.maps.LatLng(latlon_wgs.lat, latlon_wgs.lon) }); if (wgs) { latlon_wgs = new ZDC.LatLon(to.lat,to.lon); } else { latlon_wgs = ZdcEmapTky2Wgs(to.lat,to.lon); } ZdcEmapRouteEndFlag = new google.maps.Marker({ icon : new google.maps.MarkerImage( 'https://global.map.japanpost.jp/smt/it/search/company/search/img/spacer.gif', new google.maps.Size(54, 36), new google.maps.Point(0, 0), new google.maps.Point(-4, -36) ), optimized : false, position : new google.maps.LatLng(latlon_wgs.lat, latlon_wgs.lon) }); /* スタートとゴールのウィジットが他のマーカの 下にならないようにz-indexを設定します */ ZdcEmapRouteStartFlag.setZIndex(110); ZdcEmapRouteEndFlag.setZIndex(110); ZdcEmapRouteStartFlag.setMap(ZdcEmapMapObj); ZdcEmapRouteEndFlag.setMap(ZdcEmapMapObj); var link = res.route.link; var latlngbounds_wgs = new google.maps.LatLngBounds(); for (var i=0, j=link.length; i 0) { for(var i=0; i < arr_cond.length; i++) { if (arr_cond[i] && arr_cond[i] != "") { if (jkn) jkn += " AND "; jkn += "("+arr_cond[i]+")"; } } } return jkn; }