Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java @ 2832:ac5bd90697c1
Added new parser for flow velocity measurements and fixed some smaller bugs while importing flow velocity data.
flys-backend/trunk@4250 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 17 Apr 2012 13:00:04 +0000 |
parents | ac13e466a55e |
children | 163c037f2c7e |
comparison
equal
deleted
inserted
replaced
2831:8fe9c6584b93 | 2832:ac5bd90697c1 |
---|---|
24 import de.intevation.flys.model.Unit; | 24 import de.intevation.flys.model.Unit; |
25 | 25 |
26 import de.intevation.flys.importer.parsers.BedHeightEpochParser; | 26 import de.intevation.flys.importer.parsers.BedHeightEpochParser; |
27 import de.intevation.flys.importer.parsers.BedHeightSingleParser; | 27 import de.intevation.flys.importer.parsers.BedHeightSingleParser; |
28 import de.intevation.flys.importer.parsers.FlowVelocityModelParser; | 28 import de.intevation.flys.importer.parsers.FlowVelocityModelParser; |
29 import de.intevation.flys.importer.parsers.FlowVelocityMeasurementParser; | |
29 import de.intevation.flys.importer.parsers.PRFParser; | 30 import de.intevation.flys.importer.parsers.PRFParser; |
30 import de.intevation.flys.importer.parsers.HYKParser; | 31 import de.intevation.flys.importer.parsers.HYKParser; |
31 import de.intevation.flys.importer.parsers.MorphologicalWidthParser; | 32 import de.intevation.flys.importer.parsers.MorphologicalWidthParser; |
32 import de.intevation.flys.importer.parsers.AnnotationsParser; | 33 import de.intevation.flys.importer.parsers.AnnotationsParser; |
33 import de.intevation.flys.importer.parsers.AnnotationClassifier; | 34 import de.intevation.flys.importer.parsers.AnnotationClassifier; |
113 | 114 |
114 protected List<ImportMorphWidth> morphologicalWidths; | 115 protected List<ImportMorphWidth> morphologicalWidths; |
115 | 116 |
116 protected List<ImportFlowVelocityModel> flowVelocityModels; | 117 protected List<ImportFlowVelocityModel> flowVelocityModels; |
117 | 118 |
119 protected List<ImportFlowVelocityMeasurement> flowVelocityMeasurements; | |
120 | |
118 protected ImportWst wst; | 121 protected ImportWst wst; |
119 | 122 |
120 protected ImportUnit wstUnit; | 123 protected ImportUnit wstUnit; |
121 | 124 |
122 protected AnnotationClassifier annotationClassifier; | 125 protected AnnotationClassifier annotationClassifier; |
123 | 126 |
124 protected River peer; | 127 protected River peer; |
125 | 128 |
126 public ImportRiver() { | 129 public ImportRiver() { |
127 hyks = new ArrayList<ImportHYK>(); | 130 hyks = new ArrayList<ImportHYK>(); |
128 crossSections = new ArrayList<ImportCrossSection>(); | 131 crossSections = new ArrayList<ImportCrossSection>(); |
129 extraWsts = new ArrayList<ImportWst>(); | 132 extraWsts = new ArrayList<ImportWst>(); |
130 fixations = new ArrayList<ImportWst>(); | 133 fixations = new ArrayList<ImportWst>(); |
131 officialLines = new ArrayList<ImportWst>(); | 134 officialLines = new ArrayList<ImportWst>(); |
132 floodWater = new ArrayList<ImportWst>(); | 135 floodWater = new ArrayList<ImportWst>(); |
133 floodProtection = new ArrayList<ImportWst>(); | 136 floodProtection = new ArrayList<ImportWst>(); |
134 sedimentDensities = new ArrayList<ImportSedimentDensity>(); | 137 sedimentDensities = new ArrayList<ImportSedimentDensity>(); |
135 morphologicalWidths = new ArrayList<ImportMorphWidth>(); | 138 morphologicalWidths = new ArrayList<ImportMorphWidth>(); |
136 flowVelocityModels = new ArrayList<ImportFlowVelocityModel>(); | 139 flowVelocityModels = new ArrayList<ImportFlowVelocityModel>(); |
140 flowVelocityMeasurements = new ArrayList<ImportFlowVelocityMeasurement>(); | |
137 } | 141 } |
138 | 142 |
139 public ImportRiver( | 143 public ImportRiver( |
140 String name, | 144 String name, |
141 File wstFile, | 145 File wstFile, |
364 | 368 |
365 if (measureFiles == null) { | 369 if (measureFiles == null) { |
366 log.warn("Cannot parse directory '" + measureDir + "'"); | 370 log.warn("Cannot parse directory '" + measureDir + "'"); |
367 } | 371 } |
368 else { | 372 else { |
369 // TODO | 373 FlowVelocityMeasurementParser parser = |
374 new FlowVelocityMeasurementParser(); | |
375 | |
370 for (File measurement: measureFiles) { | 376 for (File measurement: measureFiles) { |
371 log.debug("Parse file '" + measurement + "'"); | 377 log.debug("Parse file '" + measurement + "'"); |
372 } | 378 parser.parse(measurement); |
379 } | |
380 | |
381 flowVelocityMeasurements = parser.getMeasurements(); | |
373 } | 382 } |
374 } | 383 } |
375 | 384 |
376 | 385 |
377 protected void parseBedHeightSingles(File dir) throws IOException { | 386 protected void parseBedHeightSingles(File dir) throws IOException { |
963 } | 972 } |
964 catch (ConstraintViolationException cve) { | 973 catch (ConstraintViolationException cve) { |
965 log.error("Error while storing flow velocity model.", cve); | 974 log.error("Error while storing flow velocity model.", cve); |
966 } | 975 } |
967 } | 976 } |
977 | |
978 for (ImportFlowVelocityMeasurement m: flowVelocityMeasurements) { | |
979 try { | |
980 m.storeDependencies(river); | |
981 } | |
982 catch (SQLException sqle) { | |
983 log.error("Error while storing flow velocity measurement.", sqle); | |
984 } | |
985 catch (ConstraintViolationException cve) { | |
986 log.error("Error while storing flow velocity measurement.", cve); | |
987 } | |
988 } | |
968 } | 989 } |
969 } | 990 } |
970 | 991 |
971 public void storeAnnotations() { | 992 public void storeAnnotations() { |
972 if (!Config.INSTANCE.skipAnnotations()) { | 993 if (!Config.INSTANCE.skipAnnotations()) { |