// 0 ) { strHtml += ""; } if( intLvl > 1 ) { strHtml += ""; } if( intLvl > 2 ) { strHtml += ""; } if( intLvl > 3 ) { strHtml += ""; } if( intLvl > 4 ) { strHtml += ""; } if( intLvl > 5 ) { strHtml += ""; } if( intLvl > 6 ) { strHtml += ""; } document.getElementById( "meter" ).innerHTML = strHtml; // document.getElementById( "meter" ).style.display = "block"; } } ///////////////////////////////////////////////////// // short cut var objSC = { // fHtml: function() { // if( document.getElementById( "map_shortcut" ).style.display != "none" ) { var objBounds = gobjGMap.getBounds(); var objSW = objBounds.getSouthWest(); var objNE = objBounds.getNorthEast(); var objMarker; // var arrCatCB = document.getElementsByName( "cat_cb" ); var arrCatVal = []; var intMax = arrCatCB.length ? arrCatCB.length : 0; for( var i = 0; i < intMax; i++ ) { // if( arrCatCB[i].checked ) { arrCatVal.push( arrCatCB[i].value ); } } // 上部一覧読み込み var strUrl = "scut.php"; var strPrms = "sw_lat=" + objSW.lat() + "&sw_lon=" + objSW.lng() + "&ne_lat=" + objNE.lat() + "&ne_lon=" + objNE.lng() + "&cat=" + arrCatVal.join( "," ) + "&mnum=" + ( document.fmnum.markers.value < 20 ? document.fmnum.markers.value : 20 ); // $.ajax({ url: strUrl + "?" + strPrms, cache: false, dataType: "json", success: function( objRes ) { // if( objRes.error.code != 0 ) { alert( "エラー\n" + objRes.error.desc ); return; } // document.getElementById( "marker_sc" ).style.display ="none"; document.getElementById( "marker_sc" ).innerHTML = ""; if( objRes.data.page != "" ) { document.getElementById( "marker_sc" ).innerHTML = objRes.data.page; document.getElementById( "marker_sc" ).style.display ="block"; } } }); } }, // fSwitch: function() { // if( document.getElementById( "map_shortcut" ).style.display == "none" ) { document.getElementById( "map_sc_title" ).innerHTML = "▼マーカー一覧を非表示"; document.getElementById( "map_shortcut" ).style.display ="block"; document.getElementById( "map_shortcut" ).innerHTML = "
表示中の最新マーカー
"; objSC.fHtml(); // fSetCookie( "m_sc", "0", 60 * 60 * 24 * 365 ); } else { document.getElementById( "map_sc_title" ).innerHTML = "▼マーカー一覧を表示"; document.getElementById( "map_shortcut" ).innerHTML = ""; document.getElementById( "map_shortcut" ).style.display ="none"; // fSetCookie( "m_sc", "1", 60 * 60 * 24 * 365 ); } } } ///////////////////////////////////////////////////// // markers function cMk() { // this.arrMarkers = new Array(); // this.fDeploy = function() { // meter objMt.fMeter( 0 ); // var objBounds = gobjGMap.getBounds(); var objSW = objBounds.getSouthWest(); var objNE = objBounds.getNorthEast(); var objMarker; // meter objMt.fMeter( 1 ); // var arrCatCB = document.getElementsByName( "cat_cb" ); var arrCatVal = []; var intMax = arrCatCB.length ? arrCatCB.length : 0; for( var i = 0; i < intMax; i++ ) { // if( arrCatCB[i].checked ) { arrCatVal.push( arrCatCB[i].value ); } } // meter objMt.fMeter( 2 ); // マーカー読み込み var strUrl = "mark.php"; var strPrms = "sw_lat=" + objSW.lat() + "&sw_lon=" + objSW.lng() + "&ne_lat=" + objNE.lat() + "&ne_lon=" + objNE.lng() + "&cat=" + arrCatVal.join( "," ) + "&mnum=" + document.fmnum.markers.value; // $.ajax({ url: strUrl + "?" + strPrms, cache: false, dataType: "json", success: function( objRes ) { // meter objMt.fMeter( 3 ); // meter objMt.fMeter( 4 ); // if( objRes.error.code != 0 ) { alert( "エラー\n" + objRes.error.desc ); return; } // var arrItem = objRes.data; // for( var strKey in gobjMk.arrMarkers ) { // gobjMk.arrMarkers[ strKey ].bolRemain = false; } // meter objMt.fMeter( 5 ); // intMax = arrItem.length ? arrItem.length : 0; for( var i = 0; i < arrItem.length; i++ ) { // gobjMk.fAddMarker( arrItem[ i ].strMsgId, arrItem[ i ].strKeyCat, arrItem[ i ].strIconNameCat, arrItem[ i ].dblGeoLat, arrItem[ i ].dblGeoLon ); } // meter objMt.fMeter( 6 ); gobjMk.fClean(); // meter objMt.fMeter( 7 ); } }); objSC.fHtml(); } // this.fAddMarker = function( strMsgId, strKeyCat, strCatName, dblLat, dblLon ) { // if(!gobjMk.arrMarkers[ strMsgId ]) { objMarker = new google.maps.Marker({ position: new google.maps.LatLng(dblLat, dblLon), map: gobjGMap, icon: garrIcon[ strKeyCat ], title: strCatName }); objMarker.strMsgId = strMsgId; // google.maps.event.addListener( objMarker, "click", function() { gobjMk.fBlowUp( this.strMsgId ) }); gobjMk.arrMarkers[ strMsgId ] = objMarker; } gobjMk.arrMarkers[ strMsgId ].bolRemain = true; } // this.fSearched = function( strMsgId, strKeyCat, strCatName, dblLat, dblLon ) { var arrCatCB = document.getElementsByName( "cat_cb" ); var intMax = arrCatCB.length ? arrCatCB.length : 0; for( var i = 0; i < arrCatCB.length; i++ ) { // if( arrCatCB[i].value == strKeyCat ) { // arrCatCB[i].checked = true; } } // gobjMk.fAddMarker( strMsgId, strKeyCat, strCatName, dblLat, dblLon ); gobjMk.fBlowUp( strMsgId ); // return true; } // this.fBlowUp = function(strMsgId) { if(gobjInfoWindow && gobjInfoWindow[ "key" ] == strMsgId) { return; } closeInfoWindow(); // $.ajax({ url: "blow.php?id=" + strMsgId, cache: false, dataType: "json", success: function( objRes ) { if( objRes.error.code != 0 ) { alert( "エラー\n" + objRes.error.desc ); return; } gobjInfoWindow = []; gobjInfoWindow[ "key" ] = strMsgId; var infoWindow = new google.maps.InfoWindow({ content: objRes.data.html }); google.maps.event.addListener(infoWindow, "closeclick", function() { deleteInfoWindow(); }); gobjInfoWindow[ "window" ] = infoWindow; gobjInfoWindow[ "window" ].open(gobjGMap, gobjMk.arrMarkers[ strMsgId ]); } }); } // this.fClean = function() { // for(var strKey in gobjMk.arrMarkers) { if(!gobjMk.arrMarkers[ strKey ].bolRemain) { if(gobjInfoWindow && gobjInfoWindow[ "key" ] == strKey) { closeInfoWindow(); } gobjMk.arrMarkers[ strKey ].setMap(null); delete gobjMk.arrMarkers[ strKey ]; } } } } function closeInfoWindow() { if(gobjInfoWindow && gobjInfoWindow[ "window" ]) { gobjInfoWindow[ "window" ].close(); } deleteInfoWindow(); } function deleteInfoWindow() { if(gobjInfoWindow) { delete gobjInfoWindow[ "key" ]; delete gobjInfoWindow[ "window" ]; delete gobjInfoWindow; } gobjInfoWindow = null; } ///////////////////////////////////////////////////// // search var objSearch = { // fSearch: function( strQuery ) { // if( !document.getElementById( "map_search" ).innerHTML.length ) { // document.getElementById( "map_search" ).style.display ="none"; document.getElementById( "map_search" ).innerHTML = ""; } // var strPrms = ""; // if( strQuery != "" ) { strPrms = strQuery; } else { var strPrm = document.fsearch.query.value; if( strPrm != "" ) { strPrms += "str=" + strPrm; } } // if( strPrms != "" ) { // $.ajax({ url: "srch.php" + "?" + strPrms, cache: false, dataType: "json", success: function( objRes ) { // if( objRes.error.code != 0 ) { alert( "エラー\n" + objRes.error.desc ); return false; } // document.getElementById( "map_search" ).innerHTML = "
検索結果" + objRes.data.ix + "
" + objRes.data.page + "
"; document.getElementById( "map_search" ).style.display ="block"; } }); } // return true; } } //////////////////////////////////////////////////////////////////////////////////////// // geo // var objGC = { // fSearch: function() { // document.getElementById( "map_search" ).style.display ="none"; document.getElementById( "map_search" ).innerHTML = ""; // if( !document.fgeocode.query.value.length ) { return; } var geocoder = new google.maps.Geocoder(); geocoder.geocode({ address: "日本 " + document.fgeocode.query.value }, function(results, status) { if(status != google.maps.GeocoderStatus.OK) { return; } var strHtml = ""; if(results.length) { var placeMarks = new Array(); var intMax = results.length; for (var i = 0; i < intMax; i++) { var addressComponents = results[ i ][ "address_components" ]; var japan = false; for(var j = 0; j < addressComponents[ "length" ]; j++) { if(addressComponents[ j ][ "types" ][ 0 ] == "country" && addressComponents[ j ][ "short_name" ] == "JP") { japan = true; break; } } if(!japan) { continue; } var item = new Array(); item[ "name" ] = ("" + results[ i ][ "formatted_address" ]).replace("日本, ", "*"); item[ "latLng" ] = results[ i ][ "geometry" ][ "location" ]; placeMarks[i] = item; } console.log(placeMarks); // strHtml += ''; for(var i = 0; i < placeMarks.length; i++) { // strHtml += ''; strHtml += ''; strHtml += ''; } strHtml += '
'; strHtml += "" + placeMarks[ i ][ "name" ] + ""; strHtml += '
'; } // document.getElementById( "map_search" ).innerHTML = "
場所候補
" + strHtml + "
"; document.getElementById( "map_search" ).style.display ="block"; }); // return true; } }; google.load("maps", "3",{ "other_params" : "sensor=fakse&libraries=geometry&key=AIzaSyCdvHbGRpAQW0GGzNFgT_-NTKjwSmQXD3I", // "key": "AIzaSyCdvHbGRpAQW0GGzNFgT_-NTKjwSmQXD3I", "callback" : initMap }); //]]>