~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/snapped-point.h

  • Committer: Diederik van Lierop
  • Date: 2009-12-24 20:10:43 UTC
  • Revision ID: diederik_van_lierop_mail_at-sign_diedenrezi_dot_nl-20091224201043-txzqbq2uvs8334ei
refactoring the snapping code (laying the groundwork for my next commit which reduces snap jitter)

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
 
79
79
public:
80
80
    SnappedPoint();
81
 
    SnappedPoint(Geom::Point const &p, SnapSourceType const &source, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2);
82
 
    SnappedPoint(Geom::Point const &p, SnapSourceType const &source, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &fully_constrained);
 
81
    SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &at_intersection, bool const &fully_constrained, Geom::Coord const &d2, Geom::Coord const &t2, bool const &a2);
 
82
    SnappedPoint(Geom::Point const &p, SnapSourceType const &source, long source_num, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &fully_constrained);
83
83
    ~SnappedPoint();
84
84
 
85
85
    Geom::Coord getSnapDistance() const {return _distance;}
115
115
    void setTarget(SnapTargetType const target) {_target = target;}
116
116
    SnapTargetType getTarget() const {return _target;}
117
117
    void setSource(SnapSourceType const source) {_source = source;}
118
 
        SnapSourceType getSource() const {return _source;}
 
118
    SnapSourceType getSource() const {return _source;}
 
119
    long getSourceNum() const {return _source_num;}
119
120
 
120
121
    bool isOtherSnapBetter(SnappedPoint const &other_one, bool weighted) const;
121
122
 
122
123
    /*void dump() const {
123
124
        std::cout << "_point              = " << _point << std::endl;
124
125
        std::cout << "_source             = " << _source << std::endl;
 
126
        std::cout << "_source_num         = " << _source_num << std::endl;
125
127
        std::cout << "_target             = " << _target << std::endl;
126
128
        std::cout << "_at_intersection    = " << _at_intersection << std::endl;
127
129
        std::cout << "_fully_constrained  = " << _fully_constrained << std::endl;
138
140
protected:
139
141
    Geom::Point _point; // Location of the snapped point
140
142
    SnapSourceType _source; // Describes what snapped
 
143
    long _source_num; // Sequence number of the source point that snapped, if that point is part of a set of points. (starting at zero)
141
144
    SnapTargetType _target; // Describes to what we've snapped to
142
145
    bool _at_intersection; // If true, the snapped point is at an intersection
143
146
    bool _fully_constrained; // When snapping for example to a node, then the snap will be "fully constrained".
153
156
    bool _always_snap;
154
157
 
155
158
    /* If the snapped point is at an intersection of e.g. two lines, then this is
156
 
       the distance to the fartest line */
 
159
       the distance to the farthest line */
157
160
    Geom::Coord _second_distance;
158
161
    /* The snapping tolerance in screen pixels (depends on zoom)*/
159
162
    Geom::Coord _second_tolerance;