summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-26 19:41:50 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-26 19:41:50 +0000
commitf563567a6779e121758d0b6e7a3523caf15de4ab (patch)
treed7df78819d7fbfae567e33b1c341f3c32edf0182 /src
parentupdate to trunk (diff)
parentFix a crash on perspective/envelope LPE introduced in recent refactor of poin... (diff)
downloadinkscape-f563567a6779e121758d0b6e7a3523caf15de4ab.tar.gz
inkscape-f563567a6779e121758d0b6e7a3523caf15de4ab.zip
update to trunk
(bzr r13645.1.53)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pathstroke.cpp220
-rw-r--r--src/live_effects/lpe-jointype.cpp6
-rw-r--r--src/live_effects/lpe-jointype.h1
-rw-r--r--src/live_effects/lpe-perspective-envelope.cpp12
-rw-r--r--src/live_effects/lpe-taperstroke.cpp116
-rw-r--r--src/ui/tool/path-manipulator.cpp40
6 files changed, 190 insertions, 205 deletions
diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp
index 6fcfb79d5..d3147f233 100644
--- a/src/helper/geom-pathstroke.cpp
+++ b/src/helper/geom-pathstroke.cpp
@@ -19,6 +19,74 @@ namespace Geom {
// 2geom/circle-circle.cpp, no header
int circle_circle_intersection(Point X0, double r0, Point X1, double r1, Point &p0, Point &p1);
+/**
+ * Determine the intersection points between a circle C0 and a line defined
+ * by two points, X0 and X1.
+ *
+ * Which intersection point is assigned to p0 or p1 is unspecified, and callers
+ * should not depend on any particular intersection always being assigned to p0.
+ *
+ * Returns:
+ * If the line and circle do not cross, 0 is returned.
+ * If solution(s) exist, 2 is returned, and the results are written to p0 and p1.
+ */
+static int circle_line_intersection(Circle C0, Point X0, Point X1, Point &p0, Point &p1)
+{
+ /* equation of a circle: (x - h)^2 + (y - k)^2 = r^2 */
+ Coord r = C0.ray();
+ Coord h = C0.center()[X];
+ Coord k = C0.center()[Y];
+
+ Coord x0, y0;
+ Coord x1, y1;
+
+ if (are_near(X1[X], X0[X])) {
+ /* slope is undefined (vertical line) */
+ Coord c = X0[X];
+ Coord det = r*r - (c-h)*(c-h);
+
+ /* no intersection */
+ if (det < 0)
+ return 0;
+
+ /* solve for y */
+ y0 = k + std::sqrt(det);
+ y1 = k - std::sqrt(det);
+
+ // x == c (always)
+ x0 = c;
+ x1 = c;
+ } else {
+ /* equation of a line: y = mx + b */
+ Coord m = (X1[Y] - X0[Y]) / (X1[X] - X0[X]);
+ Coord b = X0[Y] - m*X0[X];
+
+ /* obtain quadratic for x: */
+ Coord A = m*m + 1;
+ Coord B = 2*h - 2*b*m + 2*k*m;
+ Coord C = b*b + h*h + k*k - r*r - 2*b*k;
+
+ Coord det = B*B - 4*A*C;
+
+ /* no intersection, circle and line do not cross */
+ if (det < 0)
+ return 0;
+
+ /* solve quadratic */
+ x0 = (B + std::sqrt(det)) / (2*A);
+ x1 = (B - std::sqrt(det)) / (2*A);
+
+ /* substitute the calculated x times to determine the y values */
+ y0 = m*x0 + b;
+ y1 = m*x1 + b;
+ }
+
+ p0 = Point(x0, y0);
+ p1 = Point(x1, y1);
+
+ return 2;
+}
+
static Point intersection_point(Point origin_a, Point vector_a, Point origin_b, Point vector_b)
{
Coord denom = cross(vector_b, vector_a);
@@ -88,13 +156,16 @@ void miter_join(Geom::Path& res, Geom::Curve const& outgoing, double miter, doub
Geom::Point tang1 = Geom::unitTangentAt(reverse(incoming.toSBasis()), 0.);
Geom::Point tang2 = outgoing.unitTangentAt(0);
Geom::Point p = Geom::intersection_point(incoming.finalPoint(), tang1, outgoing.initialPoint(), tang2);
+
+ bool satisfied = false;
+
if (p.isFinite()) {
// check size of miter
Geom::Point point_on_path = incoming.finalPoint() - Geom::rot90(tang1)*width;
- double len = Geom::distance(p, point_on_path);
- if (len <= miter) {
+ satisfied = Geom::distance(p, point_on_path) <= miter;
+ if (satisfied) {
// miter OK, check to see if we can do a relocation
- bool ls = dynamic_cast<Geom::LineSegment const*>(&res.back_open());
+ bool ls = res.back_open().degreesOfFreedom() <= 4;
if (ls) {
res.setFinal(p);
} else {
@@ -106,81 +177,93 @@ void miter_join(Geom::Path& res, Geom::Curve const& outgoing, double miter, doub
res.appendNew<Geom::LineSegment>(outgoing.initialPoint());
// check if we can do another relocation
+ bool ls = outgoing.degreesOfFreedom() <= 4;
- bool ls = dynamic_cast<Geom::LineSegment const*>(&outgoing);
- if (ls) {
+ if (satisfied && ls) {
res.setFinal(outgoing.finalPoint());
} else {
res.append(outgoing);
}
}
-// might need a little reworking
+Geom::Point pick_solution(Geom::Point points[2], Geom::Point tang2, Geom::Point endPt)
+{
+ Geom::Point sol;
+ if ( dot(tang2,points[0]-endPt) > 0 ) {
+ // points[0] is bad, choose points[1]
+ sol = points[1];
+ } else if ( dot(tang2,points[1]-endPt) > 0 ) { // points[0] could be good, now check points[1]
+ // points[1] is bad, choose points[0]
+ sol = points[0];
+ } else {
+ // both points are good, choose nearest
+ sol = ( distanceSq(endPt, points[0]) < distanceSq(endPt, points[1]) ) ? points[0] : points[1];
+ }
+ return sol;
+}
+
void extrapolate_join(Geom::Path& path_builder, Geom::Curve const& outgoing, double miter_limit, double line_width)
{
using namespace Geom;
Geom::Curve const& incoming = path_builder.back();
Geom::Point endPt = outgoing.initialPoint();
+ Geom::Point tang2 = Geom::unitTangentAt(outgoing.toSBasis(), 0);
+
+ Geom::Circle circle1 = Geom::touching_circle(Geom::reverse(incoming.toSBasis()), 0.);
+ Geom::Circle circle2 = Geom::touching_circle(outgoing.toSBasis(), 0);
+
+ bool inc_ls = !circle1.center().isFinite();
+ bool out_ls = !circle2.center().isFinite();
- // The method used when extrapolating curves fails to work when either side of the join to be extrapolated
- // is a line segment. When this situation is encountered, fall back to a regular miter join.
- bool lineProblem = (dynamic_cast<LineSegment const *>(&incoming)) || (dynamic_cast<LineSegment const*>(&outgoing));
- if (lineProblem == false) {
- // Geom::Point tang1 = Geom::unitTangentAt(Geom::reverse(incoming.toSBasis()), 0.);
- Geom::Point tang2 = Geom::unitTangentAt(outgoing.toSBasis(), 0);
+ Geom::Point points[2];
- Geom::Circle circle1 = Geom::touching_circle(Geom::reverse(incoming.toSBasis()), 0.);
- Geom::Circle circle2 = Geom::touching_circle(outgoing.toSBasis(), 0);
+ int solutions = 0;
+ Geom::EllipticalArc *arc0 = NULL;
+ Geom::EllipticalArc *arc1 = NULL;
- Geom::Point points[2];
- int solutions = Geom::circle_circle_intersection(circle1.center(), circle1.ray(),
- circle2.center(), circle2.ray(),
- points[0], points[1]);
+ if (!inc_ls && !out_ls) {
+ solutions = Geom::circle_circle_intersection(circle1.center(), circle1.ray(),
+ circle2.center(), circle2.ray(),
+ points[0], points[1]);
if (solutions == 2) {
- Geom::Point sol(0,0);
- if ( dot(tang2,points[0]-endPt) > 0 ) {
- // points[0] is bad, choose points[1]
- sol = points[1];
- } else if ( dot(tang2,points[1]-endPt) > 0 ) { // points[0] could be good, now check points[1]
- // points[1] is bad, choose points[0]
- sol = points[0];
- } else {
- // both points are good, choose nearest
- sol = ( distanceSq(endPt, points[0]) < distanceSq(endPt, points[1]) ) ? points[0] : points[1];
- }
+ Geom::Point sol = pick_solution(points, tang2, endPt);
- Geom::EllipticalArc *arc0 = circle1.arc(incoming.finalPoint(), 0.5*(incoming.finalPoint()+sol), sol, true);
- Geom::EllipticalArc *arc1 = circle2.arc(sol, 0.5*(sol+endPt), endPt, true);
- try {
- if (arc0) {
- path_builder.append(*arc0);
- delete arc0;
- arc0 = NULL;
- } else {
- throw std::exception();
- }
-
- if (arc1) {
- path_builder.append(*arc1);
- delete arc1;
- arc1 = NULL;
- } else {
- throw std::exception();
- }
-
- } catch (std::exception const & ex) {
- printf("WARNING: Error extrapolating line join: %s\n", ex.what());
- path_builder.appendNew<Geom::LineSegment>(endPt);
- }
- path_builder.append(outgoing);
- } else {
- // 1 or no solutions found, default to miter
- miter_join(path_builder, outgoing, miter_limit, line_width);
+ arc0 = circle1.arc(incoming.finalPoint(), 0.5*(incoming.finalPoint()+sol), sol, true);
+ arc1 = circle2.arc(sol, 0.5*(sol+endPt), endPt, true);
+ }
+ } else if (inc_ls && !out_ls) {
+ solutions = Geom::circle_line_intersection(circle2, incoming.initialPoint(), incoming.finalPoint(), points[0], points[1]);
+
+ if (solutions == 2) {
+ Geom::Point sol = pick_solution(points, tang2, endPt);
+ path_builder.setFinal(sol);
+ arc1 = circle2.arc(sol, 0.5*(sol+endPt), endPt, true);
+ }
+ } else if (!inc_ls && out_ls) {
+ solutions = Geom::circle_line_intersection(circle1, outgoing.initialPoint(), outgoing.finalPoint(), points[0], points[1]);
+
+ if (solutions == 2) {
+ Geom::Point sol = pick_solution(points, tang2, endPt);
+ arc0 = circle1.arc(incoming.finalPoint(), 0.5*(sol+incoming.finalPoint()), sol, true);
}
- } else {
- // Line segments exist
- miter_join(path_builder, outgoing, miter_limit, line_width);
}
+
+ if (solutions != 2)
+ // no solutions available, fall back to miter
+ return miter_join(path_builder, outgoing, miter_limit, line_width);
+
+ if (arc0)
+ path_builder.append(*arc0);
+ if (arc1)
+ path_builder.append(*arc1);
+
+ delete arc0;
+ delete arc1;
+
+ if (!inc_ls && out_ls)
+ path_builder.appendNew<Geom::LineSegment>(outgoing.finalPoint());
+ else
+ path_builder.append(outgoing);
}
void join_inside(Geom::Path& res, Geom::Curve const& outgoing)
@@ -207,6 +290,9 @@ void join_inside(Geom::Path& res, Geom::Curve const& outgoing)
void outline_helper(Geom::Path& res, Geom::Path const& to_add, double width, double miter, Inkscape::LineJoinType join)
{
+ if (res.size() == 0 || to_add.size() == 0)
+ return;
+
Geom::Curve const& outgoing = to_add[0];
if (Geom::are_near(res.finalPoint(), outgoing.initialPoint())) {
// if the points are /that/ close, just ignore this one
@@ -216,7 +302,6 @@ void outline_helper(Geom::Path& res, Geom::Path const& to_add, double width, dou
}
Geom::Point tang1 = -Geom::unitTangentAt(reverse(res.back().toSBasis()), 0.);
- //Geom::Point tang2 = to_add[0].unitTangentAt(0);
Geom::Point discontinuity_vec = to_add.initialPoint() - res.finalPoint();
bool on_outside = (Geom::dot(tang1, discontinuity_vec) >= 0);
@@ -368,9 +453,11 @@ void offset_quadratic(Geom::Path& p, Geom::QuadraticBezier const& bez, double wi
void offset_curve(Geom::Path& res, Geom::Curve const* current, double width)
{
- double const tolerance = 0.0025;
+ double const tolerance = 0.005;
size_t levels = 8;
+ if (current->isDegenerate()) return; // don't do anything
+
// TODO: we can handle SVGEllipticalArc here as well, do that!
if (Geom::BezierCurve const *b = dynamic_cast<Geom::BezierCurve const*>(current)) {
@@ -390,7 +477,7 @@ void offset_curve(Geom::Path& res, Geom::Curve const* current, double width)
break;
}
default: {
- Geom::Path sbasis_path = Geom::cubicbezierpath_from_sbasis(current->toSBasis(), 0.1);
+ Geom::Path sbasis_path = Geom::cubicbezierpath_from_sbasis(current->toSBasis(), tolerance);
for (size_t i = 0; i < sbasis_path.size(); ++i)
offset_curve(res, &sbasis_path[i], width);
break;
@@ -469,6 +556,7 @@ Geom::PathVector outline(Geom::Path const& input, double width, double miter, Li
if (!input.closed()) {
cf(res, with_dir, against_dir, width);
} else {
+ res.closePath();
res.moveTo(against_dir.initialPoint());
}
@@ -476,9 +564,9 @@ Geom::PathVector outline(Geom::Path const& input, double width, double miter, Li
if (!input.closed()) {
cf(res, against_dir, with_dir, width);
- res.closePath();
}
+ res.closePath();
res.flush();
return res.peek();
}
@@ -507,7 +595,8 @@ Geom::Path half_outline(Geom::Path const& input, double width, double miter, Lin
res.append(temp);
} else {
outline_helper(res, temp, width, miter, join);
- res.insert(res.end(), ++temp.begin(), temp.end());
+ if (temp.size() > 0)
+ res.insert(res.end(), ++temp.begin(), temp.end());
}
// odd number of paths
@@ -515,7 +604,8 @@ Geom::Path half_outline(Geom::Path const& input, double width, double miter, Lin
temp = Geom::Path();
offset_curve(temp, &input[u+1], width);
outline_helper(res, temp, width, miter, join);
- res.insert(res.end(), ++temp.begin(), temp.end());
+ if (temp.size() > 0)
+ res.insert(res.end(), ++temp.begin(), temp.end());
}
}
diff --git a/src/live_effects/lpe-jointype.cpp b/src/live_effects/lpe-jointype.cpp
index 09869822c..c7ea64b77 100644
--- a/src/live_effects/lpe-jointype.cpp
+++ b/src/live_effects/lpe-jointype.cpp
@@ -63,7 +63,6 @@ LPEJoinType::LPEJoinType(LivePathEffectObject *lpeobject) :
//registerParameter(&end_lean);
registerParameter(&miter_limit);
registerParameter(&attempt_force_join);
- was_initialized = false;
//start_lean.param_set_range(-1,1);
//start_lean.param_set_increments(0.1, 0.1);
//start_lean.param_set_digits(4);
@@ -109,10 +108,7 @@ void LPEJoinType::doOnApply(SPLPEItem const* lpeitem)
sp_desktop_apply_css_recursive(item, css, true);
sp_repr_css_attr_unref (css);
- if (!was_initialized) {
- was_initialized = true;
- line_width.param_set_value(width);
- }
+ line_width.param_set_value(width);
}
}
diff --git a/src/live_effects/lpe-jointype.h b/src/live_effects/lpe-jointype.h
index 799901eb6..bca0961c9 100644
--- a/src/live_effects/lpe-jointype.h
+++ b/src/live_effects/lpe-jointype.h
@@ -37,7 +37,6 @@ private:
//ScalarParam end_lean;
ScalarParam miter_limit;
BoolParam attempt_force_join;
- bool was_initialized;
};
} //namespace LivePathEffect
diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp
index d60a13c23..b5885bdb3 100644
--- a/src/live_effects/lpe-perspective-envelope.cpp
+++ b/src/live_effects/lpe-perspective-envelope.cpp
@@ -48,11 +48,11 @@ LPEPerspectiveEnvelope::LPEPerspectiveEnvelope(LivePathEffectObject *lpeobject)
Down_Right_Point(_("Down Right"), _("Down Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Down_Right_Point", &wr, this)
{
// register all your parameters here, so Inkscape knows which parameters this effect has:
- registerParameter( dynamic_cast<Parameter *>(&deform_type));
- registerParameter( dynamic_cast<Parameter *>(&Up_Left_Point) );
- registerParameter( dynamic_cast<Parameter *>(&Up_Right_Point) );
- registerParameter( dynamic_cast<Parameter *>(&Down_Left_Point) );
- registerParameter( dynamic_cast<Parameter *>(&Down_Right_Point) );
+ registerParameter(&deform_type);
+ registerParameter(&Up_Left_Point);
+ registerParameter(&Up_Right_Point);
+ registerParameter(&Down_Left_Point);
+ registerParameter(&Down_Right_Point);
}
LPEPerspectiveEnvelope::~LPEPerspectiveEnvelope()
@@ -340,8 +340,8 @@ LPEPerspectiveEnvelope::resetDefaults(SPItem const* item)
{
Effect::resetDefaults(item);
original_bbox(SP_LPE_ITEM(item));
- resetGrid();
setDefaults();
+ resetGrid();
}
void
diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp
index d54b2acc0..bdd36df68 100644
--- a/src/live_effects/lpe-taperstroke.cpp
+++ b/src/live_effects/lpe-taperstroke.cpp
@@ -186,18 +186,8 @@ static Geom::Path return_at_first_cusp(Geom::Path const & path_in, double /*smoo
return temp;
}
-static Geom::CubicBezier sbasis_to_cubicbezier(Geom::D2<Geom::SBasis> const & sbasis_in)
-{
- std::vector<Geom::Point> temp;
- Geom::sbasis_to_bezier(temp, sbasis_in, 4);
- return Geom::CubicBezier( temp );
-}
-
Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path pattern, double width);
-// references to pointers
-void subdivideCurve(Geom::Curve * curve_in, Geom::Coord t, Geom::Curve *& val_first, Geom::Curve *& val_second);
-
// actual effect
Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
@@ -357,85 +347,18 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
*/
Geom::PathVector LPETaperStroke::doEffect_simplePath(Geom::PathVector const & path_in)
{
- size_t size = path_in[0].size();
-
- unsigned loc = (unsigned)attach_start;
- Geom::Curve * curve_start = path_in[0] [loc].duplicate();
-
- std::vector<Geom::Path> pathv_out;
- Geom::Path path_out = Geom::Path();
-
- Geom::Path trimmed_start = Geom::Path();
- Geom::Path trimmed_end = Geom::Path();
-
- for (size_t i = 0; i < loc; ++i) {
- trimmed_start.append(path_in[0] [i]);
- }
-
- Geom::Curve * temp;
- subdivideCurve(curve_start, attach_start - loc, temp, curve_start);
- trimmed_start.append(*temp);
- if (temp) delete temp; temp = 0;
-
- // special case: path is one segment long
- // special case: what if the two knots occupy the same segment?
- if ((size == 1) || ( size - unsigned(attach_end) - 1 == loc )) {
-
- // If you look into it, I don't actually think there is a working way to do this
- // with only point math. So we use nearest_point instead.
- Geom::Coord t = Geom::nearest_point(end_attach_point, *curve_start);
-
- // it is just a dumb segment
- // we have to do some shifting here because the value changed when we reduced the length
- // of the previous segment.
-
- subdivideCurve(curve_start, t, curve_start, temp);
- trimmed_end.append(*temp);
- if (temp) delete temp; temp = 0;
-
- for (size_t j = (size - attach_end) + 1; j < size; ++j) {
- trimmed_end.append(path_in[0] [j]);
- }
-
- path_out.append(*curve_start);
- pathv_out.push_back(trimmed_start);
- pathv_out.push_back(path_out);
- pathv_out.push_back(trimmed_end);
- return pathv_out;
- }
-
- pathv_out.push_back(trimmed_start);
+ Geom::Coord endTime = path_in[0].size() - attach_end;
- // append almost all of the rest of the path, ignore the curves that the knot is past (we'll get to it in a minute)
- path_out.append(*curve_start);
-
- for (size_t k = loc + 1; k < (size - unsigned(attach_end)) - 1; ++k) {
- path_out.append(path_in[0] [k]);
- }
-
- // deal with the last segment in a very similar fashion to the first
- loc = size - attach_end;
-
- Geom::Curve * curve_end = path_in[0] [loc].duplicate();
-
- Geom::Coord t = Geom::nearest_point(end_attach_point, *curve_end);
-
- subdivideCurve(curve_end, t, curve_end, temp);
- trimmed_end.append(*temp);
- if (temp) delete temp; temp = 0;
-
- for (size_t j = (size - attach_end) + 1; j < size; ++j) {
- trimmed_end.append(path_in[0] [j]);
- }
-
- path_out.append(*curve_end);
- pathv_out.push_back(path_out);
-
- pathv_out.push_back(trimmed_end);
-
- if (curve_end) delete curve_end;
- if (curve_start) delete curve_start;
- return pathv_out;
+ Geom::Path p1 = path_in[0].portion(0., attach_start);
+ Geom::Path p2 = path_in[0].portion(attach_start, endTime);
+ Geom::Path p3 = path_in[0].portion(endTime, path_in[0].size());
+
+ Geom::PathVector out;
+ out.push_back(p1);
+ out.push_back(p2);
+ out.push_back(p3);
+
+ return out;
}
@@ -523,23 +446,6 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path
}
}
-void subdivideCurve(Geom::Curve * curve_in, Geom::Coord t, Geom::Curve *& val_first, Geom::Curve *& val_second)
-{
- if (Geom::LineSegment* linear = dynamic_cast<Geom::LineSegment*>(curve_in)) {
- // special case for line segments
- std::pair<Geom::LineSegment, Geom::LineSegment> seg_pair = linear->subdivide(t);
- val_first = seg_pair.first.duplicate();
- val_second = seg_pair.second.duplicate();
- } else {
- // all other cases:
- Geom::CubicBezier cubic = sbasis_to_cubicbezier(curve_in->toSBasis());
- std::pair<Geom::CubicBezier, Geom::CubicBezier> cubic_pair = cubic.subdivide(t);
- val_first = cubic_pair.first.duplicate();
- val_second = cubic_pair.second.duplicate();
- }
-}
-
-
void LPETaperStroke::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item)
{
KnotHolderEntity *e = new TpS::KnotHolderEntityAttachBegin(this);
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 49991c75f..d2bdd9384 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1240,14 +1240,11 @@ int PathManipulator::BSplineGetSteps() const {
// determines if the trace has bspline effect
void PathManipulator::recalculateIsBSpline(){
- SPLPEItem * path = dynamic_cast<SPLPEItem *>(_path);
- if (path){
- if(path->hasPathEffect()){
- Inkscape::LivePathEffect::Effect const *thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE);
- if(thisEffect){
- _is_bspline = true;
- return;
- }
+ if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) {
+ Inkscape::LivePathEffect::Effect const *thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE);
+ if(thisEffect){
+ _is_bspline = true;
+ return;
}
}
_is_bspline = false;
@@ -1351,22 +1348,19 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE)
_spcurve->set_pathvector(pathv);
if (alert_LPE) {
/// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming?
- SPLPEItem * path = dynamic_cast<SPLPEItem *>(_path);
- if (path){
- if(path->hasPathEffect()){
- Inkscape::LivePathEffect::Effect* thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE);
- if(thisEffect){
- LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(thisEffect->getLPEObj()->get_lpe());
- if (lpe_pwr) {
- lpe_pwr->adjustForNewPath(pathv);
- }
+ if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) {
+ Inkscape::LivePathEffect::Effect* thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE);
+ if(thisEffect){
+ LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(thisEffect->getLPEObj()->get_lpe());
+ if (lpe_pwr) {
+ lpe_pwr->adjustForNewPath(pathv);
}
- thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER);
- if(thisEffect){
- LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(thisEffect->getLPEObj()->get_lpe());
- if (lpe_fll) {
- lpe_fll->adjustForNewPath(pathv);
- }
+ }
+ thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER);
+ if(thisEffect){
+ LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(thisEffect->getLPEObj()->get_lpe());
+ if (lpe_fll) {
+ lpe_fll->adjustForNewPath(pathv);
}
}
}