MySQL 8.0.39
Source Code Documentation
srs.cc File Reference
#include "sql/gis/srs/srs.h"
#include <assert.h>
#include <stddef.h>
#include <cmath>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <boost/variant/get.hpp>
#include "m_ctype.h"
#include "m_string.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysqld_error.h"
#include "sql/gis/srs/wkt_parser.h"

Namespaces

namespace  gis
 
namespace  gis::srs
 

Functions

template<typename T >
static bool has_no_conflicting_authority (const T &element, const char *name, int code)
 Check that an element doesn't have an authority clause with a different authority name and code. More...
 
template<typename T >
static bool has_authority (const T &element, const char *name, int code)
 Check if an element has an authority clause with a given authority name and code. More...
 
static bool set_parameters (gis::srid_t srid, gis::srs::wkt_parser::Projected_cs *proj, std::vector< std::pair< int, double * > > *params)
 Extract projection parameter values from the parse tree and assign them to variables. More...
 
static const char * axis_direction_to_name (gis::srs::Axis_direction direction)
 
void push_fp_to_string (std::stringstream &proj4, const std::string &proj4_parameter, const double &parameter)
 
static bool create_geographic_srs (gis::srid_t srid, gis::srs::wkt_parser::Geographic_cs *geog, gis::srs::Geographic_srs **srs)
 Create a geographic SRS description from a parse tree. More...
 
static gis::srs::Projected_srsnew_projection (int epsg_code)
 Create a new projected SRS object based on EPSG code. More...
 
static bool create_projected_srs (gis::srid_t srid, gis::srs::wkt_parser::Projected_cs *proj, gis::srs::Projected_srs **srs)
 Create a projected SRS description from a parse tree. More...
 

Function Documentation

◆ axis_direction_to_name()

static const char * axis_direction_to_name ( gis::srs::Axis_direction  direction)
static

◆ create_geographic_srs()

static bool create_geographic_srs ( gis::srid_t  srid,
gis::srs::wkt_parser::Geographic_cs geog,
gis::srs::Geographic_srs **  srs 
)
static

Create a geographic SRS description from a parse tree.

Parameters
[in]sridSpatial reference system ID to use when reporting errors
[in]geogParser output
[in,out]srsGeographic SRS object allocated by the caller
Return values
trueAn error has occurred
falseSuccess

◆ create_projected_srs()

static bool create_projected_srs ( gis::srid_t  srid,
gis::srs::wkt_parser::Projected_cs proj,
gis::srs::Projected_srs **  srs 
)
static

Create a projected SRS description from a parse tree.

Parameters
[in]sridSpatial reference system ID to use when reporting errors
[in]projParser output
[out]srsA newly allocated projected SRS object
Return values
trueAn error has occurred
falseSuccess

◆ has_authority()

template<typename T >
static bool has_authority ( const T &  element,
const char *  name,
int  code 
)
static

Check if an element has an authority clause with a given authority name and code.

The function will return true if the element has an authority clause which name matches (case insensitively) with the name parameter and a code which is the same as the code parameter.

Template Parameters
TThe type of the element with the authority clause.
Parameters
elementThe element with the authority clause.
nameThe authority name to check for.
codeThe authority code to check for.
Return values
trueThe element has the specified authority clause.
falseThe element doesn't have the specified authority clause.

◆ has_no_conflicting_authority()

template<typename T >
static bool has_no_conflicting_authority ( const T &  element,
const char *  name,
int  code 
)
static

Check that an element doesn't have an authority clause with a different authority name and code.

The function will return true if the element has no authority clause, or if it has an authority clause with a name that matches (case insensitively) with the name parameter and a code that is the same as the code parameter.

Template Parameters
TThe type of the element with the authority clause.
Parameters
elementThe element with the authority clause.
nameThe authority name to check for.
codeThe authority code to check for.
Return values
trueThe element has no other authority clause.
falseThe element has another authority clause.

◆ new_projection()

static gis::srs::Projected_srs * new_projection ( int  epsg_code)
static

Create a new projected SRS object based on EPSG code.

When creating a projected SRS object for a projection without an EPSG code, code 0 should be used.

If the EPSG code is 0 or unknown, an Unkown_projected_srs object is returned.

Parameters
epsg_codeEPSG coordinate operation method (i.e. projection type) code
Returns
New projected SRS object. The caller is responsible for deleting it.

◆ push_fp_to_string()

void push_fp_to_string ( std::stringstream &  proj4,
const std::string &  proj4_parameter,
const double &  parameter 
)

◆ set_parameters()

static bool set_parameters ( gis::srid_t  srid,
gis::srs::wkt_parser::Projected_cs proj,
std::vector< std::pair< int, double * > > *  params 
)
static

Extract projection parameter values from the parse tree and assign them to variables.

The function is given a list of EPSG parameter codes for all parameters that can be extracted, and pointers to the variable where each parameter should be stored.

Mandatory parameters must be set to NAN before calling this function. Optional parameters must be set to their default value.

If a mandatory parameter is missing, an error is flagged and the function returns true.

Parameters
[in]sridThe spatial reference system ID, used in error reporting
[in]projParse tree
[in,out]paramsList of mandatory parameters (EPSG codes) and pointers to where their values should be stored.
Return values
trueAn error has occurred. The error has been flagged.
falseSuccess