Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Super Contributor
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido
Accepted Solution

MapView navigation?

[ Edited ]

Hi,

 

I have successfully created a MapView (bb::cascades::maps::MapView) and have added one GeoLocation (bb:: platform::geo::GeoLocation) which shows a marker on the map.

 

I have added a name and description to my location:

 

location->setName("Point of interest");

location->setDescription("This point is interesting");

 

So when I click on the marker the little bubble pops up showing me 3 things:

 

-The GeoLocation's Name. "Point of interest"

-The GeoLocation's Description. "This point is interesting"

-A button with an arrow on it.

 

The arrow on the button is usually associated with the ability to navigate to the marker in question. How do I capture a button press from this button? And more importantly, how can I start navigation when the button is pressed?

 

Thanks!

Developer
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: MapView navigation?

For Navigation you'll need to use the RouteInvoker

 

To use this you'll need this in your main.cpp:

#include <bb/platform/RouteMapInvoker>

qmlRegisterType<bb::platform::RouteMapInvoker>("bb.platform", 1, 0, "RouteMapInvoker");
	    bb::data&colon;:DataSource::registerQmlTypes();

 ^put that right under this code in your main.cpp:

 

Q_DECL_EXPORT int main(int argc, char **argv)
{

 As well as attach this in your qml:

RouteMapInvoker {
            
            id: routeInvoker
        
        }

 And then onClicked or onTouch use this:

onTriggered: {
                routeInvoker.endLatitude = listItemLat.text <<<the latitude you want to go to
                routeInvoker.endLongitude = listItemLon.text <<<the longitude you want to go to
                routeInvoker.go() <<<calls the function
            }