CanvasCV: canvascv::ShapesConnector Class Reference
CanvasCV  1.0.0
canvascv::ShapesConnector Class Reference

The ShapesConnector class. More...

#include <shapesconnector.h>

Inheritance diagram for canvascv::ShapesConnector:
canvascv::Line canvascv::CompoundShape canvascv::Shape canvascv::LabeledShapesConnector

Public Member Functions

int getSpacing () const
 get the spacing of the dotted connecting line
 
void setSpacing (int value)
 set the spacing of the dotted connecting line
 
void connectTail (Shape &shape, Handle &handle)
 Connect 'shape' with it's Handle 'handle' to our own tail Handle.
 
void connectHead (Shape &shape, Handle &handle)
 Connect 'shape' with it's Handle 'handle' to our own head Handle.
 
void disconnectTail ()
 disconnect our own tail Handle from any previously connected shape
 
void disconnectHead ()
 disconnect our own head Handle from any previously connected shape
 
void reconnect ()
 called after read of Canvas from file, assuming internals are filled, but not connected
 
int getTailShapeId ()
 get the id of the shape connected to our tail Handle
 
int getHeadShapeId ()
 get the id of the shape connected to our head Handle
 
ShapegetTailShape ()
 get the shape connected to our tail Handle
 
ShapegetHeadShape ()
 get the shape connected to our head Handle
 
void disconnectShape (int id)
 disconnect a previouslt connected shape with an 'id'
 
virtual std::list< Handle * > getConnectionTargets ()
 getConnectionTargets More...
 
virtual const char * getType () const
 getType is always implemented by derived to return the same static pointer per shape. More...
 
- Public Member Functions inherited from canvascv::Line
void lockTail (bool isLocked)
 set if to lock the tail (Handle) of the line
 
void lockHead (bool isLocked)
 set if to lock the head (Handle) of the line
 
void showTail (bool isVisible)
 set if to show the tail (Handle) of the line
 
void showHead (bool isVisible)
 set if to show the head (Handle) of the line
 
void setTailPos (const cv::Point &pos)
 will move the tail (Handle) of the line to pos
 
void setHeadPos (const cv::Point &pos)
 will move the head (Handle) of the line to pos
 
double length () const
 returns the length of the line in pixels
 
bool isPointOnLine (const cv::Point &p3, int threshold=3) const
 returns true if the point 'p3' is on the line, give or take 'threshold' pixels
 
HandlegetPT1 ()
 get the Handle to the tail of the
 
HandlegetPT2 ()
 get the Handle to the head of the
 
const cv::Point & getTail () const
 get the Point position og the tail Handle
 
const cv::Point & getHead () const
 get the Point position og the head Handle
 
virtual bool isAtPos (const cv::Point &pos)
 returns true if shape is at pos, false otherwise
 
virtual bool keyPressed (int &key)
 keyPressed will be called by Canvas for active shapes More...
 
- Public Member Functions inherited from canvascv::CompoundShape
virtual void setOutlineColor (const cv::Scalar &value)
 set the outline color
 
virtual void setFillColor (const cv::Scalar &value)
 set the fill color (fill color is not very useful for shapes right now)
 
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 void setLocked (bool value)
 set the shape lock state (can/can't be moved/edited)
 
virtual void setVisible (bool value)
 set the shape visible state
 
virtual std::shared_ptr< ShapegetShape (int id)
 getShape More...
 
- Public Member Functions inherited from canvascv::Shape
 Shape ()
 constructor
 
 Shape (const Shape &other)
 copy constructor
 
virtual ~Shape ()
 virtual destructor
 
void notifyOnEvent (CBPerShape cb)
 used to register for notifications on shape More...
 
cv::Scalar getOutlineColor () const
 get the outline color
 
cv::Scalar getFillColor () const
 get the fill color (fill color is not very useful for shapes right now)
 
bool getLocked () const
 is the shape locked (can't be moved/edited)
 
bool getVisible () const
 is the shape visible
 
int getThickness () const
 get line thickness to use when drawing
 
int getLineType () const
 get the line type (LINE_4, LINE_8, LINE_AA)
 
int getId ()
 return a unique id for this shape
 

Protected Member Functions

virtual bool mousePressed (const cv::Point &pos, bool onCreate=false)
 mousePressed More...
 
virtual bool mouseReleased (const cv::Point &pos)
 mouseReleased More...
 
- Protected Member Functions inherited from canvascv::Line
virtual void draw (cv::Mat &canvas)
 draw shape on the canvas More...
 
virtual bool mouseMoved (const cv::Point &pos)
 mouseMoved More...
 
- Protected Member Functions inherited from canvascv::CompoundShape
virtual void lostFocus ()
 lostFocus is called by Canvas if we're in it and just became non-active
 
- Protected Member Functions inherited from canvascv::Shape
void drawHelper (cv::Mat &canvas, Shape *other)
 helper method for non compund shapes to draw their members
 

Additional Inherited Members

- Public Types inherited from canvascv::Shape
typedef std::function< void(Shape *, Event)> CBPerShape
 signature of a callback which gets the Event
 

Detailed Description

Allows visually connecting 2 shapes from the code or by mouse

Examples:
example_shapes_widgets.cpp.

Member Function Documentation

virtual std::list<Handle *> canvascv::ShapesConnector::getConnectionTargets ( )
virtual

Return a list of Handles this shape allows to connect to from other shapes (mainly for ShapesConnector)

Returns
list of Handle pointers we ShapesConnector can use to connect

Reimplemented from canvascv::Line.

virtual const char* canvascv::ShapesConnector::getType ( ) const
virtual
Returns
const char * pointer to string with shape type name

Reimplemented from canvascv::Line.

Reimplemented in canvascv::LabeledShapesConnector.

virtual bool canvascv::ShapesConnector::mousePressed ( const cv::Point &  pos,
bool  onCreate = false 
)
protectedvirtual
Parameters
pos
onCreateis true if this is the mouse press which cerated this shape
Returns
true for keep in focus, false for leave focus

Reimplemented from canvascv::Line.

virtual bool canvascv::ShapesConnector::mouseReleased ( const cv::Point &  pos)
protectedvirtual
Parameters
pos
Returns
true for keep in focus, false for leave focus

Reimplemented from canvascv::Line.


The documentation for this class was generated from the following file: