Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FixingsOverview.java @ 3421:c44ff50f4970
FixA: Added a list of gauges to the output of the fixings overview service which intersect the selected fixings.
flys-artifacts/trunk@5075 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 19 Jul 2012 21:12:57 +0000 |
parents | 086326be721c |
children | 278b5508567e |
comparison
equal
deleted
inserted
replaced
3420:7f7ab030a4e3 | 3421:c44ff50f4970 |
---|---|
76 " wst_column_values " + | 76 " wst_column_values " + |
77 "WHERE" + | 77 "WHERE" + |
78 " wst_column_id = :column_id"; | 78 " wst_column_id = :column_id"; |
79 | 79 |
80 | 80 |
81 | |
82 public static class QRange extends Range { | 81 public static class QRange extends Range { |
83 | 82 |
84 protected double q; | 83 protected double q; |
85 | 84 |
86 public QRange() { | 85 public QRange() { |
686 Collections.sort(allColumns, Fixing.DATE_CMP); | 685 Collections.sort(allColumns, Fixing.DATE_CMP); |
687 | 686 |
688 return allColumns; | 687 return allColumns; |
689 } | 688 } |
690 | 689 |
690 protected static Range realRange(List<Fixing.Column> columns) { | |
691 Range range = null; | |
692 for (Fixing.Column column: columns) { | |
693 if (range == null) { | |
694 range = new Range(column); | |
695 } | |
696 else { | |
697 range.extend(column); | |
698 } | |
699 } | |
700 return range; | |
701 } | |
702 | |
703 protected Element intersectingGauges(Document document, Range range) { | |
704 Element gauges = document.createElement("gauges"); | |
705 | |
706 if (range == null) { | |
707 return gauges; | |
708 } | |
709 | |
710 GaugeFinderFactory gff = GaugeFinderFactory.getInstance(); | |
711 | |
712 GaugeFinder gf = gff.getGaugeFinder(riverId, isKmUp); | |
713 | |
714 if (gf == null) { | |
715 return gauges; | |
716 } | |
717 | |
718 for (GaugeRange gr: gf.getGauges()) { | |
719 if (gr.intersects(range)) { | |
720 Element gauge = document.createElement("gauge"); | |
721 gauge.setAttribute("from", String.valueOf(gr.getStart())); | |
722 gauge.setAttribute("to", String.valueOf(gr.getEnd())); | |
723 gauge.setAttribute("name", gr.getName()); | |
724 gauges.appendChild(gauge); | |
725 } | |
726 } | |
727 | |
728 return gauges; | |
729 } | |
730 | |
691 public void generateOverview( | 731 public void generateOverview( |
692 Document document, | 732 Document document, |
693 Range range, | 733 Range range, |
694 Fixing.Filter filter | 734 Fixing.Filter filter |
695 ) { | 735 ) { |
704 riverElement.setAttribute("rid", String.valueOf(riverId)); | 744 riverElement.setAttribute("rid", String.valueOf(riverId)); |
705 riverElement.setAttribute("name", riverName); | 745 riverElement.setAttribute("name", riverName); |
706 | 746 |
707 fixingsElement.appendChild(riverElement); | 747 fixingsElement.appendChild(riverElement); |
708 | 748 |
749 fixingsElement.appendChild( | |
750 intersectingGauges( | |
751 document, | |
752 realRange(allColumns))); | |
753 | |
709 SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); | 754 SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); |
710 | 755 |
711 Element esE = document.createElement("events"); | 756 Element esE = document.createElement("events"); |
712 | 757 |
713 for (Fixing.Column column: allColumns) { | 758 for (Fixing.Column column: allColumns) { |