Mercurial > gemma
diff pkg/imports/sr.go @ 5403:85f19e924a43 marking-single-beam
Adjusted the import model to be able to handle marking single beam scans.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 06 Jul 2021 01:20:44 +0200 |
parents | 12a5e128255f |
children | 850f5847d18a |
line wrap: on
line diff
--- a/pkg/imports/sr.go Tue Jul 06 00:30:39 2021 +0200 +++ b/pkg/imports/sr.go Tue Jul 06 01:20:44 2021 +0200 @@ -58,8 +58,8 @@ // DepthReference if given overides the DepthReference value // from the meta.json. DepthReference *string `json:"depth-reference,omitempty"` - // SingleBeam indicates that the sounding is a single beam scan. - 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 // multiplied by -1. NegateZ *bool `json:"negate-z,omitempty"` @@ -240,15 +240,15 @@ return strings.Join(descs, "|"), nil } -func (sr *SoundingResult) singleBeam() bool { - return sr.SingleBeam != nil && *sr.SingleBeam +func (sr *SoundingResult) surveyType() models.SurveyType { + if sr.SurveyType != nil { + return *sr.SurveyType + } + return models.SurveyTypeMultiBeam } func (sr *SoundingResult) surtype() string { - if sr.singleBeam() { - return "single" - } - return "multi" + return string(sr.surveyType()) } func (sr *SoundingResult) negateZ() bool { @@ -419,11 +419,7 @@ zpgException bool, ) (interface{}, error) { - if sr.singleBeam() { - feedback.Info("Processing as single beam scan.") - } else { - feedback.Info("Processing as multi beam scan.") - } + feedback.Info("Processing as %s beam scan.", sr.surtype()) feedback.Info("Reproject XYZ data.") @@ -532,7 +528,12 @@ removed = str.Clip(&clippingPolygon) } - if sr.singleBeam() { + switch sr.surveyType() { + case models.SurveyTypeMarking: + // TODO: Implement me! + return nil, errors.New("Not implemented, yet!") + + case models.SurveyTypeSingleBeam: origDensity := float64(len(xyz)) / polygonArea @@ -712,7 +713,7 @@ return sr.Bottleneck != nil && sr.Date != nil && sr.DepthReference != nil && - sr.SingleBeam != nil && + sr.SurveyType != nil && sr.NegateZ != nil } @@ -729,7 +730,7 @@ Bottleneck: *sr.Bottleneck, EPSG: epsg, DepthReference: *sr.DepthReference, - SingleBeam: sr.singleBeam(), + SurveyType: sr.surveyType(), NegateZ: sr.negateZ(), }, nil } @@ -756,8 +757,8 @@ if sr.DepthReference != nil { m.DepthReference = *sr.DepthReference } - if sr.SingleBeam != nil { - m.SingleBeam = *sr.SingleBeam + if sr.SurveyType != nil { + m.SurveyType = *sr.SurveyType } if sr.NegateZ != nil { m.NegateZ = *sr.NegateZ