Code

convert almost all libnrtype to Geom::
[inkscape.git] / src / line-snapper.h
index 5d93c858e59a19f6c16357f908c58f7b65913283..7767fe2ea5a0f25a4fbc87313ca3399b086e9c4c 100644 (file)
@@ -19,30 +19,37 @@ namespace Inkscape
 class LineSnapper : public Snapper
 {
 public:
-  LineSnapper(SPNamedView const *nv, NR::Coord const d);
+  LineSnapper(SnapManager const *sm, Geom::Coord const d);
+
+  void freeSnap(SnappedConstraints &sc,
+                   Inkscape::Snapper::PointType const &t,
+                   Geom::Point const &p,
+                   bool const &first_point,
+                   boost::optional<Geom::Rect> const &bbox_to_snap,
+                   std::vector<SPItem const *> const *it,
+                   std::vector<Geom::Point> *unselected_nodes) const;
+  
+  void constrainedSnap(SnappedConstraints &sc,
+                          Inkscape::Snapper::PointType const &t,
+                          Geom::Point const &p,
+                          bool const &first_point,
+                          boost::optional<Geom::Rect> const &bbox_to_snap,
+                          ConstraintLine const &c,
+                          std::vector<SPItem const *> const *it) 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(Inkscape::Snapper::PointType const &t,
-                                       NR::Point const &p,
-                                       bool const &first_point,
-                    std::vector<NR::Point> &points_to_snap,
-                    std::list<SPItem const *> const &it) const;
-  
-  SnappedPoint _doConstrainedSnap(Inkscape::Snapper::PointType const &t,
-                                       NR::Point const &p,
-                                       bool const &first_point,
-                    std::vector<NR::Point> &points_to_snap,
-                    ConstraintLine 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, Geom::Point const normal_to_line, Geom::Point const point_on_line) const = 0;
 };
 
 }