X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsnapped-point.h;h=f0584812d8a9814b6106067b01e87b06c9528880;hb=f0e5ef1c60ad148623253dc3cc5d53014724094a;hp=0669ddd21621ad8b3a9854ae5c73135962c705a8;hpb=1c08a33cfc4402041ddc6f9f470d643df81676e4;p=inkscape.git diff --git a/src/snapped-point.h b/src/snapped-point.h index 0669ddd21..f0584812d 100644 --- a/src/snapped-point.h +++ b/src/snapped-point.h @@ -7,41 +7,65 @@ * * Authors: * Mathieu Dimanche + * Diederik van Lierop * * Released under GNU GPL, read the file 'COPYING' for more information. */ #include +#include #include "libnr/nr-coord.h" #include "libnr/nr-point.h" +#include 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 *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 getHighlightGroups() const; - -private: - ::NR::Coord _distance; - ::NR::Point _point; - std::vector _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 &list, Inkscape::SnappedPoint &result); + + #endif /* !SEEN_SNAPPEDPOINT_H */ /*