4 #include <opencv2/core.hpp> 8 #include "canvascv/themes/themerepository.h" 28 static Shape *newShape(std::string type,
const cv::Point &pos);
30 typedef std::function<Shape*(const cv::Point &)> Allocator;
31 static void addShape(std::string name, Allocator a);
34 typedef map<std::string,Allocator> AllocatorsMap;
35 static AllocatorsMap *allocators;
49 static bool addType(std::string name);
52 static T *newShape(
const cv::Point &pos);
61 addShape(name, [](
const cv::Point& pos)->
Shape*{
return new T(pos);});
70 T *shape =
new T(pos);
78 #define CCV_REGISTER_SHAPE(X) static bool regShape##X = canvascv::ShapeFactoryT<X>::addType(#X) 81 #endif // SHAPEFACTORY_H The ShapeFactory class.
Definition: shapefactory.h:24
The c++ std namespace.
Definition: canvas.h:462
The OpenCV namespace.
Definition: canvas.h:465
The Shape class hierarchy is for geomertric user interaction.
Definition: shape.h:32
static void applyCurrentTheme(Shape *shape)
used automatically by the ShapeFactory when creating a shape
The ShapeFactoryT class.
Definition: shapefactory.h:45
This namespace holds all the classes of the CanvasCV library.
Definition: canvas.h:20
static T * newShape(const cv::Point &pos)
create a shape by compile time type at a certain initial pos (don't use directly. Use Canvas::createS...
Definition: shapefactory.h:68
static bool addType(std::string name)
add a shape by compile time type - use the macro CCV_REGISTER_SHAPE
Definition: shapefactory.h:56