diff pkg/imports/sr.go @ 5407:850f5847d18a marking-single-beam

Re-establish compat with old single-beam interface.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Jul 2021 15:26:20 +0200
parents 85f19e924a43
children 8b6018ed3ffd
line wrap: on
line diff
--- a/pkg/imports/sr.go	Tue Jul 06 14:26:02 2021 +0200
+++ b/pkg/imports/sr.go	Tue Jul 06 15:26:20 2021 +0200
@@ -58,6 +58,8 @@
 	// DepthReference if given overides the DepthReference value
 	// from the meta.json.
 	DepthReference *string `json:"depth-reference,omitempty"`
+	// SingleBeam is kept in for compat.
+	SingleBeam *bool `json:"single-beam,omitempty"`
 	// SurveyType indicates that the sounding is a single beam scan.
 	SurveyType *models.SurveyType `json:"survey-type,omitempty"`
 	// NegateZ indicated that the Z values of thy XYZ input should be
@@ -237,6 +239,9 @@
 	if sr.NegateZ != nil && *sr.NegateZ {
 		descs = append(descs, "negateZ")
 	}
+	if sr.surveyType != nil {
+		descs = append(descs, string(*sr.SurveyType))
+	}
 	return strings.Join(descs, "|"), nil
 }
 
@@ -757,6 +762,16 @@
 	if sr.DepthReference != nil {
 		m.DepthReference = *sr.DepthReference
 	}
+
+	// Kept in for compat
+	if sr.SingleBeam != nil {
+		if *sr.SingleBeam {
+			m.SurveyType = models.SurveyTypeSingleBeam
+		} else {
+			m.SurveyType = models.SurveyTypeSingleBeam
+		}
+	}
+
 	if sr.SurveyType != nil {
 		m.SurveyType = *sr.SurveyType
 	}