[Marble-commits] KDE/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Sat Sep 4 23:44:57 CEST 2010
SVN commit 1171699 by nienhueser:
change geodatacoordinates to geodataplacemark as underlying storage to be able to set/query via point names
M +35 -10 RouteRequest.cpp
M +4 -0 RouteRequest.h
M +1 -0 RoutingInputWidget.cpp
--- trunk/KDE/kdeedu/marble/src/lib/routing/RouteRequest.cpp #1171698:1171699
@@ -11,6 +11,7 @@
#include "RouteRequest.h"
#include "GeoDataLineString.h"
+#include "GeoDataPlacemark.h"
#include "MarbleDirs.h"
#include <QtCore/QMap>
@@ -22,7 +23,7 @@
class RouteRequestPrivate
{
public:
- QVector<GeoDataCoordinates> m_route;
+ QVector<GeoDataPlacemark> m_route;
QMap<int, QPixmap> m_pixmapCache;
@@ -72,8 +73,8 @@
viaFirst.append( position );
}
- viaFirst.append( m_route[i] );
- viaSecond.append( m_route[i] );
+ viaFirst.append( m_route[i].coordinate() );
+ viaSecond.append( m_route[i].coordinate() );
if ( viaSecond.size() == 2 ) {
viaSecond.append( position );
@@ -121,7 +122,7 @@
{
GeoDataCoordinates result;
if ( d->m_route.size() ) {
- result = d->m_route.first();
+ result = d->m_route.first().coordinate();
}
return result;
}
@@ -130,14 +131,14 @@
{
GeoDataCoordinates result;
if ( d->m_route.size() ) {
- result = d->m_route.last();
+ result = d->m_route.last().coordinate();
}
return result;
}
GeoDataCoordinates RouteRequest::at( int position ) const
{
- return d->m_route.at( position );
+ return d->m_route.at( position ).coordinate();
}
QPixmap RouteRequest::pixmap( int position ) const
@@ -194,13 +195,17 @@
void RouteRequest::insert( int index, const GeoDataCoordinates &coordinates )
{
- d->m_route.insert( index, coordinates );
+ GeoDataPlacemark placemark;
+ placemark.setCoordinate( GeoDataPoint( coordinates ) );
+ d->m_route.insert( index, placemark );
emit positionAdded( index );
}
void RouteRequest::append( const GeoDataCoordinates &coordinates )
{
- d->m_route.append( coordinates );
+ GeoDataPlacemark placemark;
+ placemark.setCoordinate( GeoDataPoint( coordinates ) );
+ d->m_route.append( placemark );
}
void RouteRequest::remove( int index )
@@ -214,14 +219,18 @@
void RouteRequest::addVia( const GeoDataCoordinates &position )
{
int index = d->viaIndex( position );
- d->m_route.insert( index, position );
+ GeoDataPlacemark placemark;
+ placemark.setCoordinate( GeoDataPoint( position ) );
+ d->m_route.insert( index, placemark );
emit positionAdded( index );
}
void RouteRequest::setPosition( int index, const GeoDataCoordinates &position )
{
if ( index >= 0 && index < d->m_route.size() ) {
- d->m_route[index] = position;
+ GeoDataPlacemark placemark;
+ placemark.setCoordinate( GeoDataPoint( position ) );
+ d->m_route[index] = placemark;
emit positionChanged( index, position );
}
}
@@ -246,6 +255,22 @@
return d->m_routePreference;
}
+void RouteRequest::setName( int index, const QString &name )
+{
+ if ( index >= 0 && index < d->m_route.size() ) {
+ d->m_route[index].setName( name );
+ }
+}
+
+QString RouteRequest::name( int index ) const
+{
+ QString result;
+ if ( index >= 0 && index < d->m_route.size() ) {
+ result = d->m_route[index].name();
+ }
+ return result;
+}
+
} // namespace Marble
#include "RouteRequest.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RouteRequest.h #1171698:1171699
@@ -102,6 +102,10 @@
RoutePreference routePreference() const;
+ void setName( int index, const QString &name );
+
+ QString name( int index ) const;
+
Q_SIGNALS:
/** The value of the n-th element was changed */
void positionChanged( int index, const GeoDataCoordinates &position );
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.cpp #1171698:1171699
@@ -310,6 +310,7 @@
void RoutingInputWidget::retrieveReverseGeocodingResult( const GeoDataCoordinates &, const GeoDataPlacemark &placemark )
{
+ d->m_route->setName( d->m_index, placemark.address() );
d->m_lineEdit->setText( placemark.address() );
d->m_lineEdit->setCursorPosition( 0 );
}
More information about the Marble-commits
mailing list