Code

NR::Maybe => boost::optional
[inkscape.git] / src / line-snapper.cpp
index efa6762b2a3d659c2d8740f9c518c3dd2135ea68..d06d027e314c8b3d94f931e597d0981d2bf55e7d 100644 (file)
@@ -27,7 +27,7 @@ void Inkscape::LineSnapper::freeSnap(SnappedConstraints &sc,
                                                     Inkscape::Snapper::PointType const &t,
                                                     NR::Point const &p,
                                                     bool const &/*f*/,
-                                                    NR::Maybe<NR::Rect> const &/*bbox_to_snap*/,
+                                                    boost::optional<NR::Rect> const &/*bbox_to_snap*/,
                                                     std::vector<SPItem const *> const */*it*/,
                                                     std::vector<NR::Point> */*unselected_nodes*/) const
 {
@@ -61,7 +61,7 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc,
                                                Inkscape::Snapper::PointType const &t,
                                                NR::Point const &p,
                                                bool const &/*f*/,
-                                               NR::Maybe<NR::Rect> const &/*bbox_to_snap*/,
+                                               boost::optional<NR::Rect> const &/*bbox_to_snap*/,
                                                ConstraintLine const &c,
                                                std::vector<SPItem const *> const */*it*/) const
 
@@ -87,7 +87,7 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc,
     
             /* Try to intersect this line with the target line */
             Geom::Point t_2geom(NR_HUGE, NR_HUGE);
-            Geom::IntersectorKind const k = Geom::line_intersection(n.to_2geom(), q0, i->first.to_2geom(), q1, t_2geom);
+            Geom::IntersectorKind const k = Geom::line_intersection(n, q0, i->first, q1, t_2geom);
             NR::Point t(t_2geom);
     
             if (k == Geom::intersects) {
@@ -97,7 +97,9 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc,
                     // This snappoint is therefore fully constrained, so there's no need
                     // to look for additional intersections; just return the snapped point
                     // and forget about the line
-                    sc.points.push_back(SnappedPoint(t, dist, getSnapperTolerance(), getSnapperAlwaysSnap())); 
+                    sc.points.push_back(SnappedPoint(t, Inkscape::SNAPTARGET_UNDEFINED, dist, getSnapperTolerance(), getSnapperAlwaysSnap()));
+                    // The type of the snap target is yet undefined, as we cannot tell whether 
+                    // we're snapping to grid or the guide lines; must be set by on a higher level   
                 }
             }
         }