[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Fri Jul 16 23:10:13 CEST 2010
SVN commit 1150818 by tgridel:
GeoDataTreeModel, a model that works(TM)
M +1 -0 CMakeLists.txt
M +2 -0 FileManager.cpp
A GeoDataTreeModel.cpp [License: LGPL]
A GeoDataTreeModel.h [License: LGPL]
M +10 -1 MarbleDataFacade.cpp
M +5 -0 MarbleDataFacade.h
M +9 -0 geodata/data/GeoDataContainer.cpp
M +1 -0 geodata/data/GeoDataContainer.h
M +1 -6 geodata/data/GeoDataContainer_p.h
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1150817:1150818
@@ -77,6 +77,7 @@
MarblePlacemarkModel.cpp
MarbleGeoDataModel.cpp
MarbleGeometryModel.cpp
+ GeoDataTreeModel.cpp
MarbleDataFacade.cpp
MarbleDebug.cpp
TextureTile.cpp
--- trunk/KDE/kdeedu/marble/src/lib/FileManager.cpp #1150817:1150818
@@ -20,6 +20,7 @@
#include "MarbleDebug.h"
#include "MarbleDataFacade.h"
#include "MarbleGeometryModel.h"
+#include "GeoDataTreeModel.h"
#include "GeoDataDocument.h"
@@ -69,6 +70,7 @@
{
d->m_datafacade = facade;
d->m_datafacade->fileViewModel()->setFileManager( this );
+ d->m_datafacade->treeModel()->setFileManager( this );
}
MarbleDataFacade *FileManager::dataFacade()
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDataFacade.cpp #1150817:1150818
@@ -28,6 +28,7 @@
#include "FileViewModel.h"
#include "PluginManager.h"
+#include "GeoDataTreeModel.h"
#include "GeoDataParser.h"
#include "GeoSceneDocument.h"
@@ -44,7 +45,8 @@
m_fileviewmodel( new FileViewModel() ),
m_geodatamodel( new MarbleGeoDataModel() ),
m_geometrymodel( new MarbleGeometryModel() ),
- m_placemarkmodel( new MarblePlacemarkModel )
+ m_placemarkmodel( new MarblePlacemarkModel ),
+ m_treemodel( new GeoDataTreeModel)
{
}
@@ -54,6 +56,7 @@
delete m_geodatamodel;
delete m_geometrymodel;
delete m_placemarkmodel;
+ delete m_treemodel;
}
MarbleModel *m_model;
@@ -61,6 +64,7 @@
MarbleGeoDataModel *m_geodatamodel;
MarbleGeometryModel *m_geometrymodel;
MarblePlacemarkModel *m_placemarkmodel;
+ GeoDataTreeModel *m_treemodel;
};
@@ -130,5 +134,10 @@
return d->m_model->pluginManager();
}
+GeoDataTreeModel* MarbleDataFacade::treeModel() const
+{
+ return d->m_treemodel;
}
+}
+
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDataFacade.h #1150817:1150818
@@ -40,6 +40,7 @@
class MarbleGeoDataModel;
class MarbleGeometryModel;
class MarblePlacemarkModel;
+class GeoDataTreeModel;
class FileViewModel;
class MarbleDataFacadePrivate;
class Planet;
@@ -84,9 +85,13 @@
MarbleGeometryModel* geometryModel();
MarblePlacemarkModel* placemarkModel();
+
FileViewModel* fileViewModel() const;
+
PluginManager* pluginManager();
+ GeoDataTreeModel* treeModel() const;
+
private:
MarbleDataFacadePrivate * const d;
};
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer.cpp #1150817:1150818
@@ -142,6 +142,7 @@
void GeoDataContainer::append( GeoDataFeature *other )
{
detach();
+ other->setParent(this);
p()->m_vector.append( other );
}
@@ -150,9 +151,16 @@
{
detach();
GeoDataFeature *f = new GeoDataFeature(other);
+ f->setParent(this);
p()->m_vector.append( f );
}
+void GeoDataContainer::remove( int index )
+{
+ detach();
+ p()->m_vector.remove( index );
+}
+
int GeoDataContainer::size() const
{
return p()->m_vector.size();
@@ -194,6 +202,7 @@
void GeoDataContainer::clear()
{
GeoDataContainer::detach();
+ qDeleteAll(p()->m_vector);
p()->m_vector.clear();
}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer.h #1150817:1150818
@@ -97,6 +97,7 @@
*/
void append( GeoDataFeature *other );
+ void remove( int index );
/**
* @brief add an element
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer_p.h #1150817:1150818
@@ -27,13 +27,8 @@
~GeoDataContainerPrivate()
{
- QVector<GeoDataFeature*>::Iterator i = m_vector.begin();
- QVector<GeoDataFeature*>::Iterator end = m_vector.end();
- for( ; i != end; ++i )
- {
- delete *i;
+ qDeleteAll(m_vector);
}
- }
virtual void* copy()
{
More information about the Marble-commits
mailing list