diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java index 667e9374f4..699e3335f6 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java @@ -34,6 +34,8 @@ import java.util.List; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 24, 2013 2189 mschenke Initial creation + * Sep 13, 2013 16581 kshrestha Variables scaleFont and smoothing + * initialized to true. * * * @@ -45,9 +47,9 @@ public abstract class AbstractAWTFont implements IFont { protected Font font; - protected boolean scaleFont; + protected boolean scaleFont = true; - protected boolean smoothing; + protected boolean smoothing = true; protected AbstractAWTFont(String fontName, float fontSize, Style[] styles) { this(new Font(fontName, toAwtStyle(styles), (int) fontSize)); diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java index e1a0fe52f9..db50729cbe 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java @@ -68,6 +68,8 @@ import com.vividsolutions.jts.geom.Coordinate; * Aug 27, 2013 #2287 randerso Replaced hard coded constant with densityFactor * parameter to allow application specific density * scaling to better match A1 displays + * Sep 10, 2013 DR 16257 MPorricelli Fix so that wind for global grids displays on + * mercator maps. * * * @@ -215,14 +217,31 @@ public abstract class AbstractGriddedDisplay implements IRenderable { // space // Linear distance(between (0,0) and (0,1) makes more sense but // looks to sparse. - DirectPosition2D p1 = new DirectPosition2D(0, 0); - DirectPosition2D p2 = new DirectPosition2D(1, 1); - try { - grid2grid.transform(p1, p1); - grid2grid.transform(p2, p2); - } catch (TransformException e) { - throw new VizException(e); - } + DirectPosition2D p1 = new DirectPosition2D(); + DirectPosition2D p2 = new DirectPosition2D(); + + boolean doneTryingCoords = false; + int i = -1; + // starting with coords (0,0), (1,1), try until tranform succeeds, + // or until have gone through a set of diagonal coords + do { + try { + i++; + if (i + 1 < gridDims[0] && i + 1 < gridDims[1]) { + p1.x = p1.y = i; + p2.x = p2.y = i + 1; + grid2grid.transform(p1, p1); + grid2grid.transform(p2, p2); + doneTryingCoords = true; + } + } catch (TransformException e) { + if (i + 1 >= gridDims[0] || i + 1 >= gridDims[1]) { + doneTryingCoords = true; + throw new VizException(e); + } + } + } while (!doneTryingCoords); + pixelSize = p1.distance(p2); IExtent viewPixelExtent = paintProps.getView().getExtent(); diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java index e906f0d79f..321186e971 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java @@ -61,6 +61,10 @@ import com.vividsolutions.jts.geom.Coordinate; * adjustment of density. * Added gridRelative flag to indicate whether direction * data is relative to grid or true north + * Sep 9, 2013 DR16257 MPorricelli When setDestinationGeographicPoint fails (which can + * happen for global lat/lon grid winds displayed on + * Equidistant Cylindrical map) try again with different + * pixel location. * * * @@ -157,7 +161,7 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { if (Float.isNaN(spd) || Float.isNaN(dir)) { return; } - + int tryDiffPixLoc = 0; try { ReferencedCoordinate rCoord = new ReferencedCoordinate( gridGeometryOfGrid, ijcoord); @@ -169,12 +173,24 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { if (stationPixelLocation != null) { stationPixelLocation[1]--; - double[] newWorldLocation = this.descriptor - .pixelToWorld(stationPixelLocation); - this.gc.setStartingGeographicPoint(stationLocation[0], - stationLocation[1]); - this.gc.setDestinationGeographicPoint(newWorldLocation[0], - newWorldLocation[1]); + do { + try { + double[] newWorldLocation = this.descriptor + .pixelToWorld(stationPixelLocation); + this.gc.setStartingGeographicPoint(stationLocation[0], + stationLocation[1]); + this.gc.setDestinationGeographicPoint( + newWorldLocation[0], newWorldLocation[1]); + tryDiffPixLoc = 2; // setting of pts succeeded; do not need to try again + + } catch (Exception e2) { + if (tryDiffPixLoc == 0) { // setting of points failed first time through + stationPixelLocation[1] += 2; // try pixel location in opposite dir of 1st try + tryDiffPixLoc++; + } else + throw new VizException(e2); // failed on second try; give up + } + } while (tryDiffPixLoc < 2); } if (gridRelative) { @@ -185,6 +201,7 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { // rotate dir from true north to display up dir -= this.gc.getAzimuth(); + } catch (Exception e) { throw new VizException(e); } diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java index b38f451b56..7495ed6b1e 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java @@ -44,6 +44,10 @@ import org.opengis.referencing.operation.TransformException; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Oct 13, 2011 bsteffen Initial creation + * Sep 10, 2013 DR 16257 MPorricelli Eliminate values that + * fail to be tranformed,e.g. + * when too close to pole for + * mercator projections * * * @@ -146,7 +150,19 @@ public class PlotLocationCache { ConcatenatedTransform.create(grid2crs, crs2crs), crs2grid); - grid2grid.transform(result, 0, result, 0, xDim * yDim); + try { + grid2grid.transform(result, 0, result, 0, xDim * yDim); + } catch (TransformException e1) { + // Set values to NaN when fail transform + for (int i = 0; i < result.length; i += 2) { + try { + grid2grid.transform(result, i, result, i, 1); + } catch (TransformException e2) { + result[i] = Float.NaN; + result[i + 1] = Float.NaN; + } + } + } } catch (FactoryException e) { throw new RuntimeException(e); } catch (InvalidGridGeometryException e) { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java index 3e9e82b24f..f9a16efd4c 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java @@ -40,6 +40,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; * Mar 25, 2013 1605 jsanchez Set ClosestPoint's prepGeom. * Apr 24, 2013 1944 jsanchez Updated calculateLocationPortion visibility to public. * May 2, 2013 1963 jsanchez Referenced calculatePortion from GisUtil if intersection less than DEFAULT_PORTION_TOLERANCE. + * Sep 13, 2013 DR 16601 D. Friedman Fix from jsanchez: Allow cities outside the CWA. * * * @@ -156,8 +157,6 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor { filter = new HashMap(); } - filter.put(cwaField, new RequestConstraint(localizedSite)); - return filter; }