Be compatible with existing behavior: close open paths in DXF files

527olive
Marius Kintel 2013-12-29 02:15:42 -05:00
parent bc4fae0d85
commit db7da052a3
1 changed files with 4 additions and 2 deletions

View File

@ -589,9 +589,11 @@ Polygon2d *DxfData::toPolygon2d() const
Polygon2d *poly = new Polygon2d();
for (size_t i = 0; i < this->paths.size(); i++) {
const DxfData::Path &path = this->paths[i];
if (!path.is_closed) continue; // We don't support open paths for now
Outline2d outline;
for (size_t j = 1; j < path.indices.size(); j++) {
size_t endidx = path.indices.size();
// We don't support open paths; closing them to be compatible with existing behavior
if (!path.is_closed) endidx++;
for (size_t j = 1; j < endidx; j++) {
outline.vertices.push_back(Vector2d(this->points[path.indices[path.indices.size()-j]]));
}
poly->addOutline(outline);