comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATWriter.java @ 6637:65a5deaee769

Subtract PNP before calculating wcm from wMinCM (issue1155)
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 23 Jul 2013 15:09:30 +0200
parents ee701de9c875
children f4b3861712a4
comparison
equal deleted inserted replaced
6635:3aa6c1f5ddc3 6637:65a5deaee769
113 org.dive4elements.river.artifacts.math.Function invInst = 113 org.dive4elements.river.artifacts.math.Function invInst =
114 inverse.instantiate(coeffs); 114 inverse.instantiate(coeffs);
115 115
116 double wMin = minW(invInst, wMax, qMax[0]); 116 double wMin = minW(invInst, wMax, qMax[0]);
117 117
118 double wMinCM = wMin * 100d; 118 double wMinCM = wMin * 100d - subtractPNP;
119 double wMaxCM = wMax * 100d; 119 double wMaxCM = wMax * 100d;
120 120
121 int wRow = ((int)wMinCM / 10) * 10; 121 int wRow = ((int)wMinCM / 10) * 10;
122 122
123 if ((wMinCM - (int)wMinCM) > 0d) { 123 if ((wMinCM - (int)wMinCM) > 0d) {
124 wMinCM = (int)wMinCM + 1d; 124 wMinCM = (int)wMinCM + 1d;
125 } 125 }
126 126
127 double w = wMinCM / 100.0; 127 double w = (wMinCM + subtractPNP) / 100.0;
128 128
129 int wcm = ((int)wMinCM) % 10; 129 int wcm = ((int)wMinCM) % 10;
130 130
131 if (log.isDebugEnabled()) { 131 if (log.isDebugEnabled()) {
132 log.debug("wMinCM: " + wMinCM); 132 log.debug("wMinCM: " + wMinCM);
133 log.debug("wMaxCM: " + wMaxCM); 133 log.debug("wMaxCM: " + wMaxCM);
134 log.debug("wcm: " + wcm); 134 log.debug("wcm: " + wcm);
135 } 135 log.debug("subtractPNP: " + subtractPNP);
136 136 }
137 out.printf(Locale.US, "%8d", wRow - subtractPNP); 137
138 out.printf(Locale.US, "%8d", wRow);
138 139
139 for (int i = 0; i < wcm; i++) { 140 for (int i = 0; i < wcm; i++) {
140 out.print(ATWriter.EMPTY); 141 out.print(ATWriter.EMPTY);
141 } 142 }
142 143
156 } 157 }
157 out.println(); 158 out.println();
158 if (w > wMax) { 159 if (w > wMax) {
159 break; 160 break;
160 } 161 }
161 out.printf(Locale.US, "%8d", (wRow += 10) - subtractPNP); 162 out.printf(Locale.US, "%8d", (wRow += 10));
162 wcm = 0; 163 wcm = 0;
163 } 164 }
164 165
165 out.flush(); 166 out.flush();
166 } 167 }

http://dive4elements.wald.intevation.org