# HG changeset patch # User Sascha L. Teichmann # Date 1625739715 -7200 # Node ID 24156a964eaac04c30484db3ff49668b9fe92ce1 # Parent ad8e3fffb868fbfdf947dd65b7465c4b30f70fb5 [WIP] Add support for scan marking points in geoserver. diff -r ad8e3fffb868 -r 24156a964eaa pkg/controllers/system.go --- a/pkg/controllers/system.go Thu Jul 08 10:53:26 2021 +0200 +++ b/pkg/controllers/system.go Thu Jul 08 12:21:55 2021 +0200 @@ -194,9 +194,13 @@ return nil, err } + styles := strings.Split(which, ",") + doBoth := func(req *http.Request) { log.Printf("info: Trigger re-calculation of %s.", which) - geoserver.ReconfigureStyle(which) + for _, style := range styles { + geoserver.ReconfigureStyle(style) + } recalc(req) } @@ -228,7 +232,11 @@ // Only the color changed -> no expensive recalc needed. if colorChanged { log.Println("info: Only colors changed.") - return func(*http.Request) { geoserver.ReconfigureStyle(which) }, nil + return func(*http.Request) { + for _, style := range styles { + geoserver.ReconfigureStyle(style) + } + }, nil } return nil, nil @@ -239,7 +247,7 @@ func(old sql.NullString, curr string) (func(*http.Request), error) { return reconfigureClassBreaks( old, curr, - "sounding_results_areas_geoserver", + "sounding_results_areas_geoserver,sounding_results_marking_points_geoserver", func(req *http.Request) { if s, ok := auth.GetSession(req); ok { triggerSoundingResultsContoursRecalc(s.User, curr) diff -r ad8e3fffb868 -r 24156a964eaa pkg/geoserver/templates.go --- a/pkg/geoserver/templates.go Thu Jul 08 10:53:26 2021 +0200 +++ b/pkg/geoserver/templates.go Thu Jul 08 12:21:55 2021 +0200 @@ -38,6 +38,9 @@ "sounding_results_areas_geoserver", templateContourLinesFunc("morphology_classbreaks")) RegisterStylePreprocessor( + "sounding_results_marking_points_geoserver", + templateContourLinesFunc("morphology_classbreaks")) + RegisterStylePreprocessor( "sounding_differences", templateContourLinesFunc("morphology_classbreaks_compare")) RegisterStylePreprocessor( diff -r ad8e3fffb868 -r 24156a964eaa schema/default_sysconfig.sql --- a/schema/default_sysconfig.sql Thu Jul 08 10:53:26 2021 +0200 +++ b/schema/default_sysconfig.sql Thu Jul 08 12:21:55 2021 +0200 @@ -218,6 +218,16 @@ FROM waterway.sounding_results_iso_areas ia JOIN waterway.sounding_results sr ON sr.id = ia.sounding_result_id $$), + ('waterway', 'sounding_results_marking_points_geoserver', 4326, NULL, $$ + SELECT bottleneck_id, + to_char(date_info, 'YYYY-MM-DD') AS date_info, + height, + points, + surtyp, + zpg_exception + FROM waterway.sounding_results_marking_points mp + JOIN waterway.sounding_results sr ON sr.id = mp.sounding_result_id + $$), ('waterway', 'bottleneck_overview', 4326, NULL, $$ SELECT objnam AS name, diff -r ad8e3fffb868 -r 24156a964eaa schema/updates/1461/01.config.sql --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/updates/1461/01.config.sql Thu Jul 08 12:21:55 2021 +0200 @@ -0,0 +1,15 @@ +-- GeoServer SQL views without time support +INSERT INTO sys_admin.published_services ( + schema, name, srid, key_column, view_def +) VALUES + ('waterway', 'sounding_results_marking_points_geoserver', 4326, NULL, $$ + SELECT bottleneck_id, + to_char(date_info, 'YYYY-MM-DD') AS date_info, + height, + points, + surtyp, + zpg_exception + FROM waterway.sounding_results_marking_points mp + JOIN waterway.sounding_results sr ON sr.id = mp.sounding_result_id + $$); + diff -r ad8e3fffb868 -r 24156a964eaa schema/version.sql --- a/schema/version.sql Thu Jul 08 10:53:26 2021 +0200 +++ b/schema/version.sql Thu Jul 08 12:21:55 2021 +0200 @@ -1,1 +1,1 @@ -INSERT INTO gemma_schema_version(version) VALUES (1460); +INSERT INTO gemma_schema_version(version) VALUES (1461); diff -r ad8e3fffb868 -r 24156a964eaa style-templates/sounding_results_marking_points_geoserver.sld-template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/style-templates/sounding_results_marking_points_geoserver.sld-template Thu Jul 08 12:21:55 2021 +0200 @@ -0,0 +1,275 @@ + + + + sounding_results_areas + + sounding_results_areas + + area_colours + + + FeatureTypeStyle defining colour classes for height attribute + + + {{ range . -}} + + {{- if not .HasLow }} + ≤ {{ printf "%g" .High }} + + + height + {{ printf "%f" .High }} + + + {{- else if not .HasHigh }} + > {{ printf "%g" .Low }} + + + height + {{ printf "%f" .Low }} + + + {{- else }} + ≤ {{ printf "%g" .High }} + + + + height + {{ printf "%f" .Low }} + + + height + {{ printf "%f" .High }} + + + + {{- end }} + 34e3 + + + + circle + + {{ .Color }} + + + 6 + + + + + {{- if not .HasLow }} + ≤ {{ printf "%g" .High }} + + + height + {{ printf "%f" .High }} + + + {{- else if not .HasHigh }} + > {{ printf "%g" .Low }} + + + height + {{ printf "%f" .Low }} + + + {{- else }} + ≤ {{ printf "%g" .High }} + + + + height + {{ printf "%f" .Low }} + + + height + {{ printf "%f" .High }} + + + + {{- end }} + 34e3 + + + + circle + + {{ .Color }} + + + 6 + + + + height + {{ end }} + + + area_labels + + + FeatureTypeStyle for labels at colour areas + + + + 3e2 + + + 50 + + + + 0.000000 + height + + {{ range . -}} + {{ if .HasHigh -}} + + {{- printf "%f" .High -}} + + {{- printf "%g" .High -}} + + {{ end -}} + {{ end }} + + + + 80 + bold + Sans Serif + + + + 5 + + + + #000000 + + + + + 5e2 + 3e2 + + + 80 + + + + 0.000000 + height + + {{ range . -}} + {{ if .HasHigh -}} + + {{- printf "%f" .High -}} + + {{- printf "%g" .High -}} + + {{ end -}} + {{ end }} + + + + 40 + bold + Sans Serif + + + + 5 + + + + #000000 + + + + + 7e2 + 5e2 + + + 50 + + + + 0.000000 + height + + {{ range . -}} + {{ if .HasHigh -}} + + {{- printf "%f" .High -}} + + {{- printf "%g" .High -}} + + {{ end -}} + {{ end }} + + + + 20 + bold + Sans Serif + + + + 5 + + + + #000000 + + + + + 6e3 + 7e2 + + + 50 + + + + 0.000000 + height + + {{ range . -}} + {{ if .HasHigh -}} + + {{- printf "%f" .High -}} + + {{- printf "%g" .High -}} + + {{ end -}} + {{ end }} + + + + 12 + bold + Sans Serif + + + + 5 + + + + #000000 + + + + + + +