e320f013fe8e8f36451084046564465587a50f37
1 /**
2 * \file object-snapper.cpp
3 * \brief Snapping things to objects.
4 *
5 * Authors:
6 * Carl Hetherington <inkscape@carlh.net>
7 * Diederik van Lierop <mail@diedenrezi.nl>
8 *
9 * Copyright (C) 2005 - 2007 Authors
10 *
11 * Released under GNU GPL, read the file 'COPYING' for more information
12 */
14 #include "libnr/n-art-bpath.h"
15 #include "libnr/nr-path.h"
16 #include "libnr/nr-rect-ops.h"
17 #include "libnr/nr-point-fns.h"
18 #include "live_effects/n-art-bpath-2geom.h"
19 #include "2geom/path-intersection.h"
20 #include "document.h"
21 #include "sp-namedview.h"
22 #include "sp-image.h"
23 #include "sp-item-group.h"
24 #include "sp-item.h"
25 #include "sp-use.h"
26 #include "display/curve.h"
27 #include "desktop.h"
28 #include "inkscape.h"
29 #include "prefs-utils.h"
30 #include "sp-text.h"
31 #include "sp-flowtext.h"
32 #include "text-editing.h"
34 Inkscape::ObjectSnapper::ObjectSnapper(SPNamedView const *nv, NR::Coord const d)
35 : Snapper(nv, d), _snap_to_itemnode(true), _snap_to_itempath(true),
36 _snap_to_bboxnode(true), _snap_to_bboxpath(true), _strict_snapping(true),
37 _include_item_center(false)
38 {
39 _candidates = new std::vector<SPItem*>;
40 _points_to_snap_to = new std::vector<NR::Point>;
41 _bpaths_to_snap_to = new std::vector<NArtBpath*>;
42 _paths_to_snap_to = new std::vector<Path*>;
43 }
45 Inkscape::ObjectSnapper::~ObjectSnapper()
46 {
47 _candidates->clear(); //Don't delete the candidates themselves, as these are not ours!
48 delete _candidates;
50 _points_to_snap_to->clear();
51 delete _points_to_snap_to;
53 _clear_paths();
54 delete _paths_to_snap_to;
55 delete _bpaths_to_snap_to;
56 }
58 /**
59 * Find all items within snapping range.
60 * \param r Pointer to the current document
61 * \param it List of items to ignore
62 * \param first_point If true then this point is the first one from a whole bunch of points
63 * \param points_to_snap The whole bunch of points, all from the same selection and having the same transformation
64 * \param DimensionToSnap Snap in X, Y, or both directions.
65 */
67 void Inkscape::ObjectSnapper::_findCandidates(SPObject* r,
68 std::list<SPItem const *> const &it,
69 bool const &first_point,
70 std::vector<NR::Point> &points_to_snap,
71 DimensionToSnap const snap_dim) const
72 {
73 bool const c1 = (snap_dim == TRANSL_SNAP_XY) && ThisSnapperMightSnap();
74 bool const c2 = (snap_dim != TRANSL_SNAP_XY) && GuidesMightSnap();
75 bool const c3 = points_to_snap.size() == 0;
77 if (!(c1 || c2) || c3) {
78 return;
79 }
81 SPDesktop const *desktop = SP_ACTIVE_DESKTOP;
83 if (first_point) {
84 _candidates->clear();
85 }
87 NR::Maybe<NR::Rect> bbox = NR::Rect(); // a default NR::Rect is infinitely large
88 NR::Coord t = getSnapperTolerance();
90 // When dragging a guide...
91 NR::Point p_guide = points_to_snap[0];
92 if (!getSnapperAlwaysSnap()) {
93 bbox = NR::Rect(p_guide, p_guide); // bbox is now just a single point: p_guide
94 bbox->growBy(t); // bbox width and height now measure 2x snapper tolerance
95 // for angled guidelines the bbox is now larger than really needed
96 // (up to sqrt(2) for 45 deg. guidelines) but we'll leave it like that
97 } // else: use an infinitely large bbox to find candidates
99 for (SPObject* o = sp_object_first_child(r); o != NULL; o = SP_OBJECT_NEXT(o)) {
100 if (SP_IS_ITEM(o) && !SP_ITEM(o)->isLocked() && !desktop->itemIsHidden(SP_ITEM(o))) {
102 /* See if this item is on the ignore list */
103 std::list<SPItem const *>::const_iterator i = it.begin();
104 while (i != it.end() && *i != o) {
105 i++;
106 }
108 if (i == it.end()) {
109 /* See if the item is within range */
110 if (SP_IS_GROUP(o)) {
111 _findCandidates(o, it, false, points_to_snap, snap_dim);
112 } else {
113 // Now let's see if any of the snapping points is within snapping range of this object
114 if (snap_dim == TRANSL_SNAP_XY) {
115 bbox = sp_item_bbox_desktop(SP_ITEM(o));
116 } // else: we're snapping a guide to an object and we will use the bbox as defined above
118 if (bbox) {
119 for (std::vector<NR::Point>::const_iterator i = points_to_snap.begin(); i != points_to_snap.end(); i++) {
120 NR::Point b_min = bbox->min();
121 NR::Point b_max = bbox->max();
122 bool withinX = ((*i)[NR::X] >= b_min[NR::X] - t) && ((*i)[NR::X] <= b_max[NR::X] + t);
123 bool withinY = ((*i)[NR::Y] >= b_min[NR::Y] - t) && ((*i)[NR::Y] <= b_max[NR::Y] + t);
124 if (withinX && withinY) {
125 //We've found a point that is within snapping range
126 //of this object, so record it as a candidate
127 _candidates->push_back(SP_ITEM(o));
128 break;
129 }
130 }
131 }
132 }
133 }
134 }
135 }
136 }
139 void Inkscape::ObjectSnapper::_collectNodes(Inkscape::Snapper::PointType const &t,
140 bool const &first_point) const
141 {
142 // Now, let's first collect all points to snap to. If we have a whole bunch of points to snap,
143 // e.g. when translating an item using the selector tool, then we will only do this for the
144 // first point and store the collection for later use. This significantly improves the performance
145 if (first_point) {
146 _points_to_snap_to->clear();
148 // Determine the type of bounding box we should snap to
149 SPItem::BBoxType bbox_type = SPItem::GEOMETRIC_BBOX;
151 bool p_is_a_node = t & Inkscape::Snapper::SNAPPOINT_NODE;
152 bool p_is_a_bbox = t & Inkscape::Snapper::SNAPPOINT_BBOX;
153 bool p_is_a_guide = t & Inkscape::Snapper::SNAPPOINT_GUIDE;
155 // A point considered for snapping should be either a node, a bbox corner or a guide. Pick only ONE!
156 g_assert(!(p_is_a_node && p_is_a_bbox || p_is_a_bbox && p_is_a_guide || p_is_a_node && p_is_a_guide));
158 if (_snap_to_bboxnode) {
159 gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box");
160 bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX;
161 }
163 for (std::vector<SPItem*>::const_iterator i = _candidates->begin(); i != _candidates->end(); i++) {
164 //NR::Matrix i2doc(NR::identity());
165 SPItem *root_item = *i;
166 if (SP_IS_USE(*i)) {
167 root_item = sp_use_root(SP_USE(*i));
168 }
170 //Collect all nodes so we can snap to them
171 if (_snap_to_itemnode) {
172 if (!(_strict_snapping && !p_is_a_node) || p_is_a_guide) {
173 sp_item_snappoints(root_item, _include_item_center, SnapPointsIter(*_points_to_snap_to));
174 }
175 }
177 //Collect the bounding box's corners so we can snap to them
178 if (_snap_to_bboxnode) {
179 if (!(_strict_snapping && !p_is_a_bbox) || p_is_a_guide) {
180 NR::Maybe<NR::Rect> b = sp_item_bbox_desktop(root_item, bbox_type);
181 if (b) {
182 for ( unsigned k = 0 ; k < 4 ; k++ ) {
183 _points_to_snap_to->push_back(b->corner(k));
184 }
185 }
186 }
187 }
188 }
189 }
190 }
192 void Inkscape::ObjectSnapper::_snapNodes(SnappedConstraints &sc,
193 Inkscape::Snapper::PointType const &t,
194 NR::Point const &p,
195 bool const &first_point) const
196 {
197 // Iterate through all nodes, find out which one is the closest to p, and snap to it!
199 _collectNodes(t, first_point);
201 SnappedPoint s;
202 bool success = false;
204 for (std::vector<NR::Point>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) {
205 NR::Coord dist = NR::L2(*k - p);
206 if (dist < getSnapperTolerance() && dist < s.getDistance()) {
207 s = SnappedPoint(*k, dist, getSnapperTolerance(), getSnapperAlwaysSnap());
208 success = true;
209 }
210 }
212 if (success) {
213 sc.points.push_back(s);
214 }
215 }
217 void Inkscape::ObjectSnapper::_snapTranslatingGuideToNodes(SnappedConstraints &sc,
218 Inkscape::Snapper::PointType const &t,
219 NR::Point const &p,
220 NR::Point const &guide_normal) const
221 {
222 // Iterate through all nodes, find out which one is the closest to this guide, and snap to it!
223 _collectNodes(t, true);
225 SnappedPoint s;
226 bool success = false;
228 NR::Coord tol = getSnapperTolerance();
230 for (std::vector<NR::Point>::const_iterator k = _points_to_snap_to->begin(); k != _points_to_snap_to->end(); k++) {
231 // Project each node (*k) on the guide line (running through point p)
232 NR::Point p_proj = project_on_linesegment(*k, p, p + NR::rot90(guide_normal));
233 NR::Coord dist = NR::L2(*k - p_proj); // distance from node to the guide
234 NR::Coord dist2 = NR::L2(p - p_proj); // distance from projection of node on the guide, to the mouse location
235 if ((dist < tol && dist2 < tol || getSnapperAlwaysSnap()) && dist < s.getDistance()) {
236 s = SnappedPoint(*k, dist, tol, getSnapperAlwaysSnap());
237 success = true;
238 }
239 }
241 if (success) {
242 sc.points.push_back(s);
243 }
244 }
246 void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &t,
247 bool const &first_point) const
248 {
249 // Now, let's first collect all paths to snap to. If we have a whole bunch of points to snap,
250 // e.g. when translating an item using the selector tool, then we will only do this for the
251 // first point and store the collection for later use. This significantly improves the performance
252 if (first_point) {
253 _clear_paths();
255 // Determine the type of bounding box we should snap to
256 SPItem::BBoxType bbox_type = SPItem::GEOMETRIC_BBOX;
258 bool p_is_a_node = t & Inkscape::Snapper::SNAPPOINT_NODE;
260 if (_snap_to_bboxpath) {
261 gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box");
262 bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX;
263 }
265 for (std::vector<SPItem*>::const_iterator i = _candidates->begin(); i != _candidates->end(); i++) {
267 /* Transform the requested snap point to this item's coordinates */
268 NR::Matrix i2doc(NR::identity());
269 SPItem *root_item = NULL;
270 /* We might have a clone at hand, so make sure we get the root item */
271 if (SP_IS_USE(*i)) {
272 i2doc = sp_use_get_root_transform(SP_USE(*i));
273 root_item = sp_use_root(SP_USE(*i));
274 } else {
275 i2doc = sp_item_i2doc_affine(*i);
276 root_item = *i;
277 }
279 //Build a list of all paths considered for snapping to
281 //Add the item's path to snap to
282 if (_snap_to_itempath) {
283 if (!(_strict_snapping && !p_is_a_node)) {
284 // Snapping to the path of characters is very cool, but for a large
285 // chunk of text this will take ages! So limit snapping to text paths
286 // containing max. 240 characters. Snapping the bbox will not be affected
287 bool very_lenghty_prose = false;
288 if (SP_IS_TEXT(root_item) || SP_IS_FLOWTEXT(root_item)) {
289 very_lenghty_prose = sp_text_get_length(SP_TEXT(root_item)) > 240;
290 }
291 // On my AMD 3000+, the snapping lag becomes annoying at approx. 240 chars
292 // which corresponds to a lag of 500 msec. This is for snapping a rect
293 // to a single line of text.
295 // Snapping for example to a traced bitmap is also very stressing for
296 // the CPU, so we'll only snap to paths having no more than 500 nodes
297 // This also leads to a lag of approx. 500 msec (in my lousy test set-up).
298 bool very_complex_path = false;
299 if (SP_IS_PATH(root_item)) {
300 very_complex_path = sp_nodes_in_path(SP_PATH(root_item)) > 500;
301 }
303 if (!very_lenghty_prose && !very_complex_path) {
304 SPCurve *curve = curve_for_item(root_item);
305 if (curve) {
306 NArtBpath *bpath = bpath_for_curve(root_item, curve, true, true);
307 _bpaths_to_snap_to->push_back(bpath);
308 // Because in bpath_for_curve we set doTransformation to true, we
309 // will get a dupe of the path, which must be freed at some point
310 sp_curve_unref(curve);
311 }
312 }
313 }
314 }
316 //Add the item's bounding box to snap to
317 if (_snap_to_bboxpath) {
318 if (!(_strict_snapping && p_is_a_node)) {
319 NRRect rect;
320 sp_item_invoke_bbox(root_item, &rect, i2doc, TRUE, bbox_type);
321 NArtBpath *bpath = nr_path_from_rect(rect);
322 _bpaths_to_snap_to->push_back(bpath);
323 }
324 }
325 }
326 }
327 }
329 void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc,
330 Inkscape::Snapper::PointType const &t,
331 NR::Point const &p,
332 bool const &first_point) const
333 {
334 _collectPaths(t, first_point);
336 // Now we can finally do the real snapping, using the paths collected above
337 SnappedPoint s;
338 bool success = false;
340 /* FIXME: this seems like a hack. Perhaps Snappers should be
341 ** in SPDesktop rather than SPNamedView?
342 */
343 SPDesktop const *desktop = SP_ACTIVE_DESKTOP;
344 NR::Point const p_doc = desktop->dt2doc(p);
346 // Convert all bpaths to Paths, because here we really must have Paths
347 // (whereas in _snapPathsConstrained we will use the original bpaths)
348 if (first_point) {
349 for (std::vector<NArtBpath*>::const_iterator k = _bpaths_to_snap_to->begin(); k != _bpaths_to_snap_to->end(); k++) {
350 Path *path = bpath_to_Path(*k);
351 if (path) {
352 path->ConvertWithBackData(0.01); //This is extremely time consuming!
353 _paths_to_snap_to->push_back(path);
354 }
355 }
356 }
358 for (std::vector<Path*>::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); k++) {
359 if (*k) {
360 /* Look for the nearest position on this SPItem to our snap point */
361 NR::Maybe<Path::cut_position> const o = get_nearest_position_on_Path(*k, p_doc);
362 if (o && o->t >= 0 && o->t <= 1) {
364 /* Convert the nearest point back to desktop coordinates */
365 NR::Point const o_it = get_point_on_Path(*k, o->piece, o->t);
366 NR::Point const o_dt = desktop->doc2dt(o_it);
367 NR::Coord const dist = NR::L2(o_dt - p);
369 if (dist < getSnapperTolerance()) {
370 // if we snap to a straight line segment (within a path), then return this line segment
371 if ((*k)->IsLineSegment(o->piece)) {
372 NR::Point start_point;
373 NR::Point end_point;
374 (*k)->PointAt(o->piece, 0, start_point);
375 (*k)->PointAt(o->piece, 1, end_point);
376 start_point = desktop->doc2dt(start_point);
377 end_point = desktop->doc2dt(end_point);
378 sc.lines.push_back(Inkscape::SnappedLineSegment(o_dt, dist, getSnapperTolerance(), getSnapperAlwaysSnap(), start_point, end_point));
379 } else {
380 // for segments other than straight lines of a path, we'll return just the closest snapped point
381 if (dist < s.getDistance()) {
382 s = SnappedPoint(o_dt, dist, getSnapperTolerance(), getSnapperAlwaysSnap());
383 success = true;
384 }
385 }
386 }
387 }
388 }
389 }
391 if (success) {
392 sc.points.push_back(s);
393 }
394 }
396 void Inkscape::ObjectSnapper::_snapPathsConstrained(SnappedConstraints &sc,
397 Inkscape::Snapper::PointType const &t,
398 NR::Point const &p,
399 bool const &first_point,
400 ConstraintLine const &c) const
401 {
402 _collectPaths(t, first_point);
404 // Now we can finally do the real snapping, using the paths collected above
406 /* FIXME: this seems like a hack. Perhaps Snappers should be
407 ** in SPDesktop rather than SPNamedView?
408 */
409 SPDesktop const *desktop = SP_ACTIVE_DESKTOP;
410 NR::Point const p_doc = desktop->dt2doc(p);
412 NR::Point direction_vector = c.getDirection();
413 if (!is_zero(direction_vector)) {
414 direction_vector = NR::unit_vector(direction_vector);
415 }
417 NR::Point const p1_on_cl = c.hasPoint() ? c.getPoint() : p;
418 NR::Point const p2_on_cl = p1_on_cl + direction_vector;
420 // The intersection point of the constraint line with any path,
421 // must lie within two points on the constraintline: p_min_on_cl and p_max_on_cl
422 // The distance between those points is twice the snapping tolerance
423 NR::Point const p_proj_on_cl = project_on_linesegment(p, p1_on_cl, p2_on_cl);
424 NR::Point const p_min_on_cl = desktop->dt2doc(p_proj_on_cl - getSnapperTolerance() * direction_vector);
425 NR::Point const p_max_on_cl = desktop->dt2doc(p_proj_on_cl + getSnapperTolerance() * direction_vector);
427 Geom::Path cl;
428 cl.start(p_min_on_cl.to_2geom());
429 cl.appendNew<Geom::LineSegment>(p_max_on_cl.to_2geom());
431 for (std::vector<NArtBpath*>::const_iterator k = _bpaths_to_snap_to->begin(); k != _bpaths_to_snap_to->end(); k++) {
432 if (*k) {
433 // convert a Path object (see src/livarot/Path.h) to a 2geom's path object (see 2geom/path.h)
434 // TODO: (Diederik) Only do this once for the first point, needs some storage of pointers in a member variable
435 std::vector<Geom::Path> path_2geom = BPath_to_2GeomPath(*k);
437 for (std::vector<Geom::Path>::const_iterator l = path_2geom.begin(); l != path_2geom.end(); l++) {
438 Geom::SimpleCrosser sxr;
439 Geom::Crossings crossings = sxr.crossings(*l, cl);
440 for (std::vector<Geom::Crossing>::const_iterator m = crossings.begin(); m != crossings.end(); m++) {
441 // Reconstruct the point of intersection
442 NR::Point p_inters = p_min_on_cl + ((*m).tb) * (p_max_on_cl - p_min_on_cl);
443 // When it's within snapping range, then return it
444 // (within snapping range == between p_min_on_cl and p_max_on_cl == 0 < tb < 1)
445 if ((*m).tb >= 0 && (*m).tb <= 1 ) {
446 NR::Coord dist = NR::L2(desktop->dt2doc(p_proj_on_cl) - p_inters);
447 SnappedPoint s(desktop->doc2dt(p_inters), dist, getSnapperTolerance(), getSnapperAlwaysSnap());
448 sc.points.push_back(s);
449 }
450 }
451 }
452 }
453 }
454 }
457 void Inkscape::ObjectSnapper::_doFreeSnap(SnappedConstraints &sc,
458 Inkscape::Snapper::PointType const &t,
459 NR::Point const &p,
460 bool const &first_point,
461 std::vector<NR::Point> &points_to_snap,
462 std::list<SPItem const *> const &it) const
463 {
464 if ( NULL == _named_view ) {
465 return;
466 }
468 /* Get a list of all the SPItems that we will try to snap to */
469 if (first_point) {
470 _findCandidates(sp_document_root(_named_view->document), it, first_point, points_to_snap, TRANSL_SNAP_XY);
471 }
473 if (_snap_to_itemnode || _snap_to_bboxnode) {
474 _snapNodes(sc, t, p, first_point);
475 }
476 if (_snap_to_itempath || _snap_to_bboxpath) {
477 _snapPaths(sc, t, p, first_point);
478 }
479 }
483 void Inkscape::ObjectSnapper::_doConstrainedSnap( SnappedConstraints &sc,
484 Inkscape::Snapper::PointType const &t,
485 NR::Point const &p,
486 bool const &first_point,
487 std::vector<NR::Point> &points_to_snap,
488 ConstraintLine const &c,
489 std::list<SPItem const *> const &it) const
490 {
491 if ( NULL == _named_view ) {
492 return;
493 }
495 /* Get a list of all the SPItems that we will try to snap to */
496 if (first_point) {
497 _findCandidates(sp_document_root(_named_view->document), it, first_point, points_to_snap, TRANSL_SNAP_XY);
498 }
500 // A constrained snap, is a snap in only one degree of freedom (specified by the constraint line).
501 // This is usefull for example when scaling an object while maintaining a fixed aspect ratio. It's
502 // nodes are only allowed to move in one direction (i.e. in one degree of freedom).
504 // When snapping to objects, we either snap to their nodes or their paths. It is however very
505 // unlikely that any node will be exactly at the constrained line, so for a constrained snap
506 // to objects we will only consider the object's paths. Beside, the nodes will be at these paths,
507 // so we will more or less snap to them anyhow.
509 if (_snap_to_itempath || _snap_to_bboxpath) {
510 _snapPathsConstrained(sc, t, p, first_point, c);
511 }
512 }
515 // This method is used to snap a guide to nodes, while dragging the guide around
516 void Inkscape::ObjectSnapper::guideSnap(SnappedConstraints &sc,
517 NR::Point const &p,
518 NR::Point const &guide_normal) const
519 {
520 if ( NULL == _named_view ) {
521 return;
522 }
524 /* Get a list of all the SPItems that we will try to snap to */
525 std::vector<SPItem*> cand;
526 std::list<SPItem const *> const it; //just an empty list
528 std::vector<NR::Point> points_to_snap;
529 points_to_snap.push_back(p);
531 DimensionToSnap snap_dim;
532 if (guide_normal == component_vectors[NR::Y]) {
533 snap_dim = GUIDE_TRANSL_SNAP_Y;
534 } else if (guide_normal == component_vectors[NR::X]) {
535 snap_dim = GUIDE_TRANSL_SNAP_X;
536 } else {
537 snap_dim = ANGLED_GUIDE_TRANSL_SNAP;
538 }
539 // We don't support ANGLED_GUIDE_ROT_SNAP yet.
541 // It would be cool to allow the user to rotate a guide by dragging it, instead of
542 // only translating it. (For example when CTRL is pressed). We will need an UI part
543 // for that first; and some important usability choices need to be made:
544 // E.g. which point should be used for pivoting? A previously snapped point,
545 // or a transformation center (which can be moved after clicking for the
546 // second time on an object; but should this point then be constrained to the
547 // line, or can it be located anywhere?)
549 _findCandidates(sp_document_root(_named_view->document), it, true, points_to_snap, snap_dim);
550 _snapTranslatingGuideToNodes(sc, Inkscape::Snapper::SNAPPOINT_GUIDE, p, guide_normal);
552 // _snapRotatingGuideToNodes has not been implemented yet.
553 }
555 /**
556 * \return true if this Snapper will snap at least one kind of point.
557 */
558 bool Inkscape::ObjectSnapper::ThisSnapperMightSnap() const
559 {
560 bool snap_to_something = _snap_to_itempath || _snap_to_itemnode || _snap_to_bboxpath || _snap_to_bboxnode;
561 return (_snap_enabled && _snap_from != 0 && snap_to_something);
562 }
564 bool Inkscape::ObjectSnapper::GuidesMightSnap() const
565 {
566 bool snap_to_something = _snap_to_itemnode || _snap_to_bboxnode;
567 return (_snap_enabled && (_snap_from & SNAPPOINT_GUIDE) && snap_to_something);
568 }
570 void Inkscape::ObjectSnapper::_clear_paths() const
571 {
572 for (std::vector<NArtBpath*>::const_iterator k = _bpaths_to_snap_to->begin(); k != _bpaths_to_snap_to->end(); k++) {
573 g_free(*k);
574 }
575 _bpaths_to_snap_to->clear();
577 for (std::vector<Path*>::const_iterator k = _paths_to_snap_to->begin(); k != _paths_to_snap_to->end(); k++) {
578 delete *k;
579 }
580 _paths_to_snap_to->clear();
581 }
583 /*
584 Local Variables:
585 mode:c++
586 c-file-style:"stroustrup"
587 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
588 indent-tabs-mode:nil
589 fill-column:99
590 End:
591 */
592 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :