-
Notifications
You must be signed in to change notification settings - Fork 0
/
layer_group.go
44 lines (35 loc) · 1.06 KB
/
layer_group.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package models
import "log"
// LayerGroup is the gong version of the leaflet LayerGroup
//
// swagger:model LayerGroup
type LayerGroup struct {
Name string
DisplayName string
// swagger:ignore
// access to the models instance that contains the original information
LayerGroupInterface LayerGroupInterface `gorm:"-"`
}
type LayerGroupInterface interface {
GetLayerName() (name string)
}
func (LayerGroup *LayerGroup) UpdateLayerGroup() {
if LayerGroup.LayerGroupInterface != nil {
LayerGroup.Name = LayerGroup.LayerGroupInterface.GetLayerName()
LayerGroup.DisplayName = LayerGroup.LayerGroupInterface.GetLayerName()
}
}
var DefaultLayerGroup *LayerGroup
// little simple algo for the visual layer computation
func ComputeLayerGroupFromLayerGroupName(gongleafletStage *StageStruct, layerGroupName string) (layerGroup *LayerGroup) {
for _layerGroup := range gongleafletStage.LayerGroups {
if _layerGroup.Name == layerGroupName {
layerGroup = _layerGroup
continue
}
}
if layerGroup == nil {
log.Printf("Unknown layer %s ", layerGroupName)
}
return
}