Marble
GeoPainter.cpp
30GeoPainterPrivate::GeoPainterPrivate(GeoPainter *q, const ViewportParams *viewport, MapQuality mapQuality)
125GeoDataLinearRing GeoPainterPrivate::createLinearRingFromGeoRect(const GeoDataCoordinates ¢erCoordinates, qreal width, qreal height)
178void GeoPainterPrivate::drawTextRotated(const QPointF &startPoint, qreal angle, const QString &text)
190// -------------------------------------------------------------------------------------------------
229 bool visible = d->m_viewport->screenCoordinates(position, d->m_x, y, pointRepeatNum, QSizeF(), globeHidesPoint);
249 bool visible = d->m_viewport->screenCoordinates(position, d->m_x, y, pointRepeatNum, QSizeF(), globeHidesPoint);
310void GeoPainter::drawEllipse(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, bool isGeoProjected)
317 bool visible = d->m_viewport->screenCoordinates(centerPosition, d->m_x, y, pointRepeatNum, QSizeF(width, height), globeHidesPoint);
374QRegion GeoPainter::regionFromEllipse(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, bool isGeoProjected, qreal strokeWidth) const
381 bool visible = d->m_viewport->screenCoordinates(centerPosition, d->m_x, y, pointRepeatNum, QSizeF(width, height), globeHidesPoint);
390 const int startY = antialiased ? (qFloor(y - halfStrokeWidth)) : (qFloor(y + 0.5 - halfStrokeWidth));
391 const int endY = antialiased ? (qCeil(y + height + halfStrokeWidth)) : (qFloor(y + 0.5 + height + halfStrokeWidth));
395 const int startX = antialiased ? (qFloor(x - halfStrokeWidth)) : (qFloor(x + 0.5 - halfStrokeWidth));
396 const int endX = antialiased ? (qCeil(x + width + halfStrokeWidth)) : (qFloor(x + 0.5 + width + halfStrokeWidth));
449void GeoPainter::drawImage(const GeoDataCoordinates ¢erPosition, const QImage &image /*, bool isGeoProjected */)
460 bool visible = d->m_viewport->screenCoordinates(centerPosition, d->m_x, y, pointRepeatNum, image.size(), globeHidesPoint);
473void GeoPainter::drawPixmap(const GeoDataCoordinates ¢erPosition, const QPixmap &pixmap /* , bool isGeoProjected */)
481 bool visible = d->m_viewport->screenCoordinates(centerPosition, d->m_x, y, pointRepeatNum, pixmap.size(), globeHidesPoint);
494QRegion GeoPainter::regionFromPixmapRect(const GeoDataCoordinates ¢erCoordinates, int width, int height, int margin) const
502 const bool visible = d->m_viewport->screenCoordinates(centerCoordinates, d->m_x, y, pointRepeatNum, QSizeF(fullWidth, fullHeight), globeHidesPoint);
519void GeoPainter::polygonsFromLineString(const GeoDataLineString &lineString, QList<QPolygonF *> &polygons) const
524 if (!d->m_viewport->viewLatLonAltBox().intersects(lineString.latLonAltBox()) || !d->m_viewport->resolves(lineString.latLonAltBox())) {
532void GeoPainter::drawPolyline(const GeoDataLineString &lineString, const QString &labelText, LabelPositionFlags labelPositionFlags, const QColor &labelColor)
537 if (labelText.isEmpty() || labelPositionFlags.testFlag(NoLabel) || labelColor == Qt::transparent) {
693QRegion GeoPainter::regionFromPolyline(const GeoDataLineString &lineString, qreal strokeWidth) const
698 if (!d->m_viewport->viewLatLonAltBox().intersects(lineString.latLonAltBox()) || !d->m_viewport->resolves(lineString.latLonAltBox())) {
726 if (!d->m_viewport->viewLatLonAltBox().intersects(linearRing.latLonAltBox()) || !d->m_viewport->resolves(linearRing.latLonAltBox())) {
741QRegion GeoPainter::regionFromPolygon(const GeoDataLinearRing &linearRing, Qt::FillRule fillRule, qreal strokeWidth) const
746 if (!d->m_viewport->viewLatLonAltBox().intersects(linearRing.latLonAltBox()) || !d->m_viewport->resolves(linearRing.latLonAltBox())) {
803 if (viewLatLonAltBox.intersects(itInnerBoundary.latLonAltBox()) && d->m_viewport->resolves(itInnerBoundary.latLonAltBox()), 4) {
849QList<QPolygonF *> GeoPainter::createFillPolygons(const QList<QPolygonF *> &outerPolygons, const QList<QPolygonF *> &innerPolygons) const
871void GeoPainter::drawRect(const GeoDataCoordinates ¢erCoordinates, qreal width, qreal height, bool isGeoProjected)
878 bool visible = d->m_viewport->screenCoordinates(centerCoordinates, d->m_x, y, pointRepeatNum, QSizeF(width, height), globeHidesPoint);
893QRegion GeoPainter::regionFromRect(const GeoDataCoordinates ¢erCoordinates, qreal width, qreal height, bool isGeoProjected, qreal strokeWidth) const
900 bool visible = d->m_viewport->screenCoordinates(centerCoordinates, d->m_x, centerY, pointRepeatNum, QSizeF(width, height), globeHidesPoint);
910 const int startY = antialiased ? (qFloor(topY - halfStrokeWidth)) : (qFloor(topY + 0.5 - halfStrokeWidth));
911 const int endY = antialiased ? (qCeil(topY + height + halfStrokeWidth)) : (qFloor(centerY + 0.5 + height + halfStrokeWidth));
915 const int startX = antialiased ? (qFloor(leftX - halfStrokeWidth)) : (qFloor(leftX + 0.5 - halfStrokeWidth));
916 const int endX = antialiased ? (qCeil(leftX + width + halfStrokeWidth)) : (qFloor(leftX + 0.5 + width + halfStrokeWidth));
922 return regionFromPolygon(d->createLinearRingFromGeoRect(centerCoordinates, width, height), Qt::OddEvenFill, strokeWidth);
926void GeoPainter::drawRoundedRect(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, qreal xRnd, qreal yRnd)
933 bool visible = d->m_viewport->screenCoordinates(centerPosition, d->m_x, y, pointRepeatNum, QSizeF(width, height), globeHidesPoint);
945void GeoPainter::drawTextFragment(const QPoint &position, const QString &text, const qreal fontSize, const QColor &color, const Frames &flags)
963 const QSize size = hasRoundFrame ? QSize(qMax(1.2 * width, 1.1 * height), 1.2 * height) : QSize(width, height);
992 QPainter::drawPixmap(position.x() - pixmap.width() / 2, position.y() - pixmap.height() / 2, pixmap);
This file contains the headers for AbstractProjection.
This file contains the headers for ViewportParams.
virtual bool isClippedToSphere() const
Defines whether a projection is supposed to be clipped to a certain radius.
Definition AbstractProjection.cpp:160
static qreal normalizeLon(qreal lon, GeoDataCoordinates::Unit=GeoDataCoordinates::Radian)
normalize the longitude to always be -M_PI <= lon <= +M_PI (Radian).
Definition GeoDataCoordinates.cpp:238
qreal altitude() const
return the altitude of the Point in meters
Definition GeoDataCoordinates.cpp:688
static qreal normalizeLat(qreal lat, GeoDataCoordinates::Unit=GeoDataCoordinates::Radian)
normalize latitude to always be in -M_PI / 2.
Definition GeoDataCoordinates.cpp:260
void geoCoordinates(qreal &lon, qreal &lat, GeoDataCoordinates::Unit unit) const
use this function to get the longitude and latitude with one call - use the unit parameter to switch ...
Definition GeoDataCoordinates.cpp:159
A class that defines a 3D bounding box for geographic data.
Definition GeoDataLatLonAltBox.h:40
virtual bool intersects(const GeoDataLatLonAltBox &) const
Check if this GeoDataLatLonAltBox intersects with the given one.
Definition GeoDataLatLonAltBox.cpp:177
A class that defines a 2D bounding box for geographic data.
Definition GeoDataLatLonBox.h:45
A LineString that allows to store a contiguous set of line segments.
Definition GeoDataLineString.h:66
const GeoDataLatLonAltBox & latLonAltBox() const override
Returns the smallest latLonAltBox that contains the LineString.
Definition GeoDataLineString.cpp:786
A LinearRing that allows to store a closed, contiguous set of line segments.
Definition GeoDataLinearRing.h:60
GeoDataLinearRing & outerBoundary()
Returns the outer boundary that is represented as a LinearRing.
Definition GeoDataPolygon.cpp:130
QList< GeoDataLinearRing > & innerBoundaries()
Returns a set of inner boundaries which are represented as LinearRings.
Definition GeoDataPolygon.cpp:152
A painter that allows to draw geometric primitives on the map.
Definition GeoPainter.h:86
GeoPainter(QPaintDevice *paintDevice, const ViewportParams *viewportParams, MapQuality mapQuality=NormalQuality)
Creates a new geo painter.
Definition GeoPainter.cpp:192
void drawRoundedRect(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, qreal xRnd=25.0, qreal yRnd=25.0)
Draws a rectangle with rounded corners at the given position. The rectangle is placed with its center...
Definition GeoPainter.cpp:926
void drawImage(const GeoDataCoordinates ¢erPosition, const QImage &image)
Draws an image at the given position. The image is placed with its center located at the given center...
Definition GeoPainter.cpp:449
void drawText(const GeoDataCoordinates &position, const QString &text, qreal xOffset=0.0, qreal yOffset=0.0, qreal width=0.0, qreal height=0.0, const QTextOption &option=QTextOption())
Draws the given text at a given geographic position. The text is drawn starting at the given position...
Definition GeoPainter.cpp:274
QRegion regionFromEllipse(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, bool isGeoProjected=false, qreal strokeWidth=3) const
Creates a region for an ellipse at a given position.
Definition GeoPainter.cpp:374
void drawPolygon(const GeoDataLinearRing &linearRing, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws a given linear ring (a "polygon without holes").
Definition GeoPainter.cpp:721
void drawAnnotation(const GeoDataCoordinates &position, const QString &text, QSizeF bubbleSize=QSizeF(130, 100), qreal bubbleOffsetX=-10, qreal bubbleOffsetY=-30, qreal xRnd=5, qreal yRnd=5)
Draws a text annotation that points to a geodesic position.
Definition GeoPainter.cpp:211
QRegion regionFromPoint(const GeoDataCoordinates &position, qreal strokeWidth=3) const
Creates a region for a given geographic position.
Definition GeoPainter.cpp:259
void drawEllipse(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, bool isGeoProjected=false)
Draws an ellipse at the given position. The ellipse is placed with its center located at the given ce...
Definition GeoPainter.cpp:310
void drawPoint(const GeoDataCoordinates &position)
Draws a single point at a given geographic position. The point is drawn using the painter's pen color...
Definition GeoPainter.cpp:243
QRegion regionFromPolygon(const GeoDataLinearRing &linearRing, Qt::FillRule fillRule, qreal strokeWidth=3) const
Creates a region for a given linear ring (a "polygon without holes").
Definition GeoPainter.cpp:741
QRegion regionFromPixmapRect(const GeoDataCoordinates ¢erCoordinates, int width, int height, int margin=0) const
Creates a region for a rectangle for a pixmap at a given position.
Definition GeoPainter.cpp:494
void drawLabelsForPolygons(const QList< QPolygonF * > &polygons, const QString &labelText, LabelPositionFlags labelPositionFlags, const QColor &labelColor)
Draws Labels for a given set of screen polygons.
Definition GeoPainter.cpp:556
void polygonsFromLineString(const GeoDataLineString &lineString, QList< QPolygonF * > &polygons) const
Helper method for safe and quick linestring conversion.
Definition GeoPainter.cpp:519
void drawPixmap(const GeoDataCoordinates ¢erPosition, const QPixmap &pixmap)
Draws a pixmap at the given position. The pixmap is placed with its center located at the given cente...
Definition GeoPainter.cpp:473
void drawRect(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, bool isGeoProjected=false)
Draws a rectangle at the given position. The rectangle is placed with its center located at the given...
Definition GeoPainter.cpp:871
void drawPolyline(const GeoDataLineString &lineString, const QString &labelText, LabelPositionFlags labelPositionFlags=LineCenter, const QColor &labelcolor=Qt::black)
Draws a given line string (a "polyline") with a label.
Definition GeoPainter.cpp:532
QRegion regionFromPolyline(const GeoDataLineString &lineString, qreal strokeWidth=3) const
Creates a region for a given line string (a "polyline").
Definition GeoPainter.cpp:693
QRegion regionFromRect(const GeoDataCoordinates ¢erPosition, qreal width, qreal height, bool isGeoProjected=false, qreal strokeWidth=3) const
Creates a region for a rectangle at a given position.
Definition GeoPainter.cpp:893
A public class that controls what is visible in the viewport of a Marble map.
Definition ViewportParams.h:41
QString path(const QString &relativePath)
Binds a QML item to a specific geodetic location in screen coordinates.
Definition AbstractDataPlugin.cpp:23
MapQuality
This enum is used to choose the map quality shown in the view.
Definition MarbleGlobal.h:73
QColor lighter(int factor) const const
void setAlphaF(float alpha)
bool testFlag(Enum flag) const const
void setPointSize(int pointSize)
void setPointSizeF(qreal pointSize)
int ascent() const const
int height() const const
int horizontalAdvance(QChar ch) const const
int height() const const
QSize size() const const
int width() const const
void clear()
bool empty() const const
T & first()
bool isEmpty() const const
void reserve(qsizetype size)
qsizetype size() const const
Antialiasing
bool begin(QPaintDevice *device)
QRect boundingRect(const QRect &rectangle, int flags, const QString &text)
void drawEllipse(const QPoint ¢er, int rx, int ry)
void drawImage(const QPoint &point, const QImage &image)
void drawPath(const QPainterPath &path)
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
void drawPoint(const QPoint &position)
void drawRect(const QRect &rectangle)
void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
void drawText(const QPoint &position, const QString &text)
bool end()
const QFont & font() const const
QFontMetrics fontMetrics() const const
const QPen & pen() const const
void setBrush(Qt::BrushStyle style)
void setFont(const QFont &font)
void setRenderHint(RenderHint hint, bool on)
void strokePath(const QPainterPath &path, const QPen &pen)
bool testRenderHint(RenderHint hint) const const
QRect viewport() const const
void addPolygon(const QPolygonF &polygon)
QPolygonF toFillPolygon(const QTransform &matrix) const const
QPainterPath united(const QPainterPath &p) const const
QPainterPath createStroke(const QPainterPath &path) const const
void setWidth(qreal width)
qreal widthF() const const
void fill(const QColor &color)
int height() const const
QSize size() const const
int width() const const
bool find(const Key &key, QPixmap *pixmap)
Key insert(const QPixmap &pixmap)
int x() const const
int y() const const
void setX(qreal x)
void setY(qreal y)
QPoint toPoint() const const
qreal x() const const
qreal y() const const
QPolygon toPolygon() const const
int height() const const
int width() const const
void setBottomRight(const QPointF &position)
void setTopLeft(const QPointF &position)
Ellipse
qreal height() const const
void setHeight(qreal height)
qreal width() const const
const QChar at(qsizetype position) const const
QString fromLatin1(QByteArrayView str)
bool isEmpty() const const
QString left(qsizetype n) const const
qsizetype length() const const
QString number(double n, char format, int precision)
qsizetype size() const const
AlignHCenter
OddEvenFill
transparent
NoPen
TextWordWrap
QTextStream & center(QTextStream &stream)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
QTransform & rotate(qreal a, Qt::Axis axis)
QTransform & translate(qreal dx, qreal dy)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.