summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76a8149)
raw | patch | inline | side by side (parent: 76a8149)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 3 Jul 2008 21:31:15 +0000 (21:31 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 3 Jul 2008 21:31:15 +0000 (21:31 +0000) |
src/display/curve.cpp | patch | blob | history |
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 1d3a3b1d55dc321aac92a44e373e0b5489aa24af..3874fec590d7d34657784c81515f6c74419d0d1f 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
}
/**
- * True if no paths are in curve.
+ * True if no paths are in curve. If it only contains a path with only a moveto, the path is considered NON-empty
* 2GEOMproof
*/
bool
if (!_bpath)
return true;
- bool empty = _pathv.empty() || _pathv.front().empty();
+ bool empty = _pathv.empty();
debug_check("SPCurve::is_empty", (_bpath->code == NR_END) == empty );
return empty;
/**
* Return the second point of first subpath or _movePos if curve too short.
* If the pathvector is empty, this returns (0,0). If the first path is only a moveto, this method
- * returns the first point of the second path, if it exists. Otherwise (0,0)
+ * returns the first point of the second path, if it exists. If there is no 2nd path, it returns the
+ * first point of the first path.
*
* FIXME: for empty paths this should return (NR_HUGE,NR_HUGE)
*/
debug_check("SPCurve::second_point", bpath->c(3) == _pathv.front()[0].finalPoint() );
- return bpath->c(3);
+ if (is_empty()) {
+ return NR::Point(0,0);
+ }
+ else if (_pathv.front().empty()) {
+ // first path is only a moveto
+ // check if there is second path
+ if (_pathv.size() > 1) {
+ return _pathv[1].initialPoint();
+ } else {
+ return _pathv[0].initialPoint();
+ }
+ }
+ else
+ return _pathv.front()[0].finalPoint();
}
/**