diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2015-12-29 18:17:06 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2015-12-29 18:17:06 +0100 |
commit | e5e30daf905fc6d41caa3c50d78ebc66b9e70c05 (patch) | |
tree | e24e9893a11a4a645572c34e1066d244a07931d5 | |
parent | 53f7dacb2869feaa959f56a701f123839fbb8a80 (diff) |
Try to sort out 0-length path segments
Change-Id: Icaf05be1675850e9b0ff233be0cc4cb5bf86ca6a
-rw-r--r-- | src/lib/VSDContentCollector.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp index da6b073..c20e626 100644 --- a/src/lib/VSDContentCollector.cpp +++ b/src/lib/VSDContentCollector.cpp @@ -481,8 +481,28 @@ void libvisio::VSDContentCollector::_convertToPath(const std::vector<librevenge: } else { + double prevX = DBL_MAX; + double prevY = DBL_MAX; for (unsigned i = 0; i < segmentVector.size(); ++i) - path.append(segmentVector[i]); + { + if (!segmentVector[i]["librevenge:path-action"]) + continue; + double x = DBL_MAX; + double y = DBL_MAX; + if (segmentVector[i]["svg:x"] && segmentVector[i]["svg:y"]) + + { + x = segmentVector[i]["svg:x"]->getDouble(); + y = segmentVector[i]["svg:y"]->getDouble(); + } + // skip segment that have length 0.0 + if (!VSD_ALMOST_ZERO(x-prevX) || !VSD_ALMOST_ZERO(y-prevY)) + { + path.append(segmentVector[i]); + prevX = x; + prevY = y; + } + } } } |