2023-12-29 18:00:11 +03:00
|
|
|
package types
|
2019-01-21 13:13:00 +03:00
|
|
|
|
|
|
|
type Layer struct {
|
|
|
|
Id int `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
From int `json:"from"`
|
2019-03-29 23:02:36 +03:00
|
|
|
To int `json:"to"`
|
2019-01-21 13:13:00 +03:00
|
|
|
}
|
2019-02-14 10:34:16 +03:00
|
|
|
|
|
|
|
func FindLayerById(layers []*Layer, id int) *Layer {
|
|
|
|
for _, l := range layers {
|
|
|
|
if l.Id == id {
|
|
|
|
return l
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func FindLayerByY(layers []*Layer, y int) *Layer {
|
|
|
|
for _, l := range layers {
|
|
|
|
if y >= l.From && y <= l.To {
|
|
|
|
return l
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|