Example configuration file: shape-history.xml
Contains The classes
ShapeHistory keeps track of the current shapes the user has created. The shapes handled are any that inherits the Shape base class. There are currently two shapes implemented Point and Line.
Point is the graphical representation of a centred position. A point can be stored and managed by the ShapeHistory.
Line is a line between two Point objects.
DrawingEvent is an extension of Qub and handles mouse and keyboard events for the Qub canvas. It handles selection and some manipulation of the Shape objects.
Bases: Qub.Objects.QubDrawingEvent.QubDrawingEvent
Extension of Qub that handles mouse and keyboard events for the Qub canvas. Handles selection and some manipulation of the Shape objects.
De selects all shapes.
Delete the selected shape.
Method defined by QubDrawingEvent. Called on mouse click. Checks if a shape is selected and ‘moves to’ the selected position.
Selects the shape the mouse is over when clicked, de selects everything if nothing was under the mouse.
Handles the type of selection, multiple shapes or only one.
Method defined by QubDrawingEvent. Called on key press.
Method defined by QubDrawingEvent. Called on key release. Handles removal of a selected shape when delete is pressed.
Select the shape referenced by self._current_shape.
Select the shape <shape> (programmatically).
Parameters: | shape (Shape) – The shape to select. |
---|
Bases: HardwareObjects.ShapeHistory.Shape
Bases: HardwareObjects.ShapeHistory.Shape
Draws a qub point in the sample video.
Bases: object
Base class for shapes.
Draws the shape on its drawing.
Returns: | The centred position(s) associated with the shape. |
---|---|
Return type: | List of CentredPosition objects. |
Returns: | The drawing on which the shape is drawn. |
---|---|
Return type: | QDrawing |
Returns: | True if the shape was hit by the mouse. |
---|
Returns: | A list of qub objects. |
---|
Hides the shape.
Highlights the shape
Moves the shape to the position <new_position>
Shows the shape.
Removes highlighting.
Bases: HardwareRepository.BaseHardwareObjects.HardwareObject
Keeps track of the current shapes the user has created. The shapes handled are any that inherits the Shape base class.
Adds a grid object to the shape history. The grid/mesh is not yet handled as a Shape object but will be in the future.
This method will disapear when that transition has been made.
Adds the shape <shape> to the list of handled objects.
Parameters: | shape (Shape object.) – Shape to add. |
---|
Clear the shape history, remove all contents.
Removes the shape <shape> from the list of handled shapes.
Parameters: | shape (Shape object.) – The shape to remove |
---|
Returns: | Returns the drawing of the shapes. |
---|---|
Return type: | QubDrawing |
Returns: | The event handler of the drawing. |
---|---|
Return type: | QubDrawingEvent |
Returns the current grid object.
Gets the QImage from a parent widget.
Parameters: |
|
---|---|
Returns: | The QImage contained in the parent widget. |
Return type: | QImage |
Returns: | All the shapes currently handled. |
---|
Get a snapshot of the video stream and overlay the objects in qub_objects.
Parameters: | qub_objects (QCanvas) – The QCanvas object to add on top of the video. |
---|---|
Returns: | The snapshot |
Return type: | QImage |
Moves the shape <shape> to the position <new_position>
Parameters: |
|
---|
Sets the drawing the Shape objects that are managed are drawn on.
Parameters: | drawing (QubDrawing (used by Qub)) – The drawing that the shapes are drawn on. |
---|---|
Returns: | None |