MCPcopy Create free account
hub / github.com/MariaDB/server / is_closed

Method is_closed

sql/spatial.cc:1581–1608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1579
1580
1581int Gis_line_string::is_closed(int *closed) const
1582{
1583 uint32 n_points;
1584 double x1, y1, x2, y2;
1585 const char *data= m_data;
1586
1587 if (no_data(data, 4))
1588 return 1;
1589 n_points= uint4korr(data);
1590 if (n_points == 1)
1591 {
1592 *closed=1;
1593 return 0;
1594 }
1595 data+= 4;
1596 if (n_points == 0 || not_enough_points(data, n_points))
1597 return 1;
1598
1599 /* Get first point */
1600 get_point(&x1, &y1, data);
1601
1602 /* get last point */
1603 data+= POINT_DATA_SIZE + (n_points-2)*POINT_DATA_SIZE;
1604 get_point(&x2, &y2, data);
1605
1606 *closed= (x1==x2) && (y1==y2);
1607 return 0;
1608}
1609
1610
1611int Gis_line_string::is_valid(int *valid) const

Callers 4

init_from_wktMethod · 0.45
init_from_wkbMethod · 0.45
init_from_jsonMethod · 0.45
val_intMethod · 0.45

Calls 4

uint4korrFunction · 0.85
get_pointFunction · 0.85
set_data_ptrMethod · 0.80
get_data_sizeMethod · 0.45

Tested by

no test coverage detected