Marble

RoutingInputWidget.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <[email protected]>
4 //
5 
6 #ifndef MARBLE_ROUTINGINPUTWIDGET_H
7 #define MARBLE_ROUTINGINPUTWIDGET_H
8 
9 #include "PositionProviderPluginInterface.h"
10 
11 #include <QWidget>
12 
13 class QAbstractItemModel;
14 
15 namespace Marble
16 {
17 
18 class RoutingInputWidgetPrivate;
19 class GeoDataCoordinates;
20 class GeoDataPlacemark;
21 class MarbleModel;
22 class 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 {
32  Q_OBJECT
33 
34 public:
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 
75 public 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 */
89  void abortMapInputRequest();
90 
91  /** Reload the bookmarks menu */
92  void reloadBookmarks();
93 
94 Q_SIGNALS:
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 */
108  void targetValidityChanged( bool targetValid );
109 
110 private 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 
150 private:
151  RoutingInputWidgetPrivate *const d;
152 };
153 
154 } // namespace Marble
155 
156 #endif
Q_OBJECTQ_OBJECT
A 3d point representation.
Q_SLOTSQ_SLOTS
~RoutingInputWidget() override
Destructor.
void abortMapInputRequest()
Cancel a started input request from the map.
void reloadBookmarks()
Reload the bookmarks menu.
bool hasInput() const
Returns false iff the input text is empty.
void targetValidityChanged(bool targetValid)
hasTargetPosition changed because of selecting a placemark or changing the search term
void setTargetPosition(const GeoDataCoordinates &position, const QString &name=QString())
Set the target position to the given coordinates, eliminating any previously set positions.
Combines a line edit for input and a couple of buttons to let the user type in a search term,...
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 searchFinished(RoutingInputWidget *)
All runners are finished.
GeoDataCoordinates targetPosition() const
Returns the geoposition selected by the user, or a default constructed geoposition if hasTargetPositi...
Q_SCRIPTABLE CaptureState status()
bool hasTargetPosition() const
Returns true if the user has selected a valid geo position.
void clear()
Remove target position and user input, if any.
void activityRequest(RoutingInputWidget *)
User requests to activate this widget.
Binds a QML item to a specific geodetic location in screen coordinates.
void findPlacemarks()
Search for placemarks matching the current input text.
a class representing a point of interest on the map
RoutingInputWidget(MarbleModel *model, int index, QWidget *parent=nullptr)
Constructor.
Q_SIGNALSQ_SIGNALS
MarblePlacemarkModel * searchResultModel()
Returns the placemark model that contains search results.
This class represents a model of all place marks which are currently available through a given Placem...
void removalRequest(RoutingInputWidget *)
User requests to remove this widget.
QObject * parent() const const
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:86
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.