ok, I was being stupid... I set the polygons above to be MVCArrays and things are working better now...
I'd still like those docs and examples though :) w On Jul 19, 11:24 am, willcadell <[email protected]> wrote: > hello all, > > I am trying to get my head around the MVC Array, I'm pretty dumb so > some help would be hugely appreciated! > > I want to add polygons to an array, and then take them away. > > so ultimately have a grid of polygons and allow the user to assemble a > selection set from this grid, sounds like a perfect job for the > MVCArray... > > well...if i dumb down my code, taking away all click events, just > assembling a multi-polygon MVCArray from individual polygons, I get to > this... > > var poly1 = [ > new google.maps.LatLng(9, -79), > new google.maps.LatLng(10, -79), > new google.maps.LatLng(10, -78), > new google.maps.LatLng(9, -78), > new google.maps.LatLng(9, -79) > ]; > > var poly2 = [ > new google.maps.LatLng(10, -79), > new google.maps.LatLng(11, -79), > new google.maps.LatLng(11, -78), > new google.maps.LatLng(10, -78), > new google.maps.LatLng(10, -79) > ]; > > testPoly1 = new google.maps.Polygon({ > paths: poly1, > strokeColor: "#FF0000", > strokeOpacity: 0.8, > strokeWeight: 2, > fillColor: "#FF0000", > fillOpacity: 0.35 > }); > > testPoly1.setMap(map); /*works to here!!*/ > > var testPoly2 = testPoly1; > > var testPolyCoords2 = testPoly2.getPaths(); > > testPolyCoords2.push(poly2); > > testPoly2.setOptions({ > paths: testPolyCoords2, > strokeColor: "#FFFF00" > }); > > testPoly2.setMap(map); > > I guess what this comes to is... can I push a whole polygon? > > any help would be hugely appreciated! > > w -- 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.
