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

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
ViewportParams.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 2007 Inge Wallin <ingwa@kde.org>
9 // Copyright 2008 Jens-Michael Hoffmann <jensmh@gmx.de>
10 //
11 
12 #ifndef MARBLE_VIEWPORTPARAMS_H
13 #define MARBLE_VIEWPORTPARAMS_H
14 
15 
22 #include <QSize>
23 #include <QPainterPath>
24 
25 #include "GeoDataLatLonAltBox.h"
26 
27 #include "Quaternion.h"
28 #include "MarbleGlobal.h"
29 #include "marble_export.h"
30 
31 class QPolygonF;
32 
33 namespace Marble
34 {
35 
36 class AbstractProjection;
37 class ViewportParamsPrivate;
38 
44 class MARBLE_EXPORT ViewportParams
45 {
46  public:
47  ViewportParams( );
48  explicit ViewportParams( Projection projection,
49  qreal centerLongitude = 0, qreal centerLatatitude = 0,
50  int radius = 2000,
51  const QSize &size = QSize( 100, 100 ) );
52  ~ViewportParams();
53 
54  // Getters and setters
55  Projection projection() const;
56  const AbstractProjection *currentProjection() const;
57  void setProjection(Projection newProjection);
58 
59  int polarity() const;
60 
61  const GeoDataLatLonAltBox& viewLatLonAltBox() const;
62 
63  GeoDataLatLonAltBox latLonAltBox( const QRect &screenRect ) const;
64 
65  // Calculates an educated guess for the average angle in radians covered per pixel.
66  // Given a certain resolution it doesn't make much sense
67  // - to display an object that covers an angle that is smaller than that.
68  // - to display two points as distinct points if they are separated by a
69  // an angular distance that is smaller. Instead only one point should be shown.
70  // So this method helps to filter out details.
71  // It's somewhat related to http://en.wikipedia.org/wiki/Angular_resolution
72 
73  qreal angularResolution() const;
74 
75  // Determines whether a geographical feature is big enough so that it should
76  // represent a single point on the screen already.
77  // See angularResolution()
78 
79  bool resolves ( const GeoDataLatLonBox &latLonBox ) const;
80 
81  bool resolves ( const GeoDataLatLonAltBox &latLonAltBox ) const;
82 
83  // Determines whether two points are located enough apart so that it makes
84  // sense to display them as distinct points. If this is not the case
85  // calculation and drawing of one point can be skipped as only a single
86  // point will be displayed on the screen.
87 
88  bool resolves ( const GeoDataCoordinates &coord1, const GeoDataCoordinates &coord2 ) const;
89 
90  int radius() const;
91 
96  void setRadius(int radius);
97 
98  void centerOn( qreal lon, qreal lat );
99 
100  Quaternion planetAxis() const;
101  const matrix &planetAxisMatrix() const;
102 
103  int width() const;
104  int height() const;
105  QSize size() const;
106 
107  void setWidth(int newWidth);
108  void setHeight(int newHeight);
109  void setSize(QSize newSize);
110 
111  qreal centerLongitude() const;
112  qreal centerLatitude() const;
113  MARBLE_DEPRECATED( void centerCoordinates( qreal &centerLon, qreal &centerLat ) const );
114 
126  bool screenCoordinates( const qreal lon, const qreal lat,
127  qreal &x, qreal &y ) const;
128 
142  bool screenCoordinates( const GeoDataCoordinates &geopoint,
143  qreal &x, qreal &y,
144  bool &globeHidesPoint ) const;
145 
146  // Will just call the virtual version with a dummy globeHidesPoint.
147  bool screenCoordinates( const GeoDataCoordinates &geopoint,
148  qreal &x, qreal &y ) const;
149 
165  bool screenCoordinates( const GeoDataCoordinates &coordinates,
166  qreal *x, qreal &y, int &pointRepeatNum,
167  const QSizeF& size,
168  bool &globeHidesPoint ) const;
169 
170 
171  bool screenCoordinates( const GeoDataLineString &lineString,
172  QVector<QPolygonF*> &polygons ) const;
173 
184  bool geoCoordinates( const int x, const int y,
185  qreal &lon, qreal &lat,
186  GeoDataCoordinates::Unit unit = GeoDataCoordinates::Degree ) const;
187 
188  bool mapCoversViewport() const;
189 
190  QPainterPath mapShape() const;
191 
192  QRegion mapRegion() const;
193 
200  GeoDataCoordinates focusPoint() const;
201 
207  void setFocusPoint(const GeoDataCoordinates &focusPoint);
208 
213  void resetFocusPoint();
214 
215  private:
216  Q_DISABLE_COPY( ViewportParams )
217  ViewportParamsPrivate * const d;
218 };
219 
220 }
221 
222 #endif
Marble::GeoDataCoordinates::Unit
Unit
enum used constructor to specify the units used
Definition: GeoDataCoordinates.h:64
Quaternion.h
Marble::matrix
xmmfloat matrix[3]
Definition: Quaternion.h:40
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
MARBLE_EXPORT
#define MARBLE_EXPORT
Definition: marble_export.h:20
MARBLE_DEPRECATED
#define MARBLE_DEPRECATED(func)
Definition: MarbleGlobal.h:255
MarbleGlobal.h
Marble::GeoDataLineString
A LineString that allows to store a contiguous set of line segments.
Definition: GeoDataLineString.h:75
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
marble_export.h
GeoDataLatLonAltBox.h
Marble::Quaternion
Definition: Quaternion.h:43
Marble::AbstractProjection
A base class for all projections in Marble.
Definition: AbstractProjection.h:49
Marble::Projection
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:44
Marble::GeoDataLatLonAltBox
A class that defines a 3D bounding box for geographic data.
Definition: GeoDataLatLonAltBox.h:49
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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