1 #ifndef COMPOUNDSHAPE_H 2 #define COMPOUNDSHAPE_H 5 #include "shapefactory.h" 6 #include "canvascv/colors.h" 31 virtual std::shared_ptr<Shape>
getShape(
int id);
33 virtual void translate(
const cv::Point &offset);
37 virtual void reloadPointers(
const std::list<Shape*> &, std::list<Shape*>::const_iterator &)
40 virtual void draw(cv::Mat &canvas);
41 virtual bool mousePressed(
const cv::Point &pos,
bool onCreate =
false);
48 virtual const string &getCreateStatusMsg()
const;
49 virtual const string &getEditStatusMsg()
const;
51 void setActive(
Shape* shape);
55 T* addShape(cv::Point pos);
57 bool rmvShape(
Shape *shape);
59 virtual void writeInternals(cv::FileStorage &fs)
const;
60 virtual void readInternals(
const cv::FileNode &node);
62 virtual void setReady();
65 std::shared_ptr<Shape> active;
66 std::list<std::shared_ptr<Shape>> shapes;
69 template <
class T>
inline 70 T* CompoundShape::addShape(cv::Point pos)
73 shapes.push_back(std::shared_ptr<Shape>(ret));
79 #endif // COMPOUNDSHAPE_H virtual void setThickness(int value)
set line thickness to use when drawing
virtual void setLineType(int value)
set the line type (LINE_4, LINE_8, LINE_AA)
virtual std::shared_ptr< Shape > getShape(int id)
getShape
The Shape class hierarchy is for geomertric user interaction.
Definition: shape.h:32
virtual void draw(cv::Mat &canvas)
draw shape on the canvas
The CompoundShape class.
Definition: compoundshape.h:20
virtual bool keyPressed(int &key)
keyPressed will be called by Canvas for active shapes
virtual void setLocked(bool value)
set the shape lock state (can/can't be moved/edited)
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
virtual void setFillColor(const cv::Scalar &value)
set the fill color (fill color is not very useful for shapes right now)
virtual bool mouseMoved(const cv::Point &pos)
mouseMoved
virtual void setVisible(bool value)
set the shape visible state
virtual void setOutlineColor(const cv::Scalar &value)
set the outline color
virtual bool mousePressed(const cv::Point &pos, bool onCreate=false)
mousePressed
virtual bool mouseReleased(const cv::Point &pos)
mouseReleased
virtual void lostFocus()
lostFocus is called by Canvas if we're in it and just became non-active