Code

updated catalan.nsh from launchpad by Xavi Conde
[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::Point, NR::Point> > LineList; 
26   //first point is a vector normal to the line
27   //second point is a point on the line
29 private:
30   void _doFreeSnap(SnappedConstraints &sc,
31                    Inkscape::Snapper::PointType const &t,
32                    NR::Point const &p,
33                    bool const &first_point,
34                    std::vector<NR::Point> &points_to_snap,
35                    std::list<SPItem const *> const &it) const;
36   
37   void _doConstrainedSnap(SnappedConstraints &sc,
38                           Inkscape::Snapper::PointType const &t,
39                           NR::Point const &p,
40                           bool const &first_point,
41                           std::vector<NR::Point> &points_to_snap,
42                           ConstraintLine const &c,
43                           std::list<SPItem const *> const &it) const;
44   
45   /**
46    *  \param p Point that we are trying to snap.
47    *  \return List of lines that we should try snapping to.
48    */
49   virtual LineList _getSnapLines(NR::Point const &p) const = 0;
50   
51   virtual void _addSnappedLine(SnappedConstraints &sc, NR::Point const snapped_point, NR::Coord const snapped_distance, NR::Point const normal_to_line, NR::Point const point_on_line) const = 0;
52 };
54 }
56 #endif /* !SEEN_LINE_SNAPPER_H */