Mercurial > gemma
annotate pkg/models/system.go @ 962:d7f34791b18d
refac: moved linetool and morphtool
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 17 Oct 2018 15:22:21 +0200 |
parents | 83c271cb2344 |
children | a244b18cb916 |
rev | line source |
---|---|
840
0f61bfc21041
Added end point to get style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
1 package models |
0f61bfc21041
Added end point to get style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
2 |
0f61bfc21041
Added end point to get style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
3 type ( |
0f61bfc21041
Added end point to get style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
4 Colour struct { |
854
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
5 R int `json:"r"` |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
6 G int `json:"g"` |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
7 B int `json:"b"` |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
8 A float32 `json:"a"` |
840
0f61bfc21041
Added end point to get style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
9 } |
0f61bfc21041
Added end point to get style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
10 ) |
846
6902032757e4
Added end point to set style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
840
diff
changeset
|
11 |
854
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
12 func isByteRange(i int) bool { |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
13 return i >= 0 && i < 256 |
846
6902032757e4
Added end point to set style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
840
diff
changeset
|
14 } |
6902032757e4
Added end point to set style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
840
diff
changeset
|
15 |
854
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
16 func (c Colour) IsValid() bool { |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
17 return isByteRange(c.R) && |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
18 isByteRange(c.G) && |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
19 isByteRange(c.B) && |
83c271cb2344
Reverted fcb38cedc680 (More tightened color model.)
Sascha Wilde <wilde@intevation.de>
parents:
850
diff
changeset
|
20 c.A >= 0 && c.A <= 1 |
846
6902032757e4
Added end point to set style (colour) information for feature.
Sascha Wilde <wilde@intevation.de>
parents:
840
diff
changeset
|
21 } |