diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2018-01-30 08:33:01 +0000 |
|---|---|---|
| committer | Tavmjong Bah <tavmjong@free.fr> | 2018-01-30 08:33:01 +0000 |
| commit | 267299811df952d08324a39008f52c19641de9e0 (patch) | |
| tree | 28fef736a52cb7a72119d119be8eb663ad20a77f /src/object/sp-item-update-cns.cpp | |
| parent | Translations: update inkscape.pot (diff) | |
| download | inkscape-267299811df952d08324a39008f52c19641de9e0.tar.gz inkscape-267299811df952d08324a39008f52c19641de9e0.zip | |
Move classes derived from SPObject to own directory.
A lot of header clean-up.
Diffstat (limited to 'src/object/sp-item-update-cns.cpp')
| -rw-r--r-- | src/object/sp-item-update-cns.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/object/sp-item-update-cns.cpp b/src/object/sp-item-update-cns.cpp new file mode 100644 index 000000000..077931d52 --- /dev/null +++ b/src/object/sp-item-update-cns.cpp @@ -0,0 +1,47 @@ + + +#include "satisfied-guide-cns.h" + +#include "sp-item-update-cns.h" +#include "sp-guide.h" + +using std::find; +using std::vector; + +void sp_item_update_cns(SPItem &item, SPDesktop const &desktop) +{ + std::vector<Inkscape::SnapCandidatePoint> snappoints; + item.getSnappoints(snappoints, NULL); + /* TODO: Implement the ordering. */ + vector<SPGuideConstraint> found_cns; + satisfied_guide_cns(desktop, snappoints, found_cns); + /* effic: It might be nice to avoid an n^2 algorithm, but in practice n will be + small enough that it's still usually more efficient. */ + + for (vector<SPGuideConstraint>::const_iterator fi(found_cns.begin()), + fiEnd(found_cns.end()); + fi != fiEnd; ++fi) + { + SPGuideConstraint const &cn = *fi; + if ( find(item.constraints.begin(), + item.constraints.end(), + cn) + == item.constraints.end() ) + { + item.constraints.push_back(cn); + cn.g->attached_items.push_back(SPGuideAttachment(&item, cn.snappoint_ix)); + } + } +} + + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : |
