49 if(locid == -1)
return;
94 return count < 0 ? 0 : count;
99 const gboolean remove_root)
103 gchar *path1, *path2;
107 path2 = g_strdup_printf(
"%s|", path1);
112 path2 = g_strdup_printf(
"%s|", path1);
120 for(GList *l = tags; l; l = g_list_next(l))
124 if(tc->
name && strlen(tc->
name) > lgth)
129 t->tag = g_strdup(tc->
name + lgth);
132 locs = g_list_prepend(locs,
t);
163 pol = g_list_prepend(pol,
p);
182 gboolean inside =
FALSE;
184 float lat1 = plp->
lat;
185 float lon1 = plp->
lon;
187 for(
int i = 0;
i < plg_pts;
i++)
200 if(!(((lat1 > pt->
lat) && (lat2 > pt->
lat)) ||
201 ((lat1 < pt->
lat) && (lat2 < pt->
lat))))
203 const float sl = lon1 + (lon2 - lon1) * (pt->
lat - lat1) / (lat2 - lat1);
222 if(result && *result)
234 return g_strcmp0(tuple_a->
tag, tuple_b->
tag);
242 for(GList *taglist = tags; taglist; taglist = g_list_next(taglist))
245 for(
char *letter = tag; *letter; letter++)
246 if(*letter ==
'|') *letter =
'\1';
249 for(GList *taglist = sorted_tags; taglist; taglist = g_list_next(taglist))
252 for(
char *letter = tag; *letter; letter++)
253 if(*letter ==
'\1') *letter =
'|';
261 if(locid == -1)
return NULL;
268 if(locid == -1)
return;
280 for(GList *c = candidates; c; c = g_list_next(c))
283 gboolean inside =
TRUE;
298 if(inside) tags = g_list_prepend(tags, GINT_TO_POINTER(cand->
id));
300 g_list_free_full(candidates,
g_free);
311 for(GList *c = candidates; c; c = g_list_next(c))
318 imgs = g_list_prepend(imgs, GINT_TO_POINTER(cand->
id));
321 imgs = g_list_prepend(imgs, GINT_TO_POINTER(cand->
id));
323 g_list_free_full(candidates,
g_free);
335 for(GList *tag = old_tags; tag; tag = g_list_next(tag))
337 if(!g_list_find((GList *)tags, tag->data))
345 for(GList *tag = (GList *)tags; tag; tag = g_list_next(tag))
347 if(!g_list_find(old_tags, tag->data))
353 g_list_free(old_tags);
368 for(GList *img = imgs; img; img = g_list_next(img))
370 if(!g_list_find(new_imgs, img->data))
378 for(GList *img = new_imgs; img; img = g_list_next(img))
380 if(!g_list_find(imgs, img->data))
386 g_list_free(new_imgs);
403 gboolean included =
FALSE;
405 (((
g->lon -
lon) * (
g->lon -
lon) / (
g->delta1 *
g->delta1) +
406 (
g->lat -
lat) * (
g->lat -
lat) / (
g->delta2 *
g->delta2)) <= 1.0))
420 const int nb = g_list_length(polygons);
424 if(nb_pts) *nb_pts = 0;
431 for(GList *pol = polygons; pol; pol = g_list_next(pol),
p++)
436 npol = g_list_prepend(npol,
p);
445 npol = g_list_reverse(npol);
memcpy(roundtrip, origin, sizeof(roundtrip))
GList * dt_location_repository_get_in_bbox(const dt_map_box_t *const bbox)
Locations whose extent overlaps bbox.
gboolean dt_location_repository_get_polygon(const guint locid, void **blob, gint *bytes)
The raw polygon blob of locid.
GList * dt_location_repository_find_images_for_location(const guint locid, const int shape)
Images whose coordinates fall inside location locid.
GList * dt_location_repository_get_image_locations(const int32_t imgid)
Location (tag) ids currently attached to imgid. GINT_TO_POINTER list.
void dt_location_repository_set_data(const guint locid, const dt_map_location_data_t *g)
Insert or replace the geometry of locid, polygon blob included.
void dt_location_repository_delete(const guint locid)
Drop the geometry row of locid. The tag itself is the tag repository's.
GList * dt_location_repository_find_locations_for_image(const int32_t imgid)
Locations whose shape contains imgid's coordinates.
dt_map_location_data_t * dt_location_repository_get_data(const guint locid, const char *name_prefix)
The geometry of locid, if it is a real location.
data.locations: the geometry of a geotagging location.
#define IS_NULL_PTR(p)
C is way too permissive with !=, == and if(var) checks, which can mean too many things depending on w...
@ MAP_LOCATION_SHAPE_POLYGONS
@ MAP_LOCATION_SHAPE_RECTANGLE
@ MAP_LOCATION_SHAPE_ELLIPSE
#define dt_free(ptr)
g_free() ptr and set it to NULL, skipping both if it is already NULL.
One row of a geo query: an id with the position that matched.
dt_map_location_data_t data
int dt_tag_repository_count_attachments(const guint tagid)
How many attachment ROWS tagid has, or -1 if the count could not be read. See dt_tag_repository_count...
GList * dt_tag_repository_get_by_path_with_counts(const char *path, const char *path_prefix)
Tags at path or below it, each with the number of distinct images carrying it.
void dt_tag_count_free(gpointer data)
Release one dt_tag_count_t, name included. Suits g_list_free_full().
data.tags and main.tagged_images.