Renamed xxx_as_text() and xxx__from_text().
This commit is contained in:
parent
2295fcc876
commit
fd3abc83ea
@ -508,7 +508,7 @@ Item *create_func_quote(Item* a)
|
|||||||
|
|
||||||
Item *create_func_as_wkt(Item *a)
|
Item *create_func_as_wkt(Item *a)
|
||||||
{
|
{
|
||||||
return new Item_func_as_text(a);
|
return new Item_func_as_wkt(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
Item *create_func_as_wkb(Item *a)
|
Item *create_func_as_wkb(Item *a)
|
||||||
|
@ -85,7 +85,7 @@ void Item_func_geometry_from_wkb::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String *Item_func_as_text::val_str(String *str)
|
String *Item_func_as_wkt::val_str(String *str)
|
||||||
{
|
{
|
||||||
String arg_val;
|
String arg_val;
|
||||||
String *swkb= args[0]->val_str(&arg_val);
|
String *swkb= args[0]->val_str(&arg_val);
|
||||||
@ -104,7 +104,7 @@ String *Item_func_as_text::val_str(String *str)
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_func_as_text::fix_length_and_dec()
|
void Item_func_as_wkt::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=MAX_BLOB_WIDTH;
|
max_length=MAX_BLOB_WIDTH;
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ public:
|
|||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Item_func_as_text: public Item_str_func
|
class Item_func_as_wkt: public Item_str_func
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_func_as_text(Item *a): Item_str_func(a) {}
|
Item_func_as_wkt(Item *a): Item_str_func(a) {}
|
||||||
const char *func_name() const { return "astext"; }
|
const char *func_name() const { return "astext"; }
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#define IMPLEMENT_GEOM(class_name, type_id, name) \
|
#define IMPLEMENT_GEOM(class_name, type_id, name) \
|
||||||
{ \
|
{ \
|
||||||
(GF_InitFromText) &class_name::init_from_text, \
|
(GF_InitFromText) &class_name::init_from_wkt, \
|
||||||
(GF_GetDataAsText) &class_name::get_data_as_text, \
|
(GF_GetDataAsText) &class_name::get_data_as_wkt, \
|
||||||
(GF_GetDataSize) &class_name::get_data_size, \
|
(GF_GetDataSize) &class_name::get_data_size, \
|
||||||
(GF_GetMBR) &class_name::get_mbr, \
|
(GF_GetMBR) &class_name::get_mbr, \
|
||||||
(GF_GetD) &class_name::get_x, \
|
(GF_GetD) &class_name::get_x, \
|
||||||
@ -113,7 +113,7 @@ int Geometry::create_from_wkt(GTextReadStream *trs, String *wkt, int init_stream
|
|||||||
trs->set_error_msg("'(' expected");
|
trs->set_error_msg("'(' expected");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (init_from_text(trs, wkt)) return 1;
|
if (init_from_wkt(trs, wkt)) return 1;
|
||||||
if (trs->get_next_symbol() != ')')
|
if (trs->get_next_symbol() != ')')
|
||||||
{
|
{
|
||||||
trs->set_error_msg("')' expected");
|
trs->set_error_msg("')' expected");
|
||||||
@ -161,7 +161,7 @@ size_t GPoint::get_data_size() const
|
|||||||
return POINT_DATA_SIZE;
|
return POINT_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GPoint::init_from_text(GTextReadStream *trs, String *wkb)
|
int GPoint::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
if (wkb->reserve(sizeof(double)*2))
|
if (wkb->reserve(sizeof(double)*2))
|
||||||
@ -176,7 +176,7 @@ int GPoint::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GPoint::get_data_as_text(String *txt) const
|
int GPoint::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
if (get_xy(&x, &y))
|
if (get_xy(&x, &y))
|
||||||
@ -207,7 +207,7 @@ size_t GLineString::get_data_size() const
|
|||||||
return 4 + n_points*POINT_DATA_SIZE;
|
return 4 + n_points*POINT_DATA_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GLineString::init_from_text(GTextReadStream *trs, String *wkb)
|
int GLineString::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
uint32 n_points = 0;
|
uint32 n_points = 0;
|
||||||
int np_pos = wkb->length();
|
int np_pos = wkb->length();
|
||||||
@ -220,7 +220,7 @@ int GLineString::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (p.init_from_text(trs, wkb))
|
if (p.init_from_wkt(trs, wkb))
|
||||||
return 1;
|
return 1;
|
||||||
++n_points;
|
++n_points;
|
||||||
if (trs->get_next_toc_type() == GTextReadStream::comma)
|
if (trs->get_next_toc_type() == GTextReadStream::comma)
|
||||||
@ -239,7 +239,7 @@ int GLineString::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GLineString::get_data_as_text(String *txt) const
|
int GLineString::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
uint32 n_points;
|
uint32 n_points;
|
||||||
const char *data = m_data;
|
const char *data = m_data;
|
||||||
@ -459,7 +459,7 @@ size_t GPolygon::get_data_size() const
|
|||||||
return data - m_data;
|
return data - m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GPolygon::init_from_text(GTextReadStream *trs, String *wkb)
|
int GPolygon::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
uint32 n_linear_rings = 0;
|
uint32 n_linear_rings = 0;
|
||||||
int lr_pos = wkb->length();
|
int lr_pos = wkb->length();
|
||||||
@ -478,7 +478,7 @@ int GPolygon::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
trs->set_error_msg("'(' expected");
|
trs->set_error_msg("'(' expected");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (ls.init_from_text(trs, wkb))
|
if (ls.init_from_wkt(trs, wkb))
|
||||||
return 1;
|
return 1;
|
||||||
if (trs->get_next_symbol() != ')')
|
if (trs->get_next_symbol() != ')')
|
||||||
{
|
{
|
||||||
@ -503,7 +503,7 @@ int GPolygon::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GPolygon::get_data_as_text(String *txt) const
|
int GPolygon::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
uint32 n_linear_rings;
|
uint32 n_linear_rings;
|
||||||
const char *data= m_data;
|
const char *data= m_data;
|
||||||
@ -783,7 +783,7 @@ size_t GMultiPoint::get_data_size() const
|
|||||||
return 4 + uint4korr(m_data)*(POINT_DATA_SIZE + WKB_HEADER_SIZE);
|
return 4 + uint4korr(m_data)*(POINT_DATA_SIZE + WKB_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GMultiPoint::init_from_text(GTextReadStream *trs, String *wkb)
|
int GMultiPoint::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
uint32 n_points = 0;
|
uint32 n_points = 0;
|
||||||
int np_pos = wkb->length();
|
int np_pos = wkb->length();
|
||||||
@ -799,7 +799,7 @@ int GMultiPoint::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 1;
|
return 1;
|
||||||
wkb->q_append((char)wkbNDR);
|
wkb->q_append((char)wkbNDR);
|
||||||
wkb->q_append((uint32)wkbPoint);
|
wkb->q_append((uint32)wkbPoint);
|
||||||
if (p.init_from_text(trs, wkb))
|
if (p.init_from_wkt(trs, wkb))
|
||||||
return 1;
|
return 1;
|
||||||
++n_points;
|
++n_points;
|
||||||
if (trs->get_next_toc_type() == GTextReadStream::comma)
|
if (trs->get_next_toc_type() == GTextReadStream::comma)
|
||||||
@ -812,7 +812,7 @@ int GMultiPoint::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GMultiPoint::get_data_as_text(String *txt) const
|
int GMultiPoint::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
uint32 n_points;
|
uint32 n_points;
|
||||||
const char *data= m_data;
|
const char *data= m_data;
|
||||||
@ -904,7 +904,7 @@ size_t GMultiLineString::get_data_size() const
|
|||||||
return data - m_data;
|
return data - m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GMultiLineString::init_from_text(GTextReadStream *trs, String *wkb)
|
int GMultiLineString::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
uint32 n_line_strings = 0;
|
uint32 n_line_strings = 0;
|
||||||
int ls_pos = wkb->length();
|
int ls_pos = wkb->length();
|
||||||
@ -928,7 +928,7 @@ int GMultiLineString::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
trs->set_error_msg("'(' expected");
|
trs->set_error_msg("'(' expected");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (ls.init_from_text(trs, wkb))
|
if (ls.init_from_wkt(trs, wkb))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (trs->get_next_symbol() != ')')
|
if (trs->get_next_symbol() != ')')
|
||||||
@ -947,7 +947,7 @@ int GMultiLineString::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GMultiLineString::get_data_as_text(String *txt) const
|
int GMultiLineString::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
uint32 n_line_strings;
|
uint32 n_line_strings;
|
||||||
const char *data= m_data;
|
const char *data= m_data;
|
||||||
@ -1120,7 +1120,7 @@ size_t GMultiPolygon::get_data_size() const
|
|||||||
return data - m_data;
|
return data - m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GMultiPolygon::init_from_text(GTextReadStream *trs, String *wkb)
|
int GMultiPolygon::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
uint32 n_polygons = 0;
|
uint32 n_polygons = 0;
|
||||||
int np_pos = wkb->length();
|
int np_pos = wkb->length();
|
||||||
@ -1143,7 +1143,7 @@ int GMultiPolygon::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
trs->set_error_msg("'(' expected");
|
trs->set_error_msg("'(' expected");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (p.init_from_text(trs, wkb))
|
if (p.init_from_wkt(trs, wkb))
|
||||||
return 1;
|
return 1;
|
||||||
if (trs->get_next_symbol() != ')')
|
if (trs->get_next_symbol() != ')')
|
||||||
{
|
{
|
||||||
@ -1160,7 +1160,7 @@ int GMultiPolygon::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GMultiPolygon::get_data_as_text(String *txt) const
|
int GMultiPolygon::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
uint32 n_polygons;
|
uint32 n_polygons;
|
||||||
const char *data= m_data;
|
const char *data= m_data;
|
||||||
@ -1403,7 +1403,7 @@ size_t GGeometryCollection::get_data_size() const
|
|||||||
return data - m_data;
|
return data - m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GGeometryCollection::init_from_text(GTextReadStream *trs, String *wkb)
|
int GGeometryCollection::init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{
|
{
|
||||||
uint32 n_objects = 0;
|
uint32 n_objects = 0;
|
||||||
int no_pos = wkb->length();
|
int no_pos = wkb->length();
|
||||||
@ -1433,7 +1433,7 @@ int GGeometryCollection::init_from_text(GTextReadStream *trs, String *wkb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GGeometryCollection::get_data_as_text(String *txt) const
|
int GGeometryCollection::get_data_as_wkt(String *txt) const
|
||||||
{
|
{
|
||||||
uint32 n_objects;
|
uint32 n_objects;
|
||||||
const char *data = m_data;
|
const char *data = m_data;
|
||||||
|
@ -228,8 +228,8 @@ public:
|
|||||||
class GClassInfo
|
class GClassInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GF_InitFromText init_from_text;
|
GF_InitFromText init_from_wkt;
|
||||||
GF_GetDataAsText get_data_as_text;
|
GF_GetDataAsText get_data_as_wkt;
|
||||||
GF_GetDataSize get_data_size;
|
GF_GetDataSize get_data_size;
|
||||||
GF_GetMBR get_mbr;
|
GF_GetMBR get_mbr;
|
||||||
GF_GetD get_x;
|
GF_GetD get_x;
|
||||||
@ -262,11 +262,11 @@ public:
|
|||||||
const GClassInfo *get_class_info() const { return m_vmt; }
|
const GClassInfo *get_class_info() const { return m_vmt; }
|
||||||
size_t get_data_size() const { return (this->*m_vmt->get_data_size)(); }
|
size_t get_data_size() const { return (this->*m_vmt->get_data_size)(); }
|
||||||
|
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb)
|
int init_from_wkt(GTextReadStream *trs, String *wkb)
|
||||||
{ return (this->*m_vmt->init_from_text)(trs, wkb); }
|
{ return (this->*m_vmt->init_from_wkt)(trs, wkb); }
|
||||||
|
|
||||||
int get_data_as_text(String *txt) const
|
int get_data_as_wkt(String *txt) const
|
||||||
{ return (this->*m_vmt->get_data_as_text)(txt); }
|
{ return (this->*m_vmt->get_data_as_wkt)(txt); }
|
||||||
|
|
||||||
int get_mbr(MBR *mbr) const { return (this->*m_vmt->get_mbr)(mbr); }
|
int get_mbr(MBR *mbr) const { return (this->*m_vmt->get_mbr)(mbr); }
|
||||||
int dimension(uint32 *dim) const
|
int dimension(uint32 *dim) const
|
||||||
@ -324,7 +324,7 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
wkt->qs_append(get_class_info()->m_name);
|
wkt->qs_append(get_class_info()->m_name);
|
||||||
wkt->qs_append('(');
|
wkt->qs_append('(');
|
||||||
if (get_data_as_text(wkt))
|
if (get_data_as_wkt(wkt))
|
||||||
return 1;
|
return 1;
|
||||||
wkt->qs_append(')');
|
wkt->qs_append(')');
|
||||||
return 0;
|
return 0;
|
||||||
@ -364,8 +364,8 @@ class GPoint: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int get_xy(double *x, double *y) const
|
int get_xy(double *x, double *y) const
|
||||||
@ -401,8 +401,8 @@ class GLineString: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int length(double *len) const;
|
int length(double *len) const;
|
||||||
@ -420,8 +420,8 @@ class GPolygon: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int area(double *ar) const;
|
int area(double *ar) const;
|
||||||
@ -439,8 +439,8 @@ class GMultiPoint: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int num_geometries(uint32 *num) const;
|
int num_geometries(uint32 *num) const;
|
||||||
@ -454,8 +454,8 @@ class GMultiLineString: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int num_geometries(uint32 *num) const;
|
int num_geometries(uint32 *num) const;
|
||||||
@ -471,8 +471,8 @@ class GMultiPolygon: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int num_geometries(uint32 *num) const;
|
int num_geometries(uint32 *num) const;
|
||||||
@ -488,8 +488,8 @@ class GGeometryCollection: public Geometry
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
size_t get_data_size() const;
|
size_t get_data_size() const;
|
||||||
int init_from_text(GTextReadStream *trs, String *wkb);
|
int init_from_wkt(GTextReadStream *trs, String *wkb);
|
||||||
int get_data_as_text(String *txt) const;
|
int get_data_as_wkt(String *txt) const;
|
||||||
int get_mbr(MBR *mbr) const;
|
int get_mbr(MBR *mbr) const;
|
||||||
|
|
||||||
int num_geometries(uint32 *num) const;
|
int num_geometries(uint32 *num) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user