comparison pkg/controllers/system.go @ 5423:24156a964eaa marking-single-beam

[WIP] Add support for scan marking points in geoserver.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 08 Jul 2021 12:21:55 +0200
parents 44b032028e48
children 5f47eeea988d
comparison
equal deleted inserted replaced
5422:ad8e3fffb868 5423:24156a964eaa
192 currCVs, err := models.ParseColorValues(curr) 192 currCVs, err := models.ParseColorValues(curr)
193 if err != nil { 193 if err != nil {
194 return nil, err 194 return nil, err
195 } 195 }
196 196
197 styles := strings.Split(which, ",")
198
197 doBoth := func(req *http.Request) { 199 doBoth := func(req *http.Request) {
198 log.Printf("info: Trigger re-calculation of %s.", which) 200 log.Printf("info: Trigger re-calculation of %s.", which)
199 geoserver.ReconfigureStyle(which) 201 for _, style := range styles {
202 geoserver.ReconfigureStyle(style)
203 }
200 recalc(req) 204 recalc(req)
201 } 205 }
202 206
203 if !old.Valid { 207 if !old.Valid {
204 return doBoth, nil 208 return doBoth, nil
226 } 230 }
227 231
228 // Only the color changed -> no expensive recalc needed. 232 // Only the color changed -> no expensive recalc needed.
229 if colorChanged { 233 if colorChanged {
230 log.Println("info: Only colors changed.") 234 log.Println("info: Only colors changed.")
231 return func(*http.Request) { geoserver.ReconfigureStyle(which) }, nil 235 return func(*http.Request) {
236 for _, style := range styles {
237 geoserver.ReconfigureStyle(style)
238 }
239 }, nil
232 } 240 }
233 241
234 return nil, nil 242 return nil, nil
235 } 243 }
236 244
237 func init() { 245 func init() {
238 registerReconfigureFunc("morphology_classbreaks", 246 registerReconfigureFunc("morphology_classbreaks",
239 func(old sql.NullString, curr string) (func(*http.Request), error) { 247 func(old sql.NullString, curr string) (func(*http.Request), error) {
240 return reconfigureClassBreaks( 248 return reconfigureClassBreaks(
241 old, curr, 249 old, curr,
242 "sounding_results_areas_geoserver", 250 "sounding_results_areas_geoserver,sounding_results_marking_points_geoserver",
243 func(req *http.Request) { 251 func(req *http.Request) {
244 if s, ok := auth.GetSession(req); ok { 252 if s, ok := auth.GetSession(req); ok {
245 triggerSoundingResultsContoursRecalc(s.User, curr) 253 triggerSoundingResultsContoursRecalc(s.User, curr)
246 } 254 }
247 }) 255 })