summaryrefslogtreecommitdiffstats
path: root/src/object-snapper.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-07-24 19:53:33 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-07-24 19:53:33 +0000
commit5a37f06c70e0e4e2519812564f4dcdced7c0246a (patch)
treef959f73813cb6f968072aee1100323b24e294136 /src/object-snapper.cpp
parentupdate to trunk (diff)
parentFix a bug continuing a bezier path whith a LPE one like spiro or bspline on a... (diff)
downloadinkscape-5a37f06c70e0e4e2519812564f4dcdced7c0246a.tar.gz
inkscape-5a37f06c70e0e4e2519812564f4dcdced7c0246a.zip
update to trunk
(bzr r13879.1.17)
Diffstat (limited to 'src/object-snapper.cpp')
-rw-r--r--src/object-snapper.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 338f91463..634d56aa6 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -19,6 +19,7 @@
#include <2geom/rect.h>
#include <2geom/line.h>
#include <2geom/circle.h>
+#include <2geom/path-sink.h>
#include "document.h"
#include "sp-namedview.h"
#include "sp-image.h"
@@ -237,8 +238,9 @@ void Inkscape::ObjectSnapper::_collectNodes(SnapSourceType const &t,
// current selection (see the comment in SelTrans::centerRequest())
bool old_pref2 = _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_ROTATION_CENTER);
if (old_pref2) {
- for ( GSList const *itemlist = _snapmanager->getRotationCenterSource(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) {
- if ((*i).item == reinterpret_cast<SPItem*>(itemlist->data)) {
+ std::vector<SPItem*> rotationSource=_snapmanager->getRotationCenterSource();
+ for ( std::vector<SPItem*>::const_iterator itemlist = rotationSource.begin(); itemlist != rotationSource.end(); itemlist++) {
+ if ((*i).item == *itemlist) {
// don't snap to this item's rotation center
_snapmanager->snapprefs.setTargetSnappable(SNAPTARGET_ROTATION_CENTER, false);
break;
@@ -516,14 +518,14 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr,
for(Geom::PathVector::iterator it_pv = (it_p->path_vector)->begin(); it_pv != (it_p->path_vector)->end(); ++it_pv) {
// Find a nearest point for each curve within this path
// n curves will return n time values with 0 <= t <= 1
- std::vector<double> anp = (*it_pv).nearestPointPerCurve(p_doc);
+ std::vector<double> anp = (*it_pv).nearestTimePerCurve(p_doc);
//std::cout << "#nearest points = " << anp.size() << " | p = " << p.getPoint() << std::endl;
// Now we will examine each of the nearest points, and determine whether it's within snapping range and if we should snap to it
std::vector<double>::const_iterator np = anp.begin();
unsigned int index = 0;
for (; np != anp.end(); ++np, index++) {
- Geom::Curve const *curve = &((*it_pv).at_index(index));
+ Geom::Curve const *curve = &(it_pv->at(index));
Geom::Point const sp_doc = curve->pointAt(*np);
//dt->snapindicator->set_new_debugging_point(sp_doc*dt->doc2dt());
bool c1 = true;
@@ -622,10 +624,13 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(IntermSnapResults &isr,
// PS: Because the paths we're about to snap to are all expressed relative to document coordinate system, we will have
// to convert the snapper coordinates from the desktop coordinates to document coordinates
- std::vector<Geom::Path> constraint_path;
+ Geom::PathVector constraint_path;
if (c.isCircular()) {
Geom::Circle constraint_circle(dt->dt2doc(c.getPoint()), c.getRadius());
- constraint_circle.getPath(constraint_path);
+ Geom::PathBuilder pb;
+ pb.feed(constraint_circle);
+ pb.flush();
+ constraint_path = pb.peek();
} else {
Geom::Path constraint_line;
constraint_line.start(p_min_on_cl);