mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 03:42:09 +01:00
Fixed route marker display issues.
Code cleanup.
This commit is contained in:
parent
1634b0715c
commit
473b92e8f7
@ -83,7 +83,7 @@ void AxisItem::updateBoundingRect()
|
|||||||
if (_type == X) {
|
if (_type == X) {
|
||||||
_boundingRect = QRectF(-ss.width()/2, -TICK/2,
|
_boundingRect = QRectF(-ss.width()/2, -TICK/2,
|
||||||
_size + es.width()/2 + ss.width()/2,
|
_size + es.width()/2 + ss.width()/2,
|
||||||
ls.height() + es.height() - fm.descent() + TICK + 2*PADDING);
|
ls.height() + es.height() - fm.descent() + TICK + 2*PADDING + 1);
|
||||||
} else {
|
} else {
|
||||||
int mtw = 0;
|
int mtw = 0;
|
||||||
QRect ts;
|
QRect ts;
|
||||||
|
@ -41,15 +41,15 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
|||||||
QVector<Waypoint> r = route.route();
|
QVector<Waypoint> r = route.route();
|
||||||
Q_ASSERT(r.count() >= 2);
|
Q_ASSERT(r.count() >= 2);
|
||||||
|
|
||||||
wi = new WaypointItem(r.at(0));
|
wi = new WaypointItem(r.at(0), this);
|
||||||
wi->setParentItem(this);
|
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
|
||||||
const QPointF &p = r.at(0).coordinates();
|
const QPointF &p = r.at(0).coordinates();
|
||||||
_path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
|
_path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
|
||||||
for (int i = 1; i < r.size(); i++) {
|
for (int i = 1; i < r.size(); i++) {
|
||||||
const QPointF &p = r.at(i).coordinates();
|
const QPointF &p = r.at(i).coordinates();
|
||||||
_path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
|
_path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
|
||||||
wi = new WaypointItem(r.at(i));
|
wi = new WaypointItem(r.at(i), this);
|
||||||
wi->setParentItem(this);
|
wi->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
@ -66,6 +66,7 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
|||||||
|
|
||||||
_marker = new MarkerItem(this);
|
_marker = new MarkerItem(this);
|
||||||
_marker->setPos(_path.pointAtPercent(0));
|
_marker->setPos(_path.pointAtPercent(0));
|
||||||
|
_marker->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -91,10 +92,6 @@ void RouteItem::setScale(qreal scale)
|
|||||||
_pen.setWidthF(ROUTE_WIDTH * 1.0/scale);
|
_pen.setWidthF(ROUTE_WIDTH * 1.0/scale);
|
||||||
QGraphicsItem::setScale(scale);
|
QGraphicsItem::setScale(scale);
|
||||||
|
|
||||||
QList<QGraphicsItem *> childs = childItems();
|
|
||||||
for (int i = 0; i < childs.count(); i++)
|
|
||||||
childs.at(i)->setScale(1.0/scale);
|
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
|||||||
|
|
||||||
_marker = new MarkerItem(this);
|
_marker = new MarkerItem(this);
|
||||||
_marker->setPos(_path.pointAtPercent(0));
|
_marker->setPos(_path.pointAtPercent(0));
|
||||||
|
_marker->setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -90,7 +91,6 @@ void TrackItem::setScale(qreal scale)
|
|||||||
|
|
||||||
_pen.setWidthF(TRACK_WIDTH * 1.0/scale);
|
_pen.setWidthF(TRACK_WIDTH * 1.0/scale);
|
||||||
QGraphicsItem::setScale(scale);
|
QGraphicsItem::setScale(scale);
|
||||||
_marker->setScale(1.0/scale);
|
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user