Code

Fix change in revision 9947 to be consistent with rest of the codebase.
[inkscape.git] / src / line-snapper.h
index 581466d330533b4ebbdd005c4d31440525253b9e..cdc45c286bce947b2cb86904c88f7095025702db 100644 (file)
@@ -7,6 +7,9 @@
  *
  *    Authors:
  *      Carl Hetherington <inkscape@carlh.net>
+ *      Diederik van Lierop <mail@diedenrezi.nl>
+ *
+ *       Copyright (C) 1999-2008 Authors
  *
  *    Released under GNU GPL, read the file 'COPYING' for more information.
  */
 
 namespace Inkscape
 {
+class SnapCandidatePoint;
 
 class LineSnapper : public Snapper
 {
 public:
-  LineSnapper(SPNamedView const *nv, NR::Coord const d);
+  LineSnapper(SnapManager *sm, Geom::Coord const d);
+
+  void freeSnap(SnappedConstraints &sc,
+                   Inkscape::SnapCandidatePoint const &p,
+                   Geom::OptRect const &bbox_to_snap,
+                   std::vector<SPItem const *> const *it,
+                   std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes) const;
+
+  void constrainedSnap(SnappedConstraints &sc,
+                          Inkscape::SnapCandidatePoint const &p,
+                          Geom::OptRect const &bbox_to_snap,
+                          SnapConstraint const &c,
+                          std::vector<SPItem const *> const *it,
+                          std::vector<SnapCandidatePoint> *unselected_nodes) const;
 
 protected:
-  typedef std::list<std::pair<NR::Dim2, NR::Coord> > LineList;
+  typedef std::list<std::pair<Geom::Point, Geom::Point> > LineList;
+  //first point is a vector normal to the line
+  //second point is a point on the line
 
 private:
-  SnappedPoint _doFreeSnap(NR::Point const &p,
-                          std::list<SPItem const *> const &it) const;
-  
-  SnappedPoint _doConstrainedSnap(NR::Point const &p,
-                                 NR::Point const &c,
-                                 std::list<SPItem const *> const &it) const;
-  
   /**
    *  \param p Point that we are trying to snap.
    *  \return List of lines that we should try snapping to.
    */
-  virtual LineList _getSnapLines(NR::Point const &p) const = 0;
+  virtual LineList _getSnapLines(Geom::Point const &p) const = 0;
+
+  virtual void _addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source, long source_num, Geom::Point const normal_to_line, Geom::Point const point_on_line) const = 0;
+
+  // Will only be implemented for guide lines, because grid lines don't have an origin
+  virtual void _addSnappedLinesOrigin(SnappedConstraints &sc, Geom::Point const origin, Geom::Coord const snapped_distance, SnapSourceType const &source, long source_num, bool constrained_snap) const;
+
+  virtual void _addSnappedPoint(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source, long source_num, bool constrained_snap) const = 0;
 };
 
 }