comparison 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
comparison
equal deleted inserted replaced
5406:6d73836bc2fb 5407:850f5847d18a
56 // Defaults to WGS84. 56 // Defaults to WGS84.
57 EPSG *uint `json:"epsg,omitempty"` 57 EPSG *uint `json:"epsg,omitempty"`
58 // DepthReference if given overides the DepthReference value 58 // DepthReference if given overides the DepthReference value
59 // from the meta.json. 59 // from the meta.json.
60 DepthReference *string `json:"depth-reference,omitempty"` 60 DepthReference *string `json:"depth-reference,omitempty"`
61 // SingleBeam is kept in for compat.
62 SingleBeam *bool `json:"single-beam,omitempty"`
61 // SurveyType indicates that the sounding is a single beam scan. 63 // SurveyType indicates that the sounding is a single beam scan.
62 SurveyType *models.SurveyType `json:"survey-type,omitempty"` 64 SurveyType *models.SurveyType `json:"survey-type,omitempty"`
63 // NegateZ indicated that the Z values of thy XYZ input should be 65 // NegateZ indicated that the Z values of thy XYZ input should be
64 // multiplied by -1. 66 // multiplied by -1.
65 NegateZ *bool `json:"negate-z,omitempty"` 67 NegateZ *bool `json:"negate-z,omitempty"`
235 descs = append(descs, (*sr).Date.Format(common.DateFormat)) 237 descs = append(descs, (*sr).Date.Format(common.DateFormat))
236 } 238 }
237 if sr.NegateZ != nil && *sr.NegateZ { 239 if sr.NegateZ != nil && *sr.NegateZ {
238 descs = append(descs, "negateZ") 240 descs = append(descs, "negateZ")
239 } 241 }
242 if sr.surveyType != nil {
243 descs = append(descs, string(*sr.SurveyType))
244 }
240 return strings.Join(descs, "|"), nil 245 return strings.Join(descs, "|"), nil
241 } 246 }
242 247
243 func (sr *SoundingResult) surveyType() models.SurveyType { 248 func (sr *SoundingResult) surveyType() models.SurveyType {
244 if sr.SurveyType != nil { 249 if sr.SurveyType != nil {
755 m.EPSG = *sr.EPSG 760 m.EPSG = *sr.EPSG
756 } 761 }
757 if sr.DepthReference != nil { 762 if sr.DepthReference != nil {
758 m.DepthReference = *sr.DepthReference 763 m.DepthReference = *sr.DepthReference
759 } 764 }
765
766 // Kept in for compat
767 if sr.SingleBeam != nil {
768 if *sr.SingleBeam {
769 m.SurveyType = models.SurveyTypeSingleBeam
770 } else {
771 m.SurveyType = models.SurveyTypeSingleBeam
772 }
773 }
774
760 if sr.SurveyType != nil { 775 if sr.SurveyType != nil {
761 m.SurveyType = *sr.SurveyType 776 m.SurveyType = *sr.SurveyType
762 } 777 }
763 if sr.NegateZ != nil { 778 if sr.NegateZ != nil {
764 m.NegateZ = *sr.NegateZ 779 m.NegateZ = *sr.NegateZ