Mercurial > dive4elements > river
changeset 185:a60edcfe5f53
Added new helper models for import.
flys-backend/trunk@1503 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 17 Mar 2011 16:12:39 +0000 |
parents | 4ab2c3bd474c |
children | cf8cbcb6a10d |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/ImportAnnotation.java flys-backend/src/main/java/de/intevation/flys/importer/ImportAttribute.java flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java flys-backend/src/main/java/de/intevation/flys/importer/ImportPosition.java flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.java |
diffstat | 7 files changed, 150 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Thu Mar 17 15:21:50 2011 +0000 +++ b/flys-backend/ChangeLog Thu Mar 17 16:12:39 2011 +0000 @@ -1,3 +1,15 @@ +2011-03-17 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/importer/ImportPosition.java, + src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/ImportAttribute.java, + src/main/java/de/intevation/flys/importer/ImportAnnotation.java: + New helper models for import. + + * src/main/java/de/intevation/flys/importer/PegelGltParser.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java: + Use new models. + 2011-03-17 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/importer/PegelGltParser.java:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportAnnotation.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,36 @@ +package de.intevation.flys.importer; + +public class ImportAnnotation +{ + protected ImportAttribute attribute; + protected ImportPosition position; + protected ImportRange range; + + public ImportAnnotation() { + } + + public ImportAttribute getAttribute() { + return attribute; + } + + public void setAttribute(ImportAttribute attribute) { + this.attribute = attribute; + } + + public ImportPosition getPosition() { + return position; + } + + public void setPosition(ImportPosition position) { + this.position = position; + } + + public ImportRange getRange() { + return range; + } + + public void setRange(ImportRange range) { + this.range = range; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportAttribute.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,30 @@ +package de.intevation.flys.importer; + +public class ImportAttribute +{ + protected String value; + + public ImportAttribute() { + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof ImportPosition)) return false; + return value.equals(((ImportPosition)other).value); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java Thu Mar 17 15:21:50 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java Thu Mar 17 16:12:39 2011 +0000 @@ -4,8 +4,7 @@ public class ImportGauge { - protected double from; - protected double to; + protected ImportRange range; protected File staFile; protected File atFile; @@ -13,27 +12,14 @@ public ImportGauge() { } - public ImportGauge(double from, double to, File staFile, File atFile) { - this.from = from; - this.to = to; + public ImportGauge(ImportRange range, File staFile, File atFile) { + this.range = range; this.staFile = staFile; this.atFile = atFile; } - public void setFrom(double from) { - this.from = from; - } - - public double getFrom() { - return from; - } - - public void setTo(double to) { - this.to = to; - } - - public double getTo() { - return to; + public void setRange(ImportRange range) { + this.range = range; } public void setStaFile(File staFile) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportPosition.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,35 @@ +package de.intevation.flys.importer; + +public class ImportPosition +{ + protected String value; + + public ImportPosition() { + } + + public ImportPosition(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public boolean equals(Object other) { + if (other == this) return true; + if (!(other instanceof ImportPosition)) return false; + return value.equals(((ImportPosition)other).value); + } + + @Override + public int hashCode() { + return value.hashCode(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRange.java Thu Mar 17 16:12:39 2011 +0000 @@ -0,0 +1,30 @@ +package de.intevation.flys.importer; + +public class ImportRange +{ + public Double from; + public Double to; + + public ImportRange() { + } + + public ImportRange(Double from, Double to) { + } + + public Double getFrom() { + return from; + } + + public void setFrom(Double from) { + this.from = from; + } + + public Double getTo() { + return to; + } + + public void setTo(Double to) { + this.to = to; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.java Thu Mar 17 15:21:50 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/PegelGltParser.java Thu Mar 17 16:12:39 2011 +0000 @@ -74,6 +74,7 @@ double from = Double.parseDouble(parts[0].replace(",", ".")); double to = Double.parseDouble(parts[1].replace(",", ".")); if (to < from) { double t = from; from = to; to = t; } + ImportRange range = new ImportRange(from, to); File staFile = FileTools.repair(new File(parent, parts[2])); File atFile = FileTools.repair(new File(parent, parts[3])); @@ -84,7 +85,7 @@ log.debug("\tat: " + atFile); } - gauges.add(new ImportGauge(from, to, staFile, atFile)); + gauges.add(new ImportGauge(range, staFile, atFile)); } } finally {