Issue #2791 Fix streamlines that were broken in conversion to data source.

Former-commit-id: 3af21bb5a8 [formerly 288621fd9c] [formerly 4289b416c0] [formerly 4289b416c0 [formerly b4c30292f8]] [formerly 3af21bb5a8 [formerly 288621fd9c] [formerly 4289b416c0] [formerly 4289b416c0 [formerly b4c30292f8]] [formerly 3c6fa3bfc8 [formerly 4289b416c0 [formerly b4c30292f8] [formerly 3c6fa3bfc8 [formerly 644ceb3fb7a4f01f74a0259043b23e4d01ce16c0]]]]]
Former-commit-id: 3c6fa3bfc8
Former-commit-id: 0397e04bd6 [formerly 0efa412e99] [formerly 83d17a138e] [formerly 9f013e6f71d6f6d0e725584103d52c6dd50a8d54 [formerly a8575e0c50ea7854743176738e8faefc64b768b6] [formerly 83d17a138e [formerly 2589749b76]]]
Former-commit-id: 77ed65f7617cf9ada81a7af1e9fc059ca1db3dcc [formerly ebabe04a6177553af86c870b0d009dcae5a7b594] [formerly 7e0fc8bda5 [formerly f7ecee99ff]]
Former-commit-id: 7e0fc8bda5
Former-commit-id: 225ee343a4
This commit is contained in:
Ben Steffensmeier 2014-03-27 15:08:54 -05:00
parent 8f200f9f64
commit 235535ac20
2 changed files with 28 additions and 12 deletions

View file

@ -1151,6 +1151,11 @@ public class ContourSupport {
maxspc = 0.25f;
}
if (minX != 0 || minY != 0) {
uW = new OffsetDataSource(uW, minX, minY);
vW = new OffsetDataSource(vW, minX, minY);
}
StrmPakConfig config = new StrmPakConfig(arrowSize, minspc, maxspc,
-1000000f, -999998f);
StreamLineContainer container = StrmPak.strmpak(uW, vW,
@ -1169,9 +1174,10 @@ public class ContourSupport {
StreamLinePoint point = points.get(i);
try {
long tZ0 = System.currentTimeMillis();
rastPosToWorldGrid.transform(new double[] {
maxX - point.getX(), point.getY() + minY }, 0,
valsArr[i], 0, 1);
rastPosToWorldGrid.transform(
new double[] { point.getX() + minX,
point.getY() + minY }, 0, valsArr[i],
0, 1);
long tZ1 = System.currentTimeMillis();
tAccum += (tZ1 - tZ0);
} catch (TransformException e) {

View file

@ -25,8 +25,10 @@ import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.numeric.array.FloatArray2DWrapper;
import com.raytheon.uf.common.numeric.filter.DataFilter;
import com.raytheon.uf.common.numeric.source.AxisSwapDataSource;
import com.raytheon.uf.common.numeric.source.DataSource;
import com.raytheon.uf.common.numeric.source.FilteredDataSource;
import com.raytheon.viz.core.contours.util.StreamLineContainer.StreamLinePoint;
/**
@ -131,7 +133,8 @@ public final class StrmPak {
private final PointValueBuffer<Float> JPnt;
/**
* Generate streamlines using column major float data.
* Generate streamlines using column major float data. The u component is
* assumed to moving in the opposite direction of the x axis.
*
* @param uComp
* data values for the u component of the vector
@ -153,6 +156,13 @@ public final class StrmPak {
DataSource vSource = new FloatArray2DWrapper(vComp, ny, nx);
uSource = new AxisSwapDataSource(uSource);
vSource = new AxisSwapDataSource(vSource);
uSource = FilteredDataSource.addFilters(uSource, new DataFilter() {
@Override
public double filter(double value) {
return -value;
}
});
return strmpak(uSource, vSource, nx, ny, config);
}
@ -521,14 +531,14 @@ public final class StrmPak {
influx = V.getDataValue(i, j) * (1.0f - x)
+ V.getDataValue(ii, j) * x;
} else if (side0 == 2) {
influx = -(U.getDataValue(ii, j) * (1.0f - y) + U
.getDataValue(ii, jj) * y);
influx = U.getDataValue(ii, j) * (1.0f - y)
+ U.getDataValue(ii, jj) * y;
} else if (side0 == 3) {
influx = -(V.getDataValue(i, jj) * (1.0f - x) + V
.getDataValue(ii, jj) * x);
} else {
influx = U.getDataValue(i, j) * (1.0f - y)
+ U.getDataValue(i, jj) * y;
influx = -(U.getDataValue(i, j) * (1.0f - y) + U
.getDataValue(i, jj) * y);
}
if (influx < 0.0f) {
dirflg = -1.0f;
@ -647,12 +657,12 @@ public final class StrmPak {
float[] Flux = { Float.NaN,
(-dirflg) * (float) V.getDataValue(i, j),
(-dirflg) * (float) V.getDataValue(ii, j),
dirflg * (float) U.getDataValue(ii, j),
dirflg * (float) U.getDataValue(ii, jj),
(-dirflg) * (float) U.getDataValue(ii, j),
(-dirflg) * (float) U.getDataValue(ii, jj),
dirflg * (float) V.getDataValue(ii, jj),
dirflg * (float) V.getDataValue(i, jj),
(-dirflg) * (float) U.getDataValue(i, jj),
(-dirflg) * (float) U.getDataValue(i, j) };
dirflg * (float) U.getDataValue(i, jj),
dirflg * (float) U.getDataValue(i, j) };
// Count total number of in, out, and zero contributions
// to net flux.