diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-06-08 18:31:38 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-06-08 18:31:38 +0000 |
| commit | 33fdcb19f2eda0c91a2c4371a3e1973b3d0c556f (patch) | |
| tree | 9d34d6c6bc002c4e8c8a073e6bee4b7d1de0fc19 /src/display/curve.cpp | |
| parent | Re-add two handles for PerpBisector LPE (we don't add the other two because t... (diff) | |
| download | inkscape-33fdcb19f2eda0c91a2c4371a3e1973b3d0c556f.tar.gz inkscape-33fdcb19f2eda0c91a2c4371a3e1973b3d0c556f.zip | |
add method to retrieve first and last path of SPCurve, fix error.
(bzr r5858)
Diffstat (limited to 'src/display/curve.cpp')
| -rw-r--r-- | src/display/curve.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 4144bb623..df1666d2e 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -1,7 +1,7 @@ #define __CURVE_C__ /** \file - * Routines for SPCurve and for NArtBpath arrays in general. + * Routines for SPCurve and for NArtBpath arrays / Geom::PathVector in general. */ /* @@ -895,6 +895,21 @@ SPCurve::last_bpath() const } /** + * Return last path in PathVector or NULL. + */ +Geom::Path const * +SPCurve::last_path() const +{ + g_return_val_if_fail(this != NULL, NULL); + + if (is_empty()) { + return NULL; + } + + return &_pathv.back(); +} + +/** * Return first subpath or NULL. */ NArtBpath const * @@ -910,6 +925,21 @@ SPCurve::first_bpath() const } /** + * Return first path in PathVector or NULL. + */ +Geom::Path const * +SPCurve::first_path() const +{ + g_return_val_if_fail(this != NULL, NULL); + + if (is_empty()) { + return NULL; + } + + return &_pathv.front(); +} + +/** * Return first point of first subpath or (0,0). TODO: shouldn't this be (NR_HUGE, NR_HUGE) to be able to tell it apart from normal (0,0) ? */ NR::Point @@ -1080,9 +1110,9 @@ SPCurve::append(SPCurve const *curve2, case NR_MOVETO_OPEN: if (use_lineto && _hascpt) { lineto(bp->x3, bp->y3); - use_lineto = FALSE; + use_lineto = false; } else { - if (closed) closepath(); + if (closed && _hascpt) closepath(); moveto(bp->x3, bp->y3); } closed = false; @@ -1093,7 +1123,7 @@ SPCurve::append(SPCurve const *curve2, lineto(bp->x3, bp->y3); use_lineto = FALSE; } else { - if (closed) closepath(); + if (closed && _hascpt) closepath(); moveto(bp->x3, bp->y3); } closed = true; |
