• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
PlacemarkLayout.h
Go to the documentation of this file.
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 2006-2007 Torsten Rahn <tackat@kde.org>
9 // Copyright 2007 Inge Wallin <ingwa@kde.org>
10 // Copyright 2010-2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
11 //
12 
13 //
14 // PlacemarkLayout is responsible for drawing the Placemarks on the map
15 //
16 
17 #ifndef MARBLE_PLACEMARKLAYOUT_H
18 #define MARBLE_PLACEMARKLAYOUT_H
19 
20 
21 #include <QHash>
22 #include <QModelIndex>
23 #include <QRect>
24 #include <QSet>
25 #include <QVector>
26 #include <QSortFilterProxyModel>
27 
28 #include "GeoDataFeature.h"
29 
30 class QAbstractItemModel;
31 class QItemSelectionModel;
32 class QPoint;
33 
34 
35 namespace Marble
36 {
37 
38 class GeoDataCoordinates;
39 class GeoDataPlacemark;
40 class GeoDataStyle;
41 class GeoPainter;
42 class MarbleClock;
43 class PlacemarkPainter;
44 class TileId;
45 class VisiblePlacemark;
46 class ViewportParams;
47 
54 class PlacemarkLayout : public QObject
55 {
56  Q_OBJECT
57 
58  public:
62  PlacemarkLayout( QAbstractItemModel *placemarkModel,
63  QItemSelectionModel *selectionModel,
64  MarbleClock *clock,
65  QObject *parent = 0 );
66 
70  ~PlacemarkLayout();
71 
75  QVector<VisiblePlacemark *> generateLayout( const ViewportParams *viewport );
76 
80  QVector<const GeoDataPlacemark*> whichPlacemarkAt( const QPoint &pos );
81 
82  QString runtimeTrace() const;
83 
84  public Q_SLOTS:
85  // earth
86  void setShowPlaces( bool show );
87  void setShowCities( bool show );
88  void setShowTerrain( bool show );
89  void setShowOtherPlaces( bool show );
90 
91  // other planets
92  void setShowLandingSites( bool show );
93  void setShowCraters( bool show );
94  void setShowMaria( bool show );
95 
96  void requestStyleReset();
97  void addPlacemarks( QModelIndex index, int first, int last );
98  void removePlacemarks( QModelIndex index, int first, int last );
99  void resetCacheData();
100 
101  Q_SIGNALS:
102  void repaintNeeded();
103 
104  private:
112  int maxLabelHeight() const;
113 
114  void styleReset();
115 
116  static QSet<TileId> visibleTiles( const ViewportParams *viewport );
117  bool layoutPlacemark( const GeoDataPlacemark *placemark, qreal x, qreal y, bool selected );
118 
124  GeoDataCoordinates placemarkIconCoordinates( const GeoDataPlacemark *placemark ) const;
125 
126  QRectF roomForLabel( const GeoDataStyle * style,
127  const qreal x, const qreal y,
128  const QString &labelText ) const;
129 
130  bool placemarksOnScreenLimit( const QSize &screenSize ) const;
131 
132  private:
133  Q_DISABLE_COPY( PlacemarkLayout )
134  QSortFilterProxyModel m_placemarkModel;
135  QItemSelectionModel *const m_selectionModel;
136  MarbleClock *const m_clock;
137 
138  QVector<VisiblePlacemark*> m_paintOrder;
139  QString m_runtimeTrace;
140  int m_labelArea;
141  QHash<const GeoDataPlacemark*, VisiblePlacemark*> m_visiblePlacemarks;
142  QVector< QVector< VisiblePlacemark* > > m_rowsection;
143 
145  QMap<TileId, QList<const GeoDataPlacemark*> > m_placemarkCache;
146 
147  const QVector< GeoDataFeature::GeoDataVisualCategory > m_acceptedVisualCategories;
148 
149  // earth
150  bool m_showPlaces;
151  bool m_showCities;
152  bool m_showTerrain;
153  bool m_showOtherPlaces;
154 
155  // other planets
156  bool m_showLandingSites;
157  bool m_showCraters;
158  bool m_showMaria;
159 
160  int m_maxLabelHeight;
161  bool m_styleResetRequested;
162 };
163 
164 }
165 
166 #endif
QModelIndex
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::PlacemarkLayout::repaintNeeded
void repaintNeeded()
Marble::PlacemarkLayout::setShowOtherPlaces
void setShowOtherPlaces(bool show)
Definition: PlacemarkLayout.cpp:193
QMap
Marble::PlacemarkLayout::setShowCities
void setShowCities(bool show)
Definition: PlacemarkLayout.cpp:183
Marble::PlacemarkLayout::runtimeTrace
QString runtimeTrace() const
Definition: PlacemarkLayout.cpp:532
QPoint
Marble::GeoDataStyle
an addressable style group
Definition: GeoDataStyle.h:55
GeoDataFeature.h
QHash
QObject
Marble::PlacemarkLayout::setShowPlaces
void setShowPlaces(bool show)
Definition: PlacemarkLayout.cpp:178
Marble::PlacemarkLayout::removePlacemarks
void removePlacemarks(QModelIndex index, int first, int last)
Definition: PlacemarkLayout.cpp:289
QSet
Marble::PlacemarkLayout::generateLayout
QVector< VisiblePlacemark * > generateLayout(const ViewportParams *viewport)
Definition: PlacemarkLayout.cpp:371
QString
Marble::PlacemarkLayout::whichPlacemarkAt
QVector< const GeoDataPlacemark * > whichPlacemarkAt(const QPoint &pos)
Returns a list of model indexes that are at position pos.
Definition: PlacemarkLayout.cpp:229
Marble::PlacemarkLayout
Layouts the place marks with a passed QPainter.
Definition: PlacemarkLayout.h:54
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
Marble::PlacemarkLayout::PlacemarkLayout
PlacemarkLayout(QAbstractItemModel *placemarkModel, QItemSelectionModel *selectionModel, MarbleClock *clock, QObject *parent=0)
Creates a new place mark layout.
Definition: PlacemarkLayout.cpp:136
QSize
QSortFilterProxyModel
Marble::PlacemarkLayout::~PlacemarkLayout
~PlacemarkLayout()
Destroys the place mark painter.
Definition: PlacemarkLayout.cpp:173
Marble::PlacemarkLayout::setShowTerrain
void setShowTerrain(bool show)
Definition: PlacemarkLayout.cpp:188
QVector
QRectF
Marble::PlacemarkLayout::setShowCraters
void setShowCraters(bool show)
Definition: PlacemarkLayout.cpp:203
Marble::PlacemarkLayout::setShowMaria
void setShowMaria(bool show)
Definition: PlacemarkLayout.cpp:208
QAbstractItemModel
Marble::PlacemarkLayout::setShowLandingSites
void setShowLandingSites(bool show)
Definition: PlacemarkLayout.cpp:198
QItemSelectionModel
QObject::parent
QObject * parent() const
Marble::PlacemarkLayout::addPlacemarks
void addPlacemarks(QModelIndex index, int first, int last)
feed an internal QMap of placemarks with TileId as key when model changes
Definition: PlacemarkLayout.cpp:268
Marble::MarbleClock
Definition: MarbleClock.h:25
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
Marble::PlacemarkLayout::requestStyleReset
void requestStyleReset()
Definition: PlacemarkLayout.cpp:213
Marble::PlacemarkLayout::resetCacheData
void resetCacheData()
Definition: PlacemarkLayout.cpp:309
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal