Mercurial > gemma
changeset 4596:800119befa90 iso-areas
Merged default into iso-areas branch.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 09 Oct 2019 14:47:04 +0200 |
parents | db4e7fecad0d (current diff) 998f4d7d9626 (diff) |
children | bd2999cac246 |
files | |
diffstat | 4 files changed, 105 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/Fairwayprofile.vue Wed Oct 09 13:29:43 2019 +0200 +++ b/client/src/components/fairway/Fairwayprofile.vue Wed Oct 09 14:47:04 2019 +0200 @@ -7,7 +7,9 @@ <span style="background-color: #5995ff; width: 20px; height: 20px;" ></span> - Water + <span class="fix-trans-space" style="display:inline;" v-translate + >Water</span + > </div> <div class="legend"> <span @@ -20,7 +22,9 @@ '; background-clip: padding-box; box-sizing: content-box;' " ></span> - Fairway (LOS 1) + <span class="fix-trans-space" style="display:inline;" v-translate + >Fairway (LOS 1)</span + > </div> <div class="legend"> <span @@ -33,7 +37,9 @@ '; background-clip: padding-box; box-sizing: content-box;' " ></span> - Fairway (LOS 2) + <span class="fix-trans-space" style="display:inline;" v-translate + >Fairway (LOS 2)</span + > </div> <div class="legend"> <span @@ -46,19 +52,25 @@ '; background-clip: padding-box; box-sizing: content-box;' " ></span> - Fairway (LOS 3) + <span class="fix-trans-space" style="display:inline;" v-translate + >Fairway (LOS 3)</span + > </div> <div class="legend"> <span style="width: 14px; height: 14px; background-color: #4a2f06; border: solid 3px black; background-clip: padding-box; box-sizing: content-box;" ></span> - Sediment + <span class="fix-trans-space" style="display:inline;" v-translate + >Sediment</span + > </div> <div class="legend"> <span style="width: 14px; height: 14px; background-color: rgba(74, 47, 6, 0.6); border: solid 3px #943007; background-clip: padding-box; box-sizing: content-box;" ></span> - Sediment (Compare) + <span class="fix-trans-space" style="display:inline;" v-translate + >Sediment (Compare)</span + > </div> <div> <select @@ -349,33 +361,33 @@ this.pdf.doc.setDrawColor("#5995ff"); this.pdf.doc.setFillColor("#5995ff"); this.pdf.doc.circle(x, y, 2, "FD"); - this.pdf.doc.text(x + 3, y + 1, "Water"); + this.pdf.doc.text(x + 3, y + 1, this.$gettext("Water")); this.pdf.doc.setLineDashPattern([0.8], 0); this.pdf.doc.setDrawColor("#0000ff"); this.pdf.doc.setFillColor("#fcfacc"); this.pdf.doc.circle(x, y + 5, 2, "FD"); - this.pdf.doc.text(x + 3, y + 6, "Fairway (LOS 1)"); + this.pdf.doc.text(x + 3, y + 6, this.$gettext("Fairway (LOS 1)")); this.pdf.doc.setLineDashPattern([1.8], 0); this.pdf.doc.setFillColor("#fdfce5"); this.pdf.doc.circle(x, y + 10, 2, "FD"); - this.pdf.doc.text(x + 3, y + 11, "Fairway (LOS 2)"); + this.pdf.doc.text(x + 3, y + 11, this.$gettext("Fairway (LOS 2)")); this.pdf.doc.setLineDashPattern([], 0); this.pdf.doc.setFillColor("#ffffff"); this.pdf.doc.circle(x, y + 15, 2, "FD"); - this.pdf.doc.text(x + 3, y + 16, "Fairway (LOS 3)"); + this.pdf.doc.text(x + 3, y + 16, this.$gettext("Fairway (LOS 3)")); this.pdf.doc.setDrawColor("black"); this.pdf.doc.setFillColor("#4a2e06"); this.pdf.doc.circle(x, y + 20, 2, "FD"); - this.pdf.doc.text(x + 3, y + 21, "Sediment"); + this.pdf.doc.text(x + 3, y + 21, this.$gettext("Sediment")); this.pdf.doc.setDrawColor("#943007"); this.pdf.doc.setFillColor("#928269"); this.pdf.doc.circle(x, y + 25, 2, "FD"); - this.pdf.doc.text(x + 3, y + 26, "Sediment (Compare)"); + this.pdf.doc.text(x + 3, y + 26, this.$gettext("Sediment (Compare)")); }, getPrintLayout(svgHeight, svgWidth) { return { @@ -485,7 +497,7 @@ .attr("x", -dimensions.mainHeight / 2) .attr("fill", "black") .style("text-anchor", "middle") - .text("Depth [m]"); + .text(this.$gettext("Depth [m]")); graph .append("text") .attr("transform", ["rotate(-90)"]) @@ -493,7 +505,7 @@ .attr("x", -dimensions.mainHeight / 2) .attr("fill", "black") .style("text-anchor", "middle") - .text("Waterlevel [m]"); + .text(this.$gettext("Waterlevel [m]")); graph .append("text") .attr("y", 0) @@ -505,7 +517,7 @@ `translate(${dimensions.width / 2} ${dimensions.mainHeight})`, "rotate(0)" ]) - .text("Width [m]"); + .text(this.$gettext("Width [m]")); }, generateScalesAndGraph({ svg, height, width, dimensions, offsetY }) { let xScale = d3
--- a/client/src/components/gauge/HydrologicalConditions.vue Wed Oct 09 13:29:43 2019 +0200 +++ b/client/src/components/gauge/HydrologicalConditions.vue Wed Oct 09 14:47:04 2019 +0200 @@ -18,25 +18,33 @@ <span style="background-color: orange; width: 20px; height: 20px;" ></span> - Q25% + <span class="fix-trans-space" style="display:inline;" v-translate + >Q25%</span + > </div> <div class="legend"> <span style="background-color: black; width: 20px; height: 20px;" ></span> - Median + <span class="fix-trans-space" style="display:inline;" v-translate + >Median</span + > </div> <div class="legend"> <span style="background-color: purple; width: 20px; height: 20px;" ></span> - Q75% + <span class="fix-trans-space" style="display:inline;" v-translate + >Q75%</span + > </div> <div class="legend"> <span style="background-color: lightsteelblue; width: 20px; height: 20px;" ></span> - Long-term Amplitude + <span class="fix-trans-space" style="display:inline;" v-translate + >Long-term Amplitude</span + > </div> <select @change="applyChange" @@ -282,16 +290,20 @@ this.pdf.doc.text(x + padding, y + 1, "" + this.yearCompareD); this.pdf.doc.setFillColor("orange"); this.pdf.doc.circle(x, y + 5, 2, "FD"); - this.pdf.doc.text(x + padding, y + 6, "Q25%"); + this.pdf.doc.text(x + padding, y + 6, this.$gettext("Q25%")); this.pdf.doc.setFillColor("black"); this.pdf.doc.circle(x, y + 10, 2, "FD"); - this.pdf.doc.text(x + 3, y + 11, "Median "); + this.pdf.doc.text(x + 3, y + 11, this.$gettext("Median")); this.pdf.doc.setFillColor("purple"); this.pdf.doc.circle(x, y + 15, 2, "FD"); - this.pdf.doc.text(x + padding, y + 16, "Q75%"); + this.pdf.doc.text(x + padding, y + 16, this.$gettext("Q75%")); this.pdf.doc.setFillColor("lightsteelblue"); this.pdf.doc.circle(x, y + 20, 2, "FD"); - this.pdf.doc.text(x + padding, y + 21, "Long-term Amplitude"); + this.pdf.doc.text( + x + padding, + y + 21, + this.$gettext("Long-term Amplitude") + ); }, getPrintLayout(svgHeight, svgWidth) { return {
--- a/client/src/components/gauge/Waterlevel.vue Wed Oct 09 13:29:43 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Wed Oct 09 14:47:04 2019 +0200 @@ -12,19 +12,25 @@ <span style="background-color: steelblue; width: 20px; height: 20px;" ></span> - Waterlevel + <span class="fix-trans-space" style="display:inline;" v-translate + >Waterlevel</span + > </div> <div class="legend"> <span style="width: 8px; height: 8px; background-color: rgba(70, 130, 180, 0.6); border: solid 7px rgba(70, 130, 180, 0.2); background-clip: padding-box; box-sizing: content-box;" ></span> - Prediction + <span class="fix-trans-space" style="display:inline;" v-translate + >Prediction</span + > </div> <div class="legend"> <span style="background-color: rgba(0, 255, 0, 0.1); width: 20px; height: 20px;" ></span> - Navigable Range + <span class="fix-trans-space" style="display:inline;" v-translate + >Navigable Range</span + > </div> <div> <select @@ -282,16 +288,16 @@ this.pdf.doc.setDrawColor("white"); this.pdf.doc.setFillColor("steelblue"); this.pdf.doc.circle(x, y, 2, "FD"); - this.pdf.doc.text(x + padding, y + 1, "Waterlevel"); + this.pdf.doc.text(x + padding, y + 1, this.$gettext("Waterlevel")); this.pdf.doc.setFillColor("#dae6f0"); this.pdf.doc.circle(x, y + 5, 2, "FD"); this.pdf.doc.setFillColor("#e5ffe5"); this.pdf.doc.circle(x, y + 10, 2, "FD"); - this.pdf.doc.text(x + padding, y + 11, "Navigable Range"); + this.pdf.doc.text(x + padding, y + 11, this.$gettext("Navigable Range")); this.pdf.doc.setDrawColor("#90b4d2"); this.pdf.doc.setFillColor("#90b4d2"); this.pdf.doc.circle(x, y + 5, 0.6, "FD"); - this.pdf.doc.text(x + padding, y + 6, "Prediction"); + this.pdf.doc.text(x + padding, y + 6, this.$gettext("Prediction")); }, getPrintLayout(svgHeight, svgWidth) { return {
--- a/pkg/octree/strtree.go Wed Oct 09 13:29:43 2019 +0200 +++ b/pkg/octree/strtree.go Wed Oct 09 14:47:04 2019 +0200 @@ -18,16 +18,21 @@ "sort" ) -const numEntries = 8 +const STRTreeDefaultEntries = 8 type STRTree struct { - tin *Tin - index []int32 - bboxes []Box2D + Entries int + tin *Tin + index []int32 + bboxes []Box2D } func (s *STRTree) Build(t *Tin) { + if s.Entries == 0 { + s.Entries = STRTreeDefaultEntries + } + s.tin = t all := make([]int32, len(t.Triangles)) @@ -43,6 +48,31 @@ s.index[0] = root } +func (s *STRTree) BuildWithout(t *Tin, remove map[int32]struct{}) { + + if s.Entries == 0 { + s.Entries = STRTreeDefaultEntries + } + + s.tin = t + + all := make([]int32, 0, len(t.Triangles)-len(remove)) + + for i := range all { + idx := int32(i) + if _, found := remove[idx]; !found { + all = append(all, idx) + } + all[i] = int32(i) + } + + s.index = append(s.index, 0) + + root := s.build(all) + + s.index[0] = root +} + func (s *STRTree) Clip(p *Polygon) map[int32]struct{} { removed := make(map[int32]struct{}) @@ -113,12 +143,12 @@ return s.tin.Vertices[ti[0]].X < s.tin.Vertices[tj[0]].X }) - P := int(math.Ceil(float64(len(items)) / float64(numEntries))) + P := int(math.Ceil(float64(len(items)) / float64(s.Entries))) S := int(math.Ceil(math.Sqrt(float64(P)))) - slices := strSplit(items, S) + slices := s.strSplit(items, S) - leaves := strJoin( + leaves := s.strJoin( slices, S, func(i, j int32) bool { ti := s.tin.Triangles[i] @@ -133,7 +163,7 @@ func (s *STRTree) buildNodes(items []int32) int32 { - if len(items) <= numEntries { + if len(items) <= s.Entries { return s.allocNode(items) } @@ -141,12 +171,12 @@ return s.bbox(items[i]).X1 < s.bbox(items[j]).X1 }) - P := int(math.Ceil(float64(len(items)) / float64(numEntries))) + P := int(math.Ceil(float64(len(items)) / float64(s.Entries))) S := int(math.Ceil(math.Sqrt(float64(P)))) - slices := strSplit(items, S) + slices := s.strSplit(items, S) - nodes := strJoin( + nodes := s.strJoin( slices, S, func(i, j int32) bool { return s.bbox(i).Y1 < s.bbox(j).Y1 }, s.allocNode, @@ -162,8 +192,8 @@ return s.bboxes[s.index[idx]] } -func strSplit(items []int32, S int) [][]int32 { - sm := S * numEntries +func (s *STRTree) strSplit(items []int32, S int) [][]int32 { + sm := S * s.Entries slices := make([][]int32, S) for i := range slices { var n int @@ -178,7 +208,7 @@ return slices } -func strJoin( +func (s *STRTree) strJoin( slices [][]int32, S int, less func(int32, int32) bool, alloc func([]int32) int32, @@ -192,8 +222,8 @@ for len(slice) > 0 { var n int - if l := len(slice); l >= numEntries { - n = numEntries + if l := len(slice); l >= s.Entries { + n = s.Entries } else { n = l }