Is this required?
// === A method for testing if a point is inside a polygon
// === Returns true if poly contains point
// === Algorithm shamelessly stolen from
http://alienryderflex.com/polygon/
GPolygon.prototype.Contains = function(point) {
var j=0;
var oddNodes = false;
var x = point.lng();
var y = point.lat();
for (var i=0; i < this.getVertexCount(); i++) {
j++;
if (j == this.getVertexCount()) {j = 0;}
if (((this.getVertex(i).lat() < y) && (this.getVertex(j).lat
() >= y))
|| ((this.getVertex(j).lat() < y) && (this.getVertex(i).lat
() >= y))) {
if ( this.getVertex(i).lng() + (y - this.getVertex(i).lat
())
/ (this.getVertex(j).lat()-this.getVertex(i).lat())
* (this.getVertex(j).lng() - this.getVertex(i).lng())<x )
{
oddNodes = !oddNodes
}
}
}
return oddNodes;
}
This is where I am confused. looking here: http://econym.org.uk/gmap/inside.htm
It points out that the following is no longer needed. And I have
looked to to avail what version of the map I am using.
If I could get this cleared up I think it would solve the majority of
my problems. Because I use the above function on my map currently
without a problem.
On Dec 6, 6:47 pm, Mike Williams <[EMAIL PROTECTED]> wrote:
> Wasn't it daniel who wrote:
>
> >So I am curious as to how do i know the user has clicked the polygon --
> >how to i get that point to open the infowindow?
>
> You have to decide which point you want to use to open the infowindow
> on. One possibility is to open it at the point where the user clicked:
>
> GEvent.addListener(poly, "click", function(point) {
> map.openInfoWindowHtml(point, "hello");
>
> });
>
> Or you might want to open it at the centre of the bounds of the poly
>
> GEvent.addListener(poly, "click", function() {
> map.openInfoWindowHtml(poly.getBounds().cetCentre(), "hello");
>
> });
>
> --http://econym.org.uk/gmap
> The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---