digiKam
|
The central map view class of geolocation interface. More...
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 ®ion) |
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 ¤tMouseMode) |
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) |
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:
MapWidget
has to be created. GeoModelHelper
has to be subclassed and at least the pure virtual functions have to be implemented. MapWidget
instance using addUngroupedModel. 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. DragDropHandler
has to be subclassed as well and added to the model using setDragDropHandler.
|
explicit |
References createActions(), and createActionsForBackendSelection().
|
override |
void Digikam::MapWidget::addUngroupedModel | ( | GeoModelHelper *const | modelHelper | ) |
void Digikam::MapWidget::addWidgetToControlWidget | ( | QWidget *const | newWidget | ) |
References getControlWidget().
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.
useSaneZoomLevel | Stop 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().
|
protected |
References currentBackendReady(), setCenter(), and setZoom().
Referenced by readSettingsFromGroup(), and slotBackendReadyChanged().
QStringList Digikam::MapWidget::availableBackends | ( | ) | const |
References Digikam::MapBackend::backendName().
void Digikam::MapWidget::clearRegionSelection | ( | ) |
References slotUpdateActionsEnabled().
Referenced by slotRemoveCurrentRegionSelection().
QString Digikam::MapWidget::convertZoomToBackendZoom | ( | const QString & | someZoom, |
const QString & | targetBackend | ||
) | const |
References GEOIFACE_ASSERT.
|
protected |
References createActionsForBackendSelection(), Digikam::MouseModeFilter, Digikam::MouseModePan, Digikam::MouseModeRegionSelection, Digikam::MouseModeRegionSelectionFromIcon, Digikam::MouseModeSelectThumbnail, Digikam::MouseModeZoomIntoGroup, signalRemoveCurrentFilter(), slotChangeBackend(), slotDecreaseThumbnailSize(), slotIncreaseThumbnailSize(), slotItemDisplaySettingsChanged(), slotMouseModeChanged(), slotRemoveCurrentRegionSelection(), slotShowThumbnailsChanged(), slotStickyModeChanged(), slotZoomIn(), and slotZoomOut().
Referenced by MapWidget().
|
protected |
Referenced by createActions(), and MapWidget().
|
protected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
bool Digikam::MapWidget::getActiveState | ( | ) |
GeoCoordinates Digikam::MapWidget::getCenter | ( | ) | const |
References currentBackendReady().
Referenced by saveBackendToCache(), and saveSettingsToGroup().
QVariant Digikam::MapWidget::getClusterRepresentativeMarker | ( | const int | clusterIndex, |
const int | sortKey | ||
) |
References Digikam::GeoIfaceCluster::representativeMarkers, and Digikam::GeoIfaceCluster::tileIndicesList.
Referenced by getDecoratedPixmapForCluster(), and slotClustersClicked().
void Digikam::MapWidget::getColorInfos | ( | const GeoGroupState | groupState, |
const int | nMarkers, | ||
QColor * | fillColor, | ||
QColor * | strokeColor, | ||
Qt::PenStyle * | strokeStyle, | ||
QString * | labelText, | ||
QColor * | labelColor | ||
) | const |
References Digikam::SelectedAll, Digikam::SelectedMask, Digikam::SelectedNone, and Digikam::SelectedSome.
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.
clusterIndex | Index of the cluster |
fillColor | Color used to fill the circle |
strokeColor | Color used for the stroke around the circle |
strokeStyle | Style used to draw the stroke around the circle |
labelText | Text for the label |
labelColor | Color for the label text |
overrideSelection | Get the colors for a different selection state |
overrideCount | Get the colors for a different amount of markers |
References Digikam::GeoIfaceCluster::groupState, and Digikam::GeoIfaceCluster::markerCount.
Referenced by getDecoratedPixmapForCluster().
QAction * Digikam::MapWidget::getControlAction | ( | const QString & | actionName | ) |
QWidget * Digikam::MapWidget::getControlWidget | ( | ) |
Returns the control widget.
References rebuildConfigurationMenu(), setVisibleExtraActions(), and setVisibleMouseModes().
Referenced by addWidgetToControlWidget().
QPixmap Digikam::MapWidget::getDecoratedPixmapForCluster | ( | const int | clusterId, |
const GeoGroupState *const | selectedStateOverride, | ||
const int *const | countOverride, | ||
QPoint *const | centerPoint | ||
) |
References Digikam::FilteredPositiveMask, Digikam::FilteredPositiveNone, getClusterRepresentativeMarker(), getColorInfos(), Digikam::GeoIfaceGlobalObject::getMarkerPixmap(), getUndecoratedThumbnailSize(), Digikam::GeoIfaceCluster::groupState, Digikam::GeoIfaceGlobalObject::instance(), Digikam::GeoIfaceCluster::markerCount, Digikam::GeoIfaceCluster::PixmapCircle, Digikam::GeoIfaceCluster::PixmapImage, Digikam::GeoIfaceCluster::PixmapMarker, Digikam::GeoIfaceCluster::pixmapOffset, Digikam::GeoIfaceCluster::pixmapSize, Digikam::GeoIfaceCluster::pixmapType, Digikam::RegionSelectedMask, Digikam::RegionSelectedNone, Digikam::SelectedAll, Digikam::SelectedMask, and Digikam::SelectedSome.
GeoCoordinates::Pair Digikam::MapWidget::getRegionSelection | ( | ) |
bool Digikam::MapWidget::getStickyModeState | ( | ) | const |
int Digikam::MapWidget::getThumbnailSize | ( | ) | const |
int Digikam::MapWidget::getUndecoratedThumbnailSize | ( | ) | const |
Referenced by getDecoratedPixmapForCluster().
QString Digikam::MapWidget::getZoom | ( | ) |
References currentBackendReady().
Referenced by saveBackendToCache(), and saveSettingsToGroup().
|
static |
Return a string version of LibMarbleWidget release in format "major.minor.patch"
Referenced by Digikam::LibsInfoDlg::LibsInfoDlg().
void Digikam::MapWidget::markClustersAsDirty | ( | ) |
Referenced by slotBackendReadyChanged().
void Digikam::MapWidget::readSettingsFromGroup | ( | const KConfigGroup *const | group | ) |
References applyCacheToBackend(), Digikam::GeoCoordinates::fromGeoUrl(), GEOIFACE_ASSERT, Digikam::GeoIfaceMinMarkerGroupingRadius, Digikam::GeoIfaceMinThumbnailGroupingRadius, Digikam::GeoIfaceMinThumbnailSize, Digikam::GeoCoordinates::geoUrl(), setBackend(), setMarkerGroupingRadius(), setThumbnailGroupingRadius(), setThumnailSize(), and slotUpdateActionsEnabled().
|
protected |
References currentBackendReady(), and slotUpdateActionsEnabled().
Referenced by getControlWidget(), setActive(), setBackend(), setShowThumbnails(), setSortOptionsMenu(), and slotBackendReadyChanged().
void Digikam::MapWidget::refreshMap | ( | ) |
References slotRequestLazyReclustering().
|
protected |
Referenced by setBackend().
void Digikam::MapWidget::removeUngroupedModel | ( | GeoModelHelper *const | modelHelper | ) |
|
protected |
References currentBackendReady(), getCenter(), and getZoom().
Referenced by setBackend().
void Digikam::MapWidget::saveSettingsToGroup | ( | KConfigGroup *const | group | ) |
References Digikam::ExtraActionSticky, GEOIFACE_ASSERT, getCenter(), and getZoom().
void Digikam::MapWidget::setActive | ( | const bool | state | ) |
void Digikam::MapWidget::setAllowModifications | ( | const bool | state | ) |
References slotRequestLazyReclustering(), and slotUpdateActionsEnabled().
void Digikam::MapWidget::setAvailableMouseModes | ( | const GeoMouseModes | mouseModes | ) |
bool Digikam::MapWidget::setBackend | ( | const QString & | backendName | ) |
References Digikam::MapBackend::backendName(), rebuildConfigurationMenu(), removeMapWidgetFromFrame(), saveBackendToCache(), setMapWidgetInFrame(), setShowPlaceholderWidget(), Digikam::MapBackend::signalBackendReadyChanged(), Digikam::MapBackend::signalClustersClicked(), Digikam::MapBackend::signalClustersMoved(), Digikam::MapBackend::signalSelectionHasBeenMade(), signalUngroupedModelChanged(), Digikam::MapBackend::signalZoomChanged(), slotBackendReadyChanged(), slotBackendZoomChanged(), slotClustersClicked(), slotClustersMoved(), slotNewSelectionFromMap(), and slotUngroupedModelChanged().
Referenced by readSettingsFromGroup(), and slotChangeBackend().
void Digikam::MapWidget::setCenter | ( | const GeoCoordinates & | coordinate | ) |
References currentBackendReady().
Referenced by applyCacheToBackend().
void Digikam::MapWidget::setDragDropHandler | ( | GeoDragDropHandler *const | dragDropHandler | ) |
void Digikam::MapWidget::setEnabledExtraActions | ( | const GeoExtraActions | actions | ) |
References slotUpdateActionsEnabled().
void Digikam::MapWidget::setGroupedModel | ( | AbstractMarkerTiler *const | markerModel | ) |
References slotRequestLazyReclustering().
|
protected |
Set widgetForFrame
as the widget in the frame, but does not show it.
Referenced by setActive(), and setBackend().
void Digikam::MapWidget::setMarkerGroupingRadius | ( | const int | newGroupingRadius | ) |
References Digikam::GeoIfaceMinMarkerGroupingRadius, slotRequestLazyReclustering(), and slotUpdateActionsEnabled().
Referenced by readSettingsFromGroup().
void Digikam::MapWidget::setMouseMode | ( | const GeoMouseModes | mouseMode | ) |
References currentBackendReady(), and slotUpdateActionsEnabled().
void Digikam::MapWidget::setRegionSelection | ( | const GeoCoordinates::Pair & | region | ) |
References slotUpdateActionsEnabled().
|
protected |
Referenced by setBackend(), and slotBackendReadyChanged().
void Digikam::MapWidget::setShowThumbnails | ( | const bool | state | ) |
References rebuildConfigurationMenu(), slotRequestLazyReclustering(), and slotUpdateActionsEnabled().
Referenced by slotShowThumbnailsChanged().
void Digikam::MapWidget::setSortKey | ( | const int | sortKey | ) |
References slotRequestLazyReclustering().
void Digikam::MapWidget::setSortOptionsMenu | ( | QMenu *const | sortMenu | ) |
References rebuildConfigurationMenu().
Referenced by Digikam::GPSItemInfoSorter::addToMapWidget().
void Digikam::MapWidget::setStickyModeState | ( | const bool | state | ) |
References slotUpdateActionsEnabled().
void Digikam::MapWidget::setThumbnailGroupingRadius | ( | const int | newGroupingRadius | ) |
References Digikam::GeoIfaceMinThumbnailGroupingRadius, slotRequestLazyReclustering(), and slotUpdateActionsEnabled().
Referenced by readSettingsFromGroup(), and slotDecreaseThumbnailSize().
void Digikam::MapWidget::setThumnailSize | ( | const int | newThumbnailSize | ) |
References Digikam::GeoIfaceMinThumbnailSize, slotRequestLazyReclustering(), and slotUpdateActionsEnabled().
Referenced by readSettingsFromGroup(), and slotIncreaseThumbnailSize().
void Digikam::MapWidget::setTrackManager | ( | TrackManager *const | trackManager | ) |
References Digikam::MapBackend::slotTrackManagerChanged().
void Digikam::MapWidget::setVisibleExtraActions | ( | const GeoExtraActions | actions | ) |
References Digikam::ExtraActionSticky, and slotUpdateActionsEnabled().
Referenced by getControlWidget().
void Digikam::MapWidget::setVisibleMouseModes | ( | const GeoMouseModes | mouseModes | ) |
void Digikam::MapWidget::setZoom | ( | const QString & | newZoom | ) |
References currentBackendReady().
Referenced by applyCacheToBackend().
|
signal |
Referenced by slotMouseModeChanged().
|
signal |
Referenced by slotClustersClicked(), slotNewSelectionFromMap(), and slotRemoveCurrentRegionSelection().
|
signal |
Referenced by createActions().
|
signal |
Referenced by slotStickyModeChanged().
|
signal |
Referenced by addUngroupedModel(), removeUngroupedModel(), setBackend(), and slotUngroupedModelChanged().
|
protectedslot |
References applyCacheToBackend(), currentBackendReady(), markClustersAsDirty(), rebuildConfigurationMenu(), setShowPlaceholderWidget(), stopThumbnailTimer(), and updateMarkers().
Referenced by setActive(), and setBackend().
|
protectedslot |
Referenced by setBackend().
|
protectedslot |
References GEOIFACE_ASSERT, and setBackend().
Referenced by createActions().
|
protectedslot |
References Digikam::TileIndex::CornerNE, Digikam::TileIndex::CornerNW, Digikam::TileIndex::CornerSE, Digikam::TileIndex::CornerSW, Digikam::AbstractMarkerTiler::ClickInfo::currentMouseMode, getClusterRepresentativeMarker(), Digikam::AbstractMarkerTiler::ClickInfo::groupSelectionState, Digikam::GeoIfaceCluster::groupState, Digikam::GeoCoordinates::lat(), Digikam::TileIndex::level(), Digikam::GeoCoordinates::lon(), Digikam::MouseModeFilter, Digikam::MouseModeRegionSelectionFromIcon, Digikam::MouseModeSelectThumbnail, Digikam::MouseModeZoomIntoGroup, Digikam::AbstractMarkerTiler::ClickInfo::representativeIndex, signalRegionSelectionChanged(), Digikam::GeoIfaceCluster::tileIndicesList, Digikam::AbstractMarkerTiler::ClickInfo::tileIndicesList, and Digikam::TileIndex::toCoordinates().
Referenced by setBackend().
|
protectedslot |
References Digikam::SelectedNone, and Digikam::GeoIfaceCluster::tileIndicesList.
Referenced by setBackend().
|
slot |
References currentBackendReady().
Referenced by slotLazyReclusteringRequestCallBack().
|
slot |
References Digikam::GeoIfaceMinThumbnailSize, and setThumbnailGroupingRadius().
Referenced by createActions().
|
slot |
References setThumnailSize().
Referenced by createActions().
|
protectedslot |
References slotRequestLazyReclustering().
Referenced by createActions().
|
protectedslot |
Helper function to buffer reclustering.
References slotClustersNeedUpdating().
Referenced by slotRequestLazyReclustering().
|
protectedslot |
References signalMouseModeChanged().
Referenced by createActions().
|
protectedslot |
References signalRegionSelectionChanged(), and slotUpdateActionsEnabled().
Referenced by setBackend().
|
protectedslot |
References clearRegionSelection(), signalRegionSelectionChanged(), and slotUpdateActionsEnabled().
Referenced by createActions().
|
protectedslot |
Request reclustering, repeated calls should generate only one actual update of the clusters.
References slotLazyReclusteringRequestCallBack().
Referenced by refreshMap(), setActive(), setAllowModifications(), setGroupedModel(), setMarkerGroupingRadius(), setShowThumbnails(), setSortKey(), setThumbnailGroupingRadius(), setThumnailSize(), and slotItemDisplaySettingsChanged().
|
protectedslot |
References setShowThumbnails().
Referenced by createActions().
|
slot |
References signalStickyModeChanged(), and slotUpdateActionsEnabled().
Referenced by createActions().
|
protectedslot |
References signalUngroupedModelChanged().
Referenced by addUngroupedModel(), removeUngroupedModel(), and setBackend().
|
slot |
References Digikam::ExtraActionSticky, Digikam::FilteredPositiveMask, Digikam::GeoIfaceMinThumbnailSize, Digikam::GeoIfaceGlobalObject::instance(), Digikam::MouseModeFilter, Digikam::MouseModePan, Digikam::MouseModeRegionSelection, Digikam::MouseModeRegionSelectionFromIcon, Digikam::MouseModeSelectThumbnail, Digikam::MouseModeZoomIntoGroup, and Digikam::RegionSelectedMask.
Referenced by clearRegionSelection(), readSettingsFromGroup(), rebuildConfigurationMenu(), setAllowModifications(), setEnabledExtraActions(), setMarkerGroupingRadius(), setMouseMode(), setRegionSelection(), setShowThumbnails(), setStickyModeState(), setThumbnailGroupingRadius(), setThumnailSize(), setVisibleExtraActions(), slotNewSelectionFromMap(), slotRemoveCurrentRegionSelection(), and slotStickyModeChanged().
|
slot |
References currentBackendReady().
Referenced by createActions().
|
slot |
References currentBackendReady().
Referenced by createActions().
|
slot |
Referenced by slotBackendReadyChanged().
void Digikam::MapWidget::updateClusters | ( | ) |
void Digikam::MapWidget::updateMarkers | ( | ) |
References currentBackendReady().
Referenced by slotBackendReadyChanged().