control for NaNs in RadarMapMouseHandler (prv. throwing errors w geostationary projection)
This commit is contained in:
parent
ed4d7623ad
commit
e10276131d
1 changed files with 8 additions and 7 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue