Marble

GeoPainter.h
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2008-2009 Torsten Rahn <[email protected]>
9 //
10 
11 #ifndef MARBLE_GEOPAINTER_H
12 #define MARBLE_GEOPAINTER_H
13 
14 
15 #include "marble_export.h"
16 
17 // Marble
18 #include "MarbleGlobal.h"
19 #include "ClipPainter.h"
20 
21 #include <QSizeF>
22 
23 class QImage;
24 class QPaintDevice;
25 class QRegion;
26 class QString;
27 
28 namespace Marble
29 {
30 
31 class ViewportParams;
32 class GeoPainterPrivate;
33 class GeoDataCoordinates;
34 class GeoDataLineString;
35 class GeoDataLinearRing;
36 class GeoDataPoint;
37 class GeoDataPolygon;
38 
39 
93 class MARBLE_EXPORT GeoPainter : public ClipPainter
94 {
95  public:
96  enum Frame {
97  NoOptions = 0x0,
98  RoundFrame = 0x1
99  };
100 
101  Q_DECLARE_FLAGS(Frames, Frame)
102 
103 
110  GeoPainter( QPaintDevice * paintDevice,
111  const ViewportParams *viewportParams,
112  MapQuality mapQuality = NormalQuality );
113 
114 
118  ~GeoPainter();
119 
120 
125  MapQuality mapQuality() const;
126 
127 
160  void drawAnnotation( const GeoDataCoordinates & position,
161  const QString & text,
162  QSizeF bubbleSize = QSizeF( 130, 100 ),
163  qreal bubbleOffsetX = -10, qreal bubbleOffsetY = -30,
164  qreal xRnd = 5, qreal yRnd = 5 );
165 
166 
173  void drawPoint ( const GeoDataCoordinates & position );
174 
175 
190  QRegion regionFromPoint ( const GeoDataCoordinates & position,
191  qreal strokeWidth = 3) const;
192 
193 
200  void drawPoint ( const GeoDataPoint & point );
201 
202 
215  QRegion regionFromPoint ( const GeoDataPoint & point,
216  qreal strokeWidth = 3) const;
217 
218 
229  void drawText ( const GeoDataCoordinates & position, const QString & text,
230  qreal xOffset = 0.0, qreal yOffset = 0.0,
231  qreal width = 0.0, qreal height = 0.0,
232  const QTextOption & option = QTextOption() );
233 
234 
251  void drawEllipse ( const GeoDataCoordinates & centerPosition,
252  qreal width, qreal height, bool isGeoProjected = false );
253 
254 
268  QRegion regionFromEllipse ( const GeoDataCoordinates & centerPosition,
269  qreal width, qreal height, bool isGeoProjected = false,
270  qreal strokeWidth = 3 ) const;
271 
272 
282  void drawImage ( const GeoDataCoordinates & centerPosition,
283  const QImage & image /* , bool isGeoProjected = false */ );
284 
285 
295  void drawPixmap ( const GeoDataCoordinates & centerPosition,
296  const QPixmap & pixmap /*, bool isGeoProjected = false */ );
297 
309  QRegion regionFromPixmapRect(const GeoDataCoordinates &centerCoordinates,
310  int width, int height,
311  int margin = 0) const;
312 
323  void polygonsFromLineString( const GeoDataLineString &lineString,
324  QVector<QPolygonF*> &polygons) const;
325 
326 
338  void drawPolyline ( const GeoDataLineString & lineString,
339  const QString& labelText,
340  LabelPositionFlags labelPositionFlags = LineCenter,
341  const QColor& labelcolor = Qt::black);
342 
351  void drawLabelsForPolygons( const QVector<QPolygonF*> &polygons,
352  const QString& labelText,
353  LabelPositionFlags labelPositionFlags,
354  const QColor& labelColor );
355 
363  void drawPolyline(const GeoDataLineString & lineString);
364 
379  QRegion regionFromPolyline ( const GeoDataLineString & lineString,
380  qreal strokeWidth = 3 ) const;
381 
382 
393  void drawPolygon ( const GeoDataLinearRing & linearRing,
394  Qt::FillRule fillRule = Qt::OddEvenFill );
395 
396 
417  QRegion regionFromPolygon ( const GeoDataLinearRing & linearRing,
418  Qt::FillRule fillRule, qreal strokeWidth = 3 ) const;
419 
420 
431  void drawPolygon ( const GeoDataPolygon & polygon,
432  Qt::FillRule fillRule = Qt::OddEvenFill );
433 
434 
435  QVector<QPolygonF*> createFillPolygons( const QVector<QPolygonF*> & outerPolygons,
436  const QVector<QPolygonF*> & innerPolygons ) const;
437 
455  void drawRect ( const GeoDataCoordinates & centerPosition,
456  qreal width, qreal height,
457  bool isGeoProjected = false );
458 
459 
477  QRegion regionFromRect ( const GeoDataCoordinates & centerPosition,
478  qreal width, qreal height,
479  bool isGeoProjected = false,
480  qreal strokeWidth = 3 ) const;
481 
482 
503  void drawRoundedRect(const GeoDataCoordinates &centerPosition,
504  qreal width, qreal height,
505  qreal xRnd = 25.0, qreal yRnd = 25.0);
506 
507 
508  void drawTextFragment(const QPoint &position, const QString &text,
509  const qreal fontSize, const QColor &color = Qt::black,
510  const Frames &flags = nullptr);
511 
512 
513  // Reenabling QPainter+ClipPainter methods.
514  using QPainter::drawText;
515  using QPainter::drawEllipse;
516  using QPainter::drawImage;
517  using QPainter::drawPixmap;
518  using QPainter::drawPoint;
519  using ClipPainter::drawPolyline;
520  using ClipPainter::drawPolygon;
521  using QPainter::drawRect;
523 
524  private:
525  Q_DISABLE_COPY( GeoPainter )
526  GeoPainterPrivate * const d;
527 };
528 
529 }
530 
531 #endif
A Geometry object representing a 3d point.
Definition: GeoDataPoint.h:47
A 3d point representation.
A LinearRing that allows to store a closed, contiguous set of line segments.
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:93
Binds a QML item to a specific geodetic location in screen coordinates.
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:78
void drawRect(const QRectF &rectangle)
void drawPoint(const QPointF &position)
void drawEllipse(const QRectF &rectangle)
void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
A polygon that can have "holes".
Normal quality.
Definition: MarbleGlobal.h:81
void drawText(const QPointF &position, const QString &text)
A LineString that allows to store a contiguous set of line segments.
A public class that controls what is visible in the viewport of a Marble map.
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, Qt::ImageConversionFlags flags)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed May 27 2020 22:35:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.