[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Fri Jul 16 23:10:20 CEST 2010
SVN commit 1150819 by tgridel:
PositionTracking: append GeoDataDocument to FileManager directly
M +3 -1 FileManager.h
M +5 -5 MarbleModel.cpp
M +12 -19 gps/PositionTracking.cpp
M +3 -3 gps/PositionTracking.h
--- trunk/KDE/kdeedu/marble/src/lib/FileManager.h #1150818:1150819
@@ -90,8 +90,10 @@
void fileAdded( int index );
void fileRemoved( int index );
+ public Q_SLOTS:
+ void addGeoDataDocument( GeoDataDocument *document );
+
private Q_SLOTS:
- void addGeoDataDocument( GeoDataDocument *document );
void cleanupLoader( FileLoader *loader );
private:
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1150818:1150819
@@ -210,7 +210,7 @@
this, SIGNAL( modelChanged() ) );
d->m_gpxFileModel = new GpxFileModel( this );
- d->m_positionTracking = new PositionTracking( d->m_dataFacade->geometryModel(), this );
+ d->m_positionTracking = new PositionTracking( d->m_fileManager, this );
d->m_layerManager = new LayerManager( d->m_dataFacade, d->m_pluginManager, this );
@@ -422,10 +422,10 @@
}
}
// unload old standard Placemarks which are not part of the new map
- foreach(const QString& container, loadedContainers) {
- loadedContainers.pop_front();
- d->m_fileManager->removeFile( container );
- }
+// foreach(const QString& container, loadedContainers) {
+// loadedContainers.pop_front();
+// d->m_fileManager->removeFile( container );
+// }
// load new standard Placemarks
foreach(const QString& container, loadList) {
loadList.pop_front();
--- trunk/KDE/kdeedu/marble/src/lib/gps/PositionTracking.cpp #1150818:1150819
@@ -15,29 +15,28 @@
#include "GeoDataDocument.h"
#include "GeoDataPlacemark.h"
#include "AbstractProjection.h"
+#include "FileManager.h"
#include "MarbleMath.h"
#include "MarbleDebug.h"
-#include "MarbleGeometryModel.h"
using namespace Marble;
-PositionTracking::PositionTracking( MarbleGeometryModel *geometryModel,
+PositionTracking::PositionTracking( FileManager *fileManager,
QObject *parent )
- : QObject( parent ), m_geometryModel(geometryModel), m_positionProvider(0)
+ : QObject( parent ), m_fileManager(fileManager), m_positionProvider(0)
{
m_document = new GeoDataDocument();
+ m_document->setName("Position Tracking");
- GeoDataPlacemark placemark;
+ GeoDataPlacemark *placemark = new GeoDataPlacemark;
GeoDataMultiGeometry multiGeometry;
- GeoDataLineString lineString;
+ GeoDataLineString *lineString = new GeoDataLineString;
multiGeometry.append(lineString);
- placemark.setGeometry(multiGeometry);
+ placemark->setGeometry(multiGeometry);
m_document->append(placemark);
- m_geometryModel->setGeoDataRoot(m_document);
- connect(this, SIGNAL(gpsLocation(GeoDataCoordinates,qreal)),
- m_geometryModel, SLOT(update()));
+ m_fileManager->addGeoDataDocument(m_document);
}
@@ -61,17 +60,11 @@
PositionProviderStatusAvailable )
{
- GeoDataPlacemark placemark = m_document->features().last();
- GeoDataMultiGeometry *geometry = static_cast<GeoDataMultiGeometry*>(placemark.geometry());
- GeoDataLineString &lineString = static_cast<GeoDataLineString&>(geometry->last());
- lineString.append(position);
+ GeoDataPlacemark *placemark = static_cast<GeoDataPlacemark*>(m_document->child(m_document->size()-1));
+ GeoDataMultiGeometry *geometry = static_cast<GeoDataMultiGeometry*>(placemark->geometry());
+ GeoDataLineString *lineString = static_cast<GeoDataLineString*>(geometry->child(geometry->size()-1));
+ lineString->append(position);
- if (m_geometryModel->geoDataRoot() != m_document) {
- mDebug() << "setting geometrymodel";
- m_geometryModel->setGeoDataRoot(m_document);
- }
- mDebug() << "geometry size " << lineString.size();
-
//if the position has moved then update the current position
if ( !( m_gpsCurrentPosition ==
position ) )
--- trunk/KDE/kdeedu/marble/src/lib/gps/PositionTracking.h #1150818:1150819
@@ -26,8 +26,8 @@
class GeoDataDocument;
class GeoDataCoordinates;
+class FileManager;
class PluginManager;
-class MarbleGeometryModel;
class PositionTracking : public QObject
{
@@ -35,7 +35,7 @@
public:
- explicit PositionTracking( MarbleGeometryModel *geometryModel,
+ explicit PositionTracking( FileManager *fileManager,
QObject *parent = 0 );
~PositionTracking();
@@ -62,7 +62,7 @@
qreal m_speed;
GeoDataDocument *m_document;
- MarbleGeometryModel *m_geometryModel;
+ FileManager *m_fileManager;
GeoDataCoordinates m_gpsCurrentPosition;
GeoDataCoordinates m_gpsPreviousPosition;
More information about the Marble-commits
mailing list