// 測地系変換 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) { ZdcEmapMyLocation = ZdcEmapWgs2Tky(lat_wgs, lon_wgs); } //------------------------------------------------------------- //初期設定 //------------------------------------------------------------- //地図 var ZdcEmapMapObj = null; var ZdcEmapWindowWidth = 0; var ZdcEmapWindowHeight = 0; //ズーム番号オフセット var ZdcEmapZoomOffset = 4; //小窓 var ZdcEmapListObj; var ZdcEmapNekiListObj; var ZdcEmapDetailObj; var ZdcEmapCondObj; var ZdcEmapDetailPopObj; // add 2015/06/03 N.Wada var ZdcEmapSearchPopObj; // add 2015/06/03 N.Wada var ZdcEmapSrchCombRootDeptObj; var ZdcEmapSrchCombRootResultObj; //マーカー記憶 var ZdcEmapMapShopMrkId = new Array(50); var ZdcEmapMapShopMrkCnt = null; var ZdcEmapMapShopDetailMrkId = null; var ZdcEmapMapCurFocusMrkId = null; //マーカークラスター var ZdcEmapMapShopMrkClstObj; //各ボタンのイベント管理 var ZdcEmapSearchClickFlg = 0; //アイコン情報 var ZdcEmapIconImg = new Array(); var ZdcEmapIconW = new Array(); var ZdcEmapIconH = new Array(); var ZdcEmapIconOffsetX = new Array(); var ZdcEmapIconOffsetY = new Array(); ZdcEmapIconImg['@SHOP'] = 'https://map.japanpost.jp/p/search/img/000000.gif';ZdcEmapIconW['@SHOP'] = 11;ZdcEmapIconH['@SHOP'] = 11;ZdcEmapIconOffsetX['@SHOP'] = 6;ZdcEmapIconOffsetY['@SHOP'] = 6;ZdcEmapIconImg['@NEW'] = 'https://map.japanpost.jp/p/search/img/new.gif';ZdcEmapIconW['@NEW'] = 23;ZdcEmapIconH['@NEW'] = 10;ZdcEmapIconOffsetX['@NEW'] = 12;ZdcEmapIconOffsetY['@NEW'] = 5;ZdcEmapIconImg['@SEL'] = 'https://map.japanpost.jp/p/search/img/icon_cursor/0003.gif';ZdcEmapIconW['@SEL'] = 51;ZdcEmapIconH['@SEL'] = 50;ZdcEmapIconOffsetX['@SEL'] = 26;ZdcEmapIconOffsetY['@SEL'] = 25;ZdcEmapIconImg['@SELB'] = 'https://map.japanpost.jp/p/search/img/icon_cursor/0000.gif';ZdcEmapIconW['@SELB'] = 51;ZdcEmapIconH['@SELB'] = 50;ZdcEmapIconOffsetX['@SELB'] = 26;ZdcEmapIconOffsetY['@SELB'] = 25;ZdcEmapIconImg['@TP'] = 'https://map.japanpost.jp/p/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 ZdcEmapRouteReverse = 0; //その他 var ZdcEmapSaveCond = new Array(50);//絞込条件 // mod 2022/08/02 K.Taku #7768 [ ZdcEmapSaveCond[107] = '3';ZdcEmapSaveCond[200] = '1';// mod 2022/08/02 K.Taku #7768 ] var QSTRING = location.search.replace(/^\?/, ''); //初期化関数 function ZdcEmapInit(init_lat, init_lon, init_lv, wgs){ var i, len; if (!document.getElementById("ZdcEmapMap")) return; ZdcEmapWindowWidth = document.body.clientWidth; ZdcEmapWindowHeight = document.body.clientHeight; if (!init_lv || init_lv == 0) { init_lv = 13; } init_lv = init_lv - 1; if (wgs) { var latlon = new ZDC.LatLon(init_lat, init_lon); } else { var latlon = ZdcEmapTky2Wgs(init_lat, init_lon); } var latlng = new google.maps.LatLng(latlon.lat, latlon.lon); var opts = { zoom: init_lv ,center: latlng ,mapTypeId: google.maps.MapTypeId.ROADMAP ,maxZoom: 22 ,minZoom: 5 ,mapTypeControl: false ,scaleControl: true ,zoomControl: true ,streetViewControl: false }; ZdcEmapMapObj = new google.maps.Map(document.getElementById("ZdcEmapMap"), opts); document.getElementById("ZdcEmapMap").style.visibility = 'visible'; // イベントログ // google.maps.event.addListener(ZdcEmapMapObj, 'zoom_changed', function() { // ZdcEmapEventLog('mapapi_ChangeZoom'); // }); // google.maps.event.addListener(ZdcEmapMapObj, 'dragend', function() { // ZdcEmapEventLog('mapapi_ChangeLocation'); // }); //各e-map用コントロール -------------------------------- //リスト表示部 ZdcEmapListObj = document.getElementById('ZdcEmapList'); if(!ZdcEmapListObj) ZdcEmapListObj = document.createElement('DIV');//light用ダミー ZdcEmapNekiListObj = ZdcEmapListObj; //検索条件指定部 ZdcEmapCondObj = document.getElementById('ZdcEmapCond'); if(!ZdcEmapCondObj) ZdcEmapCondObj = document.createElement('DIV');//light用ダミー //店舗詳細表示部 add 2015/06/03 N.Wada //検索結果表示部 add 2015/06/03 N.Wada //出発地複合FW結果表示部 ZdcEmapSrchCombRootDeptObj = document.getElementById('ZdcEmapSrchCombRootDept'); if(!ZdcEmapSrchCombRootDeptObj) ZdcEmapSrchCombRootDeptObj = document.createElement('DIV');//light用ダミー //複合ルート結果表示部 ZdcEmapSrchCombRootResultObj = document.getElementById('ZdcEmapSrchCombRootResult'); if(!ZdcEmapSrchCombRootResultObj) ZdcEmapSrchCombRootResultObj = document.createElement('DIV');//light用ダミー // 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); } //------------------------------------------------------------- //地図制御 //------------------------------------------------------------- //地図上にカーソル表示 var ZdcEmapMapCurMrkId = null; //function ZdcEmapMapCursorSet(lat, lon){ mod 2016/03/22 N.Wada function ZdcEmapMapCursorSet(lat, lon, iconid, is_cluster, wgs){ //アイコンの作成 var offset_x = ZdcEmapIconOffsetX['@SELB']; var offset_y = ZdcEmapIconOffsetY['@SELB']; var mrk = ZdcEmapMakeMrkApi2(0, lat, lon, ZdcEmapIconW['@SELB'], ZdcEmapIconH['@SELB'],0,0, offset_x, offset_y,0,0, ZdcEmapIconImg['@SELB'], '', '', '', '', 0, null, null, null ,wgs ); if (ZdcEmapMapCurMrkId != null) ZdcEmapMapCurMrkId.setMap(null); mrk.setMap(ZdcEmapMapObj); ZdcEmapMapCursorRemove(); ZdcEmapMapCurMrkId = mrk; } //地図上にカーソル表示(ID使用) function ZdcEmapMapCursorSetById(id){ if(ZdcEmapMapShopMrkId[id] != null) { var mrk = ZdcEmapMapShopMrkId[id]; ZdcEmapMapCursorSet(mrk.lat, mrk.lon, mrk.data2, false); } } //地図上のカーソル外す function ZdcEmapMapCursorRemove(){ if (ZdcEmapMapCurMrkId != null) { //ZdcEmapMapObj.removeWidget(ZdcEmapMapCurMrkId); ZdcEmapMapCurMrkId.setMap(null); ZdcEmapMapCurMrkId = null; } //詳細表示中 //ZdcEmapMapFrontShopDetail();//詳細アイコンを前面にもってくる } //地図移動 function ZdcEmapMapMove(lat, lon, lvl, wgs){ // var center = new ZDC.LatLon(Number(lat), Number(lon)); // ZdcEmapMapObj.moveLatLon(center); // if(lvl) ZdcEmapMapObj.setZoom(lvl); var latlon = ZdcEmapTky2Wgs(lat, lon); if (wgs) latlon = new ZDC.LatLon(lat, lon); var pos = new google.maps.LatLng(latlon.lat, latlon.lon); ZdcEmapMapObj.setCenter(pos); if(lvl) ZdcEmapMapObj.setZoom(lvl + ZdcEmapZoomOffset); } //地図移動(現在地) function ZdcEmapMapMoveMyLoc(){ if (!ZdcEmapMyLocation) return; ZdcEmapMapMove(ZdcEmapMyLocation.lat, ZdcEmapMyLocation.lon); } //地図移動(矩形) function ZdcEmapMapMoveBox(minlat,minlon,maxlat,maxlon){ var latlon_wgs, sw_wgs, ne_wgs; // 南西点、北東点を計算 latlon_wgs = ZdcEmapTky2Wgs( minlat, minlon ); sw_wgs = new google.maps.LatLng(latlon_wgs.lat, latlon_wgs.lon); latlon_wgs = ZdcEmapTky2Wgs( maxlat, maxlon ); ne_wgs = new google.maps.LatLng(latlon_wgs.lat, latlon_wgs.lon); // 地図を調整 ZdcEmapMapObj.fitBounds(new google.maps.LatLngBounds(sw_wgs, ne_wgs)); } //地図移動(矩形・中心固定) function ZdcEmapMapMoveBoxCenterFixed(minlat,minlon,maxlat,maxlon,centerlat,centerlon){ // 中心から最も離れたlat、lonの差分を計算 var lat_delta = Math.max( Math.abs( minlat - centerlat ), Math.abs( maxlat - centerlat ) ); var lon_delta = Math.max( Math.abs( minlon - centerlon ), Math.abs( maxlon - centerlon ) ); // 地図移動 ZdcEmapMapMoveBox( centerlat-lat_delta, centerlon-lon_delta, centerlat+lat_delta, centerlon+lon_delta ) // 地図移動後のズレを修正 var center_wgs = ZdcEmapTky2Wgs(centerlat, centerlon); ZdcEmapMapObj.setCenter(new google.maps.LatLng(center_wgs.lat, center_wgs.lon)); } //------------------------------------------------------------- //自動検索のイベント管理 //------------------------------------------------------------- var ZdcEmapSearchEventFlg = 0; var ZdcEmapSearchEventFunc = null; var ZdcEmapSearchEventDragmapend; var ZdcEmapSearchEventScrollmapend; var ZdcEmapSearchEventChangezoomend; var ZdcEmapSearchEventIdle; var ZdcEmapSearchEventChangezoomAvailable = 1; var ZdcEmapSearchEventCenterChangeAvailable = 1; //検索実行 function ZdcEmapSearchEventAction() { ZdcEmapWindowWidth = document.body.clientWidth; ZdcEmapWindowHeight = document.body.clientHeight; if(!ZdcEmapSearchEventFlg) return; if (!ZdcEmapSearchEventCenterChangeAvailable) { ZdcEmapSearchEventCenterChangeAvailable = 1; return; } ZdcEmapSearchPoint = null; eval(ZdcEmapSearchEventFunc); } function ZdcEmapEventDragAction() { ZdcEmapSearchEventAction(); } function ZdcEmapEventScrollAction() { ZdcEmapSearchEventAction(); } function ZdcEmapEventZoomAction() { if (!ZdcEmapSearchEventChangezoomAvailable) { ZdcEmapSearchEventChangezoomAvailable = 1; return; } ZdcEmapSearchEventAction(); } //検索イベント開始 function ZdcEmapSearchEventStart() { ZdcEmapSearchEventAdd("ZdcEmapSearchShop()"); ZdcEmapSearchEventFlg = 1; } //検索イベント停止 function ZdcEmapSearchEventStop() { ZdcEmapSearchEventDel(); ZdcEmapSearchEventFlg = 0; } //検索イベント追加 function ZdcEmapSearchEventAdd(func) { ZdcEmapSearchEventDel(); ZdcEmapSearchEventFunc = func; // ZdcEmapSearchEventDragmapend = ZDC.addListener(ZdcEmapMapObj, ZDC.MAP_DRAG_END, ZdcEmapEventDragAction); // ZdcEmapSearchEventScrollmapend = ZDC.addListener(ZdcEmapMapObj, ZDC.MAP_SCROLL_END, ZdcEmapEventScrollAction); // ZdcEmapSearchEventChangezoomend = ZDC.addListener(ZdcEmapMapObj, ZDC.MAP_CHG_ZOOM, ZdcEmapEventZoomAction); ZdcEmapSearchEventIdle = google.maps.event.addListener(ZdcEmapMapObj, "idle", ZdcEmapEventZoomAction); } //検索イベント削除 function ZdcEmapSearchEventDel() { // if(ZdcEmapSearchEventDragmapend) ZDC.removeListener(ZdcEmapSearchEventDragmapend); // if(ZdcEmapSearchEventScrollmapend) ZDC.removeListener(ZdcEmapSearchEventScrollmapend); // if(ZdcEmapSearchEventChangezoomend) ZDC.removeListener(ZdcEmapSearchEventChangezoomend); if(ZdcEmapSearchEventIdle) google.maps.event.removeListener(ZdcEmapSearchEventIdle); ZdcEmapSearchEventDragmapend = null; ZdcEmapSearchEventScrollmapend = null; ZdcEmapSearchEventChangezoomend = null; ZdcEmapSearchEventIdle = null; ZdcEmapSearchEventFunc = null; } //ボタン押下拒否判定 function ZdcEmapButtonNG() { if(ZdcEmapReadCheck()) return 1;//読み込み中の動作がある return 0; } //読み込み中フラグ var ZdcEmapReading = 0;//読み込み中・処理中フラグ function ZdcEmapReadOn() { ZdcEmapReading ++; //if(ZdcEmapReading == 1) ZdcEampVisibleWait(); } function ZdcEmapReadOff() { if(ZdcEmapReading <= 0) return; ZdcEmapReading --; //if(ZdcEmapReading == 0) ZdcEampHiddenWait(); } function ZdcEmapReadCheck() { if(ZdcEmapReading > 0) return 1;//読み込み中の動作がある return 0; } function ZdcEampVisibleWait() { var wait = document.getElementById("ZdcEmapWait"); if (!wait) return; wait.style.left = (ZdcEmapWindowWidth / 2 + (-60))+'px'; wait.style.top = (ZdcEmapWindowHeight / 2 + (-12))+'px'; // mod 2022/08/16 K.taku #7768 [ // wait.style.width = ; // wait.style.height = ; // mod 2022/08/16 K.taku #7768 ] 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"; } //------------------------------------------------------------- //アイコン登録(API2.0用) //------------------------------------------------------------- var rtnhtml; function ZdcEmapMakeMrkApi2(id,lat,lon, sizew,sizeh,newsizew,newsizeh, offsetx,offsety,newoffsetx,newoffsety, image,newimage, data1,data2,message,nflg, mouseclickmarker, mouseovermarker, lvl, wgs ) { var mrk; var w; var h; var latlon_wgs = ZdcEmapTky2Wgs(lat, lon); var lat_wgs = latlon_wgs.lat; var lon_wgs = latlon_wgs.lon; var latlon = new ZDC.LatLon(lat, lon); var iconimage; if (wgs) { lat_wgs = lat; lon_wgs = lon; } // icon.imageの末尾が「.gif」でないと、内部的にGIF以外として処理されてしまうので、末尾を無理矢理「.gif」にしています。 // GIF以外で処理されてしまうと、IEで印刷時に透過GIFが透過しません。 // タイムスタンプ値を付加しているのは、キャッシュ抑制のためです。これがないと、アイコン画像を差し替えた際に表示が崩れることがあります。(IEのみ) if (image.substr(image.length-4, 4) == ".gif") { iconimage = image; } else { dd = new Date(); ts = dd.getTime(); if (image.indexOf('?') < 0) { iconimage = image+"?dummy="+ts+".gif"; } else { iconimage = image+"&dummy="+ts+".gif"; } } if (newimage) { // //アイコンの作成(newアイコン有りの場合) // mrk = new ZDC.Marker(latlon,{ // /* マーカのサイズに合わせて位置を調整する */ // offset: new ZDC.Pixel(offsetx, offsety), // contentOffset: new ZDC.Pixel(newoffsetx, newoffsety), // custom: { // base : { // src: iconimage, // imgSize: ZDC.WH(sizew, sizeh) // }, // content : { // src: newimage, // imgSize: ZDC.WH(newsizew, newsizeh) // } // } // }); } else { //アイコンの作成(通常) // mrk = new ZDC.Marker(latlon,{ // /* マーカのサイズに合わせて位置を調整する */ // offset: new ZDC.Pixel(offsetx, offsety), // custom: { // base : { // src: iconimage, // imgSize: ZDC.WH(sizew, sizeh) // } // } // }); mrk = new google.maps.Marker({ //icon : iconimage, icon : new google.maps.MarkerImage( iconimage, new google.maps.Size(sizew, sizeh), new google.maps.Point(0, 0), new google.maps.Point(offsetx, offsety) ), optimized : false, position : new google.maps.LatLng(lat_wgs, lon_wgs) }); } //マーカーの基本情報 mrk.id = id; mrk.data1 = data1; mrk.data2 = data2; mrk.nflg = nflg; mrk.lat = lat; mrk.lon = lon; if (lvl) mrk.lvl = lvl; //クリック時のイベント登録 if (mouseclickmarker) { //吹き出しテキスト用アンカーイベント //ZDC.addListener(mrk, ZDC.MARKER_CLICK, mouseclickmarker); google.maps.event.addListener(mrk, "click", mouseclickmarker); } return mrk; } //------------------------------------------------------------- //ルート探索 //------------------------------------------------------------- var ZdcEmapRouteType = null; var ZdcEmapRouteCase = null; var ZdcEmapRoutePoint1 = null; var ZdcEmapRoutePoint2 = null; var ZdcEmapRouteSearchShopDetailEventClicked = null; var ZdcEmapRoutePolyline = []; var ZdcEmapRoutePolylineBus = []; var ZdcEmapRouteStartFlag; var ZdcEmapRouteEndFlag; 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(ZdcEmapButtonNG()) return; if(ZdcEmapRouteType == 0) return; ZdcEmapRouteClear(); //パラメーターの設定 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); if(ZdcEmapRouteType == 3) ZdcEmapRouteSearchCarApi2(ZdcEmapRoutePoint1, ZdcEmapRoutePoint2, wgs, 1); } // 歩行者ルート検索(API2.0用) function ZdcEmapRouteSearchWalkApi2(p1, p2, wgs) { ZdcEmapReadOn(); /* スタート地点の緯度経度 */ from = p1; /* ゴール地点の緯度経度 */ to = p2; if (ZdcEmapRouteReverse) { from = p2; to = p1; } /* 歩行者の速さを80m/minとする */ var walk_speed = 80; var datum = 'TOKYO'; if (wgs) datum = 'WGS84'; ZDC.Search.getRouteByWalk({ from: from, to: to , datum: datum , station: "bothoff" },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, wgs); } else { alert('距離が長すぎるか探索に失敗しました。 [' + status.code + ']'); // ルート検索終了 ZdcEmapReadOff(); } return; } }); } // 自動車ルート検索(API2.0用) function ZdcEmapRouteSearchCarApi2(p1, p2, wgs, localroad) { ZdcEmapReadOn(); /* スタート地点の緯度経度 */ from = p1; /* ゴール地点の緯度経度 */ to = p2; var datum = 'TOKYO'; if (wgs) datum = 'WGS84'; var toll = true; if (localroad) toll = false; ZDC.Search.getRouteByDrive({ from: from, to: to , datum: datum , toll: toll },function(status, res) { if (status.code == '000') { /* 取得成功 */ ZdcEmapRouteWrite(status, res, 2, wgs); } else { /* 取得失敗 */ alert('距離が長すぎるか探索に失敗しました。 [' + status.code + ']'); // ルート検索終了 ZdcEmapReadOff(); } }); } // ルート描画 function ZdcEmapRouteWrite(status, res, stype, wgs) { /* スタートとゴールのアイコンを地図に重畳します */ ZdcEmapRouteClear(); var latlon_wgs; if (wgs) { latlon_wgs = new ZDC.LatLon(from.lat,from.lon); } else { latlon_wgs = ZdcEmapTky2Wgs(from.lat,from.lon); } if (ZdcEmapRouteReverse) { ZdcEmapRouteReverse = 0; if (wgs) { latlon_wgs = new ZDC.LatLon(to.lat,to.lon); } else { latlon_wgs = ZdcEmapTky2Wgs(to.lat,to.lon); } } ZdcEmapRouteStartFlag = new google.maps.Marker({ icon : new google.maps.MarkerImage( 'https://map.japanpost.jp/p/search/company/search/images/icon_start_large.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://map.japanpost.jp/p/search/company/search/images/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 latlons = []; var latlngbounds_wgs = new google.maps.LatLngBounds(); for (var i=0, j=link.length; i 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); } //------------------------------------------------------------- //その他 //------------------------------------------------------------- //HTML読み込み用ajax通信関数 function ZdcEmapHttpRequestHtml(url, func, nowaitmsg, typ) { if(!nowaitmsg) ZdcEmapReadOn();//読み込み中フラグon if(typ == undefined) typ = 1; //通信処理 var ZdcEmapHttpRequestObj = new ZdcEmapHttpRequest('EUC', 'EUC'); ZdcEmapHttpRequestObj.request(url, function(html,status) { if(status == 3) status = 0;//タイムアウトは無視 連続呼び出し時の動作が安定しないので if(status == 9) status = 0;//テンプレートが無い場合に対応 if(html == null) html = "";//nullは出さない if(status == 0) { func(html,status); } else { //エラー処理 func(html,status); } ZdcEmapReadOff();//読み込み中フラグoff },30000,typ); } function ZdcEmapHttpRequestHtml_ENC(url, func, nowaitmsg, target_enc) { if(!nowaitmsg) ZdcEmapReadOn();//読み込み中フラグon //通信処理 var ZdcEmapHttpRequestObj = new ZdcEmapHttpRequest('EUC', 'EUC', 0, target_enc); ZdcEmapHttpRequestObj.requestEnc(url, function(html,status) { if(status == 3) status = 0;//タイムアウトは無視 連続呼び出し時の動作が安定しないので if(status == 9) status = 0;//テンプレートが無い場合に対応 if(html == null) html = "";//nullは出さない if(status == 0) { func(html,status); } else { //エラー処理 func(html,status); } ZdcEmapReadOff();//読み込み中フラグoff },30000); } /*** * Function request with method POST ***/ function ZdcEmapHttpRequestHtmlPost(url, func, nowaitmsg, typ) { if(!nowaitmsg) ZdcEmapReadOn();//読み込み中フラグon if(typ == undefined) typ = 1; //通信処理 var ZdcEmapHttpRequestObj = new ZdcEmapHttpRequest('EUC', 'EUC'); ZdcEmapHttpRequestObj.requestAjax(url, function(html,status) { if(status == 3) status = 0;//タイムアウトは無視 連続呼び出し時の動作が安定しないので if(status == 9) status = 0;//テンプレートが無い場合に対応 if(html == null) html = "";//nullは出さない if(status == 0) { func(html,status); } else { //エラー処理 func(html,status); } ZdcEmapReadOff();//読み込み中フラグoff },30000,typ, "POST"); } //common func ZdcSetErrorStatus = function(retcd, st){ var status; if (st == undefined){ var errPart = retcd.charAt(4); var errPartStr = retcd.slice(3, 5); if( errPart == '9' ){ status = 1; //パラメータエラー }else if( retcd.substr(4,4) == '1009' ){ status = 5; //該当データなし }else if ( errPart == '2' ){ status = 6; //認証エラー }else if ( errPart == '6' || errPart == '7' || errPart == '8' || errPartStr == '15'){ status = 2; //サーバーエラー }else{ status = 9; //その他エラー } }else{ status = st; } this.retCode = retcd || ''; this.type = ''; this.status = status; this.recCount = 0; this.hitCount = 0; this.rest = false; this.items = []; } // APIイベントログ出力 // (event_log.cgiを呼び出し) function ZdcEmapEventLog(evt) { var url = "http://127.0.0.1/cgi2/event_log.cgi"; url += "?key=71nQuP95lgvvBwnAPvBvnAyf9hmgdPBVidc5SFXuMmA0fhxzTgrx2zTQrxrzT5ngMzFHlwhbF2lxe8JMlQfvDmoQwT6foQHv6roRkL0DngozF0lw0bFmlhq8JmlQIvDToQ2T6eoQcv7zoRLLTd"; url += "&event="+evt; url += "&opt=search"; // mod 2022/08/16 K.taku #7768 [ if ("") { url += "&freeparm="; } // mod 2022/08/16 K.taku #7768 ] var httpReq = new ZdcEmapHttpRequest('EUC', 'EUC'); httpReq.request(url, function(reference_text,status){ }, 60000); } var ZdcEmapBeforeAddOptHisHTML = ""; function ZdcEmapAddOptionalHistory(name, lasturl) { var obj = null; obj = document.getElementById("history_count"); if (!obj) return; var cnt = obj.value; var his = ""; var idx = 0; for (var i = 1; i <= cnt; i++) { obj = document.getElementById("history_name_"+i); if (obj) { idx++; var nm = obj.value; var url = ""; obj = document.getElementById("history_url_"+i); if (obj) url = obj.value; if (i == cnt && lasturl) url = lasturl; if (idx > 1) his += "\t\t\t > \t\t"; his += ''+nm+''; } } his += "\t\t\t > \t\t"; his += name; obj = document.getElementById("history"); if (!obj) return; if (!ZdcEmapBeforeAddOptHisHTML) ZdcEmapBeforeAddOptHisHTML = obj.innerHTML; obj.innerHTML = his; } function ZdcEmapRemoveOptionalHistory() { if (ZdcEmapBeforeAddOptHisHTML) { var obj = document.getElementById("history"); if (!obj) return; obj.innerHTML = ZdcEmapBeforeAddOptHisHTML; ZdcEmapBeforeAddOptHisHTML = ""; } } function ZdcEmapSetBusLatlons(type) { var key = (type == "print" ? 'bus_latlons_all_print' : 'bus_latlons_all'); var val = document.getElementById(key).value; sessionStorage.removeItem(key); sessionStorage.setItem(key, val); } function ZdcEmapGetBusLatlonsByNaviId(naviid) { if (sessionStorage.getItem('bus_latlons_all')) { var bus_latlons_all = JSON.parse(sessionStorage.getItem('bus_latlons_all')); if (bus_latlons_all[naviid]) { return bus_latlons_all[naviid]; } } if (sessionStorage.getItem('bus_latlons_all_print')) { var bus_latlons_all_print = JSON.parse(sessionStorage.getItem('bus_latlons_all_print')); if (bus_latlons_all_print[naviid]) { return bus_latlons_all_print[naviid]; } } return undefined; }