Mercurial > dive4elements > river
changeset 8389:1e1b08d033f4
Removed some code duplication and moved macros to more appropriate places in file.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 07 Oct 2014 19:04:06 +0200 |
parents | 5b3a2908a346 |
children | e52a7daabe0f |
files | artifacts/doc/conf/meta-data.xml |
diffstat | 1 files changed, 59 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/doc/conf/meta-data.xml Tue Oct 07 19:02:50 2014 +0200 +++ b/artifacts/doc/conf/meta-data.xml Tue Oct 07 19:04:06 2014 +0200 @@ -444,43 +444,6 @@ </dc:macro> - <dc:macro name="historical_discharge_curve"> - <dc:variable name="refgauge" type="number" - expr="dc:get('reference_gauge')"/> - <dc:context> - <dc:statement> - SELECT g.id AS gauge_id, - g.name AS gauge_name, - dt.id AS dt_id, - t.start_time AS start_time, - t.stop_time AS stop_time, - dt.bfg_id AS bfg_id - FROM gauges g - JOIN discharge_tables dt ON g.id = dt.gauge_id - LEFT JOIN time_intervals t ON dt.time_interval_id = t.id - WHERE g.river_id = ${river_id} - AND dt.kind <> 0 - AND ((g.station = ${fromkm} AND g.station = ${tokm}) - OR g.official_number = ${refgauge}) - ORDER BY start_time - </dc:statement> - <dc:if test="dc:has-result()"> - <historical_discharge_curves> - <dc:group expr="$gauge_name"> - <dc:for-each> - <dc:variable name="combined_desc" expr="concat($bfg_id, ' ', dc:date-format('dd.MM.yyyy', $start_time), ' - ', dc:date-format('dd.MM.yyyy', $stop_time))"/> - <histdis name="{$combined_desc}" - description="{$combined_desc}" - factory="gaugedischarge" target_out="{$out}" - ids="{$gauge_name};{$dt_id};{$combined_desc}"/> - </dc:for-each> - </dc:group> - </historical_discharge_curves> - </dc:if> - </dc:context> - </dc:macro> - - <dc:macro name="flood-map"> <dc:filter expr="$facet_name = 'floodmap.wsplgen'"> <dc:if test="dc:has-result()"> @@ -1045,10 +1008,6 @@ <!-- Macros to load system data --> - <dc:macro name="annotations"> - <annotation factory="annotations" ids="{$river_id}" target_out="{$out}" /> - </dc:macro> - <dc:macro name="qmainvalues"> <qmainvalue factory="mainvalue" ids="{$river_id}:q" target_out="{$out}"/> </dc:macro> @@ -1058,6 +1017,61 @@ <dc:call-macro name="qmainvalues"/> </dc:macro> + <dc:macro name="discharge_table_gauge"> + <dc:variable name="refgauge" type="number" + expr="dc:get('reference_gauge')"/> + <dc:context> + <dc:call-macro name="discharge_curves"/> + <dc:filter expr="$kind = 0"> + <dc:for-each> + <current_gauge factory="gaugedischarge" target_out="{$out}" + ids="{$gauge_name}"/> + </dc:for-each> + </dc:filter> + </dc:context> + </dc:macro> + + <dc:macro name="historical_discharge_curve"> + <dc:variable name="refgauge" type="number" + expr="dc:get('reference_gauge')"/> + <dc:context> + <dc:call-macro name="discharge_curves"/> + <dc:filter expr="$kind = 1"> + <historical_discharge_curves> + <dc:for-each> + <dc:variable name="combined_desc" + expr="concat($bfg_id, ' ', + dc:date-format('dd.MM.yyyy', $start_time), + ' - ', + dc:date-format('dd.MM.yyyy', $stop_time))"/> + <histdis name="{$combined_desc}" + description="{$combined_desc}" + factory="gaugedischarge" target_out="{$out}" + ids="{$gauge_name};{$dt_id};{$combined_desc}"/> + </dc:for-each> + </historical_discharge_curves> + </dc:filter> + </dc:context> + </dc:macro> + + <dc:macro name="discharge_curves"> + <dc:statement> + SELECT g.name AS gauge_name, + dt.id AS dt_id, + t.start_time AS start_time, + t.stop_time AS stop_time, + dt.bfg_id AS bfg_id, + dt.kind AS kind + FROM gauges g + JOIN discharge_tables dt ON g.id = dt.gauge_id + LEFT JOIN time_intervals t ON dt.time_interval_id = t.id + WHERE g.river_id = ${river_id} + AND ((g.station = ${fromkm} AND g.station = ${tokm}) + OR g.official_number = ${refgauge}) + ORDER BY start_time + </dc:statement> + </dc:macro> + <dc:macro name="cross_sections"> <cross_sections id="flood-protections-{$river_id}"> <dc:context connection="system"> @@ -1721,6 +1735,10 @@ </dc:macro> <!-- annotations --> + <dc:macro name="annotations"> + <annotation factory="annotations" ids="{$river_id}" target_out="{$out}"/> + </dc:macro> + <dc:macro name="annotations_per_type"> <annotations> <dc:context> @@ -1757,32 +1775,6 @@ </sources_sinks> </dc:macro> - <dc:macro name="discharge_table_gauge"> - <dc:variable name="refgauge" type="number" - expr="dc:get('reference_gauge')"/> - <dc:context> - <dc:statement> - SELECT g.id AS gauge_id, - g.name AS gauge_name, - t.start_time AS start_time, - t.stop_time AS stop_time - FROM gauges g - JOIN discharge_tables dt ON g.id = dt.gauge_id - LEFT JOIN time_intervals t ON dt.time_interval_id = t.id - WHERE g.river_id = ${river_id} - AND dt.kind = 0 - AND ((g.station = ${fromkm} AND g.station = ${tokm}) - OR g.official_number = ${refgauge}) - </dc:statement> - <dc:if test="dc:has-result()"> - <dc:for-each> - <current_gauge factory="gaugedischarge" target_out="{$out}" - ids="{$gauge_name}"/> - </dc:for-each> - </dc:if> - </dc:context> - </dc:macro> - <dc:macro name="qsectors"> <qsector factory="qsectors" ids="{$river_id}" target_out="{$out}" /> </dc:macro>