Drawing the ItemizedOverlay

 

As the name suggests, allows you to supply a list of points of interest to be displayed on the map – specifically, instances of . The overlay, then, handles much of the drawing logic for you. Here are the minimum steps to make this work:

• First, override as your own subclass (in this example, )

• In the constructor, build your roster of instances, and call when they are ready for use by the overlay

• Implement to return the number of items to be handled by the overlay

• Override to return instances given an index

• When you instantiate your subclass, provide it with a that represents the default icon (e.g., push‑pin) to display for each item

The marker from the constructor is the Drawable used for the last bullet – it shows a push‑pin, as illustrated in Figure 34‑1 earlier in this chapter.

You may also wish to override to do a better job of handling the shadow for your markers. While the map will handle casting a shadow for you, it appears you need to provide a bit of assistance for it to know where the “bottom” of your icon is, so it can draw the shadow appropriately.

For example, here is :

Private class extends

Private new

Private null

 

Public SitesOverlay

Super

This

 

Add new OverlayItem getPoint

 

Add new OverlayItem getPoint

 

 

Add new OverlayItem getPoint

 

 








Дата добавления: 2015-05-16; просмотров: 736;


Поиск по сайту:

При помощи поиска вы сможете найти нужную вам информацию.

Поделитесь с друзьями:

Если вам перенёс пользу информационный материал, или помог в учебе – поделитесь этим сайтом с друзьями и знакомыми.
helpiks.org - Хелпикс.Орг - 2014-2024 год. Материал сайта представляется для ознакомительного и учебного использования. | Поддержка
Генерация страницы за: 0.003 сек.