changeset 1496:3bf1f0de0763

Un-export point, line string and polygon types in import package as these are only used locally.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 04 Dec 2018 18:27:35 +0100
parents d26e3e1fcff1
children b41ad15cc55f
files pkg/imports/polygon.go pkg/imports/sr.go
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/polygon.go	Tue Dec 04 18:20:31 2018 +0100
+++ b/pkg/imports/polygon.go	Tue Dec 04 18:27:35 2018 +0100
@@ -23,12 +23,12 @@
 )
 
 type (
-	Point struct {
+	point struct {
 		X float64
 		Y float64
 	}
-	LineString []Point
-	Polygon    []LineString
+	lineString []point
+	polygon    []lineString
 )
 
 const (
@@ -36,7 +36,7 @@
 	wkbPolygon uint32 = 3
 )
 
-func shapeToPolygon(s shp.Shape) (Polygon, error) {
+func shapeToPolygon(s shp.Shape) (polygon, error) {
 	switch p := s.(type) {
 	case *shp.Polygon:
 		return toPolygon(p.NumParts, p.Parts, p.Points), nil
@@ -48,22 +48,22 @@
 	return nil, fmt.Errorf("Unsupported shape type %T", s)
 }
 
-func toPolygon(numParts int32, parts []int32, points []shp.Point) Polygon {
-	out := make(Polygon, numParts)
+func toPolygon(numParts int32, parts []int32, points []shp.Point) polygon {
+	out := make(polygon, numParts)
 	pos := 0
 	for i := range out {
 		ps := parts[i]
-		line := make(LineString, ps)
+		line := make(lineString, ps)
 		for j := int32(0); j < ps; j, pos = j+1, pos+1 {
 			p := &points[pos]
-			line[j] = Point{p.X, p.Y}
+			line[j] = point{p.X, p.Y}
 		}
 		out[i] = line
 	}
 	return out
 }
 
-func (p Polygon) AsWBK() []byte {
+func (p polygon) asWKB() []byte {
 	if p == nil {
 		return nil
 	}
--- a/pkg/imports/sr.go	Tue Dec 04 18:20:31 2018 +0100
+++ b/pkg/imports/sr.go	Tue Dec 04 18:27:35 2018 +0100
@@ -234,7 +234,7 @@
 		m.Date.Time,
 		m.DepthReference,
 		xyz.AsWKB(),
-		polygon.AsWBK(),
+		polygon.asWKB(),
 		m.EPSG,
 	).Scan(&id, &lat, &lon, &epsg)
 	xyz, polygon = nil, nil // not need from now on.
@@ -415,7 +415,7 @@
 	return loadXYZReader(r, feedback)
 }
 
-func loadBoundary(z *zip.ReadCloser) (Polygon, error) {
+func loadBoundary(z *zip.ReadCloser) (polygon, error) {
 	shpF := common.FindInZIP(z, ".shp")
 	if shpF == nil {
 		return nil, nil