summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/booleans-subitems.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:50:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:50:49 +0000
commitc853ffb5b2f75f5a889ed2e3ef89b818a736e87a (patch)
tree7d13a0883bb7936b84d6ecdd7bc332b41ed04bee /src/ui/tools/booleans-subitems.h
parentInitial commit. (diff)
downloadinkscape-c853ffb5b2f75f5a889ed2e3ef89b818a736e87a.tar.xz
inkscape-c853ffb5b2f75f5a889ed2e3ef89b818a736e87a.zip
Adding upstream version 1.3+ds.upstream/1.3+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ui/tools/booleans-subitems.h')
-rw-r--r--src/ui/tools/booleans-subitems.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/ui/tools/booleans-subitems.h b/src/ui/tools/booleans-subitems.h
new file mode 100644
index 0000000..bbb12f2
--- /dev/null
+++ b/src/ui/tools/booleans-subitems.h
@@ -0,0 +1,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 &copy)
+ : 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