-
Notifications
You must be signed in to change notification settings - Fork 1
/
options.go
48 lines (42 loc) · 939 Bytes
/
options.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
45
46
47
48
package cluster
// Option allows modifying cluster properties or cluster itself.
type Option func(*Cluster) error
// cluster := &Cluster{
// MinZoom: 0,
// MaxZoom: 16,
// PointSize: 40, // 240
// TileSize: 512,
// NodeSize: 64, // 128
// Radius: 40,
// Extent: 512,
// }
// WithPointSize will set point size.
func WithPointSize(size int) Option {
return func(c *Cluster) error {
c.PointSize = size
return nil
}
}
// WithTileSize will set tile size.
// TileSize = 512 (GMaps and OSM default).
func WithTileSize(size int) Option {
return func(c *Cluster) error {
c.TileSize = size
return nil
}
}
// WithinZoom will set min/max zoom.
func WithinZoom(min, max int) Option {
return func(c *Cluster) error {
c.MinZoom = min
c.MaxZoom = max
return nil
}
}
// WithNodeSize will set node size.
func WithNodeSize(size int) Option {
return func(c *Cluster) error {
c.NodeSize = size
return nil
}
}