From 851046ccf3592a7d7f139765cff1b4ea55f883d3 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 6 Feb 2012 16:54:00 -0600 Subject: [PATCH] Issue #237 revert Silver Spring changes to nsharp activator which break windows. Fix grib decoder to handle grib files with lo1 on the dateline. Change-Id: I4991e7f02c8cdcfd608c3c6d987f4d0ea8593f40 Former-commit-id: 2b0f9f149c4dc2031cb9178538899eb3f9f5de23 --- .../edex/plugin/grib/Grib1Decoder.java | 2 +- .../noaa/nws/ncep/ui/nsharp/Activator.java | 131 +++++++++--------- 2 files changed, 70 insertions(+), 63 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java index ad605149b9..0bdb716032 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/Grib1Decoder.java @@ -1308,7 +1308,7 @@ public class Grib1Decoder extends AbstractDecoder { lon = lon % 360; } - if (lon > 180) { + if (lon >= 180) { lon = (180 - lon % 180) * -1; } else if (lon < -180) { lon = (180 - (-lon % 180)); diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java index f45fb552e3..27e3df0778 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/Activator.java @@ -29,8 +29,6 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; - - import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -38,83 +36,92 @@ import com.raytheon.uf.common.status.UFStatus; * The activator class controls the plug-in life cycle */ public class Activator extends AbstractUIPlugin { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(Activator.class); - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(Activator.class); - - // The plug-in ID - public static final String PLUGIN_ID = "gov.noaa.nws.ncep.ui.nsharp"; + // The plug-in ID + public static final String PLUGIN_ID = "gov.noaa.nws.ncep.ui.nsharp"; - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } + private static final String BIGNSHARP = "bignsharp"; - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - try { - Bundle b = this.getBundle(); - URL url = FileLocator.find(b, new Path("libbignsharp.so"), null); - url = FileLocator.resolve(url); - System.load(url.getPath()); - }catch (Throwable e) { - statusHandler.handle(UFStatus.Priority.WARN, "An Error occured loading nsharp libraries, nsharp will not work.", e); - } + // The shared instance + private static Activator plugin; - } + /** + * The constructor + */ + public Activator() { + } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + try { + Bundle b = this.getBundle(); + URL url = FileLocator.find(b, + new Path(System.mapLibraryName(BIGNSHARP)), null); + url = FileLocator.resolve(url); + System.load(url.getPath()); + } catch (Throwable e) { + statusHandler + .handle(UFStatus.Priority.WARN, + "An Error occured loading nsharp libraries, nsharp will not work.", + e); + } + } - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } - - //for plugin to retrieve runtime properties from build.properties - protected final static String MY_PROPERTIES = "build.properties"; + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } - protected PropertyResourceBundle myProperties; + // for plugin to retrieve runtime properties from build.properties + protected final static String MY_PROPERTIES = "build.properties"; + protected PropertyResourceBundle myProperties; - public PropertyResourceBundle getMyProperties(){ + public PropertyResourceBundle getMyProperties() { - if (myProperties == null){ + if (myProperties == null) { - try { + try { - myProperties = new PropertyResourceBundle( + myProperties = new PropertyResourceBundle( - FileLocator.openStream(this.getBundle(), + FileLocator.openStream(this.getBundle(), - new Path(MY_PROPERTIES),false)); + new Path(MY_PROPERTIES), false)); - } catch (IOException e) { + } catch (IOException e) { - System.out.println("Error open NSHARP build.properites file"); + System.out.println("Error open NSHARP build.properties file"); - } - } - return myProperties; - } + } + } + return myProperties; + } }