Due to our requirement, the default "Add Feature" will not work for us. So we decided to create a new GUI which validates and does some calculation before changing a layer. This GUI holds the information in a list and based on some conditions decides which layer/layers to edit.
My add-feature tool needs to be similar to the default one, with default add-feature as soon as you click it starts drawing an arbitrary line on the canvas. Similar to the following picture.
How can I represent the information on the QGIS map canvas without adding any new layer?
In short, I want to draw lines/polygons on map canvas. These lines and polygons are totally virtual and after execution of GUI will be removed. Is there a function/class which does this?