Omaha #3966 Limit the number of flags on wind barbs.

Former-commit-id: f1aadfd1be [formerly dad3e9ed8c] [formerly 22f13c9f08] [formerly f1aadfd1be [formerly dad3e9ed8c] [formerly 22f13c9f08] [formerly 3a6bce1100 [formerly 22f13c9f08 [formerly 8b0ce01043b4ba2858dacb5ceeb41299f5c2044d]]]]
Former-commit-id: 3a6bce1100
Former-commit-id: f54ba922fc [formerly f7d8dae6b9] [formerly 6e46f5ca1f27bbfd2affbcd77eca893a08d09a48 [formerly 7d9ff47dfa]]
Former-commit-id: 5d2c5c2a402c7cc6c52b10342882d75fca379f34 [formerly 4b253097a1]
Former-commit-id: 79d0ce0b70
This commit is contained in:
Ben Steffensmeier 2015-01-13 17:20:53 -06:00
parent 55468188a6
commit 4f11df8c5a

View file

@ -63,6 +63,8 @@ import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence;
* May 27, 2011 bsteffen Initial creation
* Aug 27, 2013 2287 randerso Refactored to allow subclassing
* Sep 23, 2013 2363 bsteffen Add more configuration options.
* Jan 13, 2015 3966 bsteffen Limit the number of flags on barbs.
*
*
* </pre>
*
@ -246,9 +248,26 @@ public class VectorGraphicsRenderable {
int n10 = calcSpd / 10;
calcSpd = calcSpd - 10 * n10;
int n5 = calcSpd / 5;
/*
* Rendering too many flags results in unacceptable rendering
* performance(freezes). Since real atmospheric conditions can never
* generate that much wind we want to limit it too a reasonablish number
* of flags. To make it somewhat configurable the number of flags is
* limited to 10 times the number of flags that fit on the staff size
* specified in the config. 10 was chosen arbitrarily, displays with
* that many flags are already unusable but still render with good
* enough performance.
*/
if (n50 * add * 2 > size * 10) {
throw new IllegalArgumentException(
"Unable to render a wind barb because magnitude is too great("
+ magnitude + ").");
}
double sx = ((n50 + n50 + n10 + n5 + 2)) * add;
double staff = Math.max(size, sx);
// DRAW STAFF
double ix2 = plotLoc.x + dix * size * config.getOffsetRatio();
double jy2 = plotLoc.y - djy * size * config.getOffsetRatio();