Geometrize  1.0
C++ library for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
shape.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 #include <vector>
6 
7 #include "../rasterizer/scanline.h"
8 #include "shapetypes.h"
9 
10 namespace geometrize
11 {
12 
17 class Shape
18 {
19 public:
20  Shape() = default;
21  virtual ~Shape() = default;
22  Shape& operator=(const geometrize::Shape& other) = default;
23  Shape(const geometrize::Shape& other) = default;
24 
25  std::function<void(geometrize::Shape&)> setup;
26  std::function<void(geometrize::Shape&)> mutate;
27  std::function<std::vector<geometrize::Scanline>(const geometrize::Shape&)> rasterize;
28 
33  virtual std::shared_ptr<geometrize::Shape> clone() const
34  {
35  throw "Unimplemented"; // NOTE not pure virtual because it breaks simple upcast in Chaiscript (and can't see how else to do it)
36  }
37 
43  {
44  throw "Unimplemented";
45  }
46 };
47 
48 }
ShapeTypes
The ShapeTypes enum specifies the types of shapes that can be used. These can be combined to produce ...
Definition: shapetypes.h:16
virtual std::shared_ptr< geometrize::Shape > clone() const
clone Clones the shape, a virtual copy constructor.
Definition: shape.h:33
virtual ~Shape()=default
std::function< void(geometrize::Shape &)> mutate
Definition: shape.h:26
std::function< std::vector< geometrize::Scanline >const geometrize::Shape &)> rasterize
Definition: shape.h:27
Shape & operator=(const geometrize::Shape &other)=default
Definition: shape.h:17
std::function< void(geometrize::Shape &)> setup
Definition: shape.h:25
virtual geometrize::ShapeTypes getType() const
getType Gets the ShapeType of the shape.
Definition: shape.h:42