acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_defer_item.h
1// From item.h on 2023-06-01 21:00 <3ThomasBorregaardSorensen!!
2#pragma once
3
4
5#include "arc.h"
6#include "ellipse.h"
7#include "line.h"
8
9
10namespace geometry2d
11{
12
13
14 template < typename TYPE, ::draw2d::enum_item t_eitem >
15 class item_type :
16 virtual public item
17 {
18 public:
19
20
21 TYPE m_item;
22
23 item_type()
24 {
25
26
27 }
28
29 ~item_type()
30 {
31
32
33
34 }
35
36
37 ::draw2d::enum_item type() const override { return t_eitem; }
38
39
40 void translate(const ::f64_point & point) override { m_item.offset(point); }
41 bool contains(const ::f64_point & point) override { return m_item.contains(point); }
42 void expand_bounding_box(::f64_rectangle & rectangle) override { m_item.expand_bounding_box(rectangle.top_left(), rectangle.bottom_right()); }
43
44
45 ::subparticle_pointer clone() override
46 {
47
48 auto pitem = allocateø item_type();
49
50 pitem->m_item = m_item;
51
52 return pitem;
53
54 }
55
56
57 };
58
59
60 using line_item = item_type < ::f64_line, ::draw2d::e_item_line >;
61 using rectangle_item = item_type < ::f64_rectangle, ::draw2d::e_item_rectangle >;
62
63
64 using ellipse_item = item_type < ::f64_ellipse, ::draw2d::e_item_ellipse >;
65
66 using arc_item = item_type < ::f64_arc, ::draw2d::e_item_arc >;
67
68 using lines_item = item_type < ::f64_lines, ::draw2d::e_item_lines >;
69
70
71} // namespace geometry2d
72
73
74