comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java @ 1682:394b7ac58fc9

ATWriter: Get rid of buggy first line code. flys-artifacts/trunk@2900 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 06 Oct 2011 14:36:05 +0000
parents a800994aed1e
children 0c8a6145098b
comparison
equal deleted inserted replaced
1681:e5f7f25a511c 1682:394b7ac58fc9
126 126
127 // a header is required, because the desktop version of FLYS will skip 127 // a header is required, because the desktop version of FLYS will skip
128 // the first row. 128 // the first row.
129 printHeader(out, meta, river, km); 129 printHeader(out, meta, river, km);
130 130
131 double rest = Math.abs(minW % COLUMNS); 131 double rest = (minW * 100.0) % 10.0;
132 132
133 double startW = Math.round(minW*10.0)/10.0; 133 double startW = Math.rint((minW - rest*0.01)*10.0)*0.1;
134 if (rest >= 1d) { 134
135 startW -= 0.1; 135 if (logger.isDebugEnabled()) {
136 out.printf(Locale.US, "%8d", (int)Math.round(startW*100.0)); 136 logger.debug("startW: " + startW);
137 int columns = (int)Math.floor(rest); 137 logger.debug("rest: " + rest);
138 for (int i = columns; i < COLUMNS; ++i) {
139 out.print(EMPTY);
140 }
141 for (int i = COLUMNS-columns; i < COLUMNS; ++i) {
142 double w = startW + i*0.01;
143 if (w < minW) {
144 out.print(EMPTY);
145 }
146 else {
147 printQ(out, getQ(w));
148 }
149 }
150 out.println();
151 startW += 0.1;
152 } 138 }
153 139
154 int col = 0; 140 int col = 0;
155 for (double w = startW; w <= maxW; w += 0.01) { 141 for (double w = startW; w <= maxW; w += 0.01) {
156 if (col == 0) { 142 if (col == 0) {
157 out.printf(Locale.US, "%8d", (int)Math.round(w*100.0)); 143 out.printf(Locale.US, "%8d", (int)Math.round(w*100.0));
158 } 144 }
159 145
160 printQ(out, getQ(w)); 146 if (w < minW) {
147 out.print(EMPTY);
148 }
149 else {
150 printQ(out, getQ(w));
151 }
161 152
162 if (++col >= COLUMNS) { 153 if (++col >= COLUMNS) {
163 out.println(); 154 out.println();
164 col = 0; 155 col = 0;
165 } 156 }

http://dive4elements.wald.intevation.org