[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Fri Sep 11 22:39:01 CEST 2009
SVN commit 1022473 by tgridel:
get rid of PlacemarkContainer
replace it with the actual QVector<GeoDataPlacemark> where needed
M +0 -1 CMakeLists.txt
M +0 -1 MarbleControlBox.cpp
M +5 -26 MarblePlacemarkModel.cpp
M +4 -5 MarblePlacemarkModel.h
M +2 -14 MarbleRunnerManager.cpp
M +0 -2 MarbleRunnerManager.h
D PlacemarkContainer.cpp
D PlacemarkContainer.h
M +4 -11 PlacemarkLoader.cpp
M +4 -3 PlacemarkLoader.h
M +2 -4 PlacemarkManager.cpp
M +3 -2 PlacemarkManager.h
M +0 -1 geodata/data/GeoDataContainer.h
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1022472:1022473
@@ -101,7 +101,6 @@
MeasureTool.cpp
ImageLoadThread.cpp
VisiblePlacemark.cpp
- PlacemarkContainer.cpp
PlacemarkManager.cpp
PlacemarkLayout.cpp
PlacemarkLoader.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1022472:1022473
@@ -46,7 +46,6 @@
#include "gps/GpxFileModel.h"
#include "gps/GpsLayer.h"
#include "gps/PositionTracking.h"
-#include "PlacemarkContainer.h"
#include "MarbleLocale.h"
#include "MarblePlacemarkModel.h"
#include "MarbleRunnerManager.h"
--- trunk/KDE/kdeedu/marble/src/lib/MarblePlacemarkModel.cpp #1022472:1022473
@@ -22,7 +22,6 @@
// Marble
#include "GeoDataStyle.h" // In geodata/data/
-#include "PlacemarkContainer.h"
using namespace Marble;
@@ -30,8 +29,7 @@
{
public:
- Private( MarblePlacemarkModel *parent )
- : m_parent( parent )
+ Private()
{
}
@@ -39,8 +37,7 @@
{
}
- MarblePlacemarkModel *m_parent;
- PlacemarkContainer m_placemarkContainer;
+ QVector<Marble::GeoDataPlacemark> m_placemarkContainer;
};
@@ -49,7 +46,7 @@
MarblePlacemarkModel::MarblePlacemarkModel( QObject *parent )
: QAbstractListModel( parent ),
- d( new Private( this ) )
+ d( new Private )
{
}
@@ -59,22 +56,7 @@
delete d;
}
-void MarblePlacemarkModel::sort( int column, Qt::SortOrder order )
-{
- Q_UNUSED( column )
- Q_UNUSED( order )
- QTime t;
- t.start();
- qDebug() << "start sorting";
-
- emit layoutAboutToBeChanged();
-// d->m_placemarkContainer.sort( order );
- emit layoutChanged();
-
- qDebug() << "MarblePlacemarkModel (sort): Time elapsed:" << t.elapsed() << "ms";
-}
-
int MarblePlacemarkModel::rowCount( const QModelIndex &parent ) const
{
if ( !parent.isValid() )
@@ -185,7 +167,7 @@
return results;
}
-void MarblePlacemarkModel::addPlacemarks( PlacemarkContainer &placemarks,
+void MarblePlacemarkModel::addPlacemarks( QVector<Marble::GeoDataPlacemark> &placemarks,
bool clearPrevious,
bool finalize )
{
@@ -228,9 +210,6 @@
d->m_placemarkContainer.erase(begin, end);
endRemoveRows();
-/* if ( finalize ) {
-// sort( Qt::DescendingOrder );
- }*/
// there have not been any additions, but without the following line marble seems to crash here.
emit dataChanged( index( 0, 0 ), index( 0, 0 ) );
qDebug() << "removePlacemarks(" << containerName << "): Time elapsed:" << t.elapsed() << "ms for" << length << "Placemarks.";
@@ -247,7 +226,7 @@
reset();
}
-void MarblePlacemarkModel::createFilterProperties( PlacemarkContainer &container )
+void MarblePlacemarkModel::createFilterProperties( QVector<Marble::GeoDataPlacemark> &container )
{
QVector<GeoDataPlacemark>::Iterator i;
--- trunk/KDE/kdeedu/marble/src/lib/MarblePlacemarkModel.h #1022472:1022473
@@ -25,12 +25,13 @@
#include "marble_export.h"
+#include "GeoDataPlacemark.h"
+
namespace Marble
{
class GeoDataCoordinates;
class GeoDataStyle;
-class PlacemarkContainer;
/**
* This class represents a model of all place marks which
* are currently available through a given PlacemarkManager.
@@ -100,7 +101,7 @@
*
* Note: The model takes ownership of the place marks!
*/
- void addPlacemarks( PlacemarkContainer &placemarks,
+ void addPlacemarks( QVector<Marble::GeoDataPlacemark> &placemarks,
bool clearPrevious = false,
bool finalize = true );
@@ -134,10 +135,8 @@
*/
void clearPlacemarks();
- virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder );
+ void createFilterProperties( QVector<Marble::GeoDataPlacemark> &container );
- void createFilterProperties( PlacemarkContainer &container );
-
Q_DISABLE_COPY( MarblePlacemarkModel )
class Private;
Private* const d;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.cpp #1022472:1022473
@@ -22,7 +22,6 @@
#include "MarblePlacemarkModel.h"
#include "PlacemarkManager.h"
-#include "PlacemarkContainer.h"
#include "GeoDataPlacemark.h"
#include "LatLonRunner.h"
@@ -41,7 +40,7 @@
: QObject(parent),
m_activeRunners(0),
m_lastString(""),
- m_model(new MarblePlacemarkModel(0))
+ m_model(new MarblePlacemarkModel)
{
qRegisterMetaType<QVector<GeoDataPlacemark> >("QVector<GeoDataPlacemark>");
}
@@ -95,22 +94,11 @@
if( result.isEmpty() )
return;
- PlacemarkContainer cont( result, "Runner Results" );
- m_model->addPlacemarks( cont, false );
+ m_model->addPlacemarks( result, false );
emit modelChanged( m_model );
}
-MarblePlacemarkModel* MarbleRunnerManager::model()
-{
- return m_model;
}
-void MarbleRunnerManager::setModel( MarblePlacemarkModel *model )
-{
- m_model = model;
-}
-
-}
-
#include "MarbleRunnerManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.h #1022472:1022473
@@ -40,8 +40,6 @@
explicit MarbleRunnerManager( QObject *parent = 0 );
~MarbleRunnerManager();
- void setModel(MarblePlacemarkModel *model);
- MarblePlacemarkModel* model();
public slots:
void newText(QString text);
signals:
--- trunk/KDE/kdeedu/marble/src/lib/PlacemarkLoader.cpp #1022472:1022473
@@ -23,7 +23,6 @@
#include "GeoDataPlacemark.h"
#include "MarbleDirs.h"
#include "MarblePlacemarkModel.h"
-#include "PlacemarkContainer.h"
namespace Marble
@@ -65,7 +64,7 @@
QString defaultsrcname;
QString defaulthomecache;
- m_container = new PlacemarkContainer( m_filepath );
+ m_container = new QVector<Marble::GeoDataPlacemark>;
if( m_filepath.endsWith(".kml") ) {
m_filepath.remove(QRegExp("\\.kml$"));
@@ -143,7 +142,7 @@
emit placemarkLoaderFailed( this );
}
} else {
- m_container = new PlacemarkContainer( m_filepath );
+ m_container = new QVector<Marble::GeoDataPlacemark>;
// Read the KML Data
importKmlFromData();
@@ -177,9 +176,6 @@
m_document = static_cast<GeoDataDocument*>( document );
m_document->setFileName( m_filepath );
- m_container = new PlacemarkContainer( m_document->placemarks(),
- m_filepath );
-
file.close();
qDebug() << "newGeoDataDocumentAdded" << m_filepath;
@@ -205,9 +201,6 @@
m_document = static_cast<GeoDataDocument*>( document );
m_document->setFileName( m_filepath );
- m_container = new PlacemarkContainer( m_document->placemarks(),
- m_filepath );
-
buffer.close();
qDebug() << "newGeoDataDocumentAdded" << m_filepath;
@@ -235,8 +228,8 @@
qreal lat;
qreal alt;
- PlacemarkContainer::const_iterator it = m_container->constBegin();
- PlacemarkContainer::const_iterator const end = m_container->constEnd();
+ QVector<Marble::GeoDataPlacemark>::const_iterator it = m_container->constBegin();
+ QVector<Marble::GeoDataPlacemark>::const_iterator const end = m_container->constEnd();
for (; it != end; ++it )
{
out << (*it).name();
--- trunk/KDE/kdeedu/marble/src/lib/PlacemarkLoader.h #1022472:1022473
@@ -13,9 +13,10 @@
#include <QtCore/QString>
#include <QtCore/QThread>
+#include "GeoDataPlacemark.h"
+
namespace Marble
{
-class PlacemarkContainer;
class GeoDataDocument;
class PlacemarkLoader : public QThread
@@ -30,7 +31,7 @@
QString path() const;
Q_SIGNALS:
- void placemarksLoaded( PlacemarkLoader*, PlacemarkContainer * );
+ void placemarksLoaded( PlacemarkLoader*, QVector<Marble::GeoDataPlacemark> * );
void placemarkLoaderFailed( PlacemarkLoader* );
void newGeoDataDocumentAdded( GeoDataDocument* );
private:
@@ -42,7 +43,7 @@
QString m_filepath;
QString m_contents;
GeoDataDocument *m_document;
- PlacemarkContainer *m_container;
+ QVector<Marble::GeoDataPlacemark> *m_container;
};
} // namespace Marble
--- trunk/KDE/kdeedu/marble/src/lib/PlacemarkManager.cpp #1022472:1022473
@@ -25,7 +25,6 @@
#include "MarblePlacemarkModel.h"
#include "MarbleGeometryModel.h"
#include "MarbleDataFacade.h"
-#include "PlacemarkContainer.h"
#include "PlacemarkLoader.h"
#include "GeoDataDocument.h"
@@ -56,7 +55,6 @@
: QObject( parent )
, d( new PlacemarkManagerPrivate() )
{
-
}
@@ -218,9 +216,9 @@
}
}
-void PlacemarkManager::loadPlacemarkContainer( PlacemarkLoader* loader, PlacemarkContainer * container )
+void PlacemarkManager::loadPlacemarkContainer( PlacemarkLoader* loader, QVector<Marble::GeoDataPlacemark> * container )
{
- qDebug() << "Containername:" << container->name() << "to be finalized:" << (d->m_loaderList.size() == 1) << d->m_loaderList.size();
+ qDebug() << "Containername " << "to be finalized:" << (d->m_loaderList.size() == 1) << d->m_loaderList.size();
d->m_loaderList.removeAll( loader );
if ( container )
{
--- trunk/KDE/kdeedu/marble/src/lib/PlacemarkManager.h #1022472:1022473
@@ -19,11 +19,12 @@
#include "PlacemarkLoader.h"
+#include "GeoDataPlacemark.h"
+
namespace Marble
{
class GeoDataDocument;
-class PlacemarkContainer;
class MarblePlacemarkModel;
class MarbleDataFacade;
class PlacemarkManagerPrivate;
@@ -103,7 +104,7 @@
void fileRemoved( int index );
private Q_SLOTS:
- void loadPlacemarkContainer( PlacemarkLoader* loader, PlacemarkContainer * );
+ void loadPlacemarkContainer( PlacemarkLoader* loader, QVector<Marble::GeoDataPlacemark> * );
void cleanupLoader( PlacemarkLoader* loader );
void addGeoDataDocument( GeoDataDocument* );
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer.h #1022472:1022473
@@ -78,7 +78,6 @@
* @return A QVector of GeoDataPlacemark
*
* @see GeoDataPlacemark
- * @see PlacemarkContainer
*/
QVector<GeoDataPlacemark> placemarks() const;
More information about the Marble-commits
mailing list