Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java @ 6550:7cf3b3bcd439
BedDiffHeightYearGenerator: Correct list size check, in
BedDifferenceYearGenerator do analog refactoring.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 10 Jul 2013 09:31:43 +0200 |
parents | 70ae55f7bc55 |
children | 8c226c5089e0 |
comparison
equal
deleted
inserted
replaced
6549:e7eb3c4afcf3 | 6550:7cf3b3bcd439 |
---|---|
84 return yaxes[idx].toString(); | 84 return yaxes[idx].toString(); |
85 } | 85 } |
86 }; | 86 }; |
87 } | 87 } |
88 | 88 |
89 @Override | 89 public void setContextBounds(ArtifactAndFacet bundle) { |
90 public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { | |
91 String name = bundle.getFacetName(); | |
92 | |
93 logger.debug("doOut: " + name); | |
94 | |
95 if (name == null) { | |
96 logger.error("No facet name for doOut(). No output generated!"); | |
97 return; | |
98 } | |
99 | |
100 Facet facet = bundle.getFacet(); | |
101 | |
102 if (facet == null) { | |
103 return; | |
104 } | |
105 | |
106 if (getXBounds(0) != null && getDomainAxisRange() != null) { | 90 if (getXBounds(0) != null && getDomainAxisRange() != null) { |
107 Bounds bounds = | 91 Bounds bounds = |
108 calculateZoom(getXBounds(0), getDomainAxisRange()); | 92 calculateZoom(getXBounds(0), getDomainAxisRange()); |
109 context.putContextValue("startkm", bounds.getLower()); | 93 context.putContextValue("startkm", bounds.getLower()); |
110 context.putContextValue("endkm", bounds.getUpper()); | 94 context.putContextValue("endkm", bounds.getUpper()); |
113 context.putContextValue("startkm", getXBounds(0).getLower()); | 97 context.putContextValue("startkm", getXBounds(0).getLower()); |
114 context.putContextValue("endkm", getXBounds(0).getUpper()); | 98 context.putContextValue("endkm", getXBounds(0).getUpper()); |
115 } | 99 } |
116 else if (getXBounds(0) == null && getDomainAxisRange() == null) { | 100 else if (getXBounds(0) == null && getDomainAxisRange() == null) { |
117 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | 101 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); |
118 context.putContextValue("startkm", data.getKms().min()); | 102 if (data.getKms().size() > 0) { |
119 context.putContextValue("endkm", data.getKms().max()); | 103 context.putContextValue("startkm", data.getKms().min()); |
104 context.putContextValue("endkm", data.getKms().max()); | |
105 } | |
106 else { | |
107 logger.warn("No data to define start and end km"); | |
108 } | |
120 } | 109 } |
121 else if (getXBounds(0) == null && getDomainAxisRange() != null){ | 110 else if (getXBounds(0) == null && getDomainAxisRange() != null){ |
122 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | 111 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); |
123 Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); | 112 Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); |
124 Bounds bounds = | 113 Bounds bounds = |
125 calculateZoom(b, getDomainAxisRange()); | 114 calculateZoom(b, getDomainAxisRange()); |
126 context.putContextValue("startkm", bounds.getLower()); | 115 context.putContextValue("startkm", bounds.getLower()); |
127 context.putContextValue("endkm", bounds.getUpper()); | 116 context.putContextValue("endkm", bounds.getUpper()); |
128 } | 117 } |
118 } | |
119 | |
120 @Override | |
121 public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { | |
122 String name = bundle.getFacetName(); | |
123 | |
124 logger.debug("doOut: " + name); | |
125 | |
126 if (name == null) { | |
127 logger.error("No facet name for doOut(). No output generated!"); | |
128 return; | |
129 } | |
130 | |
131 Facet facet = bundle.getFacet(); | |
132 | |
133 if (facet == null) { | |
134 return; | |
135 } | |
136 | |
137 setContextBounds(bundle); | |
138 | |
129 Processor processor = new KMIndexProcessor(); | 139 Processor processor = new KMIndexProcessor(); |
130 Processor woutp = new WOutProcessor(); | 140 Processor woutp = new WOutProcessor(); |
131 if (name.equals(BED_DIFFERENCE_YEAR)) { | 141 if (name.equals(BED_DIFFERENCE_YEAR)) { |
132 doBedDifferenceYearOut( | 142 doBedDifferenceYearOut( |
133 (BedDiffYearResult) bundle.getData(context), | 143 (BedDiffYearResult) bundle.getData(context), |