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?
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.