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