summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07bcf96)
raw | patch | inline | side by side (parent: 07bcf96)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 8 Jun 2008 18:31:38 +0000 (18:31 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 8 Jun 2008 18:31:38 +0000 (18:31 +0000) |
src/display/curve.cpp | patch | blob | history | |
src/display/curve.h | patch | blob | history |
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 4144bb623f340346d98abbe497b0111181a5c0e7..df1666d2e403f76297358366c1a159872c6f937d 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
#define __CURVE_C__
/** \file
- * Routines for SPCurve and for NArtBpath arrays in general.
+ * Routines for SPCurve and for NArtBpath arrays / Geom::PathVector in general.
*/
/*
return _bpath + _end - 1;
}
+/**
+ * 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.
*/
return _bpath;
}
+/**
+ * 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) ?
*/
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;
lineto(bp->x3, bp->y3);
use_lineto = FALSE;
} else {
- if (closed) closepath();
+ if (closed && _hascpt) closepath();
moveto(bp->x3, bp->y3);
}
closed = true;
diff --git a/src/display/curve.h b/src/display/curve.h
index 4e94578ed975084cfead90f3a42082238efb5734..d46fa13b123f2cad594a99f9dffb537189a51495 100644 (file)
--- a/src/display/curve.h
+++ b/src/display/curve.h
bool is_empty() const;
bool is_closed() const;
NArtBpath const * last_bpath() const;
+ Geom::Path const * last_path() const;
NArtBpath const * first_bpath() const;
+ Geom::Path const * first_path() const;
NR::Point first_point() const;
NR::Point last_point() const;
NR::Point second_point() const;