CanvasCV: canvascv::Handle Class Reference
CanvasCV  1.0.0

The Handle class. More...

#include <handle.h>

Inheritance diagram for canvascv::Handle:
canvascv::Shape

Public Member Functions

const cv::Point & operator() () const
 return the Point location of this Handle
 
void setPos (const cv::Point &pos, bool notify=true)
 setPos More...
 
int getRadius () const
 return the radius of this circled handle
 
CBID addPosChangedCB (PosChangedCB cb)
 register to be notified when this handle changes
 
void delPosChangedCB (const CBID &id)
 unregister to be notified when this handle changes
 
void connect (Handle &other)
 connect to a handle to change when we change
 
void disconnect (Handle &other)
 disconnect from a handle that needed to change with us
 
virtual bool isAtPos (const cv::Point &pos)
 returns true if shape is at pos, false otherwise
 
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::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
 
virtual void setOutlineColor (const cv::Scalar &value)
 set the outline color
 
cv::Scalar getFillColor () const
 get the fill color (fill color is not very useful for shapes right now)
 
virtual void setFillColor (const cv::Scalar &value)
 set 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)
 
virtual void setLocked (bool value)
 set the shape lock state (can/can't be moved/edited)
 
bool getVisible () const
 is the shape visible
 
virtual void setVisible (bool value)
 set the shape visible state
 
int getThickness () const
 get line thickness to use when drawing
 
virtual void setThickness (int value)
 set line thickness to use when drawing
 
int getLineType () const
 get the line type (LINE_4, LINE_8, LINE_AA)
 
virtual void setLineType (int value)
 set the line type (LINE_4, LINE_8, LINE_AA)
 
int getId ()
 return a unique id for this shape
 

Protected Member Functions

virtual void draw (cv::Mat &canvas)
 draw shape on the canvas More...
 
virtual bool mousePressed (const cv::Point &pos, bool=false)
 mousePressed More...
 
virtual bool mouseMoved (const cv::Point &pos)
 mouseMoved More...
 
virtual bool mouseReleased (const cv::Point &pos)
 mouseReleased More...
 
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
virtual std::shared_ptr< ShapegetShape (int id)
 getShape More...
 
virtual bool keyPressed (int &key)
 keyPressed will be called by Canvas for active shapes More...
 
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

The vertices by which the shape is defined and edited

Examples:
example_linecrossing.cpp, and example_shapes_widgets.cpp.

Member Function Documentation

virtual void canvascv::Handle::draw ( cv::Mat &  canvas)
protectedvirtual
Parameters
canvas

Implements canvascv::Shape.

virtual std::list<Handle *> canvascv::Handle::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

Implements canvascv::Shape.

Examples:
example_shapes_widgets.cpp.
virtual const char* canvascv::Handle::getType ( ) const
virtual
Returns
const char * pointer to string with shape type name

Implements canvascv::Shape.

virtual bool canvascv::Handle::mouseMoved ( const cv::Point &  pos)
protectedvirtual
  1. Was a mouse moved over this shape?
  2. If shape is during edit, then these are the mouse position.
    Parameters
    pos
    Returns
    true if a mouse moved over this shape, or it is during edit. false otherwise.

Implements canvascv::Shape.

virtual bool canvascv::Handle::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

Implements canvascv::Shape.

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

Implements canvascv::Shape.

void canvascv::Handle::setPos ( const cv::Point &  pos,
bool  notify = true 
)

set the location of this handle

Parameters
posis the new location to change to
notifydetermines if other cbs which want to know when we change should be notified (mostly 'true')

The documentation for this class was generated from the following file:
  • CanvasCV-doxygen/src/canvascv/shapes/handle.h