view pkg/models/system.go @ 961:a4c92e0ef2e1

Stored point cloud and bounding area of sounding result in database. WIP.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 17 Oct 2018 13:41:49 +0200
parents 83c271cb2344
children a244b18cb916
line wrap: on
line source

package models

type (
	Colour struct {
		R int     `json:"r"`
		G int     `json:"g"`
		B int     `json:"b"`
		A float32 `json:"a"`
	}
)

func isByteRange(i int) bool {
	return i >= 0 && i < 256
}

func (c Colour) IsValid() bool {
	return isByteRange(c.R) &&
		isByteRange(c.G) &&
		isByteRange(c.B) &&
		c.A >= 0 && c.A <= 1
}