// 測地系変換 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 = "0"; 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://idmap.id-credit.com/smt/docomoid/img/000000.gif';ZdcEmapIconW['@SHOP'] = 11;ZdcEmapIconH['@SHOP'] = 11;ZdcEmapIconOffsetX['@SHOP'] = 6;ZdcEmapIconOffsetY['@SHOP'] = 6;ZdcEmapIconImg['@NEW'] = 'https://idmap.id-credit.com/smt/docomoid/img/new.gif';ZdcEmapIconW['@NEW'] = 23;ZdcEmapIconH['@NEW'] = 10;ZdcEmapIconOffsetX['@NEW'] = 12;ZdcEmapIconOffsetY['@NEW'] = 5;ZdcEmapIconImg['@SEL'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=@SEL.gif';ZdcEmapIconW['@SEL'] = 51;ZdcEmapIconH['@SEL'] = 51;ZdcEmapIconOffsetX['@SEL'] = 26;ZdcEmapIconOffsetY['@SEL'] = 26;ZdcEmapIconImg['@SELB'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=@SELB.gif';ZdcEmapIconW['@SELB'] = 53;ZdcEmapIconH['@SELB'] = 53;ZdcEmapIconOffsetX['@SELB'] = 27;ZdcEmapIconOffsetY['@SELB'] = 27;ZdcEmapIconImg['@TP'] = 'https://idmap.id-credit.com/smt/docomoid/img/tp11.gif';ZdcEmapIconW['@TP'] = 11;ZdcEmapIconH['@TP'] = 11;ZdcEmapIconOffsetX['@TP'] = 6;ZdcEmapIconOffsetY['@TP'] = 6;ZdcEmapIconImg['1001'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1001';ZdcEmapIconW['1001'] = 100;ZdcEmapIconH['1001'] = 100;ZdcEmapIconOffsetX['1001'] = 50;ZdcEmapIconOffsetY['1001'] = 50;ZdcEmapIconImg['1002'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1002';ZdcEmapIconW['1002'] = 100;ZdcEmapIconH['1002'] = 100;ZdcEmapIconOffsetX['1002'] = 50;ZdcEmapIconOffsetY['1002'] = 50;ZdcEmapIconImg['1003'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1003';ZdcEmapIconW['1003'] = 100;ZdcEmapIconH['1003'] = 100;ZdcEmapIconOffsetX['1003'] = 50;ZdcEmapIconOffsetY['1003'] = 50;ZdcEmapIconImg['1004'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1004';ZdcEmapIconW['1004'] = 100;ZdcEmapIconH['1004'] = 14;ZdcEmapIconOffsetX['1004'] = 50;ZdcEmapIconOffsetY['1004'] = 7;ZdcEmapIconImg['1005'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1005';ZdcEmapIconW['1005'] = 100;ZdcEmapIconH['1005'] = 100;ZdcEmapIconOffsetX['1005'] = 50;ZdcEmapIconOffsetY['1005'] = 50;ZdcEmapIconImg['1006'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1006';ZdcEmapIconW['1006'] = 100;ZdcEmapIconH['1006'] = 100;ZdcEmapIconOffsetX['1006'] = 50;ZdcEmapIconOffsetY['1006'] = 50;ZdcEmapIconImg['1007'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1007';ZdcEmapIconW['1007'] = 100;ZdcEmapIconH['1007'] = 100;ZdcEmapIconOffsetX['1007'] = 50;ZdcEmapIconOffsetY['1007'] = 50;ZdcEmapIconImg['1008'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1008';ZdcEmapIconW['1008'] = 100;ZdcEmapIconH['1008'] = 100;ZdcEmapIconOffsetX['1008'] = 50;ZdcEmapIconOffsetY['1008'] = 50;ZdcEmapIconImg['1009'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1009';ZdcEmapIconW['1009'] = 100;ZdcEmapIconH['1009'] = 100;ZdcEmapIconOffsetX['1009'] = 50;ZdcEmapIconOffsetY['1009'] = 50;ZdcEmapIconImg['1010'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=1010';ZdcEmapIconW['1010'] = 63;ZdcEmapIconH['1010'] = 52;ZdcEmapIconOffsetX['1010'] = 32;ZdcEmapIconOffsetY['1010'] = 26;ZdcEmapIconImg['11'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=11';ZdcEmapIconW['11'] = 25;ZdcEmapIconH['11'] = 25;ZdcEmapIconOffsetX['11'] = 13;ZdcEmapIconOffsetY['11'] = 13;ZdcEmapIconImg['12'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=12';ZdcEmapIconW['12'] = 25;ZdcEmapIconH['12'] = 25;ZdcEmapIconOffsetX['12'] = 13;ZdcEmapIconOffsetY['12'] = 13;ZdcEmapIconImg['13'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=13';ZdcEmapIconW['13'] = 25;ZdcEmapIconH['13'] = 25;ZdcEmapIconOffsetX['13'] = 13;ZdcEmapIconOffsetY['13'] = 13;ZdcEmapIconImg['14'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=14';ZdcEmapIconW['14'] = 25;ZdcEmapIconH['14'] = 25;ZdcEmapIconOffsetX['14'] = 13;ZdcEmapIconOffsetY['14'] = 13;ZdcEmapIconImg['15'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=15';ZdcEmapIconW['15'] = 25;ZdcEmapIconH['15'] = 25;ZdcEmapIconOffsetX['15'] = 13;ZdcEmapIconOffsetY['15'] = 13;ZdcEmapIconImg['16'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=16';ZdcEmapIconW['16'] = 25;ZdcEmapIconH['16'] = 25;ZdcEmapIconOffsetX['16'] = 13;ZdcEmapIconOffsetY['16'] = 13;ZdcEmapIconImg['17'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=17';ZdcEmapIconW['17'] = 25;ZdcEmapIconH['17'] = 25;ZdcEmapIconOffsetX['17'] = 13;ZdcEmapIconOffsetY['17'] = 13;ZdcEmapIconImg['18'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=18';ZdcEmapIconW['18'] = 25;ZdcEmapIconH['18'] = 25;ZdcEmapIconOffsetX['18'] = 13;ZdcEmapIconOffsetY['18'] = 13;ZdcEmapIconImg['19'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=19';ZdcEmapIconW['19'] = 25;ZdcEmapIconH['19'] = 25;ZdcEmapIconOffsetX['19'] = 13;ZdcEmapIconOffsetY['19'] = 13;ZdcEmapIconImg['20'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=20';ZdcEmapIconW['20'] = 25;ZdcEmapIconH['20'] = 25;ZdcEmapIconOffsetX['20'] = 13;ZdcEmapIconOffsetY['20'] = 13;ZdcEmapIconImg['21'] = 'https://idmap.id-credit.com/cgi/icon_select.cgi?cid=docomoid&icon_id=21';ZdcEmapIconW['21'] = 25;ZdcEmapIconH['21'] = 25;ZdcEmapIconOffsetX['21'] = 13;ZdcEmapIconOffsetY['21'] = 13; 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 && 0 > 0) { ZdcEmapWindowHeight = ZdcEmapWindowHeight - 0; ZdcEmapAnyDispPx = 0; } if (!nmapflg && 0 > 0) { ZdcEmapWindowHeight = ZdcEmapWindowHeight - 0; ZdcEmapAnyDispPx = 0; } // 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 ] if (!init_lv || init_lv == 0) { init_lv = 14; } init_lv = init_lv - 1; var opts = { zoom: init_lv ,center: latlng ,mapTypeId: google.maps.MapTypeId.ROADMAP ,maxZoom: 22 ,minZoom: 5 ,mapTypeControl: false ,scaleControl: false ,zoomControl: true ,streetViewControl: false }; ZdcEmapMapObj = new google.maps.Map(document.getElementById("ZdcEmapMap"), opts); // POIアイコン吹き出し無効 ZdcEmapMapObj.setClickableIcons(false); // フキダシ表示用オブジェクト ZdcEmapMsg = new google.maps.InfoWindow(); ZdcEmapMsg.set("noSuppress", true); // マーカークラスター var options_markerclusterer = {}; options_markerclusterer.gridSize = 40; options_markerclusterer.zoomOnClick = false; var clusterStyles = [{ url: 'https://idmap.id-credit.com/smt/docomoid/company/docomoid/img/_cluster.gif', height: 25, width: 25 }]; options_markerclusterer.styles = clusterStyles; ZdcEmapMapShopMrkClstObj = new MarkerClusterer(ZdcEmapMapObj, [], options_markerclusterer); } 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(19 > 0) { //lvl = EncRealZoom(19); 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){ //tooltip = new ZDC.Marker(latlon, { // custom:{ // base:{ // src:ZdcEmapIconImg['@NEW'] // } // }, // offset: ZDC.Pixel( // - sizew / 2, // + sizeh / 2 // ) //}); 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/docomoid/shop_msg.htm?cid=docomoid&kid="+obj.data1; //url += "&"; //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=idmap.id-credit.com"; ZdcEmapHttpRequestHtml(url, function(html,status){ if(status) html = "申し訳ありませんが只今大変混み合っております。TOPページに戻りしばらく時間を置いてからご利用ください 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 = 10000; 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(); // マーカークラスター削除 ZdcEmapMapShopMrkClstObj.clearMarkers(); // マーカー削除 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("検索に失敗しました 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 ] 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; } } // マーカークラスター生成 for(i = 0; i < ZdcEmapListMarkers.length; i++){ ZdcEmapMapShopMrkClstObj.addMarker(ZdcEmapListMarkers[i].marker); } google.maps.event.clearListeners(ZdcEmapMapShopMrkClstObj, "clusterclick"); google.maps.event.addListener(ZdcEmapMapShopMrkClstObj, "clusterclick", function (mCluster) { if (typeof ZdcEmapMrkClstClickFunc === "function") { ZdcEmapMrkClstClickFunc(mCluster); } else { ZdcEmapShopMsgCluster(mCluster, 1, 'bunpu'); } }); var p = ZdcEmapMapObj.getCenter(); var center = ZdcEmapWgs2Tky(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(0 == 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; } ZdcEampVisibleNotFound(); google.maps.event.addListenerOnce(ZdcEmapMapObj, "bounds_changed", ZdcEampHiddenNotFound); } ZdcEmapSearchEventStart(); //検索位置を保持 ZdcEmapSearchPoint = ZdcEmapMapObj.getCenter(); ZdcEmapSearchScale = ZdcEmapMapObj.getZoom(); ZdcEmapReadOff(); if (ZdcEmapSearchFirst == 1 && 0 > 0) { ZdcEmapSearchFirst = 0; if (ZdcEmapListMarkers.length == 0) { ZdcEmapMapObj.setZoom(0); } } 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 + (0))+'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, 1000 ); 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("検索に失敗しました 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; var ZdcEmapRouteDistance; 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" },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 { ZdcEampHiddenWait(); alert('ルート探索に失敗しました。 [' + 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('ルート探索に失敗しました。 [' + status.code + ']'); // ルート検索終了 ZdcEmapReadOff(); } }); } // ルート距離・時間表示(API2.0用、地図上) function ZdcEmapDispRouteDistanceMap(dist, time) { ZdcEmapRouteDistance = document.getElementById("mapRouteDistance"); var disp; // function mapDistanceAdd(element, position) { // var control; // if (!element) return; // control = document.createElement('div'); // control.appendChild(element); // control.index = 1; // ZdcEmapMapObj.controls[position].push(control); // } // // mapDistanceAdd(ZdcEmapRouteDistance, google.maps.ControlPosition.BOTTOM_CENTER); //ルート距離表示 var distance = dist; if (distance < 1000) { distance = distance+' m'; } else { distance = distance / 100; distance = Math.round(distance); distance = distance / 10; distance += ' km'; } //ルート時間表示 if (time == null) { time = 1; } if (time != '') { disp = "移動距離:"+distance+"
"+"移動時間:"+time+"分"; ZdcEmapRouteDistance.innerHTML = disp; ZdcEmapRouteDistance.style.display = "block"; }else{ disp = "移動距離:"+distance; ZdcEmapRouteDistance.innerHTML = disp; ZdcEmapRouteDistance.style.display = "block"; } } // ルート描画 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://idmap.id-credit.com/smt/docomoid/img/route/RouteStart.png', 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) }); 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://idmap.id-credit.com/smt/docomoid/img/route/RouteEnd.png', 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; }