MySQL 8.4.3
Source Code Documentation
|
#include "sql/spatial.h"
#include <assert.h>
#include <algorithm>
#include <cmath>
#include <map>
#include <memory>
#include <new>
#include <type_traits>
#include <utility>
#include "m_string.h"
#include "my_byteorder.h"
#include "my_macros.h"
#include "my_sys.h"
#include "myisampack.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld_error.h"
#include "prealloced_array.h"
#include "sql/check_stack.h"
#include "sql/current_thd.h"
#include "sql/gis/srid.h"
#include "sql/gis_bg_traits.h"
#include "sql/gstream.h"
#include "sql/psi_memory_key.h"
#include "sql/sql_const.h"
#include "sql_string.h"
#include "string_with_len.h"
#include "template_utils.h"
#include "unsafe_string_append.h"
Classes | |
class | Geometry_well_formed_checker |
WKB scanner event handler that checks if the WKB string is well formed. More... | |
class | GeomColl_component_counter |
class | Stepper_base |
Base class of all WKB parsers, which parse different types of geometries properly. More... | |
class | Point_stepper |
For iterating points inside multipoint and linestring. More... | |
class | Linestring_stepper |
For iterating linestrings inside multilinestring and polygon. More... | |
class | Polygon_stepper |
For iterating polygons inside multipolygon or geometry collection. More... | |
Macros | |
#define | MAX_DIGITS_IN_DOUBLE 25 |
Functions | |
void * | gis_wkb_alloc (size_t sz) |
void * | gis_wkb_realloc (void *p, size_t sz) |
static Geometry * | create_point (char *buffer) |
static Geometry * | create_linestring (char *buffer) |
static Geometry * | create_polygon (char *buffer) |
static Geometry * | create_multipoint (char *buffer) |
static Geometry * | create_multipolygon (char *buffer) |
static Geometry * | create_multilinestring (char *buffer) |
static Geometry * | create_geometrycollection (char *buffer) |
static bool | is_subtype_of (Geometry::wkbType sub, Geometry::wkbType super) |
Check if geometry type sub is a subtype of super. More... | |
static double | wkb_get_double (const char *ptr, Geometry::wkbByteOrder bo) |
static bool | check_coordinate_range (double x, double y, double srs_angular_unit, bool *long_out_of_range, bool *lat_out_of_range, double *out_of_range_value) |
Check that a pair of geographic coordinates are within the valid range. More... | |
static uint32 | wkb_get_uint (const char *ptr, Geometry::wkbByteOrder bo) |
const char * | wkb_scanner (THD *thd, const char *wkb, uint32 *len, uint32 geotype, bool has_hdr, WKB_scanner_event_handler *handler) |
Scan WKB byte string and notify WKB events by calling registered callbacks. More... | |
double | coord_val (const char *p, int i, int x) |
void * | get_packed_ptr (const Geometry *geo0, size_t *pnbytes) |
Packup a polygon's outer ring and inner rings into a single chunk of memory as result. More... | |
const char * | get_packed_ptr (Geometry *geo0) |
Get a polygon's WKB string's starting address. More... | |
bool | polygon_is_packed (Geometry *plgn, Geometry *mplgn) |
Check whether plgn is packed into its owner mplgn's WKB buffer. More... | |
void | own_rings (Geometry *geo0) |
static Gis_polygon::inner_container_type * | inner_rings (const Geometry *g) SUPPRESS_UBSAN |
Get inner rings object from a geometry. More... | |
static void | set_inner_rings (Geometry *g, Gis_polygon::inner_container_type *inns) SUPPRESS_UBSAN |
Set inner rings object to a geometry. More... | |
void | parse_wkb_data (Geometry *geom, const char *p, size_t num_geoms) |
Parse the wkb buffer to build the component vector m_geo_vect for geom. More... | |
Variables | |
static Geometry::Class_info ** | ci_collection_end |
static Geometry::Class_info | point_class ("POINT", Geometry::wkb_point, create_point) |
static Geometry::Class_info | linestring_class ("LINESTRING", Geometry::wkb_linestring, create_linestring) |
static Geometry::Class_info | polygon_class ("POLYGON", Geometry::wkb_polygon, create_polygon) |
static Geometry::Class_info | multipoint_class ("MULTIPOINT", Geometry::wkb_multipoint, create_multipoint) |
static Geometry::Class_info | multilinestring_class ("MULTILINESTRING", Geometry::wkb_multilinestring, create_multilinestring) |
static Geometry::Class_info | multipolygon_class ("MULTIPOLYGON", Geometry::wkb_multipolygon, create_multipolygon) |
static Geometry::Class_info | geometrycollection_class ("GEOMCOLLECTION", Geometry::wkb_geometrycollection, create_geometrycollection) |
#define MAX_DIGITS_IN_DOUBLE 25 |
|
static |
Check that a pair of geographic coordinates are within the valid range.
Checks if the coordinates are within the allowed range for geographic coordinates. Valid range for longitude and latitude coordinates in geographic spatial reference systems are (-180, 180) and [-90, 90] degrees, respectively.
[in] | x | Longitude coordinate. |
[in] | y | Latitude coordinate. |
[in] | srs_angular_unit | Unit to radians conversion factor. |
[out] | long_out_of_range | Longitude is out of range. |
[out] | lat_out_of_range | Latitude is out of range. |
[out] | out_of_range_value | The value that is out of range. |
false | Coordinates are within allowed range. |
true | Coordinates are not within allowed range. |
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
void * get_packed_ptr | ( | const Geometry * | geo0, |
size_t * | pnbytes | ||
) |
Packup a polygon's outer ring and inner rings into a single chunk of memory as result.
nbytes returns the number of bytes in WKB data. The returned WKB has no WKB header. Never call get_ptr to obtain a polygon's WKB data.
geo0 | The polygon whose WKB data we want to pack up. | |
[out] | pnbytes | Takes back the number of bytes of the packed WKB string. |
const char * get_packed_ptr | ( | Geometry * | geo0 | ) |
Get a polygon's WKB string's starting address.
The polygon is already packed so that its outer ring and inner rings point to different locations of a continuous chunk of WKB buffer.
geo0 | The already packed polygon, we want to get its data address. |
void * gis_wkb_alloc | ( | size_t | sz | ) |
void * gis_wkb_realloc | ( | void * | p, |
size_t | sz | ||
) |
|
inlinestatic |
Get inner rings object from a geometry.
Internally check that the argument is a polygon. This function is intended as a helper function and is called where we don't convert to a polygon pointer although it is a polygon.
g | a geometry that must be a polygon. |
|
inlinestatic |
Check if geometry type sub is a subtype of super.
Since Geometry::wkbType can't represent the geometry type, the superclass of all geometry types, this function can't check that. The supertype has to be a subtype of geometry.
sub | The type to check |
super | The supertype |
void own_rings | ( | Geometry * | geo0 | ) |
void parse_wkb_data | ( | Geometry * | geom, |
const char * | p, | ||
size_t | num_geoms | ||
) |
Parse the wkb buffer to build the component vector m_geo_vect for geom.
Set each geometry's wkb pointer into the Geometry objects inside m_geo_vect. Make it a standalone function in order to be able to access classes defined after class template Gis_wkb_vector.
geom | the geometry to analyze and parse. |
p | points to the geometry's wkb data's 1st byte, right after its wkb header if any. |
num_geoms | number of following geometries, to be used only when parsing the WKB of a polygon's inner rings because there is no WKB header for the inner rings only. |
Check whether plgn is packed into its owner mplgn's WKB buffer.
plgn | the polygon to be checked |
mplgn | the multipolygon, owner/holder of plgn. |
|
inlinestatic |
Set inner rings object to a geometry.
Internally check that the argument is a polygon. This function is intended as a helper function and is called where we don't convert to a polygon pointer although it is a polygon.
g | a geometry that must be a polygon. |
inns | The interior rings |
|
static |
|
static |
const char * wkb_scanner | ( | THD * | thd, |
const char * | wkb, | ||
uint32 * | len, | ||
uint32 | geotype, | ||
bool | has_hdr, | ||
WKB_scanner_event_handler * | handler | ||
) |
Scan WKB byte string and notify WKB events by calling registered callbacks.
wkb | a little endian WKB byte string of 'len' bytes, with or without WKB header. | |
[in] | thd | Thread context. |
[in,out] | len | remaining number of bytes of the wkb string. |
geotype | the type of the geometry to be scanned. | |
has_hdr | whether the 'wkb' point to a WKB header or right after the header. If it is true, the 'geotype' should be the same as the type in the header; otherwise, and we will use the type specified in WKB header. | |
handler | the registered WKB_scanner_event_handler object to be notified. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |