comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/MorphologicWidth.java @ 5764:7ac111db8a07

Model, factory, facet and static artifact for morphologic width.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 18 Apr 2013 14:14:15 +0200
parents
children 4a1bd43e7aa6
comparison
equal deleted inserted replaced
5763:dd652fcc9f0d 5764:7ac111db8a07
1 package de.intevation.flys.artifacts.model.minfo;
2
3 import java.util.HashMap;
4 import java.util.Map;
5
6 import de.intevation.flys.jfree.DoubleBounds;
7
8
9 public class MorphologicWidth
10 {
11
12 private Map<Double, Double> pairs;
13
14
15 public MorphologicWidth() {
16 pairs = new HashMap<Double, Double>();
17 }
18
19 public void add(double station, double width) {
20 this.pairs.put(station, width);
21 }
22
23 public Map<Double, Double> getAll() {
24 return this.pairs;
25 }
26
27 public double[][] getAsArray() {
28 double [][] array = new double[2][pairs.size()];
29 Double[] kms = pairs.keySet().toArray(new Double[pairs.size()]);
30 Double[] width = pairs.values().toArray(new Double[pairs.size()]);
31 int realIndex = 0;
32 for (int i = 0; i < kms.length; i++) {
33 if (kms[i] == null || width[i] == null) {
34 continue;
35 }
36 array[0][realIndex] = kms[i];
37 array[1][realIndex] = width[i];
38 realIndex++;
39 }
40 return array;
41 }
42
43
44 public Double getWidth(double station) {
45 if (this.pairs.containsKey(station)) {
46 return this.pairs.get(station);
47 }
48 return null;
49 }
50 }

http://dive4elements.wald.intevation.org