control for NaNs in RadarMapMouseHandler (prv. throwing errors w geostationary projection)

This commit is contained in:
Michael James 2017-05-04 13:45:46 -06:00
parent ed4d7623ad
commit e10276131d

View file

@ -193,18 +193,19 @@ public class RadarMapMouseHandler extends InputAdapter {
GeodeticCalculator gc; GeodeticCalculator gc;
// can't assume this is a map Editor/MapDescriptor // can't assume this is a map Editor/MapDescriptor
AbstractEditor mapEditor = RadarMapResource.getMapEditor(); AbstractEditor mapEditor = RadarMapResource.getMapEditor();
if (mapEditor != null) { if (mapEditor != null && ! Double.isNaN(pt.x) && ! Double.isNaN(pt.y) ) {
IMapDescriptor desc = (IMapDescriptor) mapEditor IMapDescriptor desc = (IMapDescriptor) mapEditor
.getActiveDisplayPane().getRenderableDisplay() .getActiveDisplayPane().getRenderableDisplay()
.getDescriptor(); .getDescriptor();
gc = new GeodeticCalculator(desc.getCRS());
gc.setStartingGeographicPoint(pt.x, pt.y);
for (RadarStation selectPoint : points) { for (RadarStation selectPoint : points) {
gc.setDestinationGeographicPoint(selectPoint.getLon(),
selectPoint.getLat());
double dist; double dist;
try { try {
gc = new GeodeticCalculator(desc.getCRS());
gc.setStartingGeographicPoint(pt.x, pt.y);
gc.setDestinationGeographicPoint(selectPoint.getLon(),
selectPoint.getLat());
dist = gc.getOrthodromicDistance(); dist = gc.getOrthodromicDistance();
if (dist < minDistance) { if (dist < minDistance) {
minDistance = dist; minDistance = dist;
@ -212,7 +213,7 @@ public class RadarMapMouseHandler extends InputAdapter {
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle( statusHandler.handle(
Priority.ERROR,"getOrthodromicDistance exception.",e); Priority.WARN,"getOrthodromicDistance exception.",e);
} }
} }