Code

copyedit
[inkscape.git] / src / snapped-point.h
index 0669ddd21621ad8b3a9854ae5c73135962c705a8..f0584812d8a9814b6106067b01e87b06c9528880 100644 (file)
@@ -7,41 +7,65 @@
  *
  *    Authors:
  *      Mathieu Dimanche <mdimanche@free.fr>
+ *      Diederik van Lierop <mail@diedenrezi.nl>
  *
  *    Released under GNU GPL, read the file 'COPYING' for more information.
  */
 
 #include <vector>
+#include <list>
 #include "libnr/nr-coord.h"
 #include "libnr/nr-point.h"
+#include <libnr/nr-values.h>
 
 namespace Inkscape
 {
-
-class HighlightGroup;
-
+    
 /// Class describing the result of an attempt to snap.
 class SnappedPoint
 {
 public:
-    SnappedPoint() {}
-    SnappedPoint(::NR::Point p, ::NR::Coord d);
+    SnappedPoint();
+    SnappedPoint(NR::Point p, NR::Coord d, NR::Coord t, bool a, bool at_intersection, NR::Coord d2, NR::Coord t2, bool a2);
+    SnappedPoint(NR::Point p, NR::Coord d, NR::Coord t, bool a);
     ~SnappedPoint();
 
-    void addHighlightGroup(HighlightGroup *group);
-    void addHighlightGroups(std::vector<HighlightGroup*> *groups);
-
-    ::NR::Coord getDistance() const;
+    NR::Coord getDistance() const;
+    NR::Coord getTolerance() const;
+    bool getAlwaysSnap() const;
+    NR::Coord getSecondDistance() const;
+    NR::Coord getSecondTolerance() const;
+    bool getSecondAlwaysSnap() const;
     NR::Point getPoint() const;
-    std::vector<HighlightGroup*> getHighlightGroups() const;
-
-private:
-    ::NR::Coord _distance;
-    ::NR::Point _point;
-    std::vector<HighlightGroup*> _hightlight_groups;
-};
+    bool getAtIntersection() const {return _at_intersection;}
+    
+protected:
+    NR::Point _point; // Location of the snapped point
+    bool _at_intersection; // If true, the snapped point is at an intersection 
+    
+    /* Distance from original point to snapped point. If the snapped point is at
+       an intersection of e.g. two lines, then this is the distance to the closest
+       line */    
+    NR::Coord _distance; 
+    /* The snapping tolerance in screen pixels (depends on zoom)*/  
+    NR::Coord _tolerance;
+    /* If true then "Always snap" is on */
+    bool _always_snap;
+    
+    /* If the snapped point is at an intersection of e.g. two lines, then this is
+       the distance to the fartest line */    
+    NR::Coord _second_distance;
+    /* The snapping tolerance in screen pixels (depends on zoom)*/
+    NR::Coord _second_tolerance;
+    /* If true then "Always snap" is on */
+    bool _second_always_snap;
+};    
 
 }
+
+bool getClosestSP(std::list<Inkscape::SnappedPoint> &list, Inkscape::SnappedPoint &result);
+
+
 #endif /* !SEEN_SNAPPEDPOINT_H */
 
 /*