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
Highlighted
Developer
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

How to know the mapview is properly loaded and how to destroy the map object in qml?

Hi!

 

    I want to show a loader until the mapview is loaded. how to know whether the mapview is loaded properly? If I again load a mapview the previously rendered mapview is appearing in that map. How to destroy the mapview object in qml?

 

 

Thanks!

- Raju

- Raju
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: How to know the mapview is properly loaded and how to destroy the map object in qml?


raju_winit wrote:...
How to destroy the mapview object in qml?

 

Thanks!

- Raju


see this other thread:

http://supportforums.blackberry.com/t5/Cascades-Development/Getting-problem-when-inserting-map-view-...

 


raju_winit wrote:

Hi!

 

    I want to show a loader until the mapview is loaded. how to know whether the mapview is loaded properly?


just last night got the info that there's currently no way to get a signal that the Mapview is loaded

 

hint thx to Shadid Haque:

Workaround is to wait until the worldToWindow() function stops returning bottom left for a location in antarctica

 

haven't done this yet but will do and post next days

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 410
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: How to know the mapview is properly loaded and how to destroy the map object in qml?

I also found this solution:

 

QPoint MapPage::worldToPixel(QObject* mapObject, double latitude, double longitude) const {
   MapView* mapview = qobject_cast<MapView*>(mapObject);
   const Point worldCoordinates = Point(latitude, longitude);
   return mapview->worldToWindow(worldCoordinates);
}


void MapPage::checkMapAvailable() {
if (mapView != 0 && mapView->latitude() != 0) {
   QPoint point = worldToPixel(mapView, mapView->latitude(), mapView->longitude());
   if (point.x() > 0) {
   //The center of the map is in the map => Map is valid
   timerMap->stop();
   mapLoaded = true;
   buildPins();
   }
}
}

timerMap = new QTimer(this);
connect(timerMap, SIGNAL(timeout()), this, SLOT(checkMapAvailable()));


//Take care to release timerMap when page is quit before loaded, etc...