Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
bboxsort.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_BBOXSORT_H
3#define SEEN_BBOXSORT_H
4
8/* Authors:
9 * MenTaLguY
10 * Dmitry Kirsanov
11 * Krzysztof KosiƄski
12 *
13 * Copyright (C) 2007-2012 Authors
14 *
15 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
16 */
17/*
18 * Previously part of the Align and Distribute dialog.
19 */
20
21class BBoxSort {
22
23public:
24 BBoxSort(SPItem *item, Geom::Rect const &bounds, Geom::Dim2 orientation, double begin, double end)
25 : item(item)
26 , bbox(bounds)
27 {
28 anchor = begin * bbox.min()[orientation] + end * bbox.max()[orientation];
29 }
30
31 BBoxSort(const BBoxSort &rhs) = default; // Should really be vector of pointers to avoid copying class when sorting.
32 ~BBoxSort() = default;
33
34 double anchor = 0.0;
35 SPItem* item = nullptr;
37};
38
39static bool operator< (const BBoxSort &a, const BBoxSort &b) {
40 return a.anchor < b.anchor;
41}
42
43#endif // SEEN_BBOXSORT_H
44
45/*
46 Local Variables:
47 mode:c++
48 c-file-style:"stroustrup"
49 c-file-offsets:((innamespace . 0)(inline-open . 0))
50 indent-tabs-mode:nil
51 fill-column:99
52 End:
53*/
54// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
static bool operator<(const BBoxSort &a, const BBoxSort &b)
Definition bboxsort.h:39
Geom::IntRect bounds
Definition canvas.cpp:169
~BBoxSort()=default
double anchor
Definition bboxsort.h:34
SPItem * item
Definition bboxsort.h:35
Geom::Rect bbox
Definition bboxsort.h:36
BBoxSort(const BBoxSort &rhs)=default
BBoxSort(SPItem *item, Geom::Rect const &bounds, Geom::Dim2 orientation, double begin, double end)
Definition bboxsort.h:24
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
CPoint max() const
Get the corner of the rectangle with largest coordinate values.
Axis aligned, non-empty rectangle.
Definition rect.h:92
Base class for visual SVG elements.
Definition sp-item.h:109
Dim2
2D axis enumeration (X or Y).
Definition coord.h:48
Geom::Point end