DataProvider
#include <bb/cascades/maps/DataProvider>
To link against this class, add the following line to your .pro file: LIBS += -lbbcascadesmaps
A source of mappable data.
Dynamic DataProvider
It is possible to have a DataProvider whose contents change as the map's viewport changes. To accomplish this, create a subclass of DataProvider. Add slots to the class to be connected to the signals from MapView. For example:
MapView* map = new MapView();
DynamicDataProvider* ddp = new DynamicDataProvider();
QObject::connect( map, SIGNAL( latChanged(double) ),
ddp, SLOT( onLatChanged(double) ) );
QObject::connect( map, SIGNAL( lonChanged(double) ),
ddp, SLOT( onLonChanged(double) ) );
QObject::connect( map, SIGNAL( altitudeChanged(int) ),
ddp, SLOT( onAltitudeChanged(int) ) );
Finally, emit notifications, such as geoAdded(), when elements have been added or removed from the container.
Object Ownership
Elements added to this DataProvider (that is, instances of Geographic objects) are owned by this DataProvider. When this DataProvider is deleted, all of its Geographic objects are also deleted.
When this DataProvider is added to a MapData object, the MapData instance owns this object (through parent child relationships).
Reference Type
DataProvider is expected to be used as a reference type. As such, care needs to be made when referencing this object in multi-threaded environments. For example, deletion in one thread can cause a dangling pointer in another thread.
Also note that the contents of this container (bb::platform::geo::Geographic) are also reference types.
BlackBerry 10.0.0
Public Functions Index
| DataProvider (const QString &id="", QObject *parent=0) | |
| virtual | ~DataProvider () |
| QString | providerId () const |
| void | setProviderId (const QString &id) |
| bool | isVisible () const |
| void | setVisible (bool visible) |
| bb::platform::geo::GeoList | toGeoList () const |
| bool | add (bb::platform::geo::Geographic *element) |
| int | add (const bb::platform::geo::GeoList &elements) |
| bool | remove (const QString &elementId) |
| int | remove (const QStringList &elements) |
| void | clear () |
| bb::platform::geo::GeoList | find (const bb::platform::geo::BoundingBox &box) const |
| int | count () const |
| bb::platform::geo::BoundingBox | boundingBox () const |
Signals Index
| void | geoAdded (const QString &providerId, const QString &elementId) |
| void | geoAddedBulk (const QString &providerId, const QStringList &elementIds) |
| void | geoRemoved (const QString &providerId, const QString &elementId) |
| void | geoRemovedBulk (const QString &providerId, const QStringList &elementIds) |
| void | visibilityChanged (const QString &providerId, bool visible) |
| void | topographyChanged (const QString &providerId, const QString &elementId) |
Public Functions
Constructor.
virtual
Destructor.
BlackBerry 10.0.0
void
Sets the unique identifier for this data provider.
BlackBerry 10.0.0
bool
Determines if this data provider is currently visible or not.
true if is visible, false otherwise.
BlackBerry 10.0.0
void
Makes this data provider visible.
| Parameters | |
|---|---|
| visible |
If true, the contents of this data provider will become visible to the map (the view will not change to make them "on screen"). If false, this data provider's contents will become invisible to the map. |
BlackBerry 10.0.0
bool
Adds the element to this data provider's collection.
Elements that are added to this data provider become children of this instance. When something has been added, a notification is emitted.
| Parameters | |
|---|---|
| element |
The element to be added. |
true if the addition was successful, false otherwise.
BlackBerry 10.0.0
int
Adds all the Geographic elements to this data provider.
Elements that are added to this data provider become children of this instance. When all these elements are added, a single notification is emitted.
| Parameters | |
|---|---|
| elements |
The elements to be added. |
The number of elements added.
BlackBerry 10.0.0
bool
Removes the element with the ID from this data provider's collection.
If the element has been successfully removed, then a notification is performed.
| Parameters | |
|---|---|
| elementId |
The ID of the element to remove. |
true if the element was removed successfully, false otherwise.
BlackBerry 10.0.0
int
Removes all the elements with the given IDs from this data provider's collection.
A notification is triggered with the elements that have been removed. A removed element is freed from memory.
| Parameters | |
|---|---|
| elements |
The list of IDs to be removed. |
The number of elements removed.
BlackBerry 10.0.0
void
Removes all data in this data provider.
BlackBerry 10.0.0
bb::platform::geo::GeoList
Retrieves all the visible data that's in the given lat/lon box.
| Parameters | |
|---|---|
| box |
The bounding box to search within. |
A list of visible entities.
BlackBerry 10.0.0
int
Returns the number of Geographic elements in this data provider.
BlackBerry 10.1.0
bb::platform::geo::BoundingBox
Returns the bounding box of the elements within this data provider.
If the number of elements is zero, then an invalid box is returned.
The BoundingBox of all elements within this data provider, or an invalid box if there are no elements.
BlackBerry 10.1.0
Signals
void
Emitted when a Geographic element has been added to this data provider.
| Parameters | |
|---|---|
| providerId |
The ID of the data provider that the Geographic was added to. |
| elementId |
The ID of the element that was added. |
BlackBerry 10.0.0
void
Emitted when multiple Geographic elements have been added to this data provider.
| Parameters | |
|---|---|
| providerId |
The ID of the data provider that the Geographic was added to. |
| elementIds |
The IDs of the elements that were added. |
BlackBerry 10.0.0
void
Emitted when a Geographic element has been removed from this data provider.
| Parameters | |
|---|---|
| providerId |
The ID of the data provider that the Geographic was removed from. |
| elementId |
The ID of the element that was removed. |
BlackBerry 10.0.0
void
Emitted when multiple Geographic elements have been removed from this data provider.
| Parameters | |
|---|---|
| providerId |
The ID of the data provider that the Geographic was removed from. |
| elementIds |
The IDs of the elements that were removed. |
BlackBerry 10.0.0
void
Emitted when the visibility of this data provider has changed.
| Parameters | |
|---|---|
| providerId |
The ID of the data provider whose visibility has changed. |
| visible |
The new visible state. |
BlackBerry 10.0.0
void
Emitted when the topography of a Geographic within this data provider has changed.
| Parameters | |
|---|---|
| providerId |
The ID of the data provider that contains the Geographic that was changed. |
| elementId |
The ID of the element that was changed. |
BlackBerry 10.1.0