Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixOutlierFacet.java @ 3035:b388d888330d
Implemented facets and splitted up the event facet.Implemented facets and splitted up the event facet.
flys-artifacts/trunk@4604 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 06 Jun 2012 11:35:32 +0000 |
parents | 77b5f5a26700 |
children | 22da13d1b180 |
comparison
equal
deleted
inserted
replaced
3034:842502b3913a | 3035:b388d888330d |
---|---|
3 import org.apache.log4j.Logger; | 3 import org.apache.log4j.Logger; |
4 | 4 |
5 import de.intevation.artifacts.Artifact; | 5 import de.intevation.artifacts.Artifact; |
6 import de.intevation.artifacts.CallContext; | 6 import de.intevation.artifacts.CallContext; |
7 | 7 |
8 import de.intevation.flys.utils.KMIndex; | |
9 | |
8 import de.intevation.flys.artifacts.FLYSArtifact; | 10 import de.intevation.flys.artifacts.FLYSArtifact; |
11 import de.intevation.flys.artifacts.FixationArtifactAccess; | |
12 | |
9 import de.intevation.flys.artifacts.model.FacetTypes; | 13 import de.intevation.flys.artifacts.model.FacetTypes; |
10 import de.intevation.flys.artifacts.model.DataFacet; | 14 import de.intevation.flys.artifacts.model.DataFacet; |
15 import de.intevation.flys.artifacts.model.CalculationResult; | |
11 | 16 |
12 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; | 17 import de.intevation.flys.artifacts.states.DefaultState.ComputeType; |
13 | 18 |
14 | 19 |
15 /** | 20 /** |
46 * @return the data. | 51 * @return the data. |
47 */ | 52 */ |
48 @Override | 53 @Override |
49 public Object getData(Artifact artifact, CallContext context) { | 54 public Object getData(Artifact artifact, CallContext context) { |
50 logger.debug("FixOutlierFacet.getData"); | 55 logger.debug("FixOutlierFacet.getData"); |
51 return null; | 56 |
57 if (artifact instanceof FLYSArtifact) { | |
58 FLYSArtifact flys = (FLYSArtifact)artifact; | |
59 FixationArtifactAccess access = new FixationArtifactAccess(flys); | |
60 | |
61 CalculationResult res = | |
62 (CalculationResult) flys.compute(context, | |
63 ComputeType.ADVANCE, | |
64 false); | |
65 | |
66 FixResult result = (FixResult) res.getData(); | |
67 | |
68 double km = access.getCurrentKm(); | |
69 KMIndex<QW []> kmQWs = result.getOutliers(); | |
70 | |
71 QW[] qws = kmQWs.binarySearch(km).getValue(); | |
72 if (qws == null) { | |
73 return null; | |
74 } | |
75 return qws; | |
76 } | |
77 else { | |
78 logger.debug("Not an instance of FixationArtifact."); | |
79 return null; | |
80 } | |
52 } | 81 } |
53 | 82 |
54 | 83 |
55 /** | 84 /** |
56 * Create a deep copy of this Facet. | 85 * Create a deep copy of this Facet. |