diff options
| author | bulia byak <buliabyak@gmail.com> | 2008-05-06 05:33:58 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2008-05-06 05:33:58 +0000 |
| commit | f1e85fe01f96f87a7e9ecd24ca0836b0c931bc26 (patch) | |
| tree | f797c95533055ac485c3646a82826f026ecc0752 /src | |
| parent | make determining smooth nodes more robust (diff) | |
| download | inkscape-f1e85fe01f96f87a7e9ecd24ca0836b0c931bc26.tar.gz inkscape-f1e85fe01f96f87a7e9ecd24ca0836b0c931bc26.zip | |
export bbox sorting machinery
(bzr r5614)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/align-and-distribute.cpp | 20 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.h | 11 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 9b16320f3..68c083c6f 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -255,24 +255,20 @@ ActionAlign::Coeffs const ActionAlign::_allCoeffs[10] = { {0., 0., 1., 0., 0., 0., 0., 1.} }; -struct BBoxSort -{ - SPItem *item; - float anchor; - NR::Rect bbox; - BBoxSort(SPItem *pItem, NR::Rect bounds, NR::Dim2 orientation, double kBegin, double kEnd) : +BBoxSort::BBoxSort(SPItem *pItem, NR::Rect bounds, NR::Dim2 orientation, double kBegin, double kEnd) : item(pItem), bbox (bounds) - { +{ anchor = kBegin * bbox.min()[orientation] + kEnd * bbox.max()[orientation]; - } - BBoxSort(const BBoxSort &rhs): +} +BBoxSort::BBoxSort(const BBoxSort &rhs) : //NOTE : this copy ctor is called O(sort) when sorting the vector //this is bad. The vector should be a vector of pointers. //But I'll wait the bohem GC before doing that - item(rhs.item), anchor(rhs.anchor), bbox(rhs.bbox) { - } -}; + item(rhs.item), anchor(rhs.anchor), bbox(rhs.bbox) +{ +} + bool operator< (const BBoxSort &a, const BBoxSort &b) { return (a.anchor < b.anchor); diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index a54ac781e..d6cbd377f 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -104,6 +104,17 @@ private: AlignAndDistribute& operator=(AlignAndDistribute const &d); }; + +struct BBoxSort +{ + SPItem *item; + float anchor; + NR::Rect bbox; + BBoxSort(SPItem *pItem, NR::Rect bounds, NR::Dim2 orientation, double kBegin, double kEnd); + BBoxSort(const BBoxSort &rhs); +}; +bool operator< (const BBoxSort &a, const BBoxSort &b); + } // namespace Dialog } // namespace UI } // namespace Inkscape |
