summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-19 18:26:22 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-19 18:26:22 +0000
commitaeffc3f474c1ce460b2c9f8340de283d5853a164 (patch)
tree5ed8e1047308d0d2db0baefa8f1ee38b261b6da1 /src/live_effects/parameter
parentcommit for refactoring (diff)
downloadinkscape-aeffc3f474c1ce460b2c9f8340de283d5853a164.tar.gz
inkscape-aeffc3f474c1ce460b2c9f8340de283d5853a164.zip
fixing a boring bug in path manipulator
(bzr r13645.1.43)
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/array.cpp17
-rw-r--r--src/live_effects/parameter/array.h5
-rw-r--r--src/live_effects/parameter/satellitepairarray.cpp59
3 files changed, 38 insertions, 43 deletions
diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp
index e8a1b9532..d8b2388da 100644
--- a/src/live_effects/parameter/array.cpp
+++ b/src/live_effects/parameter/array.cpp
@@ -54,19 +54,18 @@ sp_svg_satellite_read_d(gchar const *str, Geom::Satellite *sat){
return 0;
}
gchar ** strarray = g_strsplit(str, "*", 0);
- if(strarray[9] && !strarray[10]){
+ if(strarray[8] && !strarray[9]){
sat->setSatelliteType(strarray[0]);
sat->setIsTime(strncmp(strarray[1],"1",1) == 0);
- sat->setIsClosing(strncmp(strarray[2],"1",1) == 0);
- sat->setIsStart(strncmp(strarray[3],"1",1) == 0);
- sat->setActive(strncmp(strarray[4],"1",1) == 0);
- sat->setHasMirror(strncmp(strarray[5],"1",1) == 0);
- sat->setHidden(strncmp(strarray[6],"1",1) == 0);
+ sat->setIsEndOpen(strncmp(strarray[2],"1",1) == 0);
+ sat->setActive(strncmp(strarray[3],"1",1) == 0);
+ sat->setHasMirror(strncmp(strarray[4],"1",1) == 0);
+ sat->setHidden(strncmp(strarray[5],"1",1) == 0);
double amount,angle;
float stepsTmp;
- sp_svg_number_read_d(strarray[7], &amount);
- sp_svg_number_read_d(strarray[8], &angle);
- sp_svg_number_read_f(strarray[9], &stepsTmp);
+ sp_svg_number_read_d(strarray[6], &amount);
+ sp_svg_number_read_d(strarray[7], &angle);
+ sp_svg_number_read_f(strarray[8], &stepsTmp);
unsigned int steps = (unsigned int)stepsTmp;
sat->setAmount(amount);
sat->setAngle(angle);
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index a6e797d4e..5443cc3c4 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -119,9 +119,7 @@ protected:
str << "*";
str << nVector.second.getIsTime();
str << "*";
- str << nVector.second.getIsClosing();
- str << "*";
- str << nVector.second.getIsStart();
+ str << nVector.second.getIsEndOpen();
str << "*";
str << nVector.second.getActive();
str << "*";
@@ -134,6 +132,7 @@ protected:
str << nVector.second.getAngle();
str << "*";
str << nVector.second.getSteps();
+ std::cout << str.str() << "SATEEELIITE\n";
}
StorageType readsvg(const gchar * str);
diff --git a/src/live_effects/parameter/satellitepairarray.cpp b/src/live_effects/parameter/satellitepairarray.cpp
index 45f522693..045ef2060 100644
--- a/src/live_effects/parameter/satellitepairarray.cpp
+++ b/src/live_effects/parameter/satellitepairarray.cpp
@@ -52,7 +52,7 @@ void SatellitePairArrayParam::set_oncanvas_looks(SPKnotShapeType shape,
void SatellitePairArrayParam::set_pointwise(Geom::Pointwise *pointwise)
{
last_pointwise = pointwise;
- std::cout << pointwise->getSatellites().size() << "setted\n";
+ param_set_and_write_new_value(last_pointwise->getSatellites());
}
void SatellitePairArrayParam::set_document_unit(Glib::ustring value_document_unit)
@@ -106,20 +106,19 @@ void SatellitePairArrayParam::updateCanvasIndicators(bool mirror)
double size_out = _vector[i].second.getSize(pwd2[_vector[i].first]);
double lenght_out = Geom::length(pwd2[_vector[i].first], Geom::EPSILON);
double lenght_in = 0;
- boost::optional<Geom::D2<Geom::SBasis> > curve_in = last_pointwise->getCurveIn(_vector[i]);
- if(curve_in){
- lenght_in = Geom::length(*curve_in, Geom::EPSILON);
+ boost::optional<unsigned int> d2_prev_index = last_pointwise->getPrevious(_vector[i].first);
+ if(d2_prev_index){
+ lenght_in = Geom::length(pwd2[*d2_prev_index], Geom::EPSILON);
}
if(mirror == true){
- if(curve_in){
- d2 = *curve_in;
- pos = _vector[i].second.getOpositeTime(size_out,*curve_in);
+ if(d2_prev_index){
+ pos = _vector[i].second.getOpositeTime(size_out,pwd2[*d2_prev_index]);
if(lenght_out < size_out){
overflow = true;
}
}
} else {
- pos = _vector[i].second.getTime(pwd2[_vector[i].first]);
+ pos = _vector[i].second.getTime(d2);
if(lenght_in < size_out){
overflow = true;
}
@@ -202,20 +201,18 @@ void SatellitePairArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
SPItem *item,
bool mirror)
{
- std::cout << _vector.size() << "recalculated\n";
recalculate_knots();
- std::cout << _vector.size() << "recalculated\n";
for (unsigned int i = 0; i < _vector.size(); ++i) {
+ int iPlus = i;
+ if( mirror == true){
+ iPlus = i + _vector.size();
+ }
if(!_vector[i].second.getActive() || _vector[i].second.getHidden()){
continue;
}
if(!_vector[i].second.getHasMirror() && mirror == true){
continue;
}
- int iPlus = i;
- if( mirror == true){
- iPlus = i + _vector.size();
- }
using namespace Geom;
SatelliteType type = _vector[i].second.getSatelliteType();
//IF is for filletChamfer effect...
@@ -289,19 +286,20 @@ void FilletChamferKnotHolderEntity::knot_set(Point const &p,
Geom::Pointwise* pointwise = _pparam->last_pointwise;
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2();
if(_pparam->_vector.size() <= _index){
- boost::optional<Geom::D2<Geom::SBasis> > d2_in = pointwise->getCurveIn(satellite);
- if(d2_in){
- double mirrorTime = Geom::nearest_point(s, *d2_in);
+ boost::optional<unsigned int> d2_prev_index = pointwise->getPrevious(satellite.first);
+ if(d2_prev_index){
+ Geom::D2<Geom::SBasis> d2_in = pwd2[*d2_prev_index];
+ double mirrorTime = Geom::nearest_point(s, d2_in);
double timeStart = 0;
std::vector<Satellite> satVector = pointwise->findPeviousSatellites(satellite.first,1);
if(satVector.size()>0){
- timeStart = satVector[0].getTime(*d2_in);
+ timeStart = satVector[0].getTime(d2_in);
}
if(timeStart > mirrorTime){
mirrorTime = timeStart;
}
- double size = satellite.second.toSize(mirrorTime, *d2_in);
- double amount = Geom::length(*d2_in, Geom::EPSILON) - size;
+ double size = satellite.second.toSize(mirrorTime, d2_in);
+ double amount = Geom::length(d2_in, Geom::EPSILON) - size;
if(satellite.second.getIsTime()){
amount = satellite.second.toTime(amount,pwd2[satellite.first]);
}
@@ -337,15 +335,13 @@ FilletChamferKnotHolderEntity::knot_get() const
}
Geom::Pointwise* pointwise = _pparam->last_pointwise;
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2();
- std::cout << pointwise->getSatellites().size() << "knotGet\n";
- std::cout << satellite.first << "sindex\n";
- std::cout << _index << "index\n";
if( _index >= _pparam->_vector.size()){
tmpPoint = satellite.second.getPosition(pwd2[satellite.first]);
- boost::optional<Geom::D2<Geom::SBasis> > d2_in = pointwise->getCurveIn(satellite);
- if(d2_in){
+ boost::optional<unsigned int> d2_prev_index = pointwise->getPrevious(satellite.first);
+ if(d2_prev_index){
+ Geom::D2<Geom::SBasis> d2_in = pwd2[*d2_prev_index];
double s = satellite.second.getSize(pwd2[satellite.first]);
- double t = satellite.second.getOpositeTime(s,*d2_in);
+ double t = satellite.second.getOpositeTime(s,d2_in);
if(t > 1){
t = 1;
}
@@ -355,12 +351,12 @@ FilletChamferKnotHolderEntity::knot_get() const
double timeStart = 0;
std::vector<Satellite> satVector = pointwise->findPeviousSatellites(satellite.first,1);
if(satVector.size()>0){
- timeStart = satVector[0].getTime(*d2_in);
+ timeStart = satVector[0].getTime(d2_in);
}
if(timeStart > t){
t = timeStart;
}
- tmpPoint = (*d2_in).valueAt(t);
+ tmpPoint = (d2_in).valueAt(t);
}
} else {
tmpPoint = satellite.second.getPosition(pwd2[satellite.first]);
@@ -430,11 +426,12 @@ void FilletChamferKnotHolderEntity::knot_click(guint state)
if(!_pparam->use_distance && !_pparam->_vector.at(index).second.getIsTime()){
amount = _pparam->last_pointwise->len_to_rad(amount, _pparam->_vector.at(index));
}
- boost::optional<Geom::D2<Geom::SBasis> > d2_in = _pparam->last_pointwise->getCurveIn(_pparam->_vector.at(index));
bool aprox = false;
D2<SBasis> d2_out = _pparam->last_pointwise->getPwd2()[index];
- if(d2_in){
- aprox = ((*d2_in)[0].degreesOfFreedom() != 2 || d2_out[0].degreesOfFreedom() != 2) && !_pparam->use_distance?true:false;
+ boost::optional<unsigned int> d2_prev_index = _pparam->last_pointwise->getPrevious(_pparam->_vector.at(index).first);
+ if(d2_prev_index){
+ Geom::D2<Geom::SBasis> d2_in = _pparam->last_pointwise->getPwd2()[*d2_prev_index];
+ aprox = ((d2_in)[0].degreesOfFreedom() != 2 || d2_out[0].degreesOfFreedom() != 2) && !_pparam->use_distance?true:false;
}
Inkscape::UI::Dialogs::FilletChamferPropertiesDialog::showDialog(
this->desktop, amount , this, _pparam->unit, _pparam->use_distance, aprox, _pparam->documentUnit,_pparam->_vector.at(index).second);