# HG changeset patch # User Andre Heinecke # Date 1361789413 -3600 # Node ID 4f65d833680f7d106943c2dbddebb098154cb7bb # Parent 4f46679e13d018817e5f9d52d60885316b048e7c# Parent b87e504f916e46d7b1d7d04b5f25dfea483df05a Merge Default onto Dami branch. Dami is now temporarily a public merge branch to fix problems created by the merge. diff -r 4f46679e13d0 -r 4f65d833680f .hgtags --- a/.hgtags Mon Feb 25 11:46:36 2013 +0100 +++ b/.hgtags Mon Feb 25 11:50:13 2013 +0100 @@ -23,3 +23,6 @@ ce6bea03156cd45cbbd7841715d0e1f256ea4d36 2.9.6 0ba0f3e4f4c200398f0b308506f4d91a9e392bc2 2.9.7 88014b9852d041a707365162d8d941cb1a7cef5c 2.9.8 +859278918eb14a8687fef60f2b33dcf89fe71f90 2.9.9 +859278918eb14a8687fef60f2b33dcf89fe71f90 2.9.9 +53be7313310416e1f8c3e0ec414684ca9c6c71df 2.9.9 diff -r 4f46679e13d0 -r 4f65d833680f contrib/make_flys_release/confs/backend-db.xml --- a/contrib/make_flys_release/confs/backend-db.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/contrib/make_flys_release/confs/backend-db.xml Mon Feb 25 11:50:13 2013 +0100 @@ -5,7 +5,7 @@ flys293 org.hibernate.dialect.PostgreSQLDialect org.postgresql.Driver - jdbc:postgresql://czech-republic.atlas.intevation.de:5432/flys29 + jdbc:postgresql://czech-republic.atlas.intevation.de:5432/flys293 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4f46679e13d0 -r 4f65d833680f contrib/make_flys_release/make_release.sh --- a/contrib/make_flys_release/make_release.sh Mon Feb 25 11:46:36 2013 +0100 +++ b/contrib/make_flys_release/make_release.sh Mon Feb 25 11:50:13 2013 +0100 @@ -17,7 +17,7 @@ ARTIFACT_PORT=${ARTIFACT_PORT:-9002} TOMCAT_PORT=${TOMCAT_PORT:-8005} -MAPSERVER_URL=${MAPSERVER_URL:-czech-republic.intevation.de} +MAPSERVER_URL=${MAPSERVER_URL:-czech-republic.atlas.intevation.de} echo "INFO: create server directories" mkdir -p $DIRECTORY/server/bin/lib/own @@ -102,11 +102,15 @@ confs/rest-server.xml \ > $DIRECTORY/server/conf/rest-server.xml -sed -e "s@http://czech-republic.intevation.de/@http://${MAPSERVER_URL}/@g" \ - -e "s@flys-default@flys-${RELEASE}@g" \ +sed -e "s@http://example.com/@http://${MAPSERVER_URL}/@g" \ confs/floodmap.xml \ > $DIRECTORY/server/conf/floodmap.xml +sed -e "s@http://example.com/@http://${MAPSERVER_URL}/@g" \ + confs/rivermap.xml \ + > $DIRECTORY/server/conf/rivermap.xml + + sed "s@/tmp/flys-server-default.log@/tmp/flys-server-${RELEASE}.log" \ confs/log4j.properties \ > $DIRECTORY/server/conf/log4j.properties diff -r 4f46679e13d0 -r 4f65d833680f flys-aft/README.txt --- a/flys-aft/README.txt Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-aft/README.txt Mon Feb 25 11:50:13 2013 +0100 @@ -54,40 +54,43 @@ Die Konfigurationsdatei hat folgende Struktur: - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 -10 -11 -12 -13 /the/path/to/the/dips/file -14 /the/path/to/the/xslt/to/repair/dips -15 -16 -17 -18 -19 oracle.jdbc.OracleDriver -20 flys -21 flys -22 jdbc:oracle:thin:@//localhost:1521/XE -23 -24 -25 -26 -27 -28 oracle.jdbc.OracleDriver -29 aft -30 aft -31 jdbc:oracle:thin:@//localhost:1521/XE -32 -33 -34 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +10 +11 +12 +13 /the/path/to/the/dips/file +14 /the/path/to/the/xslt/to/repair/dips +15 +16 +17 +18 +19 oracle.jdbc.OracleDriver +20 flys +21 flys +22 jdbc:oracle:thin:@//localhost:1521/XE +23 +24 +25 +26 +27 +28 oracle.jdbc.OracleDriver +29 aft +30 aft +31 jdbc:oracle:thin:@//localhost:1521/XE +32 +33 ALTER SESSION SET CURRENT_SCHEMA=AFT +34 +35 +36 +37 Sie besteht aus vier Bereichen: @@ -105,10 +108,13 @@ Zeile 29: DB-Nutzername Zeile 30: Connection-URL zur AFT-Datenbank + * Schemata: + Zeile 32-34: Schema in welches die Daten geschrieben werden sollen. + * Benachrichtigungen: Zeile 5: URL des Web-Service, der benachrichtigt werden soll. Zeile 6-18: Die Nachricht, die an den Web-Service verschickt werden soll. - + Funktionsweise: --------------- diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/artifacts/fixanalysis.xml --- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon Feb 25 11:50:13 2013 +0100 @@ -304,6 +304,11 @@ + + + + + diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/datacage.sql --- a/flys-artifacts/doc/conf/datacage.sql Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/datacage.sql Mon Feb 25 11:50:13 2013 +0100 @@ -85,7 +85,40 @@ ON o.c_id = ci2.collection_id WHERE a2.creation = o.oldest_a; +CREATE VIEW master_artifacts_range AS + SELECT ma.id AS id, + ma.gid AS gid, + ma.state AS state, + ma.creation AS creation, + ma.collection_id AS collection_id, + mam.ld_mode AS ld_mode, + mal.ld_locations AS ld_locations, + maf.ld_from AS ld_from, + mat.ld_to AS ld_to + FROM master_artifacts ma + LEFT JOIN (SELECT ad.v AS ld_mode, + ad.artifact_id AS artifact_id + FROM artifact_data ad + WHERE ad.k = 'ld_mode') mam + ON mam.artifact_id = ma.id + LEFT JOIN (SELECT ad.v AS ld_locations, + ad.artifact_id AS artifact_id + FROM artifact_data ad + WHERE ad.k = 'ld_locations') mal + ON mal.artifact_id = ma.id + LEFT JOIN (SELECT ad.v AS ld_from, + ad.artifact_id AS artifact_id + FROM artifact_data ad + WHERE ad.k = 'ld_from') maf + ON maf.artifact_id = ma.id + LEFT JOIN (SELECT ad.v AS ld_to, + ad.artifact_id AS artifact_id + FROM artifact_data ad + WHERE ad.k = 'ld_to') mat + ON mat.artifact_id = ma.id; + -- DROP VIEW master_artifacts; +-- DROP VIEW master_artifacts_range; -- DROP SEQUENCE USERS_ID_SEQ; -- DROP SEQUENCE COLLECTIONS_ID_SEQ; -- DROP SEQUENCE ARTIFACTS_ID_SEQ; diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/default-themes.xml --- a/flys-artifacts/doc/conf/default-themes.xml Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1887 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/floodmap.xml --- a/flys-artifacts/doc/conf/floodmap.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/floodmap.xml Mon Feb 25 11:50:13 2013 +0100 @@ -2,7 +2,7 @@ - + @@ -13,18 +13,21 @@ - - - + + + + - - - + + + + - - - + + + + diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/meta-data.xml --- a/flys-artifacts/doc/conf/meta-data.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Mon Feb 25 11:50:13 2013 +0100 @@ -1,6 +1,19 @@ + + + SELECT wst_columns.id AS prot_column_id, + wst_columns.name AS prot_column_name, + wst_columns.position AS prot_rel_pos, + wst_columns.description AS info, + wst_ranges.a AS deffrom, + wst_ranges.b AS defto + FROM wst_columns, wst_ranges + WHERE wst_columns.wst_id = ${prot_id} AND wst_ranges.wst_column_id = wst_columns.id + ORDER by wst_columns.position + + @@ -24,20 +37,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -59,20 +65,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -95,20 +94,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -131,20 +123,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -167,20 +152,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -203,20 +181,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -238,20 +209,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -273,20 +237,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -308,20 +265,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -344,20 +294,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -379,20 +322,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -414,20 +350,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -449,20 +378,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -488,20 +410,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos, - description AS info - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + - + @@ -527,18 +442,13 @@ - - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - + + diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/rivermap.xml --- a/flys-artifacts/doc/conf/rivermap.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/rivermap.xml Mon Feb 25 11:50:13 2013 +0100 @@ -2,7 +2,7 @@ - + @@ -14,17 +14,17 @@ - - + + - - + + - - + + diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/second-themes.xml --- a/flys-artifacts/doc/conf/second-themes.xml Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1789 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/themes/default/longitudinal-section.xml --- a/flys-artifacts/doc/conf/themes/default/longitudinal-section.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/themes/default/longitudinal-section.xml Mon Feb 25 11:50:13 2013 +0100 @@ -724,7 +724,7 @@ + default="255, 0, 0" /> diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/themes/second/longitudinal-section.xml --- a/flys-artifacts/doc/conf/themes/second/longitudinal-section.xml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/doc/conf/themes/second/longitudinal-section.xml Mon Feb 25 11:50:13 2013 +0100 @@ -724,7 +724,7 @@ + default="255, 0, 0" /> diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/doc/conf/virtual-themes.xml --- a/flys-artifacts/doc/conf/virtual-themes.xml Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Feb 25 11:50:13 2013 +0100 @@ -174,11 +174,11 @@ protected void initialize(Artifact artifact, Object context, CallMeta meta) { logger.debug("MainValuesArtifact.initialize"); FLYSArtifact winfo = (FLYSArtifact) artifact; - RangeAccess rangeAccess = new RangeAccess(this, null); + RangeAccess rangeAccess = new RangeAccess(winfo, null); double [] locations = rangeAccess.getLocations(); if (locations != null) { double location = locations[0]; - addData("location", new DefaultStateData("location", null, null, + addData("ld_locations", new DefaultStateData("ld_locations", null, null, String.valueOf(location))); } else { @@ -245,7 +245,7 @@ River river = FLYSUtils.getRiver(this); // TODO use helper to get location as double - String locationStr = getDataAsString("location"); + String locationStr = getDataAsString("ld_locations"); if (river == null || locationStr == null) { return null; @@ -262,7 +262,7 @@ * @return the location. */ public double getLocation() { - double location = Double.parseDouble(getDataAsString("location")); + double location = Double.parseDouble(getDataAsString("ld_locations")); return location; } diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Mon Feb 25 11:50:13 2013 +0100 @@ -32,6 +32,7 @@ import org.w3c.dom.NodeList; +/** Handles and evaluate meta-data template against dbs. */ public class Builder { private static Logger log = Logger.getLogger(Builder.class); @@ -92,6 +93,7 @@ protected List connections; protected Map statements; protected Deque> connectionsStack; + protected Deque macroBodies; public BuildHelper( Node output, @@ -110,6 +112,7 @@ owner = getOwnerDocument(output); statements = new HashMap(); + macroBodies = new ArrayDeque(); } public void build() throws SQLException { @@ -133,6 +136,43 @@ } /** + * Return first statement node in NodeList, respecting + * macros but not doing evaluation (e.g. of s). + */ + private Node findStatementNode(NodeList nodes) { + int S = nodes.getLength(); + + // Check direct children and take special care of macros. + for (int i = 0; i < S; ++i) { + Node node = nodes.item(i); + String ns; + // Regular statement node. + if (node.getNodeType() == Node.ELEMENT_NODE + && node.getLocalName().equals("statement") + && (ns = node.getNamespaceURI()) != null + && ns.equals(DC_NAMESPACE_URI)) { + return node; + } + // Macro node. Descend. + else if (node.getNodeType() == Node.ELEMENT_NODE + && node.getLocalName().equals("call-macro") + && (ns = node.getNamespaceURI()) != null + && ns.equals(DC_NAMESPACE_URI)) { + + String macroName = ((Element)node).getAttribute("name"); + Node inMacroNode = + findStatementNode(getMacroChildren(macroName)); + if (inMacroNode != null) { + return inMacroNode; + } + } + + } + + return null; + } + + /** * Handle a \ node. */ protected void context(Node parent, Element current) @@ -141,22 +181,9 @@ log.debug("dc:context"); NodeList subs = current.getChildNodes(); + Node stmntNode = findStatementNode(subs); int S = subs.getLength(); - // Check only direct children. - Node stmntNode = null; - for (int i = 0; i < S; ++i) { - Node node = subs.item(i); - String ns; - if (node.getNodeType() == Node.ELEMENT_NODE - && node.getLocalName().equals("statement") - && (ns = node.getNamespaceURI()) != null - && ns.equals(DC_NAMESPACE_URI)) { - stmntNode = node; - break; - } - } - if (stmntNode == null) { log.warn("dc:context: cannot find statement"); return; @@ -310,6 +337,10 @@ element.setAttribute(name, value); } + /** + * Call-Macro node. + * Evaluate child-nodes of the given macro element (not its text). + */ protected void callMacro(Node parent, Element current) throws SQLException { @@ -323,18 +354,66 @@ NodeList macros = template.getElementsByTagNameNS( DC_NAMESPACE_URI, "macro"); + Element macro = null; + for (int i = 0, N = macros.getLength(); i < N; ++i) { - Element macro = (Element) macros.item(i); - if (name.equals(macro.getAttribute("name"))) { + Element m = (Element) macros.item(i); + if (name.equals(m.getAttribute("name"))) { + macro = m; + break; + } + } + + if (macro != null) { + macroBodies.push(current.getChildNodes()); + try { NodeList subs = macro.getChildNodes(); for (int j = 0, M = subs.getLength(); j < M; ++j) { build(parent, subs.item(j)); } - return; + } + finally { + macroBodies.pop(); + } + } + else { + log.warn("no macro '" + name + "' found."); + } + } + + protected void macroBody(Node parent, Element current) + throws SQLException + { + if (!macroBodies.isEmpty()) { + NodeList children = macroBodies.peek(); + for (int i = 0, N = children.getLength(); i < N; ++i) { + build(parent, children.item(i)); + } + } + else { + log.warn("no current macro"); + } + } + + /** 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; } } - log.warn("no macro '" + name + "' found."); + if (macro != null) { + return macro.getChildNodes(); + } + return null; } protected void ifClause(Node parent, Element current) @@ -444,6 +523,7 @@ } + /** Put content as variable on stackframes. */ protected void variable(Element current) { String varName = expand(current.getAttribute("name")); @@ -506,6 +586,9 @@ else if ("call-macro".equals(localName)) { callMacro(parent, (Element)current); } + else if ("macro-body".equals(localName)) { + macroBody(parent, (Element)current); + } else if ("macro".equals(localName)) { // Simply ignore the definition. } diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/CompiledStatement.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/CompiledStatement.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/CompiledStatement.java Mon Feb 25 11:50:13 2013 +0100 @@ -45,6 +45,7 @@ public Instance() { } + /** Executes a Statement. */ protected ResultData executeCached( Cache cache, Connection connection, diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Mon Feb 25 11:50:13 2013 +0100 @@ -1,15 +1,15 @@ package de.intevation.flys.artifacts.datacage.templating; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; -import java.util.Collection; import java.util.Map; -import java.util.ArrayList; -import javax.xml.xpath.XPathFunctionResolver; +import javax.xml.namespace.QName; + import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathFunctionException; - -import javax.xml.namespace.QName; +import javax.xml.xpath.XPathFunctionResolver; import org.apache.log4j.Logger; @@ -82,6 +82,120 @@ }); } + static { + /** Implementation for getting the minimum value of location or distance + * dc:fromValue. */ + FUNCTIONS.addFunction("fromValue", 3, new XPathFunction() { + @Override + public Object evaluate(List args) throws XPathFunctionException { + Object mode = args.get(0); + Object locations = args.get(1); + Object from = args.get(2); + + if (!(mode instanceof String)){ + return -Double.MAX_VALUE; + } + + if (mode.equals("locations")) { + if (!(locations instanceof String)) { + return -Double.MAX_VALUE; + } + String loc = ((String)locations).replace(" ", ""); + String[] split = loc.split(","); + if (split.length < 1) { + return -Double.MAX_VALUE; + } + try { + double min = Double.parseDouble(split[0]); + for (int i = 1; i < split.length; ++i) { + double v = Double.parseDouble(split[i]); + if (v < min) { + min = v; + } + } + return min; + } + catch (NumberFormatException nfe) { + return -Double.MAX_VALUE; + } + } + else if (mode.equals("distance")) { + if (!(from instanceof String)) { + return -Double.MAX_VALUE; + } + String f = (String)from; + try { + return Double.parseDouble(f); + } + catch(NumberFormatException nfe) { + return -Double.MAX_VALUE; + } + } + else { + return -Double.MAX_VALUE; + } + } + }); + } + + static { + /** Implementation for getting the maximum value of location or distance + * dc:toValue. */ + FUNCTIONS.addFunction("toValue", 3, new XPathFunction() { + @Override + public Object evaluate(List args) throws XPathFunctionException { + Object mode = args.get(0); + Object locations = args.get(1); + Object to = args.get(2); + + if (!(mode instanceof String)){ + return Double.MAX_VALUE; + } + + if (mode.equals("locations")) { + if (!(locations instanceof String)) { + return Double.MAX_VALUE; + } + try { + String loc = ((String)locations).replace(" ", ""); + String[] split = loc.split(","); + if (split.length < 1) { + return Double.MAX_VALUE; + } + double max = Double.parseDouble(split[0]); + for (int i = 1; i < split.length; ++i) { + double v = Double.parseDouble(split[i]); + if (v > max) { + max = v; + } + } + return max; + } + catch (NumberFormatException nfe) { + return Double.MAX_VALUE; + } + } + else if (mode.equals("distance")) { + if (!(to instanceof String)) { + return Double.MAX_VALUE; + } + else { + String t = (String)to; + try { + return Double.parseDouble(t); + } + catch(NumberFormatException nfe) { + return Double.MAX_VALUE; + } + } + } + else { + return Double.MAX_VALUE; + } + } + }); + } + /** List of functions. */ protected List functions; diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation4.java Mon Feb 25 11:50:13 2013 +0100 @@ -269,7 +269,7 @@ } } - // name the curves + // Name the curves. for (int i = 0; i < results.length; ++i) { results[i].setName(createName(i)); } @@ -338,6 +338,7 @@ return infoldings.toArray(new ConstantWQKms[infoldings.size()]); } + // TODO: issue1109/2, merge with FixRealizingCalculation protected String createName(int index) { // TODO: i18n StringBuilder sb = new StringBuilder(isQ ? "Q" : "W"); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DischargeTables.java Mon Feb 25 11:50:13 2013 +0100 @@ -129,8 +129,16 @@ } // TODO: Filter by time interval - DischargeTable table = tables.get(0); - + DischargeTable table = null; + for (DischargeTable dt : tables) { + if (dt.getKind() == 0) { + table = dt; + break; + } + } + if (table == null) { + table = tables.get(0); + } double [][] vs = loadDischargeTableValues(table, scale); values.put(gaugeName, vs); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java Mon Feb 25 11:50:13 2013 +0100 @@ -60,7 +60,7 @@ DischargeTables dt = new DischargeTables(river, name); Map map = dt.getValues( - DischargeTables.HISTORICAL_SCALE); + DischargeTables.MASTER_SCALE); double [][] values = map.get(name); if (values == null) { diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingCalculation.java Mon Feb 25 11:50:13 2013 +0100 @@ -142,6 +142,7 @@ return new CalculationResult(frr, this); } + // TODO: issue1109/2 protected String createName(int index) { // TODO: i18n StringBuilder sb = new StringBuilder(isQ ? "Q" : "W"); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java Mon Feb 25 11:50:13 2013 +0100 @@ -18,6 +18,7 @@ import org.w3c.dom.Element; /** + * Service that receives XML-packed Shapefile bundles from the client. * @author Raimund Renkert */ public class FileUploadService extends FLYSService { @@ -35,7 +36,6 @@ public FileUploadService() { } - @Override protected Document doProcess( Document data, @@ -44,6 +44,13 @@ ) { logger.debug("FileUploadService.process"); + Document doc = XMLUtils.newDocument(); + ElementCreator ec = new ElementCreator(doc, null, null); + Element resp = ec.create("response"); + Element status = ec.create("status"); + resp.appendChild(status); + doc.appendChild(resp); + String uuid = extractUuid(data); byte[] fileData = extractData(data); @@ -58,6 +65,9 @@ new File(artifactDir, "user-rgd.zip")); try { fos.write(fileData); + + // Write operation successful + status.setTextContent("Upload erfolgreich!"); // TODO: i18n } finally { fos.close(); @@ -65,27 +75,32 @@ } catch (IOException ioe) { logger.warn(ioe, ioe); + status.setTextContent("Upload fehlgeschlagen!"); } } else { logger.debug("No data in uploaded xml."); + status.setTextContent("Upload fehlgeschlagen!"); } - Document doc = XMLUtils.newDocument(); - ElementCreator ec = new ElementCreator(doc, null, null); - Element resp = ec.create("response"); - doc.appendChild(resp); - return doc; } - + /** + * Extracts the UUID from the XML document. + * @param data + * @return + */ protected String extractUuid(Document data) { return XMLUtils.xpathString( data, XPATH_ARTIFACT_UUID, ArtifactNamespaceContext.INSTANCE); } - + /** + * Extracts the base64 encoded ZIP file from the XML document. + * @param data + * @return + */ protected byte[] extractData(Document data) { String b64Data = XMLUtils.xpathString( data, XPATH_DATA, ArtifactNamespaceContext.INSTANCE); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DistanceOnlySelect.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DistanceOnlySelect.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DistanceOnlySelect.java Mon Feb 25 11:50:13 2013 +0100 @@ -4,8 +4,6 @@ import de.intevation.artifacts.Artifact; -import de.intevation.artifactdatabase.data.StateData; - import de.intevation.flys.artifacts.access.RangeAccess; import de.intevation.flys.artifacts.FLYSArtifact; diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java Mon Feb 25 11:50:13 2013 +0100 @@ -408,8 +408,9 @@ File dir, WSPLGENJob job ) { + String river = artifact.getDataAsString("river"); String geoJSON = artifact.getDataAsString("uesk.barriers"); - String srid = FLYSUtils.getRiverSrid(artifact); + String srid = FLYSUtils.getRiverDGMSrid(river); String srs = "EPSG:" + srid; if (geoJSON == null || geoJSON.length() == 0) { @@ -610,9 +611,9 @@ protected void setAxis(FLYSArtifact artifact, File dir, WSPLGENJob job) { String river = artifact.getDataAsString("river"); - String srid = FLYSUtils.getRiverSrid(artifact); + String srid = FLYSUtils.getRiverDGMSrid(river); String srs = "EPSG:" + srid; - +logger.debug("srs: " + srs); List axes = RiverAxis.getRiverAxis(river); if (axes == null || axes.isEmpty()) { logger.warn("Could not find river axis for: '" + river + "'"); @@ -649,7 +650,7 @@ protected void setPro(FLYSArtifact artifact, File dir, WSPLGENJob job) { String river = artifact.getDataAsString("river"); - String srid = FLYSUtils.getRiverSrid(artifact); + String srid = FLYSUtils.getRiverDGMSrid(river); String srs = "EPSG:" + srid; List cst = @@ -719,7 +720,7 @@ } String river = artifact.getDataAsString("river"); - String srid = FLYSUtils.getRiverSrid(artifact); + String srid = FLYSUtils.getRiverDGMSrid(river); String srs = "EPSG:" + srid; Floodplain plain = Floodplain.getFloodplain(river); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/HistoricalDischargeComputeState.java Mon Feb 25 11:50:13 2013 +0100 @@ -1,5 +1,7 @@ package de.intevation.flys.artifacts.states; +import java.text.NumberFormat; + import java.util.List; import org.apache.log4j.Logger; @@ -35,8 +37,9 @@ * * @author Ingo Weinzierl */ -public class HistoricalDischargeComputeState extends DefaultState implements - FacetTypes { +public class HistoricalDischargeComputeState +extends DefaultState +implements FacetTypes { private static final Logger logger = Logger .getLogger(HistoricalDischargeComputeState.class); @@ -136,15 +139,17 @@ double[] ws = access.getWs(); double[] qs = access.getQs(); + NumberFormat format = NumberFormat.getInstance( + Resources.getLocale(cc.getMeta())); for (int k = 0; k < ws.length; k++) { facets.add(new HistoricalDischargeWQFacet(k, - HISTORICAL_DISCHARGE_WQ_W, "W=" + ws[k], ComputeType.ADVANCE, + HISTORICAL_DISCHARGE_WQ_W, "W=" + format.format(ws[k]), ComputeType.ADVANCE, hash, getID(), ws[k])); } for (int k = 0; k < qs.length; k++) { facets.add(new HistoricalDischargeWQFacet(k, - HISTORICAL_DISCHARGE_WQ_Q, "Q=" + qs[k], ComputeType.ADVANCE, + HISTORICAL_DISCHARGE_WQ_Q, "Q=" + format.format(qs[k]), ComputeType.ADVANCE, hash, getID(), qs[k])); } diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RangeState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RangeState.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RangeState.java Mon Feb 25 11:50:13 2013 +0100 @@ -1,13 +1,12 @@ package de.intevation.flys.artifacts.states; -import org.apache.log4j.Logger; - import de.intevation.artifacts.Artifact; -import de.intevation.artifactdatabase.data.StateData; +import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.access.RangeAccess; -import de.intevation.flys.artifacts.FLYSArtifact; + +import org.apache.log4j.Logger; /** diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java Mon Feb 25 11:50:13 2013 +0100 @@ -130,6 +130,9 @@ new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); } + facets.add( + new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); + facets.add(new FixWQCurveFacet( 0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE))); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java Mon Feb 25 11:50:13 2013 +0100 @@ -59,6 +59,8 @@ * @param oldAttr "Old" (possibly user-changed) outputs. * @param newAttr "New" (eventually re-read in its original, unchanged * form) outputs. + * @param matrix Compatibility matrix, mapping output names to list of + * facet names that can be included in this out. */ public AttributeWriter( ArtifactDatabase db, @@ -98,8 +100,7 @@ String outName = entry.getKey(); Output a = entry.getValue(); - Output exists = attribute.getOutput(outName); - if (exists == null) { + if (!attribute.hasOutput(outName)) { attribute.addOutput(outName, a); } diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java --- a/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java Mon Feb 25 11:50:13 2013 +0100 @@ -25,6 +25,7 @@ /** Create attribute part of collection document. */ public class CollectionAttribute { + /** Privately owned logger. */ private static final Logger logger = Logger.getLogger(CollectionAttribute.class); @@ -169,6 +170,10 @@ return doc; } + /** True if output with outputName is found. */ + public boolean hasOutput(String outputName) { + return getOutput(outputName) != null; + } public Map getOutputs() { return outputMap; diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java --- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java Mon Feb 25 11:50:13 2013 +0100 @@ -36,6 +36,9 @@ import de.intevation.flys.utils.FLYSUtils; /** + * Collection of artifacts, can do outs, describe. + * Lots of stuff done in AttributeParser and AttributeWriter. + * Critical out and facet merging. * @author Ingo Weinzierl */ public class FLYSArtifactCollection extends DefaultArtifactCollection { @@ -65,7 +68,7 @@ /** - * Return description Document for this collection. + * Create and return description Document for this collection. */ @Override public Document describe(CallContext context) { @@ -373,7 +376,7 @@ AttributeParser parser = new AttributeParser(oldAttrs); CollectionAttribute cAttr = parser.getCollectionAttribute(); - Output output = cAttr.getOutput(name); + Output output = cAttr.getOutput(name); Settings settings = null; if (output != null) { settings = output.getSettings(); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Mon Feb 25 11:50:13 2013 +0100 @@ -19,6 +19,9 @@ import de.intevation.flys.artifacts.model.WQ; import de.intevation.flys.collections.FLYSArtifactCollection; +import de.intevation.flys.model.Gauge; +import de.intevation.flys.model.River; +import de.intevation.flys.model.TimeInterval; import de.intevation.flys.utils.FLYSUtils; import de.intevation.flys.artifacts.access.RangeAccess; @@ -83,15 +86,38 @@ throw new IOException(iae); } - String river = FLYSUtils.getRiver(master).getName(); + River river = FLYSUtils.getRiver(master); RangeAccess rangeAccess = new RangeAccess(master, context); double[] kms = rangeAccess.getLocations(); - at.write( - new OutputStreamWriter(out, DEFAULT_ENCODING), - context.getMeta(), - river, - kms[0]); + Gauge gauge = river.determineGaugeByPosition(kms[0]); + if (Math.abs(kms[0] - gauge.getStation().doubleValue()) < 1e-4) { + // at gauge. + TimeInterval interval = + gauge.fetchMasterDischargeTable().getTimeInterval(); + at.write( + new OutputStreamWriter(out, DEFAULT_ENCODING), + context.getMeta(), + river.getName(), + kms[0], + gauge.getName(), + gauge.getDatum(), + interval.getStartTime(), + 100d); + } + else { + // at km + at.write( + new OutputStreamWriter(out), + context.getMeta(), + river.getName(), + kms[0], + null, + null, + null, + 0d); + } + } diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Mon Feb 25 11:50:13 2013 +0100 @@ -3,7 +3,10 @@ import java.io.IOException; import java.io.Writer; import java.io.PrintWriter; +import java.math.BigDecimal; +import java.text.DateFormat; +import java.util.Date; import java.util.Locale; import de.intevation.artifacts.CallMeta; @@ -31,6 +34,9 @@ public static final String I18N_AT_HEADER = "export.discharge.curve.at.header"; + public static final String I18N_AT_GAUGE_HEADER = + "export.discharge.curve.at.gauge.header"; + public static final String EMPTY = " "; protected double minW; @@ -105,28 +111,59 @@ } + protected static void printGaugeHeader( + PrintWriter out, + CallMeta callMeta, + String river, + double km, + String gName, + BigDecimal datum, + Date date + ) { + DateFormat f = DateFormat.getDateInstance(); + out.print(Resources.getMsg( + callMeta, + I18N_AT_GAUGE_HEADER, + I18N_AT_GAUGE_HEADER, + new Object[] { river, gName, f.format(date), datum } )); + out.print("\r\n"); + } + protected static void printHeader( PrintWriter out, CallMeta callMeta, String river, double km ) { - out.println(Resources.getMsg( + out.print(Resources.getMsg( callMeta, I18N_AT_HEADER, I18N_AT_HEADER, new Object[] { river, km } )); + out.print("\r\n"); } - - public void write(Writer writer, CallMeta meta, String river, double km) + public void write( + Writer writer, + CallMeta meta, + String river, + double km, + String gName, + BigDecimal datum, + Date date, + double scale) throws IOException { PrintWriter out = new PrintWriter(writer); // a header is required, because the desktop version of FLYS will skip // the first row. - printHeader(out, meta, river, km); + if (gName != null) { + printGaugeHeader(out, meta, river, km, gName, datum, date); + } + else { + printHeader(out, meta, river, km); + } double rest = (minW * 100.0) % 10.0; @@ -140,7 +177,7 @@ int col = 0; for (double w = startW; w <= maxW; w += 0.01) { if (col == 0) { - out.printf(Locale.US, "%8d", (int)Math.round(w*100.0)); + out.printf(Locale.US, "%8d", (int)Math.round(w * scale)); } if (w < minW) { @@ -151,13 +188,13 @@ } if (++col >= COLUMNS) { - out.println(); + out.print("\r\n"); col = 0; } } if (col > 0) { - out.println(); + out.print("\r\n"); } out.flush(); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Mon Feb 25 11:50:13 2013 +0100 @@ -244,11 +244,14 @@ { logger.info("AbstractExporter.generateCSV"); + char quote = '"'; + char escape = '\\'; + CSVWriter writer = new CSVWriter( new OutputStreamWriter( out, DEFAULT_CSV_CHARSET), - DEFAULT_CSV_SEPARATOR); + DEFAULT_CSV_SEPARATOR, quote, escape, "\r\n"); writeCSVData(writer); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/exports/MiddleBedHeightExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MiddleBedHeightExporter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MiddleBedHeightExporter.java Mon Feb 25 11:50:13 2013 +0100 @@ -115,6 +115,8 @@ NumberFormat soundF = Formatter.getMiddleBedHeightSounding(context); NumberFormat widthF = Formatter.getMiddleBedHeightWidth(context); + heightF.setMaximumFractionDigits(1); + soundF.setMaximumFractionDigits(1); for (MiddleBedHeightData data: mData) { for (int i = 0, n = data.size(); i < n; i++) { int start = data.getStartYear(); @@ -123,7 +125,7 @@ if (start == end) { writer.writeNext(new String[] { kmF.format(data.getKM(i)), - data.getSoundingName(context), + data.getDescription(), heightF.format(data.getMiddleHeight(i)), uncertF.format(data.getUncertainty(i)), gapF.format(data.getDataGap(i)) + "%", @@ -135,7 +137,7 @@ else { writer.writeNext(new String[] { kmF.format(data.getKM(i)), - data.getSoundingName(context), + data.getDescription(), heightF.format(data.getMiddleHeight(i)), "", "", diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Mon Feb 25 11:50:13 2013 +0100 @@ -413,6 +413,10 @@ } + /** + * Write the header, with different headings depending on whether at a + * gauge or at a location. + */ protected void writeCSVHeader( CSVWriter writer, boolean atGauge, @@ -506,6 +510,7 @@ qf.format(result[1]), colDesc, FLYSUtils.getLocationDescription(flys, result[2]), + // TODO issue1114: Take correct gauge result[2] >= a && result[2] <= b ? gaugeName : notinrange diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATExport.java Mon Feb 25 11:50:13 2013 +0100 @@ -15,11 +15,10 @@ import de.intevation.flys.artifacts.model.Parameters; import de.intevation.flys.artifacts.model.fixings.FixAnalysisResult; +import de.intevation.flys.artifacts.model.fixings.FixResult; import de.intevation.flys.exports.AbstractExporter; -import de.intevation.flys.utils.FLYSUtils; - import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; @@ -48,8 +47,8 @@ if (data instanceof CalculationResult) { CalculationResult cr = (CalculationResult)data; Object resData = cr.getData(); - if (resData instanceof FixAnalysisResult) { - this.parameters = ((FixAnalysisResult)resData).getParameters(); + if (resData instanceof FixResult) { + this.parameters = ((FixResult)resData).getParameters(); } } else { diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ArtifactMapfileGenerator.java Mon Feb 25 11:50:13 2013 +0100 @@ -2,6 +2,7 @@ import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.access.RiverAccess; import de.intevation.flys.artifacts.model.LayerInfo; import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet; import de.intevation.flys.artifacts.model.map.WMSLayerFacet; @@ -77,7 +78,9 @@ "floodmap.uesk", "Floodmap")); layerinfo.setStyle(style); - layerinfo.setSrid(wms.getSrid()); + RiverAccess access = new RiverAccess(flys); + String river = access.getRiver(); + layerinfo.setSrid(FLYSUtils.getRiverDGMSrid(river)); String name = MS_LAYER_PREFIX + wms.getName(); diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Feb 25 11:50:13 2013 +0100 @@ -72,6 +72,9 @@ public static final String XPATH_FLOODMAP_RIVER_PROJECTION = "/artifact-database/floodmap/river[@name=$name]/srid/@value"; + public static final String XPATH_FLOODMAP_DGM_PROJECTION = + "/artifact-database/floodmap/river[@name=$name]/dgm-srid/@value"; + public static final String XPATH_FLOODMAP_SHAPEFILE_DIR = "/artifact-database/floodmap/shapefile-path/@value"; @@ -416,6 +419,23 @@ variables); } + public static String getRiverDGMSrid(String rivername) { + Map variables = new HashMap(1); + variables.put("name", rivername); + + Document cfg = Config.getConfig(); + + String dgm = (String) XMLUtils.xpath( + cfg, + XPATH_FLOODMAP_DGM_PROJECTION, + XPathConstants.STRING, + null, + variables); + if (logger.isDebugEnabled()) { + logger.debug("Use EPSG:" + dgm + " for DGM"); + } + return dgm; + } /** * Return the (first) Gauge corresponding to the given location(s) of diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages.properties Mon Feb 25 11:50:13 2013 +0100 @@ -78,7 +78,7 @@ calc.flood.map = Flood Plain calc.discharge.curve = State Discharge Curve/Stage Discharge Relation calc.duration.curve = Duration Curve -calc.discharge.longitudinal.section = TODO (W bei...) +calc.discharge.longitudinal.section = W for userdefined Discharge calc.w.differences = Differences calc.historical.discharge.curve = Historical Discharge Curve calc.reference.curve = Reference Curve @@ -322,9 +322,10 @@ export.duration.curve.csv.header.q = Q [m\u00b3/s] export.discharge.longitudinal.section.csv.header.km = River-Km export.discharge.longitudinal.section.csv.header.w = W [NN + m] -export.discharge.longitudinal.section.csv.header.cw = W corr. +export.discharge.longitudinal.section.csv.header.cw = W corr. [NN +m] export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] export.discharge.curve.at.header = Computed Discharge Curve for {0} {0}-km: {1} +export.discharge.curve.at.gauge.header = Discharge Table for {1}/{0} since {2} PNP[NN+m] = {3} export.historical.discharge.csv.header.timerange = Timerange export.historical.discharge.csv.header.waterlevel = Waterlevel [cm] export.historical.discharge.csv.header.discharge = Discharge [m\u00b3/s] diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de.properties Mon Feb 25 11:50:13 2013 +0100 @@ -79,7 +79,7 @@ calc.flood.map = \u00dcberschwemmungsfl\u00e4che calc.discharge.curve = Abflusskurve/Abflusstafel calc.duration.curve = Dauerlinie -calc.discharge.longitudinal.section = W f\u00fcr ungleichwertigen Abflussl\u00e4ngsschnitt +calc.discharge.longitudinal.section = W f\u00fcr benutzerdefinierten Abflussl\u00e4ngsschnitt calc.w.differences = Differenzen calc.historical.discharge.curve = Hist. Abflusskurven calc.reference.curve = Bezugslinie @@ -312,9 +312,10 @@ export.duration.curve.csv.header.q = Q [m\u00b3/s] export.discharge.longitudinal.section.csv.header.km = Fluss-Km export.discharge.longitudinal.section.csv.header.w = W [NN + m] -export.discharge.longitudinal.section.csv.header.cw = W korr. +export.discharge.longitudinal.section.csv.header.cw = W korr. [NN + m] export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] -export.discharge.curve.at.header = Berechnete Abflusskurve f\u00fcr {0} {0}-km: {1} +export.discharge.curve.at.header = Berechnete Abflusstafel f\u00fcr {0}, km {1} +export.discharge.curve.at.gauge.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} export.historical.discharge.csv.header.timerange = Zeitraum export.historical.discharge.csv.header.waterlevel = Wasserstand [cm] export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s] diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Feb 25 11:50:13 2013 +0100 @@ -80,7 +80,7 @@ calc.flood.map = \u00dcberschwemmungsfl\u00e4che calc.discharge.curve = Abflusskurve/Abflusstafel calc.duration.curve = Dauerlinie -calc.discharge.longitudinal.section = W f\u00fcr ungleichwertigen Abflussl\u00e4ngsschnitt +calc.discharge.longitudinal.section = W f\u00fcr benutzerdefinierten Abflussl\u00e4ngsschnitt calc.w.differences = Differenzen calc.historical.discharge.curve = Hist. Abflusskurven calc.reference.curve = Bezugslinie @@ -321,9 +321,10 @@ export.duration.curve.csv.header.q = Q [m\u00b3/s] export.discharge.longitudinal.section.csv.header.km = Fluss-Km export.discharge.longitudinal.section.csv.header.w = W [NN + m] -export.discharge.longitudinal.section.csv.header.cw = W korr. +export.discharge.longitudinal.section.csv.header.cw = W korr. [NN + m] export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] -export.discharge.curve.at.header = Berechnete Abflusskurve f\u00fcr {0} {0}-km: {1} +export.discharge.curve.at.gauge.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3} +export.discharge.curve.at.header = Berechnete Abflusstafel f\u00fcr {0}, km {1} export.historical.discharge.csv.header.timerange = Zeitraum export.historical.discharge.csv.header.waterlevel = Wasserstand [cm] export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s] diff -r 4f46679e13d0 -r 4f65d833680f flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_en.properties Mon Feb 25 11:50:13 2013 +0100 @@ -78,7 +78,7 @@ calc.flood.map = Flood Plain calc.discharge.curve = State Discharge Curve/Stage Discharge Relation calc.duration.curve = Duration Curve -calc.discharge.longitudinal.section = TODO (W bei...) +calc.discharge.longitudinal.section = W for userdefined Discharge calc.w.differences = Differences calc.historical.discharge.curve = Historical Discharge Curve calc.reference.curve = Reference Curve @@ -324,9 +324,10 @@ export.duration.curve.csv.header.q = Q [m\u00b3/s] export.discharge.longitudinal.section.csv.header.km = River-Km export.discharge.longitudinal.section.csv.header.w = W [NN + m] -export.discharge.longitudinal.section.csv.header.cw = W corr. +export.discharge.longitudinal.section.csv.header.cw = W corr. [NN + m] export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s] export.discharge.curve.at.header = Computed Discharge Curve for {0} {0}-km: {1} +export.discharge.curve.at.gauge.header = Dischargetable for {1}/{0} since {2} Datum[NN+m] = {3} export.historical.discharge.csv.header.timerange = Timerange export.historical.discharge.csv.header.waterlevel = Waterlevel [cm] export.historical.discharge.csv.header.discharge = Discharge [m\u00b3/s] diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/contrib/run_hydr_morph.sh --- a/flys-backend/contrib/run_hydr_morph.sh Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/contrib/run_hydr_morph.sh Mon Feb 25 11:50:13 2013 +0100 @@ -25,30 +25,31 @@ IMPORTER_MAINVALUE_TYPES=QWTD IMPORTER_ANNOTATION_TYPES="conf/annotation-types.xml" -IMPORTER_SKIP_GAUGES=false -IMPORTER_SKIP_HISTORICAL_DISCHARGE_GAUGES=false IMPORTER_SKIP_ANNOTATIONS=false -IMPORTER_SKIP_WST=false -IMPORTER_SKIP_PRFS=false +IMPORTER_SKIP_BWASTR=false IMPORTER_SKIP_DA50S=false IMPORTER_SKIP_DA66S=false -IMPORTER_SKIP_W80S=false -IMPORTER_SKIP_HYKS=false IMPORTER_SKIP_EXTRA_WST=false IMPORTER_SKIP_FIXATIONS=false -IMPORTER_SKIP_OFFICIAL_LINES=false IMPORTER_SKIP_FLOOD_WATER=false IMPORTER_SKIP_FLOOD_PROTECTION=false +IMPORTER_SKIP_GAUGES=false +IMPORTER_SKIP_HISTORICAL_DISCHARGE_GAUGES=false +IMPORTER_SKIP_HYKS=false +IMPORTER_SKIP_OFFICIAL_LINES=false +IMPORTER_SKIP_PRFS=false +IMPORTER_SKIP_W80S=false +IMPORTER_SKIP_WST=false IMPORTER_SKIP_BED_HEIGHT_SINGLE=false IMPORTER_SKIP_BED_HEIGHT_EPOCH=false -IMPORTER_SKIP_SEDIMENT_DENSITY=false +IMPORTER_SKIP_FLOW_VELOCITY=false IMPORTER_SKIP_MORPHOLOGICAL_WIDTH=false -IMPORTER_SKIP_FLOW_VELOCITY=false +IMPORTER_SKIP_SEDIMENT_DENSITY=false IMPORTER_SKIP_SEDIMENT_YIELD=false +IMPORTER_SKIP_SQ_RELATION=false IMPORTER_SKIP_WATERLEVELS=false IMPORTER_SKIP_WATERLEVEL_DIFFERENCES=false -IMPORTER_SKIP_SQ_RELATION=false ##################################################################### #MIN_MEMORY="8192m" @@ -73,29 +74,30 @@ -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ -Dflys.backend.importer.annotation.types=$IMPORTER_ANNOTATION_TYPES \ -Dflys.backend.importer.dry.run=$IMPORTER_DRY_RUN \ - -Dflys.backend.importer.skip.historical.discharge.tables=$IMPORTER_SKIP_HISTORICAL_DISCHARGE_GAUGES \ - -Dflys.backend.importer.skip.gauges=$IMPORTER_SKIP_GAUGES \ -Dflys.backend.importer.skip.annotations=$IMPORTER_SKIP_ANNOTATIONS \ - -Dflys.backend.importer.skip.prfs=$IMPORTER_SKIP_PRFS \ - -Dflys.backend.importer.skip.w80s=$IMPORTER_SKIP_W80S \ + -Dflys.backend.importer.skip.bed.height.single=$IMPORTER_SKIP_BED_HEIGHT_SINGLE \ + -Dflys.backend.importer.skip.bed.height.epoch=$IMPORTER_SKIP_BED_HEIGHT_EPOCH \ + -Dflys.backend.importer.skip.bwastr=$IMPORTER_SKIP_BWASTR \ -Dflys.backend.importer.skip.da50s=$IMPORTER_SKIP_DA50S \ -Dflys.backend.importer.skip.da66s=$IMPORTER_SKIP_DA66S \ - -Dflys.backend.importer.skip.hyks=$IMPORTER_SKIP_HYKS \ - -Dflys.backend.importer.skip.wst=$IMPORTER_SKIP_WST \ -Dflys.backend.importer.skip.extra.wsts=$IMPORTER_SKIP_EXTRA_WST \ -Dflys.backend.importer.skip.fixations=$IMPORTER_SKIP_FIXATIONS \ - -Dflys.backend.importer.skip.official.lines=$IMPORTER_SKIP_OFFICIAL_LINES \ -Dflys.backend.importer.skip.flood.water=$IMPORTER_SKIP_FLOOD_WATER \ -Dflys.backend.importer.skip.flood.protection=$IMPORTER_SKIP_FLOOD_PROTECTION \ - -Dflys.backend.importer.skip.bed.height.single=$IMPORTER_SKIP_BED_HEIGHT_SINGLE \ - -Dflys.backend.importer.skip.bed.height.epoch=$IMPORTER_SKIP_BED_HEIGHT_EPOCH \ + -Dflys.backend.importer.skip.flow.velocity=$IMPORTER_SKIP_FLOW_VELOCITY \ + -Dflys.backend.importer.skip.gauges=$IMPORTER_SKIP_GAUGES \ + -Dflys.backend.importer.skip.historical.discharge.tables=$IMPORTER_SKIP_HISTORICAL_DISCHARGE_GAUGES \ + -Dflys.backend.importer.skip.hyks=$IMPORTER_SKIP_HYKS \ + -Dflys.backend.importer.skip.morphological.width=$IMPORTER_SKIP_MORPHOLOGICAL_WIDTH \ + -Dflys.backend.importer.skip.official.lines=$IMPORTER_SKIP_OFFICIAL_LINES \ + -Dflys.backend.importer.skip.prfs=$IMPORTER_SKIP_PRFS \ -Dflys.backend.importer.skip.sediment.density=$IMPORTER_SKIP_SEDIMENT_DENSITY \ - -Dflys.backend.importer.skip.morphological.width=$IMPORTER_SKIP_MORPHOLOGICAL_WIDTH \ - -Dflys.backend.importer.skip.flow.velocity=$IMPORTER_SKIP_FLOW_VELOCITY \ -Dflys.backend.importer.skip.sediment.yield=$IMPORTER_SKIP_SEDIMENT_YIELD \ + -Dflys.backend.importer.skip.sq.relation=$IMPORTER_SKIP_SQ_RELATION \ + -Dflys.backend.importer.skip.w80s=$IMPORTER_SKIP_W80S \ -Dflys.backend.importer.skip.waterlevels=$IMPORTER_SKIP_WATERLEVELS \ -Dflys.backend.importer.skip.waterlevel.differences=$IMPORTER_SKIP_WATERLEVEL_DIFFERENCES \ - -Dflys.backend.importer.skip.sq.relation=$IMPORTER_SKIP_SQ_RELATION \ + -Dflys.backend.importer.skip.wst=$IMPORTER_SKIP_WST \ -Dflys.backend.user=$BACKEND_USER \ -Dflys.backend.password=$BACKEND_PASS \ -Dflys.backend.url=$BACKEND_URL \ diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/doc/README.txt --- a/flys-backend/doc/README.txt Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/doc/README.txt Mon Feb 25 11:50:13 2013 +0100 @@ -18,8 +18,9 @@ System-Properties gesteuert werden. Diese werden im Allgemeinen in der Form -Dkey=value angegeben. -Will man z.B. mit dem Importer nur in simulierierten Import -durchführen, dann kann dies über die Angabe von +Will man z.B. mit dem Importer nur einen simulierten Import +durchführen (also nicht in die Datenbank geschrieben werden), +dann kann dies über die Angabe von '-Dflys.backend.importer.dry.run=true' erfolgen. !!! Der Import geht wie Desktop-FLYS davon aus, dass die Dateien diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/Config.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/Config.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/Config.java Mon Feb 25 11:50:13 2013 +0100 @@ -17,6 +17,9 @@ public static final String SKIP_GAUGES = "flys.backend.importer.skip.gauges"; + public static final String SKIP_BWASTR = + "flys.backend.importer.skip.bwastr"; + public static final String SKIP_HISTORICAL_DISCHARGE_TABLES = "flys.backend.importer.skip.historical.discharge.tables"; @@ -119,6 +122,10 @@ return getFlag(SKIP_HISTORICAL_DISCHARGE_TABLES); } + public boolean skipBWASTR() { + return getFlag(SKIP_BWASTR); + } + public boolean skipAnnotations() { return getFlag(SKIP_ANNOTATIONS); } diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java Mon Feb 25 11:50:13 2013 +0100 @@ -25,9 +25,9 @@ } }; - protected Double km; + protected Double km; protected ImportCrossSection crossSection; - protected List points; + protected List points; protected CrossSectionLine peer; diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Mon Feb 25 11:50:13 2013 +0100 @@ -46,6 +46,7 @@ /** Import all river-related data (files) that can be found. */ public class ImportRiver { + /** Private logger. */ private static Logger log = Logger.getLogger(ImportRiver.class); public static final String PEGEL_GLT = "PEGEL.GLT"; @@ -105,9 +106,11 @@ protected String name; - protected File wstFile; + protected Long officialNumber; - protected File bbInfoFile; + protected File wstFile; + + protected File bbInfoFile; protected List gauges; @@ -155,6 +158,7 @@ protected AnnotationClassifier annotationClassifier; + /** Database-mapped River instance. */ protected River peer; @@ -233,6 +237,14 @@ this.name = name; } + public Long getOfficialNumber() { + return this.officialNumber; + } + + public void setOfficialNumber(Long officialNumber) { + this.officialNumber = officialNumber; + } + public File getWstFile() { return wstFile; } @@ -329,6 +341,13 @@ } } + public void storeOfficialNumber() { + if (Config.INSTANCE.skipBWASTR()) { + log.info("skip storing official number."); + return; + } + getPeer().setOfficialNumber(officialNumber); + } public void parseBedHeight() throws IOException { File minfoDir = getMinfoDir(); @@ -541,7 +560,12 @@ parser.parse(file); } - waterlevels = parser.getWaterlevels(); + // The parsed ImportWaterlevels are converted to + // 'fixation'-wsts now. + for(ImportWst iw: parser.exportWsts()) { + //iw.setDescription("CSV" + iw.getDescription()); + fixations.add(iw); + } } protected void parseMeasurementStations() throws IOException { @@ -1058,6 +1082,7 @@ storeWaterlevelDifferences(); storeMeasurementStations(); storeSQRelations(); + storeOfficialNumber(); } public void storeWstUnit() { @@ -1097,8 +1122,8 @@ } public void storeFixations() { - if (!Config.INSTANCE.skipFixations()) { - log.info("store fixation wsts"); + if (!Config.INSTANCE.skipFixations() || !Config.INSTANCE.skipWaterlevels()) { + log.info("store fixation wsts and/or csvs"); River river = getPeer(); for (ImportWst wst: fixations) { log.debug("name: " + wst.getDescription()); @@ -1435,13 +1460,19 @@ Session session = ImporterSession.getInstance().getDatabaseSession(); Query query = session.createQuery("from River where name=:name"); - Unit u = wstUnit.getPeer(); + Unit u = null; + if (wstUnit != null) { + u = wstUnit.getPeer(); + } query.setString("name", name); List rivers = query.list(); if (rivers.isEmpty()) { log.info("Store new river '" + name + "'"); peer = new River(name, u); + if (!Config.INSTANCE.skipBWASTR()) { + peer.setOfficialNumber(officialNumber); + } session.save(peer); } else { diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java Mon Feb 25 11:50:13 2013 +0100 @@ -31,14 +31,26 @@ this.description = description; } + public String getDescription() { + return this.description; + } + public void setUnit(ImportUnit unit) { this.unit = unit; } + public ImportUnit getUnit() { + return this.unit; + } + public void addValue(ImportWaterlevelQRange qRange) { this.qRanges.add(qRange); } + public List getQRanges() { + return this.qRanges; + } + public void storeDependencies(River river) { log.info("store dependencies"); diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java Mon Feb 25 11:50:13 2013 +0100 @@ -12,12 +12,12 @@ import de.intevation.flys.model.WaterlevelQRange; +/** Has a Q and list of W,km values. */ public class ImportWaterlevelQRange { private static final Logger log = Logger.getLogger(ImportWaterlevelQRange.class); - private Double q; private List values; @@ -34,6 +34,13 @@ this.values.add(value); } + public Double getQ() { + return this.q; + } + + public List getValues() { + return values; + } public void storeDependencies(Waterlevel waterlevel) { log.info("store dependencies"); diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java Mon Feb 25 11:50:13 2013 +0100 @@ -9,6 +9,7 @@ import de.intevation.flys.model.WaterlevelValue; +/** W and a station. */ public class ImportWaterlevelValue { private Double station; @@ -28,6 +29,15 @@ } + public Double getStation() { + return this.station; + } + + + public Double getW() { + return this.w; + } + public WaterlevelValue getPeer(WaterlevelQRange qRange) { if (peer == null) { Session session = ImporterSession.getInstance().getDatabaseSession(); diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportWst.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWst.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWst.java Mon Feb 25 11:50:13 2013 +0100 @@ -23,6 +23,7 @@ protected ImportUnit unit; + /** Wst as in db. */ protected Wst peer; public ImportWst() { @@ -87,6 +88,7 @@ session.flush(); } + /** Get corresponding mapped wst (from database). */ public Wst getPeer(River river) { if (peer == null) { Session session = ImporterSession.getInstance().getDatabaseSession(); diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java Mon Feb 25 11:50:13 2013 +0100 @@ -15,6 +15,8 @@ import org.apache.log4j.Logger; + +/** Unmapped column of a WST. */ public class ImportWstColumn { private static Logger log = Logger.getLogger(ImportWstColumn.class); @@ -112,6 +114,7 @@ this.timeInterval = timeInterval; } + /** Get corresponding mapped wst-column (from database). */ public WstColumn getPeer(River river) { if (peer == null) { Wst w = wst.getPeer(river); diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/Importer.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/Importer.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/Importer.java Mon Feb 25 11:50:13 2013 +0100 @@ -2,13 +2,16 @@ import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.flys.importer.parsers.AnnotationClassifier; +import de.intevation.flys.importer.parsers.BundesWasserStrassenParser; import de.intevation.flys.importer.parsers.InfoGewParser; -import de.intevation.flys.importer.parsers.AnnotationClassifier; import java.io.File; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.sql.SQLException; @@ -19,12 +22,16 @@ import org.w3c.dom.Document; +import de.intevation.flys.utils.StringUtil; -/** Data Importer. */ +/** Data Importer. Further processing happens per-river. */ public class Importer { + /** Private logger. */ private static Logger log = Logger.getLogger(Importer.class); + private static String BWASTR_ID_CSV_FILE = "BWASTR_ID.csv"; + protected List rivers; public Importer() { @@ -42,6 +49,7 @@ this.rivers = rivers; } + /** Write rivers and their dependencies/dependants to db. */ public void writeRivers() { log.debug("write rivers started"); @@ -121,10 +129,16 @@ log.info("Start parsing rivers..."); + File bwastrFile = null; + for (String gew: args) { log.info("parsing info gew file: " + gew); + File gewFile = new File(gew); + if (bwastrFile == null) { + bwastrFile = new File(gewFile.getParentFile(), BWASTR_ID_CSV_FILE); + } try { - infoGewParser.parse(new File(gew)); + infoGewParser.parse(gewFile); } catch (IOException ioe) { log.error("error while parsing gew: " + gew); @@ -134,14 +148,45 @@ String gew = Config.INSTANCE.getInfoGewFile(); if (gew != null && gew.length() > 0) { log.info("parsing info gew file: " + gew); + File gewFile = new File(gew); + if (bwastrFile == null) { + bwastrFile = new File(gewFile.getParentFile(), BWASTR_ID_CSV_FILE); + } try { - infoGewParser.parse(new File(gew)); + infoGewParser.parse(gewFile); } catch (IOException ioe) { log.error("error while parsing gew: " + gew); } } + // Look for official numbers. + BundesWasserStrassenParser bwastrIdParser = + new BundesWasserStrassenParser(); + + // Read bwastFile (river-dir + BWASTR_ID_CSV_FILE). + if (!Config.INSTANCE.skipBWASTR()) { + try{ + bwastrIdParser.parse(bwastrFile); + HashMap map = bwastrIdParser.getMap(); + + // Now link rivers with official numbers. + for(ImportRiver river: infoGewParser.getRivers()) { + for(Map.Entry entry: map.entrySet()) { + if (StringUtil.containsIgnoreCase(entry.getKey(), river.getName())) { + river.setOfficialNumber(entry.getValue()); + log.debug(river.getName() + " is mapped to bwastr " + entry.getValue()); + } + } + } + } catch (IOException ioe) { + log.warn("BWASTR-file could not be loaded."); + } + } + else { + log.debug("skip reading BWASTR_ID.csv"); + } + if (!Config.INSTANCE.dryRun()) { new Importer(infoGewParser.getRivers()).writeToDatabase(); } diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/parsers/BundesWasserStrassenParser.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BundesWasserStrassenParser.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,85 @@ +package de.intevation.flys.importer.parsers; + +import java.math.BigDecimal; + +import java.text.NumberFormat; +import java.text.ParseException; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.log4j.Logger; + +import de.intevation.flys.importer.ImportMorphWidth; +import de.intevation.flys.importer.ImportMorphWidthValue; +import de.intevation.flys.importer.ImportUnit; + +/** Parse CSV file that contains official numbers for rivers. */ +public class BundesWasserStrassenParser extends LineParser { + + /** Private logger. */ + private static final Logger logger = + Logger.getLogger(BundesWasserStrassenParser.class); + + /** Map from rivernames to Official numbers. */ + private HashMap numberMap; + + + public BundesWasserStrassenParser() { + numberMap = new HashMap(); + } + + + /** No need to reset. */ + @Override + protected void reset() { + } + + + /** No action needed on eof. */ + @Override + protected void finish() { + } + + + /** Handle a line of the bwastr-id file. */ + @Override + protected void handleLine(int lineNum, String line) { + String[] vals = line.split(","); + if (vals.length != 2) { + logger.warn("Invalid bwastr-id line:\n" + line); + return; + } + try{ + String name = unwrap(vals[0].toLowerCase()); + String numberStr = unwrap(vals[1]); + Long number = Long.valueOf(numberStr); + numberMap.put(name, number); + } + catch (NumberFormatException e) { + logger.warn("Invalid number in bwastr-id line:\n" + line); + } + } + + + /** Get river->official number mapping. */ + public HashMap getMap() { + return numberMap; + } + + + /** Remove leading and trailing quotes. */ + protected String unwrap(String input) { + if (input.startsWith("\"")) { + input = input.substring(1); + } + if (input.endsWith("\"")) { + input = input.substring(0, input.length() - 1); + } + return input; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/parsers/InfoGewParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/InfoGewParser.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/InfoGewParser.java Mon Feb 25 11:50:13 2013 +0100 @@ -57,7 +57,7 @@ return f.replace("\\", "/").replace("/", File.separator); } - /* Handle a gew, wst, or bb_info file. */ + /** Handle a gew, wst, or bb_info file. */ public void parse(File file) throws IOException { LineNumberReader in = null; diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java Mon Feb 25 11:50:13 2013 +0100 @@ -22,14 +22,11 @@ private static final Logger log = Logger.getLogger(MorphologicalWidthParser.class); - public static final NumberFormat nf = NumberFormat.getInstance(DEFAULT_LOCALE); - public static final Pattern META_UNIT = Pattern.compile("^Einheit: \\[(.*)\\].*"); - protected List morphWidths; protected ImportMorphWidth current; diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java Mon Feb 25 11:50:13 2013 +0100 @@ -2,6 +2,7 @@ import java.io.File; import java.io.IOException; +import java.math.BigDecimal; import java.text.NumberFormat; import java.text.ParseException; import java.util.ArrayList; @@ -16,7 +17,19 @@ import de.intevation.flys.importer.ImportWaterlevelQRange; import de.intevation.flys.importer.ImportWaterlevelValue; +import de.intevation.flys.importer.ImportWstColumn; +import de.intevation.flys.importer.ImportRange; +import de.intevation.flys.importer.ImportWst; +import de.intevation.flys.importer.ImportWstQRange; + +/** + * Parse CSV Waterlevel files. + * As these waterlevels are probably used in fixation analysis + * only, functionality to export them to "fixation"-wsts + * has been added (the ImportWaterlevel*- stuff is actually + * not needed to do so.) + */ public class WaterlevelParser extends LineParser { private static final Logger log = Logger.getLogger(WaterlevelParser.class); @@ -30,7 +43,6 @@ public static final Pattern META_UNIT = Pattern.compile("^Einheit: \\[(.*)\\].*"); - private List waterlevels; private ImportWaterlevel current; @@ -45,6 +57,56 @@ } + /** + * Create ImportWst objects from ImportWaterlevel + * objects. + */ + public List exportWsts() { + List wsts = new ArrayList(); + for(ImportWaterlevel waterlevel: getWaterlevels()) { + String description = waterlevel.getDescription(); + ImportWst wst = new ImportWst(); + wsts.add(wst); + wst.setDescription(description); + // Fixation kind. + wst.setKind(2); + wst.setUnit(waterlevel.getUnit()); + + // Fake WST has but 1 column. + wst.setNumberColumns(1); + ImportWstColumn column = wst.getColumn(0); + column.setDescription(description); + column.setName(description); + column.setPosition(0); + + // Build Q Range. + List qRanges = waterlevel.getQRanges(); + for(ImportWaterlevelQRange range: qRanges) { + List values = range.getValues(); + if (values.size() < 2) { + log.warn ("Not enough values to build valid QRange"); + continue; + } + ImportRange iRange = new ImportRange( + BigDecimal.valueOf(values.get(0).getStation()), + BigDecimal.valueOf(values.get(values.size() -1).getStation())); + column.addColumnQRange( + new ImportWstQRange(iRange, BigDecimal.valueOf(range.getQ()))); + } + + // The other W/KM values. + for(ImportWaterlevelQRange range: qRanges) { + for(ImportWaterlevelValue value: range.getValues()) { + column.addColumnValue(BigDecimal.valueOf(value.getStation()), + BigDecimal.valueOf(value.getW())); + } + } + // TODO Maybe set a timeinterval. + } + return wsts; + } + + public List getWaterlevels() { return waterlevels; } diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java Mon Feb 25 11:50:13 2013 +0100 @@ -18,7 +18,7 @@ - +/** Mapped Waterlevel. */ @Entity @Table(name = "waterlevel") public class Waterlevel diff -r 4f46679e13d0 -r 4f65d833680f flys-backend/src/main/java/de/intevation/flys/utils/StringUtil.java --- a/flys-backend/src/main/java/de/intevation/flys/utils/StringUtil.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/utils/StringUtil.java Mon Feb 25 11:50:13 2013 +0100 @@ -819,5 +819,11 @@ testQuote(); testStringArray2D(); } + + /** Check for occurence of needle in hay, converting both to lowercase + * to be ignorant of cases. */ + public static boolean containsIgnoreCase(String hay, String needle) { + return hay.toLowerCase().contains(needle.toLowerCase()); + } } // end of file diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Mon Feb 25 11:50:13 2013 +0100 @@ -35,9 +35,12 @@ import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.CollectionItem; +import de.intevation.flys.client.shared.model.GaugeInfo; import de.intevation.flys.client.shared.model.River; import de.intevation.flys.client.shared.model.User; +import de.intevation.flys.client.client.ui.wq.WQAutoTabSet; + import java.util.ArrayList; import java.util.List; import java.util.MissingResourceException; @@ -434,6 +437,29 @@ }); } + + /** Opens a window with Main Values from gauge. */ + public void newGaugeMainValueTable(GaugeInfo gauge) { + Window mainValueView = new Window(); + + // Take middle to avoid issues at borders. + double km = (gauge.getKmEnd() + gauge.getKmStart())/2d; + mainValueView.addItem(new WQAutoTabSet(gauge.getRiverName(), + new double[] {km, km})); + mainValueView.setWidth(450); + mainValueView.setHeight(600); + + mainValueView.setMaximized(false); + mainValueView.centerInPage(); + mainValueView.setCanDragReposition(true); + mainValueView.setCanDragResize(true); + mainValueView.setShowMaximizeButton(true); + mainValueView.setKeepInParentRect(true); + + mainValueView.setTitle(MSG.mainvalues() + " " + gauge.getName() + " (" + gauge.getRiverName() + ")" ); + workspace.addChild(mainValueView); + } + public void newGaugeDischargeCurve(String river, Long gaugeref) { Config config = Config.getInstance(); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Feb 25 11:50:13 2013 +0100 @@ -852,6 +852,10 @@ String mainvalue(); + String mainvalues(); + + String show_mainvalues(); + String dems(); String hydrboundaries(); @@ -1044,6 +1048,8 @@ String areatransparency(); + String attribution(); + // Manual Points editor String addpoints(); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Feb 25 11:50:13 2013 +0100 @@ -106,9 +106,9 @@ riverMap = images/FLYS_Karte.png properties_ico = images/properties.png -dpLabelFrom = From +dpLabelFrom = from dpUnitFrom = km -dpLabelTo = To +dpLabelTo = to dpUnitTo = km dpLabelStep = a dpUnitStep = m @@ -160,7 +160,7 @@ wqTitle = Input for W/Q Data wqadaptedTitle = Input for W/Q Data wqHistorical = Selection of Analyse Type -calcTableTitle = Calculated Output +calcTableTitle = Values helperPanelTitle = Input Support gaugePanelTitle = Gauge Information measurementStationPanelTitle = Measurement Station Information @@ -200,8 +200,8 @@ askThemeRemove = Are you sure that you want to remove the selected theme / themes? add = Add -discharge_curve = Discharge Curves at Gauges -gauge_discharge_curve = Discharge Curves at Gauge +discharge_curve = Discharge Curve at Gauge +gauge_discharge_curve = Discharge Table at Gauge computed_discharge_curve = Discharge Curve computed_discharge_curves = Discharge Curves longitudinal_section = Longitudinal Section Curve @@ -437,6 +437,8 @@ discharge_table_nn = Discharge Tables at Gauge discharge_table_gauge = Discharge Table at Gauge mainvalue = Mainvalue +mainvalues = Mainvalues +show_mainvalues = Show Mainvalues dems = Digital Elevation Models hydrboundaries = Hydrological Boundaries gaugelocations = Location of Gauges @@ -541,6 +543,7 @@ wsplgen_cat3 = Fill Color 2.0 <= DIFF < 3 wsplgen_cat4 = Fill Color 3.0 <= DIFF < 4 wsplgen_cat5 = Fill Color 4.0 <= DIFF +attribution = ©Intevation GmbH 2012
Data ©OpenStreetMap # Manual Points Editor addpoints = Add points @@ -575,7 +578,7 @@ gauge_info_link = Gaugeinfo gauge_url = https://flys-intern.intevation.de/PegelInfo/ gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/ -gauge_curve_link = Dischargecurve +gauge_curve_link = Dischargecurve/-table discharge_timeranges = DC-Timeranges discharge_chart = DC-Chart diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Feb 25 11:50:13 2013 +0100 @@ -107,9 +107,9 @@ riverMap = images/FLYS_Karte.png properties_ico = images/properties.png -dpLabelFrom = Von +dpLabelFrom = von dpUnitFrom = km -dpLabelTo = Bis +dpLabelTo = bis dpUnitTo = km dpLabelStep = a dpUnitStep = m @@ -148,7 +148,7 @@ wqTitle = Eingabe f\u00fcr W/Q Daten wqadaptedTitle = Eingabe f\u00fcr W/Q Daten wqHistorical = Auswahl der Analyseart -calcTableTitle = Berechnungsausgabe +calcTableTitle = Werte helperPanelTitle = Eingabeunterst\u00fctzung gaugePanelTitle = Gew\u00e4sser/Pegel-Info measurementStationPanelTitle = Gew\u00e4sser/Messstellen-Info @@ -201,13 +201,13 @@ zoomboxTooltip = Ausschnitt vergr\u00f6\u00dfern chartPropertiesTooltip = Diagrammeigenschaften -discharge_curve = Abflusskurven an Pegeln -gauge_discharge_curve = Abflusskurven an Pegel +discharge_curve = Abflusskurve am Pegel +gauge_discharge_curve = Abflusstafel am Pegel computed_discharge_curve = Abflusskurve computed_discharge_curves = Abflusskurven longitudinal_section = L\u00e4ngsschnitt duration_curve = Dauerlinie -discharge_longitudinal_section = W f\u00fcr ungleichwertigen Abflussl\u00e4ngsschnitt +discharge_longitudinal_section = W f\u00fcr benutzerdefinierten Abflussl\u00e4ngsschnitt floodmap = \u00dcberschwemmungsfl\u00e4che historical_discharge = Zeit Diagramm historical_discharge_wq = WQ Diagramm @@ -402,6 +402,7 @@ requireDGM = Sie m\u00fcssen ein DGM ausw\u00e4hlen. upload_file = hochladen shape_file_upload = Shapedatei hochladen +attribution = ©Intevation GmbH 2012
Data ©OpenStreetMap # data cage waterlevels = Wasserst\u00e4nde @@ -438,6 +439,8 @@ discharge_table_nn = Abflusstafeln am Pegel discharge_table_gauge = Abflusstafel am Pegel mainvalue = Hauptwerte +mainvalues = Hauptwerte +show_mainvalues = Hauptwerte anzeigen dems = Digitale Gel\u00e4ndemodelle hydrboundaries = Hydrologische Grenzen gaugelocations = Pegellagen @@ -575,7 +578,7 @@ gauge_info_link = Pegelinfo gauge_url = https://flys-intern.intevation.de/PegelInfo/ gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/ -gauge_curve_link = Abflusskurve +gauge_curve_link = Abflusskurve/-tafel discharge_timeranges = AK-Zeitr\u00e4ume discharge_chart = AK-Diagramm diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Feb 25 11:50:13 2013 +0100 @@ -107,9 +107,9 @@ riverMap = images/FLYS_Karte.png properties_ico = images/properties.png -dpLabelFrom = From +dpLabelFrom = from dpUnitFrom = km -dpLabelTo = To +dpLabelTo = to dpUnitTo = km dpLabelStep = a dpUnitStep = m @@ -161,7 +161,7 @@ wqTitle = Input for W/Q Data wqadaptedTitle = Input for W/Q Data wqHistorical = Selection of Analyse Type -calcTableTitle = Calculated Output +calcTableTitle = Values helperPanelTitle = Input Support gaugePanelTitle = Gauge Information measurementStationPanelTitle = Measurement Station Information @@ -201,8 +201,8 @@ askThemeRemove = Are you sure that you want to remove the selected theme / themes? add = Add -discharge_curve = Discharge Curves at Gauges -gauge_discharge_curve = Discharge Curves at Gauge +discharge_curve = Discharge Curve at Gauge +gauge_discharge_curve = Discharge Table at Gauge computed_discharge_curve = Discharge Curve computed_discharge_curves = Discharge Curves longitudinal_section = Longitudinal Section Curve @@ -402,6 +402,7 @@ requireDGM = You need to choose a DEM. upload_file = upload shape_file_upload = Upload shapefile +attribution = ©Intevation GmbH 2012
Data ©OpenStreetMap # data cage waterlevels = Waterlevels @@ -438,6 +439,8 @@ discharge_table_nn = Discharge Tables at Gauge discharge_table_gauge = Discharge Table at Gauge mainvalue = Mainvalue +mainvalues = Mainvalues +show_mainvalues = Show Mainvalues dems = Digital Elevation Models hydrboundaries = Hydrological Boundaries gaugelocations = Location of Gauges @@ -575,7 +578,7 @@ gauge_info_link = Gaugeinfo gauge_url = https://flys-intern.intevation.de/PegelInfo/ gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/ -gauge_curve_link = Dischargecurve +gauge_curve_link = Dischargecurve/-table discharge_timeranges = DC-Timeranges discharge_chart = DC-Chart diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -2,6 +2,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; + import com.smartgwt.client.types.Encoding; import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.util.SC; @@ -38,6 +39,7 @@ import java.util.List; import org.gwtopenmaps.openlayers.client.Map; +import org.gwtopenmaps.openlayers.client.control.Attribution; import org.gwtopenmaps.openlayers.client.feature.VectorFeature; import org.gwtopenmaps.openlayers.client.format.GeoJSON; import org.gwtopenmaps.openlayers.client.layer.WMS; @@ -179,10 +181,13 @@ combobox.setShowTitle(false); form.setItems(combobox); - HTMLPane frame = new HTMLPane(); - frame.setWidth("1px"); - frame.setHeight("1px"); - frame.setContents(""); + HTMLPane uploadTargetFrame = new HTMLPane(); + uploadTargetFrame.setWidth("200px"); + uploadTargetFrame.setHeight("50px"); + uploadTargetFrame.setContents( + ""); + uploadTargetFrame.setBorder("0px"); + uploadTargetFrame.setScrollbarSize(0); final DynamicForm uploadForm = new DynamicForm(); uploadForm.setAction("flys/fileupload?uuid=" + artifact.getUuid()); @@ -200,13 +205,16 @@ uploadForm.submitForm(); } }); - layout.addMember(frame); + layout.addMember(label); layout.addMember(form); layout.addMember(uploadLabel); layout.addMember(uploadForm); layout.addMember(submit); layout.addMember(getNextButton()); + + layout.setMembersMargin(10); + layout.addMember(uploadTargetFrame); } form.setValues(initial); @@ -262,7 +270,7 @@ VectorFeature[] features = new GeoJSON().read(geojson); floodMap.getBarrierLayer().addFeatures(features); } - + map.addControl(new Attribution()); map.zoomToMaxExtent(); } @@ -278,7 +286,9 @@ opts.setSingleTile(true); opts.setRatio(1); opts.setBuffer(0); - + if (layers.equals("OSM-WMS-Dienst")) { + opts.setAttribution(MSG.attribution()); + } WMS wms = new WMS(layers, url, params, opts); wms.setIsVisible(true); wms.setIsBaseLayer(x); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -71,7 +71,14 @@ if (name.equals("fix_wq_curve_at_export")) { continue; } - layout.addMember(createExportButton(name, facet.getName())); + String filename = name; + if (name.equals("computed_dischargecurve_at_export")) { + filename = "dischargecurve"; + } + layout.addMember(createExportButton( + name, + facet.getName(), + filename)); } } @@ -88,8 +95,12 @@ * * @return an image with click handler. */ - protected Canvas createExportButton(String name, String facet) { - String url = getExportUrl(name, facet); + protected Canvas createExportButton( + String name, + String facet, + String filename + ) { + String url = getExportUrl(name, facet, filename); String iUrl = GWT.getHostPageBaseURL() + MSG.imageSave(); ImgLink link = new ImgLink(iUrl, url, 30, 30); @@ -107,12 +118,13 @@ * * @return the export URL. */ - protected String getExportUrl(String name, String facet) { + protected String getExportUrl(String name, String facet, String filename) { Config config = Config.getInstance(); String url = GWT.getModuleBaseURL(); url += "export"; url += "?uuid=" + c.identifier(); + url += "&name=" + filename; url += "&mode=" + name; url += "&type=" + facet; url += "&server=" + config.getServerUrl(); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Mon Feb 25 11:50:13 2013 +0100 @@ -33,15 +33,16 @@ /** The number of pixels used to move windows.*/ public static int WINDOW_OFFSET = 20; - /** A map that contains the open CollectionViews. */ protected Map views; /** The interface that provides the message resources. */ private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); + /** Application instance. */ private FLYS flys; + /** * The default constructor creates an empty FLYSWorkspace with no * CollectionViews opened. diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.rpc.AsyncCallback; -import de.intevation.flys.client.client.FLYS; -import de.intevation.flys.client.shared.model.RiverInfo; - -/** - * The GaugePanel is intended to be used within a SectionStackSection - * - * @author Björn Ricks - */ -public class GaugePanel extends InfoPanel { - - /** - * GaugePanel loads the GaugeInfo from the RiverInfoService and - * displays them in a tree underneath a RiverInfoPanel - * - * @param flys The FLYS object - */ - public GaugePanel(FLYS flys) { - super(new GaugeTree(flys)); - } - - @Override - public String getSectionTitle() { - return MSG.gaugePanelTitle(); - } - - /** - * Loads the river info and renders it afterwards - */ - public void refresh() { - contract(); - - riverInfoService.getGauges(this.river, new AsyncCallback() { - @Override - public void onFailure(Throwable e) { - GWT.log("Could not load the river info." + e); - } - - @Override - public void onSuccess(RiverInfo riverinfo) { - GWT.log("Loaded river info"); - render(riverinfo); - expand(); - } - }); - } - -} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,449 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.DecoratorPanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Tree; -import com.google.gwt.user.client.ui.TreeItem; - -import com.smartgwt.client.widgets.layout.HLayout; - -import de.intevation.flys.client.client.FLYS; -import de.intevation.flys.client.shared.model.Data; -import de.intevation.flys.client.shared.model.DataItem; -import de.intevation.flys.client.shared.model.DataList; -import de.intevation.flys.client.shared.model.GaugeInfo; -import de.intevation.flys.client.shared.model.RiverInfo; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * @author Björn Ricks - */ -public class GaugeTree extends InfoTree { - - public GaugeTree(FLYS flys) { - this.flys = flys; - tree = new Tree(); - setWidget(tree); - } - - /** - * Resets the items of the tree. - * If the list of gauges is empty or null the tree will be empty. - */ - @Override - public void setRiverInfo(RiverInfo riverinfo) { - tree.clear(); - - List gauges = riverinfo.getGauges(); - - if (gauges != null && !gauges.isEmpty()) { - - ArrayList emptygauges = new ArrayList(); - - if (!riverinfo.isKmUp()) { - for (GaugeInfo gauge : gauges) { - addGauge(gauge, emptygauges); - } - } - else { - for (int i = gauges.size()-1; i >= 0; i--) { - GaugeInfo gauge = gauges.get(i); - addGauge(gauge, emptygauges); - } - } - - // put empty gauges to the end - for (GaugeInfo gauge : emptygauges) { - addGauge(gauge); - } - - open(); - } - } - - private void addGauge(GaugeInfo gauge, List empty) { - if (gauge.getKmStart() != null && gauge.getKmEnd() != null) { - addGauge(gauge); - } - else { - empty.add(gauge); - } - } - - private void addGauge(GaugeInfo gauge) { - GaugeInfoItem gaugeitem = new GaugeInfoItem(flys, gauge); - tree.addItem(gaugeitem); - } - - void getLocations(String labelname, List locations, DataList dl) { - for (int j = dl.size()-1; j >= 0; --j) { - Data d = dl.get(j); - String label = d.getLabel(); - if (label.equals(labelname)) { - getLocationsFromData(locations, d); - } - } - } - - void getLocationsFromData(List locations, Data data) { - DataItem[] items = data.getItems(); - for (int k = 0; k < items.length; k++) { - String tmp = items[k].getStringValue(); - GWT.log("GaugeTree - getLocationsFromData " + tmp); - if (tmp != null) { - if (tmp.contains(" ")) { - // string contains several values ... - String[] values = tmp.split(" "); - for(int i=0; i < values.length; i++) { - Double value = Double.valueOf(values[i]); - if (value != null) { - locations.add(value); - } - } - } - else { - Double value = Double.valueOf(tmp); - if (value != null) { - locations.add(value); - } - } - } - } - } - - public void openOnReference(Long number) { - GWT.log("GaugeTree - openOnReference " + number); - for (Iterator it = tree.treeItemIterator(); it.hasNext();) { - TreeItem item = it.next(); - if (item instanceof GaugeInfoItem) { - GaugeInfoItem gitem = (GaugeInfoItem)item; - if (gitem.getReference().equals(number)) { - item.setState(true); - } - else { - item.setState(false); - } - } - } - } - - public void openOnDistance(Double start, Double end) { - GWT.log("GaugeTree - openOnDistance " + start + " " + end + " " + - tree.getItemCount()); - - for (Iterator it = tree.treeItemIterator(); it.hasNext();) { - TreeItem item = it.next(); - /* Strange stuff is happening here: - * GWT Tree.treeItemIterator returns another TreeItem for each - * GaugeInfoItem */ - if (item instanceof GaugeInfoItem) { - boolean setstate = false; - GaugeInfoItem gitem = (GaugeInfoItem)item; - if (end == null && gitem.getStart() != null) { - if (gitem.getStart() >= start) { - setstate = true; - } - } - else { - // as getStart()/getEnd() return Double objects, they can be null and - // can cause NPEs when comparing with double... strange... - if (gitem.getStart() != null && gitem.getEnd() != null) { - GWT.log("GaugeTree - openOnDistance gitem " + gitem.getStart() + " " + gitem.getEnd()); - if ((start >= gitem.getStart() && start <= gitem.getEnd()) || - (end >= gitem.getStart() && end <= gitem.getEnd()) || - (start <= gitem.getStart() && end >= gitem.getEnd())) { - setstate = true; - } - } - } - item.setState(setstate); - } - } - } - - /** - * Open Gauge entry if a location fits to the gauge - */ - public void openOnLocations(List locations) { - GWT.log("GaugeTree - openOnLocations " + locations + " " + - tree.getItemCount()); - - if (locations == null || locations.isEmpty()) { - return; - } - - for (Iterator it = tree.treeItemIterator(); it.hasNext();) { - TreeItem item = it.next(); - if (item instanceof GaugeInfoItem) { - GaugeInfoItem gitem = (GaugeInfoItem)item; - boolean isset = false; - for (Double location: locations) { - if (locations == null) { - continue; - } - - Double start = gitem.getStart(); - Double end = gitem.getEnd(); - if (start == null || end == null) { - // should not occur but avoid NullPointerException - continue; - } - - if (location >= start && location <= end) { - isset = true; - break; - } - } - item.setState(isset); - } - } - } - - class GaugeInfoItem extends TreeItem { - - private GaugeInfo gauge; - - public GaugeInfoItem(FLYS flys, GaugeInfo gauge) { - GaugeInfoHead gaugeinfohead = new GaugeInfoHead(flys, gauge); - GaugeInfoPanel gaugeinfopanel = new GaugeInfoPanel(gauge); - setWidget(gaugeinfohead); - addItem(gaugeinfopanel); - this.gauge = gauge; - } - - public Double getStart() { - return gauge.getKmStart(); - } - - public Double getEnd() { - return gauge.getKmEnd(); - } - - public Long getReference() { - return gauge.getOfficialNumber(); - } - } - - class GaugeInfoHead extends HLayout { - - public GaugeInfoHead(FLYS flys, GaugeInfo gauge) { - setStyleName("gaugeinfohead"); - setAutoHeight(); - setAutoWidth(); - - NumberFormat nf = NumberFormat.getDecimalFormat(); - - Label label = new Label(gauge.getName(), true); - addMember(label); - - Double start; - Double end; - - if (!gauge.isKmUp()) { - start = gauge.getKmStart(); - end = gauge.getKmEnd(); - } - else { - start = gauge.getKmEnd(); - end = gauge.getKmStart(); - } - - String kmtext = ""; - if (start != null) { - kmtext += nf.format(start); - kmtext += " - "; - } - if (end != null) { - kmtext += nf.format(end); - } - if (start != null || end != null) { - kmtext += " km"; - } - - label = new Label(kmtext); - - addMember(label); - - Double station = gauge.getStation(); - if (station != null) { - String stext = nf.format(station); - stext += " km"; - label = new Label(stext); - addMember(label); - } - - Long number = gauge.getOfficialNumber(); - String url = number != null ? - MSG.gauge_url() + number : - MSG.gauge_url(); - Anchor anchor = new Anchor(MSG.gauge_info_link(), url, "_blank"); - addMember(anchor); - - addMember(new GaugeCurveAnchor(flys, gauge)); - } - } - - class GaugeCurveAnchor extends Anchor implements ClickHandler { - - private FLYS flys; - private GaugeInfo gauge; - - public GaugeCurveAnchor(FLYS flys, GaugeInfo gauge) { - super(MSG.gauge_curve_link()); - this.flys = flys; - this.gauge = gauge; - - addClickHandler(this); - } - - @Override - public void onClick(ClickEvent ev) { - GWT.log("GaugeCurveAnchor - onClick " + gauge.getRiverName() + - " " + gauge.getOfficialNumber()); - flys.newGaugeDischargeCurve(gauge.getRiverName(), - gauge.getOfficialNumber()); - } - } - - class GaugeInfoPanel extends DecoratorPanel { - - public GaugeInfoPanel(GaugeInfo gauge) { - setStyleName("gaugeinfopanel"); - Grid grid = new Grid(4, 2); - - NumberFormat nf = NumberFormat.getDecimalFormat(); - - Double minw = gauge.getMinW(); - Double maxw = gauge.getMaxW(); - if (minw != null && maxw != null) { - grid.setText(0, 0, MSG.wq_value_q()); - grid.setText(0, 1, "" + nf.format(minw) + - " - " + nf.format(maxw)); - } - - Double minq = gauge.getMinQ(); - Double maxq = gauge.getMaxQ(); - if (minq != null && maxq != null) { - grid.setText(1, 0, MSG.wq_value_w()); - grid.setText(1, 1, "" + nf.format(minq) + - " - " + nf.format(maxq)); - } - - Double aeo = gauge.getAeo(); - if (aeo != null) { - grid.setText(2, 0, "AEO [km²]"); - grid.setText(2, 1, "" + nf.format(aeo)); - } - - Double datum = gauge.getDatum(); - if (datum != null) { - grid.setText(3, 0, MSG.gauge_zero() + " [" + - gauge.getWstUnit() + "]"); - grid.setText(3, 1, "" + nf.format(datum)); - } - - setWidget(grid); - } - } - - public void open() { - ArrayList locations = new ArrayList(); - - if (data != null && data.length > 0) { - for (int i = 0; i < data.length; i++) { - DataList dl = data[i]; - String state = dl.getState(); - GWT.log("GaugeTree - open " + state); - if (state.equals("state.winfo.location_distance")) { - Double ldfrom = null; - Double ldto = null; - - for (int j = dl.size()-1; j >= 0; --j) { - Data d = dl.get(j); - String label = d.getLabel(); - GWT.log("GaugeTree - setData - label " + label + " " + d.getStringValue()); - if (label.equals("ld_from")) { - ldfrom = getDoubleValue(d); - } - else if (label.equals("ld_to")) { - ldto = getDoubleValue(d); - } - else if (label.equals("ld_locations")) { - getLocationsFromData(locations, d); - openOnLocations(locations); - return; - } - } - if (ldfrom != null) { - openOnDistance(ldfrom, ldto); - return; - } - } - else if(state.equals("state.winfo.distance_only") || - state.equals("state.winfo.distance")) { - Double ldfrom = null; - Double ldto = null; - - for (int j = dl.size()-1; j >= 0; --j) { - Data d = dl.get(j); - String label = d.getLabel(); - GWT.log("GaugeTree - setData - label " + label + " " + d.getStringValue()); - if (label.equals("ld_from")) { - ldfrom = getDoubleValue(d); - } - else if (label.equals("ld_to")) { - ldto = getDoubleValue(d); - } - } - - if (ldfrom != null) { - openOnDistance(ldfrom, ldto); - return; - } - } - else if (state.equals("state.winfo.location")) { - getLocations("ld_locations", locations, dl); - openOnLocations(locations); - return; - } - else if (state.equals("state.winfo.reference.curve.input.start")) { - getLocations("reference_startpoint", locations, dl); - } - else if (state.equals("state.winfo.reference.curve.input.end")) { - getLocations("reference_endpoint", locations, dl); - } - else if (state.equals("state.winfo.historicalq.reference_gauge")) { - for (int j = dl.size()-1; j >= 0; --j) { - Data d = dl.get(j); - String label = d.getLabel(); - if (label.equals("reference_gauge")) { - String tmp = d.getStringValue(); - if (tmp != null) { - Long gaugereference = Long.valueOf(tmp); - if (gaugereference != null) { - openOnReference(gaugereference); - return; - } - } - } - } - } - } - } - if (!locations.isEmpty()) { - openOnLocations(locations); - } - else { - openAll(); - } - } -} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/InfoPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/InfoPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.core.client.GWT; - -import com.smartgwt.client.types.Overflow; -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.SectionStackSection; -import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.WidgetCanvas; - -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.services.RiverInfoService; -import de.intevation.flys.client.client.services.RiverInfoServiceAsync; -import de.intevation.flys.client.shared.model.DataList; -import de.intevation.flys.client.shared.model.RiverInfo; - -/** - * @author Björn Ricks - */ -public abstract class InfoPanel extends VLayout implements ResizedHandler { - - /** SectionStackSection where this InfoPanel belongs in*/ - protected SectionStackSection section; - - /** Name of the river */ - protected String river; - - /** The message class that provides i18n strings.*/ - protected FLYSConstants MSG = GWT.create(FLYSConstants.class); - - protected RiverInfoServiceAsync riverInfoService = GWT.create(RiverInfoService.class); - - /** Panel to show the info about the river */ - protected RiverInfoPanel riverinfopanel; - protected InfoTree tree; - - /** Wrapper arround the GWT Tree (InfoTree) object */ - protected Canvas treecanvas; - - protected final static String SECTION_ID = "InfoPanelSection"; - - public InfoPanel(InfoTree tree) { - SectionStackSection section = new SectionStackSection(); - section.setExpanded(false); - section.setTitle(getSectionTitle()); - section.setName(SECTION_ID); - section.setID(SECTION_ID); - - treecanvas = new WidgetCanvas(tree); - - setOverflow(Overflow.HIDDEN); - setStyleName("infopanel"); - - section.setHidden(true); - section.setItems(this); - this.section = section; - this.tree = tree; - - addResizedHandler(this); - } - - /** - * Sets and loads the river data if river is not the current set river - */ - public void setRiver(String river) { - if (!river.equals(this.river)) { - this.river = river; - this.refresh(); - } - } - - /** - * Sets the data and closes not corresponding folds in the gauge tree - */ - public void setData(DataList[] data) { - tree.setData(data); - } - - protected void render(RiverInfo riverinfo) { - tree.setRiverInfo(riverinfo); - - if (riverinfopanel == null) { - removeAllMembers(); - - riverinfopanel = new RiverInfoPanel(riverinfo); - - addMember(riverinfopanel); - addMember(treecanvas); - } - else { - riverinfopanel.setRiverInfo(riverinfo); - } - } - - @Override - public void onResized(ResizedEvent event) { - /* this height calculation is only an approximation and doesn't reflect - * the real height of the the gaugetree. */ - int height = getInnerContentHeight() - - RiverInfoPanel.getStaticHeight(); - int width = getInnerContentWidth(); - - if (height < 0) { - height = 0; - } - - GWT.log("InfoPanel - onResize " + height); - - tree.setHeight("" + height + "px"); - tree.setWidth("" + width + "px"); - } - - /** - * Hide the section stack section. - */ - @Override - public void hide() { - GWT.log("InfoPanel - hide"); - this.section.setHidden(true); - } - - /** - * Show the section stack section. - */ - @Override - public void show() { - GWT.log("InfoPanel - show"); - this.section.setHidden(false); - } - - @Override - public void addMember(Canvas component) { - super.addMember(component); - expand(); - } - - @Override - public void removeMembers(Canvas[] components) { - super.removeMembers(components); - contract(); - } - - public SectionStackSection getSection() { - return this.section; - } - - protected void removeAllMembers() { - removeMembers(getMembers()); - } - - /** - * Expands the gauge section - */ - public void expand() { - section.setExpanded(true); - } - - /** - * Contracts/shrinks the expanded gauge section - */ - public void contract() { - section.setExpanded(false); - } - - protected abstract void refresh(); - - protected abstract String getSectionTitle(); -} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/InfoTree.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/InfoTree.java Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import java.util.Iterator; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.ui.ScrollPanel; -import com.google.gwt.user.client.ui.Tree; -import com.google.gwt.user.client.ui.TreeItem; - -import de.intevation.flys.client.client.FLYS; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.shared.model.Data; -import de.intevation.flys.client.shared.model.DataList; -import de.intevation.flys.client.shared.model.RiverInfo; - -/** - * @author Björn Ricks - */ -public abstract class InfoTree extends ScrollPanel { - - protected FLYS flys; - protected Tree tree; - protected DataList[] data; - - /** The message class that provides i18n strings.*/ - protected FLYSConstants MSG = GWT.create(FLYSConstants.class); - - public void openAll() { - for (Iterator it = tree.treeItemIterator(); it.hasNext();) { - TreeItem item = it.next(); - item.setState(true); - } - } - - public void setData(DataList[] data) { - this.data = data; - if (tree.getItemCount() > 0) { - open(); - } - } - - protected Double getDoubleValue(Data d) { - String tmp = d.getStringValue(); - if (tmp != null) { - return Double.valueOf(tmp); - } - return null; - } - - public abstract void open() ; - - public abstract void setRiverInfo(RiverInfo riverinfo); - - -} \ No newline at end of file diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/MeasurementStationPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MeasurementStationPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.rpc.AsyncCallback; -import de.intevation.flys.client.client.FLYS; -import de.intevation.flys.client.shared.model.RiverInfo; - -/** - * A Panel to show info about the MeasurementStations of a river - * - * @author Björn Ricks - */ -public class MeasurementStationPanel extends InfoPanel { - - /** - * MeasurementStationPanel loads the MeasurementStations from the - * RiverInfoService and displays them in a tree underneath a RiverInfoPanel - * - * @param flys The FLYS object - */ - public MeasurementStationPanel(FLYS flys) { - super(new MeasurementStationTree(flys)); - } - - /** - * Returns the title which should be displayed in the section - */ - @Override - public String getSectionTitle() { - return MSG.measurementStationPanelTitle(); - } - - /** - * Loads the river info and renders it afterwards - */ - @Override - public void refresh() { - contract(); - - riverInfoService.getMeasurementStations(this.river, - new AsyncCallback() { - @Override - public void onFailure(Throwable e) { - GWT.log("Could not load the river info." + e); - } - - @Override - public void onSuccess(RiverInfo riverinfo) { - GWT.log("Loaded river info"); - render(riverinfo); - expand(); - } - }); - } -} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/MeasurementStationTree.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MeasurementStationTree.java Mon Feb 25 11:46:36 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; -import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.DecoratorPanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Tree; -import com.google.gwt.user.client.ui.TreeItem; - -import com.smartgwt.client.widgets.layout.HLayout; - -import de.intevation.flys.client.client.FLYS; -import de.intevation.flys.client.shared.model.MeasurementStation; -import de.intevation.flys.client.shared.model.RiverInfo; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * @author Björn Ricks - */ -public class MeasurementStationTree extends InfoTree { - - public MeasurementStationTree(FLYS flys) { - this.flys = flys; - tree = new Tree(); - setWidget(tree); - } - - /** - * Resets the items of the tree. - * If the list of gauges is empty or null the tree will be empty. - */ - @Override - public void setRiverInfo(RiverInfo riverinfo) { - tree.clear(); - - List stations = riverinfo.getMeasurementStations(); - - if (stations != null && !stations.isEmpty()) { - - ArrayList emptystations = - new ArrayList(); - - if (!riverinfo.isKmUp()) { - for (MeasurementStation station : stations) { - addStation(station, emptystations); - } - } - else { - for (int i = stations.size()-1; i >= 0; i--) { - MeasurementStation station = stations.get(i); - addStation(station, emptystations); - } - } - - // put empty stations to the end - for (MeasurementStation station : emptystations) { - addStation(station); - } - } - } - - private void addStation(MeasurementStation station, - List empty) { - if (station.getKmStart() != null && station.getKmEnd() != null) { - addStation(station); - } - else { - empty.add(station); - } - } - - private void addStation(MeasurementStation station) { - MeasurementStationItem sitem = - new MeasurementStationItem(flys, station); - tree.addItem(sitem); - } - - class MeasurementStationItem extends TreeItem { - - private MeasurementStation station; - - public MeasurementStationItem(FLYS flys, MeasurementStation station) { - MeasurementStationHead head = - new MeasurementStationHead(flys, station); - MeasurementStationDecoratorPanel - panel = new MeasurementStationDecoratorPanel(station); - setWidget(head); - addItem(panel); - this.station = station; - } - - public Double getStart() { - return station.getKmStart(); - } - - public Double getEnd() { - return station.getKmEnd(); - } - - public Integer getID() { - return station.getID(); - } - } - - class MeasurementStationHead extends HLayout { - - public MeasurementStationHead(FLYS flys, MeasurementStation station) { - setStyleName("infohead"); - setAutoHeight(); - setAutoWidth(); - - NumberFormat nf = NumberFormat.getDecimalFormat(); - - Label label = new Label(station.getName(), true); - addMember(label); - - Double start; - Double end; - - if (!station.isKmUp()) { - start = station.getKmStart(); - end = station.getKmEnd(); - } - else { - start = station.getKmEnd(); - end = station.getKmStart(); - } - - String kmtext = ""; - if (start != null) { - kmtext += nf.format(start); - kmtext += " - "; - } - if (end != null) { - kmtext += nf.format(end); - } - if (start != null || end != null) { - kmtext += " km"; - } - - label = new Label(kmtext); - - addMember(label); - - Double dstation = station.getStation(); - if (dstation != null) { - String stext = nf.format(dstation); - stext += " km"; - label = new Label(stext); - addMember(label); - } - - Integer number = station.getID(); - String url = number != null ? - MSG.measurement_station_url() + number : - MSG.measurement_station_url(); - Anchor anchor = new Anchor(MSG.measurement_station_info_link(), - url, "_blank"); - addMember(anchor); - } - } - - class MeasurementStationDecoratorPanel extends DecoratorPanel { - - public MeasurementStationDecoratorPanel(MeasurementStation station) { - setStyleName("infopanel"); - Grid grid = new Grid(5, 2); - - String type = station.getMeasurementType(); - if (type != null) { - grid.setText(0, 0, MSG.measurement_station_type()); - grid.setText(0, 1, type); - } - - String riverside = station.getRiverSide(); - if (riverside != null) { - grid.setText(1, 0, MSG.riverside()); - grid.setText(1, 1, riverside); - } - - String gaugename = station.getGaugeName(); - if (gaugename != null) { - grid.setText(2, 0, MSG.measurement_station_gauge_name()); - grid.setText(2, 1, gaugename); - } - - DateTimeFormat df = DateTimeFormat.getFormat( - PredefinedFormat.DATE_MEDIUM); - - Date starttime = station.getStartTime(); - if (starttime != null) { - grid.setText(3, 0, MSG.measurement_station_start_time()); - grid.setText(3, 1, df.format(starttime)); - } - - String moperator = station.getOperator(); - if (moperator != null) { - grid.setText(4, 0, MSG.measurement_station_operator()); - grid.setText(4, 1, moperator); - } - - setWidget(grid); - } - } - - @Override - public void open() { - } -} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -343,12 +343,12 @@ setLocationValues(selected); } + /** * Returns the label string for the input panel. */ protected String getLabelString() { return MSG.location(); } - } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Mon Feb 25 11:50:13 2013 +0100 @@ -39,6 +39,9 @@ import de.intevation.flys.client.client.services.ReportServiceAsync; import de.intevation.flys.client.client.services.StepForwardService; import de.intevation.flys.client.client.services.StepForwardServiceAsync; +import de.intevation.flys.client.client.ui.stationinfo.GaugePanel; +import de.intevation.flys.client.client.ui.stationinfo.InfoPanel; +import de.intevation.flys.client.client.ui.stationinfo.MeasurementStationPanel; import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.ArtifactDescription; import de.intevation.flys.client.shared.model.Collection; diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/RiverInfoPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/RiverInfoPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/RiverInfoPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -14,14 +14,11 @@ import de.intevation.flys.client.shared.model.RiverInfo; /** + * Panel to display information about a river. * @author Björn Ricks */ public class RiverInfoPanel extends HorizontalPanel { - /** - * Panel to display information about a river - */ - /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -28,10 +28,8 @@ public static final int BUTTON_MARGIN = 5; private static final int BOTTON_WIDTH = 20; - protected FLYSConstants MSG = GWT.create(FLYSConstants.class); - protected List handlers; diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -1781,21 +1781,21 @@ * * @return the name of the current river. */ - protected String getRiverName(DataList[] data) { + protected String getRiverName() { ArtifactDescription adesc = artifact.getArtifactDescription(); return adesc.getRiver(); } protected void fetchWQData() { - Config config = Config.getInstance(); - String locale = config.getLocale (); + Config config = Config.getInstance(); + String locale = config.getLocale (); ArtifactDescription adescr = artifact.getArtifactDescription(); DataList[] data = adescr.getOldData(); double[] mm = getMinMaxKM(data); - String river = getRiverName(data); + String river = getRiverName(); wqInfoService.getWQInfo(locale, river, mm[0], mm[1], new AsyncCallback() { diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/WQSimpleArrayPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQSimpleArrayPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQSimpleArrayPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -304,7 +304,7 @@ NumberFormat nf = NumberFormat.getDecimalFormat(); DataItem[] items = modeData.getItems(); - String unit = items[0].getStringValue().equals("0") ? "cm" : "q³/s"; + String unit = items[0].getStringValue().equals("0") ? "cm" : "m³/s"; VLayout layout = new VLayout(); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Mon Feb 25 11:50:13 2013 +0100 @@ -113,6 +113,7 @@ baseUrl + MSG.downloadCSV(), moduleUrl + "export" + "?uuid=" + chartTab.getCollection().identifier() + + "&name=" + chartTab.getMode().getName() + "&mode=" + chartTab.getMode().getName() + "_at_export" + "&type=at" + "&server=" + config.getServerUrl() + diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualDatePointsEditor.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualDatePointsEditor.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualDatePointsEditor.java Mon Feb 25 11:50:13 2013 +0100 @@ -404,3 +404,5 @@ } } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : + diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/map/DrawControl.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/DrawControl.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/DrawControl.java Mon Feb 25 11:50:13 2013 +0100 @@ -1,7 +1,5 @@ package de.intevation.flys.client.client.ui.map; -import java.util.LinkedHashMap; - import com.google.gwt.core.client.GWT; import com.smartgwt.client.types.SelectionType; @@ -9,18 +7,22 @@ import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.SelectItem; -import com.smartgwt.client.widgets.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.layout.HLayout; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.utils.EnableDisableCmd; + +import java.util.LinkedHashMap; + import org.gwtopenmaps.openlayers.client.Map; import org.gwtopenmaps.openlayers.client.Style; import org.gwtopenmaps.openlayers.client.control.Control; import org.gwtopenmaps.openlayers.client.control.DrawFeature; import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; -import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener.FeatureAddedEvent; import org.gwtopenmaps.openlayers.client.feature.VectorFeature; import org.gwtopenmaps.openlayers.client.handler.Handler; import org.gwtopenmaps.openlayers.client.handler.PathHandler; @@ -28,9 +30,6 @@ import org.gwtopenmaps.openlayers.client.layer.Vector; import org.gwtopenmaps.openlayers.client.util.Attributes; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.utils.EnableDisableCmd; - public class DrawControl extends HLayout implements VectorFeatureAddedListener { @@ -86,6 +85,7 @@ button.setTooltip(MSG.digitizeObjects()); button.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent e) { if (button.isSelected()) { cmd.enable(); @@ -123,6 +123,7 @@ box.setValueIcons(ics); box.addChangedHandler(new ChangedHandler() { + @Override public void onChanged(ChangedEvent e) { setSelectedControl(); } @@ -144,6 +145,7 @@ } + @Override public void onFeatureAdded(FeatureAddedEvent evt) { setCurrentType(evt.getVectorFeature()); } diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/FloodMap.java Mon Feb 25 11:50:13 2013 +0100 @@ -6,6 +6,7 @@ import org.gwtopenmaps.openlayers.client.MapOptions; import org.gwtopenmaps.openlayers.client.MapWidget; import org.gwtopenmaps.openlayers.client.Style; +import org.gwtopenmaps.openlayers.client.control.Attribution; import org.gwtopenmaps.openlayers.client.control.ScaleLine; import org.gwtopenmaps.openlayers.client.control.ScaleLineOptions; import org.gwtopenmaps.openlayers.client.event.VectorFeatureAddedListener; @@ -56,6 +57,7 @@ Integer.toString(height), opts); map = mapWidget.getMap(); + map.addControl(new Attribution()); } diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java Mon Feb 25 11:50:13 2013 +0100 @@ -1,6 +1,7 @@ package de.intevation.flys.client.client.ui.map; import com.google.gwt.core.client.GWT; + import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.layout.HLayout; @@ -39,17 +40,14 @@ protected void initLayout() { VLayout root = new VLayout(); - int rows = 0; - for (FeatureInfo feature: features) { root.addMember(createFeatureRow(feature)); - rows++; } addItem(root); setWidth(500); - setHeight(500); // + rows * ROW_HEIGHT); + setHeight(500); setTitle(MSG.getFeatureInfoWindowTitle()); setIsModal(true); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java Mon Feb 25 11:50:13 2013 +0100 @@ -454,7 +454,6 @@ if (url == null || layers == null) { return null; } - this.wmsUrls.put(name, url); WMSParams params = new WMSParams(); @@ -466,7 +465,9 @@ opts.setProjection("EPSG:" + getSrid()); opts.setSingleTile(true); opts.setRatio(1); - + if (layers.equals("OSM-WMS-Dienst")) { + opts.setAttribution(MSG.attribution()); + } WMS wms = new WMS(layers, url, params, opts); wms.setIsVisible(at.getActive() == 1); wms.setIsBaseLayer(false); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintSettingsPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintSettingsPanel.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintSettingsPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -96,8 +96,9 @@ protected SelectItem createPageFormatSelectItem() { LinkedHashMap values = new LinkedHashMap(); // TODO: i18n - values.put("A4 portrait", "DIN A4 (Hochformat)"); - values.put("A0 portrait", "DIN A0 (Hochformat)"); + values.put("A4 landscape", "DIN A4 (Querformat)"); + //values.put("A4 portrait", "DIN A4 (Hochformat)"); + //values.put("A0 portrait", "DIN A0 (Hochformat)"); SelectItem selItem = new SelectItem(); selItem.setTitle("Seitengröße:"); // TODO: i18n diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeInfoPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,114 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.i18n.client.NumberFormat; +import com.google.gwt.user.client.ui.Anchor; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.Label; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.shared.model.GaugeInfo; + +public class GaugeInfoPanel extends VLayout { + + /** The message class that provides i18n strings.*/ + private FLYSConstants MSG = GWT.create(FLYSConstants.class); + + /** Application instance. */ + private FLYS flys; + + public GaugeInfoPanel(GaugeInfo gauge, FLYS flys) { + this.flys = flys; + setStyleName("gaugeinfopanel"); + + NumberFormat nf = NumberFormat.getDecimalFormat(); + + VLayout grid = new VLayout(); + HLayout line1 = new HLayout(); + + Double minw = gauge.getMinW(); + Double maxw = gauge.getMaxW(); + if (minw != null && maxw != null) { + Label key = new Label(MSG.wq_value_q()); + Label value = new Label(nf.format(minw) + + " - " + nf.format(maxw)); + key.setWidth(150); + line1.addMember(key); + line1.addMember(value); + } + + HLayout line2 = new HLayout(); + Double minq = gauge.getMinQ(); + Double maxq = gauge.getMaxQ(); + if (minq != null && maxq != null) { + Label key = new Label(MSG.wq_value_w()); + Label value = new Label( nf.format(minq) + + " - " + nf.format(maxq)); + key.setWidth(150); + line2.addMember(key); + line2.addMember(value); + } + + HLayout line3 = new HLayout(); + Double aeo = gauge.getAeo(); + if (aeo != null) { + Label key = new Label("AEO [km²]"); + Label value = new Label(nf.format(aeo)); + key.setWidth(150); + line3.addMember(key); + line3.addMember(value); + } + + HLayout line4 = new HLayout(); + Double datum = gauge.getDatum(); + if (datum != null) { + Label key = new Label(MSG.gauge_zero() + " [" + + gauge.getWstUnit() + "]"); + Label value = new Label(nf.format(datum)); + key.setWidth(150); + line4.addMember(key); + line4.addMember(value); + } + + HLayout line5 = new HLayout(); + line5.addMember(new GaugeMainValueAnchor(flys, gauge)); + + grid.addMember(line1); + grid.addMember(line2); + grid.addMember(line3); + grid.addMember(line4); + grid.addMember(line5); + addMember(grid); + } + + + /** + * Clickable anchor that asks application to show window with + * main values for gauge. + */ + class GaugeMainValueAnchor extends Anchor implements ClickHandler { + + private FLYS flys; + private GaugeInfo gauge; + + public GaugeMainValueAnchor(FLYS flys, GaugeInfo gauge) { + super(MSG.show_mainvalues()); + this.flys = flys; + this.gauge = gauge; + this.setHeight("5"); + + addClickHandler(this); + } + + @Override + public void onClick(ClickEvent ev) { + GWT.log("GaugeMainValueAnchor - onClick " + gauge.getRiverName() + + " " + gauge.getOfficialNumber()); + flys.newGaugeMainValueTable(gauge); + } + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeListGrid.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,319 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gwt.core.client.GWT; +import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.WidgetCanvas; +import com.smartgwt.client.widgets.grid.ListGridField; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.grid.events.RecordClickEvent; +import com.smartgwt.client.widgets.grid.events.RecordClickHandler; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.shared.model.Data; +import de.intevation.flys.client.shared.model.DataItem; +import de.intevation.flys.client.shared.model.DataList; +import de.intevation.flys.client.shared.model.GaugeInfo; +import de.intevation.flys.client.shared.model.RiverInfo; + + +/** + * @author Björn Ricks + */ +public class GaugeListGrid extends InfoListGrid implements RecordClickHandler { + + private static final int ABFLUSSTAFEL_COLUMN = 6; + + public GaugeListGrid(FLYS flys) { + super(flys); + ListGridField nfield = new ListGridField("name", "Pegel"); + ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60); + ListGridField efield = new ListGridField("kmend", "Ende [km]", 60); + ListGridField stfield = new ListGridField("station", "Station [km]"); + ListGridField lfield = new ListGridField("link", "Info"); + lfield.setType(ListGridFieldType.LINK); + ListGridField cfield = new ListGridField("curvelink", "Link"); + cfield.addRecordClickHandler(this); + + this.setFields(nfield, sfield, efield, stfield, lfield, cfield); + } + + public void setRiverInfo(RiverInfo riverinfo) { + List gauges = riverinfo.getGauges(); + + if (gauges != null && !gauges.isEmpty()) { + + ArrayList emptygauges = new ArrayList(); + + if (!riverinfo.isKmUp()) { + for (GaugeInfo gauge : gauges) { + addGauge(gauge, emptygauges); + } + } + else { + for (int i = gauges.size()-1; i >= 0; i--) { + GaugeInfo gauge = gauges.get(i); + addGauge(gauge, emptygauges); + } + } + + // put empty gauges to the end + for (GaugeInfo gauge : emptygauges) { + addGauge(gauge); + } + } + } + + private void addGauge(GaugeInfo gauge, List empty) { + if (gauge.getKmStart() != null && gauge.getKmEnd() != null) { + addGauge(gauge); + } + else { + empty.add(gauge); + } + } + + private void addGauge(GaugeInfo gauge) { + this.addData(new GaugeRecord(gauge)); + } + + public void open() { + ArrayList locations = new ArrayList(); + + if (data != null && data.length > 0) { + for (int i = 0; i < data.length; i++) { + DataList dl = data[i]; + String state = dl.getState(); + GWT.log("GaugeListGrid - open " + state); + if (state.equals("state.winfo.location_distance")) { + Double ldfrom = null; + Double ldto = null; + + for (int j = dl.size()-1; j >= 0; --j) { + Data d = dl.get(j); + String label = d.getLabel(); + GWT.log("GaugeListGrid - setData - label " + label + " " + d.getStringValue()); + if (label.equals("ld_from")) { + ldfrom = getDoubleValue(d); + } + else if (label.equals("ld_to")) { + ldto = getDoubleValue(d); + } + else if (label.equals("ld_locations")) { + getLocationsFromData(locations, d); + openOnLocations(locations); + return; + } + } + if (ldfrom != null) { + openOnDistance(ldfrom, ldto); + return; + } + } + else if(state.equals("state.winfo.distance_only") || + state.equals("state.winfo.distance")) { + Double ldfrom = null; + Double ldto = null; + + for (int j = dl.size()-1; j >= 0; --j) { + Data d = dl.get(j); + String label = d.getLabel(); + GWT.log("GaugeListGrid - setData - label " + label + " " + d.getStringValue()); + if (label.equals("ld_from")) { + ldfrom = getDoubleValue(d); + } + else if (label.equals("ld_to")) { + ldto = getDoubleValue(d); + } + } + + if (ldfrom != null) { + openOnDistance(ldfrom, ldto); + return; + } + } + else if (state.equals("state.winfo.location")) { + getLocations("ld_locations", locations, dl); + openOnLocations(locations); + return; + } + else if (state.equals("state.winfo.reference.curve.input.start")) { + getLocations("reference_startpoint", locations, dl); + } + else if (state.equals("state.winfo.reference.curve.input.end")) { + getLocations("reference_endpoint", locations, dl); + } + else if (state.equals("state.winfo.historicalq.reference_gauge")) { + for (int j = dl.size()-1; j >= 0; --j) { + Data d = dl.get(j); + String label = d.getLabel(); + if (label.equals("reference_gauge")) { + String tmp = d.getStringValue(); + if (tmp != null) { + Long gaugereference = Long.valueOf(tmp); + if (gaugereference != null) { + openOnReference(gaugereference); + return; + } + } + } + } + } + } + } + if (!locations.isEmpty()) { + openOnLocations(locations); + } + else { + openAll(); + } + } + + void getLocations(String labelname, List locations, DataList dl) { + for (int j = dl.size()-1; j >= 0; --j) { + Data d = dl.get(j); + String label = d.getLabel(); + if (label.equals(labelname)) { + getLocationsFromData(locations, d); + } + } + } + + void getLocationsFromData(List locations, Data data) { + DataItem[] items = data.getItems(); + for (int k = 0; k < items.length; k++) { + String tmp = items[k].getStringValue(); + GWT.log("GaugeListGrid - getLocationsFromData " + tmp); + if (tmp != null) { + if (tmp.contains(" ")) { + // string contains several values ... + String[] values = tmp.split(" "); + for(int i=0; i < values.length; i++) { + Double value = Double.valueOf(values[i]); + if (value != null) { + locations.add(value); + } + } + } + else { + Double value = Double.valueOf(tmp); + if (value != null) { + locations.add(value); + } + } + } + } + } + + public void openOnReference(Long number) { + GWT.log("GaugeListGrid - openOnReference " + number); + for (ListGridRecord record: this.getRecords()) { + GaugeRecord item = (GaugeRecord)record; + if (item.getOfficialNumber().equals(number)) { + expandRecord(item); + } + else { + collapseRecord(item); + } + } + } + + public void openOnDistance(Double start, Double end) { + GWT.log("GaugeListGrid - openOnDistance " + start + " " + end); + + for (ListGridRecord record: this.getRecords()) { + GaugeRecord item = (GaugeRecord)record; + if (end == null && item.getKmStart() != null) { + if (item.getKmStart() >= start) { + expandRecord(item); + } + else { + collapseRecord(item); + } + } + else if (item.getKmStart() != null && item.getKmEnd() != null) { + // as getStart()/getEnd() return Double objects, they can be null and + // can cause NPEs when comparing with double... strange... + GWT.log("GaugeListGrid - openOnDistance item " + item.getKmStart() + " " + item.getKmEnd()); + if ((start >= item.getKmStart() && start <= item.getKmEnd()) || + (end >= item.getKmStart() && end <= item.getKmEnd()) || + (start <= item.getKmStart() && end >= item.getKmEnd())) { + expandRecord(item); + } + else { + collapseRecord(item); + } + } + else { + collapseRecord(item); + } + } + } + + /** + * Open Gauge entry if a location fits to the gauge. + */ + public void openOnLocations(List locations) { + GWT.log("GaugeListGrid - openOnLocations " + locations); + + if (locations == null || locations.isEmpty()) { + return; + } + + for (ListGridRecord record: this.getRecords()) { + GaugeRecord item = (GaugeRecord)record; + boolean isset = false; + for (Double location: locations) { + if (locations == null) { + continue; + } + + Double start = item.getKmStart(); + Double end = item.getKmEnd(); + if (start == null || end == null) { + // should not occur but avoid NullPointerException + continue; + } + + if (location >= start && location <= end) { + isset = true; + break; + } + } + if (isset) { + expandRecord(item); + } + else { + collapseRecord(item); + } + } + } + + @Override + protected Canvas getExpandPanel(ListGridRecord record) { + GaugeRecord item = (GaugeRecord)record; + return new WidgetCanvas(new GaugeInfoPanel(item, flys)); + } + + @Override + public void onRecordClick(RecordClickEvent event) { + GaugeRecord gauge = (GaugeRecord)event.getRecord(); + flys.newGaugeDischargeCurve(gauge.getRiverName(), + gauge.getOfficialNumber()); + } + + @Override + public String getCellCSSText(ListGridRecord record, int rowNum, + int colNum) { + if (colNum == ABFLUSSTAFEL_COLUMN) { + // display the ablfusstafel cell like a link + return "text-decoration: underline; color: #0000EE; cursor: pointer;"; + } + else { + return super.getCellCSSText(record, rowNum, colNum); + } + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugePanel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugePanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,56 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Label; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.AsyncCallback; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.shared.model.RiverInfo; + + +/** + * The GaugePanel is intended to be used within a SectionStackSection + * + * @author Björn Ricks + */ +public class GaugePanel extends InfoPanel { + + /** + * GaugePanel loads the GaugeInfo from the RiverInfoService and + * displays them in a tree underneath a RiverInfoPanel + * + * @param flys The FLYS object + */ + public GaugePanel(FLYS flys) { + super(new GaugeListGrid(flys)); + } + + + @Override + public String getSectionTitle() { + return MSG.gaugePanelTitle(); + } + + /** + * Loads the river info and renders it afterwards. + */ + public void refresh() { + contract(); + + riverInfoService.getGauges(this.river, new AsyncCallback() { + @Override + public void onFailure(Throwable e) { + GWT.log("Could not load the river info." + e); + } + + @Override + public void onSuccess(RiverInfo riverinfo) { + GWT.log("Loaded river info"); + render(riverinfo); + expand(); + } + }); + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeRecord.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/GaugeRecord.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,165 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.google.gwt.core.client.GWT; +import com.smartgwt.client.widgets.grid.ListGridRecord; + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.shared.model.GaugeInfo; + +/** + * @author Björn Ricks + */ +public class GaugeRecord extends ListGridRecord implements GaugeInfo { + + /** The message class that provides i18n strings.*/ + private FLYSConstants MSG = GWT.create(FLYSConstants.class); + + public GaugeRecord(GaugeInfo gauge) { + setCanExpand(true); + Long number = gauge.getOfficialNumber(); + String url = number != null ? + MSG.gauge_url() + number : + MSG.gauge_url(); + setLink(url); + setLinkText(MSG.gauge_info_link()); + setName(gauge.getName()); + setKmStart(gauge.getKmStart()); + setKmEnd(gauge.getKmEnd()); + setMinQ(gauge.getMinQ()); + setMaxQ(gauge.getMaxQ()); + setMinW(gauge.getMinW()); + setMaxW(gauge.getMaxW()); + setAeo(gauge.getAeo()); + setDatum(gauge.getDatum()); + setKmUp(gauge.isKmUp()); + setOfficialNumber(gauge.getOfficialNumber()); + setRiverName(gauge.getRiverName()); + setStation(gauge.getStation()); + setWstUnit(gauge.getWstUnit()); + setCurveLink(MSG.gauge_curve_link()); + } + + private void setCurveLink(String value) { + this.setAttribute("curvelink", value); + } + + private void setLink(String url) { + this.setAttribute("link", url); + } + + public String getLink() { + return this.getAttributeAsString("link"); + } + + public String getName() { + return this.getAttributeAsString("name"); + } + + private void setName(String value) { + this.setAttribute("name", value); + } + + public Double getKmStart() { + return this.getAttributeAsDouble("kmstart"); + } + + private void setKmStart(Double value) { + this.setAttribute("kmstart", value); + } + + public Double getKmEnd() { + return this.getAttributeAsDouble("kmend"); + } + + private void setKmEnd(Double value) { + this.setAttribute("kmend", value); + } + + public Double getMinQ() { + return this.getAttributeAsDouble("minq"); + } + + private void setMinQ(Double value) { + this.setAttribute("minq", value); + } + + public Double getMaxQ() { + return this.getAttributeAsDouble("maxq"); + } + + private void setMaxQ(Double value) { + this.setAttribute("maxq", value); + } + + public Double getMinW() { + return this.getAttributeAsDouble("minw"); + } + + private void setMinW(Double value) { + this.setAttribute("minw", value); + } + + public Double getMaxW() { + return this.getAttributeAsDouble("maxw"); + } + + private void setMaxW(Double value) { + this.setAttribute("maxw", value); + } + + public Double getDatum() { + return this.getAttributeAsDouble("datum"); + } + + private void setDatum(Double value) { + this.setAttribute("datum", value); + } + + public Double getAeo() { + return this.getAttributeAsDouble("aeo"); + } + + private void setAeo(Double value) { + this.setAttribute("aeo", value); + } + + public boolean isKmUp() { + return this.getAttributeAsBoolean("kmup"); + } + + private void setKmUp(boolean value) { + this.setAttribute("kmup", value); + } + + public Double getStation() { + return this.getAttributeAsDouble("station"); + } + + private void setStation(Double value) { + this.setAttribute("station", value); + } + + public String getWstUnit() { + return this.getAttributeAsString("wstunit"); + } + + private void setWstUnit(String value) { + this.setAttribute("wstunit", value); + } + + public Long getOfficialNumber() { + return this.getAttributeAsLong("officialnumber"); + } + + private void setOfficialNumber(Long number) { + this.setAttribute("officialnumber", number); + } + + public String getRiverName() { + return this.getAttributeAsString("rivername"); + } + + private void setRiverName(String rivername) { + this.setAttribute("rivername", rivername); + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoListGrid.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,67 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.google.gwt.core.client.GWT; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.grid.ListGrid; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.layout.VLayout; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.shared.model.Data; +import de.intevation.flys.client.shared.model.DataList; +import de.intevation.flys.client.shared.model.RiverInfo; + +/** + * @author Björn Ricks + */ +public abstract class InfoListGrid extends ListGrid { + + protected FLYS flys; + protected DataList[] data; + /** The message class that provides i18n strings.*/ + protected FLYSConstants MSG = GWT.create(FLYSConstants.class); + + + public InfoListGrid(FLYS flys) { + super(); + this.flys = flys; + this.setCanExpandRecords(true); + this.setCanExpandMultipleRecords(true); + } + + public void openAll() { + GWT.log("InfoListGrid - openAll"); + for (ListGridRecord record: this.getRecords()) { + expandRecord(record); + } + } + + public void setData(DataList[] data) { + GWT.log("InfoListGrid - setData"); + this.data = data; + this.open(); + } + + protected Double getDoubleValue(Data d) { + String tmp = d.getStringValue(); + if (tmp != null) { + return Double.valueOf(tmp); + } + return null; + } + + @Override + protected Canvas getExpansionComponent(ListGridRecord record) { + VLayout layout = new VLayout(); + layout.setPadding(5); + layout.addMember(this.getExpandPanel(record)); + return layout; + } + + public abstract void open(); + + public abstract void setRiverInfo(RiverInfo riverinfo); + + protected abstract Canvas getExpandPanel(ListGridRecord record); +} \ No newline at end of file diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoPanel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/InfoPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,140 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.google.gwt.core.client.GWT; + +import com.smartgwt.client.types.Overflow; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.layout.SectionStackSection; +import com.smartgwt.client.widgets.layout.VLayout; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.services.RiverInfoService; +import de.intevation.flys.client.client.services.RiverInfoServiceAsync; +import de.intevation.flys.client.client.ui.RiverInfoPanel; +import de.intevation.flys.client.shared.model.DataList; +import de.intevation.flys.client.shared.model.RiverInfo; + +/** + * @author Björn Ricks + */ +public abstract class InfoPanel extends VLayout { + + /** SectionStackSection where this InfoPanel belongs in*/ + protected SectionStackSection section; + + /** Name of the river */ + protected String river; + + /** The message class that provides i18n strings.*/ + protected FLYSConstants MSG = GWT.create(FLYSConstants.class); + + protected RiverInfoServiceAsync riverInfoService = GWT.create(RiverInfoService.class); + + /** Panel to show the info about the river */ + protected RiverInfoPanel riverinfopanel; + + protected InfoListGrid listgrid; + + public final static String SECTION_ID = "InfoPanelSection"; + + public InfoPanel(InfoListGrid listgrid) { + SectionStackSection section = new SectionStackSection(); + section.setExpanded(false); + section.setTitle(getSectionTitle()); + section.setName(SECTION_ID); + section.setID(SECTION_ID); + + setOverflow(Overflow.HIDDEN); + setStyleName("infopanel"); + + section.setHidden(true); + section.setItems(this); + this.section = section; + this.listgrid = listgrid; + this.addMember(listgrid); + } + + /** + * Sets and loads the river data if river is not the current set river. + */ + public void setRiver(String river) { + if (!river.equals(this.river)) { + this.river = river; + this.refresh(); + } + } + + /** + * Sets the data and closes not corresponding folds in the gauge tree. + */ + public void setData(DataList[] data) { + this.listgrid.setData(data); + } + + protected void render(RiverInfo riverinfo) { + if (this.riverinfopanel == null) { + this.riverinfopanel = new RiverInfoPanel(riverinfo); + + this.addMember(this.riverinfopanel, 0); + } + else { + riverinfopanel.setRiverInfo(riverinfo); + } + this.listgrid.setRiverInfo(riverinfo); + } + + /** + * Hide the section stack section. + */ + @Override + public void hide() { + GWT.log("InfoPanel - hide"); + this.section.setHidden(true); + } + + /** + * Show the section stack section. + */ + @Override + public void show() { + GWT.log("InfoPanel - show"); + this.section.setHidden(false); + } + + @Override + public void addMember(Canvas component) { + super.addMember(component); + expand(); + } + + @Override + public void removeMembers(Canvas[] components) { + super.removeMembers(components); + contract(); + } + + public SectionStackSection getSection() { + return this.section; + } + + protected void removeAllMembers() { + removeMembers(getMembers()); + } + + /** + * Expands the gauge section. + */ + public void expand() { + section.setExpanded(true); + } + + /** + * Contracts/shrinks the expanded gauge section. + */ + public void contract() { + section.setExpanded(false); + } + + protected abstract void refresh(); + + protected abstract String getSectionTitle(); +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationInfoPanel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationInfoPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,60 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import java.util.Date; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; +import com.google.gwt.user.client.ui.Grid; +import com.smartgwt.client.widgets.layout.VLayout; + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.shared.model.MeasurementStation; + +public class MeasurementStationInfoPanel extends VLayout { + + /** The message class that provides i18n strings.*/ + private FLYSConstants MSG = GWT.create(FLYSConstants.class); + + public MeasurementStationInfoPanel(MeasurementStation station) { + setStyleName("infopanel"); + setWidth100(); + + Grid grid = new Grid(5, 2); + + String type = station.getMeasurementType(); + if (type != null) { + grid.setText(0, 0, MSG.measurement_station_type()); + grid.setText(0, 1, type); + } + + String riverside = station.getRiverSide(); + if (riverside != null) { + grid.setText(1, 0, MSG.riverside()); + grid.setText(1, 1, riverside); + } + + String gaugename = station.getGaugeName(); + if (gaugename != null) { + grid.setText(2, 0, MSG.measurement_station_gauge_name()); + grid.setText(2, 1, gaugename); + } + + DateTimeFormat df = DateTimeFormat.getFormat( + PredefinedFormat.DATE_MEDIUM); + + Date starttime = station.getStartTime(); + if (starttime != null) { + grid.setText(3, 0, MSG.measurement_station_start_time()); + grid.setText(3, 1, df.format(starttime)); + } + + String moperator = station.getOperator(); + if (moperator != null) { + grid.setText(4, 0, MSG.measurement_station_operator()); + grid.setText(4, 1, moperator); + } + + addMember(grid); + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,91 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.google.gwt.core.client.GWT; + +import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.WidgetCanvas; +import com.smartgwt.client.widgets.grid.ListGridField; +import com.smartgwt.client.widgets.grid.ListGridRecord; + +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.shared.model.MeasurementStation; +import de.intevation.flys.client.shared.model.RiverInfo; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Björn Ricks + */ +public class MeasurementStationListGrid extends InfoListGrid { + + public MeasurementStationListGrid(FLYS flys) { + super(flys); + ListGridField nfield = new ListGridField("name", "Messtelle"); + ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60); + ListGridField efield = new ListGridField("kmend", "Ende [km]", 60); + ListGridField stfield = new ListGridField("station", "Station [km]"); + ListGridField lfield = new ListGridField("link", "Link"); + lfield.setType(ListGridFieldType.LINK); + this.setFields(nfield, sfield, efield, stfield, lfield); + } + + /** + * Resets the items of the tree. + * If the list of gauges is empty or null the tree will be empty. + */ + @Override + public void setRiverInfo(RiverInfo riverinfo) { + List stations = riverinfo.getMeasurementStations(); + GWT.log("MeasurmentStationListGrid - setRiverInfo " + stations); + + if (stations != null && !stations.isEmpty()) { + + ArrayList emptystations = + new ArrayList(); + + if (!riverinfo.isKmUp()) { + for (MeasurementStation station : stations) { + addStation(station, emptystations); + } + } + else { + for (int i = stations.size()-1; i >= 0; i--) { + MeasurementStation station = stations.get(i); + addStation(station, emptystations); + } + } + + // put empty stations to the end + for (MeasurementStation station : emptystations) { + addStation(station); + } + } + } + + private void addStation(MeasurementStation station, + List empty) { + if (station.getKmStart() != null && station.getKmEnd() != null) { + addStation(station); + } + else { + empty.add(station); + } + } + + private void addStation(MeasurementStation station) { + ListGridRecord record = new MeasurementStationRecord(station); + this.addData(record); + } + + @Override + public void open() { + } + + @Override + protected Canvas getExpandPanel(ListGridRecord record) { + MeasurementStationRecord station = (MeasurementStationRecord)record; + return new WidgetCanvas(new MeasurementStationInfoPanel(station)); + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationPanel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationPanel.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,56 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.AsyncCallback; +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.shared.model.RiverInfo; + +/** + * A Panel to show info about the MeasurementStations of a river + * + * @author Björn Ricks + */ +public class MeasurementStationPanel extends InfoPanel { + + /** + * MeasurementStationPanel loads the MeasurementStations from the + * RiverInfoService and displays them in a tree underneath a RiverInfoPanel + * + * @param flys The FLYS object + */ + public MeasurementStationPanel(FLYS flys) { + super(new MeasurementStationListGrid(flys)); + } + + /** + * Returns the title which should be displayed in the section + */ + @Override + public String getSectionTitle() { + return MSG.measurementStationPanelTitle(); + } + + /** + * Loads the river info and renders it afterwards + */ + @Override + public void refresh() { + GWT.log("MeasurementStationPanel - refresh"); + contract(); + + riverInfoService.getMeasurementStations(this.river, + new AsyncCallback() { + @Override + public void onFailure(Throwable e) { + GWT.log("Could not load the river info." + e); + } + + @Override + public void onSuccess(RiverInfo riverinfo) { + GWT.log("MeasurementStationPanel - Loaded river info"); + render(riverinfo); + expand(); + } + }); + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationRecord.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationRecord.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,175 @@ +package de.intevation.flys.client.client.ui.stationinfo; + +import java.util.Date; + +import com.google.gwt.core.client.GWT; +import com.smartgwt.client.widgets.grid.ListGridRecord; + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.shared.model.MeasurementStation; + +/** + * @author Björn Ricks + */ +public class MeasurementStationRecord +extends ListGridRecord +implements MeasurementStation { + + /** The message class that provides i18n strings.*/ + private FLYSConstants MSG = GWT.create(FLYSConstants.class); + + public MeasurementStationRecord(MeasurementStation station) { + this.setCanExpand(true); + + Integer number = station.getID(); + String link = number != null ? + MSG.measurement_station_url() + number : + MSG.measurement_station_url(); + this.setLink(link); + this.setLinkText(MSG.measurement_station_info_link()); + this.setID(number); + this.setName(station.getName()); + if (station.isKmUp()) { + this.setKmEnd(station.getKmStart()); + this.setKmStart(station.getKmEnd()); + } + else { + this.setKmEnd(station.getKmEnd()); + this.setKmStart(station.getKmStart()); + } + this.setKmUp(station.isKmUp()); + this.setRiverName(station.getRiverName()); + this.setStation(station.getStation()); + this.setGaugeName(station.getGaugeName()); + this.setMeasurementType(station.getMeasurementType()); + this.setOperator(station.getOperator()); + this.setRiverSide(station.getRiverSide()); + this.setStartTime(station.getStartTime()); + this.setStopTime(station.getStopTime()); + } + + @Override + public Integer getID() { + return this.getAttributeAsInt("stationid"); + } + + private void setID(Integer value) { + this.setAttribute("stationid", value); + } + + @Override + public String getName() { + return this.getAttributeAsString("name"); + } + + private void setName(String value) { + this.setAttribute("name", value); + } + + @Override + public Double getKmStart() { + return this.getAttributeAsDouble("kmstart"); + } + + private void setKmStart(Double value) { + this.setAttribute("kmstart", value); + } + + @Override + public Double getKmEnd() { + return this.getAttributeAsDouble("kmend"); + } + + private void setKmEnd(Double value) { + this.setAttribute("kmend", value); + } + + @Override + public boolean isKmUp() { + return this.getAttributeAsBoolean("kmup"); + } + + private void setKmUp(boolean value) { + this.setAttribute("kmup", value); + } + + @Override + public Double getStation() { + return this.getAttributeAsDouble("station"); + } + + private void setStation(Double station) { + this.setAttribute("station", station); + } + + @Override + public String getRiverName() { + return this.getAttributeAsString("rivername"); + } + + private void setRiverName(String rivername) { + this.setAttribute("rivername", rivername); + } + + @Override + public String getRiverSide() { + return this.getAttributeAsString("riverside"); + } + + private void setRiverSide(String riverside) { + this.setAttribute("riverside", riverside); + } + + @Override + public String getMeasurementType() { + return this.getAttributeAsString("measurementtype"); + } + + private void setMeasurementType(String value) { + this.setAttribute("measurementtype", value); + } + + @Override + public String getOperator() { + return this.getAttributeAsString("operator"); + } + + private void setOperator(String value) { + this.setAttribute("operator", value); + } + + @Override + public Date getStartTime() { + return this.getAttributeAsDate("starttime"); + } + + private void setStartTime(Date value) { + this.setAttribute("starttime", value); + } + + @Override + public Date getStopTime() { + return this.getAttributeAsDate("stoptime"); + } + + private void setStopTime(Date value) { + this.setAttribute("stoptime", value); + } + + @Override + public String getGaugeName() { + return this.getAttributeAsString("gaugename"); + } + + private void setGaugeName(String value) { + this.setAttribute("gaugename", value); + } + + public String getLink() { + return this.getAttributeAsString("link"); + } + + public void setLink(String link) { + this.setAttribute("link", link); + } +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/QDTable.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/QDTable.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/QDTable.java Mon Feb 25 11:50:13 2013 +0100 @@ -14,6 +14,7 @@ /** + * Table showing Q and D main values, allowing for selection. * @author Ingo Weinzierl */ public class QDTable extends ListGrid { diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WQAutoTabSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/wq/WQAutoTabSet.java Mon Feb 25 11:50:13 2013 +0100 @@ -0,0 +1,99 @@ +package de.intevation.flys.client.client.ui.wq; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.NumberFormat; + +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.tab.Tab; +import com.smartgwt.client.widgets.tab.TabSet; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +import de.intevation.flys.client.client.services.WQInfoService; +import de.intevation.flys.client.client.services.WQInfoServiceAsync; + +import de.intevation.flys.client.shared.model.WQInfoObject; +import de.intevation.flys.client.shared.model.WQInfoRecord; + +import de.intevation.flys.client.client.FLYSConstants; + +import de.intevation.flys.client.client.Config; + +/** Tabset showing non-selectable W and Q/D values for a gauge. */ +public class WQAutoTabSet extends TabSet { + + /** Service to fetch W/Q/D values. */ + WQInfoServiceAsync wqInfoService = + GWT.create(WQInfoService.class); + + /** The message class that provides i18n strings.*/ + protected FLYSConstants MESSAGE = GWT.create(FLYSConstants.class); + + /** Table showing Q/D values. */ + protected QDTable qdTable; + + /** Table showing W values. */ + protected WTable wTable; + + + /** Set up two tabs showing W and Q/D values, fetch and populate tables. */ + public WQAutoTabSet(String riverName, double[] dist) { + super(); + + this.setWidth100(); + this.setHeight100(); + + Tab wTab = new Tab(MESSAGE.wq_table_w()); + Tab qTab = new Tab(MESSAGE.wq_table_q()); + + qdTable = new QDTable(); + qdTable.hideIconFields(); + wTable = new WTable(); + + wTab.setPane(wTable); + qTab.setPane(qdTable); + + this.addTab(wTab, 0); + this.addTab(qTab, 1); + + Config config = Config.getInstance(); + String locale = config.getLocale(); + wqInfoService.getWQInfo(locale, riverName, dist[0], dist[1], + new AsyncCallback() { + @Override + public void onFailure(Throwable caught) { + GWT.log("Could not recieve wq informations."); + SC.warn(caught.getMessage()); + } + + @Override + public void onSuccess(WQInfoObject[] wqi) { + int num = wqi != null ? wqi.length :0; + GWT.log("Recieved " + num + " wq informations."); + + if (num == 0) { + return; + } + + addWQInfo(wqi); + } + } + ); + } + + + /** Populate tables with one value. */ + private void addWQInfo (WQInfoObject[] wqi) { + for(WQInfoObject wi: wqi) { + WQInfoRecord rec = new WQInfoRecord(wi); + + if (wi.getType().equals("W")) { + wTable.addData(rec); + } + else { + qdTable.addData(rec); + } + } + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java Mon Feb 25 11:50:13 2013 +0100 @@ -41,11 +41,12 @@ String url = getServletContext().getInitParameter("server-url"); String uuid = req.getParameter("uuid"); + String name = req.getParameter("name"); String mode = req.getParameter("mode"); String type = req.getParameter("type"); String locale = req.getParameter("locale"); String km = req.getParameter("km"); - String fn = mode + "." + type; + String fn = name + "." + type; resp.setHeader("Content-Disposition", "attachment;filename=" + fn); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java Mon Feb 25 11:50:13 2013 +0100 @@ -7,7 +7,9 @@ import de.intevation.artifacts.httpclient.http.HttpClientImpl; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStream; +import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -28,11 +30,6 @@ @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) { - processPost(req, resp); - } - - - protected void processPost(HttpServletRequest req, HttpServletResponse resp) { logger.debug("handling post request."); String url = getServletContext().getInitParameter("server-url"); @@ -47,15 +44,31 @@ try { Document result = client.callService(url, "fileupload", request); + PrintWriter respWriter = resp.getWriter(); + respWriter.write(""); + respWriter.write("
"); + if (result == null) { logger.warn("FileUpload service returned no result."); + respWriter.write("FileUpload service returned no result"); } + else { + String status = result.getElementsByTagName("status") + .item(0).getTextContent(); + respWriter.write(status); + } + + respWriter.write("
"); + respWriter.flush(); return; } catch (ConnectionException ce) { logger.error(ce, ce); } + catch (IOException e) { + logger.error(e, e); + } } @@ -67,8 +80,6 @@ while (iter.hasNext()) { FileItemStream item = iter.next(); - - String name = item.getFieldName(); InputStream stream = item.openStream(); // Process the input stream diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Mon Feb 25 11:50:13 2013 +0100 @@ -128,7 +128,7 @@ Map pageSpecs ) { Map spec = new LinkedHashMap(); - spec.put("layout", "A4 portrait"); + spec.put("layout", "A4 landscape"); spec.put("pageSize", "A4"); spec.put("landscape", "false"); spec.put("title", "FLYS Druck"); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/WQInfoServiceImpl.java Mon Feb 25 11:50:13 2013 +0100 @@ -37,7 +37,6 @@ private static final Logger logger = Logger.getLogger(WQInfoServiceImpl.class); - public static final String ERROR_NO_WQINFO_FOUND = "error_no_wqinfo_found"; diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java Mon Feb 25 11:50:13 2013 +0100 @@ -89,7 +89,7 @@ logger.debug("Request for: " + requesturi); - // Allow acces to localhost + // Allow access to localhost if (isLocalAddress(req)) { logger.debug("Request to localhost"); chain.doFilter(req, resp); diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/server/filter/NoCacheFilter.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/filter/NoCacheFilter.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/filter/NoCacheFilter.java Mon Feb 25 11:50:13 2013 +0100 @@ -9,7 +9,6 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java --- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java Mon Feb 25 11:50:13 2013 +0100 @@ -8,69 +8,69 @@ public interface GaugeInfo extends Serializable { /** - * Returns the name of the gauge + * Returns the name of the gauge. */ String getName(); /** - * Returns the start KM of the gauge or null if not available + * Returns the start KM of the gauge or null if not available. */ Double getKmStart(); /** - * Returns the end KM of the gauge or null if not available + * Returns the end KM of the gauge or null if not available. */ Double getKmEnd(); /** - * Returns the mimimum Q value at this gauge or null if not available + * Returns the mimimum Q value at this gauge or null if not available. */ Double getMinQ(); /** - * Returns the maximum Q value at this gauge or null if not available + * Returns the maximum Q value at this gauge or null if not available. */ Double getMaxQ(); /** - * Returns the mimimum W value at this gauge or null if not available + * Returns the mimimum W value at this gauge or null if not available. */ Double getMinW(); /** - * Returns the maximim W value at this gauge or null if not available + * Returns the maximim W value at this gauge or null if not available. */ Double getMaxW(); /** - * Returns the datum value or null if not available + * Returns the datum value or null if not available. */ Double getDatum(); /** - * Returns the aeo value or null if not available + * Returns the aeo value or null if not available. */ Double getAeo(); boolean isKmUp(); /** - * Returns the station km of the gauge or null if not available + * Returns the station km of the gauge or null if not available. */ Double getStation(); /** - * Returns the wst unit as a String + * Returns the wst unit as a String. */ String getWstUnit(); /** - * Returns the official number of this gauge + * Returns the official number of this gauge. */ Long getOfficialNumber(); /** - * Returns the river to which this gauge belongs + * Returns the river to which this gauge belongs. */ String getRiverName(); } diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/webapp/FLYS.css --- a/flys-client/src/main/webapp/FLYS.css Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/webapp/FLYS.css Mon Feb 25 11:50:13 2013 +0100 @@ -235,3 +235,8 @@ color: #a9c9e6; margin-left: 10px; } + +.olControlAttribution { + bottom: 1em !important; + font-size: 12px !important; +} diff -r 4f46679e13d0 -r 4f65d833680f flys-client/src/main/webapp/WEB-INF/config.yaml --- a/flys-client/src/main/webapp/WEB-INF/config.yaml Mon Feb 25 11:46:36 2013 +0100 +++ b/flys-client/src/main/webapp/WEB-INF/config.yaml Mon Feb 25 11:50:13 2013 +0100 @@ -1,7 +1,7 @@ #=========================================================================== # allowed DPIs #=========================================================================== -dpis: [254, 190, 127, 56] +dpis: [254, 190, 127, 72, 56] #=========================================================================== # allowed Formats @@ -25,7 +25,7 @@ - 2000000 - 4000000 -outputFilename: 'flys-${date}.pdf' +outputFilename: "flys-${date}.pdf" #=========================================================================== # the list of allowed hosts @@ -43,160 +43,56 @@ host: www.pegelonline.wsv.de port: 80 - !dnsMatch - host: osm.wheregroup.com + host: geo4.service24.rlp.de + port: 80 + # Catch all + #- !dnsMatch + # host: #regex that catches host plus path + # port: 80 + - !dnsMatch + host: osm.intevation.de port: 80 layouts: + #=========================================================================== - A4 portrait: + A4 landscape: #=========================================================================== metaData: - title: '${title}' - author: 'MapFish print module' - subject: 'Simple layout' + title: "${title}" + author: 'Flys' + subject: 'Kartendruck A4 Quer' keywords: 'map,print' - creator: 'MapFish' - -# titlePage: -# pageSize: A4 -# items: -# - !text -# spacingAfter: 150 -# - !text -# font: Helvetica -# fontSize: 40 -# spacingAfter: 100 -# align: center -# text: '${title}' -# - !image -# maxWidth: 160 -# maxHeight: 160 -# spacingAfter: 100 -# align: center -# url: http://trac.mapfish.org/trac/mapfish/attachment/ticket/3/logo_v8_sphere.svg?format=raw -# - !image -# maxWidth: 160 -# maxHeight: 160 -# spacingAfter: 100 -# align: center -# url: 'file://${configDir}/../images/flys_logo.gif' -# - !text -# font: Helvetica -# fontSize: 14 -# align: left -# text: | -# Two layers are asked by the client: -# - a base layer from Metacarta -# - a transparent layer from Camptocamp.org (routes) -# . -# Some text is added over the map, just to demonstrate the absolute positionning. -# footer: &commonFooter -# height: 30 -# items: -# - !columns -# config: -# cells: -# - paddingBottom: 5 -# items: -# - !image -# maxWidth: 40 -# backgroundColor: #FF0000 -# align: left -# url: '${configDir}/../images/properties.gif' -# - !text -# backgroundColor: #FF0000 -# text: ©Camptocamp SA -# - !text -# align: right -# text: 'Page ${pageNum}' + creator: 'd4e-river' #------------------------------------------------------------------------- mainPage: pageSize: A4 - rotation: true + landscape: true header: height: 50 items: - - !image - align: left - maxWidth: 60 - maxHeight: 60 - # Fixme: Replace with local file or self-hosted link... - url: '${configDir}/../images/FLYS_Logo.png' + - !columns + config: + cells: + - paddingBottom: 5 + items: + - !image + align: left + maxWidth: 50 + maxHeight: 50 + url: "${configDir}/../images/FLYS_Logo.png" + - !text + font: Helvetica + fontSize: 30 + align: right + text: "${mapTitle}" + items: - - !text - font: Helvetica - fontSize: 30 - align: right - text: '${mapTitle}' - spacingAfter: 30 - - !map - spacingAfter: 30 - width: 440 - height: 483 - - !scalebar - type: bar - maxSize: 100 - barBgColor: white - fontSize: 8 - align: right - - !text - text: '${comment}' - spacingAfter: 30 - - !text - font: Helvetica - fontSize: 9 - align: right - text: '1:${scale} ${now MM.dd.yyyy}' - - !legends - align: left - maxIconWidth: 32 - maxIconHeight: 32 - footer: *commonFooter - - #=========================================================================== - A0 portrait: - #=========================================================================== - metaData: - title: '${title}' - author: 'MapFish print module' - subject: 'Simple layout' - keywords: 'map,print' - creator: 'MapFish' - - #------------------------------------------------------------------------- - mainPage: - pageSize: A0 - rotation: true - header: - height: 50 - items: - - !text - font: Helvetica - fontSize: 30 - align: right - text: '${mapTitle}' - items: - - !map - spacingAfter: 30 - width: 1760 - height: 1932 - - !scalebar - type: bar - maxSize: 100 - barBgColor: white - fontSize: 8 - align: right - - !text - text: '${comment}' - spacingAfter: 30 - - !text - font: Helvetica - fontSize: 9 - align: right - text: '1:${scale} ${now MM.dd.yyyy}' - - !legends - align: left - maxIconWidth: 32 - maxIconHeight: 32 - footer: *commonFooter + - !map + absoluteX: 45 + absoluteY: 510 + spacingAfter: 200 + width: 540 + height: 480 + align: left