Commit 071d749c authored by Sanjiban Bairagya's avatar Sanjiban Bairagya Committed by Sanjiban Bairagya

Use QML-based current-position pointer in place of

the older QImage based one
parent c6c2ad73
......@@ -91,7 +91,7 @@ ApplicationWindow {
showScaleBar: false
showBackground: false
positionProvider: suspended ? "" : "QtPositioning"
showPositionMarker: true
showPositionMarker: false
onPositionAvailableChanged: {
updateIndicator();
......@@ -300,6 +300,7 @@ ApplicationWindow {
posY: navigationManager.visible ? navigationManager.snappedPositionMarkerScreenPosition.y : 0
angle: marbleMaps.angle
visible: navigationManager.visible
radius: navigationManager.screenAccuracy
}
}
}
......
......@@ -22,6 +22,7 @@ Item {
property var tts: null
property var snappedPositionMarkerScreenPosition: null
property bool guidanceMode: false
property double screenAccuracy: 0
onGuidanceModeChanged: {
if (guidanceMode && marbleItem) {
......@@ -150,6 +151,7 @@ Item {
{
if (navigation.marbleQuickItem) {
root.snappedPositionMarkerScreenPosition = navigation.positionOnRoute();
root.screenAccuracy = navigation.screenAccuracy();
}
else
{
......
......@@ -17,24 +17,36 @@ Item {
property alias angle: rotation.angle
property int posX: 0
property int posY: 0
property int radius: 0
width: 100
height: 100
x: posX - width * 0.5
y: posY - height * 0.5
Image {
id: image
source: "qrc:///navigation_blue.png"
width: 100
height: 100
anchors.centerIn: parent
transform: Rotation {
id: rotation
origin {
x: image.width * 0.5
y: image.height * 0.5
}
}
Rectangle {
width: root.radius
height: root.radius
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
color: "#40ff0000"
border.color: "#ff0000"
border.width: 2
radius: width*0.5
Image {
id: image
source: "qrc:///navigation_blue.png"
width: 30
height: 30
anchors.centerIn: parent
transform: Rotation {
id: rotation
origin {
x: image.width * 0.5
y: image.height * 0.5
}
}
}
}
}
......@@ -43,6 +43,8 @@ public:
qreal m_destinationDistance;
double m_screenAccuracy;
Marble::RouteSegment nextRouteSegment();
void updateNextInstructionDistance( const Marble::Route &route );
......@@ -52,7 +54,7 @@ public:
NavigationPrivate::NavigationPrivate() :
m_marbleWidget( nullptr ), m_marbleQuickItem( nullptr ), m_muted( false ), m_autoNavigation( 0 ), m_nextInstructionDistance( 0.0 ),
m_destinationDistance( 0.0 )
m_destinationDistance( 0.0 ), m_screenAccuracy(0)
{
// nothing to do
}
......@@ -284,6 +286,15 @@ QPointF Navigation::positionOnRoute() const
return QPointF(x,y);
}
double Navigation::screenAccuracy() const
{
double distanceMeter = d->model()->positionTracking()->accuracy().horizontal;
if(d->m_marbleQuickItem == 0){
return 0;
}
return distanceMeter * d->m_marbleQuickItem->map()->radius() / d->model()->planetRadius();
}
void Navigation::setMarbleQuickItem(Marble::MarbleQuickItem *marbleQuickItem)
{
if ( d->m_marbleQuickItem == marbleQuickItem) {
......
......@@ -85,6 +85,8 @@ public:
Q_INVOKABLE QPointF positionOnRoute() const;
Q_INVOKABLE double screenAccuracy() const;
public Q_SLOTS:
void setMarbleQuickItem(Marble::MarbleQuickItem * marbleQuickItem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment