comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/RelativePointFacet.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 af13ceeba52a
children 5e38e2924c07
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
26 */ 26 */
27 public class RelativePointFacet 27 public class RelativePointFacet
28 extends BlackboardDataFacet 28 extends BlackboardDataFacet
29 implements FacetTypes { 29 implements FacetTypes {
30 30
31 /** Own logger. */ 31 /** Own log. */
32 private static Logger logger = Logger.getLogger(RelativePointFacet.class); 32 private static Logger log = Logger.getLogger(RelativePointFacet.class);
33 33
34 /** Trivial Constructor. */ 34 /** Trivial Constructor. */
35 public RelativePointFacet(String description) { 35 public RelativePointFacet(String description) {
36 this(RELATIVE_POINT, description); 36 this(RELATIVE_POINT, description);
37 } 37 }
52 Object wqdays = null; 52 Object wqdays = null;
53 double km = 0d; 53 double km = 0d;
54 List<DataProvider> providers = context. 54 List<DataProvider> providers = context.
55 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE); 55 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE);
56 if (providers.size() < 1) { 56 if (providers.size() < 1) {
57 logger.warn("Could not find durationcurve data provider."); 57 log.warn("Could not find durationcurve data provider.");
58 } 58 }
59 else { 59 else {
60 wqdays = providers.get(0).provideData( 60 wqdays = providers.get(0).provideData(
61 DurationCurveFacet.BB_DURATIONCURVE, 61 DurationCurveFacet.BB_DURATIONCURVE,
62 null, 62 null,
63 context); 63 context);
64 } 64 }
65 List<DataProvider> kmproviders = context. 65 List<DataProvider> kmproviders = context.
66 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE_KM); 66 getDataProvider(DurationCurveFacet.BB_DURATIONCURVE_KM);
67 if (kmproviders.size() < 1) { 67 if (kmproviders.size() < 1) {
68 logger.warn("Could not find durationcurve.km data provider."); 68 log.warn("Could not find durationcurve.km data provider.");
69 } 69 }
70 else { 70 else {
71 logger.debug("Found durationcurve.km data provider."); 71 log.debug("Found durationcurve.km data provider.");
72 String dckm = providers.get(0).provideData( 72 String dckm = providers.get(0).provideData(
73 DurationCurveFacet.BB_DURATIONCURVE_KM, 73 DurationCurveFacet.BB_DURATIONCURVE_KM,
74 null, 74 null,
75 context).toString(); 75 context).toString();
76 km = Double.valueOf(dckm); 76 km = Double.valueOf(dckm);
78 78
79 if (wqdays != null) { 79 if (wqdays != null) {
80 // Which W at this km? 80 // Which W at this km?
81 double w = StaticWKmsArtifact.getWAtKmLin(wKms, km); 81 double w = StaticWKmsArtifact.getWAtKmLin(wKms, km);
82 if (w == -1) { 82 if (w == -1) {
83 logger.warn("w is -1, already bad sign!"); 83 log.warn("w is -1, already bad sign!");
84 } 84 }
85 // Where is this W passed by in the wq-curve? 85 // Where is this W passed by in the wq-curve?
86 WQDay wqday = (WQDay) wqdays; 86 WQDay wqday = (WQDay) wqdays;
87 // Doing a linear Day Of KM. 87 // Doing a linear Day Of KM.
88 int idx = 0; 88 int idx = 0;
106 wqday.getDay(idx+mod), wqday.getDay(idx)); 106 wqday.getDay(idx+mod), wqday.getDay(idx));
107 } 107 }
108 108
109 return new Point2D.Double((double) day, w); 109 return new Point2D.Double((double) day, w);
110 } 110 }
111 logger.warn("not wqkms / w / day found"); 111 log.warn("not wqkms / w / day found");
112 // TODO better signal failure. 112 // TODO better signal failure.
113 return new Point2D.Double(0d, 0d); 113 return new Point2D.Double(0d, 0d);
114 } 114 }
115 115
116 116
122 WKms wKms) { 122 WKms wKms) {
123 123
124 List<DataProvider> providers = context. 124 List<DataProvider> providers = context.
125 getDataProvider(ReferenceCurveFacet.BB_REFERENCECURVE_STARTKM); 125 getDataProvider(ReferenceCurveFacet.BB_REFERENCECURVE_STARTKM);
126 if (providers.size() < 1) { 126 if (providers.size() < 1) {
127 logger.warn("Could not find reference curve startkm data provider."); 127 log.warn("Could not find reference curve startkm data provider.");
128 } 128 }
129 129
130 Double start = (Double) providers.get(0). 130 Double start = (Double) providers.get(0).
131 provideData(ReferenceCurveFacet.BB_REFERENCECURVE_STARTKM, null, context); 131 provideData(ReferenceCurveFacet.BB_REFERENCECURVE_STARTKM, null, context);
132 132
133 providers = context. 133 providers = context.
134 getDataProvider(ReferenceCurveFacet.BB_REFERENCECURVE_ENDKMS); 134 getDataProvider(ReferenceCurveFacet.BB_REFERENCECURVE_ENDKMS);
135 if (providers.size() < 1) { 135 if (providers.size() < 1) {
136 logger.warn("Could not find reference curve endkms data provider."); 136 log.warn("Could not find reference curve endkms data provider.");
137 } 137 }
138 double[] ends = (double[]) providers.get(0). 138 double[] ends = (double[]) providers.get(0).
139 provideData(ReferenceCurveFacet.BB_REFERENCECURVE_ENDKMS, null, context); 139 provideData(ReferenceCurveFacet.BB_REFERENCECURVE_ENDKMS, null, context);
140 140
141 logger.debug("Got s " + start + " e " + ends); 141 log.debug("Got s " + start + " e " + ends);
142 142
143 double startW = StaticWKmsArtifact.getWAtKmLin(wKms, start.doubleValue()); 143 double startW = StaticWKmsArtifact.getWAtKmLin(wKms, start.doubleValue());
144 // TODO handle multiple ends. 144 // TODO handle multiple ends.
145 double endW = StaticWKmsArtifact.getWAtKmLin(wKms, ends[0]); 145 double endW = StaticWKmsArtifact.getWAtKmLin(wKms, ends[0]);
146 logger.debug("Gotw s " + startW + " e " + endW); 146 log.debug("Gotw s " + startW + " e " + endW);
147 return new Point2D.Double(startW, endW); 147 return new Point2D.Double(startW, endW);
148 } 148 }
149 149
150 150
151 /** 151 /**
164 } 164 }
165 else if (artifact instanceof StaticWQKmsArtifact) { 165 else if (artifact instanceof StaticWQKmsArtifact) {
166 wKms = ((StaticWQKmsArtifact) artifact).getWQKms(); 166 wKms = ((StaticWQKmsArtifact) artifact).getWQKms();
167 } 167 }
168 else { 168 else {
169 logger.error("Cannot handle Artifact to create relative point."); 169 log.error("Cannot handle Artifact to create relative point.");
170 return null; 170 return null;
171 } 171 }
172 172
173 // Find out whether we live in a duration curve context, there we would 173 // Find out whether we live in a duration curve context, there we would
174 // provide only a single point. 174 // provide only a single point.

http://dive4elements.wald.intevation.org