libosmscout  1.1.1
Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | List of all members
osmscout::MapWidget Class Reference

#include <libosmscout-client-qt/include/osmscout/MapWidget.h>

Inheritance diagram for osmscout::MapWidget:
Inheritance graph
[legend]
Collaboration diagram for osmscout::MapWidget:
Collaboration graph
[legend]

Public Slots

void changeView (const MapView &view)
 
void redraw ()
 
void recenter ()
 
void zoom (double zoomFactor)
 
void zoomIn (double zoomFactor)
 
void zoomOut (double zoomFactor)
 
void zoom (double zoomFactor, const QPoint widgetPosition)
 
void zoomIn (double zoomFactor, const QPoint widgetPosition)
 
void zoomOut (double zoomFactor, const QPoint widgetPosition)
 
void move (QVector2D vector)
 
void left ()
 
void right ()
 
void up ()
 
void down ()
 
void rotateTo (double angle)
 
void rotateLeft ()
 
void rotateRight ()
 
void toggleDaylight ()
 
void reloadStyle ()
 
void reloadTmpStyle ()
 
void showCoordinates (osmscout::GeoCoord coord, osmscout::Magnification magnification)
 
void showCoordinates (double lat, double lon)
 
void showCoordinatesInstantly (osmscout::GeoCoord coord, osmscout::Magnification magnification)
 
void showCoordinatesInstantly (double lat, double lon)
 
void showLocation (LocationEntry *location)
 
void locationChanged (bool locationValid, double lat, double lon, bool horizontalAccuracyValid=false, double horizontalAccuracy=0, const QDateTime &lastUpdate=QDateTime::currentDateTime())
 
void addPositionMark (int id, double lat, double lon)
 
void removePositionMark (int id)
 
void addOverlayObject (int id, QObject *o)
 
void removeOverlayObject (int id)
 
void removeAllOverlayObjects ()
 
OverlayWaycreateOverlayWay (QString type="_route")
 
OverlayAreacreateOverlayArea (QString type="_highlighted")
 
OverlayNodecreateOverlayNode (QString type="_highlighted")
 
bool toggleDebug ()
 
bool toggleInfo ()
 
void setVehicleScaleFactor (float factor)
 

Signals

void viewChanged ()
 
void lockToPossitionChanged ()
 
void followVehicleChanged ()
 
void finishedChanged (bool finished)
 
void mouseMove (const int screenX, const int screenY, const double lat, const double lon, const Qt::KeyboardModifiers modifiers)
 
void tap (const int screenX, const int screenY, const double lat, const double lon)
 
void doubleTap (const int screenX, const int screenY, const double lat, const double lon)
 
void longTap (const int screenX, const int screenY, const double lat, const double lon)
 
void tapLongTap (const int screenX, const int screenY, const double lat, const double lon)
 
void stylesheetFilenameChanged ()
 
void styleErrorsChanged ()
 
void databaseLoaded (osmscout::GeoBox)
 
void renderingTypeChanged (QString type)
 

Public Member Functions

 MapWidget (QQuickItem *parent=nullptr)
 
 ~MapWidget () override
 
MapViewGetView () const
 
void SetMapView (QObject *o)
 
VehiclePositionGetVehiclePosition () const
 
void SetVehiclePosition (QObject *o)
 
QString getVehicleStandardIconFile () const
 
void setVehicleStandardIconFile (const QString &file)
 
QString getVehicleNoGpsSignalIconFile () const
 
void setVehicleNoGpsSignalIconFile (const QString &file)
 
QString getVehicleInTunnelIconFile () const
 
void setVehicleInTunnelIconFile (const QString &file)
 
double getVehicleIconSize () const
 
void setVehicleIconSize (double value)
 
double GetLat () const
 
double GetLon () const
 
osmscout::GeoCoord GetCenter () const
 
QString GetStylesheetFilename () const
 
QString GetZoomLevelName () const
 
int GetMagLevel () const
 
double GetPixelSize () const
 
bool IsFinished () const
 
bool getShowCurrentPosition () const
 
void setShowCurrentPosition (bool b)
 
bool isLockedToPosition () const
 
void setLockToPosition (bool)
 
bool isFollowVehicle () const
 
void setFollowVehicle (bool)
 
osmscout::MercatorProjection getProjection () const
 
void wheelEvent (QWheelEvent *event) override
 
void touchEvent (QTouchEvent *event) override
 
void focusOutEvent (QFocusEvent *event) override
 
void translateToTouch (QMouseEvent *event, Qt::TouchPointStates states)
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void hoverMoveEvent (QHoverEvent *event) override
 
void paint (QPainter *painter) override
 
bool stylesheetHasErrors () const
 
int firstStylesheetErrorLine () const
 
int firstStylesheetErrorColumn () const
 
QString firstStylesheetErrorDescription () const
 
bool isDatabaseLoaded ()
 
Q_INVOKABLE bool isInDatabaseBoundingBox (double lat, double lon)
 
Q_INVOKABLE QPointF screenPosition (double lat, double lon)
 
QString GetRenderingType () const
 
void SetRenderingType (QString type)
 
bool isPreventMouseStealing () const
 
void setPreventMouseStealing (bool b)
 

Static Public Member Functions

static QImage loadSVGIcon (const QString &directory, const QString fileName, double iconPixelSize)
 

Properties

QObject view
 
QObject vehiclePosition
 
double lat
 
double lon
 
int zoomLevel
 
QString zoomLevelName
 
double pixelSize
 
bool databaseLoaded
 
bool finished {false}
 
bool showCurrentPosition {false}
 
bool lockToPosition
 
bool followVehicle
 
QString stylesheetFilename
 
QString renderingType
 
bool preventMouseStealing {false}
 
bool stylesheetHasErrors
 
int stylesheetErrorLine
 
int stylesheetErrorColumn
 
QString stylesheetErrorDescription
 
QString vehicleStandardIconFile
 
QString vehicleNoGpsSignalIconFile
 
QString vehicleInTunnelIconFile
 
double vehicleIconSize
 

Detailed Description

Qt Quick widget for displaying map.

Type should to be registered by qmlRegisterType method and DBThread instance should be initialized before first usage.

Constructor & Destructor Documentation

◆ MapWidget()

osmscout::MapWidget::MapWidget ( QQuickItem *  parent = nullptr)

◆ ~MapWidget()

osmscout::MapWidget::~MapWidget ( )
override

Member Function Documentation

◆ addOverlayObject

void osmscout::MapWidget::addOverlayObject ( int  id,
QObject *  o 
)
slot

Method for registering map overlay objects. Usage from QML:

var way=map.createOverlayWay(); way.addPoint(50.09180646851823, 14.498789861494872); way.addPoint(50.09180646851823, 14.60); map.addOverlayObject(0,way);

Parameters
id
o

◆ addPositionMark

void osmscout::MapWidget::addPositionMark ( int  id,
double  lat,
double  lon 
)
slot

Add "mark" (small red circle) on top of map. It will be rendered in UI thread, count of marks should be limited.

◆ changeView

void osmscout::MapWidget::changeView ( const MapView view)
slot

◆ createOverlayArea

OverlayArea* osmscout::MapWidget::createOverlayArea ( QString  type = "_highlighted")
slot

◆ createOverlayNode

OverlayNode* osmscout::MapWidget::createOverlayNode ( QString  type = "_highlighted")
slot

◆ createOverlayWay

OverlayWay* osmscout::MapWidget::createOverlayWay ( QString  type = "_route")
slot

◆ databaseLoaded

void osmscout::MapWidget::databaseLoaded ( osmscout::GeoBox  )
signal

◆ doubleTap

void osmscout::MapWidget::doubleTap ( const int  screenX,
const int  screenY,
const double  lat,
const double  lon 
)
signal

◆ down

void osmscout::MapWidget::down ( )
slot

◆ finishedChanged

void osmscout::MapWidget::finishedChanged ( bool  finished)
signal

◆ firstStylesheetErrorColumn()

int osmscout::MapWidget::firstStylesheetErrorColumn ( ) const

◆ firstStylesheetErrorDescription()

QString osmscout::MapWidget::firstStylesheetErrorDescription ( ) const

◆ firstStylesheetErrorLine()

int osmscout::MapWidget::firstStylesheetErrorLine ( ) const

◆ focusOutEvent()

void osmscout::MapWidget::focusOutEvent ( QFocusEvent *  event)
override

◆ followVehicleChanged

void osmscout::MapWidget::followVehicleChanged ( )
signal

◆ GetCenter()

osmscout::GeoCoord osmscout::MapWidget::GetCenter ( ) const
inline

◆ GetLat()

double osmscout::MapWidget::GetLat ( ) const
inline

◆ GetLon()

double osmscout::MapWidget::GetLon ( ) const
inline

◆ GetMagLevel()

int osmscout::MapWidget::GetMagLevel ( ) const
inline

◆ GetPixelSize()

double osmscout::MapWidget::GetPixelSize ( ) const
inline

◆ getProjection()

osmscout::MercatorProjection osmscout::MapWidget::getProjection ( ) const
inline

◆ GetRenderingType()

QString osmscout::MapWidget::GetRenderingType ( ) const

◆ getShowCurrentPosition()

bool osmscout::MapWidget::getShowCurrentPosition ( ) const
inline

◆ GetStylesheetFilename()

QString osmscout::MapWidget::GetStylesheetFilename ( ) const

◆ getVehicleIconSize()

double osmscout::MapWidget::getVehicleIconSize ( ) const
inline

◆ getVehicleInTunnelIconFile()

QString osmscout::MapWidget::getVehicleInTunnelIconFile ( ) const
inline

◆ getVehicleNoGpsSignalIconFile()

QString osmscout::MapWidget::getVehicleNoGpsSignalIconFile ( ) const
inline

◆ GetVehiclePosition()

VehiclePosition* osmscout::MapWidget::GetVehiclePosition ( ) const
inline

◆ getVehicleStandardIconFile()

QString osmscout::MapWidget::getVehicleStandardIconFile ( ) const
inline

◆ GetView()

MapView* osmscout::MapWidget::GetView ( ) const
inline

◆ GetZoomLevelName()

QString osmscout::MapWidget::GetZoomLevelName ( ) const

◆ hoverMoveEvent()

void osmscout::MapWidget::hoverMoveEvent ( QHoverEvent *  event)
override

◆ isDatabaseLoaded()

bool osmscout::MapWidget::isDatabaseLoaded ( )

◆ IsFinished()

bool osmscout::MapWidget::IsFinished ( ) const
inline

◆ isFollowVehicle()

bool osmscout::MapWidget::isFollowVehicle ( ) const
inline

◆ isInDatabaseBoundingBox()

Q_INVOKABLE bool osmscout::MapWidget::isInDatabaseBoundingBox ( double  lat,
double  lon 
)

◆ isLockedToPosition()

bool osmscout::MapWidget::isLockedToPosition ( ) const
inline

◆ isPreventMouseStealing()

bool osmscout::MapWidget::isPreventMouseStealing ( ) const
inline

◆ left

void osmscout::MapWidget::left ( )
slot

◆ loadSVGIcon()

static QImage osmscout::MapWidget::loadSVGIcon ( const QString &  directory,
const QString  fileName,
double  iconPixelSize 
)
static

Helper for loading SVG graphics

◆ locationChanged

void osmscout::MapWidget::locationChanged ( bool  locationValid,
double  lat,
double  lon,
bool  horizontalAccuracyValid = false,
double  horizontalAccuracy = 0,
const QDateTime &  lastUpdate = QDateTime::currentDateTime() 
)
slot

◆ lockToPossitionChanged

void osmscout::MapWidget::lockToPossitionChanged ( )
signal

◆ longTap

void osmscout::MapWidget::longTap ( const int  screenX,
const int  screenY,
const double  lat,
const double  lon 
)
signal

◆ mouseMove

void osmscout::MapWidget::mouseMove ( const int  screenX,
const int  screenY,
const double  lat,
const double  lon,
const Qt::KeyboardModifiers  modifiers 
)
signal

◆ mouseMoveEvent()

void osmscout::MapWidget::mouseMoveEvent ( QMouseEvent *  event)
override

◆ mousePressEvent()

void osmscout::MapWidget::mousePressEvent ( QMouseEvent *  event)
override

◆ mouseReleaseEvent()

void osmscout::MapWidget::mouseReleaseEvent ( QMouseEvent *  event)
override

◆ move

void osmscout::MapWidget::move ( QVector2D  vector)
slot

◆ paint()

void osmscout::MapWidget::paint ( QPainter *  painter)
override

◆ recenter

void osmscout::MapWidget::recenter ( )
slot

◆ redraw

void osmscout::MapWidget::redraw ( )
slot

◆ reloadStyle

void osmscout::MapWidget::reloadStyle ( )
slot

◆ reloadTmpStyle

void osmscout::MapWidget::reloadTmpStyle ( )
slot

◆ removeAllOverlayObjects

void osmscout::MapWidget::removeAllOverlayObjects ( )
slot

◆ removeOverlayObject

void osmscout::MapWidget::removeOverlayObject ( int  id)
slot

◆ removePositionMark

void osmscout::MapWidget::removePositionMark ( int  id)
slot

◆ renderingTypeChanged

void osmscout::MapWidget::renderingTypeChanged ( QString  type)
signal

◆ right

void osmscout::MapWidget::right ( )
slot

◆ rotateLeft

void osmscout::MapWidget::rotateLeft ( )
slot

◆ rotateRight

void osmscout::MapWidget::rotateRight ( )
slot

◆ rotateTo

void osmscout::MapWidget::rotateTo ( double  angle)
slot

Rotate view to specified angle [radians; [0 ~ 2*PI) ]

Parameters
angle

◆ screenPosition()

Q_INVOKABLE QPointF osmscout::MapWidget::screenPosition ( double  lat,
double  lon 
)

◆ setFollowVehicle()

void osmscout::MapWidget::setFollowVehicle ( bool  )

◆ setLockToPosition()

void osmscout::MapWidget::setLockToPosition ( bool  )

◆ SetMapView()

void osmscout::MapWidget::SetMapView ( QObject *  o)
inline

◆ setPreventMouseStealing()

void osmscout::MapWidget::setPreventMouseStealing ( bool  b)
inline

◆ SetRenderingType()

void osmscout::MapWidget::SetRenderingType ( QString  type)

◆ setShowCurrentPosition()

void osmscout::MapWidget::setShowCurrentPosition ( bool  b)
inline

◆ setVehicleIconSize()

void osmscout::MapWidget::setVehicleIconSize ( double  value)
inline

◆ setVehicleInTunnelIconFile()

void osmscout::MapWidget::setVehicleInTunnelIconFile ( const QString &  file)
inline

◆ setVehicleNoGpsSignalIconFile()

void osmscout::MapWidget::setVehicleNoGpsSignalIconFile ( const QString &  file)
inline

◆ SetVehiclePosition()

void osmscout::MapWidget::SetVehiclePosition ( QObject *  o)

◆ setVehicleScaleFactor

void osmscout::MapWidget::setVehicleScaleFactor ( float  factor)
slot

Method for configuring the aspect ratio of painted items. Default value is 1.0. Using HiDPI it is required to set the value according with the scale factor.

Parameters
ratio

◆ setVehicleStandardIconFile()

void osmscout::MapWidget::setVehicleStandardIconFile ( const QString &  file)
inline

◆ showCoordinates [1/2]

void osmscout::MapWidget::showCoordinates ( osmscout::GeoCoord  coord,
osmscout::Magnification  magnification 
)
slot

◆ showCoordinates [2/2]

void osmscout::MapWidget::showCoordinates ( double  lat,
double  lon 
)
slot

◆ showCoordinatesInstantly [1/2]

void osmscout::MapWidget::showCoordinatesInstantly ( osmscout::GeoCoord  coord,
osmscout::Magnification  magnification 
)
slot

◆ showCoordinatesInstantly [2/2]

void osmscout::MapWidget::showCoordinatesInstantly ( double  lat,
double  lon 
)
slot

◆ showLocation

void osmscout::MapWidget::showLocation ( LocationEntry location)
slot

◆ styleErrorsChanged

void osmscout::MapWidget::styleErrorsChanged ( )
signal

◆ stylesheetFilenameChanged

void osmscout::MapWidget::stylesheetFilenameChanged ( )
signal

◆ stylesheetHasErrors()

bool osmscout::MapWidget::stylesheetHasErrors ( ) const

◆ tap

void osmscout::MapWidget::tap ( const int  screenX,
const int  screenY,
const double  lat,
const double  lon 
)
signal

◆ tapLongTap

void osmscout::MapWidget::tapLongTap ( const int  screenX,
const int  screenY,
const double  lat,
const double  lon 
)
signal

◆ toggleDaylight

void osmscout::MapWidget::toggleDaylight ( )
slot

◆ toggleDebug

bool osmscout::MapWidget::toggleDebug ( )
slot

◆ toggleInfo

bool osmscout::MapWidget::toggleInfo ( )
slot

◆ touchEvent()

void osmscout::MapWidget::touchEvent ( QTouchEvent *  event)
override

◆ translateToTouch()

void osmscout::MapWidget::translateToTouch ( QMouseEvent *  event,
Qt::TouchPointStates  states 
)

◆ up

void osmscout::MapWidget::up ( )
slot

◆ viewChanged

void osmscout::MapWidget::viewChanged ( )
signal

◆ wheelEvent()

void osmscout::MapWidget::wheelEvent ( QWheelEvent *  event)
override

◆ zoom [1/2]

void osmscout::MapWidget::zoom ( double  zoomFactor)
slot

◆ zoom [2/2]

void osmscout::MapWidget::zoom ( double  zoomFactor,
const QPoint  widgetPosition 
)
slot

◆ zoomIn [1/2]

void osmscout::MapWidget::zoomIn ( double  zoomFactor)
slot

◆ zoomIn [2/2]

void osmscout::MapWidget::zoomIn ( double  zoomFactor,
const QPoint  widgetPosition 
)
slot

◆ zoomOut [1/2]

void osmscout::MapWidget::zoomOut ( double  zoomFactor)
slot

◆ zoomOut [2/2]

void osmscout::MapWidget::zoomOut ( double  zoomFactor,
const QPoint  widgetPosition 
)
slot

Property Documentation

◆ databaseLoaded

bool osmscout::MapWidget::databaseLoaded
read

◆ finished

bool osmscout::MapWidget::finished {false}
read

◆ followVehicle

bool osmscout::MapWidget::followVehicle
readwrite

◆ lat

double osmscout::MapWidget::lat
read

◆ lockToPosition

bool osmscout::MapWidget::lockToPosition
readwrite

◆ lon

double osmscout::MapWidget::lon
read

◆ pixelSize

double osmscout::MapWidget::pixelSize
read

◆ preventMouseStealing

bool osmscout::MapWidget::preventMouseStealing {false}
readwrite

This property holds whether the mouse events may be stolen from this Widget. By default this property is false. see https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#preventStealing-prop

◆ renderingType

QString osmscout::MapWidget::renderingType
readwrite

◆ showCurrentPosition

bool osmscout::MapWidget::showCurrentPosition {false}
readwrite

◆ stylesheetErrorColumn

int osmscout::MapWidget::stylesheetErrorColumn
read

◆ stylesheetErrorDescription

QString osmscout::MapWidget::stylesheetErrorDescription
read

◆ stylesheetErrorLine

int osmscout::MapWidget::stylesheetErrorLine
read

◆ stylesheetFilename

QString osmscout::MapWidget::stylesheetFilename
read

◆ stylesheetHasErrors

bool osmscout::MapWidget::stylesheetHasErrors
read

◆ vehicleIconSize

double osmscout::MapWidget::vehicleIconSize
readwrite

◆ vehicleInTunnelIconFile

QString osmscout::MapWidget::vehicleInTunnelIconFile
readwrite

◆ vehicleNoGpsSignalIconFile

QString osmscout::MapWidget::vehicleNoGpsSignalIconFile
readwrite

◆ vehiclePosition

QObject osmscout::MapWidget::vehiclePosition
readwrite

◆ vehicleStandardIconFile

QString osmscout::MapWidget::vehicleStandardIconFile
readwrite

◆ view

QObject osmscout::MapWidget::view
readwrite

◆ zoomLevel

int osmscout::MapWidget::zoomLevel
read

◆ zoomLevelName

QString osmscout::MapWidget::zoomLevelName
read

The documentation for this class was generated from the following file: