From f71fb6a14a0f63e7c456590485713163b95bc9f9 Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Sat, 11 Jul 2020 13:15:00 +0000 Subject: [PATCH] added a map of area name -> area list to Stream --- stream.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/stream.go b/stream.go index b12b5b8..bc200ea 100755 --- a/stream.go +++ b/stream.go @@ -17,10 +17,11 @@ import ( // Stream Unexported type Stream struct { - URL string `json:"url"` - Base64 string `json:"base64"` - Interval int `json:"interval"` - FileLock sync.Mutex `json:"lock"` + URL string `json:"url"` + Base64 string `json:"base64"` + Interval int `json:"interval"` + Areas map[string][]image.Rectangle `json:"areas"` + FileLock sync.Mutex `json:"lock"` } // NewStream creates a new Stream Object @@ -31,7 +32,22 @@ func NewStream(URL string) Stream { URL: URL, Base64: base64, Interval: 5000, + Areas: make(map[string][]image.Rectangle), } + rectList := make([]image.Rectangle, 0) + rectList = append(rectList, image.Rectangle{ + Min: image.Point{X: 30, Y: 30}, + Max: image.Point{X: 400, Y: 200}, + }) + rectList = append(rectList, image.Rectangle{ + Min: image.Point{X: 500, Y: 30}, + Max: image.Point{X: 400, Y: 200}, + }) + rectList = append(rectList, image.Rectangle{ + Min: image.Point{X: 500, Y: 500}, + Max: image.Point{X: 400, Y: 200}, + }) + stream.Areas["test"] = rectList stream.WriteStreamJSON() return stream }