MapLongPressToPinDrop

Since: BlackBerry 10.0.0

#include <bb/cascades/maps/MapLongPressToPinDrop>

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

A utility action class for performing a pin drop, which is the creation of a new point of interest (pin) triggered by a user's action.

This class connects to the MapView::mapLongPressed() signal. When a user performs a long-press on an empty map space, this class creates the new pin.

The steps taken by this class to create the pin are as follows:
  • Create a new GeoLocation at the point the map was pressed.

  • Asynchronously initiate a reverse geocode to get the street address.

  • Set the map's focus to the new pin.

  • Emit a pinCreated() signal.

  • Update the name of the GeoLocation with the address information, when the reverse geocode has completed.

This action is connected to a MapView instance. When the action and a map are associated, the MapView object becomes the parent of the action object. Thus, when an instance of this class has been created and associated with a MapView instance, the instance should not be explicitly destroyed by the client.

To connect this action to a MapView instance:
MapView* theMapView = root->findChild< MapView* >( "mapview" );
MapLongPressToPinDrop* action = new MapLongPressToPinDrop( theMapView );
connect( action, SIGNAL( pinCreated( const QString& ) ), this, SLOT( onPinCreated( const QString& ) ) );
When a new pin is created, the corresponding new GeoLocation object is added to the associated MapView's MapData object. To retrieve the new GeoLocation when the pinCreated() signal is emitted:
Q_SLOT void onPinCreated( const QString& newId ) {
    bb::platform::geo::Geographic* newPin = mapView->mapData()->geographic( newId );
    // Do something with the new pin.
}


Overview

Public Functions Index

MapLongPressToPinDrop (bb::cascades::maps::MapView *map)
virtual ~MapLongPressToPinDrop ()

Signals Index

voidpinCreated (const QString &id)
voidreverseGeocodeFinished (const QString &id, bool success)

Public Functions

MapLongPressToPinDrop (

Constructor.

Parameters
map

The MapView control that this action is to be associated with. This parameter is required and can't be NULL.

Since:

BlackBerry 10.0.0

virtual~MapLongPressToPinDrop ()

Destructor.

Since:

BlackBerry 10.0.0

Signals

void pinCreated (

Emitted when a new pin is created.

Note: This signal can be emitted before the reverse geocode has completed.
Parameters
id

The ID of the new Geographic entity.

Since:

BlackBerry 10.0.0

void reverseGeocodeFinished (

Emitted when the reverse geocode of the address of a new pin has completed.

Parameters
id

The ID of the Geographic that was reverse geocoded.

success

true if the reverse geocode succeeded, false otherwise.

Since:

BlackBerry 10.0.0

Last modified: 2014-09-29



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

comments powered by Disqus