Mercurial > dive4elements > river
changeset 5377:a5f5599f6fd5 2.9.14
merge
author | Bettina Gruenbauer <bettina@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:02:08 +0100 |
parents | 9b2482a3b9fe (current diff) 407af2f1a364 (diff) |
children | fe5fc583390d |
files | |
diffstat | 14 files changed, 331 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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 @@ </facets> </outputmode> <outputmode name="historical_discharge_wq" description="output.historical_discharge_wq.description" mime-type="image/png" type="chart"> - <facets> - <facet name="historical_discharge.wq.q"/> - <facet name="historical_discharge.wq.w"/> - <facet name="historical_discharge.wq.curve"/> - </facets> + <facets> + <facet name="historical_discharge.wq.q"/> + <facet name="historical_discharge.wq.w"/> + <facet name="historical_discharge.wq.curve"/> + <facet name="historical_discharge.mainvalues.q"/> + <facet name="historical_discharge.mainvalues.w"/> + </facets> </outputmode> <outputmode name="historical_discharge_export" description="output.historical_discharge.export" mime-type="text/plain" type="export"> <facets>
--- 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 @@ <dc:if test="dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))"> <dc:call-macro name="annotations"/> </dc:if> + <dc:if test="dc:contains($artifact-outs, 'historical_discharge_wq')"> + <dc:call-macro name="mainvalues"/> + </dc:if> <dc:if test="dc:contains($artifact-outs, 'cross_section')"> <dc:call-macro name="cross_sections"/> <dc:call-macro name="hyks"/> @@ -1260,40 +1263,264 @@ </dc:elements> </dc:context> </dc:macro> - <dc:macro name="hwslines"> - <dc:context> - <dc:statement> - SELECT count(*) as km_exists, name as name - FROM hws_lines WHERE river_id = ${river_id} GROUP BY name - </dc:statement> - <dc:elements> - <dc:if test="$km_exists>0"> - <line> - <dc:attribute name="factory" value="wmshwslinesfactory"/> - <dc:attribute name="ids" value="${river_id};${name}"/> - <dc:attribute name="name" value="${name}"/> - </line> - </dc:if> + + <dc:macro name="hwslines_by_kind"> + <dc:comment> + Call from a context where fed_name hws_kind hws_name and river_id is + availble + </dc:comment> + <Durchlass> + <dc:elements filter="$hws_kind=1"> + <hws> + <dc:attribute name="factory" value="wmshwslinesfactory"/> + <dc:attribute name="ids" value="${river_id};${hws_name}"/> + <dc:attribute name="name" value="${hws_name}"/> + </hws> </dc:elements> - </dc:context> + </Durchlass> + <Damm> + <dc:elements filter="$hws_kind=2"> + <hws> + <dc:attribute name="factory" value="wmshwslinesfactory"/> + <dc:attribute name="ids" value="${river_id};${hws_name}"/> + <dc:attribute name="name" value="${hws_name}"/> + </hws> + </dc:elements> + </Damm> + <Graben> + <dc:elements filter="$hws_kind=3"> + <hws> + <dc:attribute name="factory" value="wmshwslinesfactory"/> + <dc:attribute name="ids" value="${river_id};${hws_name}"/> + <dc:attribute name="name" value="${hws_name}"/> + </hws> + </dc:elements> + </Graben> </dc:macro> + + <dc:macro name="hwslines"> + <hws_lines> + <official> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <dc:elements> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <fedstate> + <dc:attribute name="description" value="${fed_name}"/> + <dc:call-macro name="hwslines_by_kind"/> + </fedstate> + </dc:context> + </dc:elements> + </dc:context> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <hws_fed_unknown> + <dc:call-macro name="hwslines_by_kind"/> + </hws_fed_unknown> + </dc:context> + </official> + <inofficial> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <dc:elements> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <fedstate> + <dc:attribute name="description" value="${fed_name}"/> + <dc:call-macro name="hwslines_by_kind"/> + </fedstate> + </dc:context> + </dc:elements> + </dc:context> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <hws_fed_unknown> + <dc:call-macro name="hwslines_by_kind"/> + </hws_fed_unknown> + </dc:context> + </inofficial> + </hws_lines> + </dc:macro> + + <dc:macro name="hwspoints_by_kind"> + <dc:comment> + Call from a context where fed_name hws_kind hws_name and river_id is + availble + </dc:comment> + <Durchlass> + <dc:elements filter="$hws_kind=1"> + <hws> + <dc:attribute name="factory" value="wmshwspointsfactory"/> + <dc:attribute name="ids" value="${river_id};${hws_name}"/> + <dc:attribute name="name" value="${hws_name}"/> + </hws> + </dc:elements> + </Durchlass> + <Damm> + <dc:elements filter="$hws_kind=2"> + <hws> + <dc:attribute name="factory" value="wmshwspointsfactory"/> + <dc:attribute name="ids" value="${river_id};${hws_name}"/> + <dc:attribute name="name" value="${hws_name}"/> + </hws> + </dc:elements> + </Damm> + <Graben> + <dc:elements filter="$hws_kind=3"> + <hws> + <dc:attribute name="factory" value="wmshwspointsfactory"/> + <dc:attribute name="ids" value="${river_id};${hws_name}"/> + <dc:attribute name="name" value="${hws_name}"/> + </hws> + </dc:elements> + </Graben> + </dc:macro> + <dc:macro name="hwspoints"> - <dc:context> - <dc:statement> - SELECT count(*) as km_exists, name as name - FROM hws_points WHERE river_id = ${river_id} GROUP BY name - </dc:statement> - <dc:elements> - <dc:if test="$km_exists>0"> - <line> - <dc:attribute name="factory" value="wmshwspointsfactory"/> - <dc:attribute name="ids" value="${river_id};${name}"/> - <dc:attribute name="name" value="${name}"/> - </line> - </dc:if> - </dc:elements> - </dc:context> - </dc:macro> + <hws_points> + <official> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <dc:elements> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <fedstate> + <dc:attribute name="description" value="${fed_name}"/> + <dc:call-macro name="hwspoints_by_kind"/> + </fedstate> + </dc:context> + </dc:elements> + </dc:context> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <hws_fed_unknown> + <dc:call-macro name="hwspoints_by_kind"/> + </hws_fed_unknown> + </dc:context> + </official> + <inofficial> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <dc:elements> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <fedstate> + <dc:attribute name="description" value="${fed_name}"/> + <dc:call-macro name="hwspoints_by_kind"/> + </fedstate> + </dc:context> + </dc:elements> + </dc:context> + <dc:context> + <dc:statement> + 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 + </dc:statement> + <hws_fed_unknown> + <dc:call-macro name="hwspoints_by_kind"/> + </hws_fed_unknown> + </dc:context> + </inofficial> + </hws_points> + </dc:macro> + + <dc:macro name="flood-map-buildings"> <dc:context> <dc:statement> @@ -1454,12 +1681,8 @@ <dc:call-macro name="flood-map-qps"/> </kilometrage> <hws> - <hws_lines> - <dc:call-macro name="hwslines"/> - </hws_lines> - <hws_points> - <dc:call-macro name="hwspoints"/> - </hws_points> + <dc:call-macro name="hwslines"/> + <dc:call-macro name="hwspoints"/> </hws> <dc:call-macro name="flood-map-uesk"/> <gaugelocations>
--- 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."); + } + } }
--- 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";
--- 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; }
--- 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
--- 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');
--- 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),
--- 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;
--- 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
--- 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 :
--- 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
--- 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