comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFacet.java @ 5648:4feda81c38bc

SedimentLoadFacet: Minor refactor.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 10 Apr 2013 13:11:24 +0200
parents ddb2a4e982b8
children 5231e6b849ce
comparison
equal deleted inserted replaced
5647:ddb2a4e982b8 5648:4feda81c38bc
67 && station.getMeasurementType().equals("Schwebstoff")) 67 && station.getMeasurementType().equals("Schwebstoff"))
68 stations.add(station); 68 stations.add(station);
69 } 69 }
70 70
71 // Access data according to type. 71 // Access data according to type.
72 double[][] sd = null; 72 double[][] sd = getLoadData(result);
73 if (getName().equals(FacetTypes.SEDIMENT_LOAD_SAND))
74 sd = result.getSandData();
75 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_COARSE))
76 sd = result.getCoarseData();
77 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_FINEMIDDLE))
78 sd = result.getFineMiddleData();
79 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_SUSP_SAND))
80 sd = result.getSuspSandData();
81 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_SUSP_SAND_BED))
82 sd = result.getSuspSandBedData();
83 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_SUSP_SEDIMENT))
84 sd = result.getSuspSedimentData();
85 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_TOTAL_LOAD))
86 sd = result.getTotalLoadData();
87 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_TOTAL))
88 sd = result.getTotalData();
89 73
90 double[] km = sd[0]; 74 double[] km = sd[0];
91 double[] load = sd[1]; 75 double[] load = sd[1];
92 76
93 double[][] values = new double[2][]; 77 double[][] values = new double[2][];
105 values[0][i*2+1] = station.getRange().getB().doubleValue(); 89 values[0][i*2+1] = station.getRange().getB().doubleValue();
106 values[1][i*2+1] = load[i]; 90 values[1][i*2+1] = load[i];
107 matchFound = true; 91 matchFound = true;
108 } 92 }
109 } 93 }
94 // For now, add point if no matching measurement station found.
110 if (!matchFound) { 95 if (!matchFound) {
111 values[0][i*2] = km[i]; 96 values[0][i*2] = km[i];
112 values[1][i*2] = load[i]; 97 values[1][i*2] = load[i];
113 logger.debug("No measurement station for km " + km[i]); 98 logger.debug("No measurement station for km " + km[i]);
114 } 99 }
115 } 100 }
116 return values; 101 return values;
117 } 102 }
118 103
104
105 /** Get data according to type of facet. */
106 private double[][] getLoadData(SedimentLoadResult result) {
107 if (getName().equals(FacetTypes.SEDIMENT_LOAD_SAND))
108 return result.getSandData();
109 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_COARSE))
110 return result.getCoarseData();
111 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_FINEMIDDLE))
112 return result.getFineMiddleData();
113 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_SUSP_SAND))
114 return result.getSuspSandData();
115 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_SUSP_SAND_BED))
116 return result.getSuspSandBedData();
117 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_SUSP_SEDIMENT))
118 return result.getSuspSedimentData();
119 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_TOTAL_LOAD))
120 return result.getTotalLoadData();
121 else if (getName().equals(FacetTypes.SEDIMENT_LOAD_TOTAL))
122 return result.getTotalData();
123 else {
124 logger.error("SedimentLoadFacet " + getName() + " cannot determine data type.");
125 return null;
126 }
127 }
119 128
120 /** Copy deeply. */ 129 /** Copy deeply. */
121 @Override 130 @Override
122 public Facet deepCopy() { 131 public Facet deepCopy() {
123 SedimentLoadFacet copy = new SedimentLoadFacet(); 132 SedimentLoadFacet copy = new SedimentLoadFacet();

http://dive4elements.wald.intevation.org