# HG changeset patch # User Bettina Gruenbauer # Date 1363946528 -3600 # Node ID a5f5599f6fd5e37975d71b8a323aadfeb8d017e6 # Parent 9b2482a3b9fee4c9bb14c6f6db707528c72e6761# Parent 407af2f1a36413cb6d051e2f337e2a7126590412 merge diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-aft/src/main/java/de/intevation/aft/DischargeTable.java --- a/flys-aft/src/main/java/de/intevation/aft/DischargeTable.java Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-aft/src/main/java/de/intevation/aft/DischargeTable.java Fri Mar 22 11:02:08 2013 +0100 @@ -15,6 +15,7 @@ import org.apache.log4j.Logger; +/** A Discharge Table. */ public class DischargeTable { private static Logger log = Logger.getLogger(DischargeTable.class); diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-artifacts/doc/conf/artifacts/winfo.xml --- a/flys-artifacts/doc/conf/artifacts/winfo.xml Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Fri Mar 22 11:02:08 2013 +0100 @@ -618,11 +618,13 @@ - - - - - + + + + + + + diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-artifacts/doc/conf/meta-data.xml --- a/flys-artifacts/doc/conf/meta-data.xml Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Fri Mar 22 11:02:08 2013 +0100 @@ -720,6 +720,9 @@ + + + @@ -1260,40 +1263,264 @@ - - - - SELECT count(*) as km_exists, name as name - FROM hws_lines WHERE river_id = ${river_id} GROUP BY name - - - - - - - - - + + + + Call from a context where fed_name hws_kind hws_name and river_id is + availble + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_lines hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=1 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id IS NULL + ORDER BY name + + + + + + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_lines hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=0 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id IS NULL ORDER BY name + + + + + + + + + + + + Call from a context where fed_name hws_kind hws_name and river_id is + availble + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - SELECT count(*) as km_exists, name as name - FROM hws_points WHERE river_id = ${river_id} GROUP BY name - - - - - - - - - - - - + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_points hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=1 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id IS NULL + ORDER BY name + + + + + + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_points hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=0 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id IS NULL ORDER BY name + + + + + + + + + + @@ -1454,12 +1681,8 @@ - - - - - - + + diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Fri Mar 22 11:02:08 2013 +0100 @@ -75,6 +75,7 @@ }); } + /** * Trivial Constructor. */ @@ -126,28 +127,44 @@ "facet.discharge_curves.mainvalues.q", "facet.discharge_curves.mainvalues.q"), true); + Facet qfacet3 = new MainValuesQFacet( + HISTORICAL_DISCHARGE_MAINVALUES_Q, + Resources.getMsg( + callMeta, + "historical_discharge.mainvalues.q", + "historical_discharge.mainvalues.q"), + false); fs.add(qfacet0); fs.add(qfacet1); fs.add(qfacet2); + fs.add(qfacet3); } if (!restricted || restriction.endsWith("w")) { - Facet wfacet1 = new MainValuesWFacet( - COMPUTED_DISCHARGE_MAINVALUES_W, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.w", - "facet.discharge_curves.mainvalues.w"), - false); - Facet wfacet2 = new MainValuesWFacet( - MAINVALUES_W, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.w", - "facet.discharge_curves.mainvalues.w"), - true); + Facet wfacet1 = new MainValuesWFacet( + COMPUTED_DISCHARGE_MAINVALUES_W, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.w", + "facet.discharge_curves.mainvalues.w"), + false); + Facet wfacet2 = new MainValuesWFacet( + MAINVALUES_W, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.w", + "facet.discharge_curves.mainvalues.w"), + true); + Facet wfacet3 = new MainValuesWFacet( + HISTORICAL_DISCHARGE_MAINVALUES_W, + Resources.getMsg( + callMeta, + "historical_discharge.mainvalues.w", + "historical_discharge.mainvalues.w"), + true); fs.add(wfacet1); fs.add(wfacet2); + fs.add(wfacet3); } } @@ -170,6 +187,7 @@ } + /** Get important data from the 'calling' artifact. */ @Override protected void initialize(Artifact artifact, Object context, CallMeta meta) { logger.debug("MainValuesArtifact.initialize"); @@ -186,6 +204,20 @@ logger.error("No location for mainvalues given."); } importData(winfo, "river"); + // In the case of DischargeWQCurves, there are no locations, but a gauge. + if (getDataAsString("ld_locations") == null) { + // TODO its a tad difficult to remodel Range/Gauge-Access to + // do this. + String refGaugeID = winfo.getDataAsString("reference_gauge"); + if (refGaugeID != null) { + Gauge g = Gauge.getGaugeByOfficialNumber(Integer.parseInt(refGaugeID)); + addData("ld_locations", new DefaultStateData("ld_locations", null, null, + String.valueOf(g.getStation()))); + } + else { + logger.error("MainValuesArtifact: No location/gauge."); + } + } } diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Fri Mar 22 11:02:08 2013 +0100 @@ -237,6 +237,8 @@ String HISTORICAL_DISCHARGE_WQ_Q = "historical_discharge.wq.q"; String HISTORICAL_DISCHARGE_WQ_W = "historical_discharge.wq.w"; String HISTORICAL_DISCHARGE_WQ_CURVE = "historical_discharge.wq.curve"; + String HISTORICAL_DISCHARGE_MAINVALUES_Q = "historical_discharge.mainvalues.q"; + String HISTORICAL_DISCHARGE_MAINVALUES_W = "historical_discharge.mainvalues.w"; String REFERENCE_CURVE = "reference_curve"; String REFERENCE_CURVE_NORMALIZED = "reference_curve_normalized"; diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java Fri Mar 22 11:02:08 2013 +0100 @@ -395,7 +395,10 @@ } } - protected static Marker createQSectorMarker(double value, String label) { + /** Create Marker at value with label. */ + protected static Marker createQSectorMarker( + double value, String label + ) { if (Double.isNaN(value)) { return null; } diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-backend/contrib/shpimporter/importer.py --- a/flys-backend/contrib/shpimporter/importer.py Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-backend/contrib/shpimporter/importer.py Fri Mar 22 11:02:08 2013 +0100 @@ -73,6 +73,8 @@ return result def IsDoubleFieldSet(self, feat, name): + if not self.IsFieldSet(feat, name): + return False try: isset = feat.GetFieldAsDouble(name) return isset is not None diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-backend/doc/schema/oracle-spatial_idx.sql --- a/flys-backend/doc/schema/oracle-spatial_idx.sql Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-backend/doc/schema/oracle-spatial_idx.sql Fri Mar 22 11:02:08 2013 +0100 @@ -1,12 +1,8 @@ --- TODO: index prevents `DELETE FROM rivers' on 11g --- Error: "Ebenendimensionalitat stimmt nicht mit Geometrie-Dimensionen uberein" --- CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point'); +CREATE INDEX river_axes_km_spatial_idx ON river_axes_km(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=point'); CREATE INDEX buildings_spatial_idx ON buildings(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=LINE'); --- TODO: index prevents `DELETE FROM rivers' on 11g --- Error: "Ebenendimensionalitat stimmt nicht mit Geometrie-Dimensionen uberein" --- CREATE INDEX fixpoints_spatial_idx ON fixpoints(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT'); +CREATE INDEX fixpoints_spatial_idx ON fixpoints(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=POINT'); CREATE INDEX river_axes_spatial_idx ON river_axes(GEOM) indextype IS MDSYS.SPATIAL_INDEX parameters ('LAYER_GTYPE=MULTILINE'); diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-backend/doc/schema/postgresql-spatial.sql --- a/flys-backend/doc/schema/postgresql-spatial.sql Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-backend/doc/schema/postgresql-spatial.sql Fri Mar 22 11:02:08 2013 +0100 @@ -110,7 +110,6 @@ CREATE TABLE dem ( id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id) ON DELETE CASCADE, - -- XXX Should we use the ranges table instead? name VARCHAR(64), range_id INT REFERENCES ranges(id), time_interval_id INT REFERENCES time_intervals(id), diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-backend/src/main/java/de/intevation/flys/model/Gauge.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java Fri Mar 22 11:02:08 2013 +0100 @@ -22,6 +22,7 @@ import de.intevation.flys.backend.SessionHolder; +/** Database-mapped Gauge with all info about it. */ @Entity @Table(name = "gauges") public class Gauge @@ -31,7 +32,6 @@ public static final int MASTER_DISCHARGE_TABLE = 0; - private Integer id; private String name; private River river; diff -r 9b2482a3b9fe -r a5f5599f6fd5 flys-backend/src/main/java/de/intevation/flys/model/MainValue.java --- a/flys-backend/src/main/java/de/intevation/flys/model/MainValue.java Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/MainValue.java Fri Mar 22 11:02:08 2013 +0100 @@ -14,6 +14,8 @@ import java.math.BigDecimal; + +/** A Main or Extreme value of a rivers gauge. */ @Entity @Table(name = "main_values") public class MainValue diff -r 9b2482a3b9fe -r a5f5599f6fd5 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 Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Fri Mar 22 11:02:08 2013 +0100 @@ -1162,6 +1162,8 @@ String hws_points(); + String hws_fed_unknown(); + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 9b2482a3b9fe -r a5f5599f6fd5 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 Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Fri Mar 22 11:02:08 2013 +0100 @@ -460,6 +460,7 @@ custom_lines = Own Digitalizations hws_lines = Lines hws_points = Points +hws_fed_unknown = Unknown State startcolor = Colorrange start color endcolor = Colorrange end color diff -r 9b2482a3b9fe -r a5f5599f6fd5 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 Fri Mar 22 11:01:31 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Fri Mar 22 11:02:08 2013 +0100 @@ -461,6 +461,7 @@ custom_lines = Eigene Digitalisierungen hws_lines = Liniendaten hws_points = Punktdaten +hws_fed_unknown = Unbekanntes Bundesland startcolor = Farbverlauf Startfarbe endcolor = Farbverlauf Endfarbe