KOSMIndoorMap::View

Search for usage in LXR

#include <view.h>

Inheritance diagram for KOSMIndoorMap::View:

Properties

QDateTime beginTime
 
QDateTime endTime
 
int floorLevel
 
double panHeight
 
double panWidth
 
double panX
 
double panY
 
QRectF viewport
 
double zoomLevel
 
- Properties inherited from QObject
 objectName
 

Signals

void floorLevelChanged ()
 
void timeChanged ()
 
void transformationChanged ()
 

Public Member Functions

 View (QObject *parent=nullptr)
 
QDateTime beginTime () const
 
Q_INVOKABLE void centerOnGeoCoordinate (QPointF geoCoord)
 
QTransform deviceTransform () const
 
QDateTime endTime () const
 
int level () const
 
double mapMetersToScene (double meters) const
 
Q_INVOKABLE double mapMetersToScreen (double meters) const
 
QRectF mapSceneToScreen (const QRectF &sceneRect) const
 
QPointF mapSceneToScreen (QPointF scenePos) const
 
double mapScreenDistanceToSceneDistance (double distance) const
 
Q_INVOKABLE double mapScreenToMeters (int pixels) const
 
Q_INVOKABLE QPointF mapScreenToScene (QPointF screenPos) const
 
double panHeight () const
 
void panScreenSpace (QPoint offset)
 
Q_INVOKABLE void panTopLeft (double x, double y)
 
double panWidth () const
 
double panX () const
 
double panY () const
 
QRectF sceneBoundingBox () const
 
QTransform sceneToScreenTransform () const
 
int screenHeight () const
 
int screenWidth () const
 
void setBeginTime (const QDateTime &beginTime)
 
void setDeviceTransform (const QTransform &t)
 
void setEndTime (const QDateTime &endTime)
 
void setLevel (int level)
 
void setSceneBoundingBox (const QRectF &bbox)
 
void setSceneBoundingBox (OSM::BoundingBox bbox)
 
void setScreenSize (QSize size)
 
void setViewport (const QRectF &viewport)
 
Q_INVOKABLE void setZoomLevel (double zoom, QPointF screenCenter)
 
QRectF viewport () const
 
QRectF viewportForZoom (double zoom, QPointF screenCenter) const
 
Q_INVOKABLE void zoomIn (QPointF screenCenter)
 
double zoomLevel () const
 
Q_INVOKABLE void zoomOut (QPointF screenCenter)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QRectF mapGeoToScene (OSM::BoundingBox box)
 
static QPointF mapGeoToScene (OSM::Coordinate coord)
 
static Q_INVOKABLE OSM::BoundingBox mapSceneToGeo (const QRectF &box)
 
static OSM::Coordinate mapSceneToGeo (QPointF p)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

Static Protected Member Functions

static Q_INVOKABLE QPointF mapSceneToGeoPoint (QPointF p)
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

View transformations and transformation manipulation.

There are three different coordinate systems involved here:

  • The geographic world coordinates of the OSM input data. This uses OSM::Coordinate.
  • The scene coordinates which have a the Web Mercator projection applied (see https://en.wikipedia.org/wiki/Mercator_projection). This uses QPointF ranging from 0x0 to 256x256
  • The screen coordinates (ie. visible pixels on screen). This uses QPoint. Further, there's also three slight variations of those in use here:
  • "HUD" coordinates: elements that follow the scene coordinates for their positioning, but the screen coordinates regarding scaling and rotation. This is used for map labels.
  • Geographic distances. This is needed to display things in a fixed width in meters in the scene, or to compute the map scale. Note that this only works due to the relatively high zoom levels, so that earth curvature or map projection effects are negligible.
  • "pan space": same transform as screen space, but with the origin at the origin of the scene bounding box This is useful for implementing scene-wide panning and showing scroll bars.

Definition at line 39 of file view.h.

Property Documentation

◆ beginTime

QDateTime KOSMIndoorMap::View::beginTime
readwrite

Definition at line 49 of file view.h.

◆ endTime

QDateTime KOSMIndoorMap::View::endTime
readwrite

Definition at line 50 of file view.h.

◆ floorLevel

int KOSMIndoorMap::View::floorLevel
readwrite

Definition at line 46 of file view.h.

◆ panHeight

double KOSMIndoorMap::View::panHeight
read

Definition at line 45 of file view.h.

◆ panWidth

double KOSMIndoorMap::View::panWidth
read

Definition at line 44 of file view.h.

◆ panX

double KOSMIndoorMap::View::panX
read

Definition at line 42 of file view.h.

◆ panY

double KOSMIndoorMap::View::panY
read

Definition at line 43 of file view.h.

◆ viewport

QRectF KOSMIndoorMap::View::viewport
read

Definition at line 47 of file view.h.

◆ zoomLevel

double KOSMIndoorMap::View::zoomLevel
read

Definition at line 48 of file view.h.

Constructor & Destructor Documentation

◆ View()

View::View ( QObject * parent = nullptr)
explicit

Definition at line 19 of file view.cpp.

Member Function Documentation

◆ beginTime()

QDateTime View::beginTime ( ) const

Time range that is displayed.

This matters for example when opening hours are considered for styling.

Definition at line 343 of file view.cpp.

◆ centerOnGeoCoordinate()

void View::centerOnGeoCoordinate ( QPointF geoCoord)

Center the view on the given geo-coordinate.

Definition at line 317 of file view.cpp.

◆ deviceTransform()

QTransform View::deviceTransform ( ) const

Device tranformation for manual high DPI scaling.

Definition at line 307 of file view.cpp.

◆ endTime()

QDateTime View::endTime ( ) const

Definition at line 358 of file view.cpp.

◆ level()

int View::level ( ) const

The (floor) level to display.

See also
MapLevel.

Definition at line 84 of file view.cpp.

◆ mapGeoToScene() [1/2]

QRectF View::mapGeoToScene ( OSM::BoundingBox box)
staticnodiscard

Definition at line 36 of file view.cpp.

◆ mapGeoToScene() [2/2]

QPointF View::mapGeoToScene ( OSM::Coordinate coord)
staticnodiscard

Map a geographic coordinate to a scene coordinate, ie.

apply the mercator projection.

Definition at line 27 of file view.cpp.

◆ mapMetersToScene()

double View::mapMetersToScene ( double meters) const

Returns how many units in scene coordinate represent the distance of meters in the current view transformation.

Definition at line 257 of file view.cpp.

◆ mapMetersToScreen()

double View::mapMetersToScreen ( double meters) const

Returns how many pixels on screen represent the distance of meters with the current view transformation.

Definition at line 263 of file view.cpp.

◆ mapSceneToGeo() [1/2]

OSM::BoundingBox View::mapSceneToGeo ( const QRectF & box)
staticnodiscard

Definition at line 51 of file view.cpp.

◆ mapSceneToGeo() [2/2]

OSM::Coordinate View::mapSceneToGeo ( QPointF p)
staticnodiscard

Map a scene coordinate to a geographic one, ie.

apply the inverse mercator projection.

Definition at line 43 of file view.cpp.

◆ mapSceneToGeoPoint()

QPointF View::mapSceneToGeoPoint ( QPointF p)
staticnodiscardprotected

QML only API due to lack of OSM::Coordinate support there.

Definition at line 373 of file view.cpp.

◆ mapSceneToScreen() [1/2]

QRectF View::mapSceneToScreen ( const QRectF & sceneRect) const

Converts a rectangle in scene coordinates to screen coordinates.

Definition at line 180 of file view.cpp.

◆ mapSceneToScreen() [2/2]

QPointF View::mapSceneToScreen ( QPointF scenePos) const

Converts a point in scene coordinates to screen coordinates.

Definition at line 175 of file view.cpp.

◆ mapScreenDistanceToSceneDistance()

double View::mapScreenDistanceToSceneDistance ( double distance) const

Converts a distance in screen coordinates to a distance in scene coordinates.

Definition at line 191 of file view.cpp.

◆ mapScreenToMeters()

double View::mapScreenToMeters ( int pixels) const

Returns how many meters are represented by pixels with the current view transformation.

Definition at line 269 of file view.cpp.

◆ mapScreenToScene()

QPointF View::mapScreenToScene ( QPointF screenPos) const
nodiscard

Converts a point in screen coordinates to scene coordinates.

Definition at line 185 of file view.cpp.

◆ panHeight()

double View::panHeight ( ) const

Definition at line 293 of file view.cpp.

◆ panScreenSpace()

void View::panScreenSpace ( QPoint offset)

Definition at line 199 of file view.cpp.

◆ panTopLeft()

void View::panTopLeft ( double x,
double y )

Move the viewport to the pan coordinates x and y.

Definition at line 299 of file view.cpp.

◆ panWidth()

double View::panWidth ( ) const

Size of the pan-able area in screen coordinates.

Definition at line 287 of file view.cpp.

◆ panX()

double View::panX ( ) const

Position of the viewport in pan coordinates.

Definition at line 275 of file view.cpp.

◆ panY()

double View::panY ( ) const

Definition at line 281 of file view.cpp.

◆ sceneBoundingBox()

QRectF View::sceneBoundingBox ( ) const

The bounding box of the scene.

The viewport cannot exceed this area.

Definition at line 142 of file view.cpp.

◆ sceneToScreenTransform()

QTransform View::sceneToScreenTransform ( ) const

The transformation to apply to scene coordinate to get to the view on screen.

Definition at line 208 of file view.cpp.

◆ screenHeight()

int View::screenHeight ( ) const

Definition at line 58 of file view.cpp.

◆ screenWidth()

int View::screenWidth ( ) const

Screen-space sizes, ie the size of the on-screen area used for displaying.

Definition at line 63 of file view.cpp.

◆ setBeginTime()

void View::setBeginTime ( const QDateTime & beginTime)

Definition at line 348 of file view.cpp.

◆ setDeviceTransform()

void View::setDeviceTransform ( const QTransform & t)

Definition at line 312 of file view.cpp.

◆ setEndTime()

void View::setEndTime ( const QDateTime & endTime)

Definition at line 363 of file view.cpp.

◆ setLevel()

void View::setLevel ( int level)

Definition at line 89 of file view.cpp.

◆ setSceneBoundingBox() [1/2]

void View::setSceneBoundingBox ( const QRectF & bbox)

Definition at line 152 of file view.cpp.

◆ setSceneBoundingBox() [2/2]

void View::setSceneBoundingBox ( OSM::BoundingBox bbox)

Definition at line 147 of file view.cpp.

◆ setScreenSize()

void View::setScreenSize ( QSize size)

Definition at line 68 of file view.cpp.

◆ setViewport()

void View::setViewport ( const QRectF & viewport)

Definition at line 116 of file view.cpp.

◆ setZoomLevel()

void View::setZoomLevel ( double zoom,
QPointF screenCenter )

Set the zoom level to zoom, and adjusting it around center position center.

Definition at line 105 of file view.cpp.

◆ viewport()

QRectF View::viewport ( ) const
nodiscard

The sub-rect of the scene bounding box currently displayed.

Specified in scene coordinates.

Definition at line 111 of file view.cpp.

◆ viewportForZoom()

QRectF View::viewportForZoom ( double zoom,
QPointF screenCenter ) const
nodiscard

Computes the viewport for the given zoom level and screenCenter.

This does not apply the zoom change to the view itself though.

Definition at line 123 of file view.cpp.

◆ zoomIn()

void View::zoomIn ( QPointF screenCenter)

Increase zoom level by one/scale up by 2x around the screen position center.

Definition at line 213 of file view.cpp.

◆ zoomLevel()

double View::zoomLevel ( ) const

OSM-compatible zoom level, ie.

the 2^level-th subdivision of the scene space.

Definition at line 99 of file view.cpp.

◆ zoomOut()

void View::zoomOut ( QPointF screenCenter)

Decrease zoom level by one/scale down by 2x around the screen position center.

Definition at line 218 of file view.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.