Ported some minor methods to XS

This commit is contained in:
Alessandro Ranellucci 2014-11-15 23:06:15 +01:00
parent 379cde30e2
commit 28466750e6
9 changed files with 58 additions and 42 deletions

View file

@ -209,6 +209,19 @@ Polygon::centroid() const
return Point(x_temp/(6*area_temp), y_temp/(6*area_temp));
}
std::string
Polygon::wkt() const
{
std::ostringstream wkt;
wkt << "POLYGON((";
for (Points::const_iterator p = this->points.begin(); p != this->points.end(); ++p) {
wkt << p->x << " " << p->y;
if (p != this->points.end()-1) wkt << ",";
}
wkt << "))";
return wkt.str();
}
#ifdef SLIC3RXS
REGISTER_CLASS(Polygon, "Polygon");