var map;
var divMap;
var arrImgSystemType = [ "", "_r", "_h", "_l", "_lh", "_ic", "_is", "_im" ];
var arrMarkerList = null;
var currentInfoWindow = null;
var ico_ic_normal = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_ic_normal.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_ic_highway = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_ic_highway.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_is_normal = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_is_normal.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_is_highway = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_is_highway.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_im_normal = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_im_normal.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_im_highway = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_im_highway.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_i8833_normal = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_i8833_normal.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_i8833_highway = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_i8833_highway.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_idc_normal = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_idc_normal.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
var ico_idc_highway = L.icon( { iconUrl: '//orbis-guide.com/cmn/image/icon/map_marker_orbis_idc_highway.png', iconSize: [ 26, 32 ], iconAnchor: [ 13, 32 ], popupAnchor: [ 13, -36 ], } );
function initMap()
{
var map = L.map( "map_canvas" ).setView( [ 35.180188, 136.906565 ], 7 );
var tiles = L.tileLayer( "//{s}.tile.osm.org/{z}/{x}/{y}.png",
{
minZoom: 7,
maxZoom: 10,
attribution: '© OpenStreetMap contributors'
} );
map.addLayer( tiles );
$.getJSON( "//orbis-ido.com/share/script/index.map.server.php", { timestamp: new Date().getTime() }, function( ret )
{
var data = ret[ "data" ];
//
for( var intIndex = 0; intIndex < data[ "arrMobileList" ].length; intIndex++ )
{
var mobile = data[ "arrMobileList" ][ intIndex ];
var strSrcType = ( mobile[ "str8833Key" ].length > 0 ) ? "8833" : "dc" ;
var intRoadType = parseInt( mobile[ "intRoadType" ] );
var decLatitude = mobile[ "decLatitude" ];
var decLongitude = mobile[ "decLongitude" ];
L.marker( [ decLatitude, decLongitude ], { icon: getMobileIcon( strSrcType, intRoadType ) } ).addTo( map );
}
//
for( var intIndex = 0; intIndex < data[ "arrOrbisList" ].length; intIndex++ )
{
var orbis = data[ "arrOrbisList" ][ intIndex ];
var decLatitude = orbis[ "decLatitude" ];
var decLongitude = orbis[ "decLongitude" ];
var intSystemType = parseInt( orbis[ "intSystemType" ] );
var intRoadType = parseInt( orbis[ "intRoadType" ] );
var intOrbisKey = parseInt( orbis[ "intOrbisKey" ].replace( "o", "" ) );
L.marker( [ decLatitude, decLongitude ], { icon: getOrbisIcon( intSystemType, intRoadType ) } ).bindPopup( '詳細ページ' ).addTo( map );
}
} );
}
function getMobileIcon( strSrcType, intRoadType )
{
if( strSrcType == "8833" )
{
return intRoadType == 1 ? ico_i8833_normal : ico_i8833_highway ;
}
if( strSrcType == "dc" )
{
return intRoadType == 1 ? ico_idc_normal : ico_idc_highway ;
}
return null;
}
function getOrbisIcon( intSystemType, intRoadType )
{
switch( intSystemType )
{
case 1 : { return intRoadType == 1 ? ico_r_normal : ico_r_highway; }
case 2 : { return intRoadType == 1 ? ico_h_normal : ico_h_highway; }
case 3 : { return intRoadType == 1 ? ico_l_normal : ico_l_highway; }
case 4 : { return intRoadType == 1 ? ico_lh_normal : ico_lh_highway; }
case 5 : { return intRoadType == 1 ? ico_ic_normal : ico_ic_highway; }
case 6 : { return intRoadType == 1 ? ico_is_normal : ico_is_highway; }
case 7 : { return intRoadType == 1 ? ico_im_normal : ico_im_highway; }
case 8 : { return intRoadType == 1 ? ico_lp_normal : ico_lp_highway; }
case 9 : { return intRoadType == 1 ? ico_ls_normal : ico_ls_highway; }
}
return null;
}