comparison artifacts/doc/conf/meta-data.xml @ 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 64b21db73846
children 17db08570637
comparison
equal deleted inserted replaced
8388:5b3a2908a346 8389:1e1b08d033f4
442 </dc:if> 442 </dc:if>
443 </dc:filter> 443 </dc:filter>
444 </dc:macro> 444 </dc:macro>
445 445
446 446
447 <dc:macro name="historical_discharge_curve">
448 <dc:variable name="refgauge" type="number"
449 expr="dc:get('reference_gauge')"/>
450 <dc:context>
451 <dc:statement>
452 SELECT g.id AS gauge_id,
453 g.name AS gauge_name,
454 dt.id AS dt_id,
455 t.start_time AS start_time,
456 t.stop_time AS stop_time,
457 dt.bfg_id AS bfg_id
458 FROM gauges g
459 JOIN discharge_tables dt ON g.id = dt.gauge_id
460 LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
461 WHERE g.river_id = ${river_id}
462 AND dt.kind &lt;&gt; 0
463 AND ((g.station = ${fromkm} AND g.station = ${tokm})
464 OR g.official_number = ${refgauge})
465 ORDER BY start_time
466 </dc:statement>
467 <dc:if test="dc:has-result()">
468 <historical_discharge_curves>
469 <dc:group expr="$gauge_name">
470 <dc:for-each>
471 <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))"/>
472 <histdis name="{$combined_desc}"
473 description="{$combined_desc}"
474 factory="gaugedischarge" target_out="{$out}"
475 ids="{$gauge_name};{$dt_id};{$combined_desc}"/>
476 </dc:for-each>
477 </dc:group>
478 </historical_discharge_curves>
479 </dc:if>
480 </dc:context>
481 </dc:macro>
482
483
484 <dc:macro name="flood-map"> 447 <dc:macro name="flood-map">
485 <dc:filter expr="$facet_name = 'floodmap.wsplgen'"> 448 <dc:filter expr="$facet_name = 'floodmap.wsplgen'">
486 <dc:if test="dc:has-result()"> 449 <dc:if test="dc:has-result()">
487 <floodmap> 450 <floodmap>
488 <dc:for-each> 451 <dc:for-each>
1043 </dc:macro> 1006 </dc:macro>
1044 1007
1045 1008
1046 <!-- Macros to load system data --> 1009 <!-- Macros to load system data -->
1047 1010
1048 <dc:macro name="annotations">
1049 <annotation factory="annotations" ids="{$river_id}" target_out="{$out}" />
1050 </dc:macro>
1051
1052 <dc:macro name="qmainvalues"> 1011 <dc:macro name="qmainvalues">
1053 <qmainvalue factory="mainvalue" ids="{$river_id}:q" target_out="{$out}"/> 1012 <qmainvalue factory="mainvalue" ids="{$river_id}:q" target_out="{$out}"/>
1054 </dc:macro> 1013 </dc:macro>
1055 1014
1056 <dc:macro name="mainvalues"> 1015 <dc:macro name="mainvalues">
1057 <wmainvalue factory="mainvalue" ids="{$river_id}:w" target_out="{$out}"/> 1016 <wmainvalue factory="mainvalue" ids="{$river_id}:w" target_out="{$out}"/>
1058 <dc:call-macro name="qmainvalues"/> 1017 <dc:call-macro name="qmainvalues"/>
1018 </dc:macro>
1019
1020 <dc:macro name="discharge_table_gauge">
1021 <dc:variable name="refgauge" type="number"
1022 expr="dc:get('reference_gauge')"/>
1023 <dc:context>
1024 <dc:call-macro name="discharge_curves"/>
1025 <dc:filter expr="$kind = 0">
1026 <dc:for-each>
1027 <current_gauge factory="gaugedischarge" target_out="{$out}"
1028 ids="{$gauge_name}"/>
1029 </dc:for-each>
1030 </dc:filter>
1031 </dc:context>
1032 </dc:macro>
1033
1034 <dc:macro name="historical_discharge_curve">
1035 <dc:variable name="refgauge" type="number"
1036 expr="dc:get('reference_gauge')"/>
1037 <dc:context>
1038 <dc:call-macro name="discharge_curves"/>
1039 <dc:filter expr="$kind = 1">
1040 <historical_discharge_curves>
1041 <dc:for-each>
1042 <dc:variable name="combined_desc"
1043 expr="concat($bfg_id, ' ',
1044 dc:date-format('dd.MM.yyyy', $start_time),
1045 ' - ',
1046 dc:date-format('dd.MM.yyyy', $stop_time))"/>
1047 <histdis name="{$combined_desc}"
1048 description="{$combined_desc}"
1049 factory="gaugedischarge" target_out="{$out}"
1050 ids="{$gauge_name};{$dt_id};{$combined_desc}"/>
1051 </dc:for-each>
1052 </historical_discharge_curves>
1053 </dc:filter>
1054 </dc:context>
1055 </dc:macro>
1056
1057 <dc:macro name="discharge_curves">
1058 <dc:statement>
1059 SELECT g.name AS gauge_name,
1060 dt.id AS dt_id,
1061 t.start_time AS start_time,
1062 t.stop_time AS stop_time,
1063 dt.bfg_id AS bfg_id,
1064 dt.kind AS kind
1065 FROM gauges g
1066 JOIN discharge_tables dt ON g.id = dt.gauge_id
1067 LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
1068 WHERE g.river_id = ${river_id}
1069 AND ((g.station = ${fromkm} AND g.station = ${tokm})
1070 OR g.official_number = ${refgauge})
1071 ORDER BY start_time
1072 </dc:statement>
1059 </dc:macro> 1073 </dc:macro>
1060 1074
1061 <dc:macro name="cross_sections"> 1075 <dc:macro name="cross_sections">
1062 <cross_sections id="flood-protections-{$river_id}"> 1076 <cross_sections id="flood-protections-{$river_id}">
1063 <dc:context connection="system"> 1077 <dc:context connection="system">
1719 </sediment_load_ls> 1733 </sediment_load_ls>
1720 </sedimentloads> 1734 </sedimentloads>
1721 </dc:macro> 1735 </dc:macro>
1722 1736
1723 <!-- annotations --> 1737 <!-- annotations -->
1738 <dc:macro name="annotations">
1739 <annotation factory="annotations" ids="{$river_id}" target_out="{$out}"/>
1740 </dc:macro>
1741
1724 <dc:macro name="annotations_per_type"> 1742 <dc:macro name="annotations_per_type">
1725 <annotations> 1743 <annotations>
1726 <dc:context> 1744 <dc:context>
1727 <all_annotations factory="annotations" ids="{$river_id}" target_out="{$out}" /> 1745 <all_annotations factory="annotations" ids="{$river_id}" target_out="{$out}" />
1728 <dc:statement> 1746 <dc:statement>
1753 factory="annotations" target_out="{$out}" 1771 factory="annotations" target_out="{$out}"
1754 ids="{$river_id}:{$anno_description}"/> 1772 ids="{$river_id}:{$anno_description}"/>
1755 </dc:for-each> 1773 </dc:for-each>
1756 </dc:context> 1774 </dc:context>
1757 </sources_sinks> 1775 </sources_sinks>
1758 </dc:macro>
1759
1760 <dc:macro name="discharge_table_gauge">
1761 <dc:variable name="refgauge" type="number"
1762 expr="dc:get('reference_gauge')"/>
1763 <dc:context>
1764 <dc:statement>
1765 SELECT g.id AS gauge_id,
1766 g.name AS gauge_name,
1767 t.start_time AS start_time,
1768 t.stop_time AS stop_time
1769 FROM gauges g
1770 JOIN discharge_tables dt ON g.id = dt.gauge_id
1771 LEFT JOIN time_intervals t ON dt.time_interval_id = t.id
1772 WHERE g.river_id = ${river_id}
1773 AND dt.kind = 0
1774 AND ((g.station = ${fromkm} AND g.station = ${tokm})
1775 OR g.official_number = ${refgauge})
1776 </dc:statement>
1777 <dc:if test="dc:has-result()">
1778 <dc:for-each>
1779 <current_gauge factory="gaugedischarge" target_out="{$out}"
1780 ids="{$gauge_name}"/>
1781 </dc:for-each>
1782 </dc:if>
1783 </dc:context>
1784 </dc:macro> 1776 </dc:macro>
1785 1777
1786 <dc:macro name="qsectors"> 1778 <dc:macro name="qsectors">
1787 <qsector factory="qsectors" ids="{$river_id}" target_out="{$out}" /> 1779 <qsector factory="qsectors" ids="{$river_id}" target_out="{$out}" />
1788 </dc:macro> 1780 </dc:macro>

http://dive4elements.wald.intevation.org