Skip to content

Commit 187cf98

Browse files
author
Léon van der Kaap
committed
Switched custom function to shared functions
1 parent f45046d commit 187cf98

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

api/v3/wms_types.go

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@ SOFTWARE.
2525
package v3
2626

2727
import (
28-
"fmt"
29-
"maps"
30-
"slices"
31-
"sort"
32-
"strings"
33-
3428
shared_model "github.com/pdok/smooth-operator/model"
3529
autoscalingv2 "k8s.io/api/autoscaling/v2"
3630
corev1 "k8s.io/api/core/v1"
3731
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32+
"maps"
33+
"slices"
34+
"sort"
3835
)
3936

4037
const (
@@ -115,26 +112,14 @@ type WMSBoundingBox struct {
115112
}
116113

117114
func (wmsBoundingBox *WMSBoundingBox) ToExtent() string {
118-
bbox := wmsBoundingBox.BBox
119-
return strings.Trim(fmt.Sprintf("%s %s %s %s", bbox.MinX, bbox.MinY, bbox.MaxX, bbox.MaxY), " ")
115+
return wmsBoundingBox.BBox.ToExtent()
120116
}
121117

122118
func (wmsBoundingBox *WMSBoundingBox) Combine(other *WMSBoundingBox) {
123119
if wmsBoundingBox.CRS != other.CRS {
124120
return
125121
}
126-
if other.BBox.MinX < wmsBoundingBox.BBox.MinX {
127-
wmsBoundingBox.BBox.MinX = other.BBox.MinX
128-
}
129-
if other.BBox.MaxX > wmsBoundingBox.BBox.MaxX {
130-
wmsBoundingBox.BBox.MaxX = other.BBox.MaxX
131-
}
132-
if other.BBox.MinY < wmsBoundingBox.BBox.MinY {
133-
wmsBoundingBox.BBox.MinY = other.BBox.MinY
134-
}
135-
if other.BBox.MaxY > wmsBoundingBox.BBox.MaxY {
136-
wmsBoundingBox.BBox.MaxY = other.BBox.MaxY
137-
}
122+
wmsBoundingBox.BBox.Combine(other.BBox)
138123
}
139124

140125
type Authority struct {

0 commit comments

Comments
 (0)