Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java @ 2860:2f874d14ac68
Use Doubles to store meassure points of profiles.
flys-backend/trunk@4325 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 02 May 2012 08:49:57 +0000 |
parents | 5f1506fc7636 |
children | 3199dbc20e22 |
comparison
equal
deleted
inserted
replaced
2859:ed13816047b3 | 2860:2f874d14ac68 |
---|---|
4 import de.intevation.flys.model.CrossSectionPoint; | 4 import de.intevation.flys.model.CrossSectionPoint; |
5 import de.intevation.flys.model.CrossSectionLine; | 5 import de.intevation.flys.model.CrossSectionLine; |
6 | 6 |
7 import org.hibernate.Session; | 7 import org.hibernate.Session; |
8 import org.hibernate.Query; | 8 import org.hibernate.Query; |
9 | |
10 import java.math.BigDecimal; | |
11 | 9 |
12 import java.util.List; | 10 import java.util.List; |
13 import java.util.Comparator; | 11 import java.util.Comparator; |
14 import java.util.Map; | 12 import java.util.Map; |
15 import java.util.TreeMap; | 13 import java.util.TreeMap; |
21 public int compare(CrossSectionPoint a, CrossSectionPoint b) { | 19 public int compare(CrossSectionPoint a, CrossSectionPoint b) { |
22 return a.getColPos().compareTo(b.getColPos()); | 20 return a.getColPos().compareTo(b.getColPos()); |
23 } | 21 } |
24 }; | 22 }; |
25 | 23 |
26 protected BigDecimal km; | 24 protected Double km; |
27 protected ImportCrossSection crossSection; | 25 protected ImportCrossSection crossSection; |
28 protected List<XY> points; | 26 protected List<XY> points; |
29 | 27 |
30 protected CrossSectionLine peer; | 28 protected CrossSectionLine peer; |
31 | 29 |
32 public ImportCrossSectionLine() { | 30 public ImportCrossSectionLine() { |
33 } | 31 } |
34 | 32 |
35 public ImportCrossSectionLine(BigDecimal km, List<XY> points) { | 33 public ImportCrossSectionLine(Double km, List<XY> points) { |
36 this.km = km; | 34 this.km = km; |
37 this.points = points; | 35 this.points = points; |
38 } | 36 } |
39 | 37 |
40 public ImportCrossSection getCrossSection() { | 38 public ImportCrossSection getCrossSection() { |
43 | 41 |
44 public void setCrossSection(ImportCrossSection crossSection) { | 42 public void setCrossSection(ImportCrossSection crossSection) { |
45 this.crossSection = crossSection; | 43 this.crossSection = crossSection; |
46 } | 44 } |
47 | 45 |
48 public BigDecimal getKm() { | 46 public Double getKm() { |
49 return km; | 47 return km; |
50 } | 48 } |
51 | 49 |
52 public void setKm(BigDecimal km) { | 50 public void setKm(Double km) { |
53 this.km = km; | 51 this.km = km; |
54 } | 52 } |
55 | 53 |
56 public void storeDependencies() { | 54 public void storeDependencies() { |
57 storePoints(); | 55 storePoints(); |
80 key.setColPos(xy.getIndex()); | 78 key.setColPos(xy.getIndex()); |
81 CrossSectionPoint csp = map.get(key); | 79 CrossSectionPoint csp = map.get(key); |
82 if (csp == null) { // create new | 80 if (csp == null) { // create new |
83 csp = new CrossSectionPoint( | 81 csp = new CrossSectionPoint( |
84 csl, key.getColPos(), | 82 csl, key.getColPos(), |
85 new BigDecimal(xy.getX()), | 83 Double.valueOf(xy.getX()), |
86 new BigDecimal(xy.getY())); | 84 Double.valueOf(xy.getY())); |
87 } | 85 } |
88 else { // update old | 86 else { // update old |
89 csp.setX(new BigDecimal(xy.getX())); | 87 csp.setX(Double.valueOf(xy.getX())); |
90 csp.setY(new BigDecimal(xy.getY())); | 88 csp.setY(Double.valueOf(xy.getY())); |
91 } | 89 } |
92 session.save(csp); | 90 session.save(csp); |
93 } | 91 } |
94 } | 92 } |
95 | 93 |