summaryrefslogtreecommitdiffstats
path: root/src/selection.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-01-09 21:14:38 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-01-09 21:14:38 +0000
commite8f4c644181a8a68e2c33e1783f77a400dc1a29f (patch)
tree38083930039a3507ff467c62cf2e588a229a061f /src/selection.cpp
parentPatch by Alex Leone to fix crash with recursive masks from 190130, I also add... (diff)
downloadinkscape-e8f4c644181a8a68e2c33e1783f77a400dc1a29f.tar.gz
inkscape-e8f4c644181a8a68e2c33e1783f77a400dc1a29f.zip
Refactoring the snapping API (making it easier to maintain and understand for the devs)
(bzr r8960)
Diffstat (limited to 'src/selection.cpp')
-rw-r--r--src/selection.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/selection.cpp b/src/selection.cpp
index 7b936587c..1e14591fa 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -426,48 +426,48 @@ boost::optional<Geom::Point> Selection::center() const {
/**
* Compute the list of points in the selection that are to be considered for snapping.
*/
-std::vector<std::pair<Geom::Point, int> > Selection::getSnapPoints(SnapPreferences const *snapprefs) const {
+std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferences const *snapprefs) const {
GSList const *items = const_cast<Selection *>(this)->itemList();
SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs
snapprefs_dummy.setIncludeItemCenter(false); // locally disable snapping to the item center
- std::vector<std::pair<Geom::Point, int> > p;
+ std::vector<Inkscape::SnapCandidatePoint> p;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
SPItem *this_item = SP_ITEM(iter->data);
- sp_item_snappoints(this_item, false, p, &snapprefs_dummy);
+ sp_item_snappoints(this_item, p, &snapprefs_dummy);
//Include the transformation origin for snapping
//For a selection or group only the overall origin is considered
if (snapprefs != NULL && snapprefs->getIncludeItemCenter()) {
- p.push_back(std::make_pair(this_item->getCenter(), SNAPSOURCE_ROTATION_CENTER));
+ p.push_back(Inkscape::SnapCandidatePoint(this_item->getCenter(), SNAPSOURCE_ROTATION_CENTER));
}
}
return p;
}
-std::vector<std::pair<Geom::Point, int> > Selection::getSnapPointsConvexHull(SnapPreferences const *snapprefs) const {
+std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPointsConvexHull(SnapPreferences const *snapprefs) const {
GSList const *items = const_cast<Selection *>(this)->itemList();
- std::vector<std::pair<Geom::Point, int> > p;
+ std::vector<Inkscape::SnapCandidatePoint> p;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
- sp_item_snappoints(SP_ITEM(iter->data), false, p, snapprefs);
+ sp_item_snappoints(SP_ITEM(iter->data), p, snapprefs);
}
- std::vector<std::pair<Geom::Point, int> > pHull;
+ std::vector<Inkscape::SnapCandidatePoint> pHull;
if (!p.empty()) {
- std::vector<std::pair<Geom::Point, int> >::iterator i;
- Geom::RectHull cvh((p.front()).first);
+ std::vector<Inkscape::SnapCandidatePoint>::iterator i;
+ Geom::RectHull cvh((p.front()).getPoint());
for (i = p.begin(); i != p.end(); i++) {
// these are the points we get back
- cvh.add((*i).first);
+ cvh.add((*i).getPoint());
}
Geom::OptRect rHull = cvh.bounds();
if (rHull) {
for ( unsigned i = 0 ; i < 4 ; ++i ) {
- pHull.push_back(std::make_pair(rHull->corner(i), SNAPSOURCE_CONVEX_HULL_CORNER));
+ pHull.push_back(Inkscape::SnapCandidatePoint(rHull->corner(i), SNAPSOURCE_CONVEX_HULL_CORNER));
}
}
}