summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 123ea51)
raw | patch | inline | side by side (parent: 123ea51)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 3 Jul 2008 21:44:17 +0000 (21:44 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 3 Jul 2008 21:44:17 +0000 (21:44 +0000) |
src/display/curve.cpp | patch | blob | history |
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 3874fec590d7d34657784c81515f6c74419d0d1f..ecccd2cb16817b5671342cee6c87bf713b2f4b3c 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
/**
* 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
SPCurve::is_empty() const
{
- g_return_val_if_fail(this != NULL, TRUE);
-
- if (!_bpath)
- return true;
-
bool empty = _pathv.empty();
- debug_check("SPCurve::is_empty", (_bpath->code == NR_END) == empty );
return empty;
}
/**
* True iff all subpaths are closed.
- * 2GEOMproof
*/
bool
SPCurve::is_closed() const
break;
}
}
- debug_check("SPCurve::is_closed", (closed) == (_closed) );
return closed;
}
Geom::Path const *
SPCurve::last_path() const
{
- g_return_val_if_fail(this != NULL, NULL);
-
if (is_empty()) {
return NULL;
}
Geom::Path const *
SPCurve::first_path() const
{
- g_return_val_if_fail(this != NULL, NULL);
-
if (is_empty()) {
return NULL;
}
NR::Point
SPCurve::first_point() const
{
- NArtBpath const * bpath = get_bpath();
- g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
if (is_empty())
return NR::Point(0, 0);
- debug_check("SPCurve::first_point", bpath->c(3) == _pathv.front().initialPoint() );
-
- //return bpath->c(3);
return from_2geom( _pathv.front().initialPoint() );
}
* 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)
+ * FIXME: for empty paths shouldn't this return (NR_HUGE,NR_HUGE)
*/
NR::Point
SPCurve::second_point() const
{
- g_return_val_if_fail(this != NULL, NR::Point(0, 0));
-
- if (_end < 1) {
- return _movePos;
- }
-
- NArtBpath *bpath = NULL;
- if (_end < 2) {
- bpath = _bpath;
- } else {
- bpath = _bpath + 1;
- }
- g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
-
- debug_check("SPCurve::second_point", bpath->c(3) == _pathv.front()[0].finalPoint() );
-
if (is_empty()) {
return NR::Point(0,0);
}
/**
* Return last point of last subpath or (0,0). TODO: shouldn't this be (NR_HUGE, NR_HUGE) to be able to tell it apart from normal (0,0) ?
+ * If the last path is only a moveto, then return that point.
*/
NR::Point
SPCurve::last_point() const
{
- NArtBpath const * bpath = last_bpath();
- g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
if (is_empty())
return NR::Point(0, 0);
- debug_check("SPCurve::last_point", bpath->c(3) == _pathv.back().finalPoint() );
- //return bpath->c(3);
return from_2geom( _pathv.back().finalPoint() );
}