//
// GoogleMaps用汎用メソッド
//
// 2006/05/01 作成：中本
//
//## Setting start #########################################
//-- base position --

// * setting of HPK *

//
// map
//
var DefLng = 135.2706241607666; // longitude
var DefLat = 34.68829249968282; // latitude
var DefZoom = 2; // zoom level

//
// default icon
//
var DefIcon = 1; // show:1, hide:0
var DefIconFace = "../img/areaicon/def_face.png";
var DefIconFaceWidth = 167;
var DefIconFaceHeight = 60;
var DefIconShadow = "../img/areaicon/def_shadow.png";
var DefIconShadowWidth = 167;
var DefIconShadowHeight = 60;
var DefIconAnchorX = 62;
var DefIconAnchorY = 59;

//
// area icon
//
var AreaIconFace = "../img/areaicon/area_face.png";
var AreaIconFaceWidth = 28;
var AreaIconFaceHeight = 28;
var AreaIconShadow = "../img/areaicon/area_shadow.png";
var AreaIconShadowWidth = 38;
var AreaIconShadowHeight = 33;
var AreaIconAnchorX = 14;
var AreaIconAnchorY = 28;


//## Setting End ###########################################

//-- Local Method ------------------------------------------
//
// GIcon createDefaultIcon()
//   基準点に表示するアイコンの設定。
//
function createDefaultIcon() {
	var di = new GIcon();
	
	di.image = DefIconFace;
	di.iconSize = new GSize(DefIconFaceWidth, DefIconFaceHeight);
	di.iconAnchor = new GPoint(DefIconAnchorX, DefIconAnchorY);
	di.shadow = DefIconShadow;
	di.shadowSize = new GSize(DefIconShadowWidth, DefIconShadowHeight);
	
	return di;
}

//
// GIcon createBaseIcon_Area()
//   エリア用のアイコンで使用するベースアイコンを作成する。
//   ここでいうベースアイコンとは、imageプロパティ以外の
//   全ての値を設定したGIconクラスのインスタンスを指す。
//
function createBaseIcon_Area() {
	var bia = new GIcon();
	
	bia.iconSize = new GSize(AreaIconFaceWidth, AreaIconFaceHeight);
	bia.iconAnchor = new GPoint(AreaIconAnchorX, AreaIconAnchorY);
	bia.shadow = AreaIconShadow;
	bia.shadowSize = new GSize(AreaIconShadowWidth, AreaIconShadowHeight);
	
	return bia;
}

//-- Public Method -----------------------------------------

//
// setPositionAndZoom
//		map: target map object.
//		lng: x/longitude.
//		lat: y/latitude.
//
function setPositionAndZoom(map, lng /* =DefLng */, lat /* =DefLat */, zoom /* =DefZoom */) {
	if(lng == undefined) { lng = DefLng ;}
	if(lat == undefined) { lat = DefLat ;}
	if(zoom == undefined) { zoom = DefZoom ;}
	
	map.centerAndZoom(new GPoint(lng, lat), zoom);
}

//
//	addAreaMaker
//		map: target map object.
//		lng: x/longitude.
//		lat: y/latitude.
//		iconimg: filepath of icon image.
//
function addAreaMarker(map, lng, lat, iconimg) {
	//	marker object.
	var ico = new GIcon(createBaseIcon_Area());
	ico.image=iconimg;
	var mrk = new GMarker(new GPoint(lng, lat), ico);
	
	//	event listener.
	map.addOverlay(mrk);
}

//
//	addDefaultMaker
//		map: target map object.
//
function addDefaultMarker(map) {
	var mrk;
	if(DefIcon == 1) {
		//	marker object.
		mrk = new GMarker(new GPoint(DefLng, DefLat), new GIcon(createDefaultIcon()));
		
		//	event listener.
		map.addOverlay(mrk);
	}
}

