8#include "BillboardGraphicsItem.h"
9#include "MarbleGraphicsItem_p.h"
17class BillboardGraphicsItemPrivate :
public MarbleGraphicsItemPrivate
20 BillboardGraphicsItemPrivate(BillboardGraphicsItem *parent)
21 : MarbleGraphicsItemPrivate(parent)
38 void setProjection(
const ViewportParams *viewport)
override
43 int pointRepeatNumber = 0;
46 viewport->screenCoordinates(m_coordinates, x, y, pointRepeatNumber, m_size, globeHidesPoint);
52 m_positions.
reserve(pointRepeatNumber);
54 qint32 topY = (viewport->height() - m_size.height()) / 2;
56 topY = y - m_size.height();
58 topY = y - (m_size.height() / 2);
63 for (
int i = 0; i < pointRepeatNumber; ++i) {
65 qint32 leftX = (viewport->width() - m_size.width()) / 2;
67 leftX = x[i] - m_size.width();
69 leftX = x[i] - (m_size.width() / 2);
78 GeoDataCoordinates m_coordinates;
82BillboardGraphicsItem::BillboardGraphicsItem()
83 : MarbleGraphicsItem(new BillboardGraphicsItemPrivate(this))
87GeoDataCoordinates BillboardGraphicsItem::coordinate()
const
89 Q_D(
const BillboardGraphicsItem);
90 return d->m_coordinates;
93void BillboardGraphicsItem::setCoordinate(
const GeoDataCoordinates &coordinates)
95 Q_D(BillboardGraphicsItem);
96 d->m_coordinates = coordinates;
102 return d->positions();
110 rects.
reserve(d->m_positions.size());
112 QSizeF const size = d->m_size;
113 for (
const QPointF &point : d->m_positions) {
114 rects <<
QRectF(point, size);
121 for (
const QRectF &rect : boundingRects()) {
122 if (rect.contains(point))
132 return d->m_alignment;
135void BillboardGraphicsItem::setAlignment(
Qt::Alignment alignment)
137 Q_D(BillboardGraphicsItem);
138 d->m_alignment = alignment;
This file contains the headers for ViewportParams.
Base class for all 2D labels (a.k.a.
Binds a QML item to a specific geodetic location in screen coordinates.
void append(QList< T > &&value)
void reserve(qsizetype size)