Mercurial > gemma
comparison pkg/imports/sr.go @ 5415:4ad68ab239b7 marking-single-beam
Factored creation of default class breaks in SR import to be reused with markings, too.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 07 Jul 2021 12:01:28 +0200 |
parents | 34bc6041e61e |
children | 31b0e865e7a0 |
comparison
equal
deleted
inserted
replaced
5414:bb402cdfe545 | 5415:4ad68ab239b7 |
---|---|
897 } | 897 } |
898 | 898 |
899 return shapeToPolygon(s) | 899 return shapeToPolygon(s) |
900 } | 900 } |
901 | 901 |
902 func defaultClassBreaks(min, max float64) mesh.ClassBreaks { | |
903 var heights mesh.ClassBreaks | |
904 h := contourStepWidth * math.Ceil(min/contourStepWidth) | |
905 for ; h <= max; h += contourStepWidth { | |
906 heights = append(heights, h) | |
907 } | |
908 return heights | |
909 } | |
910 | |
902 func generateIsos( | 911 func generateIsos( |
903 ctx context.Context, | 912 ctx context.Context, |
904 tx *sql.Tx, | 913 tx *sql.Tx, |
905 feedback Feedback, | 914 feedback Feedback, |
906 tree *mesh.STRTree, | 915 tree *mesh.STRTree, |
915 minZ, maxZ := tree.Min().Z, tree.Max().Z | 924 minZ, maxZ := tree.Min().Z, tree.Max().Z |
916 | 925 |
917 if err != nil { | 926 if err != nil { |
918 feedback.Warn("Loading class breaks failed: %v", err) | 927 feedback.Warn("Loading class breaks failed: %v", err) |
919 feedback.Info("Using default class breaks") | 928 feedback.Info("Using default class breaks") |
920 heights = nil | 929 heights = defaultClassBreaks(minZ, maxZ) |
921 h := contourStepWidth * math.Ceil(minZ/contourStepWidth) | |
922 for ; h <= maxZ; h += contourStepWidth { | |
923 heights = append(heights, h) | |
924 } | |
925 } else { | 930 } else { |
926 heights = heights.ExtrapolateClassBreaks(minZ, maxZ) | 931 heights = heights.ExtrapolateClassBreaks(minZ, maxZ) |
927 } | 932 } |
928 | 933 |
929 /* | 934 /* |