Thursday, July 5, 2012

Calling Polygon in Google Maps









Example


function Polygon(_nama, _points, _color, _info, _wlyID, _tipeRegion){
//_color = get_random_color();
var _polygon = new google.maps.Polygon({
paths: _points,
strokeColor: "#ffffff",
strokeOpacity: 0.8,
strokeWeight: 1,
fillColor: _color,
fillOpacity: 0.35
});
//Adding Listener
google.maps.event.addListener(_polygon, "click", FUNC_infowindow);
//Function Infowindow
function FUNC_infowindow(event){
var content_header = "Loading...";
var content_config = "";
var view_all_content = content_header + content_config;
_infowindow.close();
_infowindow = new google.maps.InfoWindow();
google.maps.event.addListener(_infowindow, 'domready', function() {    
if (_showRegionTipe=="kecamatan_populasi"){
_infowindow.close();
closeDialog();
$("#dialog_container").load('dataKecamatan.php?kd_kec='+_wlyID+'&bulan='+global_bulan+'&tahun='+global_tahun);
}
if (_showRegionTipe=="kabupaten_populasi"){
_infowindow.close();
closeDialog();
$("#dialog_container").load('dataKabupaten.php?kd_kab='+_wlyID+'&bulan='+global_bulan+'&tahun='+global_tahun);
}
else {
$("#tabs").tabs();
}
});
_infowindow.setContent(view_all_content);
_infowindow.setPosition(event.latLng);
_infowindow.open(map);
};
//return to fuction
_tipeRegion.push(_polygon);
};

No comments:

Post a Comment