drawContour method

The drawContour method of the DrawContour class calls the drawShape method on the shape instance, this is shown in the following code:

//DrawContour method drawContour given the coordinates
func (contour DrawContour) drawContour(x[5] float32,y[5] float32) {
fmt.Println("Drawing Contour")
contour.shape.drawShape(contour.x,contour.y)
}
//DrawContour method resizeByFactor given factor
func (contour DrawContour) resizeByFactor(factor int) {
contour.factor = factor
}
// main method
func main() {
var x = [5]float32{1,2,3,4,5}
var y = [5]float32{1,2,3,4,5}
var contour IContour = DrawContour{x,y,DrawShape{},2}
contour.drawContour(x,y)
contour.resizeByFactor(2)
}

Run the following commands:

go run bridge.go

The following screenshot displays the output:

We will take a look at Composite, Decorator, Facade and Flyweight design patterns in the next sections.