~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/snapped-point.h

  • Committer: JazzyNico
  • Date: 2011-08-29 20:25:30 UTC
  • Revision ID: nicoduf@yahoo.fr-20110829202530-6deuoz11q90usldv
Code refactoring and merging with trunk (revision 10599).

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
#include <vector>
16
16
#include <list>
17
 
#include <libnr/nr-values.h> //Because of NR_HUGE
18
17
#include <2geom/geom.h>
19
18
#include <snap-candidate.h>
20
19
 
48
47
     * to, because it only returns a point if snapping has actually occurred
49
48
     * (by overwriting p)
50
49
     */
51
 
    void getPoint(Geom::Point &p) const;
 
50
    void getPointIfSnapped(Geom::Point &p) const;
52
51
 
53
52
    /* This method however always returns a point, even if no snapping
54
53
     * has occurred; A check should be implemented in the calling code
55
54
     * to check for snapping. Use this method only when really needed, e.g.
56
55
     * when the calling code is trying to snap multiple points and must
57
 
     * determine itself which point is most appropriate
 
56
     * determine itself which point is most appropriate, or when doing a
 
57
     * constrainedSnap that also enforces projection onto the constraint (in
 
58
     * which case you need the new point anyway, even if we didn't snap)
58
59
     */
59
60
    Geom::Point getPoint() const {return _point;}
60
61
    void setPoint(Geom::Point const &p) {_point = p;}
62
63
    bool getAtIntersection() const {return _at_intersection;}
63
64
    bool getFullyConstrained() const {return _fully_constrained;}
64
65
    bool getConstrainedSnap() const {return _constrained_snap;}
65
 
    bool getSnapped() const {return _distance < NR_HUGE;}
 
66
    bool getSnapped() const {return _distance < Geom::infinity();}
66
67
    Geom::Point getTransformation() const {return _transformation;}
67
68
    void setTransformation(Geom::Point const t) {_transformation = t;}
68
69
    void setTarget(SnapTargetType const target) {_target = target;}
95
96
protected:
96
97
    Geom::Point _point; // Location of the snapped point
97
98
    SnapSourceType _source; // Describes what snapped
98
 
    long _source_num; // Sequence number of the source point that snapped, if that point is part of a set of points. (starting at zero)
 
99
    long _source_num; // Sequence number of the source point that snapped, if that point is part of a set of points. (starting at zero if we might have a set of points; -1 if we only have a single point)
99
100
    SnapTargetType _target; // Describes to what we've snapped to
100
101
    bool _at_intersection; // If true, the snapped point is at an intersection
101
102
    bool _constrained_snap; // If true, then the snapped point was found when looking for a constrained snap