# HG changeset patch # User Tom Gottfried # Date 1370936456 -7200 # Node ID e8f152163a1e2269aa61a505d8e7701073077ffd # Parent a3fb76cf79b65e1f4acad985dd4e69ffa9042d85# Parent f01dee3a39fc2b5cfc1cbb4c0a076916912d9de6 merge changes from default into double-precision branch diff -r a3fb76cf79b6 -r e8f152163a1e .hgtags --- a/.hgtags Wed Jun 05 11:56:38 2013 +0200 +++ b/.hgtags Tue Jun 11 09:40:56 2013 +0200 @@ -50,3 +50,5 @@ b740f0c4179edb5238d27013b25a0b3cc52e4e7f 3.0.3 5f34e4cb80952b94e4683d90dbaab59e9da3711a 3.0.4 1a169e10c0f3e1f33990a91dd294512ac97d1a70 3.0.5 +b689d2b9d1675739778083b2bcba336abb33f70c 3.0.6 +5733d7f27196c5a8cf18231fbf187738f8fea560 3.0.7 diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/artifacts/minfo.xml --- a/artifacts/doc/conf/artifacts/minfo.xml Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/doc/conf/artifacts/minfo.xml Tue Jun 11 09:40:56 2013 +0200 @@ -229,7 +229,6 @@ - @@ -257,7 +256,6 @@ - @@ -279,6 +277,12 @@ + + + + + + @@ -391,14 +395,17 @@ - - - - - + + + + + + + + - + diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/conf.xml --- a/artifacts/doc/conf/conf.xml Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/doc/conf/conf.xml Tue Jun 11 09:40:56 2013 +0200 @@ -332,6 +332,7 @@ org.dive4elements.river.exports.minfo.BedDiffEpochInfoGenerator org.dive4elements.river.exports.minfo.BedDiffHeightYearGenerator org.dive4elements.river.exports.minfo.BedDiffHeightYearInfoGenerator + org.dive4elements.river.exports.minfo.BedDifferenceExporter org.dive4elements.river.exports.sq.SQRelationGeneratorA org.dive4elements.river.exports.sq.SQRelationGeneratorB org.dive4elements.river.exports.sq.SQRelationGeneratorC diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/jasper/beddifference.jasper Binary file artifacts/doc/conf/jasper/beddifference.jasper has changed diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/jasper/beddifference_en.jasper Binary file artifacts/doc/conf/jasper/beddifference_en.jasper has changed diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/jasper/sqrelation.jasper Binary file artifacts/doc/conf/jasper/sqrelation.jasper has changed diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/jasper/sqrelation_en.jasper Binary file artifacts/doc/conf/jasper/sqrelation_en.jasper has changed diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/mapserver/barrier_lines_class.vm --- a/artifacts/doc/conf/mapserver/barrier_lines_class.vm Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/doc/conf/mapserver/barrier_lines_class.vm Tue Jun 11 09:40:56 2013 +0200 @@ -30,3 +30,11 @@ OUTLINECOLOR "#800000" END END +CLASS + NAME "Ringdeich" + EXPRESSION ("[TYP]"="Ringdeich") + STYLE + SIZE 5 + OUTLINECOLOR "#800000" + END +END diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/mapserver/mapfile.vm --- a/artifacts/doc/conf/mapserver/mapfile.vm Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/doc/conf/mapserver/mapfile.vm Tue Jun 11 09:40:56 2013 +0200 @@ -14,7 +14,7 @@ END DEBUG 5 - CONFIG "MS_ERRORFILE" "/tmp/flys-user-wms.log" + CONFIG "MS_ERRORFILE" "d4e-wms.log" WEB METADATA diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/meta-data.xml --- a/artifacts/doc/conf/meta-data.xml Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/doc/conf/meta-data.xml Tue Jun 11 09:40:56 2013 +0200 @@ -5,8 +5,12 @@ User specific part ------------------ + This is a hack because we currently have no way to supress empty + folders (either in the client or in the datacage). - + @@ -32,7 +36,7 @@ - + @@ -186,6 +190,7 @@ + @@ -242,12 +247,6 @@ - - - - - - @@ -255,7 +254,7 @@ - + @@ -272,949 +271,642 @@ - - - - - - Recommendations (client shall load immediately). - - - - - - - - - - - - Non Recommendations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + Recommendations (user) + + + + + + + + + + + + Non Recommendations (user) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM artifacts a - JOIN outs o ON o.artifact_id = a.id - JOIN facets f ON f.out_id = o.id - WHERE a.id = ${a_id} - AND f.name = ${facet_type} - + + - + + + + + - - - - - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'cross_section' - - - - - - - SELECT name AS facet_name, num AS facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} - AND name = 'longitudinal_section' - - - - - - - SELECT name AS facet_name, - num AS facet_num, - description AS facet_description - FROM facets - WHERE out_id = ${out_id} - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} - AND name = 'fix_longitudinal_section_curve' - - - - - - - SELECT name AS facet_name, - num AS facet_num, - description AS facet_description - FROM facets - WHERE out_id = ${out_id} AND ( - name LIKE 'fix_deviation_ls%' OR - name LIKE 'fix_sector_average_ls%' OR - name LIKE 'fix_analysis_events_ls%' OR - name LIKE 'fix_reference_events_ls%') - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} - AND name = 'fix_deltawt_curve' - - - - - - - SELECT name AS facet_name, - num AS facet_num, - description AS facet_description - FROM facets - WHERE out_id = ${out_id} and ( - name LIKE 'fix_sector_average_dwt%' OR - name LIKE 'fix_deviation_dwt%' OR - name = 'fix_analysis_events_dwt' OR - name = 'fix_reference_events_dwt' OR - name = 'fix_analysis_periods_dwt') - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve' - - - - - - - SELECT name AS facet_name, num AS facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and ( - name LIKE 'fix_sector_average_dwt%' OR - name LIKE 'fix_deviation_dwt%') - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve' - - - - - - - SELECT name AS facet_name, num AS facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and name = 'fix_derivate_curve' - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve' - - - - - - - SELECT name AS facet_name, num AS facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and ( - name LIKE 'fix_sector_average_wq%' OR - name = 'fix_wq_curve' OR - name LIKE 'fix_analysis_events_wq%' OR - name LIKE 'fix_reference_events_wq%' ) - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - (f.name = 'duration_curve.q' OR f.name = 'duration_curve.w') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Aheinecke: Why is this grouping different from the rest? + + + + + + + + + + + + + + + + + + + + + + + + Aheinecke: Why is this grouping different from the rest? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - TODO doesnt work nicely for fix/wq-diags. + TODO doesnt work nicely for fix/wq-diags. Aheinecke (27.5.2013): Why? - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' - + - - - - SELECT name AS facet_name, num AS facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and name = 'longitudinal_section.w' - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'floodmap' - - - - - SELECT name AS facet_name, - num AS facet_num, - description AS facet_description - FROM facets - WHERE out_id = ${out_id} AND name = 'floodmap.usershape' - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - + No grouping in this? + + + + + + + + + + + + + + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} AND - o.name='bed_longitudinal_section' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - (f.name = 'bed_longitudinal_section.bed_diameter_toplayer' - OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} AND - o.name='bed_longitudinal_section' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - f.name = 'bed_longitudinal_section.bedload_diameter' AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} AND - o.name='bed_longitudinal_section' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - (f.name = 'bed_longitudinal_section.sediment_density_toplayer' OR - f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} AND - o.name='bed_longitudinal_section' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - (f.name = 'bed_longitudinal_section.porosity_toplayer' OR - f.name = 'bed_longitudinal_section.porosity_sublayer') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} and o.name='flow_velocity' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE - (f.name = 'flow_velocity.totalchannel' OR - f.name = 'flow_velocity.mainchannel' OR - f.name = 'flow_velocity.totalchannel.filtered' OR - f.name = 'flow_velocity.mainchannel.filtered') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} and o.name='sedimentload_ls' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE f.name LIKE 'sedimentload%' AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid, - name AS o_name - FROM outs AS o - WHERE - o.artifact_id = ${a_id} AND - (o.name = 'bed_difference_year' OR - o.name = 'bed_differnece_epoch') - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE (f.name LIKE 'bedheight_difference.year%' OR - f.name LIKE 'bedheight_difference.epoch%') AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - SELECT id AS oid - FROM outs AS o - WHERE - o.artifact_id = ${a_id} AND - o.name = 'discharge_longitudinal_section' - + - - - - - SELECT a.gid AS aid, - f.id AS fid, - f.name AS facet_name, - f.num AS facet_num, - f.description AS facet_description - FROM outs AS o, facets AS f, artifacts AS a - WHERE f.name = 'discharge_longitudinal_section.w' AND - f.out_id = o.id AND - o.artifact_id = ${a_id} AND - a.id = ${a_id} - - - - - - - - - - - + + + + + + + + + + + + - + - + - + - - + + @@ -1232,7 +924,7 @@ + factory="crosssections" target_out="{$out}" /> @@ -1251,9 +943,9 @@ AND he.km BETWEEN ${fromkm} AND ${tokm} - + factory="hyk" target_out="{$out}" /> @@ -1279,7 +971,7 @@ @@ -1288,7 +980,7 @@ @@ -1302,7 +994,7 @@ @@ -1321,7 +1013,7 @@ @@ -1340,7 +1032,7 @@ @@ -1369,7 +1061,7 @@ @@ -1382,7 +1074,7 @@ - + SELECT id AS anno_id, name AS anno_description @@ -1390,7 +1082,7 @@ @@ -1406,7 +1098,7 @@ @@ -1425,7 +1117,7 @@ @@ -1444,7 +1136,7 @@ @@ -1454,6 +1146,25 @@ + + + + + + + + + + + + + + + + @@ -1466,7 +1177,7 @@ @@ -1488,15 +1199,15 @@ - + - + - + @@ -1514,10 +1225,12 @@ SELECT id AS bedh_id, year AS bedh_year, description AS bedh_descr - FROM bed_height_single WHERE river_id = ${river_id} + FROM bed_height_single + WHERE river_id = ${river_id} + AND lower(description) NOT LIKE '%epoch%' - @@ -1529,14 +1242,16 @@ - SELECT id AS bedh_id, - time_interval_id AS bedh_interval_id, - description AS bedh_descr - FROM bed_height_epoch WHERE river_id = ${river_id} + SELECT id AS bedh_id, + year AS bedh_year, + description AS bedh_descr + FROM bed_height_single + WHERE river_id = ${river_id} + AND lower(description) LIKE '%epoch%' - @@ -1556,7 +1271,7 @@ TODO: Why has this an id and factory? + factory="flowvelocity" target_out="{$out}" > SELECT id, description, station, datetime, v, w, q @@ -1567,7 +1282,7 @@ + factory="flowvelocity" target_out="{$out}" /> @@ -1597,7 +1312,7 @@ + factory="morph-width" target_out="{$out}" /> @@ -1617,7 +1332,7 @@ - @@ -1646,7 +1361,7 @@ @@ -1655,7 +1370,7 @@ @@ -1680,7 +1395,7 @@ @@ -1689,7 +1404,7 @@ @@ -1733,10 +1448,10 @@ FIXME: Following two macros look identical to me. - + - + @@ -1750,21 +1465,22 @@ d.name AS name, t.start_time AS start_time, t.stop_time AS stop_time, - 'Projektion: ' || d.projection || '$' || - 'Rasterweite: ' || d.resolution || 'm$' || - 'Format: ' || d.format || '$' || + 'Projektion: ' || d.projection || '<BR>' || + 'Rasterweite: ' || d.resolution || 'm<BR>' || + 'Format: ' || d.format || '<BR>' || 'Zeitraum: ' AS info FROM dem d JOIN ranges r ON d.range_id = r.id LEFT JOIN time_intervals t ON d.time_interval_id = t.id - WHERE d.river_id = ${river_id} - - - + + + info="{$info}{dc:date-format('yyyy', $start_time)} - {dc:date-format('yyyy', $stop_time)}"/> @@ -1774,7 +1490,7 @@ - + @@ -1861,7 +1577,7 @@ AND kind = 2 - @@ -1875,7 +1591,7 @@ AND kind = 2 - @@ -1896,7 +1612,7 @@ - @@ -1921,7 +1637,7 @@ @@ -1941,7 +1657,7 @@ @@ -1959,7 +1675,7 @@ @@ -1990,7 +1706,7 @@ - @@ -2006,7 +1722,7 @@ - @@ -2032,7 +1748,7 @@ - @@ -2049,7 +1765,7 @@ - @@ -2080,7 +1796,7 @@ ${source} - @@ -2110,19 +1826,21 @@ - - - - - - - + + + + + + + + @@ -2137,7 +1855,7 @@ - @@ -2268,7 +1986,7 @@ - @@ -2403,7 +2121,7 @@ @@ -2413,7 +2131,7 @@ - @@ -2421,10 +2139,10 @@ - - - - + + + + @@ -2445,7 +2163,7 @@ + factory="riveraxis" target_out="{$out}" /> @@ -2453,7 +2171,7 @@ + factory="riveraxis" target_out="{$out}" /> @@ -2468,7 +2186,7 @@ SELECT DISTINCT 1 FROM river_axes_km WHERE river_id = ${river_id} - + @@ -2482,7 +2200,7 @@ GROUP BY name - @@ -2504,18 +2222,20 @@ - - - - - - + + + + + + + + @@ -2538,7 +2258,7 @@ @@ -2546,7 +2266,7 @@ @@ -2566,7 +2286,7 @@ @@ -2619,6 +2339,7 @@ + @@ -2640,7 +2361,7 @@ wc.position AS wst_column_position, wc.description AS info, w.description AS wst_description, - wc.name AS wst_column_name, + COALESCE(wc.name, '') AS wst_column_name, wr.a AS deffrom, wr.b AS defto FROM wst_columns wc @@ -2653,7 +2374,7 @@ - + Select collections and masterartifacts. @@ -2665,10 +2386,18 @@ COALESCE(ma.ld_mode, '') AS ld_m, COALESCE(ma.ld_locations, '') AS ld_l, COALESCE(ma.ld_from, '') AS ld_f, - COALESCE(ma.ld_to, '') AS ld_t + COALESCE(ma.ld_to, '') AS ld_t, + o.name AS out_name, + o.id AS out_id, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description, + f.id AS fid FROM users u JOIN collections c ON c.user_id = u.id JOIN master_artifacts_range ma ON ma.collection_id = c.id + JOIN outs o ON o.artifact_id = ma.id + 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 EXISTS ( @@ -2678,41 +2407,24 @@ AND k = 'river' AND v = ${river}) - - - - - - - + + + + + - - - - - - SELECT COALESCE(ld_mode, '') AS ldm, - COALESCE(ld_locations, '') AS ldl, - COALESCE(ld_from, '') AS ldf, - COALESCE(ld_to, '') AS ldt - FROM master_artifacts_range - WHERE gid = CAST(${artifact-id} AS uuid) - - - - - - - - - - - - - - + + + + + + + + + + diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes.xml --- a/artifacts/doc/conf/themes.xml Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/doc/conf/themes.xml Tue Jun 11 09:40:56 2013 +0200 @@ -1,55 +1,13 @@ - - - - - - - - - - - - - - - - - - - - - + + ]> &virtual-themes; - - - &longitudinal-section; - &cross-section; - &discharge; - &duration; - &fixings; - &floodmap; - &historical-discharge; - &reference; - &sq-relation; - &general; - - - &longitudinal-section_sec; - &cross-section_sec; - &discharge_sec; - &duration_sec; - &fixings_sec; - &floodmap_sec; - &historical-discharge_sec; - &reference_sec; - &sq-relation_sec; - &general_sec; - + &default-themes; + &second-themes; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/cross-section.xml --- a/artifacts/doc/conf/themes/default/cross-section.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/discharge.xml --- a/artifacts/doc/conf/themes/default/discharge.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/duration.xml --- a/artifacts/doc/conf/themes/default/duration.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/fixings.xml --- a/artifacts/doc/conf/themes/default/fixings.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/floodmap.xml --- a/artifacts/doc/conf/themes/default/floodmap.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/general.xml --- a/artifacts/doc/conf/themes/default/general.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/historical-discharge.xml --- a/artifacts/doc/conf/themes/default/historical-discharge.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/longitudinal-section.xml --- a/artifacts/doc/conf/themes/default/longitudinal-section.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,975 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/reference.xml --- a/artifacts/doc/conf/themes/default/reference.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/default/sq-relation.xml --- a/artifacts/doc/conf/themes/default/sq-relation.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/doc/conf/themes/second.xml Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,2097 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/cross-section.xml --- a/artifacts/doc/conf/themes/second/cross-section.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/discharge.xml --- a/artifacts/doc/conf/themes/second/discharge.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/duration.xml --- a/artifacts/doc/conf/themes/second/duration.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/fixings.xml --- a/artifacts/doc/conf/themes/second/fixings.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/floodmap.xml --- a/artifacts/doc/conf/themes/second/floodmap.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/general.xml --- a/artifacts/doc/conf/themes/second/general.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/historical-discharge.xml --- a/artifacts/doc/conf/themes/second/historical-discharge.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/longitudinal-section.xml --- a/artifacts/doc/conf/themes/second/longitudinal-section.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,945 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/reference.xml --- a/artifacts/doc/conf/themes/second/reference.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/doc/conf/themes/second/sq-relation.xml --- a/artifacts/doc/conf/themes/second/sq-relation.xml Wed Jun 05 11:56:38 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java Tue Jun 11 09:40:56 2013 +0200 @@ -145,8 +145,6 @@ addStringData(DATA_IS_NEWEST, newString); addStringData(DATA_IS_MASTER, newString); - StaticState state = (StaticState) getCurrentState(context); - if (!fs.isEmpty()) { addFacets(getCurrentStateId(), fs); } @@ -162,7 +160,7 @@ { D4EArtifact flys = (D4EArtifact) artifact; - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] range = rangeAccess.getKmRange(); double min = 0.0f; if (range != null && range.length > 0) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java Tue Jun 11 09:40:56 2013 +0200 @@ -17,8 +17,6 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.xml.xpath.XPathConstants; @@ -86,12 +84,11 @@ public static final String XPATH_FILTER = "/art:action/art:filter/art:out"; - public static final Pattern CONTAINS_OUT = - Pattern.compile( "^(.*):OUT=(.+)$"); - /** Path to 'ids' (data) in doc that comes from datacage. */ public static final String XPATH_IDS = "/art:action/art:ids/@value"; + /** Path to 'target_out' (data) in doc that comes from datacage. */ + public static final String XPATH_TARGET_OUT = "/art:action/art:target_out/@value"; /** The constant string that shows that an operation was successful. */ public static final String OPERATION_SUCCESSFUL = "SUCCESS"; @@ -120,7 +117,7 @@ */ protected Map> filterFacets; - protected String boundToOut; + private String boundToOut; /** @@ -194,11 +191,7 @@ CallMeta callMeta, Document data) { - boolean debug = log.isDebugEnabled(); - - if (debug) { - log.debug("Setup this artifact with the uuid: " + identifier); - } + log.debug("Setup this artifact with the uuid: " + identifier); super.setup(identifier, factory, context, callMeta, data); @@ -208,9 +201,7 @@ String name = getName(); - if (debug) { - log.debug("setup(): Set initial state for artifact '" + name + "'"); - } + log.debug("setup(): Set initial state for artifact '" + name + "'"); if (states == null) { log.error("No states found from which an initial " @@ -241,21 +232,13 @@ } protected void extractOut(Document data) { - log.debug("extractOut"); - String ids = XMLUtils.xpathString(data, XPATH_IDS, + String targetOut = XMLUtils.xpathString(data, XPATH_TARGET_OUT, ArtifactNamespaceContext.INSTANCE); + if (targetOut.isEmpty()) { + targetOut = null; + } - log.debug("ids: '" + ids + "'"); - if (ids != null) { - Matcher m = CONTAINS_OUT.matcher(ids); - if (m.matches()) { - boundToOut = m.group(2); - log.debug("Bound to out :'" + boundToOut + "'"); - } - else { - log.debug("does not match"); - } - } + setBoundToOut(targetOut); } /** @@ -264,17 +247,9 @@ * @return the id element value of data document. */ public static String getDatacageIDValue(Document data) { - String ids = XMLUtils.xpathString(data, XPATH_IDS, ArtifactNamespaceContext.INSTANCE); - if (ids != null) { - Matcher m = CONTAINS_OUT.matcher(ids); - if (m.matches()) { - ids = m.group(1); - } - } - return ids; } @@ -977,9 +952,18 @@ * @param facet that defines index and name of facet searched. * @return facet instance or null if not found. */ - public Facet getNativeFacet(Facet facet) { + public Facet getNativeFacet(Facet facet, String outName) { String name = facet.getName(); int index = facet.getIndex(); + if (getBoundToOut() != null && !getBoundToOut().isEmpty() && + !getBoundToOut().equals(outName)) { + log.debug(name + ": not returning facets for " + outName + + " because bound to " + getBoundToOut()); + return null; + } + log.debug("Facet: " + facet.getName()); + log.debug("Bound to out: " + getBoundToOut()); + log.debug("OutName: " + outName); for (List fs: facets.values()) { for (Facet f: fs) { @@ -1497,6 +1481,9 @@ * @param facets List of facets to be stored */ protected void addFacets(String id, List facets) { + for (Facet fac : facets) { + fac.setBoundToOut(getBoundToOut()); + } this.facets.put(id, facets); } @@ -1509,7 +1496,8 @@ // Include uuid, type, name log.debug(" - Name: " + getName()); log.debug(" - UUID: " + identifier()); - log.debug(" - Class: " + this.getClass().getName()); + log.debug(" - Class: " + getClass().getName()); + log.debug(" - BoundToOut: " + getBoundToOut()); log.debug("------ DUMP DATA ------"); Collection allData = data.values(); @@ -1545,6 +1533,7 @@ List fs = entry.getValue(); for (Facet f: fs) { log.debug(" # " + out + " : " + f.getName()); + log.debug(" # boundToOut : " + f.getBoundToOut()); } } @@ -1618,11 +1607,23 @@ * @return List of Facets belonging to the state identifier */ protected List getFacets(String stateid) { - return this.facets.get(stateid); + return facets.get(stateid); } public String getBoundToOut() { return boundToOut; } + + /** + * Binds this artifact and all its facet to an out + */ + public void setBoundToOut(String out) { + boundToOut = out; + for (List stateFacets: facets.values()) { + for (Facet fac: stateFacets) { + fac.setBoundToOut(out); + } + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java Tue Jun 11 09:40:56 2013 +0200 @@ -240,7 +240,7 @@ protected void initialize(Artifact artifact, Object context, CallMeta meta) { logger.debug("MainValuesArtifact.initialize"); D4EArtifact winfo = (D4EArtifact) artifact; - RangeAccess rangeAccess = new RangeAccess(winfo, null); + RangeAccess rangeAccess = new RangeAccess(winfo); double [] locations = rangeAccess.getKmRange(); if (locations != null) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/StaticD4EArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticD4EArtifact.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/StaticD4EArtifact.java Tue Jun 11 09:40:56 2013 +0200 @@ -18,6 +18,8 @@ import org.dive4elements.artifacts.ArtifactNamespaceContext; import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.ArtifactFactory; +import org.dive4elements.artifacts.CallMeta; import org.dive4elements.artifactdatabase.data.StateData; import org.dive4elements.artifactdatabase.ProtocolUtils; @@ -125,5 +127,17 @@ return outs; } + + @Override + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta callMeta, + Document data) + { + logger.debug("StaticD4EArtifact.setup"); + super.setup(identifier, factory, context, callMeta, data); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java Tue Jun 11 09:40:56 2013 +0200 @@ -242,7 +242,7 @@ return error(new WQKms[0], "no.wst.for.selected.river"); } - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(this); double [] range = rangeAccess.getKmRange(); if (range == null) { return error(new WQKms[0], "no.range.found"); @@ -321,7 +321,7 @@ return error(null, "no.gauge.selected"); } - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(this); double[] locations = rangeAccess.getLocations(); if (locations == null) { @@ -379,7 +379,7 @@ return error(new WQKms[0], "no.river.selected"); } - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(this); double[] locations = rangeAccess.getLocations(); if (locations == null) { @@ -677,7 +677,7 @@ return null; } - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(this); double [] range = rangeAccess.getKmRange(); if (range == null) { logger.warn("no ranges found"); @@ -849,7 +849,7 @@ */ public double[] getKms() { if (isRange()) { - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(this); double [] distance = rangeAccess.getKmRange(); return getKms(distance); @@ -864,7 +864,7 @@ if (!isRange()) { return null; } - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(this); double [] fromTo = rangeAccess.getKmRange(); if (fromTo == null) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedDifferencesAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -22,14 +22,14 @@ extends RiverAccess { private static Logger logger = Logger.getLogger(BedDifferencesAccess.class); - private String yearEpoch; - private String[] diffs; - private CallContext context; + private String yearEpoch; + private String [] diffs; - public BedDifferencesAccess(D4EArtifact artifact, CallContext context) { + private String [][] differenceArtifactIds; + + public BedDifferencesAccess(D4EArtifact artifact) { super(artifact); - this.context = context; } public String getYearEpoch() { @@ -37,20 +37,62 @@ return yearEpoch; } - public D4EArtifact[][] getDifferenceArtifacts() { - diffs = getString("diffids").split("#"); - logger.debug("diffs: " + Arrays.toString(diffs)); - D4EArtifact[][] artifacts = new D4EArtifact[diffs.length/2][2]; - for (int i = 0; i < diffs.length; i += 2) { + public String [] getDiffs() { + if (diffs == null) { + diffs = getString("diffids").split("#"); + if (logger.isDebugEnabled()) { + logger.debug("diffs: " + Arrays.toString(diffs)); + } + } + return diffs; + } + + public String[][] getDifferenceArtifactIds() { + + if (differenceArtifactIds == null) { + String [] diffs = getDiffs(); + differenceArtifactIds = new String[diffs.length/2][2]; + for (int i = 0; i < diffs.length/2; i++) { + String diff1 = StringUtil.unbracket(diffs[0 + 2*i]); + String diff2 = StringUtil.unbracket(diffs[1 + 2*i]); + String[] diff1parts = diff1.split(";"); + String[] diff2parts = diff2.split(";"); + if (logger.isDebugEnabled()) { + logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]); + } + differenceArtifactIds[i][0] = diff1parts[0]; + differenceArtifactIds[i][1] = diff2parts[0]; + } + } + + return differenceArtifactIds; + } + + public String[] getDifferenceArtifactNamePairs() { + + String [] diffs = getDiffs(); + String [] result = new String[diffs.length/2]; + for (int i = 0; i < diffs.length/2; i++) { String diff1 = StringUtil.unbracket(diffs[0 + 2*i]); String diff2 = StringUtil.unbracket(diffs[1 + 2*i]); String[] diff1parts = diff1.split(";"); String[] diff2parts = diff2.split(";"); - logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]); - artifacts[i][0] = RiverUtils.getArtifact(diff1parts[0], context); - artifacts[i][1] = RiverUtils.getArtifact(diff2parts[0], context); + result[i] = diff1parts[3] + " - " + diff2parts[3]; } - return artifacts; + + return result; + } + + public int [][] extractHeightIds(CallContext context) { + String [][] artifactsIds = getDifferenceArtifactIds(); + int [][] ids = new int[artifactsIds.length][2]; + for (int i = 0; i < artifactsIds.length; ++i) { + D4EArtifact a1 = RiverUtils.getArtifact(artifactsIds[i][0], context); + D4EArtifact a2 = RiverUtils.getArtifact(artifactsIds[i][1], context); + ids[i][0] = getHeightId(a1); + ids[i][1] = getHeightId(a2); + } + return ids; } public static int getHeightId(D4EArtifact artifact) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedHeightAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -10,8 +10,6 @@ import java.util.List; -import org.dive4elements.artifacts.CallContext; - import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.minfo.BedHeight; import org.dive4elements.river.artifacts.model.minfo.BedHeightFactory; @@ -35,8 +33,8 @@ private String time; - public BedHeightAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public BedHeightAccess(D4EArtifact artifact) { + super(artifact); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedQualityAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedQualityAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/BedQualityAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,6 +8,7 @@ package org.dive4elements.river.artifacts.access; +import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; @@ -33,7 +34,7 @@ public BedQualityAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + super(artifact); } public List getDateRanges() { @@ -48,6 +49,9 @@ if (bedDiameter == null && value != null) { bedDiameter = extractDiameter(value); } + if (bedDiameter == null) { + return new ArrayList(); + } return bedDiameter; } @@ -56,6 +60,9 @@ if (bedloadDiameter == null && value != null) { bedloadDiameter = extractDiameter(value); } + if (bedloadDiameter == null) { + return new ArrayList(); + } return bedloadDiameter; } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/Calculation4Access.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/Calculation4Access.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/Calculation4Access.java Tue Jun 11 09:40:56 2013 +0200 @@ -34,7 +34,7 @@ public Calculation4Access(D4EArtifact artifact) { - super(artifact, null); + super(artifact); } public List getSegments() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/ExtremeAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/ExtremeAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/ExtremeAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,8 +8,6 @@ package org.dive4elements.river.artifacts.access; -import org.dive4elements.artifacts.CallContext; - import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.RangeWithValues; @@ -38,8 +36,8 @@ protected List ranges; - public ExtremeAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public ExtremeAccess(D4EArtifact artifact) { + super(artifact); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,7 +8,6 @@ package org.dive4elements.river.artifacts.access; -import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; import java.util.Arrays; @@ -33,8 +32,8 @@ protected String function; - public FixAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public FixAccess(D4EArtifact artifact) { + super(artifact); } public Long getStart() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixAnalysisAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixAnalysisAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixAnalysisAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -9,7 +9,6 @@ package org.dive4elements.river.artifacts.access; import org.dive4elements.artifactdatabase.data.StateData; -import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; @@ -30,8 +29,8 @@ protected double [] qs; - public FixAnalysisAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public FixAnalysisAccess(D4EArtifact artifact) { + super(artifact); } public DateRange getReferencePeriod() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixRealizingAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixRealizingAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FixRealizingAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,7 +8,6 @@ package org.dive4elements.river.artifacts.access; -import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.Segment; @@ -28,8 +27,8 @@ protected List segments; - public FixRealizingAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public FixRealizingAccess(D4EArtifact artifact) { + super(artifact); } public Boolean isQ() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/FlowVelocityAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FlowVelocityAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/FlowVelocityAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,8 +8,6 @@ package org.dive4elements.river.artifacts.access; -import org.dive4elements.artifacts.CallContext; - import org.dive4elements.river.artifacts.D4EArtifact; @@ -21,8 +19,8 @@ private int[] mainChannels; private int[] totalChannels; - public FlowVelocityAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public FlowVelocityAccess(D4EArtifact artifact) { + super(artifact); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/GaugeAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/GaugeAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/GaugeAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; -import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.utils.RiverUtils; @@ -21,8 +20,8 @@ { private static Logger logger = Logger.getLogger(GaugeAccess.class); - public GaugeAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public GaugeAccess(D4EArtifact artifact) { + super(artifact); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/MapAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/MapAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/MapAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.List; -import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; @@ -20,8 +19,8 @@ extends RangeAccess { - public MapAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public MapAccess(D4EArtifact artifact) { + super(artifact); } public List getHWS() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,10 +8,10 @@ package org.dive4elements.river.artifacts.access; +import gnu.trove.TDoubleArrayList; + import org.apache.log4j.Logger; -import gnu.trove.TDoubleArrayList; -import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.WINFOArtifact; @@ -25,8 +25,6 @@ { private static Logger logger = Logger.getLogger(RangeAccess.class); - private CallContext context; - public static enum KM_MODE { RANGE, LOCATIONS, NONE }; double[] kmRange; @@ -40,9 +38,8 @@ private KM_MODE mode; - public RangeAccess(D4EArtifact artifact, CallContext context) { + public RangeAccess(D4EArtifact artifact) { super(artifact); - this.context = context; } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/SedimentLoadAccess.java Tue Jun 11 09:40:56 2013 +0200 @@ -12,8 +12,6 @@ import org.apache.log4j.Logger; -import org.dive4elements.artifacts.CallContext; - import org.dive4elements.river.artifacts.D4EArtifact; @@ -22,14 +20,11 @@ { private static final Logger logger = Logger.getLogger(BedHeightAccess.class); - private int[] singleIDs; - private int[] epochIDs; - private String time; private String unit; - public SedimentLoadAccess(D4EArtifact artifact, CallContext context) { - super(artifact, context); + public SedimentLoadAccess(D4EArtifact artifact) { + super(artifact); } public Double getLowerKM() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/Recommendations.java Tue Jun 11 09:40:56 2013 +0200 @@ -257,6 +257,7 @@ new ArrayList(3); Connection userConnection = userId != null + || parameters.containsKey("ARTIFACT-ID") ? DBConfig .getInstance() .getDBConnection() diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java Tue Jun 11 09:40:56 2013 +0200 @@ -298,7 +298,7 @@ } catch (XPathExpressionException xee) { log.warn("unable to apply filter expression '" + - filter + "' to dataset."); + filter + "' to dataset.", xee); } finally { frames.leave(); @@ -517,6 +517,7 @@ String [] origColumns = rd.getColumnLabels(); int index = origColumns.length; String [] newColumns = Arrays.copyOf(origColumns, index+1); + newColumns[index] = name.toUpperCase(); ResultData result = new ResultData(newColumns); fillResult(result, rd, index, index+1, expr, returnType); return result; @@ -535,17 +536,15 @@ } protected void fillResult( - ResultData result, - ResultData rd, - int index, - int size, + ResultData result, + ResultData rd, + int index, + int size, XPathExpression expr, - QName returnType + QName returnType ) { - List rows = rd.getRows(); String [] origColumns = rd.getColumnLabels(); - for (int i = 0, R = rows.size(); i < R; ++i) { - Object [] row = rows.get(i); + for (Object [] row: rd.getRows()) { frames.enter(); try { frames.put(origColumns, row); @@ -769,23 +768,11 @@ /** Get macro node children, not resolving bodies. */ protected NodeList getMacroChildren(String name) { - NodeList macros = template.getElementsByTagNameNS( - DC_NAMESPACE_URI, "macro"); - - Element macro = null; - for (int i = 0, N = macros.getLength(); i < N; ++i) { - Element m = (Element) macros.item(i); - if (name.equals(m.getAttribute("name"))) { - macro = m; - break; - } - } - - if (macro != null) { - return macro.getChildNodes(); - } - return null; + Element macro = macros.get(name); + return macro != null + ? macro.getChildNodes() + : null; } protected void ifClause(Node parent, Element current) diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java Tue Jun 11 09:40:56 2013 +0200 @@ -9,11 +9,11 @@ package org.dive4elements.river.artifacts.datacage.templating; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.HashMap; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -38,24 +38,32 @@ public static final double FAR_AWAY = 99999d; - public static final class Entry { + protected static final class Entry { - String name; + Entry next; XPathFunction function; int arity; - public Entry() { + public Entry(Entry next, XPathFunction function, int arity) { + this.next = next; + this.function = function; + this.arity = arity; } - public Entry(String name, XPathFunction function, int arity) { - this.name = name; - this.function = function; - this.arity = arity; + XPathFunction find(int arity) { + Entry current = this; + while (current != null) { + if (current.arity == arity) { + return current.function; + } + current = current.next; + } + return null; } } // class Entry /** List of functions. */ - protected List functions; + protected Map functions; protected Builder.BuildHelper buildHelper; @@ -67,7 +75,7 @@ public FunctionResolver(Builder.BuildHelper buildHelper) { this.buildHelper = buildHelper; - functions = new ArrayList(); + functions = new HashMap(); addFunction("contains", 2, new XPathFunction() { @Override @@ -97,6 +105,13 @@ } }); + addFunction("replace-all", 3, new XPathFunction() { + @Override + public Object evaluate(List args) throws XPathFunctionException { + return replaceAll(args); + } + }); + addFunction("has-result", 0, new XPathFunction() { @Override public Object evaluate(List args) throws XPathFunctionException { @@ -124,6 +139,18 @@ return FunctionResolver.this.buildHelper.frames.dump(); } }); + + addFunction("get", 1, new XPathFunction() { + @Override + public Object evaluate(List args) throws XPathFunctionException { + Object o = args.get(0); + if (o instanceof String) { + return FunctionResolver.this.buildHelper.frames.getNull( + (String)o, StackFrames.NULL); + } + return StackFrames.NULL; + } + }); } /** @@ -133,7 +160,15 @@ * @param function the function itself. */ public void addFunction(String name, int arity, XPathFunction function) { - functions.add(new Entry(name, function, arity)); + Entry entry = functions.get(name); + if (entry == null) { + entry = new Entry(null, function, arity); + functions.put(name, entry); + } + else { + Entry newEntry = new Entry(entry.next, function, arity); + entry.next = newEntry; + } } @Override @@ -143,14 +178,10 @@ return null; } - String name = functionName.getLocalPart(); - for (Entry entry: functions) { - if (entry.arity == arity && entry.name.equals(name)) { - return entry.function; - } - } - - return null; + Entry entry = functions.get(functionName.getLocalPart()); + return entry != null + ? entry.find(arity) + : null; } /** Implementation of case-ignoring dc:contains. */ @@ -203,11 +234,7 @@ Object locations = args.get(1); Object from = args.get(2); - if (!(mode instanceof String)){ - return -FAR_AWAY; - } - - if (mode.equals("locations")) { + if (mode instanceof String && mode.equals("locations")) { if (!(locations instanceof String)) { return -FAR_AWAY; } @@ -230,7 +257,7 @@ return -FAR_AWAY; } } - else if (mode.equals("distance")) { + else { if (!(from instanceof String)) { return -FAR_AWAY; } @@ -242,9 +269,6 @@ return -FAR_AWAY; } } - else { - return -FAR_AWAY; - } } /** Implementation for getting the maximum value of location or distance @@ -255,11 +279,7 @@ Object locations = args.get(1); Object to = args.get(2); - if (!(mode instanceof String)){ - return FAR_AWAY; - } - - if (mode.equals("locations")) { + if (mode instanceof String && mode.equals("locations")) { if (!(locations instanceof String)) { return FAR_AWAY; } @@ -282,7 +302,7 @@ return FAR_AWAY; } } - else if (mode.equals("distance")) { + else { if (!(to instanceof String)) { return FAR_AWAY; } @@ -291,14 +311,11 @@ try { return Double.parseDouble(t); } - catch(NumberFormatException nfe) { + catch (NumberFormatException nfe) { return FAR_AWAY; } } } - else { - return FAR_AWAY; - } } /** Implementation for doing a string replace @@ -309,14 +326,30 @@ Object needle = args.get(1); Object replacement = args.get(2); - if (needle instanceof String && - haystack instanceof String && - replacement instanceof String) { + if (needle instanceof String + && haystack instanceof String + && replacement instanceof String) { return ((String)haystack).replace( (String)needle, (String)replacement); - } else { - return haystack; } + return haystack; + } + + /** Implementation for doing a string replace + * dc:replace-all + */ + public Object replaceAll(List args) throws XPathFunctionException { + Object haystack = args.get(0); + Object needle = args.get(1); + Object replacement = args.get(2); + + if (needle instanceof String + && haystack instanceof String + && replacement instanceof String) { + return ((String)haystack).replaceAll( + (String)needle, (String)replacement); + } + return haystack; } public Object dateFormat(List args) throws XPathFunctionException { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java Tue Jun 11 09:40:56 2013 +0200 @@ -281,6 +281,9 @@ String BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER = "bed_longitudinal_section.sediment_density_toplayer"; String BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER = "bed_longitudinal_section.sediment_density_sublayer"; String BED_QUALITY_BEDLOAD_DIAMETER = "bed_longitudinal_section.bedload_diameter"; + String BED_DIAMETER_DATA_TOP = "bed_longitudinal_section.bed_diameter_data_top"; + String BED_DIAMETER_DATA_SUB = "bed_longitudinal_section.bed_diameter_data_sub"; + String BEDLOAD_DIAMETER_DATA = "bed_longitudinal_section.bedload_diameter_data"; String BED_DIFFERENCE_YEAR = "bedheight_difference.year"; String BED_DIFFERENCE_YEAR_FILTERED = "bedheight_difference.year.filtered"; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/LinearInterpolated.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/LinearInterpolated.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,228 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * 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.model; + +import gnu.trove.TDoubleArrayList; + +import java.io.Serializable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.commons.math.stat.descriptive.moment.StandardDeviation; + +import org.dive4elements.river.artifacts.math.Linear; + +import org.dive4elements.river.utils.EpsilonComparator; + +public class LinearInterpolated +implements Serializable +{ + public static final double EPSILON = 1e-5; + public static final double MULTIPLE_STD_DEV = 4d; + + public static final EpsilonComparator CMP = new EpsilonComparator(EPSILON); + + private TDoubleArrayList xs; + private TDoubleArrayList ys; + + private List gaps; + + public interface Operator { + double evaluate(double y1, double y2); + } // interface Operator + + public static final Operator SUB = new Operator() { + @Override + public double evaluate(double y1, double y2) { + return y1 - y2; + } + }; + + public static final Operator MAX = new Operator() { + @Override + public double evaluate(double y1, double y2) { + return Math.max(y1, y2); + } + }; + + public LinearInterpolated() { + xs = new TDoubleArrayList(); + ys = new TDoubleArrayList(); + } + + public LinearInterpolated(int capacity) { + xs = new TDoubleArrayList(capacity); + ys = new TDoubleArrayList(capacity); + } + + public void add(double x, double y) { + xs.add(x); + ys.add(y); + } + + public int size() { + return xs.size(); + } + + public void pointsInRange(double from, double to, Set points) { + if (from > to) { + double t = from; + from = to; + to = t; + } + for (int i = 0, S = size(); i < S; ++i) { + double x = xs.getQuick(i); + if (x >= from && x <= to) { + points.add(x); + } + } + } + + public boolean inGap(double x) { + if (gaps != null) { + for (Range gap: gaps) { + if (gap.inside(x)) { + return true; + } + } + } + return false; + } + + public void detectGaps(double threshold) { + List gabs = new ArrayList(); + for (int i = 1, S = size(); i < S; ++i) { + double x0 = xs.getQuick(i-1); + double x1 = xs.getQuick(i); + double minX, maxX; + if (x0 < x1) { minX = x0; maxX = x1; } + else { minX = x1; maxX = x0; } + double diff = maxX - minX - 2d*EPSILON; + if (diff > threshold) { + gaps.add(new Range(minX+EPSILON, maxX-EPSILON)); + } + } + this.gaps = gaps.isEmpty() ? null : gabs; + } + + public void resetGaps() { + gaps = null; + } + + public double guessGapThreshold() { + return guessGapThreshold(MULTIPLE_STD_DEV); + } + + public double guessGapThreshold(double scale) { + int S = size(); + if (S < 5) { // Too less points. + return Double.MAX_VALUE; + } + + StandardDeviation s = new StandardDeviation(); + + for (int i = 1; i < S; ++i) { + double diff = Math.abs(xs.getQuick(i-1) - xs.getQuick(i)); + s.increment(diff); + } + + return scale*s.getResult(); + } + + public double value(double x) { + for (int i = 0, S = size(); i < S; ++i) { + double x1 = xs.getQuick(i); + if (Math.abs(x1 - x) < EPSILON) { + return ys.getQuick(i); + } + if (i > 0) { + double x0 = xs.getQuick(i-1); + double minX, maxX; + if (x0 < x1) { minX = x0; maxX = x1; } + else { minX = x1; maxX = x0; } + if (x > minX && x < maxX) { + return Linear.linear( + x, + x0, x1, + ys.getQuick(i-1), ys.getQuick(i)); + } + } + } + return Double.NaN; + } + + public LinearInterpolated sub( + LinearInterpolated other, + double from, + double to + ) { + return apply(SUB, other, from, to); + } + + public LinearInterpolated max( + LinearInterpolated other, + double from, + double to + ) { + return apply(MAX, other, from, to); + } + + public boolean intersect(LinearInterpolated other) { + if (xs.isEmpty() || other.xs.isEmpty()) { + return false; + } + + double tMax = xs.max(); + double oMin = other.xs.min(); + if (tMax < oMin) { + return false; + } + + double tMin = xs.min(); + double oMax = other.xs.max(); + return !(tMin > oMax); + } + + public LinearInterpolated apply( + Operator operator, + LinearInterpolated other, + double from, + double to + ) { + LinearInterpolated result = new LinearInterpolated(); + if (!intersect(other)) { + return result; + } + + Set points = new TreeSet(CMP); + points.add(from); + points.add(to); + + this .pointsInRange(from, to, points); + other.pointsInRange(from, to, points); + + + for (double x: points) { + if (!inGap(x) && !other.inGap(x)) { + double y1 = this .value(x); + double y2 = other.value(x); + double y = operator.evaluate(y1, y2); + if (!Double.isNaN(y)) { + result.add(x, y); + } + } + } + + return result; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedDomFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedDomFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedDomFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -24,13 +24,13 @@ * values are set directly on the Element, the other attributes aren't * touched. */ -public class ManagedDomFacet extends ManagedFacet { +public class ManagedDomFacet extends ManagedFacet +{ protected Element facet; public ManagedDomFacet(Element facet) { super(null, -1, null, null, -1, -1, -1); - this.facet = facet; } @@ -169,6 +169,29 @@ return this.uuid; } + @Override + public String getBoundToOut() { + if (boundToOut == null) { + String bondageAttr = this.facet.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, + "boundToOut"); + if (bondageAttr != null && !bondageAttr.isEmpty()) { + boundToOut = bondageAttr; + } + } + return boundToOut; + } + + + @Override + public void setBoundToOut(String value) { + boundToOut = value; + + facet.setAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX + ":" + "boundToOut", + getBoundToOut()); + } /** * Import into document. diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -41,12 +41,18 @@ public ManagedFacet(String name, int index, String desc, String uuid, int pos, int active, int visible) { + this(name, index, desc, uuid, pos, active, visible, null); + } + + public ManagedFacet(String name, int index, String desc, String uuid, + int pos, int active, int visible, String boundToOut) { super(index, name, desc); this.uuid = uuid; this.position = pos; this.active = active; this.visible = visible; + this.boundToOut = boundToOut; } /** diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacetAdapter.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacetAdapter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/ManagedFacetAdapter.java Tue Jun 11 09:40:56 2013 +0200 @@ -46,7 +46,8 @@ uuid, pos, active, - visible); + visible, + facet.getBoundToOut()); this.facet = facet; } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/extreme/ExtremeCurveFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/extreme/ExtremeCurveFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/extreme/ExtremeCurveFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -95,7 +95,7 @@ logger.debug("A curve at km = " + currentKm); Curve c = curveEntry.getValue(); // Find segment in which the curr. km is located. - ExtremeAccess access = new ExtremeAccess(flys, context); + ExtremeAccess access = new ExtremeAccess(flys); double[] ds = access.getValuesForRange(currentKm); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAnalysisPeriodsFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAnalysisPeriodsFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAnalysisPeriodsFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -13,8 +13,6 @@ import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.FixAnalysisAccess; - import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.model.DateRange; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -69,7 +67,6 @@ if (artifact instanceof D4EArtifact) { D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAvSectorFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAvSectorFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixAvSectorFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -13,8 +13,6 @@ import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.FixAnalysisAccess; - import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -69,7 +67,6 @@ if (artifact instanceof D4EArtifact) { D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixDerivateFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixDerivateFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixDerivateFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -75,7 +75,7 @@ } D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); + FixAnalysisAccess access = new FixAnalysisAccess(flys); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixDeviationFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixDeviationFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixDeviationFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -12,7 +12,6 @@ import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.FixAnalysisAccess; import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -67,7 +66,6 @@ logger.debug("FixDeviationFacet.getData"); if (artifact instanceof D4EArtifact) { D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixEventFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixEventFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixEventFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -50,7 +50,7 @@ public Object getData(Artifact artifact, CallContext context) { logger.debug("FixEventFacet.getData"); - FixRealizingAccess access = new FixRealizingAccess((D4EArtifact) artifact, context); + FixRealizingAccess access = new FixRealizingAccess((D4EArtifact) artifact); int wstColID = access.getEvents()[index]; return WQKmsFactory.getWQKmsCID(wstColID); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalDeviationFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalDeviationFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalDeviationFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -13,8 +13,6 @@ import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.FixAnalysisAccess; - import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -72,7 +70,6 @@ if (artifact instanceof D4EArtifact) { D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalReferenceFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalReferenceFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixLongitudinalReferenceFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -13,8 +13,6 @@ import org.dive4elements.river.artifacts.D4EArtifact; -import org.dive4elements.river.artifacts.access.FixAnalysisAccess; - import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -72,7 +70,6 @@ if (artifact instanceof D4EArtifact) { D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixWQCurveFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixWQCurveFacet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixWQCurveFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -69,7 +69,7 @@ logger.debug("getData"); if (artifact instanceof D4EArtifact) { D4EArtifact flys = (D4EArtifact)artifact; - FixAnalysisAccess access = new FixAnalysisAccess(flys, context); + FixAnalysisAccess access = new FixAnalysisAccess(flys); CalculationResult res = (CalculationResult) flys.compute(context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/HWS.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/HWS.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/HWS.java Tue Jun 11 09:40:56 2013 +0200 @@ -34,7 +34,6 @@ public HWS() { this.geom = null; - // TODO Auto-generated constructor stub } public HWS(String name) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterData.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,27 @@ +package org.dive4elements.river.artifacts.model.minfo; + +import gnu.trove.TDoubleArrayList; + + +public class BedDiameterData +extends BedQualityDiameterResult +{ + + private TDoubleArrayList data; + + public BedDiameterData() { + super(); + } + + public BedDiameterData ( + String type, + TDoubleArrayList kms, + TDoubleArrayList data) { + super(type, kms); + this.data = data; + } + + public double[][] getDiameterData() { + return new double[][]{kms.toNativeArray(), data.toNativeArray()}; + } +} diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterDataFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,93 @@ +package org.dive4elements.river.artifacts.model.minfo; + +import gnu.trove.TDoubleArrayList; + +import org.apache.log4j.Logger; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.access.BedQualityAccess; +import org.dive4elements.river.artifacts.model.DataFacet; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; + +public class BedDiameterDataFacet +extends DataFacet +{ + private static final Logger logger = Logger.getLogger(BedDiameterDataFacet.class); + + public BedDiameterDataFacet() { + } + + public BedDiameterDataFacet( + int ndx, + String name, + String description, + ComputeType type, + String stateId, + String hash + ) { + super(ndx, name, description, type, hash, stateId); + } + + public Object getData(Artifact artifact, CallContext context) { + D4EArtifact d4e = (D4EArtifact) artifact; + BedQualityAccess access = new BedQualityAccess(d4e, context); + int ndx = getIndex() & 7; + int top = (getIndex() >> 3) & 1; + int diam = (getIndex() >> 4); + String diameter = ""; + switch (diam) { + case 1: diameter = "d10"; break; + case 2: diameter = "d16"; break; + case 3: diameter = "d20"; break; + case 4: diameter = "d25"; break; + case 5: diameter = "d30"; break; + case 6: diameter = "d40"; break; + case 7: diameter = "d50"; break; + case 8: diameter = "d60"; break; + case 9: diameter = "d70"; break; + case 10: diameter = "d75"; break; + case 11: diameter = "d80"; break; + case 12: diameter = "d84"; break; + case 13: diameter = "d90"; break; + case 14: diameter = "dmin"; break; + case 15: diameter = "dmax"; break; + case 16: diameter = "dm"; break; + default: return null; + } + + QualityMeasurements measurements = + QualityMeasurementFactory.getBedMeasurements( + access.getRiver(), + access.getFrom(), + access.getTo(), + access.getDateRanges().get(ndx).getFrom(), + access.getDateRanges().get(ndx).getTo()); + TDoubleArrayList kms = new TDoubleArrayList(); + TDoubleArrayList data = new TDoubleArrayList(); + for (QualityMeasurement m : measurements.getMeasurements()) { + if (top == 1 && m.getDepth1() == 0d && m.getDepth2() <= 0.3) { + kms.add(m.getKm()); + data.add(m.getDiameter(diameter) * 1000); + } + else if (top == 0 && m.getDepth1() > 0d && m.getDepth2() <= 0.5){ + kms.add(m.getKm()); + data.add(m.getDiameter(diameter) * 1000); + } + } + BedDiameterData bdd = new BedDiameterData(diameter, kms, data); + return bdd; + } + + /** Copy deeply. */ + @Override + public Facet deepCopy() { + BedDiameterDataFacet copy = new BedDiameterDataFacet(); + copy.set(this); + copy.type = type; + copy.hash = hash; + copy.stateId = stateId; + return copy; + } +} diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Tue Jun 11 09:40:56 2013 +0200 @@ -5,18 +5,15 @@ * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ - package org.dive4elements.river.artifacts.model.minfo; import gnu.trove.TDoubleArrayList; import java.util.Date; -import java.util.LinkedList; -import java.util.List; import org.apache.log4j.Logger; -import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.access.BedDifferencesAccess; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.CalculationResult; @@ -25,25 +22,23 @@ public class BedDiffCalculation extends Calculation { + private static final Logger logger = + Logger.getLogger(BedDiffCalculation.class); - private static final Logger logger = Logger - .getLogger(BedDiffCalculation.class); - - protected String river; - protected String yearEpoch; - protected D4EArtifact[][] artifacts; + protected String river; + protected String yearEpoch; + protected int [][] heightIds; public BedDiffCalculation() { } - public CalculationResult calculate(BedDifferencesAccess access) { + public CalculationResult calculate(BedDifferencesAccess access, CallContext context) { logger.info("BedDiffCalculation.calculate"); - String river = access.getRiver(); - String yearEpoch = access.getYearEpoch(); - D4EArtifact[][] artifacts = access.getDifferenceArtifacts(); + String river = access.getRiver(); + String yearEpoch = access.getYearEpoch(); + int [][] heightIds = access.extractHeightIds(context); - logger.debug("got artifacts: " + artifacts.length + "; " + artifacts[0].length); if (river == null) { // TODO: i18n addProblem("minfo.missing.river"); @@ -53,14 +48,10 @@ addProblem("minfo.missing.year_epoch"); } - if (artifacts == null) { - addProblem("minfo.missing.differences"); - } - if (!hasProblems()) { - this.river = river; + this.river = river; this.yearEpoch = yearEpoch; - this.artifacts = artifacts; + this.heightIds = heightIds; return internalCalculate(); } @@ -69,116 +60,106 @@ private CalculationResult internalCalculate() { - if (yearEpoch.equals("year")) { - List results = - new LinkedList(); + BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length]; - for (int i = 0; i < artifacts.length; i++) { - BedHeight[] pair = - getHeightPair(artifacts[i][0], artifacts[i][1], "single"); - BedDiffYearResult res = calculateYearDifference(pair); - results.add(res); + for (int i = 0; i < heightIds.length; i++) { + BedHeight [] pair = getHeightPair(heightIds[i], "single"); + results[i] = calculateYearDifference(pair); + } + return new CalculationResult(results, this); + // Currently epochs are handled like single years. To handle epochs + // uncomment the follwing code and use an if-clause in the code above. +/* + if (yearEpoch.equals("epoch")) { + BedDiffEpochResult [] results = new BedDiffEpochResult[heightIds.length]; + + for (int i = 0; i < heightIds.length; i++) { + BedHeight[] pair = getHeightPair(heightIds[i], "epoch"); + results[i] = calculateEpochDifference(pair); } - return new CalculationResult( - results.toArray(new BedDiffYearResult[results.size()]), this); - } - if (yearEpoch.equals("epoch")) { - List results = - new LinkedList(); - for (int i = 0; i < artifacts.length; i++) { - BedHeight[] pair = - getHeightPair(artifacts[i][0], artifacts[i][1], "epoch"); - BedDiffEpochResult res = calculateEpochDifference(pair); - results.add(res); - } - return new CalculationResult( - results.toArray(new BedDiffEpochResult[results.size()]), this); + return new CalculationResult(results, this); } return new CalculationResult(); + */ } - private BedHeight[] getHeightPair( - D4EArtifact art1, - D4EArtifact art2, - String type - ) { - int id1 = BedDifferencesAccess.getHeightId(art1); - int id2 = BedDifferencesAccess.getHeightId(art2); - - BedHeight[] heights = new BedHeight[2]; - heights[0] = BedHeightFactory.getHeight(type, id1, 0); - heights[1] = BedHeightFactory.getHeight(type, id2, 0); - return heights; + private static BedHeight [] getHeightPair(int [] ids, String type) { + return new BedHeight [] { + BedHeightFactory.getHeight(type, ids[0], 0), + BedHeightFactory.getHeight(type, ids[1], 0) + }; } private BedDiffEpochResult calculateEpochDifference(BedHeight[] pair) { - TDoubleArrayList stations = pair[0].getStations(); - TDoubleArrayList diffRes = new TDoubleArrayList(); - TDoubleArrayList kms = new TDoubleArrayList(); - TDoubleArrayList heights1 = new TDoubleArrayList(); - TDoubleArrayList heights2 = new TDoubleArrayList(); + BedHeight bh1 = pair[0]; + BedHeight bh2 = pair[1]; - for (int i = 0; i < stations.size(); i++) { - if (!Double.isNaN(pair[0].getHeight(stations.get(i))) && - !Double.isNaN(pair[1].getHeight(stations.get(i)))) { - double hDiff = - pair[0].getHeight(stations.get(i)) - - pair[1].getHeight(stations.get(i)); + TDoubleArrayList stations = bh1.getStations(); + int size = stations.size(); + + TDoubleArrayList diffRes = new TDoubleArrayList(size); + TDoubleArrayList kms = new TDoubleArrayList(size); + TDoubleArrayList heights1 = new TDoubleArrayList(size); + TDoubleArrayList heights2 = new TDoubleArrayList(size); + + for (int i = 0; i < size; i++) { + double station = stations.getQuick(i); + double h1 = bh1.getHeight(station); + double h2 = bh2.getHeight(station); + double hDiff = h1 - h2; + if (!Double.isNaN(hDiff)) { diffRes.add(hDiff); - kms.add(stations.get(i)); - heights1.add(pair[0].getHeight(stations.get(i))); - heights2.add(pair[1].getHeight(stations.get(i))); + kms.add(station); + heights1.add(h1); + heights2.add(h2); } } - Date start = ((BedHeightEpoch)pair[0]).getStart(); - Date end = ((BedHeightEpoch)pair[1]).getEnd(); + Date start = ((BedHeightEpoch)bh1).getStart(); + Date end = ((BedHeightEpoch)bh2).getEnd(); return new BedDiffEpochResult(kms, diffRes, heights1, heights2, start, end); } private BedDiffYearResult calculateYearDifference(BedHeight[] pair) { - TDoubleArrayList stations = pair[0].getStations(); - TDoubleArrayList diffRes = new TDoubleArrayList(); - TDoubleArrayList kms = new TDoubleArrayList(); - TDoubleArrayList morphs = new TDoubleArrayList(); - TDoubleArrayList absolute = new TDoubleArrayList(); - TDoubleArrayList gap = new TDoubleArrayList(); - TDoubleArrayList heights1 = new TDoubleArrayList(); - TDoubleArrayList heights2 = new TDoubleArrayList(); - BedHeightSingle s1 = (BedHeightSingle)pair[0]; BedHeightSingle s2 = (BedHeightSingle)pair[1]; - int range = s1.getYear() - s2.getYear(); - if (range < 0) { - range = range * -1; - } - for (int i = 0; i < stations.size(); i++) { - if (!Double.isNaN(s1.getHeight(stations.get(i))) && - !Double.isNaN(s2.getHeight(stations.get(i)))) { - double hDiff = - s1.getHeight(stations.get(i)) - - s2.getHeight(stations.get(i)); + + TDoubleArrayList stations = s1.getStations(); + int size = stations.size(); + + TDoubleArrayList diffRes = new TDoubleArrayList(size); + TDoubleArrayList kms = new TDoubleArrayList(size); + TDoubleArrayList morphs = new TDoubleArrayList(size); + TDoubleArrayList absolute = new TDoubleArrayList(size); + TDoubleArrayList gap = new TDoubleArrayList(size); + TDoubleArrayList heights1 = new TDoubleArrayList(size); + TDoubleArrayList heights2 = new TDoubleArrayList(size); + + int range = Math.abs(s1.getYear() - s2.getYear()); + + for (int i = 0; i < size; i++) { + double station = stations.getQuick(i); + double h1 = s1.getHeight(station); + double h2 = s2.getHeight(station); + double hDiff = h1 - h2; + + if (!Double.isNaN(hDiff)) { diffRes.add(hDiff); - double km = stations.get(i); - kms.add(km); - if (s1.getMorphWidth(km) > - s2.getMorphWidth(km)) { - morphs.add(s1.getMorphWidth(km)); - } - else { - morphs.add(s2.getMorphWidth(km)); - } - if (s1.getDataGap(km) > s2.getDataGap(km)) { - gap.add(s1.getDataGap(km)); - } - else { - gap.add(s2.getDataGap(km)); - } - absolute.add((hDiff / range) * 100); - heights1.add(s1.getHeight(km)); - heights2.add(s2.getHeight(km)); + kms.add(station); + + morphs.add(Math.max( + s1.getMorphWidth(station), + s2.getMorphWidth(station))); + + gap.add(Math.max( + s1.getDataGap(station), + s2.getDataGap(station))); + + absolute.add((hDiff / range) * 100d); + heights1.add(h1); + heights2.add(h2); } } return new BedDiffYearResult( diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Tue Jun 11 09:40:56 2013 +0200 @@ -90,7 +90,7 @@ /** Get name of the second BedHeight (subtrahend). */ public String getNameSecond() { - return this.nameFirst; + return this.nameSecond; } public void addMorphWidth(double value) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,79 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * 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.model.minfo; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.log4j.Logger; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRField; + + +/** + * @author Andre Heinecke + */ +public class BedDifferenceJRDataSource implements JRDataSource +{ + /** The logger used in this exporter.*/ + private static Logger logger = Logger.getLogger(BedDifferenceJRDataSource.class); + + private ArrayList data; + private HashMap metaData; + + private int index = -1; + + public BedDifferenceJRDataSource() { + data = new ArrayList(); + metaData = new HashMap(); + } + + public void addData(String[] val) { + data.add(val); + } + + public void addMetaData(String key, String value) { + metaData.put(key, value); + } + + public boolean next() throws JRException { + index++; + return (index < data.size()); + } + + public Object getFieldValue(JRField field) throws JRException { + Object value = ""; + String fieldName = field.getName(); + if ("river".equals(fieldName)) { + value = metaData.get("river"); + } + else if ("calculation".equals(fieldName)) { + value = metaData.get("calculation"); + } + else if ("ye_mode".equals(fieldName)) { + value = metaData.get("ye_mode"); + } + else if ("date".equals(fieldName)) { + value = metaData.get("date"); + } + else if ("differences".equals(fieldName)) { + value = metaData.get("differences"); + } + else if ("km".equals(fieldName)) { + value = data.get(index)[0]; + } + else if ("meter".equals(fieldName)) { + value = data.get(index)[1]; + } + return value; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeight.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeight.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeight.java Tue Jun 11 09:40:56 2013 +0200 @@ -78,10 +78,8 @@ } public double getHeight(double station) { - if (this.station.indexOf(station) >= 0) { - return this.heights.get(this.station.indexOf(station)); - } - return Double.NaN; + int index = this.station.indexOf(station); + return index >= 0 ? heights.getQuick(index) : Double.NaN; } diff -r a3fb76cf79b6 -r e8f152163a1e 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 Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -38,7 +38,7 @@ */ @Override public Object getData(Artifact artifact, CallContext context) { - BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact, context); + BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); if (type.equals("singlevalues")) { return access.getSingleValues(); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingle.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingle.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingle.java Tue Jun 11 09:40:56 2013 +0200 @@ -51,25 +51,21 @@ } public double getMorphWidth(int idx) { - return this.morphWidth.get(idx); + return this.morphWidth.getQuick(idx); } public double getDataGap(int idx) { - return this.data_gap.get(idx); + return this.data_gap.getQuick(idx); } public double getMorphWidth(double station) { - if (this.station.indexOf(station) >= 0) { - return this.morphWidth.get(this.station.indexOf(station)); - } - return Double.NaN; + int index = this.station.indexOf(station); + return index >= 0 ? morphWidth.getQuick(index): Double.NaN; } public double getDataGap(double station) { - if (this.station.indexOf(station) >= 0) { - return this.getDataGap(this.station.indexOf(station)); - } - return Double.NaN; + int index = this.station.indexOf(station); + return index >= 0 ? data_gap.getQuick(index) : Double.NaN; } public double[] getMorphWidths() { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java Tue Jun 11 09:40:56 2013 +0200 @@ -253,7 +253,7 @@ List measurements = qm.getMeasurements(km); double mid = calculateAverage(measurements, diameter); location.add(km); - avDiameter.add(mid); + avDiameter.add(mid * 1000); } return new BedloadDiameterResult( diameter, @@ -299,22 +299,25 @@ public double calculateDeviation(QualityMeasurement qm) { Map dm = qm.getAllDiameter(); - double phiM = 0; - double[] phis = new double[dm.size()]; - double[] ps = new double[dm.size()]; + int size = dm.size(); + + double phiM = 0; + double [] phis = new double[size]; + double [] ps = new double[size]; + double scale = -1d/Math.log(2d); + int i = 0; - for (String key : dm.keySet()) { - double d = dm.get(key); - double phi = -Math.log(d)/Math.log(2); + for (Map.Entry entry: dm.entrySet()) { + double phi = scale*Math.log(entry.getValue()); + double p = calculateWeight(qm, entry.getKey()); + phiM += phi * p; + ps[i] = p; phis[i] = phi; - double p = calculateWeight(qm, key); - ps[i] = p; - phiM += phi * p; i++; } double sig = 0d; - for (i = 0; i < dm.size(); i++) { + for (i = 0; i < size; i++) { sig += ps[i] * Math.exp(phis[i] - phiM); } double deviation = Math.sqrt(sig); @@ -331,7 +334,7 @@ double sum = 0d; for (Double d : dm.values()) { - sum =+ d.doubleValue(); + sum += d.doubleValue(); } double weight = sum/100*value; return weight; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,87 @@ +package org.dive4elements.river.artifacts.model.minfo; + +import gnu.trove.TDoubleArrayList; + +import org.apache.log4j.Logger; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.access.BedQualityAccess; +import org.dive4elements.river.artifacts.model.DataFacet; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; + + +public class BedloadDiameterDataFacet +extends DataFacet +{ + private static final Logger logger = Logger.getLogger(BedDiameterDataFacet.class); + + public BedloadDiameterDataFacet() { + } + + public BedloadDiameterDataFacet( + int ndx, + String name, + String description, + ComputeType type, + String stateId, + String hash + ) { + super(ndx, name, description, type, hash, stateId); + } + + public Object getData(Artifact artifact, CallContext context) { + D4EArtifact d4e = (D4EArtifact) artifact; + BedQualityAccess access = new BedQualityAccess(d4e, context); + int ndx = getIndex() & 7; + int diam = (getIndex() >> 3); + String diameter = ""; + switch (diam) { + case 1: diameter = "d10"; break; + case 2: diameter = "d16"; break; + case 3: diameter = "d20"; break; + case 4: diameter = "d25"; break; + case 5: diameter = "d30"; break; + case 6: diameter = "d40"; break; + case 7: diameter = "d50"; break; + case 8: diameter = "d60"; break; + case 9: diameter = "d70"; break; + case 10: diameter = "d75"; break; + case 11: diameter = "d80"; break; + case 12: diameter = "d84"; break; + case 13: diameter = "d90"; break; + case 14: diameter = "dmin"; break; + case 15: diameter = "dmax"; break; + case 16: diameter = "dm"; break; + default: return null; + } + + QualityMeasurements measurements = + QualityMeasurementFactory.getBedloadMeasurements( + access.getRiver(), + access.getFrom(), + access.getTo(), + access.getDateRanges().get(ndx).getFrom(), + access.getDateRanges().get(ndx).getTo()); + TDoubleArrayList kms = new TDoubleArrayList(); + TDoubleArrayList data = new TDoubleArrayList(); + for (QualityMeasurement m : measurements.getMeasurements()) { + kms.add(m.getKm()); + data.add(m.getDiameter(diameter)*1000); + } + BedDiameterData bdd = new BedDiameterData(diameter, kms, data); + return bdd; + } + + /** Copy deeply. */ + @Override + public Facet deepCopy() { + BedloadDiameterDataFacet copy = new BedloadDiameterDataFacet(); + copy.set(this); + copy.type = type; + copy.hash = hash; + copy.stateId = stateId; + return copy; + } +} diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQRelationJRDataSource.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQRelationJRDataSource.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,100 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * 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.model.sq; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.apache.log4j.Logger; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRField; + + +/** + * @author Andre Heinecke + */ +public class SQRelationJRDataSource implements JRDataSource +{ + /** The logger used in this exporter.*/ + private static Logger logger = Logger.getLogger(SQRelationJRDataSource.class); + + private ArrayList data; + private HashMap metaData; + + private int index = -1; + + public SQRelationJRDataSource() { + data = new ArrayList(); + metaData = new HashMap(); + } + + public void addData(String[] val) { + data.add(val); + } + + public void addMetaData(String key, String value) { + metaData.put(key, value); + } + + public boolean next() throws JRException { + index++; + return (index < data.size()); + } + + public Object getFieldValue(JRField field) throws JRException { + Object value = ""; + String fieldName = field.getName(); + if ("river".equals(fieldName)) { + value = metaData.get("river"); + } + else if ("date".equals(fieldName)) { + value = metaData.get("date"); + } + else if ("calculation".equals(fieldName)) { + value = metaData.get("calculation"); + } + else if ("location".equals(fieldName)) { + value = metaData.get("location"); + } + else if ("outliers".equals(fieldName)) { + value = metaData.get("outliers"); + } + else if ("outliertest".equals(fieldName)) { + value = metaData.get("outliertest"); + } + else if ("periods".equals(fieldName)) { + value = metaData.get("periods"); + } + else if ("km".equals(fieldName)) { + value = data.get(index)[0]; + } + else if ("param".equals(fieldName)) { + value = data.get(index)[1]; + } + else if ("a".equals(fieldName)) { + value = data.get(index)[2]; + } + else if ("b".equals(fieldName)) { + value = data.get(index)[3]; + } + else if ("total".equals(fieldName)) { + value = data.get(index)[4]; + } + else if ("out".equals(fieldName)) { + value = data.get(index)[5]; + } + else if ("variance".equals(fieldName)) { + value = data.get(index)[6]; + } + return value; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/MainValuesService.java Tue Jun 11 09:40:56 2013 +0200 @@ -79,7 +79,7 @@ } double[] minmax = getRequestedStartEnd(data, river); - Gauge gauge = river.maxOverlap(minmax[0], minmax[1]); + Gauge gauge = river.determineGauge(minmax[0], minmax[1]); if (gauge == null) { return error("no gauge found."); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/DischargeState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DischargeState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DischargeState.java Tue Jun 11 09:40:56 2013 +0200 @@ -9,6 +9,8 @@ package org.dive4elements.river.artifacts.states; import java.util.List; +import java.util.Collections; +import java.util.Comparator; import org.apache.log4j.Logger; @@ -68,9 +70,16 @@ KVP[] kvp = new KVP[zones.size()]; - for (int i = 0, Z = zones.size(); i < Z; i++) { - DischargeZone zone = zones.get(i); + Collections.sort(zones, new Comparator() { + @Override + public int compare(DischargeZone a, DischargeZone b) { + return a.getValue().compareTo(b.getValue()); + } + }); + int i = 0; + + for (DischargeZone zone: zones) { String lower = zone.getLowerDischarge(); String upper = zone.getUpperDischarge(); @@ -80,6 +89,7 @@ else { kvp[i] = new KVP(zone.getId(), lower + " - " + upper); } + i++; } return kvp; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/DistanceOnlySelect.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DistanceOnlySelect.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DistanceOnlySelect.java Tue Jun 11 09:40:56 2013 +0200 @@ -34,7 +34,7 @@ D4EArtifact flys = (D4EArtifact) artifact; try { - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double from = rangeAccess.getFrom(); double to = rangeAccess.getTo(); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/DurationCurveState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DurationCurveState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DurationCurveState.java Tue Jun 11 09:40:56 2013 +0200 @@ -75,7 +75,7 @@ WQDay wqday = (WQDay)res.getData(); if (wqday != null && facets != null) { - RangeAccess rangeAccess = new RangeAccess(winfo, context); + RangeAccess rangeAccess = new RangeAccess(winfo); // Create an i18ed name for a (w or q) duration curve facet. Object[] args = new Object[] { RiverUtils.getRiver(winfo).getName(), diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java Tue Jun 11 09:40:56 2013 +0200 @@ -483,7 +483,7 @@ protected void setRange(D4EArtifact artifact, WSPLGENJob job) { - RangeAccess rangeAccess = new RangeAccess(artifact, null); + RangeAccess rangeAccess = new RangeAccess(artifact); double[] range = rangeAccess.getKmRange(); job.setStart(range[0]); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/FlowVelocityState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FlowVelocityState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FlowVelocityState.java Tue Jun 11 09:40:56 2013 +0200 @@ -70,7 +70,7 @@ List newFacets = new ArrayList(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/HWSBarriersState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/HWSBarriersState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/HWSBarriersState.java Tue Jun 11 09:40:56 2013 +0200 @@ -110,7 +110,7 @@ return null; } - MapAccess access = new MapAccess(artifact, context); + MapAccess access = new MapAccess(artifact); String river = access.getRiver(); HWSContainer hwsLines = HWSFactory.getHWSLines(river); HWSContainer hwsPoints = HWSFactory.getHWSPoints(river); @@ -219,7 +219,6 @@ } private boolean extractUserShp(File dir) { - // TODO Auto-generated method stub File archive = new File(dir, USER_RGD_ZIP); boolean exists = archive.exists(); logger.debug("Zip file exists: " + exists); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/MiddleBedHeight.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/MiddleBedHeight.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/MiddleBedHeight.java Tue Jun 11 09:40:56 2013 +0200 @@ -46,7 +46,7 @@ List newFacets = new ArrayList(); - BedHeightAccess access = new BedHeightAccess(artifact, context); + BedHeightAccess access = new BedHeightAccess(artifact); CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/RangeState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/RangeState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/RangeState.java Tue Jun 11 09:40:56 2013 +0200 @@ -83,7 +83,7 @@ D4EArtifact flys = (D4EArtifact) artifact; try { - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double from = rangeAccess.getFrom(); double to = rangeAccess.getTo(); double step = rangeAccess.getStep(); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WQAdapted.java Tue Jun 11 09:40:56 2013 +0200 @@ -137,7 +137,7 @@ D4EArtifact flysArtifact = (D4EArtifact) artifact; - RangeAccess rangeAccess = new RangeAccess(flysArtifact, context); + RangeAccess rangeAccess = new RangeAccess(flysArtifact); double[] dist = rangeAccess.getKmRange(); // TODO use Access to get River and gauges. River river = RiverUtils.getRiver(flysArtifact); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeCompute.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeCompute.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeCompute.java Tue Jun 11 09:40:56 2013 +0200 @@ -61,7 +61,7 @@ CalculationResult res; - ExtremeAccess access = new ExtremeAccess(artifact, context); + ExtremeAccess access = new ExtremeAccess(artifact); if (old instanceof CalculationResult) { res = (CalculationResult)old; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/extreme/ExtremeQInput.java Tue Jun 11 09:40:56 2013 +0200 @@ -86,7 +86,7 @@ D4EArtifact flysArtifact = (D4EArtifact) artifact; - ExtremeAccess access = new ExtremeAccess(flysArtifact, context); + ExtremeAccess access = new ExtremeAccess(flysArtifact); River river = RiverFactory.getRiver(access.getRiver()); WstValueTable wstValueTable = WstValueTableFactory.getTable(river); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixAnalysisCompute.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixAnalysisCompute.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixAnalysisCompute.java Tue Jun 11 09:40:56 2013 +0200 @@ -133,8 +133,7 @@ CalculationResult res; - FixAnalysisAccess access = - new FixAnalysisAccess(artifact, context); + FixAnalysisAccess access = new FixAnalysisAccess(artifact); if (old instanceof CalculationResult) { res = (CalculationResult)old; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FixRealizingCompute.java Tue Jun 11 09:40:56 2013 +0200 @@ -71,8 +71,7 @@ CalculationResult res; - FixRealizingAccess access = - new FixRealizingAccess(artifact, context); + FixRealizingAccess access = new FixRealizingAccess(artifact); if (old instanceof CalculationResult) { res = (CalculationResult) old; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java Tue Jun 11 09:40:56 2013 +0200 @@ -15,6 +15,8 @@ import org.apache.log4j.Logger; import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifactdatabase.state.FacetActivity; +import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.CallMeta; import org.dive4elements.river.artifacts.D4EArtifact; @@ -24,6 +26,7 @@ import org.dive4elements.river.artifacts.model.DateRange; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.minfo.BedDensityFacet; +import org.dive4elements.river.artifacts.model.minfo.BedDiameterDataFacet; import org.dive4elements.river.artifacts.model.minfo.BedDiameterFacet; import org.dive4elements.river.artifacts.model.minfo.BedDiameterResult; import org.dive4elements.river.artifacts.model.minfo.BedParametersResult; @@ -31,6 +34,7 @@ import org.dive4elements.river.artifacts.model.minfo.BedQualityCalculation; import org.dive4elements.river.artifacts.model.minfo.BedQualityDiameterResult; import org.dive4elements.river.artifacts.model.minfo.BedQualityResult; +import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterDataFacet; import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterFacet; import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterResult; import org.dive4elements.river.artifacts.resources.Resources; @@ -53,8 +57,37 @@ public static final String I18N_FACET_BED_DENSITY_SUBLAYER = "facet.bedquality.bed.density.sublayer"; public static final String I18N_FACET_BED_DIAMETER_TOPLAYER = "facet.bedquality.bed.diameter.toplayer"; public static final String I18N_FACET_BED_DIAMETER_SUBLAYER = "facet.bedquality.bed.diameter.sublayer"; + public static final String I18N_FACET_BED_DIAMETER_DATA_TOPLAYER = "facet.bedquality.bed.diameter.data.toplayer"; + public static final String I18N_FACET_BED_DIAMETER_DATA_SUBLAYER = "facet.bedquality.bed.diameter.data.sublayer"; + public static final String I18N_FACET_BEDLOAD_DIAMETER_DATA = "facet.bedquality.bedload.diameter.data"; public static final String I18N_FACET_BEDLOAD_DIAMETER = "facet.bedquality.bedload.diameter"; + static { + // Active/deactivate facets. + FacetActivity.Registry.getInstance().register( + "minfo", + new FacetActivity() { + @Override + public Boolean isInitialActive( + Artifact artifact, + Facet facet, + String output + ) { + String name = facet.getName(); + if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER) || + name.equals(BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER) || + name.equals(BED_DIAMETER_DATA_TOP) || + name.equals(BED_DIAMETER_DATA_SUB) || + name.equals(BEDLOAD_DIAMETER_DATA)){ + return Boolean.FALSE; + } + else { + return null; + } + } + }); + } + @Override public Object computeAdvance(D4EArtifact artifact, String hash, CallContext context, List facets, Object old) { @@ -80,12 +113,138 @@ generateFacets(context, newFacets, results, getID(), hash); logger.debug("Created " + newFacets.size() + " new Facets."); - + generateDataFacets(context, newFacets, access, getID(), hash); facets.addAll(newFacets); return res; } + private void generateDataFacets( + CallContext context, + List newFacets, + BedQualityAccess access, + String stateId, + String hash) { + List diameters = access.getBedDiameter(); + List loadDiameters = access.getBedloadDiameter(); + List ranges = access.getDateRanges(); + for (int i = 0; i < ranges.size(); i++) { + DateRange range = ranges.get(i); + for (String diameter: diameters) { + int ndxTop = generateIndex(diameter); + int ndxSub = generateIndex(diameter); + ndxTop += 1; + ndxTop = ndxTop << 3; + ndxSub = ndxSub << 3; + ndxTop += i; + ndxSub += i; + String toplayer = + Resources.getMsg( + context.getMeta(), I18N_TOPLAYER, I18N_TOPLAYER); + String sublayer = + Resources.getMsg( + context.getMeta(), I18N_SUBLAYER, I18N_SUBLAYER); + //toplayer + newFacets.add(new BedDiameterDataFacet( + ndxTop, + BED_DIAMETER_DATA_TOP, + Resources.getMsg( + context.getMeta(), + I18N_FACET_BED_DIAMETER_DATA_TOPLAYER, + I18N_FACET_BED_DIAMETER_DATA_TOPLAYER, + new Object[] { diameter.toUpperCase(), + range.getFrom(), range.getTo(), toplayer}), + ComputeType.ADVANCE, + stateId, + hash)); + //sublayer + newFacets.add(new BedDiameterDataFacet( + ndxSub, + BED_DIAMETER_DATA_SUB, + Resources.getMsg( + context.getMeta(), + I18N_FACET_BED_DIAMETER_DATA_TOPLAYER, + I18N_FACET_BED_DIAMETER_DATA_TOPLAYER, + new Object[] { diameter.toUpperCase(), + range.getFrom(), range.getTo(), sublayer}), + ComputeType.ADVANCE, + stateId, + hash)); + } + for (String loadDiameter: loadDiameters) { + int ndx = generateIndex(loadDiameter); + ndx = ndx << 3; + ndx += i; + newFacets.add(new BedloadDiameterDataFacet( + ndx, + BEDLOAD_DIAMETER_DATA, + Resources.getMsg( + context.getMeta(), + I18N_FACET_BEDLOAD_DIAMETER_DATA, + I18N_FACET_BEDLOAD_DIAMETER_DATA, + new Object[] { loadDiameter.toUpperCase(), + range.getFrom(), range.getTo()}), + ComputeType.ADVANCE, + stateId, + hash)); + } + } + } + + private int generateIndex(String diameter) { + int d = 0; + if(diameter.equals("d10")) { + d = 1; + } + else if (diameter.equals("d16")) { + d = 2; + } + else if (diameter.equals("d20")) { + d = 3; + } + else if (diameter.equals("d25")) { + d = 4; + } + else if (diameter.equals("d30")) { + d = 5; + } + else if (diameter.equals("d40")) { + d = 6; + } + else if (diameter.equals("d50")) { + d = 7; + } + else if (diameter.equals("d60")) { + d = 8; + } + else if (diameter.equals("d70")) { + d = 9; + } + else if (diameter.equals("d75")) { + d = 10; + } + else if (diameter.equals("d80")) { + d = 11; + } + else if (diameter.equals("d84")) { + d = 12; + } + else if (diameter.equals("d90")) { + d = 13; + } + else if (diameter.equals("dmin")) { + d = 14; + } + else if (diameter.equals("dmax")) { + d = 15; + } + else if (diameter.equals("dm")) { + d = 16; + } + int ndx = d << 1; + return ndx; + } + protected void generateFacets(CallContext context, List newFacets, BedQualityResult[] results, String stateId, String hash) { logger.debug("BedQualityState.generateFacets"); @@ -126,39 +285,41 @@ hash)); } - BedParametersResult[] bedParameters = result.getParameters(); - for (int j = 0; j < bedParameters.length; j++) { - newFacets.add(new BedPorosityFacet((idx << 8) + j, - BED_QUALITY_POROSITY_TOPLAYER, - createPorosityTopLayerDescription( - meta, - bedParameters[j], - range), - ComputeType.ADVANCE, stateId, hash)); + if (bedDiameter.length > 0) { + BedParametersResult[] bedParameters = result.getParameters(); + for (int j = 0; j < bedParameters.length; j++) { + newFacets.add(new BedPorosityFacet((idx << 8) + j, + BED_QUALITY_POROSITY_TOPLAYER, + createPorosityTopLayerDescription( + meta, + bedParameters[j], + range), + ComputeType.ADVANCE, stateId, hash)); - newFacets.add(new BedPorosityFacet((idx << 8) + j, - BED_QUALITY_POROSITY_SUBLAYER, - createPorositySubLayerDescription( - meta, - bedParameters[j], - range), - ComputeType.ADVANCE, stateId, hash)); + newFacets.add(new BedPorosityFacet((idx << 8) + j, + BED_QUALITY_POROSITY_SUBLAYER, + createPorositySubLayerDescription( + meta, + bedParameters[j], + range), + ComputeType.ADVANCE, stateId, hash)); - newFacets.add(new BedDensityFacet((idx << 8) + j, - BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER, - createDensityTopLayerDescription( - meta, - bedParameters[j], - range), - ComputeType.ADVANCE, stateId, hash)); + newFacets.add(new BedDensityFacet((idx << 8) + j, + BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER, + createDensityTopLayerDescription( + meta, + bedParameters[j], + range), + ComputeType.ADVANCE, stateId, hash)); - newFacets.add(new BedDensityFacet((idx << 8) + j, - BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER, - createDensitySubLayerDescription( - meta, - bedParameters[j], - range), - ComputeType.ADVANCE, stateId, hash)); + newFacets.add(new BedDensityFacet((idx << 8) + j, + BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER, + createDensitySubLayerDescription( + meta, + bedParameters[j], + range), + ComputeType.ADVANCE, stateId, hash)); + } } } } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferenceSelect.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferenceSelect.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferenceSelect.java Tue Jun 11 09:40:56 2013 +0200 @@ -63,7 +63,7 @@ CallContext context) { Element[] elements = new Element[1]; - BedHeightAccess bha = new BedHeightAccess((D4EArtifact)artifact, context); + BedHeightAccess bha = new BedHeightAccess((D4EArtifact)artifact); String time = bha.getYearEpoch(); elements[0] = createItem( ec, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java Tue Jun 11 09:40:56 2013 +0200 @@ -22,6 +22,7 @@ import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.access.BedDifferencesAccess; import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.minfo.BedDiffCalculation; import org.dive4elements.river.artifacts.model.minfo.BedDiffEpochFacet; @@ -71,11 +72,11 @@ List newFacets = new ArrayList(); - BedDifferencesAccess access = - new BedDifferencesAccess(artifact, context); + BedDifferencesAccess access = new BedDifferencesAccess(artifact); - CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old - : new BedDiffCalculation().calculate(access); + CalculationResult res = old instanceof CalculationResult + ? (CalculationResult)old + : new BedDiffCalculation().calculate(access, context); if (facets == null || res == null) { return res; @@ -102,6 +103,8 @@ CallMeta meta = context.getMeta(); + newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); + newFacets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); for (int idx = 0; idx < results.length; idx++) { if (results[idx] instanceof BedDiffYearResult) { newFacets.add(new BedDiffYearFacet( @@ -386,20 +389,20 @@ if (name.equals(BED_DIFFERENCE_EPOCH) || name.equals(BED_DIFFERENCE_EPOCH_HEIGHT1) || name.equals(BED_DIFFERENCE_EPOCH_HEIGHT2) || + name.equals(BED_DIFFERENCE_EPOCH_HEIGHT1_FILTERED) || + name.equals(BED_DIFFERENCE_EPOCH_HEIGHT2_FILTERED) || name.equals(BED_DIFFERENCE_HEIGHT_YEAR) || name.equals(BED_DIFFERENCE_YEAR) || name.equals(BED_DIFFERENCE_YEAR_HEIGHT1) || - name.equals(BED_DIFFERENCE_YEAR_HEIGHT2)) { + name.equals(BED_DIFFERENCE_YEAR_HEIGHT2) || + name.equals(BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED) || + name.equals(BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED)){ return Boolean.FALSE; } else if (name.equals(BED_DIFFERENCE_MORPH_WIDTH) || name.equals(BED_DIFFERENCE_EPOCH_FILTERED) || - name.equals(BED_DIFFERENCE_EPOCH_HEIGHT1_FILTERED) || - name.equals(BED_DIFFERENCE_EPOCH_HEIGHT2_FILTERED) || name.equals(BED_DIFFERENCE_HEIGHT_YEAR_FILTERED) || - name.equals(BED_DIFFERENCE_YEAR_FILTERED) || - name.equals(BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED) || - name.equals(BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED)){ + name.equals(BED_DIFFERENCE_YEAR_FILTERED)) { return Boolean.TRUE; } else { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java Tue Jun 11 09:40:56 2013 +0200 @@ -55,7 +55,7 @@ List newFacets = new ArrayList(); - SedimentLoadAccess access = new SedimentLoadAccess(artifact, context); + SedimentLoadAccess access = new SedimentLoadAccess(artifact); CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old : new SedimentLoadCalculation().calculate(access); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadYearSelect.java Tue Jun 11 09:40:56 2013 +0200 @@ -44,7 +44,7 @@ public boolean validate(Artifact artifact) throws IllegalArgumentException { - SedimentLoadAccess access = new SedimentLoadAccess((D4EArtifact) artifact, null); + SedimentLoadAccess access = new SedimentLoadAccess((D4EArtifact) artifact); // Second year should be later than first. if (access.getPeriod() != null && access.getPeriod()[1] < access.getPeriod()[0]) diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java --- a/artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/collections/AttributeWriter.java Tue Jun 11 09:40:56 2013 +0200 @@ -188,18 +188,23 @@ logger.debug("Compatible facets are " + compatibleFacets); } - for (int i = 0; i < num; i++) { - ManagedFacet facet = (ManagedFacet) newFacets.get(i); + for (Facet fac: newFacets) { + ManagedFacet facet = (ManagedFacet) fac; if (debug) { logger.debug("Try to add Facet: " + facet.getName()); } if (!compatibleFacets.contains(facet.getName())) { - logger.warn("Have incompatible facet, skip: " + facet.getName()); + logger.debug("Have incompatible facet, skip: " + facet.getName()); continue; - } - else { + } else if (facet.getBoundToOut() != null && + !facet.getBoundToOut().equals(outputName)) { + logger.debug("Skip facet " + facet.getName() + + " because it is bound to: " + facet.getBoundToOut()); + continue; + } else { + logger.debug("Facet is bound to: " + facet.getBoundToOut()); logger.debug("Have compatible facet: " + facet.getName()); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Tue Jun 11 09:40:56 2013 +0200 @@ -95,7 +95,7 @@ } River river = RiverUtils.getRiver(master); - RangeAccess rangeAccess = new RangeAccess(master, context); + RangeAccess rangeAccess = new RangeAccess(master); double[] kms = rangeAccess.getLocations(); Gauge gauge = river.determineGaugeByPosition(kms[0]); @@ -111,7 +111,7 @@ gauge.getName(), gauge.getDatum(), interval.getStartTime(), - 100d); + false); } else { // at km @@ -123,7 +123,7 @@ null, null, null, - 0d); + true); } } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATWriter.java Tue Jun 11 09:40:56 2013 +0200 @@ -130,7 +130,7 @@ Date date ) { DateFormat f = DateFormat.getDateInstance(); - out.print(Resources.getMsg( + out.print("*" + Resources.getMsg( callMeta, I18N_AT_GAUGE_HEADER, I18N_AT_GAUGE_HEADER, @@ -144,7 +144,7 @@ String river, double km ) { - out.print(Resources.getMsg( + out.print("*" + Resources.getMsg( callMeta, I18N_AT_HEADER, I18N_AT_HEADER, @@ -160,7 +160,7 @@ String gName, BigDecimal datum, Date date, - double scale) + boolean wOutUnitIsMeter) throws IOException { PrintWriter out = new PrintWriter(writer); @@ -186,7 +186,13 @@ int col = 0; for (double w = startW; w <= maxW; w += 0.01) { if (col == 0) { - out.printf(Locale.US, "%8d", (int)Math.round(w * scale)); + if (wOutUnitIsMeter) { + // For some crazy reason W's at a gauge should be in the + // unit but W's exported elsewhere should be in Meter + out.printf(Locale.US, "%5.2f", w); + } else { + out.printf(Locale.US, "%8d", (int)Math.round(w * 100d)); + } } if (w < minW) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -1432,7 +1432,7 @@ protected double[] getRange() { D4EArtifact flys = (D4EArtifact) master; - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); return rangeAccess.getKmRange(); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java Tue Jun 11 09:40:56 2013 +0200 @@ -129,7 +129,7 @@ logger.debug("ComputedDischargeCurveExporter.writeCSVHeader"); String unit = RiverUtils.getRiver((D4EArtifact) master).getWstUnit().getName(); - RangeAccess access = new RangeAccess((D4EArtifact)master, context); + RangeAccess access = new RangeAccess((D4EArtifact)master); double[] km = access.getLocations(); String header = msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }); @@ -218,7 +218,7 @@ source.addMetaData("date", df.format(new Date())); - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] kms = rangeAccess.getKmRange(); source.addMetaData("range", String.valueOf(kms[0])); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveExporter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveExporter.java Tue Jun 11 09:40:56 2013 +0200 @@ -227,7 +227,7 @@ source.addMetaData("date", df.format(new Date())); - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] kms = rangeAccess.getKmRange(); source.addMetaData("range", String.valueOf(kms[0])); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -240,13 +240,13 @@ } else if (getXBounds(0) == null && getDomainAxisRange() == null) { D4EArtifact artifact = (D4EArtifact)artifactAndFacet.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); context.putContextValue("startkm", access.getLowerKM()); context.putContextValue("endkm", access.getUpperKM()); } else if (getXBounds(0) == null && getDomainAxisRange() != null){ D4EArtifact artifact = (D4EArtifact)artifactAndFacet.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM()); Bounds bounds = calculateZoom(b, getDomainAxisRange()); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -11,24 +11,33 @@ import java.util.Date; import org.apache.log4j.Logger; -import org.jfree.chart.plot.XYPlot; -import org.jfree.data.general.SeriesException; -import org.jfree.data.time.Day; -import org.jfree.data.time.RegularTimePeriod; -import org.jfree.data.time.TimeSeries; -import org.jfree.data.time.TimeSeriesCollection; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; + import org.dive4elements.river.artifacts.D4EArtifact; + import org.dive4elements.river.artifacts.access.HistoricalDischargeAccess; + import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.HistoricalWQTimerange; import org.dive4elements.river.artifacts.model.Timerange; import org.dive4elements.river.artifacts.model.WQTimerange; + import org.dive4elements.river.jfree.StyledTimeSeries; + import org.dive4elements.river.utils.RiverUtils; +import org.jfree.chart.plot.XYPlot; + +import org.jfree.data.general.SeriesException; + +import org.jfree.data.time.FixedMillisecond; +import org.jfree.data.time.RegularTimePeriod; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; + +import org.w3c.dom.Document; + /** * @author Ingo Weinzierl @@ -249,18 +258,18 @@ } /** - * Creates an array that consists of two Minute periods [start, end]. + * Creates an array that consists of two FixedMillisecond periods [start, end]. * * @param timerange * Supports start and end time. * - * @return an array with two Minute periods [start, end]. + * @return an array with two FixedMillisecond periods [start, end]. */ protected RegularTimePeriod[] newRegularTimePeriod(Timerange timerange) { Date start = new Date(timerange.getStart()); Date end = new Date(timerange.getEnd() - 1000 * 60 * 60 * 24); - return new RegularTimePeriod[] { new Day(start), new Day(end) }; + return new RegularTimePeriod[] { new FixedMillisecond(start), new FixedMillisecond(end) }; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,8 +8,6 @@ package org.dive4elements.river.exports; -import com.vividsolutions.jts.geom.Envelope; - import org.dive4elements.artifactdatabase.data.StateData; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -41,6 +39,8 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import com.vividsolutions.jts.geom.Envelope; + public class MapGenerator implements OutGenerator, FacetTypes { @@ -102,7 +102,7 @@ String name = artifactFacet.getFacetName(); logger.debug("MapGenerator.doOut: " + - artifactFacet.getArtifact().identifier() + " | " + name); + artifactFacet.getArtifact().identifier() + " | " + name); D4EArtifact flys = (D4EArtifact) artifactFacet.getArtifact(); Facet nativeFacet = artifactFacet.getFacet(); @@ -161,12 +161,12 @@ mfg.createUeskLayer( flys, (WSPLGENLayerFacet) wms, - ThemeUtil.createDynamicMapserverStyle(attr, from, to, step), + ThemeUtil.createDynamicMapserverStyle(attr, from, to, step, context.getMeta()), context); } else { logger.warn("Cannot create WSPLGEN layer from: " + - wms.getClass()); + wms.getClass()); } } catch (IOException ioe) { @@ -225,9 +225,9 @@ if (wms instanceof WMSDBLayerFacet) { mfg.createDatabaseLayer( - flys, - (WMSDBLayerFacet) wms, - ThemeUtil.createMapserverStyle(attr)); + flys, + (WMSDBLayerFacet) wms, + ThemeUtil.createMapserverStyle(attr)); } else { logger.warn("Cannot create DB layer from: " + wms.getClass()); @@ -244,7 +244,7 @@ @Override public void generate() - throws IOException + throws IOException { logger.debug("MapGenerator.generate"); @@ -253,9 +253,9 @@ Document response = XMLUtils.newDocument(); ElementCreator c = new ElementCreator( - response, - ArtifactNamespaceContext.NAMESPACE_URI, - ArtifactNamespaceContext.NAMESPACE_PREFIX); + response, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX); Element root = c.create("floodmap"); Element layers = c.create("layers"); @@ -267,7 +267,7 @@ appendMapInformation(root, c); XMLUtils.toStream(response, out); - } + } protected void appendLayers(Element parent) { diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -31,7 +31,7 @@ * @author Ingo Weinzierl */ public class MiddleBedHeightGenerator -extends XYChartGenerator +extends XYChartGenerator implements FacetTypes { public enum YAXIS { @@ -148,7 +148,13 @@ * Get internationalized label for the y axis. */ protected String getHAxisLabel() { - return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); + D4EArtifact flys = (D4EArtifact) master; + + String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); + + return msg(I18N_YAXIS_LABEL, + I18N_YAXIS_LABEL_DEFAULT, + new Object[] { unit }); } @@ -243,7 +249,7 @@ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); - StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), false); + StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), false, 0.110d); addAxisSeries(series, YAXIS.H.idx, visible); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java Tue Jun 11 09:40:56 2013 +0200 @@ -26,6 +26,7 @@ import org.dive4elements.artifactdatabase.Backend; import org.dive4elements.artifactdatabase.Backend.PersistentArtifact; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; +import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.ArtifactDatabase; import org.dive4elements.artifacts.ArtifactDatabaseException; @@ -75,16 +76,11 @@ ThemeList themeList = new ThemeList(attributes); - int size = themeList.size(); - if (debug) { - log.debug("Output will contain " + size + " elements."); - } - List dataProviders = - doBlackboardPass(themeList, context); + doBlackboardPass(themeList, context, outName); try { - for (int i = 0; i < size; i++) { + for (int i = 0; i < themeList.size(); i++) { ManagedFacet theme = themeList.get(i); if (theme == null) { @@ -322,27 +318,40 @@ * @param context The "Blackboard". */ protected List doBlackboardPass( - ThemeList themeList, CallContext context + ThemeList themeList, CallContext context, String outname ) { ArrayList dataProviders = new ArrayList(); - int size = themeList.size(); try { // Collect all ArtifactAndFacets for blackboard pass. - for (int i = 0; i < size; i++) { + for (int i = 0; i < themeList.size(); i++) { + log.debug("BLackboard pass for: " + outname); ManagedFacet theme = themeList.get(i); if (theme == null) { log.warn("A ManagedFacet in ThemeList is null."); + themeList.remove(i); + i--; continue; } + String uuid = theme.getArtifact(); Artifact artifact = getArtifact(uuid, context); D4EArtifact flys = (D4EArtifact) artifact; + Facet face = flys.getNativeFacet(theme, outname); + log.debug("Looking for Native Facet for theme: " + theme + " and out: " + + outname + " in artifact: " + uuid + + face == null ? " Found. " : " Not Found. "); + if (face == null) { + log.warn("Theme " + theme.getName() + " for " + outname + " has no facets!. Removing theme."); + themeList.remove(i); + i--; + continue; + } ArtifactAndFacet artifactAndFacet = new ArtifactAndFacet( artifact, - flys.getNativeFacet(theme)); + face); // XXX HELP ME PLEASE artifactAndFacet.setFacetDescription(theme.getDescription()); @@ -515,6 +524,10 @@ return themes.get(idx); } + public void remove(int idx) { + themes.remove(idx); + } + public int size() { return themes.size(); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java Tue Jun 11 09:40:56 2013 +0200 @@ -40,6 +40,38 @@ /** + * 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. + * @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) { + if (points == null || points.length <= 1) { + return; + } + double [] xPoints = points[0]; + double [] yPoints = points[1]; + for (int i = 0; i < xPoints.length; i++) { + if (skipNANs && + (Double.isNaN(xPoints[i]) || Double.isNaN(yPoints[i]))) { + logger.warn ("Skipping NaN in StyledSeriesBuilder."); + continue; + } + // Create gap if distance >= distance. + if (i != 0 && Math.abs(xPoints[i-1] - xPoints[i]) >= distance) { + if (!Double.isNaN(yPoints[i-1]) && !Double.isNaN(yPoints[i])) { + series.add((xPoints[i-1]+xPoints[i])/2.d, Double.NaN, false); + } + } + series.add(xPoints[i], yPoints[i], false); + } + } + + /** * Add points to series. * * @param series Series to add points to. diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Tue Jun 11 09:40:56 2013 +0200 @@ -346,7 +346,7 @@ new Object[] { RiverUtils.getRivername(flys) }) }); - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] kms = rangeAccess.getKmRange(); writer.writeNext(new String[] { Resources.getMsg( @@ -573,7 +573,7 @@ } else if (flys instanceof FixationArtifact) { // Get W/Q input per gauge for this case. - FixRealizingAccess fixAccess = new FixRealizingAccess(flys, getCallContext()); + FixRealizingAccess fixAccess = new FixRealizingAccess(flys); segments = fixAccess.getSegments(); if (segments != null && !segments.isEmpty()) { isFixRealize = true; @@ -772,7 +772,7 @@ source.addMetaData("date", df.format(new Date())); - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] kms = rangeAccess.getKmRange(); source.addMetaData("range", kms[0] + " - " + kms[kms.length-1]); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -159,7 +159,7 @@ @Override protected String getDefaultChartSubtitle() { - FixAnalysisAccess access = new FixAnalysisAccess(artifact, context); + FixAnalysisAccess access = new FixAnalysisAccess(artifact); DateRange dateRange = access.getDateRange(); DateRange refRange = access.getReferencePeriod(); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATExport.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATExport.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATExport.java Tue Jun 11 09:40:56 2013 +0200 @@ -62,7 +62,7 @@ logger.debug("No CalculationResult found for AT export."); return; } - FixAccess access = new FixAccess((D4EArtifact)this.master, context); + FixAccess access = new FixAccess((D4EArtifact)this.master); String f = access.getFunction(); if (f == null || f.length() == 0) { logger.debug("No function found for AT export."); @@ -80,7 +80,7 @@ Writer writer = new OutputStreamWriter(out, DEFAULT_CSV_CHARSET); - FixAccess access = new FixAccess((D4EArtifact)this.master, context); + FixAccess access = new FixAccess((D4EArtifact)this.master); FixATWriter atWriter = new FixATWriter(this.function, this.parameters); NodeList nodes = request.getElementsByTagName("km"); String km = nodes.item(0).getTextContent(); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATWriter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATWriter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATWriter.java Tue Jun 11 09:40:56 2013 +0200 @@ -118,11 +118,8 @@ out.printf(Locale.US, "%8d", wRow); - if (wcm > 0) { - int rest = 10 - wcm; - while (rest-- > 0) { - out.print(ATWriter.EMPTY); - } + for (int i = 0; i < wcm; i++) { + out.print(ATWriter.EMPTY); } for (;;) { @@ -156,7 +153,7 @@ String river, double km ) { - out.println(Resources.format( + out.println("*" + Resources.format( meta, I18N_HEADER_KEY, I18N_HEADER_DEFAULT, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -37,6 +37,7 @@ import org.jfree.chart.annotations.XYTextAnnotation; import org.jfree.data.time.Day; import org.jfree.data.time.RegularTimePeriod; +import org.jfree.data.time.FixedMillisecond; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.w3c.dom.Document; @@ -118,7 +119,7 @@ @Override protected String getDefaultChartSubtitle() { - FixAnalysisAccess access = new FixAnalysisAccess(artifact, context); + FixAnalysisAccess access = new FixAnalysisAccess(artifact); DateRange dateRange = access.getDateRange(); DateRange refRange = access.getReferencePeriod(); return Resources.format( @@ -234,11 +235,11 @@ logger.debug("doReferencePeriodsOut()"); if (visible) { - FixAnalysisAccess access = new FixAnalysisAccess(artifact, context); + FixAnalysisAccess access = new FixAnalysisAccess(artifact); DateRange refRange = access.getReferencePeriod(); - RegularTimePeriod start = new Day(refRange.getFrom()); - RegularTimePeriod end = new Day(refRange.getTo()); + RegularTimePeriod start = new FixedMillisecond(refRange.getFrom()); + RegularTimePeriod end = new FixedMillisecond(refRange.getTo()); StyledDomainMarker marker = new StyledDomainMarker( start.getMiddleMillisecond(), end.getMiddleMillisecond(), @@ -264,7 +265,7 @@ if (qwd == null || qwd.qwd == null || qwd.dateRange == null) { return; } - RegularTimePeriod rtp = new Day(qwd.qwd.getDate()); + RegularTimePeriod rtp = new FixedMillisecond(qwd.qwd.getDate()); double value = qwd.qwd.getDeltaW(); // Draw a line spanning the analysis time. @@ -323,7 +324,7 @@ int idxInterpol = 0; int idxRegular = 0; - RegularTimePeriod rtp = new Day(qwd.getDate()); + RegularTimePeriod rtp = new FixedMillisecond(qwd.getDate()); double value = qwd.getDeltaW(); boolean interpolate = qwd.getInterpolated(); if (interpolate) { @@ -437,8 +438,8 @@ } for (int i = 0; i < ranges.length; i++) { logger.debug("creating domain marker"); - RegularTimePeriod start = new Day(ranges[i].getFrom()); - RegularTimePeriod end = new Day(ranges[i].getTo()); + RegularTimePeriod start = new FixedMillisecond(ranges[i].getFrom()); + RegularTimePeriod end = new FixedMillisecond(ranges[i].getTo()); StyledDomainMarker marker = new StyledDomainMarker(start.getMiddleMillisecond(), end.getMiddleMillisecond(), theme); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -554,7 +554,7 @@ @Override protected String getDefaultChartSubtitle() { - FixAnalysisAccess access = new FixAnalysisAccess(artifact, context); + FixAnalysisAccess access = new FixAnalysisAccess(artifact); DateRange dateRange = access.getDateRange(); DateRange refRange = access.getReferencePeriod(); @@ -586,7 +586,7 @@ StringBuilder buf = new StringBuilder(); // Add analysis periods as additional subtitle - FixAnalysisAccess access = new FixAnalysisAccess(artifact, context); + FixAnalysisAccess access = new FixAnalysisAccess(artifact); DateRange[] aperiods = access.getAnalysisPeriods(); buf.append(msg("fix.analysis.periods")); buf.append(": "); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -148,7 +148,9 @@ @Override protected String getDefaultXAxisLabel() { - return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); + return msg(I18N_XAXIS_LABEL, + I18N_XAXIS_LABEL_DEFAULT, + new Object[] { getRiverName() }); } @Override diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -29,6 +29,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.utils.DataUtil; +import org.dive4elements.river.utils.RiverUtils; public class BedDifferenceEpochGenerator @@ -113,13 +114,13 @@ } else if (getXBounds(0) == null && getDomainAxisRange() == null) { D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); context.putContextValue("startkm", access.getLowerKM()); context.putContextValue("endkm", access.getUpperKM()); } else if (getXBounds(0) == null && getDomainAxisRange() != null){ D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - FlowVelocityAccess access = new FlowVelocityAccess(artifact, context); + FlowVelocityAccess access = new FlowVelocityAccess(artifact); Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM()); Bounds bounds = calculateZoom(b, getDomainAxisRange()); @@ -186,7 +187,9 @@ @Override protected String getDefaultXAxisLabel() { - return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); + return msg(I18N_XAXIS_LABEL, + I18N_XAXIS_LABEL_DEFAULT, + new Object[] {getRiverName()}); } @Override @@ -196,7 +199,11 @@ label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } else if (pos == YAXIS.H.idx) { - label = msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT); + D4EArtifact flys = (D4EArtifact) master; + label = msg(I18N_SECOND_YAXIS_LABEL, + I18N_SECOND_YAXIS_LABEL_DEFAULT, + new Object[] + { RiverUtils.getRiver(flys).getWstUnit().getName() }); } else if (pos == YAXIS.dW.idx) { return msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,186 @@ +package org.dive4elements.river.exports.minfo; + +import java.io.IOException; +import java.io.OutputStream; +import java.text.NumberFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.util.Locale; +import java.util.Date; +import java.text.DateFormat; + +import org.apache.log4j.Logger; +import org.apache.commons.lang.StringUtils; + +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.JRException; + +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.access.BedDifferencesAccess; +import org.dive4elements.artifacts.common.utils.Config; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.minfo.BedDifferencesResult; +import org.dive4elements.river.artifacts.model.minfo.BedDifferenceJRDataSource; +import org.dive4elements.river.exports.AbstractExporter; +import org.dive4elements.river.utils.Formatter; +import org.dive4elements.river.utils.RiverUtils; + +import org.w3c.dom.Document; + +import au.com.bytecode.opencsv.CSVWriter; + + +public class BedDifferenceExporter +extends AbstractExporter +{ + + /** Private logger. */ + private static Logger logger = + Logger.getLogger(BedDifferenceExporter.class); + + private static final String CSV_HEADER_KM = + "export.minfo.beddifference.km"; + + private static final String CSV_HEADER_DIFF = + "export.minfo.beddifference.diff"; + + public static final String JASPER_FILE = + "export.minfo.beddifference.pdf.file"; + + public static final String PDF_TITLE= + "export.minfo.beddifference.pdf.title"; + + public static final String PDF_HEADER_MODE= + "export.minfo.beddifference.pdf.mode"; + + private BedDifferencesResult[] results; + + @Override + public void init(Document request, OutputStream out, CallContext context) { + logger.debug("init"); + super.init(request, out, context); + results = new BedDifferencesResult[0]; + } + + @Override + protected void writeCSVData(CSVWriter writer) throws IOException { + writeCSVHeader(writer); + + NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); + NumberFormat mf = Formatter.getMeterFormat(context); + for (int i = 0; i < results.length; i++) { + BedDifferencesResult result = results[i]; + double[][] kms = result.getDifferencesData(); + for (int j = 0; j < kms[0].length; j++) { + writer.writeNext(new String[] { + kmf.format(kms[0][j]), mf.format(kms[1][j])}); + } + } + } + + @Override + protected void addData(Object data) { + if (!(data instanceof CalculationResult)) { + logger.warn("Invalid data type."); + return; + } + Object[] d = (Object[])((CalculationResult)data).getData(); + + if (!(d instanceof BedDifferencesResult[])) { + logger.warn("Invalid result object."); + return; + } + results = (BedDifferencesResult[])d; + } + + protected void addMetaData(BedDifferenceJRDataSource source) { + CallMeta meta = context.getMeta(); + + D4EArtifact arti = (D4EArtifact) master; + + source.addMetaData ("river", RiverUtils.getRivername(arti)); + + Locale locale = Resources.getLocale(meta); + DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); + + source.addMetaData("date", df.format(new Date())); + + source.addMetaData("calculation", Resources.getMsg( + locale, + PDF_HEADER_MODE, + "Bedheight difference")); + + // Now the dynamic parts + + BedDifferencesAccess access = new BedDifferencesAccess(arti); + source.addMetaData("ye_mode", Resources.getMsg(locale, + "state.minfo." + access.getYearEpoch(), + access.getYearEpoch())); + + source.addMetaData("differences", StringUtils.join( + access.getDifferenceArtifactNamePairs(), "\n")); + } + + + protected void writeCSVHeader(CSVWriter writer) { + logger.debug("writeCSVHeader()"); + + List header = new LinkedList(); + if (results != null) { + header.add(msg(CSV_HEADER_KM, "km")); + header.add(msg(CSV_HEADER_DIFF, "m")); + } + writer.writeNext(header.toArray(new String[header.size()])); + } + + protected BedDifferenceJRDataSource createJRData() { + BedDifferenceJRDataSource source = new BedDifferenceJRDataSource(); + + addMetaData(source); + NumberFormat kmf = Formatter.getCalculationKm(context.getMeta()); + NumberFormat mf = Formatter.getMeterFormat(context); + for (BedDifferencesResult result: results) { + double[][] kms = result.getDifferencesData(); + for (int j = 0; j < kms[0].length; j++) { + source.addData(new String[] { + kmf.format(kms[0][j]), mf.format(kms[1][j])}); + } + } + return source; + } + + @Override + protected void writePDF(OutputStream out) { + logger.debug("write PDF"); + BedDifferenceJRDataSource source = createJRData(); + + String jasperFile = Resources.getMsg( + context.getMeta(), + JASPER_FILE, + "/jasper/beddifference_en.jasper"); + String confPath = Config.getConfigDirectory().toString(); + + + Map parameters = new HashMap(); + parameters.put("ReportTitle", Resources.getMsg( + context.getMeta(), PDF_TITLE, "Exported Data")); + try { + JasperPrint print = JasperFillManager.fillReport( + confPath + jasperFile, + parameters, + source); + JasperExportManager.exportReportToPdfStream(print, out); + } + catch(JRException je) { + logger.warn("Error generating PDF Report!", je); + } + } + +} diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -14,6 +14,7 @@ import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.WKms; import org.dive4elements.river.artifacts.model.minfo.BedDiffYearResult; @@ -29,6 +30,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.utils.DataUtil; +import org.dive4elements.river.utils.RiverUtils; public class BedDifferenceYearGenerator @@ -232,12 +234,15 @@ @Override protected String getDefaultXAxisLabel() { - return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); + return msg(I18N_XAXIS_LABEL, + I18N_XAXIS_LABEL_DEFAULT, + new Object[] { getRiverName() }); } @Override protected String getDefaultYAxisLabel(int pos) { String label = "default"; + D4EArtifact flys = (D4EArtifact) master; if (pos == YAXIS.D.idx) { label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } @@ -245,13 +250,18 @@ label = msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT); } else if (pos == YAXIS.H.idx) { - label = msg(I18N_THIRD_YAXIS_LABEL, I18N_THIRD_YAXIS_LABEL_DEFAULT); + label = msg(I18N_THIRD_YAXIS_LABEL, + I18N_THIRD_YAXIS_LABEL_DEFAULT, + new Object[] + { RiverUtils.getRiver(flys).getWstUnit().getName() }); } else if (pos == YAXIS.dW.idx) { label = msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT); } else if (pos == YAXIS.W.idx) { - return msg(I18N_W_YAXIS_LABEL, I18N_W_YAXIS_LABEL_DEFAULT); + return msg(I18N_W_YAXIS_LABEL, I18N_W_YAXIS_LABEL_DEFAULT, + new Object[] + { RiverUtils.getRiver(flys).getWstUnit().getName() }); } return label; diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -15,6 +15,7 @@ import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.artifacts.model.minfo.BedDiameterData; import org.dive4elements.river.artifacts.model.minfo.BedDiameterResult; import org.dive4elements.river.artifacts.model.minfo.BedParametersResult; import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterResult; @@ -88,7 +89,9 @@ */ @Override protected String getDefaultXAxisLabel() { - return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); + return msg(I18N_XAXIS_LABEL, + I18N_XAXIS_LABEL_DEFAULT, + new Object[] {getRiverName()}); } @Override @@ -191,6 +194,13 @@ (BedParametersResult) artifactAndFacet.getData(context), artifactAndFacet, attr, visible); } + else if (name.equals(BED_DIAMETER_DATA_TOP) || + name.equals(BED_DIAMETER_DATA_SUB) || + name.equals(BEDLOAD_DIAMETER_DATA)) { + doBedDiameterDataOut( + (BedDiameterData) artifactAndFacet.getData(context), + artifactAndFacet, attr, visible); + } else if (name.equals(LONGITUDINAL_ANNOTATION)) { doAnnotations( (RiverAnnotation) artifactAndFacet.getData(context), @@ -208,6 +218,18 @@ } } + private void doBedDiameterDataOut( + BedDiameterData data, + ArtifactAndFacet aandf, + Document theme, + boolean visible + ) { + XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); + StyledSeriesBuilder.addPoints(series, data.getDiameterData(), true); + + addAxisSeries(series, YAXIS.W.idx, visible); + } + protected void doBedDiameterTopLayerOut(BedDiameterResult data, ArtifactAndFacet aandf, Document theme, boolean visible) { logger.debug("BedQuality.doBedDiameterTopLayerOut"); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java Tue Jun 11 09:40:56 2013 +0200 @@ -119,20 +119,20 @@ } else if (getXBounds(0) == null && getDomainAxisRange() == null) { D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - RangeAccess access = new RangeAccess(artifact, context); + RangeAccess access = new RangeAccess(artifact); context.putContextValue("startkm", access.getFrom()); context.putContextValue("endkm", access.getTo()); } else if (getXBounds(0) == null && getDomainAxisRange() != null){ D4EArtifact artifact = (D4EArtifact)bundle.getArtifact(); - RangeAccess access = new RangeAccess(artifact, context); + RangeAccess access = new RangeAccess(artifact); Bounds b = new DoubleBounds(access.getFrom(), access.getTo()); Bounds bounds = calculateZoom(b, getDomainAxisRange()); context.putContextValue("startkm", bounds.getLower()); context.putContextValue("endkm", bounds.getUpper()); } - if (FacetTypes.IS.SEDIMENT_LOAD(SEDIMENT_LOAD_COARSE)) { + if (FacetTypes.IS.SEDIMENT_LOAD(name)) { doSedimentLoadOut( (double[][]) bundle.getData(context), bundle, @@ -226,7 +226,7 @@ protected String getDefaultYAxisLabel(int pos) { String label = "default"; if (pos == YAXIS.L.idx) { - SedimentLoadAccess access = new SedimentLoadAccess(artifact, context); + SedimentLoadAccess access = new SedimentLoadAccess(artifact); if (access.getUnit().equals("m3_per_a")) { label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2); } diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java Tue Jun 11 09:40:56 2013 +0200 @@ -11,21 +11,43 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.util.Date; +import java.util.Locale; +import java.text.DateFormat; import org.w3c.dom.Document; +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperFillManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.JRException; + import au.com.bytecode.opencsv.CSVWriter; import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; import org.dive4elements.river.artifacts.model.CalculationResult; - import org.dive4elements.river.artifacts.model.sq.SQFractionResult; import org.dive4elements.river.artifacts.model.sq.SQResult; +import org.dive4elements.river.artifacts.model.sq.SQRelationJRDataSource; import org.dive4elements.river.artifacts.model.Parameters; +import org.dive4elements.river.artifacts.model.DateRange; +import org.dive4elements.river.artifacts.access.SQRelationAccess; + +import org.dive4elements.river.artifacts.resources.Resources; + +import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.exports.AbstractExporter; +import org.dive4elements.river.utils.RiverUtils; +import org.dive4elements.river.utils.Formatter; + +import org.dive4elements.artifacts.common.utils.Config; + import org.apache.log4j.Logger; /** @@ -80,6 +102,14 @@ public static final String CSV_VARIANCE = "export.sqrelation.csv.header.variance"; + public static final String PDF_TITLE= + "export.sqrelation.pdf.title"; + + public static final String PDF_HEADER_MODE = + "export.sqrelation.pdf.mode"; + + public static final String JASPER_FILE = + "export.sqrelation.pdf.file"; protected List data; @@ -120,16 +150,14 @@ for (SQResult [] results: data) { for (SQResult result: results) { - data2CSV(writer, result); + writer.writeAll(data2StringArrays(result)); } } } - protected void data2CSV(CSVWriter writer, SQResult result) { - logger.debug("data2CSV"); - - // TODO: i18n + protected List data2StringArrays(SQResult result) { String km = String.valueOf(result.getKm()); + List retval = new ArrayList(); for (int i = 0; i < SQResult.NUMBER_FRACTIONS; ++i) { SQFractionResult fraction = result.getFraction(i); @@ -142,29 +170,97 @@ continue; } - double a = parameters.getValue(0, "a"); - double b = parameters.getValue(0, "b"); - double sd = Math.sqrt(parameters.getValue(0, "std_dev")); - int o = fraction.totalNumOutliers(); - int t = fraction.numMeasurements() + o; + String a, b, sd, o, t; + a = Formatter.getSQRelationA(context).format(parameters.getValue(0, "a")); + b = Formatter.getSQRelationB(context).format(parameters.getValue(0, "b")); + sd = Formatter.getVariance(context).format(Math.sqrt(parameters.getValue(0, "std_dev"))); - writer.writeNext(new String[] { + o = String.valueOf(fraction.totalNumOutliers()); + t = String.valueOf(fraction.numMeasurements() + o); + + retval.add(new String[] { km, name, - String.valueOf(a), - String.valueOf(b), - String.valueOf(t), - String.valueOf(o), - String.valueOf(sd) + a, + b, + t, + o, + sd }); } + return retval; } + protected SQRelationJRDataSource createJRData() { + SQRelationJRDataSource source = new SQRelationJRDataSource(); + + addMetaData(source); + for (SQResult [] results: data) { + for (SQResult result: results) { + for (String[] res: data2StringArrays(result)) { + source.addData(res); + } + } + } + return source; + } + + protected void addMetaData(SQRelationJRDataSource source) { + CallMeta meta = context.getMeta(); + + D4EArtifact arti = (D4EArtifact) master; + + source.addMetaData ("river", RiverUtils.getRivername(arti)); + + Locale locale = Resources.getLocale(meta); + DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale); + + source.addMetaData("date", df.format(new Date())); + + SQRelationAccess access = new SQRelationAccess(arti); + source.addMetaData("location", "KM " + getKmFormatter().format(access.getLocation())); + + DateRange period = access.getPeriod(); + source.addMetaData("periods", df.format(period.getFrom()) + " - " + + df.format(period.getTo())); + + source.addMetaData("outliertest", Resources.getMsg(meta, + access.getOutlierMethod(), + access.getOutlierMethod())); + source.addMetaData("outliers", access.getOutliers().toString()); + + source.addMetaData("calculation", Resources.getMsg( + locale, + PDF_HEADER_MODE, + "SQRelation")); + } + @Override protected void writePDF(OutputStream out) { - logger.debug("writePDF"); - logger.error("NOT IMPLEMENTED: writePDF"); + logger.debug("write PDF"); + SQRelationJRDataSource source = createJRData(); + + String jasperFile = Resources.getMsg( + context.getMeta(), + JASPER_FILE, + "/jasper/sqrelation_en.jasper"); + String confPath = Config.getConfigDirectory().toString(); + + + Map parameters = new HashMap(); + parameters.put("ReportTitle", Resources.getMsg( + context.getMeta(), PDF_TITLE, "Exported Data")); + try { + JasperPrint print = JasperFillManager.fillReport( + confPath + jasperFile, + parameters, + source); + JasperExportManager.exportReportToPdfStream(print, out); + } + catch(JRException je) { + logger.warn("Error generating PDF Report!", je); + } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java --- a/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java Tue Jun 11 09:40:56 2013 +0200 @@ -11,6 +11,7 @@ import java.text.DateFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; +import java.text.DecimalFormat; import java.util.Locale; import org.dive4elements.artifacts.CallContext; @@ -87,6 +88,14 @@ public static final int FIX_DELTA_W_DELTA_Q_MIN_DIGITS = 0; public static final int FIX_DELTA_W_DELTA_Q_MAX_DIGITS = 2; + public static final int VARIANCE_MIN_DIGITS = 3; + public static final int VARIANCE_MAX_DIGITS = 3; + + // SQ Relation + public static final int SQ_RELATION_A_MAX_DIGITS = 7; + public static final int SQ_RELATION_A_MIN_DIGITS = 7; + public static final int SQ_RELATION_B_MAX_DIGITS = 3; + public static final int SQ_RELATION_B_MIN_DIGITS = 3; /** * Creates a localized NumberFormatter with given range of decimal digits. @@ -106,7 +115,6 @@ return nf; } - public static NumberFormat getFormatter(CallContext c, int min, int max){ return getFormatter(c.getMeta(), min, max); } @@ -124,6 +132,32 @@ return NumberFormat.getInstance(locale); } + /** + * Returns a formatter in engineering notation + */ + public static NumberFormat getEngFormatter(CallContext c) { + NumberFormat nf = getRawFormatter(c); + if (nf instanceof DecimalFormat) { + DecimalFormat df = (DecimalFormat)nf; + df.applyPattern("##0.#####E0"); + } + return nf; + } + + /** + * Returns a number formatter that uses an exponent after max digits + */ + public static NumberFormat getScientificFormater(CallContext c, int min, int max) { + NumberFormat nf = getRawFormatter(c); + if (nf instanceof DecimalFormat) { + DecimalFormat df = (DecimalFormat)nf; + df.applyPattern("0.0E0"); + df.setMaximumFractionDigits(max); + df.setMinimumFractionDigits(min); + } + return nf; + } + /** * Returns a date formatter with SHORT style. @@ -398,6 +432,27 @@ FIX_DELTA_W_DELTA_W_MAX_DIGITS); } + public static NumberFormat getVariance(CallContext context) { + return getFormatter( + context, + VARIANCE_MIN_DIGITS, + VARIANCE_MAX_DIGITS); + } + + public static NumberFormat getSQRelationA(CallContext context) { + return getFormatter( + context, + SQ_RELATION_A_MIN_DIGITS, + SQ_RELATION_A_MAX_DIGITS); + } + + public static NumberFormat getSQRelationB(CallContext context) { + return getFormatter( + context, + SQ_RELATION_B_MIN_DIGITS, + SQ_RELATION_B_MAX_DIGITS); + } + public static NumberFormat getMeterFormat(CallContext context) { return getFormatter( context, diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java --- a/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Tue Jun 11 09:40:56 2013 +0200 @@ -459,7 +459,7 @@ return null; } - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] dist = rangeAccess.getKmRange(); if (dist == null) { @@ -915,7 +915,7 @@ return null; } - RangeAccess rangeAccess = new RangeAccess(flys, null); + RangeAccess rangeAccess = new RangeAccess(flys); double[] dist = rangeAccess.getKmRange(); if (dist == null) { logger.debug("getGauges: no dist!"); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java --- a/artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/utils/ThemeUtil.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,12 +8,14 @@ package org.dive4elements.river.utils; +import org.dive4elements.artifacts.CallMeta; import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.river.artifacts.model.MapserverStyle; import org.dive4elements.river.artifacts.model.MapserverStyle.Clazz; import org.dive4elements.river.artifacts.model.MapserverStyle.Expression; import org.dive4elements.river.artifacts.model.MapserverStyle.Label; import org.dive4elements.river.artifacts.model.MapserverStyle.Style; +import org.dive4elements.river.artifacts.resources.Resources; import java.awt.Color; import java.awt.Font; @@ -31,6 +33,10 @@ private static Logger logger = Logger.getLogger(ThemeUtil.class); + private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class"; + + private static final String MSG_ISOBATH_LASTCLASS = "floodmap.isobath.lastclass"; + public final static String XPATH_FILL_COLOR = "/theme/field[@name='fillcolor']/@default"; @@ -669,7 +675,7 @@ * @return String representation of the MapserverStyle */ public static String createDynamicMapserverStyle(Document theme, - float from, float to, float step) + float from, float to, float step, CallMeta meta) { MapserverStyle ms = new MapserverStyle(); @@ -700,9 +706,10 @@ newColor.append(' '); newColor.append(startColor.getBlue() + Math.round(n * bd)); - String expr = createWSPLGENExpression(from + n * step, step, n + 1, numClasses); + String expr = createWSPLGENClassExpression(from + n * step, step, n + 1, numClasses); + String name = createWSPLGENClassName(from + n * step, step, n + 1, numClasses, meta); - Clazz c = new Clazz(expr); + Clazz c = new Clazz(name); Style s = new Style(); s.setColor(newColor.toString()); s.setSize(5); @@ -717,7 +724,7 @@ } - protected static String createWSPLGENExpression(float val, float step, int idx, int maxIdx) { + protected static String createWSPLGENClassExpression(float val, float step, int idx, int maxIdx) { if (idx < maxIdx) { return "[DIFF] >= " + val + " AND [DIFF] < " + (val + step); } @@ -726,6 +733,30 @@ } } + /** + * Creates a class name for the mapfile style that visualizes a floodmap. + * The class names are used in the map's legend. + * + * @param val Current isobath value. + * @param step Difference between to class values. + * @param idx Current class index that is being processed. + * @param maxIdx Highest class index. + * @param meta Caller meta object used to determine locale. + * @return + */ + protected static String createWSPLGENClassName(float val, float step, int idx, int maxIdx, CallMeta meta) { + assert meta != null : "CallMeta instance is null"; + + if (idx < maxIdx) { + return Resources.getMsg(meta, MSG_ISOBATH_CLASS, + new Object[] {val, val + step}); + } + else { + return Resources.getMsg(meta, MSG_ISOBATH_LASTCLASS, + new Object[] {val}); + } + } + public static String createMapserverStyle(Document theme) { String symbol = getSymbol(theme); diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/java/org/dive4elements/river/wsplgen/FacetCreator.java --- a/artifacts/src/main/java/org/dive4elements/river/wsplgen/FacetCreator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/wsplgen/FacetCreator.java Tue Jun 11 09:40:56 2013 +0200 @@ -85,7 +85,7 @@ protected Envelope getWSPLGENBounds() { String river = getRiver(); - RangeAccess rangeAccess = new RangeAccess(artifact, null); + RangeAccess rangeAccess = new RangeAccess(artifact); double kms[] = rangeAccess.getKmRange(); logger.debug("### getWSPLGENBounds"); @@ -123,7 +123,7 @@ public void createWSPLGENFacet() { String river = getRiver(); - RangeAccess rangeAccess = new RangeAccess(artifact, null); + RangeAccess rangeAccess = new RangeAccess(artifact); double kms[] = rangeAccess.getKmRange(); WSPLGENLayerFacet wsplgen = new WSPLGENLayerFacet( diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/resources/messages.properties Tue Jun 11 09:40:56 2013 +0200 @@ -209,13 +209,13 @@ chart.fixings.analysis.title = Longitudinal section at km {0} chart.bedquality.title=Bed Longitudinal Section -chart.bedquality.xaxis.label=River-Km +chart.bedquality.xaxis.label={0}-km chart.bedquality.yaxis.label=Diameter [mm] chart.bedquality.yaxis.label.porosity=Porosity [%] chart.bedquality.yaxis.label.density=Density [t/m\u00b3] chart.bedheight_middle.section.title=Middle Bed Height -chart.bedheight_middle.section.yaxis.label=middle Bed Height [mm a NN] +chart.bedheight_middle.section.yaxis.label=middle Bed Height [{0}] chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung chart.flow_velocity.section.yaxis.label=Speed v [m/s] @@ -277,6 +277,9 @@ facet.bedquality.bed.density.sublayer = Density ({0,date} - {1,date}) ({2}) facet.bedquality.bed.diameter.toplayer = {0}_Bed ({1,date} - {2,date}) ({3}) facet.bedquality.bed.diameter.sublayer = {0}_Bed ({1,date} - {2,date}) ({3}) +facet.bedquality.bed.diameter.data.toplayer = {0} Bed ({1,date} - {2,date}) ({3}) - measurements +facet.bedquality.bed.diameter.data.sublayer = {0} Bed ({1,date} - {2,date}) ({3}) - measurements +facet.bedquality.bedload.diameter.data = {0} Bedload - measurements facet.bedquality.bedload.diameter = {0}_Bedload bedquality.toplayer = 0.0m - 0.3m bedquality.sublayer = 0.1m - 0.5m @@ -300,15 +303,15 @@ facet.morphologic.width = morphologic Width chart.beddifference.height.title = Bedheight Difference -chart.beddifference.height.xaxis.label = River-Km [km] +chart.beddifference.height.xaxis.label = {0}-km chart.beddifference.height.yaxis.label = Difference [cm/year] chart.beddifference.epoch.title = Bedheight Difference -chart.beddifference.xaxis.label = River-Km [km] +chart.beddifference.xaxis.label = {0}-km chart.beddifference.yaxis.label.diff = Difference [m] -chart.beddifference.yaxis.label.height = Absolute Height [m] +chart.beddifference.yaxis.label.height = Absolute Height [{0}] chart.beddifference.year.title = Bedheight Difference chart.beddifference.yaxis.label.morph = Width [m] -chart.beddifference.yaxis.label.heights = Absolute Height [m] +chart.beddifference.yaxis.label.heights = Absolute Height [{0}] export.waterlevel.csv.header.km = River-Km @@ -390,6 +393,8 @@ export.sqrelation.csv.header.c.duan = C (DUAN) export.sqrelation.csv.header.c.ferguson = C (FERGUSON) export.sqrelation.csv.header.variance = Standard variance +export.sqrelation.pdf.file = /jasper/sqrelation_en.jasper +export.sqrelation.pdf.mode = Load Discharge Relation export.minfo.bedquality.km = km export.minfo.bedquality.density_cap = Density Toplayer export.minfo.bedquality.density_sub = Density Sublayer @@ -398,6 +403,11 @@ export.minfo.bedquality.bedload = Bedload Diameter export.minfo.bedquality.bed_cap = Bed Diameter Toplayer export.minfo.bedquality.bed_sub = Bed Diameter Sublayer +export.minfo.beddifference.km = km +export.minfo.beddifference.diff = m +export.minfo.beddifference.pdf.file = /jasper/beddifference_en.jasper +export.minfo.beddifference.pdf.title = Bedheight Difference +export.minfo.beddifference.pdf.mode = Bedheight Difference floodmap.wmsbackground = Background Map floodmap.riveraxis = River Axis @@ -415,6 +425,8 @@ floodmap.fixpoints = Fixpoints floodmap.floodmaps = Floodmaps floodmap.usershape = User data +floodmap.isobath.class = {0,number,#.#} m to {1,number,#.#} m +floodmap.isobath.lastclass = greater {0,number,#.#} m wsplgen.job.queued = WSPLGEN job in queue. wsplgen.job.error = An unexpected error while starting WSPLGEN occured. @@ -616,6 +628,11 @@ gauge.discharge.service.chart.series.title = Discharge Curve {0,date,short} - {1,date,short} gauge.discharge.service.chart.series.title.master = Current Discharge Curve since {0,date,short} +bed.km.chart.label = Sedimentdata +bed.km.chart.title = Sedimentdata SedDB +bedload.km.chart.label = Geschiebedaten +bedload.km.chart.title = Geschiebedatenbestand SedDB + help.state.fix.river=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.river help.state.fix.calculation.mode=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.calculation.mode help.state.fix.location=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.location diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/resources/messages_de.properties --- a/artifacts/src/main/resources/messages_de.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Tue Jun 11 09:40:56 2013 +0200 @@ -210,13 +210,13 @@ chart.w_differences.yaxis.second.label = W [NN + m] chart.bedquality.title=Sohlen L\u00e4ngsschnitt -chart.bedquality.xaxis.label=Fluss-Km +chart.bedquality.xaxis.label={0}-km chart.bedquality.yaxis.label=Durchmesser [mm] chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%] chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3] chart.bedheight_middle.section.title=Mittlere Sohlh\u00f6he -chart.bedheight_middle.section.yaxis.label=mittlere Sohlh\u00f6hen [mm\u00fcNN] +chart.bedheight_middle.section.yaxis.label=mittlere Sohlh\u00f6hen [{0}] chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung chart.flow_velocity.section.yaxis.label=Geschwindigkeit v [m/s] @@ -278,6 +278,9 @@ facet.bedquality.bed.density.sublayer = Dichte ({0,date} - {1,date}) ({2}) facet.bedquality.bed.diameter.toplayer = {0}_Sohle ({1,date} - {2,date}) ({3}) facet.bedquality.bed.diameter.sublayer = {0}_Sohle ({1,date} - {2,date}) ({3}) +facet.bedquality.bed.diameter.data.toplayer = {0} Sohle ({1,date} - {2,date}) ({3}) - Messungen +facet.bedquality.bed.diameter.data.sublayer = {0} Sohle ({1,date} - {2,date}) ({3}) - Messungen +facet.bedquality.bedload.diameter.data = {0} Geschiebe - Messungen facet.bedquality.bedload.diameter = {0}_Geschiebe bedquality.toplayer = 0,0m - 0,3m bedquality.sublayer = 0,1m - 0,5m @@ -301,10 +304,10 @@ facet.morphologic.width = Morphologische Breite chart.beddifference.height.title = Sohlh\u00f6hendifferenz -chart.beddifference.height.xaxis.label = Fluss-Km [km] +chart.beddifference.height.xaxis.label = {0}-km chart.beddifference.height.yaxis.label = Differenz [cm/Jahr] chart.beddifference.epoch.title = Sohlh\u00f6hendifferenz -chart.beddifference.xaxis.label = Fluss-Km [km] +chart.beddifference.xaxis.label = {0}-km chart.beddifference.yaxis.label.diff = Differenz [m] chart.beddifference.yaxis.label.height = Absolute H\u00f6he [m] chart.beddifference.year.title = Sohlh\u00f6hendifferenz @@ -391,6 +394,8 @@ export.sqrelation.csv.header.c.duan = C (DUAN) export.sqrelation.csv.header.c.ferguson = C (FERGUSON) export.sqrelation.csv.header.variance = Standardabweichung +export.sqrelation.pdf.file = /jasper/sqrelation.jasper +export.sqrelation.pdf.mode = Transport-Abfluss Beziehung export.minfo.bedquality.km = km export.minfo.bedquality.density_cap = Sedimentdichte Deckschicht export.minfo.bedquality.density_sub = Sedimentdichte Unterschicht @@ -399,10 +404,15 @@ export.minfo.bedquality.bedload = Geschiebedurchmesser export.minfo.bedquality.bed_cap = Sohldurchmesser Deckschicht export.minfo.bedquality.bed_sub = Sohldurchmesser Unterschicht +export.minfo.beddifference.km = Fluss-km +export.minfo.beddifference.diff = m +export.minfo.beddifference.pdf.file = /jasper/beddifference.jasper +export.minfo.beddifference.pdf.title = Sohlh\u00f6hendifferenz +export.minfo.beddifference.pdf.mode = Sohlh\u00f6hendifferenz floodmap.wmsbackground = Hintergrundkarte floodmap.riveraxis = Flussachse -floodmap.uesk = \u00dcsg: {0}-km {1,number,####} - {2,number,####} +floodmap.uesk = \u00dcSG: {0}-km {1,number,####} - {2,number,####} floodmap.barriers = Digitalisierte Objekte floodmap.kms = Kilometrierung floodmap.qps = Querprofilspuren @@ -416,6 +426,8 @@ floodmap.fixpoints = Festpunkte floodmap.floodmaps = \u00dcberschwemmungsfl\u00e4che floodmap.usershape = Benutzerdaten +floodmap.isobath.class = {0,number,#.#} m bis {1,number,#.#} m +floodmap.isobath.lastclass = gr\u00f6\u00dfer {0,number,#.#} m wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange. wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten. @@ -619,6 +631,11 @@ gauge.discharge.service.chart.series.title = Abflusskurve {0,date,short} - {1,date,short} gauge.discharge.service.chart.series.title.master = Aktuelle Abflusskurve ab {0,date,short} +bed.km.chart.label = Sohldaten +bed.km.chart.title = Sohldatenbestand SedDB +bedload.km.chart.label = Geschiebedaten +bedload.km.chart.title = Geschiebedatenbestand SedDB + help.state.fix.river=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.river help.state.fix.calculation.mode=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.calculation.mode help.state.fix.location=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.location diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/resources/messages_de_DE.properties --- a/artifacts/src/main/resources/messages_de_DE.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/resources/messages_de_DE.properties Tue Jun 11 09:40:56 2013 +0200 @@ -207,13 +207,13 @@ chart.w_differences.yaxis.second.label = W [NN + m] chart.bedquality.title=Sohlen L\u00e4ngsschnitt -chart.bedquality.xaxis.label=Fluss-Km +chart.bedquality.xaxis.label={0}-km chart.bedquality.yaxis.label=Durchmesser [mm] chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%] chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3] chart.bedheight_middle.section.title=Mittlere Sohlh\u00f6he -chart.bedheight_middle.section.yaxis.label=mittlere Sohlh\u00f6hen [mm\u00fcNN] +chart.bedheight_middle.section.yaxis.label=mittlere Sohlh\u00f6hen [{0}] chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung chart.flow_velocity.section.yaxis.label=Geschwindigkeit v [m/s] @@ -275,6 +275,9 @@ facet.bedquality.bed.density.sublayer = Dichte ({0,date} - {1,date}) ({2}) facet.bedquality.bed.diameter.toplayer = {0}_Sohle ({1,date} - {2,date}) ({3}) facet.bedquality.bed.diameter.sublayer = {0}_Sohle ({1,date} - {2,date}) ({3}) +facet.bedquality.bed.diameter.data.toplayer = {0} Sohle ({1,date} - {2,date}) ({3}) - Messungen +facet.bedquality.bed.diameter.data.sublayer = {0} Sohle ({1,date} - {2,date}) ({3}) - Messungen +facet.bedquality.bedload.diameter.data = {0} Geschiebe - Messungen facet.bedquality.bedload.diameter = {0}_Geschiebe bedquality.toplayer = 0,0m - 0,3m bedquality.sublayer = 0,1m - 0,5m @@ -298,15 +301,15 @@ facet.morphologic.width = Morphologische Breite chart.beddifference.height.title = Sohlh\u00f6hendifferenz -chart.beddifference.height.xaxis.label = Fluss-Km [km] +chart.beddifference.height.xaxis.label = {0}-km chart.beddifference.height.yaxis.label = Differenz [cm/Jahr] chart.beddifference.epoch.title = Sohlh\u00f6hendifferenz -chart.beddifference.xaxis.label = Fluss-Km [km] +chart.beddifference.xaxis.label = {0}-km chart.beddifference.yaxis.label.diff = Differenz [m] -chart.beddifference.yaxis.label.height = Absolute H\u00f6he [m] +chart.beddifference.yaxis.label.height = Absolute H\u00f6he [{0}] chart.beddifference.year.title = Sohlh\u00f6hendifferenz chart.beddifference.yaxis.label.morph = Breite [m] -chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m] +chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [{0}] export.waterlevel.csv.header.km = Fluss-Km export.waterlevel.csv.header.w = W [{0}] @@ -387,6 +390,8 @@ export.sqrelation.csv.header.c.duan = C (DUAN) export.sqrelation.csv.header.c.ferguson = C (FERGUSON) export.sqrelation.csv.header.variance = Standardabweichung +export.sqrelation.pdf.file = /jasper/sqrelation.jasper +export.sqrelation.pdf.mode = Transport-Abfluss Beziehung export.minfo.bedquality.km = km export.minfo.bedquality.density_cap = Sedimentdichte Deckschicht export.minfo.bedquality.density_sub = Sedimentdichte Unterschicht @@ -395,10 +400,15 @@ export.minfo.bedquality.bedload = Geschiebedurchmesser export.minfo.bedquality.bed_cap = Sohldurchmesser Deckschicht export.minfo.bedquality.bed_sub = Sohldurchmesser Unterschicht +export.minfo.beddifference.km = Fluss-km +export.minfo.beddifference.diff = m +export.minfo.beddifference.pdf.file = /jasper/beddifference.jasper +export.minfo.beddifference.pdf.title = Sohlh\u00f6hendifferenz +export.minfo.beddifference.pdf.mode = Sohlh\u00f6hendifferenz floodmap.wmsbackground = Hintergrundkarte floodmap.riveraxis = Flussachse -floodmap.uesk = \u00dcsg: {0}-km {1,number,####} - {2,number,####} +floodmap.uesk = \u00dcSG: {0}-km {1,number,####} - {2,number,####} floodmap.barriers = Digitalisierte Objekte floodmap.kms = Kilometrierung floodmap.qps = Querprofilspuren @@ -412,6 +422,8 @@ floodmap.fixpoints = Festpunkte floodmap.floodmaps = \u00dcberschwemmungsfl\u00e4che floodmap.usershape = Benutzerdaten +floodmap.isobath.class = {0,number,#.#} m bis {1,number,#.#} m +floodmap.isobath.lastclass = gr\u00f6\u00dfer {0,number,#.#} m wsplgen.job.queued = WSPLGEN Berechnung befindet sich in Warteschlange. wsplgen.job.error = Ein unerwarteter Fehler beim Starten von WSPLGEN ist aufgetreten. @@ -617,6 +629,11 @@ gauge.discharge.service.chart.series.title = Abflusskurve {0,date,short} - {1,date,short} gauge.discharge.service.chart.series.title.master = Aktuelle Abflusskurve ab {0,date,short} +bed.km.chart.label = Sohldaten +bed.km.chart.title = Sohldatenbestand SedDB +bedload.km.chart.label = Geschiebedaten +bedload.km.chart.title = Geschiebedatenbestand SedDB + help.state.fix.river=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.river help.state.fix.calculation.mode=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.calculation.mode help.state.fix.location=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.location diff -r a3fb76cf79b6 -r e8f152163a1e artifacts/src/main/resources/messages_en.properties --- a/artifacts/src/main/resources/messages_en.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/artifacts/src/main/resources/messages_en.properties Tue Jun 11 09:40:56 2013 +0200 @@ -211,13 +211,13 @@ chart.w_differences.yaxis.second.label = W [NN + m] chart.bedquality.title=Bed Longitudinal Section -chart.bedquality.xaxis.label=River-Km +chart.bedquality.xaxis.label={0}-km chart.bedquality.yaxis.label=Diameter [mm] chart.bedquality.yaxis.label.porosity=Porosity [%] chart.bedquality.yaxis.label.density=Density [t/m\u00b3] chart.bedheight_middle.section.title=Middle Bed Height -chart.bedheight_middle.section.yaxis.label=middle Bed Height [mm a NN] +chart.bedheight_middle.section.yaxis.label=middle Bed Height [{0}] chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung chart.flow_velocity.section.yaxis.label=Speed v [m/s] @@ -280,6 +280,9 @@ facet.bedquality.bed.density.sublayer = Density ({0,date} - {1,date}) ({2}) facet.bedquality.bed.diameter.toplayer = {0}_Bed ({1,date} - {2,date}) ({3}) facet.bedquality.bed.diameter.sublayer = {0}_Bed ({1,date} - {2,date}) ({3}) +facet.bedquality.bed.diameter.data.toplayer = {0} Bed ({1,date} - {2,date}) ({3}) - measurements +facet.bedquality.bed.diameter.data.sublayer = {0} Bed ({1,date} - {2,date}) ({3}) - measurements +facet.bedquality.bedload.diameter.data = {0} Bedload - measurements facet.bedquality.bedload.diameter = {0}_Bedload bedquality.toplayer = 0.0m - 0.3m bedquality.sublayer = 0.1m - 0.5m @@ -303,10 +306,10 @@ facet.morphologic.width = morphologic Width chart.beddifference.height.title = Bedheight Difference -chart.beddifference.height.xaxis.label = River-Km [km] +chart.beddifference.height.xaxis.label = {0}-km chart.beddifference.height.yaxis.label = Difference [cm/year] chart.beddifference.epoch.title = Bedheight Difference -chart.beddifference.xaxis.label = River-Km [km] +chart.beddifference.xaxis.label = {0}-km chart.beddifference.yaxis.label.diff = Difference [m] chart.beddifference.yaxis.label.height = Absolute Height [m] chart.beddifference.year.title = Bedheight Difference @@ -392,6 +395,8 @@ export.sqrelation.csv.header.c.duan = C (DUAN) export.sqrelation.csv.header.c.ferguson = C (FERGUSON) export.sqrelation.csv.header.variance = Standard variance +export.sqrelation.pdf.file = /jasper/sqrelation_en.jasper +export.sqrelation.pdf.mode = Load Discharge Relation export.minfo.bedquality.km = km export.minfo.bedquality.density_cap = Density Toplayer export.minfo.bedquality.density_sub = Density Sublayer @@ -400,6 +405,11 @@ export.minfo.bedquality.bedload = Bedload Diameter export.minfo.bedquality.bed_cap = Bed Diameter Toplayer export.minfo.bedquality.bed_sub = Bed Diameter Sublayer +export.minfo.beddifference.km = km +export.minfo.beddifference.diff = m +export.minfo.beddifference.pdf.file = /jasper/beddifference_en.jasper +export.minfo.beddifference.pdf.title = Bedheight Difference +export.minfo.beddifference.pdf.mode = Bedheight Difference floodmap.wmsbackground = Background Map floodmap.riveraxis = River Axis @@ -417,6 +427,8 @@ floodmap.fixpoints = Fixpoints floodmap.floodmaps = Floodmaps floodmap.usershape = User data +floodmap.isobath.class = {0,number,#.#} m to {1,number,#.#} m +floodmap.isobath.lastclass = greater {0,number,#.#} m wsplgen.job.queued = WSPLGEN job in queue. wsplgen.job.error = An unexpected error while starting WSPLGEN occured. @@ -617,6 +629,11 @@ gauge.discharge.service.chart.series.title = Discharge Curve {0,date,short} - {1,date,short} gauge.discharge.service.chart.series.title.master = Current Discharge Curve since {0,date,short} +bed.km.chart.label = Sedimentdata +bed.km.chart.title = Sedimentdata SedDB +bedload.km.chart.label = Geschiebedaten +bedload.km.chart.title = Geschiebedatenbestand SedDB + help.state.fix.river=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.river help.state.fix.calculation.mode=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.calculation.mode help.state.fix.location=${help.url}/OnlineHilfe/Fixierungsanalyse#help.state.fix.location diff -r a3fb76cf79b6 -r e8f152163a1e backend/doc/schema/oracle.sql --- a/backend/doc/schema/oracle.sql Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/doc/schema/oracle.sql Tue Jun 11 09:40:56 2013 +0200 @@ -54,7 +54,6 @@ y NUMBER(38,2) NOT NULL, cross_section_line_id NUMBER(38,0) NOT NULL, PRIMARY KEY (id), - UNIQUE (cross_section_line_id, col_pos) ); @@ -430,7 +429,7 @@ JOIN ranges r ON wqr.range_id=r.id JOIN wst_column_values wcv - ON wcv.wst_column_id=wc.id AND wcv.position between r.a and r.b; + ON wcv.wst_column_id=wc.id AND wcv.position between r.a and r.b ORDER BY wcv.position ASC, wc.position DESC; diff -r a3fb76cf79b6 -r e8f152163a1e backend/doc/schema/postgresql.sql --- a/backend/doc/schema/postgresql.sql Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/doc/schema/postgresql.sql Tue Jun 11 09:40:56 2013 +0200 @@ -259,7 +259,7 @@ JOIN ranges r ON wqr.range_id=r.id JOIN wst_column_values wcv - ON wcv.wst_column_id=wc.id AND wcv.position between r.a and r.b; + ON wcv.wst_column_id=wc.id AND wcv.position between r.a and r.b ORDER BY wcv.position ASC, wc.position DESC; @@ -315,7 +315,6 @@ col_pos int NOT NULL, x NUMERIC NOT NULL, y NUMERIC NOT NULL, - UNIQUE (cross_section_line_id, col_pos) ); -- Indices for faster access of the points diff -r a3fb76cf79b6 -r e8f152163a1e backend/src/main/java/org/dive4elements/river/importer/parsers/AtFileParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/AtFileParser.java Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/AtFileParser.java Tue Jun 11 09:40:56 2013 +0200 @@ -132,8 +132,8 @@ dischargeTable.addDischargeTableValue( new ImportDischargeTableValue( - new BigDecimal(iQ/100.0), - new BigDecimal(iW/100.0))); + new BigDecimal(iQ), + new BigDecimal(iW))); } beginning = false; diff -r a3fb76cf79b6 -r e8f152163a1e backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java Tue Jun 11 09:40:56 2013 +0200 @@ -113,7 +113,7 @@ public void parse(File file) throws IOException { log.info("Parsing bed height single file '" + file + "'"); - ImportBedHeight obj = newImportBedHeight(file.getName()); + ImportBedHeight obj = newImportBedHeight(file.getName().replaceAll("\\.csv", "")); LineNumberReader in = null; try { @@ -273,10 +273,11 @@ return true; } catch (NumberFormatException e) { - log.warn("BHP: Could not parse sounding width: " + line, e); - log.warn("-> Set default value '0'"); + log.warn("BHP: Could not parse sounding width in line '" + line + + "'. -> Set default value '0'"); } obj.setSoundingWidth(0); + return true; } return false; @@ -345,7 +346,7 @@ Matcher m = META_TYPE.matcher(line); if (m.matches()) { - String tmp = m.group(1).replace(";", ""); + String tmp = m.group(1).replace(";", "").trim(); BedHeightType bht = BedHeightType.fetchBedHeightTypeForType( tmp, ImporterSession.getInstance().getDatabaseSession()); diff -r a3fb76cf79b6 -r e8f152163a1e backend/src/main/java/org/dive4elements/river/importer/parsers/FlowVelocityModelParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/FlowVelocityModelParser.java Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/FlowVelocityModelParser.java Tue Jun 11 09:40:56 2013 +0200 @@ -250,7 +250,7 @@ Double key = Double.valueOf(km); if (kmExists.contains(key)) { - log.warn("duplicate stattion '" + km + "': -> ignored"); + log.warn("duplicate station '" + km + "': -> ignored"); return; } diff -r a3fb76cf79b6 -r e8f152163a1e backend/src/main/java/org/dive4elements/river/model/FlowVelocityModelValue.java --- a/backend/src/main/java/org/dive4elements/river/model/FlowVelocityModelValue.java Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/FlowVelocityModelValue.java Tue Jun 11 09:40:56 2013 +0200 @@ -154,7 +154,8 @@ "from FlowVelocityModelValue where " + " flowVelocity=:model and" + " station >= :kmLo and " + - " station <= :kmHi"); + " station <= :kmHi" + + " order by station"); query.setParameter("model", model); query.setParameter("kmLo", new BigDecimal(kmLo)); diff -r a3fb76cf79b6 -r e8f152163a1e backend/src/main/java/org/dive4elements/river/model/River.java --- a/backend/src/main/java/org/dive4elements/river/model/River.java Wed Jun 05 11:56:38 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/model/River.java Tue Jun 11 09:40:56 2013 +0200 @@ -290,19 +290,34 @@ /** * This method returns the first gauge that is intersected by a and - * b, + * b, but which possibly does not ends with a or starts with b. * * @param a A start point. * @param b An end point. * - * @return the first intersecting gauge. + * @return the first intersecting gauge that does not border with a or b, + * the first intersecting gauge if that is impossible. */ public Gauge determineGauge(double a, double b) { List gauges = determineGauges(a, b); - int idx = a < b ? 0 : gauges.size() - 1; + if (a > b) { + for (int i = gauges.size() - 1; i >= 0; i--) { + Gauge g = gauges.get(i); + if (KM_CMP.compare(g.getRange().getA().doubleValue(), a) == 0) + continue; + return g; + } + } - return gauges.isEmpty() ? null : gauges.get(idx); + for (Gauge g: gauges) { + if (KM_CMP.compare(g.getRange().getB().doubleValue(), a) == 0) { + continue; + } + return g; + } + + return null; } /** diff -r a3fb76cf79b6 -r e8f152163a1e contrib/make_flys_release/README --- a/contrib/make_flys_release/README Wed Jun 05 11:56:38 2013 +0200 +++ b/contrib/make_flys_release/README Tue Jun 11 09:40:56 2013 +0200 @@ -27,6 +27,8 @@ BACKENDUSER BACKENDPASS +FEATURES_XML (Wenn gesetzt pfad zu einer zu verwendenden features.xml) + Prozess: ======== Als erstes muss man eine halbwegs aktuelle version von artifacts-common diff -r a3fb76cf79b6 -r e8f152163a1e contrib/make_flys_release/make_release.sh --- a/contrib/make_flys_release/make_release.sh Wed Jun 05 11:56:38 2013 +0200 +++ b/contrib/make_flys_release/make_release.sh Tue Jun 11 09:40:56 2013 +0200 @@ -66,16 +66,16 @@ # --seddb-back Sediment db backend. Default: $SEDDBBACK TOMCAT_PORT=${TOMCAT_PORT:-8282} MAPSERVER_URL=${MAPSERVER_URL:-http://flys-devel.intevation.de} -WIKI_URL=${WIKI_URL:-https://flys-intern.intevation.de/Flys-3.0} +WIKI_URL=${WIKI_URL:-https://flys3-devel.bafg.de/wiki} # Prefix to FreeSans.ttf FONT_PATH=${FONT_PATH:-/opt/flys} # Seddb Configuration SEDDBURL=${SEDDBURL:-czech-republic.atlas.intevation.de} -SEDDBPORT=${SEDDBPORT:-1521} -SEDDBBACK=${SEDDBBACK:-XE} -SEDDBUSER=${SEDDBUSER:-seddb} -SEDDBPASS=${SEDDBPASS:-seddbpass} +SEDDBPORT=${SEDDBPORT:-5432} +SEDDBBACK=${SEDDBBACK:-seddb} +SEDDBUSER=${SEDDBUSER:-flys} +SEDDBPASS=${SEDDBPASS:-flys} SEDINITSQLS=${SEDINITSQLS:-} @@ -199,7 +199,10 @@ sed -i -e "s@/tmp/flys-client.log@${LOG_DIR}/client-${VERSION}.log@g" \ $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/log4j.properties -# XXX: Are they really used at runtime? +if [ -r "$FEATURES_XML" ]; then + cp "$FEATURES_XML" $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/features.xml +fi + find $FLYS_SOURCE_DIR/river/ -name \*.properties -o -name \*.xsl | \ xargs sed -i "s@https://flys-intern.intevation.de@${WIKI_URL}@g"; @@ -293,18 +296,6 @@ -e "s@http://example.com@${WIKI_URL}@g" \ $WORK_DIR/server/conf/conf.xml -cat > $WORK_DIR/server/conf/seddb-db.xml << EOF - - - - $SEDDBUSER - $SEDDBPASS - org.hibernate.dialect.Oracle9iDialect - oracle.jdbc.driver.OracleDriver - jdbc:oracle:thin:@//$SEDDBURL:$SEDDBPORT/$SEDDBBACK - $SEDINITSQLS - -EOF if [ "$BUILD_ORACLE" = "TRUE" ]; then # Oracle backend configuration @@ -319,6 +310,19 @@ $INITSQLS EOF + +cat > $WORK_DIR/server/conf/seddb-db.xml << EOF + + + $SEDDBUSER + $SEDDBPASS + org.hibernate.dialect.Oracle9iDialect + oracle.jdbc.driver.OracleDriver + jdbc:oracle:thin:@//$SEDDBURL:$SEDDBPORT/$SEDDBBACK + $SEDINITSQLS + +EOF + else #Postgresql backend configuration cat > $WORK_DIR/server/conf/backend-db.xml << EOF @@ -332,6 +336,18 @@ $INITSQLS EOF + +cat > $WORK_DIR/server/conf/seddb-db.xml << EOF + + + $SEDDBUSER + $SEDDBPASS + org.hibernate.dialect.PostgreSQLDialect + org.postgresql.Driver + jdbc:postgresql://$SEDDBURL:$SEDDBPORT/$SEDDBBACK + +EOF + fi mkdir $WORK_DIR/artifactsdb diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java Tue Jun 11 09:40:56 2013 +0200 @@ -284,6 +284,7 @@ public void onSuccess(River[] newRivers) { GWT.log("Retrieved " + newRivers.length + " new rivers."); rivers = newRivers; + newProject(); } }); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Tue Jun 11 09:40:56 2013 +0200 @@ -604,6 +604,10 @@ String bed_difference_height_year(); + String bedheight_difference_export(); + + String fix_waterlevel_export(); + // ERRORS String error_years_wrong(); @@ -922,6 +926,8 @@ String datacage_add_pair(); + String delta_w(); + // Capabilities Information Panel String addwmsInputTitle(); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue Jun 11 09:40:56 2013 +0200 @@ -255,9 +255,10 @@ bed_diameter = Bed Diameter soundings = Soundings soundings_width = Soundings Width -bed_difference_year = Single Bedheight Differences +bed_difference_year = Bedheight Differences bed_difference_epoch = Epoch Bedheight Differences bed_difference_height_year = Bedheight Differences per year +bedheight_difference_export = Bedheight Differences Export exportATTooltip = Export as AT file @@ -280,6 +281,7 @@ eventselect = Eventselection events = Events kmchart = W/Q-Preview +fix_waterlevel_export = Fixing analysis export chart_themepanel_header_themes = Theme chart_themepanel_header_actions = Actions @@ -489,6 +491,7 @@ measurements = Measurements floodmarks = Flood Marks pegel_had_measurement_points = HAD Discharge-Measurement points +delta_w = Delta W # No translation for the pegelonline wms service layer names. gauge_points = Pegelpunkte (WSV) gauge_level = Aktueller Wasserstand (WSV) diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue Jun 11 09:40:56 2013 +0200 @@ -255,9 +255,10 @@ bed_diameter = Sohldurchmesser soundings = Peilungen soundings_width = Gepeilte Breite -bed_difference_year = Sohlh\u00f6hendifferenz (Jahr) +bed_difference_year = Sohlh\u00f6hendifferenz bed_difference_epoch = Sohlh\u00f6hendifferenz (Epoche) bed_difference_height_year = Sohlh\u00f6hendifferenz pro Jahr +bedheight_difference_export = Sohlh\u00f6hendifferenz Export waterlevel_export = Wasserstand/Wasserspiegellagen Export waterlevel_report = Wasserstand/Wasserspiegellagen Bericht @@ -278,6 +279,7 @@ eventselect = Ereignisauswahl events = Ereignisse kmchart = W/Q-Vorschau +fix_waterlevel_export = Fixierungsanalysen Export exportATTooltip = Daten als AT Datei exportieren @@ -494,6 +496,7 @@ measurements = Messungen floodmarks = HW-Marken pegel_had_measurement_points = HAD Abflussmessstellen (WMS) +delta_w = W Differenzen gauge_points = Pegelmessstelle (WMS) gauge_level = Wasserstand (WMS) gauge_names = Pegelname (WMS) diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Tue Jun 11 09:40:56 2013 +0200 @@ -253,9 +253,10 @@ bed_diameter = Bed Diameter soundings = Soundings soundings_width = Soundings Width -bed_difference_year = Single Bedheight Differences +bed_difference_year = Bedheight Differences bed_difference_epoch = Epoch Bedheight Differences bed_difference_height_year = Bedheight Difference per year +bedheight_difference_export = Bedheight Differences Export exportATTooltip = Export as AT file @@ -278,6 +279,7 @@ eventselect = Eventselection events = Events kmchart = W/Q-Preview +fix_waterlevel_export = Fixing analysis export chart_themepanel_header_themes = Theme chart_themepanel_header_actions = Actions @@ -473,6 +475,7 @@ bedheights = Bedheights morph_width = morphologic Width datacage = Datacage +delta_w = Delta W startcolor = Colorrange start color endcolor = Colorrange end color diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractUIProvider.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractUIProvider.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractUIProvider.java Tue Jun 11 09:40:56 2013 +0200 @@ -19,6 +19,7 @@ import com.smartgwt.client.widgets.layout.VLayout; import org.dive4elements.river.client.client.FLYSConstants; +import org.dive4elements.river.client.client.FLYS; import org.dive4elements.river.client.client.event.HasStepBackHandlers; import org.dive4elements.river.client.client.event.HasStepForwardHandlers; import org.dive4elements.river.client.client.event.StepBackEvent; @@ -178,11 +179,11 @@ @Override - public Canvas createHelpLink(DataList dataList, Data data) { + public Canvas createHelpLink(DataList dataList, Data data, FLYS instance) { String iUrl = GWT.getHostPageBaseURL() + MSG.getFeatureInfo(); String helpUrl = dataList.getHelpText(); - return new ImgLink(iUrl, helpUrl, 30, 30, true); + return new WikiImgLink(iUrl, helpUrl, 30, 30, instance); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DatacageWidget.java Tue Jun 11 09:40:56 2013 +0200 @@ -381,6 +381,7 @@ String name = node.getAttribute("facet"); String ids = node.getAttribute("ids"); String displayname = node.getAttribute("name"); + String targetOut = node.getAttribute("target_out"); String debugAttributeValues = ""; for (String attr: node.getAttributes()) { debugAttributeValues += ("[" + attr +": " @@ -394,7 +395,8 @@ out, name, ids, - displayname); + displayname, + targetOut); } TreeNode [] children = tree.getChildren(node); if (children != null) { diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DemDatacagePanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DemDatacagePanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DemDatacagePanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -46,12 +46,6 @@ @Override - public User getUser() { - return null; - } - - - @Override public String getOuts() { return OUT; } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ImgLink.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ImgLink.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ImgLink.java Tue Jun 11 09:40:56 2013 +0200 @@ -14,13 +14,13 @@ public class ImgLink extends HTMLPane { - private int width; - private int height; + protected int width; + protected int height; - private String href; - private String imgUrl; + protected String href; + protected String imgUrl; - private boolean newTab; + protected boolean newTab; public ImgLink(String imgUrl, String href, int width, int height) { diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/LinkSelection.java Tue Jun 11 09:40:56 2013 +0200 @@ -16,7 +16,10 @@ import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.HTMLPane; +import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.events.VisibilityChangedEvent; +import com.smartgwt.client.widgets.events.VisibilityChangedHandler; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.LinkItem; import com.smartgwt.client.widgets.form.fields.events.ClickEvent; @@ -42,6 +45,7 @@ */ public class LinkSelection extends MapSelection +implements VisibilityChangedHandler { private static final long serialVersionUID = -7138270638349711024L; @@ -51,7 +55,9 @@ /** The selected river*/ protected Data river; - private static Map rivers; + private static Map riverHighlight; + private static Map riverList; + private static String selected; private static HLayout columns; private static Trigger trigger; @@ -95,7 +101,8 @@ public Canvas create(DataList data) { trigger = new Trigger(this); createCallback(); - rivers = new HashMap(); + riverHighlight = new HashMap(); + riverList = new HashMap(); VLayout v = new VLayout(); v.setMembersMargin(10); @@ -182,22 +189,37 @@ int counter = 0; for (DataItem item: d.getItems()) { + HLayout row = new HLayout(); LinkItem link = new LinkItem("river"); + link.setHoverDelay(0); link.setLinkTitle(item.getLabel()); link.setTarget(item.getStringValue()); link.setShowTitle(false); + Img img = new Img(); + img.setShowTitle(false); + img.setSrc("symbol_selected.png"); + img.setWidth(18); + img.setHeight(18); + img.setVisible(false); + Canvas container = new Canvas(); + container.addChild(img); + container.setHeight(20); + container.setWidth(20); DynamicForm f = new DynamicForm(); - rivers.put(item.getStringValue(), link); - + riverList.put(item.getStringValue(), row); + riverHighlight.put(item.getStringValue(), img); f.setItems(link); + row.addMember(container); + row.addMember(f); + row.addVisibilityChangedHandler(this); + link.setColSpan(20); if (counter < d.getItems().length/2) { - formLayout1.addMember(f); + formLayout1.addMember(row); } else { - formLayout2.addMember(f); + formLayout2.addMember(row); } counter++; - link.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -218,27 +240,22 @@ @Override public void onItemHover(ItemHoverEvent event) { String river = ((LinkItem)event.getItem()).getLinkTitle(); - for (Map.Entry entry: rivers.entrySet()) { - String s = entry.getKey(); - LinkItem item = entry.getValue(); - if (item.getLinkTitle().equals(river)) { - item.setCellStyle("riverLinkHighlight"); - callHighlightRiver(river); + Img item = riverHighlight.get(river); + if (item != null) { + item.setVisible(true); + if (selected != null && !selected.equals(river)) { + riverHighlight.get(selected).setVisible(false); + callUnHighlightRiver(selected); } - else { - item.setCellStyle("formCell"); - callUnHighlightRiver(s); - } - } - if (columns != null) { - columns.redraw(); + callHighlightRiver(river); + selected = river; } } }); } if (module != null) { - getModuleSelection().setRivers(rivers); + getModuleSelection().setRivers(riverList); } label.setWidth(50); @@ -248,7 +265,6 @@ layout.addMember(columns); } - layout.addMember(getNextButton()); HTMLPane map = new HTMLPane(); map.setContentsURL("images/FLYS_Karte_interactive.html"); @@ -270,24 +286,31 @@ private native void createCallback() /*-{ $wnd.highlightRiver = @org.dive4elements.river.client.client.ui.LinkSelection::highlightCallback(Ljava/lang/String;); + $wnd.unHighlightRiver = @org.dive4elements.river.client.client.ui.LinkSelection::unHighlightCallback(Ljava/lang/String;); $wnd.selectRiver = @org.dive4elements.river.client.client.ui.LinkSelection::selectCallback(Ljava/lang/String;); $wnd.availableRiver = @org.dive4elements.river.client.client.ui.LinkSelection::availableRiver(Ljava/lang/String;); }-*/; private static void highlightCallback(String name) { - for (Map.Entry entry: rivers.entrySet()) { - String s = entry.getKey(); - LinkItem item = entry.getValue(); - item.setCellStyle(s.equals(name) ? "riverLinkHighlight" : "formCell"); + if (riverHighlight.containsKey(name)) { + riverHighlight.get(name).setVisible(true); + if(selected != null && !selected.equals(name)) { + riverHighlight.get(selected).setVisible(false); + } + selected = name; } - if (columns != null) { - columns.redraw(); + } + + private static void unHighlightCallback(String name) { + if (riverHighlight.containsKey(name)) { + riverHighlight.get(name).setVisible(false); + selected = null; } } private static boolean availableRiver(String river) { - LinkItem ri = rivers.get(river); - return ri != null && ri.isVisible(); + HLayout row = riverList.get(river); + return row != null && row.isVisible(); } private static void selectCallback(String name) { @@ -303,5 +326,15 @@ private native void callUnHighlightRiver(String name) /*-{ $wnd.unHighlight(name); }-*/; + + + @Override + public void onVisibilityChanged(VisibilityChangedEvent event) { + for (Map.Entry entry: riverHighlight.entrySet()) { + entry.getValue().setVisible(false); + callUnHighlightRiver(entry.getKey()); + } + selected = null; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java Tue Jun 11 09:40:56 2013 +0200 @@ -16,7 +16,6 @@ import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.LinkItem; import com.smartgwt.client.widgets.form.fields.RadioGroupItem; import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; @@ -55,7 +54,7 @@ protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); /** The module checkboxes.*/ - protected RadioGroupItem radio; + protected static RadioGroupItem radio; /** */ protected Module[] modules; @@ -65,7 +64,7 @@ private List fixRivers; private List minfoRivers; - protected Map rivers; + protected Map rivers; /** * The default constructor. @@ -110,6 +109,7 @@ @Override public Canvas create(DataList data) { GWT.log("ModuleSelection - create()"); + createCallback(); VLayout newLayout = new VLayout(); newLayout.setMembersMargin(10); newLayout.setAlign(VerticalAlignment.TOP); @@ -179,7 +179,7 @@ public void onChange(ChangeEvent event) { String selected = (String)event.getValue(); if (!rivers.isEmpty()) { - for (Map.Entry s: rivers.entrySet()) { + for (Map.Entry s: rivers.entrySet()) { if (selected.equals("minfo") && !minfoRivers.contains(s.getKey())) { s.getValue().hide(); } @@ -188,9 +188,7 @@ } else { s.getValue().show(); - s.getValue().setCellStyle("formCell"); } - callUnHighlightRiver(s.getKey()); } } } @@ -235,12 +233,17 @@ return new Data[] {data}; } - public void setRivers(Map rivers) { + public void setRivers(Map rivers) { this.rivers = rivers; } - private native void callUnHighlightRiver(String name) /*-{ - $wnd.unHighlight(name); + private native void createCallback() /*-{ + $wnd.getModule = @org.dive4elements.river.client.client.ui.ModuleSelection::getSelectedModule(); }-*/; + + private static String getSelectedModule() { + GWT.log("selected: " + radio.getValueAsString()); + return radio.getValueAsString(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java Tue Jun 11 09:40:56 2013 +0200 @@ -576,7 +576,7 @@ if (current != null && uiProvider != null) { Canvas c = uiProvider.create(current); - Canvas h = uiProvider.createHelpLink(current, null); + Canvas h = uiProvider.createHelpLink(current, null, this.flys); HLayout wrapper = new HLayout(); wrapper.addMember(h); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -44,7 +44,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -242,13 +241,10 @@ List errors = new ArrayList(); NumberFormat nf = NumberFormat.getDecimalFormat(); - Iterator iter = wqranges.keySet().iterator(); + for (Map.Entry entry: wqranges.entrySet()) { - while (iter.hasNext()) { - List tmpErrors = new ArrayList(); - - String key = iter.next(); - DoubleArrayPanel dap = wqranges.get(key); + String key = entry.getKey(); + DoubleArrayPanel dap = entry.getValue(); if (!dap.validateForm()) { errors.add(MSG.error_invalid_double_value()); @@ -261,6 +257,7 @@ continue; } + List tmpErrors = new ArrayList(); double[] values = dap.getInputValues(); // might geht npe here if one field not filled double[] good = new double[values.length]; @@ -362,10 +359,9 @@ protected Data getWQValues() { String wqvalue = null; - Iterator iter = wqranges.keySet().iterator(); - while (iter.hasNext()) { - String key = iter.next(); - DoubleArrayPanel dap = wqranges.get(key); + for (Map.Entry entry: wqranges.entrySet()) { + String key = entry.getKey(); + DoubleArrayPanel dap = entry.getValue(); double[] values = dap.getInputValues(); if (wqvalue == null) { diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -16,7 +16,9 @@ import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Widget; +import com.google.gwt.user.client.ui.HTML; +import org.dive4elements.river.client.client.FLYS; import org.dive4elements.river.client.client.FLYSConstants; import org.dive4elements.river.client.shared.model.RiverInfo; @@ -27,6 +29,9 @@ */ public class RiverInfoPanel extends HorizontalPanel { + /** The flys instance */ + protected FLYS flys; + /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -35,7 +40,9 @@ public final static int PADDING = 8; public final static int MARGIN = 10; - public RiverInfoPanel(RiverInfo riverinfo) { + public RiverInfoPanel(FLYS flys, RiverInfo riverinfo) { + this.flys = flys; + setStyleName("riverinfopanel"); setHeight("" + HEIGHT + "px"); setVerticalAlignment(ALIGN_MIDDLE); @@ -91,8 +98,8 @@ String url = number != null ? MSG.gauge_river_url() + number : MSG.gauge_river_url(); - Anchor anchor = new Anchor(MSG.gauge_river_info_link(), url, "_blank"); - add(anchor); + add(new HTML(WikiLinks.linkHTML(this.flys, url, + MSG.gauge_river_info_link()))); } public static int getStaticHeight() { diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java Tue Jun 11 09:40:56 2013 +0200 @@ -31,7 +31,6 @@ import org.dive4elements.river.client.shared.model.DefaultDataItem; import java.util.ArrayList; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; @@ -260,14 +259,13 @@ @Override protected Data[] getData() { Map values = form.getValues(); - Iterator keys = values.keySet().iterator(); Data[] list = new Data[values.size()]; int i = 0; - while (keys.hasNext()) { - String fieldname = ((String) keys.next()).replace('_', ' '); - String selection = (String) values.get(fieldname); + for (Map.Entry entry: values.entrySet()) { + String fieldname = ((String)entry.getKey()).replace('_', ' '); + String selection = (String)entry.getValue(); DataItem item = new DefaultDataItem(fieldname, null, selection); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java Tue Jun 11 09:40:56 2013 +0200 @@ -49,7 +49,6 @@ import org.dive4elements.river.client.shared.model.Theme; import java.util.Arrays; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; @@ -196,9 +195,7 @@ LinkedHashMap valueMap = new LinkedHashMap(); valueMap.put("aktuell", "Aktuell"); - Iterator iter = keys.iterator(); - while (iter.hasNext()) { - String s = iter.next().toString(); + for (String s: keys) { Style tmp = styleGroups.get(s); tmp.setFacet(current.getFacet()); tmp.setIndex(current.getIndex()); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProvider.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProvider.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProvider.java Tue Jun 11 09:40:56 2013 +0200 @@ -18,6 +18,8 @@ import org.dive4elements.river.client.shared.model.Artifact; import org.dive4elements.river.client.shared.model.Collection; +import org.dive4elements.river.client.client.FLYS; + /** * This interface describes a method that creates a Canvas element displaying * DataItems for a current state of the artifact. @@ -48,7 +50,7 @@ public Canvas createOld(DataList dataList); - public Canvas createHelpLink(DataList dataList, Data data); + public Canvas createHelpLink(DataList dataList, Data data, FLYS instance); /** diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -51,7 +51,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -220,7 +219,6 @@ return; } - int idx = e.getColNum(); Record r = e.getRecord(); double val = r.getAttributeAsDouble("value"); @@ -385,13 +383,10 @@ List errors = new ArrayList(); NumberFormat nf = NumberFormat.getDecimalFormat(); - Iterator iter = wqranges.keySet().iterator(); + for (Map.Entry entry: wqranges.entrySet()) { - while (iter.hasNext()) { - List tmpErrors = new ArrayList(); - - String key = iter.next(); - DoubleArrayPanel dap = wqranges.get(key); + String key = entry.getKey(); + DoubleArrayPanel dap = entry.getValue(); if (!dap.validateForm()) { errors.add(MSG.error_invalid_double_value()); @@ -409,6 +404,7 @@ int idx = 0; + List tmpErrors = new ArrayList(); for (double value: values) { if (value < mm[0] || value > mm[1]) { String tmp = MSG.error_validate_range(); @@ -697,10 +693,9 @@ protected Data getWQValues() { String wqvalue = null; - Iterator iter = wqranges.keySet().iterator(); - while (iter.hasNext()) { - String key = iter.next(); - DoubleArrayPanel dap = wqranges.get(key); + for (Map.Entry entry: wqranges.entrySet()) { + String key = entry.getKey(); + DoubleArrayPanel dap = entry.getValue(); String label = dap.getItemTitle(); double[] values = dap.getInputValues(); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiImgLink.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiImgLink.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,33 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * 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.client.client.ui; + +import com.smartgwt.client.types.Overflow; + +import org.dive4elements.river.client.client.FLYS; +import org.dive4elements.river.client.client.ui.WikiLinks; + +public class WikiImgLink extends ImgLink { + + protected FLYS instance; + + public WikiImgLink(String imgUrl, String href, int width, int height, FLYS instance) { + super(imgUrl, href, width, height, false); + this.instance = instance; + update(); + } + + @Override + protected void update() { + setContents(WikiLinks.imageLinkHTML(instance, href, imgUrl)); + setWidth(width); + setHeight(height); + setOverflow(Overflow.VISIBLE); + } +} diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WikiLinks.java Tue Jun 11 09:40:56 2013 +0200 @@ -0,0 +1,65 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * 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.client.client.ui; + +import com.smartgwt.client.widgets.grid.CellFormatter; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; + +import org.dive4elements.river.client.client.FLYS; + +public class WikiLinks +{ + public static String imageLinkHTML(FLYS instance, String url, String imageUrl) { + String saml = null; + if (instance != null && instance.getCurrentUser() != null) { + saml = instance.getCurrentUser().getSamlXMLBase64(); + } + String quotedUrl = SafeHtmlUtils.htmlEscape(url); + String quotedImage = SafeHtmlUtils.htmlEscape(imageUrl); + + if (saml != null) { + return "
" + + "" + + "" + + "
"; + } + else { + return ""; + } + } + + public static String linkHTML(FLYS flys, String url, String text) { + String saml = flys.getCurrentUser().getSamlXMLBase64(); + String quotedUrl = SafeHtmlUtils.htmlEscape(url); + String quotedText = SafeHtmlUtils.htmlEscape(text); + if (saml != null) { + return "
" + + "" + + "" + + "
"; + } + else { + return "" + quotedText + ""; + } + } + + public static CellFormatter cellFormatter(final FLYS flys) { + return new CellFormatter() { + public String format(Object value, ListGridRecord record, + int rowNum, int colNum) { + return linkHTML(flys, (String)value, record.getLinkText()); + } + }; + } +} diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartToolbar.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartToolbar.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/ChartToolbar.java Tue Jun 11 09:40:56 2013 +0200 @@ -118,7 +118,7 @@ if (chartTab.getMode().getName().equals("fix_wq_curve")) { exportAT = new ImgLink( - baseUrl + MSG.downloadCSV(), + baseUrl + MSG.downloadAT(), moduleUrl + "export" + "?uuid=" + chartTab.getCollection().identifier() + "&name=" + chartTab.getMode().getName() + @@ -335,6 +335,7 @@ exportAT.setSource( moduleUrl + "export" + "?uuid=" + chartTab.getCollection().identifier() + + "&name=" + chartTab.getMode().getName() + "&mode=" + chartTab.getMode().getName() + "_at_export" + "&type=at" + "&server=" + config.getServerUrl() + diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/CrossSectionChartThemePanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/CrossSectionChartThemePanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/CrossSectionChartThemePanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -79,7 +79,7 @@ /** Data item name for CrossSections selected km. */ protected static String CS_KM = "cross_section.km"; - /** Data item name for CrossSections selected km. */ + /** Data item name for CrossSections reference ('master') flag. */ protected static String CS_IS_MASTER = "cross_section.master?"; /** List of cross-section themes through which is moved through synchronously. */ @@ -178,6 +178,8 @@ } // There is none selected. Take the first one. if (firstCSUuid != null) { + // TODO better take the one closest to first km! + // issue1157, query next/prev kms, select the one which is closest. setCurrentCSMaster(firstCSUuid); feedTellMaster(firstCSUuid); } @@ -410,7 +412,11 @@ * \param to. */ @Override - public void spinnerValueEntered(KMSpinner spinner, final double enteredKm, final FacetRecord facetRecord, final boolean up) { + public void spinnerValueEntered(KMSpinner spinner, + final double enteredKm, + final FacetRecord facetRecord, + final boolean up + ) { disable(); Config config = Config.getInstance(); final String locale = config.getLocale(); @@ -502,6 +508,7 @@ String fieldName = this.getFieldName(colNum); + // Place KMSpinner in Grid with currently chosen km value. if (fieldName.equals(GRID_FIELD_ACTIONS)) { double currentValue = Double.valueOf(facetRecord.getTheme().getCollectionItem().getData().get(CS_KM)); @@ -520,6 +527,7 @@ list.setShowAllRecords(true); list.setShowHeaderContextMenu(false); list.setLeaveScrollbarGap(false); + return list; } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java Tue Jun 11 09:40:56 2013 +0200 @@ -23,7 +23,6 @@ import org.dive4elements.river.client.shared.model.DefaultDataItem; import java.util.HashMap; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; @@ -145,15 +144,14 @@ @Override public Data[] getData() { - Map values = form.getValues(); - Iterator keys = values.keySet().iterator(); + Map values = form.getValues(); Data[] list = new Data[values.size()]; int i = 0; - while (keys.hasNext()) { - String fieldname = (String) keys.next(); - String selection = (String) values.get(fieldname); + for (Map.Entryentry: values.entrySet()) { + String fieldname = (String)entry.getKey(); + String selection = (String)entry.getValue(); DataItem item = new DefaultDataItem(fieldname, null, selection); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPrintPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPrintPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPrintPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,44 +8,42 @@ package org.dive4elements.river.client.client.ui.map; -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.Window; - -import com.smartgwt.client.util.SC; -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.TextItem; -import com.smartgwt.client.widgets.form.fields.ButtonItem; -import com.smartgwt.client.widgets.form.fields.SelectItem; -import com.smartgwt.client.widgets.form.fields.events.ClickEvent; -import com.smartgwt.client.widgets.form.fields.events.ClickHandler; -import com.smartgwt.client.types.Alignment; - -import org.gwtopenmaps.openlayers.client.Bounds; -import org.gwtopenmaps.openlayers.client.Map; - import org.dive4elements.river.client.client.Config; import org.dive4elements.river.client.client.FLYSConstants; import org.dive4elements.river.client.client.services.CollectionAttributeService; import org.dive4elements.river.client.client.services.CollectionAttributeServiceAsync; +import org.dive4elements.river.client.shared.model.Artifact; +import org.dive4elements.river.client.shared.model.ArtifactDescription; import org.dive4elements.river.client.shared.model.Collection; +import org.dive4elements.river.client.shared.model.Data; +import org.dive4elements.river.client.shared.model.DataItem; +import org.dive4elements.river.client.shared.model.DataList; import org.dive4elements.river.client.shared.model.OutputSettings; import org.dive4elements.river.client.shared.model.Property; import org.dive4elements.river.client.shared.model.PropertySetting; import org.dive4elements.river.client.shared.model.Settings; -import org.dive4elements.river.client.shared.model.Artifact; -import org.dive4elements.river.client.shared.model.ArtifactDescription; -import org.dive4elements.river.client.shared.model.Data; -import org.dive4elements.river.client.shared.model.DataItem; -import org.dive4elements.river.client.shared.model.DataList; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.ButtonItem; +import com.smartgwt.client.widgets.form.fields.SelectItem; +import com.smartgwt.client.widgets.form.fields.TextItem; +import com.smartgwt.client.widgets.form.fields.events.ClickEvent; +import com.smartgwt.client.widgets.form.fields.events.ClickHandler; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.MissingResourceException; +import org.gwtopenmaps.openlayers.client.Bounds; +import org.gwtopenmaps.openlayers.client.Map; + public class MapPrintPanel extends Canvas { private static final String MAPFISH_MAPTITLE = "mapfish_mapTitle"; @@ -138,7 +136,7 @@ this.pageCreator.setTitle(MSG.mapCreator()); this.pageDatePlace.setTitle(MSG.mapDate()); - pageTitle.setLength(30); + pageTitle.setLength(20); pageSubtitle.setLength(30); pageRange.setLength(30); pageStretch.setLength(30); @@ -201,6 +199,7 @@ ButtonItem btn = new ButtonItem(); btn.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent event) { updateCollection(); Window.open(createPrintUrl(), "_blank", ""); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedMultiPeriodPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedMultiPeriodPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedMultiPeriodPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -11,7 +11,7 @@ import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.events.ResizedEvent; import com.smartgwt.client.widgets.events.ResizedHandler; -import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.layout.HLayout; import org.dive4elements.river.client.client.ui.MultiPeriodPanel; @@ -28,7 +28,7 @@ protected Canvas createHelper() { chartContainer1 = new BedCampaignChart(artifact, this); chartContainer2 = new BedloadCampaignChart(artifact, this); - VLayout layout = new VLayout(); + HLayout layout = new HLayout(); layout.addMember(chartContainer1); layout.addMember(chartContainer2); return layout; diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java Tue Jun 11 09:40:56 2013 +0200 @@ -21,6 +21,7 @@ import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import org.dive4elements.river.client.client.FLYS; +import org.dive4elements.river.client.client.ui.WikiLinks; import org.dive4elements.river.client.shared.model.Data; import org.dive4elements.river.client.shared.model.DataItem; import org.dive4elements.river.client.shared.model.DataList; @@ -44,6 +45,7 @@ ListGridField stfield = new ListGridField("station", "Station [km]"); ListGridField lfield = new ListGridField("link", "Info"); lfield.setType(ListGridFieldType.LINK); + lfield.setCellFormatter(WikiLinks.cellFormatter(flys)); ListGridField cfield = new ListGridField("curvelink", MSG.gauge_curve_link()); cfield.addRecordClickHandler(this); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugePanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugePanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugePanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -29,7 +29,7 @@ * @param flys The FLYS object */ public GaugePanel(FLYS flys) { - super(new GaugeListGrid(flys)); + super(flys, new GaugeListGrid(flys)); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -14,6 +14,7 @@ import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.layout.SectionStackSection; import com.smartgwt.client.widgets.layout.VLayout; +import org.dive4elements.river.client.client.FLYS; import org.dive4elements.river.client.client.FLYSConstants; import org.dive4elements.river.client.client.services.RiverInfoService; import org.dive4elements.river.client.client.services.RiverInfoServiceAsync; @@ -26,6 +27,9 @@ */ public abstract class InfoPanel extends VLayout { + /** The instance of FLYS */ + protected FLYS flys; + /** SectionStackSection where this InfoPanel belongs in*/ protected SectionStackSection section; @@ -44,7 +48,7 @@ public final static String SECTION_ID = "InfoPanelSection"; - public InfoPanel(InfoListGrid listgrid) { + public InfoPanel(FLYS flys, InfoListGrid listgrid) { SectionStackSection section = new SectionStackSection(); section.setExpanded(false); section.setTitle(getSectionTitle()); @@ -54,6 +58,8 @@ setOverflow(Overflow.HIDDEN); setStyleName("infopanel"); + this.flys = flys; + section.setHidden(true); section.setItems(this); this.section = section; @@ -80,7 +86,7 @@ protected void render(RiverInfo riverinfo) { if (this.riverinfopanel == null) { - this.riverinfopanel = new RiverInfoPanel(riverinfo); + this.riverinfopanel = new RiverInfoPanel(this.flys, riverinfo); this.addMember(this.riverinfopanel, 0); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationListGrid.java Tue Jun 11 09:40:56 2013 +0200 @@ -19,6 +19,7 @@ import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import org.dive4elements.river.client.client.FLYS; +import org.dive4elements.river.client.client.ui.WikiLinks; import org.dive4elements.river.client.shared.model.MeasurementStation; import org.dive4elements.river.client.shared.model.RiverInfo; @@ -40,6 +41,7 @@ ListGridField stfield = new ListGridField("station", "Station [km]"); ListGridField lfield = new ListGridField("link", "Link"); lfield.setType(ListGridFieldType.LINK); + lfield.setCellFormatter(WikiLinks.cellFormatter(flys)); ListGridField cfield = new ListGridField("curvelink", "SQ"); cfield.addRecordClickHandler(this); this.setFields(nfield, sfield, efield, stfield, lfield, cfield); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationPanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationPanel.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationPanel.java Tue Jun 11 09:40:56 2013 +0200 @@ -27,7 +27,7 @@ * @param flys The FLYS object */ public MeasurementStationPanel(FLYS flys) { - super(new MeasurementStationListGrid(flys)); + super(flys, new MeasurementStationListGrid(flys)); } /** diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactDescriptionFactory.java Tue Jun 11 09:40:56 2013 +0200 @@ -575,12 +575,15 @@ Recommendation[] rec = new Recommendation[num]; for (int i = 0; i < num; i++) { - Element e = (Element) list.item(i); - String factory = e.getAttribute("factory"); - String index = e.getAttribute("ids"); + Element e = (Element) list.item(i); + String factory = e.getAttribute("factory"); + String index = e.getAttribute("ids"); + String targetOut = e.getAttribute("target_out"); if (factory != null && factory.length() > 0) { - rec[i] = new Recommendation(factory, index); + logger.debug("Adding Recommendation. Factory: " + factory + + " IDs: " + index + " target out " + targetOut); + rec[i] = new Recommendation(factory, index, null, null, targetOut); } } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ArtifactHelper.java Tue Jun 11 09:40:56 2013 +0200 @@ -71,20 +71,23 @@ String uuid; String ids; CreationFilter filter; + String targetOut; if (recommendation != null) { - uuid = recommendation.getMasterArtifact(); - ids = recommendation.getIDs(); - filter = convertFilter(recommendation.getFilter()); + uuid = recommendation.getMasterArtifact(); + ids = recommendation.getIDs(); + filter = convertFilter(recommendation.getFilter()); + targetOut = recommendation.getTargetOut(); } else { - uuid = null; - ids = null; - filter = null; + uuid = null; + ids = null; + filter = null; + targetOut = null; } Document create = ClientProtocolUtils.newCreateDocument( - factory, uuid, ids, filter); + factory, uuid, ids, filter, targetOut); return sendCreate(serverUrl, locale, create); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/CapabilitiesParser.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/CapabilitiesParser.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/CapabilitiesParser.java Tue Jun 11 09:40:56 2013 +0200 @@ -8,8 +8,14 @@ package org.dive4elements.river.client.server; +import org.dive4elements.artifacts.common.utils.XMLUtils; +import org.dive4elements.river.client.shared.exceptions.ServerException; +import org.dive4elements.river.client.shared.model.Capabilities; +import org.dive4elements.river.client.shared.model.ContactInformation; +import org.dive4elements.river.client.shared.model.WMSLayer; + +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; @@ -20,21 +26,15 @@ import javax.xml.xpath.XPathConstants; +import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.apache.log4j.Logger; - -import org.dive4elements.artifacts.common.utils.XMLUtils; - -import org.dive4elements.river.client.shared.exceptions.ServerException; -import org.dive4elements.river.client.shared.model.Capabilities; -import org.dive4elements.river.client.shared.model.ContactInformation; -import org.dive4elements.river.client.shared.model.WMSLayer; - - +/** + * Parser for GetCapabilities of a WMS. + */ public class CapabilitiesParser { private static final Logger logger = @@ -96,6 +96,12 @@ public static final String XPATH_LAYERS = "Capability/Layer"; + public static final String XPATH_MAP_FORMAT = + "Capability/Request/GetMap/Format"; + + public static final String XPATH_GETMAP_ONLINERESOURCE = + "Capability/Request/GetMap/DCPType/HTTP/Get/OnlineResource/@href"; + public static final Pattern SRS_PATTERN = Pattern.compile("(EPSG:\\d+)*"); @@ -110,9 +116,14 @@ LoggingConfigurator.init(log4jProperties); try { - Capabilities caps = getCapabilities(System.getProperty("test.wms")); + String wmsURL = System.getProperty("test.wms"); + if (wmsURL == null || args.length > 0) { + wmsURL = args[0]; + } + Capabilities caps = getCapabilities(wmsURL); logger.debug(caps.toString()); + System.out.println(caps.toString()); } catch (ServerException se) { se.printStackTrace(); @@ -204,7 +215,20 @@ XPATH_LAYERS, XPathConstants.NODESET); - List layers = parseLayers(layerNodes, onlineResource); + String getMapOnlineResource = (String) XMLUtils.xpath( + capabilities, + XPATH_GETMAP_ONLINERESOURCE, + XPathConstants.STRING); + + List layers = parseLayers(layerNodes, getMapOnlineResource); + + // Parse MIME types of supported return types, e.g. image/jpeg + NodeList mapFormatNodes = (NodeList) + XMLUtils.xpath(capabilities, XPATH_MAP_FORMAT, XPathConstants.NODESET); + List mapFormats = new ArrayList(); + for (int n = 0; n < mapFormatNodes.getLength(); n++) { + mapFormats.add(mapFormatNodes.item(n).getTextContent()); + } return new Capabilities( title, @@ -212,7 +236,8 @@ ci, fees, accessConstraints, - layers); + layers, + mapFormats); } @@ -327,6 +352,12 @@ logger.debug("Found layer: " + title + "(" + name + ")"); + boolean queryable = true; + Node queryableAttr = layerNode.getAttributes().getNamedItem("queryable"); + if (queryableAttr != null && queryableAttr.getNodeValue().equals("0")) { + queryable = false; + } + List srs = parseSRS(layerNode); NodeList layersNodes = (NodeList) XMLUtils.xpath( @@ -336,7 +367,7 @@ List layers = parseLayers(layersNodes, onlineResource); - return new WMSLayer(onlineResource, title, name, srs, layers); + return new WMSLayer(onlineResource, title, name, srs, layers, queryable); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/CollectionHelper.java Tue Jun 11 09:40:56 2013 +0200 @@ -403,6 +403,10 @@ public static Collection parseCollection(Document description) { logger.debug("CollectionHelper.parseCollection"); + if (logger.isDebugEnabled()) { + logger.debug(XMLUtils.toString(description)); + } + if (description == null) { logger.warn("The DESCRIBE of the Collection is null!"); return null; diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/FileUploadServiceImpl.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/FileUploadServiceImpl.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/FileUploadServiceImpl.java Tue Jun 11 09:40:56 2013 +0200 @@ -52,9 +52,10 @@ try { Document result = client.callService(url, "fileupload", request); + resp.setContentType("text/html"); + PrintWriter respWriter = resp.getWriter(); - respWriter.write(""); - respWriter.write("
"); + respWriter.write("
"); if (result == null) { logger.warn("FileUpload service returned no result."); @@ -81,7 +82,7 @@ protected Document createFileXML(HttpServletRequest req) { - ServletFileUpload upload = new ServletFileUpload(); + ServletFileUpload upload = new ServletFileUpload(); try{ FileItemIterator iter = upload.getItemIterator(req); @@ -92,14 +93,18 @@ // Process the input stream ByteArrayOutputStream out = new ByteArrayOutputStream(); - int len; + int len, cnt = 0; byte[] buffer = new byte[stream.available()]; while ((len = stream.read(buffer, 0, buffer.length)) != -1) { out.write(buffer, 0, len); + cnt += len; } - buffer = Base64.encodeBase64(buffer); + buffer = Base64.encodeBase64(out.toByteArray()); String b64File = new String(buffer); + logger.debug("FileUploadServiceImpl.createFileXML(): " + cnt + + "/" + b64File.length() + + " bytes (orig/base64) file to be uploaded"); Document fileDoc = XMLUtils.newDocument(); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/GGInATrustStrategy.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/GGInATrustStrategy.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/GGInATrustStrategy.java Tue Jun 11 09:40:56 2013 +0200 @@ -16,7 +16,7 @@ public class GGInATrustStrategy implements TrustStrategy { /** - * Tempoary class to accept all certificates for GGinA Authentication + * Temporary class to accept all certificates for GGinA Authentication. */ @Override diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/SamlServlet.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/SamlServlet.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/SamlServlet.java Tue Jun 11 09:40:56 2013 +0200 @@ -37,7 +37,7 @@ throws ServletException, IOException { String encoding = req.getCharacterEncoding(); - String samlTicketXML = req.getParameter("samlTicket"); + String samlTicketXML = req.getParameter("saml"); logger.debug("Processing post request"); @@ -86,6 +86,7 @@ Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE); return new org.dive4elements.river.client.server.auth.saml.User( - assertion, features.getFeatures(assertion.getRoles()), null); + assertion, samlTicketXML, + features.getFeatures(assertion.getRoles()), null); } } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/UserServiceImpl.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/UserServiceImpl.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/UserServiceImpl.java Tue Jun 11 09:40:56 2013 +0200 @@ -60,7 +60,8 @@ String name = user.getAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "name"); - return new DefaultUser(uuid, name); + return new DefaultUser(uuid, name, + loginuser.getSamlXMLBase64()); } } catch (ConnectionException ce) { diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/DefaultUser.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/DefaultUser.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/DefaultUser.java Tue Jun 11 09:40:56 2013 +0200 @@ -16,6 +16,7 @@ protected String name; protected String account; protected String password; + protected String samlXML; protected boolean expired; protected List roles; protected List features; @@ -26,12 +27,14 @@ public DefaultUser( String name, String password, + String samlXML, boolean expired, List roles, List features ) { this.name = name; this.password = password; + this.samlXML = samlXML; this.expired = expired; this.roles = roles; this.features = features; @@ -92,5 +95,14 @@ public void setAccount(String account) { this.account = account; } + + @Override + public String getSamlXMLBase64() { + return this.samlXML; + } + + public void setSamlXMLBase64(String samlXML) { + this.samlXML = samlXML; + } } // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/User.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/User.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/User.java Tue Jun 11 09:40:56 2013 +0200 @@ -46,5 +46,12 @@ * Returns the users account name */ public String getAccount(); + + /** + * Returns the SAML ticket for single sign-on. + * @return The SAML ticket in base64 encoded XML. null if no ticket + * is available. + */ + public String getSamlXMLBase64(); } // vim:set ts=4 sw=4 si et fenc=utf8 tw=80: diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/plain/Authenticator.java Tue Jun 11 09:40:56 2013 +0200 @@ -63,7 +63,7 @@ @Override public User getUser() { return isSuccess() - ? new DefaultUser(user, password, false, roles, this.features.getFeatures(roles)) + ? new DefaultUser(user, password, null, false, roles, this.features.getFeatures(roles)) : null; } } // class Authentication diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/User.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/User.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/User.java Tue Jun 11 09:40:56 2013 +0200 @@ -18,11 +18,13 @@ private Assertion assertion; - public User(Assertion assertion, List features, String password) { + public User(Assertion assertion, String samlXML, List features, + String password) { this.setName(assertion.getNameID()); this.setAccount(assertion.getNameID()); this.setRoles(assertion.getRoles()); this.assertion = assertion; + this.setSamlXMLBase64(samlXML); this.setAllowedFeatures(features); this.setPassword(password); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Response.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Response.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/auth/was/Response.java Tue Jun 11 09:40:56 2013 +0200 @@ -10,11 +10,13 @@ import java.io.IOException; import java.io.InputStream; +import java.io.StringBufferInputStream; import java.util.List; import org.apache.commons.codec.binary.Base64InputStream; import org.apache.http.HttpEntity; +import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; @@ -37,6 +39,7 @@ private static Logger logger = Logger.getLogger(Response.class); private Element root; + private String samlTicketXML; private Assertion assertion; private String username; private String password; @@ -53,8 +56,9 @@ } String contenttype = entity.getContentType().getValue(); + String samlTicketXML = EntityUtils.toString(entity); - InputStream in = entity.getContent(); + InputStream in = new StringBufferInputStream(samlTicketXML); if (!contenttype.equals("application/vnd.ogc.se_xml")) { // XXX: Assume base64 encoded content. @@ -70,6 +74,7 @@ "ServiceException")); } + this.samlTicketXML = samlTicketXML; this.root = root; this.username = username; this.password = password; @@ -113,7 +118,7 @@ this.assertion.getRoles()); logger.debug("User " + this.username + " with features " + features + " successfully authenticated."); - return new User(assertion, features, this.password); + return new User(assertion, this.samlTicketXML, features, this.password); } } // vim: set si et fileencoding=utf-8 ts=4 sw=4 tw=80: diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Capabilities.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Capabilities.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Capabilities.java Tue Jun 11 09:40:56 2013 +0200 @@ -12,7 +12,9 @@ import java.util.ArrayList; import java.util.List; - +/** + * Capabilities of a WMS. + */ public class Capabilities implements Serializable { protected String title; @@ -23,6 +25,7 @@ protected ContactInformation contactInformation; protected List layers; + protected List mapFormats; public Capabilities() { @@ -41,7 +44,8 @@ ContactInformation contactInformation, String fees, String accessConstraints, - List layers + List layers, + List mapFormats ) { this.title = title; this.onlineResource = onlineResource; @@ -49,6 +53,7 @@ this.fees = fees; this.accessConstraints = accessConstraints; this.layers = layers; + this.mapFormats = mapFormats; } @@ -82,6 +87,11 @@ } + public List getMapFormats() { + return mapFormats; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultUser.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultUser.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultUser.java Tue Jun 11 09:40:56 2013 +0200 @@ -22,6 +22,8 @@ /** The name of the user.*/ protected String name; + /** The saml ticket used for single sign-on.*/ + protected String samlXML; /** * The default constructor. @@ -36,9 +38,10 @@ * @param identifier The uuid of the user. * @param name The name of the user. */ - public DefaultUser(String identifier, String name) { + public DefaultUser(String identifier, String name, String samlXML) { this.identifier = identifier; this.name = name; + this.samlXML = samlXML; } @@ -63,6 +66,16 @@ /** + * Returns the SAML ticket for single sign-on. + * + * @return the SAML ticket as base64 encoded XML + */ + public String getSamlXMLBase64() { + return samlXML; + } + + + /** * Set the identifier of the user. * * @param identifier The new identifier. @@ -80,5 +93,14 @@ public void setName(String name) { this.name = name; } + + /** + * Set the SAML Ticket for single sign-on. + * + * @param samlXML the SAML ticket as base64 encoded XML. + */ + public void setSamlXMLBase64(String samlXML) { + this.samlXML = samlXML; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/Recommendation.java Tue Jun 11 09:40:56 2013 +0200 @@ -117,6 +117,9 @@ protected String masterArtifact; /** Optional facet filter. */ protected Filter filter; + /** The out this Artifact should be added to **/ + protected String targetOut; + protected String displayName = null; public Recommendation() { @@ -126,16 +129,39 @@ this(factory, ids, null, null); } + public Recommendation(String factory, String ids, String targetOut) { + this(factory, ids, null, null, targetOut); + } + public Recommendation( String factory, String ids, String masterArtifact, Filter filter ) { + this(factory, ids, masterArtifact, filter, null); + } + + public Recommendation( + String factory, + String ids, + String masterArtifact, + Filter filter, + String targetOut + ) { this.factory = factory; this.ids = ids; this.masterArtifact = masterArtifact; this.filter = filter; + this.targetOut = targetOut; + } + + public String getTargetOut() { + return targetOut; + } + + public void setTargetOut(String value) { + targetOut = value; } public String getFactory() { @@ -190,6 +216,9 @@ hash += (getMasterArtifact() != null) ? getMasterArtifact().hashCode() : 0; + hash += (getTargetOut() != null) + ? getTargetOut().hashCode() + : 0; return hash; } @@ -221,7 +250,8 @@ return (same(this.getFactory(), rec.getFactory())) && (same(this.getIDs(), rec.getIDs())) && (same(this.getFilter(), rec.getFilter())) - && (same(this.getMasterArtifact(), rec.getMasterArtifact())); + && (same(this.getMasterArtifact(), rec.getMasterArtifact())) + && (same(this.getTargetOut(), rec.getTargetOut())); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ToLoad.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ToLoad.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/ToLoad.java Tue Jun 11 09:40:56 2013 +0200 @@ -15,6 +15,8 @@ import java.io.Serializable; +import com.google.gwt.core.client.GWT; + public class ToLoad implements Serializable { @@ -49,6 +51,16 @@ } return key; } + public void add( + String artifactName, + String factory, + String out, + String name, + String ids, + String displayName + ) { + add(artifactName, factory, out, name, ids, displayName, null); + } public void add( String artifactName, @@ -56,8 +68,13 @@ String out, String name, String ids, - String displayName + String displayName, + String targetOut ) { + GWT.log("Adding artifact: " + artifactName + " Factory: " + factory + + " Out: " + out + " Name: " + name + " Ids: " + ids + + " Display Name: " + displayName + " Target Out: " + targetOut); + if (artifactName == null) { artifactName = uniqueKey(artifacts); } diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/shared/model/User.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/User.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/User.java Tue Jun 11 09:40:56 2013 +0200 @@ -17,8 +17,12 @@ String getName(); + String getSamlXMLBase64(); + void setName(String name); void setIdentifier(String identifier); + + void setSamlXMLBase64(String samlXml); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/java/org/dive4elements/river/client/shared/model/WMSLayer.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/WMSLayer.java Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/WMSLayer.java Tue Jun 11 09:40:56 2013 +0200 @@ -22,6 +22,8 @@ protected List srs; protected List layers; + protected boolean queryable = true; + public WMSLayer() { layers = new ArrayList(); @@ -39,13 +41,15 @@ String title, String name, List srs, - List layers + List layers, + boolean queryable ) { - this.server = server; - this.title = title; - this.name = name; - this.srs = srs; - this.layers = layers; + this.server = server; + this.title = title; + this.name = name; + this.srs = srs; + this.layers = layers; + this.queryable = queryable; } @@ -74,6 +78,11 @@ } + public boolean isQueryable() { + return queryable; + } + + public boolean supportsSrs(String srs) { if (this.srs == null || this.srs.size() == 0) { return true; diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/webapp/WEB-INF/config.yaml --- a/gwt-client/src/main/webapp/WEB-INF/config.yaml Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/webapp/WEB-INF/config.yaml Tue Jun 11 09:40:56 2013 +0200 @@ -183,7 +183,7 @@ url: '${configDir}/../${logo}' # Scalebar - !columns - absoluteX: 460 + absoluteX: 455 absoluteY: 40 width: 150 items: @@ -197,11 +197,11 @@ # The legend - !columns absoluteX: 612 - absoluteY: 390 + absoluteY: 385 width: 200 items: - !legends - maxHeight: 310 + maxHeight: 350 maxWidth: 0 maxIconHeight: 0 inline: true @@ -213,7 +213,7 @@ fontEncoding: Identity-H classFont: FreeSans layerFont: FreeSans - defaultScale: 0.5 + defaultScale: 0.7 config: borderWidthLeft: 1 borderWidthRight: 1 @@ -227,7 +227,7 @@ items: - !image maxWidth: 260 - maxHeight: 184 + maxHeight: 190 url: '${configDir}/../images/white.png' # Title of the map @@ -238,21 +238,16 @@ condition: mapTitle items: - !text + fontSize: 18 text: '${mapTitle}' # The Stamp - !columns absoluteX: 562 - absoluteY: 555 + absoluteY: 550 width: 250 - # config: - # borderWidthLeft: 5 - # borderWidthRight: 5 - # borderWidthTop: 5 - # borderWidthBottom: 5 - #padding: 10 - #backgroundColor: #FFFFFF - #borderColor: #FFFFFF + config: + borderWidth: 1 items: - !attributes source: data @@ -266,7 +261,7 @@ cell: !columns config: cells: - - borderWidth: 1 + - borderWidth: 0.5 padding: 5 items: - !text @@ -284,7 +279,7 @@ cell: !columns config: cells: - - borderWidth: 1 + - borderWidth: 0.5 padding: 5 items: - !text diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html --- a/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html Wed Jun 05 11:56:38 2013 +0200 +++ b/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html Tue Jun 11 09:40:56 2013 +0200 @@ -2,25 +2,39 @@ @@ -41,30 +59,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/webapp/images/FLYS_transp.png Binary file gwt-client/src/main/webapp/images/FLYS_transp.png has changed diff -r a3fb76cf79b6 -r e8f152163a1e gwt-client/src/main/webapp/images/symbol_selected.png Binary file gwt-client/src/main/webapp/images/symbol_selected.png has changed