// 測地系変換 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 ZdcEmapMapObj = null; //ズーム番号オフセット var ZdcEmapZoomOffset = 4; //小窓 var ZdcEmapListObj; var ZdcEmapDetailObj; var ZdcEmapCondObj; //マーカー記憶 var ZdcEmapMapShopMrkId = new Array(50); var ZdcEmapMapShopMrkCnt = null; var ZdcEmapMapShopDetailMrkId = null; var ZdcEmapMapCurFocusMrkId = null; //各ボタンのイベント管理 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://global.map.japanpost.jp/p/ko/search/img/000000.gif';ZdcEmapIconW['@SHOP'] = 11;ZdcEmapIconH['@SHOP'] = 11;ZdcEmapIconOffsetX['@SHOP'] = 6;ZdcEmapIconOffsetY['@SHOP'] = 6;ZdcEmapIconImg['@NEW'] = 'https://global.map.japanpost.jp/p/ko/search/img/new.gif';ZdcEmapIconW['@NEW'] = 23;ZdcEmapIconH['@NEW'] = 10;ZdcEmapIconOffsetX['@NEW'] = 12;ZdcEmapIconOffsetY['@NEW'] = 5;ZdcEmapIconImg['@SEL'] = 'https://global.map.japanpost.jp/p/ko/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/p/ko/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/p/ko/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 ZdcEmapSaveCond = new Array(50);//絞込条件 ZdcEmapSaveCond[100] = '1';ZdcEmapSaveCond[101] = '1';ZdcEmapSaveCond[102] = '1';ZdcEmapSaveCond[103] = '1';ZdcEmapSaveCond[104] = '1';ZdcEmapSaveCond[105] = '1';ZdcEmapSaveCond[106] = '1';ZdcEmapSaveCond[107] = '1';ZdcEmapSaveCond[108] = '1';ZdcEmapSaveCond[109] = '1'; //mod 2022/09/15 M.date var QSTRING = location.search.replace(/^\?/, ''); //初期化関数 function ZdcEmapInit(init_lat, init_lon, init_lv, wgs){ if (!document.getElementById("ZdcEmapMap")) return; if (!init_lv || init_lv == 0) { init_lv = 18; } 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用ダミー //検索条件指定部 ZdcEmapCondObj = document.getElementById('ZdcEmapCond'); if(!ZdcEmapCondObj) ZdcEmapCondObj = document.createElement('DIV');//light用ダミー // POIアイコン add 2015/10/05 Y.Matsukawa // 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); } //------------------------------------------------------------- //地図制御 //------------------------------------------------------------- //地図移動 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); } //地図上にカーソル表示 var ZdcEmapMapCurMrkId = null; function ZdcEmapMapCursorSet(lat, lon, wgs){ ZdcEmapMapCursorRemove(); //アイコンの作成 ZdcEmapMapCurMrkId = ZdcEmapMakeMrkApi2(0, lat, lon, ZdcEmapIconW['@SEL'], ZdcEmapIconH['@SEL'],0,0, ZdcEmapIconOffsetX['@SEL'], ZdcEmapIconOffsetY['@SEL'],0,0, ZdcEmapIconImg['@SEL'], '', '', '', '', 0, null, null, null , wgs ); } //地図上のカーソル外す function ZdcEmapMapCursorRemove(){ if (ZdcEmapMapCurMrkId != null) { ZdcEmapMapCurMrkId.setMap(null); ZdcEmapMapCurMrkId = null; } } //------------------------------------------------------------- //自動検索のイベント管理 //------------------------------------------------------------- var ZdcEmapSearchEventFlg = 0; var ZdcEmapSearchEventFunc = null; var ZdcEmapSearchEventDragmapend; var ZdcEmapSearchEventScrollmapend; var ZdcEmapSearchEventChangezoomend; var ZdcEmapSearchEventChangezoomAvailable = 1; var ZdcEmapSearchEventCenterChangeAvailable = 1; //検索実行 function ZdcEmapSearchEventAction() { 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; } //------------------------------------------------------------- //アイコン登録(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; if (wgs) { var latlon = new ZDC.LatLon(lat, lon); } else { var latlon = ZdcEmapTky2Wgs(lat, lon); } var iconimage; // 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({ map : ZdcEmapMapObj, //icon : iconimage, icon : new google.maps.MarkerImage( iconimage, // url new google.maps.Size(sizew, sizeh), // size new google.maps.Point(0,0), // origin new google.maps.Point(offsetx, offsety) // anchor ), position : new google.maps.LatLng(latlon.lat, latlon.lon) }); } //マーカーの基本情報 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; } //検索イベント停止 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); ZdcEmapSearchEventDragmapend = google.maps.event.addListener(ZdcEmapMapObj, "center_changed", ZdcEmapEventDragAction); ZdcEmapSearchEventChangezoomend = google.maps.event.addListener(ZdcEmapMapObj, "zoom_changed", ZdcEmapEventZoomAction); } //検索イベント削除 function ZdcEmapSearchEventDel() { // if(ZdcEmapSearchEventDragmapend) ZDC.removeListener(ZdcEmapSearchEventDragmapend); // if(ZdcEmapSearchEventScrollmapend) ZDC.removeListener(ZdcEmapSearchEventScrollmapend); // if(ZdcEmapSearchEventChangezoomend) ZDC.removeListener(ZdcEmapSearchEventChangezoomend); if(ZdcEmapSearchEventDragmapend) google.maps.event.removeListener(ZdcEmapSearchEventDragmapend); if(ZdcEmapSearchEventChangezoomend) google.maps.event.removeListener(ZdcEmapSearchEventChangezoomend); ZdcEmapSearchEventDragmapend = null; ZdcEmapSearchEventScrollmapend = null; ZdcEmapSearchEventChangezoomend = null; delete ZdcEmapSearchEventFunc; } //ボタン押下拒否判定 function ZdcEmapButtonNG() { if(ZdcEmapReadCheck()) return 1;//読み込み中の動作がある return 0; } //読み込み中フラグ var ZdcEmapReading = 0;//読み込み中・処理中フラグ function ZdcEmapReadOn() { ZdcEmapReading ++; } function ZdcEmapReadOff() { if(ZdcEmapReading <= 0) return; ZdcEmapReading --; } function ZdcEmapReadCheck() { if(ZdcEmapReading > 0) return 1;//読み込み中の動作がある return 0; } //------------------------------------------------------------- //その他 //------------------------------------------------------------- //HTML読み込み用ajax通信関数 function ZdcEmapHttpRequestHtml(url, func, nowaitmsg, typ) { if(!nowaitmsg) ZdcEmapReadOn();//読み込み中フラグon if(typ == undefined) typ = 1; //通信処理 var ZdcEmapHttpRequestObj = new ZdcEmapHttpRequest('UTF8', 'UTF8'); 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 },10000,typ); } //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=71nQlP9jlg8vBYnAOvBynAQf9GmgIPBgidp5S1Xv85H6f7Qmi0rxUzTErxpzTxngvzFxlw0bF1lxN8JUlQAvDdoQcT6BoQNv6NoRvL0VngwzFJlwTbFMlhZ8JmlQ3vDPoQmT6AoQVv7DoRKLTz"; url += "&event="+evt; url += "&opt=search"; // mod 2022/09/15 M.date if ("") { url += "&freeparm="; } url += "&lang=ko"; var httpReq = new ZdcEmapHttpRequest('UTF8', 'UTF8'); httpReq.request(url, function(reference_text,status){ }, 60000); }