digiKam
Digikam::MapWidget Class Reference

The central map view class of geolocation interface. More...

+ Inheritance diagram for Digikam::MapWidget:

Public Member Functions

 MapWidget (QWidget *const parent=nullptr)
 
void readSettingsFromGroup (const KConfigGroup *const group)
 
void saveSettingsToGroup (KConfigGroup *const group)
 
 ~MapWidget () override
 
Data
void addUngroupedModel (GeoModelHelper *const modelHelper)
 
void removeUngroupedModel (GeoModelHelper *const modelHelper)
 
void setGroupedModel (AbstractMarkerTiler *const markerModel)
 
void setDragDropHandler (GeoDragDropHandler *const dragDropHandler)
 
void setTrackManager (TrackManager *const trackManager)
 
UI setup
QAction * getControlAction (const QString &actionName)
 
QWidget * getControlWidget ()
 Returns the control widget. More...
 
void addWidgetToControlWidget (QWidget *const newWidget)
 
void setSortOptionsMenu (QMenu *const sortMenu)
 
void setMouseMode (const GeoMouseModes mouseMode)
 
void setAvailableMouseModes (const GeoMouseModes mouseModes)
 
void setVisibleMouseModes (const GeoMouseModes mouseModes)
 
void setAllowModifications (const bool state)
 
void setActive (const bool state)
 
bool getActiveState ()
 
bool getStickyModeState () const
 
void setStickyModeState (const bool state)
 
void setVisibleExtraActions (const GeoExtraActions actions)
 
void setEnabledExtraActions (const GeoExtraActions actions)
 
Map related functions
QStringList availableBackends () const
 
bool setBackend (const QString &backendName)
 
GeoCoordinates getCenter () const
 
void setCenter (const GeoCoordinates &coordinate)
 
void setZoom (const QString &newZoom)
 
QString getZoom ()
 
void adjustBoundariesToGroupedMarkers (const bool useSaneZoomLevel=true)
 Adjusts the visible map area such that all grouped markers are visible. More...
 
void refreshMap ()
 
Region selection
void setRegionSelection (const GeoCoordinates::Pair &region)
 
GeoCoordinates::Pair getRegionSelection ()
 
void clearRegionSelection ()
 
Internal

Functions that are only used internally and should be hidden from the public interface

void updateMarkers ()
 
void updateClusters ()
 
void markClustersAsDirty ()
 
void getColorInfos (const int clusterIndex, QColor *fillColor, QColor *strokeColor, Qt::PenStyle *strokeStyle, QString *labelText, QColor *labelColor, const GeoGroupState *const overrideSelection=nullptr, const int *const overrideCount=nullptr) const
 Return color and style information for rendering the cluster. More...
 
void getColorInfos (const GeoGroupState groupState, const int nMarkers, QColor *fillColor, QColor *strokeColor, Qt::PenStyle *strokeStyle, QString *labelText, QColor *labelColor) const
 
QString convertZoomToBackendZoom (const QString &someZoom, const QString &targetBackend) const
 
QPixmap getDecoratedPixmapForCluster (const int clusterId, const GeoGroupState *const selectedStateOverride, const int *const countOverride, QPoint *const centerPoint)
 
QVariant getClusterRepresentativeMarker (const int clusterIndex, const int sortKey)
 

Mouse modes

void slotMouseModeChanged (QAction *triggeredAction)
 
void slotRemoveCurrentRegionSelection ()
 

Appearance

void setSortKey (const int sortKey)
 
void setThumnailSize (const int newThumbnailSize)
 
void setThumbnailGroupingRadius (const int newGroupingRadius)
 
void setMarkerGroupingRadius (const int newGroupingRadius)
 
int getThumbnailSize () const
 
int getUndecoratedThumbnailSize () const
 
void setShowThumbnails (const bool state)
 
void slotZoomIn ()
 
void slotZoomOut ()
 
void slotDecreaseThumbnailSize ()
 
void slotIncreaseThumbnailSize ()
 

Internal?

void slotUpdateActionsEnabled ()
 
void slotClustersNeedUpdating ()
 
void stopThumbnailTimer ()
 
void slotStickyModeChanged ()
 
void signalUngroupedModelChanged (const int index)
 
void signalRegionSelectionChanged ()
 
void signalRemoveCurrentFilter ()
 
void signalStickyModeChanged ()
 
void signalMouseModeChanged (const Digikam::GeoMouseModes &currentMouseMode)
 
static QString MarbleWidgetVersion ()
 
bool currentBackendReady () const
 
void applyCacheToBackend ()
 
void saveBackendToCache ()
 
void rebuildConfigurationMenu ()
 
void dropEvent (QDropEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void createActions ()
 
void createActionsForBackendSelection ()
 
void setShowPlaceholderWidget (const bool state)
 
void setMapWidgetInFrame (QWidget *const widgetForFrame)
 Set widgetForFrame as the widget in the frame, but does not show it. More...
 
void removeMapWidgetFromFrame ()
 
void slotBackendReadyChanged (const QString &backendName)
 
void slotChangeBackend (QAction *action)
 
void slotBackendZoomChanged (const QString &newZoom)
 
void slotClustersMoved (const QIntList &clusterIndices, const QPair< int, QModelIndex > &snapTarget)
 
void slotClustersClicked (const QIntList &clusterIndices)
 
void slotShowThumbnailsChanged ()
 
void slotRequestLazyReclustering ()
 Request reclustering, repeated calls should generate only one actual update of the clusters. More...
 
void slotLazyReclusteringRequestCallBack ()
 Helper function to buffer reclustering. More...
 
void slotItemDisplaySettingsChanged ()
 
void slotUngroupedModelChanged ()
 
void slotNewSelectionFromMap (const Digikam::GeoCoordinates::Pair &sel)
 

Detailed Description

The central map view class of geolocation interface.

The MapWidget class is the central widget of geolocation interface. It provides a widget which can display maps using either the Marble or Google Maps backend. Using a model, items can be displayed on the map. For models containing only a small number of items, the items can be shown directly, but for models with a larger number of items, the items can also be grouped. Currently, any number of ungrouped models can be shown, but only one grouped model. Item selection models can also be used along with the models, to interact with the selection states of the items on the map. In order to use a model with geolocation interface, however, a model helper has to be implemented, which extracts data from the model that is not provided by the Qt part of a model's API.

Now, a brief introduction on how to get geolocation interface working is provided:

  • First, an instance of MapWidget has to be created.
  • Next, GeoModelHelper has to be subclassed and at least the pure virtual functions have to be implemented.
  • To show the model's data ungrouped, the model helper has to be added to MapWidget instance using addUngroupedModel.
  • To show the model's data grouped, an instance of AbstractMarkerTiler has to be created and the model helper has to be set to it using setMarkerGeoModelHelper. The AbstractMarkerTiler has then to be given to MapWidget using setGroupedModel. If the items to be displayed do not reside in a model, a subclass of AbstractMarkerTiler can be created which returns just the number of items in a particular area, and picks representative items for thumbnails.
  • To handle dropping of items from the host applications UI onto the map, DragDropHandler has to be subclassed as well and added to the model using setDragDropHandler.
  • Finally, setActive() has to be called to tell the widget that it should start displaying things.

Constructor & Destructor Documentation

◆ MapWidget()

Digikam::MapWidget::MapWidget ( QWidget *const  parent = nullptr)
explicit

◆ ~MapWidget()

Digikam::MapWidget::~MapWidget ( )
override

Member Function Documentation

◆ addUngroupedModel()

◆ addWidgetToControlWidget()

void Digikam::MapWidget::addWidgetToControlWidget ( QWidget *const  newWidget)

References getControlWidget().

◆ adjustBoundariesToGroupedMarkers()

void Digikam::MapWidget::adjustBoundariesToGroupedMarkers ( const bool  useSaneZoomLevel = true)

Adjusts the visible map area such that all grouped markers are visible.

Note that a call to this function currently has no effect if the widget has been set inactive via setActive() or the backend is not yet ready.

Parameters
useSaneZoomLevelStop zooming at a sane level, if markers are too close together.

References Digikam::AbstractMarkerTiler::NonEmptyIterator::atEnd(), currentBackendReady(), Digikam::GeoCoordinates::lat(), Digikam::GeoCoordinates::lon(), Digikam::TileIndex::MaxLevel, and Digikam::TileIndex::toCoordinates().

◆ applyCacheToBackend()

void Digikam::MapWidget::applyCacheToBackend ( )
protected

◆ availableBackends()

QStringList Digikam::MapWidget::availableBackends ( ) const

◆ clearRegionSelection()

void Digikam::MapWidget::clearRegionSelection ( )

◆ convertZoomToBackendZoom()

QString Digikam::MapWidget::convertZoomToBackendZoom ( const QString &  someZoom,
const QString &  targetBackend 
) const

References GEOIFACE_ASSERT.

◆ createActions()

◆ createActionsForBackendSelection()

void Digikam::MapWidget::createActionsForBackendSelection ( )
protected

Referenced by createActions(), and MapWidget().

◆ currentBackendReady()

◆ dragEnterEvent()

void Digikam::MapWidget::dragEnterEvent ( QDragEnterEvent *  event)
overrideprotected

◆ dragLeaveEvent()

void Digikam::MapWidget::dragLeaveEvent ( QDragLeaveEvent *  event)
overrideprotected

◆ dragMoveEvent()

void Digikam::MapWidget::dragMoveEvent ( QDragMoveEvent *  event)
overrideprotected

◆ dropEvent()

void Digikam::MapWidget::dropEvent ( QDropEvent *  event)
overrideprotected

◆ getActiveState()

bool Digikam::MapWidget::getActiveState ( )

◆ getCenter()

GeoCoordinates Digikam::MapWidget::getCenter ( ) const

◆ getClusterRepresentativeMarker()

QVariant Digikam::MapWidget::getClusterRepresentativeMarker ( const int  clusterIndex,
const int  sortKey 
)

◆ getColorInfos() [1/2]

void Digikam::MapWidget::getColorInfos ( const GeoGroupState  groupState,
const int  nMarkers,
QColor *  fillColor,
QColor *  strokeColor,
Qt::PenStyle *  strokeStyle,
QString *  labelText,
QColor *  labelColor 
) const

◆ getColorInfos() [2/2]

void Digikam::MapWidget::getColorInfos ( const int  clusterIndex,
QColor *  fillColor,
QColor *  strokeColor,
Qt::PenStyle *  strokeStyle,
QString *  labelText,
QColor *  labelColor,
const GeoGroupState *const  overrideSelection = nullptr,
const int *const  overrideCount = nullptr 
) const

Return color and style information for rendering the cluster.

Parameters
clusterIndexIndex of the cluster
fillColorColor used to fill the circle
strokeColorColor used for the stroke around the circle
strokeStyleStyle used to draw the stroke around the circle
labelTextText for the label
labelColorColor for the label text
overrideSelectionGet the colors for a different selection state
overrideCountGet the colors for a different amount of markers

References Digikam::GeoIfaceCluster::groupState, and Digikam::GeoIfaceCluster::markerCount.

Referenced by getDecoratedPixmapForCluster().

◆ getControlAction()

QAction * Digikam::MapWidget::getControlAction ( const QString &  actionName)

◆ getControlWidget()

QWidget * Digikam::MapWidget::getControlWidget ( )

Returns the control widget.

References rebuildConfigurationMenu(), setVisibleExtraActions(), and setVisibleMouseModes().

Referenced by addWidgetToControlWidget().

◆ getDecoratedPixmapForCluster()

◆ getRegionSelection()

GeoCoordinates::Pair Digikam::MapWidget::getRegionSelection ( )

◆ getStickyModeState()

bool Digikam::MapWidget::getStickyModeState ( ) const

◆ getThumbnailSize()

int Digikam::MapWidget::getThumbnailSize ( ) const

◆ getUndecoratedThumbnailSize()

int Digikam::MapWidget::getUndecoratedThumbnailSize ( ) const

◆ getZoom()

QString Digikam::MapWidget::getZoom ( )

◆ MarbleWidgetVersion()

QString Digikam::MapWidget::MarbleWidgetVersion ( )
static

Return a string version of LibMarbleWidget release in format "major.minor.patch"

Referenced by Digikam::LibsInfoDlg::LibsInfoDlg().

◆ markClustersAsDirty()

void Digikam::MapWidget::markClustersAsDirty ( )

Referenced by slotBackendReadyChanged().

◆ readSettingsFromGroup()

◆ rebuildConfigurationMenu()

void Digikam::MapWidget::rebuildConfigurationMenu ( )
protected

◆ refreshMap()

void Digikam::MapWidget::refreshMap ( )

◆ removeMapWidgetFromFrame()

void Digikam::MapWidget::removeMapWidgetFromFrame ( )
protected

Referenced by setBackend().

◆ removeUngroupedModel()

◆ saveBackendToCache()

void Digikam::MapWidget::saveBackendToCache ( )
protected

References currentBackendReady(), getCenter(), and getZoom().

Referenced by setBackend().

◆ saveSettingsToGroup()

void Digikam::MapWidget::saveSettingsToGroup ( KConfigGroup *const  group)

◆ setActive()

void Digikam::MapWidget::setActive ( const bool  state)

◆ setAllowModifications()

void Digikam::MapWidget::setAllowModifications ( const bool  state)

◆ setAvailableMouseModes()

void Digikam::MapWidget::setAvailableMouseModes ( const GeoMouseModes  mouseModes)

◆ setBackend()

◆ setCenter()

void Digikam::MapWidget::setCenter ( const GeoCoordinates coordinate)

References currentBackendReady().

Referenced by applyCacheToBackend().

◆ setDragDropHandler()

void Digikam::MapWidget::setDragDropHandler ( GeoDragDropHandler *const  dragDropHandler)

◆ setEnabledExtraActions()

void Digikam::MapWidget::setEnabledExtraActions ( const GeoExtraActions  actions)

◆ setGroupedModel()

void Digikam::MapWidget::setGroupedModel ( AbstractMarkerTiler *const  markerModel)

◆ setMapWidgetInFrame()

void Digikam::MapWidget::setMapWidgetInFrame ( QWidget *const  widgetForFrame)
protected

Set widgetForFrame as the widget in the frame, but does not show it.

Referenced by setActive(), and setBackend().

◆ setMarkerGroupingRadius()

void Digikam::MapWidget::setMarkerGroupingRadius ( const int  newGroupingRadius)

◆ setMouseMode()

void Digikam::MapWidget::setMouseMode ( const GeoMouseModes  mouseMode)

◆ setRegionSelection()

void Digikam::MapWidget::setRegionSelection ( const GeoCoordinates::Pair region)

◆ setShowPlaceholderWidget()

void Digikam::MapWidget::setShowPlaceholderWidget ( const bool  state)
protected

◆ setShowThumbnails()

void Digikam::MapWidget::setShowThumbnails ( const bool  state)

◆ setSortKey()

void Digikam::MapWidget::setSortKey ( const int  sortKey)

◆ setSortOptionsMenu()

void Digikam::MapWidget::setSortOptionsMenu ( QMenu *const  sortMenu)

◆ setStickyModeState()

void Digikam::MapWidget::setStickyModeState ( const bool  state)

◆ setThumbnailGroupingRadius()

void Digikam::MapWidget::setThumbnailGroupingRadius ( const int  newGroupingRadius)

◆ setThumnailSize()

void Digikam::MapWidget::setThumnailSize ( const int  newThumbnailSize)

◆ setTrackManager()

void Digikam::MapWidget::setTrackManager ( TrackManager *const  trackManager)

◆ setVisibleExtraActions()

void Digikam::MapWidget::setVisibleExtraActions ( const GeoExtraActions  actions)

◆ setVisibleMouseModes()

◆ setZoom()

void Digikam::MapWidget::setZoom ( const QString &  newZoom)

References currentBackendReady().

Referenced by applyCacheToBackend().

◆ signalMouseModeChanged

void Digikam::MapWidget::signalMouseModeChanged ( const Digikam::GeoMouseModes &  currentMouseMode)
signal

Referenced by slotMouseModeChanged().

◆ signalRegionSelectionChanged

void Digikam::MapWidget::signalRegionSelectionChanged ( )
signal

◆ signalRemoveCurrentFilter

void Digikam::MapWidget::signalRemoveCurrentFilter ( )
signal

Referenced by createActions().

◆ signalStickyModeChanged

void Digikam::MapWidget::signalStickyModeChanged ( )
signal

Referenced by slotStickyModeChanged().

◆ signalUngroupedModelChanged

void Digikam::MapWidget::signalUngroupedModelChanged ( const int  index)
signal

◆ slotBackendReadyChanged

void Digikam::MapWidget::slotBackendReadyChanged ( const QString &  backendName)
protectedslot

◆ slotBackendZoomChanged

void Digikam::MapWidget::slotBackendZoomChanged ( const QString &  newZoom)
protectedslot

Referenced by setBackend().

◆ slotChangeBackend

void Digikam::MapWidget::slotChangeBackend ( QAction *  action)
protectedslot

References GEOIFACE_ASSERT, and setBackend().

Referenced by createActions().

◆ slotClustersClicked

◆ slotClustersMoved

void Digikam::MapWidget::slotClustersMoved ( const QIntList clusterIndices,
const QPair< int, QModelIndex > &  snapTarget 
)
protectedslot

◆ slotClustersNeedUpdating

void Digikam::MapWidget::slotClustersNeedUpdating ( )
slot

◆ slotDecreaseThumbnailSize

void Digikam::MapWidget::slotDecreaseThumbnailSize ( )
slot

◆ slotIncreaseThumbnailSize

void Digikam::MapWidget::slotIncreaseThumbnailSize ( )
slot

References setThumnailSize().

Referenced by createActions().

◆ slotItemDisplaySettingsChanged

void Digikam::MapWidget::slotItemDisplaySettingsChanged ( )
protectedslot

References slotRequestLazyReclustering().

Referenced by createActions().

◆ slotLazyReclusteringRequestCallBack

void Digikam::MapWidget::slotLazyReclusteringRequestCallBack ( )
protectedslot

Helper function to buffer reclustering.

References slotClustersNeedUpdating().

Referenced by slotRequestLazyReclustering().

◆ slotMouseModeChanged

void Digikam::MapWidget::slotMouseModeChanged ( QAction *  triggeredAction)
protectedslot

References signalMouseModeChanged().

Referenced by createActions().

◆ slotNewSelectionFromMap

void Digikam::MapWidget::slotNewSelectionFromMap ( const Digikam::GeoCoordinates::Pair sel)
protectedslot

◆ slotRemoveCurrentRegionSelection

void Digikam::MapWidget::slotRemoveCurrentRegionSelection ( )
protectedslot

◆ slotRequestLazyReclustering

void Digikam::MapWidget::slotRequestLazyReclustering ( )
protectedslot

◆ slotShowThumbnailsChanged

void Digikam::MapWidget::slotShowThumbnailsChanged ( )
protectedslot

References setShowThumbnails().

Referenced by createActions().

◆ slotStickyModeChanged

void Digikam::MapWidget::slotStickyModeChanged ( )
slot

◆ slotUngroupedModelChanged

void Digikam::MapWidget::slotUngroupedModelChanged ( )
protectedslot

◆ slotUpdateActionsEnabled

◆ slotZoomIn

void Digikam::MapWidget::slotZoomIn ( )
slot

References currentBackendReady().

Referenced by createActions().

◆ slotZoomOut

void Digikam::MapWidget::slotZoomOut ( )
slot

References currentBackendReady().

Referenced by createActions().

◆ stopThumbnailTimer

void Digikam::MapWidget::stopThumbnailTimer ( )
slot

Referenced by slotBackendReadyChanged().

◆ updateClusters()

void Digikam::MapWidget::updateClusters ( )

◆ updateMarkers()

void Digikam::MapWidget::updateMarkers ( )

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