Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java @ 6549:e7eb3c4afcf3
Minor refactoring, extracted method.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 09 Jul 2013 10:50:33 +0200 |
parents | 9987c5a8154a |
children | 7cf3b3bcd439 |
comparison
equal
deleted
inserted
replaced
6548:9987c5a8154a | 6549:e7eb3c4afcf3 |
---|---|
89 if (facet == null) { | 89 if (facet == null) { |
90 return; | 90 return; |
91 } | 91 } |
92 | 92 |
93 if (bundle.getData(context) instanceof BedDifferencesResult) { | 93 if (bundle.getData(context) instanceof BedDifferencesResult) { |
94 if (getXBounds(0) != null && getDomainAxisRange() != null) { | 94 setContextBounds(bundle); |
95 Bounds bounds = | |
96 calculateZoom(getXBounds(0), getDomainAxisRange()); | |
97 context.putContextValue("startkm", bounds.getLower()); | |
98 context.putContextValue("endkm", bounds.getUpper()); | |
99 } | |
100 else if (getXBounds(0) != null && getDomainAxisRange() == null) { | |
101 context.putContextValue("startkm", getXBounds(0).getLower()); | |
102 context.putContextValue("endkm", getXBounds(0).getUpper()); | |
103 } | |
104 else if (getXBounds(0) == null && getDomainAxisRange() == null) { | |
105 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | |
106 if (data.getKms().size() >= 0) { | |
107 context.putContextValue("startkm", data.getKms().min()); | |
108 context.putContextValue("endkm", data.getKms().max()); | |
109 } | |
110 else { | |
111 logger.warn("No data to define start and end km"); | |
112 } | |
113 } | |
114 else if (getXBounds(0) == null && getDomainAxisRange() != null){ | |
115 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | |
116 Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); | |
117 Bounds bounds = | |
118 calculateZoom(b, getDomainAxisRange()); | |
119 context.putContextValue("startkm", bounds.getLower()); | |
120 context.putContextValue("endkm", bounds.getUpper()); | |
121 } | |
122 } | 95 } |
96 | |
123 Processor processor = new KMIndexProcessor(); | 97 Processor processor = new KMIndexProcessor(); |
124 if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) { | 98 if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) { |
125 doBedDifferenceYearOut( | 99 doBedDifferenceYearOut( |
126 (BedDiffYearResult) bundle.getData(context), | 100 (BedDiffYearResult) bundle.getData(context), |
127 bundle, attr, visible); | 101 bundle, attr, visible); |
141 else if (processor.canHandle(name)) { | 115 else if (processor.canHandle(name)) { |
142 processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx); | 116 processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx); |
143 } | 117 } |
144 else { | 118 else { |
145 logger.warn("Unknown facet name " + name); | 119 logger.warn("Unknown facet name " + name); |
120 } | |
121 } | |
122 | |
123 public void setContextBounds(ArtifactAndFacet bundle) { | |
124 if (getXBounds(0) != null && getDomainAxisRange() != null) { | |
125 Bounds bounds = | |
126 calculateZoom(getXBounds(0), getDomainAxisRange()); | |
127 context.putContextValue("startkm", bounds.getLower()); | |
128 context.putContextValue("endkm", bounds.getUpper()); | |
129 } | |
130 else if (getXBounds(0) != null && getDomainAxisRange() == null) { | |
131 context.putContextValue("startkm", getXBounds(0).getLower()); | |
132 context.putContextValue("endkm", getXBounds(0).getUpper()); | |
133 } | |
134 else if (getXBounds(0) == null && getDomainAxisRange() == null) { | |
135 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | |
136 if (data.getKms().size() >= 0) { | |
137 context.putContextValue("startkm", data.getKms().min()); | |
138 context.putContextValue("endkm", data.getKms().max()); | |
139 } | |
140 else { | |
141 logger.warn("No data to define start and end km"); | |
142 } | |
143 } | |
144 else if (getXBounds(0) == null && getDomainAxisRange() != null){ | |
145 BedDifferencesResult data = (BedDifferencesResult)bundle.getData(context); | |
146 Bounds b = new DoubleBounds(data.getKms().min(), data.getKms().max()); | |
147 Bounds bounds = | |
148 calculateZoom(b, getDomainAxisRange()); | |
149 context.putContextValue("startkm", bounds.getLower()); | |
150 context.putContextValue("endkm", bounds.getUpper()); | |
146 } | 151 } |
147 } | 152 } |
148 | 153 |
149 @Override | 154 @Override |
150 protected String getDefaultChartTitle() { | 155 protected String getDefaultChartTitle() { |