Mercurial > gemma
comparison pkg/controllers/cross.go @ 4827:f4abfd0ee8ad remove-octree-debris
Renamed octree package to mesh as there is no octree any more.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 05 Nov 2019 14:30:22 +0100 |
parents | 4bbfe3dd2ab5 |
children | 5f47eeea988d |
comparison
equal
deleted
inserted
replaced
4826:ec5afada70ec | 4827:f4abfd0ee8ad |
---|---|
19 "fmt" | 19 "fmt" |
20 "log" | 20 "log" |
21 "net/http" | 21 "net/http" |
22 "time" | 22 "time" |
23 | 23 |
24 "gemma.intevation.de/gemma/pkg/mesh" | |
24 "gemma.intevation.de/gemma/pkg/models" | 25 "gemma.intevation.de/gemma/pkg/models" |
25 "gemma.intevation.de/gemma/pkg/octree" | |
26 | 26 |
27 mw "gemma.intevation.de/gemma/pkg/middleware" | 27 mw "gemma.intevation.de/gemma/pkg/middleware" |
28 ) | 28 ) |
29 | 29 |
30 func reproject( | 30 func reproject( |
50 SELECT ST_AsBinary( | 50 SELECT ST_AsBinary( |
51 ST_Transform(ST_GeomFromWKB($2, $1::integer), 4326))` | 51 ST_Transform(ST_GeomFromWKB($2, $1::integer), 4326))` |
52 | 52 |
53 func projectBack( | 53 func projectBack( |
54 ctx context.Context, | 54 ctx context.Context, |
55 line octree.MultiLineStringZ, | 55 line mesh.MultiLineStringZ, |
56 epsg uint32, | 56 epsg uint32, |
57 conn *sql.Conn, | 57 conn *sql.Conn, |
58 ) (models.GeoJSONMultiLineCoordinatesZ, error) { | 58 ) (models.GeoJSONMultiLineCoordinatesZ, error) { |
59 | 59 |
60 var mls models.GeoJSONMultiLineCoordinatesZ | 60 var mls models.GeoJSONMultiLineCoordinatesZ |
72 | 72 |
73 start := time.Now() | 73 start := time.Now() |
74 ctx := req.Context() | 74 ctx := req.Context() |
75 conn := mw.JSONConn(req) | 75 conn := mw.JSONConn(req) |
76 | 76 |
77 tree, err := octree.FromCache( | 77 tree, err := mesh.FromCache( |
78 ctx, conn, | 78 ctx, conn, |
79 csi.Properties.Bottleneck, csi.Properties.Date.Time) | 79 csi.Properties.Bottleneck, csi.Properties.Date.Time) |
80 | 80 |
81 log.Printf("info: loading mesh took %s\n", time.Since(start)) | 81 log.Printf("info: loading mesh took %s\n", time.Since(start)) |
82 if err != nil { | 82 if err != nil { |
115 return | 115 return |
116 } | 116 } |
117 | 117 |
118 start = time.Now() | 118 start = time.Now() |
119 | 119 |
120 var segments octree.MultiLineStringZ | 120 var segments mesh.MultiLineStringZ |
121 | 121 |
122 for i := 0; i < len(coords)-1; i++ { | 122 for i := 0; i < len(coords)-1; i++ { |
123 c1 := &coords[i] | 123 c1 := &coords[i] |
124 c2 := &coords[i+1] | 124 c2 := &coords[i+1] |
125 | 125 |
126 verticalLine := octree.NewVerticalLine(c1.Lat, c1.Lon, c2.Lat, c2.Lon) | 126 verticalLine := mesh.NewVerticalLine(c1.Lat, c1.Lon, c2.Lat, c2.Lon) |
127 | 127 |
128 var line octree.MultiLineStringZ | 128 var line mesh.MultiLineStringZ |
129 tree.Vertical(c1.Lat, c1.Lon, c2.Lat, c2.Lon, func(t *octree.Triangle) { | 129 tree.Vertical(c1.Lat, c1.Lon, c2.Lat, c2.Lon, func(t *mesh.Triangle) { |
130 if ls := verticalLine.Intersection(t); len(ls) > 0 { | 130 if ls := verticalLine.Intersection(t); len(ls) > 0 { |
131 line = append(line, ls) | 131 line = append(line, ls) |
132 } | 132 } |
133 }) | 133 }) |
134 | 134 |