Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
gpx.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2011-2021 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include <glib.h>
22#include "common/image.h"
23
24#define EARTH_RADIUS 6378100.0 /* in meters */
25#define DT_MINIMUM_DISTANCE_FOR_GEODESIC 100000.0 /* in meters */
26#define DT_MINIMUM_ANGULAR_DELTA_FOR_GEODESIC 1.0
27/* DT_MINIMUM_ANGULAR_DELTA_FOR_GEODESIC is in degrees, and is used for longitude and latitude
28 0.1 degress ~ 10 km on the earth surface */
29
30struct dt_gpx_t;
31
33{
35 GDateTime *time;
36 uint32_t segid;
38
48
49/* loads and parses a gpx track file */
50struct dt_gpx_t *dt_gpx_new(const gchar *filename);
51void dt_gpx_destroy(struct dt_gpx_t *gpx);
52
53/* fetch the lon,lat coords for time t, if within time range
54 of gpx record return TRUE, FALSE is returned if out of time frame
55 and closest record of lon,lat is filled */
56gboolean dt_gpx_get_location(struct dt_gpx_t *, GDateTime *timestamp, dt_image_geoloc_t *geoloc);
57
58// get the list of track segments
59GList *dt_gpx_get_trkseg(struct dt_gpx_t *gpx);
60
61// get the list of track points for a track segment
62GList *dt_gpx_get_trkpts(struct dt_gpx_t *gpx, const guint segid);
63
64// get the distance on the geodesic line and the angle delta referred to earth center
65void dt_gpx_geodesic_distance(double lat1, double lon1,
66 double lat2, double lon2,
67 double *d, double *delta);
68
69/* get the intermediate point (lat, lon) on the geodesic line between point 1 and point 2
70 which form an angle delta (calculated by dt_gpx_geodesic_distance)
71 corresponding to fraction f
72 boolean first_time is in order to reduce unnecessary calculations */
73void dt_gpx_geodesic_intermediate_point(const double lat1, const double lon1,
74 const double lat2, const double lon2,
75 const double delta,
76 const gboolean first_time,
77 double f,
78 double *lat, double *lon);
79
80
81// clang-format off
82// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
83// vim: shiftwidth=2 expandtab tabstop=2 cindent
84// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
85// clang-format on
86
void dt_gpx_destroy(struct dt_gpx_t *gpx)
Definition gpx.c:140
GList * dt_gpx_get_trkpts(struct dt_gpx_t *gpx, const guint segid)
Definition gpx.c:424
struct dt_gpx_t * dt_gpx_new(const gchar *filename)
Definition gpx.c:76
gboolean dt_gpx_get_location(struct dt_gpx_t *, GDateTime *timestamp, dt_image_geoloc_t *geoloc)
Definition gpx.c:150
void dt_gpx_geodesic_intermediate_point(const double lat1, const double lon1, const double lat2, const double lon2, const double delta, const gboolean first_time, double f, double *lat, double *lon)
Definition gpx.c:469
GList * dt_gpx_get_trkseg(struct dt_gpx_t *gpx)
Definition gpx.c:419
void dt_gpx_geodesic_distance(double lat1, double lon1, double lat2, double lon2, double *d, double *delta)
Definition gpx.c:448
static float f(const float t, const float c, const float x)
Definition graduatednd.c:173
float lat
Definition location.c:3
float lon
Definition location.c:2
Definition gpx.c:36
uint32_t segid
Definition gpx.c:46
Definition gpx.h:33
gdouble longitude
Definition gpx.h:34
GDateTime * time
Definition gpx.h:35
gdouble elevation
Definition gpx.h:34
uint32_t segid
Definition gpx.h:36
gdouble latitude
Definition gpx.h:34
Definition gpx.h:40
char * name
Definition gpx.h:44
dt_gpx_track_point_t * trkpt
Definition gpx.h:45
GDateTime * start_dt
Definition gpx.h:42
GDateTime * end_dt
Definition gpx.h:43
uint32_t nb_trkpt
Definition gpx.h:46
guint id
Definition gpx.h:41
Definition common/image.h:186