Code

5d93c858e59a19f6c16357f908c58f7b65913283
[inkscape.git] / src / line-snapper.h
1 #ifndef SEEN_LINE_SNAPPER_H
2 #define SEEN_LINE_SNAPPER_H
4 /**
5  *    \file src/line-snapper.h
6  *    \brief Superclass for snappers to horizontal and vertical lines.
7  *
8  *    Authors:
9  *      Carl Hetherington <inkscape@carlh.net>
10  *
11  *    Released under GNU GPL, read the file 'COPYING' for more information.
12  */
14 #include "snapper.h"
16 namespace Inkscape
17 {
19 class LineSnapper : public Snapper
20 {
21 public:
22   LineSnapper(SPNamedView const *nv, NR::Coord const d);
24 protected:
25   typedef std::list<std::pair<NR::Dim2, NR::Coord> > LineList;
27 private:
28   SnappedPoint _doFreeSnap(Inkscape::Snapper::PointType const &t,
29                                         NR::Point const &p,
30                                         bool const &first_point,
31                     std::vector<NR::Point> &points_to_snap,
32                     std::list<SPItem const *> const &it) const;
33   
34   SnappedPoint _doConstrainedSnap(Inkscape::Snapper::PointType const &t,
35                                         NR::Point const &p,
36                                         bool const &first_point,
37                     std::vector<NR::Point> &points_to_snap,
38                     ConstraintLine const &c,
39                                         std::list<SPItem const *> const &it) const;
40   
41   /**
42    *  \param p Point that we are trying to snap.
43    *  \return List of lines that we should try snapping to.
44    */
45   virtual LineList _getSnapLines(NR::Point const &p) const = 0;
46 };
48 }
50 #endif /* !SEEN_LINE_SNAPPER_H */