diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-06-12 14:33:27 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-06-12 14:33:27 +0000 |
| commit | 7e1183de6ed51ff730915fe936e2bb607dd72f33 (patch) | |
| tree | a8e4d16259d2ce0c86e298bd06cf746bc7a2a323 /src | |
| parent | update to trunk (diff) | |
| download | inkscape-7e1183de6ed51ff730915fe936e2bb607dd72f33.tar.gz inkscape-7e1183de6ed51ff730915fe936e2bb607dd72f33.zip | |
Fix bug consecutive nodes at same position
(bzr r13645.1.152)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 14 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.h | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.cpp | 7 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.h | 2 |
4 files changed, 22 insertions, 2 deletions
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index 1d5c036ba..48e68d366 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -55,7 +55,8 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) apply_with_radius(_("Apply changes if radius > 0"), _("Apply changes if radius > 0"), "apply_with_radius", &wr, this, true), helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 0), - pathvector_satellites(NULL) + pathvector_satellites(NULL), + degenerate_hide(false) { registerParameter(&satellites_param); registerParameter(&method); @@ -387,6 +388,11 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) doOnApply(lpeItem); satellites = satellites_param.data(); } + if (degenerate_hide) { + satellites_param.setGlobalKnotHide(true); + } else { + satellites_param.setGlobalKnotHide(false); + } if (hide_knots) { satellites_param.setHelperSize(0); } else { @@ -438,6 +444,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) Geom::PathVector path_out; size_t path = 0; const double K = (4.0 / 3.0) * (sqrt(2.0) - 1.0); + degenerate_hide = false; Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers(path_in); for (Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { if (path_it->empty()) { @@ -468,6 +475,11 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) continue; } Satellite satellite = satellites[path][next_index]; + if (Geom::are_near((*curve_it1).initialPoint(),(*curve_it1).finalPoint())) { + degenerate_hide = true; + g_warning("Knots hidded if consecutive nodes has the same position."); + return path_in; + } if (!curve) { //curve == 0 if (!path_it->closed()) { time0 = 0; diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h index 363a35d43..420403b70 100644 --- a/src/live_effects/lpe-fillet-chamfer.h +++ b/src/live_effects/lpe-fillet-chamfer.h @@ -60,6 +60,7 @@ private: BoolParam apply_with_radius; ScalarParam helper_size; + bool degenerate_hide; PathVectorSatellites *pathvector_satellites; Geom::PathVector _hp; diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index e61aaf38d..db7cf80c0 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -33,6 +33,7 @@ SatellitesArrayParam::SatellitesArrayParam(const Glib::ustring &label, _knot_color = 0xAAFF8800; _helper_size = 0; _use_distance = false; + _global_knot_hide = false; _effectType = FILLET_CHAMFER; _last_pathvector_satellites = NULL; } @@ -57,6 +58,10 @@ void SatellitesArrayParam::setUseDistance(bool use_knot_distance) _use_distance = use_knot_distance; } +void SatellitesArrayParam::setGlobalKnotHide(bool global_knot_hide) +{ + _global_knot_hide = global_knot_hide; +} void SatellitesArrayParam::setEffectType(EffectType et) { _effectType = et; @@ -331,7 +336,7 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point FilletChamferKnotHolderEntity::knot_get() const { - if (!_pparam->_last_pathvector_satellites) { + if (!_pparam->_last_pathvector_satellites || _pparam->_global_knot_hide) { return Geom::Point(Geom::infinity(), Geom::infinity()); } Geom::Point tmp_point; diff --git a/src/live_effects/parameter/satellitesarray.h b/src/live_effects/parameter/satellitesarray.h index a52bcef53..30b1db6c1 100644 --- a/src/live_effects/parameter/satellitesarray.h +++ b/src/live_effects/parameter/satellitesarray.h @@ -55,6 +55,7 @@ public: } void param_transform_multiply(Geom::Affine const &postmul, bool /*set*/); void setUseDistance(bool use_knot_distance); + void setGlobalKnotHide(bool global_knot_hide); void setEffectType(EffectType et); void setPathVectorSatellites(PathVectorSatellites *pathVectorSatellites); void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); @@ -75,6 +76,7 @@ private: Geom::PathVector _hp; int _helper_size; bool _use_distance; + bool _global_knot_hide; EffectType _effectType; PathVectorSatellites *_last_pathvector_satellites; |
