[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Sat Jul 17 00:35:27 CEST 2010
SVN commit 1150831 by tgridel:
GeoDataContainer: use placemarkList and drop vector of data
M +18 -18 FileLoader.cpp
M +4 -4 geodata/GeoDataTest.cpp
M +0 -17 geodata/data/GeoDataContainer.cpp
M +0 -1 geodata/data/GeoDataContainer.h
M +2 -2 routing/RoutingModel.cpp
--- trunk/KDE/kdeedu/marble/src/lib/FileLoader.cpp #1150830:1150831
@@ -239,21 +239,21 @@
qint64 tmpint64;
while ( !in.atEnd() ) {
- GeoDataPlacemark mark;
+ GeoDataPlacemark *mark = new GeoDataPlacemark;
in >> tmpstr;
- mark.setName( tmpstr );
+ mark->setName( tmpstr );
in >> lon >> lat >> alt;
- mark.setCoordinate( (qreal)(lon), (qreal)(lat), (qreal)(alt) );
+ mark->setCoordinate( (qreal)(lon), (qreal)(lat), (qreal)(alt) );
in >> tmpstr;
- mark.setRole( tmpstr );
+ mark->setRole( tmpstr );
in >> tmpstr;
- mark.setDescription( tmpstr );
+ mark->setDescription( tmpstr );
in >> tmpstr;
- mark.setCountryCode( tmpstr );
+ mark->setCountryCode( tmpstr );
in >> area;
- mark.setArea( (qreal)(area) );
+ mark->setArea( (qreal)(area) );
in >> tmpint64;
- mark.setPopulation( tmpint64 );
+ mark->setPopulation( tmpint64 );
m_document->append( mark );
}
@@ -291,20 +291,20 @@
qreal lat;
qreal alt;
- const QVector<GeoDataPlacemark> placemarks = container->placemarks();
- QVector<GeoDataPlacemark>::const_iterator it = placemarks.constBegin();
- QVector<GeoDataPlacemark>::const_iterator const end = placemarks.constEnd();
+ const QVector<GeoDataPlacemark*> placemarks = container->placemarkList();
+ QVector<GeoDataPlacemark*>::const_iterator it = placemarks.constBegin();
+ QVector<GeoDataPlacemark*>::const_iterator const end = placemarks.constEnd();
for (; it != end; ++it ) {
- out << it->name();
- it->coordinate( lon, lat, alt );
+ out << (*it)->name();
+ (*it)->coordinate( lon, lat, alt );
// Use double to provide a single cache file format across architectures
out << (double)(lon) << (double)(lat) << (double)(alt);
- out << QString( it->role() );
- out << QString( it->description() );
- out << QString( it->countryCode() );
- out << (double) it->area();
- out << (qint64) it->population();
+ out << QString( (*it)->role() );
+ out << QString( (*it)->description() );
+ out << QString( (*it)->countryCode() );
+ out << (double) (*it)->area();
+ out << (qint64) (*it)->population();
}
const QVector<GeoDataFolder> folders = container->folders();
--- trunk/KDE/kdeedu/marble/src/lib/geodata/GeoDataTest.cpp #1150830:1150831
@@ -188,7 +188,7 @@
return result;
}
-void dumpGeoDataPlacemark(const GeoDataPlacemark& placemark)
+void dumpGeoDataPlacemark(const GeoDataPlacemark *placemark)
{
Q_UNUSED(placemark);
// qDebug() << placemark.name() << placemark.population() << placemark.coordinate().toString();
@@ -199,7 +199,7 @@
qDebug() << "dumping container with" << container.size() << "children...";
QVector<GeoDataFolder> folders = container.folders();
- QVector<GeoDataPlacemark> placemarks = container.placemarks();
+ QVector<GeoDataPlacemark*> placemarks = container.placemarkList();
QString format = formatOutput(depth);
qDebug() << qPrintable(format + QString("Dumping container with %1 child folders!\n").arg(folders.size()));
@@ -214,8 +214,8 @@
qDebug() << qPrintable(format + QString("Dumping container with %1 child placemarks!\n").arg(placemarks.size()));
- QVector<GeoDataPlacemark>::const_iterator pit = placemarks.constBegin();
- const QVector<GeoDataPlacemark>::const_iterator pend = placemarks.constEnd();
+ QVector<GeoDataPlacemark*>::const_iterator pit = placemarks.constBegin();
+ const QVector<GeoDataPlacemark*>::const_iterator pend = placemarks.constEnd();
for (; pit != pend; ++pit) {
qDebug() << qPrintable(format + QString("Dumping child %1\n").arg(pit - placemarks.constBegin() + 1));
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer.cpp #1150830:1150831
@@ -94,23 +94,6 @@
return results;
}
-QVector<GeoDataPlacemark> GeoDataContainer::placemarks() const
-{
- QVector<GeoDataPlacemark> results;
-
- QVector<GeoDataFeature*>::const_iterator it = p()->m_vector.constBegin();
- QVector<GeoDataFeature*>::const_iterator end = p()->m_vector.constEnd();
-
- for (; it != end; ++it) {
- if ( GeoDataPlacemarkId == (*it)->featureId() ) {
- GeoDataPlacemark placemark = **it;
- results.append( placemark );
- }
- }
-
- return results;
-}
-
QVector<GeoDataFeature*> GeoDataContainer::featureList() const
{
return p()->m_vector;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/data/GeoDataContainer.h #1150830:1150831
@@ -81,7 +81,6 @@
* @see GeoDataPlacemark
*/
QVector<GeoDataPlacemark*> placemarkList() const;
- QVector<GeoDataPlacemark> placemarks() const;
/**
* @brief returns the requested child item
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.cpp #1150830:1150831
@@ -276,8 +276,8 @@
QVector<GeoDataFolder> folders = document->folders();
foreach( const GeoDataFolder &folder, folders ) {
- foreach( const GeoDataPlacemark &placemark, folder.placemarks() ) {
- GeoDataGeometry* geometry = placemark.geometry();
+ foreach( const GeoDataPlacemark *placemark, folder.placemarkList() ) {
+ GeoDataGeometry* geometry = placemark->geometry();
if ( geometry->geometryId() == GeoDataLineStringId ) {
GeoDataLineString* lineString = dynamic_cast<GeoDataLineString*>( geometry );
Q_ASSERT( lineString && "Internal error: geometry ID does not match class type" );
More information about the Marble-commits
mailing list