MySQL 8.1.0
Source Code Documentation
gis0geo.h
Go to the documentation of this file.
1/*****************************************************************************
2Copyright (c) 2014, 2023, Oracle and/or its affiliates.
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License, version 2.0,
6as published by the Free Software Foundation.
7
8This program is also distributed with certain software (including
9but not limited to OpenSSL) that is licensed under separate terms,
10as designated in a particular file or component or in included license
11documentation. The authors of MySQL hereby grant you an additional
12permission to link the program and your derivative works with the
13separately licensed software that they have included with MySQL.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*****************************************************************************/
24
25/** @file gis0geo.h
26 The r-tree define from MyISAM
27 *******************************************************/
28
29#ifndef _gis0geo_h
30#define _gis0geo_h
31
32#include "page0types.h"
34
35constexpr uint32_t SPLEN = 8;
36
37namespace dd {
38class Spatial_reference_system;
39}
40
41/* Rtree split node structure. */
43 double square; /* square of the mbr.*/
44 int n_node; /* which group in.*/
45 uchar *key; /* key. */
46 double *coords; /* mbr. */
47};
48
49/** Inline function for reserving coords */
50inline static double *reserve_coords(double **d_buffer, /*!< in/out: buffer. */
51 int n_dim) /*!< in: dimensions. */
52{
53 double *coords = *d_buffer;
54 (*d_buffer) += n_dim * 2;
55 return coords;
56}
57
58/** Split rtree nodes.
59 Return which group the first rec is in. */
61 rtr_split_node_t *node, /*!< in: split nodes.*/
62 int n_entries, /*!< in: entries number.*/
63 int all_size, /*!< in: total key's size.*/
64 int key_size, /*!< in: key's size.*/
65 int min_size, /*!< in: minimal group size.*/
66 int size1, /*!< in: size of group.*/
67 int size2, /*!< in: initial group sizes */
68 double **d_buffer, /*!< in/out: buffer.*/
69 int n_dim, /*!< in: dimensions. */
70 uchar *first_rec, /*!< in: the first rec. */
71 const dd::Spatial_reference_system *srs); /*!< in: SRS of R-tree */
72
73/** Compares two keys a and b depending on mode
74 mode can contain these flags:
75 PAGE_CUR_INTERSECT a intersects b
76 PAGE_CUR_CONTAIN a contains b
77 PAGE_CUR_DISJOINT a disjoint b
78 PAGE_CUR_WITHIN a within b
79 PAGE_CUR_MBR_EQUAL All coordinates of MBRs are equal
80 @param[in] mode compare method
81 @param[in] a first key
82 @param[in] a_len first key len
83 @param[in] b second key
84 @param[in] b_len second_key_len
85 @param[in] srs Spatial reference system of R-tree
86 @retval true if the predicate is true, otherwise false. */
87bool rtree_key_cmp(page_cur_mode_t mode, const uchar *a, int a_len,
88 const uchar *b, int b_len,
90#endif
Definition: spatial_reference_system.h:52
bool rtree_key_cmp(page_cur_mode_t mode, const uchar *a, int a_len, const uchar *b, int b_len, const dd::Spatial_reference_system *srs)
Compares two keys a and b depending on mode mode can contain these flags: PAGE_CUR_INTERSECT a inters...
Definition: gis0geo.cc:221
int split_rtree_node(rtr_split_node_t *node, int n_entries, int all_size, int key_size, int min_size, int size1, int size2, double **d_buffer, int n_dim, uchar *first_rec, const dd::Spatial_reference_system *srs)
Split rtree nodes.
Definition: gis0geo.cc:144
static double * reserve_coords(double **d_buffer, int n_dim)
Inline function for reserving coords.
Definition: gis0geo.h:50
constexpr uint32_t SPLEN
Definition: gis0geo.h:35
unsigned char uchar
Definition: my_inttypes.h:51
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
mode
Definition: file_handle.h:59
Index page routines.
page_cur_mode_t
Definition: page0types.h:175
This file declares a set of functions that storage engines can call to do geometrical operations.
Definition: gis0geo.h:42
double square
Definition: gis0geo.h:43
uchar * key
Definition: gis0geo.h:45
double * coords
Definition: gis0geo.h:46
int n_node
Definition: gis0geo.h:44