Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedDifferencesAccess.java @ 3887:a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
flys-artifacts/trunk@5538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 20 Sep 2012 09:34:48 +0000 |
parents | |
children | 95d699c769fb |
rev | line source |
---|---|
3887
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.access; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifacts.CallContext; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.flys.artifacts.FLYSArtifact; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.flys.artifacts.model.minfo.BedHeight; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import de.intevation.flys.utils.FLYSUtils; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.flys.utils.StringUtil; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 public class BedDifferencesAccess |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 extends RiverAccess |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 { |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 private String yearEpoch; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 private String[] diffs; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 private CallContext context; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 public BedDifferencesAccess(FLYSArtifact artifact, CallContext context) { |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 super(artifact); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 this.context = context; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 } |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 public String getYearEpoch() { |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 return yearEpoch; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 } |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 public FLYSArtifact[][] getDifferenceArtifacts() { |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 FLYSArtifact[][] artifacts = new FLYSArtifact[diffs.length][2]; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 for (int i = 0; i < diffs.length; i++) { |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 String[] diff = diffs[i].split("#"); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 String diff1 = StringUtil.unbracket(diff[0]); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 String diff2 = StringUtil.unbracket(diff[1]); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 String[] diff1parts = diff1.split(";"); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 String[] diff2parts = diff2.split(";"); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 artifacts[i][0] = FLYSUtils.getArtifact(diff1parts[0], context); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 artifacts[i][1] = FLYSUtils.getArtifact(diff2parts[1], context); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 } |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 return artifacts; |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 } |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 public static int getHeightId(FLYSArtifact artifact) { |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 Access a = new Access(artifact); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 return a.getInteger("height_id"); |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 } |
a1c79d84e3cd
New calcultion in MINFO: Bed height difference calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 } |