comparison backend/src/main/java/org/dive4elements/river/importer/parsers/W80CSVParser.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 8ce2d749f0a7
children 0a5239a1e46e
comparison
equal deleted inserted replaced
8855:d7c005e12af0 8856:5e38e2924c07
197 * @param height The hight (3rd coord) of point, in meter. 197 * @param height The hight (3rd coord) of point, in meter.
198 * @param idx Ignored, the parameter of new point. 198 * @param idx Ignored, the parameter of new point.
199 * @return true if point could been added, false otherwise (e.g. not 199 * @return true if point could been added, false otherwise (e.g. not
200 * parsable y or z values. 200 * parsable y or z values.
201 */ 201 */
202 private boolean addPoint(double gkr, double gkh, double height, String idx) { 202 private boolean addPoint(
203 double gkr,
204 double gkh,
205 double height,
206 String idx
207 ) {
203 // Calculate distance between this and lst point (add distances). 208 // Calculate distance between this and lst point (add distances).
204 double d = distanceToLastPoint(gkr, gkh); 209 double d = distanceToLastPoint(gkr, gkh);
205 double totalX = getLastPointX() + d; 210 double totalX = getLastPointX() + d;
206 211
207 // We ignore idx, and increment instead. 212 // We ignore idx, and increment instead.
218 currentLine.add(new XY(totalX, height, index)); 223 currentLine.add(new XY(totalX, height, index));
219 return true; 224 return true;
220 } 225 }
221 226
222 // As per documentation: 227 // As per documentation:
223 // BW;WPA;ST;UF;PN;LS;BL-LS;Y;X;Z;DL;LZK;SY;SX;SZ;BML;HS;BL-HS;H;DH;HZK;SH;WVA;BMH;BMP;DST;DB;LDS;LKZ; 228 // BW;WPA;ST;UF;PN;LS;BL-LS;Y;X;Z;DL;LZK;SY;SX;SZ;BML;HS;BL-HS;
229 // H;DH;HZK;SH;WVA;BMH;BMP;DST;DB;LDS;LKZ;
224 230
225 231
226 /** 232 /**
227 * Called for each line. Try to extract info from a w80 line. 233 * Called for each line. Try to extract info from a w80 line.
228 * @param lineNum Number of line (starting with 1). 234 * @param lineNum Number of line (starting with 1).
231 protected void handleLine(int lineNum, String line) { 237 protected void handleLine(int lineNum, String line) {
232 // First two lines are 'comment'-like. 238 // First two lines are 'comment'-like.
233 if (lineNum == 1 || lineNum == 2) { 239 if (lineNum == 1 || lineNum == 2) {
234 return; 240 return;
235 } 241 }
236 // The 'shore' field shows which side of the river the shore is measured. 242 // The 'shore' field shows which side of the river the shore
243 // is measured.
237 // Therefore, the points have to be added in the correct order (also 244 // Therefore, the points have to be added in the correct order (also
238 // because later distances are calculated which cannot be 245 // because later distances are calculated which cannot be
239 // negative. 246 // negative.
240 String[] fields = line.split(";"); 247 String[] fields = line.split(";");
241 String station = fields[2]; 248 String station = fields[2];
256 double gkHighKm; 263 double gkHighKm;
257 double heightM; 264 double heightM;
258 265
259 try { 266 try {
260 stationKm = Double.parseDouble(station) / 1000d; 267 stationKm = Double.parseDouble(station) / 1000d;
261 gkRightKm = Double.parseDouble(gkRight.replace(",","."));//.substring(0,7)); 268 gkRightKm = Double.parseDouble(gkRight.replace(",","."));
262 gkHighKm = Double.parseDouble(gkHigh.replace(",","."));//.substring(0,7)); 269 gkHighKm = Double.parseDouble(gkHigh.replace(",","."));
263 heightM = Double.parseDouble(height.replace(",",".")); 270 heightM = Double.parseDouble(height.replace(",","."));
264 } 271 }
265 catch (java.lang.NumberFormatException nfe) { 272 catch (java.lang.NumberFormatException nfe) {
266 log.error("Skipping malformed w80csv line #" + lineNum); 273 log.error("Skipping malformed w80csv line #" + lineNum);
267 return; 274 return;

http://dive4elements.wald.intevation.org