changeset 1373:84e78d2e2d95

Backend: Centralized the definition of WGS84 constant in the models package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 27 Nov 2018 13:02:28 +0100
parents 5b9b8eabcd01
children 353d36dd2571
files pkg/controllers/cross.go pkg/models/common.go pkg/models/sr.go pkg/octree/tin.go
diffstat 4 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/cross.go	Tue Nov 27 12:49:53 2018 +0100
+++ b/pkg/controllers/cross.go	Tue Nov 27 13:02:28 2018 +0100
@@ -25,8 +25,6 @@
 	"gemma.intevation.de/gemma/pkg/octree"
 )
 
-const WGS84 = 4326
-
 func reproject(
 	ctx context.Context,
 	rp *models.Reprojector,
@@ -105,7 +103,7 @@
 	var rp *models.Reprojector
 	if rp, err = models.NewReprojector(
 		ctx, conn,
-		WGS84, tree.EPSG,
+		models.WGS84, tree.EPSG,
 	); err != nil {
 		return
 	}
--- a/pkg/models/common.go	Tue Nov 27 12:49:53 2018 +0100
+++ b/pkg/models/common.go	Tue Nov 27 13:02:28 2018 +0100
@@ -19,3 +19,6 @@
 	errNoString    = errors.New("Not a string")
 	errNoByteSlice = errors.New("Not a byte slice")
 )
+
+// WGS84 is the EPSG of the World Geodetic System 1984.
+const WGS84 = 4326
--- a/pkg/models/sr.go	Tue Nov 27 12:49:53 2018 +0100
+++ b/pkg/models/sr.go	Tue Nov 27 13:02:28 2018 +0100
@@ -24,10 +24,7 @@
 	"time"
 )
 
-const (
-	SoundingResultDateFormat = "2006-01-02"
-	WGS84                    = 4326
-)
+const SoundingResultDateFormat = "2006-01-02"
 
 type (
 	SoundingResultDate struct{ time.Time }
--- a/pkg/octree/tin.go	Tue Nov 27 12:49:53 2018 +0100
+++ b/pkg/octree/tin.go	Tue Nov 27 13:02:28 2018 +0100
@@ -23,6 +23,8 @@
 	"io"
 	"log"
 	"math"
+
+	"gemma.intevation.de/gemma/pkg/models"
 )
 
 var (
@@ -30,8 +32,6 @@
 	errTooLessPoints = errors.New("Too less points")
 )
 
-const wgs84 = 4326
-
 type Tin struct {
 	EPSG      uint32
 	Vertices  []Vertex
@@ -170,7 +170,7 @@
 		min.X, min.Y, max.X, max.Y)
 
 	*t = Tin{
-		EPSG:      wgs84,
+		EPSG:      models.WGS84,
 		Vertices:  vertices,
 		Triangles: triangles,
 		Min:       min,