On Tue, Nov 24, 2009 at 6:05 AM, arclyte <[email protected]> wrote:

> Can anyone (Ben?) provide an example of how I can prepopulate an
> MVCArray?  I think that's my problem.
>

If you write
    new MVCArray([... your points here ...]);
then the MVCArray adopts the given array for its internal storage.  The
.setAt(), .insertAt(), .deleteAt() methods will modify the given array, and
fire change events so the polygon knows to redraw.

Ben, the example you provide instantiates an empty array and fill it
> on click.  I'm doing that in my script, but it must also pre-load some
> stored polygons.  I'm trying to get away from the way we used to do it
> in v2 with a thousand lines of pushing points.  If I could construct
> the array of points and define it in the constructor that'd be much
> better, to my eyes anyway.  I've tested and can manually push (.setAt)
> points into the path/poly but any time I've tried to pre-define it I
> get the constructor errors I've mentioned. Thanks!
>
> - Jim
>
>
> On Nov 23, 12:45 pm, arclyte <[email protected]> wrote:
> > I kind of hacked this together based on a prototype, so it's gone
> > through a few different versions.  I had tried to simplify things and
> > ended up changing path from an MVCArray to just an array.  It looks
> > like that's probably my downfall, forcing me to update the polygon in
> > order to see the changes that were made in the path.
> >
> > I did that, though, because I've had some trouble getting MVCArray
> > working correctly.  I keep getting errors like this: "Invalid value
> > for constructor parameter 0: [object Object]
> http://maps.gstatic.com/intl/en_us/mapfiles/api-3/22a/main.jsLine
> > 52".  I'm guessing it's just syntax, but I'm not familiar enough with
> > the MVCArray to figure it out in this context.
> >
> > Back to fiddling with it I suppose...  Thanks for the response!
> >
> > On Nov 22, 7:34 pm, Ben Appleton <[email protected]> wrote:
> >
> > > On Sat, Nov 21, 2009 at 5:49 AM, arclyte <[email protected]> wrote:
> > > > I'm guessing that this is a bug in my code somewhere, but I haven't
> > > > been able to figure out where just yet.
> >
> > > > Here is the sample for my current code:
> > > >http://arclyte.netdojo.com/geo/polyDraw.php
> >
> > > > If you click on the map you'll start placing markers, or you can
> click
> > > > on the color box next to a polygon to load markers for that polygon
> > > > and edit it.
> >
> > > > My polygon is defined as an array of polygons, so the new (green)
> > > > polygon is in poly[2].  If you click and add points to the polygon
> you
> > > > can see that the points actually are contained within the object but
> > > > the polygon display is not being updated.
> >
> > > > I've found that if I call poly[n].setMaps(map) on the polygon I'm
> > > > editing it will redraw and show the new/edited points.  But that
> means
> > > > redrawing the polygon each time... I'm afraid that won't scale very
> > > > well if we get very large polygons.  It also gives a nice flicker
> > > > every time you draw a point which I'd rather avoid.
> >
> > > I see you've tried MVCArray's .insertAt(), which notifies the polygon
> of a
> > > change in its coordinates.  But that code is currently commented out.
>  Did
> > > that not work?
> >
> > > For reference, I use MVCArray's .insertAt() in this polygon editing
> demo:http://gmaps-samples-v3.googlecode.com/svn/trunk/poly/poly_edit.html
> >
> > > --
> >
> > > > 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]<google-maps-js-api-v3%[email protected]>
> <google-maps-js-api-v3%[email protected]<google-maps-js-api-v3%[email protected]>
> >
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-maps-js-api-v3?hl=.
>
> --
>
> 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]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=.
>
>
>

--

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.


Reply via email to