/* 変数セット */ var http = null; var i; var xml = null; var node = null; var node_text; var marker = []; var htmls = []; var html_point = []; var list_html =""; /* データをマーカにセット */ function setUserData(marker, id){ // フキダシのタイトルを表示するための、タイトルオブジェクトを定義する。 // タイトルのクリック時に、参照先を別ページで開くようにする。 var titlelink = document.createElement('a'); titlelink.setAttribute('href', news[id].getElementsByTagName("link")[0].firstChild.nodeValue); titlelink.setAttribute('target', '_blank'); titlelink.appendChild(document.createTextNode(news[id].getElementsByTagName("title")[0].firstChild.nodeValue)); marker.title = titlelink; // ノードオブジェクトを定義する。 var nodelink = document.createElement('a'); nodelink.setAttribute('href', news[id].getElementsByTagName("link")[0].firstChild.nodeValue); nodelink.setAttribute('target', '_blank'); nodelink.appendChild(document.createTextNode(news[id].getElementsByTagName("title")[0].firstChild.nodeValue)); var node = document.createElement('a'); node.appendChild(nodelink); node.appendChild(document.createElement('br')); node.appendChild(document.createElement('br')); node.appendChild(document.createTextNode(news[id].getElementsByTagName("description")[0].firstChild.nodeValue)); marker.node = node; // フキダシを表示するポイントを定義する。 var TKY_Point = ZdcCommon.WGS2TKY(parseFloat(news[id].getAttribute("longitude")), parseFloat(news[id].getAttribute("latitude"))); temp_lon = TKY_Point.lon; temp_lat = TKY_Point.lat; marker.point = new ZdcPoint(temp_lon, temp_lat); // this.pointでひろう htmls[i] = node; html_point[i] = marker.point; } function nclick(titlei, desci, linki, lati, lngi) { if(map.msgopenstatus) map.closeMsgWindow(); var tmp_point = new ZdcPoint(lngi, lati); map.setMapLocation(tmp_point, 11); // 中心を変更する var nodelinki = document.createElement('a'); nodelinki.setAttribute('href', linki); nodelinki.setAttribute('target', '_blank'); nodelinki.appendChild(document.createTextNode(titlei)); var node = document.createElement('a'); node.appendChild(nodelinki); node.appendChild(document.createElement('br')); node.appendChild(document.createElement('br')); node.appendChild(document.createTextNode(desci)); if(titlei.length > 17){ titlei = titlei.substring(0,15) + '…'; } var title = document.createElement('a'); title.setAttribute('href', linki); title.setAttribute('target', '_blank'); title.appendChild(document.createTextNode(titlei)); /* 吹き出しを表示する */ map.createMsgWindow(); map.openMsgWindow(tmp_point ,title ,node); } function loadMap() { if(ZDC_RC!="00000"){ map_html = '地図が表示できません。以下の原因が考えられます。
(1)ウイルスセキュリティーソフトのプライバシー機能がオンになっているため表示できない。
(2)お使いのブラウザが非対応の可能性があります。
'; document.getElementById("Map").innerHTML = map_html; exit; } /* サーバと通信してデータを取得する */ http = ZdcXmlHttp.create(); if(!http){ alert('通信できません。オブジェクトの生成に失敗しました。'); return; } http.open('GET', file, false); http.send(null); if(http.responseText.length == '0') alert('エラーが発生しました。'); http.responseText.charset ='Shift_JIS'; xml = ZdcXml.parse(http.responseText); /* フリースクロール地図を取得する */ map = new ZdcMap(document.getElementById('Map')); var icon = new ZdcIcon(); icon.size = new ZdcSize(25, 25); icon.offset = new ZdcPixel(-7, -13); icon.msgoffset = new ZdcPixel(0, -15); icon.image = '/map/img/icon.png'; map.addMapScaleBar(new ZdcScaleBar()); map.addMapControl(new ZdcControl(),0,0); map.saveMapLocation(); /* ユーザレイヤを作成する */ var userlay = new ZdcUserLayer(); userlay.setLayerScale(4,18); // 縮尺レベル4から18に対応 userlay.setLayerType('manual'); if(latd && lngd){ var point = new ZdcPoint(lngd, latd); map.setMapLocation(point, scope); }else{ map.setMapLocation(new ZdcPoint(133.819686388889 ,34.75811222222222), 5); } map.saveMapLocation(); map.setWheelOff(); /* マーカを生成する */ var xmlData = http.responseXML; news = xmlData.documentElement.getElementsByTagName("place"); var cnt = news.length; for (var i = 0; i < cnt; i++) { title = news[i].getElementsByTagName("title")[0].firstChild.nodeValue; lng_tmp = parseFloat(news[i].getAttribute("longitude")); lat_tmp = parseFloat(news[i].getAttribute("latitude")); link_tmp = news[i].getElementsByTagName("link")[0].firstChild.nodeValue; var TKY_Point = ZdcCommon.WGS2TKY(parseFloat(news[i].getAttribute("longitude")), parseFloat(news[i].getAttribute("latitude"))); temp_lon = TKY_Point.lon; temp_lat = TKY_Point.lat; description_tmp = news[i].getElementsByTagName("description")[0].firstChild.nodeValue; if(title.length > 20){ title_t = title.substring(0,18) + '…'; }else{ title_t = title; } list_html += '' + title_t + '
'; var point = new ZdcPoint(temp_lon, temp_lat); var marker = new ZdcMarker(point, icon); /* イベントを追加変更する */ /* 【マウスオーバー】イベントに登録 */ ZdcEvent.addListener(marker, 'mouseclickmarker', function() { if(map.msgopenstatus) map.closeMsgWindow(); this.openMsgWindow(this.point,this.title,this.node,true,1); // このthisはmarkerを指します }); setUserData(marker,i); // 店舗データをマーカにセットする関数です userlay.addMarker(marker); // ユーザレイヤにマーカを追加する } /* 地図にユーザレイヤを追加する */ map.addUserLayer(userlay); document.getElementById("list").innerHTML = list_html; }