diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-08-31 20:37:49 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-31 18:41:32 -0700 |
commit | 71e366a6e4cd1529eb336f68f239736125466fcf (patch) | |
tree | 17807532db4d309348b9e95a6e936f8a7ad9da82 /qt-models/divelocationmodel.cpp | |
parent | ab32295f8906ae5b6334f7abc8d05032b68ae577 (diff) | |
download | subsurface-71e366a6e4cd1529eb336f68f239736125466fcf.tar.gz |
Add function to filter same-gps dive sites
This should be userfull to show dive sites that are
mergeable.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divelocationmodel.cpp')
-rw-r--r-- | qt-models/divelocationmodel.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index fca322dcf..abdf69f91 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -183,3 +183,13 @@ GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStrin list << taxonomy_category_names[i]; setStringList(list); } + +bool filter_same_gps_cb (QAbstractItemModel *model, int sourceRow, const QModelIndex& parent) +{ + int ref_lat = displayed_dive_site.latitude.udeg; + int ref_lon = displayed_dive_site.longitude.udeg; + QModelIndex curr = model->index(sourceRow, LocationInformationModel::UUID, parent.isValid() ? parent : QModelIndex()); + + struct dive_site *ds = get_dive_site_by_uuid(curr.data().toInt()); + return (ds->latitude.udeg == ref_lat && ds->longitude.udeg == ref_lon); +}
\ No newline at end of file |