digiKam
Loading...
Searching...
No Matches
gpsitemcontainer.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2010-03-21
7 * Description : A container to hold GPS information about an item.
8 *
9 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2010-2014 by Michael G. Hansen <mike at mghansen dot de>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QVariant>
21#include <QDateTime>
22#include <QUrl>
23
24// Local includes
25
26#include "geoifacetypes.h"
27#include "digikam_export.h"
28#include "gpsdatacontainer.h"
29#include "metadatainfo.h"
30#include "rginfo.h"
31
32namespace Digikam
33{
34
35enum Type
36{
39 TypeNewChild = 4
40};
41
42typedef struct TagData
43{
44 TagData() = default;
45
46 QString tagName;
47 QString tipName;
49
50} TagData;
51
52// --------------------------------------------------------------------------
53
55{
56public:
57
58 SaveProperties() = default;
59
63 bool shouldWriteAltitude = false;
64 qreal altitude = 0.0;
65 qreal latitude = 0.0;
66 qreal longitude = 0.0;
67};
68
69// --------------------------------------------------------------------------
70
71class GPSItemModel;
72class DMetadata;
73
74class DIGIKAM_EXPORT GPSItemContainer
75{
76public:
77
78 static const int RoleCoordinates = Qt::UserRole + 1;
79
80 static const int ColumnThumbnail = 0;
81 static const int ColumnFilename = 1;
82 static const int ColumnDateTime = 2;
83 static const int ColumnLatitude = 3;
84 static const int ColumnLongitude = 4;
85 static const int ColumnAltitude = 5;
86 static const int ColumnAccuracy = 6;
87 static const int ColumnTags = 7;
88 static const int ColumnStatus = 8;
89 static const int ColumnDOP = 9;
90 static const int ColumnFixType = 10;
91 static const int ColumnNSatellites = 11;
92 static const int ColumnSpeed = 12;
93
94 static const int ColumnGPSItemContainerCount = 13;
95
96public:
97
98 explicit GPSItemContainer(const QUrl& url);
99 virtual ~GPSItemContainer() = default;
100
102
103 virtual QString saveChanges();
104 virtual bool loadImageData();
106
107 bool isDirty() const;
108 QUrl url() const;
109 QDateTime dateTime() const;
110
112
113 static void setHeaderData(GPSItemModel* const model);
114 bool lessThan(const GPSItemContainer* const otherItem, const int column) const;
116
118
119 void setCoordinates(const GeoCoordinates& newCoordinates);
120 GeoCoordinates coordinates() const;
121 GPSDataContainer gpsData() const;
122 void setGPSData(const GPSDataContainer& container);
123 void restoreGPSData(const GPSDataContainer& container);
125
127
128
132 void setTagList(const QList<QList<TagData> >& externalTagList);
133
137 bool isTagListDirty() const;
138
142 QList<QList<TagData> > getTagList() const;
143
147 void restoreRGTagList(const QList<QList<TagData> >& tagList);
148
152 void writeTagsToXmp(const bool writeXmpTags) { m_writeXmpTags = writeXmpTags; }
153
157 void writeLocations(const bool writeMetaLoc) { m_writeMetaLoc = writeMetaLoc; }
159
160protected:
161
162 void setLocationInfo(const TagData& tagData, IptcCoreLocationInfo& locationInfo);
163
164protected:
165
167 QVariant data(const int column, const int role) const;
168 void setModel(GPSItemModel* const model);
169 void emitDataChanged();
170 DMetadata* getMetadataForFile() const;
171 SaveProperties saveProperties() const;
172
173protected:
174
175 GPSItemModel* m_model = nullptr;
176
177 QUrl m_url;
178 QDateTime m_dateTime;
179
180 bool m_dirty = false;
183
184 bool m_tagListDirty = false;
185 QList<QList<TagData> > m_tagList;
186 QList<QList<TagData> > m_savedTagList;
187 bool m_writeXmpTags = true;
188 bool m_writeMetaLoc = true;
189
190 friend class GPSItemModel;
191
192private:
193
194 Q_DISABLE_COPY(GPSItemContainer)
195};
196
197} // namespace Digikam
Definition dmetadata.h:46
Definition gpsdatacontainer.h:26
Definition gpsitemcontainer.h:75
QList< QList< TagData > > m_savedTagList
Definition gpsitemcontainer.h:186
void writeTagsToXmp(const bool writeXmpTags)
Definition gpsitemcontainer.h:152
QDateTime m_dateTime
Definition gpsitemcontainer.h:178
virtual ~GPSItemContainer()=default
GPSDataContainer m_savedState
Definition gpsitemcontainer.h:182
void writeLocations(const bool writeMetaLoc)
Definition gpsitemcontainer.h:157
QList< QList< TagData > > m_tagList
Definition gpsitemcontainer.h:185
QUrl m_url
Definition gpsitemcontainer.h:177
GPSDataContainer m_gpsData
Definition gpsitemcontainer.h:181
Definition gpsitemmodel.h:33
Definition geocoordinates.h:44
Definition metadatainfo.h:31
Definition gpsitemcontainer.h:55
bool shouldWriteAltitude
Definition gpsitemcontainer.h:63
qreal altitude
Definition gpsitemcontainer.h:64
qreal longitude
Definition gpsitemcontainer.h:66
bool shouldRemoveCoordinates
Definition gpsitemcontainer.h:60
bool shouldRemoveAltitude
Definition gpsitemcontainer.h:61
qreal latitude
Definition gpsitemcontainer.h:65
bool shouldWriteCoordinates
Definition gpsitemcontainer.h:62
Definition datefolderview.cpp:34
@ ColumnFilename
Definition track_listmodel.cpp:32
Type
Definition gpsitemcontainer.h:36
@ TypeChild
Definition gpsitemcontainer.h:37
@ TypeNewChild
Definition gpsitemcontainer.h:39
@ TypeSpacer
Definition gpsitemcontainer.h:38
Definition gpsitemcontainer.h:43
QString tipName
Definition gpsitemcontainer.h:47
TagData()=default
Type tagType
Definition gpsitemcontainer.h:48
QString tagName
Definition gpsitemcontainer.h:46