1 #ifndef SEEN_OBJECT_SNAPPER_H
2 #define SEEN_OBJECT_SNAPPER_H
4 /**
5 * \file object-snapper.h
6 * \brief Snapping things to objects.
7 *
8 * Authors:
9 * Carl Hetherington <inkscape@carlh.net>
10 *
11 * Copyright (C) 2005 Authors
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 #include "snapper.h"
18 struct SPNamedView;
19 struct SPItem;
20 struct SPObject;
22 namespace Inkscape
23 {
25 class ObjectSnapper : public Snapper
26 {
27 public:
28 ObjectSnapper(SPNamedView const *nv, NR::Coord const d);
30 void setSnapToNodes(bool s) {
31 _snap_to_nodes = s;
32 }
34 bool getSnapToNodes() const {
35 return _snap_to_nodes;
36 }
38 void setSnapToPaths(bool s) {
39 _snap_to_paths = s;
40 }
42 bool getSnapToPaths() const {
43 return _snap_to_paths;
44 }
46 private:
47 SnappedPoint _doFreeSnap(NR::Point const &p,
48 std::list<SPItem const *> const &it) const;
50 SnappedPoint _doConstrainedSnap(NR::Point const &p,
51 ConstraintLine const &c,
52 std::list<SPItem const *> const &it) const;
54 void _findCandidates(std::list<SPItem*>& c,
55 SPObject* r,
56 std::list<SPItem const *> const &it,
57 NR::Point const &p) const;
59 void _snapNodes(Inkscape::SnappedPoint &s, NR::Point const &p, std::list<SPItem*> const &cand) const;
60 void _snapPaths(Inkscape::SnappedPoint &s, NR::Point const &p, std::list<SPItem*> const &cand) const;
62 bool _snap_to_nodes;
63 bool _snap_to_paths;
64 };
66 }
68 #endif