Mercurial > gemma
annotate pkg/models/system.go @ 904:e4b72a199258
New default bottleneck colors
Mainly to make the stroke color one actually selectable in the ui.
In addition the pink does better match the collors used on the ECDIS layer.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 02 Oct 2018 13:34:59 +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 } |