comparison artifacts/doc/conf/meta-data.xml @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/doc/conf/meta-data.xml@a7df90f425e2
children 6343a61b62c8
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 <?xml version="1.0" encoding="UTF-8"?>
2 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
3 <datacage>
4 <dc:comment>
5 Statement to load data from wsts.
6 </dc:comment>
7 <dc:macro name="SQL-wst_columns_statement">
8 <dc:statement>
9 SELECT wst_columns.id AS prot_column_id,
10 wst_columns.name AS prot_column_name,
11 wst_columns.position AS prot_rel_pos,
12 wst_columns.description AS info,
13 wst_ranges.a AS deffrom,
14 wst_ranges.b AS defto
15 FROM wst_columns, wst_ranges
16 WHERE wst_columns.wst_id = ${prot_id}
17 AND wst_ranges.wst_column_id = wst_columns.id
18 AND (${fromkm} BETWEEN wst_ranges.a AND wst_ranges.b
19 OR ${tokm} BETWEEN wst_ranges.a AND wst_ranges.b
20 OR wst_ranges.a BETWEEN ${fromkm} AND ${tokm}
21 OR wst_ranges.b BETWEEN ${fromkm} AND ${tokm})
22 ORDER by wst_columns.position
23 </dc:statement>
24 </dc:macro>
25
26 <dc:comment>
27 Load user specific distance information from artifact.
28 </dc:comment>
29 <dc:macro name="user-range">
30 <dc:choose>
31 <dc:when test="dc:contains($parameters, 'user-id')">
32 <dc:context connection="user">
33 <dc:statement>
34 SELECT COALESCE(ld_mode, '') AS ldm,
35 COALESCE(ld_locations, '') AS ldl,
36 COALESCE(ld_from, '') AS ldf,
37 COALESCE(ld_to, '') AS ldt
38 FROM master_artifacts_range
39 WHERE gid = CAST(${artifact-id} AS uuid)
40 </dc:statement>
41 <dc:for-each>
42 <dc:variable name="fromkm" type="number" expr="dc:fromValue($ldm, $ldl, $ldf)"/>
43 <dc:variable name="tokm" type="number" expr="dc:toValue($ldm, $ldl, $ldt)"/>
44 <dc:macro-body/>
45 </dc:for-each>
46 </dc:context>
47 </dc:when>
48 <dc:otherwise>
49 <dc:variable name="fromkm" type="number" expr="dc:fromValue('', '', '')"/>
50 <dc:variable name="tokm" type="number" expr="dc:toValue('', '', '')"/>
51 <dc:macro-body/>
52 </dc:otherwise>
53 </dc:choose>
54 </dc:macro>
55
56 <dc:comment>
57 System part. Load data for the given river.
58 </dc:comment>
59 <dc:macro name="load-system">
60 <dc:context connection="system">
61 <dc:statement>
62 SELECT id AS river_id, name AS river_name FROM rivers
63 WHERE lower(name) LIKE lower(${river})
64 </dc:statement>
65 <dc:for-each>
66
67 <dc:comment>
68 Base-data macros (mostly data imported from wst-files).
69 </dc:comment>
70 <dc:macro name="basedata_0">
71 <dc:call-macro name="user-range">
72 <dc:comment comment=" BASEDATA ---------------------------"/>
73 <basedata>
74 <dc:context connection="system">
75 <dc:statement>
76 SELECT id AS prot_id,
77 description AS prot_description
78 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
79 </dc:statement>
80 <dc:for-each>
81 <basedata name="{$prot_description}">
82 <dc:context>
83 <dc:call-macro name="SQL-wst_columns_statement"/>
84 <dc:for-each>
85 <column name="{$prot_column_name}"
86 ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}"
87 factory="staticwqkms"
88 info="{$info} [km {$deffrom} - {$defto}]"/>
89 </dc:for-each>
90 </dc:context>
91 </basedata>
92 </dc:for-each>
93 </dc:context>
94 </basedata>
95 </dc:call-macro>
96 </dc:macro>
97
98 <dc:macro name="basedata_0_wq">
99 <dc:call-macro name="user-range">
100 <dc:comment comment=" BASEDATA ---------------------------"/>
101 <basedata>
102 <dc:context connection="system">
103 <dc:statement>
104 SELECT id AS prot_id,
105 description AS prot_description
106 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
107 </dc:statement>
108 <dc:for-each>
109 <basedata name="{$prot_description}">
110 <dc:context>
111 <dc:call-macro name="SQL-wst_columns_statement"/>
112 <dc:for-each>
113 <column name="{$prot_column_name}"
114 ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}"
115 factory="wqinterpol"
116 info="{$info} [km {$deffrom} - {$defto}]"/>
117 </dc:for-each>
118 </dc:context>
119 </basedata>
120 </dc:for-each>
121 </dc:context>
122 </basedata>
123 </dc:call-macro>
124 </dc:macro>
125
126 <dc:macro name="basedata_1_additionals_marks">
127 <dc:call-macro name="user-range">
128 <dc:comment comment=".ZUS -------------------------------"/>
129 <additionals>
130 <dc:context connection="system">
131 <dc:statement>
132 SELECT id AS prot_id,
133 description AS prot_description
134 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
135 </dc:statement>
136 <dc:for-each>
137 <additional name="{$prot_description}">
138 <dc:context>
139 <dc:call-macro name="SQL-wst_columns_statement"/>
140 <dc:for-each>
141 <column name="{$prot_column_name}"
142 ids="additionalsmarks-wstv-{$prot_rel_pos}-{$prot_id}"
143 factory="staticwkms"
144 info="{$info} [km {$deffrom} - {$defto}]"/>
145 </dc:for-each>
146 </dc:context></additional>
147 </dc:for-each>
148 </dc:context>
149 </additionals>
150 </dc:call-macro>
151 </dc:macro>
152
153 <dc:macro name="basedata_1_additionals">
154 <dc:call-macro name="user-range">
155 <dc:comment comment=".ZUS -------------------------------"/>
156 <additionals>
157 <dc:context connection="system">
158 <dc:statement>
159 SELECT id AS prot_id,
160 description AS prot_description
161 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
162 </dc:statement>
163 <dc:for-each>
164 <additional name="{dc:replace($prot_description, 'Zus.Längsschnitte/', '')}">
165 <dc:context>
166 <dc:call-macro name="SQL-wst_columns_statement"/>
167 <dc:for-each>
168 <column name="{$prot_column_name}"
169 ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
170 factory="staticwkms"
171 info="{$info} [km {$deffrom} - {$defto}]"/>
172 </dc:for-each>
173 </dc:context>
174 </additional>
175 </dc:for-each>
176 </dc:context>
177 </additionals>
178 </dc:call-macro>
179 </dc:macro>
180
181 <dc:macro name="basedata_1_additionals-relative_point">
182 <dc:call-macro name="user-range">
183 <dc:comment comment=".ZUS -------------------------------"/>
184 <additionals>
185 <dc:context connection="system">
186 <dc:statement>
187 SELECT id AS prot_id,
188 description AS prot_description
189 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
190 </dc:statement>
191 <dc:for-each>
192 <relativepoint name="{$prot_description}">
193 <dc:context>
194 <dc:call-macro name="SQL-wst_columns_statement"/>
195 <dc:for-each>
196 <column name="{$prot_column_name}"
197 ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
198 factory="staticwkms"
199 info="{$info} [km {$deffrom} - {$defto}]"/>
200 </dc:for-each>
201 </dc:context>
202 </relativepoint>
203 </dc:for-each>
204 </dc:context>
205 </additionals>
206 </dc:call-macro>
207 </dc:macro>
208
209 <dc:macro name="basedata_2_fixations_wqkms">
210 <dc:call-macro name="user-range">
211 <fixations>
212 <dc:context connection="system">
213 <dc:statement>
214 SELECT id AS prot_id,
215 description AS prot_description
216 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
217 ORDER BY prot_description
218 </dc:statement>
219 <dc:for-each>
220 <fixation name="{dc:replace($prot_description, 'Fixierungen/', '')}">
221 <dc:context>
222 <dc:call-macro name="SQL-wst_columns_statement"/>
223 <dc:for-each>
224 <column name="{$prot_column_name}"
225 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
226 factory="wqinterpol"
227 info="{$info} [km {$deffrom} - {$defto}]"/>
228 </dc:for-each>
229 </dc:context>
230 </fixation>
231 </dc:for-each>
232 </dc:context>
233 </fixations>
234 </dc:call-macro>
235 </dc:macro>
236
237 <dc:macro name="basedata_2_fixations">
238 <dc:call-macro name="user-range">
239 <fixations>
240 <dc:context connection="system">
241 <dc:statement>
242 SELECT id AS prot_id,
243 description AS prot_description
244 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
245 ORDER BY prot_description
246 </dc:statement>
247 <dc:for-each>
248 <fixation name="{dc:replace($prot_description, 'Fixierungen/', '')}">
249 <dc:context>
250 <dc:call-macro name="SQL-wst_columns_statement"/>
251 <dc:for-each>
252 <column name="{$prot_column_name}"
253 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
254 factory="staticwkms"
255 info="{$info} [km {$deffrom} - {$defto}]"/>
256 </dc:for-each>
257 </dc:context>
258 </fixation>
259 </dc:for-each>
260 </dc:context>
261 </fixations>
262 </dc:call-macro>
263 </dc:macro>
264
265 <dc:macro name="basedata_2_fixations_relative_point">
266 <dc:call-macro name="user-range">
267 <fixations>
268 <dc:context connection="system">
269 <dc:statement>
270 SELECT id AS prot_id,
271 description AS prot_description
272 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
273 ORDER BY prot_description
274 </dc:statement>
275 <dc:for-each>
276 <relativepoint name="{dc:replace($prot_description, 'Fixierungen/', '')}">
277 <dc:context>
278 <dc:call-macro name="SQL-wst_columns_statement"/>
279 <dc:for-each>
280 <column name="{$prot_column_name}"
281 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
282 factory="staticwkms"
283 info="{$info} [km {$deffrom} - {$defto}]"/>
284 </dc:for-each>
285 </dc:context>
286 </relativepoint>
287 </dc:for-each>
288 </dc:context>
289 </fixations>
290 </dc:call-macro>
291 </dc:macro>
292
293 <dc:macro name="basedata_3_officials">
294 <dc:call-macro name="user-range">
295 <dc:comment comment=".wst -------------------------------"/>
296 <officiallines>
297 <dc:context connection="system">
298 <dc:statement>
299 SELECT id AS prot_id,
300 description AS prot_description
301 FROM wsts WHERE kind = 3 AND river_id = ${river_id}
302 </dc:statement>
303 <dc:for-each>
304 <official name="{$prot_description}">
305 <dc:context>
306 <dc:call-macro name="SQL-wst_columns_statement"/>
307 <dc:for-each>
308 <column name="{$prot_column_name}"
309 ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
310 factory="staticwqkms"
311 info="{$info} [km {$deffrom} - {$defto}]"/>
312 </dc:for-each>
313 </dc:context>
314 </official>
315 </dc:for-each>
316 </dc:context>
317 </officiallines>
318 </dc:call-macro>
319 </dc:macro>
320
321 <dc:macro name="basedata_4_heightmarks-points-relative_points">
322 <dc:call-macro name="user-range">
323 <heightmarks>
324 <dc:context connection="system">
325 <dc:statement>
326 SELECT id AS prot_id,
327 description AS prot_description
328 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
329 </dc:statement>
330 <dc:for-each>
331 <relativepoint name="{$prot_description}">
332 <dc:context>
333 <dc:call-macro name="SQL-wst_columns_statement"/>
334 <dc:for-each>
335 <column name="{$prot_column_name}"
336 ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}"
337 factory="staticwkms"
338 info="{$info} [km {$deffrom} - {$defto}]"/>
339 </dc:for-each>
340 </dc:context>
341 </relativepoint>
342 </dc:for-each>
343 </dc:context>
344 </heightmarks>
345 </dc:call-macro>
346 </dc:macro>
347
348 <dc:macro name="basedata_4_heightmarks-points">
349 <dc:call-macro name="user-range">
350 <heightmarks>
351 <dc:context connection="system">
352 <dc:statement>
353 SELECT id AS prot_id,
354 description AS prot_description
355 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
356 </dc:statement>
357 <dc:for-each>
358 <heightmark name="{dc:replace($prot_description, 'HW-Marken/', '')}">
359 <dc:context>
360 <dc:call-macro name="SQL-wst_columns_statement"/>
361 <dc:for-each>
362 <column name="{$prot_column_name}"
363 ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}"
364 factory="staticwkms"
365 info="{$info} [km {$deffrom} - {$defto}]"/>
366 </dc:for-each>
367 </dc:context>
368 </heightmark>
369 </dc:for-each>
370 </dc:context>
371 </heightmarks>
372 </dc:call-macro>
373 </dc:macro>
374
375 <dc:macro name="basedata_4_heightmarks-wq">
376 <dc:call-macro name="user-range">
377 <heightmarks>
378 <dc:context connection="system">
379 <dc:statement>
380 SELECT id AS prot_id,
381 description AS prot_description
382 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
383 </dc:statement>
384 <dc:for-each>
385 <heightmark name="{$prot_description}">
386 <dc:context>
387 <dc:call-macro name="SQL-wst_columns_statement"/>
388 <dc:for-each>
389 <column name="{$prot_column_name}"
390 ids="heightmarks_annotations-wstv-{$prot_rel_pos}-{$prot_id}"
391 factory="wqinterpol"
392 info="{$info} [km {$deffrom} - {$defto}]"/>
393 </dc:for-each>
394 </dc:context>
395 </heightmark>
396 </dc:for-each>
397 </dc:context>
398 </heightmarks>
399 </dc:call-macro>
400 </dc:macro>
401
402 <dc:macro name="basedata_5_flood-protections_relative_points">
403 <dc:call-macro name="user-range">
404 <flood_protections id="flood-protections-{$river_id}">
405 <dc:context connection="system">
406 <dc:statement>
407 SELECT id AS prot_id,
408 description AS prot_description
409 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
410 </dc:statement>
411 <dc:for-each>
412 <relativepoint name="{$prot_description}"
413 db-id="{$prot_id}"
414 factory="staticwkms">
415 <columns>
416 <dc:context>
417 <dc:call-macro name="SQL-wst_columns_statement"/>
418 <dc:for-each>
419 <column name="{$prot_column_name}"
420 ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}"
421 factory="staticwkms"
422 info="{$info} [km {$deffrom} - {$defto}]"/>
423 </dc:for-each>
424 </dc:context>
425 </columns>
426 </relativepoint>
427 </dc:for-each>
428 </dc:context></flood_protections>
429 </dc:call-macro>
430 </dc:macro>
431
432 <dc:macro name="basedata_5_flood-protections">
433 <dc:call-macro name="user-range">
434 <flood_protections id="flood-protections-{$river_id}">
435 <dc:context connection="system">
436 <dc:statement>
437 SELECT id AS prot_id,
438 description AS prot_description
439 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
440 </dc:statement>
441 <dc:for-each>
442 <flood_protection name="{dc:replace($prot_description, 'HW-Schutzanlagen/', '')}"
443 db-id="{$prot_id}"
444 factory="staticwkms">
445 <dc:context>
446 <dc:call-macro name="SQL-wst_columns_statement"/>
447 <dc:for-each>
448 <column name="{$prot_column_name}"
449 ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}"
450 factory="staticwkms"
451 info="{$info} [km {$deffrom} - {$defto}]"/>
452 </dc:for-each>
453 </dc:context>
454 </flood_protection>
455 </dc:for-each>
456 </dc:context>
457 </flood_protections>
458 </dc:call-macro>
459 </dc:macro>
460
461 <dc:macro name="mainvalues">
462 <mainvalue factory="mainvalue" ids="{$river_id}"/>
463 <wmainvalue factory="mainvalue" ids="{$river_id}:w"/>
464 <qmainvalue factory="mainvalue" ids="{$river_id}:q"/>
465 </dc:macro>
466
467 <dc:macro name="qsectors">
468 <qsector factory="qsectors" ids="{$river_id}"/>
469 </dc:macro>
470
471 <dc:macro name="annotations">
472 <annotation factory="annotations" ids="{$river_id}"/>
473 </dc:macro>
474
475 <dc:macro name="annotations_per_type">
476 <annotations>
477 <dc:context>
478 <annotation name="all_annotations" factory="annotations" ids="{$river_id}"/>
479 <dc:statement>
480 SELECT id AS anno_id,
481 name AS anno_description
482 FROM annotation_types
483 </dc:statement>
484 <dc:for-each>
485 <annotation name="{$anno_description}"
486 factory="annotations"
487 ids="{$river_id}:{$anno_description}"/>
488 </dc:for-each>
489 </dc:context>
490 </annotations>
491 </dc:macro>
492
493 <dc:macro name="cross_sections">
494 <dc:call-macro name="user-range">
495 <cross_sections id="flood-protections-{$river_id}">
496 <dc:context connection="system">
497 <dc:statement>
498 SELECT DISTINCT
499 cs.id AS prot_id,
500 cs.description AS prot_description
501 FROM cross_sections cs
502 JOIN cross_section_lines csl ON csl.cross_section_id = cs.id
503 WHERE cs.river_id = ${river_id}
504 AND csl.km BETWEEN ${fromkm} AND ${tokm}
505 </dc:statement>
506 <dc:for-each>
507 <cross_section name="{$prot_description}"
508 ids="{$prot_id}"
509 factory="crosssections"/>
510 </dc:for-each>
511 </dc:context>
512 </cross_sections>
513 </dc:call-macro>
514 </dc:macro>
515
516 <dc:macro name="hyks">
517 <dc:call-macro name="user-range">
518 <hyks id="hyk-{$river_id}">
519 <dc:context connection="system">
520 <dc:statement>
521 SELECT DISTINCT
522 h.id AS hyk_id,
523 h.description AS hyk_description
524 FROM hyks h
525 JOIN hyk_entries he ON he.hyk_id = h.id
526 WHERE river_id = ${river_id}
527 AND he.km BETWEEN ${fromkm} AND ${tokm}
528 </dc:statement>
529 <dc:for-each>
530 <hyk name="{$hyk_description}" ids="{$hyk_id}" factory="hyk"/>
531 </dc:for-each>
532 </dc:context></hyks>
533 </dc:call-macro>
534 </dc:macro>
535
536 <dc:macro name="flow_velocity_measurements">
537 <dc:call-macro name="user-range">
538 <flowvelocitymeasurement>
539 <dc:context connection="system">
540 <dc:statement>
541 SELECT id AS fvmid,
542 description AS fvmd
543 FROM flow_velocity_measurements WHERE river_id = ${river_id}
544 </dc:statement>
545 <dc:for-each>
546 <flow_velocity_measurement name="{$fvmd}"
547 ids="{$fvmid}"
548 factory="flowvelocity">
549 <dc:context>
550 <dc:statement>
551 SELECT id, description, station, datetime, v, w, q
552 FROM flow_velocity_measure_values
553 WHERE measurements_id = ${fvmid}
554 AND station BETWEEN ${fromkm} AND ${tokm}
555 </dc:statement>
556 <dc:for-each>
557 <measurement_value name="{$description} - {$station} - {$datetime}"
558 ids="{$id}"
559 factory="flowvelocity"/>
560 </dc:for-each>
561 </dc:context>
562 </flow_velocity_measurement>
563 </dc:for-each>
564 </dc:context>
565 </flowvelocitymeasurement>
566 </dc:call-macro>
567 </dc:macro>
568
569 <dc:macro name="sounding-width">
570 <soundings_width>
571 <dc:context>
572 <dc:statement>
573 SELECT id AS bedh_id,
574 year AS bedh_year,
575 description AS bedh_descr
576 FROM bed_height_single WHERE river_id = ${river_id}
577 </dc:statement>
578 <dc:for-each>
579 <height factory="bedheight"
580 ids="bedheight-singlevalues-{$bedh_id}-{$bedh_year}"
581 description="{$bedh_descr}"/>
582 </dc:for-each>
583 </dc:context>
584 </soundings_width>
585 </dc:macro>
586
587 <dc:macro name="morph_width">
588 <morph_width>
589 <dc:context>
590 <dc:statement>
591 SELECT id AS width_id
592 FROM morphologic_width
593 WHERE river_id = ${river_id}
594 </dc:statement>
595 <dc:for-each>
596 <dc:context>
597 <dc:statement>
598 SELECT min(station) AS from,
599 max(station) AS to
600 FROM morphologic_width_values
601 WHERE morphologic_width_id = ${width_id}
602 </dc:statement>
603 <dc:for-each>
604 <morphologic-width name="{$from} - {$to}"
605 ids="{$width_id}"
606 factory="morph-width"/>
607 </dc:for-each>
608 </dc:context>
609 </dc:for-each>
610 </dc:context>
611 </morph_width>
612 </dc:macro>
613
614 <dc:macro name="longitudinal-section-prototype">
615 <dc:call-macro name="basedata_0"/>
616 <dc:call-macro name="basedata_1_additionals"/>
617 <dc:comment comment=" FIXATIONS ---------------------------"/>
618 <dc:call-macro name="basedata_2_fixations"/>
619 <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
620 <dc:call-macro name="basedata_4_heightmarks-points"/>
621 <dc:comment comment=" AMTL LINIEN ---------------------------"/>
622 <dc:call-macro name="basedata_3_officials"/>
623 <dc:call-macro name="basedata_5_flood-protections"/>
624 <dc:call-macro name="annotations_per_type"/>
625 </dc:macro>
626
627 <dc:comment>
628 + River-Node
629 </dc:comment>
630 <dc:attribute name="name" value="${river_name}"/>
631
632 <dc:choose>
633 <dc:when test="dc:contains($parameters, 'recommended')">
634 <dc:comment>
635 Recommendations (client shall load immediately).
636 </dc:comment>
637 <dc:if test="dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
638 <dc:call-macro name="annotations"/>
639 </dc:if>
640 <dc:if test="dc:contains($artifact-outs, 'historical_discharge_wq')">
641 <dc:call-macro name="mainvalues"/>
642 </dc:if>
643 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
644 <dc:call-macro name="cross_sections"/>
645 <dc:call-macro name="hyks"/>
646 </dc:if>
647 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
648 <dc:call-macro name="mainvalues"/>
649 <dc:call-macro name="basedata_2_fixations_wqkms"/>
650 </dc:if>
651 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
652 <dc:call-macro name="mainvalues"/>
653 </dc:if>
654 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
655 <dc:call-macro name="annotations"/>
656 <dc:call-macro name="mainvalues"/>
657 </dc:if>
658 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
659 <dc:call-macro name="qsectors"/>
660 </dc:if>
661 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
662 <dc:call-macro name="annotations"/>
663 </dc:if>
664 <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
665 <dc:call-macro name="annotations"/>
666 </dc:if>
667 <dc:if test="dc:contains($artifact-outs, 'bed_difference_epoch')">
668 <dc:call-macro name="annotations"/>
669 </dc:if>
670 <dc:if test="dc:contains($artifact-outs, 'bed_difference_year')">
671 <dc:call-macro name="annotations"/>
672 </dc:if>
673 <dc:if test="dc:contains($artifact-outs, 'bed_difference_height_year')">
674 <dc:call-macro name="annotations"/>
675 </dc:if>
676 </dc:when>
677 <dc:otherwise>
678 <dc:comment>
679 Non - Recommendations.
680 </dc:comment>
681 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
682 <dc:call-macro name="basedata_0"/>
683 <dc:call-macro name="basedata_1_additionals"/>
684 <dc:call-macro name="basedata_2_fixations"/>
685 <dc:call-macro name="basedata_3_officials"/>
686 <dc:call-macro name="basedata_4_heightmarks-points"/>
687 <dc:call-macro name="cross_sections"/>
688 <dc:call-macro name="hyks"/>
689 </dc:if>
690 <!--dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
691 <dc:call-macro name="basedata_0_wq"/>
692 <dc:call-macro name="basedata_4_heightmarks-wq"/>
693 </dc:if-->
694 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')) or (dc:contains($artifact-outs, 'discharge_longitudinal_section'))">
695 <dc:call-macro name="longitudinal-section-prototype"/>
696 </dc:if>
697 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
698 <dc:call-macro name="mainvalues"/>
699 <dc:call-macro name="basedata_2_fixations_relative_point"/>
700 <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
701 <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
702 </dc:if>
703 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
704 <dc:call-macro name="annotations"/>
705 <!--dc:call-macro name="basedata_0"/-->
706 <dc:call-macro name="basedata_1_additionals-relative_point"/>
707 <dc:comment comment=" FIXATIONS ---------------------------"/>
708 <dc:call-macro name="basedata_2_fixations_relative_point"/>
709 <dc:comment comment=" HOEHENMARKEN ---------------------------"/>
710 <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/>
711 <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
712 </dc:if>
713 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
714 <dc:call-macro name="basedata_0_wq"/>
715 <dc:call-macro name="basedata_1_additionals_marks"/>
716 <dc:call-macro name="basedata_2_fixations_wqkms"/>
717 <dc:call-macro name="basedata_3_officials"/>
718 <dc:call-macro name="basedata_4_heightmarks-points"/>
719 <dc:call-macro name="basedata_5_flood-protections_relative_points"/>
720 </dc:if>
721 <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
722 </dc:if>
723 <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
724 <dc:call-macro name="annotations"/>
725 </dc:if>
726 <dc:if test="dc:contains($artifact-outs, 'map')">
727 <dc:call-macro name="flood-map-complete"/>
728 </dc:if>
729 <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
730 <dc:call-macro name="annotations_per_type"/>
731 <dc:call-macro name="flow_velocity_measurements"/>
732 </dc:if>
733 <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
734 <dc:call-macro name="annotations_per_type"/>
735 </dc:if>
736 <dc:if test="dc:contains($artifact-outs, 'sedimentload_ls')">
737 <dc:call-macro name="annotations_per_type"/>
738 <dc:call-macro name="morph_width"/>
739 </dc:if>
740 <dc:comment>
741 MINFO bedheight middle
742 </dc:comment>
743 <dc:if test="dc:contains($artifact-outs, 'bedheight_middle')">
744 <dc:call-macro name="sounding-width"/>
745 <dc:call-macro name="basedata_0"/>
746 <dc:call-macro name="basedata_1_additionals"/>
747 <dc:call-macro name="basedata_2_fixations"/>
748 <dc:call-macro name="basedata_3_officials"/>
749 <dc:call-macro name="annotations_per_type"/>
750 </dc:if>
751 <dc:if test="dc:contains($artifact-outs, 'bed_difference_year') or
752 dc:contains($artifact-outs, 'bed_difference_epoch')">
753 <dc:call-macro name="basedata_0"/>
754 <dc:call-macro name="basedata_1_additionals"/>
755 <dc:call-macro name="basedata_2_fixations"/>
756 <dc:call-macro name="basedata_3_officials"/>
757 <dc:call-macro name="annotations_per_type"/>
758 <dc:call-macro name="morph_width"/>
759 </dc:if>
760 <dc:comment comment="--- non-recommendations---"/>
761 </dc:otherwise>
762 </dc:choose>
763
764 <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
765
766 <!-- base data -->
767 <dc:call-macro name="basedata_0"/>
768
769 <!-- extra-longitudinal-sections -->
770 <dc:call-macro name="basedata_1_additionals"/>
771
772 <!-- fixations -->
773 <dc:call-macro name="basedata_2_fixations"/>
774
775 <!-- flood water marks-->
776 <dc:call-macro name="basedata_4_heightmarks-points"/>
777
778 <!-- flood protection -->
779 <dc:call-macro name="basedata_5_flood-protections"/>
780
781 </dc:if>
782
783 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))">
784 <discharge_table_nn>
785 <discharge_table_gauge>
786 <dc:context>
787 <dc:statement>
788 SELECT id AS gauge_id,
789 name AS gauge_name
790 FROM gauges WHERE river_id = ${river_id}
791 </dc:statement>
792 <dc:for-each>
793 <gauge name="{$gauge_name}"
794 db-id="{$gauge_id}"
795 factory="gaugedischarge"
796 from="{$g_start}"
797 to="{$g_stop}"
798 ids="{$gauge_name}"/>
799 <dc:comment>
800 <!--
801 <gauge>
802 <dc:attribute name="name" value="${gauge_name}"/>
803 <dc:attribute name="db-id" value="${gauge_id}"/>
804 <dc:context>
805 <dc:statement>
806 SELECT description AS gauge_desc,
807 d.id AS discharge_id,
808 ti.start_time AS g_start,
809 ti.stop_time AS g_stop
810 FROM discharge_tables d JOIN time_intervals ti
811 ON d.time_interval_id = ti.id
812 WHERE d.gauge_id = ${gauge_id} AND d.kind = 1
813 </dc:statement>
814 <dc:for-each>
815 <historical>
816 <dc:attribute name="name" value="${gauge_desc}"/>
817 <dc:attribute name="factory" value="gaugedischarge"/>
818 <dc:attribute name="from" value="${g_start}"/>
819 <dc:attribute name="to" value="${g_stop}"/>
820 <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}"/>
821 </historical>
822 </dc:for-each>
823 </dc:context>
824 </gauge>
825 -->
826 </dc:comment>
827 </dc:for-each>
828 </dc:context>
829 </discharge_table_gauge>
830 </discharge_table_nn>
831
832 <dc:call-macro name="basedata_2_fixations_wqkms"/>
833
834 <dc:call-macro name="basedata_5_flood-protections"/>
835
836 <!-- former waterlevels -->
837 <dc:call-macro name="basedata_0"/>
838
839 <dc:call-macro name="basedata_1_additionals"/>
840
841 <!-- former flood-water-marks -->
842 <dc:call-macro name="basedata_4_heightmarks-points"/>
843 <computed_discharge_curve>
844 <dc:call-macro name="mainvalues"/>
845 </computed_discharge_curve>
846 </dc:if>
847
848 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve') and not (dc:contains($parameters, 'recommended'))">
849 <discharge_table_nn>
850 <discharge_table_gauge>
851 <dc:context>
852 <dc:statement>
853 SELECT id AS gauge_id,
854 name AS gauge_name
855 FROM gauges WHERE river_id = ${river_id}
856 </dc:statement>
857 <dc:for-each>
858 <gauge name="{$gauge_name}"
859 db-id="{$gauge_id}"
860 factory="gaugedischarge"
861 from="{$g_start}"
862 to="{$g_stop}"
863 ids="{$gauge_name}"/>
864 </dc:for-each>
865 </dc:context>
866 </discharge_table_gauge>
867 </discharge_table_nn>
868 </dc:if>
869
870 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'floodmap-hws')">
871 <dc:choose>
872 <dc:when test="dc:contains($parameters, 'recommended')">
873 <dc:call-macro name="flood-map-recommended"/>
874 </dc:when>
875 <dc:when test="dc:contains($parameters, 'dem')">
876 <dc:call-macro name="flood-map-dem"/>
877 </dc:when>
878 <dc:when test="dc:contains($parameters, 'hws')">
879 <hws>
880 <dc:call-macro name="flood-map-hws-lines"/>
881 <dc:call-macro name="flood-map-hws-points"/>
882 </hws>
883 </dc:when>
884 <dc:otherwise>
885 <dc:call-macro name="flood-map-complete"/>
886 </dc:otherwise>
887 </dc:choose>
888
889 <dc:macro name="flood-map-recommended">
890 <dc:comment>
891 FIXME: Following two macros look identical to me.
892 </dc:comment>
893 <kilometrage>
894 <riveraxis factory="riveraxis" ids="{$river_id}"/>
895 </kilometrage>
896 <rastermap>
897 <background factory="wmsbackground" ids="{$river_id}"/>
898 </rastermap>
899 </dc:macro>
900
901 <dc:macro name="flood-map-dem">
902 <dems>
903 <dc:context>
904 <dc:statement>
905 SELECT d.id AS dem_id,
906 r.a AS dem_lower,
907 r.b AS dem_upper,
908 d.name AS name,
909 t.start_time AS start_time,
910 t.stop_time AS stop_time,
911 'Projektion: ' || d.projection || '$' ||
912 'Rasterweite: ' || d.resolution || 'm$' ||
913 'Format: ' || d.format || '$' ||
914 'Zeitraum: '
915 AS info
916 FROM dem d
917 JOIN ranges r ON d.range_id = r.id
918 LEFT JOIN time_intervals t ON d.time_interval_id = t.id
919 WHERE d.river_id = ${river_id}
920 </dc:statement>
921 <dc:for-each>
922 <dem factory="demfactory" ids="{$dem_id}" name="{$name}"
923 info="{dc:replace($info, '$', '&lt;BR&gt;')}{dc:date-format('yyyy', $start_time)} - {dc:date-format('yyyy', $stop_time)}"/>
924 </dc:for-each>
925 </dc:context>
926 </dems>
927 </dc:macro>
928
929 <dc:macro name="filter_hws_ddg">
930 <dc:macro name="durchlass_damm_graben">
931 <dc:macro name="ddg_factory">
932 <dc:for-each>
933 <hws factory="hwsfactory" name="{$hws_name}"/>
934 </dc:for-each>
935 </dc:macro>
936
937 <dc:filter expr="$hws_kind=1">
938 <dc:if test="dc:has-result()">
939 <Durchlass><dc:call-macro name="ddg_factory"/></Durchlass>
940 </dc:if>
941 </dc:filter>
942
943 <dc:filter expr="$hws_kind=2">
944 <dc:if test="dc:has-result()">
945 <Damm><dc:call-macro name="ddg_factory"/></Damm>
946 </dc:if>
947 </dc:filter>
948
949 <dc:filter expr="$hws_kind=3">
950 <dc:if test="dc:has-result()">
951 <Graben><dc:call-macro name="ddg_factory"/></Graben>
952 </dc:if>
953 </dc:filter>
954 </dc:macro>
955
956 <dc:filter expr="$hws_official=1">
957 <dc:if test="dc:has-result()">
958 <official>
959 <dc:call-macro name="durchlass_damm_graben"/>
960 </official>
961 </dc:if>
962 </dc:filter>
963
964 <dc:filter expr="$hws_official=0">
965 <dc:if test="dc:has-result()">
966 <inofficial>
967 <dc:call-macro name="durchlass_damm_graben"/>
968 </inofficial>
969 </dc:if>
970 </dc:filter>
971 </dc:macro>
972
973 <dc:macro name="flood-map-hws-lines">
974 <dc:context>
975 <dc:statement>
976 SELECT DISTINCT
977 name AS hws_name,
978 official AS hws_official,
979 kind_id AS hws_kind
980 FROM hws_lines
981 WHERE river_id = ${river_id}
982 </dc:statement>
983 <dc:if test="dc:has-result()">
984 <lines>
985 <dc:call-macro name="filter_hws_ddg"/>
986 </lines>
987 </dc:if>
988 </dc:context>
989 </dc:macro>
990
991 <dc:macro name="flood-map-hws-points">
992 <dc:context>
993 <dc:statement>
994 SELECT DISTINCT
995 name AS hws_name,
996 official AS hws_official,
997 kind_id AS hws_kind
998 FROM hws_points
999 WHERE river_id = ${river_id}
1000 </dc:statement>
1001 <dc:if test="dc:has-result()">
1002 <points>
1003 <dc:call-macro name="filter_hws_ddg"/>
1004 </points>
1005 </dc:if>
1006 </dc:context>
1007 </dc:macro>
1008
1009 <dc:macro name="flood-map-km">
1010 <dc:context>
1011 <dc:statement>
1012 SELECT DISTINCT 1 FROM river_axes_km WHERE river_id = ${river_id}
1013 </dc:statement>
1014 <dc:for-each>
1015 <kilometrage factory="wmskmfactory" ids="{$river_id}"/>
1016 </dc:for-each>
1017 </dc:context>
1018 </dc:macro>
1019
1020 <dc:macro name="flood-map-qps">
1021 <dc:context>
1022 <dc:comment>Grab only the actual first</dc:comment>
1023 <dc:statement>
1024 SELECT DISTINCT
1025 cs.kind_id AS kind_id,
1026 ck.name AS kind_name
1027 FROM cross_section_tracks cs
1028 JOIN cross_section_track_kinds ck on cs.kind_id = ck.id
1029 WHERE river_id = ${river_id}
1030 AND kind_id=1
1031 </dc:statement>
1032 <dc:if test="dc:has-result()">
1033 <dc:for-each>
1034 <actual description="{$kind_name}"
1035 factory="wmsqpsfactory"
1036 ids="{$river_id};{$kind_name};{$kind_id}"/>
1037 </dc:for-each>
1038 </dc:if>
1039 </dc:context>
1040 <dc:context>
1041 <dc:comment>Now the other tracks</dc:comment>
1042 <dc:statement>
1043 SELECT DISTINCT
1044 cs.kind_id AS kind_id,
1045 ck.name AS kind_name,
1046 cs.name AS layer_name
1047 FROM cross_section_tracks cs
1048 JOIN cross_section_track_kinds ck on cs.kind_id = ck.id
1049 WHERE river_id = ${river_id}
1050 AND kind_id=0
1051 </dc:statement>
1052 <dc:if test="dc:has-result()">
1053 <other>
1054 <dc:for-each>
1055 <misc-qps description="{$layer_name}"
1056 factory="wmsqpsfactory"
1057 ids="{$river_id};{$layer_name};{$kind_id}"/>
1058 </dc:for-each>
1059 </other>
1060 </dc:if>
1061 </dc:context>
1062 </dc:macro>
1063
1064 <dc:macro name="flood-map-riveraxis">
1065 <dc:context>
1066 <dc:statement>
1067 SELECT DISTINCT
1068 ax.kind_id AS kind_id,
1069 ak.name AS kind_name
1070 FROM river_axes ax
1071 JOIN axis_kinds ak on ax.kind_id = ak.id
1072 WHERE river_id = ${river_id}
1073 AND kind_id=1
1074 </dc:statement>
1075 <dc:if test="dc:has-result()">
1076 <dc:for-each>
1077 <actual description="{$kind_name}"
1078 ids="{$river_id};{$kind_name};{$kind_id}"
1079 factory="riveraxis"/>
1080 </dc:for-each>
1081 </dc:if>
1082 </dc:context>
1083 <dc:context>
1084 <dc:statement>
1085 SELECT DISTINCT
1086 ak.name AS kind_name,
1087 ax.kind_id AS kind_id,
1088 ax.name AS layer_name
1089 FROM river_axes ax
1090 JOIN axis_kinds ak on ax.kind_id = ak.id
1091 WHERE river_id = ${river_id}
1092 AND kind_id &lt;&gt; 1
1093 </dc:statement>
1094 <dc:if test="dc:has-result()">
1095 <other>
1096 <dc:for-each>
1097 <misc-axis description="{$layer_name}"
1098 ids="{$river_id};{$layer_name};{$kind_id}"
1099 factory="riveraxis"/>
1100 </dc:for-each>
1101 </other>
1102 </dc:if>
1103 </dc:context>
1104 </dc:macro>
1105
1106 <dc:macro name="flood-map-hydr-boundaries-state">
1107 <dc:context>
1108 <dc:statement>
1109 SELECT DISTINCT
1110 name
1111 FROM hydr_boundaries
1112 WHERE river_id = ${river_id}
1113 AND kind = 2
1114 </dc:statement>
1115 <dc:for-each>
1116 <line factory="wmshydrboundariesfactory"
1117 ids="{$river_id};{$name};2"
1118 name="{$name}"/>
1119 </dc:for-each>
1120 </dc:context>
1121 <dc:context>
1122 <dc:statement>
1123 SELECT DISTINCT
1124 name
1125 FROM hydr_boundaries_poly
1126 WHERE river_id = ${river_id}
1127 AND kind = 2
1128 </dc:statement>
1129 <dc:for-each>
1130 <line factory="wmshydrboundariespolyfactory"
1131 ids="{$river_id};{$name};2"
1132 name="{$name}"/>
1133 </dc:for-each>
1134 </dc:context>
1135 </dc:macro>
1136
1137 <dc:macro name="flood-map-hydr-boundaries-lines">
1138 <dc:context>
1139 <dc:statement>
1140 SELECT DISTINCT
1141 name
1142 FROM hydr_boundaries
1143 WHERE river_id = ${river_id}
1144 AND kind = 1
1145 </dc:statement>
1146 <dc:comment> What about all other line kinds?</dc:comment>
1147 <dc:if test="dc:has-result()">
1148 <lines>
1149 <dc:for-each>
1150 <line factory="wmshydrboundariesfactory"
1151 ids="{$river_id};{$name};1"
1152 name="{$name}"/>
1153 </dc:for-each>
1154 </lines>
1155 </dc:if>
1156 </dc:context>
1157 </dc:macro>
1158
1159 <dc:macro name="flood-map-hydr-boundaries-poly">
1160 <dc:context>
1161 <dc:statement>
1162 SELECT DISTINCT
1163 b.sectie AS sectie_id,
1164 sk.name AS sectie
1165 FROM hydr_boundaries_poly b
1166 JOIN sectie_kinds sk ON b.sectie = sk.id
1167 WHERE b.river_id = ${river_id}
1168 AND b.kind = 1
1169 </dc:statement>
1170 <dc:if test="dc:has-result()">
1171 <sobek_areas>
1172 <dc:for-each>
1173 <boundary name="{$sectie}"
1174 factory="wmshydrboundariespolyfactory"
1175 ids="{$river_id};{$sectie};1;{$sectie_id};-1"/>
1176 </dc:for-each>
1177 </sobek_areas>
1178 </dc:if>
1179 </dc:context>
1180 <dc:context>
1181 <dc:statement>
1182 SELECT DISTINCT
1183 b.sobek AS sobek_id,
1184 sk.name AS sobek
1185 FROM hydr_boundaries_poly b
1186 JOIN sobek_kinds sk ON b.sobek = sk.id
1187 WHERE b.river_id = ${river_id}
1188 AND b.kind = 1
1189 </dc:statement>
1190 <dc:if test="dc:has-result()">
1191 <sobek_flooded>
1192 <dc:for-each>
1193 <boundary name="{$sobek}"
1194 factory="wmshydrboundariespolyfactory"
1195 ids="{$river_id};{$sobek};1;-1;{$sobek_id}"/>
1196 </dc:for-each>
1197 </sobek_flooded>
1198 </dc:if>
1199 </dc:context>
1200 <dc:context>
1201 <dc:statement>
1202 SELECT DISTINCT
1203 b.name AS name
1204 FROM hydr_boundaries_poly b
1205 WHERE b.river_id = ${river_id}
1206 AND b.kind = 1
1207 AND b.sobek IS NULL
1208 AND b.sectie is NULL
1209 </dc:statement>
1210 <dc:for-each>
1211 <boundary name="{$name}"
1212 factory="wmshydrboundariespolyfactory"
1213 ids="{$river_id};{$name}"/>
1214 </dc:for-each>
1215 </dc:context>
1216 </dc:macro>
1217
1218 <dc:macro name="flood-map-hydr-boundaries">
1219 <bfg_model>
1220 <areas>
1221 <dc:call-macro name="flood-map-hydr-boundaries-poly"/>
1222 </areas>
1223 <dc:call-macro name="flood-map-hydr-boundaries-lines"/>
1224 </bfg_model>
1225 <federal>
1226 <dc:call-macro name="flood-map-hydr-boundaries-state"/>
1227 </federal>
1228 </dc:macro>
1229
1230 <dc:macro name="flood-map-floodplain">
1231 <floodplain>
1232 <dc:context>
1233 <dc:statement>
1234 SELECT DISTINCT
1235 fp.kind_id AS kind_id,
1236 flk.name AS kind_name
1237 FROM floodplain fp
1238 JOIN floodplain_kinds flk on fp.kind_id = flk.id
1239 WHERE river_id = ${river_id}
1240 AND kind_id=1
1241 </dc:statement>
1242 <dc:if test="dc:has-result()">
1243 <dc:for-each>
1244 <floody factory="wmsfloodplainfactory"
1245 description="{$kind_name}"
1246 ids="{$river_id};{$kind_name};{$kind_id}"/>
1247 </dc:for-each>
1248 </dc:if>
1249 </dc:context>
1250 <dc:context>
1251 <dc:statement>
1252 SELECT DISTINCT
1253 flk.name AS kind_name,
1254 fp.kind_id AS kind_id,
1255 fp.name AS layer_name
1256 FROM floodplain fp
1257 JOIN floodplain_kinds flk on fp.kind_id = flk.id
1258 WHERE river_id = ${river_id}
1259 AND kind_id &lt;&gt; 1
1260 </dc:statement>
1261 <dc:if test="dc:has-result()">
1262 <other>
1263 <dc:for-each>
1264 <floody factory="wmsfloodplainfactory"
1265 description="{$layer_name}"
1266 ids="{$river_id};{$layer_name};{$kind_id}"/>
1267 </dc:for-each>
1268 </other>
1269 </dc:if>
1270 </dc:context>
1271 </floodplain>
1272 </dc:macro>
1273
1274 <dc:macro name="hwslines_by_kind">
1275 <dc:comment>
1276 Call from a context where fed_name hws_kind hws_name and river_id is
1277 availble
1278 </dc:comment>
1279
1280 <dc:macro name="hwslines_by_kind_factory">
1281 <dc:for-each>
1282 <hws factory="wmshwslinesfactory"
1283 ids="{$river_id};{$hws_name}"
1284 name="{$hws_name}"/>
1285 </dc:for-each>
1286 </dc:macro>
1287
1288 <dc:filter expr="$hws_kind=1">
1289 <dc:if test="dc:has-result()">
1290 <Durchlass>
1291 <dc:call-macro name="hwslines_by_kind_factory"/>
1292 </Durchlass>
1293 </dc:if>
1294 </dc:filter>
1295
1296 <dc:filter expr="$hws_kind=2">
1297 <dc:if test="dc:has-result()">
1298 <Damm>
1299 <dc:call-macro name="hwslines_by_kind_factory"/>
1300 </Damm>
1301 </dc:if>
1302 </dc:filter>
1303
1304 <dc:filter expr="$hws_kind=3">
1305 <dc:if test="dc:has-result()">
1306 <Graben>
1307 <dc:call-macro name="hwslines_by_kind_factory"/>
1308 </Graben>
1309 </dc:if>
1310 </dc:filter>
1311 </dc:macro>
1312
1313 <dc:macro name="hwslines">
1314 <hws_lines>
1315 <official>
1316 <dc:context>
1317 <dc:statement>
1318 SELECT DISTINCT
1319 fs.name AS fed_name,
1320 fs.id AS fed_id
1321 FROM hws_lines hws
1322 JOIN fed_states fs ON hws.fed_state_id = fs.id
1323 WHERE river_id = ${river_id}
1324 AND hws.official=1
1325 </dc:statement>
1326 <dc:for-each>
1327 <dc:context>
1328 <dc:statement>
1329 SELECT DISTINCT
1330 name AS hws_name,
1331 kind_id AS hws_kind
1332 FROM hws_lines
1333 WHERE river_id = ${river_id}
1334 AND official=1
1335 AND fed_state_id = ${fed_id} ORDER BY name
1336 </dc:statement>
1337 <fedstate description="{$fed_name}">
1338 <dc:call-macro name="hwslines_by_kind"/>
1339 </fedstate>
1340 </dc:context>
1341 </dc:for-each>
1342 </dc:context>
1343 <dc:context>
1344 <dc:statement>
1345 SELECT distinct
1346 name AS hws_name,
1347 kind_id AS hws_kind
1348 FROM hws_lines
1349 WHERE river_id = ${river_id}
1350 AND official=1
1351 AND fed_state_id IS NULL
1352 ORDER BY name
1353 </dc:statement>
1354 <hws_fed_unknown>
1355 <dc:call-macro name="hwslines_by_kind"/>
1356 </hws_fed_unknown>
1357 </dc:context>
1358 </official>
1359 <inofficial>
1360 <dc:context>
1361 <dc:statement>
1362 SELECT DISTINCT
1363 fs.name AS fed_name,
1364 fs.id AS fed_id
1365 FROM hws_lines hws
1366 JOIN fed_states fs ON hws.fed_state_id = fs.id
1367 WHERE river_id = ${river_id}
1368 AND hws.official=0
1369 </dc:statement>
1370 <dc:for-each>
1371 <dc:context>
1372 <dc:statement>
1373 SELECT DISTINCT
1374 name AS hws_name,
1375 kind_id AS hws_kind
1376 FROM hws_lines
1377 WHERE river_id = ${river_id}
1378 AND official=0
1379 AND fed_state_id = ${fed_id} ORDER BY name
1380 </dc:statement>
1381 <fedstate description="{$fed_name}">
1382 <dc:call-macro name="hwslines_by_kind"/>
1383 </fedstate>
1384 </dc:context>
1385 </dc:for-each>
1386 </dc:context>
1387 <dc:context>
1388 <dc:statement>
1389 SELECT distinct
1390 name AS hws_name,
1391 kind_id AS hws_kind
1392 FROM hws_lines
1393 WHERE river_id = ${river_id}
1394 AND official=0
1395 AND fed_state_id IS NULL ORDER BY name
1396 </dc:statement>
1397 <hws_fed_unknown>
1398 <dc:call-macro name="hwslines_by_kind"/>
1399 </hws_fed_unknown>
1400 </dc:context>
1401 </inofficial>
1402 </hws_lines>
1403 </dc:macro>
1404
1405 <dc:macro name="hwspoints_by_kind">
1406 <dc:comment>
1407 Call from a context where fed_name hws_kind hws_name and river_id is
1408 availble
1409 </dc:comment>
1410
1411 <dc:macro name="hwspoints_by_kind_factory">
1412 <dc:for-each>
1413 <hws factory="wmshwspointsfactory"
1414 ids="{$river_id};{$hws_name}"
1415 name="{$hws_name}"/>
1416 </dc:for-each>
1417 </dc:macro>
1418
1419 <dc:filter expr="$hws_kind=1">
1420 <dc:if test="dc:has-result()">
1421 <Durchlass>
1422 <dc:call-macro name="hwspoints_by_kind_factory"/>
1423 </Durchlass>
1424 </dc:if>
1425 </dc:filter>
1426
1427 <dc:filter expr="$hws_kind=2">
1428 <dc:if test="dc:has-result()">
1429 <Damm>
1430 <dc:call-macro name="hwspoints_by_kind_factory"/>
1431 </Damm>
1432 </dc:if>
1433 </dc:filter>
1434
1435 <dc:filter expr="$hws_kind=3">
1436 <dc:if test="dc:has-result()">
1437 <Graben>
1438 <dc:call-macro name="hwspoints_by_kind_factory"/>
1439 </Graben>
1440 </dc:if>
1441 </dc:filter>
1442 </dc:macro>
1443
1444 <dc:macro name="hwspoints">
1445 <hws_points>
1446 <official>
1447 <dc:context>
1448 <dc:statement>
1449 SELECT DISTINCT
1450 fs.name AS fed_name,
1451 fs.id AS fed_id
1452 FROM hws_points hws
1453 JOIN fed_states fs ON hws.fed_state_id = fs.id
1454 WHERE river_id = ${river_id}
1455 AND hws.official=1
1456 </dc:statement>
1457 <dc:for-each>
1458 <dc:context>
1459 <dc:statement>
1460 SELECT DISTINCT
1461 name AS hws_name,
1462 kind_id AS hws_kind
1463 FROM hws_points
1464 WHERE river_id = ${river_id}
1465 AND official=1
1466 AND fed_state_id = ${fed_id} ORDER BY name
1467 </dc:statement>
1468 <fedstate description="{$fed_name}">
1469 <dc:call-macro name="hwspoints_by_kind"/>
1470 </fedstate>
1471 </dc:context>
1472 </dc:for-each>
1473 </dc:context>
1474 <dc:context>
1475 <dc:statement>
1476 SELECT distinct
1477 name AS hws_name,
1478 kind_id AS hws_kind
1479 FROM hws_points
1480 WHERE river_id = ${river_id}
1481 AND official=1
1482 AND fed_state_id IS NULL
1483 ORDER BY name
1484 </dc:statement>
1485 <hws_fed_unknown>
1486 <dc:call-macro name="hwspoints_by_kind"/>
1487 </hws_fed_unknown>
1488 </dc:context>
1489 </official>
1490 <inofficial>
1491 <dc:context>
1492 <dc:statement>
1493 SELECT DISTINCT
1494 fs.name AS fed_name,
1495 fs.id AS fed_id
1496 FROM hws_points hws
1497 JOIN fed_states fs ON hws.fed_state_id = fs.id
1498 WHERE river_id = ${river_id}
1499 AND hws.official=0
1500 </dc:statement>
1501 <dc:for-each>
1502 <dc:context>
1503 <dc:statement>
1504 SELECT DISTINCT
1505 name AS hws_name,
1506 kind_id AS hws_kind
1507 FROM hws_points
1508 WHERE river_id = ${river_id}
1509 AND official=0
1510 AND fed_state_id = ${fed_id} ORDER BY name
1511 </dc:statement>
1512 <fedstate description="{$fed_name}">
1513 <dc:call-macro name="hwspoints_by_kind"/>
1514 </fedstate>
1515 </dc:context>
1516 </dc:for-each>
1517 </dc:context>
1518 <dc:context>
1519 <dc:statement>
1520 SELECT distinct
1521 name AS hws_name,
1522 kind_id AS hws_kind
1523 FROM hws_points
1524 WHERE river_id = ${river_id}
1525 AND official=0
1526 AND fed_state_id IS NULL ORDER BY name
1527 </dc:statement>
1528 <hws_fed_unknown>
1529 <dc:call-macro name="hwspoints_by_kind"/>
1530 </hws_fed_unknown>
1531 </dc:context>
1532 </inofficial>
1533 </hws_points>
1534 </dc:macro>
1535
1536 <dc:macro name="flood-map-buildings">
1537 <dc:context>
1538 <dc:statement>
1539 SELECT DISTINCT
1540 b.kind_id AS building_kind_id,
1541 bk.name AS building_kind
1542 FROM buildings b
1543 JOIN building_kinds bk ON b.kind_id = bk.id
1544 WHERE b.river_id = ${river_id}
1545 AND b.kind_id &lt;&gt; 0
1546 </dc:statement>
1547 <dc:for-each>
1548 <buildings description="{$building_kind}"
1549 factory="wmsbuildingsfactory"
1550 ids="{$river_id};{$building_kind};{$building_kind_id}"/>
1551 </dc:for-each>
1552 </dc:context>
1553 <dc:context>
1554 <dc:statement>
1555 SELECT DISTINCT
1556 b.name AS building_name,
1557 bk.name AS building_kind,
1558 b.kind_id AS building_kind_id
1559 FROM buildings b
1560 JOIN building_kinds bk ON b.kind_id = bk.id
1561 WHERE river_id = ${river_id}
1562 AND kind_id = 0
1563 </dc:statement>
1564 <dc:if test="dc:has-result()">
1565 <other>
1566 <dc:for-each>
1567 <buildings description="{$building_name}"
1568 factory="wmsbuildingsfactory"
1569 ids="{$river_id};{$building_name}"/>
1570 </dc:for-each>
1571 </other>
1572 </dc:if>
1573 </dc:context>
1574 <dc:context>
1575 <dc:statement>
1576 SELECT DISTINCT
1577 j.kind_id AS jetty_kind_id,
1578 jk.name AS jetty_kind
1579 FROM jetties j
1580 JOIN jetty_kinds jk ON j.kind_id = jk.id
1581 WHERE river_id = ${river_id}
1582 </dc:statement>
1583 <dc:if test="dc:has-result()">
1584 <jetties>
1585 <dc:for-each>
1586 <jetty description="{$jetty_kind}"
1587 factory="wmsjettiesfactory"
1588 ids="{$river_id};{$jetty_kind};{$jetty_kind_id}"/>
1589 </dc:for-each>
1590 </jetties>
1591 </dc:if>
1592 </dc:context>
1593 </dc:macro>
1594
1595 <dc:macro name="flood-map-fixpoints">
1596 <dc:context>
1597 <dc:statement>
1598 SELECT name AS name
1599 FROM fixpoints WHERE river_id = ${river_id} GROUP BY name
1600 </dc:statement>
1601 <dc:for-each>
1602 <fixpoints factory="wmsfixpointsfactory"
1603 ids="{$river_id};{$name}"/>
1604 </dc:for-each>
1605 </dc:context>
1606 </dc:macro>
1607
1608 <dc:macro name="flood-map-gaugelocations">
1609 <gauge_points factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelpunkte (WSV)"/>
1610 <gauge_names factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelnamen;Pegelnamen (WSV)"/>
1611 <gauge_level factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelwasserstand;Aktueller Wasserstand (WSV)"/>
1612 <gauge_tendency factory="externalwmsfactory" ids="http://www.pegelonline.wsv.de/webservices/gis/wms;TendenzWasserstand;Tendenz des Wasserstands (WSV)"/>
1613 </dc:macro>
1614
1615 <dc:macro name="flood-map-uesk">
1616 <dc:context>
1617 <dc:statement>
1618 SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
1619 </dc:statement>
1620 <dc:if test="dc:has-result()">
1621 <uesk>
1622 <calculations>
1623 <dc:context>
1624 <dc:statement>
1625 SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
1626 AND (kind = 112 OR kind = 111)
1627 </dc:statement>
1628 <dc:if test="dc:has-result()">
1629 <current>
1630 <dc:context>
1631 <dc:statement>
1632 SELECT DISTINCT name AS name
1633 FROM floodmaps
1634 WHERE river_id = ${river_id} AND kind = 111
1635 </dc:statement>
1636 <dc:if test="dc:has-result()">
1637 <bfg>
1638 <dc:for-each>
1639 <floodmaps factory="wmsfloodmapsfactory"
1640 ids="{$river_id};{$name}"
1641 name="{$name}"/>
1642 </dc:for-each>
1643 </bfg>
1644 </dc:if>
1645 </dc:context>
1646 <dc:context>
1647 <dc:statement>
1648 SELECT DISTINCT name AS name
1649 FROM floodmaps
1650 WHERE river_id = ${river_id} AND kind = 112
1651 </dc:statement>
1652 <dc:if test="dc:has-result()">
1653 <federal>
1654 <dc:for-each>
1655 <floodmaps factory="wmsfloodmapsfactory"
1656 ids="{$river_id};{$name}"
1657 name="{$name}"/>
1658 </dc:for-each>
1659 </federal>
1660 </dc:if>
1661 </dc:context>
1662 </current>
1663 </dc:if>
1664 </dc:context>
1665 <dc:context>
1666 <dc:statement>
1667 SELECT DISTINCT 1 from floodmaps where river_id = ${river_id}
1668 AND (kind = 122 OR kind = 121)
1669 </dc:statement>
1670 <dc:if test="dc:has-result()">
1671 <potential>
1672 <dc:context>
1673 <dc:statement>
1674 SELECT DISTINCT name AS name
1675 FROM floodmaps
1676 WHERE river_id = ${river_id} AND kind = 121
1677 </dc:statement>
1678 <dc:if test="dc:has-result()">
1679 <bfg>
1680 <dc:for-each>
1681 <floodmaps factory="wmsfloodmapsfactory"
1682 ids="{$river_id};{$name}"
1683 name="{$name}"/>
1684 </dc:for-each>
1685 </bfg>
1686 </dc:if>
1687 </dc:context>
1688 <dc:context>
1689 <dc:statement>
1690 SELECT DISTINCT
1691 name AS name
1692 FROM floodmaps
1693 WHERE river_id = ${river_id} AND kind = 122
1694 </dc:statement>
1695 <dc:if test="dc:has-result()">
1696 <federal>
1697 <dc:for-each>
1698 <floodmaps factory="wmsfloodmapsfactory"
1699 ids="{$river_id};{$name}"
1700 name="{$name}"/>
1701 </dc:for-each>
1702 </federal>
1703 </dc:if>
1704 </dc:context>
1705 </potential>
1706 </dc:if>
1707 </dc:context>
1708 </calculations>
1709 <dc:context>
1710 <dc:statement>
1711 SELECT DISTINCT
1712 source AS source
1713 FROM floodmaps
1714 WHERE river_id = ${river_id} AND kind = 200
1715 </dc:statement>
1716 <dc:if test="dc:has-result()">
1717 <measurements>
1718 <dc:for-each>
1719 <year name="{$source}">
1720 <dc:context>
1721 <dc:statement>
1722 SELECT DISTINCT
1723 name AS name
1724 FROM floodmaps
1725 WHERE river_id = ${river_id} AND kind = 200 AND source =
1726 ${source}
1727 </dc:statement>
1728 <dc:for-each>
1729 <floodmaps factory="wmsfloodmapsfactory"
1730 ids="{$river_id};{$name}"
1731 name="{$name}"/>
1732 </dc:for-each>
1733 </dc:context>
1734 </year>
1735 </dc:for-each>
1736 </measurements>
1737 </dc:if>
1738 </dc:context>
1739 </uesk>
1740 </dc:if>
1741 </dc:context>
1742 </dc:macro>
1743
1744 <dc:macro name="flood-map-routing">
1745 <qps>
1746 <dc:call-macro name="flood-map-qps"/>
1747 </qps>
1748 <dc:call-macro name="flood-map-fixpoints"/>
1749 <dc:call-macro name="flood-map-km"/>
1750 <axis>
1751 <dc:call-macro name="flood-map-riveraxis"/>
1752 </axis>
1753 </dc:macro>
1754
1755 <dc:macro name="floodmarks">
1756 <dc:context>
1757 <dc:statement>
1758 SELECT DISTINCT
1759 coalesce(CAST (year AS VARCHAR(64)), 'Unbekanntes Jahr') as year
1760 FROM flood_marks
1761 WHERE river_id = ${river_id}
1762 </dc:statement>
1763 <dc:if test="dc:has-result()">
1764 <floodmarks>
1765 <dc:for-each>
1766 <floodmark name="{$year}"
1767 factory="wmsfloodmarkfactory"
1768 ids="{$river_id};{$year};{$year}"/>
1769 </dc:for-each>
1770 </floodmarks>
1771 </dc:if>
1772 </dc:context>
1773 </dc:macro>
1774
1775 <dc:macro name="flood-map-complete">
1776 <buildings>
1777 <dc:call-macro name="flood-map-buildings"/>
1778 </buildings>
1779 <catchments>
1780 <catchment_wms factory="externalwmsfactory"
1781 ids="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiete (WMS)" />
1782 <gaugelocations>
1783 <dc:call-macro name="flood-map-gaugelocations"/>
1784 </gaugelocations>
1785 </catchments>
1786 <dc:call-macro name="floodmarks"/>
1787 <hws>
1788 <dc:call-macro name="hwslines"/>
1789 <dc:call-macro name="hwspoints"/>
1790 </hws>
1791 <route_data>
1792 <dc:call-macro name="flood-map-routing"/>
1793 </route_data>
1794 <hydrboundaries>
1795 <dc:call-macro name="flood-map-floodplain"/>
1796 <dc:call-macro name="flood-map-hydr-boundaries"/>
1797 </hydrboundaries>
1798 <dc:call-macro name="flood-map-uesk"/>
1799 </dc:macro>
1800
1801 </dc:if>
1802
1803 <dc:if test="dc:contains($artifact-outs, 'minfo-heights')">
1804 <dc:call-macro name="minfo-heights"/>
1805 <dc:macro name="minfo-heights">
1806 <bedheights>
1807 <dc:call-macro name="bed-heights-single"/>
1808 <dc:call-macro name="bed-heights-epoch"/>
1809 </bedheights>
1810 </dc:macro>
1811 </dc:if>
1812 <dc:if test="dc:contains($artifact-outs, 'minfo-heights-epoch')">
1813 <bedheights>
1814 <dc:call-macro name="bed-heights-epoch"/>
1815 </bedheights>
1816 </dc:if>
1817
1818 <dc:macro name="bed-heights-single">
1819 <single>
1820 <dc:context>
1821 <dc:statement>
1822 SELECT id AS bedh_id,
1823 year AS bedh_year,
1824 description AS bedh_descr
1825 FROM bed_height_single WHERE river_id = ${river_id}
1826 </dc:statement>
1827 <dc:for-each>
1828 <height factory="bedheight"
1829 ids="bedheight-single-{$bedh_id}-{$bedh_year}"
1830 description="{$bedh_descr}"/>
1831 </dc:for-each>
1832 </dc:context>
1833 </single>
1834 </dc:macro>
1835
1836 <dc:macro name="bed-heights-epoch">
1837 <epoch>
1838 <dc:context>
1839 <dc:statement>
1840 SELECT id AS bedh_id,
1841 time_interval_id AS bedh_interval_id,
1842 description AS bedh_descr
1843 FROM bed_height_epoch WHERE river_id = ${river_id}
1844 </dc:statement>
1845 <dc:for-each>
1846 <height factory="bedheight"
1847 ids="bedheight-epoch-{$bedh_id}-{$bedh_interval_id}"
1848 description="{$bedh_descr}"/>
1849 </dc:for-each>
1850 </dc:context>
1851 </epoch>
1852 </dc:macro>
1853
1854 </dc:for-each>
1855 </dc:context>
1856 </dc:macro>
1857
1858 <dc:choose>
1859 <dc:comment>
1860 User specific part
1861 ------------------
1862 </dc:comment>
1863 <dc:when test="dc:contains($parameters, 'user-id') and
1864 not(dc:contains($artifact-outs, 'floodmap-hws'))">
1865
1866 <old_calculations>
1867
1868 <dc:comment><!-- <dc:macro name="load-user">--></dc:comment>
1869 <dc:call-macro name="user-range">
1870 <dc:context connection="user">
1871 <dc:comment> Get the user and collection-id. </dc:comment>
1872 <dc:statement>
1873 SELECT u.id AS user_id, c.id AS collection_id, c.name AS collection_name
1874 FROM collections c JOIN users u ON c.user_id = u.id
1875 WHERE u.gid = CAST(${user-id} AS uuid)
1876 ORDER BY c.creation DESC
1877 </dc:statement>
1878
1879 <dc:macro name="range-filter">
1880 <dc:statement>
1881 SELECT m.id AS a_id,
1882 m.state AS a_state,
1883 m.gid AS a_gid,
1884 m.creation AS a_creation,
1885 COALESCE(ld_mode, '') AS ld_m,
1886 COALESCE(ld_locations, '') AS ld_l,
1887 COALESCE(ld_from, '') AS ld_f,
1888 COALESCE(ld_to, '') AS ld_t
1889 FROM master_artifacts_range m
1890 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1891 AND EXISTS (
1892 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1893 </dc:statement>
1894 <dc:for-each>
1895 <dc:variable name="from" type="number" expr="dc:fromValue($ld_m, $ld_l, $ld_f)"/>
1896 <dc:variable name="to" type="number" expr="dc:toValue($ld_m, $ld_l, $ld_t)"/>
1897 <dc:if test="($from &gt;= $fromkm and $from &lt;= $tokm) or ($to &lt;= $tokm and $to &gt;= $fromkm) or ($from &lt;= $fromkm and $to &gt;= $tokm)">
1898 <dc:macro-body/>
1899 </dc:if>
1900 </dc:for-each>
1901 </dc:macro>
1902
1903 <!-- OFFICIAL LINES -->
1904 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
1905 <dc:comment comment=".wst -------------------------------"/>
1906 <officiallines>
1907 <dc:for-each>
1908 <dc:context>
1909 <dc:statement>
1910 SELECT m.id AS a_id,
1911 m.state AS a_state,
1912 m.gid AS a_gid,
1913 m.creation AS a_creation,
1914 ardg.v AS gaugy,
1915 arv.v AS wqsingle
1916 FROM master_artifacts m,
1917 artifact_data ardg,
1918 artifact_data arv
1919 WHERE m.collection_id = ${collection_id}
1920 AND m.gid = CAST(${artifact-id} AS uuid)
1921 AND ardg.artifact_id = m.id
1922 AND ardg.k = 'ld_gaugename'
1923 AND arv.artifact_id = m.id
1924 AND arv.k = 'wq_single'
1925 AND EXISTS (
1926 SELECT id
1927 FROM artifact_data ad
1928 WHERE ad.artifact_id = m.id
1929 AND k = 'river'
1930 AND v = ${river})
1931 </dc:statement>
1932 <dc:for-each>
1933 <dc:context connection="system">
1934 <dc:statement>
1935 SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval
1936 FROM official_q_values ol
1937 WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy}
1938 </dc:statement>
1939 <dc:for-each>
1940 <dc:element name="${olname}">
1941 <dc:attribute name="name" value="${olname}"/>
1942 <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
1943 <dc:attribute name="factory" value="staticwkms"/>
1944 </dc:element>
1945 </dc:for-each>
1946 </dc:context>
1947 </dc:for-each>
1948 </dc:context>
1949 </dc:for-each>
1950 </officiallines>
1951 </dc:if>
1952 <!-- END OFFICIAL LINES -->
1953
1954 <dc:comment>
1955 SHOW W-DIFFERENCES
1956 </dc:comment>
1957
1958 <dc:macro name="differences">
1959 <differences>
1960 <dc:for-each>
1961 <dc:context>
1962 <dc:call-macro name="range-filter">
1963 <dc:context>
1964 <dc:statement>
1965 SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description
1966 FROM outs AS o, facets AS f, artifacts AS a
1967 WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1968 </dc:statement>
1969 <dc:for-each>
1970 <dc:element name="${facet_name}">
1971 <dc:attribute name="description" value="${facet_description}"/>
1972 <dc:attribute name="factory" value="winfo"/>
1973 <dc:attribute name="artifact-id" value="${aid}"/>
1974 <dc:attribute name="ids" value="${aid}"/>
1975 <dc:attribute name="out" value="w_differences"/>
1976 </dc:element>
1977 </dc:for-each>
1978 </dc:context>
1979 </dc:call-macro>
1980 </dc:context>
1981 </dc:for-each>
1982 </differences>
1983 </dc:macro>
1984
1985 <dc:comment>
1986 SHOW REFERENCE CURVE
1987 </dc:comment>
1988
1989 <dc:macro name="reference-curves">
1990 <reference_curves>
1991 <dc:for-each>
1992 <dc:context>
1993 <dc:call-macro name="user-range">
1994 <dc:context>
1995 <dc:statement>
1996 SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description
1997 FROM outs AS o, facets AS f, artifacts AS a
1998 WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
1999 </dc:statement>
2000 <dc:for-each>
2001 <dc:element name="${facet_name}">
2002 <dc:attribute name="description" value="${facet_description}"/>
2003 <dc:attribute name="factory" value="winfo"/>
2004 <dc:attribute name="artifact-id" value="${aid}"/>
2005 <dc:attribute name="ids" value="${aid}"/>
2006 <dc:attribute name="out" value="reference_curve"/>
2007 </dc:element>
2008 </dc:for-each>
2009 </dc:context>
2010 </dc:call-macro>
2011 </dc:context>
2012 </dc:for-each>
2013 </reference_curves>
2014 </dc:macro>
2015
2016 <dc:comment>
2017 SHOW COMPUTED DISCHARGE CURVES
2018 </dc:comment>
2019
2020 <dc:macro name="computed-discharge-curve">
2021 <computed_discharge_curves>
2022 <dc:for-each>
2023 <dc:context>
2024 <dc:call-macro name="range-filter">
2025 <dc:context>
2026 <dc:statement>
2027 SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description
2028 FROM outs AS o, facets AS f, artifacts AS a
2029 WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
2030 </dc:statement>
2031 <dc:for-each>
2032 <dc:element name="${facet_name}">
2033 <dc:attribute name="description" value="${facet_description}"/>
2034 <dc:attribute name="factory" value="winfo"/>
2035 <dc:attribute name="artifact-id" value="${aid}"/>
2036 <dc:attribute name="ids" value="${aid}"/>
2037 <dc:attribute name="out" value="computed_discharge_curve"/>
2038 </dc:element>
2039 </dc:for-each>
2040 </dc:context>
2041 </dc:call-macro>
2042 </dc:context>
2043 </dc:for-each>
2044 </computed_discharge_curves>
2045 </dc:macro>
2046
2047 <dc:comment>
2048 CROSS SECTION
2049 </dc:comment>
2050
2051 <dc:macro name="waterlevels">
2052 <waterlevels>
2053 <dc:for-each>
2054 <dc:context>
2055 <dc:call-macro name="range-filter">
2056 <dc:context>
2057 <dc:statement>
2058 SELECT id AS out_id
2059 FROM outs
2060 WHERE artifact_id = ${a_id} AND name = 'cross_section'
2061 </dc:statement>
2062 <dc:for-each>
2063 <dc:context>
2064 <dc:statement>
2065 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2066 FROM facets
2067 WHERE out_id = ${out_id}
2068 ORDER BY num ASC, name DESC
2069 </dc:statement>
2070 <longitudinal_section_columns description="{$river} {$a_creation}">
2071 <dc:for-each>
2072 <dc:element name="${facet_name}">
2073 <dc:attribute name="description" value="${facet_description}"/>
2074 <dc:attribute name="ids" value="${facet_num}"/>
2075 <dc:attribute name="factory" value="winfo"/>
2076 <dc:attribute name="artifact-id" value="${a_gid}"/>
2077 <dc:attribute name="out" value="cross_section"/>
2078 </dc:element>
2079 </dc:for-each>
2080 </longitudinal_section_columns>
2081 </dc:context>
2082 </dc:for-each>
2083 </dc:context>
2084 </dc:call-macro>
2085 </dc:context>
2086 </dc:for-each>
2087 </waterlevels>
2088 </dc:macro>
2089
2090 <dc:macro name="longitudinal">
2091 <waterlevels>
2092 <dc:for-each>
2093 <dc:context>
2094 <dc:call-macro name="range-filter">
2095 <dc:context>
2096 <dc:statement>
2097 SELECT id AS out_id
2098 FROM outs
2099 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
2100 </dc:statement>
2101 <dc:for-each>
2102 <dc:context>
2103 <dc:statement>
2104 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2105 FROM facets
2106 WHERE out_id = ${out_id}
2107 ORDER BY num ASC, name DESC
2108 </dc:statement>
2109 <longitudinal_section_columns description="{$river} {$a_creation}">
2110 <dc:for-each>
2111 <dc:element name="${facet_name}">
2112 <dc:attribute name="description" value="${facet_description}"/>
2113 <dc:attribute name="ids" value="${facet_num}"/>
2114 <dc:attribute name="factory" value="winfo"/>
2115 <dc:attribute name="artifact-id" value="${a_gid}"/>
2116 <dc:attribute name="out" value="longitudinal_section"/>
2117 </dc:element>
2118 </dc:for-each>
2119 </longitudinal_section_columns>
2120 </dc:context>
2121 </dc:for-each>
2122 </dc:context>
2123 </dc:call-macro>
2124 </dc:context>
2125 </dc:for-each>
2126 </waterlevels>
2127 </dc:macro>
2128
2129 <dc:macro name="longitudinal-section">
2130 <waterlevels>
2131 <dc:for-each>
2132 <dc:context>
2133 <dc:call-macro name="range-filter">
2134 <dc:context>
2135 <dc:statement>
2136 SELECT id AS out_id
2137 FROM outs
2138 WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve'
2139 </dc:statement>
2140 <dc:for-each>
2141 <dc:context>
2142 <dc:comment><!-- average und deviation ls_0 . ls_1 ...--></dc:comment>
2143 <dc:statement>
2144 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2145 FROM facets
2146 WHERE out_id = ${out_id} AND (
2147 name LIKE 'fix_deviation_ls%' OR
2148 name LIKE 'fix_sector_average_ls%' OR
2149 name LIKE 'fix_analysis_events_ls%' OR
2150 name LIKE 'fix_reference_events_ls%' )
2151 ORDER BY num ASC, name DESC
2152 </dc:statement>
2153 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2154 <dc:for-each>
2155 <dc:element name="${facet_name}">
2156 <dc:attribute name="description" value="${facet_description}"/>
2157 <dc:attribute name="ids" value="${facet_num}"/>
2158 <dc:attribute name="factory" value="fixanalysis"/>
2159 <dc:attribute name="artifact-id" value="${a_gid}"/>
2160 <dc:attribute name="out" value="fix_longitudinal_section_curve"/>
2161 </dc:element>
2162 </dc:for-each>
2163 </waterlevels>
2164 </dc:context>
2165 </dc:for-each>
2166 </dc:context>
2167 </dc:call-macro>
2168 </dc:context>
2169 </dc:for-each>
2170 </waterlevels>
2171 </dc:macro>
2172
2173 <dc:macro name="delta-wt">
2174 <waterlevels>
2175 <dc:for-each>
2176 <dc:context>
2177 <dc:call-macro name="range-filter">
2178 <dc:context>
2179 <dc:statement>
2180 SELECT id AS out_id
2181 FROM outs
2182 WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve'
2183 </dc:statement>
2184 <dc:for-each>
2185 <dc:context>
2186 <dc:statement>
2187 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2188 FROM facets
2189 WHERE out_id = ${out_id} and (
2190 name LIKE 'fix_sector_average_dwt%' OR
2191 name LIKE 'fix_deviation_dwt%' OR
2192 name = 'fix_analysis_events_dwt' OR
2193 name = 'fix_reference_events_dwt' OR
2194 name = 'fix_analysis_periods_dwt' )
2195 ORDER BY num ASC, name DESC
2196 </dc:statement>
2197 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2198 <dc:for-each>
2199 <dc:element name="${facet_name}">
2200 <dc:attribute name="description" value="${facet_description}"/>
2201 <dc:attribute name="ids" value="${facet_num}"/>
2202 <dc:attribute name="factory" value="fixanalysis"/>
2203 <dc:attribute name="artifact-id" value="${a_gid}"/>
2204 <dc:attribute name="out" value="fix_deltawt_curve"/>
2205 </dc:element>
2206 </dc:for-each>
2207 </waterlevels>
2208 </dc:context>
2209 </dc:for-each>
2210 </dc:context>
2211 </dc:call-macro>
2212 </dc:context>
2213 </dc:for-each>
2214 </waterlevels>
2215 </dc:macro>
2216
2217 <dc:macro name="delta-wt-ls">
2218 <waterlevels>
2219 <dc:for-each>
2220 <dc:context>
2221 <dc:call-macro name="range-filter">
2222 <dc:context>
2223 <dc:statement>
2224 SELECT id AS out_id
2225 FROM outs
2226 WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve'
2227 </dc:statement>
2228 <dc:for-each>
2229 <dc:context>
2230 <dc:statement>
2231 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2232 FROM facets
2233 WHERE out_id = ${out_id} and (
2234 name LIKE 'fix_sector_average_dwt%' OR
2235 name LIKE 'fix_deviation_dwt%')
2236 ORDER BY num ASC, name DESC
2237 </dc:statement>
2238 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2239 <dc:for-each>
2240 <dc:element name="${facet_name}">
2241 <dc:attribute name="description" value="${facet_description}"/>
2242 <dc:attribute name="ids" value="${facet_num}"/>
2243 <dc:attribute name="factory" value="fixanalysis"/>
2244 <dc:attribute name="artifact-id" value="${a_gid}"/>
2245 <dc:attribute name="out" value="fix_deltawt_curve"/>
2246 </dc:element>
2247 </dc:for-each>
2248 </waterlevels>
2249 </dc:context>
2250 </dc:for-each>
2251 </dc:context>
2252 </dc:call-macro>
2253 </dc:context>
2254 </dc:for-each>
2255 </waterlevels>
2256 </dc:macro>
2257
2258 <dc:macro name="fix-derivate-curve">
2259 <waterlevels>
2260 <dc:for-each>
2261 <dc:context>
2262 <dc:call-macro name="range-filter">
2263 <dc:context>
2264 <dc:statement>
2265 SELECT id AS out_id
2266 FROM outs
2267 WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve'
2268 </dc:statement>
2269 <dc:for-each>
2270 <dc:context>
2271 <dc:statement>
2272 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2273 FROM facets
2274 WHERE out_id = ${out_id} and name = 'fix_derivate_curve'
2275 ORDER BY num ASC, name DESC
2276 </dc:statement>
2277 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2278 <dc:for-each>
2279 <dc:element name="${facet_name}">
2280 <dc:attribute name="description" value="${facet_description}"/>
2281 <dc:attribute name="ids" value="${facet_num}"/>
2282 <dc:attribute name="factory" value="fixanalysis"/>
2283 <dc:attribute name="artifact-id" value="${a_gid}"/>
2284 <dc:attribute name="out" value="fix_derivate_curve"/>
2285 </dc:element>
2286 </dc:for-each>
2287 </waterlevels>
2288 </dc:context>
2289 </dc:for-each>
2290 </dc:context>
2291 </dc:call-macro>
2292 </dc:context>
2293 </dc:for-each>
2294 </waterlevels>
2295 </dc:macro>
2296
2297 <dc:macro name="fix-wq-curve">
2298 <waterlevels>
2299 <dc:for-each>
2300 <dc:context>
2301 <dc:call-macro name="range-filter">
2302 <dc:context>
2303 <dc:statement>
2304 SELECT id AS out_id
2305 FROM outs
2306 WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve'
2307 </dc:statement>
2308 <dc:for-each>
2309 <dc:context>
2310 <dc:statement>
2311 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2312 FROM facets
2313 WHERE out_id = ${out_id} and (
2314 name LIKE 'fix_sector_average_wq%' OR
2315 name = 'fix_wq_curve' OR
2316 name LIKE 'fix_analysis_events_wq%' OR
2317 name LIKE 'fix_reference_events_wq%' )
2318 ORDER BY num ASC, name DESC
2319 </dc:statement>
2320 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2321 <dc:for-each>
2322 <dc:element name="${facet_name}">
2323 <dc:attribute name="description" value="${facet_description}"/>
2324 <dc:attribute name="ids" value="${facet_num}"/>
2325 <dc:attribute name="factory" value="fixanalysis"/>
2326 <dc:attribute name="artifact-id" value="${a_gid}"/>
2327 <dc:attribute name="out" value="fix_wq_curve"/>
2328 </dc:element>
2329 </dc:for-each>
2330 </waterlevels>
2331 </dc:context>
2332 </dc:for-each>
2333 </dc:context>
2334 </dc:call-macro>
2335 </dc:context>
2336 </dc:for-each>
2337 </waterlevels>
2338 </dc:macro>
2339
2340 <dc:macro name="duration-curve">
2341 <computed_discharge_curves>
2342 <dc:for-each>
2343 <dc:context>
2344 <dc:call-macro name="range-filter">
2345 <dc:context>
2346 <dc:statement>
2347 SELECT a.gid AS aid,
2348 f.id AS fid,
2349 f.name AS facet_name,
2350 f.num AS facet_num,
2351 f.description AS facet_description
2352 FROM outs AS o, facets AS f, artifacts AS a
2353 WHERE
2354 (f.name = 'duration_curve.q' OR f.name = 'duration_curve.w') AND
2355 f.out_id = o.id AND
2356 o.artifact_id = ${a_id} AND
2357 a.id = ${a_id}
2358 </dc:statement>
2359 <dc:for-each>
2360 <dc:element name="${facet_name}">
2361 <dc:attribute name="description" value="${facet_description}"/>
2362 <dc:attribute name="factory" value="winfo"/>
2363 <dc:attribute name="artifact-id" value="${aid}"/>
2364 <dc:attribute name="ids" value="${aid}"/>
2365 <dc:attribute name="out" value="duration_curve"/>
2366 </dc:element>
2367 </dc:for-each>
2368 </dc:context>
2369 </dc:call-macro>
2370 </dc:context>
2371 </dc:for-each>
2372 </computed_discharge_curves>
2373 </dc:macro>
2374
2375 <dc:comment>
2376 WATERLEVELS - ONLY SHOW Ws
2377 </dc:comment>
2378
2379 <dc:comment><!-- TODO doesnt work nicely for fix/wq-diags. --></dc:comment>
2380
2381 <dc:macro name="waterlevels-fix">
2382 <waterlevels>
2383 <dc:for-each>
2384 <dc:context>
2385 <dc:call-macro name="range-filter">
2386 <dc:context>
2387 <dc:statement>
2388 SELECT id AS out_id
2389 FROM outs
2390 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
2391 </dc:statement>
2392 <dc:for-each>
2393 <dc:context>
2394 <dc:statement>
2395 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2396 FROM facets
2397 WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
2398 ORDER BY num ASC, name DESC
2399 </dc:statement>
2400 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2401 <dc:for-each>
2402 <dc:element name="${facet_name}">
2403 <dc:attribute name="description" value="${facet_description}"/>
2404 <dc:attribute name="ids" value="${facet_num}"/>
2405 <dc:attribute name="factory" value="winfo"/>
2406 <dc:attribute name="artifact-id" value="${a_gid}"/>
2407 <dc:attribute name="out" value="longitudinal_section"/>
2408 </dc:element>
2409 </dc:for-each>
2410 </waterlevels>
2411 </dc:context>
2412 </dc:for-each>
2413 </dc:context>
2414 </dc:call-macro>
2415 </dc:context>
2416 </dc:for-each>
2417 </waterlevels>
2418 </dc:macro>
2419
2420 <dc:comment>
2421 SHOW FLOODMAPS
2422 </dc:comment>
2423
2424 <dc:macro name="flood-map">
2425 <floodmap>
2426 <dc:for-each>
2427 <dc:context>
2428 <dc:call-macro name="range-filter">
2429 <dc:context>
2430 <dc:statement>
2431 SELECT a.gid AS aid,
2432 f.id AS fid,
2433 f.name AS facet_name,
2434 f.num AS facet_num,
2435 f.description AS facet_description
2436 FROM outs AS o, facets AS f, artifacts AS a
2437 WHERE f.name = 'floodmap.wsplgen' AND
2438 f.out_id = o.id AND
2439 o.artifact_id = ${a_id} AND
2440 a.id = ${a_id}
2441 </dc:statement>
2442 <dc:for-each>
2443 <dc:element name="${facet_name}">
2444 <dc:attribute name="description" value="${facet_description}"/>
2445 <dc:attribute name="factory" value="winfo"/>
2446 <dc:attribute name="artifact-id" value="${aid}"/>
2447 <dc:attribute name="ids" value="${aid}"/>
2448 <dc:attribute name="out" value="floodmap"/>
2449 </dc:element>
2450 </dc:for-each>
2451 </dc:context>
2452 </dc:call-macro>
2453 </dc:context>
2454 </dc:for-each>
2455 </floodmap>
2456 </dc:macro>
2457
2458 <dc:comment>
2459 MINFO bedheight middle
2460 </dc:comment>
2461
2462 <dc:macro name="bed-height">
2463 <fix_vollmer_wq_curve>
2464 <dc:for-each>
2465 <dc:context>
2466 <dc:call-macro name="range-filter">
2467 <dc:context>
2468 <dc:statement>
2469 SELECT a.gid AS aid,
2470 f.id AS fid,
2471 f.name AS facet_name,
2472 f.num AS facet_num,
2473 f.description AS facet_description
2474 FROM outs AS o, facets AS f, artifacts AS a
2475 WHERE (
2476 f.name = 'longitudinal_section.w' OR
2477 f.name = 'heightmarks_points'
2478 ) AND f.out_id = o.id AND o.artifact_id = ${a_id} AND a.id = ${a_id}
2479 </dc:statement>
2480 <fix_vollmer_wq_curve description="{$river} {$a_creation} {$collection_name}">
2481 <dc:for-each>
2482 <dc:element name="${facet_name}">
2483 <dc:attribute name="description" value="${facet_description}"/>
2484 <dc:attribute name="factory" value="fixanalysis"/>
2485 <dc:attribute name="artifact-id" value="${aid}"/>
2486 <dc:attribute name="ids" value="${facet_num}"/>
2487 <dc:attribute name="out" value="longitudinal_section"/>
2488 </dc:element>
2489 </dc:for-each>
2490 </fix_vollmer_wq_curve>
2491 </dc:context>
2492 </dc:call-macro>
2493 </dc:context>
2494 </dc:for-each>
2495 </fix_vollmer_wq_curve>
2496 </dc:macro>
2497
2498 <dc:macro name="floodmap-hws-user">
2499 <dc:context>
2500 <dc:statement>
2501 SELECT id AS out_id
2502 FROM outs
2503 WHERE artifact_id = ${a_id} AND name = 'floodmap'
2504 </dc:statement>
2505 <dc:for-each>
2506 <dc:context>
2507 <dc:statement>
2508 SELECT name AS facet_name,
2509 num AS facet_num,
2510 description AS facet_description
2511 FROM facets
2512 WHERE out_id = ${out_id} AND name = 'floodmap.usershape'
2513 ORDER BY num ASC, name DESC
2514 </dc:statement>
2515 <own-hws>
2516 <dc:for-each>
2517 <dc:element name="${facet_name}">
2518 <dc:attribute name="description" value="${facet_description}"/>
2519 <dc:attribute name="ids" value="${facet_num}"/>
2520 <dc:attribute name="factory" value="winfo"/>
2521 <dc:attribute name="artifact-id" value="${a_gid}"/>
2522 <dc:attribute name="out" value="floodmap"/>
2523 </dc:element>
2524 </dc:for-each>
2525 </own-hws>
2526 </dc:context>
2527 </dc:for-each>
2528 </dc:context>
2529 </dc:macro>
2530
2531 <dc:macro name="bedquality-bed">
2532 <bed_quality_bed>
2533 <dc:for-each>
2534 <dc:context>
2535 <dc:call-macro name="range-filter">
2536 <dc:context>
2537 <dc:statement>
2538 SELECT id AS oid
2539 FROM outs AS o
2540 WHERE
2541 o.artifact_id = ${a_id} AND
2542 o.name='bed_longitudinal_section'
2543 </dc:statement>
2544 <dc:for-each>
2545 <quality-bed description="{$river} {$a_creation} {$collection_name}">
2546 <dc:context>
2547 <dc:statement>
2548 SELECT a.gid AS aid,
2549 f.id AS fid,
2550 f.name AS facet_name,
2551 f.num AS facet_num,
2552 f.description AS facet_description
2553 FROM outs AS o, facets AS f, artifacts AS a
2554 WHERE
2555 (f.name = 'bed_longitudinal_section.bed_diameter_toplayer'
2556 OR f.name = 'bed_longitudinal_section.bed_diameter_sublayer') AND
2557 f.out_id = o.id AND
2558 o.artifact_id = ${a_id} AND
2559 a.id = ${a_id}
2560 </dc:statement>
2561 <dc:for-each>
2562 <dc:element name="${facet_name}">
2563 <dc:attribute name="factory" value="minfo"/>
2564 <dc:attribute name="description" value="${facet_description}"/>
2565 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2566 <dc:attribute name="artifact-id" value="${aid}"/>
2567 <dc:attribute name="out" value="bed_longitudinal_section"/>
2568 </dc:element>
2569 </dc:for-each>
2570 </dc:context>
2571 </quality-bed>
2572 </dc:for-each>
2573 </dc:context>
2574 </dc:call-macro>
2575 </dc:context>
2576 </dc:for-each>
2577 </bed_quality_bed>
2578 </dc:macro>
2579
2580 <dc:macro name="bedquality-load">
2581 <bed_quality_load>
2582 <dc:for-each>
2583 <dc:context>
2584 <dc:call-macro name="range-filter">
2585 <dc:context>
2586 <dc:statement>
2587 SELECT id AS oid
2588 FROM outs AS o
2589 WHERE
2590 o.artifact_id = ${a_id} AND
2591 o.name='bed_longitudinal_section'
2592 </dc:statement>
2593 <dc:for-each>
2594 <quality-load description="{$river} {$a_creation} {$collection_name}">
2595 <dc:context>
2596 <dc:statement>
2597 SELECT a.gid AS aid,
2598 f.id AS fid,
2599 f.name AS facet_name,
2600 f.num AS facet_num,
2601 f.description AS facet_description
2602 FROM outs AS o, facets AS f, artifacts AS a
2603 WHERE
2604 f.name = 'bed_longitudinal_section.bedload_diameter' AND
2605 f.out_id = o.id AND
2606 o.artifact_id = ${a_id} AND
2607 a.id = ${a_id}
2608 </dc:statement>
2609 <dc:for-each>
2610 <dc:element name="${facet_name}">
2611 <dc:attribute name="factory" value="minfo"/>
2612 <dc:attribute name="description" value="${facet_description}"/>
2613 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2614 <dc:attribute name="artifact-id" value="${aid}"/>
2615 <dc:attribute name="out" value="bed_longitudinal_section"/>
2616 </dc:element>
2617 </dc:for-each>
2618 </dc:context>
2619 </quality-load>
2620 </dc:for-each>
2621 </dc:context>
2622 </dc:call-macro>
2623 </dc:context>
2624 </dc:for-each>
2625 </bed_quality_load>
2626 </dc:macro>
2627
2628 <dc:macro name="bedquality-density">
2629 <bed_quality_density>
2630 <dc:for-each>
2631 <dc:context>
2632 <dc:call-macro name="range-filter">
2633 <dc:context>
2634 <dc:statement>
2635 SELECT id AS oid
2636 FROM outs AS o
2637 WHERE
2638 o.artifact_id = ${a_id} AND
2639 o.name='bed_longitudinal_section'
2640 </dc:statement>
2641 <dc:for-each>
2642 <density description="{$river} {$a_creation} {$collection_name}">
2643 <dc:context>
2644 <dc:statement>
2645 SELECT a.gid AS aid,
2646 f.id AS fid,
2647 f.name AS facet_name,
2648 f.num AS facet_num,
2649 f.description AS facet_description
2650 FROM outs AS o, facets AS f, artifacts AS a
2651 WHERE
2652 (f.name = 'bed_longitudinal_section.sediment_density_toplayer' OR
2653 f.name = 'bed_longitudinal_section.sediment_density_sublayer') AND
2654 f.out_id = o.id AND
2655 o.artifact_id = ${a_id} AND
2656 a.id = ${a_id}
2657 </dc:statement>
2658 <dc:for-each>
2659 <dc:element name="${facet_name}">
2660 <dc:attribute name="factory" value="minfo"/>
2661 <dc:attribute name="description" value="${facet_description}"/>
2662 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2663 <dc:attribute name="artifact-id" value="${aid}"/>
2664 <dc:attribute name="out" value="bed_longitudinal_section"/>
2665 </dc:element>
2666 </dc:for-each>
2667 </dc:context>
2668 </density>
2669 </dc:for-each>
2670 </dc:context>
2671 </dc:call-macro>
2672 </dc:context>
2673 </dc:for-each>
2674 </bed_quality_density>
2675 </dc:macro>
2676
2677 <dc:macro name="bedquality-porosity">
2678 <bed_quality_porosity>
2679 <dc:for-each>
2680 <dc:context>
2681 <dc:call-macro name="range-filter">
2682 <dc:context>
2683 <dc:statement>
2684 SELECT id AS oid
2685 FROM outs AS o
2686 WHERE
2687 o.artifact_id = ${a_id} AND
2688 o.name='bed_longitudinal_section'
2689 </dc:statement>
2690 <dc:for-each>
2691 <porosity description="{$river} {$a_creation} {$collection_name}">
2692 <dc:context>
2693 <dc:statement>
2694 SELECT a.gid AS aid,
2695 f.id AS fid,
2696 f.name AS facet_name,
2697 f.num AS facet_num,
2698 f.description AS facet_description
2699 FROM outs AS o, facets AS f, artifacts AS a
2700 WHERE
2701 (f.name = 'bed_longitudinal_section.porosity_toplayer' OR
2702 f.name = 'bed_longitudinal_section.porosity_sublayer') AND
2703 f.out_id = o.id AND
2704 o.artifact_id = ${a_id} AND
2705 a.id = ${a_id}
2706 </dc:statement>
2707 <dc:for-each>
2708 <dc:element name="${facet_name}">
2709 <dc:attribute name="factory" value="minfo"/>
2710 <dc:attribute name="description" value="${facet_description}"/>
2711 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2712 <dc:attribute name="artifact-id" value="${aid}"/>
2713 <dc:attribute name="out" value="bed_longitudinal_section"/>
2714 </dc:element>
2715 </dc:for-each>
2716 </dc:context>
2717 </porosity>
2718 </dc:for-each>
2719 </dc:context>
2720 </dc:call-macro>
2721 </dc:context>
2722 </dc:for-each>
2723 </bed_quality_porosity>
2724 </dc:macro>
2725
2726 <dc:macro name="flow-velocity">
2727 <flow-velocity>
2728 <dc:for-each>
2729 <dc:context>
2730 <dc:call-macro name="range-filter">
2731 <dc:context>
2732 <dc:statement>
2733 SELECT id AS oid
2734 FROM outs AS o
2735 WHERE
2736 o.artifact_id = ${a_id} and o.name='flow_velocity'
2737 </dc:statement>
2738 <dc:for-each>
2739 <flow description="{$river} {$a_creation} {$collection_name}">
2740 <dc:context>
2741 <dc:statement>
2742 SELECT a.gid AS aid,
2743 f.id AS fid,
2744 f.name AS facet_name,
2745 f.num AS facet_num,
2746 f.description AS facet_description
2747 FROM outs AS o, facets AS f, artifacts AS a
2748 WHERE
2749 (f.name = 'flow_velocity.totalchannel' OR
2750 f.name = 'flow_velocity.mainchannel' OR
2751 f.name = 'flow_velocity.totalchannel.filtered' OR
2752 f.name = 'flow_velocity.mainchannel.filtered') AND
2753 f.out_id = o.id AND
2754 o.artifact_id = ${a_id} AND
2755 a.id = ${a_id}
2756 </dc:statement>
2757 <dc:for-each>
2758 <dc:element name="${facet_name}">
2759 <dc:attribute name="factory" value="minfo"/>
2760 <dc:attribute name="description" value="${facet_description}"/>
2761 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2762 <dc:attribute name="artifact-id" value="${aid}"/>
2763 <dc:attribute name="out" value="flow_velocity"/>
2764 </dc:element>
2765 </dc:for-each>
2766 </dc:context>
2767 </flow>
2768 </dc:for-each>
2769 </dc:context>
2770 </dc:call-macro>
2771 </dc:context>
2772 </dc:for-each>
2773 </flow-velocity>
2774 </dc:macro>
2775
2776 <dc:macro name="sediment-load">
2777 <sediment-load>
2778 <dc:for-each>
2779 <dc:context>
2780 <dc:call-macro name="range-filter">
2781 <dc:context>
2782 <dc:statement>
2783 SELECT id AS oid
2784 FROM outs AS o
2785 WHERE
2786 o.artifact_id = ${a_id} and o.name='sedimentload_ls'
2787 </dc:statement>
2788 <dc:for-each>
2789 <load description="{$river} {$a_creation} {$collection_name}">
2790 <dc:context>
2791 <dc:statement>
2792 SELECT a.gid AS aid,
2793 f.id AS fid,
2794 f.name AS facet_name,
2795 f.num AS facet_num,
2796 f.description AS facet_description
2797 FROM outs AS o, facets AS f, artifacts AS a
2798 WHERE f.name LIKE 'sedimentload%' AND
2799 f.out_id = o.id AND
2800 o.artifact_id = ${a_id} AND
2801 a.id = ${a_id}
2802 </dc:statement>
2803 <dc:for-each>
2804 <dc:element name="${facet_name}">
2805 <dc:attribute name="factory" value="minfo"/>
2806 <dc:attribute name="description" value="${facet_description}"/>
2807 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2808 <dc:attribute name="artifact-id" value="${aid}"/>
2809 <dc:attribute name="out" value="sedimentload_ls"/>
2810 </dc:element>
2811 </dc:for-each>
2812 </dc:context>
2813 </load>
2814 </dc:for-each>
2815 </dc:context>
2816 </dc:call-macro>
2817 </dc:context>
2818 </dc:for-each>
2819 </sediment-load>
2820 </dc:macro>
2821
2822 <dc:macro name="bedheight-differences">
2823 <bedheight-differences>
2824 <dc:for-each>
2825 <dc:context>
2826 <dc:call-macro name="range-filter">
2827 <dc:context>
2828 <dc:statement>
2829 SELECT id AS oid,
2830 name AS o_name
2831 FROM outs AS o
2832 WHERE
2833 o.artifact_id = ${a_id} AND
2834 (o.name = 'bed_difference_year' OR
2835 o.name = 'bed_differnece_epoch')
2836 </dc:statement>
2837 <dc:for-each>
2838 <difference description="{$river} {$a_creation} {$collection_name}">
2839 <dc:context>
2840 <dc:statement>
2841 SELECT a.gid AS aid,
2842 f.id AS fid,
2843 f.name AS facet_name,
2844 f.num AS facet_num,
2845 f.description AS facet_description
2846 FROM outs AS o, facets AS f, artifacts AS a
2847 WHERE (f.name LIKE 'bedheight_difference.year%' OR
2848 f.name LIKE 'bedheight_difference.epoch%') AND
2849 f.out_id = o.id AND
2850 o.artifact_id = ${a_id} AND
2851 a.id = ${a_id}
2852 </dc:statement>
2853 <dc:for-each>
2854 <dc:element name="${facet_name}">
2855 <dc:attribute name="factory" value="minfo"/>
2856 <dc:attribute name="description" value="${facet_description}"/>
2857 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2858 <dc:attribute name="artifact-id" value="${aid}"/>
2859 <dc:choose>
2860 <dc:when test="dc:contains($o_name, 'bed_difference_year')">
2861 <dc:attribute name="out" value="bed_difference_year"/>
2862 </dc:when>
2863 <dc:otherwise>
2864 <dc:attribute name="out" value="bed_difference_epoch"/>
2865 </dc:otherwise>
2866 </dc:choose>
2867 </dc:element>
2868 </dc:for-each>
2869 </dc:context>
2870 </difference>
2871 </dc:for-each>
2872 </dc:context>
2873 </dc:call-macro>
2874 </dc:context>
2875 </dc:for-each>
2876 </bedheight-differences>
2877 </dc:macro>
2878
2879 <dc:macro name="fixings-year">
2880 <fixings>
2881 <dc:for-each>
2882 <dc:context>
2883 <dc:call-macro name="range-filter">
2884 <dc:context>
2885 <dc:statement>
2886 SELECT ou.id AS oid
2887 FROM outs AS ou, artifacts AS ar
2888 WHERE
2889 ar.state = 'state.fix.vollmer.compute' AND
2890 ou.name = 'longitudinal_section'
2891 </dc:statement>
2892 <dc:for-each>
2893 <fix description="{$river} {$a_id} {$a_creation} {$collection_name}">
2894 <dc:context>
2895 <dc:statement>
2896 SELECT a.gid AS aid,
2897 f.id AS fid,
2898 f.name AS facet_name,
2899 f.num AS facet_num,
2900 f.description AS facet_description
2901 FROM outs AS o, facets AS f, artifacts AS a
2902 WHERE f.name = 'longitudinal_section.w' AND
2903 f.out_id = o.id AND
2904 o.artifact_id = ${a_id} AND
2905 a.id = ${a_id}
2906 </dc:statement>
2907 <dc:for-each>
2908 <dc:element name="${facet_name}">
2909 <dc:attribute name="factory" value="fixanalysis"/>
2910 <dc:attribute name="description" value="${facet_description}"/>
2911 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2912 <dc:attribute name="artifact-id" value="${aid}"/>
2913 <dc:attribute name="out" value="longitudinal_section"/>
2914 </dc:element>
2915 </dc:for-each>
2916 </dc:context>
2917 </fix>
2918 </dc:for-each>
2919 </dc:context>
2920 </dc:call-macro>
2921 </dc:context>
2922 </dc:for-each>
2923 </fixings>
2924 </dc:macro>
2925
2926 <dc:macro name="waterlevels-discharge">
2927 <waterlevels-discharge>
2928 <dc:for-each>
2929 <dc:context>
2930 <dc:call-macro name="range-filter">
2931 <dc:context>
2932 <dc:statement>
2933 SELECT id AS oid
2934 FROM outs AS o
2935 WHERE
2936 o.artifact_id = ${a_id} AND
2937 o.name = 'discharge_longitudinal_section'
2938 </dc:statement>
2939 <dc:for-each>
2940 <discharge description="{$oid} {$river} {$a_id} {$a_creation} {$collection_name}">
2941 <dc:context>
2942 <dc:statement>
2943 SELECT a.gid AS aid,
2944 f.id AS fid,
2945 f.name AS facet_name,
2946 f.num AS facet_num,
2947 f.description AS facet_description
2948 FROM outs AS o, facets AS f, artifacts AS a
2949 WHERE f.name = 'discharge_longitudinal_section.w' AND
2950 f.out_id = o.id AND
2951 o.artifact_id = ${a_id} AND
2952 a.id = ${a_id}
2953 </dc:statement>
2954 <dc:for-each>
2955 <dc:element name="${facet_name}">
2956 <dc:attribute name="factory" value="winfo"/>
2957 <dc:attribute name="description" value="${facet_description}"/>
2958 <dc:attribute name="ids" value="${facet_num}-${facet_name}"/>
2959 <dc:attribute name="artifact-id" value="${aid}"/>
2960 <dc:attribute name="out" value="longitudinal_section"/>
2961 </dc:element>
2962 </dc:for-each>
2963 </dc:context>
2964 </discharge>
2965 </dc:for-each>
2966 </dc:context>
2967 </dc:call-macro>
2968 </dc:context>
2969 </dc:for-each>
2970 </waterlevels-discharge>
2971 </dc:macro>
2972
2973 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
2974 <dc:call-macro name="longitudinal"/>
2975 </dc:if>
2976 <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
2977 <dc:call-macro name="delta-wt"/>
2978 </dc:if>
2979 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
2980 <dc:call-macro name="differences"/>
2981 </dc:if>
2982 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
2983 <dc:call-macro name="reference-curves"/>
2984 </dc:if>
2985 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
2986 <dc:call-macro name="computed-discharge-curve"/>
2987 </dc:if>
2988 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
2989 <dc:call-macro name="waterlevels"/>
2990 </dc:if>
2991 <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
2992 <dc:call-macro name="longitudinal-section"/>
2993 </dc:if>
2994 <dc:if test="dc:contains($artifact-outs, 'fix_derivate_curve')">
2995 <dc:call-macro name="fix-derivate-curve"/>
2996 </dc:if>
2997 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
2998 <dc:call-macro name="fix-wq-curve"/>
2999 </dc:if>
3000 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
3001 <dc:call-macro name="duration-curve"/>
3002 </dc:if>
3003 <dc:if test="dc:contains($artifact-outs, 'waterlevels') or (dc:contains($artifact-outs, 'fix_wq_curve'))">
3004 <dc:call-macro name="waterlevels-fix"/>
3005 </dc:if>
3006 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'map')">
3007 <dc:call-macro name="flood-map"/>
3008 </dc:if>
3009 <dc:if test="dc:contains($artifact-outs, 'bedheight_middle')">
3010 <dc:call-macro name="waterlevels-discharge"/>
3011 <dc:call-macro name="waterlevels-fix"/>
3012 </dc:if>
3013 <dc:if test="dc:contains($artifact-outs, 'floodmap-hws')">
3014 <dc:call-macro name="floodmap-hws-user"/>
3015 </dc:if>
3016 <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
3017 <dc:call-macro name="bedquality-bed"/>
3018 <dc:call-macro name="bedquality-load"/>
3019 </dc:if>
3020 <dc:if test="dc:contains($artifact-outs, 'bed_longitudinal_section')">
3021 <dc:call-macro name="bedquality-bed"/>
3022 <dc:call-macro name="bedquality-load"/>
3023 <dc:call-macro name="bedquality-density"/>
3024 <dc:call-macro name="bedquality-porosity"/>
3025 </dc:if>
3026 <dc:if test="dc:contains($artifact-outs, 'sedimentload_ls')">
3027 <dc:call-macro name="differences"/>
3028 <dc:call-macro name="bedheight-differences"/>
3029 <dc:call-macro name="flow-velocity"/>
3030 <dc:call-macro name="sediment-load"/>
3031 </dc:if>
3032 <dc:if test="dc:contains($artifact-outs, 'bed_difference_year') or
3033 dc:contains($artifact-outs, 'bed_difference_epoch')">
3034 <dc:call-macro name="waterlevels-discharge"/>
3035 <dc:call-macro name="bedheight-differences"/>
3036 <dc:call-macro name="differences"/>
3037 <dc:call-macro name="waterlevels-fix"/>
3038 <dc:call-macro name="delta-wt-ls"/>
3039 </dc:if>
3040 </dc:context>
3041 </dc:call-macro>
3042
3043 </old_calculations>
3044
3045 <dc:if test="dc:contains($parameters,'load-system')">
3046 <dc:comment>
3047 Include System specific part when 'load-system' is in parameters.
3048 -----------------------------------------------------------------
3049 </dc:comment>
3050 <dc:call-macro name="load-system"/>
3051 </dc:if>
3052 </dc:when>
3053
3054 <dc:otherwise>
3055 <dc:comment>
3056 Include System specific part only if no user ID is given.
3057 ---------------------------------------------------------
3058 </dc:comment>
3059 <dc:call-macro name="load-system"/>
3060 </dc:otherwise>
3061 </dc:choose>
3062
3063 </datacage>
3064 </dc:template>

http://dive4elements.wald.intevation.org