summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-21 21:24:37 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-21 21:24:37 +0000
commitc1487f9dc277520b8734b7e80387b35c78d979ae (patch)
treeb0a57903db1e8f37258a65e1db40317b28445d33 /src
parentupdate to trunk (diff)
downloadinkscape-c1487f9dc277520b8734b7e80387b35c78d979ae.tar.gz
inkscape-c1487f9dc277520b8734b7e80387b35c78d979ae.zip
Fixed bug whith maps
(bzr r13645.1.49)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/pointwise.cpp32
-rw-r--r--src/2geom/pointwise.h4
-rw-r--r--src/live_effects/lpe-bspline.cpp44
-rw-r--r--src/live_effects/lpe-bspline.h3
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp46
-rw-r--r--src/ui/tool/multi-path-manipulator.h2
-rw-r--r--src/ui/tool/path-manipulator.cpp30
-rw-r--r--src/ui/tool/path-manipulator.h2
8 files changed, 62 insertions, 101 deletions
diff --git a/src/2geom/pointwise.cpp b/src/2geom/pointwise.cpp
index f476821ff..733bd6496 100644
--- a/src/2geom/pointwise.cpp
+++ b/src/2geom/pointwise.cpp
@@ -36,8 +36,8 @@
namespace Geom {
-Pointwise::Pointwise(Piecewise<D2<SBasis> > pwd2)
- : _pwd2(pwd2)
+Pointwise::Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<std::pair<unsigned int,Satellite> > satellites)
+ : _pwd2(pwd2),_satellites(satellites),_pathInfo()
{
setPathInfo();
};
@@ -239,36 +239,34 @@ Pointwise::new_pwd_sustract(Piecewise<D2<SBasis> > A)
sats.push_back(std::make_pair(_satellites[i].first-counter,_satellites[i].second));
}
}
- std::cout << sats.size() << "SAAAAAAAAAAAAAAAAAAAAAAAATTSSIZE\n";
- std::cout << sats.size() << "SAAAAAAAAAAAAAAAAAAAAAAAATTSSIZE\n";
setSatellites(sats);
}
void
-Pointwise::set_extremes(std::vector<std::pair<unsigned int,Satellite> > &sats, bool active, bool hidden, double amount, double angle)
+Pointwise::set_extremes(bool active, bool hidden, double amount, double angle)
{
for(unsigned int i = 0; i < _pathInfo.size(); i++){
unsigned int firstNode = getFirst(_pathInfo[i].first);
unsigned int lastNode = getLast(_pathInfo[i].first);
if(!getIsClosed(lastNode)){
unsigned int lastIndex = 0;
- for(unsigned i = 0; i < sats.size(); i++){
- sats[i].second.setIsEndOpen(false);
- if(sats[i].first > lastNode){
+ for(unsigned j = 0; j < _satellites.size();j++){
+ _satellites[j].second.setIsEndOpen(false);
+ if(_satellites[j].first > lastNode){
break;
}
- if(sats[i].first == firstNode){
- sats[i].second.setActive(active);
- sats[i].second.setHidden(hidden);
- sats[i].second.setAmount(amount);
- sats[i].second.setAngle(angle);
+ if(_satellites[j].first == firstNode){
+ _satellites[j].second.setActive(active);
+ _satellites[j].second.setHidden(hidden);
+ _satellites[j].second.setAmount(amount);
+ _satellites[j].second.setAngle(angle);
}
- if(sats[i].first == lastNode){
- lastIndex = i;
+ if(_satellites[j].first == lastNode){
+ lastIndex = j;
}
}
- Satellite sat(sats[0].second.getSatelliteType(), sats[0].second.getIsTime(), true, active, sats[0].second.getHasMirror(), hidden, amount, angle, sats[0].second.getSteps());
- sats.insert(sats.begin() + lastIndex,std::make_pair(lastNode,sat));
+ Satellite sat(_satellites[0].second.getSatelliteType(), _satellites[0].second.getIsTime(), true, active, _satellites[0].second.getHasMirror(), hidden, amount, angle, _satellites[0].second.getSteps());
+ _satellites.insert(_satellites.begin() + lastIndex,std::make_pair(lastNode,sat));
}
}
}
diff --git a/src/2geom/pointwise.h b/src/2geom/pointwise.h
index 72ff852d0..f9dc2e47a 100644
--- a/src/2geom/pointwise.h
+++ b/src/2geom/pointwise.h
@@ -63,7 +63,7 @@ namespace Geom {
class Pointwise
{
public:
- Pointwise(Piecewise<D2<SBasis> > pwd2);
+ Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<std::pair<unsigned int,Satellite> > satellites);
virtual ~Pointwise();
std::vector<unsigned int> findSatellites(unsigned int A, int B = -1) const;
std::vector<unsigned int> findPeviousSatellites(unsigned int A, int B) const;
@@ -76,7 +76,7 @@ class Pointwise
void recalculate_for_new_pwd2(Piecewise<D2<SBasis> > A);
void new_pwd_append(Piecewise<D2<SBasis> > A);
void new_pwd_sustract(Piecewise<D2<SBasis> > A);
- void set_extremes(std::vector<std::pair<unsigned int,Satellite> > &sats, bool active, bool hidden, double amount, double angle);
+ void set_extremes(bool active, bool hidden, double amount, double angle);
void reverse(unsigned int start,unsigned int end);
void setPathInfo();
void setPathInfo(Piecewise<D2<SBasis> >);
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index b924d8a23..dba501f42 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -1,48 +1,16 @@
/*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <gtkmm.h>
-
-#if WITH_GLIBMM_2_32
-# include <glibmm/threads.h>
-#endif
-
-#include <glib.h>
-#include <glibmm/i18n.h>
-
-
-#include "display/curve.h"
-#include <2geom/bezier-curve.h>
-#include <2geom/point.h>
-#include "helper/geom-curves.h"
#include "live_effects/lpe-bspline.h"
-#include "live_effects/lpeobject.h"
-#include "live_effects/parameter/parameter.h"
#include "ui/widget/scalar.h"
-#include "xml/repr.h"
-#include "svg/svg.h"
+#include "display/curve.h"
+#include "helper/geom-curves.h"
#include "sp-path.h"
-#include "style.h"
-#include "document-private.h"
-#include "document.h"
-#include "document-undo.h"
-#include "verbs.h"
-#include "sp-lpe-item.h"
-#include "sp-namedview.h"
-#include "display/sp-canvas.h"
-#include <typeinfo>
-#include <vector>
-#include "util/units.h"
-// For handling un-continuous paths:
-#include "message-stack.h"
-#include "inkscape.h"
-
-using Inkscape::DocumentUndo;
+#include "svg/svg.h"
+#include "xml/repr.h"
+// TODO due to internal breakage in glibmm headers, this must be last:
+#include <glibmm/i18n.h>
namespace Inkscape {
namespace LivePathEffect {
diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h
index 642562b24..8017e39ef 100644
--- a/src/live_effects/lpe-bspline.h
+++ b/src/live_effects/lpe-bspline.h
@@ -6,9 +6,8 @@
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-
#include "live_effects/effect.h"
-#include "live_effects/parameter/bool.h"
+
#include <vector>
namespace Inkscape {
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index 09436676c..93c21469a 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -149,8 +149,7 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem)
satellites.push_back(std::make_pair(counterTotal-1, satellite));
}
}
- pointwise = new Pointwise( pwd2_in);
- pointwise->setSatellites(satellites);
+ pointwise = new Pointwise( pwd2_in,satellites);
satellitepairarrayparam_values.set_pointwise(pointwise);
} else {
g_warning("LPE Fillet/Chamfer can only be applied to shapes (not groups).");
@@ -373,8 +372,11 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(original_pathv);
pwd2_in = remove_short_cuts(pwd2_in, 0.01);
std::vector<std::pair<unsigned int,Geom::Satellite> > sats;
- sats = satellitepairarrayparam_values.data();
-
+ if(!pointwise){
+ sats = satellitepairarrayparam_values.data();
+ } else {
+ sats = pointwise->getSatellites();
+ }
//optional call
if(hide_knots){
satellitepairarrayparam_values.set_helper_size(0);
@@ -382,30 +384,29 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
satellitepairarrayparam_values.set_helper_size(helper_size);
}
bool refresh = false;
- for (std::vector<std::pair<unsigned int,Geom::Satellite> >::iterator it = sats.begin(); it != sats.end(); ++it) {
- 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);
+ 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);
} else {
- double size = it->second.toSize(amount,d2_in);
- it->second.setAmount(size);
+ double size = sats[i].second.toSize(amount,d2_in);
+ sats[i].second.setAmount(size);
}
}
- if(it->second.getHasMirror() != mirror_knots){
- it->second.setHasMirror(mirror_knots);
+ if(sats[i].second.getHasMirror() != mirror_knots){
+ sats[i].second.setHasMirror(mirror_knots);
refresh = true;
}
- if(it->second.getHidden() != hide_knots){
- it->second.setHidden(hide_knots);
+ if(sats[i].second.getHidden() != hide_knots){
+ sats[i].second.setHidden(hide_knots);
refresh = true;
}
}
- pointwise = new Pointwise(pwd2_in);
- pointwise->setSatellites(sats);
+ pointwise = new Pointwise(pwd2_in, sats);
//mandatory call
satellitepairarrayparam_values.set_pointwise(pointwise);
if(refresh){
@@ -421,10 +422,7 @@ LPEFilletChamfer::adjustForNewPath(std::vector<Geom::Path> const &path_in)
{
if (!path_in.empty() && pointwise) {
pointwise->recalculate_for_new_pwd2(paths_to_pw(pathv_to_linear_and_cubic_beziers(path_in)));
- std::vector<std::pair<unsigned int,Geom::Satellite> > sats = pointwise->getSatellites();
- pointwise->set_extremes(sats,false,true,0.0,0.0);
- pointwise->setSatellites(sats);
- satellitepairarrayparam_values.set_pointwise(pointwise);
+ pointwise->set_extremes(false,true,0.0,0.0);
}
}
diff --git a/src/ui/tool/multi-path-manipulator.h b/src/ui/tool/multi-path-manipulator.h
index cdbf34e9d..1bbcdd7ec 100644
--- a/src/ui/tool/multi-path-manipulator.h
+++ b/src/ui/tool/multi-path-manipulator.h
@@ -39,7 +39,7 @@ public:
virtual bool event(Inkscape::UI::Tools::ToolBase *, GdkEvent *event);
bool empty() { return _mmap.empty(); }
- unsigned size() { return _mmap.empty(); }
+ unsigned size() { return _mmap.size(); }
void setItems(std::set<ShapeRecord> const &);
void clear() { _mmap.clear(); }
void cleanup();
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 8b735f3e6..00e18dd3f 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -11,6 +11,7 @@
*/
#include "live_effects/lpe-powerstroke.h"
+#include "live_effects/lpe-bspline.h"
#include "live_effects/lpe-fillet-chamfer.h"
#include <string>
#include <sstream>
@@ -20,7 +21,7 @@
#include <2geom/bezier-curve.h>
#include <2geom/bezier-utils.h>
#include <2geom/path-sink.h>
-#include <glibmm/i18n.h>
+
#include "ui/tool/path-manipulator.h"
#include "desktop.h"
@@ -33,6 +34,7 @@
#include "live_effects/lpeobject.h"
#include "live_effects/lpeobject-reference.h"
#include "live_effects/parameter/path.h"
+
#include "sp-path.h"
#include "helper/geom.h"
#include "preferences.h"
@@ -43,7 +45,7 @@
#include "ui/tool/multi-path-manipulator.h"
#include "xml/node.h"
#include "xml/node-observer.h"
-#include "live_effects/lpe-bspline.h"
+#include <glibmm/i18n.h>
namespace Inkscape {
namespace UI {
@@ -151,7 +153,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path,
_createControlPointsFromGeometry();
//Define if the path is BSpline on construction
- isBSpline(true);
+ recalculateIsBSpline();
}
PathManipulator::~PathManipulator()
@@ -1238,22 +1240,18 @@ int PathManipulator::BSplineGetSteps() const {
}
// determines if the trace has bspline effect
-bool PathManipulator::isBSpline(bool recalculate){
- if(recalculate){
- 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 _is_bspline;
- }
+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;
}
}
-
}
_is_bspline = false;
- return _is_bspline;
}
bool PathManipulator::isBSpline() const {
@@ -1325,7 +1323,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE)
{
Geom::PathBuilder builder;
//Refresh if is bspline some times -think on path change selection, this value get lost
- isBSpline(true);
+ recalculateIsBSpline();
for (std::list<SubpathPtr>::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) {
SubpathPtr subpath = *spi;
if (subpath->empty()) {
diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h
index 4badec569..6dc1c9d09 100644
--- a/src/ui/tool/path-manipulator.h
+++ b/src/ui/tool/path-manipulator.h
@@ -107,7 +107,7 @@ private:
void _createControlPointsFromGeometry();
- bool isBSpline(bool recalculate);
+ void recalculateIsBSpline();
bool isBSpline() const;
double BSplineHandlePosition(Handle *h, Handle *h2 = NULL);
Geom::Point BSplineHandleReposition(Handle *h, Handle *h2 = NULL);