diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index a9833e05385941e143be6ac05f771f1b4cad1a2a..c7ed88513a4ae8e51e520e78a9a16358c05962d6 100644 (file)
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
static void sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags);
-static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p);
+static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs);
static void sp_genericellipse_set_shape(SPShape *shape);
static void sp_genericellipse_update_patheffect (SPLPEItem *lpeitem, bool write);
Geom::Matrix aff = Geom::Scale(rx, ry) * Geom::Translate(ellipse->cx.computed, ellipse->cy.computed);
curve->transform(aff);
- sp_lpe_item_perform_path_effect(SP_LPE_ITEM (ellipse), curve);
- sp_shape_set_curve_insync((SPShape *) ellipse, curve, TRUE);
+ /* Reset the shape'scurve to the "original_curve"
+ * This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
+ sp_shape_set_curve_insync (shape, curve, TRUE);
+ if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(shape)) && sp_lpe_item_path_effects_enabled(SP_LPE_ITEM(shape))) {
+ SPCurve *c_lpe = curve->copy();
+ bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe);
+ if (success) {
+ sp_shape_set_curve_insync (shape, c_lpe, TRUE);
+ }
+ c_lpe->unref();
+ }
curve->unref();
}
-static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p)
+static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const */*snapprefs*/)
{
g_assert(item != NULL);
g_assert(SP_IS_GENERICELLIPSE(item));
-
+
SPGenericEllipse *ellipse = SP_GENERICELLIPSE(item);
sp_genericellipse_normalize(ellipse);
- NR::Matrix const i2d = sp_item_i2d_affine(item);
+ Geom::Matrix const i2d = sp_item_i2d_affine(item);
// figure out if we have a slice, whilst guarding against rounding errors
bool slice = false;
@@ -269,32 +278,32 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p)
}
double rx = ellipse->rx.computed;
- double ry = ellipse->ry.computed;
+ double ry = ellipse->ry.computed;
double cx = ellipse->cx.computed;
double cy = ellipse->cy.computed;
-
+
// Snap to the 4 quadrant points of the ellipse, but only if the arc
// spans far enough to include them
double angle = 0;
for (angle = 0; angle < SP_2PI; angle += M_PI_2) {
if (angle >= ellipse->start && angle <= ellipse->end) {
- *p = NR::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2d;
+ *p = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2d;
}
}
-
- // And if we have a slice, also snap to the endpoints and the centre point
+
+ // And if we have a slice, also snap to the endpoints and the centre point
if (slice) {
// Add the centre, if we have a closed slice
if (ellipse->closed) {
- *p = NR::Point(cx, cy) * i2d;
+ *p = Geom::Point(cx, cy) * i2d;
}
// Add the start point, if it's not coincident with a quadrant point
- if (fmod(ellipse->start, M_PI_2) != 0.0 ) {
- *p = NR::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2d;
- }
+ if (fmod(ellipse->start, M_PI_2) != 0.0 ) {
+ *p = Geom::Point(cx + cos(ellipse->start)*rx, cy + sin(ellipse->start)*ry) * i2d;
+ }
// Add the end point, if it's not coincident with a quadrant point
- if (fmod(ellipse->end, M_PI_2) != 0.0 ) {
- *p = NR::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2d;
+ if (fmod(ellipse->end, M_PI_2) != 0.0 ) {
+ *p = Geom::Point(cx + cos(ellipse->end)*rx, cy + sin(ellipse->end)*ry) * i2d;
}
}
}
Inkscape::SVG::PathString str;
- NR::Point p1 = sp_arc_get_xy(arc, ge->start);
- NR::Point p2 = sp_arc_get_xy(arc, ge->end);
+ Geom::Point p1 = sp_arc_get_xy(arc, ge->start);
+ Geom::Point p2 = sp_arc_get_xy(arc, ge->end);
double rx = ge->rx.computed;
double ry = ge->ry.computed;
double dt = fmod(ge->end - ge->start, SP_2PI);
if (fabs(dt) < 1e-6) {
- NR::Point ph = sp_arc_get_xy(arc, (ge->start + ge->end) / 2.0);
+ Geom::Point ph = sp_arc_get_xy(arc, (ge->start + ge->end) / 2.0);
str.arcTo(rx, ry, 0, true, true, ph)
.arcTo(rx, ry, 0, true, true, p2)
.closePath();
bool fs = (dt > 0);
str.arcTo(rx, ry, 0, fa, fs, p2);
if (ge->closed) {
- NR::Point center = NR::Point(ge->cx.computed, ge->cy.computed);
+ Geom::Point center = Geom::Point(ge->cx.computed, ge->cy.computed);
str.lineTo(center).closePath();
}
}
ge->rx.computed = rx;
ge->ry.computed = ry;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- if (prefs->getDouble("tools.shapes.arc", "start", 0.0) != 0)
- ge->start = prefs->getDouble("tools.shapes.arc", "start", 0.0);
- if (prefs->getDouble("tools.shapes.arc", "end", 0.0) != 0)
- ge->end = prefs->getDouble("tools.shapes.arc", "end", 0.0);
- if (!prefs->getBool("tools.shapes.arc", "open"))
+ if (prefs->getDouble("/tools/shapes/arc/start", 0.0) != 0)
+ ge->start = prefs->getDouble("/tools/shapes/arc/start", 0.0);
+ if (prefs->getDouble("/tools/shapes/arc/end", 0.0) != 0)
+ ge->end = prefs->getDouble("/tools/shapes/arc/end", 0.0);
+ if (!prefs->getBool("/tools/shapes/arc/open"))
ge->closed = 1;
else
ge->closed = 0;
((SPObject *)arc)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
}
-NR::Point sp_arc_get_xy(SPArc *arc, gdouble arg)
+Geom::Point sp_arc_get_xy(SPArc *arc, gdouble arg)
{
SPGenericEllipse *ge = SP_GENERICELLIPSE(arc);
- return NR::Point(ge->rx.computed * cos(arg) + ge->cx.computed,
+ return Geom::Point(ge->rx.computed * cos(arg) + ge->cx.computed,
ge->ry.computed * sin(arg) + ge->cy.computed);
}