Marble

RoutingInputWidget.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_ROUTINGINPUTWIDGET_H
7#define MARBLE_ROUTINGINPUTWIDGET_H
8
9#include "PositionProviderPluginInterface.h"
10
11#include <QWidget>
12
14
15namespace Marble
16{
17
18class RoutingInputWidgetPrivate;
19class GeoDataCoordinates;
20class GeoDataPlacemark;
21class MarbleModel;
22class MarblePlacemarkModel;
23
24/**
25 * Combines a line edit for input and a couple of buttons to let
26 * the user type in a search term, find according placemarks using
27 * the marble runner manager and store one of them as the current
28 * selection (target position)
29 */
31{
33
34public:
35
36 /** Constructor */
37 explicit RoutingInputWidget( MarbleModel* model, int index, QWidget *parent = nullptr );
38
39 /** Destructor */
40 ~RoutingInputWidget() override;
41
42 /**
43 * Returns true if the user has selected a valid geo position
44 * @see targetPosition
45 */
46 bool hasTargetPosition() const;
47
48 /**
49 * Returns the geoposition selected by the user, or a default
50 * constructed geoposition if hasTargetPosition returns false
51 * @see hasTargetPosition selectPlacemark
52 */
54
55 /**
56 * Returns the placemark model that contains search results
57 */
59
60 /**
61 * Returns false iff the input text is empty
62 */
63 bool hasInput() const;
64
65 /**
66 * Change the data index in the route request model
67 */
68 void setIndex( int index );
69
70 /**
71 * Remove target position and user input, if any
72 */
73 void clear();
74
75public Q_SLOTS:
76 /**
77 * Search for placemarks matching the current input text. Does nothing
78 * if input is empty
79 */
80 void findPlacemarks();
81
82 /** Set the target position to the given coordinates,
83 * eliminating any previously set positions
84 * @see selectPlacemark hasTargetPosition
85 */
86 void setTargetPosition( const GeoDataCoordinates &position, const QString &name = QString() );
87
88 /** Cancel a started input request from the map */
90
91 /** Reload the bookmarks menu */
92 void reloadBookmarks();
93
95 /** All runners are finished */
97
98 /** User requests to remove this widget */
100
101 /** User requests to activate this widget */
103
104 /** User requests position input from the map */
106
107 /** hasTargetPosition changed because of selecting a placemark or changing the search term */
109
110private Q_SLOTS:
111 /** Runner progress */
112 void setPlacemarkModel( QAbstractItemModel * );
113
114 /** Handle click on the goto target button */
115 void requestActivity();
116
117 /** Handle click on the remove widget button */
118 void requestRemoval();
119
120 /** Handle click on the map input button */
121 void setMapInputModeEnabled( bool enabled );
122
123 /** All runners have completed */
124 void finishSearch();
125
126 /** Mark ourselves dirty (no target) */
127 void setInvalid();
128
129 /** Set the target position (dragging) */
130 void updatePosition( int index, const GeoDataCoordinates &position );
131
132 void reverseGeocoding();
133
134 void retrieveReverseGeocodingResult( const GeoDataCoordinates &coordinates, const GeoDataPlacemark &placemark );
135
136 void setHomePosition();
137
138 void setCurrentLocation();
139
140 void updateCurrentLocationButton( PositionProviderStatus status );
141
142 void updateCenterButton( bool hasPosition );
143
144 void setBookmarkPosition( QAction* bookmark );
145
146 void openTargetSelectionDialog();
147
148 void showMenu();
149
150private:
151 RoutingInputWidgetPrivate *const d;
152};
153
154} // namespace Marble
155
156#endif
A 3d point representation.
a class representing a point of interest on the map
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition MarbleModel.h:87
This class represents a model of all place marks which are currently available through a given Placem...
Combines a line edit for input and a couple of buttons to let the user type in a search term,...
void reloadBookmarks()
Reload the bookmarks menu.
void targetValidityChanged(bool targetValid)
hasTargetPosition changed because of selecting a placemark or changing the search term
void removalRequest(RoutingInputWidget *)
User requests to remove this widget.
void clear()
Remove target position and user input, if any.
void searchFinished(RoutingInputWidget *)
All runners are finished.
GeoDataCoordinates targetPosition() const
Returns the geoposition selected by the user, or a default constructed geoposition if hasTargetPositi...
bool hasTargetPosition() const
Returns true if the user has selected a valid geo position.
void abortMapInputRequest()
Cancel a started input request from the map.
void setTargetPosition(const GeoDataCoordinates &position, const QString &name=QString())
Set the target position to the given coordinates, eliminating any previously set positions.
MarblePlacemarkModel * searchResultModel()
Returns the placemark model that contains search results.
void findPlacemarks()
Search for placemarks matching the current input text.
void mapInputModeEnabled(RoutingInputWidget *, bool enabled)
User requests position input from the map.
void setIndex(int index)
Change the data index in the route request model.
void activityRequest(RoutingInputWidget *)
User requests to activate this widget.
bool hasInput() const
Returns false iff the input text is empty.
~RoutingInputWidget() override
Destructor.
RoutingInputWidget(MarbleModel *model, int index, QWidget *parent=nullptr)
Constructor.
Q_SCRIPTABLE CaptureState status()
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.