# HG changeset patch # User dnt_bjoernsen # Date 1570714142 -7200 # Node ID 1d4262a68f1f7e641c3c363efb6de413de54df75 # Parent cedcee24a21a030ed7c4a6e6eaabd737f6c39583 #12 Minuend/Subtrahend + MergeConflict #19 CollisionCalculation diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/artifacts/sinfo.xml --- a/artifacts/doc/conf/artifacts/sinfo.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/artifacts/sinfo.xml Thu Oct 10 15:29:02 2019 +0200 @@ -69,6 +69,10 @@ + + + + @@ -126,10 +130,14 @@ - + + + + + - - + + @@ -189,7 +197,9 @@ + + @@ -197,8 +207,8 @@ - - + + @@ -208,8 +218,8 @@ - - + + @@ -228,9 +238,6 @@ - - - @@ -246,7 +253,7 @@ - + @@ -470,6 +477,9 @@ + + + diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml --- a/artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/generators/longitudinal-diagram-defaults.xml Thu Oct 10 15:29:02 2019 +0200 @@ -52,6 +52,8 @@ + + diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/meta-data.xml --- a/artifacts/doc/conf/meta-data.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/meta-data.xml Thu Oct 10 15:29:02 2019 +0200 @@ -2,9 +2,9 @@ - + - + @@ -14,14 +14,14 @@ WHERE lower(name) LIKE lower(${river}) - + - + @@ -39,120 +39,120 @@ Longitudinal sections - + - - + + - - + + - + - + - - - + + + - - + + - - + + - + - + Discharge curves - - + + - - + + - - - + + + - - + + - + - + Cross sections - - - + + + Duration curve - + Reference curve - + Maps - + - + - + - + - + - + - + - + - + - + - + - + @@ -166,179 +166,179 @@ Inline datacage panels - + - + - - + + - - - - - + + + + + - - - - - - + + + + + + Longitudinal sections - + - + - + - + - + - + - + - + - + - + Discharge curves - + - + - + - + - + - + Cross sections - - - - - - - - - + + + + + + + + + Duration curve - + Reference curve - - - - - - + + + + + + Maps - + - + S-INFO - + - + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + @@ -361,7 +361,7 @@ - + @@ -374,140 +374,140 @@ Inline datacage panels - - + + - + - + - + - + Longitudinal sections - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + Discharge curves - + - + - + - + - + Time series - + - + Cross sections - + Duration curve - + Reference curve - + Maps - + - + @@ -528,12 +528,12 @@ - - - - - - + + + + + + @@ -551,12 +551,12 @@ - - - - - - + + + + + + @@ -574,12 +574,12 @@ - - - - - - + + + + + + @@ -595,14 +595,14 @@ - + - - - - - - + + + + + + @@ -611,9 +611,9 @@ - - - + + + @@ -625,12 +625,12 @@ - - - - - - + + + + + + @@ -649,12 +649,12 @@ - - - - - - + + + + + + @@ -666,7 +666,7 @@ - + @@ -679,12 +679,12 @@ - - - - - - + + + + + + @@ -697,13 +697,13 @@ - + - + @@ -714,19 +714,19 @@ - - + + - + - - - + + --> + + + - - + + @@ -748,12 +748,12 @@ - - - - - - + + + + + + @@ -776,12 +776,12 @@ - - - - - - + + + + + + @@ -807,22 +807,22 @@ - - - - - - + + + + + + - - - - - - + + + + + + @@ -840,12 +840,12 @@ - - - - - - + + + + + + @@ -861,12 +861,12 @@ - - - - - - + + + + + + @@ -878,12 +878,12 @@ - + - + @@ -894,12 +894,12 @@ - - - - - - + + + + + + @@ -910,20 +910,20 @@ - + - + - - - - - - + + + + + + @@ -946,20 +946,20 @@ + ' an KM ', $deffrom)" /> + $deffrom, ' bis KM ', $defto)" /> - - - - - - + + + + + + @@ -969,9 +969,9 @@ - + - + @@ -980,21 +980,21 @@ - + + $deffrom, ' bis KM ', $defto)" /> - - - - - - - + + + + + + + @@ -1011,20 +1011,20 @@ - + + $deffrom, ' bis KM ', $defto)" /> - - - - - - + + + + + + @@ -1041,12 +1041,12 @@ - - - - - - + + + + + + @@ -1062,12 +1062,12 @@ - - - - - - + + + + + + @@ -1086,12 +1086,12 @@ - - - - - - + + + + + + @@ -1109,12 +1109,12 @@ - - - - - - + + + + + + @@ -1133,12 +1133,12 @@ - - - - - - + + + + + + @@ -1157,12 +1157,12 @@ - - - - - - + + + + + + @@ -1189,12 +1189,12 @@ - - - - - - + + + + + + @@ -1212,12 +1212,12 @@ - - - - - - + + + + + + @@ -1231,23 +1231,23 @@ - - - - + + + + - + - + - - + + @@ -1256,17 +1256,17 @@ + dc:date-format('dd.MM.yyyy', $stop_time))" /> + $gauge_name, ' ', $validity)}" /> + number(substring-before($year_range, ';')))" /> + number(substring-after($year_range, ';')))" /> - + @@ -1286,7 +1286,7 @@ - + @@ -1300,7 +1300,7 @@ - + @@ -1312,15 +1312,15 @@ - - + + - + - - + + @@ -1374,7 +1374,7 @@ AND csl.km BETWEEN ${fromkm} AND ${tokm} - + @@ -1393,7 +1393,7 @@ AND he.km BETWEEN ${fromkm} AND ${tokm} - + @@ -1403,9 +1403,9 @@ - + - + @@ -1420,7 +1420,7 @@ - + @@ -1431,13 +1431,13 @@ - + - + @@ -1449,7 +1449,7 @@ - + @@ -1460,7 +1460,7 @@ - + @@ -1471,7 +1471,7 @@ - + @@ -1482,7 +1482,7 @@ - + @@ -1493,7 +1493,7 @@ - + @@ -1504,20 +1504,20 @@ - - + + - + - + @@ -1529,7 +1529,7 @@ - + @@ -1540,20 +1540,20 @@ - - + + - + - + @@ -1565,7 +1565,7 @@ - + @@ -1576,14 +1576,14 @@ - - + + - + @@ -1595,7 +1595,7 @@ - + @@ -1606,19 +1606,19 @@ - + - + - + @@ -1630,7 +1630,7 @@ - + @@ -1641,19 +1641,19 @@ - + - + - + @@ -1667,7 +1667,7 @@ - + @@ -1678,7 +1678,7 @@ - + @@ -1697,7 +1697,7 @@ - + @@ -1708,14 +1708,14 @@ - - + + - + @@ -1724,84 +1724,84 @@ - - + + - - - - - - - + + + + + + + - - + + - - + + - + - + - + - - - - - - - + + + + + + + - - + + - - - - - - + + + + + + - - + + - + - + - + - + - - + + - - + + @@ -1810,32 +1810,32 @@ SINFO - - - - - - + + + + + + WINFO/DIFF/FIX - - - - - + + + + + MINFO - - - - - + + + + + UINFO - + BUNDU - + @@ -1864,7 +1864,7 @@ + ' - ', dc:date-format('yyyy', $eyear))}" ids="{$pid};{$description}" /> @@ -1891,7 +1891,7 @@ - + @@ -1900,11 +1900,11 @@ - + - + @@ -1913,24 +1913,24 @@ dc:date-format('yyyy', $sqstop))"> - + - + + dc:date-format('yyyy', $endyear))" /> + dc:get('info'))" /> - + @@ -1943,41 +1943,41 @@ - + - + - + - + - + - + - + - + @@ -2054,20 +2054,20 @@ - + - + SELECT id AS anno_id, name AS anno_description FROM annotation_types - + @@ -2083,26 +2083,26 @@ WHERE name LIKE 'Quelle %' OR name LIKE 'Senke %' - + - + - + - + - + @@ -2137,8 +2137,8 @@ - - + + @@ -2147,7 +2147,7 @@ - + @@ -2155,7 +2155,7 @@ - + @@ -2166,11 +2166,11 @@ - + - - + + @@ -2180,8 +2180,8 @@ - - + + @@ -2189,13 +2189,13 @@ - + - + - + @@ -2205,7 +2205,7 @@ - + @@ -2213,11 +2213,11 @@ - + - + @@ -2229,12 +2229,12 @@ - + - + @@ -2247,12 +2247,12 @@ - + - + @@ -2264,9 +2264,9 @@ - + - + @@ -2274,16 +2274,16 @@ - + - + - + @@ -2291,9 +2291,9 @@ - + - + @@ -2352,7 +2352,7 @@ + Q = {$q} m3/s" target_out="{$out}" /> @@ -2379,7 +2379,7 @@ AND station BETWEEN ${fromkm} AND ${tokm} - + @@ -2407,7 +2407,7 @@ WHERE morphologic_width_id = ${width_id} - + @@ -2448,8 +2448,8 @@ - + $stop_time))" /> + @@ -2463,36 +2463,36 @@ - - - + + + - - + + - + - - + + - + - - - - + + + + - - + + - + @@ -2518,7 +2518,7 @@ AND NOT((${tokm} < r.a) or (${fromkm} > r.b)) - + @@ -2528,14 +2528,14 @@ - + - + @@ -2543,7 +2543,7 @@ - + @@ -2551,7 +2551,7 @@ - + @@ -2560,7 +2560,7 @@ - + @@ -2568,7 +2568,7 @@ - + @@ -2586,7 +2586,7 @@ - + @@ -2604,7 +2604,7 @@ - + @@ -2621,7 +2621,7 @@ AND kind = 2 - + @@ -2633,7 +2633,7 @@ AND kind = 2 - + @@ -2652,7 +2652,7 @@ - + @@ -2674,7 +2674,7 @@ - + @@ -2692,7 +2692,7 @@ - + @@ -2708,7 +2708,7 @@ AND b.sectie is NULL - + @@ -2738,7 +2738,7 @@ - + @@ -2752,7 +2752,7 @@ - + @@ -2776,7 +2776,7 @@ - + @@ -2791,7 +2791,7 @@ - + @@ -2820,7 +2820,7 @@ ${source} - + @@ -2847,14 +2847,14 @@ - + - + @@ -2872,14 +2872,14 @@ - + - + @@ -2887,7 +2887,7 @@ - + @@ -2895,7 +2895,7 @@ - + @@ -2926,7 +2926,7 @@ AND fed_state_id = ${fed_id} ORDER BY name - + @@ -2943,7 +2943,7 @@ ORDER BY name - + @@ -2970,7 +2970,7 @@ AND fed_state_id = ${fed_id} ORDER BY name - + @@ -2986,7 +2986,7 @@ AND fed_state_id IS NULL ORDER BY name - + @@ -3001,14 +3001,14 @@ - + - + @@ -3016,7 +3016,7 @@ - + @@ -3024,7 +3024,7 @@ - + @@ -3055,7 +3055,7 @@ AND fed_state_id = ${fed_id} ORDER BY name - + @@ -3072,7 +3072,7 @@ ORDER BY name - + @@ -3099,7 +3099,7 @@ AND fed_state_id = ${fed_id} ORDER BY name - + @@ -3115,7 +3115,7 @@ AND fed_state_id IS NULL ORDER BY name - + @@ -3133,7 +3133,7 @@ - + @@ -3142,10 +3142,10 @@ - - - - + + + + @@ -3164,13 +3164,13 @@ - + - + @@ -3185,7 +3185,7 @@ SELECT DISTINCT 1 FROM river_axes_km WHERE river_id = ${river_id} - + @@ -3199,7 +3199,7 @@ GROUP BY name - + @@ -3219,14 +3219,14 @@ - + - + @@ -3251,13 +3251,13 @@ - + - + @@ -3275,7 +3275,7 @@ - + @@ -3287,14 +3287,14 @@ - - - + + + - + @@ -3305,14 +3305,14 @@ - + - - + + - - + + - + - + - + - + - + @@ -3371,7 +3371,7 @@ NOT((${tokm} < wr.a) or (${fromkm} > wr.b)) ORDER BY wst_column_position - + @@ -3408,7 +3408,8 @@ JOIN facets f ON f.out_id = o.id WHERE u.gid = CAST(${user-id} AS UUID) AND ma.gid <> CAST(${artifact-id} AS uuid) - AND f.name NOT LIKE '%empty.facet%' + AND f.name NOT LIKE + '%empty.facet%' AND EXISTS ( SELECT id @@ -3419,7 +3420,7 @@ - + @@ -3432,7 +3433,7 @@ - + @@ -3440,32 +3441,40 @@ + dc:get('ld_locations')))" /> + dc:get('ld_locations')))" /> + dc:get('ld_locations'), dc:get('ld_from'))" /> + dc:get('ld_locations'), dc:get('ld_to'))" /> Inverting KM filter. + dc:get('ld_locations'), dc:get('ld_to'))" /> + dc:get('ld_locations'), dc:get('ld_from'))" /> - + - @@ -3473,12 +3482,12 @@ - - - - - - + + + + + + @@ -3490,20 +3499,26 @@ + ( $facet_name = 'sinfo_facet_flow_depth_min' or + $facet_name = 'sinfo_facet_flow_depth_bedheight_min' or + $facet_name = 'sinfo_facet_flow_depth_bedheight_max' or + $facet_name = 'sinfo_facet_flow_depth_waterlevel' or + $facet_name = 'sinfo_facet_flow_depth_discharge' or + $facet_name = 'sinfo_facet_flow_depth_min.filtered' or + $facet_name = 'sinfo_facet_flow_depth_max' or + $facet_name = 'sinfo_facet_flow_depth_max.filtered' )"> - - - - - - + + + + + + @@ -3528,12 +3543,12 @@ - - - - - - + + + + + + @@ -3548,6 +3563,11 @@ expr="$a_state = 'state.sinfo.transport_bodies_heights' and ( $facet_name = 'sinfo_facet_tkh' or $facet_name = 'sinfo_facet_flow_depth' or $facet_name = 'sinfo_facet_flow_depth.filtered' or + $facet_name = 'sinfo_facet_flow_depth_discharge' or + $facet_name = 'sinfo_facet_flow_depth_waterlevel' or + $facet_name = 'sinfo_facet_flow_depth_bedheight' or + $facet_name = 'sinfo_facet_flow_depth_bedheight_min' or + $facet_name = 'sinfo_facet_flow_depth_bedheight_max' or $facet_name = 'sinfo_facet_velocity' or $facet_name = 'sinfo_facet_velocity.filtered' or $facet_name = 'sinfo_facet_tau' or $facet_name = 'sinfo_facet_tau.filtered' or $facet_name = 'sinfo_facet_d50' or $facet_name = 'sinfo_facet_d50.filtered' )"> @@ -3557,12 +3577,12 @@ - - - - - - + + + + + + @@ -3581,12 +3601,12 @@ - - - - - - + + + + + + @@ -3607,12 +3627,12 @@ - - - - - - + + + + + + @@ -3640,7 +3660,7 @@ - + @@ -3649,15 +3669,15 @@ - - + + - - + + @@ -3685,7 +3705,7 @@ - + @@ -3696,15 +3716,15 @@ - - + + - - + + @@ -3728,14 +3748,14 @@ ORDER BY s.id - + - + @@ -3761,7 +3781,7 @@ - + @@ -3790,7 +3810,7 @@ - + @@ -3814,7 +3834,7 @@ - + @@ -3832,12 +3852,12 @@ - - - - - - + + + + + + @@ -3853,18 +3873,18 @@ - - + + - - - - - - + + + + + + - + @@ -3917,12 +3937,12 @@ - - - - - - + + + + + + diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/themes.xml --- a/artifacts/doc/conf/themes.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/themes.xml Thu Oct 10 15:29:02 2019 +0200 @@ -410,6 +410,11 @@ + + + + + @@ -440,7 +445,9 @@ + + diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/themes/default.xml --- a/artifacts/doc/conf/themes/default.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/themes/default.xml Thu Oct 10 15:29:02 2019 +0200 @@ -2633,6 +2633,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/themes/legend.xml --- a/artifacts/doc/conf/themes/legend.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/themes/legend.xml Thu Oct 10 15:29:02 2019 +0200 @@ -23,6 +23,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r cedcee24a21a -r 1d4262a68f1f artifacts/doc/conf/themes/second.xml --- a/artifacts/doc/conf/themes/second.xml Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/doc/conf/themes/second.xml Thu Oct 10 15:29:02 2019 +0200 @@ -2,36 +2,36 @@ - + - - - + + + - + - - - + + + - + - - + + @@ -39,126 +39,126 @@ - - + + - - + + - - - + + + - - - - + + + + - - + + - - + + - - - + + + - - - + + + - + - - + + - - + + - + - - + + - + - + - - - - - + + + + + - - - - + + + + - - + + - + - - - - + + + + - + @@ -166,14 +166,14 @@ - - - + + + - - - + + + @@ -181,1301 +181,1301 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - - - - - + + + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - - - + + + + + @@ -1483,53 +1483,53 @@ - - - - + + + + - - + + - - - + + + - - - - - - - + + + + + + + - + - + - + - - - - - + + + + + @@ -1537,38 +1537,38 @@ - - - + + + - - + + - - + + - - - - + + + + - - + + - - - + + + @@ -1576,33 +1576,33 @@ - - - - + + + + - - - + + + - + - + - + - + @@ -1610,320 +1610,320 @@ - - + + - - + + - - - + + + - - - + + + - + - - - - - + + + + + - + - - - + + + - + - + - + - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1931,44 +1931,44 @@ - - + + - + - + - - + + - + - - - + + + - + @@ -1976,93 +1976,93 @@ - - - + + + - - + + - - + + - - + + - + - + - - - + + + - + - + - + - + - + - + - - - + + + @@ -2070,59 +2070,59 @@ - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -2154,18 +2154,18 @@ - - + + - - - - - - - - + + + + + + + + @@ -2173,21 +2173,21 @@ - - - - + + + + - - - + + + - + @@ -2197,921 +2197,961 @@ - - + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - - - + + + - - + + - + - - - - - - + + + + - - - - + - + + + + - + - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - - - - + + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - + - + - + - + - + - + - - - - - - - - - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractProcessor.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -229,4 +229,10 @@ final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), description, description, result.getLabel()); return new ResultFacet(resultIndex, facetId, facetFlowDepthFilteredDescription, axisLabel, ComputeType.ADVANCE, id, hash); } + + protected static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int resultIndex, final String axisLabel, final String facetId, final String description, final String resultLabel) { + final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), description, description, resultLabel); + return new ResultFacet(resultIndex, facetId, facetFlowDepthFilteredDescription, axisLabel, ComputeType.ADVANCE, id, hash); + } } \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/model/QWDDateRange.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/QWDDateRange.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/QWDDateRange.java Thu Oct 10 15:29:02 2019 +0200 @@ -8,25 +8,22 @@ package org.dive4elements.river.artifacts.model; - import java.io.Serializable; import org.dive4elements.river.artifacts.model.fixings.QWD; -public class QWDDateRange -implements Serializable -{ +public class QWDDateRange implements Serializable { - public QWD qwd; public DateRange dateRange; + public QWD qwd; - public QWDDateRange(QWD qwd, DateRange dr) { + public QWDDateRange(final QWD qwd, final DateRange dr) { this.qwd = qwd; this.dateRange = dr; } public QWD getQWD() { - return qwd; + return this.qwd; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java Thu Oct 10 15:29:02 2019 +0200 @@ -14,20 +14,19 @@ import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.access.BedHeightAccess; import org.dive4elements.river.artifacts.model.BlackboardDataFacet; import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.model.BedHeight; import org.dive4elements.river.model.BedHeightValue; -public class BedHeightFacet -extends BlackboardDataFacet -implements FacetTypes { +public class BedHeightFacet extends BlackboardDataFacet implements FacetTypes { + private static final long serialVersionUID = 1L; private static final Logger log = Logger.getLogger(BedHeightFacet.class); - public BedHeightFacet(String name, String description) { + public BedHeightFacet(final String name, final String description) { this.name = name; this.description = description; this.index = 0; @@ -38,53 +37,43 @@ /** * Returns the data this facet requires. * - * @param artifact the owner artifact. - * @param context the CallContext (ignored). + * @param artifact + * the owner artifact. + * @param context + * the CallContext (ignored). * * @return the data. */ @Override - public Object getData(Artifact artifact, CallContext context) { - BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); - BedHeight single = BedHeight.getBedHeightById(access.getHeightId()); - List bedheightValues = - BedHeightValue.getBedHeightValues( - single, - access.getFrom(true), - access.getTo(true)); - double[][] values = new double[2][bedheightValues.size()]; + public Object getData(final Artifact artifact, final CallContext context) { + final BedHeightAccess access = new BedHeightAccess((D4EArtifact) artifact); + final BedHeight single = BedHeight.getBedHeightById(access.getHeightId()); + final List bedheightValues = BedHeightValue.getBedHeightValues(single, access.getFrom(true), access.getTo(true)); + final double[][] values = new double[2][bedheightValues.size()]; int i = 0; - for (BedHeightValue bedheightValue : bedheightValues) { + for (final BedHeightValue bedheightValue : bedheightValues) { values[0][i] = bedheightValue.getStation(); values[1][i] = bedheightValue.getHeight(); i++; } - this.addMetaData(Resources.getMsg( - context.getMeta(), - "meta.bedheight.cur.elevation"), - single.getCurElevationModel().getName()); + this.addMetaData(Resources.getMsg(context.getMeta(), "meta.bedheight.cur.elevation"), single.getCurElevationModel().getName()); if (single.getOldElevationModel() != null) { - this.addMetaData(Resources.getMsg( - context.getMeta(), - "meta.bedheight.old.elevation"), - single.getOldElevationModel().getName()); + this.addMetaData(Resources.getMsg(context.getMeta(), "meta.bedheight.old.elevation"), single.getOldElevationModel().getName()); } - this.addMetaData(Resources.getMsg( - context.getMeta(), - "meta.bedheight.river.elevation"), - access.getRiver().getWstUnit().getName()); + this.addMetaData(Resources.getMsg(context.getMeta(), "meta.bedheight.river.elevation"), access.getRiver().getWstUnit().getName()); return values; } /** * Create a deep copy of this Facet. + * * @return a deep copy. */ @Override public BedHeightFacet deepCopy() { - BedHeightFacet copy = new BedHeightFacet(name, description); + final BedHeightFacet copy = new BedHeightFacet(this.name, this.description); copy.set(this); return copy; } diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/SINFOArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/SINFOArtifact.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/SINFOArtifact.java Thu Oct 10 15:29:02 2019 +0200 @@ -17,7 +17,9 @@ import org.dive4elements.river.artifacts.sinfo.common.D50Processor; import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDevelopmentPerYearProcessor; import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDevelopmentProcessor; +import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDischargeProcessor; import org.dive4elements.river.artifacts.sinfo.common.FlowDepthProcessor; +import org.dive4elements.river.artifacts.sinfo.common.FlowDepthWaterlevelProcessor; import org.dive4elements.river.artifacts.sinfo.common.TauProcessor; import org.dive4elements.river.artifacts.sinfo.common.VelocityProcessor; @@ -73,10 +75,24 @@ return Boolean.FALSE; if (FlowDepthDevelopmentProcessor.FACET_WATERLEVEL_DIFFERENCE_FILTERED.equals(name)) return Boolean.FALSE; + if (FlowDepthDevelopmentProcessor.FACET_WATERLEVEL_DIFFERENCE_RAW.equals(name)) + return Boolean.FALSE; if (FlowDepthDevelopmentProcessor.FACET_BEDHEIGHT_DIFFERENCE_FILTERED.equals(name)) return Boolean.FALSE; + if (FlowDepthDevelopmentProcessor.FACET_BEDHEIGHT_DIFFERENCE_RAW.equals(name)) + return Boolean.FALSE; } + if (FlowDepthDischargeProcessor.FACET_FLOW_DEPTH_DISCHARGE.equals(name)) + return Boolean.FALSE; + if (FlowDepthWaterlevelProcessor.FACET_FLOW_DEPTH_WATER_LEVEL.equals(name)) + return Boolean.FALSE; + if (FlowDepthWaterlevelProcessor.FACET_FLOW_DEPTH_BEDHEIGHT.equals(name)) + return Boolean.FALSE; + if (FlowDepthWaterlevelProcessor.FACET_FLOW_DEPTH_BEDHEIGHT_MIN.equals(name)) + return Boolean.FALSE; + if (FlowDepthWaterlevelProcessor.FACET_FLOW_DEPTH_BEDHEIGHT_MAX.equals(name)) + return Boolean.FALSE; if (FlowDepthProcessor.FACET_FLOW_DEPTH_RAW.equals(name)) return Boolean.FALSE; if (FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_RAW.equals(name)) diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcProcessor.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -69,15 +69,15 @@ } public static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, - final int resultIndex, final int year, final int themeCount) { + final int resultIndex, final int themeCount, final int rangeIndex) { // REMARK: we are using themeCount as facet index, because we get several lines (with the same facet name) for the same // result index; however name and index are used on client side as unique id. final CollisionCalcOverviewResult ccoResult = (CollisionCalcOverviewResult) result; - final String years = CollisionCalculation.yearsToString(ccoResult.getIsEpochs(), ccoResult.getYears().get(themeCount)); + final String years = CollisionCalculation.yearsToString(ccoResult.getIsEpochs(), ccoResult.getYears().get(rangeIndex)); final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, years); - return new CollisionCalcFacet(themeCount, resultIndex, years, COLLISION_FACETS[themeCount % 3], facetDescription, I18N_AXIS_LABEL, - ComputeType.ADVANCE, hash, id); + return new CollisionCalcFacet(themeCount, resultIndex, years, COLLISION_FACETS[themeCount % 3], facetDescription, I18N_AXIS_LABEL, ComputeType.ADVANCE, + hash, id); } } \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalculation.java Thu Oct 10 15:29:02 2019 +0200 @@ -1,7 +1,7 @@ -/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -48,12 +49,6 @@ private final CallContext context; - private CollisionAccess access; - private River river; - private List years; - private Calculation problems; - private int qfinderProblemCount; - public CollisionCalculation(final CallContext context) { this.context = context; } @@ -62,50 +57,71 @@ final String user = CalculationUtils.findArtifactUser(this.context, sinfo); + final int qfinderProblemCount = 0; + // access input data - this.access = new CollisionAccess(sinfo); - this.river = this.access.getRiver(); - final RiverInfo riverInfo = new RiverInfo(this.river); - final DoubleRange calcRange = this.access.getRange(); + final CollisionAccess access = new CollisionAccess(sinfo); + final River river = access.getRiver(); + final RiverInfo riverInfo = new RiverInfo(river); + + final DoubleRange calcRange = access.getRange(); // calculate results for each year or epoch - this.problems = new Calculation(); - this.qfinderProblemCount = 0; + final Calculation problems = new Calculation(); + final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name()); - final CollisionCalculationResults results = new CollisionCalculationResults(calcModeLabel, user, riverInfo, calcRange, this.access.getYearsHeader()); + final CollisionCalculationResults results = new CollisionCalculationResults(calcModeLabel, user, riverInfo, calcRange, access.getYearsHeader()); final Collection overViewRows = new ArrayList<>(); - this.years = new ArrayList<>(); + final List years = new ArrayList<>(); final NavigableSet detailYears = new TreeSet<>(); - if (this.access.getYears() != null) { - for (final int year : this.access.getYears()) { - calculateOverview(overViewRows, year, year, false); - this.years.add(new DateRange(DateUtil.getStartDateFromYear(year), DateUtil.getEndDateFromYear(year))); + final List singleYearResults = new ArrayList<>(); + if (access.getYears() != null) { + for (final int year : access.getYears()) { + calculateOverview(overViewRows, river, access.getLowerKm(), access.getUpperKm(), year, year, false); + years.add(new DateRange(DateUtil.getStartDateFromYear(year), DateUtil.getEndDateFromYear(year))); detailYears.add(Integer.valueOf(year)); } } else { - for (final DateRange dr : this.access.getEpochs()) { - calculateOverview(overViewRows, dr.getFromYear(), dr.getToYear(), true); - this.years.add(dr); + for (final DateRange dr : access.getEpochs()) { + calculateOverview(overViewRows, river, access.getLowerKm(), access.getUpperKm(), dr.getFromYear(), dr.getToYear(), true); + years.add(dr); detailYearsAdd(detailYears, dr); } + + for (final Integer year : detailYears) { + + final Collection yearRows = new ArrayList<>(); + calculateOverview(yearRows, river, access.getLowerKm(), access.getUpperKm(), year, year, false); + + if (!yearRows.isEmpty()) { + final DateRange yearRange = new DateRange(DateUtil.getStartDateFromYear(year), DateUtil.getEndDateFromYear(year)); + final CollisionCalcOverviewResult yearResult = new CollisionCalcOverviewResult(Integer.toString(year), false, + Collections.singleton(yearRange), yearRows); + singleYearResults.add(yearResult); + } + } } - final CollisionCalcOverviewResult overviewResult = new CollisionCalcOverviewResult(this.access.getYearsHeader(), (this.access.getYears() == null), - this.years, overViewRows); - results.addResult(overviewResult, this.problems); + final CollisionCalcOverviewResult overviewResult = new CollisionCalcOverviewResult(access.getYearsHeader(), (access.getYears() == null), years, + overViewRows); + results.addResult(overviewResult, problems); + + /* add the single year from epochs, after the epochs, so they will be exported at the end of the table etc. */ + for (final CollisionCalcOverviewResult result : singleYearResults) + results.addResult(result, problems); // calculate secondary results for each year final Map> qFinders = new HashMap<>(); final Map zoneFinders = new HashMap<>(); final Collection detailsRows = new ArrayList<>(); for (final Integer year : detailYears) - calculateDetails(detailsRows, year, qFinders, zoneFinders); + calculateDetails(detailsRows, river, access, year, qFinders, zoneFinders, problems, years, qfinderProblemCount); final CollisionCalcDetailResult detailResult = new CollisionCalcDetailResult("Details", detailsRows); - results.addResult(detailResult, this.problems); + results.addResult(detailResult, problems); - return new CalculationResult(results, this.problems); + return new CalculationResult(results, problems); } /** @@ -120,9 +136,9 @@ * Calculates the collision counts for a km range of a river and a year or year range (epoch), * and adds them to a ResultRow collection */ - private void calculateOverview(final Collection rows, final int fromYear, final int toYear, final boolean isEpoch) { - for (final CollisionAggregateValue aggregate : CollisionAggregateValue.getValuesByKm(this.river, this.access.getLowerKm(), this.access.getUpperKm(), - fromYear, toYear)) { + private void calculateOverview(final Collection rows, final River river, final double fromKm, final double toKm, final int fromYear, + final int toYear, final boolean isEpoch) { + for (final CollisionAggregateValue aggregate : CollisionAggregateValue.getValuesByKm(river, fromKm, toKm, fromYear, toYear)) { rows.add(ResultRow.create().putValue(GeneralResultType.station, aggregate.getStation()) .putValue(SInfoResultType.years, yearsToString(isEpoch, fromYear, toYear)).putValue(SInfoResultType.collisionCount, aggregate.getCount())); } @@ -144,16 +160,23 @@ /** * Calculates the collision details for a km range of a river and a year, and adds them to a ResultRow collection + * + * @param qfinderProblemCount */ - private void calculateDetails(final Collection rows, final int year, final Map> qFinders, - final Map zoneFinders) { + private void calculateDetails(final Collection rows, final River river, final CollisionAccess access, final int year, + final Map> qFinders, final Map zoneFinders, + final Calculation problems, final List years, final int qfinderProblemCount) { - for (final CollisionValue collision : CollisionValue.getValues(this.river, this.access.getLowerKm(), this.access.getUpperKm(), - DateUtil.getStartDateFromYear(year), DateUtil.getEndDateFromYear(year))) { + final double fromKm = access.getLowerKm(); + final double toKm = access.getUpperKm(); + + for (final CollisionValue collision : CollisionValue.getValues(river, fromKm, toKm, DateUtil.getStartDateFromYear(year), + DateUtil.getEndDateFromYear(year))) { final String gaugeName = collision.getGaugeName(); - final double q = getQ(qFinders, gaugeName, collision.getGaugeW().doubleValue(), collision.getEventDate()); + final double q = getQ(qFinders, gaugeName, collision.getGaugeW().doubleValue(), collision.getEventDate(), river, problems, years, + qfinderProblemCount); final double qOut = Double.isInfinite(q) ? Double.NaN : q; - final String zone = getZone(zoneFinders, gaugeName, q); + final String zone = getZone(zoneFinders, gaugeName, q, river, problems); rows.add(ResultRow.create().putValue(GeneralResultType.station, collision.getStation()) .putValue(GeneralResultType.dateShort, collision.getEventDate()).putValue(SInfoResultType.collisionGaugeW, collision.getGaugeW()) .putValue(GeneralResultType.gaugeLabel, gaugeName).putValue(SInfoResultType.dischargeLong, qOut) @@ -163,18 +186,24 @@ /** * Gets the discharge of a gauge and a W + * + * @param years + * @param qfinderProblemCount */ - private double getQ(final Map> qFinders, final String gaugeName, final double w, final Date when) { + private double getQ(final Map> qFinders, final String gaugeName, final double w, final Date when, + final River river, final Calculation problems, final List years, int qfinderProblemCount) { // Find the gauge and load its discharge table, if not already in the map final String gnKey = gaugeName.toLowerCase(); if (!qFinders.containsKey(gnKey)) - addQFinders(qFinders, gaugeName); + addQFinders(qFinders, gaugeName, problems, river, years); + + // Interpolate W. // Interpolate W. final GaugeDischargeValuesFinder qFinder = getQFinder(qFinders.get(gnKey), when); if (qFinder == null) { - this.qfinderProblemCount++; - if (this.qfinderProblemCount == 1) - this.problems.addProblem("gauge_discharge_table.missing", gaugeName); + qfinderProblemCount++; + if (qfinderProblemCount == 1) + problems.addProblem("gauge_discharge_table.missing", gaugeName); return Double.NaN; } return qFinder.getDischarge(w); @@ -183,19 +212,18 @@ /** * Add the discharge finders for a gauge and the active time period */ - private void addQFinders(final Map> qFinders, final String gaugeName) { + private void addQFinders(final Map> qFinders, final String gaugeName, final Calculation problems, + final River river, final List years) { final String gnKey = gaugeName.toLowerCase(); - final Gauge gauge = this.river.determineGaugeByName(gaugeName); + final Gauge gauge = river.determineGaugeByName(gaugeName); if (gauge == null) { qFinders.put(gnKey, new TreeMap()); return; } - final List qtables = DischargeTable.fetchHistoricalDischargeTables(gauge, this.years.get(0).getFrom(), - this.years.get(this.years.size() - 1).getTo()); + final List qtables = DischargeTable.fetchHistoricalDischargeTables(gauge, years.get(0).getFrom(), years.get(years.size() - 1).getTo()); qFinders.put(gnKey, new TreeMap()); for (final DischargeTable qtable : qtables) - qFinders.get(gnKey).put(qtable.getTimeInterval().getStartTime(), - GaugeDischargeValuesFinder.loadValues(qtable, this.river, gaugeName, this.problems)); + qFinders.get(gnKey).put(qtable.getTimeInterval().getStartTime(), GaugeDischargeValuesFinder.loadValues(qtable, river, gaugeName, problems)); } /** @@ -215,11 +243,12 @@ /** * Gets the main value zone name of a gauge and a Q */ - private String getZone(final Map zoneFinders, final String gaugeName, final double q) { + private String getZone(final Map zoneFinders, final String gaugeName, final double q, final River river, + final Calculation problems) { // Find the gauge and load its main value list, if not already in the map final String gnKey = gaugeName.toLowerCase(); if (!zoneFinders.containsKey(gnKey)) - zoneFinders.put(gnKey, GaugeMainValueFinder.loadValues(MainValueTypeKey.Q, this.river, gaugeName, this.problems, "GLQ")); + zoneFinders.put(gnKey, GaugeMainValueFinder.loadValues(MainValueTypeKey.Q, river, gaugeName, problems, "GLQ")); // Build the zone name if (zoneFinders.get(gnKey) == null) return ""; diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java Thu Oct 10 15:29:02 2019 +0200 @@ -78,12 +78,18 @@ /* add themes for chart, for each result */ final List resultList = results.getResults(); + int themeCount = 0; + for (int index = 0; index < resultList.size(); index++) { if (resultList.get(index) instanceof CollisionCalcOverviewResult) { final CollisionCalcOverviewResult result = (CollisionCalcOverviewResult) resultList.get(index); - for (final DateRange dr : result.getYears()) - facets.add(CollisionCalcProcessor.createFacet(context, hash, this.id, result, index, dr.getFromYear(), themeCount++)); + + final List yearRanges = result.getYears(); + for (int rangeIndex = 0; rangeIndex < yearRanges.size(); rangeIndex++) { + final DateRange dr = yearRanges.get(rangeIndex); + facets.add(CollisionCalcProcessor.createFacet(context, hash, this.id, result, index, themeCount++, rangeIndex)); + } } } diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractTkhCalculationResult.java Thu Oct 10 15:29:02 2019 +0200 @@ -112,4 +112,8 @@ public final WstInfo getWst() { return this.wst; // TODO: Meta-Data export hier hin } + + public final String getWstLabel() { + return this.wst.getLabel(); + } } \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentPerYearProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentPerYearProcessor.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentPerYearProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -65,7 +65,7 @@ public static Facet createFlowDepthDevelopmentFilteredFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, final int index) { return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_YAXIS_LABEL, - FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED, FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED_DESCRIPTION); + FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED, FACET_FLOW_DEPTH_DEVELOPMENT_PER_YEAR_FILTERED_DESCRIPTION, result.getLabel()); } public static Facet createFlowDepthDevelopmentRawFacet(final CallContext context, final String hash, final String id, diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -42,12 +42,16 @@ private static final String FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION = "sinfo.facet.flow_depth_development.raw.description"; public static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED = "sinfo_facet_waterlevel_difference.filtered"; + public static final String FACET_WATERLEVEL_DIFFERENCE_RAW = "sinfo_facet_waterlevel_difference"; private static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.waterlevel_difference.filtered.description"; + private static final String FACET_WATERLEVEL_DIFFERENCE_RAW_DESCRIPTION = "sinfo.facet.waterlevel_difference.raw.description"; // TODO public static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED = "sinfo_facet_bedheight_difference.filtered"; + public static final String FACET_BEDHEIGHT_DIFFERENCE_RAW = "sinfo_facet_bedheight_difference"; private static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.bedheight_difference.filtered.description"; + private static final String FACET_BEDHEIGHT_DIFFERENCE_RAW_DESCRIPTION = "sinfo.facet.bedheight_difference.raw.description"; private static final Set HANDLED_FACET_TYPES = new HashSet<>(); @@ -55,7 +59,9 @@ HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED); HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_RAW); HANDLED_FACET_TYPES.add(FACET_WATERLEVEL_DIFFERENCE_FILTERED); + HANDLED_FACET_TYPES.add(FACET_WATERLEVEL_DIFFERENCE_RAW); HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT_DIFFERENCE_FILTERED); + HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT_DIFFERENCE_RAW); } public FlowDepthDevelopmentProcessor() { @@ -71,9 +77,13 @@ if (FACET_WATERLEVEL_DIFFERENCE_FILTERED.contentEquals(facetName)) return SInfoResultType.waterlevelDifference; + if (FACET_WATERLEVEL_DIFFERENCE_RAW.contentEquals(facetName)) + return SInfoResultType.waterlevelDifference; if (FACET_BEDHEIGHT_DIFFERENCE_FILTERED.contentEquals(facetName)) return SInfoResultType.bedHeightDifference; + if (FACET_BEDHEIGHT_DIFFERENCE_RAW.contentEquals(facetName)) + return SInfoResultType.bedHeightDifference; final String error = String.format("Unknown facet name: %s", facetName); throw new UnsupportedOperationException(error); @@ -87,25 +97,45 @@ public static Facet createFlowDepthDevelopmentRawFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, final int index) { - return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, - FACET_FLOW_DEPTH_DEVELOPMENT_RAW, FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION); + return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, FACET_FLOW_DEPTH_DEVELOPMENT_RAW, + FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION); } - public static Facet createWaterlevelDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, - final int index) { - final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, - FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); - return new ResultFacet(index, FACET_WATERLEVEL_DIFFERENCE_FILTERED, facetFlowDepthTkhFilteredDescription, - SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); + public static Facet createWaterlevelDifferenceFacetRaw(final CallContext context, final String hash, final String id, + final AbstractCalculationResult result, final int index) { + return createWaterlevelDifferenceFacet(context, hash, id, result, index, FACET_WATERLEVEL_DIFFERENCE_RAW, FACET_WATERLEVEL_DIFFERENCE_RAW_DESCRIPTION); } - public static Facet createBedHeightDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + public static Facet createBedHeightDifferenceFacetRaw(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, final int index) { + return createBedHeightDifferenceFacet(context, hash, id, result, index, FACET_BEDHEIGHT_DIFFERENCE_RAW, FACET_BEDHEIGHT_DIFFERENCE_RAW_DESCRIPTION); + } - final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, - FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); - return new ResultFacet(index, FACET_BEDHEIGHT_DIFFERENCE_FILTERED, facetFlowDepthFilteredDescription, - SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); + public static Facet createWaterlevelDifferenceFacetFiltered(final CallContext context, final String hash, final String id, + final AbstractCalculationResult result, final int index) { + return createWaterlevelDifferenceFacet(context, hash, id, result, index, FACET_WATERLEVEL_DIFFERENCE_FILTERED, + FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION); + } + + public static Facet createBedHeightDifferenceFacetFiltered(final CallContext context, final String hash, final String id, + final AbstractCalculationResult result, final int index) { + return createBedHeightDifferenceFacet(context, hash, id, result, index, FACET_BEDHEIGHT_DIFFERENCE_FILTERED, + FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION); + } + + private static Facet createWaterlevelDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String facetName, final String description) { + final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), description, description, result.getLabel()); + return new ResultFacet(index, facetName, facetFlowDepthTkhFilteredDescription, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, + hash); + } + + private static Facet createBedHeightDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String facetName, final String description) { + + final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), description, description, result.getLabel()); + return new ResultFacet(index, facetName, facetFlowDepthFilteredDescription, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, + hash); } @Override diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDischargeProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDischargeProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -0,0 +1,65 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.sinfo.common; + +import java.util.HashSet; +import java.util.Set; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; +import org.dive4elements.river.artifacts.common.AbstractProcessor; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.themes.ThemeDocument; + +public final class FlowDepthDischargeProcessor extends AbstractProcessor { + + /* discharge */ + public static final String FACET_FLOW_DEPTH_DISCHARGE = "sinfo_facet_flow_depth_discharge"; + public static final String FACET_FLOW_DEPTH_DISCHARGE_Y_AXIS_LABEL = "common.export.csv.header.q"; + public static final String FACET_FLOW_DEPTH_DISCHARGE_DESCRIPTION = "facet.flow_depth.discharge"; + + private static final Set HANDLED_FACET_TYPES = new HashSet<>(); + + static { + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DISCHARGE); + } + + public FlowDepthDischargeProcessor() { + super(FACET_FLOW_DEPTH_DISCHARGE_Y_AXIS_LABEL, HANDLED_FACET_TYPES); + } + + protected SInfoResultType doGetType(final String facetName) { + + if (FACET_FLOW_DEPTH_DISCHARGE.contentEquals(facetName)) + return SInfoResultType.discharge; + + final String error = String.format("Unknown facet name: %s", facetName); + throw new UnsupportedOperationException(error); + } + + public static Facet createFlowDepthDischargeFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String wstLabel) { + final CallMeta meta = context.getMeta(); + final String yAxisLabel = Resources.getMsg(meta, FACET_FLOW_DEPTH_DISCHARGE_Y_AXIS_LABEL, FACET_FLOW_DEPTH_DISCHARGE_Y_AXIS_LABEL); + return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, FACET_FLOW_DEPTH_DISCHARGE, FACET_FLOW_DEPTH_DISCHARGE_DESCRIPTION, + wstLabel); + } + + @Override + protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + + return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE); + } +} \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -16,8 +16,10 @@ import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; import org.dive4elements.river.artifacts.common.AbstractCalculationResult; import org.dive4elements.river.artifacts.common.AbstractProcessor; +import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.exports.DiagramGenerator; import org.dive4elements.river.themes.ThemeDocument; @@ -32,6 +34,7 @@ // changes depending on zoom state /* flow depth */ + public static final String FACET_FLOW_DEPTH_FILTERED = "sinfo_facet_flow_depth.filtered"; private static final String FACET_FLOW_DEPTH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.filtered.description"; @@ -144,14 +147,16 @@ public static Facet createFlowDepthFilteredFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, final int index) { - return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_FILTERED, - FACET_FLOW_DEPTH_FILTERED_DESCRIPTION); + final CallMeta meta = context.getMeta(); + final String yAxisLabel = Resources.getMsg(meta, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL); + return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, FACET_FLOW_DEPTH_FILTERED, FACET_FLOW_DEPTH_FILTERED_DESCRIPTION); } public static Facet createFlowDepthRawFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, final int index) { - return AbstractProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, FACET_FLOW_DEPTH_RAW, - FACET_FLOW_DEPTH_RAW_DESCRIPTION); + final CallMeta meta = context.getMeta(); + final String yAxisLabel = Resources.getMsg(meta, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL); + return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, FACET_FLOW_DEPTH_RAW, FACET_FLOW_DEPTH_RAW_DESCRIPTION); } public static Facet createFlowDepthTkhFilteredFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthWaterlevelProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthWaterlevelProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -0,0 +1,106 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.sinfo.common; + +import java.util.HashSet; +import java.util.Set; + +import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.river.artifacts.common.AbstractCalculationResult; +import org.dive4elements.river.artifacts.common.AbstractProcessor; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.exports.DiagramGenerator; +import org.dive4elements.river.themes.ThemeDocument; + +public final class FlowDepthWaterlevelProcessor extends AbstractProcessor { + + /* waterlevel */ + public static final String FACET_FLOW_DEPTH_BEDHEIGHT_MIN = "sinfo_facet_flow_depth_bedheight_min"; + public static final String FACET_FLOW_DEPTH_BEDHEIGHT_MAX = "sinfo_facet_flow_depth_bedheight_max"; + public static final String FACET_FLOW_DEPTH_BEDHEIGHT = "sinfo_facet_flow_depth_bedheight"; + public static final String FACET_FLOW_DEPTH_WATER_LEVEL = "sinfo_facet_flow_depth_waterlevel"; + public static final String FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL = "chart.longitudinal.section.yaxis.label"; + public static final String FACET_FLOW_DEPTH_WATER_LEVEL_DESCRIPTION = "facet.flow_depth.waterlevel"; + public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION = "facet.flow_depth.bedheight"; + public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MIN = "facet.flow_depth.bedheight.min"; + public static final String FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MAX = "facet.flow_depth.bedheight.max"; + + private static final Set HANDLED_FACET_TYPES = new HashSet<>(); + + static { + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_WATER_LEVEL); + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT); + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT_MIN); + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_BEDHEIGHT_MAX); + } + + public FlowDepthWaterlevelProcessor() { + super(FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, HANDLED_FACET_TYPES); + } + + protected SInfoResultType doGetType(final String facetName) { + + if (FACET_FLOW_DEPTH_WATER_LEVEL.contentEquals(facetName)) + return SInfoResultType.waterlevel; + if (FACET_FLOW_DEPTH_BEDHEIGHT.contentEquals(facetName)) + return SInfoResultType.meanBedHeight; + if (FACET_FLOW_DEPTH_BEDHEIGHT_MIN.contentEquals(facetName)) + return SInfoResultType.minBedHeight; + if (FACET_FLOW_DEPTH_BEDHEIGHT_MAX.contentEquals(facetName)) + return SInfoResultType.maxBedHeight; + + final String error = String.format("Unknown facet name: %s", facetName); + throw new UnsupportedOperationException(error); + } + + private static Facet createFlowDepthBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String unit, final String facetLabel, final String facetName, final String description) { + final CallMeta meta = context.getMeta(); + final String yAxisLabel = Resources.getMsg(meta, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, unit); + + return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, facetName, description, facetLabel); + } + + public static Facet createFlowDepthMeanBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String unit, final String facetLabel) { + return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit, facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT, + FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION); + } + + public static Facet createFlowDepthMinBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String unit, final String facetLabel) { + return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit, facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT_MIN, + FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MIN); + } + + public static Facet createFlowDepthMaxBedheightFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String unit, final String facetLabel) { + return FlowDepthWaterlevelProcessor.createFlowDepthBedheightFacet(context, hash, id, result, index, unit, facetLabel, FACET_FLOW_DEPTH_BEDHEIGHT_MAX, + FACET_FLOW_DEPTH_BEDHEIGHT_DESCRIPTION_MAX); + } + + public static Facet createFlowDepthWaterlevelFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, + final int index, final String unit, final String wstLabel) { + final CallMeta meta = context.getMeta(); + final String yAxisLabel = Resources.getMsg(meta, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, FACET_FLOW_DEPTH_WATER_LEVEL_Y_AXIS_LABEL, unit); + return AbstractProcessor.createFacet(context, hash, id, result, index, yAxisLabel, FACET_FLOW_DEPTH_WATER_LEVEL, + FACET_FLOW_DEPTH_WATER_LEVEL_DESCRIPTION, wstLabel); + } + + @Override + protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + + return buildSeriesForType(generator, bundle, theme, visible, doGetType(bundle.getFacetName()), GAP_DISTANCE); + } +} \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Oct 10 15:29:02 2019 +0200 @@ -47,7 +47,6 @@ super(label, wst, hasTkh, rows); this.sounding = sounding; - } public BedHeightInfo getSounding() { @@ -160,4 +159,8 @@ return lines.toArray(new String[lines.size()]); } + public String getSoundingLabel() { + return this.sounding.getDescription(); + } + } \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java Thu Oct 10 15:29:02 2019 +0200 @@ -21,7 +21,9 @@ import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.ReportFacet; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; +import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDischargeProcessor; import org.dive4elements.river.artifacts.sinfo.common.FlowDepthProcessor; +import org.dive4elements.river.artifacts.sinfo.common.FlowDepthWaterlevelProcessor; import org.dive4elements.river.artifacts.sinfo.common.TkhProcessor; import org.dive4elements.river.artifacts.states.DefaultState; @@ -81,6 +83,12 @@ final FlowDepthCalculationResult result = resultList.get(index); + /* Discharge */ + facets.add(FlowDepthDischargeProcessor.createFlowDepthDischargeFacet(context, hash, this.id, result, index, result.getWstLabel())); + /* Result Type Wasserspiegellage, Mittl. Sohlhöhe */ + final String unit = results.getRiver().getWstUnit(); + facets.add(FlowDepthWaterlevelProcessor.createFlowDepthWaterlevelFacet(context, hash, this.id, result, index, unit, result.getWstLabel())); + facets.add(FlowDepthWaterlevelProcessor.createFlowDepthMeanBedheightFacet(context, hash, this.id, result, index, unit, result.getSoundingLabel())); /* filtered (zoom dependent mean) flow depth */ facets.add(FlowDepthProcessor.createFlowDepthFilteredFacet(context, hash, this.id, result, index)); facets.add(FlowDepthProcessor.createFlowDepthRawFacet(context, hash, this.id, result, index)); diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentState.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthdev/FlowDepthDevelopmentState.java Thu Oct 10 15:29:02 2019 +0200 @@ -89,8 +89,10 @@ facets.add(FlowDepthDevelopmentPerYearProcessor.createFlowDepthDevelopmentFilteredFacet(context, hash, this.id, result, index)); facets.add(FlowDepthDevelopmentPerYearProcessor.createFlowDepthDevelopmentRawFacet(context, hash, this.id, result, index)); - facets.add(FlowDepthDevelopmentProcessor.createWaterlevelDifferenceFacet(context, hash, this.id, result, index)); - facets.add(FlowDepthDevelopmentProcessor.createBedHeightDifferenceFacet(context, hash, this.id, result, index)); + facets.add(FlowDepthDevelopmentProcessor.createWaterlevelDifferenceFacetFiltered(context, hash, this.id, result, index)); + facets.add(FlowDepthDevelopmentProcessor.createWaterlevelDifferenceFacetRaw(context, hash, this.id, result, index)); + facets.add(FlowDepthDevelopmentProcessor.createBedHeightDifferenceFacetFiltered(context, hash, this.id, result, index)); + facets.add(FlowDepthDevelopmentProcessor.createBedHeightDifferenceFacetRaw(context, hash, this.id, result, index)); facets.add(FlowDepthProcessor.createFlowDepthCurrentFilteredFacet(context, hash, this.id, result, index)); facets.add(FlowDepthProcessor.createFlowDepthCurrentRawFacet(context, hash, this.id, result, index)); diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculation.java Thu Oct 10 15:29:02 2019 +0200 @@ -155,6 +155,8 @@ putValue(SInfoResultType.discharge, discharge). // putValue(GeneralResultType.waterlevelLabel, waterlevelLabel). // putValue(GeneralResultType.gaugeLabel, gaugeLabel). // + putValue(SInfoResultType.minBedHeight, minBedHeightValue). // + putValue(SInfoResultType.maxBedHeight, maxBedHeightValue). // putValue(SInfoResultType.meanBedHeight, meanBedHeight). // putValue(SInfoResultType.soundingLabel, soundingLabel). // putValue(GeneralResultType.location, location); diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResult.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxCalculationResult.java Thu Oct 10 15:29:02 2019 +0200 @@ -136,4 +136,12 @@ return lines.toArray(new String[lines.size()]); } + + public String getSoundingLabel() { + return this.sounding.getDescription(); + } + + public String getWstLabel() { + return this.wst.getLabel(); + } } \ No newline at end of file diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxState.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepthminmax/FlowDepthMinMaxState.java Thu Oct 10 15:29:02 2019 +0200 @@ -21,7 +21,9 @@ import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.ReportFacet; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; +import org.dive4elements.river.artifacts.sinfo.common.FlowDepthDischargeProcessor; import org.dive4elements.river.artifacts.sinfo.common.FlowDepthProcessor; +import org.dive4elements.river.artifacts.sinfo.common.FlowDepthWaterlevelProcessor; import org.dive4elements.river.artifacts.states.DefaultState; /** State in which a waterlevel has been calculated. */ @@ -81,6 +83,15 @@ final FlowDepthMinMaxCalculationResult result = resultList.get(index); + final String unit = results.getRiver().getWstUnit(); + + final String wstLabel = result.getWstLabel(); + facets.add(FlowDepthWaterlevelProcessor.createFlowDepthMinBedheightFacet(context, hash, this.id, result, index, unit, result.getSoundingLabel())); + facets.add(FlowDepthWaterlevelProcessor.createFlowDepthMaxBedheightFacet(context, hash, this.id, result, index, unit, result.getSoundingLabel())); + + facets.add(FlowDepthWaterlevelProcessor.createFlowDepthWaterlevelFacet(context, hash, this.id, result, index, unit, wstLabel)); + /* Discharge */ + facets.add(FlowDepthDischargeProcessor.createFlowDepthDischargeFacet(context, hash, this.id, result, index, wstLabel)); /* filtered (zoom dependent mean) flow depth */ facets.add(FlowDepthProcessor.createFlowDepthMinFilteredFacet(context, hash, this.id, result, index)); facets.add(FlowDepthProcessor.createFlowDepthMinRawFacet(context, hash, this.id, result, index)); diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java Thu Oct 10 15:29:02 2019 +0200 @@ -9,12 +9,10 @@ package org.dive4elements.river.exports; import org.apache.log4j.Logger; - -import org.jfree.data.xy.XYSeries; - import org.dive4elements.river.artifacts.model.WKms; import org.dive4elements.river.artifacts.model.WQKms; import org.dive4elements.river.artifacts.model.WWQQ; +import org.jfree.data.xy.XYSeries; /** * Helper to create and modify StyledXYSeries. @@ -28,9 +26,7 @@ */ final static double BIG_DOUBLE_VALUE = 1234567d; - private static final Logger log = Logger.getLogger - (StyledSeriesBuilder.class); - + private static final Logger log = Logger.getLogger(StyledSeriesBuilder.class); /** * Trivial, hidden constructor. @@ -38,51 +34,48 @@ private StyledSeriesBuilder() { } - /** * Add points to series, create gaps if certain distance * between points is met. * - * @param series Series to add points to. - * @param points Points to add to series, points[0] to 1st dim, points[1] - * to 2nd dim. - * @param skipNANs if true, skip NAN values in points parameter. Otherwise, - * the NaNs lead to gaps in graph. - * @param distance if two consecutive entries in points[0] are more - * than distance apart, create a NaN value to skip - * in display. + * @param series + * Series to add points to. + * @param points + * Points to add to series, points[0] to 1st dim, points[1] + * to 2nd dim. + * @param skipNANs + * if true, skip NAN values in points parameter. Otherwise, + * the NaNs lead to gaps in graph. + * @param distance + * if two consecutive entries in points[0] are more + * than distance apart, create a NaN value to skip + * in display. */ - public static void addPoints( - XYSeries series, - double[][] points, - boolean skipNANs, - double distance - ) { + public static void addPoints(final XYSeries series, final double[][] points, final boolean skipNANs, final double distance) { if (points == null || points.length <= 1) { return; } - double [] xPoints = points[0]; - double [] yPoints = points[1]; - + final double[] xPoints = points[0]; + final double[] yPoints = points[1]; + Integer lastNonNaNIndex = null; - + for (int i = 0; i < xPoints.length; i++) { - if (skipNANs && - (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { + if (skipNANs && (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { continue; } // Create gap if distance between points > distance. - if (i > 0 && lastNonNaNIndex != null) - { - double distanceToLastNonNan = Math.abs(xPoints[lastNonNaNIndex] - xPoints[i] ); + if (i > 0 && lastNonNaNIndex != null) { + final double distanceToLastNonNan = Math.abs(xPoints[lastNonNaNIndex] - xPoints[i]); if (distanceToLastNonNan > distance && !Double.isNaN(yPoints[lastNonNaNIndex]) && !Double.isNaN(yPoints[i])) - series.add((xPoints[i-1] + xPoints[i])/2, Double.NaN, false); + series.add((xPoints[i - 1] + xPoints[i]) / 2, Double.NaN, false); } series.add(xPoints[i], yPoints[i], false); - + // if (skipNANs && !Double.isNaN(xPoints[i]) && !Double.isNaN(yPoints[i])) - if (!Double.isNaN(xPoints[i]) && !Double.isNaN(yPoints[i])) // skipNaN-State irrelevant, since lastNonNaNIndex is used for interpolation after gap-distance-comparison + if (!Double.isNaN(xPoints[i]) && !Double.isNaN(yPoints[i])) // skipNaN-State irrelevant, since lastNonNaNIndex is used for interpolation + // after gap-distance-comparison lastNonNaNIndex = i; } } @@ -90,15 +83,19 @@ /** * Add points to series. * - * @param series Series to add points to. - * @param points Points to add to series, points[0] to 1st dim, points[1] - * to 2nd dim. - * @param skipNANs if true, skip NAN values in points parameter. - * @param transY translate y-values by this value (before scale). - * @param factorY scale y-values by this value (after translation). + * @param series + * Series to add points to. + * @param points + * Points to add to series, points[0] to 1st dim, points[1] + * to 2nd dim. + * @param skipNANs + * if true, skip NAN values in points parameter. + * @param transY + * translate y-values by this value (before scale). + * @param factorY + * scale y-values by this value (after translation). */ - public static void addPoints(XYSeries series, double[][] points, - boolean skipNANs, double transY, double factorY) { + public static void addPoints(final XYSeries series, final double[][] points, final boolean skipNANs, final double transY, final double factorY) { if (transY == 0d && factorY == 1d) { addPoints(series, points, skipNANs); return; @@ -106,167 +103,176 @@ if (points == null || points.length <= 1) { return; } - double [] xPoints = points[0]; - double [] yPoints = points[1]; + final double[] xPoints = points[0]; + final double[] yPoints = points[1]; for (int i = 0; i < xPoints.length; i++) { - if (skipNANs && - (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { + if (skipNANs && (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { continue; } - series.add(xPoints[i], factorY * (transY+yPoints[i]), false); + series.add(xPoints[i], factorY * (transY + yPoints[i]), false); } } /** * Add points to series. * - * @param series Series to add points to. - * @param points Points to add to series, points[0] to 1st dim, points[1] - * to 2nd dim. - * @param skipNANs if true, skip NAN values in points parameter. + * @param series + * Series to add points to. + * @param points + * Points to add to series, points[0] to 1st dim, points[1] + * to 2nd dim. + * @param skipNANs + * if true, skip NAN values in points parameter. */ - public static void addPoints( - XYSeries series, - double[][] points, - boolean skipNANs - ) { + public static void addPoints(final XYSeries series, final double[][] points, final boolean skipNANs) { if (points == null || points.length <= 1) { return; } - double [] xPoints = points[0]; - double [] yPoints = points[1]; + final double[] xPoints = points[0]; + final double[] yPoints = points[1]; for (int i = 0; i < xPoints.length; i++) { - if (skipNANs && - (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { + if (skipNANs && (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { continue; } series.add(xPoints[i], yPoints[i], false); } } - /** * Add points to series (km to 1st dim, w to 2nd dim). * - * @param series Series to add points to. - * @param wkms WKms to add to series. + * @param series + * Series to add points to. + * @param wkms + * WKms to add to series. */ - public static void addPoints(XYSeries series, WKms wkms) { + public static void addPoints(final XYSeries series, final WKms wkms) { if (wkms == null) { return; } - int size = wkms.size(); + final int size = wkms.size(); for (int i = 0; i < size; i++) { series.add(wkms.getKm(i), wkms.getW(i), false); } } - /** * Add points to dataset with an offset (shift all points by given amount). - * @param series series to add data to. - * @param wkms WKms of which the Ws will be shifted. - * @param off the offset. + * + * @param series + * series to add data to. + * @param wkms + * WKms of which the Ws will be shifted. + * @param off + * the offset. */ - public static void addUpperBand(XYSeries series, WKms wkms, double off) { + public static void addUpperBand(final XYSeries series, final WKms wkms, final double off) { if (wkms == null) { return; } - int size = wkms.size(); + final int size = wkms.size(); for (int i = 0; i < size; i++) { - series.add(wkms.getKm(i), wkms.getW(i)+off, false); + series.add(wkms.getKm(i), wkms.getW(i) + off, false); } } - /** * Add points to dataset with an offset (shift all points 'down' by given * amount). - * @param series series to add data to. - * @param wkms WKms of which the Ws will be shifted. - * @param off the offset. + * + * @param series + * series to add data to. + * @param wkms + * WKms of which the Ws will be shifted. + * @param off + * the offset. */ - public static void addLowerBand(XYSeries series, WKms wkms, double off) { + public static void addLowerBand(final XYSeries series, final WKms wkms, final double off) { addUpperBand(series, wkms, -off); } - /** * Add points to series (km to 1st dim, q to 2nd dim). * - * @param series Series to add points to. - * @param wqkms WQKms to add to series. + * @param series + * Series to add points to. + * @param wqkms + * WQKms to add to series. */ - public static void addPointsKmQ(XYSeries series, WQKms wqkms) { + public static void addPointsKmQ(final XYSeries series, final WQKms wqkms) { if (wqkms == null) { return; } - int size = wqkms.size(); + final int size = wqkms.size(); for (int i = 0; i < size; i++) { series.add(wqkms.getKm(i), wqkms.getQ(i), false); } } - /** * Add points to series (km to 1st dim, q to 2nd dim), adding points * to achieve a step-like curve. * - * @param series Series to add points to. - * @param wqkms WQKms to add to series. + * @param series + * Series to add points to. + * @param wqkms + * WQKms to add to series. */ - public static void addStepPointsKmQ(XYSeries series, WQKms wqkms) { + public static void addStepPointsKmQ(final XYSeries series, final WQKms wqkms) { if (wqkms == null) { return; } - int size = wqkms.size(); + final int size = wqkms.size(); for (int i = 0; i < size; i++) { - if (i==0) { + if (i == 0) { series.add(wqkms.getKm(i), wqkms.getQ(i), false); - } else if (i == size-1) { + } else if (i == size - 1) { series.add(wqkms.getKm(i), wqkms.getQ(i), false); } else { - //Add two points. + // Add two points. double prevX; double prevQ; if (wqkms.getKm(i + 1) < wqkms.getKm(i)) { - /* Depending on the data direction the previous km / q + /* + * Depending on the data direction the previous km / q * might have a larger index when we draw - * right to left data. */ + * right to left data. + */ prevX = wqkms.getKm(i + 1); prevQ = wqkms.getQ(i + 1); } else { prevX = wqkms.getKm(i - 1); prevQ = wqkms.getQ(i - 1); } - double halveX = (prevX + wqkms.getKm(i)) / 2d; + final double halveX = (prevX + wqkms.getKm(i)) / 2d; series.add(halveX, prevQ, false); series.add(halveX, wqkms.getQ(i), false); } } } - /** * Add points to series (q to 1st dim, w to 2nd dim). * - * @param series Series to add points to. - * @param wqkms WQKms to add to series. + * @param series + * Series to add points to. + * @param wqkms + * WQKms to add to series. */ - public static void addPointsQW(XYSeries series, WQKms wqkms) { + public static void addPointsQW(final XYSeries series, final WQKms wqkms) { if (wqkms == null) { return; } - int size = wqkms.size(); + final int size = wqkms.size(); for (int i = 0; i < size; i++) { series.add(wqkms.getQ(i), wqkms.getW(i), false); @@ -277,48 +283,47 @@ * Add points to series (q to 1st dim, w to 2nd dim), adding wTrans to the * W values and scaling it with wScale. * - * @param series Series to add points to. - * @param qws to add to series. - * @param wAdd Value to add to each Q while adding to series. - * @param wScale multiply with + * @param series + * Series to add points to. + * @param qws + * to add to series. + * @param wAdd + * Value to add to each Q while adding to series. + * @param wScale + * multiply with */ - public static void addPointsQW( - XYSeries series, - double[][] qws, - double wTrans, - double wScale - ) { + public static void addPointsQW(final XYSeries series, final double[][] qws, final double wTrans, final double wScale) { if (qws == null || qws.length == 0) { return; } - double x[] = qws[0]; - double y[] = qws[1]; + final double x[] = qws[0]; + final double y[] = qws[1]; for (int i = 0; i < x.length; i++) { series.add(x[i], wScale * (y[i] + wTrans), false); } } + /** * Add points to series (q to 1st dim, w to 2nd dim), adding wTrans to the * W values and scaling it with wScale. * - * @param series Series to add points to. - * @param wqkms WQKms to add to series. - * @param wAdd Value to add to each Q while adding to series. - * @param wScale multiply with + * @param series + * Series to add points to. + * @param wqkms + * WQKms to add to series. + * @param wAdd + * Value to add to each Q while adding to series. + * @param wScale + * multiply with */ - public static void addPointsQW( - XYSeries series, - WQKms wqkms, - double wTrans, - double wScale - ) { + public static void addPointsQW(final XYSeries series, final WQKms wqkms, final double wTrans, final double wScale) { if (wqkms == null) { return; } - int size = wqkms.size(); + final int size = wqkms.size(); for (int i = 0; i < size; i++) { series.add(wqkms.getQ(i), wScale * (wqkms.getW(i) + wTrans), false); @@ -328,16 +333,19 @@ /** * Add points to series (q to 1st dim, w to 2nd dim). * - * @param series Series to add points to. - * @param qs the Qs to add, assumed same length than ws. - * @param ws the Ws to add, assumed same length than qs. + * @param series + * Series to add points to. + * @param qs + * the Qs to add, assumed same length than ws. + * @param ws + * the Ws to add, assumed same length than qs. */ - public static void addPointsQW(XYSeries series, double[] qs, double ws[]) { + public static void addPointsQW(final XYSeries series, final double[] qs, final double ws[]) { if (ws == null || qs == null) { return; } - int size = qs.length; + final int size = qs.length; for (int i = 0; i < size; i++) { series.add(qs[i], ws[i], false); @@ -348,76 +356,75 @@ * Add points to series (q to 1st dim, w to 2nd dim), with * scaling and translation. * - * @param series Series to add points to. - * @param qs the Qs to add, assumed same length than ws. - * @param ws the Ws to add, assumed same length than qs. + * @param series + * Series to add points to. + * @param qs + * the Qs to add, assumed same length than ws. + * @param ws + * the Ws to add, assumed same length than qs. */ - public static void addPointsQW(XYSeries series, double[] qs, double ws[], - double wTrans, double wScale) { + public static void addPointsQW(final XYSeries series, final double[] qs, final double ws[], final double wTrans, final double wScale) { if (ws == null || qs == null) { return; } - int size = qs.length; + final int size = qs.length; for (int i = 0; i < size; i++) { - series.add(qs[i], wScale * (ws[i]+wTrans), false); + series.add(qs[i], wScale * (ws[i] + wTrans), false); } } - - /** * Add points to series (q to 1st dim, w to 2nd dim). * - * @param series Series to add points to. - * @param wwqq WWQQ to add to series. + * @param series + * Series to add points to. + * @param wwqq + * WWQQ to add to series. */ - public static void addPoints(XYSeries series, WWQQ wwqq) { + public static void addPoints(final XYSeries series, final WWQQ wwqq) { if (wwqq == null) { return; } - int size = wwqq.size(); + final int size = wwqq.size(); for (int i = 0; i < size; i++) { series.add(wwqq.getW1(i), wwqq.getW2(i), false); } } - /** * Create a Series such that an infinitely big area can be filled * between the newly created and the given series. */ - public static XYSeries createGroundAtInfinity(XYSeries series) { - XYSeries ground = - new XYSeries(series.getKey() + /** TODO rand + */ "INF"); + public static XYSeries createGroundAtInfinity(final XYSeries series) { + final XYSeries ground = new XYSeries(series.getKey() + /** TODO rand + */ + "INF"); ground.add(series.getMinX(), -BIG_DOUBLE_VALUE); ground.add(series.getMaxX(), -BIG_DOUBLE_VALUE); return ground; } - /** * Create a Series such that an infinitely big area can be filled * between the newly created and the given series. */ - public static XYSeries createCeilingAtInfinity(XYSeries series) { - XYSeries ground = - new XYSeries(series.getKey() + /** TODO rand + */ "INF"); + public static XYSeries createCeilingAtInfinity(final XYSeries series) { + final XYSeries ground = new XYSeries(series.getKey() + /** TODO rand + */ + "INF"); ground.add(series.getMinX(), BIG_DOUBLE_VALUE); ground.add(series.getMaxX(), BIG_DOUBLE_VALUE); return ground; } + /** Checks if a given value is the BIG_DOUBLE_VALUE */ + public static boolean isBigDoubleValue(final Number value) { + if (value == null) + return false; - /** Checks if a given value is the BIG_DOUBLE_VALUE */ - public static boolean isBigDoubleValue(Number value) { - if( value == null ) - return false; - - return Math.abs( BIG_DOUBLE_VALUE - Math.abs(value.doubleValue()) ) < 0.1; + return Math.abs(BIG_DOUBLE_VALUE - Math.abs(value.doubleValue())) < 0.1; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r cedcee24a21a -r 1d4262a68f1f artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java Wed Oct 09 19:25:55 2019 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java Thu Oct 10 15:29:02 2019 +0200 @@ -11,80 +11,58 @@ import java.util.Map; import org.apache.log4j.Logger; -import org.jfree.data.xy.XYSeries; - import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.CallMeta; - -import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.access.RiverAccess; import org.dive4elements.river.artifacts.model.FacetTypes; -import org.dive4elements.river.exports.XYChartGenerator; +import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.exports.DiagramGenerator; import org.dive4elements.river.exports.StyledSeriesBuilder; +import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.themes.ThemeDocument; +import org.jfree.data.xy.XYSeries; public class BedHeightProcessor extends DefaultProcessor { - private final static Logger log = - Logger.getLogger(BedHeightProcessor.class); + private final static Logger log = Logger.getLogger(BedHeightProcessor.class); - public static final String I18N_AXIS_LABEL = - "chart.bedheight_middle.section.yaxis.label"; + public static final String I18N_AXIS_LABEL = "chart.bedheight_middle.section.yaxis.label"; public final static String FACET_BED_HEIGHTS_MIN = "bedheight_min"; public final static String FACET_BED_HEIGHTS_MAX = "bedheight_min"; - + protected static final double GAP_TOLERANCE = 0.101d; protected String yAxisLabel; @Override - public void doOut( - DiagramGenerator generator, - ArtifactAndFacet bundle, - ThemeDocument theme, - boolean visible) { - XYSeries series = prepareSeries( - bundle, theme, generator.getContext()); + public void doOut(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { + final XYSeries series = prepareSeries(bundle, theme, generator.getContext()); if (series != null) { - generator.addAxisSeries(series, axisName, visible); + generator.addAxisSeries(series, this.axisName, visible); } } @Override - public void doOut( - XYChartGenerator generator, - ArtifactAndFacet bundle, - ThemeDocument theme, - boolean visible, - int index - ) { - XYSeries series = prepareSeries( - bundle, theme, generator.getContext()); + public void doOut(final XYChartGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible, final int index) { + final XYSeries series = prepareSeries(bundle, theme, generator.getContext()); if (series != null) { generator.addAxisSeries(series, index, visible); } } /** Prepare an series, independent of axis. */ - private XYSeries prepareSeries( - ArtifactAndFacet bundle, - ThemeDocument theme, - CallContext context - ) { - Map metaData = bundle.getFacet().getMetaData( - bundle.getArtifact(), context); - StyledXYSeries series = new StyledXYSeries(bundle.getFacetName(), bundle.getFacetDescription(), - theme); + private XYSeries prepareSeries(final ArtifactAndFacet bundle, final ThemeDocument theme, final CallContext context) { + final Map metaData = bundle.getFacet().getMetaData(bundle.getArtifact(), context); + final StyledXYSeries series = new StyledXYSeries(bundle.getFacetName(), bundle.getFacetDescription(), theme); series.putMetaData(metaData, bundle.getArtifact(), context); - yAxisLabel = metaData.get("Y"); + this.yAxisLabel = metaData.get("Y"); - Object raw = bundle.getData(context); + final Object raw = bundle.getData(context); if (raw == null) { return null; } @@ -93,44 +71,28 @@ return null; } - double[][] data = (double[][])raw; - StyledSeriesBuilder.addPoints(series, - data, - false, - GAP_TOLERANCE); + final double[][] data = (double[][]) raw; + StyledSeriesBuilder.addPoints(series, data, false, GAP_TOLERANCE); return series; } - @Override - public boolean canHandle(String facetType) { - return FacetTypes.BEDHEIGHT.equals(facetType) - || FACET_BED_HEIGHTS_MIN.equals(facetType) - || FACET_BED_HEIGHTS_MAX.equals(facetType) - || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) - || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType) - || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals( - facetType) - || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals( - facetType); + public boolean canHandle(final String facetType) { + return FacetTypes.BEDHEIGHT.equals(facetType) || FACET_BED_HEIGHTS_MIN.equals(facetType) || FACET_BED_HEIGHTS_MAX.equals(facetType) + || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1.equals(facetType) || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT2.equals(facetType) + || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED.equals(facetType) || FacetTypes.BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED.equals(facetType); } @Override - public String getAxisLabel(DiagramGenerator generator) { - D4EArtifact flys = (D4EArtifact) generator.getMaster(); - String unit = new RiverAccess(flys).getRiver().getWstUnit().getName(); - - CallMeta meta = generator.getContext().getMeta(); + public String getAxisLabel(final DiagramGenerator generator) { + final D4EArtifact flys = (D4EArtifact) generator.getMaster(); + final String unit = new RiverAccess(flys).getRiver().getWstUnit().getName(); - if (yAxisLabel != null && !yAxisLabel.isEmpty()) { - return Resources.getMsg( - meta, - yAxisLabel, - new Object[] {unit}); + final CallMeta meta = generator.getContext().getMeta(); + + if (this.yAxisLabel != null && !this.yAxisLabel.isEmpty()) { + return Resources.getMsg(meta, this.yAxisLabel, new Object[] { unit }); } - return Resources.getMsg( - meta, - I18N_AXIS_LABEL, - new Object[] { unit }); + return Resources.getMsg(meta, I18N_AXIS_LABEL, new Object[] { unit }); } } \ No newline at end of file