Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/StyledSeriesBuilder.java @ 3176:cbaa49896eca
Fix issue663 (step curves for longitudinal_section Qs).
flys-artifacts/trunk@4791 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 25 Jun 2012 19:13:16 +0000 |
parents | 5642a83420f2 |
children | b2ea89a665bc |
comparison
equal
deleted
inserted
replaced
3175:4616436a84f4 | 3176:cbaa49896eca |
---|---|
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 | 96 |
97 /** | 97 /** |
98 * Add points to series (km to 1st dim, q to 2nd dim), adding points | |
99 * to achieve a step-like curve. | |
100 * | |
101 * @param series Series to add points to. | |
102 * @param points Points to add to series. | |
103 */ | |
104 public static void addStepPointsKmQ(XYSeries series, WQKms wqkms) { | |
105 if (wqkms == null) { | |
106 return; | |
107 } | |
108 | |
109 int size = wqkms.size(); | |
110 | |
111 for (int i = 0; i < size; i++) { | |
112 if (i==0) { | |
113 series.add(wqkms.getKm(i), wqkms.getQ(i), false); | |
114 } | |
115 else { | |
116 //Add two points. | |
117 double halveX = (wqkms.getKm(i-1) + wqkms.getKm(i)) / 2d; | |
118 series.add(halveX, wqkms.getQ(i-1)); | |
119 series.add(halveX, wqkms.getQ(i)); | |
120 } | |
121 if (i == size-1) { | |
122 series.add(wqkms.getKm(i), wqkms.getQ(i), false); | |
123 } | |
124 } | |
125 } | |
126 | |
127 | |
128 /** | |
98 * Add points to series (q to 1st dim, w to 2nd dim). | 129 * Add points to series (q to 1st dim, w to 2nd dim). |
99 * | 130 * |
100 * @param series Series to add points to. | 131 * @param series Series to add points to. |
101 * @param points Points to add to series. | 132 * @param points Points to add to series. |
102 */ | 133 */ |