Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java @ 3272:31168ac9c7e7
Partial fix for issue694 (heightmarks snap to nearest cross section).
flys-artifacts/trunk@4916 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 10 Jul 2012 15:31:56 +0000 |
parents | ed07dd55f487 |
children | 6153c50f78cf |
comparison
equal
deleted
inserted
replaced
3271:4c4ec9e9650a | 3272:31168ac9c7e7 |
---|---|
22 */ | 22 */ |
23 public class CrossSectionWaterLineFacet | 23 public class CrossSectionWaterLineFacet |
24 extends BlackboardDataFacet | 24 extends BlackboardDataFacet |
25 implements FacetTypes { | 25 implements FacetTypes { |
26 | 26 |
27 private static Logger logger = Logger.getLogger(CrossSectionWaterLineFacet.class); | 27 /** Private logger to use. */ |
28 private static Logger logger = | |
29 Logger.getLogger(CrossSectionWaterLineFacet.class); | |
28 | 30 |
29 | 31 |
30 /** Trivial constructor, set (maybe localized) description. */ | 32 /** Trivial constructor, set (maybe localized) description. */ |
31 public CrossSectionWaterLineFacet(int idx, String description) { | 33 public CrossSectionWaterLineFacet(int idx, String description) { |
32 super(idx, CROSS_SECTION_WATER_LINE, description); | 34 super(idx, CROSS_SECTION_WATER_LINE, description); |
33 } | 35 } |
34 | 36 |
35 | 37 |
36 /** Trivial constructor, set (maybe localized) description. */ | 38 /** |
39 * Trivial constructor, set (maybe localized) description. | |
40 * @param idx Index of this facet. | |
41 * @param name 'type' of this facet. | |
42 * @param description (maybe) localized user-visible description. | |
43 */ | |
37 public CrossSectionWaterLineFacet(int idx, String name, String description) { | 44 public CrossSectionWaterLineFacet(int idx, String name, String description) { |
38 super(idx, name, description); | 45 super(idx, name, description); |
39 } | 46 } |
40 | |
41 | 47 |
42 | 48 |
43 /** | 49 /** |
44 * Gets waterline (crossed with cross section) of waterlevel. | 50 * Gets waterline (crossed with cross section) of waterlevel. |
45 */ | 51 */ |
52 logger.warn("Could not find Cross-Section data provider."); | 58 logger.warn("Could not find Cross-Section data provider."); |
53 return new Lines.LineData(new double[][] {}, 0d, 0d); | 59 return new Lines.LineData(new double[][] {}, 0d, 0d); |
54 } | 60 } |
55 | 61 |
56 Object crossSection = providers.get(0) | 62 Object crossSection = providers.get(0) |
57 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); | 63 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, |
64 null, context); | |
65 Object nextKm = providers.get(0). | |
66 provideData(CrossSectionFacet.BLACKBOARD_CS_NEXT_KM, null, context); | |
67 Object prevKm = providers.get(0). | |
68 provideData(CrossSectionFacet.BLACKBOARD_CS_PREV_KM, null, context); | |
69 if (prevKm == null) | |
70 prevKm = new Double(-1d); | |
71 if (nextKm == null) | |
72 nextKm = new Double(-1d); | |
58 | 73 |
59 WaterLineArtifact winfo = (WaterLineArtifact)artifact; | 74 WaterLineArtifact lineArtifact = (WaterLineArtifact) artifact; |
60 | 75 |
61 if (crossSection != null) { | 76 if (crossSection != null) { |
62 return winfo.getWaterLines(this.getIndex(), | 77 return lineArtifact.getWaterLines(this.getIndex(), |
63 (FastCrossSectionLine) crossSection); | 78 (FastCrossSectionLine) crossSection, (Double) nextKm, (Double) prevKm); |
64 } | 79 } |
65 else { | 80 else { |
66 return new Lines.LineData(new double[][] {}, 0d,0d); | 81 return new Lines.LineData(new double[][] {}, 0d,0d); |
67 } | 82 } |
68 } | 83 } |