blob: bbb12f2c4865c2c98990e71ce91a7de411b00152 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
*
*//*
* Authors:
* Martin Owens
*
* Copyright (C) 2022 Authors
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#ifndef INKSCAPE_UI_TOOLS_BOOLEANS_SUBITEMS_H
#define INKSCAPE_UI_TOOLS_BOOLEANS_SUBITEMS_H
#include <2geom/pathvector.h>
#include <vector>
#include <functional>
class SPItem;
class SPStyle;
namespace Inkscape {
class SubItem;
using WorkItem = std::shared_ptr<SubItem>;
using WorkItems = std::vector<WorkItem>;
/**
* When an item is broken, each broken part is represented by
* the SubItem class. This class hold information such as the
* original items it originated from and the paths that it
* consists of.
**/
class SubItem
{
public:
SubItem(Geom::PathVector paths, SPItem *item, SPStyle *style)
: _paths(std::move(paths))
, _item(item)
, _style(style)
{}
SubItem(const SubItem ©)
: SubItem(copy._paths, copy._item, copy._style)
{}
SubItem &operator+=(const SubItem &other);
bool contains(const Geom::Point &pt) const;
const Geom::PathVector &get_pathv() const { return _paths; }
SPItem *get_item() const { return _item; }
SPStyle *getStyle() const { return _style; }
static WorkItems build_mosaic(std::vector<SPItem*> &&items);
static WorkItems build_flatten(std::vector<SPItem*> &&items);
bool getSelected() const { return _selected; }
void setSelected(bool selected) { _selected = selected; }
private:
Geom::PathVector _paths;
SPItem *_item;
SPStyle *_style;
bool _selected = false;
};
} // namespace Inkscape
#endif // INKSCAPE_UI_TOOLS_BOOLEANS_SUBITEMS_H
|