Sareth
unread,Feb 4, 2011, 4:08:47 AM2/4/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Maps JavaScript API v3
Sorry for my English.
Maybe somebody can help me.
I'm new in Javascript and it is my first job. I have this code:
function addpolygon(n11,n12,n21,n22,n31,n32,n41,n42,n51,n52,info){
var Coords = [
new google.maps.LatLng(n11,n12),
new google.maps.LatLng(n21,n22),
new google.maps.LatLng(n31,n32)];
if (n41 != "" && n42 != "") {
Coords.push(new google.maps.LatLng(n41,n42))}
if (n51 != "" && n52 != "") {
Coords.push(new google.maps.LatLng(n51,n52))}
NewPolygon = new google.maps.Polygon({
paths: Coords,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35
});
NewPolygon.setMap(map);
polygonsArray.push(NewPolygon);
// Add a listener for the click event
google.maps.event.addListener(NewPolygon, 'rightclick',
showInfo);
infowindow = new google.maps.InfoWindow();
infowindow.setContent(info);
}
function showInfo(event){
infowindow.setPosition(event.latLng);
infowindow.open(map);
}
function deletePolygons() {
if (polygonsArray) {
for (j in polygonsArray) {
polygonsArray[j].setMap(null);
}
polygonsArray.length = 0;
}
}
I call function "addpolygon" every time when want to create new
polygon with some coords and different info. I push polygons in array
to delete them in future. When I click on polygon, I have the same
infowindow for each polygon, what I must to do if I want to show
different info's with each polygon?