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
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
Highlighted
Developer
Posts: 1,687
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
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 Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner http://vimeo.com/ekkescorner/videos
bb10-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 409
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...