On Fri, Apr 23, 2010 at 11:18 AM, Scott <[email protected]> wrote:

> If you don't mind i'm going to word this another way and see if I REALLY
> UNDERSTAND.
>

Let's do it.


> If i were to send a drawable object..i.e. PNG icon like all the examples
> the Overlay will accumulate them (add item)...
>

The OverlayItem you send in addItem does NOT HAVE TO be an image, or any
drawable item for that matter, though it usually is. It's just something
with a position that can be represented on the map.


> However...My Draw is done on a clean Slate ontop of the overlay...Basically
> the overlay is cleaned out and refreshed with each item(icon) added
>

Yes.


> So the draw is cleaned on each additem...So If that is correct or close
> to correct?
>

Sort of. addItem just adds another OverlayItem to the collection of items.
Calling draw, by default, simply draws all the items that are in the
collection. When you add a new item it does invalidate the list causing a
redraw.


> Then am I to understand that itemized Overlays are just for icons,
>

It's just a collection of things to place on a map, which are usually
represented by icons. They can be whatever you want though.


> or can i move my Draw to another location in this class,
>

You don't want to be calling draw() on your own. This is called as necessary
when the map view needs to be drawn (when you scroll, zoom, add new items,
etc).


> Like before the populate to make the circles accumulate and just send
> a darn icon into additem whether I want an icon or not?
>

I'm not sure what you said here.


> IN OTHER WORDS Can i collect anything other than icons in an
> itemized overlay?
>

Yes, you can collect anything you want, as long as it's an OverlayItem. You
can define your own OverlayItem class that has more properties attached to
it besides the image and location. If you look at my website and
screenshots, you'll see that I use the map to show bus and stop icons. The
bus's in particular have a custom draw function that work similarly to what
you're doing.

I call super.draw() to draw the icon, then I iterate over the collection of
items (each of which is a custom BusOverlayItem that has extra information)
to do custom drawing to display a bus number and another image of an arrow
that is oriented to show the bus direction.

Draw is called ONCE for the one ItemizedOverlay (which represents the
collection of buses) and I, in turn, handle drawing each individual bus.

Make sense?

ItemizedOverlay can get confusing because it's one Overlay object as far as
the map is concerned, but is actually a collection of similar items treated
uniformly. Just remember that when you're doing custom drawing on it you
have to draw each individual item in the collection as necessary.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en

Reply via email to