iVS3D v2.0.9
Loading...
Searching...
No Matches
geomap.h
1#ifndef IVS3D_GEOMAPPLUGIN_H
2#define IVS3D_GEOMAPPLUGIN_H
3
4// Std
5#include <cmath>
6#include <algorithm>
7#include <memory>
8
9// Qt
10#include <QCoreApplication>
11#include <QLabel>
12#include <QLayout>
13#include <QMap>
14#include <QObject>
15#include <QPointer>
16#include <QPushButton>
17#include <QTranslator>
18#include <QVBoxLayout>
19#include <QWidget>
20
21// iVS3D-core
22#include "metadata.h"
23
24// iVS3D-pluginInterface
25#include "ibase.h"
26#include "iselection.h"
27
28#include "maphandler.h"
29
30#define DESCRIPTION_STYLE "color: rgb(58, 58, 58); border-left: 6px solid rgb(58, 58, 58); " \
31 "border-top-right-radius: 5px; border-bottom-right-radius: 5px; " \
32 "background-color: lightblue;"
33
34#define NAME_Polygon "Polygon"
51class GeoMap : public PLUG::IBase, public PLUG::ISelection
52{
53 Q_OBJECT
54
55 // implement interface as plugin, use the iid as identifier
56 Q_PLUGIN_METADATA(IID "iVS3D.IBase")
57
58 // declare this as implementation of IBase and ISelection interfaces
59 Q_INTERFACES(PLUG::IBase PLUG::ISelection)
60
61 //--- METHOD DECLARATION ---//
62
63 public:
69 GeoMap();
70
74 ~GeoMap() override = default;
75
84
89 QString getName() const override;
90
91 QMap<QString, QVariant> getSettings() const override;
93 const QMap<QString, QVariant>& settings) override;
96 const PLUG::InputMetaData& inputMetaData) override;
98 const std::vector<uint>& selectedImages) override;
99 void onIndexChanged(uint index) override;
100
101 PLUG::SelectionResult selectImages(const PLUG::SelectionData& data,
102 volatile bool& cancelFlag) override;
103
104 signals:
105 void syncMapData(const GpsDataList& gpsData, const QPolygonF& polygon);
106 void syncMapPointUpdates(const GpsPointStateList& changedGpsData,
107 const QPolygonF& polygon);
108 void syncMapPolygon(const QPolygonF& polygon);
109 void syncCurrentIndex(uint index);
110 void syncPartialSelectionMode(bool enabled);
111
112 public slots:
113
119 void onGpsClicked(QPointF gpsPoint, bool used);
120
125 void onGpsSelected(QPolygonF polyF);
126
127
128 private:
129 std::unique_ptr<QWidget> createSettingsWidget();
130 void loadPersistentSettings();
131 void savePersistentSettings() const;
132
133 void readMetaData(MetaData* metaData);
135 std::vector<unsigned int> getKeyframesFromGps() const;
137 std::vector<unsigned int> getFramesInsidePolygon() const;
138
139 QPointF gpsHashToLatLong(const QVariant& hash, bool* ok = nullptr) const;
140 QGeoCoordinate gpsHashtoGeoCo(const QVariant& hash) const;
141
142 double distanceBetweenPoints(int first, int second) const;
143 double greatCircleDistance(QPointF first, QPointF second) const;
144 //--- MEMBER DECLARATION ---//
145
146 private:
147 Reader* mReader = nullptr;
148
150 QList<QVariant> mMetaData;
151
153 QList<QPair<QPointF, bool>> mGpsData;
154
155 QPolygonF mPolygon;
156
158 bool mIsGpsAvailable = false;
159 bool mPartialSelectionEnabled = GEOMAP_ENABLE_PARTIAL_SELECTION != 0;
160};
161
162#endif // IVS3D_GEOMAPPLUGIN_H
The GeoMapPlugin allows the user to select the images, which are to be used for the 3D reconstruction...
Definition geomap.h:52
void onGpsClicked(QPointF gpsPoint, bool used)
onGpsClicked slot triggered when gps point on the map is clicked
Definition geomap.cpp:244
std::vector< unsigned int > getKeyframesFromGps() const
these are the localy stored keyframes
Definition geomap.cpp:441
void onGpsSelected(QPolygonF polyF)
onGpsSelected Slot is triggered when a new user selcted polyogn is created
Definition geomap.cpp:264
void onIndexChanged(uint index) override
onIndexChanged is called when the currently displayed frame index changes in the viewer.
Definition geomap.cpp:271
bool mIsGpsAvailable
Flag indicating if GPS data is available.
Definition geomap.h:158
std::vector< unsigned int > getFramesInsidePolygon() const
these are all frames inside the user created polygon
Definition geomap.cpp:451
PLUG::SelectionResult selectImages(const PLUG::SelectionData &data, volatile bool &cancelFlag) override
Selects images based on the provided selection data.
Definition geomap.cpp:206
PLUG::SettingsWidgetResult getSettingsWidget() override
getSettingsWidget is provides an QWidget to display plugin specific settings to the user....
Definition geomap.cpp:48
QString getName() const override
getName returns the display name for the plugin. This name is presented to the user.
Definition geomap.cpp:58
GeoMap()
Construct and initialize plugin with default parameterization.
Definition geomap.cpp:35
PLUG::MetaDataLoadedResult onMetaDataLoaded(const PLUG::InputMetaData &inputMetaData) override
onMetaDataLoaded is called whenever metadata was loaded or refreshed for the currently active input.
Definition geomap.cpp:95
QList< QPair< QPointF, bool > > mGpsData
List of GPS data associated with the images.
Definition geomap.h:153
~GeoMap() override=default
Destroy object of GeoMapPlugin.
QList< QVariant > mMetaData
List of available meta data.
Definition geomap.h:150
QMap< QString, QVariant > getSettings() const override
getSettings retrieves the current settings of the plugin as a map of key-value pairs....
Definition geomap.cpp:60
void onSelectedImagesChanged(const std::vector< uint > &selectedImages) override
onSelectedImagesChanged is called when the current keyframe / selected-image list changed.
Definition geomap.cpp:108
PLUG::InputLoadedResult onInputLoaded(const PLUG::InputData &input) override
onInputLoaded is called when a new input video or image set is loaded.
Definition geomap.cpp:84
PLUG::ApplySettingsResult applySettings(const QMap< QString, QVariant > &settings) override
applySettings applies the provided settings to the plugin. This method is used to restore plugin conf...
Definition geomap.cpp:66
Interface to give plugins access to all parsed and loaded meta data.
Definition metadata.h:20
The IBase interface provides a base class for all plugin interfaces in iVS3D. It inherits from QObjec...
Definition ibase.h:102
Interface for keyframe/image-selection plugins in iVS3D.
Definition iselection.h:53
The Reader interface defines functions which are used for reading and parsing the import.
Definition reader.h:23
tl::expected< void, Error > InputLoadedResult
Type alias for the result of handling an input loaded event, which can be either a successful void re...
Definition ibase.h:58
tl::expected< void, Error > ApplySettingsResult
Type alias for the result of applying settings to a plugin, which can be either a successful void res...
Definition ibase.h:51
tl::expected< std::unique_ptr< QWidget >, Error > SettingsWidgetResult
Type alias for the result of a settings widget creation operation, which can be either a successful u...
Definition ibase.h:44
tl::expected< void, Error > MetaDataLoadedResult
Type alias for the result of handling a metadata-loaded event, either success (void) or an Error.
Definition ibase.h:65
Struct to encapsulate data related to the input loaded event in iVS3D.
Definition ibase.h:71
Struct containing metadata context that has been loaded for the currently opened input.
Definition ibase.h:80
Data available for image selection in ISelection plugins.
Definition iselection.h:31