<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Martin,<br>
<br>
Am 20.11.2012 20:40, schrieb Martin Engelmann:<br>
</div>
<blockquote cite="mid:8467009.qHIOY6hDTx@murphi" type="cite">
<pre wrap="">Hello,
I'm developing an application for managing geocaches and I'm using marble to
display the locations on a map. I'm using a GeoDataDocument to colect all the
placemarks for the caches. For each cache I use the following code to add a
placemark to the map:
Marble::GeoDataPlacemark* placemark = new Marble::GeoDataPlacemark();
placemark->setName(geocache->waypoint());
placemark->setCoordinate(Marble::GeoDataPoint(geocache->position()));
// Set style, description and visual category ...
marbleWidget->model()->treeModel()->addFeature(geoDataDoc, placemark);
The code works fine and fast when the application starts and the widget is not
yet shown on the screen. The placemarks are created based on information from
a database in a function called from the constructor of the applications main
window.
When I change the path to the database file however I need to remove all
geocache placemarks and repopulate the map with the placemarks read from the
database. The map is shown as it is part of the main window. This is much
slower on my machine.
I measured the follwing times for the addFeature call on my machine (Intel
Core i7 CPU 860 @ 2.80GHz, 6GB RAM):
Startup of the application: 1.1ms
Repopulate the map: 28ms - 29ms</pre>
</blockquote>
I guess seconds, not milliseconds? 30 ms would still be pretty fast.<br>
<br>
<blockquote cite="mid:8467009.qHIOY6hDTx@murphi" type="cite">
<pre wrap="">
I assume it's slower because after each call to addFeature the map is updated
to show the new placemark. Is there a possibility to disable updating the map
when I add placemarks? </pre>
</blockquote>
<br>
For testing (I wouldn't recommend this as a general solution) you
can call something like (see also [1])<br>
<br>
<pre wrap="">marbleWidget->model()->treeModel()->blockSignals(true);
// repopulate map
marbleWidget->model()->treeModel()->blockSignals(false);
marbleWidget->model()->treeModel()->update();
If that speeds things up, I'd try wrapping the placemarks in a GeoDataDocument and add/remove that to the model like so:
Marble::GeoDataDocument* document = new Marble::GeoDataDocument;
Marble::GeoDataPlacemark* placemark = new Marble::GeoDataPlacemark();
placemark->setName(geocache->waypoint());
placemark->setCoordinate(Marble::GeoDataPoint(geocache->position()));
// Set style, description and visual category ...
document->add(placemark);
marbleWidget->model()->treeModel()->addFeature(geoDataDoc, document);
The benefit is that you have just one addFeature/removeFeature call for all placemarks.
Regards,
Dennis
</pre>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<br>
[1]
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="http://doc.qt.digia.com/qt/qobject.html#blockSignals">http://doc.qt.digia.com/qt/qobject.html#blockSignals</a><br>
<br>
<blockquote cite="mid:8467009.qHIOY6hDTx@murphi" type="cite">
<pre wrap="">
This way I could disable updating before I start adding the placemarks and re-
enable it when I'm finished.
I'm using marble 1.4.1 and KDE 4.9.3 on ArchLinux x86_64.
Kind regards,
Martin Engelmann
<a class="moz-txt-link-abbreviated" href="mailto:murphi.oss@googlemail.com">murphi.oss@googlemail.com</a>
_______________________________________________
Marble-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Marble-devel@kde.org">Marble-devel@kde.org</a>
<a class="moz-txt-link-freetext" href="https://mail.kde.org/mailman/listinfo/marble-devel">https://mail.kde.org/mailman/listinfo/marble-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>