QDeclarativeGeoMapObjectView::~QDeclarativeGeoMapObjectView()
{
    // Remove group from map, and items from the group. This is to
    // prevent their deletion. The objects are owned by the
    // declarative objects and are to be deleted by them.
    if (map_ && map_->mapData_) {
        map_->mapData_->removeMapObject(&group_);
        removeInstantiatedItems();
    }
}
// Removes and repopulates all items.
void QDeclarativeGeoMapObjectView::repopulate()
{
    if (!componentCompleted_ || !map_ || !map_->mapData_ || !delegate_ || !model_)
        return;
    // Free any earlier instances
    removeInstantiatedItems();

    // Iterate model data and instantiate delegates.
    // We could use more specialized landmark model calls here too,
    // but hopefully the support will be leveraged to a general model
    // level.
    QDeclarativeGeoMapObject* mapObject;
    for (int i = 0; i < model_->rowCount(); ++i) {
        mapObject = createItem(i);
        if (!mapObject)
            break;
        declarativeObjectList_.append(mapObject);
        mapObject->setVisible(visible_);
        mapObject->setMap(map_);
        group_.addChildObject(mapObject->mapObject());
        // Needed in order for mouse areas to work.
        map_->recursiveAddToObjectMap(mapObject);
    }
}
QDeclarativeGeoMapItemView::~QDeclarativeGeoMapItemView()
{
    removeInstantiatedItems();
}