Let's assume we have a polyline called poly and we want to read all
vertices.
I found the following solution in one the libraries:
var path = poly.getPath();
var points = new Array(path.getLength());
for (var i = 0; i < points.length; i++) {
path.getAt(i);
}
This seems to be a good solution and it works very well. But it seems
a bit weird to copy the length of the MVCArray and take the copy to
iterate through the original MVCArray.. So I wonder why to make this
detour?
Another, slightly shorter, solution seems to be the following:
for (var i = 0; i < path.getLength(); i++) {
path.getAt(i);
}
Again a well working solution but again a detour. So I wonder why
nobody seems to use forEach()?
--
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.