33 "DELETE FROM data.locations WHERE tagid=?1", -1, &
stmt,
NULL);
48 "SELECT tagid, type, longitude, latitude, delta1, delta2, ratio"
49 " FROM data.locations AS t"
50 " WHERE latitude IS NOT NULL"
51 " AND (latitude + delta2) > ?2"
52 " AND (latitude - delta2) < ?1"
53 " AND (longitude + delta1) > ?3"
54 " AND (longitude - delta1) < ?4",
88 "SELECT type, longitude, latitude, delta1, delta2, ratio"
89 " FROM data.locations"
90 " JOIN data.tags ON id = tagid"
91 " WHERE tagid = ?1 AND longitude IS NOT NULL"
92 " AND SUBSTR(name, 1, LENGTH(?2)) = ?2",
118 "INSERT OR REPLACE INTO data.locations"
119 " (tagid, type, longitude, latitude, delta1, delta2, ratio, polygons)"
120 " VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)",
152 "SELECT polygons FROM data.locations WHERE tagid = ?1",
157 gboolean found =
FALSE;
188 "SELECT l.tagid, l.type, i.longitude, i.latitude FROM main.images AS i"
189 " JOIN data.locations AS l"
191 " AND ((((i.longitude-l.longitude)*(i.longitude-l.longitude))/"
193 " ((i.latitude-l.latitude)*(i.latitude-l.latitude))/"
194 "(delta2*delta2)) <= 1)"
195 " OR ((l.type = ?3 OR l.type = ?4)"
196 " AND i.longitude>=(l.longitude-delta1)"
197 " AND i.longitude<=(l.longitude+delta1)"
198 " AND i.latitude>=(l.latitude-delta2)"
199 " AND i.latitude<=(l.latitude+delta2)))"
201 " AND i.latitude IS NOT NULL AND i.longitude IS NOT NULL",
235 "SELECT i.id, i.longitude, i.latitude FROM main.images AS i"
236 " JOIN data.locations AS l"
238 " AND ((((i.longitude-l.longitude)*(i.longitude-l.longitude))/"
240 " ((i.latitude-l.latitude)*(i.latitude-l.latitude))/"
241 "(delta2*delta2)) <= 1))"
242 " WHERE l.tagid = ?1 ",
250 "SELECT i.id, i.longitude, i.latitude FROM main.images AS i"
251 " JOIN data.locations AS l"
253 " AND i.longitude>=(l.longitude-delta1)"
254 " AND i.longitude<=(l.longitude+delta1)"
255 " AND i.latitude>=(l.latitude-delta2)"
256 " AND i.latitude<=(l.latitude+delta2))"
257 " WHERE l.tagid = ?1 ",
265 "SELECT i.id, i.longitude, i.latitude FROM main.images AS i"
266 " JOIN data.locations AS l"
268 " AND i.longitude>=(l.longitude-delta1)"
269 " AND i.longitude<=(l.longitude+delta1)"
270 " AND i.latitude>=(l.latitude-delta2)"
271 " AND i.latitude<=(l.latitude+delta2))"
272 " WHERE l.tagid = ?1 ",
306 "SELECT t.id FROM main.tagged_images ti"
307 " JOIN data.tags AS t ON t.id = ti.tagid"
308 " JOIN data.locations AS l ON l.tagid = t.id"
sqlite3 * dt_database_get_sqlite3_global(void)
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
Checked wrappers around the sqlite3_* calls: trace the statement, assert the return code,...
#define DT_DEBUG_SQLITE3_BIND_BLOB(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_PREPARE_V2(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_TEXT(a, b, c, d, e)
#define DT_DEBUG_SQLITE3_BIND_INT(a, b, c)
#define DT_DEBUG_SQLITE3_BIND_DOUBLE(a, b, c)
One row of a geo query: an id with the position that matched.