[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Sun Jun 6 21:24:34 CEST 2010
SVN commit 1135197 by tgridel:
MarbleModel manages the PositionTracking
M +11 -1 MarbleModel.cpp
M +2 -0 MarbleModel.h
M +2 -8 gps/GpsLayer.cpp
M +1 -3 gps/GpsLayer.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1135196:1135197
@@ -52,6 +52,7 @@
#include "MercatorScanlineTextureMapper.h"
#include "gps/GpxFileModel.h"
#include "gps/GpxFile.h"
+#include "gps/PositionTracking.h"
#include "HttpDownloadManager.h"
#include "KmlFileViewItem.h"
#include "LayerManager.h"
@@ -143,6 +144,7 @@
//Gps Stuff
GpsLayer *m_gpsLayer;
+ PositionTracking *m_positionTracking;
GpxFileModel *m_gpxFileModel;
QTimer *m_timer;
@@ -211,7 +213,10 @@
this, SIGNAL( modelChanged() ) );
d->m_gpxFileModel = new GpxFileModel( this );
- d->m_gpsLayer = new GpsLayer( d->m_gpxFileModel );
+ GpxFile *gpxFile = new GpxFile();
+ d->m_gpxFileModel->addFile(gpxFile);
+ d->m_positionTracking = new PositionTracking(gpxFile, this);
+ d->m_gpsLayer = new GpsLayer( d->m_gpxFileModel, d->m_positionTracking );
connect( d->m_dataFacade->fileViewModel(), SIGNAL(layoutChanged()),
d->m_gpsLayer, SLOT(clearModel() ) );
@@ -718,6 +723,11 @@
return d->m_gpxFileModel;
}
+PositionTracking *MarbleModel::positionTracking() const
+{
+ return d->m_positionTracking;
+}
+
FileViewModel *MarbleModel::fileViewModel() const
{
return d->m_dataFacade->fileViewModel();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1135196:1135197
@@ -53,6 +53,7 @@
class FileViewModel;
class GpsLayer;
class GpxFileModel;
+class PositionTracking;
class HttpDownloadManager;
class MarbleModelPrivate;
class PlacemarkLayout;
@@ -220,6 +221,7 @@
GpsLayer *gpsLayer() const;
GpxFileModel *gpxFileModel() const;
FileViewModel *fileViewModel() const;
+ PositionTracking *positionTracking() const;
/**
* @brief Return whether the Gps Data is visible.
--- trunk/KDE/kdeedu/marble/src/lib/gps/GpsLayer.cpp #1135196:1135197
@@ -23,6 +23,7 @@
using namespace Marble;
GpsLayer::GpsLayer( GpxFileModel *fileModel,
+ PositionTracking *positionTracking,
QObject *parent )
:AbstractLayer( parent )
{
@@ -35,10 +36,7 @@
// m_files = new QVector<GpxFile*>();
m_fileModel = fileModel;
-// m_gpsTrack = new Track();
- m_currentGpx = new GpxFile();
- m_fileModel->addFile( m_currentGpx );
- m_tracking = new PositionTracking( m_currentGpx, this );
+ m_tracking = positionTracking;
}
@@ -46,7 +44,6 @@
{
// leaks m_fileModel, see comment in clearModel()
delete m_currentPosition;
- delete m_currentGpx;
}
bool GpsLayer::updateGps( const QSize &canvasSize, ViewParams *viewParams,
@@ -71,17 +68,14 @@
QRegion temp; // useless variable
updateGps( canvasSize, viewParams, temp );
paintCurrentPosition( painter, canvasSize, viewParams );
- m_currentGpx->draw( painter, canvasSize, viewParams );
}
const QVector<GpxFile*> * const allFiles = m_fileModel->allFiles();
QVector<GpxFile*>::const_iterator it;
for( it = allFiles->constBegin();
it != allFiles->constEnd(); ++it ) {
- if( (*it) != m_currentGpx ) {
(*it)->draw( painter, canvasSize, viewParams );
}
- }
painter->restore();
}
--- trunk/KDE/kdeedu/marble/src/lib/gps/GpsLayer.h #1135196:1135197
@@ -31,6 +31,7 @@
public:
explicit GpsLayer( GpxFileModel *fileModel,
+ PositionTracking *positionTracking,
QObject *parent =0 );
~GpsLayer();
virtual void paintLayer( ClipPainter *painter,
@@ -53,9 +54,6 @@
private:
Waypoint *m_currentPosition;
-// QVector<GpxFile*> *m_files;
-
- GpxFile *m_currentGpx;
PositionTracking *m_tracking;
};
More information about the Marble-commits
mailing list