marble
AlternativeRoutesModel.cpp
Go to the documentation of this file.
70 static qreal distance( const GeoDataCoordinates &satellite, const GeoDataCoordinates &lineA, const GeoDataCoordinates &lineB );
75 static GeoDataCoordinates coordinates( const GeoDataCoordinates &start, qreal distance, qreal bearing );
81 static qreal unidirectionalSimilarity( const GeoDataDocument* routeA, const GeoDataDocument* routeB );
97 static QPolygonF polygon( const GeoDataLineString* lineString, qreal x, qreal y, qreal sx, qreal sy );
120 QPolygonF AlternativeRoutesModelPrivate::polygon( const GeoDataLineString* lineString, qreal x, qreal y, qreal sx, qreal sy )
142 qreal AlternativeRoutesModelPrivate::similarity( const GeoDataDocument* routeA, const GeoDataDocument* routeB )
148 qreal AlternativeRoutesModelPrivate::distance( const GeoDataLineString* wayPoints, const GeoDataCoordinates &position )
162 qreal AlternativeRoutesModelPrivate::bearing( const GeoDataCoordinates &one, const GeoDataCoordinates &two )
171 GeoDataCoordinates AlternativeRoutesModelPrivate::coordinates( const GeoDataCoordinates &start, qreal distance, qreal bearing )
175 qreal lat2 = asin( sin( lat1 ) * cos( distance ) + cos( lat1 ) * sin( distance ) * cos( bearing ) );
176 qreal lon2 = lon1 + atan2( sin( bearing ) * sin( distance ) * cos( lat1 ), cos( distance ) - sin( lat1 ) * sin( lat2 ) );
180 qreal AlternativeRoutesModelPrivate::distance( const GeoDataCoordinates &satellite, const GeoDataCoordinates &lineA, const GeoDataCoordinates &lineB )
186 Q_ASSERT( qMax<qreal>( distanceSphere(satellite, lineA), distanceSphere(satellite, lineB) ) >= qAbs<qreal>(result) );
190 qreal final = qMin<qreal>( distanceSphere( satellite, lineA ), distanceSphere( satellite, lineB ) );
199 qreal AlternativeRoutesModelPrivate::unidirectionalSimilarity( const GeoDataDocument* routeA, const GeoDataDocument* routeB )
222 painter.drawPoints( AlternativeRoutesModelPrivate::polygon( waypointsA, box.west(), box.north(), sw, sh ) );
225 painter.drawPoints( AlternativeRoutesModelPrivate::polygon( waypointsB, box.west(), box.north(), sw, sh ) );
231 bool AlternativeRoutesModelPrivate::higherScore( const GeoDataDocument* one, const GeoDataDocument* two )
273 const GeoDataLineString* AlternativeRoutesModelPrivate::waypoints( const GeoDataDocument* document )
323 if ( role == Qt::DisplayRole && index.column() == 0 && index.row() >= 0 && index.row() < d->m_routes.size() ) {
349 qSort( d->m_restrainedRoutes.begin(), d->m_restrainedRoutes.end(), AlternativeRoutesModelPrivate::higherScore );
407 qreal AlternativeRoutesModel::distance( const GeoDataCoordinates &satellite, const GeoDataCoordinates &lineA, const GeoDataCoordinates &lineB )
412 QVector<qreal> AlternativeRoutesModel::deviation( const GeoDataDocument* routeA, const GeoDataDocument* routeB )
uchar * scanLine(int i)
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:65
void clear()
Remove all alternative routes from the model.
Definition: AlternativeRoutesModel.cpp:456
int rowCount(const QModelIndex &parent=QModelIndex()) const
Overload of QAbstractListModel.
Definition: AlternativeRoutesModel.cpp:309
void currentRouteChanged(GeoDataDocument *newRoute)
void addRoute(GeoDataDocument *document, WritePolicy policy=Lazy)
Old data in the model is discarded, the parsed content of the provided document is used as the new mo...
Definition: AlternativeRoutesModel.cpp:366
void newRequest(RouteRequest *request)
Invalidate the current alternative routes and prepare for new ones to arrive.
Definition: AlternativeRoutesModel.cpp:339
bool contains(const QString &str, Qt::CaseSensitivity cs) const
static const GeoDataLineString * waypoints(const GeoDataDocument *document)
Returns the waypoints contained in the route as a linestring.
Definition: AlternativeRoutesModel.cpp:432
qreal distanceSphere(qreal lon1, qreal lat1, qreal lon2, qreal lat2)
This method calculates the shortest distance between two points on a sphere.
Definition: MarbleMath.h:52
GeoDataDocument * currentRoute()
Definition: AlternativeRoutesModel.cpp:446
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Overload of QAbstractListModel.
Definition: AlternativeRoutesModel.cpp:319
void beginResetModel()
const char * name() const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void fill(uint pixelValue)
void endInsertRows()
int width() const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Overload of QAbstractListModel.
Definition: AlternativeRoutesModel.cpp:314
int row() const
void setCurrentRoute(int index)
Definition: AlternativeRoutesModel.cpp:437
A LineString that allows to store a contiguous set of line segments.
Definition: GeoDataLineString.h:75
GeoDataCoordinates & at(int pos)
Returns a reference to the coordinates of a node at a given position. This method detaches the return...
Definition: GeoDataLineString.cpp:143
static qreal distance(const GeoDataCoordinates &satellite, const GeoDataCoordinates &lineA, const GeoDataCoordinates &lineB)
Returns the distance between the given point and the given great circle path.
Definition: AlternativeRoutesModel.cpp:407
void beginInsertRows(const QModelIndex &parent, int first, int last)
static QVector< qreal > deviation(const GeoDataDocument *routeA, const GeoDataDocument *routeB)
Returns the minimal distance of each waypoint of routeA to routeB.
Definition: AlternativeRoutesModel.cpp:412
int column() const
void push_back(const T &value)
int height() const
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
GeoDataDocument * route(int index)
Definition: AlternativeRoutesModel.cpp:330
void endResetModel()
singleShot
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.