Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/StaticWQKmsArtifact.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 8d5ca5175038 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
48 */ | 48 */ |
49 public class StaticWQKmsArtifact | 49 public class StaticWQKmsArtifact |
50 extends StaticD4EArtifact | 50 extends StaticD4EArtifact |
51 implements FacetTypes, WaterLineArtifact | 51 implements FacetTypes, WaterLineArtifact |
52 { | 52 { |
53 /** The logger for this class. */ | 53 /** The log for this class. */ |
54 private static Logger logger = | 54 private static Logger log = |
55 Logger.getLogger(StaticWQKmsArtifact.class); | 55 Logger.getLogger(StaticWQKmsArtifact.class); |
56 | 56 |
57 public static final String STATIC_STATE_NAME = | 57 public static final String STATIC_STATE_NAME = |
58 "state.additional_wqkms.static"; | 58 "state.additional_wqkms.static"; |
59 | 59 |
77 | 77 |
78 /** | 78 /** |
79 * Trivial Constructor. | 79 * Trivial Constructor. |
80 */ | 80 */ |
81 public StaticWQKmsArtifact() { | 81 public StaticWQKmsArtifact() { |
82 logger.debug("StaticWQKmsArtifact.StaticWQKmsArtifact"); | 82 log.debug("StaticWQKmsArtifact.StaticWQKmsArtifact"); |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 /** | 86 /** |
87 * Gets called from factory, to set things up. | 87 * Gets called from factory, to set things up. |
97 Object context, | 97 Object context, |
98 CallMeta callMeta, | 98 CallMeta callMeta, |
99 Document data, | 99 Document data, |
100 List<Class> loadFacets) | 100 List<Class> loadFacets) |
101 { | 101 { |
102 logger.debug("StaticWQKmsArtifact.setup"); | 102 log.debug("StaticWQKmsArtifact.setup"); |
103 | 103 |
104 // Store the 'ids' (from datacage). | 104 // Store the 'ids' (from datacage). |
105 if (logger.isDebugEnabled()) { | 105 if (log.isDebugEnabled()) { |
106 logger.debug("StaticWQKmsArtifact.setup" + XMLUtils.toString(data)); | 106 log.debug("StaticWQKmsArtifact.setup" + XMLUtils.toString(data)); |
107 } | 107 } |
108 | 108 |
109 String code = getDatacageIDValue(data); | 109 String code = getDatacageIDValue(data); |
110 addStringData("ids", code); | 110 addStringData("ids", code); |
111 if (code != null) { | 111 if (code != null) { |
139 protected void initialize( | 139 protected void initialize( |
140 Artifact artifact, | 140 Artifact artifact, |
141 Object context, | 141 Object context, |
142 CallMeta meta) | 142 CallMeta meta) |
143 { | 143 { |
144 logger.debug("StaticWQKmsArtifact.initialize"); | 144 log.debug("StaticWQKmsArtifact.initialize"); |
145 D4EArtifact flys = (D4EArtifact) artifact; | 145 D4EArtifact flys = (D4EArtifact) artifact; |
146 // TODO: The river is of no interest, so far., also use importData | 146 // TODO: The river is of no interest, so far., also use importData |
147 importData(flys, "river"); | 147 importData(flys, "river"); |
148 | 148 |
149 List<Facet> fs = new ArrayList<Facet>(); | 149 List<Facet> fs = new ArrayList<Facet>(); |
150 | 150 |
151 DefaultState state = (DefaultState) getCurrentState(context); | 151 DefaultState state = (DefaultState) getCurrentState(context); |
152 state.computeInit(this, hash(), context, meta, fs); | 152 state.computeInit(this, hash(), context, meta, fs); |
153 if (!fs.isEmpty()) { | 153 if (!fs.isEmpty()) { |
154 logger.debug("Facets to add in StaticWQKmsArtifact.initialize ."); | 154 log.debug("Facets to add in StaticWQKmsArtifact.initialize ."); |
155 addFacets(getCurrentStateId(), fs); | 155 addFacets(getCurrentStateId(), fs); |
156 } | 156 } |
157 else { | 157 else { |
158 logger.debug("No facets to add in StaticWQKmsArtifact.initialize (" | 158 log.debug("No facets to add in StaticWQKmsArtifact.initialize (" |
159 + state.getID() + ")."); | 159 + state.getID() + ")."); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 /** | 164 /** |
165 * Get WQKms from factory. | 165 * Get WQKms from factory. |
166 * @return WQKms according to parameterization (can be null); | 166 * @return WQKms according to parameterization (can be null); |
167 */ | 167 */ |
168 public WQKms getWQKms() { | 168 public WQKms getWQKms() { |
169 logger.debug("StaticWQKmsArtifact.getWQKms"); | 169 log.debug("StaticWQKmsArtifact.getWQKms"); |
170 | 170 |
171 int col = Integer.parseInt(getDataAsString("col_pos")); | 171 int col = Integer.parseInt(getDataAsString("col_pos")); |
172 int wst = Integer.parseInt(getDataAsString("wst_id")); | 172 int wst = Integer.parseInt(getDataAsString("wst_id")); |
173 | 173 |
174 /** TODO do not run twice against db to do this. */ | 174 /** TODO do not run twice against db to do this. */ |
200 */ | 200 */ |
201 @Override | 201 @Override |
202 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl, | 202 public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl, |
203 double next, double prev, CallContext context | 203 double next, double prev, CallContext context |
204 ) { | 204 ) { |
205 logger.debug("getWaterLines(" + idx + ")/" + identifier()); | 205 log.debug("getWaterLines(" + idx + ")/" + identifier()); |
206 | 206 |
207 List<Point2D> points = csl.getPoints(); | 207 List<Point2D> points = csl.getPoints(); |
208 | 208 |
209 WKms wkms = getWQKms(); | 209 WKms wkms = getWQKms(); |
210 | 210 |
223 */ | 223 */ |
224 wAtKm = StaticWKmsArtifact.getWAtKm(wkms, km); | 224 wAtKm = StaticWKmsArtifact.getWAtKm(wkms, km); |
225 //} | 225 //} |
226 | 226 |
227 if (wAtKm == -1 || Double.isNaN(wAtKm)) { | 227 if (wAtKm == -1 || Double.isNaN(wAtKm)) { |
228 logger.warn("Waterlevel at km " + km + " unknown."); | 228 log.warn("Waterlevel at km " + km + " unknown."); |
229 return new Lines.LineData(new double[][] {{}}, 0d, 0d); | 229 return new Lines.LineData(new double[][] {{}}, 0d, 0d); |
230 } | 230 } |
231 | 231 |
232 return Lines.createWaterLines(points, wAtKm); | 232 return Lines.createWaterLines(points, wAtKm); |
233 } | 233 } |