Code

remove g++ 4.1.1 compiler errors
[inkscape.git] / src / sp-item-update-cns.cpp
2 #include "satisfied-guide-cns.h"
3 #include "sp-guide-constraint.h"
4 #include <sp-guide.h>
5 #include <sp-item.h>
6 using std::find;
7 using std::vector;
9 void sp_item_update_cns(SPItem &item, SPDesktop const &desktop)
10 {
11     vector<NR::Point> snappoints;
12     sp_item_snappoints(&item, SnapPointsIter(snappoints));
13     /* TODO: Implement the ordering. */
14     vector<SPGuideConstraint> found_cns;
15     satisfied_guide_cns(desktop, snappoints, found_cns);
16     /* effic: It might be nice to avoid an n^2 algorithm, but in practice n will be
17        small enough that it's still usually more efficient. */
19     for (vector<SPGuideConstraint>::const_iterator fi(found_cns.begin()),
20              fiEnd(found_cns.end());
21          fi != fiEnd; ++fi)
22     {
23         SPGuideConstraint const &cn = *fi;
24         if ( find(item.constraints.begin(),
25                   item.constraints.end(),
26                   cn)
27              == item.constraints.end() )
28         {
29             item.constraints.push_back(cn);
30             cn.g->attached_items.push_back(SPGuideAttachment(&item, cn.snappoint_ix));
31         }
32     }
33 }
36 /*
37   Local Variables:
38   mode:c++
39   c-file-style:"stroustrup"
40   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
41   indent-tabs-mode:nil
42   fill-column:99
43   End:
44 */
45 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :