Marker symbolizer: Fix bug with lines with 0 length (division by zero)

This commit is contained in:
Raul Marin 2018-05-11 11:58:41 +02:00
parent b7e486d3c3
commit 0195047d7a

View file

@ -314,6 +314,12 @@ bool middle_point(PathType & path, double & x, double & y, boost::optional<doubl
path.rewind(0); path.rewind(0);
unsigned command = path.vertex(&x0,&y0); unsigned command = path.vertex(&x0,&y0);
if (command == SEG_END) return false; if (command == SEG_END) return false;
if (std::abs(mid_length) < std::numeric_limits<double>::epsilon())
{
x = x0;
y = y0;
return true;
}
double dist = 0.0; double dist = 0.0;
while (SEG_END != (command = path.vertex(&x1, &y1))) while (SEG_END != (command = path.vertex(&x1, &y1)))
{ {