Code

Merge and cleanup of GSoC C++-ification project.
[inkscape.git] / src / satisfied-guide-cns.cpp
1 #include <desktop-handles.h>
2 #include <libnr/nr-point-fns.h>
3 #include <sp-guide.h>
4 #include <sp-guide-constraint.h>
5 #include <sp-namedview.h>
6 #include <approx-equal.h>
8 void satisfied_guide_cns(SPDesktop const &desktop,
9                          std::vector<Inkscape::SnapCandidatePoint> const &snappoints,
10                          std::vector<SPGuideConstraint> &cns)
11 {
12     SPNamedView const &nv = *sp_desktop_namedview(&desktop);
13     for (GSList const *l = nv.guides; l != NULL; l = l->next) {
14         SPGuide &g = *SP_GUIDE(l->data);
15         for (unsigned int i = 0; i < snappoints.size(); ++i) {
16             if (approx_equal( g.getDistanceFrom(snappoints[i].getPoint()), 0) ) {
17                 cns.push_back(SPGuideConstraint(&g, i));
18             }
19         }
20     }
21 }
24 /*
25   Local Variables:
26   mode:c++
27   c-file-style:"stroustrup"
28   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
29   indent-tabs-mode:nil
30   fill-column:99
31   End:
32 */
33 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :