GeographicsProvisioningBridge

Since: BlackBerry 10.2.0

#include <bb/cascades/maps/GeographicsProvisioningBridge>

To link against this class, add the following line to your .pro file: LIBS += -lbbcascadesmaps

A bridge to translate an external geographic data source into Geographic data and add it to a DataProvider.

The GeographicsProvisioningBridge class lets you convert external geographic data, such as a KML file, into Geographic data and add it to a DataProvider. Data sources can be local or remotely accessed by HTTP. This class is specifically intended to make it easier to populate a DataProvider with data in QML.

The type property has a default value of GeographicsProvisioningBridgeDataSource::AutoDetect, which indicates that the content type should be detected automatically. If this property is set to any other value, automatic detection of content type will not occur and the data will be treated as the provided type.

To populate a DataProvider with the geographic data from an external source:

If the destinationProvider property is not set when GeographicsProvisioningBridge::load() is called the operation will fail and an error will be emitted.

Here is an example in QML:

import bb.cascades 1.2
import bb.cascades.maps 1.2

Page {
    attachedObjects: [
        GeographicsProvisioningBridge {
            id: exampleBridge
            source: "asset:///placemark.kml"
            destinationProvider: dataProvider
        }
    ]
    content: Container {
        layout: StackLayout {
            orientation: LayoutOrientation.TopToBottom
        }
        horizontalAlignment: HorizontalAlignment.Center
        verticalAlignment: VerticalAlignment.Center     
        MapView {
            id: mapViewId
            latitude: 43.4706
            longitude: -80.5361
            mapData: MapData {
                dataProviders: [
                    DataProvider {
                        id: dataProvider
                        providerId: "dataProvider"
                        visible: true
                    }
                ]
            }
        }
    }
    onCreationCompleted: {
       exampleBridge.load();
    }
}

Overview

QML properties

destinationProvider: bb::cascades::maps::DataProvider
source: QUrl
sourceRemote: bool [read-only]
type: bb::cascades::maps::GeographicsProvisioningBridgeDataSource::Type

Public Functions Index

GeographicsProvisioningBridge (QObject *parent=0)
virtual ~GeographicsProvisioningBridge ()
Q_SLOT voidabort ()
DataProvider *destinationProvider () const
boolisSourceRemote ()
Q_SLOT voidload ()
Q_SLOT voidsetDestinationProvider (bb::cascades::maps::DataProvider *provider)
Q_SLOT voidsetSource (const QUrl &source)
Q_SLOT voidsetType (GeographicsProvisioningBridgeDataSource::Type type)
QUrlsource () const
GeographicsProvisioningBridgeDataSource::Typetype ()

Signals Index

voiddestinationProviderChanged (bb::cascades::maps::DataProvider *destinationProvider)
voidfinished (bb::cascades::maps::GeographicsProvisioningBridgeResult::Type resultType, const QString &errorMessage)
voidsourceChanged (QUrl source)
voidsourceRemoteChanged (bool sourceRemote)
voidtypeChanged (bb::cascades::maps::GeographicsProvisioningBridgeDataSource::Type type)

Properties

bb::cascades::maps::DataProvider destinationProvider

The destination DataProvider of the data.

Since:

BlackBerry 10.2.0

QUrl source

The source of the data.

In QML, relative paths are relative to the QML document in which this object is declared. In C++, relative paths are relative to the application's working directory.
Since:

BlackBerry 10.2.0

bool sourceRemote[read-only]

Whether the data source is remote or local.

Since:

BlackBerry 10.2.0

bb::cascades::maps::GeographicsProvisioningBridgeDataSource::Type type

The type of data source.

This property has a default value of GeographicsProvisioningBridgeDataSource::AutoDetect, which indicates that the content type should be detected automatically. If this property is set to any other value, automatic detection of content type will not occur and the data will be treated as the provided type.

Since:

BlackBerry 10.2.0

Public Functions

GeographicsProvisioningBridge (

Constructor.

Parameters
parent

The parent object to this object.

Since:

BlackBerry 10.2.0

virtual~GeographicsProvisioningBridge ()

Destructor.

Since:

BlackBerry 10.2.0

Q_SLOT void abort ()

Stops the current load operation if a network download is in progress.

If a load operation is stopped no error signal will be emitted.

Since:

BlackBerry 10.2.0

DataProvider * destinationProvider ()

Gets the current destination DataProvider.

Return:

The current destination DataProvider, or NULL if the destination DataProvider is not set.

Since:

BlackBerry 10.2.0

bool isSourceRemote ()

Gets the current value of the sourceRemote property.

Return:

true if the data source is remote, false if the data source is local.

Since:

BlackBerry 10.2.0

Q_SLOT void load ()

Loads the data from the data source into the destination provider.

The finished() signal is emitted when loading is complete.

If a network download is already in progress it will be stopped.

Since:

BlackBerry 10.2.0

Q_SLOT void setDestinationProvider (

Sets a new destination DataProvider.

Parameters
provider

The new destination DataProvider.

Since:

BlackBerry 10.2.0

Q_SLOT void setSource (

Sets a new URL of the data source.

Parameters
source

The new URL of the data source.

Since:

BlackBerry 10.2.0

Q_SLOT void setType (

Sets the value of the type property.

Since:

BlackBerry 10.2.0

QUrl source ()

Gets the current value of the source property.

Return:

The current URL to the data source.

Since:

BlackBerry 10.2.0

GeographicsProvisioningBridgeDataSource::Type type ()

Gets the current value of the type property.

Return:

The current data source type.

Since:

BlackBerry 10.2.0

Signals

void destinationProviderChanged (

Emitted when the destinationProvider property has changed.

Parameters
destinationProvider

The new value for the dataProvider property.

Since:

BlackBerry 10.2.0

void finished (

Emitted when loading operation has finished and the data has been added to the DataProvider.

Parameters
resultType

The result of the loading operation.

errorMessage

An error message if resultType is not GeographicsProvisioningBridgeResult::Success.

Since:

BlackBerry 10.2.0

void sourceChanged (

Emitted when the source property has changed.

Parameters
source

The new value for the source property.

Since:

BlackBerry 10.2.0

void sourceRemoteChanged (
  • boolsourceRemote)

Emitted when the sourceRemote property has changed.

Parameters
sourceRemote

The new value for the sourceRemote property.

Since:

BlackBerry 10.2.0

void typeChanged (

Emitted when the type property has changed.

Parameters
type

The new value for the type property.

Since:

BlackBerry 10.2.0

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus