summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-31 10:56:46 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-31 10:56:46 +0000
commita1cd9b9c2fdb5b4258a14159a3a4baa2782e7d40 (patch)
tree082b1b90fb1d19d6013ff44a019cddab76039b2a /src/live_effects
parentupdate to trunk (diff)
downloadinkscape-a1cd9b9c2fdb5b4258a14159a3a4baa2782e7d40.tar.gz
inkscape-a1cd9b9c2fdb5b4258a14159a3a4baa2782e7d40.zip
end append path
(bzr r13645.1.57)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp64
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h1
-rw-r--r--src/live_effects/parameter/satellitepairarray.cpp23
-rw-r--r--src/live_effects/parameter/satellitepairarray.h1
4 files changed, 59 insertions, 30 deletions
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index 2fc2027ab..0502a4192 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -59,7 +59,8 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
hide_knots(_("Hide knots"), _("Hide knots"), "hide_knots", &wr, this, false),
ignore_radius_0(_("Ignore 0 radius knots"), _("Ignore 0 radius knots"), "ignore_radius_0", &wr, this, false),
helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 0),
- pointwise(NULL)
+ pointwise(NULL),
+ segCount(0)
{
registerParameter(&satellitepairarrayparam_values);
registerParameter(&unit);
@@ -380,43 +381,52 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
}
bool refresh = false;
bool hide = true;
- for(unsigned i = 0; i < sats.size(); i++){
- if(sats[i].second.getIsTime() != flexible){
- sats[i].second.setIsTime(flexible);
- double amount = sats[i].second.getAmount();
- D2<SBasis> d2_in = pwd2_in[sats[i].first];
- if(sats[i].second.getIsTime()){
- double time = sats[i].second.toTime(amount,d2_in);
- sats[i].second.setAmount(time);
+ for (std::vector<std::pair<size_t,Satellite> >::iterator it = sats.begin(); it != sats.end();)
+ {
+ if(it->second.getIsTime() != flexible){
+ it->second.setIsTime(flexible);
+ double amount = it->second.getAmount();
+ D2<SBasis> d2_in = pwd2_in[it->first];
+ if(it->second.getIsTime()){
+ double time = it->second.toTime(amount,d2_in);
+ it->second.setAmount(time);
} else {
- double size = sats[i].second.toSize(amount,d2_in);
- sats[i].second.setAmount(size);
+ double size = it->second.toSize(amount,d2_in);
+ it->second.setAmount(size);
}
}
- if(sats[i].second.getHasMirror() != mirror_knots){
- sats[i].second.setHasMirror(mirror_knots);
+ if(it->second.getHasMirror() != mirror_knots){
+ it->second.setHasMirror(mirror_knots);
refresh = true;
}
- if(sats[i].second.getHidden() == false){
+ if(it->second.getHidden() == false){
hide = false;
}
- sats[i].second.setHidden(hide_knots);
+ it->second.setHidden(hide_knots);
+ if(it->second.getIsEndOpen()){
+ it = sats.erase(it);
+ } else {
+ ++it;
+ }
}
if(hide != hide_knots){
refresh = true;
}
- pointwise = new Pointwise(pwd2_in, sats);
- //mandatory call
- pointwise->set_extremes(false, false, true);
+
+ if(pointwise && c->get_segment_count() != segCount && segCount != 0){
+ pointwise->recalculate_for_new_pwd2(pwd2_in);
+ pointwise->set_extremes(false, true, 0.0, 0.0);
+ segCount = c->get_segment_count();
+ } else {
+ pointwise = new Pointwise(pwd2_in, sats);
+ //mandatory call
+ pointwise->set_extremes(false, true);
+ segCount = c->get_segment_count();
+ }
satellitepairarrayparam_values.set_pointwise(pointwise);
if(refresh){
refreshKnots();
}
- if(c->nodes_in_path() != sats.size()){
- pointwise->recalculate_for_new_pwd2(pwd2_in);
- pointwise->set_extremes(true, false, true, 0.0, 0.0);
- satellitepairarrayparam_values.set_pointwise(pointwise);
- }
} else {
g_warning("LPE Fillet can only be applied to shapes (not groups).");
}
@@ -426,8 +436,8 @@ void
LPEFilletChamfer::adjustForNewPath(std::vector<Geom::Path> const &path_in)
{
if (!path_in.empty() && pointwise) {
- pointwise->recalculate_for_new_pwd2(pathv_to_linear_and_cubic_beziers(path_in)[0].toPwSb());
- pointwise->set_extremes(true, false, true, 0.0, 0.0);
+ pointwise->recalculate_for_new_pwd2(remove_short_cuts(paths_to_pw(pathv_to_linear_and_cubic_beziers(path_in)),0.01));
+ pointwise->set_extremes(false, true, 0.0, 0.0);
satellitepairarrayparam_values.set_pointwise(pointwise);
}
}
@@ -532,10 +542,6 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
if(time1 <= time0){
time1 = time0;
}
- std::cout << counter << ":::::::::::::::::::::::::::::\n";
- std::cout << time0 << "time0\n";
- std::cout << time1 << "time1\n";
- std::cout << time2 << "time2\n";
std::vector<double> times;
times.push_back(time0);
times.push_back(time1);
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index 1bedbefa4..89d91265a 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -65,6 +65,7 @@ private:
ScalarParam helper_size;
Geom::Pointwise *pointwise;
+ double segCount;
LPEFilletChamfer(const LPEFilletChamfer &);
LPEFilletChamfer &operator=(const LPEFilletChamfer &);
diff --git a/src/live_effects/parameter/satellitepairarray.cpp b/src/live_effects/parameter/satellitepairarray.cpp
index 8102edf9b..3876dc8df 100644
--- a/src/live_effects/parameter/satellitepairarray.cpp
+++ b/src/live_effects/parameter/satellitepairarray.cpp
@@ -13,6 +13,7 @@
#include "live_effects/parameter/satellitepairarray.h"
#include "live_effects/effect.h"
#include "sp-lpe-item.h"
+#include <preferences.h>
// TODO due to internal breakage in glibmm headers,
// this has to be included last.
#include <glibmm/i18n.h>
@@ -113,7 +114,8 @@ void SatellitePairArrayParam::updateCanvasIndicators(bool mirror)
}
if(mirror == true){
if(d2_prev_index){
- pos = _vector[i].second.getOpositeTime(size_out,pwd2[*d2_prev_index]);
+ d2 = pwd2[*d2_prev_index];
+ pos = _vector[i].second.getOpositeTime(size_out,d2);
if(lenght_out < size_out){
overflow = true;
}
@@ -196,6 +198,24 @@ void SatellitePairArrayParam::recalculate_knots()
}
}
+void
+SatellitePairArrayParam::param_transform_multiply(Geom::Affine const &postmul,
+ bool /*set*/)
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ if (prefs->getBool("/options/transform/rectcorners", true)) {
+ for (size_t i = 0; i < _vector.size(); ++i) {
+ if(!_vector[i].second.getIsTime() && _vector[i].second.getAmount() > 0){
+ _vector[i].second.setAmount(_vector[i].second.getAmount() * ((postmul.expansionX() + postmul.expansionY()) / 2));
+ }
+ }
+ param_set_and_write_new_value(_vector);
+ }
+
+ // param_set_and_write_new_value( (*this) * postmul );
+}
+
void SatellitePairArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
SPDesktop *desktop,
SPItem *item,
@@ -315,6 +335,7 @@ void FilletChamferKnotHolderEntity::knot_set(Point const &p,
}
}
+
Geom::Point
FilletChamferKnotHolderEntity::knot_get() const
{
diff --git a/src/live_effects/parameter/satellitepairarray.h b/src/live_effects/parameter/satellitepairarray.h
index a85e3f83f..462f1017c 100644
--- a/src/live_effects/parameter/satellitepairarray.h
+++ b/src/live_effects/parameter/satellitepairarray.h
@@ -52,6 +52,7 @@ public:
virtual bool providesKnotHolderEntities() const {
return true;
}
+ void param_transform_multiply(Geom::Affine const &postmul, bool /*set*/);
void set_document_unit(Glib::ustring value_document_unit);
void set_use_distance(bool use_knot_distance );
void set_unit(const gchar *abbr);