comparison flys-artifacts/doc/conf/meta-data.xml @ 5523:35dba807966a

Applied contrib/inline-dc-attribute.xsl und fix idention. Need testing
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 29 Mar 2013 14:25:36 +0100
parents eeac800eb4cd
children 3badc699af0e
comparison
equal deleted inserted replaced
5522:eeac800eb4cd 5523:35dba807966a
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage"> 2 <dc:template xmlns:dc="http://www.intevation.org/2011/Datacage">
3 <datacage> 3 <datacage>
4 <dc:comment> 4 <dc:comment>
5 Statement to load data from wsts. 5 Statement to load data from wsts.
6 </dc:comment> 6 </dc:comment>
34 SELECT COALESCE(ld_mode, '') AS ldm, 34 SELECT COALESCE(ld_mode, '') AS ldm,
35 COALESCE(ld_locations, '') AS ldl, 35 COALESCE(ld_locations, '') AS ldl,
36 COALESCE(ld_from, '') AS ldf, 36 COALESCE(ld_from, '') AS ldf,
37 COALESCE(ld_to, '') AS ldt 37 COALESCE(ld_to, '') AS ldt
38 FROM master_artifacts_range 38 FROM master_artifacts_range
39 WHERE gid = CAST(${artifact-id} as uuid) 39 WHERE gid = CAST(${artifact-id} AS uuid)
40 </dc:statement> 40 </dc:statement>
41 <dc:for-each> 41 <dc:for-each>
42 <dc:variable name="fromkm" type="number" expr="dc:fromValue($ldm, $ldl, $ldf)"/> 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)"/> 43 <dc:variable name="tokm" type="number" expr="dc:toValue($ldm, $ldl, $ldt)"/>
44 <dc:macro-body/> 44 <dc:macro-body/>
57 System part. Load data for the given river. 57 System part. Load data for the given river.
58 </dc:comment> 58 </dc:comment>
59 <dc:macro name="load-system"> 59 <dc:macro name="load-system">
60 <dc:context connection="system"> 60 <dc:context connection="system">
61 <dc:statement> 61 <dc:statement>
62 SELECT id AS river_id, name as river_name FROM rivers 62 SELECT id AS river_id, name AS river_name FROM rivers
63 WHERE lower(name) LIKE lower(${river}) 63 WHERE lower(name) LIKE lower(${river})
64 </dc:statement> 64 </dc:statement>
65 <dc:for-each> 65 <dc:for-each>
66 66
67 <dc:comment> 67 <dc:comment>
76 SELECT id AS prot_id, 76 SELECT id AS prot_id,
77 description AS prot_description 77 description AS prot_description
78 FROM wsts WHERE kind = 0 AND river_id = ${river_id} 78 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
79 </dc:statement> 79 </dc:statement>
80 <dc:for-each> 80 <dc:for-each>
81 <basedata> 81 <basedata name="{$prot_description}">
82 <dc:attribute name="name" value="${prot_description}"/>
83 <dc:context> 82 <dc:context>
84 <dc:call-macro name="SQL-wst_columns_statement"/> 83 <dc:call-macro name="SQL-wst_columns_statement"/>
85 <dc:for-each> 84 <dc:for-each>
86 <column> 85 <column name="{$prot_column_name}"
87 <dc:attribute name="name" value="${prot_column_name}"/> 86 ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}"
88 <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/> 87 factory="staticwkms"
89 <dc:attribute name="factory" value="staticwkms"/> 88 info="{$info} [km {$deffrom} - {$defto}]"/>
90 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
91 </column>
92 </dc:for-each> 89 </dc:for-each>
93 </dc:context> 90 </dc:context>
94 </basedata> 91 </basedata>
95 </dc:for-each> 92 </dc:for-each>
96 </dc:context> 93 </dc:context>
107 SELECT id AS prot_id, 104 SELECT id AS prot_id,
108 description AS prot_description 105 description AS prot_description
109 FROM wsts WHERE kind = 0 AND river_id = ${river_id} 106 FROM wsts WHERE kind = 0 AND river_id = ${river_id}
110 </dc:statement> 107 </dc:statement>
111 <dc:for-each> 108 <dc:for-each>
112 <basedata> 109 <basedata name="{$prot_description}">
113 <dc:attribute name="name" value="${prot_description}"/>
114 <dc:context> 110 <dc:context>
115 <dc:call-macro name="SQL-wst_columns_statement"/> 111 <dc:call-macro name="SQL-wst_columns_statement"/>
116 <dc:for-each> 112 <dc:for-each>
117 <column> 113 <column name="{$prot_column_name}"
118 <dc:attribute name="name" value="${prot_column_name}"/> 114 ids="base_data-wstv-{$prot_rel_pos}-{$prot_id}"
119 <dc:attribute name="ids" value="base_data-wstv-${prot_rel_pos}-${prot_id}"/> 115 factory="wqinterpol"
120 <dc:attribute name="factory" value="wqinterpol"/> 116 info="{$info} [km {$deffrom} - {$defto}]"/>
121 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
122 </column>
123 </dc:for-each> 117 </dc:for-each>
124 </dc:context> 118 </dc:context>
125 </basedata> 119 </basedata>
126 </dc:for-each> 120 </dc:for-each>
127 </dc:context> 121 </dc:context>
138 SELECT id AS prot_id, 132 SELECT id AS prot_id,
139 description AS prot_description 133 description AS prot_description
140 FROM wsts WHERE kind = 1 AND river_id = ${river_id} 134 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
141 </dc:statement> 135 </dc:statement>
142 <dc:for-each> 136 <dc:for-each>
143 <additional> 137 <additional name="{$prot_description}">
144 <dc:attribute name="name" value="${prot_description}"/>
145 <dc:context> 138 <dc:context>
146 <dc:call-macro name="SQL-wst_columns_statement"/> 139 <dc:call-macro name="SQL-wst_columns_statement"/>
147 <dc:for-each> 140 <dc:for-each>
148 <column> 141 <column name="{$prot_column_name}"
149 <dc:attribute name="name" value="${prot_column_name}"/> 142 ids="additionalsmarks-wstv-{$prot_rel_pos}-{$prot_id}"
150 <dc:attribute name="ids" value="additionalsmarks-wstv-${prot_rel_pos}-${prot_id}"/> 143 factory="staticwkms"
151 <dc:attribute name="factory" value="staticwkms"/> 144 info="{$info} [km {$deffrom} - {$defto}]"/>
152 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
153 </column>
154 </dc:for-each> 145 </dc:for-each>
155 </dc:context> 146 </dc:context></additional>
156 </additional>
157 </dc:for-each> 147 </dc:for-each>
158 </dc:context> 148 </dc:context>
159 </additionals> 149 </additionals>
160 </dc:call-macro> 150 </dc:call-macro>
161 </dc:macro> 151 </dc:macro>
169 SELECT id AS prot_id, 159 SELECT id AS prot_id,
170 description AS prot_description 160 description AS prot_description
171 FROM wsts WHERE kind = 1 AND river_id = ${river_id} 161 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
172 </dc:statement> 162 </dc:statement>
173 <dc:for-each> 163 <dc:for-each>
174 <additional> 164 <additional name="{$prot_description}">
175 <dc:attribute name="name" value="${prot_description}"/>
176 <dc:context> 165 <dc:context>
177 <dc:call-macro name="SQL-wst_columns_statement"/> 166 <dc:call-macro name="SQL-wst_columns_statement"/>
178 <dc:for-each> 167 <dc:for-each>
179 <column> 168 <column name="{$prot_column_name}"
180 <dc:attribute name="name" value="${prot_column_name}"/> 169 ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
181 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/> 170 factory="staticwkms"
182 <dc:attribute name="factory" value="staticwkms"/> 171 info="{$info} [km {$deffrom} - {$defto}]"/>
183 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
184 </column>
185 </dc:for-each> 172 </dc:for-each>
186 </dc:context> 173 </dc:context>
187 </additional> 174 </additional>
188 </dc:for-each> 175 </dc:for-each>
189 </dc:context> 176 </dc:context>
200 SELECT id AS prot_id, 187 SELECT id AS prot_id,
201 description AS prot_description 188 description AS prot_description
202 FROM wsts WHERE kind = 1 AND river_id = ${river_id} 189 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
203 </dc:statement> 190 </dc:statement>
204 <dc:for-each> 191 <dc:for-each>
205 <relativepoint> 192 <relativepoint name="{$prot_description}">
206 <dc:attribute name="name" value="${prot_description}"/>
207 <dc:context> 193 <dc:context>
208 <dc:call-macro name="SQL-wst_columns_statement"/> 194 <dc:call-macro name="SQL-wst_columns_statement"/>
209 <dc:for-each> 195 <dc:for-each>
210 <column> 196 <column name="{$prot_column_name}"
211 <dc:attribute name="name" value="${prot_column_name}"/> 197 ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
212 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/> 198 factory="staticwkms"
213 <dc:attribute name="factory" value="staticwkms"/> 199 info="{$info} [km {$deffrom} - {$defto}]"/>
214 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
215 </column>
216 </dc:for-each> 200 </dc:for-each>
217 </dc:context> 201 </dc:context>
218 </relativepoint> 202 </relativepoint>
219 </dc:for-each> 203 </dc:for-each>
220 </dc:context> 204 </dc:context>
230 SELECT id AS prot_id, 214 SELECT id AS prot_id,
231 description AS prot_description 215 description AS prot_description
232 FROM wsts WHERE kind = 2 AND river_id = ${river_id} 216 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
233 </dc:statement> 217 </dc:statement>
234 <dc:for-each> 218 <dc:for-each>
235 <fixation> 219 <fixation name="{$prot_description}">
236 <dc:attribute name="name" value="${prot_description}"/> 220 <!--dc:attribute name="ids" value="fixations-wstv-A-${prot_id}"/--><dc:context>
237 <!--dc:attribute name="ids" value="fixations-wstv-A-${prot_id}"/-->
238 <dc:context>
239 <dc:call-macro name="SQL-wst_columns_statement"/> 221 <dc:call-macro name="SQL-wst_columns_statement"/>
240 <dc:for-each> 222 <dc:for-each>
241 <column> 223 <column name="{$prot_column_name}"
242 <dc:attribute name="name" value="${prot_column_name}"/> 224 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
243 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/> 225 factory="wqinterpol"
244 <dc:attribute name="factory" value="wqinterpol"/> 226 info="{$info} [km {$deffrom} - {$defto}]"/>
245 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
246 </column>
247 </dc:for-each> 227 </dc:for-each>
248 </dc:context> 228 </dc:context>
249 </fixation> 229 </fixation>
250 </dc:for-each> 230 </dc:for-each>
251 </dc:context> 231 </dc:context>
261 SELECT id AS prot_id, 241 SELECT id AS prot_id,
262 description AS prot_description 242 description AS prot_description
263 FROM wsts WHERE kind = 2 AND river_id = ${river_id} 243 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
264 </dc:statement> 244 </dc:statement>
265 <dc:for-each> 245 <dc:for-each>
266 <fixation> 246 <fixation name="{$prot_description}">
267 <dc:attribute name="name" value="${prot_description}"/>
268 <dc:context> 247 <dc:context>
269 <dc:call-macro name="SQL-wst_columns_statement"/> 248 <dc:call-macro name="SQL-wst_columns_statement"/>
270 <dc:for-each> 249 <dc:for-each>
271 <column> 250 <column name="{$prot_column_name}"
272 <dc:attribute name="name" value="${prot_column_name}"/> 251 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
273 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/> 252 factory="wqinterpol"
274 <dc:attribute name="factory" value="wqinterpol"/> 253 info="{$info} [km {$deffrom} - {$defto}]"/>
275 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
276 </column>
277 </dc:for-each> 254 </dc:for-each>
278 </dc:context> 255 </dc:context>
279 </fixation> 256 </fixation>
280 </dc:for-each> 257 </dc:for-each>
281 </dc:context> 258 </dc:context>
291 SELECT id AS prot_id, 268 SELECT id AS prot_id,
292 description AS prot_description 269 description AS prot_description
293 FROM wsts WHERE kind = 2 AND river_id = ${river_id} 270 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
294 </dc:statement> 271 </dc:statement>
295 <dc:for-each> 272 <dc:for-each>
296 <fixation> 273 <fixation name="{$prot_description}">
297 <dc:attribute name="name" value="${prot_description}"/>
298 <dc:context> 274 <dc:context>
299 <dc:call-macro name="SQL-wst_columns_statement"/> 275 <dc:call-macro name="SQL-wst_columns_statement"/>
300 <dc:for-each> 276 <dc:for-each>
301 <column> 277 <column name="{$prot_column_name}"
302 <dc:attribute name="name" value="${prot_column_name}"/> 278 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
303 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/> 279 factory="staticwkms"
304 <dc:attribute name="factory" value="staticwkms"/> 280 info="{$info} [km {$deffrom} - {$defto}]"/>
305 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
306 </column>
307 </dc:for-each> 281 </dc:for-each>
308 </dc:context> 282 </dc:context>
309 </fixation> 283 </fixation>
310 </dc:for-each> 284 </dc:for-each>
311 </dc:context> 285 </dc:context>
321 SELECT id AS prot_id, 295 SELECT id AS prot_id,
322 description AS prot_description 296 description AS prot_description
323 FROM wsts WHERE kind = 2 AND river_id = ${river_id} 297 FROM wsts WHERE kind = 2 AND river_id = ${river_id}
324 </dc:statement> 298 </dc:statement>
325 <dc:for-each> 299 <dc:for-each>
326 <relativepoint> 300 <relativepoint name="{$prot_description}">
327 <dc:attribute name="name" value="${prot_description}"/>
328 <dc:context> 301 <dc:context>
329 <dc:call-macro name="SQL-wst_columns_statement"/> 302 <dc:call-macro name="SQL-wst_columns_statement"/>
330 <dc:for-each> 303 <dc:for-each>
331 <column> 304 <column name="{$prot_column_name}"
332 <dc:attribute name="name" value="${prot_column_name}"/> 305 ids="fixations-wstv-{$prot_rel_pos}-{$prot_id}"
333 <dc:attribute name="ids" value="fixations-wstv-${prot_rel_pos}-${prot_id}"/> 306 factory="staticwkms"
334 <dc:attribute name="factory" value="staticwkms"/> 307 info="{$info} [km {$deffrom} - {$defto}]"/>
335 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
336 </column>
337 </dc:for-each> 308 </dc:for-each>
338 </dc:context> 309 </dc:context>
339 </relativepoint> 310 </relativepoint>
340 </dc:for-each> 311 </dc:for-each>
341 </dc:context> 312 </dc:context>
352 SELECT id AS prot_id, 323 SELECT id AS prot_id,
353 description AS prot_description 324 description AS prot_description
354 FROM wsts WHERE kind = 3 AND river_id = ${river_id} 325 FROM wsts WHERE kind = 3 AND river_id = ${river_id}
355 </dc:statement> 326 </dc:statement>
356 <dc:for-each> 327 <dc:for-each>
357 <official> 328 <official name="{$prot_description}">
358 <dc:attribute name="name" value="${prot_description}"/>
359 <dc:context> 329 <dc:context>
360 <dc:call-macro name="SQL-wst_columns_statement"/> 330 <dc:call-macro name="SQL-wst_columns_statement"/>
361 <dc:for-each> 331 <dc:for-each>
362 <column> 332 <column name="{$prot_column_name}"
363 <dc:attribute name="name" value="${prot_column_name}"/> 333 ids="additionals-wstv-{$prot_rel_pos}-{$prot_id}"
364 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/> 334 factory="staticwqkms"
365 <dc:attribute name="factory" value="staticwqkms"/> 335 info="{$info} [km {$deffrom} - {$defto}]"/>
366 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
367 </column>
368 </dc:for-each> 336 </dc:for-each>
369 </dc:context> 337 </dc:context>
370 </official> 338 </official>
371 </dc:for-each> 339 </dc:for-each>
372 </dc:context> 340 </dc:context>
382 SELECT id AS prot_id, 350 SELECT id AS prot_id,
383 description AS prot_description 351 description AS prot_description
384 FROM wsts WHERE kind = 4 AND river_id = ${river_id} 352 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
385 </dc:statement> 353 </dc:statement>
386 <dc:for-each> 354 <dc:for-each>
387 <relativepoint> 355 <relativepoint name="{$prot_description}">
388 <dc:attribute name="name" value="${prot_description}"/>
389 <dc:context> 356 <dc:context>
390 <dc:call-macro name="SQL-wst_columns_statement"/> 357 <dc:call-macro name="SQL-wst_columns_statement"/>
391 <dc:for-each> 358 <dc:for-each>
392 <column> 359 <column name="{$prot_column_name}"
393 <dc:attribute name="name" value="${prot_column_name}"/> 360 ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}"
394 <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/> 361 factory="staticwkms"
395 <dc:attribute name="factory" value="staticwkms"/> 362 info="{$info} [km {$deffrom} - {$defto}]"/>
396 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
397 </column>
398 </dc:for-each> 363 </dc:for-each>
399 </dc:context> 364 </dc:context>
400 </relativepoint> 365 </relativepoint>
401 </dc:for-each> 366 </dc:for-each>
402 </dc:context> 367 </dc:context>
412 SELECT id AS prot_id, 377 SELECT id AS prot_id,
413 description AS prot_description 378 description AS prot_description
414 FROM wsts WHERE kind = 4 AND river_id = ${river_id} 379 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
415 </dc:statement> 380 </dc:statement>
416 <dc:for-each> 381 <dc:for-each>
417 <heightmark> 382 <heightmark name="{$prot_description}">
418 <dc:attribute name="name" value="${prot_description}"/>
419 <dc:context> 383 <dc:context>
420 <dc:call-macro name="SQL-wst_columns_statement"/> 384 <dc:call-macro name="SQL-wst_columns_statement"/>
421 <dc:for-each> 385 <dc:for-each>
422 <column> 386 <column name="{$prot_column_name}"
423 <dc:attribute name="name" value="${prot_column_name}"/> 387 ids="heightmarks_points-wstv-{$prot_rel_pos}-{$prot_id}"
424 <dc:attribute name="ids" value="heightmarks_points-wstv-${prot_rel_pos}-${prot_id}"/> 388 factory="staticwkms"
425 <dc:attribute name="factory" value="staticwkms"/> 389 info="{$info} [km {$deffrom} - {$defto}]"/>
426 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
427 </column>
428 </dc:for-each> 390 </dc:for-each>
429 </dc:context> 391 </dc:context>
430 </heightmark> 392 </heightmark>
431 </dc:for-each> 393 </dc:for-each>
432 </dc:context> 394 </dc:context>
442 SELECT id AS prot_id, 404 SELECT id AS prot_id,
443 description AS prot_description 405 description AS prot_description
444 FROM wsts WHERE kind = 4 AND river_id = ${river_id} 406 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
445 </dc:statement> 407 </dc:statement>
446 <dc:for-each> 408 <dc:for-each>
447 <heightmark> 409 <heightmark name="{$prot_description}"><dc:context>
448 <dc:attribute name="name" value="${prot_description}"/>
449 <dc:context>
450 <dc:call-macro name="SQL-wst_columns_statement"/> 410 <dc:call-macro name="SQL-wst_columns_statement"/>
451 <dc:for-each> 411 <dc:for-each>
452 <column> 412 <column name="{$prot_column_name}"
453 <dc:attribute name="name" value="${prot_column_name}"/> 413 ids="heightmarks_annotations-wstv-{$prot_rel_pos}-{$prot_id}"
454 <dc:attribute name="ids" value="heightmarks_annotations-wstv-${prot_rel_pos}-${prot_id}"/> 414 factory="wqinterpol"
455 <dc:attribute name="factory" value="wqinterpol"/> 415 info="{$info} [km {$deffrom} - {$defto}]"/>
456 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
457 </column>
458 </dc:for-each> 416 </dc:for-each>
459 </dc:context> 417 </dc:context>
460 </heightmark> 418 </heightmark>
461 </dc:for-each> 419 </dc:for-each>
462 </dc:context> 420 </dc:context>
464 </dc:call-macro> 422 </dc:call-macro>
465 </dc:macro> 423 </dc:macro>
466 424
467 <dc:macro name="basedata_5_flood-protections_relative_points"> 425 <dc:macro name="basedata_5_flood-protections_relative_points">
468 <dc:call-macro name="user-range"> 426 <dc:call-macro name="user-range">
469 <flood_protections> 427 <flood_protections id="flood-protections-{$river_id}">
470 <dc:attribute name="id" value="flood-protections-${river_id}"/>
471 <dc:context connection="system"> 428 <dc:context connection="system">
472 <dc:statement> 429 <dc:statement>
473 SELECT id AS prot_id, 430 SELECT id AS prot_id,
474 description AS prot_description 431 description AS prot_description
475 FROM wsts WHERE kind = 5 AND river_id = ${river_id} 432 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
476 </dc:statement> 433 </dc:statement>
477 <dc:for-each> 434 <dc:for-each>
478 <relativepoint> 435 <relativepoint name="{$prot_description}"
479 <dc:attribute name="name" value="${prot_description}"/> 436 db-id="{$prot_id}"
480 <dc:attribute name="db-id" value="${prot_id}"/> 437 factory="staticwkms">
481 <dc:attribute name="factory" value="staticwkms"/> 438 <columns>
482 <columns>
483 <dc:context> 439 <dc:context>
484 <dc:call-macro name="SQL-wst_columns_statement"/> 440 <dc:call-macro name="SQL-wst_columns_statement"/>
485 <dc:for-each> 441 <dc:for-each>
486 <column> 442 <column name="{$prot_column_name}"
487 <dc:attribute name="name" value="${prot_column_name}"/> 443 ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}"
488 <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/> 444 factory="staticwkms"
489 <dc:attribute name="factory" value="staticwkms"/> 445 info="{$info} [km {$deffrom} - {$defto}]"/>
490 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
491 </column>
492 </dc:for-each> 446 </dc:for-each>
493 </dc:context> 447 </dc:context>
494 </columns> 448 </columns>
495 </relativepoint> 449 </relativepoint>
496 </dc:for-each> 450 </dc:for-each>
497 </dc:context> 451 </dc:context></flood_protections>
498 </flood_protections>
499 </dc:call-macro> 452 </dc:call-macro>
500 </dc:macro> 453 </dc:macro>
501 454
502 <dc:macro name="basedata_5_flood-protections"> 455 <dc:macro name="basedata_5_flood-protections">
503 <dc:call-macro name="user-range"> 456 <dc:call-macro name="user-range">
504 <flood_protections> 457 <flood_protections id="flood-protections-{$river_id}">
505 <dc:attribute name="id" value="flood-protections-${river_id}"/>
506 <dc:context connection="system"> 458 <dc:context connection="system">
507 <dc:statement> 459 <dc:statement>
508 SELECT id AS prot_id, 460 SELECT id AS prot_id,
509 description AS prot_description 461 description AS prot_description
510 FROM wsts WHERE kind = 5 AND river_id = ${river_id} 462 FROM wsts WHERE kind = 5 AND river_id = ${river_id}
511 </dc:statement> 463 </dc:statement>
512 <dc:for-each> 464 <dc:for-each>
513 <flood_protection> 465 <flood_protection name="{$prot_description}"
514 <dc:attribute name="name" value="${prot_description}"/> 466 db-id="{$prot_id}"
515 <dc:attribute name="db-id" value="${prot_id}"/> 467 factory="staticwkms">
516 <dc:attribute name="factory" value="staticwkms"/>
517 <dc:context> 468 <dc:context>
518 <dc:call-macro name="SQL-wst_columns_statement"/> 469 <dc:call-macro name="SQL-wst_columns_statement"/>
519 <dc:for-each> 470 <dc:for-each>
520 <column> 471 <column name="{$prot_column_name}"
521 <dc:attribute name="name" value="${prot_column_name}"/> 472 ids="flood_protection-wstv-{$prot_rel_pos}-{$prot_id}"
522 <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/> 473 factory="staticwkms"
523 <dc:attribute name="factory" value="staticwkms"/> 474 info="{$info} [km {$deffrom} - {$defto}]"/>
524 <dc:attribute name="info" value="${info} [km ${deffrom} - ${defto}]"/>
525 </column>
526 </dc:for-each> 475 </dc:for-each>
527 </dc:context> 476 </dc:context>
528 </flood_protection> 477 </flood_protection>
529 </dc:for-each> 478 </dc:for-each>
530 </dc:context> 479 </dc:context>
531 </flood_protections> 480 </flood_protections>
532 </dc:call-macro> 481 </dc:call-macro>
533 </dc:macro> 482 </dc:macro>
534 483
535 <dc:macro name="mainvalues"> 484 <dc:macro name="mainvalues">
536 <mainvalue> 485 <mainvalue factory="mainvalue" ids="{$river_id}"/>
537 <dc:attribute name="factory" value="mainvalue"/> 486 <wmainvalue factory="mainvalue" ids="{$river_id}:w"/>
538 <dc:attribute name="ids" value="${river_id}"/> 487 <qmainvalue factory="mainvalue" ids="{$river_id}:q"/>
539 </mainvalue>
540 <wmainvalue>
541 <dc:attribute name="factory" value="mainvalue"/>
542 <dc:attribute name="ids" value="${river_id}:w"/>
543 </wmainvalue>
544 <qmainvalue>
545 <dc:attribute name="factory" value="mainvalue"/>
546 <dc:attribute name="ids" value="${river_id}:q"/>
547 </qmainvalue>
548 </dc:macro> 488 </dc:macro>
549 489
550 <dc:macro name="qsectors"> 490 <dc:macro name="qsectors">
551 <qsector> 491 <qsector factory="qsectors" ids="{$river_id}"/>
552 <dc:attribute name="factory" value="qsectors"/>
553 <dc:attribute name="ids" value="${river_id}"/>
554 </qsector>
555 </dc:macro> 492 </dc:macro>
556 493
557 <dc:macro name="annotations"> 494 <dc:macro name="annotations">
558 <annotation> 495 <annotation factory="annotations" ids="{$river_id}"/>
559 <dc:attribute name="factory" value="annotations"/>
560 <dc:attribute name="ids" value="${river_id}"/>
561 </annotation>
562 </dc:macro> 496 </dc:macro>
563 497
564 <dc:macro name="annotations_per_type"> 498 <dc:macro name="annotations_per_type">
565 <annotations> 499 <annotations>
566 <dc:context> 500 <dc:context>
567 <annotation> 501 <annotation name="all_annotations" factory="annotations" ids="{$river_id}"/>
568 <dc:attribute name="name" value="all_annotations"/>
569 <dc:attribute name="factory" value="annotations"/>
570 <dc:attribute name="ids" value="${river_id}"/>
571 </annotation>
572 <dc:statement> 502 <dc:statement>
573 SELECT id AS anno_id, 503 SELECT id AS anno_id,
574 name AS anno_description 504 name AS anno_description
575 FROM annotation_types 505 FROM annotation_types
576 </dc:statement> 506 </dc:statement>
577 <dc:for-each> 507 <dc:for-each>
578 <annotation> 508 <annotation name="{$anno_description}"
579 <dc:attribute name="name" value="${anno_description}"/> 509 factory="annotations"
580 <dc:attribute name="factory" value="annotations"/> 510 ids="{$river_id}:{$anno_description}"/>
581 <dc:attribute name="ids" value="${river_id}:${anno_description}"/>
582 </annotation>
583 </dc:for-each> 511 </dc:for-each>
584 </dc:context> 512 </dc:context>
585 </annotations> 513 </annotations>
586 </dc:macro> 514 </dc:macro>
587 515
588 <dc:macro name="cross_sections"> 516 <dc:macro name="cross_sections">
589 <dc:call-macro name="user-range"> 517 <dc:call-macro name="user-range">
590 <cross_sections> 518 <cross_sections id="flood-protections-{$river_id}">
591 <dc:attribute name="id" value="flood-protections-${river_id}"/>
592 <dc:context connection="system"> 519 <dc:context connection="system">
593 <dc:statement> 520 <dc:statement>
594 SELECT DISTINCT 521 SELECT DISTINCT
595 cs.id AS prot_id, 522 cs.id AS prot_id,
596 cs.description AS prot_description 523 cs.description AS prot_description
598 JOIN cross_section_lines csl ON csl.cross_section_id = cs.id 525 JOIN cross_section_lines csl ON csl.cross_section_id = cs.id
599 WHERE cs.river_id = ${river_id} 526 WHERE cs.river_id = ${river_id}
600 AND csl.km BETWEEN ${fromkm} AND ${tokm} 527 AND csl.km BETWEEN ${fromkm} AND ${tokm}
601 </dc:statement> 528 </dc:statement>
602 <dc:for-each> 529 <dc:for-each>
603 <cross_section> 530 <cross_section name="{$prot_description}"
604 <dc:attribute name="name" value="${prot_description}"/> 531 ids="{$prot_id}"
605 <dc:attribute name="ids" value="${prot_id}"/> 532 factory="crosssections"/>
606 <dc:attribute name="factory" value="crosssections"/>
607 </cross_section>
608 </dc:for-each> 533 </dc:for-each>
609 </dc:context> 534 </dc:context>
610 </cross_sections> 535 </cross_sections>
611 </dc:call-macro> 536 </dc:call-macro>
612 </dc:macro> 537 </dc:macro>
613 538
614 <dc:macro name="hyks"> 539 <dc:macro name="hyks">
615 <dc:call-macro name="user-range"> 540 <dc:call-macro name="user-range">
616 <hyks> 541 <hyks id="hyk-{$river_id}">
617 <dc:attribute name="id" value="hyk-${river_id}"/>
618 <dc:context connection="system"> 542 <dc:context connection="system">
619 <dc:statement> 543 <dc:statement>
620 SELECT DISTINCT 544 SELECT DISTINCT
621 h.id AS hyk_id, 545 h.id AS hyk_id,
622 h.description AS hyk_description 546 h.description AS hyk_description
624 JOIN hyk_entries he ON he.hyk_id = h.id 548 JOIN hyk_entries he ON he.hyk_id = h.id
625 WHERE river_id = ${river_id} 549 WHERE river_id = ${river_id}
626 AND he.km BETWEEN ${fromkm} AND ${tokm} 550 AND he.km BETWEEN ${fromkm} AND ${tokm}
627 </dc:statement> 551 </dc:statement>
628 <dc:for-each> 552 <dc:for-each>
629 <hyk> 553 <hyk name="{$hyk_description}" ids="{$hyk_id}" factory="hyk"/>
630 <dc:attribute name="name" value="${hyk_description}"/> 554 </dc:for-each>
631 <dc:attribute name="ids" value="${hyk_id}"/> 555 </dc:context></hyks>
632 <dc:attribute name="factory" value="hyk"/>
633 </hyk>
634 </dc:for-each>
635 </dc:context>
636 </hyks>
637 </dc:call-macro> 556 </dc:call-macro>
638 </dc:macro> 557 </dc:macro>
639 558
640 <dc:macro name="flow_velocity_measurements"> 559 <dc:macro name="flow_velocity_measurements">
641 <dc:call-macro name="user-range"> 560 <dc:call-macro name="user-range">
642 <flowvelocitymeasurement> 561 <flowvelocitymeasurement>
643 <dc:context connection="system"> 562 <dc:context connection="system">
644 <dc:statement> 563 <dc:statement>
645 SELECT id AS fvmid, 564 SELECT id AS fvmid,
646 description AS fvmd 565 description AS fvmd
647 FROM flow_velocity_measurements WHERE river_id = ${river_id} 566 FROM flow_velocity_measurements WHERE river_id = ${river_id}
648 </dc:statement> 567 </dc:statement>
649 <dc:for-each> 568 <dc:for-each>
650 <flow_velocity_measurement> 569 <flow_velocity_measurement name="{$fvmd}"
651 <dc:attribute name="name" value="${fvmd}"/> 570 ids="{$fvmid}"
652 <dc:attribute name="ids" value="${fvmid}"/> 571 factory="flowvelocity">
653 <dc:attribute name="factory" value="flowvelocity"/>
654 <dc:context> 572 <dc:context>
655 <dc:statement> 573 <dc:statement>
656 SELECT id, description, station, datetime, v, w, q 574 SELECT id, description, station, datetime, v, w, q
657 FROM flow_velocity_measure_values 575 FROM flow_velocity_measure_values
658 WHERE measurements_id = ${fvmid} 576 WHERE measurements_id = ${fvmid}
659 AND station BETWEEN ${fromkm} AND ${tokm} 577 AND station BETWEEN ${fromkm} AND ${tokm}
660 </dc:statement> 578 </dc:statement>
661 <dc:for-each> 579 <dc:for-each>
662 <measurement_value> 580 <measurement_value name="{$id}-{$description}-{$station}-{$datetime}"
663 <dc:attribute name="name" value="${id}-${description}-${station}-${datetime}"/> 581 ids="{$id}"
664 <dc:attribute name="ids" value="${id}"/> 582 factory="flowvelocity"/>
665 <dc:attribute name="factory" value="flowvelocity"/> 583 </dc:for-each>
666 </measurement_value>
667 </dc:for-each>
668 </dc:context> 584 </dc:context>
669 </flow_velocity_measurement> 585 </flow_velocity_measurement>
670 </dc:for-each> 586 </dc:for-each>
671 </dc:context> 587 </dc:context>
672 </flowvelocitymeasurement> 588 </flowvelocitymeasurement>
673 </dc:call-macro> 589 </dc:call-macro>
674 </dc:macro> 590 </dc:macro>
675 591
676 <dc:macro name="sounding-width"> 592 <dc:macro name="sounding-width">
677 <soundings_width> 593 <soundings_width>
678 <dc:context> 594 <dc:context>
681 year AS bedh_year, 597 year AS bedh_year,
682 description AS bedh_descr 598 description AS bedh_descr
683 FROM bed_height_single WHERE river_id = ${river_id} 599 FROM bed_height_single WHERE river_id = ${river_id}
684 </dc:statement> 600 </dc:statement>
685 <dc:for-each> 601 <dc:for-each>
686 <height> 602 <height factory="bedheight"
687 <dc:attribute name="factory" value="bedheight"/> 603 ids="bedheight-singlevalues-{$bedh_id}-{$bedh_year}"
688 <dc:attribute name="ids" value="bedheight-singlevalues-${bedh_id}-${bedh_year}"/> 604 description="{$bedh_descr}"/>
689 <dc:attribute name="description" value="${bedh_descr}"/>
690 </height>
691 </dc:for-each> 605 </dc:for-each>
692 </dc:context> 606 </dc:context>
693 </soundings_width> 607 </soundings_width>
694 </dc:macro> 608 </dc:macro>
695 609
822 </dc:if> 736 </dc:if>
823 <dc:comment comment="--- non-recommendations---"/> 737 <dc:comment comment="--- non-recommendations---"/>
824 </dc:otherwise> 738 </dc:otherwise>
825 </dc:choose> 739 </dc:choose>
826 740
827
828 <dc:if test="dc:contains($artifact-outs, 'waterlevels')"> 741 <dc:if test="dc:contains($artifact-outs, 'waterlevels')">
829 742
830 <!-- base data --> 743 <!-- base data -->
831 <dc:call-macro name="basedata_0"/> 744 <dc:call-macro name="basedata_0"/>
832 745
841 754
842 <!-- flood protection --> 755 <!-- flood protection -->
843 <dc:call-macro name="basedata_5_flood-protections"/> 756 <dc:call-macro name="basedata_5_flood-protections"/>
844 757
845 </dc:if> 758 </dc:if>
846 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and (dc:contains($parameters, 'recommended'))"> 759
847 <!--dc:call-macro name="basedata_2_fixations_wst"/--> 760 <dc:comment><!-- XXX: Why is this taken out?
848 </dc:if> 761 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and (dc:contains($parameters, 'recommended'))">
762 <dc:call-macro name="basedata_2_fixations_wst"/>
763 </dc:if>
764 -->
765 </dc:comment>
849 766
850 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))"> 767 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve') and not (dc:contains($parameters, 'recommended'))">
851 <discharge_table_nn> 768 <discharge_table_nn>
852 <discharge_table_gauge> 769 <discharge_table_gauge>
853 <dc:context> 770 <dc:context>
854 <dc:statement> 771 <dc:statement>
855 SELECT id AS gauge_id, 772 SELECT id AS gauge_id,
856 name AS gauge_name 773 name AS gauge_name
857 FROM gauges WHERE river_id = ${river_id} 774 FROM gauges WHERE river_id = ${river_id}
858 </dc:statement> 775 </dc:statement>
859 <dc:for-each> 776 <dc:for-each>
860 <gauge> 777 <gauge name="{$gauge_name}"
861 <dc:attribute name="name" value="${gauge_name}"/> 778 db-id="{$gauge_id}"
862 <dc:attribute name="db-id" value="${gauge_id}"/> 779 factory="gaugedischarge"
863 <dc:attribute name="factory" value="gaugedischarge"/> 780 from="{$g_start}"
864 <dc:attribute name="from" value="${g_start}"/> 781 to="{$g_stop}"
865 <dc:attribute name="to" value="${g_stop}"/> 782 ids="{$gauge_name}"/>
866 <dc:attribute name="ids" value="${gauge_name}"/> 783 <dc:comment>
867 </gauge>
868 <!-- 784 <!--
869 <gauge> 785 <gauge>
870 <dc:attribute name="name" value="${gauge_name}"/> 786 <dc:attribute name="name" value="${gauge_name}"/>
871 <dc:attribute name="db-id" value="${gauge_id}"/> 787 <dc:attribute name="db-id" value="${gauge_id}"/>
872 <dc:context> 788 <dc:context>
888 <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}"/> 804 <dc:attribute name="ids" value="${discharge_id}-${g_start}-${g_stop}"/>
889 </historical> 805 </historical>
890 </dc:for-each> 806 </dc:for-each>
891 </dc:context> 807 </dc:context>
892 </gauge> 808 </gauge>
893 --> 809 -->
894 </dc:for-each> 810 </dc:comment>
895 </dc:context> 811 </dc:for-each>
896 </discharge_table_gauge> 812 </dc:context>
897 813 </discharge_table_gauge>
898 </discharge_table_nn> 814 </discharge_table_nn>
899 815
900 <dc:call-macro name="basedata_2_fixations_wst"/> 816 <dc:call-macro name="basedata_2_fixations_wst"/>
901 817
902 <dc:call-macro name="basedata_5_flood-protections"/> 818 <dc:call-macro name="basedata_5_flood-protections"/>
903 819
912 <dc:call-macro name="mainvalues"/> 828 <dc:call-macro name="mainvalues"/>
913 </computed_discharge_curve> 829 </computed_discharge_curve>
914 </dc:if> 830 </dc:if>
915 831
916 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve') and not (dc:contains($parameters, 'recommended'))"> 832 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve') and not (dc:contains($parameters, 'recommended'))">
917 <discharge_table_nn> 833 <discharge_table_nn>
918 <discharge_table_gauge> 834 <discharge_table_gauge>
835 <dc:context>
836 <dc:statement>
837 SELECT id AS gauge_id,
838 name AS gauge_name
839 FROM gauges WHERE river_id = ${river_id}
840 </dc:statement>
841 <dc:for-each>
842 <gauge name="{$gauge_name}"
843 db-id="{$gauge_id}"
844 factory="gaugedischarge"
845 from="{$g_start}"
846 to="{$g_stop}"
847 ids="{$gauge_name}"/>
848 </dc:for-each>
849 </dc:context>
850 </discharge_table_gauge>
851 </discharge_table_nn>
852 </dc:if>
853
854 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'floodmap-hws')">
855 <floodmap>
856 <dc:choose>
857 <dc:when test="dc:contains($parameters, 'recommended')">
858 <dc:call-macro name="flood-map-recommended"/>
859 </dc:when>
860 <dc:when test="dc:contains($parameters, 'dem')">
861 <dc:call-macro name="flood-map-dem"/>
862 </dc:when>
863 <dc:otherwise>
864 <dc:call-macro name="flood-map-complete"/>
865 </dc:otherwise>
866 </dc:choose>
867 </floodmap>
868
869 <dc:if test="dc:contains($parameters, 'hws')">
870 <hws>
871 <dc:call-macro name="flood-map-hws-lines"/>
872 <dc:call-macro name="flood-map-hws-points"/>
873 </hws>
874 </dc:if>
875
876 <dc:macro name="flood-map-recommended">
877 <dc:comment>
878 FIXME: Following two macros look identical to me.
879 </dc:comment>
880 <kilometrage>
881 <riveraxis factory="riveraxis" ids="{$river_id}"/>
882 </kilometrage>
883 <rastermap>
884 <background factory="wmsbackground" ids="{$river_id}"/>
885 </rastermap>
886 </dc:macro>
887
888 <dc:macro name="flood-map-dem">
889 <dems>
890 <dc:context>
891 <dc:statement>
892 SELECT d.id AS dem_id,
893 r.a AS dem_lower,
894 r.b AS dem_upper,
895 d.name AS name,
896 d.projection || ' | ' || t.start_time || ' - ' || t.stop_time AS info
897 FROM dem d
898 JOIN ranges r ON d.range_id = r.id
899 JOIN time_intervals t ON d.time_interval_id = t.id
900 WHERE d.river_id = ${river_id}
901 </dc:statement>
902 <dc:for-each>
903 <dem factory="demfactory" ids="{$dem_id}" name="{$name}" info="{$info}"/>
904 </dc:for-each>
905 </dc:context>
906 </dems>
907 </dc:macro>
908
909 <dc:macro name="flood-map-hws-lines">
910 <dc:context>
911 <dc:statement>
912 SELECT DISTINCT
913 name AS hws_name,
914 official AS hws_official,
915 kind_id AS hws_kind
916 FROM hws_lines
917 WHERE river_id = ${river_id}
918 </dc:statement>
919 <lines>
920 <official>
921 <Durchlass>
922 <dc:for-each filter="$hws_kind=1 and $hws_official=1">
923 <hws factory="hwsfactory" name="{$hws_name}"/>
924 </dc:for-each>
925 </Durchlass>
926 <Damm>
927 <dc:for-each filter="$hws_kind=2 and $hws_official=1">
928 <hws factory="hwsfactory" name="{$hws_name}"/>
929 </dc:for-each>
930 </Damm>
931 <Graben>
932 <dc:for-each filter="$hws_kind=3 and $hws_official=1">
933 <hws factory="hwsfactory" name="{$hws_name}"/>
934 </dc:for-each>
935 </Graben>
936 </official>
937 <inofficial>
938 <Durchlass>
939 <dc:for-each filter="$hws_kind=1 and $hws_official=0">
940 <hws factory="hwsfactory" name="{$hws_name}"/>
941 </dc:for-each>
942 </Durchlass>
943 <Damm>
944 <dc:for-each filter="$hws_kind=2 and $hws_official=0">
945 <hws factory="hwsfactory" name="{$hws_name}"/>
946 </dc:for-each>
947 </Damm>
948 <Graben>
949 <dc:for-each filter="$hws_kind=3 and $hws_official=0">
950 <hws factory="hwsfactory" name="{$hws_name}"/>
951 </dc:for-each>
952 </Graben>
953 </inofficial>
954 </lines>
955 </dc:context>
956 </dc:macro>
957
958 <dc:macro name="flood-map-hws-points">
959 <dc:context>
960 <dc:statement>
961 SELECT DISTINCT
962 name AS hws_points_name,
963 official AS hws_points_official,
964 kind_id AS hws_points_kind
965 FROM hws_points
966 WHERE river_id = ${river_id}
967 </dc:statement>
968 <points>
969 <official>
970 <Durchlass>
971 <dc:for-each filter="$hws_points_kind=1 and $hws_points_official=1">
972 <hws factory="hwsfactory" name="{$hws_points_name}"/>
973 </dc:for-each>
974 </Durchlass>
975 <Damm>
976 <dc:for-each filter="$hws_points_kind=2 and $hws_points_official=1">
977 <hws factory="hwsfactory" name="{$hws_points_name}"/>
978 </dc:for-each>
979 </Damm>
980 <Graben>
981 <dc:for-each filter="$hws_kind=3 and $hws_official=1">
982 <hws factory="hwsfactory" name="{$hws_points_name}"/>
983 </dc:for-each>
984 </Graben>
985 </official>
986 <inofficial>
987 <Durchlass>
988 <dc:for-each filter="$hws_points_kind=1 and $hws_points_official=0">
989 <hws factory="hwsfactory" name="{$hws_points_name}"/>
990 </dc:for-each>
991 </Durchlass>
992 <Damm>
993 <dc:for-each filter="$hws_points_kind=2 and $hws_points_official=0">
994 <hws factory="hwsfactory" name="{$hws_points_name}"/>
995 </dc:for-each>
996 </Damm>
997 <Graben>
998 <dc:for-each filter="$hws_points_kind=3 and $hws_points_official=0">
999 <hws factory="hwsfactory" name="{$hws_points_name}"/>
1000 </dc:for-each>
1001 </Graben>
1002 </inofficial>
1003 </points>
1004 </dc:context>
1005 </dc:macro>
1006
1007 <dc:macro name="flood-map-km">
1008 <dc:context>
1009 <dc:statement>
1010 SELECT count(*) AS km_exists
1011 FROM river_axes_km WHERE river_id = ${river_id}
1012 </dc:statement>
1013 <dc:for-each>
1014 <dc:if test="$km_exists&gt;0">
1015 <kilometrage factory="wmskmfactory" ids="{$river_id}"/>
1016 </dc:if>
1017 </dc:for-each>
1018 </dc:context>
1019 </dc:macro>
1020
1021 <dc:macro name="flood-map-qps">
1022 <dc:context>
1023 <dc:comment>Grab only the actual first</dc:comment>
1024 <dc:statement>
1025 SELECT DISTINCT
1026 cs.kind_id AS kind_id,
1027 ck.name AS kind_name
1028 FROM cross_section_tracks cs
1029 JOIN cross_section_track_kinds ck on cs.kind_id = ck.id
1030 WHERE river_id = ${river_id}
1031 AND kind_id=1
1032 </dc:statement>
1033 <dc:if test="dc:has-result()">
1034 <dc:for-each>
1035 <actual description="{$kind_name}"
1036 factory="wmsqpsfactory"
1037 ids="{$river_id};{$kind_name};{$kind_id}"/>
1038 </dc:for-each>
1039 </dc:if>
1040 </dc:context>
1041 <dc:context>
1042 <dc:comment>Now the other tracks</dc:comment>
1043 <dc:statement>
1044 SELECT DISTINCT
1045 cs.kind_id AS kind_id,
1046 ck.name AS kind_name,
1047 cs.name AS layer_name
1048 FROM cross_section_tracks cs
1049 JOIN cross_section_track_kinds ck on cs.kind_id = ck.id
1050 WHERE river_id = ${river_id}
1051 AND kind_id=0
1052 </dc:statement>
1053 <dc:if test="dc:has-result()">
1054 <other>
1055 <dc:for-each>
1056 <misc-qps description="{$layer_name}"
1057 factory="wmsqpsfactory"
1058 ids="{$river_id};{$layer_name};{$kind_id}"/>
1059 </dc:for-each>
1060 </other>
1061 </dc:if>
1062 </dc:context>
1063 </dc:macro>
1064
1065 <dc:macro name="flood-map-riveraxis">
1066 <dc:context>
1067 <dc:statement>
1068 SELECT DISTINCT
1069 ax.kind_id AS kind_id,
1070 ak.name AS kind_name
1071 FROM river_axes ax
1072 JOIN axis_kinds ak on ax.kind_id = ak.id
1073 WHERE river_id = ${river_id}
1074 AND kind_id=1
1075 </dc:statement>
1076 <dc:if test="dc:has-result()">
1077 <dc:for-each>
1078 <actual description="{$kind_name}"
1079 ids="{$river_id};{$kind_name};{$kind_id}"
1080 factory="riveraxis"/>
1081 </dc:for-each>
1082 </dc:if>
1083 </dc:context>
1084 <dc:context>
1085 <dc:statement>
1086 SELECT DISTINCT
1087 ak.name AS kind_name,
1088 ax.kind_id AS kind_id,
1089 ax.name AS layer_name
1090 FROM river_axes ax
1091 JOIN axis_kinds ak on ax.kind_id = ak.id
1092 WHERE river_id = ${river_id}
1093 AND kind_id &lt;&gt; 1
1094 </dc:statement>
1095 <dc:if test="dc:has-result()">
1096 <other>
1097 <dc:for-each>
1098 <misc-axis description="{$layer_name}"
1099 ids="{$river_id};{$layer_name};{$kind_id}"
1100 factory="riveraxis"/>
1101 </dc:for-each>
1102 </other>
1103 </dc:if>
1104 </dc:context>
1105 </dc:macro>
1106
1107 <dc:macro name="flood-map-hydr-boundaries-state">
1108 <dc:context>
1109 <dc:statement>
1110 SELECT DISTINCT
1111 name
1112 FROM hydr_boundaries
1113 WHERE river_id = ${river_id}
1114 AND kind = 2
1115 </dc:statement>
1116 <dc:for-each>
1117 <line factory="wmshydrboundariesfactory"
1118 ids="{$river_id};{$name};2"
1119 name="{$name}"/>
1120 </dc:for-each>
1121 </dc:context>
1122 <dc:context>
1123 <dc:statement>
1124 SELECT DISTINCT
1125 name
1126 FROM hydr_boundaries_poly
1127 WHERE river_id = ${river_id}
1128 AND kind = 2
1129 </dc:statement>
1130 <dc:for-each>
1131 <line factory="wmshydrboundariespolyfactory"
1132 ids="{$river_id};{$name};2"
1133 name="{$name}"/>
1134 </dc:for-each>
1135 </dc:context>
1136 </dc:macro>
1137
1138 <dc:macro name="flood-map-hydr-boundaries-lines">
1139 <dc:context>
1140 <dc:statement>
1141 SELECT DISTINCT
1142 name
1143 FROM hydr_boundaries
1144 WHERE river_id = ${river_id}
1145 AND kind = 1
1146 </dc:statement>
1147 <dc:comment> What about all other line kinds?</dc:comment>
1148 <dc:if test="dc:has-result()">
1149 <lines>
1150 <dc:for-each>
1151 <line factory="wmshydrboundariesfactory"
1152 ids="{$river_id};{$name};1"
1153 name="{$name}"/>
1154 </dc:for-each>
1155 </lines>
1156 </dc:if>
1157 </dc:context>
1158 </dc:macro>
1159
1160 <dc:macro name="flood-map-hydr-boundaries-poly">
1161 <dc:context>
1162 <dc:statement>
1163 SELECT DISTINCT
1164 b.sectie AS sectie_id,
1165 sk.name AS sectie
1166 FROM hydr_boundaries_poly b
1167 JOIN sectie_kinds sk ON b.sectie = sk.id
1168 WHERE b.river_id = ${river_id}
1169 AND b.kind = 1
1170 </dc:statement>
1171 <dc:if test="dc:has-result()">
1172 <sobek_areas>
1173 <dc:for-each>
1174 <boundary name="{$sectie}"
1175 factory="wmshydrboundariespolyfactory"
1176 ids="{$river_id};{$sectie};1;{$sectie_id};-1"/>
1177 </dc:for-each>
1178 </sobek_areas>
1179 </dc:if>
1180 </dc:context>
1181 <dc:context>
1182 <dc:statement>
1183 SELECT DISTINCT
1184 b.sobek AS sobek_id,
1185 sk.name AS sobek
1186 FROM hydr_boundaries_poly b
1187 JOIN sobek_kinds sk ON b.sobek = sk.id
1188 WHERE b.river_id = ${river_id}
1189 AND b.kind = 1
1190 </dc:statement>
1191 <dc:if test="dc:has-result()">
1192 <sobek_flooded>
1193 <dc:for-each>
1194 <boundary name="{$sobek}"
1195 factory="wmshydrboundariespolyfactory"
1196 ids="{$river_id};{$sobek};1;-1;{$sobek_id}"/>
1197 </dc:for-each>
1198 </sobek_flooded>
1199 </dc:if>
1200 </dc:context>
1201 </dc:macro>
1202
1203 <dc:macro name="flood-map-hydr-boundaries">
1204 <bfg_model>
1205 <areas>
1206 <dc:call-macro name="flood-map-hydr-boundaries-poly"/>
1207 </areas>
1208 <dc:call-macro name="flood-map-hydr-boundaries-lines"/>
1209 </bfg_model>
1210 <federal>
1211 <dc:call-macro name="flood-map-hydr-boundaries-state"/>
1212 </federal>
1213 </dc:macro>
1214
1215 <dc:macro name="flood-map-floodplain">
1216 <dc:context>
1217 <dc:statement>
1218 SELECT DISTINCT
1219 fp.kind_id AS kind_id,
1220 flk.name AS kind_name
1221 FROM floodplain fp
1222 JOIN floodplain_kinds flk on fp.kind_id = flk.id
1223 WHERE river_id = ${river_id}
1224 AND kind_id=1
1225 </dc:statement>
1226 <dc:if test="dc:has-result()">
1227 <dc:for-each>
1228 <floody factory="wmsfloodplainfactory"
1229 description="{$kind_name}"
1230 ids="{$river_id};{$kind_name};{$kind_id}"/>
1231 </dc:for-each>
1232 </dc:if>
1233 </dc:context>
1234 <dc:context>
1235 <dc:statement>
1236 SELECT DISTINCT
1237 flk.name AS kind_name,
1238 fp.kind_id AS kind_id,
1239 fp.name AS layer_name
1240 FROM floodplain fp
1241 JOIN floodplain_kinds flk on fp.kind_id = flk.id
1242 WHERE river_id = ${river_id}
1243 AND kind_id &lt;&gt; 1
1244 </dc:statement>
1245 <dc:if test="dc:has-result()">
1246 <other>
1247 <dc:for-each>
1248 <floody factory="wmsfloodplainfactory"
1249 description="{$layer_name}"
1250 ids="{$river_id};{$layer_name};{$kind_id}"/>
1251 </dc:for-each>
1252 </other>
1253 </dc:if>
1254 </dc:context>
1255 </dc:macro>
1256
1257 <dc:macro name="hwslines_by_kind">
1258 <dc:comment>
1259 Call from a context where fed_name hws_kind hws_name and river_id is
1260 availble
1261 </dc:comment>
1262 <Durchlass>
1263 <dc:for-each filter="$hws_kind=1">
1264 <hws factory="wmshwslinesfactory"
1265 ids="{$river_id};{$hws_name}"
1266 name="{$hws_name}"/>
1267 </dc:for-each>
1268 </Durchlass>
1269 <Damm>
1270 <dc:for-each filter="$hws_kind=2">
1271 <hws factory="wmshwslinesfactory"
1272 ids="{$river_id};{$hws_name}"
1273 name="{$hws_name}"/>
1274 </dc:for-each>
1275 </Damm>
1276 <Graben>
1277 <dc:for-each filter="$hws_kind=3">
1278 <hws factory="wmshwslinesfactory"
1279 ids="{$river_id};{$hws_name}"
1280 name="{$hws_name}"/>
1281 </dc:for-each>
1282 </Graben>
1283 </dc:macro>
1284
1285 <dc:macro name="hwslines">
1286 <hws_lines>
1287 <official>
919 <dc:context> 1288 <dc:context>
920 <dc:statement> 1289 <dc:statement>
921 SELECT id AS gauge_id, 1290 SELECT DISTINCT
922 name AS gauge_name 1291 fs.name AS fed_name,
923 FROM gauges WHERE river_id = ${river_id} 1292 fs.id AS fed_id
1293 FROM hws_lines hws
1294 JOIN fed_states fs ON hws.fed_state_id = fs.id
1295 WHERE river_id = ${river_id}
1296 AND hws.official=1
924 </dc:statement> 1297 </dc:statement>
925 <dc:for-each> 1298 <dc:for-each>
926 <gauge> 1299 <dc:context>
927 <dc:attribute name="name" value="${gauge_name}"/> 1300 <dc:statement>
928 <dc:attribute name="db-id" value="${gauge_id}"/> 1301 SELECT DISTINCT
929 <dc:attribute name="factory" value="gaugedischarge"/> 1302 name AS hws_name,
930 <dc:attribute name="from" value="${g_start}"/> 1303 kind_id AS hws_kind
931 <dc:attribute name="to" value="${g_stop}"/> 1304 FROM hws_lines
932 <dc:attribute name="ids" value="${gauge_name}"/> 1305 WHERE river_id = ${river_id}
933 </gauge> 1306 AND official=1
1307 AND fed_state_id = ${fed_id} ORDER BY name
1308 </dc:statement>
1309 <fedstate description="{$fed_name}">
1310 <dc:call-macro name="hwslines_by_kind"/>
1311 </fedstate>
1312 </dc:context>
934 </dc:for-each> 1313 </dc:for-each>
935 </dc:context> 1314 </dc:context>
936 </discharge_table_gauge>
937 </discharge_table_nn>
938 </dc:if>
939
940 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'floodmap-hws')">
941 <floodmap>
942 <dc:choose>
943 <dc:when test="dc:contains($parameters, 'recommended')">
944 <dc:call-macro name="flood-map-recommended"/>
945 </dc:when>
946 <dc:when test="dc:contains($parameters, 'dem')">
947 <dc:call-macro name="flood-map-dem"/>
948 </dc:when>
949 <dc:otherwise>
950 <dc:call-macro name="flood-map-complete"/>
951 </dc:otherwise>
952 </dc:choose>
953 </floodmap>
954 <dc:if test="dc:contains($parameters, 'hws')">
955 <hws>
956 <dc:call-macro name="flood-map-hws-lines" />
957 <dc:call-macro name="flood-map-hws-points" />
958 </hws>
959 </dc:if>
960
961 <dc:macro name="flood-map-recommended">
962 <dc:comment>
963 FIXME: Following two macros look identical to me.
964 </dc:comment>
965 <kilometrage>
966 <riveraxis>
967 <dc:attribute name="factory" value="riveraxis"/>
968 <dc:attribute name="ids" value="${river_id}"/>
969 </riveraxis>
970 </kilometrage>
971 <rastermap>
972 <background>
973 <dc:attribute name="factory" value="wmsbackground"/>
974 <dc:attribute name="ids" value="${river_id}"/>
975 </background>
976 </rastermap>
977 </dc:macro>
978 <dc:macro name="flood-map-dem">
979 <dems>
980 <dc:context> 1315 <dc:context>
981 <dc:statement> 1316 <dc:statement>
982 SELECT d.id AS dem_id, 1317 SELECT distinct
983 r.a AS dem_lower, 1318 name AS hws_name,
984 r.b AS dem_upper, 1319 kind_id AS hws_kind
985 d.name AS name, 1320 FROM hws_lines
986 d.projection || ' | ' || t.start_time || ' - ' || t.stop_time AS info 1321 WHERE river_id = ${river_id}
987 FROM dem d 1322 AND official=1
988 JOIN ranges r ON d.range_id = r.id 1323 AND fed_state_id IS NULL
989 JOIN time_intervals t ON d.time_interval_id = t.id 1324 ORDER BY name
990 WHERE d.river_id = ${river_id} 1325 </dc:statement>
1326 <hws_fed_unknown>
1327 <dc:call-macro name="hwslines_by_kind"/>
1328 </hws_fed_unknown>
1329 </dc:context>
1330 </official>
1331 <inofficial>
1332 <dc:context>
1333 <dc:statement>
1334 SELECT DISTINCT
1335 fs.name AS fed_name,
1336 fs.id AS fed_id
1337 FROM hws_lines hws
1338 JOIN fed_states fs ON hws.fed_state_id = fs.id
1339 WHERE river_id = ${river_id}
1340 AND hws.official=0
991 </dc:statement> 1341 </dc:statement>
992 <dc:for-each> 1342 <dc:for-each>
993 <dem> 1343 <dc:context>
994 <dc:attribute name="factory" value="demfactory"/> 1344 <dc:statement>
995 <dc:attribute name="ids" value="${dem_id}"/> 1345 SELECT DISTINCT
996 <dc:attribute name="name" value="${name}"/> 1346 name AS hws_name,
997 <dc:attribute name="info" value="${info}"/> 1347 kind_id AS hws_kind
998 </dem> 1348 FROM hws_lines
1349 WHERE river_id = ${river_id}
1350 AND official=0
1351 AND fed_state_id = ${fed_id} ORDER BY name
1352 </dc:statement>
1353 <fedstate description="{$fed_name}">
1354 <dc:call-macro name="hwslines_by_kind"/>
1355 </fedstate>
1356 </dc:context>
999 </dc:for-each> 1357 </dc:for-each>
1000 </dc:context> 1358 </dc:context>
1001 </dems> 1359 <dc:context>
1002 </dc:macro> 1360 <dc:statement>
1003 <dc:macro name="flood-map-hws-lines"> 1361 SELECT distinct
1004 <dc:context> 1362 name AS hws_name,
1005 <dc:statement> 1363 kind_id AS hws_kind
1006 SELECT DISTINCT 1364 FROM hws_lines
1007 name AS hws_name, 1365 WHERE river_id = ${river_id}
1008 official AS hws_official, 1366 AND official=0
1009 kind_id AS hws_kind 1367 AND fed_state_id IS NULL ORDER BY name
1010 FROM hws_lines 1368 </dc:statement>
1011 WHERE river_id = ${river_id} 1369 <hws_fed_unknown>
1012 </dc:statement> 1370 <dc:call-macro name="hwslines_by_kind"/>
1013 <lines> 1371 </hws_fed_unknown>
1014 <official> 1372 </dc:context>
1015 <Durchlass> 1373 </inofficial>
1016 <dc:for-each filter="$hws_kind=1 and $hws_official=1">
1017 <hws>
1018 <dc:attribute name="factory" value="hwsfactory"/>
1019 <dc:attribute name="name" value="${hws_name}"/>
1020 </hws>
1021 </dc:for-each>
1022 </Durchlass>
1023 <Damm>
1024 <dc:for-each filter="$hws_kind=2 and $hws_official=1">
1025 <hws>
1026 <dc:attribute name="factory" value="hwsfactory"/>
1027 <dc:attribute name="name" value="${hws_name}"/>
1028 </hws>
1029 </dc:for-each>
1030 </Damm>
1031 <Graben>
1032 <dc:for-each filter="$hws_kind=3 and $hws_official=1">
1033 <hws>
1034 <dc:attribute name="factory" value="hwsfactory"/>
1035 <dc:attribute name="name" value="${hws_name}"/>
1036 </hws>
1037 </dc:for-each>
1038 </Graben>
1039 </official>
1040 <inofficial>
1041 <Durchlass>
1042 <dc:for-each filter="$hws_kind=1 and $hws_official=0">
1043 <hws>
1044 <dc:attribute name="factory" value="hwsfactory"/>
1045 <dc:attribute name="name" value="${hws_name}"/>
1046 </hws>
1047 </dc:for-each>
1048 </Durchlass>
1049 <Damm>
1050 <dc:for-each filter="$hws_kind=2 and $hws_official=0">
1051 <hws>
1052 <dc:attribute name="factory" value="hwsfactory"/>
1053 <dc:attribute name="name" value="${hws_name}"/>
1054 </hws>
1055 </dc:for-each>
1056 </Damm>
1057 <Graben>
1058 <dc:for-each filter="$hws_kind=3 and $hws_official=0">
1059 <hws>
1060 <dc:attribute name="factory" value="hwsfactory"/>
1061 <dc:attribute name="name" value="${hws_name}"/>
1062 </hws>
1063 </dc:for-each>
1064 </Graben>
1065 </inofficial>
1066 </lines>
1067 </dc:context>
1068 </dc:macro>
1069 <dc:macro name="flood-map-hws-points">
1070 <dc:context>
1071 <dc:statement>
1072 SELECT DISTINCT
1073 name AS hws_points_name,
1074 official AS hws_points_official,
1075 kind_id AS hws_points_kind
1076 FROM hws_points
1077 WHERE river_id = ${river_id}
1078 </dc:statement>
1079 <points>
1080 <official>
1081 <Durchlass>
1082 <dc:for-each filter="$hws_points_kind=1 and $hws_points_official=1">
1083 <hws>
1084 <dc:attribute name="factory" value="hwsfactory"/>
1085 <dc:attribute name="name" value="${hws_points_name}"/>
1086 </hws>
1087 </dc:for-each>
1088 </Durchlass>
1089 <Damm>
1090 <dc:for-each filter="$hws_points_kind=2 and $hws_points_official=1">
1091 <hws>
1092 <dc:attribute name="factory" value="hwsfactory"/>
1093 <dc:attribute name="name" value="${hws_points_name}"/>
1094 </hws>
1095 </dc:for-each>
1096 </Damm>
1097 <Graben>
1098 <dc:for-each filter="$hws_kind=3 and $hws_official=1">
1099 <hws>
1100 <dc:attribute name="factory" value="hwsfactory"/>
1101 <dc:attribute name="name" value="${hws_points_name}"/>
1102 </hws>
1103 </dc:for-each>
1104 </Graben>
1105 </official>
1106 <inofficial>
1107 <Durchlass>
1108 <dc:for-each filter="$hws_points_kind=1 and $hws_points_official=0">
1109 <hws>
1110 <dc:attribute name="factory" value="hwsfactory"/>
1111 <dc:attribute name="name" value="${hws_points_name}"/>
1112 </hws>
1113 </dc:for-each>
1114 </Durchlass>
1115 <Damm>
1116 <dc:for-each filter="$hws_points_kind=2 and $hws_points_official=0">
1117 <hws>
1118 <dc:attribute name="factory" value="hwsfactory"/>
1119 <dc:attribute name="name" value="${hws_points_name}"/>
1120 </hws>
1121 </dc:for-each>
1122 </Damm>
1123 <Graben>
1124 <dc:for-each filter="$hws_points_kind=3 and $hws_points_official=0">
1125 <hws>
1126 <dc:attribute name="factory" value="hwsfactory"/>
1127 <dc:attribute name="name" value="${hws_points_name}"/>
1128 </hws>
1129 </dc:for-each>
1130 </Graben>
1131 </inofficial>
1132 </points>
1133 </dc:context>
1134 </dc:macro>
1135 <dc:macro name="flood-map-km">
1136 <dc:context>
1137 <dc:statement>
1138 SELECT count(*) as km_exists
1139 FROM river_axes_km WHERE river_id = ${river_id}
1140 </dc:statement>
1141 <dc:for-each>
1142 <dc:if test="$km_exists>0">
1143 <kilometrage>
1144 <dc:attribute name="factory" value="wmskmfactory"/>
1145 <dc:attribute name="ids" value="${river_id}"/>
1146 </kilometrage>
1147 </dc:if>
1148 </dc:for-each>
1149 </dc:context>
1150 </dc:macro>
1151 <dc:macro name="flood-map-qps">
1152 <dc:context>
1153 <dc:comment>Grab only the actual first</dc:comment>
1154 <dc:statement>
1155 SELECT DISTINCT
1156 cs.kind_id as kind_id,
1157 ck.name as kind_name
1158 FROM cross_section_tracks cs
1159 JOIN cross_section_track_kinds ck on cs.kind_id = ck.id
1160 WHERE river_id = ${river_id}
1161 AND kind_id=1
1162 </dc:statement>
1163 <dc:if test="dc:has-result()">
1164 <dc:for-each>
1165 <actual>
1166 <dc:attribute name="description" value="${kind_name}"/>
1167 <dc:attribute name="factory" value="wmsqpsfactory"/>
1168 <dc:attribute name="ids" value="${river_id};${kind_name};${kind_id}"/>
1169 </actual>
1170 </dc:for-each>
1171 </dc:if>
1172 </dc:context>
1173 <dc:context>
1174 <dc:comment>Now the other tracks</dc:comment>
1175 <dc:statement>
1176 SELECT DISTINCT
1177 cs.kind_id as kind_id,
1178 ck.name as kind_name,
1179 cs.name as layer_name
1180 FROM cross_section_tracks cs
1181 JOIN cross_section_track_kinds ck on cs.kind_id = ck.id
1182 WHERE river_id = ${river_id}
1183 AND kind_id=0
1184 </dc:statement>
1185 <dc:if test="dc:has-result()">
1186 <other>
1187 <dc:for-each>
1188 <misc-qps>
1189 <dc:attribute name="description" value="${layer_name}"/>
1190 <dc:attribute name="factory" value="wmsqpsfactory"/>
1191 <dc:attribute name="ids" value="${river_id};${layer_name};${kind_id}"/>
1192 </misc-qps>
1193 </dc:for-each>
1194 </other>
1195 </dc:if>
1196 </dc:context>
1197 </dc:macro>
1198 <dc:macro name="flood-map-riveraxis">
1199 <dc:context>
1200 <dc:statement>
1201 SELECT DISTINCT
1202 ax.kind_id as kind_id,
1203 ak.name as kind_name
1204 FROM river_axes ax
1205 JOIN axis_kinds ak on ax.kind_id = ak.id
1206 WHERE river_id = ${river_id}
1207 AND kind_id=1
1208 </dc:statement>
1209 <dc:if test="dc:has-result()">
1210 <dc:for-each>
1211 <actual factory="riveraxis">
1212 <dc:attribute name="description" value="${kind_name}"/>
1213 <dc:attribute name="ids" value="${river_id};${kind_name};${kind_id}"/>
1214 </actual>
1215 </dc:for-each>
1216 </dc:if>
1217 </dc:context>
1218 <dc:context>
1219 <dc:statement>
1220 SELECT DISTINCT
1221 ak.name as kind_name,
1222 ax.kind_id as kind_id,
1223 ax.name as layer_name
1224 FROM river_axes ax
1225 JOIN axis_kinds ak on ax.kind_id = ak.id
1226 WHERE river_id = ${river_id}
1227 AND kind_id &lt;&gt; 1
1228 </dc:statement>
1229 <dc:if test="dc:has-result()">
1230 <other>
1231 <dc:for-each>
1232 <misc-axis factory="riveraxis">
1233 <dc:attribute name="description" value="${layer_name}"/>
1234 <dc:attribute name="ids" value="${river_id};${layer_name};${kind_id}"/>
1235 </misc-axis>
1236 </dc:for-each>
1237 </other>
1238 </dc:if>
1239 </dc:context>
1240 </dc:macro>
1241 <dc:macro name="flood-map-hydr-boundaries-state">
1242 <dc:context>
1243 <dc:statement>
1244 SELECT DISTINCT
1245 name
1246 FROM hydr_boundaries
1247 WHERE river_id = ${river_id}
1248 AND kind = 2
1249 </dc:statement>
1250 <dc:for-each>
1251 <line factory="wmshydrboundariesfactory"
1252 ids="{$river_id};{$name};2"
1253 name="{$name}"/>
1254 </dc:for-each>
1255 </dc:context>
1256 <dc:context>
1257 <dc:statement>
1258 SELECT DISTINCT
1259 name
1260 FROM hydr_boundaries_poly
1261 WHERE river_id = ${river_id}
1262 AND kind = 2
1263 </dc:statement>
1264 <dc:for-each>
1265 <line factory="wmshydrboundariespolyfactory"
1266 ids="{$river_id};{$name};2"
1267 name="{$name}"/>
1268 </dc:for-each>
1269 </dc:context>
1270 </dc:macro>
1271 <dc:macro name="flood-map-hydr-boundaries-lines">
1272 <dc:context>
1273 <dc:statement>
1274 SELECT DISTINCT
1275 name
1276 FROM hydr_boundaries
1277 WHERE river_id = ${river_id}
1278 AND kind = 1
1279 </dc:statement>
1280 <dc:comment> What about all other line kinds?</dc:comment>
1281 <dc:if test="dc:has-result()">
1282 <lines>
1283 <dc:for-each>
1284 <line factory="wmshydrboundariesfactory"
1285 ids="{$river_id};{$name};1"
1286 name="{$name}"/>
1287 </dc:for-each>
1288 </lines>
1289 </dc:if>
1290 </dc:context>
1291 </dc:macro>
1292 <dc:macro name="flood-map-hydr-boundaries-poly">
1293 <dc:context>
1294 <dc:statement>
1295 SELECT DISTINCT
1296 b.sectie AS sectie_id,
1297 sk.name AS sectie
1298 FROM hydr_boundaries_poly b
1299 JOIN sectie_kinds sk ON b.sectie = sk.id
1300 WHERE b.river_id = ${river_id}
1301 AND b.kind = 1
1302 </dc:statement>
1303 <dc:if test="dc:has-result()">
1304 <sobek_areas>
1305 <dc:for-each>
1306 <boundary name="{$sectie}"
1307 factory="wmshydrboundariespolyfactory"
1308 ids="{$river_id};{$sectie};1;{$sectie_id};-1"/>
1309 </dc:for-each>
1310 </sobek_areas>
1311 </dc:if>
1312 </dc:context>
1313 <dc:context>
1314 <dc:statement>
1315 SELECT DISTINCT
1316 b.sobek AS sobek_id,
1317 sk.name AS sobek
1318 FROM hydr_boundaries_poly b
1319 JOIN sobek_kinds sk ON b.sobek = sk.id
1320 WHERE b.river_id = ${river_id}
1321 AND b.kind = 1
1322 </dc:statement>
1323 <dc:if test="dc:has-result()">
1324 <sobek_flooded>
1325 <dc:for-each>
1326 <boundary name="{$sobek}"
1327 factory="wmshydrboundariespolyfactory"
1328 ids="{$river_id};{$sobek};1;-1;{$sobek_id}"/>
1329 </dc:for-each>
1330 </sobek_flooded>
1331 </dc:if>
1332 </dc:context>
1333 </dc:macro>
1334 <dc:macro name="flood-map-hydr-boundaries">
1335 <bfg_model>
1336 <areas>
1337 <dc:call-macro name="flood-map-hydr-boundaries-poly"/>
1338 </areas>
1339 <dc:call-macro name="flood-map-hydr-boundaries-lines"/>
1340 </bfg_model>
1341 <federal>
1342 <dc:call-macro name="flood-map-hydr-boundaries-state"/>
1343 </federal>
1344 </dc:macro>
1345 <dc:macro name="flood-map-floodplain">
1346 <dc:context>
1347 <dc:statement>
1348 SELECT DISTINCT
1349 fp.kind_id as kind_id,
1350 flk.name as kind_name
1351 FROM floodplain fp
1352 JOIN floodplain_kinds flk on fp.kind_id = flk.id
1353 WHERE river_id = ${river_id}
1354 AND kind_id=1
1355 </dc:statement>
1356 <dc:if test="dc:has-result()">
1357 <dc:for-each>
1358 <floody factory="wmsfloodplainfactory"
1359 description="{$kind_name}"
1360 ids="{$river_id};{$kind_name};{$kind_id}"/>
1361 </dc:for-each>
1362 </dc:if>
1363 </dc:context>
1364 <dc:context>
1365 <dc:statement>
1366 SELECT DISTINCT
1367 flk.name as kind_name,
1368 fp.kind_id as kind_id,
1369 fp.name as layer_name
1370 FROM floodplain fp
1371 JOIN floodplain_kinds flk on fp.kind_id = flk.id
1372 WHERE river_id = ${river_id}
1373 AND kind_id &lt;&gt; 1
1374 </dc:statement>
1375 <dc:if test="dc:has-result()">
1376 <other>
1377 <dc:for-each>
1378 <floody factory="wmsfloodplainfactory"
1379 description="{$layer_name}"
1380 ids="{$river_id};{$layer_name};{$kind_id}"/>
1381 </dc:for-each>
1382 </other>
1383 </dc:if>
1384 </dc:context>
1385 </dc:macro>
1386
1387 <dc:macro name="hwslines_by_kind">
1388 <dc:comment>
1389 Call from a context where fed_name hws_kind hws_name and river_id is
1390 availble
1391 </dc:comment>
1392 <Durchlass>
1393 <dc:for-each filter="$hws_kind=1">
1394 <hws>
1395 <dc:attribute name="factory" value="wmshwslinesfactory"/>
1396 <dc:attribute name="ids" value="${river_id};${hws_name}"/>
1397 <dc:attribute name="name" value="${hws_name}"/>
1398 </hws>
1399 </dc:for-each>
1400 </Durchlass>
1401 <Damm>
1402 <dc:for-each filter="$hws_kind=2">
1403 <hws>
1404 <dc:attribute name="factory" value="wmshwslinesfactory"/>
1405 <dc:attribute name="ids" value="${river_id};${hws_name}"/>
1406 <dc:attribute name="name" value="${hws_name}"/>
1407 </hws>
1408 </dc:for-each>
1409 </Damm>
1410 <Graben>
1411 <dc:for-each filter="$hws_kind=3">
1412 <hws>
1413 <dc:attribute name="factory" value="wmshwslinesfactory"/>
1414 <dc:attribute name="ids" value="${river_id};${hws_name}"/>
1415 <dc:attribute name="name" value="${hws_name}"/>
1416 </hws>
1417 </dc:for-each>
1418 </Graben>
1419 </dc:macro>
1420
1421 <dc:macro name="hwslines">
1422 <hws_lines>
1423 <official>
1424 <dc:context>
1425 <dc:statement>
1426 SELECT DISTINCT
1427 fs.name AS fed_name,
1428 fs.id AS fed_id
1429 FROM hws_lines hws
1430 JOIN fed_states fs ON hws.fed_state_id = fs.id
1431 WHERE river_id = ${river_id}
1432 AND hws.official=1
1433 </dc:statement>
1434 <dc:for-each>
1435 <dc:context>
1436 <dc:statement>
1437 SELECT DISTINCT
1438 name AS hws_name,
1439 kind_id AS hws_kind
1440 FROM hws_lines
1441 WHERE river_id = ${river_id}
1442 AND official=1
1443 AND fed_state_id = ${fed_id} ORDER BY name
1444 </dc:statement>
1445 <fedstate>
1446 <dc:attribute name="description" value="${fed_name}"/>
1447 <dc:call-macro name="hwslines_by_kind"/>
1448 </fedstate>
1449 </dc:context>
1450 </dc:for-each>
1451 </dc:context>
1452 <dc:context>
1453 <dc:statement>
1454 SELECT distinct
1455 name AS hws_name,
1456 kind_id AS hws_kind
1457 FROM hws_lines
1458 WHERE river_id = ${river_id}
1459 AND official=1
1460 AND fed_state_id IS NULL
1461 ORDER BY name
1462 </dc:statement>
1463 <hws_fed_unknown>
1464 <dc:call-macro name="hwslines_by_kind"/>
1465 </hws_fed_unknown>
1466 </dc:context>
1467 </official>
1468 <inofficial>
1469 <dc:context>
1470 <dc:statement>
1471 SELECT DISTINCT
1472 fs.name AS fed_name,
1473 fs.id AS fed_id
1474 FROM hws_lines hws
1475 JOIN fed_states fs ON hws.fed_state_id = fs.id
1476 WHERE river_id = ${river_id}
1477 AND hws.official=0
1478 </dc:statement>
1479 <dc:for-each>
1480 <dc:context>
1481 <dc:statement>
1482 SELECT DISTINCT
1483 name AS hws_name,
1484 kind_id AS hws_kind
1485 FROM hws_lines
1486 WHERE river_id = ${river_id}
1487 AND official=0
1488 AND fed_state_id = ${fed_id} ORDER BY name
1489 </dc:statement>
1490 <fedstate>
1491 <dc:attribute name="description" value="${fed_name}"/>
1492 <dc:call-macro name="hwslines_by_kind"/>
1493 </fedstate>
1494 </dc:context>
1495 </dc:for-each>
1496 </dc:context>
1497 <dc:context>
1498 <dc:statement>
1499 SELECT distinct
1500 name AS hws_name,
1501 kind_id AS hws_kind
1502 FROM hws_lines
1503 WHERE river_id = ${river_id}
1504 AND official=0
1505 AND fed_state_id IS NULL ORDER BY name
1506 </dc:statement>
1507 <hws_fed_unknown>
1508 <dc:call-macro name="hwslines_by_kind"/>
1509 </hws_fed_unknown>
1510 </dc:context>
1511 </inofficial>
1512 </hws_lines> 1374 </hws_lines>
1513 </dc:macro> 1375 </dc:macro>
1514 1376
1515 <dc:macro name="hwspoints_by_kind"> 1377 <dc:macro name="hwspoints_by_kind">
1516 <dc:comment> 1378 <dc:comment>
1517 Call from a context where fed_name hws_kind hws_name and river_id is 1379 Call from a context where fed_name hws_kind hws_name and river_id is
1518 availble 1380 availble
1519 </dc:comment> 1381 </dc:comment>
1520 <Durchlass> 1382 <Durchlass>
1521 <dc:for-each filter="$hws_kind=1"> 1383 <dc:for-each filter="$hws_kind=1">
1522 <hws> 1384 <hws factory="wmshwspointsfactory"
1523 <dc:attribute name="factory" value="wmshwspointsfactory"/> 1385 ids="{$river_id};{$hws_name}"
1524 <dc:attribute name="ids" value="${river_id};${hws_name}"/> 1386 name="{$hws_name}"/>
1525 <dc:attribute name="name" value="${hws_name}"/> 1387 </dc:for-each>
1526 </hws> 1388 </Durchlass>
1527 </dc:for-each> 1389 <Damm>
1528 </Durchlass> 1390 <dc:for-each filter="$hws_kind=2">
1529 <Damm> 1391 <hws factory="wmshwspointsfactory"
1530 <dc:for-each filter="$hws_kind=2"> 1392 ids="{$river_id};{$hws_name}"
1531 <hws> 1393 name="{$hws_name}"/>
1532 <dc:attribute name="factory" value="wmshwspointsfactory"/> 1394 </dc:for-each>
1533 <dc:attribute name="ids" value="${river_id};${hws_name}"/> 1395 </Damm>
1534 <dc:attribute name="name" value="${hws_name}"/> 1396 <Graben>
1535 </hws> 1397 <dc:for-each filter="$hws_kind=3">
1536 </dc:for-each> 1398 <hws factory="wmshwspointsfactory"
1537 </Damm> 1399 ids="{$river_id};{$hws_name}"
1538 <Graben> 1400 name="{$hws_name}"/>
1539 <dc:for-each filter="$hws_kind=3"> 1401 </dc:for-each>
1540 <hws> 1402 </Graben>
1541 <dc:attribute name="factory" value="wmshwspointsfactory"/> 1403 </dc:macro>
1542 <dc:attribute name="ids" value="${river_id};${hws_name}"/> 1404
1543 <dc:attribute name="name" value="${hws_name}"/> 1405 <dc:macro name="hwspoints">
1544 </hws> 1406 <hws_points>
1545 </dc:for-each> 1407 <official>
1546 </Graben> 1408 <dc:context>
1547 </dc:macro> 1409 <dc:statement>
1548 1410 SELECT DISTINCT
1549 <dc:macro name="hwspoints"> 1411 fs.name AS fed_name,
1550 <hws_points> 1412 fs.id AS fed_id
1551 <official> 1413 FROM hws_points hws
1552 <dc:context> 1414 JOIN fed_states fs ON hws.fed_state_id = fs.id
1553 <dc:statement> 1415 WHERE river_id = ${river_id}
1554 SELECT DISTINCT 1416 AND hws.official=1
1555 fs.name AS fed_name, 1417 </dc:statement>
1556 fs.id AS fed_id 1418 <dc:for-each>
1557 FROM hws_points hws 1419 <dc:context>
1558 JOIN fed_states fs ON hws.fed_state_id = fs.id 1420 <dc:statement>
1559 WHERE river_id = ${river_id} 1421 SELECT DISTINCT
1560 AND hws.official=1 1422 name AS hws_name,
1561 </dc:statement> 1423 kind_id AS hws_kind
1562 <dc:for-each> 1424 FROM hws_points
1563 <dc:context> 1425 WHERE river_id = ${river_id}
1564 <dc:statement> 1426 AND official=1
1565 SELECT DISTINCT 1427 AND fed_state_id = ${fed_id} ORDER BY name
1566 name AS hws_name, 1428 </dc:statement>
1567 kind_id AS hws_kind 1429 <fedstate description="{$fed_name}">
1568 FROM hws_points 1430 <dc:call-macro name="hwspoints_by_kind"/>
1569 WHERE river_id = ${river_id} 1431 </fedstate>
1570 AND official=1 1432 </dc:context>
1571 AND fed_state_id = ${fed_id} ORDER BY name 1433 </dc:for-each>
1572 </dc:statement> 1434 </dc:context>
1573 <fedstate> 1435 <dc:context>
1574 <dc:attribute name="description" value="${fed_name}"/> 1436 <dc:statement>
1575 <dc:call-macro name="hwspoints_by_kind"/> 1437 SELECT distinct
1576 </fedstate> 1438 name AS hws_name,
1577 </dc:context> 1439 kind_id AS hws_kind
1578 </dc:for-each> 1440 FROM hws_points
1579 </dc:context> 1441 WHERE river_id = ${river_id}
1580 <dc:context> 1442 AND official=1
1581 <dc:statement> 1443 AND fed_state_id IS NULL
1582 SELECT distinct 1444 ORDER BY name
1583 name AS hws_name, 1445 </dc:statement>
1584 kind_id AS hws_kind 1446 <hws_fed_unknown>
1585 FROM hws_points 1447 <dc:call-macro name="hwspoints_by_kind"/>
1586 WHERE river_id = ${river_id} 1448 </hws_fed_unknown>
1587 AND official=1 1449 </dc:context>
1588 AND fed_state_id IS NULL 1450 </official>
1589 ORDER BY name 1451 <inofficial>
1590 </dc:statement> 1452 <dc:context>
1591 <hws_fed_unknown> 1453 <dc:statement>
1592 <dc:call-macro name="hwspoints_by_kind"/> 1454 SELECT DISTINCT
1593 </hws_fed_unknown> 1455 fs.name AS fed_name,
1594 </dc:context> 1456 fs.id AS fed_id
1595 </official> 1457 FROM hws_points hws
1596 <inofficial> 1458 JOIN fed_states fs ON hws.fed_state_id = fs.id
1597 <dc:context> 1459 WHERE river_id = ${river_id}
1598 <dc:statement> 1460 AND hws.official=0
1599 SELECT DISTINCT 1461 </dc:statement>
1600 fs.name AS fed_name, 1462 <dc:for-each>
1601 fs.id AS fed_id 1463 <dc:context>
1602 FROM hws_points hws 1464 <dc:statement>
1603 JOIN fed_states fs ON hws.fed_state_id = fs.id 1465 SELECT DISTINCT
1604 WHERE river_id = ${river_id} 1466 name AS hws_name,
1605 AND hws.official=0 1467 kind_id AS hws_kind
1606 </dc:statement> 1468 FROM hws_points
1607 <dc:for-each> 1469 WHERE river_id = ${river_id}
1608 <dc:context> 1470 AND official=0
1609 <dc:statement> 1471 AND fed_state_id = ${fed_id} ORDER BY name
1610 SELECT DISTINCT 1472 </dc:statement>
1611 name AS hws_name, 1473 <fedstate description="{$fed_name}">
1612 kind_id AS hws_kind 1474 <dc:call-macro name="hwspoints_by_kind"/>
1613 FROM hws_points 1475 </fedstate>
1614 WHERE river_id = ${river_id} 1476 </dc:context>
1615 AND official=0 1477 </dc:for-each>
1616 AND fed_state_id = ${fed_id} ORDER BY name 1478 </dc:context>
1617 </dc:statement> 1479 <dc:context>
1618 <fedstate> 1480 <dc:statement>
1619 <dc:attribute name="description" value="${fed_name}"/> 1481 SELECT distinct
1620 <dc:call-macro name="hwspoints_by_kind"/> 1482 name AS hws_name,
1621 </fedstate> 1483 kind_id AS hws_kind
1622 </dc:context> 1484 FROM hws_points
1623 </dc:for-each> 1485 WHERE river_id = ${river_id}
1624 </dc:context> 1486 AND official=0
1625 <dc:context> 1487 AND fed_state_id IS NULL ORDER BY name
1626 <dc:statement> 1488 </dc:statement>
1627 SELECT distinct 1489 <hws_fed_unknown>
1628 name AS hws_name, 1490 <dc:call-macro name="hwspoints_by_kind"/>
1629 kind_id AS hws_kind 1491 </hws_fed_unknown>
1630 FROM hws_points 1492 </dc:context>
1631 WHERE river_id = ${river_id} 1493 </inofficial>
1632 AND official=0
1633 AND fed_state_id IS NULL ORDER BY name
1634 </dc:statement>
1635 <hws_fed_unknown>
1636 <dc:call-macro name="hwspoints_by_kind"/>
1637 </hws_fed_unknown>
1638 </dc:context>
1639 </inofficial>
1640 </hws_points> 1494 </hws_points>
1641 </dc:macro> 1495 </dc:macro>
1642 1496
1643 <dc:macro name="flood-map-buildings"> 1497 <dc:macro name="flood-map-buildings">
1644 <dc:context> 1498 <dc:context>
1650 JOIN building_kinds bk ON b.kind_id = bk.id 1504 JOIN building_kinds bk ON b.kind_id = bk.id
1651 WHERE b.river_id = ${river_id} 1505 WHERE b.river_id = ${river_id}
1652 AND b.kind_id &lt;&gt; 0 1506 AND b.kind_id &lt;&gt; 0
1653 </dc:statement> 1507 </dc:statement>
1654 <dc:for-each> 1508 <dc:for-each>
1655 <buildings> 1509 <buildings description="{$building_kind}"
1656 <dc:attribute name="description" value="${building_kind}"/> 1510 factory="wmsbuildingsfactory"
1657 <dc:attribute name="factory" value="wmsbuildingsfactory"/> 1511 ids="{$river_id};{$building_kind};{$building_kind_id}"/>
1658 <dc:attribute name="ids" value="${river_id};${building_kind};${building_kind_id}"/>
1659 </buildings>
1660 </dc:for-each> 1512 </dc:for-each>
1661 </dc:context> 1513 </dc:context>
1662 <dc:context> 1514 <dc:context>
1663 <dc:statement> 1515 <dc:statement>
1664 SELECT DISTINCT 1516 SELECT DISTINCT
1672 kind_id IS NULL 1524 kind_id IS NULL
1673 </dc:statement> 1525 </dc:statement>
1674 <dc:for-each> 1526 <dc:for-each>
1675 <dc:element name="${building_kind}"> 1527 <dc:element name="${building_kind}">
1676 <dc:for-each> 1528 <dc:for-each>
1677 <buildings> 1529 <buildings description="{$building_name}"
1678 <dc:attribute name="description" value="${building_name}"/> 1530 factory="wmsbuildingsfactory"
1679 <dc:attribute name="factory" value="wmsbuildingsfactory"/> 1531 ids="{$river_id};{$building_name}"/>
1680 <dc:attribute name="ids" value="${river_id};${building_name}"/>
1681 </buildings>
1682 </dc:for-each> 1532 </dc:for-each>
1683 </dc:element> 1533 </dc:element>
1684 </dc:for-each> 1534 </dc:for-each>
1685 </dc:context> 1535 </dc:context>
1686 <dc:context> 1536 <dc:context>
1693 WHERE river_id = ${river_id} 1543 WHERE river_id = ${river_id}
1694 </dc:statement> 1544 </dc:statement>
1695 <dc:if test="dc:has-result()"> 1545 <dc:if test="dc:has-result()">
1696 <jetties> 1546 <jetties>
1697 <dc:for-each> 1547 <dc:for-each>
1698 <jetty> 1548 <jetty description="{$jetty_kind}"
1699 <dc:attribute name="description" value="${jetty_kind}"/> 1549 factory="wmsjettiesfactory"
1700 <dc:attribute name="factory" value="wmsjettiesfactory"/> 1550 ids="{$river_id};{$jetty_kind};{$jetty_kind_id}"/>
1701 <dc:attribute name="ids" value="${river_id};${jetty_kind};${jetty_kind_id}"/>
1702 </jetty>
1703 </dc:for-each> 1551 </dc:for-each>
1704 </jetties> 1552 </jetties>
1705 </dc:if> 1553 </dc:if>
1706 </dc:context> 1554 </dc:context>
1707 </dc:macro> 1555 </dc:macro>
1708 <dc:macro name="flood-map-fixpoints"> 1556
1709 <dc:context> 1557 <dc:macro name="flood-map-fixpoints">
1710 <dc:statement> 1558 <dc:context>
1711 SELECT count(*) as km_exists, name as name 1559 <dc:statement>
1712 FROM fixpoints WHERE river_id = ${river_id} GROUP BY name 1560 SELECT count(*) AS km_exists, name AS name
1713 </dc:statement> 1561 FROM fixpoints WHERE river_id = ${river_id} GROUP BY name
1714 <dc:for-each> 1562 </dc:statement>
1715 <dc:if test="$km_exists>0"> 1563 <dc:for-each>
1716 <fixpoint> 1564 <dc:if test="$km_exists&gt;0">
1717 <dc:attribute name="factory" value="wmsfixpointsfactory"/> 1565 <fixpoint factory="wmsfixpointsfactory"
1718 <dc:attribute name="ids" value="${river_id};${name}"/> 1566 ids="{$river_id};{$name}"
1719 <dc:attribute name="name" value="${name}"/> 1567 name="{$name}"/>
1720 </fixpoint> 1568 </dc:if>
1721 </dc:if> 1569 </dc:for-each>
1722 </dc:for-each> 1570 </dc:context>
1723 </dc:context> 1571 </dc:macro>
1724 </dc:macro> 1572
1725 <dc:macro name="flood-map-gaugelocations"> 1573 <dc:macro name="flood-map-gaugelocations">
1726 <dc:attribute name="factory" value="externalwmsfactory"/> 1574 <dc:attribute name="factory" value="externalwmsfactory"/>
1727 <dc:attribute name="ids" value="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelonline-Pegelpunkte"/> 1575 <dc:attribute name="ids" value="http://www.pegelonline.wsv.de/webservices/gis/wms;Pegelpunkte;Pegelonline-Pegelpunkte"/>
1728 </dc:macro> 1576 </dc:macro>
1729 <dc:macro name="flood-map-uesk"> 1577
1730 <uesk> 1578 <dc:macro name="flood-map-uesk">
1731 <calculations> 1579 <uesk>
1732 <current> 1580 <calculations>
1733 <bfg> 1581 <current>
1734 <dc:context> 1582 <bfg>
1735 <dc:statement> 1583 <dc:context>
1736 SELECT count(*) as uesg_exist, name as name 1584 <dc:statement>
1737 FROM floodmaps 1585 SELECT count(*) AS uesg_exist, name AS name
1738 WHERE river_id = ${river_id} AND kind = 111 1586 FROM floodmaps
1739 GROUP BY name, kind 1587 WHERE river_id = ${river_id} AND kind = 111
1740 </dc:statement> 1588 GROUP BY name, kind
1741 <dc:for-each> 1589 </dc:statement>
1742 <dc:if test="$uesg_exist>0"> 1590 <dc:for-each>
1743 <floodmaps> 1591 <dc:if test="$uesg_exist&gt;0">
1744 <dc:attribute name="factory" value="wmsfloodmapsfactory"/> 1592 <floodmaps factory="wmsfloodmapsfactory"
1745 <dc:attribute name="ids" value="${river_id};${name}"/> 1593 ids="{$river_id};{$name}"
1746 <dc:attribute name="name" value="${name}"/> 1594 name="{$name}"/>
1747 </floodmaps> 1595 </dc:if>
1748 </dc:if> 1596 </dc:for-each>
1749 </dc:for-each> 1597 </dc:context>
1750 </dc:context> 1598 </bfg>
1751 </bfg> 1599 <land>
1752 <land> 1600 <dc:context>
1753 <dc:context> 1601 <dc:statement>
1754 <dc:statement> 1602 SELECT count(*) AS uesg_exist, name AS name
1755 SELECT count(*) as uesg_exist, name as name 1603 FROM floodmaps
1756 FROM floodmaps 1604 WHERE river_id = ${river_id} AND kind = 112
1757 WHERE river_id = ${river_id} AND kind = 112 1605 GROUP BY name, kind
1758 GROUP BY name, kind 1606 </dc:statement>
1759 </dc:statement> 1607 <dc:for-each>
1760 <dc:for-each> 1608 <dc:if test="$uesg_exist&gt;0">
1761 <dc:if test="$uesg_exist>0"> 1609 <floodmaps factory="wmsfloodmapsfactory"
1762 <floodmaps> 1610 ids="{$river_id};{$name}"
1763 <dc:attribute name="factory" value="wmsfloodmapsfactory"/> 1611 name="{$name}"/>
1764 <dc:attribute name="ids" value="${river_id};${name}"/> 1612 </dc:if>
1765 <dc:attribute name="name" value="${name}"/> 1613 </dc:for-each>
1766 </floodmaps> 1614 </dc:context>
1767 </dc:if> 1615 </land>
1768 </dc:for-each> 1616 </current>
1769 </dc:context> 1617 <potentiel>
1770 </land> 1618 <bfg>
1771 </current> 1619 <dc:context>
1772 <potentiel> 1620 <dc:statement>
1773 <bfg> 1621 SELECT count(*) AS uesg_exist, name AS name
1774 <dc:context> 1622 FROM floodmaps
1775 <dc:statement> 1623 WHERE river_id = ${river_id} AND kind = 121
1776 SELECT count(*) as uesg_exist, name as name 1624 GROUP BY name, kind
1777 FROM floodmaps 1625 </dc:statement>
1778 WHERE river_id = ${river_id} AND kind = 121 1626 <dc:for-each>
1779 GROUP BY name, kind 1627 <dc:if test="$uesg_exist&gt;0">
1780 </dc:statement> 1628 <floodmaps factory="wmsfloodmapsfactory"
1781 <dc:for-each> 1629 ids="{$river_id};{$name}"
1782 <dc:if test="$uesg_exist>0"> 1630 name="{$name}"/>
1783 <floodmaps> 1631 </dc:if>
1784 <dc:attribute name="factory" value="wmsfloodmapsfactory"/> 1632 </dc:for-each>
1785 <dc:attribute name="ids" value="${river_id};${name}"/> 1633 </dc:context>
1786 <dc:attribute name="name" value="${name}"/> 1634 </bfg>
1787 </floodmaps> 1635 <land>
1788 </dc:if> 1636 <dc:context>
1789 </dc:for-each> 1637 <dc:statement>
1790 </dc:context> 1638 SELECT count(*) AS uesg_exist, name AS name
1791 </bfg> 1639 FROM floodmaps
1792 <land> 1640 WHERE river_id = ${river_id} AND kind = 122
1793 <dc:context> 1641 GROUP BY name, kind
1794 <dc:statement> 1642 </dc:statement>
1795 SELECT count(*) as uesg_exist, name as name 1643 <dc:for-each>
1796 FROM floodmaps 1644 <dc:if test="$uesg_exist&gt;0">
1797 WHERE river_id = ${river_id} AND kind = 122 1645 <floodmaps factory="wmsfloodmapsfactory"
1798 GROUP BY name, kind 1646 ids="{$river_id};{$name}"
1799 </dc:statement> 1647 name="{$name}"/>
1800 <dc:for-each> 1648 </dc:if>
1801 <dc:if test="$uesg_exist>0"> 1649 </dc:for-each>
1802 <floodmaps> 1650 </dc:context>
1803 <dc:attribute name="factory" value="wmsfloodmapsfactory"/> 1651 </land>
1804 <dc:attribute name="ids" value="${river_id};${name}"/> 1652 </potentiel>
1805 <dc:attribute name="name" value="${name}"/> 1653 </calculations>
1806 </floodmaps> 1654 </uesk>
1807 </dc:if> 1655 </dc:macro>
1808 </dc:for-each> 1656
1809 </dc:context> 1657 <dc:macro name="flood-map-catchments">
1810 </land> 1658 <dc:attribute name="factory" value="externalwmsfactory"/>
1811 </potentiel> 1659 <dc:attribute name="ids" value="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiet"/>
1812 </calculations> 1660 </dc:macro>
1813 </uesk> 1661
1814 </dc:macro> 1662 <dc:macro name="flood-map-routing">
1815 1663 <qps>
1816 <dc:macro name="flood-map-catchments"> 1664 <dc:call-macro name="flood-map-qps"/>
1817 <dc:attribute name="factory" value="externalwmsfactory"/> 1665 </qps>
1818 <dc:attribute name="ids" value="http://geoportal.bafg.de/wmsproxy/INSPIRE/DrainageBasin;HY.PHYSICALWATERS.CATCHMENTS;Einzugsgebiet"/> 1666 <dc:call-macro name="flood-map-fixpoints"/>
1819 </dc:macro> 1667 <dc:call-macro name="flood-map-km"/>
1820 1668 <axis>
1821 <dc:macro name="flood-map-routing"> 1669 <dc:call-macro name="flood-map-riveraxis"/>
1822 <qps> 1670 </axis>
1823 <dc:call-macro name="flood-map-qps"/> 1671 </dc:macro>
1824 </qps> 1672
1825 <dc:call-macro name="flood-map-fixpoints"/> 1673 <dc:macro name="flood-map-complete">
1826 <dc:call-macro name="flood-map-km"/> 1674 <buildings>
1827 <axis> 1675 <dc:call-macro name="flood-map-buildings"/>
1828 <dc:call-macro name="flood-map-riveraxis"/> 1676 </buildings>
1829 </axis> 1677 <catchments>
1830 </dc:macro> 1678 <dc:call-macro name="flood-map-catchments"/>
1831 1679 </catchments>
1832 <dc:macro name="flood-map-complete"> 1680 <dc:comment><!-- TODO: HW-Marken --></dc:comment>
1833 <buildings> 1681 <hws>
1834 <dc:call-macro name="flood-map-buildings"/> 1682 <dc:call-macro name="hwslines"/>
1835 </buildings> 1683 <dc:call-macro name="hwspoints"/>
1836 <catchments> 1684 </hws>
1837 <dc:call-macro name="flood-map-catchments"/> 1685 <route_data>
1838 </catchments> 1686 <dc:call-macro name="flood-map-routing"/>
1839 <!-- TODO: HW-Marken --> 1687 </route_data>
1840 <hws> 1688 <hydrboundaries>
1841 <dc:call-macro name="hwslines"/> 1689 <dc:call-macro name="flood-map-floodplain"/>
1842 <dc:call-macro name="hwspoints"/> 1690 <dc:call-macro name="flood-map-hydr-boundaries"/>
1843 </hws> 1691 </hydrboundaries>
1844 <route_data> 1692 <dc:call-macro name="flood-map-uesk"/>
1845 <dc:call-macro name="flood-map-routing"/> 1693 <gaugelocations>
1846 </route_data> 1694 <dc:call-macro name="flood-map-gaugelocations"/>
1847 <hydrboundaries> 1695 </gaugelocations>
1848 <dc:call-macro name="flood-map-floodplain"/> 1696 <background factory="wmsbackground" ids="{$river_id}"/>
1849 <dc:call-macro name="flood-map-hydr-boundaries"/> 1697 </dc:macro>
1850 </hydrboundaries> 1698
1851 <dc:call-macro name="flood-map-uesk"/>
1852 <gaugelocations>
1853 <dc:call-macro name="flood-map-gaugelocations"/>
1854 </gaugelocations>
1855 <background>
1856 <dc:attribute name="factory" value="wmsbackground"/>
1857 <dc:attribute name="ids" value="${river_id}"/>
1858 </background>
1859 </dc:macro>
1860 </dc:if> 1699 </dc:if>
1700
1861 <dc:if test="dc:contains($artifact-outs, 'minfo-heights')"> 1701 <dc:if test="dc:contains($artifact-outs, 'minfo-heights')">
1862 <dc:call-macro name="minfo-heights"/> 1702 <dc:call-macro name="minfo-heights"/>
1863 <dc:macro name="minfo-heights"> 1703 <dc:macro name="minfo-heights">
1864 <bedheights> 1704 <bedheights>
1865 <dc:call-macro name="bed-heights-single"/> 1705 <dc:call-macro name="bed-heights-single"/>
1870 <dc:if test="dc:contains($artifact-outs, 'minfo-heights-epoch')"> 1710 <dc:if test="dc:contains($artifact-outs, 'minfo-heights-epoch')">
1871 <bedheights> 1711 <bedheights>
1872 <dc:call-macro name="bed-heights-epoch"/> 1712 <dc:call-macro name="bed-heights-epoch"/>
1873 </bedheights> 1713 </bedheights>
1874 </dc:if> 1714 </dc:if>
1715
1875 <dc:macro name="bed-heights-single"> 1716 <dc:macro name="bed-heights-single">
1876 <single> 1717 <single>
1877 <dc:context> 1718 <dc:context>
1878 <dc:statement> 1719 <dc:statement>
1879 SELECT id AS bedh_id, 1720 SELECT id AS bedh_id,
1880 year AS bedh_year, 1721 year AS bedh_year,
1881 description AS bedh_descr 1722 description AS bedh_descr
1882 FROM bed_height_single WHERE river_id = ${river_id} 1723 FROM bed_height_single WHERE river_id = ${river_id}
1883 </dc:statement> 1724 </dc:statement>
1884 <dc:for-each> 1725 <dc:for-each>
1885 <height> 1726 <height factory="bedheight"
1886 <dc:attribute name="factory" value="bedheight"/> 1727 ids="bedheight-single-{$bedh_id}-{$bedh_year}"
1887 <dc:attribute name="ids" value="bedheight-single-${bedh_id}-${bedh_year}"/> 1728 description="{$bedh_descr}"/>
1888 <dc:attribute name="description" value="${bedh_descr}"/>
1889 </height>
1890 </dc:for-each> 1729 </dc:for-each>
1891 </dc:context> 1730 </dc:context>
1892 </single> 1731 </single>
1893 </dc:macro> 1732 </dc:macro>
1733
1894 <dc:macro name="bed-heights-epoch"> 1734 <dc:macro name="bed-heights-epoch">
1895 <epoch> 1735 <epoch>
1896 <dc:context> 1736 <dc:context>
1897 <dc:statement> 1737 <dc:statement>
1898 SELECT id AS bedh_id, 1738 SELECT id AS bedh_id,
1899 time_interval_id AS bedh_interval_id, 1739 time_interval_id AS bedh_interval_id,
1900 description AS bedh_descr 1740 description AS bedh_descr
1901 FROM bed_height_epoch WHERE river_id = ${river_id} 1741 FROM bed_height_epoch WHERE river_id = ${river_id}
1902 </dc:statement> 1742 </dc:statement>
1903 <dc:for-each> 1743 <dc:for-each>
1904 <height> 1744 <height factory="bedheight"
1905 <dc:attribute name="factory" value="bedheight"/> 1745 ids="bedheight-epoch-{$bedh_id}-{$bedh_interval_id}"
1906 <dc:attribute name="ids" value="bedheight-epoch-${bedh_id}-${bedh_interval_id}"/> 1746 description="{$bedh_descr}"/>
1907 <dc:attribute name="description" value="${bedh_descr}"/>
1908 </height>
1909 </dc:for-each> 1747 </dc:for-each>
1910 </dc:context> 1748 </dc:context>
1911 </epoch> 1749 </epoch>
1912 </dc:macro> 1750 </dc:macro>
1751
1913 </dc:for-each> 1752 </dc:for-each>
1914 </dc:context> 1753 </dc:context>
1915 </dc:macro> 1754 </dc:macro>
1916 1755
1917 <dc:choose> 1756 <dc:choose>
1919 User specific part 1758 User specific part
1920 ------------------ 1759 ------------------
1921 </dc:comment> 1760 </dc:comment>
1922 <dc:when test="dc:contains($parameters, 'user-id')"> 1761 <dc:when test="dc:contains($parameters, 'user-id')">
1923 1762
1924 1763 <old_calculations>
1925 <old_calculations> 1764
1926 <!-- <dc:macro name="load-user">--> 1765 <dc:comment><!-- <dc:macro name="load-user">--></dc:comment>
1927 <dc:call-macro name="user-range"> 1766 <dc:call-macro name="user-range">
1928 <dc:context connection="user"> 1767 <dc:context connection="user">
1929 <dc:comment> 1768 <dc:comment> Get the user and collection-id. </dc:comment>
1930 Get the user and collection-id. 1769 <dc:statement>
1931 </dc:comment> 1770 SELECT u.id AS user_id, c.id AS collection_id, c.name AS collection_name
1932 <dc:statement> 1771 FROM collections c JOIN users u ON c.user_id = u.id
1933 SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name 1772 WHERE u.gid = CAST(${user-id} AS uuid)
1934 FROM collections c JOIN users u ON c.user_id = u.id 1773 ORDER BY c.creation DESC
1935 WHERE u.gid = CAST(${user-id} AS uuid) 1774 </dc:statement>
1936 ORDER BY c.creation DESC 1775
1937 </dc:statement> 1776 <dc:macro name="range-filter">
1938 1777 <dc:statement>
1939 1778 SELECT m.id AS a_id,
1940 <dc:macro name="range-filter"> 1779 m.state AS a_state,
1941 <dc:statement> 1780 m.gid AS a_gid,
1942 SELECT m.id AS a_id, 1781 m.creation AS a_creation,
1943 m.state AS a_state, 1782 COALESCE(ld_mode, '') AS ld_m,
1944 m.gid AS a_gid, 1783 COALESCE(ld_locations, '') AS ld_l,
1945 m.creation AS a_creation, 1784 COALESCE(ld_from, '') AS ld_f,
1946 COALESCE(ld_mode, '') AS ld_m, 1785 COALESCE(ld_to, '') AS ld_t
1947 COALESCE(ld_locations, '') AS ld_l, 1786 FROM master_artifacts_range m
1948 COALESCE(ld_from, '') AS ld_f, 1787 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid)
1949 COALESCE(ld_to, '') AS ld_t 1788 AND EXISTS (
1950 FROM master_artifacts_range m 1789 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river})
1951 WHERE m.collection_id = ${collection_id} AND m.gid &lt;&gt; CAST(${artifact-id} AS uuid) 1790 </dc:statement>
1952 AND EXISTS ( 1791 <dc:for-each>
1953 SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river}) 1792 <dc:variable name="from" type="number" expr="dc:fromValue($ld_m, $ld_l, $ld_f)"/>
1954 </dc:statement> 1793 <dc:variable name="to" type="number" expr="dc:toValue($ld_m, $ld_l, $ld_t)"/>
1955 <dc:for-each> 1794 <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)">
1956 <dc:variable name="from" type="number" expr="dc:fromValue($ld_m, $ld_l, $ld_f)"/> 1795 <dc:macro-body/>
1957 <dc:variable name="to" type="number" expr="dc:toValue($ld_m, $ld_l, $ld_t)"/> 1796 </dc:if>
1958 <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)"> 1797 </dc:for-each>
1959 <dc:macro-body/> 1798 </dc:macro>
1960 </dc:if> 1799
1961 </dc:for-each> 1800 <!-- OFFICIAL LINES -->
1962 </dc:macro> 1801 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
1963 1802 <dc:comment comment=".wst -------------------------------"/>
1964 <!-- OFFICIAL LINES --> 1803 <officiallines>
1965 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')"> 1804 <dc:for-each>
1966 <dc:comment comment=".wst -------------------------------"/> 1805 <dc:context>
1967 <officiallines> 1806 <dc:statement>
1968 <dc:for-each> 1807 SELECT m.id AS a_id,
1969 <dc:context> 1808 m.state AS a_state,
1970 <dc:statement> 1809 m.gid AS a_gid,
1971 SELECT m.id AS a_id, 1810 m.creation AS a_creation,
1972 m.state AS a_state, 1811 ardg.v AS gaugy,
1973 m.gid AS a_gid, 1812 arv.v AS wqsingle
1974 m.creation AS a_creation, 1813 FROM master_artifacts m,
1975 ardg.v AS gaugy, 1814 artifact_data ardg,
1976 arv.v AS wqsingle 1815 artifact_data arv
1977 FROM master_artifacts m, 1816 WHERE m.collection_id = ${collection_id}
1978 artifact_data ardg, 1817 AND m.gid = CAST(${artifact-id} AS uuid)
1979 artifact_data arv 1818 AND ardg.artifact_id = m.id
1980 WHERE m.collection_id = ${collection_id} 1819 AND ardg.k = 'ld_gaugename'
1981 AND m.gid = CAST(${artifact-id} AS uuid) 1820 AND arv.artifact_id = m.id
1982 AND ardg.artifact_id = m.id 1821 AND arv.k = 'wq_single'
1983 AND ardg.k = 'ld_gaugename' 1822 AND EXISTS (
1984 AND arv.artifact_id = m.id 1823 SELECT id
1985 AND arv.k = 'wq_single' 1824 FROM artifact_data ad
1986 AND EXISTS ( 1825 WHERE ad.artifact_id = m.id
1987 SELECT id 1826 AND k = 'river'
1988 FROM artifact_data ad 1827 AND v = ${river})
1989 WHERE ad.artifact_id = m.id 1828 </dc:statement>
1990 AND k = 'river' 1829 <dc:for-each>
1991 AND v = ${river})
1992 </dc:statement>
1993 <dc:for-each>
1994 <dc:context connection="system"> 1830 <dc:context connection="system">
1995 <dc:statement> 1831 <dc:statement>
1996 SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval 1832 SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval
1997 FROM official_q_values ol 1833 FROM official_q_values ol
1998 WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy} 1834 WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy}
2003 <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/> 1839 <dc:attribute name="ids" value="additionals-wstv-${wstcolpos}-${wstid}"/>
2004 <dc:attribute name="factory" value="staticwkms"/> 1840 <dc:attribute name="factory" value="staticwkms"/>
2005 </dc:element> 1841 </dc:element>
2006 </dc:for-each> 1842 </dc:for-each>
2007 </dc:context> 1843 </dc:context>
2008 </dc:for-each> 1844 </dc:for-each>
2009 </dc:context> 1845 </dc:context>
2010 </dc:for-each> 1846 </dc:for-each>
2011 </officiallines> 1847 </officiallines>
2012 </dc:if> 1848 </dc:if>
2013 <!-- END OFFICIAL LINES --> 1849 <!-- END OFFICIAL LINES -->
2014 1850
2015 <dc:comment> 1851 <dc:comment>
2016 SHOW W-DIFFERENCES 1852 SHOW W-DIFFERENCES
2017 </dc:comment> 1853 </dc:comment>
2018 1854
2019 <dc:macro name="differences"> 1855 <dc:macro name="differences">
2020 <differences> 1856 <differences>
2021 <dc:for-each> 1857 <dc:for-each>
2022 <dc:context> 1858 <dc:context>
2023 <dc:call-macro name="range-filter"> 1859 <dc:call-macro name="range-filter">
2024 <dc:context> 1860 <dc:context>
2025 <dc:statement> 1861 <dc:statement>
2026 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description 1862 SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description
2027 FROM outs as o, facets as f, artifacts as a 1863 FROM outs AS o, facets AS f, artifacts AS a
2028 WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} 1864 WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
2029 </dc:statement> 1865 </dc:statement>
2030 <dc:for-each> 1866 <dc:for-each>
2031 <dc:element name="${facet_name}"> 1867 <dc:element name="${facet_name}">
2032 <dc:attribute name="description" value="${facet_description}"/> 1868 <dc:attribute name="description" value="${facet_description}"/>
2033 <dc:attribute name="factory" value="winfo"/> 1869 <dc:attribute name="factory" value="winfo"/>
2034 <dc:attribute name="artifact-id" value="${aid}"/> 1870 <dc:attribute name="artifact-id" value="${aid}"/>
2035 <dc:attribute name="ids" value="${aid}"/> 1871 <dc:attribute name="ids" value="${aid}"/>
2036 <dc:attribute name="out" value="w_differences"/> 1872 <dc:attribute name="out" value="w_differences"/>
2037 </dc:element> 1873 </dc:element>
2038 </dc:for-each> 1874 </dc:for-each>
2039 </dc:context> 1875 </dc:context>
2040 </dc:call-macro> 1876 </dc:call-macro>
2041 </dc:context> 1877 </dc:context>
2042 </dc:for-each> 1878 </dc:for-each>
2043 </differences> 1879 </differences>
2044 </dc:macro> 1880 </dc:macro>
2045 1881
2046 <dc:comment> 1882 <dc:comment>
2047 SHOW REFERENCE CURVE 1883 SHOW REFERENCE CURVE
2048 </dc:comment> 1884 </dc:comment>
2049 1885
2050 1886 <dc:macro name="reference-curves">
2051 <dc:macro name="reference-curves"> 1887 <reference_curves>
2052 <reference_curves> 1888 <dc:for-each>
2053 <dc:for-each> 1889 <dc:context>
2054 <dc:context> 1890 <dc:call-macro name="user-range">
2055 <dc:call-macro name="user-range">
2056 <dc:context> 1891 <dc:context>
2057 <dc:statement> 1892 <dc:statement>
2058 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description 1893 SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description
2059 FROM outs as o, facets as f, artifacts as a 1894 FROM outs AS o, facets AS f, artifacts AS a
2060 WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} 1895 WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
2061 </dc:statement> 1896 </dc:statement>
2062 <dc:for-each> 1897 <dc:for-each>
2063 <dc:element name="${facet_name}"> 1898 <dc:element name="${facet_name}">
2064 <dc:attribute name="description" value="${facet_description}"/> 1899 <dc:attribute name="description" value="${facet_description}"/>
2065 <dc:attribute name="factory" value="winfo"/> 1900 <dc:attribute name="factory" value="winfo"/>
2066 <dc:attribute name="artifact-id" value="${aid}"/> 1901 <dc:attribute name="artifact-id" value="${aid}"/>
2067 <dc:attribute name="ids" value="${aid}"/> 1902 <dc:attribute name="ids" value="${aid}"/>
2068 <dc:attribute name="out" value="reference_curve"/> 1903 <dc:attribute name="out" value="reference_curve"/>
2069 </dc:element> 1904 </dc:element>
2070 </dc:for-each> 1905 </dc:for-each>
2071 </dc:context> 1906 </dc:context>
2072 </dc:call-macro> 1907 </dc:call-macro>
2073 </dc:context> 1908 </dc:context>
2074 </dc:for-each> 1909 </dc:for-each>
2075 </reference_curves> 1910 </reference_curves>
2076 </dc:macro> 1911 </dc:macro>
2077 1912
2078 <dc:comment> 1913 <dc:comment>
2079 SHOW COMPUTED DISCHARGE CURVES 1914 SHOW COMPUTED DISCHARGE CURVES
2080 </dc:comment> 1915 </dc:comment>
2081 1916
2082 <dc:macro name="computed-discharge-curve"> 1917 <dc:macro name="computed-discharge-curve">
2083 <computed_discharge_curves> 1918 <computed_discharge_curves>
2084 <dc:for-each> 1919 <dc:for-each>
2085 <dc:context> 1920 <dc:context>
2086 <dc:call-macro name="range-filter"> 1921 <dc:call-macro name="range-filter">
2087 <dc:context> 1922 <dc:context>
2088 <dc:statement> 1923 <dc:statement>
2089 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description 1924 SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description
2090 FROM outs as o, facets as f, artifacts as a 1925 FROM outs AS o, facets AS f, artifacts AS a
2091 WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} 1926 WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
2092 </dc:statement> 1927 </dc:statement>
2093 <dc:for-each> 1928 <dc:for-each>
2094 <dc:element name="${facet_name}"> 1929 <dc:element name="${facet_name}">
2095 <dc:attribute name="description" value="${facet_description}"/> 1930 <dc:attribute name="description" value="${facet_description}"/>
2096 <dc:attribute name="factory" value="winfo"/> 1931 <dc:attribute name="factory" value="winfo"/>
2097 <dc:attribute name="artifact-id" value="${aid}"/> 1932 <dc:attribute name="artifact-id" value="${aid}"/>
2098 <dc:attribute name="ids" value="${aid}"/> 1933 <dc:attribute name="ids" value="${aid}"/>
2099 <dc:attribute name="out" value="computed_discharge_curve"/> 1934 <dc:attribute name="out" value="computed_discharge_curve"/>
2100 </dc:element> 1935 </dc:element>
2101 </dc:for-each> 1936 </dc:for-each>
2102 </dc:context> 1937 </dc:context>
2103 </dc:call-macro> 1938 </dc:call-macro>
2104 </dc:context> 1939 </dc:context>
2105 </dc:for-each> 1940 </dc:for-each>
2106 </computed_discharge_curves> 1941 </computed_discharge_curves>
2107 </dc:macro> 1942 </dc:macro>
2108 1943
2109 <dc:comment> 1944 <dc:comment>
2110 CROSS SECTION 1945 CROSS SECTION
2111 </dc:comment> 1946 </dc:comment>
2112 1947
2113 1948 <dc:macro name="waterlevels">
2114 <dc:macro name="waterlevels"> 1949 <waterlevels>
2115 <waterlevels> 1950 <dc:for-each>
2116 <dc:for-each>
2117 <dc:context>
2118 <dc:call-macro name="range-filter">
2119 <dc:context>
2120 <dc:statement>
2121 SELECT id AS out_id
2122 FROM outs
2123 WHERE artifact_id = ${a_id} AND name = 'cross_section'
2124 </dc:statement>
2125 <dc:for-each>
2126 <dc:context>
2127 <dc:statement>
2128 SELECT name AS facet_name, num as facet_num, description AS facet_description
2129 FROM facets
2130 WHERE out_id = ${out_id}
2131 ORDER BY num ASC, name DESC
2132 </dc:statement>
2133 <longitudinal_section_columns>
2134 <dc:attribute name="description" value="${river} ${a_creation}"/>
2135 <dc:for-each>
2136 <dc:element name="${facet_name}">
2137 <dc:attribute name="description" value="${facet_description}"/>
2138 <dc:attribute name="ids" value="${facet_num}"/>
2139 <dc:attribute name="factory" value="winfo"/>
2140 <dc:attribute name="artifact-id" value="${a_gid}"/>
2141 <dc:attribute name="out" value="cross_section"/>
2142 </dc:element>
2143 </dc:for-each>
2144 </longitudinal_section_columns>
2145 </dc:context>
2146 </dc:for-each>
2147 </dc:context>
2148 </dc:call-macro>
2149 </dc:context>
2150 </dc:for-each>
2151 </waterlevels>
2152 </dc:macro>
2153
2154
2155 <dc:macro name="longitudinal">
2156 <waterlevels>
2157 <dc:for-each>
2158 <dc:context>
2159 <dc:call-macro name="range-filter">
2160 <dc:context> 1951 <dc:context>
2161 <dc:statement> 1952 <dc:call-macro name="range-filter">
2162 SELECT id AS out_id
2163 FROM outs
2164 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
2165 </dc:statement>
2166 <dc:for-each>
2167 <dc:context>
2168 <dc:statement>
2169 SELECT name AS facet_name, num as facet_num, description AS facet_description
2170 FROM facets
2171 WHERE out_id = ${out_id}
2172 ORDER BY num ASC, name DESC
2173 </dc:statement>
2174 <longitudinal_section_columns>
2175 <dc:attribute name="description" value="${river} ${a_creation}"/>
2176 <dc:for-each>
2177 <dc:element name="${facet_name}">
2178 <dc:attribute name="description" value="${facet_description}"/>
2179 <dc:attribute name="ids" value="${facet_num}"/>
2180 <dc:attribute name="factory" value="winfo"/>
2181 <dc:attribute name="artifact-id" value="${a_gid}"/>
2182 <dc:attribute name="out" value="longitudinal_section"/>
2183 </dc:element>
2184 </dc:for-each>
2185 </longitudinal_section_columns>
2186 </dc:context>
2187 </dc:for-each>
2188 </dc:context>
2189 </dc:call-macro>
2190 </dc:context>
2191 </dc:for-each>
2192 </waterlevels>
2193 </dc:macro>
2194
2195
2196 <dc:macro name="longitudinal-section">
2197 <waterlevels>
2198 <dc:for-each>
2199 <dc:context>
2200 <dc:call-macro name="range-filter">
2201 <dc:context>
2202 <dc:statement>
2203 SELECT id AS out_id
2204 FROM outs
2205 WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve'
2206 </dc:statement>
2207 <dc:for-each>
2208 <dc:context>
2209 <!-- average und deviation ls_0 . ls_1 ...-->
2210 <dc:statement>
2211 SELECT name AS facet_name, num as facet_num, description AS facet_description
2212 FROM facets
2213 WHERE out_id = ${out_id} AND ( name LIKE 'fix_deviation_ls%' OR name LIKE 'fix_sector_average_ls%' OR name LIKE 'fix_analysis_events_ls%' OR name LIKE 'fix_reference_events_ls%' )
2214 ORDER BY num ASC, name DESC
2215 </dc:statement>
2216 <waterlevels>
2217 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2218 <dc:for-each>
2219 <dc:element name="${facet_name}">
2220 <dc:attribute name="description" value="${facet_description}"/>
2221 <dc:attribute name="ids" value="${facet_num}"/>
2222 <dc:attribute name="factory" value="fixanalysis"/>
2223 <dc:attribute name="artifact-id" value="${a_gid}"/>
2224 <dc:attribute name="out" value="fix_longitudinal_section_curve"/>
2225 </dc:element>
2226 </dc:for-each>
2227 </waterlevels>
2228 </dc:context>
2229 </dc:for-each>
2230 </dc:context>
2231 </dc:call-macro>
2232 </dc:context>
2233 </dc:for-each>
2234 </waterlevels>
2235 </dc:macro>
2236
2237 <dc:macro name="delta-wt">
2238 <waterlevels>
2239 <dc:for-each>
2240 <dc:context>
2241 <dc:call-macro name="range-filter">
2242 <dc:context>
2243 <dc:statement>
2244 SELECT id AS out_id
2245 FROM outs
2246 WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve'
2247 </dc:statement>
2248 <dc:for-each>
2249 <dc:context>
2250 <dc:statement>
2251 SELECT name AS facet_name, num as facet_num, description AS facet_description
2252 FROM facets
2253 WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_dwt%' OR name LIKE 'fix_deviation_dwt%' OR name = 'fix_analysis_events_dwt' OR name = 'fix_reference_events_dwt' OR name = 'fix_analysis_periods_dwt' )
2254 ORDER BY num ASC, name DESC
2255 </dc:statement>
2256 <waterlevels>
2257 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2258 <dc:for-each>
2259 <dc:element name="${facet_name}">
2260 <dc:attribute name="description" value="${facet_description}"/>
2261 <dc:attribute name="ids" value="${facet_num}"/>
2262 <dc:attribute name="factory" value="fixanalysis"/>
2263 <dc:attribute name="artifact-id" value="${a_gid}"/>
2264 <dc:attribute name="out" value="fix_deltawt_curve"/>
2265 </dc:element>
2266 </dc:for-each>
2267 </waterlevels>
2268 </dc:context>
2269 </dc:for-each>
2270 </dc:context>
2271 </dc:call-macro>
2272 </dc:context>
2273 </dc:for-each>
2274 </waterlevels>
2275 </dc:macro>
2276
2277
2278 <dc:macro name="fix-derivate-curve">
2279 <waterlevels>
2280 <dc:for-each>
2281 <dc:context>
2282 <dc:call-macro name="range-filter">
2283 <dc:context>
2284 <dc:statement>
2285 SELECT id AS out_id
2286 FROM outs
2287 WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve'
2288 </dc:statement>
2289 <dc:for-each>
2290 <dc:context>
2291 <dc:statement>
2292 SELECT name AS facet_name, num as facet_num, description AS facet_description
2293 FROM facets
2294 WHERE out_id = ${out_id} and name = 'fix_derivate_curve'
2295 ORDER BY num ASC, name DESC
2296 </dc:statement>
2297 <waterlevels>
2298 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2299 <dc:for-each>
2300 <dc:element name="${facet_name}">
2301 <dc:attribute name="description" value="${facet_description}"/>
2302 <dc:attribute name="ids" value="${facet_num}"/>
2303 <dc:attribute name="factory" value="fixanalysis"/>
2304 <dc:attribute name="artifact-id" value="${a_gid}"/>
2305 <dc:attribute name="out" value="fix_derivate_curve"/>
2306 </dc:element>
2307 </dc:for-each>
2308 </waterlevels>
2309 </dc:context>
2310 </dc:for-each>
2311 </dc:context>
2312 </dc:call-macro>
2313 </dc:context>
2314 </dc:for-each>
2315 </waterlevels>
2316 </dc:macro>
2317
2318
2319 <dc:macro name="fix-wq-curve">
2320 <waterlevels>
2321 <dc:for-each>
2322 <dc:context>
2323 <dc:call-macro name="range-filter">
2324 <dc:context>
2325 <dc:statement>
2326 SELECT id AS out_id
2327 FROM outs
2328 WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve'
2329 </dc:statement>
2330 <dc:for-each>
2331 <dc:context>
2332 <dc:statement>
2333 SELECT name AS facet_name, num as facet_num, description AS facet_description
2334 FROM facets
2335 WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_wq%' OR name = 'fix_wq_curve' OR name LIKE 'fix_analysis_events_wq%' OR name LIKE 'fix_reference_events_wq%' )
2336 ORDER BY num ASC, name DESC
2337 </dc:statement>
2338 <waterlevels>
2339 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2340 <dc:for-each>
2341 <dc:element name="${facet_name}">
2342 <dc:attribute name="description" value="${facet_description}"/>
2343 <dc:attribute name="ids" value="${facet_num}"/>
2344 <dc:attribute name="factory" value="fixanalysis"/>
2345 <dc:attribute name="artifact-id" value="${a_gid}"/>
2346 <dc:attribute name="out" value="fix_wq_curve"/>
2347 </dc:element>
2348 </dc:for-each>
2349 </waterlevels>
2350 </dc:context>
2351 </dc:for-each>
2352 </dc:context>
2353 </dc:call-macro>
2354 </dc:context>
2355 </dc:for-each>
2356 </waterlevels>
2357 </dc:macro>
2358
2359
2360 <dc:macro name="duration-curve">
2361 <computed_discharge_curves>
2362 <dc:for-each>
2363 <dc:context>
2364 <dc:call-macro name="range-filter">
2365 <dc:context> 1953 <dc:context>
2366 <dc:statement> 1954 <dc:statement>
2367 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description 1955 SELECT id AS out_id
2368 FROM outs as o, facets as f, artifacts as a 1956 FROM outs
2369 WHERE (f.name = 'duration_curve.q' or f.name = 'duration_curve.w') and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} 1957 WHERE artifact_id = ${a_id} AND name = 'cross_section'
1958 </dc:statement>
1959 <dc:for-each>
1960 <dc:context>
1961 <dc:statement>
1962 SELECT name AS facet_name, num AS facet_num, description AS facet_description
1963 FROM facets
1964 WHERE out_id = ${out_id}
1965 ORDER BY num ASC, name DESC
1966 </dc:statement>
1967 <longitudinal_section_columns description="{$river} {$a_creation}">
1968 <dc:for-each>
1969 <dc:element name="${facet_name}">
1970 <dc:attribute name="description" value="${facet_description}"/>
1971 <dc:attribute name="ids" value="${facet_num}"/>
1972 <dc:attribute name="factory" value="winfo"/>
1973 <dc:attribute name="artifact-id" value="${a_gid}"/>
1974 <dc:attribute name="out" value="cross_section"/>
1975 </dc:element>
1976 </dc:for-each>
1977 </longitudinal_section_columns>
1978 </dc:context>
1979 </dc:for-each>
1980 </dc:context>
1981 </dc:call-macro>
1982 </dc:context>
1983 </dc:for-each>
1984 </waterlevels>
1985 </dc:macro>
1986
1987 <dc:macro name="longitudinal">
1988 <waterlevels>
1989 <dc:for-each>
1990 <dc:context>
1991 <dc:call-macro name="range-filter">
1992 <dc:context>
1993 <dc:statement>
1994 SELECT id AS out_id
1995 FROM outs
1996 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
1997 </dc:statement>
1998 <dc:for-each>
1999 <dc:context>
2000 <dc:statement>
2001 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2002 FROM facets
2003 WHERE out_id = ${out_id}
2004 ORDER BY num ASC, name DESC
2005 </dc:statement>
2006 <longitudinal_section_columns description="{$river} {$a_creation}">
2007 <dc:for-each>
2008 <dc:element name="${facet_name}">
2009 <dc:attribute name="description" value="${facet_description}"/>
2010 <dc:attribute name="ids" value="${facet_num}"/>
2011 <dc:attribute name="factory" value="winfo"/>
2012 <dc:attribute name="artifact-id" value="${a_gid}"/>
2013 <dc:attribute name="out" value="longitudinal_section"/>
2014 </dc:element>
2015 </dc:for-each>
2016 </longitudinal_section_columns>
2017 </dc:context>
2018 </dc:for-each>
2019 </dc:context>
2020 </dc:call-macro>
2021 </dc:context>
2022 </dc:for-each>
2023 </waterlevels>
2024 </dc:macro>
2025
2026 <dc:macro name="longitudinal-section">
2027 <waterlevels>
2028 <dc:for-each>
2029 <dc:context>
2030 <dc:call-macro name="range-filter">
2031 <dc:context>
2032 <dc:statement>
2033 SELECT id AS out_id
2034 FROM outs
2035 WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve'
2036 </dc:statement>
2037 <dc:for-each>
2038 <dc:context>
2039 <dc:comment><!-- average und deviation ls_0 . ls_1 ...--></dc:comment>
2040 <dc:statement>
2041 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2042 FROM facets
2043 WHERE out_id = ${out_id} AND (
2044 name LIKE 'fix_deviation_ls%' OR
2045 name LIKE 'fix_sector_average_ls%' OR
2046 name LIKE 'fix_analysis_events_ls%' OR
2047 name LIKE 'fix_reference_events_ls%' )
2048 ORDER BY num ASC, name DESC
2049 </dc:statement>
2050 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2051 <dc:for-each>
2052 <dc:element name="${facet_name}">
2053 <dc:attribute name="description" value="${facet_description}"/>
2054 <dc:attribute name="ids" value="${facet_num}"/>
2055 <dc:attribute name="factory" value="fixanalysis"/>
2056 <dc:attribute name="artifact-id" value="${a_gid}"/>
2057 <dc:attribute name="out" value="fix_longitudinal_section_curve"/>
2058 </dc:element>
2059 </dc:for-each>
2060 </waterlevels>
2061 </dc:context>
2062 </dc:for-each>
2063 </dc:context>
2064 </dc:call-macro>
2065 </dc:context>
2066 </dc:for-each>
2067 </waterlevels>
2068 </dc:macro>
2069
2070 <dc:macro name="delta-wt">
2071 <waterlevels>
2072 <dc:for-each>
2073 <dc:context>
2074 <dc:call-macro name="range-filter">
2075 <dc:context>
2076 <dc:statement>
2077 SELECT id AS out_id
2078 FROM outs
2079 WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve'
2080 </dc:statement>
2081 <dc:for-each>
2082 <dc:context>
2083 <dc:statement>
2084 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2085 FROM facets
2086 WHERE out_id = ${out_id} and (
2087 name LIKE 'fix_sector_average_dwt%' OR
2088 name LIKE 'fix_deviation_dwt%' OR
2089 name = 'fix_analysis_events_dwt' OR
2090 name = 'fix_reference_events_dwt' OR
2091 name = 'fix_analysis_periods_dwt' )
2092 ORDER BY num ASC, name DESC
2093 </dc:statement>
2094 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2095 <dc:for-each>
2096 <dc:element name="${facet_name}">
2097 <dc:attribute name="description" value="${facet_description}"/>
2098 <dc:attribute name="ids" value="${facet_num}"/>
2099 <dc:attribute name="factory" value="fixanalysis"/>
2100 <dc:attribute name="artifact-id" value="${a_gid}"/>
2101 <dc:attribute name="out" value="fix_deltawt_curve"/>
2102 </dc:element>
2103 </dc:for-each>
2104 </waterlevels>
2105 </dc:context>
2106 </dc:for-each>
2107 </dc:context>
2108 </dc:call-macro>
2109 </dc:context>
2110 </dc:for-each>
2111 </waterlevels>
2112 </dc:macro>
2113
2114 <dc:macro name="fix-derivate-curve">
2115 <waterlevels>
2116 <dc:for-each>
2117 <dc:context>
2118 <dc:call-macro name="range-filter">
2119 <dc:context>
2120 <dc:statement>
2121 SELECT id AS out_id
2122 FROM outs
2123 WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve'
2124 </dc:statement>
2125 <dc:for-each>
2126 <dc:context>
2127 <dc:statement>
2128 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2129 FROM facets
2130 WHERE out_id = ${out_id} and name = 'fix_derivate_curve'
2131 ORDER BY num ASC, name DESC
2132 </dc:statement>
2133 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2134 <dc:for-each>
2135 <dc:element name="${facet_name}">
2136 <dc:attribute name="description" value="${facet_description}"/>
2137 <dc:attribute name="ids" value="${facet_num}"/>
2138 <dc:attribute name="factory" value="fixanalysis"/>
2139 <dc:attribute name="artifact-id" value="${a_gid}"/>
2140 <dc:attribute name="out" value="fix_derivate_curve"/>
2141 </dc:element>
2142 </dc:for-each>
2143 </waterlevels>
2144 </dc:context>
2145 </dc:for-each>
2146 </dc:context>
2147 </dc:call-macro>
2148 </dc:context>
2149 </dc:for-each>
2150 </waterlevels>
2151 </dc:macro>
2152
2153 <dc:macro name="fix-wq-curve">
2154 <waterlevels>
2155 <dc:for-each>
2156 <dc:context>
2157 <dc:call-macro name="range-filter">
2158 <dc:context>
2159 <dc:statement>
2160 SELECT id AS out_id
2161 FROM outs
2162 WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve'
2163 </dc:statement>
2164 <dc:for-each>
2165 <dc:context>
2166 <dc:statement>
2167 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2168 FROM facets
2169 WHERE out_id = ${out_id} and (
2170 name LIKE 'fix_sector_average_wq%' OR
2171 name = 'fix_wq_curve' OR
2172 name LIKE 'fix_analysis_events_wq%' OR
2173 name LIKE 'fix_reference_events_wq%' )
2174 ORDER BY num ASC, name DESC
2175 </dc:statement>
2176 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2177 <dc:for-each>
2178 <dc:element name="${facet_name}">
2179 <dc:attribute name="description" value="${facet_description}"/>
2180 <dc:attribute name="ids" value="${facet_num}"/>
2181 <dc:attribute name="factory" value="fixanalysis"/>
2182 <dc:attribute name="artifact-id" value="${a_gid}"/>
2183 <dc:attribute name="out" value="fix_wq_curve"/>
2184 </dc:element>
2185 </dc:for-each>
2186 </waterlevels>
2187 </dc:context>
2188 </dc:for-each>
2189 </dc:context>
2190 </dc:call-macro>
2191 </dc:context>
2192 </dc:for-each>
2193 </waterlevels>
2194 </dc:macro>
2195
2196 <dc:macro name="duration-curve">
2197 <computed_discharge_curves>
2198 <dc:for-each>
2199 <dc:context>
2200 <dc:call-macro name="range-filter">
2201 <dc:context>
2202 <dc:statement>
2203 SELECT a.gid AS aid,
2204 f.id AS fid,
2205 f.name AS facet_name,
2206 f.num AS facet_num,
2207 f.description AS facet_description
2208 FROM outs AS o, facets AS f, artifacts AS a
2209 WHERE
2210 (f.name = 'duration_curve.q' OR f.name = 'duration_curve.w') AND
2211 f.out_id = o.id AND
2212 o.artifact_id = ${a_id} AND
2213 a.id = ${a_id}
2370 </dc:statement> 2214 </dc:statement>
2371 <dc:for-each> 2215 <dc:for-each>
2372 <dc:element name="${facet_name}"> 2216 <dc:element name="${facet_name}">
2373 <dc:attribute name="description" value="${facet_description}"/> 2217 <dc:attribute name="description" value="${facet_description}"/>
2374 <dc:attribute name="factory" value="winfo"/> 2218 <dc:attribute name="factory" value="winfo"/>
2375 <dc:attribute name="artifact-id" value="${aid}"/> 2219 <dc:attribute name="artifact-id" value="${aid}"/>
2376 <dc:attribute name="ids" value="${aid}"/> 2220 <dc:attribute name="ids" value="${aid}"/>
2377 <dc:attribute name="out" value="duration_curve"/> 2221 <dc:attribute name="out" value="duration_curve"/>
2378 </dc:element> 2222 </dc:element>
2379 </dc:for-each> 2223 </dc:for-each>
2380 </dc:context> 2224 </dc:context>
2381 </dc:call-macro> 2225 </dc:call-macro>
2382 </dc:context>
2383 </dc:for-each>
2384 </computed_discharge_curves>
2385 </dc:macro>
2386
2387 <dc:comment>
2388 WATERLEVELS - ONLY SHOW Ws
2389 </dc:comment>
2390
2391 <!-- TODO doesnt work nicely for fix/wq-diags. -->
2392
2393 <dc:macro name="waterlevels-fix">
2394 <waterlevels>
2395 <dc:for-each>
2396 <dc:context>
2397 <dc:call-macro name="range-filter">
2398 <dc:context>
2399 <dc:statement>
2400 SELECT id AS out_id
2401 FROM outs
2402 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
2403 </dc:statement>
2404 <dc:for-each>
2405 <dc:context>
2406 <dc:statement>
2407 SELECT name AS facet_name, num as facet_num, description AS facet_description
2408 FROM facets
2409 WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
2410 ORDER BY num ASC, name DESC
2411 </dc:statement>
2412 <waterlevels>
2413 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2414 <dc:for-each>
2415 <dc:element name="${facet_name}">
2416 <dc:attribute name="description" value="${facet_description}"/>
2417 <dc:attribute name="ids" value="${facet_num}"/>
2418 <dc:attribute name="factory" value="winfo"/>
2419 <dc:attribute name="artifact-id" value="${a_gid}"/>
2420 <dc:attribute name="out" value="longitudinal_section"/>
2421 </dc:element>
2422 </dc:for-each>
2423 </waterlevels>
2424 </dc:context>
2425 </dc:for-each>
2426 </dc:context> 2226 </dc:context>
2427 </dc:call-macro> 2227 </dc:for-each>
2428 </dc:context> 2228 </computed_discharge_curves>
2429 </dc:for-each> 2229 </dc:macro>
2430 </waterlevels> 2230
2431 </dc:macro> 2231 <dc:comment>
2432 2232 WATERLEVELS - ONLY SHOW Ws
2433 <dc:comment> 2233 </dc:comment>
2434 SHOW FLOODMAPS 2234
2435 </dc:comment> 2235 <dc:comment><!-- TODO doesnt work nicely for fix/wq-diags. --></dc:comment>
2436 2236
2437 2237 <dc:macro name="waterlevels-fix">
2438 <dc:macro name="flood-map"> 2238 <waterlevels>
2439 <floodmap> 2239 <dc:for-each>
2440 <dc:for-each> 2240 <dc:context>
2441 <dc:context> 2241 <dc:call-macro name="range-filter">
2442 <dc:call-macro name="range-filter">
2443 <dc:context> 2242 <dc:context>
2444 <dc:statement> 2243 <dc:statement>
2445 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description 2244 SELECT id AS out_id
2446 FROM outs as o, facets as f, artifacts as a 2245 FROM outs
2447 WHERE f.name = 'floodmap.wsplgen' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} 2246 WHERE artifact_id = ${a_id} AND name = 'longitudinal_section'
2247 </dc:statement>
2248 <dc:for-each>
2249 <dc:context>
2250 <dc:statement>
2251 SELECT name AS facet_name, num AS facet_num, description AS facet_description
2252 FROM facets
2253 WHERE out_id = ${out_id} and name = 'longitudinal_section.w'
2254 ORDER BY num ASC, name DESC
2255 </dc:statement>
2256 <waterlevels description="{$river} {$a_creation} {$collection_name}">
2257 <dc:for-each>
2258 <dc:element name="${facet_name}">
2259 <dc:attribute name="description" value="${facet_description}"/>
2260 <dc:attribute name="ids" value="${facet_num}"/>
2261 <dc:attribute name="factory" value="winfo"/>
2262 <dc:attribute name="artifact-id" value="${a_gid}"/>
2263 <dc:attribute name="out" value="longitudinal_section"/>
2264 </dc:element>
2265 </dc:for-each>
2266 </waterlevels>
2267 </dc:context>
2268 </dc:for-each>
2269 </dc:context>
2270 </dc:call-macro>
2271 </dc:context>
2272 </dc:for-each>
2273 </waterlevels>
2274 </dc:macro>
2275
2276 <dc:comment>
2277 SHOW FLOODMAPS
2278 </dc:comment>
2279
2280 <dc:macro name="flood-map">
2281 <floodmap>
2282 <dc:for-each>
2283 <dc:context>
2284 <dc:call-macro name="range-filter">
2285 <dc:context>
2286 <dc:statement>
2287 SELECT a.gid AS aid,
2288 f.id AS fid,
2289 f.name AS facet_name,
2290 f.num AS facet_num,
2291 f.description AS facet_description
2292 FROM outs AS o, facets AS f, artifacts AS a
2293 WHERE f.name = 'floodmap.wsplgen' AND
2294 f.out_id = o.id AND
2295 o.artifact_id = ${a_id} AND
2296 a.id = ${a_id}
2448 </dc:statement> 2297 </dc:statement>
2449 <dc:for-each> 2298 <dc:for-each>
2450 <dc:element name="${facet_name}"> 2299 <dc:element name="${facet_name}">
2451 <dc:attribute name="description" value="${facet_description}"/> 2300 <dc:attribute name="description" value="${facet_description}"/>
2452 <dc:attribute name="factory" value="winfo"/> 2301 <dc:attribute name="factory" value="winfo"/>
2453 <dc:attribute name="artifact-id" value="${aid}"/> 2302 <dc:attribute name="artifact-id" value="${aid}"/>
2454 <dc:attribute name="ids" value="${aid}"/> 2303 <dc:attribute name="ids" value="${aid}"/>
2455 <dc:attribute name="out" value="floodmap"/> 2304 <dc:attribute name="out" value="floodmap"/>
2456 </dc:element> 2305 </dc:element>
2457 </dc:for-each> 2306 </dc:for-each>
2458 </dc:context> 2307 </dc:context>
2459 </dc:call-macro> 2308 </dc:call-macro>
2460 </dc:context> 2309 </dc:context>
2461 </dc:for-each> 2310 </dc:for-each>
2462 </floodmap> 2311 </floodmap>
2463 </dc:macro> 2312 </dc:macro>
2464 2313
2465 <dc:comment> 2314 <dc:comment>
2466 MINFO bedheight difference 2315 MINFO bedheight difference
2467 </dc:comment> 2316 </dc:comment>
2468 2317
2469 <dc:macro name="bed-difference"> 2318 <dc:macro name="bed-difference">
2470 <fix_longitudinal_section_curve> 2319 <fix_longitudinal_section_curve>
2471 <dc:for-each> 2320 <dc:for-each>
2472 <dc:context> 2321 <dc:context>
2473 <dc:call-macro name="range-filter"> 2322 <dc:call-macro name="range-filter">
2474 <dc:context> 2323 <dc:context>
2475 <dc:statement> 2324 <dc:statement>
2476 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description 2325 SELECT a.gid AS aid,
2477 FROM outs as o, facets as f, artifacts as a 2326 f.id AS fid,
2478 WHERE (f.name = 'fix_sector_average_ls_0' or f.name = 'fix_sector_average_ls_1' or f.name = 'fix_sector_average_ls_2' 2327 f.name AS facet_name,
2479 or f.name = 'fix_sector_average_ls_3' or f.name = 'fix_analysis_events_ls' or f.name = 'fix_reference_events_ls') 2328 f.num AS facet_num,
2480 and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} 2329 f.description AS facet_description
2330 FROM outs AS o, facets AS f, artifacts AS a
2331 WHERE (
2332 f.name = 'fix_sector_average_ls_0' OR
2333 f.name = 'fix_sector_average_ls_1' OR
2334 f.name = 'fix_sector_average_ls_2' OR
2335 f.name = 'fix_sector_average_ls_3' OR
2336 f.name = 'fix_analysis_events_ls' OR
2337 f.name = 'fix_reference_events_ls'
2338 ) AND f.out_id = o.id AND o.artifact_id = ${a_id} AND a.id = ${a_id}
2481 </dc:statement> 2339 </dc:statement>
2482 <fix_longitudinal_section_curve> 2340 <fix_longitudinal_section_curve description="{$river} {$a_creation} {$collection_name}">
2483 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2484 <dc:for-each>
2485 <dc:element name="${facet_name}">
2486 <dc:attribute name="description" value="${facet_description}"/>
2487 <dc:attribute name="factory" value="fixanalysis"/>
2488 <dc:attribute name="artifact-id" value="${aid}"/>
2489 <dc:attribute name="ids" value="${facet_num}"/>
2490 <dc:attribute name="out" value="fix_longitudinal_section_curve"/>
2491 </dc:element>
2492 </dc:for-each>
2493 </fix_longitudinal_section_curve>
2494 </dc:context>
2495 </dc:call-macro>
2496 </dc:context>
2497 </dc:for-each>
2498 </fix_longitudinal_section_curve>
2499 </dc:macro>
2500
2501 <dc:comment>
2502 MINFO bedheight middle
2503 </dc:comment>
2504
2505 <dc:macro name="bed-height">
2506 <fix_vollmer_wq_curve>
2507 <dc:for-each>
2508 <dc:context>
2509 <dc:call-macro name="range-filter">
2510 <dc:context>
2511 <dc:statement>
2512 SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description
2513 FROM outs as o, facets as f, artifacts as a
2514 WHERE (f.name = 'longitudinal_section.w' or f.name = 'heightmarks_points')
2515 and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id}
2516 </dc:statement>
2517 <fix_vollmer_wq_curve>
2518 <dc:attribute name="description" value="${river} ${a_creation} ${collection_name}"/>
2519 <dc:for-each>
2520 <dc:element name="${facet_name}">
2521 <dc:attribute name="description" value="${facet_description}"/>
2522 <dc:attribute name="factory" value="fixanalysis"/>
2523 <dc:attribute name="artifact-id" value="${aid}"/>
2524 <dc:attribute name="ids" value="${facet_num}"/>
2525 <dc:attribute name="out" value="longitudinal_section"/>
2526 </dc:element>
2527 </dc:for-each>
2528 </fix_vollmer_wq_curve>
2529 </dc:context>
2530 </dc:call-macro>
2531 </dc:context>
2532 </dc:for-each>
2533 </fix_vollmer_wq_curve>
2534 </dc:macro>
2535
2536 <dc:macro name="floodmap-hws-user">
2537 <dc:context>
2538 <dc:statement>
2539 SELECT id AS out_id
2540 FROM outs
2541 WHERE artifact_id = ${a_id} AND name = 'floodmap'
2542 </dc:statement>
2543 <dc:for-each>
2544 <dc:context>
2545 <dc:statement>
2546 SELECT name AS facet_name, num as facet_num, description AS facet_description
2547 FROM facets
2548 WHERE out_id = ${out_id} and name = 'floodmap.usershape'
2549 ORDER BY num ASC, name DESC
2550 </dc:statement>
2551 <own-hws>
2552 <dc:for-each> 2341 <dc:for-each>
2553 <dc:element name="${facet_name}"> 2342 <dc:element name="${facet_name}">
2554 <dc:attribute name="description" value="${facet_description}"/> 2343 <dc:attribute name="description" value="${facet_description}"/>
2555 <dc:attribute name="ids" value="${facet_num}"/> 2344 <dc:attribute name="factory" value="fixanalysis"/>
2556 <dc:attribute name="factory" value="winfo"/> 2345 <dc:attribute name="artifact-id" value="${aid}"/>
2557 <dc:attribute name="artifact-id" value="${a_gid}"/> 2346 <dc:attribute name="ids" value="${facet_num}"/>
2558 <dc:attribute name="out" value="floodmap"/> 2347 <dc:attribute name="out" value="fix_longitudinal_section_curve"/>
2559 </dc:element> 2348 </dc:element>
2560 </dc:for-each> 2349 </dc:for-each>
2561 </own-hws> 2350 </fix_longitudinal_section_curve>
2562 </dc:context> 2351 </dc:context>
2563 </dc:for-each> 2352 </dc:call-macro>
2564 </dc:context> 2353 </dc:context>
2565 </dc:macro> 2354 </dc:for-each>
2566 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))"> 2355 </fix_longitudinal_section_curve>
2567 <dc:call-macro name="longitudinal"/> 2356 </dc:macro>
2568 </dc:if> 2357
2569 <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')"> 2358 <dc:comment>
2570 <dc:call-macro name="delta-wt"/> 2359 MINFO bedheight middle
2571 </dc:if> 2360 </dc:comment>
2572 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))"> 2361
2573 <dc:call-macro name="differences"/> 2362 <dc:macro name="bed-height">
2574 </dc:if> 2363 <fix_vollmer_wq_curve>
2575 <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> 2364 <dc:for-each>
2576 <dc:call-macro name="reference-curves"/> 2365 <dc:context>
2577 </dc:if> 2366 <dc:call-macro name="range-filter">
2578 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')"> 2367 <dc:context>
2579 <dc:call-macro name="computed-discharge-curve"/> 2368 <dc:statement>
2580 </dc:if> 2369 SELECT a.gid AS aid,
2581 <dc:if test="dc:contains($artifact-outs, 'cross_section')"> 2370 f.id AS fid,
2582 <dc:call-macro name="waterlevels"/> 2371 f.name AS facet_name,
2583 </dc:if> 2372 f.num AS facet_num,
2584 <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')"> 2373 f.description AS facet_description
2585 <dc:call-macro name="longitudinal-section"/> 2374 FROM outs AS o, facets AS f, artifacts AS a
2586 </dc:if> 2375 WHERE (
2587 <dc:if test="dc:contains($artifact-outs, 'fix_derivate_curve')"> 2376 f.name = 'longitudinal_section.w' OR
2588 <dc:call-macro name="fix-derivate-curve"/> 2377 f.name = 'heightmarks_points'
2589 </dc:if> 2378 ) AND f.out_id = o.id AND o.artifact_id = ${a_id} AND a.id = ${a_id}
2590 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')"> 2379 </dc:statement>
2591 <dc:call-macro name="fix-wq-curve"/> 2380 <fix_vollmer_wq_curve description="{$river} {$a_creation} {$collection_name}">
2592 </dc:if> 2381 <dc:for-each>
2593 <dc:if test="dc:contains($artifact-outs, 'duration_curve')"> 2382 <dc:element name="${facet_name}">
2594 <dc:call-macro name="duration-curve"/> 2383 <dc:attribute name="description" value="${facet_description}"/>
2595 </dc:if> 2384 <dc:attribute name="factory" value="fixanalysis"/>
2596 <dc:if test="dc:contains($artifact-outs, 'waterlevels') or (dc:contains($artifact-outs, 'fix_wq_curve'))"> 2385 <dc:attribute name="artifact-id" value="${aid}"/>
2597 <dc:call-macro name="waterlevels-fix"/> 2386 <dc:attribute name="ids" value="${facet_num}"/>
2598 </dc:if> 2387 <dc:attribute name="out" value="longitudinal_section"/>
2599 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'map')"> 2388 </dc:element>
2600 <dc:call-macro name="flood-map"/> 2389 </dc:for-each>
2601 </dc:if> 2390 </fix_vollmer_wq_curve>
2602 <dc:if test="dc:contains($artifact-outs, 'bed_difference_year') or dc:contains($artifact-outs, 'bed_difference_height_year')"> 2391 </dc:context>
2603 <dc:call-macro name="bed-difference"/> 2392 </dc:call-macro>
2604 </dc:if> 2393 </dc:context>
2605 <dc:if test="dc:contains($artifact-outs, 'bedheight_middle')"> 2394 </dc:for-each>
2606 <dc:call-macro name="bed-height"/> 2395 </fix_vollmer_wq_curve>
2607 </dc:if> 2396 </dc:macro>
2608 <dc:if test="dc:contains($artifact-outs, 'floodmap-hws')"> 2397
2609 <dc:call-macro name="floodmap-hws-user"/> 2398 <dc:macro name="floodmap-hws-user">
2610 </dc:if> 2399 <dc:context>
2611 </dc:context> 2400 <dc:statement>
2612 </dc:call-macro> 2401 SELECT id AS out_id
2402 FROM outs
2403 WHERE artifact_id = ${a_id} AND name = 'floodmap'
2404 </dc:statement>
2405 <dc:for-each>
2406 <dc:context>
2407 <dc:statement>
2408 SELECT name AS facet_name,
2409 num AS facet_num,
2410 description AS facet_description
2411 FROM facets
2412 WHERE out_id = ${out_id} AND name = 'floodmap.usershape'
2413 ORDER BY num ASC, name DESC
2414 </dc:statement>
2415 <own-hws>
2416 <dc:for-each>
2417 <dc:element name="${facet_name}">
2418 <dc:attribute name="description" value="${facet_description}"/>
2419 <dc:attribute name="ids" value="${facet_num}"/>
2420 <dc:attribute name="factory" value="winfo"/>
2421 <dc:attribute name="artifact-id" value="${a_gid}"/>
2422 <dc:attribute name="out" value="floodmap"/>
2423 </dc:element>
2424 </dc:for-each>
2425 </own-hws>
2426 </dc:context>
2427 </dc:for-each>
2428 </dc:context>
2429 </dc:macro>
2430
2431 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'discharge_longitudinal_section') or (dc:contains($artifact-outs, 'w_differences')))">
2432 <dc:call-macro name="longitudinal"/>
2433 </dc:if>
2434 <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')">
2435 <dc:call-macro name="delta-wt"/>
2436 </dc:if>
2437 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section') or (dc:contains($artifact-outs, 'w_differences') or (dc:contains($artifact-outs, 'discharge_longitudinal_section')))">
2438 <dc:call-macro name="differences"/>
2439 </dc:if>
2440 <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
2441 <dc:call-macro name="reference-curves"/>
2442 </dc:if>
2443 <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')">
2444 <dc:call-macro name="computed-discharge-curve"/>
2445 </dc:if>
2446 <dc:if test="dc:contains($artifact-outs, 'cross_section')">
2447 <dc:call-macro name="waterlevels"/>
2448 </dc:if>
2449 <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
2450 <dc:call-macro name="longitudinal-section"/>
2451 </dc:if>
2452 <dc:if test="dc:contains($artifact-outs, 'fix_derivate_curve')">
2453 <dc:call-macro name="fix-derivate-curve"/>
2454 </dc:if>
2455 <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
2456 <dc:call-macro name="fix-wq-curve"/>
2457 </dc:if>
2458 <dc:if test="dc:contains($artifact-outs, 'duration_curve')">
2459 <dc:call-macro name="duration-curve"/>
2460 </dc:if>
2461 <dc:if test="dc:contains($artifact-outs, 'waterlevels') or (dc:contains($artifact-outs, 'fix_wq_curve'))">
2462 <dc:call-macro name="waterlevels-fix"/>
2463 </dc:if>
2464 <dc:if test="dc:contains($artifact-outs, 'floodmap') or dc:contains($artifact-outs, 'map')">
2465 <dc:call-macro name="flood-map"/>
2466 </dc:if>
2467 <dc:if test="dc:contains($artifact-outs, 'bed_difference_year') or dc:contains($artifact-outs, 'bed_difference_height_year')">
2468 <dc:call-macro name="bed-difference"/>
2469 </dc:if>
2470 <dc:if test="dc:contains($artifact-outs, 'bedheight_middle')">
2471 <dc:call-macro name="bed-height"/>
2472 </dc:if>
2473 <dc:if test="dc:contains($artifact-outs, 'floodmap-hws')">
2474 <dc:call-macro name="floodmap-hws-user"/>
2475 </dc:if>
2476 </dc:context>
2477 </dc:call-macro>
2613 2478
2614 </old_calculations> 2479 </old_calculations>
2615 2480
2616 2481 <dc:if test="dc:contains($parameters,'load-system')">
2482 <dc:comment>
2483 Include System specific part when 'load-system' is in parameters.
2484 -----------------------------------------------------------------
2485 </dc:comment>
2486 <dc:call-macro name="load-system"/>
2487 </dc:if>
2488 </dc:when>
2489
2490 <dc:otherwise>
2617 <dc:comment> 2491 <dc:comment>
2618 Include System specific part when 'load-system' is in parameters. 2492 Include System specific part only if no user ID is given.
2619 ----------------------------------------------------------------- 2493 ---------------------------------------------------------
2620 </dc:comment> 2494 </dc:comment>
2621 <dc:choose> 2495 <dc:call-macro name="load-system"/>
2622 <dc:when test="dc:contains($parameters,'load-system')">
2623 <dc:call-macro name="load-system"/>
2624 </dc:when>
2625 </dc:choose>
2626 </dc:when>
2627
2628
2629 <dc:comment>
2630 Include System specific part only if no user ID is given.
2631 ---------------------------------------------------------
2632 </dc:comment>
2633 <dc:otherwise>
2634 <dc:call-macro name="load-system"/>
2635 </dc:otherwise> 2496 </dc:otherwise>
2636 </dc:choose> 2497 </dc:choose>
2498
2637 </datacage> 2499 </datacage>
2638 </dc:template> 2500 </dc:template>

http://dive4elements.wald.intevation.org