scriptArguments) {
+ this.scriptArguments.clear();
+ if (scriptArguments != null) {
+ this.scriptArguments.addAll(scriptArguments);
+ }
+ }
+
+ /**
+ * Append an argument to the script's argument list.
+ *
+ * @param argument
+ * @return success - true when added to the list
+ */
+ public boolean addScriptArgument(String argument) {
+ return scriptArguments.add(argument);
+ }
+
+ /**
+ * This clears the script argument list and breaks arguments into a list
+ * which becomes the new script argument list. The arguments is split into
+ * tokens delimited by whitespace. A token may be surrounded by single or
+ * double quotes. A quote may be escaped within a quoted section by
+ * duplicating itself.
+ *
+ *
+ * Examples of lists from java strings:
+ * "a b c" - Three arguments [a, b, c]
+ * "1 'a b c'd 3" - Three arguments [1, a b cd, 3]
+ * "1 \"a b c\"d 3" - Three arguments [1, a b cd, 3]
+ * "1 'a b ''c'''d 3" - Three arguments [1, a b 'c'd, 3]
+ * "1 \"a b \"\"c\"\"\"d 3" - Three arguments [1, a b "c"d, 3]
+ *
+ */
+ public void parseAndSetScriptArguments(String arguments) {
+ if (arguments == null || (arguments.trim().length() == 0)) {
+ clearScriptArguements();
+ return;
+ }
+ String[] args = (new StrTokenizer(arguments, StrMatcher.spaceMatcher(),
+ StrMatcher.quoteMatcher())).getTokenArray();
+ setScriptArguments(Arrays.asList(args));
+ }
+
+ /**
+ * Remove all arguments from the script's argument list.
+ */
+ public void clearScriptArguements() {
+ scriptArguments.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder(getClass().getName());
+ sb.append("[ userId: ").append(getUserId());
+ sb.append(", script: ").append(getScript());
+ sb.append(", context: ").append(getContext());
+ sb.append(", propertyMap: ").append(propertyMap);
+ sb.append(", scriptArguments: ").append(getScriptArguments());
+ sb.append("]");
+ return sb.toString();
+ }
+}
diff --git a/edexOsgi/com.raytheon.uf.common.remote.script/src/com/raytheon/uf/common/remote/script/RemoteScriptRunResponse.java b/edexOsgi/com.raytheon.uf.common.remote.script/src/com/raytheon/uf/common/remote/script/RemoteScriptRunResponse.java
new file mode 100644
index 0000000000..81010ae3e3
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.remote.script/src/com/raytheon/uf/common/remote/script/RemoteScriptRunResponse.java
@@ -0,0 +1,172 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.common.remote.script;
+
+import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
+import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
+
+/**
+ * This contains the results from running a remote script.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 19, 2014 2743 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+@DynamicSerialize
+public class RemoteScriptRunResponse {
+ /**
+ * The exit status for the script.
+ */
+ @DynamicSerializeElement
+ private Integer exitStatus;
+
+ /**
+ * The scripts output either just stdout or a combination of stadout and
+ * stderr. See {@link RemoteScriptConstants}.
+ */
+ @DynamicSerializeElement
+ private String output = "";
+
+ /**
+ * When requested a separate sting with stderr. See
+ * {@link RemoteScriptConstants}.
+ */
+ @DynamicSerializeElement
+ private String error = "";
+
+ /**
+ * When true script process timed out and was killed otherwise false. See
+ * {@link RemoteScriptConstants}.
+ */
+ @DynamicSerializeElement
+ private boolean timedOut = false;
+
+ /**
+ * Default Constructor.
+ */
+ public RemoteScriptRunResponse() {
+ }
+
+ /**
+ * Get the exit status for the process running the script.
+ *
+ * @return exitStatus
+ */
+ public Integer getExitStatus() {
+ return exitStatus;
+ }
+
+ /**
+ * Set the exit status for script's process. Should only be used by the
+ * handler and serialization.
+ *
+ * @param exitStatus
+ */
+ public void setExitStatus(Integer exitStatus) {
+ this.exitStatus = exitStatus;
+ }
+
+ /**
+ * Get the script's output. Based on the request properties this is either
+ * just stdout or a combination of stdout and stderr. See
+ * {@link RemoteScriptConstants}.
+ *
+ * @return output - never null
+ */
+ public String getOutput() {
+ return output;
+ }
+
+ /**
+ * Set the script's output. Based on the request properties this is either
+ * just stdout or a combination of stdout and stderr. Should only be used by
+ * the handler and serialization. See {@link RemoteScriptConstants}.
+ *
+ * @param output
+ */
+ public void setOutput(String output) {
+ this.output = (output == null) ? "" : output;
+ }
+
+ /**
+ * Get script's stderr when not placed in output.
+ *
+ * @return error - never null
+ */
+ public String getError() {
+ return error;
+ }
+
+ /**
+ * Set script's stderr when not place in output. Should only be used by the
+ * handler and serialization.
+ *
+ * @param error
+ */
+ public void setError(String error) {
+ this.error = (error == null) ? "" : error;
+ }
+
+ /**
+ * Flag to indicate script did not finish in the desired number of seconds.
+ * See {@link RemoteScriptConstants}.
+ *
+ * @return true when script process is killed otherwise false
+ */
+ public boolean isTimedOut() {
+ return timedOut;
+ }
+
+ /**
+ * Set the timed out flag. Should only be used by the handler and
+ * serialization. See {@link RemoteScriptConstants}.
+ *
+ * @param timeOut
+ */
+ public void setTimedOut(boolean timedOut) {
+ this.timedOut = timedOut;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder(this.getClass().getName());
+ sb.append("[");
+ sb.append("exitStatus: ").append(getExitStatus());
+ sb.append(", timedOut: ").append(isTimedOut());
+ sb.append(", error: \"").append(getError()).append("\"");
+ sb.append(", output: \"").append(getOutput()).append("\"");
+ sb.append("]");
+ return sb.toString();
+ }
+}
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script.feature/.project b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/.project
new file mode 100644
index 0000000000..a5f433fa4b
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/.project
@@ -0,0 +1,17 @@
+
+
+ com.raytheon.uf.edex.remote.script.feature
+
+
+
+
+
+ org.eclipse.pde.FeatureBuilder
+
+
+
+
+
+ org.eclipse.pde.FeatureNature
+
+
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script.feature/build.properties b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/build.properties
new file mode 100644
index 0000000000..64f93a9f0b
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script.feature/com.raytheon.uf.edex.remote.script.feature.ecl b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/com.raytheon.uf.edex.remote.script.feature.ecl
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/feature.xml
new file mode 100644
index 0000000000..1805e7b3a2
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script.feature/feature.xml
@@ -0,0 +1,34 @@
+
+
+
+
+ [Enter Feature Description here.]
+
+
+
+ [Enter Copyright Description here.]
+
+
+
+ [Enter License Description here.]
+
+
+
+
+
+
+
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/.classpath b/edexOsgi/com.raytheon.uf.edex.remote.script/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/.project b/edexOsgi/com.raytheon.uf.edex.remote.script/.project
new file mode 100644
index 0000000000..4abe6eabcd
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/.project
@@ -0,0 +1,28 @@
+
+
+ com.raytheon.uf.edex.remote.script
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.edex.remote.script/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..8000cd6ca6
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.remote.script/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..2bc201a02f
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: RemoteScript
+Bundle-SymbolicName: com.raytheon.uf.edex.remote.script
+Bundle-Version: 1.14.0.qualifier
+Bundle-Vendor: RAYTHEON
+Require-Bundle: com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
+ com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
+ com.raytheon.uf.common.localization;bundle-version="1.12.1174",
+ com.raytheon.uf.common.remote.script;bundle-version="1.0.0",
+ com.raytheon.uf.common.status;bundle-version="1.12.1174",
+ com.raytheon.uf.edex.auth;bundle-version="1.12.1174",
+ com.raytheon.uf.common.auth;bundle-version="1.12.1174",
+ com.raytheon.uf.common.time;bundle-version="1.12.1174",
+ com.raytheon.uf.common.util;bundle-version="1.12.1174",
+ com.raytheon.uf.common.comm;bundle-version="1.12.1174"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Export-Package: com.raytheon.uf.edex.remote.script
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/build.properties b/edexOsgi/com.raytheon.uf.edex.remote.script/build.properties
new file mode 100644
index 0000000000..5791d48d5f
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ res/
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/res/spring/remotescript-request.xml b/edexOsgi/com.raytheon.uf.edex.remote.script/res/spring/remotescript-request.xml
new file mode 100644
index 0000000000..2f90605999
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/res/spring/remotescript-request.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/resources/com.raytheon.uf.edex.remote.script.properties b/edexOsgi/com.raytheon.uf.edex.remote.script/resources/com.raytheon.uf.edex.remote.script.properties
new file mode 100644
index 0000000000..6a0c8d853a
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/resources/com.raytheon.uf.edex.remote.script.properties
@@ -0,0 +1,21 @@
+# The values shown here are the default values in the RemoteScriptConstants class.
+# To change a property's default value for the EDEX server do the following:
+# 1 - Edit this file and uncomment the desired property line(s).
+# (remove the # at the start of the line.)
+# 2 - Change the property's value
+# 3 - Save the Changes
+# 4 - Restart EDEX request.
+
+# The localized directory that contains scripts.
+remote.script.directory=ncep/remoteScripts
+
+# Number of seconds to wait for script's process to complete before handler kills the process.
+# Note the value will be adjusted to be less then the HttpClient's socket timeout value.
+#remote.script.timeout=30
+
+# Default use of standard error. When true Separate the standard output and error streams;
+# otherwise combine them into standard out.
+#remote.script.use.stderr=false
+
+# Exit error to use when unable to run a script. Must be an integer.
+#remote.script.setup.error=99
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/AbstractRemoteScriptHandler.java b/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/AbstractRemoteScriptHandler.java
new file mode 100644
index 0000000000..30205f60e0
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/AbstractRemoteScriptHandler.java
@@ -0,0 +1,174 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.edex.remote.script;
+
+import com.raytheon.uf.common.auth.exception.AuthorizationException;
+import com.raytheon.uf.common.auth.user.IUser;
+import com.raytheon.uf.common.localization.IPathManager;
+import com.raytheon.uf.common.remote.script.RemoteScriptConstants;
+import com.raytheon.uf.common.remote.script.RemoteScriptRequest;
+import com.raytheon.uf.common.status.IUFStatusHandler;
+import com.raytheon.uf.common.status.UFStatus;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.time.util.ITimer;
+import com.raytheon.uf.common.time.util.TimeUtil;
+import com.raytheon.uf.common.util.FileUtil;
+import com.raytheon.uf.edex.auth.AuthManager;
+import com.raytheon.uf.edex.auth.AuthManagerFactory;
+import com.raytheon.uf.edex.auth.req.AbstractPrivilegedRequestHandler;
+import com.raytheon.uf.edex.auth.resp.AuthorizationResponse;
+import com.raytheon.uf.edex.auth.roles.IRoleStorage;
+
+/**
+ * Abstract class for the remote script handlers. Performs authorization and
+ * timing of requests.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 12, 2014 2742 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public abstract class AbstractRemoteScriptHandler extends
+ AbstractPrivilegedRequestHandler {
+
+ /** Status handler of the handling class using this class. */
+ protected final transient IUFStatusHandler statusHandler;
+
+ /** Common static directory for scripts. */
+ protected final String scriptsDirectory;
+
+ /** The handler's roleId defined in the common remoteScriptAdminRoles.xml */
+ protected final String roleId;
+
+ /**
+ * Application name. This must match the application tag in the user role
+ * file.
+ */
+ private static final String APPLICATION = "Remote Script";
+
+ /**
+ * Construct.
+ *
+ * @param statusHandler
+ */
+ public AbstractRemoteScriptHandler(String roleId) {
+ this.statusHandler = UFStatus.getHandler(this.getClass());
+ this.roleId = roleId;
+
+ String scriptsDirectory = FileUtil.edexPath(System.getProperty(
+ RemoteScriptConstants.scriptDirectoryKey,
+ RemoteScriptConstants.scriptDirectoryDefault));
+
+ // Strip tailing separators.
+ if (scriptsDirectory.endsWith(IPathManager.SEPARATOR)) {
+ StringBuilder sb = new StringBuilder(scriptsDirectory);
+ do {
+ sb.setLength(sb.length() - 1);
+ } while ((sb.length() > 0)
+ && (sb.lastIndexOf(IPathManager.SEPARATOR) == (sb.length() - 1)));
+ scriptsDirectory = sb.toString();
+ }
+ this.scriptsDirectory = scriptsDirectory;
+ }
+
+ /**
+ * The method a subclass must implement to perform the work for the desired
+ * request.
+ *
+ * @param request
+ * @return results
+ */
+ abstract protected Object performRequest(RemoteScriptRequest request);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
+ * (com.raytheon.uf.common.serialization.comm.IServerRequest)
+ */
+ @Override
+ public Object handleRequest(RemoteScriptRequest request) throws Exception {
+ Object result = null;
+
+ if (statusHandler.isPriorityEnabled(Priority.INFO)) {
+ statusHandler.handle(Priority.INFO, String.format(
+ "Start for %s, do %s", request.getUserId(), getRoleId()));
+ }
+
+ ITimer timer = TimeUtil.getTimer();
+ timer.start();
+ result = performRequest(request);
+ timer.stop();
+
+ if (statusHandler.isPriorityEnabled(Priority.INFO)) {
+ statusHandler.handle(
+ Priority.INFO,
+ String.format("Finish for %s, do %s, took %s",
+ request.getUserId(), getRoleId(),
+ TimeUtil.prettyDuration(timer.getElapsedTime())));
+ }
+
+ return result;
+ }
+
+ protected String getRoleId() {
+ return roleId;
+ }
+
+ /**
+ * Performs the authorization work for the handlers.
+ *
+ * @param user
+ * @param request
+ * @return authorizationResponse
+ * @throws AuthorizationException
+ */
+ public AuthorizationResponse authorized(IUser user,
+ RemoteScriptRequest request) throws AuthorizationException {
+ AuthManager manager = AuthManagerFactory.getInstance().getManager();
+ IRoleStorage roleStorage = manager.getRoleStorage();
+
+ String roleId = getRoleId();
+
+ boolean authorized = roleStorage.isAuthorized(roleId, user.uniqueId()
+ .toString(), APPLICATION);
+
+ if (authorized) {
+ return new AuthorizationResponse(authorized);
+ } else {
+ String message = "Not Authorized to run " + roleId;
+ if (statusHandler.isPriorityEnabled(Priority.INFO)) {
+ statusHandler.handle(Priority.INFO,
+ String.format("%s, %s", user.uniqueId(), message));
+ }
+ return new AuthorizationResponse(message);
+ }
+ }
+}
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/RemoteScriptListHandler.java b/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/RemoteScriptListHandler.java
new file mode 100644
index 0000000000..2c100e3b74
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/RemoteScriptListHandler.java
@@ -0,0 +1,103 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.edex.remote.script;
+
+import com.raytheon.uf.common.localization.IPathManager;
+import com.raytheon.uf.common.localization.LocalizationContext;
+import com.raytheon.uf.common.localization.LocalizationFile;
+import com.raytheon.uf.common.localization.PathManagerFactory;
+import com.raytheon.uf.common.remote.script.RemoteScriptListRequest;
+import com.raytheon.uf.common.remote.script.RemoteScriptListResponse;
+import com.raytheon.uf.common.remote.script.RemoteScriptRequest;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+
+/**
+ * Handler to get the remote script list.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 14, 2014 2742 rferrel Initial creation
+ * Exclude files with md5 checksum extension.
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public class RemoteScriptListHandler extends AbstractRemoteScriptHandler {
+
+ /** Extension for check sum files to remove from listing. */
+ private final String MD5_EXT = ".md5";
+
+ /**
+ * Constructor.
+ */
+ public RemoteScriptListHandler() {
+ // The role id in the common remoteScriptAdminRoles.xml
+ super("remote.script.list");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.edex.remote.script.RemoteScriptHandler#performRequest
+ * (com.raytheon.uf.common.remote.script.RemoteScriptRequest)
+ */
+ public Object performRequest(RemoteScriptRequest request) {
+ IPathManager pm = PathManagerFactory.getPathManager();
+ RemoteScriptListRequest req = (RemoteScriptListRequest) request;
+
+ if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
+ statusHandler.handle(Priority.DEBUG,
+ String.format("Request: %s", req));
+ }
+
+ LocalizationContext[] ctxs = req.getContexts();
+
+ RemoteScriptListResponse result = new RemoteScriptListResponse();
+
+ for (LocalizationContext ctx : ctxs) {
+ LocalizationFile[] lFiles = pm.listFiles(ctx, scriptsDirectory,
+ null, false, true);
+ if ((lFiles != null) && (lFiles.length > 0)) {
+ for (LocalizationFile lFile : lFiles) {
+ if (!lFile.getName().trim().endsWith(MD5_EXT)) {
+ result.add(lFile);
+ System.out.println(lFile.getFile().getAbsolutePath());
+ }
+ }
+ }
+ }
+
+ if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
+ statusHandler.handle(Priority.DEBUG,
+ String.format("Results: %s", result));
+ }
+
+ return result;
+ }
+
+}
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/RemoteScriptRunHandler.java b/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/RemoteScriptRunHandler.java
new file mode 100644
index 0000000000..390b28c7d0
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/src/com/raytheon/uf/edex/remote/script/RemoteScriptRunHandler.java
@@ -0,0 +1,303 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.edex.remote.script;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.raytheon.uf.common.comm.HttpClient;
+import com.raytheon.uf.common.localization.IPathManager;
+import com.raytheon.uf.common.localization.LocalizationContext;
+import com.raytheon.uf.common.localization.LocalizationFile;
+import com.raytheon.uf.common.localization.PathManagerFactory;
+import com.raytheon.uf.common.remote.script.RemoteScriptConstants;
+import com.raytheon.uf.common.remote.script.RemoteScriptRequest;
+import com.raytheon.uf.common.remote.script.RemoteScriptRunRequest;
+import com.raytheon.uf.common.remote.script.RemoteScriptRunResponse;
+import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.time.util.TimeUtil;
+import com.raytheon.uf.common.util.RunProcess;
+
+/**
+ * Handler to Run a remote script and return the results.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 19, 2014 2743 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public class RemoteScriptRunHandler extends AbstractRemoteScriptHandler {
+
+ /**
+ * Time to back off from socket time out to allow completion of a timeout
+ * script.
+ */
+ private static final int BACKOFF_MSEC = 100;
+
+ /**
+ * Resource timeout.
+ */
+ private final int defaultTimeoutSec;
+
+ /**
+ * Resource flag value.
+ */
+ private final boolean defaultUseStdErrFlag;
+
+ /**
+ * Resource set up exit status.
+ */
+ private final int defaultSetupExit;
+
+ /**
+ * Constructor setup roleId and resource property values.
+ */
+ public RemoteScriptRunHandler() {
+ // The role id in the common remoteScriptAdminRoles.xml
+ super("remote.script.run");
+
+ // Set up default values.
+ String defaultTimeoutStr = System.getProperty(
+ RemoteScriptConstants.scriptTimeoutKey,
+ RemoteScriptConstants.scriptTimeoutDefault);
+ int defaultTimeoutSec = -1;
+ try {
+ defaultTimeoutSec = Integer.parseInt(defaultTimeoutStr);
+ } catch (NumberFormatException ex) {
+ defaultTimeoutSec = -1;
+ } finally {
+ if (defaultTimeoutSec <= 0) {
+ defaultTimeoutSec = Integer
+ .parseInt(RemoteScriptConstants.scriptTimeoutDefault);
+ }
+ this.defaultTimeoutSec = defaultTimeoutSec;
+ }
+
+ String defaultUseStdErr = System.getProperty(
+ RemoteScriptConstants.scriptUseStdErrKey,
+ RemoteScriptConstants.scriptUseStdErrDefault);
+ this.defaultUseStdErrFlag = Boolean.parseBoolean(defaultUseStdErr);
+
+ String defaultSetupErrorStr = System.getProperty(
+ RemoteScriptConstants.scriptSetupErrrorKey,
+ RemoteScriptConstants.scriptUseStdErrDefault);
+ int defaultSetupExit = 0;
+ try {
+ defaultSetupExit = Integer.parseInt(defaultSetupErrorStr);
+
+ } catch (NumberFormatException ex) {
+ defaultSetupExit = 0;
+ } finally {
+ if (defaultSetupExit <= 0) {
+ defaultSetupExit = Integer
+ .parseInt(RemoteScriptConstants.scriptSetUpErrorDefault);
+ }
+ this.defaultSetupExit = defaultSetupExit;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
+ * (com.raytheon.uf.common.serialization.comm.IServerRequest)
+ */
+ @Override
+ public Object handleRequest(RemoteScriptRequest request) throws Exception {
+ return super.handleRequest(request);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.edex.remote.script.RemoteScriptHandler#performRequest
+ * (com.raytheon.uf.common.remote.script.RemoteScriptRequest)
+ */
+ public Object performRequest(RemoteScriptRequest request) {
+ RemoteScriptRunRequest req = (RemoteScriptRunRequest) request;
+ RemoteScriptRunResponse result = new RemoteScriptRunResponse();
+
+ Map propMap = req.getPropertyMap();
+
+ String timeoutValue = propMap
+ .get(RemoteScriptConstants.scriptTimeoutKey);
+ int timeoutSec = -1;
+ if (timeoutValue == null) {
+ timeoutSec = defaultTimeoutSec;
+ } else {
+ try {
+ timeoutSec = Integer.parseInt(timeoutValue);
+ if (timeoutSec <= 0) {
+ timeoutSec = defaultTimeoutSec;
+ }
+ } catch (NumberFormatException ex) {
+ statusHandler.handle(Priority.PROBLEM,
+ String.format("Bad timeout value %s", timeoutValue));
+ timeoutSec = defaultTimeoutSec;
+ } finally {
+ if (timeoutSec <= 0) {
+ timeoutSec = defaultTimeoutSec;
+ }
+ }
+ }
+
+ long timeout = timeoutSec * TimeUtil.MILLIS_PER_SECOND;
+
+ String useStdErrString = propMap
+ .get(RemoteScriptConstants.scriptUseStdErrKey);
+
+ boolean useStdErr = defaultUseStdErrFlag;
+ if (useStdErrString != null) {
+ useStdErr = Boolean.parseBoolean(useStdErrString);
+ }
+
+ String setupExitValue = propMap
+ .get(RemoteScriptConstants.scriptSetupErrrorKey);
+ int setupExit = -1;
+
+ if (setupExitValue == null) {
+ setupExit = defaultSetupExit;
+ } else {
+
+ try {
+ setupExit = Integer.parseInt(setupExitValue);
+ } catch (NumberFormatException ex) {
+ statusHandler.handle(Priority.PROBLEM, String.format(
+ "Bad setup Error exit value %s", setupExitValue));
+ setupExit = defaultSetupExit;
+ } finally {
+ if (setupExit <= 0) {
+ setupExit = defaultSetupExit;
+ }
+ }
+ }
+
+ List arguments = req.getScriptArguments();
+ String script = req.getScript();
+ LocalizationContext context = req.getContext();
+
+ IPathManager pm = PathManagerFactory.getPathManager();
+ String name = scriptsDirectory + IPathManager.SEPARATOR + script;
+ LocalizationFile lFile = pm.getLocalizationFile(context, name);
+ File file = lFile.getFile();
+ File dir = file.getParentFile();
+
+ if (!file.canExecute()) {
+ String message = String.format("Not an executable script: \"%s\".",
+ lFile);
+ return sendMessage(result, message, useStdErr, setupExit);
+ }
+
+ int maxTimeout = HttpClient.getInstance().getSocketTimeout()
+ - BACKOFF_MSEC;
+ if (maxTimeout <= 0) {
+ String message = String
+ .format("HttpClient's socket timeout of %d msec not enough time to run a remote script.",
+ HttpClient.getInstance().getSocketTimeout());
+ return sendMessage(result, message, useStdErr, setupExit);
+ } else if (timeout > maxTimeout) {
+ timeout = maxTimeout;
+ }
+
+ List args = new ArrayList();
+ args.add(file.getAbsolutePath());
+ if (arguments != null && (arguments.size() > 0)) {
+ args.addAll(arguments);
+ }
+
+ ProcessBuilder pb = new ProcessBuilder(args);
+ pb.redirectErrorStream(!useStdErr);
+ pb.directory(dir);
+ Process p = null;
+ RunProcess rp = RunProcess.getRunProcess();
+ String errorMessage = null;
+
+ // TODO - The timeout/destroy should be placed in RunProcess along with
+ // limiting the size of stdout/stderr.
+ try {
+ p = pb.start();
+ rp.setProcess(p);
+ synchronized (rp) {
+ rp.wait(timeout);
+ if (!rp.isExecComplete()) {
+ p.destroy();
+ result.setTimedOut(true);
+ rp.notify();
+ errorMessage = "Script timed out.";
+ }
+ }
+ } catch (Exception ex) {
+ errorMessage = "Problem running script: "
+ + ex.getLocalizedMessage().trim();
+ statusHandler.handle(Priority.PROBLEM, errorMessage, ex);
+
+ } finally {
+ if (p != null) {
+ result.setOutput(rp.getStdout());
+ result.setError(rp.getStderr());
+ }
+ result.setExitStatus(rp.waitFor());
+ if (errorMessage != null) {
+ if (useStdErr) {
+ result.setError(result.getError() + "\n" + errorMessage);
+ } else {
+ result.setOutput(result.getOutput() + "\n" + errorMessage);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Report a problem in running the script.
+ *
+ * @param result
+ * @param message
+ * @param useStdErr
+ * @param setupExit
+ * @return result
+ */
+ private RemoteScriptRunResponse sendMessage(RemoteScriptRunResponse result,
+ String message, boolean useStdErr, int setupExit) {
+ statusHandler.handle(Priority.PROBLEM, message);
+
+ if (useStdErr) {
+ result.setError(message);
+ } else {
+ result.setOutput(message);
+ }
+
+ result.setExitStatus(setupExit);
+ return result;
+ }
+}
diff --git a/edexOsgi/com.raytheon.uf.edex.remote.script/utility/common_static/base/roles/remoteScriptAdminRoles.xml b/edexOsgi/com.raytheon.uf.edex.remote.script/utility/common_static/base/roles/remoteScriptAdminRoles.xml
new file mode 100644
index 0000000000..acecfb9c98
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.remote.script/utility/common_static/base/roles/remoteScriptAdminRoles.xml
@@ -0,0 +1,20 @@
+
+
+ Remote Script
+
+
+
+ This permission allows the user to retrive a listing of remote scripts.
+
+
+
+
+
+ This permission allows the user to execute a remote script.
+
+
+
+ remote.script.list
+ remote.script.run
+
+
\ No newline at end of file
diff --git a/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/remoteScripts/baseScript-1 b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/remoteScripts/baseScript-1
new file mode 100755
index 0000000000..e69de29bb2
diff --git a/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/remoteScripts/test_script b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/remoteScripts/test_script
new file mode 100755
index 0000000000..918423117c
--- /dev/null
+++ b/ncep/gov.noaa.nws.ncep.edex.common/utility/common_static/base/ncep/remoteScripts/test_script
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+usage(){
+ cat <: number of seconds to sleep.
+ --help print out usage
+
+EOF
+ exit
+}
+
+if [ $# -lt 1 ]; then
+ usage
+fi
+
+if [ "$1" == "--help" ]; then
+ usage
+else
+ sleep $1
+ if [ "$?" == 0 ]; then
+ echo Sleeping...$1 seconds...Done!
+ exit 0
+ else
+ exit -1
+ fi
+fi
\ No newline at end of file
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.ui.nsharp/META-INF/MANIFEST.MF
index 3693e3d7cd..c310149a30 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/META-INF/MANIFEST.MF
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/META-INF/MANIFEST.MF
@@ -35,6 +35,9 @@ Import-Package: com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.viz.d2d.ui.perspectives,
com.raytheon.uf.viz.sounding,
com.vividsolutions.jts.geom,
+ gov.noaa.nws.ncep.common.dataplugin.gpd,
+ gov.noaa.nws.ncep.common.dataplugin.gpd.product,
+ gov.noaa.nws.ncep.common.dataplugin.gpd.query,
gov.noaa.nws.ncep.common.dataplugin.ncuair,
gov.noaa.nws.ncep.edex.common.ncinventory,
gov.noaa.nws.ncep.edex.common.sounding,
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpConstants.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpConstants.java
index 9e49061ee0..7a790590c7 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpConstants.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpConstants.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp;
+
/**
*
* gov.noaa.nws.ncep.ui.nsharp.NsharpConstants
@@ -9,9 +10,9 @@ package gov.noaa.nws.ncep.ui.nsharp;
*
* SOFTWARE HISTORY
*
- * Date Ticket# Engineer Description
- * ------- ------- -------- -----------
- * 05/23/2010 229 Chin Chen Initial coding
+ * Date Ticket# Engineer Description
+ * ------- ------- -------- -----------
+ * 05/23/2010 229 Chin Chen Initial coding
*
*
*
@@ -35,71 +36,100 @@ import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
public class NsharpConstants {
- public static Rectangle NSHARP_SkewTRectangle = new Rectangle(0, 0, 3200, 1850);
+ public static Rectangle NSHARP_SkewTRectangle = new Rectangle(0, 0, 3200,
+ 1850);
+
public static Rectangle NSHARP_HodoRectangle = new Rectangle(0, 0, 100, 100);
- public static final int DEFAULT_CANVAS_HEIGHT=700;
- public static final int DEFAULT_CANVAS_WIDTH=1100;
- //public static double TEMPERATURE_MIN = -115.0;
- public static float KnotsToMetersPerSecond = 0.5144444F;
+
+ public static final int DEFAULT_CANVAS_HEIGHT = 700;
+
+ public static final int DEFAULT_CANVAS_WIDTH = 1100;
+
+ // public static double TEMPERATURE_MIN = -115.0;
+ public static float KnotsToMetersPerSecond = 0.5144444F;
+
public static final UnitConverter kelvinToCelsius = SI.KELVIN
- .getConverterTo(SI.CELSIUS);
+ .getConverterTo(SI.CELSIUS);
+
public static final UnitConverter metersToFeet = SI.METER
- .getConverterTo(NonSI.FOOT);
+ .getConverterTo(NonSI.FOOT);
public static final UnitConverter feetToMeters = NonSI.FOOT
- .getConverterTo(SI.METRE);
+ .getConverterTo(SI.METRE);
- //public static double WIND_SPEED_MIN = 0.0;
+ // public static double WIND_SPEED_MIN = 0.0;
- //public static double WIND_SPEED_MAX = 250.0;
+ // public static double WIND_SPEED_MAX = 250.0;
- // public static double WIND_DIR_MIN = 0.0;
+ // public static double WIND_DIR_MIN = 0.0;
+
+ // public static double WIND_DIR_MAX = 360.0;
+
+ public static final int WINDBARB_DISTANCE_DEFAULT = 600; // in meters
- //public static double WIND_DIR_MAX = 360.0;
-
- public static final int WINDBARB_DISTANCE_DEFAULT= 600; // in meters
public static final float WINDBARB_WIDTH = 2;
+
public static final float WINDBARB_SIZE = 2.5f;
public static double PRESSURE_MIN = 100.0;
public static double PRESSURE_MAX = 973.0;
-
- public static final double MAX_PRESSURE = 1050;
- public static final double MIN_PRESSURE = 100;
- // horizontal pressure line that will be drawn.
- public static final Integer[] PRESSURE_MAIN_LEVELS = { 1000, 850,
- 700, 500, 300, 200,150};
- public static final int[] PRESSURE_MARK_LEVELS = { 1000, 950, 900, 850, 800,
- 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150
- };
- public static final int[] PRESSURE_NUMBERING_LEVELS = { 1000, 850,
- 700, 500, 300, 200, 150 };
- //Icing pressure level 1000, 900,800,700,600, 500,400, 300
+ public static final double MAX_PRESSURE = 1050;
+
+ public static final double MIN_PRESSURE = 100;
+
+ // horizontal pressure line that will be drawn.
+ public static final Integer[] PRESSURE_MAIN_LEVELS = { 1000, 850, 700, 500,
+ 300, 200, 150 };
+
+ public static final int[] PRESSURE_MARK_LEVELS = { 1000, 950, 900, 850,
+ 800, 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200,
+ 150 };
+
+ public static final int[] PRESSURE_NUMBERING_LEVELS = { 1000, 850, 700,
+ 500, 300, 200, 150 };
+
+ // Icing pressure level 1000, 900,800,700,600, 500,400, 300
public static final double ICING_PRESSURE_LEVEL_BOTTOM = 1000;
+
public static final double ICING_PRESSURE_LEVEL_TOP = 300;
+
public static final double ICING_PRESSURE_LEVEL_INC = 100;
- //Icing relative humidity 100, 90,80,70,60, 50,40, 30,20,10,0
+
+ // Icing relative humidity 100, 90,80,70,60, 50,40, 30,20,10,0
public static final double ICING_RELATIVE_HUMIDITY_LEFT = 0;
+
public static final double ICING_RELATIVE_HUMIDITY_RIGHT = 100;
+
public static final double ICING_RELATIVE_HUMIDITY_INC = 10;
- //Icing temperature (C) 25,20,15,10,5,0,-5,-10, -15,-20,-25
+
+ // Icing temperature (C) 25,20,15,10,5,0,-5,-10, -15,-20,-25
public static final double ICING_TEMPERATURE_RIGHT = 25;
+
public static final double ICING_TEMPERATURE_LEFT = -25;
+
public static final double ICING_TEMPERATURE_INC = 5;
- //Turbulence pressure level 1000, 900,800,700,600, 500,400, 300, 200, 100
- public static final double TURBULENCE_PRESSURE_LEVEL_TOP =100;
- public static final double TURBULENCE_PRESSURE_LEVEL_BOTTOM =1000;
- public static final double TURBULENCE_PRESSURE_LEVEL_INC =100;
- //Turbulence LN Richardson Number -2,-1, 0, 1,2,3,4,5,6,7,8
- public static final double TURBULENCE_LN_RICHARDSON_NUMBER_LEFT =8;
- public static final double TURBULENCE_LN_RICHARDSON_NUMBER_RIGHT =-2;
- public static final double TURBULENCE_LN_RICHARDSON_NUMBER_INC =-1;
- //Turbulence wind shear TKE 50,45,40,35,30,25,20,15,10,5,0
+ // Turbulence pressure level 1000, 900,800,700,600, 500,400, 300, 200, 100
+ public static final double TURBULENCE_PRESSURE_LEVEL_TOP = 100;
+
+ public static final double TURBULENCE_PRESSURE_LEVEL_BOTTOM = 1000;
+
+ public static final double TURBULENCE_PRESSURE_LEVEL_INC = 100;
+
+ // Turbulence LN Richardson Number -2,-1, 0, 1,2,3,4,5,6,7,8
+ public static final double TURBULENCE_LN_RICHARDSON_NUMBER_LEFT = 8;
+
+ public static final double TURBULENCE_LN_RICHARDSON_NUMBER_RIGHT = -2;
+
+ public static final double TURBULENCE_LN_RICHARDSON_NUMBER_INC = -1;
+
+ // Turbulence wind shear TKE 50,45,40,35,30,25,20,15,10,5,0
public static final double TURBULENCE_WIND_SHEAR_TKE_LEFT = 0;
+
public static final double TURBULENCE_WIND_SHEAR_TKE_RIGHT = 50;
+
public static final double TURBULENCE_WIND_SHEAR_TKE_INC = 5;
// lightGray.
@@ -109,12 +139,13 @@ public class NsharpConstants {
* Color for moist adiabat lines
*/
public static final RGB moistAdiabatColor = new RGB(0, 127, 255);
- public static final RGB degreeSpokeColor = new RGB(238,238,238);
+
+ public static final RGB degreeSpokeColor = new RGB(238, 238, 238);
/**
* Color for dry adiabat lines
*/
- public static final RGB dryAdiabatColor = new RGB(70,130,180);
+ public static final RGB dryAdiabatColor = new RGB(70, 130, 180);
/**
* Color for mixing ratio lines
@@ -124,7 +155,7 @@ public class NsharpConstants {
/**
* Color for temperature lines
*/
- public static final RGB temperatureColor = new RGB(0,102,255);
+ public static final RGB temperatureColor = new RGB(0, 102, 255);
/**
* Color for pressure lines
@@ -165,8 +196,11 @@ public class NsharpConstants {
public static DecimalFormat windFormat = new DecimalFormat("###.#");
public static char DEGREE_SYMBOL = '\u00B0';
+
public static char SQUARE_SYMBOL = '\u00B2';
+
public static char THETA_SYMBOL = '\u03D1';
+
public static char PERCENT_SYMBOL = '\u0025';
public static double endpointRadius = 4;
@@ -179,638 +213,1151 @@ public class NsharpConstants {
public static double height = top - bottom;
- public static double left = -height*0.45;//(-height / 2) - 1;
+ public static double left = -height * 0.45;// (-height / 2) - 1;
- public static double right = height*0.55;//(height / 2) + 1;
+ public static double right = height * 0.55;// (height / 2) + 1;
public static double center = (left + right) / 2;
- public static RGB color_vanilla = new RGB(255,239,206);
- public static RGB color_red = new RGB(255,0,0);//red
- public static RGB color_green = new RGB(0,255,0);//green
- public static RGB color_darkgreen = new RGB(0x2f,0x4f,0x2f);//green
- public static RGB color_mdgreen = new RGB(0x34,0x80,0x17);//green
- public static RGB color_coral = new RGB(0xf0,0x80,0x80);
- public static RGB color_lawngreen = new RGB(119,255,0);//green
- public static RGB color_yellow_green = new RGB(154,205,50);//green
- public static RGB color_yellow = new RGB(255,255,0);//yellow
- public static RGB color_yellow_DK = new RGB(238,238,0);//yellow
- public static RGB color_cyan = new RGB(0,255,255); //cyan
- public static RGB color_cyan_md = new RGB(0,238,238); //cyan_md, cyan2
- public static RGB color_navy = new RGB(0,0,128); //navy
- public static RGB color_apricot = new RGB(251,206,177);
- public static RGB color_plum = new RGB(0xB9,0x3B,0x8F);
- public static RGB color_purple = new RGB(0x8E,0x35,0xEF);
- public static RGB color_violet = new RGB(125,0,255);//violet
- public static RGB color_violet_red = new RGB(208,32,144);//violet
- public static RGB color_violet_md = new RGB(208,32,144);//md-violet
- public static RGB color_white = new RGB(255,255,255);//white
- public static RGB color_brown = new RGB(166,104,41);//brown
- public static RGB color_black = new RGB(0,0,0);//black
- public static RGB color_orangered = new RGB(255,0x45, 0);//orangered
- public static RGB color_orange = new RGB(255,122, 66);//orange
- public static RGB color_darkorange = new RGB(255,140, 0);//orange
- public static RGB color_babypink = new RGB(249,207, 221);//
- public static RGB color_deeppink = new RGB(255,20, 147);//
- public static RGB color_hotpink = new RGB(255,105, 180);//
- public static RGB color_pink = new RGB(255, 192, 203);
- public static RGB color_blue = new RGB(0,0,255);
- public static RGB color_stellblue = new RGB(70,130,180);
- public static RGB color_royalblue = new RGB(65,105,225);
- public static RGB color_skyblue = new RGB(135,206,235);
- public static RGB color_lightblue = new RGB(173, 223,255);
- public static RGB color_dodgerblue = new RGB(30,144,255);
- public static RGB color_chocolate = new RGB(210,105,30);
- public static RGB color_firebrick = new RGB(178,34,34);
- public static RGB color_gold = new RGB(255,215,0);
- public static RGB color_magenta = new RGB(255,0,255);
- public static RGB color_maroon = new RGB(0x80,0,0);
- public static final RGB[] COLOR_ARRAY = {color_green, color_violet,color_yellow,color_hotpink,
- color_stellblue,color_yellow_green,color_royalblue,color_violet_red,color_orange,color_deeppink,
- color_dodgerblue, color_chocolate,color_navy};
-
- public static final HashMap gempakColorToRGB = new HashMap(){
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- {
- put(1,NsharpConstants.color_vanilla);
- put(2,NsharpConstants.color_red);
- put(3,NsharpConstants.color_green);
- put(4,NsharpConstants.color_blue);
- put(5,NsharpConstants.color_yellow);
- put(6,NsharpConstants.color_cyan);
- put(7,NsharpConstants.color_magenta);
- put(8,NsharpConstants.color_brown);
- put(9,NsharpConstants.color_coral);
- put(10,NsharpConstants.color_apricot);
- put(11,NsharpConstants.color_pink);
- put(12,NsharpConstants.color_deeppink);
- put(13,NsharpConstants.color_violet_md);
- put(14,NsharpConstants.color_maroon);
- put(15,NsharpConstants.color_firebrick);
- put(16,NsharpConstants.color_orangered);
- put(17,NsharpConstants.color_orange);
- put(18,NsharpConstants.color_darkorange);
- put(19,NsharpConstants.color_gold);
- put(20,NsharpConstants.color_yellow_DK);
- put(21,NsharpConstants.color_lawngreen);
- put(22,NsharpConstants.color_mdgreen);
- put(23,NsharpConstants.color_darkgreen);
- put(24,NsharpConstants.color_blue);
- put(25,NsharpConstants.color_lightblue);
- put(26,NsharpConstants.color_skyblue);
- put(27,NsharpConstants.color_cyan_md);
- put(28,NsharpConstants.color_violet);
- put(29,NsharpConstants.color_purple);
- put(30,NsharpConstants.color_plum);
- put(31,NsharpConstants.color_white);
- put(32,NsharpConstants.color_black);
- }
- };
+ public static RGB color_vanilla = new RGB(255, 239, 206);
+
+ public static RGB color_red = new RGB(255, 0, 0);// red
+
+ public static RGB color_green = new RGB(0, 255, 0);// green
+
+ public static RGB color_darkgreen = new RGB(0x2f, 0x4f, 0x2f);// green
+
+ public static RGB color_mdgreen = new RGB(0x34, 0x80, 0x17);// green
+
+ public static RGB color_coral = new RGB(0xf0, 0x80, 0x80);
+
+ public static RGB color_lawngreen = new RGB(119, 255, 0);// green
+
+ public static RGB color_yellow_green = new RGB(154, 205, 50);// green
+
+ public static RGB color_yellow = new RGB(255, 255, 0);// yellow
+
+ public static RGB color_yellow_DK = new RGB(238, 238, 0);// yellow
+
+ public static RGB color_cyan = new RGB(0, 255, 255); // cyan
+
+ public static RGB color_cyan_md = new RGB(0, 238, 238); // cyan_md, cyan2
+
+ public static RGB color_navy = new RGB(0, 0, 128); // navy
+
+ public static RGB color_apricot = new RGB(251, 206, 177);
+
+ public static RGB color_plum = new RGB(0xB9, 0x3B, 0x8F);
+
+ public static RGB color_purple = new RGB(0x8E, 0x35, 0xEF);
+
+ public static RGB color_violet = new RGB(125, 0, 255);// violet
+
+ public static RGB color_violet_red = new RGB(208, 32, 144);// violet
+
+ public static RGB color_violet_md = new RGB(208, 32, 144);// md-violet
+
+ public static RGB color_white = new RGB(255, 255, 255);// white
+
+ public static RGB color_brown = new RGB(166, 104, 41);// brown
+
+ public static RGB color_black = new RGB(0, 0, 0);// black
+
+ public static RGB color_orangered = new RGB(255, 0x45, 0);// orangered
+
+ public static RGB color_orange = new RGB(255, 122, 66);// orange
+
+ public static RGB color_darkorange = new RGB(255, 140, 0);// orange
+
+ public static RGB color_babypink = new RGB(249, 207, 221);//
+
+ public static RGB color_deeppink = new RGB(255, 20, 147);//
+
+ public static RGB color_hotpink = new RGB(255, 105, 180);//
+
+ public static RGB color_pink = new RGB(255, 192, 203);
+
+ public static RGB color_blue = new RGB(0, 0, 255);
+
+ public static RGB color_stellblue = new RGB(70, 130, 180);
+
+ public static RGB color_royalblue = new RGB(65, 105, 225);
+
+ public static RGB color_skyblue = new RGB(135, 206, 235);
+
+ public static RGB color_lightblue = new RGB(173, 223, 255);
+
+ public static RGB color_dodgerblue = new RGB(30, 144, 255);
+
+ public static RGB color_chocolate = new RGB(210, 105, 30);
+
+ public static RGB color_firebrick = new RGB(178, 34, 34);
+
+ public static RGB color_gold = new RGB(255, 215, 0);
+
+ public static RGB color_magenta = new RGB(255, 0, 255);
+
+ public static RGB color_maroon = new RGB(0x80, 0, 0);
+
+ public static final RGB[] COLOR_ARRAY = { color_green, color_violet,
+ color_yellow, color_hotpink, color_stellblue, color_yellow_green,
+ color_royalblue, color_violet_red, color_orange, color_deeppink,
+ color_dodgerblue, color_chocolate, color_navy };
+
+ public static final HashMap gempakColorToRGB = new HashMap() {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ {
+ put(1, NsharpConstants.color_vanilla);
+ put(2, NsharpConstants.color_red);
+ put(3, NsharpConstants.color_green);
+ put(4, NsharpConstants.color_blue);
+ put(5, NsharpConstants.color_yellow);
+ put(6, NsharpConstants.color_cyan);
+ put(7, NsharpConstants.color_magenta);
+ put(8, NsharpConstants.color_brown);
+ put(9, NsharpConstants.color_coral);
+ put(10, NsharpConstants.color_apricot);
+ put(11, NsharpConstants.color_pink);
+ put(12, NsharpConstants.color_deeppink);
+ put(13, NsharpConstants.color_violet_md);
+ put(14, NsharpConstants.color_maroon);
+ put(15, NsharpConstants.color_firebrick);
+ put(16, NsharpConstants.color_orangered);
+ put(17, NsharpConstants.color_orange);
+ put(18, NsharpConstants.color_darkorange);
+ put(19, NsharpConstants.color_gold);
+ put(20, NsharpConstants.color_yellow_DK);
+ put(21, NsharpConstants.color_lawngreen);
+ put(22, NsharpConstants.color_mdgreen);
+ put(23, NsharpConstants.color_darkgreen);
+ put(24, NsharpConstants.color_blue);
+ put(25, NsharpConstants.color_lightblue);
+ put(26, NsharpConstants.color_skyblue);
+ put(27, NsharpConstants.color_cyan_md);
+ put(28, NsharpConstants.color_violet);
+ put(29, NsharpConstants.color_purple);
+ put(30, NsharpConstants.color_plum);
+ put(31, NsharpConstants.color_white);
+ put(32, NsharpConstants.color_black);
+ }
+ };
+
// horizontal height line that will be drawn.
- public static final int[] HEIGHT_LEVEL_METERS = {/*16000,*/ 15000, 12000, 9000, 6000, 3000, 2000 };
- public static final int[] HEIGHT_LEVEL_FEET = {50000, 45000, 40000, 35000, 30000, 25000, 20000, 15000, 10000, 5000, 2500 };
+ public static final int[] HEIGHT_LEVEL_METERS = {/* 16000, */15000, 12000,
+ 9000, 6000, 3000, 2000 };
+
+ public static final int[] HEIGHT_LEVEL_FEET = { 50000, 45000, 40000, 35000,
+ 30000, 25000, 20000, 15000, 10000, 5000, 2500 };
/***
- * Chin: this implementation will be obsoleted when D2D changes its D2D Nsharp implementation to use
- * multiple panes design.
- * SINGLE PANE IMPLEMENTATIONS start
- * Obsoleting implementation
+ * Chin: this implementation will be obsoleted when D2D changes its D2D
+ * Nsharp implementation to use multiple panes design. SINGLE PANE
+ * IMPLEMENTATIONS start Obsoleting implementation
*
****/
public static final int OMEGA_X_TOP = -40;
- public static final int OMEGA_Y_TOP = 200;//225;
- public static final int SKEWT_REC_X_ORIG = OMEGA_X_TOP + 160;
- public static final int SKEWT_REC_Y_ORIG = OMEGA_Y_TOP-75;
+
+ public static final int OMEGA_Y_TOP = 200;// 225;
+
+ public static final int SKEWT_REC_X_ORIG = OMEGA_X_TOP + 160;
+
+ public static final int SKEWT_REC_Y_ORIG = OMEGA_Y_TOP - 75;
+
public static final int SKEWT_REC_WIDTH = 1000;
+
public static final int SKEWT_REC_HEIGHT = 1002;
- public static final int SKEWT_VIEW_X_END = SKEWT_REC_X_ORIG + SKEWT_REC_WIDTH;
- public static final int SKEWT_VIEW_Y_END = SKEWT_REC_Y_ORIG + SKEWT_REC_HEIGHT;
- public static final int OMEGA_Y_BOT = SKEWT_VIEW_Y_END-15;
- public static final int ICING_REC_X_ORIG =SKEWT_REC_X_ORIG;
+
+ public static final int SKEWT_VIEW_X_END = SKEWT_REC_X_ORIG
+ + SKEWT_REC_WIDTH;
+
+ public static final int SKEWT_VIEW_Y_END = SKEWT_REC_Y_ORIG
+ + SKEWT_REC_HEIGHT;
+
+ public static final int OMEGA_Y_BOT = SKEWT_VIEW_Y_END - 15;
+
+ public static final int ICING_REC_X_ORIG = SKEWT_REC_X_ORIG;
+
public static final int ICING_REC_Y_ORIG = SKEWT_REC_Y_ORIG;
+
public static final int ICING_REC_WIDTH = SKEWT_REC_WIDTH;
- public static final int ICING_REC_HEIGHT = SKEWT_REC_HEIGHT-50;
- public static final int ICING_VIEW_X_END = ICING_REC_X_ORIG + ICING_REC_WIDTH;
- public static final int ICING_VIEW_Y_END = ICING_REC_Y_ORIG + ICING_REC_HEIGHT;
- public static final int TURB_REC_X_ORIG =SKEWT_REC_X_ORIG;
- public static final int TURB_REC_Y_ORIG = SKEWT_REC_Y_ORIG ;
+
+ public static final int ICING_REC_HEIGHT = SKEWT_REC_HEIGHT - 50;
+
+ public static final int ICING_VIEW_X_END = ICING_REC_X_ORIG
+ + ICING_REC_WIDTH;
+
+ public static final int ICING_VIEW_Y_END = ICING_REC_Y_ORIG
+ + ICING_REC_HEIGHT;
+
+ public static final int TURB_REC_X_ORIG = SKEWT_REC_X_ORIG;
+
+ public static final int TURB_REC_Y_ORIG = SKEWT_REC_Y_ORIG;
+
public static final int TURB_REC_WIDTH = SKEWT_REC_WIDTH;
- public static final int TURB_REC_HEIGHT = SKEWT_REC_HEIGHT -50;
+
+ public static final int TURB_REC_HEIGHT = SKEWT_REC_HEIGHT - 50;
+
public static final int TURB_VIEW_X_END = TURB_REC_X_ORIG + TURB_REC_WIDTH;
+
public static final int TURB_VIEW_Y_END = TURB_REC_Y_ORIG + TURB_REC_HEIGHT;
+
public static final int DATAPANEL_REC_WIDTH = 750;
+
public static final int DATAPANEL_REC_HEIGHT = 630;
- public static final int INSET_REC_WIDTH = DATAPANEL_REC_WIDTH/2;//250;//300;
- public static final int INSET_REC_HEIGHT = DATAPANEL_REC_HEIGHT/2;//SKEWT_REC_HEIGHT/3;;
+
+ public static final int INSET_REC_WIDTH = DATAPANEL_REC_WIDTH / 2;// 250;//300;
+
+ public static final int INSET_REC_HEIGHT = DATAPANEL_REC_HEIGHT / 2;// SKEWT_REC_HEIGHT/3;;
+
public static final int WIND_BOX_WIDTH = 175;
+
public static final int WIND_BOX_HEIGHT = SKEWT_REC_HEIGHT;
- public static final int WIND_BOX_X_ORIG = SKEWT_REC_X_ORIG+SKEWT_REC_WIDTH;
+
+ public static final int WIND_BOX_X_ORIG = SKEWT_REC_X_ORIG
+ + SKEWT_REC_WIDTH;
+
public static final int WIND_BOX_Y_ORIG = SKEWT_REC_Y_ORIG;
-
+
public static final int VERTICAL_WIND_WIDTH = 175;
+
public static final int VERTICAL_WIND_HEIGHT = SKEWT_REC_HEIGHT;
- public static final int VERTICAL_WIND_X_ORIG = WIND_BOX_X_ORIG+ WIND_BOX_WIDTH;
+
+ public static final int VERTICAL_WIND_X_ORIG = WIND_BOX_X_ORIG
+ + WIND_BOX_WIDTH;
+
public static final int VERTICAL_WIND_Y_ORIG = SKEWT_REC_Y_ORIG;
-
- public static final int HODO_REC_X_ORIG = VERTICAL_WIND_X_ORIG + VERTICAL_WIND_WIDTH;
+
+ public static final int HODO_REC_X_ORIG = VERTICAL_WIND_X_ORIG
+ + VERTICAL_WIND_WIDTH;
+
public static final int HODO_REC_Y_ORIG = SKEWT_REC_Y_ORIG;
- public static final int HODO_REC_WIDTH = SKEWT_REC_WIDTH;//750;//1000;
- public static final int HODO_REC_HEIGHT = SKEWT_REC_HEIGHT;///3 * 2;
+
+ public static final int HODO_REC_WIDTH = SKEWT_REC_WIDTH;// 750;//1000;
+
+ public static final int HODO_REC_HEIGHT = SKEWT_REC_HEIGHT;// /3 * 2;
+
public static final int HODO_VIEW_X_END = HODO_REC_X_ORIG + HODO_REC_WIDTH;
- //public static final int HODO_VIEW_Y_END = HODO_REC_Y_ORIG + HODO_REC_HEIGHT;
- public static final float HODO_CENTER_X = HODO_REC_X_ORIG + (float)(5.00/12.00) * HODO_REC_WIDTH;
- public static final float HODO_CENTER_Y = HODO_REC_Y_ORIG + (float)(1.00/2.00) * HODO_REC_HEIGHT;
+
+ // public static final int HODO_VIEW_Y_END = HODO_REC_Y_ORIG +
+ // HODO_REC_HEIGHT;
+ public static final float HODO_CENTER_X = HODO_REC_X_ORIG
+ + (float) (5.00 / 12.00) * HODO_REC_WIDTH;
+
+ public static final float HODO_CENTER_Y = HODO_REC_Y_ORIG
+ + (float) (1.00 / 2.00) * HODO_REC_HEIGHT;
+
public static final int WIND_MOTION_REC_X_ORIG = HODO_REC_X_ORIG;
+
public static final int WIND_MOTION_REC_Y_ORIG = HODO_REC_Y_ORIG;
+
public static final int WIND_MOTION_REC_WIDTH = 175;
+
public static final int WIND_MOTION_REC_HEIGHT = 150;
- public static final int WIND_MOTION_VIEW_X_END = WIND_MOTION_REC_X_ORIG+WIND_MOTION_REC_WIDTH;
- public static final int WIND_MOTION_VIEW_Y_END = WIND_MOTION_REC_Y_ORIG+WIND_MOTION_REC_HEIGHT;
+
+ public static final int WIND_MOTION_VIEW_X_END = WIND_MOTION_REC_X_ORIG
+ + WIND_MOTION_REC_WIDTH;
+
+ public static final int WIND_MOTION_VIEW_Y_END = WIND_MOTION_REC_Y_ORIG
+ + WIND_MOTION_REC_HEIGHT;
public static final int DATA_TIMELINE_REC_X_ORIG = HODO_VIEW_X_END;
+
public static final int DATA_TIMELINE_REC_Y_ORIG = HODO_REC_Y_ORIG;
- public static final int DATA_TIMELINE_REC_WIDTH =350;//280;
- public static final int DATA_TIMELINE_REC_HEIGHT = SKEWT_REC_HEIGHT-100;
- public static final int DATA_TIMELINE_VIEW_X_END = DATA_TIMELINE_REC_X_ORIG+DATA_TIMELINE_REC_WIDTH;
- public static final int DATA_TIMELINE_VIEW_Y_END = DATA_TIMELINE_REC_Y_ORIG+DATA_TIMELINE_REC_HEIGHT;
- public static final int DATA_TIMELINE_NEXT_PAGE_END = DATA_TIMELINE_REC_Y_ORIG+ 30;
- public static final int DATA_TIMELINE_NOTATION_Y_START = DATA_TIMELINE_VIEW_Y_END;//- 100;
- //public static final int DATA_TIMELINE_SORT_X_START = DATA_TIMELINE_REC_X_ORIG+(7*DATA_TIMELINE_REC_WIDTH/18);
+
+ public static final int DATA_TIMELINE_REC_WIDTH = 350;// 280;
+
+ public static final int DATA_TIMELINE_REC_HEIGHT = SKEWT_REC_HEIGHT - 100;
+
+ public static final int DATA_TIMELINE_VIEW_X_END = DATA_TIMELINE_REC_X_ORIG
+ + DATA_TIMELINE_REC_WIDTH;
+
+ public static final int DATA_TIMELINE_VIEW_Y_END = DATA_TIMELINE_REC_Y_ORIG
+ + DATA_TIMELINE_REC_HEIGHT;
+
+ public static final int DATA_TIMELINE_NEXT_PAGE_END = DATA_TIMELINE_REC_Y_ORIG + 30;
+
+ public static final int DATA_TIMELINE_NOTATION_Y_START = DATA_TIMELINE_VIEW_Y_END;// -
+ // 100;
+
+ // public static final int DATA_TIMELINE_SORT_X_START =
+ // DATA_TIMELINE_REC_X_ORIG+(7*DATA_TIMELINE_REC_WIDTH/18);
public static final int STATION_ID_REC_X_ORIG = DATA_TIMELINE_VIEW_X_END;
+
public static final int STATION_ID_REC_Y_ORIG = DATA_TIMELINE_REC_Y_ORIG;
+
public static final int STATION_ID_REC_WIDTH = 300;
+
public static final int STATION_ID_REC_HEIGHT = DATA_TIMELINE_REC_HEIGHT;
- public static final int STATION_ID_VIEW_X_END = STATION_ID_REC_X_ORIG+STATION_ID_REC_WIDTH;
- public static final int STATION_ID_VIEW_Y_END = STATION_ID_REC_Y_ORIG+STATION_ID_REC_HEIGHT;
- //public static final int STATION_ID_NOTATION_Y_START = STATION_ID_VIEW_Y_END-90;
+
+ public static final int STATION_ID_VIEW_X_END = STATION_ID_REC_X_ORIG
+ + STATION_ID_REC_WIDTH;
+
+ public static final int STATION_ID_VIEW_Y_END = STATION_ID_REC_Y_ORIG
+ + STATION_ID_REC_HEIGHT;
+
+ // public static final int STATION_ID_NOTATION_Y_START =
+ // STATION_ID_VIEW_Y_END-90;
public static final int COLOR_NOTATION_REC_X_ORIG = DATA_TIMELINE_REC_X_ORIG;
+
public static final int COLOR_NOTATION_REC_Y_ORIG = DATA_TIMELINE_VIEW_Y_END;
- public static final int COLOR_NOTATION_REC_WIDTH = DATA_TIMELINE_REC_WIDTH+STATION_ID_REC_WIDTH;
- public static final int COLOR_NOTATION_REC_HEIGHT = SKEWT_REC_HEIGHT-DATA_TIMELINE_REC_HEIGHT;
- public static final int COLOR_NOTATION_VIEW_X_END = COLOR_NOTATION_REC_X_ORIG+COLOR_NOTATION_REC_WIDTH;
- public static final int COLOR_NOTATION_VIEW_Y_END = COLOR_NOTATION_REC_Y_ORIG+COLOR_NOTATION_REC_HEIGHT;
-
-
-
- public static final int DATAPANEL1_REC_X_ORIG = OMEGA_X_TOP+150;
+
+ public static final int COLOR_NOTATION_REC_WIDTH = DATA_TIMELINE_REC_WIDTH
+ + STATION_ID_REC_WIDTH;
+
+ public static final int COLOR_NOTATION_REC_HEIGHT = SKEWT_REC_HEIGHT
+ - DATA_TIMELINE_REC_HEIGHT;
+
+ public static final int COLOR_NOTATION_VIEW_X_END = COLOR_NOTATION_REC_X_ORIG
+ + COLOR_NOTATION_REC_WIDTH;
+
+ public static final int COLOR_NOTATION_VIEW_Y_END = COLOR_NOTATION_REC_Y_ORIG
+ + COLOR_NOTATION_REC_HEIGHT;
+
+ public static final int DATAPANEL1_REC_X_ORIG = OMEGA_X_TOP + 150;
+
public static final int DATAPANEL1_REC_Y_ORIG = SKEWT_VIEW_Y_END + 50;
+
public static final int DATAPANEL1_REC_WIDTH = DATAPANEL_REC_WIDTH;
+
public static final int DATAPANEL1_REC_HEIGHT = DATAPANEL_REC_HEIGHT;
- public static final int DATAPANEL1_VIEW_X_END = DATAPANEL1_REC_X_ORIG+DATAPANEL1_REC_WIDTH;
- public static final int DATAPANEL1_VIEW_Y_END = DATAPANEL1_REC_Y_ORIG+DATAPANEL1_REC_HEIGHT;
+
+ public static final int DATAPANEL1_VIEW_X_END = DATAPANEL1_REC_X_ORIG
+ + DATAPANEL1_REC_WIDTH;
+
+ public static final int DATAPANEL1_VIEW_Y_END = DATAPANEL1_REC_Y_ORIG
+ + DATAPANEL1_REC_HEIGHT;
public static final int DATAPANEL2_REC_X_ORIG = DATAPANEL1_VIEW_X_END;
+
public static final int DATAPANEL2_REC_Y_ORIG = DATAPANEL1_REC_Y_ORIG;
+
public static final int DATAPANEL2_REC_WIDTH = DATAPANEL_REC_WIDTH;
+
public static final int DATAPANEL2_REC_HEIGHT = DATAPANEL_REC_HEIGHT;
- public static final int DATAPANEL2_VIEW_X_END = DATAPANEL2_REC_X_ORIG+DATAPANEL2_REC_WIDTH;
- public static final int DATAPANEL2_VIEW_Y_END = DATAPANEL2_REC_Y_ORIG+DATAPANEL2_REC_HEIGHT;
+
+ public static final int DATAPANEL2_VIEW_X_END = DATAPANEL2_REC_X_ORIG
+ + DATAPANEL2_REC_WIDTH;
+
+ public static final int DATAPANEL2_VIEW_Y_END = DATAPANEL2_REC_Y_ORIG
+ + DATAPANEL2_REC_HEIGHT;
public static final int DATAPANEL3_REC_X_ORIG = DATAPANEL2_VIEW_X_END;
+
public static final int DATAPANEL3_REC_Y_ORIG = DATAPANEL1_REC_Y_ORIG;
+
public static final int DATAPANEL3_REC_WIDTH = DATAPANEL_REC_WIDTH;
+
public static final int DATAPANEL3_REC_HEIGHT = DATAPANEL_REC_HEIGHT;
- public static final int DATAPANEL3_VIEW_X_END = DATAPANEL3_REC_X_ORIG+DATAPANEL3_REC_WIDTH;
- public static final int DATAPANEL3_VIEW_Y_END = DATAPANEL3_REC_Y_ORIG+DATAPANEL3_REC_HEIGHT;
+
+ public static final int DATAPANEL3_VIEW_X_END = DATAPANEL3_REC_X_ORIG
+ + DATAPANEL3_REC_WIDTH;
+
+ public static final int DATAPANEL3_VIEW_Y_END = DATAPANEL3_REC_Y_ORIG
+ + DATAPANEL3_REC_HEIGHT;
public static final int DATAPANEL4_REC_X_ORIG = DATAPANEL3_VIEW_X_END;
+
public static final int DATAPANEL4_REC_Y_ORIG = DATAPANEL1_REC_Y_ORIG;
+
public static final int DATAPANEL4_REC_WIDTH = DATAPANEL_REC_WIDTH;
+
public static final int DATAPANEL4_REC_HEIGHT = DATAPANEL_REC_HEIGHT;
- public static final int DATAPANEL4_VIEW_X_END = DATAPANEL4_REC_X_ORIG+DATAPANEL4_REC_WIDTH;
- public static final int DATAPANEL4_VIEW_Y_END = DATAPANEL4_REC_Y_ORIG+DATAPANEL4_REC_HEIGHT;
-
+
+ public static final int DATAPANEL4_VIEW_X_END = DATAPANEL4_REC_X_ORIG
+ + DATAPANEL4_REC_WIDTH;
+
+ public static final int DATAPANEL4_VIEW_Y_END = DATAPANEL4_REC_Y_ORIG
+ + DATAPANEL4_REC_HEIGHT;
+
public static final int SRWINDS_REC_X_ORIG = DATAPANEL2_VIEW_X_END;
+
public static final int SRWINDS_REC_Y_ORIG = DATAPANEL1_REC_Y_ORIG;
+
public static final int SRWINDS_REC_WIDTH = INSET_REC_WIDTH;
+
public static final int SRWINDS_REC_HEIGHT = INSET_REC_HEIGHT;
- public static final int SRWINDS_VIEW_X_END = SRWINDS_REC_X_ORIG+SRWINDS_REC_WIDTH;
- public static final int SRWINDS_VIEW_Y_END = SRWINDS_REC_Y_ORIG+SRWINDS_REC_HEIGHT;
-
+
+ public static final int SRWINDS_VIEW_X_END = SRWINDS_REC_X_ORIG
+ + SRWINDS_REC_WIDTH;
+
+ public static final int SRWINDS_VIEW_Y_END = SRWINDS_REC_Y_ORIG
+ + SRWINDS_REC_HEIGHT;
+
public static final int STORMSLINKY_REC_X_ORIG = SRWINDS_VIEW_X_END;
+
public static final int STORMSLINKY_REC_Y_ORIG = DATAPANEL1_REC_Y_ORIG;
+
public static final int STORMSLINKY_REC_WIDTH = INSET_REC_WIDTH;
+
public static final int STORMSLINKY_REC_HEIGHT = INSET_REC_HEIGHT;
- public static final int STORMSLINKY_VIEW_X_END = STORMSLINKY_REC_X_ORIG+STORMSLINKY_REC_WIDTH;
- public static final int STORMSLINKY_VIEW_Y_END = STORMSLINKY_REC_Y_ORIG+STORMSLINKY_REC_HEIGHT;
-
+
+ public static final int STORMSLINKY_VIEW_X_END = STORMSLINKY_REC_X_ORIG
+ + STORMSLINKY_REC_WIDTH;
+
+ public static final int STORMSLINKY_VIEW_Y_END = STORMSLINKY_REC_Y_ORIG
+ + STORMSLINKY_REC_HEIGHT;
+
public static final int THETAP_REC_X_ORIG = SRWINDS_REC_X_ORIG;
- public static final int THETAP_REC_Y_ORIG = SRWINDS_VIEW_Y_END;
+
+ public static final int THETAP_REC_Y_ORIG = SRWINDS_VIEW_Y_END;
+
public static final int THETAP_REC_WIDTH = INSET_REC_WIDTH;
+
public static final int THETAP_REC_HEIGHT = INSET_REC_HEIGHT;
- public static final int THETAP_VIEW_X_END = THETAP_REC_X_ORIG+THETAP_REC_WIDTH;
- public static final int THETAP_VIEW_Y_END = THETAP_REC_Y_ORIG+THETAP_REC_HEIGHT;
-
- //same position as THETAP_REC
+
+ public static final int THETAP_VIEW_X_END = THETAP_REC_X_ORIG
+ + THETAP_REC_WIDTH;
+
+ public static final int THETAP_VIEW_Y_END = THETAP_REC_Y_ORIG
+ + THETAP_REC_HEIGHT;
+
+ // same position as THETAP_REC
public static final int THETAH_REC_X_ORIG = SRWINDS_REC_X_ORIG;
+
public static final int THETAH_REC_Y_ORIG = SRWINDS_VIEW_Y_END;
+
public static final int THETAH_REC_WIDTH = INSET_REC_WIDTH;
+
public static final int THETAH_REC_HEIGHT = INSET_REC_HEIGHT;
- public static final int THETAH_VIEW_X_END = THETAH_REC_X_ORIG+THETAH_REC_WIDTH;
- public static final int THETAH_VIEW_Y_END = THETAH_REC_Y_ORIG+THETAH_REC_HEIGHT;
-
+
+ public static final int THETAH_VIEW_X_END = THETAH_REC_X_ORIG
+ + THETAH_REC_WIDTH;
+
+ public static final int THETAH_VIEW_Y_END = THETAH_REC_Y_ORIG
+ + THETAH_REC_HEIGHT;
+
public static final int PSBLWATCH_REC_X_ORIG = THETAP_VIEW_X_END;
+
public static final int PSBLWATCH_REC_Y_ORIG = THETAP_REC_Y_ORIG;
+
public static final int PSBLWATCH_REC_WIDTH = INSET_REC_WIDTH;
+
public static final int PSBLWATCH_REC_HEIGHT = INSET_REC_HEIGHT;
- public static final int PSBLWATCH_VIEW_X_END = PSBLWATCH_REC_X_ORIG+PSBLWATCH_REC_WIDTH;
- public static final int PSBLWATCH_VIEW_Y_END = PSBLWATCH_REC_Y_ORIG+PSBLWATCH_REC_HEIGHT;
-
- //same position as PSBLWATCH_REC
+
+ public static final int PSBLWATCH_VIEW_X_END = PSBLWATCH_REC_X_ORIG
+ + PSBLWATCH_REC_WIDTH;
+
+ public static final int PSBLWATCH_VIEW_Y_END = PSBLWATCH_REC_Y_ORIG
+ + PSBLWATCH_REC_HEIGHT;
+
+ // same position as PSBLWATCH_REC
public static final int SRWINDVTRS_REC_X_ORIG = THETAP_VIEW_X_END;
+
public static final int SRWINDVTRS_REC_Y_ORIG = THETAP_REC_Y_ORIG;
+
public static final int SRWINDVTRS_REC_WIDTH = INSET_REC_WIDTH;
+
public static final int SRWINDVTRS_REC_HEIGHT = INSET_REC_HEIGHT;
- public static final int SRWINDVTRS_VIEW_X_END = SRWINDVTRS_REC_X_ORIG+SRWINDVTRS_REC_WIDTH;
- public static final int SRWINDVTRS_VIEW_Y_END = SRWINDVTRS_REC_Y_ORIG+SRWINDVTRS_REC_HEIGHT;
+
+ public static final int SRWINDVTRS_VIEW_X_END = SRWINDVTRS_REC_X_ORIG
+ + SRWINDVTRS_REC_WIDTH;
+
+ public static final int SRWINDVTRS_VIEW_Y_END = SRWINDVTRS_REC_Y_ORIG
+ + SRWINDVTRS_REC_HEIGHT;
public static final int CHAR_HEIGHT = 25;
+
/****
* SINGLE PANE IMPLEMENTATIONS end
*
******/
-
-
+
/***
*
* MULTIPLE PANES IMPLEMENTATIONS start
*
*
****/
- /*public static final int DISPLAY_SKEWT=0;
- public static final int DISPLAY_WITO= DISPLAY_SKEWT+1; //Wind box + InferredTemp + Omega
- public static final int DISPLAY_INSET= DISPLAY_WITO+1;
- public static final int DISPLAY_HODO= DISPLAY_INSET+1;
- public static final int DISPLAY_TIMESTN= DISPLAY_HODO+1;
- public static final int DISPLAY_DATA=DISPLAY_TIMESTN+1;
- public static final int DISPLAY_SPC_GRAPHS= DISPLAY_DATA+1;
- public static final int DISPLAY_TOTAL= DISPLAY_SPC_GRAPHS+1;*/
- public static final int CHAR_HEIGHT_ = 15;
-
- //note: dimensions are used as reference for its components inside its pane and only relative within its own pane.
- //Sizes defined here have no significant meaning between two different panes.
- public static final int DISPLAY_WIDTH= 1600;
- public static final int DISPLAY_HEIGHT= 820;
- public static final int SKEWT_PANE_REC_WIDTH = DISPLAY_WIDTH/2 * 11 /16; //800 *11/16=550
- public static final int SKEWT_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 8 /10; // 820*0.8 =656;
- public static final int WITO_PANE_REC_WIDTH = DISPLAY_WIDTH/2 - SKEWT_PANE_REC_WIDTH; //800-550=250
- public static final int WITO_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 8 /10; // 820*0.8 =656;
- public static final int HODO_PANE_REC_WIDTH = (DISPLAY_WIDTH/2) * 13/20;//800x0.65=520;;
- public static final int HODO_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 7 /10; // 820*0.7 =574;
- public static final int TIMESTN_PANE_REC_WIDTH = DISPLAY_WIDTH/2 - HODO_PANE_REC_WIDTH;//800-520=280
- public static final int TIMESTN_PANE_REC_HEIGHT = HODO_PANE_REC_HEIGHT; //574
- public static final int INSET_PANE_REC_WIDTH = DISPLAY_WIDTH/2;
- public static final int INSET_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 2 /10; // 820*0.2 =164;
- public static final int DATA_PANE_REC_WIDTH = DISPLAY_WIDTH/2; //800
- public static final int DATA_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 3 /10; // 820*0.3 =246;
- public static Rectangle SKEWT_DISPLAY_REC = new Rectangle(0, 0, SKEWT_PANE_REC_WIDTH, SKEWT_PANE_REC_HEIGHT);
- public static Rectangle WITO_DISPLAY_REC = new Rectangle(0, 0, WITO_PANE_REC_WIDTH, WITO_PANE_REC_HEIGHT);
- public static Rectangle HODO_DISPLAY_REC = new Rectangle(0, 0, HODO_PANE_REC_WIDTH, HODO_PANE_REC_HEIGHT);
- public static Rectangle TIMESTN_DISPLAY_REC = new Rectangle(0, 0, TIMESTN_PANE_REC_WIDTH, TIMESTN_PANE_REC_HEIGHT);
- public static Rectangle FUTURE_DISPLAY_REC = new Rectangle(0, 0, TIMESTN_PANE_REC_WIDTH, TIMESTN_PANE_REC_HEIGHT);
- public static Rectangle DATA_DISPLAY_REC = new Rectangle(0, 0, DATA_PANE_REC_WIDTH, DATA_PANE_REC_HEIGHT);
- public static Rectangle INSET_DISPLAY_REC = new Rectangle(0, 0, INSET_PANE_REC_WIDTH, INSET_PANE_REC_HEIGHT);
- public static Rectangle SPC_GRAPH_DISPLAY_REC = new Rectangle(0, 0, DATA_PANE_REC_WIDTH, DATA_PANE_REC_HEIGHT);
- public static final int SKEWT_WIDTH = SKEWT_PANE_REC_WIDTH;//=550
- public static final int SKEWT_HEIGHT = SKEWT_PANE_REC_HEIGHT;//570
+ /*
+ * public static final int DISPLAY_SKEWT=0; public static final int
+ * DISPLAY_WITO= DISPLAY_SKEWT+1; //Wind box + InferredTemp + Omega public
+ * static final int DISPLAY_INSET= DISPLAY_WITO+1; public static final int
+ * DISPLAY_HODO= DISPLAY_INSET+1; public static final int DISPLAY_TIMESTN=
+ * DISPLAY_HODO+1; public static final int DISPLAY_DATA=DISPLAY_TIMESTN+1;
+ * public static final int DISPLAY_SPC_GRAPHS= DISPLAY_DATA+1; public static
+ * final int DISPLAY_TOTAL= DISPLAY_SPC_GRAPHS+1;
+ */
+ public static final int CHAR_HEIGHT_ = 15;
+
+ // note: dimensions are used as reference for its components inside its pane
+ // and only relative within its own pane.
+ // Sizes defined here have no significant meaning between two different
+ // panes.
+ public static final int DISPLAY_WIDTH = 1600;
+
+ public static final int DISPLAY_HEIGHT = 820;
+
+ public static final int SKEWT_PANE_REC_WIDTH = DISPLAY_WIDTH / 2 * 11 / 16; // 800
+ // *11/16=550
+
+ public static final int SKEWT_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 8 / 10; // 820*0.8
+ // =656;
+
+ public static final int WITO_PANE_REC_WIDTH = DISPLAY_WIDTH / 2
+ - SKEWT_PANE_REC_WIDTH; // 800-550=250
+
+ public static final int WITO_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 8 / 10; // 820*0.8
+ // =656;
+
+ public static final int HODO_PANE_REC_WIDTH = (DISPLAY_WIDTH / 2) * 13 / 20;// 800x0.65=520;;
+
+ public static final int HODO_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 7 / 10; // 820*0.7
+ // =574;
+
+ public static final int TIMESTN_PANE_REC_WIDTH = DISPLAY_WIDTH / 2
+ - HODO_PANE_REC_WIDTH;// 800-520=280
+
+ public static final int TIMESTN_PANE_REC_HEIGHT = HODO_PANE_REC_HEIGHT; // 574
+
+ public static final int INSET_PANE_REC_WIDTH = DISPLAY_WIDTH / 2;
+
+ public static final int INSET_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 2 / 10; // 820*0.2
+ // =164;
+
+ public static final int DATA_PANE_REC_WIDTH = DISPLAY_WIDTH / 2; // 800
+
+ public static final int DATA_PANE_REC_HEIGHT = DISPLAY_HEIGHT * 3 / 10; // 820*0.3
+ // =246;
+
+ public static Rectangle SKEWT_DISPLAY_REC = new Rectangle(0, 0,
+ SKEWT_PANE_REC_WIDTH, SKEWT_PANE_REC_HEIGHT);
+
+ public static Rectangle WITO_DISPLAY_REC = new Rectangle(0, 0,
+ WITO_PANE_REC_WIDTH, WITO_PANE_REC_HEIGHT);
+
+ public static Rectangle HODO_DISPLAY_REC = new Rectangle(0, 0,
+ HODO_PANE_REC_WIDTH, HODO_PANE_REC_HEIGHT);
+
+ public static Rectangle TIMESTN_DISPLAY_REC = new Rectangle(0, 0,
+ TIMESTN_PANE_REC_WIDTH, TIMESTN_PANE_REC_HEIGHT);
+
+ public static Rectangle FUTURE_DISPLAY_REC = new Rectangle(0, 0,
+ TIMESTN_PANE_REC_WIDTH, TIMESTN_PANE_REC_HEIGHT);
+
+ public static Rectangle DATA_DISPLAY_REC = new Rectangle(0, 0,
+ DATA_PANE_REC_WIDTH, DATA_PANE_REC_HEIGHT);
+
+ public static Rectangle INSET_DISPLAY_REC = new Rectangle(0, 0,
+ INSET_PANE_REC_WIDTH, INSET_PANE_REC_HEIGHT);
+
+ public static Rectangle SPC_GRAPH_DISPLAY_REC = new Rectangle(0, 0,
+ DATA_PANE_REC_WIDTH, DATA_PANE_REC_HEIGHT);
+
+ public static final int SKEWT_WIDTH = SKEWT_PANE_REC_WIDTH;// =550
+
+ public static final int SKEWT_HEIGHT = SKEWT_PANE_REC_HEIGHT;// 570
+
public static final int SKEWT_X_ORIG = 0;
- public static final int SKEWT_Y_ORIG = 0;//70;
+
+ public static final int SKEWT_Y_ORIG = 0;// 70;
+
public static final int SKEWT_X_END = SKEWT_X_ORIG + SKEWT_WIDTH;
+
public static final int SKEWT_Y_END = SKEWT_Y_ORIG + SKEWT_HEIGHT;
- public static final int ICING_X_ORIG =SKEWT_X_ORIG;
+
+ public static final int ICING_X_ORIG = SKEWT_X_ORIG;
+
public static final int ICING_Y_ORIG = SKEWT_Y_ORIG;
+
public static final int ICING_WIDTH = SKEWT_WIDTH;
- public static final int ICING_HEIGHT = SKEWT_HEIGHT-25;
+
+ public static final int ICING_HEIGHT = SKEWT_HEIGHT - 25;
+
public static final int ICING_X_END = ICING_X_ORIG + ICING_WIDTH;
+
public static final int ICING_Y_END = ICING_Y_ORIG + ICING_HEIGHT;
- public static final int TURB_X_ORIG =SKEWT_X_ORIG;
- public static final int TURB_Y_ORIG = SKEWT_Y_ORIG ;
+
+ public static final int TURB_X_ORIG = SKEWT_X_ORIG;
+
+ public static final int TURB_Y_ORIG = SKEWT_Y_ORIG;
+
public static final int TURB_WIDTH = SKEWT_WIDTH;
- public static final int TURB_HEIGHT = SKEWT_HEIGHT -25;
+
+ public static final int TURB_HEIGHT = SKEWT_HEIGHT - 25;
+
public static final int TURB_X_END = TURB_X_ORIG + TURB_WIDTH;
+
public static final int TURB_Y_END = TURB_Y_ORIG + TURB_HEIGHT;
- public static final int WIND_BX_WIDTH = WITO_PANE_REC_WIDTH/3;;
+
+ public static final int WIND_BX_WIDTH = WITO_PANE_REC_WIDTH / 3;;
+
public static final int WIND_BX_HEIGHT = SKEWT_HEIGHT;
+
public static final int WIND_BX_X_ORIG = 0;
+
public static final int WIND_BX_Y_ORIG = SKEWT_Y_ORIG;
- public static final int VRTCAL_WIND_WIDTH = WITO_PANE_REC_WIDTH/3;;
+
+ public static final int VRTCAL_WIND_WIDTH = WITO_PANE_REC_WIDTH / 3;;
+
public static final int VRTCAL_WIND_HEIGHT = SKEWT_HEIGHT;
- public static final int VRTCAL_WIND_X_ORIG = WIND_BX_X_ORIG+ WIND_BX_WIDTH;
+
+ public static final int VRTCAL_WIND_X_ORIG = WIND_BX_X_ORIG + WIND_BX_WIDTH;
+
public static final int VRTCAL_WIND_Y_ORIG = SKEWT_Y_ORIG;
- public static final int VRTCAL_WIND_X_END = VRTCAL_WIND_X_ORIG + VRTCAL_WIND_WIDTH;
- public static final int VRTCAL_WIND_Y_END = VRTCAL_WIND_Y_ORIG + VRTCAL_WIND_HEIGHT;
+
+ public static final int VRTCAL_WIND_X_END = VRTCAL_WIND_X_ORIG
+ + VRTCAL_WIND_WIDTH;
+
+ public static final int VRTCAL_WIND_Y_END = VRTCAL_WIND_Y_ORIG
+ + VRTCAL_WIND_HEIGHT;
+
public static final int OMEGA_X_ORIG = VRTCAL_WIND_X_END;
+
public static final int OMEGA_Y_ORIG = SKEWT_Y_ORIG;
- public static final int OMEGA_WIDTH = WITO_PANE_REC_WIDTH/3;
+
+ public static final int OMEGA_WIDTH = WITO_PANE_REC_WIDTH / 3;
+
public static final int OMEGA_HEIGHT = SKEWT_HEIGHT;
+
public static final int OMEGA_Y_END = SKEWT_Y_END;
+
public static final int OMEGA_MAGNIFICATION_FACTOR = 20;
+
public static final int HODO_X_ORIG = 0;
- public static final int HODO_Y_ORIG = 0;//40;
+
+ public static final int HODO_Y_ORIG = 0;// 40;
+
public static final int HODO_WIDTH = HODO_PANE_REC_WIDTH;
+
public static final int HODO_HEIGHT = HODO_PANE_REC_HEIGHT - HODO_Y_ORIG;
+
public static final int HODO_X_END = HODO_X_ORIG + HODO_WIDTH;
- public static final float HODO_CENTER_X_ = HODO_X_ORIG + (float)(5.00/12.00) * HODO_WIDTH;
- public static final float HODO_CENTER_Y_ = HODO_Y_ORIG + (float)(1.00/2.00) * HODO_HEIGHT;
+
+ public static final float HODO_CENTER_X_ = HODO_X_ORIG
+ + (float) (5.00 / 12.00) * HODO_WIDTH;
+
+ public static final float HODO_CENTER_Y_ = HODO_Y_ORIG
+ + (float) (1.00 / 2.00) * HODO_HEIGHT;
+
public static final int HODO_COORDINATE_X1 = -50;
+
public static final int HODO_COORDINATE_X1_STD = -90;
- public static final int HODO_COORDINATE_Y1 = 75;
+
+ public static final int HODO_COORDINATE_Y1 = 75;
+
public static final int HODO_COORDINATE_X2 = 70;
+
public static final int HODO_COORDINATE_Y2 = -95;
-
+
public static final int DATA_TIMELINE_X_ORIG = 0;
+
public static final int DATA_TIMELINE_Y_ORIG = 40;
- public static final int DATA_TIMELINE_WIDTH = TIMESTN_PANE_REC_WIDTH * 40 /100;
+
+ public static final int DATA_TIMELINE_WIDTH = TIMESTN_PANE_REC_WIDTH * 35 / 100;// FixMark:nearByStnCompSnd
+ // d2dlite
+
public static final int COLOR_NOTATION_HEIGHT = 165;
- public static final int DATA_TIMELINE_HEIGHT = TIMESTN_PANE_REC_HEIGHT-DATA_TIMELINE_Y_ORIG-COLOR_NOTATION_HEIGHT;
- public static final int DATA_TIMELINE_X_END = DATA_TIMELINE_X_ORIG+DATA_TIMELINE_WIDTH;
- public static final int DATA_TIMELINE_Y_END = DATA_TIMELINE_Y_ORIG+DATA_TIMELINE_HEIGHT;
- public static final int DATA_TIMELINE_NEXT_PAGE_END_ = DATA_TIMELINE_Y_ORIG+ CHAR_HEIGHT_;
+
+ public static final int DATA_TIMELINE_HEIGHT = TIMESTN_PANE_REC_HEIGHT
+ - DATA_TIMELINE_Y_ORIG - COLOR_NOTATION_HEIGHT;
+
+ public static final int DATA_TIMELINE_X_END = DATA_TIMELINE_X_ORIG
+ + DATA_TIMELINE_WIDTH;
+
+ public static final int DATA_TIMELINE_Y_END = DATA_TIMELINE_Y_ORIG
+ + DATA_TIMELINE_HEIGHT;
+
+ public static final int DATA_TIMELINE_NEXT_PAGE_END_ = DATA_TIMELINE_Y_ORIG
+ + CHAR_HEIGHT_;
+
public static final int STATION_ID_X_ORIG = DATA_TIMELINE_X_END;
+
public static final int STATION_ID_Y_ORIG = DATA_TIMELINE_Y_ORIG;
- public static final int STATION_ID_WIDTH = (TIMESTN_PANE_REC_WIDTH - DATA_TIMELINE_WIDTH)/2;
+
+ public static final int STATION_ID_WIDTH = TIMESTN_PANE_REC_WIDTH * 30 / 100;
+
public static final int STATION_ID_HEIGHT = DATA_TIMELINE_HEIGHT;
- public static final int STATION_ID_X_END = STATION_ID_X_ORIG+STATION_ID_WIDTH;
- public static final int STATION_ID_Y_END = STATION_ID_Y_ORIG+STATION_ID_HEIGHT;
+
+ public static final int STATION_ID_X_END = STATION_ID_X_ORIG
+ + STATION_ID_WIDTH;
+
+ public static final int STATION_ID_Y_END = STATION_ID_Y_ORIG
+ + STATION_ID_HEIGHT;
+
public static final int SND_TYPE_X_ORIG = STATION_ID_X_END;
+
public static final int SND_TYPE_Y_ORIG = DATA_TIMELINE_Y_ORIG;
- public static final int SND_TYPE_WIDTH = STATION_ID_WIDTH;
+
+ public static final int SND_TYPE_WIDTH = TIMESTN_PANE_REC_WIDTH * 35 / 100;;
+
public static final int SND_TYPE_HEIGHT = DATA_TIMELINE_HEIGHT;
- public static final int SND_TYPE_X_END = SND_TYPE_X_ORIG+SND_TYPE_WIDTH;
- public static final int SND_TYPE_Y_END = SND_TYPE_Y_ORIG+ SND_TYPE_HEIGHT;
+
+ public static final int SND_TYPE_X_END = SND_TYPE_X_ORIG + SND_TYPE_WIDTH;
+
+ public static final int SND_TYPE_Y_END = SND_TYPE_Y_ORIG + SND_TYPE_HEIGHT;
+
public static final int COLOR_NOTATION_X_ORIG = DATA_TIMELINE_X_ORIG;
+
public static final int COLOR_NOTATION_Y_ORIG = DATA_TIMELINE_Y_END;
- public static final int COLOR_NOTATION_WIDTH = DATA_TIMELINE_WIDTH+STATION_ID_WIDTH;
- public static final int COLOR_NOTATION_X_END = COLOR_NOTATION_X_ORIG+COLOR_NOTATION_WIDTH;
- public static final int COLOR_NOTATION_Y_END = COLOR_NOTATION_Y_ORIG+COLOR_NOTATION_HEIGHT;
+
+ public static final int COLOR_NOTATION_WIDTH = DATA_TIMELINE_WIDTH
+ + STATION_ID_WIDTH;
+
+ public static final int COLOR_NOTATION_X_END = COLOR_NOTATION_X_ORIG
+ + COLOR_NOTATION_WIDTH;
+
+ public static final int COLOR_NOTATION_Y_END = COLOR_NOTATION_Y_ORIG
+ + COLOR_NOTATION_HEIGHT;
+
public static final int DATAPANEL1_X_ORIG = 0;
+
public static final int DATAPANEL1_Y_ORIG = 0;
- public static final int DATAPANEL1_WIDTH = DATA_PANE_REC_WIDTH/2;
+
+ public static final int DATAPANEL1_WIDTH = DATA_PANE_REC_WIDTH / 2;
+
public static final int DATAPANEL1_HEIGHT = DATA_PANE_REC_HEIGHT;
- public static final int DATAPANEL1_X_END = DATAPANEL1_X_ORIG+DATAPANEL1_WIDTH;
- public static final int DATAPANEL1_Y_END = DATAPANEL1_Y_ORIG+DATAPANEL1_HEIGHT;
+
+ public static final int DATAPANEL1_X_END = DATAPANEL1_X_ORIG
+ + DATAPANEL1_WIDTH;
+
+ public static final int DATAPANEL1_Y_END = DATAPANEL1_Y_ORIG
+ + DATAPANEL1_HEIGHT;
+
public static final int DATAPANEL2_X_ORIG = DATAPANEL1_X_END;
+
public static final int DATAPANEL2_Y_ORIG = DATAPANEL1_Y_ORIG;
+
public static final int DATAPANEL2_WIDTH = DATAPANEL1_WIDTH;
+
public static final int DATAPANEL2_HEIGHT = DATAPANEL1_HEIGHT;
- public static final int DATAPANEL2_X_END = DATAPANEL2_X_ORIG+DATAPANEL2_WIDTH;
- public static final int DATAPANEL2_Y_END = DATAPANEL2_Y_ORIG+DATAPANEL2_HEIGHT;
+
+ public static final int DATAPANEL2_X_END = DATAPANEL2_X_ORIG
+ + DATAPANEL2_WIDTH;
+
+ public static final int DATAPANEL2_Y_END = DATAPANEL2_Y_ORIG
+ + DATAPANEL2_HEIGHT;
+
public static final int INSET_X_ORIG = 0;
+
public static final int INSET_Y_ORIG = 0;
- public static final int INSET_WIDTH = INSET_PANE_REC_WIDTH/4;
+
+ public static final int INSET_WIDTH = INSET_PANE_REC_WIDTH / 4;
+
public static final int INSET_HEIGHT = INSET_PANE_REC_HEIGHT;
-
+
public static final int SRWINDS_X_ORIG = INSET_X_ORIG;
+
public static final int SRWINDS_Y_ORIG = INSET_Y_ORIG;
- public static final int SRWINDS_X_END = SRWINDS_X_ORIG+INSET_WIDTH;
- public static final int SRWINDS_Y_END = SRWINDS_Y_ORIG+INSET_HEIGHT;
-
+
+ public static final int SRWINDS_X_END = SRWINDS_X_ORIG + INSET_WIDTH;
+
+ public static final int SRWINDS_Y_END = SRWINDS_Y_ORIG + INSET_HEIGHT;
+
public static final int STORMSLINKY_X_ORIG = SRWINDS_X_END;
+
public static final int STORMSLINKY_Y_ORIG = SRWINDS_Y_ORIG;
- public static final int STORMSLINKY_X_END = STORMSLINKY_X_ORIG+INSET_WIDTH;
- public static final int STORMSLINKY_Y_END = STORMSLINKY_Y_ORIG+INSET_HEIGHT;
-
+
+ public static final int STORMSLINKY_X_END = STORMSLINKY_X_ORIG
+ + INSET_WIDTH;
+
+ public static final int STORMSLINKY_Y_END = STORMSLINKY_Y_ORIG
+ + INSET_HEIGHT;
+
public static final int THETAP_X_ORIG = STORMSLINKY_X_END;
- public static final int THETAP_Y_ORIG = STORMSLINKY_Y_ORIG;
- public static final int THETAP_X_END = THETAP_X_ORIG+INSET_WIDTH;
- public static final int THETAP_Y_END = THETAP_Y_ORIG+INSET_HEIGHT;
-
- //same position as THETAP
+
+ public static final int THETAP_Y_ORIG = STORMSLINKY_Y_ORIG;
+
+ public static final int THETAP_X_END = THETAP_X_ORIG + INSET_WIDTH;
+
+ public static final int THETAP_Y_END = THETAP_Y_ORIG + INSET_HEIGHT;
+
+ // same position as THETAP
public static final int THETAH_X_ORIG = STORMSLINKY_X_END;
+
public static final int THETAH_Y_ORIG = STORMSLINKY_Y_ORIG;
- public static final int THETAH_X_END = THETAH_X_ORIG+INSET_WIDTH;
- public static final int THETAH_Y_END = THETAH_Y_ORIG+INSET_HEIGHT;
-
+
+ public static final int THETAH_X_END = THETAH_X_ORIG + INSET_WIDTH;
+
+ public static final int THETAH_Y_END = THETAH_Y_ORIG + INSET_HEIGHT;
+
public static final int PSBLWATCH_X_ORIG = THETAP_X_END;
+
public static final int PSBLWATCH_Y_ORIG = THETAP_Y_ORIG;
- public static final int PSBLWATCH_X_END = PSBLWATCH_X_ORIG+INSET_WIDTH;
- public static final int PSBLWATCH_Y_END = PSBLWATCH_Y_ORIG+INSET_HEIGHT;
-
- //same position as PSBLWATCH
+
+ public static final int PSBLWATCH_X_END = PSBLWATCH_X_ORIG + INSET_WIDTH;
+
+ public static final int PSBLWATCH_Y_END = PSBLWATCH_Y_ORIG + INSET_HEIGHT;
+
+ // same position as PSBLWATCH
public static final int SRWINDVTRS_X_ORIG = THETAP_X_END;
+
public static final int SRWINDVTRS_Y_ORIG = THETAP_Y_ORIG;
- public static final int SRWINDVTRS_X_END = SRWINDVTRS_X_ORIG+INSET_WIDTH;
- public static final int SRWINDVTRS_Y_END = SRWINDVTRS_Y_ORIG+INSET_HEIGHT;
-
- //public static final String PANE_LEGACY_CFG_STR = "Legacy Configuration (obsoleting)";
+
+ public static final int SRWINDVTRS_X_END = SRWINDVTRS_X_ORIG + INSET_WIDTH;
+
+ public static final int SRWINDVTRS_Y_END = SRWINDVTRS_Y_ORIG + INSET_HEIGHT;
+
+ // public static final String PANE_LEGACY_CFG_STR =
+ // "Legacy Configuration (obsoleting)";
public static final String PANE_DEF_CFG_1_STR = "Default Configuration 1";
+
public static final String PANE_DEF_CFG_2_STR = "Default Configuration 2";
+
public static final String PANE_SPCWS_CFG_STR = "SPC Wide Screen Configuration";
+
public static final String PANE_SIMPLE_D2D_CFG_STR = "D2D Skewt Standard Screen Configuration";
- public static final String[] PANE_CONFIGURATION_NAME = {/*PANE_DEF_CFG_1_STR, PANE_DEF_CFG_2_STR,*/PANE_SPCWS_CFG_STR,PANE_SIMPLE_D2D_CFG_STR};//, PANE_LEGACY_CFG_STR};
-
- //pane width and height ratio to full canvas size
- // pane default configuration 1
- // full canvas consists of left group and right group
- // left group has left top and bottom groups
+
+ public static final String PANE_LITE_D2D_CFG_STR = "D2D Lite Screen Configuration"; // d2dlite
+
+ public static final String[] PANE_CONFIGURATION_NAME = {
+ PANE_SPCWS_CFG_STR, PANE_SIMPLE_D2D_CFG_STR, PANE_LITE_D2D_CFG_STR }; // d2dlite
+
+ // pane width and height ratio to full canvas size
+ // pane default configuration 1
+ // full canvas consists of left group and right group
+ // left group has left top and bottom groups
// left top group contains skewt and wito panes
// left bottom group contains time/stn and insets panes
// right group has hodo and data panes
public static final double PANE_DEF_CFG_1_LEFT_GP_WIDTH_RATIO = 0.75;
+
public static final double PANE_DEF_CFG_1_LEFT_TOP_GP_HEIGHT_RATIO = 0.8;
+
public static final double PANE_DEF_CFG_1_RIGHT_TOP_GP_HEIGHT_RATIO = 0.4;
+
public static final double PANE_DEF_CFG_1_SKEWT_WIDTH_RATIO = 0.8;
+
public static final double PANE_DEF_CFG_1_SKEWT_HEIGHT_RATIO = PANE_DEF_CFG_1_LEFT_TOP_GP_HEIGHT_RATIO;
- public static final double PANE_DEF_CFG_1_WITO_WIDTH_RATIO = 1-PANE_DEF_CFG_1_SKEWT_WIDTH_RATIO;
+
+ public static final double PANE_DEF_CFG_1_WITO_WIDTH_RATIO = 1 - PANE_DEF_CFG_1_SKEWT_WIDTH_RATIO;
+
public static final double PANE_DEF_CFG_1_WITO_HEIGHT_RATIO = PANE_DEF_CFG_1_SKEWT_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_1_HODO_WIDTH_RATIO = 1;
+
public static final double PANE_DEF_CFG_1_HODO_HEIGHT_RATIO = PANE_DEF_CFG_1_RIGHT_TOP_GP_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_1_INSET_WIDTH_RATIO = 0.5;
- public static final double PANE_DEF_CFG_1_INSET_HEIGHT_RATIO = 1-PANE_DEF_CFG_1_SKEWT_HEIGHT_RATIO;
- public static final double PANE_DEF_CFG_1_TIMESTN_WIDTH_RATIO = 1-PANE_DEF_CFG_1_INSET_WIDTH_RATIO;
+
+ public static final double PANE_DEF_CFG_1_INSET_HEIGHT_RATIO = 1 - PANE_DEF_CFG_1_SKEWT_HEIGHT_RATIO;
+
+ public static final double PANE_DEF_CFG_1_TIMESTN_WIDTH_RATIO = 1 - PANE_DEF_CFG_1_INSET_WIDTH_RATIO;
+
public static final double PANE_DEF_CFG_1_TIMESTN_HEIGHT_RATIO = PANE_DEF_CFG_1_INSET_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_1_DATA_WIDTH_RATIO = 1;
- public static final double PANE_DEF_CFG_1_DATA_HEIGHT_RATIO = 1-PANE_DEF_CFG_1_HODO_HEIGHT_RATIO;
- // pane default configuration 2
- // full canvas consists of left group and right group
- // both groups contains top and bottom groups
+
+ public static final double PANE_DEF_CFG_1_DATA_HEIGHT_RATIO = 1 - PANE_DEF_CFG_1_HODO_HEIGHT_RATIO;
+
+ // pane default configuration 2
+ // full canvas consists of left group and right group
+ // both groups contains top and bottom groups
// left top group contains skewt and wito panes
// left bottom group contains insets panes
// right top group has hodo and time/stn panes
// right bottom contains data panes
public static final double PANE_DEF_CFG_2_LEFT_GP_WIDTH_RATIO = 0.5;
+
public static final double PANE_DEF_CFG_2_LEFT_TOP_GP_HEIGHT_RATIO = 0.8;
+
public static final double PANE_DEF_CFG_2_RIGHT_TOP_GP_HEIGHT_RATIO = 0.7;
+
public static final double PANE_DEF_CFG_2_SKEWT_WIDTH_RATIO = 0.85;
+
public static final double PANE_DEF_CFG_2_SKEWT_HEIGHT_RATIO = PANE_DEF_CFG_2_LEFT_TOP_GP_HEIGHT_RATIO;
- public static final double PANE_DEF_CFG_2_WITO_WIDTH_RATIO = 1-PANE_DEF_CFG_2_SKEWT_WIDTH_RATIO;
+
+ public static final double PANE_DEF_CFG_2_WITO_WIDTH_RATIO = 1 - PANE_DEF_CFG_2_SKEWT_WIDTH_RATIO;
+
public static final double PANE_DEF_CFG_2_WITO_HEIGHT_RATIO = PANE_DEF_CFG_2_SKEWT_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_2_HODO_WIDTH_RATIO = 0.65;
+
public static final double PANE_DEF_CFG_2_HODO_HEIGHT_RATIO = PANE_DEF_CFG_2_RIGHT_TOP_GP_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_2_INSET_WIDTH_RATIO = 1;
- public static final double PANE_DEF_CFG_2_INSET_HEIGHT_RATIO = 1-PANE_DEF_CFG_2_SKEWT_HEIGHT_RATIO;
+
+ public static final double PANE_DEF_CFG_2_INSET_HEIGHT_RATIO = 1 - PANE_DEF_CFG_2_SKEWT_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_2_TIMESTN_WIDTH_RATIO = 0.35;
+
public static final double PANE_DEF_CFG_2_TIMESTN_HEIGHT_RATIO = PANE_DEF_CFG_2_HODO_HEIGHT_RATIO;
+
public static final double PANE_DEF_CFG_2_DATA_WIDTH_RATIO = 1;
- public static final double PANE_DEF_CFG_2_DATA_HEIGHT_RATIO = 1-PANE_DEF_CFG_2_HODO_HEIGHT_RATIO;
-
- // pane SPC wide screen configuration
- public static final double PANE_SPCWS_CFG_TOP_GP_HEIGHT_RATIO = 0.714; //5/7
- public static final double PANE_SPCWS_CFG_BOT_GP_HEIGHT_RATIO = 1-PANE_SPCWS_CFG_TOP_GP_HEIGHT_RATIO;
- //skewt, wito, hodo/inset (hodo stack on inset) panes are located on top group
- public static final double PANE_SPCWS_CFG_SKEWT_WIDTH_RATIO = 0.4938;//5/10.125;
+
+ public static final double PANE_DEF_CFG_2_DATA_HEIGHT_RATIO = 1 - PANE_DEF_CFG_2_HODO_HEIGHT_RATIO;
+
+ // pane SPC wide screen configuration
+ public static final double PANE_SPCWS_CFG_TOP_GP_HEIGHT_RATIO = 0.714; // 5/7
+
+ public static final double PANE_SPCWS_CFG_BOT_GP_HEIGHT_RATIO = 1 - PANE_SPCWS_CFG_TOP_GP_HEIGHT_RATIO;
+
+ // skewt, wito, hodo/inset (hodo stack on inset) panes are located on top
+ // group
+ public static final double PANE_SPCWS_CFG_SKEWT_WIDTH_RATIO = 0.4938;// 5/10.125;
+
public static final double PANE_SPCWS_CFG_SKEWT_HEIGHT_RATIO = 1;
- public static final double PANE_SPCWS_CFG_WITO_WIDTH_RATIO = 0.1111;//1.125/10.125;
+
+ public static final double PANE_SPCWS_CFG_WITO_WIDTH_RATIO = 0.1111;// 1.125/10.125;
+
public static final double PANE_SPCWS_CFG_WITO_HEIGHT_RATIO = 1;
- public static final double PANE_SPCWS_CFG_HODO_WIDTH_RATIO = 1- PANE_SPCWS_CFG_SKEWT_WIDTH_RATIO-PANE_SPCWS_CFG_WITO_WIDTH_RATIO;
- public static final double PANE_SPCWS_CFG_HODO_HEIGHT_RATIO = 0.825;//4.125/5;
+
+ public static final double PANE_SPCWS_CFG_HODO_WIDTH_RATIO = 1
+ - PANE_SPCWS_CFG_SKEWT_WIDTH_RATIO
+ - PANE_SPCWS_CFG_WITO_WIDTH_RATIO;
+
+ public static final double PANE_SPCWS_CFG_HODO_HEIGHT_RATIO = 0.825;// 4.125/5;
+
public static final double PANE_SPCWS_CFG_INSET_WIDTH_RATIO = PANE_SPCWS_CFG_HODO_WIDTH_RATIO;
- public static final double PANE_SPCWS_CFG_INSET_HEIGHT_RATIO = 1- PANE_SPCWS_CFG_HODO_HEIGHT_RATIO;
- //data and other graphs panes are located on bottom group
+
+ public static final double PANE_SPCWS_CFG_INSET_HEIGHT_RATIO = 1 - PANE_SPCWS_CFG_HODO_HEIGHT_RATIO;
+
+ // data and other graphs panes are located on bottom group
public static final double PANE_SPCWS_CFG_DATA_WIDTH_RATIO = 0.5;
+
public static final double PANE_SPCWS_CFG_DATA_HEIGHT_RATIO = 1;
+
public static final double PANE_SPCWS_CFG_SPC_GRAPHS_WIDTH_RATIO = 0.5;
+
public static final double PANE_SPCWS_CFG_SPC_GRAPHS_HEIGHT_RATIO = 1;
- //simple D2D pane configuration.
- // full canvas consists of top and bottom group
+ // simple D2D pane configuration.
+ // full canvas consists of top and bottom group
public static final double PANE_SIMPLE_D2D_CFG_TOP_GP_HEIGHT_RATIO = 0.71;
- public static final double PANE_SIMPLE_D2D_CFG_BOT_GP_HEIGHT_RATIO = 1-PANE_SIMPLE_D2D_CFG_TOP_GP_HEIGHT_RATIO;
- // top group contains left (skewt) and right groups (time/stn stack on future pane)
+
+ public static final double PANE_SIMPLE_D2D_CFG_BOT_GP_HEIGHT_RATIO = 1 - PANE_SIMPLE_D2D_CFG_TOP_GP_HEIGHT_RATIO;
+
+ // top group contains left (skewt) and right groups (time/stn stack on
+ // future pane)
public static final double PANE_SIMPLE_D2D_CFG_SKEWT_WIDTH_RATIO = 0.75;
+
public static final double PANE_SIMPLE_D2D_CFG_SKEWT_HEIGHT_RATIO = 1;
- public static final double PANE_SIMPLE_D2D_CFG_TIMESTN_WIDTH_RATIO = 1-PANE_SIMPLE_D2D_CFG_SKEWT_WIDTH_RATIO;
- public static final double PANE_SIMPLE_D2D_CFG_TIMESTN_HEIGHT_RATIO = 0.5;
+
+ public static final double PANE_SIMPLE_D2D_CFG_TIMESTN_WIDTH_RATIO = 1 - PANE_SIMPLE_D2D_CFG_SKEWT_WIDTH_RATIO;
+
+ public static final double PANE_SIMPLE_D2D_CFG_TIMESTN_HEIGHT_RATIO = 1; // d2dlite
+
public static final double PANE_SIMPLE_D2D_CFG_FUTURE_WIDTH_RATIO = PANE_SIMPLE_D2D_CFG_TIMESTN_WIDTH_RATIO;
- public static final double PANE_SIMPLE_D2D_CFG_FUTURE_HEIGHT_RATIO = 1-PANE_SIMPLE_D2D_CFG_TIMESTN_HEIGHT_RATIO;
+
+ public static final double PANE_SIMPLE_D2D_CFG_FUTURE_HEIGHT_RATIO = 1 - PANE_SIMPLE_D2D_CFG_TIMESTN_HEIGHT_RATIO;
+
// bottom group has hodo on left and data pane on right
public static final double PANE_SIMPLE_D2D_CFG_HODO_WIDTH_RATIO = 0.34;
- public static final double PANE_SIMPLE_D2D_CFG_HODO_HEIGHT_RATIO = 1;
- public static final double PANE_SIMPLE_D2D_CFG_DATA_WIDTH_RATIO = 1-PANE_SIMPLE_D2D_CFG_HODO_WIDTH_RATIO;
+
+ public static final double PANE_SIMPLE_D2D_CFG_HODO_HEIGHT_RATIO = 1;
+
+ public static final double PANE_SIMPLE_D2D_CFG_DATA_WIDTH_RATIO = 1 - PANE_SIMPLE_D2D_CFG_HODO_WIDTH_RATIO;
+
public static final double PANE_SIMPLE_D2D_CFG_DATA_HEIGHT_RATIO = 1;
+
+ // d2dlite start
+ // D2D lite pane configuration.
+ // full canvas consists of left (skewt) and right groups (time/stn/src)
+ // stack on data pane
+ public static final double PANE_LITE_D2D_CFG_SKEWT_WIDTH_RATIO = 0.75;
+
+ public static final double PANE_LITE_D2D_CFG_SKEWT_HEIGHT_RATIO = 1;
+
+ public static final double PANE_LITE_D2D_CFG_HODO_WIDTH_RATIO = 0.75;
+
+ public static final double PANE_LITE_D2D_CFG_HODO_HEIGHT_RATIO = 1;
+
+ public static final double PANE_LITE_D2D_CFG_TIMESTN_WIDTH_RATIO = 1 - PANE_LITE_D2D_CFG_SKEWT_WIDTH_RATIO;
+
+ public static final double PANE_LITE_D2D_CFG_TIMESTN_HEIGHT_RATIO = 0.5;
+
+ public static final double PANE_LITE_D2D_CFG_DATA_WIDTH_RATIO = PANE_LITE_D2D_CFG_TIMESTN_WIDTH_RATIO;
+
+ public static final double PANE_LITE_D2D_CFG_DATA_HEIGHT_RATIO = 1 - PANE_LITE_D2D_CFG_TIMESTN_HEIGHT_RATIO;
+
+ // d2dlite end
/***
*
* MULTIPLE PANES IMPLEMENTATIONS end
*
*
****/
-
-
- //Dialog
- //public static final int dialogX = 300;
+
+ // Dialog
+ // public static final int dialogX = 300;
public static int btnWidth = 120;
- public static int btnHeight = 20;
- public static int labelGap = 20;
- public static int btnGapX = 5;
- public static int btnGapY = 5;
- public static int listWidth = 160;
- public static int listHeight = 80;
- public static int filelistWidth = 120;
- public static int filelistHeight = 100;
- public static int dsiplayPanelSize = 2;
-
- public static int GRAPH_SKEWT = 0;
- public static int GRAPH_ICING = 1;
- public static int GRAPH_TURB = 2;
- public static int MAX_GRAPH_MODE = 3;
-
- public static int SKEWT_EDIT_MODE_EDITPOINT = 0;
- public static int SKEWT_EDIT_MODE_MOVELINE = 1;
- public static int SKEWT_EDIT_MODE_MODIFYRANGE = 2;
-
- public static String getNlistFile() {
- return NcPathManager.getInstance().getStaticFile(
- NcPathConstants.NSHARP_NLIST_FILE ).getAbsolutePath();
+
+ public static int btnHeight = 20;
+
+ public static int labelGap = 20;
+
+ public static int btnGapX = 5;
+
+ public static int btnGapY = 5;
+
+ public static int listWidth = 160;
+
+ public static int listHeight = 80;
+
+ public static int filelistWidth = 120;
+
+ public static int filelistHeight = 100;
+
+ public static int dsiplayPanelSize = 2;
+
+ public static int GRAPH_SKEWT = 0;
+
+ public static int GRAPH_HODO = 1;
+
+ public static int GRAPH_ICING = 2;
+
+ public static int GRAPH_TURB = 3;
+
+ public static int MAX_GRAPH_MODE = 4;
+
+ public static int SKEWT_EDIT_MODE_EDITPOINT = 0;
+
+ public static int SKEWT_EDIT_MODE_MOVELINE = 1;
+
+ public static int SKEWT_EDIT_MODE_MODIFYRANGE = 2;
+
+ public static String getNlistFile() {
+ return NcPathManager.getInstance()
+ .getStaticFile(NcPathConstants.NSHARP_NLIST_FILE)
+ .getAbsolutePath();
}
- public static String getSupFile() {
- return NcPathManager.getInstance().getStaticFile(
- NcPathConstants.NSHARP_SUP_FILE ).getAbsolutePath();
+
+ public static String getSupFile() {
+ return NcPathManager.getInstance()
+ .getStaticFile(NcPathConstants.NSHARP_SUP_FILE)
+ .getAbsolutePath();
}
-
- //Line configuration. Line name listing order in this array should be in order with constant defined below it.
- public static String[] lineNameArray= {"Temperature", "Dew Point", "Parcel Tv","Parcel","DCAPE","Virtual Temp","Wetbulb","Wind Barb","Overlay 1", "Overlay 2", "Compare 1", "Compare 2","Compare 3","Compare 4","Compare 5","Compare 6","Compare 7","Compare 8","Compare 9","Compare 10",
- "Icing RH", "Icing Temp", "Icing EPI", "Turbulence Ln", "Turbulence WindShear"};
- public static int LINE_TEMP = 0;
- public static int LINE_DEWP = LINE_TEMP+1;
- public static int LINE_PARCEL_TV = LINE_DEWP+1;
- public static int LINE_PARCEL = LINE_PARCEL_TV+1;
- public static int LINE_DCAPE =LINE_PARCEL+1;
- public static int LINE_VIRTUAL_TEMP =LINE_DCAPE+1;
- public static int LINE_WETBULB = LINE_VIRTUAL_TEMP+1;
- public static int LINE_WIND_BARB = LINE_WETBULB+1;
- public static int LINE_OVERLAY1 = LINE_WIND_BARB+1;
- public static int LINE_OVERLAY2= LINE_OVERLAY1+1;
- public static int LINE_COMP1 = LINE_OVERLAY2+1;
- public static int LINE_COMP2 = LINE_COMP1+1;
- public static int LINE_COMP3 = LINE_COMP2+1;
- public static int LINE_COMP4 = LINE_COMP3+1;
- public static int LINE_COMP5 = LINE_COMP4+1;
- public static int LINE_COMP6 = LINE_COMP5+1;
- public static int LINE_COMP7 = LINE_COMP6+1;
- public static int LINE_COMP8 = LINE_COMP7+1;
- public static int LINE_COMP9 = LINE_COMP8+1;
- public static int LINE_COMP10 = LINE_COMP9+1;
- public static int LINE_ICING_RH = LINE_COMP10+1;
- public static int LINE_ICING_TEMP= LINE_ICING_RH+1;
- public static int LINE_ICING_EPI= LINE_ICING_TEMP+1;
- public static int LINE_TURBULENCE_LN = LINE_ICING_EPI+1;
- public static int LINE_TURBULENCE_WS = LINE_TURBULENCE_LN+1;
-
- //defaultLineProperty should be listed in sync with lineNameArray for each line
- public static NsharpLineProperty[] defaultLineProperty =
- {
- new NsharpLineProperty(LineStyle.SOLID, 2,color_red ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_green ),
- new NsharpLineProperty(LineStyle.SHORT_DASHED, 1,color_white ),
- new NsharpLineProperty(LineStyle.DOTS, 1,color_darkorange ),
- new NsharpLineProperty(LineStyle.DOTS, 2,color_white ),
- new NsharpLineProperty(LineStyle.SHORT_DASHED, 2,color_red ),
- new NsharpLineProperty(LineStyle.SOLID, 1,wetBulbColor ),
- new NsharpLineProperty(LineStyle.SOLID, 1,color_yellow ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_red ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_green ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_red ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_green ),
- new NsharpLineProperty(LineStyle.SOLID, 2, new RGB (155, 0, 220) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (30, 144, 255) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (255, 215, 0) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (0, 255, 255) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (139, 71, 38) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (139, 0, 139) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (0, 139, 0) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (144, 238, 144) ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_green ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_red ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_magenta ),
- new NsharpLineProperty(LineStyle.SOLID, 2,color_magenta ),
- new NsharpLineProperty(LineStyle.SOLID, 2,new RGB (255, 174, 185) )
-
- };
- //data page name and its plotting function key definitions
- public final static int PAGE_SUMMARY1 = 1;
- public final static int PAGE_SUMMARY2 = 2;
- public final static int PAGE_PARCEL_DATA = 3;
- public final static int PAGE_THERMODYNAMIC_DATA = 4;
- public final static int PAGE_OPC_DATA = 5;
- public final static int PAGE_MIXING_HEIGHT = 6;
- public final static int PAGE_STORM_RELATIVE = 7;
- public final static int PAGE_MEAN_WIND = 8;
- public final static int PAGE_CONVECTIVE_INITIATION = 9;
- public final static int PAGE_SEVERE_POTENTIAL = 10;
- public final static int PAGE_MAX_NUMBER = PAGE_SEVERE_POTENTIAL;
- public static String[] PAGE_NAME_ARRAY = {
- "", //a dummy one
- "Summary 1 Page",
- "Summary 2 Page",
- "Parcel Data Page",
- "Thermodynamic Data Page",
- "Opc Low Level Stability Page",
- "Mixing Height Page",
- "Storm Relative Page",
- "Mean Wind Page",
- "Convective Initiation Page",
- "Severe Potential Page"
- };
- public enum State {
- CURRENT, ACTIVE, INACTIVE,NOTAVAIL , AVAIL, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP
- }
- //public enum LoadState { NOTAVAIL , AVAIL}
- public enum ActState {CURRENT, ACTIVE, INACTIVE}//, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP}
- public enum SPCGraph {
- EBS, STP, SHIP, WINTER, FIRE, HAIL, SARS
- }
-
+
+ // Line configuration. Line name listing order in this array should be in
+ // order with constant defined below it.
+ public static String[] lineNameArray = { "Temperature", "Dew Point",
+ "Parcel Tv", "Parcel", "DCAPE", "Virtual Temp", "Wetbulb",
+ "Wind Barb", "Overlay 1", "Overlay 2", "Compare 1", "Compare 2",
+ "Compare 3", "Compare 4", "Compare 5", "Compare 6", "Compare 7",
+ "Compare 8", "Compare 9", "Compare 10", "Icing RH", "Icing Temp",
+ "Icing EPI", "Turbulence Ln", "Turbulence WindShear" };
+
+ public static int LINE_TEMP = 0;
+
+ public static int LINE_DEWP = LINE_TEMP + 1;
+
+ public static int LINE_PARCEL_TV = LINE_DEWP + 1;
+
+ public static int LINE_PARCEL = LINE_PARCEL_TV + 1;
+
+ public static int LINE_DCAPE = LINE_PARCEL + 1;
+
+ public static int LINE_VIRTUAL_TEMP = LINE_DCAPE + 1;
+
+ public static int LINE_WETBULB = LINE_VIRTUAL_TEMP + 1;
+
+ public static int LINE_WIND_BARB = LINE_WETBULB + 1;
+
+ public static int LINE_OVERLAY1 = LINE_WIND_BARB + 1;
+
+ public static int LINE_OVERLAY2 = LINE_OVERLAY1 + 1;
+
+ public static int LINE_COMP1 = LINE_OVERLAY2 + 1;
+
+ public static int LINE_COMP2 = LINE_COMP1 + 1;
+
+ public static int LINE_COMP3 = LINE_COMP2 + 1;
+
+ public static int LINE_COMP4 = LINE_COMP3 + 1;
+
+ public static int LINE_COMP5 = LINE_COMP4 + 1;
+
+ public static int LINE_COMP6 = LINE_COMP5 + 1;
+
+ public static int LINE_COMP7 = LINE_COMP6 + 1;
+
+ public static int LINE_COMP8 = LINE_COMP7 + 1;
+
+ public static int LINE_COMP9 = LINE_COMP8 + 1;
+
+ public static int LINE_COMP10 = LINE_COMP9 + 1;
+
+ public static int LINE_ICING_RH = LINE_COMP10 + 1;
+
+ public static int LINE_ICING_TEMP = LINE_ICING_RH + 1;
+
+ public static int LINE_ICING_EPI = LINE_ICING_TEMP + 1;
+
+ public static int LINE_TURBULENCE_LN = LINE_ICING_EPI + 1;
+
+ public static int LINE_TURBULENCE_WS = LINE_TURBULENCE_LN + 1;
+
+ // defaultLineProperty should be listed in sync with lineNameArray for each
+ // line
+ public static NsharpLineProperty[] defaultLineProperty = {
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_red),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_green),
+ new NsharpLineProperty(LineStyle.SHORT_DASHED, 1, color_white),
+ new NsharpLineProperty(LineStyle.DOTS, 1, color_darkorange),
+ new NsharpLineProperty(LineStyle.DOTS, 2, color_white),
+ new NsharpLineProperty(LineStyle.SHORT_DASHED, 2, color_red),
+ new NsharpLineProperty(LineStyle.SOLID, 1, wetBulbColor),
+ new NsharpLineProperty(LineStyle.SOLID, 1, color_yellow),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_red),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_green),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_red),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_green),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(155, 0, 220)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(30, 144, 255)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(255, 215, 0)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(0, 255, 255)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(139, 71, 38)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(139, 0, 139)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(0, 139, 0)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(144, 238, 144)),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_green),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_red),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_magenta),
+ new NsharpLineProperty(LineStyle.SOLID, 2, color_magenta),
+ new NsharpLineProperty(LineStyle.SOLID, 2, new RGB(255, 174, 185))
+
+ };
+
+ // data page name and its plotting function key definitions
+ public final static int PAGE_SUMMARY1 = 1;
+
+ public final static int PAGE_SUMMARY2 = 2;
+
+ public final static int PAGE_PARCEL_DATA = 3;
+
+ public final static int PAGE_THERMODYNAMIC_DATA = 4;
+
+ public final static int PAGE_OPC_DATA = 5;
+
+ public final static int PAGE_MIXING_HEIGHT = 6;
+
+ public final static int PAGE_STORM_RELATIVE = 7;
+
+ public final static int PAGE_MEAN_WIND = 8;
+
+ public final static int PAGE_CONVECTIVE_INITIATION = 9;
+
+ public final static int PAGE_SEVERE_POTENTIAL = 10;
+
+ public final static int PAGE_D2DLITE = 11; // d2dlite
+
+ public final static int PAGE_FUTURE = 12; // d2dlite, a dummy page, for when
+ // showing 2 pages per time
+
+ public final static int PAGE_MAX_NUMBER = PAGE_FUTURE;
+
+ public static String[] PAGE_NAME_ARRAY = {
+ "", // a dummy one
+ "Summary 1 Page", "Summary 2 Page", "Parcel Data Page",
+ "Thermodynamic Data Page", "Opc Low Level Stability Page",
+ "Mixing Height Page", "Storm Relative Page", "Mean Wind Page",
+ "Convective Initiation Page", "Severe Potential Page",
+ "D2D Lite Page", "future page" };
+
+ public enum State {
+ CURRENT, ACTIVE, INACTIVE, NOTAVAIL, AVAIL, ACTIVE_SRC_COMP, INACTIVE_SRC_COMP, ACTIVE_TM_COMP, INACTIVE_TM_COMP
+ }
+
+ // public enum LoadState { NOTAVAIL , AVAIL}
+ public enum ActState {
+ CURRENT, ACTIVE, INACTIVE
+ }// , ACTIVE_SRC_COMP, INACTIVE_SRC_COMP,ACTIVE_TM_COMP, INACTIVE_TM_COMP}
+
+ public enum SPCGraph {
+ EBS, STP, SHIP, WINTER, FIRE, HAIL, SARS
+ }
+
+ public static final int MAX_SOUNDING_SOURCE_STR_LENGTH = 8;
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpDataPageProperty.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpDataPageProperty.java
index ca5523c036..d8f0ba68eb 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpDataPageProperty.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpDataPageProperty.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp;
+
/**
*
* gov.noaa.nws.ncep.ui.nsharp.NsharpDataPageProperty
@@ -24,128 +25,153 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
+
@XmlRootElement(name = "NsharpDataPageProperty")
@XmlAccessorType(XmlAccessType.NONE)
-public class NsharpDataPageProperty implements ISerializableObject{
- @XmlAttribute
- private int summary1Page=NsharpConstants.PAGE_SUMMARY1;
-
- @XmlAttribute
- private int summary2Page=NsharpConstants.PAGE_SUMMARY2;
+public class NsharpDataPageProperty implements ISerializableObject {
+ @XmlAttribute
+ private int summary1Page = NsharpConstants.PAGE_SUMMARY1;
- @XmlAttribute
- private int parcelDataPage=NsharpConstants.PAGE_PARCEL_DATA;
-
- @XmlAttribute
- private int thermodynamicDataPage=NsharpConstants.PAGE_THERMODYNAMIC_DATA;
-
- @XmlAttribute
- private int opcDataPage=NsharpConstants.PAGE_OPC_DATA;
-
- @XmlAttribute
- private int mixingHeightPage=NsharpConstants.PAGE_MIXING_HEIGHT;
-
- @XmlAttribute
- private int stormRelativePage=NsharpConstants.PAGE_STORM_RELATIVE;
-
- @XmlAttribute
- private int meanWindPage=NsharpConstants.PAGE_MEAN_WIND;
-
- @XmlAttribute
- private int convectiveInitiationPage=NsharpConstants.PAGE_CONVECTIVE_INITIATION;
-
- @XmlAttribute
- private int severePotentialPage=NsharpConstants.PAGE_SEVERE_POTENTIAL;
+ @XmlAttribute
+ private int summary2Page = NsharpConstants.PAGE_SUMMARY2;
- @XmlAttribute
- private int numberPagePerDisplay = 1;
-
- public int getSummary1Page() {
- return summary1Page;
- }
+ @XmlAttribute
+ private int parcelDataPage = NsharpConstants.PAGE_PARCEL_DATA;
- public void setSummary1Page(int summary1Page) {
- this.summary1Page = summary1Page;
- }
+ @XmlAttribute
+ private int thermodynamicDataPage = NsharpConstants.PAGE_THERMODYNAMIC_DATA;
- public int getSummary2Page() {
- return summary2Page;
- }
+ @XmlAttribute
+ private int opcDataPage = NsharpConstants.PAGE_OPC_DATA;
- public void setSummary2Page(int summary2Page) {
- this.summary2Page = summary2Page;
- }
+ @XmlAttribute
+ private int mixingHeightPage = NsharpConstants.PAGE_MIXING_HEIGHT;
- public int getParcelDataPage() {
- return parcelDataPage;
- }
+ @XmlAttribute
+ private int stormRelativePage = NsharpConstants.PAGE_STORM_RELATIVE;
- public void setParcelDataPage(int parcelDataPage) {
- this.parcelDataPage = parcelDataPage;
- }
+ @XmlAttribute
+ private int meanWindPage = NsharpConstants.PAGE_MEAN_WIND;
- public int getThermodynamicDataPage() {
- return thermodynamicDataPage;
- }
+ @XmlAttribute
+ private int convectiveInitiationPage = NsharpConstants.PAGE_CONVECTIVE_INITIATION;
- public void setThermodynamicDataPage(int thermodynamicDataPage) {
- this.thermodynamicDataPage = thermodynamicDataPage;
- }
+ @XmlAttribute
+ private int severePotentialPage = NsharpConstants.PAGE_SEVERE_POTENTIAL;
- public int getOpcDataPage() {
- return opcDataPage;
- }
+ // d2dlite
+ @XmlAttribute
+ private int d2dLitePage = NsharpConstants.PAGE_D2DLITE;
- public void setOpcDataPage(int opcDataPage) {
- this.opcDataPage = opcDataPage;
- }
+ // d2dlite
+ @XmlAttribute
+ private int futurePage = NsharpConstants.PAGE_FUTURE;
- public int getMixingHeightPage() {
- return mixingHeightPage;
- }
+ @XmlAttribute
+ private int numberPagePerDisplay = 1;
- public void setMixingHeightPage(int mixingHeightPage) {
- this.mixingHeightPage = mixingHeightPage;
- }
+ public int getSummary1Page() {
+ return summary1Page;
+ }
- public int getStormRelativePage() {
- return stormRelativePage;
- }
+ public void setSummary1Page(int summary1Page) {
+ this.summary1Page = summary1Page;
+ }
- public void setStormRelativePage(int stormRelativePage) {
- this.stormRelativePage = stormRelativePage;
- }
+ public int getSummary2Page() {
+ return summary2Page;
+ }
- public int getMeanWindPage() {
- return meanWindPage;
- }
+ public void setSummary2Page(int summary2Page) {
+ this.summary2Page = summary2Page;
+ }
- public void setMeanWindPage(int meanWindPage) {
- this.meanWindPage = meanWindPage;
- }
+ public int getParcelDataPage() {
+ return parcelDataPage;
+ }
- public int getConvectiveInitiationPage() {
- return convectiveInitiationPage;
- }
+ public void setParcelDataPage(int parcelDataPage) {
+ this.parcelDataPage = parcelDataPage;
+ }
- public void setConvectiveInitiationPage(int convectiveInitiationPage) {
- this.convectiveInitiationPage = convectiveInitiationPage;
- }
+ public int getThermodynamicDataPage() {
+ return thermodynamicDataPage;
+ }
- public int getSeverePotentialPage() {
- return severePotentialPage;
- }
+ public void setThermodynamicDataPage(int thermodynamicDataPage) {
+ this.thermodynamicDataPage = thermodynamicDataPage;
+ }
- public void setSeverePotentialPage(int severePotentialPage) {
- this.severePotentialPage = severePotentialPage;
- }
+ public int getOpcDataPage() {
+ return opcDataPage;
+ }
- public int getNumberPagePerDisplay() {
- return numberPagePerDisplay;
- }
+ public void setOpcDataPage(int opcDataPage) {
+ this.opcDataPage = opcDataPage;
+ }
- public void setNumberPagePerDisplay(int numberPagePerDisplay) {
- this.numberPagePerDisplay = numberPagePerDisplay;
- }
-
+ public int getMixingHeightPage() {
+ return mixingHeightPage;
+ }
+
+ public void setMixingHeightPage(int mixingHeightPage) {
+ this.mixingHeightPage = mixingHeightPage;
+ }
+
+ public int getStormRelativePage() {
+ return stormRelativePage;
+ }
+
+ public void setStormRelativePage(int stormRelativePage) {
+ this.stormRelativePage = stormRelativePage;
+ }
+
+ public int getMeanWindPage() {
+ return meanWindPage;
+ }
+
+ public void setMeanWindPage(int meanWindPage) {
+ this.meanWindPage = meanWindPage;
+ }
+
+ public int getConvectiveInitiationPage() {
+ return convectiveInitiationPage;
+ }
+
+ public void setConvectiveInitiationPage(int convectiveInitiationPage) {
+ this.convectiveInitiationPage = convectiveInitiationPage;
+ }
+
+ public int getSeverePotentialPage() {
+ return severePotentialPage;
+ }
+
+ public void setSeverePotentialPage(int severePotentialPage) {
+ this.severePotentialPage = severePotentialPage;
+ }
+
+ public int getNumberPagePerDisplay() {
+ return numberPagePerDisplay;
+ }
+
+ public void setNumberPagePerDisplay(int numberPagePerDisplay) {
+ this.numberPagePerDisplay = numberPagePerDisplay;
+ }
+
+ // d2dlite
+ public int getD2dLitePage() {
+ return d2dLitePage;
+ }
+
+ public void setD2dLitePage(int d2dLitePage) {
+ this.d2dLitePage = d2dLitePage;
+ }
+
+ public int getFuturePage() {
+ return futurePage;
+ }
+
+ public void setFuturePage(int futurePage) {
+ this.futurePage = futurePage;
+ }
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpGraphProperty.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpGraphProperty.java
index a7ac7e0f54..b8a180a2a1 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpGraphProperty.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/NsharpGraphProperty.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp;
+
/**
*
* gov.noaa.nws.ncep.ui.nsharp.NsharpGraphProperty
@@ -33,330 +34,342 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.serialization.ISerializableObject;
+
@XmlRootElement(name = "NsharpGraphProperty")
@XmlAccessorType(XmlAccessType.NONE)
-public class NsharpGraphProperty implements ISerializableObject{
- @XmlAttribute
- private boolean temp=true;
-
- @XmlAttribute
- private boolean dewp=true;
-
- @XmlAttribute
- private boolean parcelTv=true;
-
- @XmlAttribute
- private boolean parcel=true;
-
- @XmlAttribute
- private boolean dcape=true;
-
- @XmlAttribute
- private boolean VTemp=true;
-
- @XmlAttribute
- private boolean wetBulb=true;
-
- @XmlAttribute
- private boolean mixratio=false;
-
- @XmlAttribute
- private boolean dryAdiabat=true;
-
- @XmlAttribute
- private boolean moistAdiabat=false;
-
- @XmlAttribute
- private boolean effLayer=true;
-
- @XmlAttribute
- private boolean cloud=false;
-
- @XmlAttribute
- private boolean hodo=true;
-
- @XmlAttribute
- private boolean meanWind=true;
-
- @XmlAttribute
- private boolean smv3075=false;
-
- @XmlAttribute
- private boolean smv1585=false;
-
- @XmlAttribute
- private boolean smvBunkersR=true;
-
- @XmlAttribute
- private boolean smvBunkersL=true;
-
- @XmlAttribute
- private boolean omega=true;
-
- @XmlAttribute
- private boolean corfidiV=false;
-
- @XmlAttribute
- private boolean windBarb=true;
-
- @XmlAttribute
- private int windBarbDistance=NsharpConstants.WINDBARB_DISTANCE_DEFAULT;
-
- @XmlAttribute
- private int tempOffset=0;
-
- @XmlAttribute
- private String paneConfigurationName= NsharpConstants.PANE_DEF_CFG_1_STR;
-
- @XmlAttribute
- private List gribModelTypeList = new ArrayList();
-
- @XmlAttribute
- private float windBarbLineWidth=NsharpConstants.WINDBARB_WIDTH;
-
- @XmlAttribute
- private float windBarbSize=NsharpConstants.WINDBARB_SIZE;
-
- @XmlElement
+public class NsharpGraphProperty implements ISerializableObject {
+ @XmlAttribute
+ private boolean temp = true;
+
+ @XmlAttribute
+ private boolean dewp = true;
+
+ @XmlAttribute
+ private boolean parcelTv = true;
+
+ @XmlAttribute
+ private boolean parcel = true;
+
+ @XmlAttribute
+ private boolean dcape = true;
+
+ @XmlAttribute
+ private boolean VTemp = true;
+
+ @XmlAttribute
+ private boolean wetBulb = true;
+
+ @XmlAttribute
+ private boolean mixratio = false;
+
+ @XmlAttribute
+ private boolean dryAdiabat = true;
+
+ @XmlAttribute
+ private boolean moistAdiabat = false;
+
+ @XmlAttribute
+ private boolean effLayer = true;
+
+ @XmlAttribute
+ private boolean cloud = false;
+
+ @XmlAttribute
+ private boolean hodo = true;
+
+ @XmlAttribute
+ private boolean meanWind = true;
+
+ @XmlAttribute
+ private boolean smv3075 = false;
+
+ @XmlAttribute
+ private boolean smv1585 = false;
+
+ @XmlAttribute
+ private boolean smvBunkersR = true;
+
+ @XmlAttribute
+ private boolean smvBunkersL = true;
+
+ @XmlAttribute
+ private boolean omega = true;
+
+ @XmlAttribute
+ private boolean corfidiV = false;
+
+ @XmlAttribute
+ private boolean windBarb = true;
+
+ @XmlAttribute
+ private int windBarbDistance = NsharpConstants.WINDBARB_DISTANCE_DEFAULT;
+
+ @XmlAttribute
+ private int tempOffset = 0;
+
+ @XmlAttribute
+ private String paneConfigurationName = NsharpConstants.PANE_DEF_CFG_1_STR;
+
+ @XmlAttribute
+ private List gribModelTypeList = new ArrayList();
+
+ @XmlAttribute
+ private float windBarbLineWidth = NsharpConstants.WINDBARB_WIDTH;
+
+ @XmlAttribute
+ private float windBarbSize = NsharpConstants.WINDBARB_SIZE;
+
+ @XmlElement
@XmlJavaTypeAdapter(RGBColorAdapter.class)
- private RGB windBarbColor= NsharpConstants.color_yellow;
-
- @XmlAttribute
- private boolean showFilteredWindInCircle=false;
-
- public boolean isTemp() {
- return temp;
- }
+ private RGB windBarbColor = NsharpConstants.color_yellow;
- public void setTemp(boolean temp) {
- this.temp = temp;
- }
+ @XmlAttribute
+ private boolean showFilteredWindInCircle = false;
- public boolean isDewp() {
- return dewp;
- }
+ @XmlAttribute
+ private int sndCompRadius = 0; // FixMark:nearByStnCompSnd
- public void setDewp(boolean dewp) {
- this.dewp = dewp;
- }
+ public boolean isTemp() {
+ return temp;
+ }
-
- public boolean isParcelTv() {
- return parcelTv;
- }
+ public void setTemp(boolean temp) {
+ this.temp = temp;
+ }
- public void setParcelTv(boolean parcelTv) {
- this.parcelTv = parcelTv;
- }
+ public boolean isDewp() {
+ return dewp;
+ }
- public boolean isParcel() {
- return parcel;
- }
+ public void setDewp(boolean dewp) {
+ this.dewp = dewp;
+ }
- public void setParcel(boolean parcel) {
- this.parcel = parcel;
- }
+ public boolean isParcelTv() {
+ return parcelTv;
+ }
- public boolean isDcape() {
- return dcape;
- }
+ public void setParcelTv(boolean parcelTv) {
+ this.parcelTv = parcelTv;
+ }
- public void setDcape(boolean dcape) {
- this.dcape = dcape;
- }
+ public boolean isParcel() {
+ return parcel;
+ }
- public boolean isVTemp() {
- return VTemp;
- }
+ public void setParcel(boolean parcel) {
+ this.parcel = parcel;
+ }
- public void setVTemp(boolean vTemp) {
- VTemp = vTemp;
- }
+ public boolean isDcape() {
+ return dcape;
+ }
- public boolean isWetBulb() {
- return wetBulb;
- }
+ public void setDcape(boolean dcape) {
+ this.dcape = dcape;
+ }
- public void setWetBulb(boolean wetBulb) {
- this.wetBulb = wetBulb;
- }
+ public boolean isVTemp() {
+ return VTemp;
+ }
- public boolean isMixratio() {
- return mixratio;
- }
+ public void setVTemp(boolean vTemp) {
+ VTemp = vTemp;
+ }
- public void setMixratio(boolean mixratio) {
- this.mixratio = mixratio;
- }
+ public boolean isWetBulb() {
+ return wetBulb;
+ }
- public boolean isDryAdiabat() {
- return dryAdiabat;
- }
+ public void setWetBulb(boolean wetBulb) {
+ this.wetBulb = wetBulb;
+ }
- public void setDryAdiabat(boolean dryAdiabat) {
- this.dryAdiabat = dryAdiabat;
- }
+ public boolean isMixratio() {
+ return mixratio;
+ }
- public boolean isMoistAdiabat() {
- return moistAdiabat;
- }
+ public void setMixratio(boolean mixratio) {
+ this.mixratio = mixratio;
+ }
- public void setMoistAdiabat(boolean moistAdiabat) {
- this.moistAdiabat = moistAdiabat;
- }
+ public boolean isDryAdiabat() {
+ return dryAdiabat;
+ }
- public boolean isEffLayer() {
- return effLayer;
- }
+ public void setDryAdiabat(boolean dryAdiabat) {
+ this.dryAdiabat = dryAdiabat;
+ }
- public void setEffLayer(boolean effLayer) {
- this.effLayer = effLayer;
- }
+ public boolean isMoistAdiabat() {
+ return moistAdiabat;
+ }
- public boolean isCloud() {
- return cloud;
- }
+ public void setMoistAdiabat(boolean moistAdiabat) {
+ this.moistAdiabat = moistAdiabat;
+ }
- public void setCloud(boolean cloud) {
- this.cloud = cloud;
- }
+ public boolean isEffLayer() {
+ return effLayer;
+ }
- public boolean isHodo() {
- return hodo;
- }
+ public void setEffLayer(boolean effLayer) {
+ this.effLayer = effLayer;
+ }
- public void setHodo(boolean hodo) {
- this.hodo = hodo;
- }
+ public boolean isCloud() {
+ return cloud;
+ }
- public boolean isMeanWind() {
- return meanWind;
- }
+ public void setCloud(boolean cloud) {
+ this.cloud = cloud;
+ }
- public void setMeanWind(boolean meanWind) {
- this.meanWind = meanWind;
- }
+ public boolean isHodo() {
+ return hodo;
+ }
- public boolean isSmv3075() {
- return smv3075;
- }
+ public void setHodo(boolean hodo) {
+ this.hodo = hodo;
+ }
- public void setSmv3075(boolean smv3075) {
- this.smv3075 = smv3075;
- }
+ public boolean isMeanWind() {
+ return meanWind;
+ }
- public boolean isSmv1585() {
- return smv1585;
- }
+ public void setMeanWind(boolean meanWind) {
+ this.meanWind = meanWind;
+ }
- public void setSmv1585(boolean smv1585) {
- this.smv1585 = smv1585;
- }
+ public boolean isSmv3075() {
+ return smv3075;
+ }
- public boolean isSmvBunkersR() {
- return smvBunkersR;
- }
+ public void setSmv3075(boolean smv3075) {
+ this.smv3075 = smv3075;
+ }
- public void setSmvBunkersR(boolean smvBunkersR) {
- this.smvBunkersR = smvBunkersR;
- }
+ public boolean isSmv1585() {
+ return smv1585;
+ }
- public boolean isSmvBunkersL() {
- return smvBunkersL;
- }
+ public void setSmv1585(boolean smv1585) {
+ this.smv1585 = smv1585;
+ }
- public void setSmvBunkersL(boolean smvBunkersL) {
- this.smvBunkersL = smvBunkersL;
- }
+ public boolean isSmvBunkersR() {
+ return smvBunkersR;
+ }
- public boolean isOmega() {
- return omega;
- }
+ public void setSmvBunkersR(boolean smvBunkersR) {
+ this.smvBunkersR = smvBunkersR;
+ }
- public void setOmega(boolean omega) {
- this.omega = omega;
- }
+ public boolean isSmvBunkersL() {
+ return smvBunkersL;
+ }
+ public void setSmvBunkersL(boolean smvBunkersL) {
+ this.smvBunkersL = smvBunkersL;
+ }
- public boolean isCorfidiV() {
- return corfidiV;
- }
+ public boolean isOmega() {
+ return omega;
+ }
- public void setCorfidiV(boolean corfidiV) {
- this.corfidiV = corfidiV;
- }
+ public void setOmega(boolean omega) {
+ this.omega = omega;
+ }
- public boolean isWindBarb() {
- return windBarb;
- }
+ public boolean isCorfidiV() {
+ return corfidiV;
+ }
- public void setWindBarb(boolean windBarb) {
- this.windBarb = windBarb;
- }
+ public void setCorfidiV(boolean corfidiV) {
+ this.corfidiV = corfidiV;
+ }
- public int getWindBarbDistance() {
- return windBarbDistance;
- }
+ public boolean isWindBarb() {
+ return windBarb;
+ }
- public void setWindBarbDistance(int windBarbDistance) {
- this.windBarbDistance = windBarbDistance;
- }
+ public void setWindBarb(boolean windBarb) {
+ this.windBarb = windBarb;
+ }
- public int getTempOffset() {
- return tempOffset;
- }
+ public int getWindBarbDistance() {
+ return windBarbDistance;
+ }
- public void setTempOffset(int tempOffset) {
- this.tempOffset = tempOffset;
- }
+ public void setWindBarbDistance(int windBarbDistance) {
+ this.windBarbDistance = windBarbDistance;
+ }
- public String getPaneConfigurationName() {
- return paneConfigurationName;
- }
+ public int getTempOffset() {
+ return tempOffset;
+ }
- public void setPaneConfigurationName(String paneConfigurationName) {
- this.paneConfigurationName = paneConfigurationName;
- }
+ public void setTempOffset(int tempOffset) {
+ this.tempOffset = tempOffset;
+ }
- public List getGribModelTypeList() {
- return gribModelTypeList;
- }
+ // FixMark:nearByStnCompSnd
+ public int getSndCompRadius() {
+ return sndCompRadius;
+ }
- public void setGribModelTypeList(List gribModelTypeList) {
- this.gribModelTypeList = gribModelTypeList;
- }
+ public void setSndCompRadius(int sndCompRadius) {
+ this.sndCompRadius = sndCompRadius;
+ }
- public float getWindBarbLineWidth() {
- return windBarbLineWidth;
- }
+ // end FixMark:nearByStnCompSnd
- public void setWindBarbLineWidth(float windBarbLineWidth) {
- this.windBarbLineWidth = windBarbLineWidth;
- }
+ public String getPaneConfigurationName() {
+ return paneConfigurationName;
+ }
- public float getWindBarbSize() {
- return windBarbSize;
- }
+ public void setPaneConfigurationName(String paneConfigurationName) {
+ this.paneConfigurationName = paneConfigurationName;
+ }
- public void setWindBarbSize(float windBarbSize) {
- this.windBarbSize = windBarbSize;
- }
+ public List getGribModelTypeList() {
+ return gribModelTypeList;
+ }
- public RGB getWindBarbColor() {
- return windBarbColor;
- }
+ public void setGribModelTypeList(List gribModelTypeList) {
+ this.gribModelTypeList = gribModelTypeList;
+ }
- public void setWindBarbColor(RGB windBarbColor) {
- this.windBarbColor = windBarbColor;
- }
+ public float getWindBarbLineWidth() {
+ return windBarbLineWidth;
+ }
- public boolean isShowFilteredWindInCircle() {
- return showFilteredWindInCircle;
- }
+ public void setWindBarbLineWidth(float windBarbLineWidth) {
+ this.windBarbLineWidth = windBarbLineWidth;
+ }
- public void setShowFilteredWindInCircle(boolean showFilteredWindInCircle) {
- this.showFilteredWindInCircle = showFilteredWindInCircle;
- }
+ public float getWindBarbSize() {
+ return windBarbSize;
+ }
+
+ public void setWindBarbSize(float windBarbSize) {
+ this.windBarbSize = windBarbSize;
+ }
+
+ public RGB getWindBarbColor() {
+ return windBarbColor;
+ }
+
+ public void setWindBarbColor(RGB windBarbColor) {
+ this.windBarbColor = windBarbColor;
+ }
+
+ public boolean isShowFilteredWindInCircle() {
+ return showFilteredWindInCircle;
+ }
+
+ public void setShowFilteredWindInCircle(boolean showFilteredWindInCircle) {
+ this.showFilteredWindInCircle = showFilteredWindInCircle;
+ }
-
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java
index ddd2344e6e..6710f89e08 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/background/NsharpIcingPaneBackground.java
@@ -43,347 +43,408 @@ import com.raytheon.viz.core.graphing.WGraphics;
import com.vividsolutions.jts.geom.Coordinate;
public class NsharpIcingPaneBackground extends NsharpGenericPaneBackground {
- //private NsharpSkewTPaneDescriptor desc;
-
- private IWireframeShape linesNumbersShape;
- private IWireframeShape RHLabelShape;
- private IWireframeShape tempLabelShape;
- private IWireframeShape EPILabelShape;//Equivalent Potential Instability
- private double currentZoomLevel=1;
- private final float defaultLabelSpace = 50;
- private float labelSpace = defaultLabelSpace;
- private int iceXOrig=NsharpConstants.ICING_X_ORIG;
- private int iceYOrig=NsharpConstants.ICING_Y_ORIG+(int)labelSpace;
- private int iceXEnd=NsharpConstants.ICING_X_END;
- private int iceWidth=NsharpConstants.ICING_WIDTH;
- private int iceYEnd=iceYOrig+NsharpConstants.ICING_HEIGHT;
- private int paneHeight = NsharpConstants.SKEWT_HEIGHT;
- private float yMagFactor=1;
- private float xMagFactor=1;
- private NsharpGraphProperty graphConfigProperty;
- public NsharpIcingPaneBackground(NsharpSkewTPaneDescriptor desc) {
+ // private NsharpSkewTPaneDescriptor desc;
+
+ private IWireframeShape linesNumbersShape;
+
+ private IWireframeShape RHLabelShape;
+
+ private IWireframeShape tempLabelShape;
+
+ private IWireframeShape EPILabelShape;// Equivalent Potential Instability
+
+ private double currentZoomLevel = 1;
+
+ private final float defaultLabelSpace = 50;
+
+ private float labelSpace = defaultLabelSpace;
+
+ private int iceXOrig = NsharpConstants.ICING_X_ORIG;
+
+ private int iceYOrig = NsharpConstants.ICING_Y_ORIG + (int) labelSpace;
+
+ private int iceXEnd = NsharpConstants.ICING_X_END;
+
+ private int iceWidth = NsharpConstants.ICING_WIDTH;
+
+ private int iceYEnd = iceYOrig + NsharpConstants.ICING_HEIGHT;
+
+ private int paneHeight = NsharpConstants.SKEWT_HEIGHT;
+
+ private float yMagFactor = 1;
+
+ private float xMagFactor = 1;
+
+ private NsharpGraphProperty graphConfigProperty;
+
+ public NsharpIcingPaneBackground(NsharpSkewTPaneDescriptor desc) {
super();
- this.rectangle = new Rectangle(iceXOrig, iceYOrig,
- iceWidth, NsharpConstants.ICING_HEIGHT);
+ this.rectangle = new Rectangle(iceXOrig, iceYOrig, iceWidth,
+ NsharpConstants.ICING_HEIGHT);
pe = new PixelExtent(this.rectangle);
world = new WGraphics(this.rectangle);
NsharpConfigManager configMgr = NsharpConfigManager.getInstance();
- graphConfigProperty = configMgr.retrieveNsharpConfigStoreFromFs().getGraphProperty();
- //System.out.println("NsharpIcingPaneBackground created");
+ graphConfigProperty = configMgr.retrieveNsharpConfigStoreFromFs()
+ .getGraphProperty();
+ // System.out.println("NsharpIcingPaneBackground created");
this.desc = desc;
}
-
-
- @Override
- protected WGraphics computeWorld() {
- // TODO Auto-generated method stub
- return null;
- }
- private void createAllShapes(){
- IExtent ext = desc.getRenderableDisplay().getExtent();
- double xmin = ext.getMinX(); //Extent's viewable envelope min x and y
- double ymax = ext.getMaxY();
+ @Override
+ protected WGraphics computeWorld() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private void createAllShapes() {
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ double xmin = ext.getMinX(); // Extent's viewable envelope min x and y
+ double ymax = ext.getMaxY();
double ymin = ext.getMinY();
- double dispX,pX=0;
- double dispY, pY=0;
+ double dispX, pX = 0;
+ double dispY, pY = 0;
String s = "";
- linesNumbersShape = target.createWireframeShape(false,desc );
- tempLabelShape = target.createWireframeShape(false,desc );
- RHLabelShape = target.createWireframeShape(false,desc );
- EPILabelShape = target.createWireframeShape(false,desc );
+ linesNumbersShape = target.createWireframeShape(false, desc);
+ tempLabelShape = target.createWireframeShape(false, desc);
+ RHLabelShape = target.createWireframeShape(false, desc);
+ EPILabelShape = target.createWireframeShape(false, desc);
linesNumbersShape.allocate(100);
tempLabelShape.allocate(20);
RHLabelShape.allocate(20);
EPILabelShape.allocate(4);
- //set world based on pressure/RH
- world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
- NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
- pX= world.mapX( NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT);
- if(pX < xmin)
- dispX = xmin + 20 * currentZoomLevel*xMagFactor;
+ // set world based on pressure/RH
+ world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
+ NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
+ pX = world.mapX(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT);
+ if (pX < xmin)
+ dispX = xmin + 20 * currentZoomLevel * xMagFactor;
else
- dispX = pX + 20 * currentZoomLevel*xMagFactor;
-
- //pressure lines and labels
- for (double i = NsharpConstants.ICING_PRESSURE_LEVEL_TOP; i <= NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM; i=i+ NsharpConstants.ICING_PRESSURE_LEVEL_INC) {
- //Pressure lines
- double [][] lines = {{iceXOrig, world.mapY(toLogScale(i))},{iceXEnd, world.mapY(toLogScale(i))}};
- linesNumbersShape.addLineSegment(lines);
- s = NsharpConstants.pressFormat.format(i);
- //pressure labels
- dispY = world.mapY(toLogScale(i))+5;
- double [] lblXy = {dispX,dispY};
- linesNumbersShape.addLabel(s, lblXy);
+ dispX = pX + 20 * currentZoomLevel * xMagFactor;
+
+ // pressure lines and labels
+ for (double i = NsharpConstants.ICING_PRESSURE_LEVEL_TOP; i <= NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM; i = i
+ + NsharpConstants.ICING_PRESSURE_LEVEL_INC) {
+ // Pressure lines
+ double[][] lines = { { iceXOrig, world.mapY(toLogScale(i)) },
+ { iceXEnd, world.mapY(toLogScale(i)) } };
+ linesNumbersShape.addLineSegment(lines);
+ s = NsharpConstants.pressFormat.format(i);
+ // pressure labels
+ dispY = world.mapY(toLogScale(i)) + 5;
+ double[] lblXy = { dispX, dispY };
+ linesNumbersShape.addLabel(s, lblXy);
}
- //RHLabel
- //double [] lblRhXy = {iceXOrig+ iceWidth/2, iceYOrig-45};
- //RHLabelShape.addLabel("*****ICING Display*****", lblRhXy);
- double [] lblRhXy1 = {iceXOrig+iceWidth/2,iceYOrig-35*yMagFactor};
- RHLabelShape.addLabel("*****ICING Display***** RELATIVE HUMIDITY", lblRhXy1);
- double [][] lineRH = {{0,0},{0,0}};
- RHLabelShape.addLineSegment(lineRH);//add dummy line
- pY = world.mapY(toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP));
- if(ymin < pY)
- dispY = pY + 20 * currentZoomLevel*yMagFactor;
- else
- dispY = ymin + 20 * currentZoomLevel*yMagFactor;
- for (double i = NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT; i <= NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT; i= i+NsharpConstants.ICING_RELATIVE_HUMIDITY_INC) {
- // temperature/humidity vertical lines
- double [][] lines = {{world.mapX(i), iceYOrig},{world.mapX(i), iceYEnd}};
- linesNumbersShape.addLineSegment(lines);
- //RH label
- s = NsharpConstants.pressFormat.format(i);
-
- double [] lblXy = {world.mapX(i), dispY};
- RHLabelShape.addLabel(s, lblXy);
+ // RHLabel
+ // double [] lblRhXy = {iceXOrig+ iceWidth/2, iceYOrig-45};
+ // RHLabelShape.addLabel("*****ICING Display*****", lblRhXy);
+ double[] lblRhXy1 = { iceXOrig + iceWidth / 2,
+ iceYOrig - 35 * yMagFactor };
+ RHLabelShape.addLabel("*****ICING Display***** RELATIVE HUMIDITY",
+ lblRhXy1);
+ double[][] lineRH = { { 0, 0 }, { 0, 0 } };
+ RHLabelShape.addLineSegment(lineRH);// add dummy line
+ pY = world.mapY(toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP));
+ if (ymin < pY)
+ dispY = pY + 20 * currentZoomLevel * yMagFactor;
+ else
+ dispY = ymin + 20 * currentZoomLevel * yMagFactor;
+ for (double i = NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT; i <= NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT; i = i
+ + NsharpConstants.ICING_RELATIVE_HUMIDITY_INC) {
+ // temperature/humidity vertical lines
+ double[][] lines = { { world.mapX(i), iceYOrig },
+ { world.mapX(i), iceYEnd } };
+ linesNumbersShape.addLineSegment(lines);
+ // RH label
+ s = NsharpConstants.pressFormat.format(i);
+
+ double[] lblXy = { world.mapX(i), dispY };
+ RHLabelShape.addLabel(s, lblXy);
}
- //temperature label
- double [] lblTXy = {iceXOrig+ iceWidth/2, iceYEnd+20*yMagFactor};
+ // temperature label
+ double[] lblTXy = { iceXOrig + iceWidth / 2, iceYEnd + 20 * yMagFactor };
tempLabelShape.addLabel("TEMPERATURE (C)", lblTXy);
- double [][] lineT = {{0,0},{0,0}};
- tempLabelShape.addLineSegment(lineT);//add dummy line
- //set world based on pressure/twmp
- world.setWorldCoordinates(NsharpConstants.ICING_TEMPERATURE_LEFT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
- NsharpConstants.ICING_TEMPERATURE_RIGHT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
- pY = world.mapY(toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
- if(ymax > pY)
- dispY = pY - 10 * currentZoomLevel*yMagFactor;
- else
- dispY = ymax - 10 * currentZoomLevel*yMagFactor;
- for (double i = NsharpConstants.ICING_TEMPERATURE_LEFT; i <= NsharpConstants.ICING_TEMPERATURE_RIGHT; i= i+NsharpConstants.ICING_TEMPERATURE_INC) {
- // temperature label
- s = NsharpConstants.pressFormat.format(i);
-
- double [] lblXy = {world.mapX(i),dispY};// iceYEnd+10};
- tempLabelShape.addLabel(s, lblXy);
+ double[][] lineT = { { 0, 0 }, { 0, 0 } };
+ tempLabelShape.addLineSegment(lineT);// add dummy line
+ // set world based on pressure/twmp
+ world.setWorldCoordinates(NsharpConstants.ICING_TEMPERATURE_LEFT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
+ NsharpConstants.ICING_TEMPERATURE_RIGHT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
+ pY = world
+ .mapY(toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
+ if (ymax > pY)
+ dispY = pY - 10 * currentZoomLevel * yMagFactor;
+ else
+ dispY = ymax - 10 * currentZoomLevel * yMagFactor;
+ for (double i = NsharpConstants.ICING_TEMPERATURE_LEFT; i <= NsharpConstants.ICING_TEMPERATURE_RIGHT; i = i
+ + NsharpConstants.ICING_TEMPERATURE_INC) {
+ // temperature label
+ s = NsharpConstants.pressFormat.format(i);
+
+ double[] lblXy = { world.mapX(i), dispY };// iceYEnd+10};
+ tempLabelShape.addLabel(s, lblXy);
}
- //EPI label
- double [] lblEPIXy = {iceXOrig+ iceWidth/2, iceYEnd+35*yMagFactor};
- EPILabelShape.addLabel("EQUIVALENT POTENTIAL INSTABILITY x 1E-3 K/m", lblEPIXy);
- double [][] lineE = {{0,0},{0,0}};
- EPILabelShape.addLineSegment(lineE);//add dummy line
+ // EPI label
+ double[] lblEPIXy = { iceXOrig + iceWidth / 2,
+ iceYEnd + 35 * yMagFactor };
+ EPILabelShape.addLabel("EQUIVALENT POTENTIAL INSTABILITY x 1E-3 K/m",
+ lblEPIXy);
+ double[][] lineE = { { 0, 0 }, { 0, 0 } };
+ EPILabelShape.addLineSegment(lineE);// add dummy line
linesNumbersShape.compile();
RHLabelShape.compile();
tempLabelShape.compile();
EPILabelShape.compile();
- }
- @Override
- public synchronized void initInternal(IGraphicsTarget target) {
- // TODO Auto-generated method stub
- super.initInternal(target);
- createAllShapes();
- }
+ }
- @Override
- protected void paintInternal(IGraphicsTarget target,
- PaintProperties paintProps) throws VizException {
- // TODO Auto-generated method stub
- //super.paintInternal(target, paintProps);
- target.setupClippingPlane(pe);
- target.drawRect(pe, NsharpConstants.backgroundColor, 1.0f, 1.0f);
- target.clearClippingPlane();
- double zoomLevel = paintProps.getZoomLevel();
- if(zoomLevel > 1.0f)
- zoomLevel = 1.0f;
- if(zoomLevel != currentZoomLevel)
- {
- currentZoomLevel = zoomLevel;
- if(linesNumbersShape!= null){
- linesNumbersShape.dispose();
- }
- if(RHLabelShape!= null){
- RHLabelShape.dispose();
- }
- if(tempLabelShape!= null){
- tempLabelShape.dispose();
- }
- if(EPILabelShape!= null){
- EPILabelShape.dispose();
- }
- createAllShapes();
- }
- this.smallFont.setSmoothing(false);
- this.smallFont.setScaleFont(false);
- target.drawWireframeShape(linesNumbersShape, NsharpConstants.pressureColor, 1, LineStyle.SOLID,smallFont);
- HashMap lpMap = ((NsharpSkewTPaneDescriptor)desc).getSkewtResource().getLinePropertyMap();
- if(lpMap!=null){
- NsharpLineProperty lp =lpMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_ICING_RH]);
- target.drawWireframeShape(RHLabelShape, lp.getLineColor(), 1, LineStyle.SOLID,smallFont);
- lp =lpMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_ICING_TEMP]);
- target.drawWireframeShape(tempLabelShape,lp.getLineColor(), 1, LineStyle.SOLID,smallFont);
- lp =lpMap.get(NsharpConstants.lineNameArray[NsharpConstants.LINE_ICING_EPI]);
- target.drawWireframeShape(EPILabelShape, lp.getLineColor(), 1, LineStyle.SOLID,smallFont);
- }
- else {
- target.drawWireframeShape(RHLabelShape, NsharpConstants.color_green, 1, LineStyle.SOLID,smallFont);
- target.drawWireframeShape(tempLabelShape, NsharpConstants.color_red, 1, LineStyle.SOLID,smallFont);
- target.drawWireframeShape(EPILabelShape, NsharpConstants.color_violet_red, 1, LineStyle.SOLID,smallFont);
- }
-
- }
- @Override
- public void disposeInternal() {
- // TODO Auto-generated method stub
- super.disposeInternal();
- if(linesNumbersShape!= null){
- linesNumbersShape.dispose();
- }
- if(RHLabelShape!= null){
- RHLabelShape.dispose();
- }
- if(tempLabelShape!= null){
- tempLabelShape.dispose();
- }
- if(EPILabelShape!= null){
- EPILabelShape.dispose();
- }
- }
- @Override
- public double getViewableMaxPressure(){
- IExtent ext = desc.getRenderableDisplay().getExtent();
- double ymax = ext.getMaxY();
- double xmin = ext.getMinX();
- world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
- NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
- //Coordinate c = world.unMap(xmin, ymax);
- double viewablePmax = reverseLogScale(world.unMap(xmin, ymax).y);
+ @Override
+ public synchronized void initInternal(IGraphicsTarget target) {
+ // TODO Auto-generated method stub
+ super.initInternal(target);
+ createAllShapes();
+ }
+
+ @Override
+ protected void paintInternal(IGraphicsTarget target,
+ PaintProperties paintProps) throws VizException {
+ // TODO Auto-generated method stub
+ // super.paintInternal(target, paintProps);
+ target.setupClippingPlane(pe);
+ target.drawRect(pe, NsharpConstants.backgroundColor, 1.0f, 1.0f);
+ target.clearClippingPlane();
+ double zoomLevel = paintProps.getZoomLevel();
+ if (zoomLevel > 1.0f)
+ zoomLevel = 1.0f;
+ if (zoomLevel != currentZoomLevel) {
+ currentZoomLevel = zoomLevel;
+ if (linesNumbersShape != null) {
+ linesNumbersShape.dispose();
+ }
+ if (RHLabelShape != null) {
+ RHLabelShape.dispose();
+ }
+ if (tempLabelShape != null) {
+ tempLabelShape.dispose();
+ }
+ if (EPILabelShape != null) {
+ EPILabelShape.dispose();
+ }
+ createAllShapes();
+ }
+ this.smallFont.setSmoothing(false);
+ this.smallFont.setScaleFont(false);
+ target.drawWireframeShape(linesNumbersShape,
+ NsharpConstants.pressureColor, 1, LineStyle.SOLID, smallFont);
+ HashMap lpMap = ((NsharpSkewTPaneDescriptor) desc)
+ .getSkewtResource().getLinePropertyMap();
+ if (lpMap != null) {
+ NsharpLineProperty lp = lpMap
+ .get(NsharpConstants.lineNameArray[NsharpConstants.LINE_ICING_RH]);
+ target.drawWireframeShape(RHLabelShape, lp.getLineColor(), 1,
+ LineStyle.SOLID, smallFont);
+ lp = lpMap
+ .get(NsharpConstants.lineNameArray[NsharpConstants.LINE_ICING_TEMP]);
+ target.drawWireframeShape(tempLabelShape, lp.getLineColor(), 1,
+ LineStyle.SOLID, smallFont);
+ lp = lpMap
+ .get(NsharpConstants.lineNameArray[NsharpConstants.LINE_ICING_EPI]);
+ target.drawWireframeShape(EPILabelShape, lp.getLineColor(), 1,
+ LineStyle.SOLID, smallFont);
+ } else {
+ target.drawWireframeShape(RHLabelShape,
+ NsharpConstants.color_green, 1, LineStyle.SOLID, smallFont);
+ target.drawWireframeShape(tempLabelShape,
+ NsharpConstants.color_red, 1, LineStyle.SOLID, smallFont);
+ target.drawWireframeShape(EPILabelShape,
+ NsharpConstants.color_violet_red, 1, LineStyle.SOLID,
+ smallFont);
+ }
+
+ }
+
+ @Override
+ public void disposeInternal() {
+ // TODO Auto-generated method stub
+ super.disposeInternal();
+ if (linesNumbersShape != null) {
+ linesNumbersShape.dispose();
+ }
+ if (RHLabelShape != null) {
+ RHLabelShape.dispose();
+ }
+ if (tempLabelShape != null) {
+ tempLabelShape.dispose();
+ }
+ if (EPILabelShape != null) {
+ EPILabelShape.dispose();
+ }
+ }
+
+ @Override
+ public double getViewableMaxPressure() {
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ double ymax = ext.getMaxY();
+ double xmin = ext.getMinX();
+ world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
+ NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
+ // Coordinate c = world.unMap(xmin, ymax);
+ double viewablePmax = reverseLogScale(world.unMap(xmin, ymax).y);
return viewablePmax;
}
+
@Override
- public double getViewableMinPressure(){
- IExtent ext = desc.getRenderableDisplay().getExtent();
- double ymin = ext.getMinY();
- double xmin = ext.getMinX();
- world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
- NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
+ public double getViewableMinPressure() {
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ double ymin = ext.getMinY();
+ double xmin = ext.getMinX();
+ world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
+ NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
double viewablePmin = reverseLogScale(world.unMap(xmin, ymin).y);
return viewablePmin;
}
+
@Override
- public double getYPositionRatioByPressure(double pressure){
- double pY= world.mapY(toLogScale(pressure));
- IExtent ext = desc.getRenderableDisplay().getExtent();
- double ymin = ext.getMinY();
- double ymax = ext.getMaxY();
- double ratio = (pY-ymin) / (ymax-ymin);
- //System.out.println("ratio="+ratio+ "rtP="+rtP+" maxP="+maxP+" minP="+minP);
+ public double getYPositionRatioByPressure(double pressure) {
+ double pY = world.mapY(toLogScale(pressure));
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ double ymin = ext.getMinY();
+ double ymax = ext.getMaxY();
+ double ratio = (pY - ymin) / (ymax - ymin);
+ // System.out.println("ratio="+ratio+
+ // "rtP="+rtP+" maxP="+maxP+" minP="+minP);
return ratio;
}
+
@Override
- public ViewablePressureContainer getViewablePressureLinesContainer(){
- ViewablePressureContainer vpc = new ViewablePressureContainer();
- IExtent ext = desc.getRenderableDisplay().getExtent();
- float ymax = (float)ext.getMaxY();
- float ymin =(float) ext.getMinY();
- double vPmax = getViewableMaxPressure();
- double vPmin = getViewableMinPressure();
- vpc.maxVIewablePressure = (float)vPmax;
- vpc.minVIewablePressure = (float)vPmin;
- for (float pressure = 300; pressure <= 1000;pressure= pressure+100) {
- if(pressure >= vPmin &&pressure <= vPmax){
- double pY= world.mapY(toLogScale(pressure));
- float ratio = (float) (pY-ymin) / (ymax-ymin);
- vpc.pyMap.put(pressure, ratio);
- //System.out.println("Icing press="+pressure+" ratio="+ratio+ " pY="+pY+" maxPy="+ymax+" minPy="+ymin);
- }
- }
- return vpc;
+ public ViewablePressureContainer getViewablePressureLinesContainer() {
+ ViewablePressureContainer vpc = new ViewablePressureContainer();
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ float ymax = (float) ext.getMaxY();
+ float ymin = (float) ext.getMinY();
+ double vPmax = getViewableMaxPressure();
+ double vPmin = getViewableMinPressure();
+ vpc.maxVIewablePressure = (float) vPmax;
+ vpc.minVIewablePressure = (float) vPmin;
+ for (float pressure = 300; pressure <= 1000; pressure = pressure + 100) {
+ if (pressure >= vPmin && pressure <= vPmax) {
+ double pY = world.mapY(toLogScale(pressure));
+ float ratio = (float) (pY - ymin) / (ymax - ymin);
+ vpc.pyMap.put(pressure, ratio);
+ // System.out.println("Icing press="+pressure+" ratio="+ratio+
+ // " pY="+pY+" maxPy="+ymax+" minPy="+ymin);
+ }
+ }
+ return vpc;
}
+
@Override
- public ViewablePressureContainer getViewablePressureContainer(List soundingLys){
- world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
- NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT, toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
- ViewablePressureContainer vpc = new ViewablePressureContainer();
- IExtent ext = desc.getRenderableDisplay().getExtent();
- float ymax = (float)ext.getMaxY();
- float ymin =(float) ext.getMinY();
- double vPmax = getViewableMaxPressure();
- double vPmin = getViewableMinPressure();
- vpc.maxVIewablePressure = (float)vPmax;
- vpc.minVIewablePressure = (float)vPmin;
- for(NcSoundingLayer ly: soundingLys){
- float pressure = ly.getPressure();
- if(pressure >= vPmin &&pressure <= vPmax){
- double pY= world.mapY(toLogScale(pressure));
- float ratio = (float) (pY-ymin) / (ymax-ymin);
- vpc.pyMap.put(pressure, ratio);
- //System.out.println("Icing press="+pressure+" ratio="+ratio+ " pY="+pY+" maxPy="+ymax+" minPy="+ymin);
- }
- }
- return vpc;
+ public ViewablePressureContainer getViewablePressureContainer(
+ List soundingLys) {
+ world.setWorldCoordinates(NsharpConstants.ICING_RELATIVE_HUMIDITY_LEFT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_TOP),
+ NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT,
+ toLogScale(NsharpConstants.ICING_PRESSURE_LEVEL_BOTTOM));
+ ViewablePressureContainer vpc = new ViewablePressureContainer();
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ float ymax = (float) ext.getMaxY();
+ float ymin = (float) ext.getMinY();
+ double vPmax = getViewableMaxPressure();
+ double vPmin = getViewableMinPressure();
+ vpc.maxVIewablePressure = (float) vPmax;
+ vpc.minVIewablePressure = (float) vPmin;
+ for (NcSoundingLayer ly : soundingLys) {
+ float pressure = ly.getPressure();
+ if (pressure >= vPmin && pressure <= vPmax) {
+ double pY = world.mapY(toLogScale(pressure));
+ float ratio = (float) (pY - ymin) / (ymax - ymin);
+ vpc.pyMap.put(pressure, ratio);
+ // System.out.println("Icing press="+pressure+" ratio="+ratio+
+ // " pY="+pY+" maxPy="+ymax+" minPy="+ymin);
+ }
+ }
+ return vpc;
}
+
/*
* Called from handleResize() in skewTPaneResource only
*/
- public void handleResize(IExtent ext){
- if(target==null)
- return;
- //IExtent ext = desc.getRenderableDisplay().getExtent();
- //ext.reset();
- float prevHeight = paneHeight;
- float prevWidth = iceWidth;
- paneHeight = (int) (ext.getHeight());
- yMagFactor = yMagFactor*((float)paneHeight/prevHeight);
- labelSpace = defaultLabelSpace * yMagFactor;
- iceXOrig=(int) (ext.getMinX());
- iceYOrig=(int) (ext.getMinY())+ (int)labelSpace;
- iceXEnd=iceXOrig+(int) (ext.getWidth());
- iceYEnd=iceYOrig+(int) (ext.getHeight()) - 2*(int)labelSpace;
- iceWidth = (int) (ext.getWidth());
- xMagFactor = xMagFactor* ((float)iceWidth/prevWidth);
- this.rectangle = new Rectangle(iceXOrig, iceYOrig,
- iceWidth, (int) ext.getHeight()-2*(int)labelSpace);
+ public void handleResize(IExtent ext) {
+ if (target == null)
+ return;
+ // IExtent ext = desc.getRenderableDisplay().getExtent();
+ // ext.reset();
+ float prevHeight = paneHeight;
+ float prevWidth = iceWidth;
+ paneHeight = (int) (ext.getHeight());
+ yMagFactor = yMagFactor * ((float) paneHeight / prevHeight);
+ labelSpace = defaultLabelSpace * yMagFactor;
+ iceXOrig = (int) (ext.getMinX());
+ iceYOrig = (int) (ext.getMinY()) + (int) labelSpace;
+ iceXEnd = iceXOrig + (int) (ext.getWidth());
+ iceYEnd = iceYOrig + (int) (ext.getHeight()) - 2 * (int) labelSpace;
+ iceWidth = (int) (ext.getWidth());
+ xMagFactor = xMagFactor * ((float) iceWidth / prevWidth);
+ this.rectangle = new Rectangle(iceXOrig, iceYOrig, iceWidth,
+ (int) ext.getHeight() - 2 * (int) labelSpace);
pe = new PixelExtent(this.rectangle);
- //desc.setNewPe(pe);
+ // desc.setNewPe(pe);
world = new WGraphics(this.rectangle);
-
- if(linesNumbersShape!= null){
- linesNumbersShape.dispose();
- }
- if(RHLabelShape!= null){
- RHLabelShape.dispose();
- }
- if(tempLabelShape!= null){
- tempLabelShape.dispose();
- }
- if(EPILabelShape!= null){
- EPILabelShape.dispose();
- }
+
+ if (linesNumbersShape != null) {
+ linesNumbersShape.dispose();
+ }
+ if (RHLabelShape != null) {
+ RHLabelShape.dispose();
+ }
+ if (tempLabelShape != null) {
+ tempLabelShape.dispose();
+ }
+ if (EPILabelShape != null) {
+ EPILabelShape.dispose();
+ }
createAllShapes();
}
- public void handleZooming(){
- if(linesNumbersShape!= null){
- linesNumbersShape.dispose();
- }
- if(RHLabelShape!= null){
- RHLabelShape.dispose();
- }
- if(tempLabelShape!= null){
- tempLabelShape.dispose();
- }
- if(EPILabelShape!= null){
- EPILabelShape.dispose();
- }
+
+ public void handleZooming() {
+ if (linesNumbersShape != null) {
+ linesNumbersShape.dispose();
+ }
+ if (RHLabelShape != null) {
+ RHLabelShape.dispose();
+ }
+ if (tempLabelShape != null) {
+ tempLabelShape.dispose();
+ }
+ if (EPILabelShape != null) {
+ EPILabelShape.dispose();
+ }
createAllShapes();
}
- public double getWindBarbXPosition(){
- IExtent ext = desc.getRenderableDisplay().getExtent();
- double xmax = ext.getMaxX(); //Extent's viewable envelope min x and y
+
+ public double getWindBarbXPosition() {
+ IExtent ext = desc.getRenderableDisplay().getExtent();
+ double xmax = ext.getMaxX(); // Extent's viewable envelope min x and y
double ymax = ext.getMaxY();
- double pX= world.mapX( NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT);
- if(pX < xmax)
- xmax = pX;
-
- double windBarbSizfactor = graphConfigProperty.getWindBarbSize()/2.2f;
- if(windBarbSizfactor < 1)
- windBarbSizfactor=1;
- double dispX = xmax - 50 * currentZoomLevel * xMagFactor* windBarbSizfactor;
-
- Coordinate cumap = world.unMap(dispX,ymax);
-
+ double pX = world.mapX(NsharpConstants.ICING_RELATIVE_HUMIDITY_RIGHT);
+ if (pX < xmax)
+ xmax = pX;
+
+ double windBarbSizfactor = graphConfigProperty.getWindBarbSize() / 2.2f;
+ if (windBarbSizfactor < 1)
+ windBarbSizfactor = 1;
+ double dispX = xmax - 50 * currentZoomLevel * xMagFactor
+ * windBarbSizfactor;
+
+ Coordinate cumap = world.unMap(dispX, ymax);
+
return cumap.x;
- }
+ }
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java
index 3799824a9f..f8a020eab7 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp.display;
+
/**
*
* gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpEditor
@@ -79,98 +80,176 @@ import com.raytheon.viz.ui.panes.PaneManager;
import com.raytheon.viz.ui.panes.VizDisplayPane;
import com.vividsolutions.jts.geom.Coordinate;
-public class NsharpEditor extends AbstractEditor implements IRenderableDisplayChangedListener {
- private boolean restarting= false;
- private final int DISPLAY_SKEWT =0; // always set it as first display, dont change it
- private int DISPLAY_WITO;
- private int DISPLAY_INSET;
- private int DISPLAY_HODO;
- private int DISPLAY_TIMESTN;
- private int DISPLAY_DATA;
- private int DISPLAY_SPC_GRAPHS;
- private int DISPLAY_FUTURE;
- private int DISPLAY_TOTAL;
+public class NsharpEditor extends AbstractEditor implements
+ IRenderableDisplayChangedListener {
+ private boolean restarting = false;
+
+ private static int DISPLAY_Head = 0;
+
+ private int DISPLAY_SKEWT;
+
+ private int DISPLAY_WITO;
+
+ private int DISPLAY_INSET;
+
+ private int DISPLAY_HODO;
+
+ private int DISPLAY_TIMESTN;
+
+ private int DISPLAY_DATA;
+
+ private int DISPLAY_SPC_GRAPHS;
+
+ private int DISPLAY_FUTURE;
+
+ private int DISPLAY_TOTAL;
+
public static final String EDITOR_ID = "gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor";
-// private int editorNum=0;
- private NsharpResourceHandler rscHandler;
+
+ // private int editorNum=0;
+ private NsharpResourceHandler rscHandler;
+
private int baseWidth;
+
private int baseHeight;
+
private double skewTHeightHintRatio;
+
private double skewTWidthHintRatio;
+
private double witoHeightHintRatio;
+
private double witoWidthHintRatio;
+
private double hodoHeightHintRatio;
+
private double hodoWidthHintRatio;
+
private double insetHeightHintRatio;
+
private double insetWidthHintRatio;
+
private double timeStnHeightHintRatio;
+
private double timeStnWidthHintRatio;
+
+ private double futureHeightHintRatio; // d2dlite
+
+ private double futureWidthHintRatio; // d2dlite
+
private double dataHeightHintRatio;
+
private double dataWidthHintRatio;
+
private double leftGroupWidthRatio;
- private double leftTopGroupHeightRatio;//, rightTopGroupHeightRatio;
+
+ private double leftTopGroupHeightRatio;
+
private double topGroupHeightRatio, botGroupHeightRatio;
+
private int skewTHeightHint;
+
private int skewTWidthHint;
+
private int witoHeightHint;
+
private int witoWidthHint;
+
private int hodoHeightHint;
+
private int hodoWidthHint;
+
private int insetHeightHint;
+
private int insetWidthHint;
+
private int timeStnHeightHint;
+
private int timeStnWidthHint;
+
private int dataHeightHint;
+
private int dataWidthHint;
+
private int spcHeightHint;
+
private int spcWidthHint;
+
private int futureHeightHint;
+
private int futureWidthHint;
- private String paneConfigurationName;
- private IRenderableDisplay[] displayArray;
+
+ private String paneConfigurationName;
+
+ private IRenderableDisplay[] displayArray;
+
private ResizeListener resizeLsner;
- public NsharpResourceHandler getRscHandler() {
- return rscHandler;
- }
- //Note: nsharpComp used to store composite for each pane.
+
+ public NsharpResourceHandler getRscHandler() {
+ return rscHandler;
+ }
+
+ // Note: nsharpComp used to store composite for each pane.
private Composite[] nsharpComp;// = new Composite[DISPLAY_TOTAL];
- private GridData leftGpGd,topGpGd, botGpGd;
+
+ private GridData leftGpGd, topGpGd, botGpGd;
+
private GridData rightGpGd;
- private GridData rightTopGpGd,leftTopGpGd, leftBotGpGd;
- private Composite parantComp, baseComposite;
- private Group rightTopGp=null, leftTopGp=null, leftBotGp=null, leftGp, rightGp, topGp, botGp;
- /** input managers */
+
+ private GridData rightTopGpGd, leftTopGpGd, leftBotGpGd;
+
+ private Composite parantComp, baseComposite;
+
+ private Group rightTopGp = null, leftTopGp = null, leftBotGp = null,
+ leftGp, rightGp, topGp, botGp;
+
+ /** input managers */
protected InputManager skewtInputManager;
- //protected InputManager witoInputManager;
+
+ // protected InputManager witoInputManager;
protected InputManager hodoInputManager;
+
protected InputManager timeStnInputManager;
+
protected InputManager dataInputManager;
+
protected InputManager insetInputManager;
+
protected InputManager spcGraphsInputManager;
+
/** The activated context, else null if not activated. */
- //protected IContextActivation contextActivation;
+ // protected IContextActivation contextActivation;
private NsharpSkewTPaneMouseHandler skewtPaneMouseHandler = null;
- //private NsharpAbstractMouseHandler witoPaneMouseHandler = null;
+
+ // private NsharpAbstractMouseHandler witoPaneMouseHandler = null;
private NsharpHodoPaneMouseHandler hodoPaneMouseHandler = null;
+
private NsharpTimeStnPaneMouseHandler timeStnPaneMouseHandler = null;
+
private NsharpDataPaneMouseHandler dataPaneMouseHandler = null;
+
private NsharpAbstractMouseHandler insetPaneMouseHandler = null;
+
private NsharpAbstractMouseHandler spcGraphsPaneMouseHandler = null;
-
- protected VizDisplayPane displayPane[];//= new VizDisplayPane[DISPLAY_TOTAL];
+
+ protected VizDisplayPane displayPane[];// = new
+ // VizDisplayPane[DISPLAY_TOTAL];
+
protected VizDisplayPane selectedPane;
+
public static NsharpEditor getActiveNsharpEditor() {
IEditorPart ep = EditorUtil.getActiveEditor();
if (ep instanceof NsharpEditor) {
- //System.out.println("getActiveNsharpEditor return ep from EditorUtil.getActiveEditor()");
+ // System.out.println("getActiveNsharpEditor return ep from EditorUtil.getActiveEditor()");
return (NsharpEditor) ep;
}
-
+
// It might be desirable to stop here so that we only have an "active"
// editor if it really is active.
- if(PlatformUI.getWorkbench()==null || PlatformUI.getWorkbench().getActiveWorkbenchWindow() ==null )
- return null;
+ if (PlatformUI.getWorkbench() == null
+ || PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null)
+ return null;
IWorkbenchPage activePage = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
IEditorReference[] references = new IEditorReference[0];
@@ -181,12 +260,13 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
for (IEditorReference ref : references) {
ep = ref.getEditor(false);
if (ep instanceof NsharpEditor) {
- //System.out.println("getActiveNsharpEditor return ep from IEditorReference.getEditor");
+ // System.out.println("getActiveNsharpEditor return ep from IEditorReference.getEditor");
return (NsharpEditor) ep;
}
}
return null;
- }
+ }
+
/*
* (non-Javadoc)
*
@@ -196,143 +276,169 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
*/
@Override
public void createPartControl(Composite comp) {
- parantComp = comp;
- if(baseComposite!= null)
- baseComposite.dispose();
- baseComposite = new Composite(comp, SWT.NONE);
- final GridLayout mainGL;
+ parantComp = comp;
+ if (baseComposite != null)
+ baseComposite.dispose();
+ baseComposite = new Composite(comp, SWT.NONE);
+ final GridLayout mainGL;
baseHeight = baseComposite.getSize().y;
baseWidth = baseComposite.getSize().x;
- //System.out.println("createPartControl...baseComposite w= " + baseWidth + " h= "+ baseHeight);
-
- //TBD for testing, hard code now
- //paneCfgNum= NsharpConstants.PANE_CONFIGURATION_1;
+ // System.out.println("createPartControl...baseComposite w= " +
+ // baseWidth + " h= "+ baseHeight);
+
+ // TBD for testing, hard code now
+ // paneCfgNum= NsharpConstants.PANE_CONFIGURATION_1;
resizeLsner = new ResizeListener(paneConfigurationName);
- baseComposite.addListener(SWT.Resize, resizeLsner);
- if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
- mainGL = new GridLayout(2, false);
- baseComposite.setLayout(mainGL);
- mainGL.horizontalSpacing = 0;
- mainGL.marginHeight = 0;
- leftGroupWidthRatio =NsharpConstants.PANE_DEF_CFG_2_LEFT_GP_WIDTH_RATIO;
- leftTopGroupHeightRatio = NsharpConstants.PANE_DEF_CFG_2_LEFT_TOP_GP_HEIGHT_RATIO;
- //rightTopGroupHeightRatio = NsharpConstants.PANE_DEF_CFG_2_RIGHT_TOP_GP_HEIGHT_RATIO;
- skewTHeightHintRatio=NsharpConstants.PANE_DEF_CFG_2_SKEWT_HEIGHT_RATIO;
- skewTWidthHintRatio=NsharpConstants.PANE_DEF_CFG_2_SKEWT_WIDTH_RATIO;
- witoHeightHintRatio=NsharpConstants.PANE_DEF_CFG_2_WITO_HEIGHT_RATIO;
- witoWidthHintRatio=NsharpConstants.PANE_DEF_CFG_2_WITO_WIDTH_RATIO;
- hodoHeightHintRatio=NsharpConstants.PANE_DEF_CFG_2_HODO_HEIGHT_RATIO;
- hodoWidthHintRatio=NsharpConstants.PANE_DEF_CFG_2_HODO_WIDTH_RATIO;
- insetHeightHintRatio=NsharpConstants.PANE_DEF_CFG_2_INSET_HEIGHT_RATIO;
- insetWidthHintRatio=NsharpConstants.PANE_DEF_CFG_2_INSET_WIDTH_RATIO;
- timeStnHeightHintRatio=NsharpConstants.PANE_DEF_CFG_2_TIMESTN_HEIGHT_RATIO;
- timeStnWidthHintRatio=NsharpConstants.PANE_DEF_CFG_2_TIMESTN_WIDTH_RATIO;
- dataHeightHintRatio=NsharpConstants.PANE_DEF_CFG_2_DATA_HEIGHT_RATIO;
- dataWidthHintRatio=NsharpConstants.PANE_DEF_CFG_2_DATA_WIDTH_RATIO;
- createDefConfig2( baseComposite) ;
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)){
- mainGL = new GridLayout(2, false);
- mainGL.horizontalSpacing = 0;
- mainGL.marginHeight = 0;
- baseComposite.setLayout(mainGL);
- leftGroupWidthRatio =NsharpConstants.PANE_DEF_CFG_1_LEFT_GP_WIDTH_RATIO;
- leftTopGroupHeightRatio = NsharpConstants.PANE_DEF_CFG_1_LEFT_TOP_GP_HEIGHT_RATIO;
- //rightTopGroupHeightRatio = NsharpConstants.PANE_DEF_CFG_1_RIGHT_TOP_GP_HEIGHT_RATIO;
- skewTHeightHintRatio=NsharpConstants.PANE_DEF_CFG_1_SKEWT_HEIGHT_RATIO;
- skewTWidthHintRatio=NsharpConstants.PANE_DEF_CFG_1_SKEWT_WIDTH_RATIO;
- witoHeightHintRatio=NsharpConstants.PANE_DEF_CFG_1_WITO_HEIGHT_RATIO;
- witoWidthHintRatio=NsharpConstants.PANE_DEF_CFG_1_WITO_WIDTH_RATIO;
- hodoHeightHintRatio=NsharpConstants.PANE_DEF_CFG_1_HODO_HEIGHT_RATIO;
- hodoWidthHintRatio=NsharpConstants.PANE_DEF_CFG_1_HODO_WIDTH_RATIO;
- insetHeightHintRatio=NsharpConstants.PANE_DEF_CFG_1_INSET_HEIGHT_RATIO;
- insetWidthHintRatio=NsharpConstants.PANE_DEF_CFG_1_INSET_WIDTH_RATIO;
- timeStnHeightHintRatio=NsharpConstants.PANE_DEF_CFG_1_TIMESTN_HEIGHT_RATIO;
- timeStnWidthHintRatio=NsharpConstants.PANE_DEF_CFG_1_TIMESTN_WIDTH_RATIO;
- dataHeightHintRatio=NsharpConstants.PANE_DEF_CFG_1_DATA_HEIGHT_RATIO;
- dataWidthHintRatio=NsharpConstants.PANE_DEF_CFG_1_DATA_WIDTH_RATIO;
- createDefConfig1( baseComposite) ;
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
- mainGL = new GridLayout(1, true);
- mainGL.horizontalSpacing = 0;
- mainGL.marginHeight = 0;
- baseComposite.setLayout(mainGL);
- topGroupHeightRatio =NsharpConstants.PANE_SPCWS_CFG_TOP_GP_HEIGHT_RATIO;
- botGroupHeightRatio = NsharpConstants.PANE_SPCWS_CFG_BOT_GP_HEIGHT_RATIO;
- skewTHeightHintRatio=NsharpConstants.PANE_SPCWS_CFG_SKEWT_HEIGHT_RATIO;
- skewTWidthHintRatio=NsharpConstants.PANE_SPCWS_CFG_SKEWT_WIDTH_RATIO;
- witoHeightHintRatio=NsharpConstants.PANE_SPCWS_CFG_WITO_HEIGHT_RATIO;
- witoWidthHintRatio=NsharpConstants.PANE_SPCWS_CFG_WITO_WIDTH_RATIO;
- hodoHeightHintRatio=NsharpConstants.PANE_SPCWS_CFG_HODO_HEIGHT_RATIO;
- hodoWidthHintRatio=NsharpConstants.PANE_SPCWS_CFG_HODO_WIDTH_RATIO;
- insetHeightHintRatio=NsharpConstants.PANE_SPCWS_CFG_INSET_HEIGHT_RATIO;
- insetWidthHintRatio=NsharpConstants.PANE_SPCWS_CFG_INSET_WIDTH_RATIO;
- dataHeightHintRatio=NsharpConstants.PANE_SPCWS_CFG_DATA_HEIGHT_RATIO;
- dataWidthHintRatio=NsharpConstants.PANE_SPCWS_CFG_DATA_WIDTH_RATIO;
- createSPCWsConfig( baseComposite) ;
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- mainGL = new GridLayout(1, true);
- mainGL.horizontalSpacing = 0;
- mainGL.marginHeight = 0;
- baseComposite.setLayout(mainGL);
- topGroupHeightRatio =NsharpConstants.PANE_SIMPLE_D2D_CFG_TOP_GP_HEIGHT_RATIO;
- botGroupHeightRatio = 1-topGroupHeightRatio;
- skewTHeightHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_SKEWT_HEIGHT_RATIO;
- skewTWidthHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_SKEWT_WIDTH_RATIO;
- timeStnHeightHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_TIMESTN_HEIGHT_RATIO;
- timeStnWidthHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_TIMESTN_WIDTH_RATIO;
- hodoHeightHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_HODO_HEIGHT_RATIO;
- hodoWidthHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_HODO_WIDTH_RATIO;
- dataHeightHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_DATA_HEIGHT_RATIO;
- dataWidthHintRatio=NsharpConstants.PANE_SIMPLE_D2D_CFG_DATA_WIDTH_RATIO;
- createSimpleD2DConfig(baseComposite);
- }
- skewtInputManager = new InputManager(this);
- //witoInputManager = new InputManager(this);
- timeStnInputManager = new InputManager(this);
- hodoInputManager = new InputManager(this);
- dataInputManager = new InputManager(this);
- insetInputManager = new InputManager(this);
- spcGraphsInputManager = new InputManager(this);
- try {
- for(int i=0; i < displayPane.length; i++){
- if (displayPane[i] == null && nsharpComp [i]!=null) {
- displayPane[i] = new VizDisplayPane(this, nsharpComp[i],
- displaysToLoad[i]);
-
- displayPane[i].setRenderableDisplay(displaysToLoad[i]);
- }
- }
- registerHandlers();
- //set default selected pane to skewT pane
- selectedPane = displayPane[DISPLAY_SKEWT];
- for(int i=0; i < displayPane.length; i++){
- if(displayPane[i] != null)
- displayPane[i].addListener( SWT.MouseEnter, new PaneMouseListener(i));
- }
- }
- catch (Exception e) {
+ baseComposite.addListener(SWT.Resize, resizeLsner);
+ if (paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)) {
+ mainGL = new GridLayout(2, false);
+ baseComposite.setLayout(mainGL);
+ mainGL.horizontalSpacing = 0;
+ mainGL.marginHeight = 0;
+ leftGroupWidthRatio = NsharpConstants.PANE_DEF_CFG_2_LEFT_GP_WIDTH_RATIO;
+ leftTopGroupHeightRatio = NsharpConstants.PANE_DEF_CFG_2_LEFT_TOP_GP_HEIGHT_RATIO;
+ // rightTopGroupHeightRatio =
+ // NsharpConstants.PANE_DEF_CFG_2_RIGHT_TOP_GP_HEIGHT_RATIO;
+ skewTHeightHintRatio = NsharpConstants.PANE_DEF_CFG_2_SKEWT_HEIGHT_RATIO;
+ skewTWidthHintRatio = NsharpConstants.PANE_DEF_CFG_2_SKEWT_WIDTH_RATIO;
+ witoHeightHintRatio = NsharpConstants.PANE_DEF_CFG_2_WITO_HEIGHT_RATIO;
+ witoWidthHintRatio = NsharpConstants.PANE_DEF_CFG_2_WITO_WIDTH_RATIO;
+ hodoHeightHintRatio = NsharpConstants.PANE_DEF_CFG_2_HODO_HEIGHT_RATIO;
+ hodoWidthHintRatio = NsharpConstants.PANE_DEF_CFG_2_HODO_WIDTH_RATIO;
+ insetHeightHintRatio = NsharpConstants.PANE_DEF_CFG_2_INSET_HEIGHT_RATIO;
+ insetWidthHintRatio = NsharpConstants.PANE_DEF_CFG_2_INSET_WIDTH_RATIO;
+ timeStnHeightHintRatio = NsharpConstants.PANE_DEF_CFG_2_TIMESTN_HEIGHT_RATIO;
+ timeStnWidthHintRatio = NsharpConstants.PANE_DEF_CFG_2_TIMESTN_WIDTH_RATIO;
+ dataHeightHintRatio = NsharpConstants.PANE_DEF_CFG_2_DATA_HEIGHT_RATIO;
+ dataWidthHintRatio = NsharpConstants.PANE_DEF_CFG_2_DATA_WIDTH_RATIO;
+ createDefConfig2(baseComposite);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)) {
+ mainGL = new GridLayout(2, false);
+ mainGL.horizontalSpacing = 0;
+ mainGL.marginHeight = 0;
+ baseComposite.setLayout(mainGL);
+ leftGroupWidthRatio = NsharpConstants.PANE_DEF_CFG_1_LEFT_GP_WIDTH_RATIO;
+ leftTopGroupHeightRatio = NsharpConstants.PANE_DEF_CFG_1_LEFT_TOP_GP_HEIGHT_RATIO;
+ // rightTopGroupHeightRatio =
+ // NsharpConstants.PANE_DEF_CFG_1_RIGHT_TOP_GP_HEIGHT_RATIO;
+ skewTHeightHintRatio = NsharpConstants.PANE_DEF_CFG_1_SKEWT_HEIGHT_RATIO;
+ skewTWidthHintRatio = NsharpConstants.PANE_DEF_CFG_1_SKEWT_WIDTH_RATIO;
+ witoHeightHintRatio = NsharpConstants.PANE_DEF_CFG_1_WITO_HEIGHT_RATIO;
+ witoWidthHintRatio = NsharpConstants.PANE_DEF_CFG_1_WITO_WIDTH_RATIO;
+ hodoHeightHintRatio = NsharpConstants.PANE_DEF_CFG_1_HODO_HEIGHT_RATIO;
+ hodoWidthHintRatio = NsharpConstants.PANE_DEF_CFG_1_HODO_WIDTH_RATIO;
+ insetHeightHintRatio = NsharpConstants.PANE_DEF_CFG_1_INSET_HEIGHT_RATIO;
+ insetWidthHintRatio = NsharpConstants.PANE_DEF_CFG_1_INSET_WIDTH_RATIO;
+ timeStnHeightHintRatio = NsharpConstants.PANE_DEF_CFG_1_TIMESTN_HEIGHT_RATIO;
+ timeStnWidthHintRatio = NsharpConstants.PANE_DEF_CFG_1_TIMESTN_WIDTH_RATIO;
+ dataHeightHintRatio = NsharpConstants.PANE_DEF_CFG_1_DATA_HEIGHT_RATIO;
+ dataWidthHintRatio = NsharpConstants.PANE_DEF_CFG_1_DATA_WIDTH_RATIO;
+ createDefConfig1(baseComposite);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ mainGL = new GridLayout(1, true);
+ mainGL.horizontalSpacing = 0;
+ mainGL.marginHeight = 0;
+ baseComposite.setLayout(mainGL);
+ topGroupHeightRatio = NsharpConstants.PANE_SPCWS_CFG_TOP_GP_HEIGHT_RATIO;
+ botGroupHeightRatio = NsharpConstants.PANE_SPCWS_CFG_BOT_GP_HEIGHT_RATIO;
+ skewTHeightHintRatio = NsharpConstants.PANE_SPCWS_CFG_SKEWT_HEIGHT_RATIO;
+ skewTWidthHintRatio = NsharpConstants.PANE_SPCWS_CFG_SKEWT_WIDTH_RATIO;
+ witoHeightHintRatio = NsharpConstants.PANE_SPCWS_CFG_WITO_HEIGHT_RATIO;
+ witoWidthHintRatio = NsharpConstants.PANE_SPCWS_CFG_WITO_WIDTH_RATIO;
+ hodoHeightHintRatio = NsharpConstants.PANE_SPCWS_CFG_HODO_HEIGHT_RATIO;
+ hodoWidthHintRatio = NsharpConstants.PANE_SPCWS_CFG_HODO_WIDTH_RATIO;
+ insetHeightHintRatio = NsharpConstants.PANE_SPCWS_CFG_INSET_HEIGHT_RATIO;
+ insetWidthHintRatio = NsharpConstants.PANE_SPCWS_CFG_INSET_WIDTH_RATIO;
+ dataHeightHintRatio = NsharpConstants.PANE_SPCWS_CFG_DATA_HEIGHT_RATIO;
+ dataWidthHintRatio = NsharpConstants.PANE_SPCWS_CFG_DATA_WIDTH_RATIO;
+ createSPCWsConfig(baseComposite);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ mainGL = new GridLayout(1, true);
+ mainGL.horizontalSpacing = 0;
+ mainGL.marginHeight = 0;
+ baseComposite.setLayout(mainGL);
+ topGroupHeightRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_TOP_GP_HEIGHT_RATIO;
+ botGroupHeightRatio = 1 - topGroupHeightRatio;
+ skewTHeightHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_SKEWT_HEIGHT_RATIO;
+ skewTWidthHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_SKEWT_WIDTH_RATIO;
+ timeStnHeightHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_TIMESTN_HEIGHT_RATIO;
+ timeStnWidthHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_TIMESTN_WIDTH_RATIO;
+ futureHeightHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_FUTURE_WIDTH_RATIO;
+ futureWidthHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_FUTURE_HEIGHT_RATIO;
+ hodoHeightHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_HODO_HEIGHT_RATIO;
+ hodoWidthHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_HODO_WIDTH_RATIO;
+ dataHeightHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_DATA_HEIGHT_RATIO;
+ dataWidthHintRatio = NsharpConstants.PANE_SIMPLE_D2D_CFG_DATA_WIDTH_RATIO;
+ createSimpleD2DConfig(baseComposite);
+ } // d2dlite start
+ else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ mainGL = new GridLayout(1, true);
+ mainGL.horizontalSpacing = 0;
+ mainGL.marginHeight = 0;
+ baseComposite.setLayout(mainGL);
+ topGroupHeightRatio = 1;
+ botGroupHeightRatio = 0;
+ skewTHeightHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_SKEWT_HEIGHT_RATIO;
+ skewTWidthHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_SKEWT_WIDTH_RATIO;
+ hodoHeightHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_HODO_HEIGHT_RATIO;
+ hodoWidthHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_HODO_WIDTH_RATIO;
+ timeStnHeightHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_TIMESTN_HEIGHT_RATIO;
+ timeStnWidthHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_TIMESTN_WIDTH_RATIO;
+ dataWidthHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_DATA_WIDTH_RATIO;
+ dataHeightHintRatio = NsharpConstants.PANE_LITE_D2D_CFG_DATA_HEIGHT_RATIO;
+ createLiteD2DConfig(baseComposite);
+ } // d2dlite end
+ skewtInputManager = new InputManager(this);
+ // witoInputManager = new InputManager(this);
+ timeStnInputManager = new InputManager(this);
+ // hodoInputManager = new InputManager(this);
+ dataInputManager = new InputManager(this);
+ insetInputManager = new InputManager(this);
+ spcGraphsInputManager = new InputManager(this);
+ try {
+ for (int i = 0; i < displayPane.length; i++) {
+ if (displayPane[i] == null && nsharpComp[i] != null) {
+ displayPane[i] = new VizDisplayPane(this, nsharpComp[i],
+ displaysToLoad[i]);
+
+ displayPane[i].setRenderableDisplay(displaysToLoad[i]);
+ }
+ }
+ registerHandlers();
+ // set default selected pane to skewT pane
+ selectedPane = displayPane[0];
+
+ for (int i = 0; i < displayPane.length; i++) {
+ if (displayPane[i] != null)
+ displayPane[i].addListener(SWT.MouseEnter,
+ new PaneMouseListener(i));
+ }
+ } catch (Exception e) {
final String errMsg = "Error setting up NsharpEditor";
- UFStatus.getHandler().handle(Priority.SIGNIFICANT, errMsg, e);
+ UFStatus.getHandler().handle(Priority.SIGNIFICANT, errMsg, e);
}
- if(!restarting)
- contributePerspectiveActions();
+ if (!restarting)
+ contributePerspectiveActions();
}
- private void createSPCWsConfig(Composite comp) {
+
+ private void createSPCWsConfig(Composite comp) {
topGp = new Group(baseComposite, SWT.NONE);
- topGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ topGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
topGp.setLayoutData(topGpGd);
GridLayout topGpLayout = new GridLayout(3, false);
topGpLayout.marginWidth = 0;
topGpLayout.marginHeight = 0;
topGpLayout.verticalSpacing = 0;
topGp.setLayout(topGpLayout);
-
- // skewt composite
+
+ // skewt composite
Composite skewtComp = new Composite(topGp, SWT.NONE);
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
skewtComp.setLayoutData(skewtGd);
GridLayout skewtLayout = new GridLayout(1, true);
skewtLayout.marginWidth = 0;
@@ -342,8 +448,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
nsharpComp[DISPLAY_SKEWT] = skewtComp;
// wito composite
Composite witoComp = new Composite(topGp, SWT.NONE);
- GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
witoComp.setLayoutData(witoGd);
GridLayout witoLayout = new GridLayout(1, true);
witoLayout.marginWidth = 0;
@@ -351,88 +456,80 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
witoLayout.verticalSpacing = 0;
witoComp.setLayout(witoLayout);
nsharpComp[DISPLAY_WITO] = witoComp;
-
-
- // right-top group : right part of top group
+
+ // right-top group : right part of top group
rightTopGp = new Group(topGp, SWT.NONE);
- rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
rightTopGp.setLayoutData(rightTopGpGd);
GridLayout rightTopGpLayout = new GridLayout(1, true);
rightTopGpLayout.marginWidth = 0;
rightTopGpLayout.marginHeight = 0;
- rightTopGpLayout.verticalSpacing=0;
+ rightTopGpLayout.verticalSpacing = 0;
rightTopGp.setLayout(rightTopGpLayout);
-
- //hodo composite
+
+ // hodo composite
Composite hodoComp = new Composite(rightTopGp, SWT.NONE);
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
hodoComp.setLayoutData(hodoGd);
GridLayout hodoLayout = new GridLayout(1, true);
- hodoLayout.marginHeight =0;
- hodoLayout.marginWidth=0;
- hodoLayout.verticalSpacing=0;
+ hodoLayout.marginHeight = 0;
+ hodoLayout.marginWidth = 0;
+ hodoLayout.verticalSpacing = 0;
hodoComp.setLayout(hodoLayout);
- nsharpComp[DISPLAY_HODO] = hodoComp;
-
- //inset composite
+ nsharpComp[DISPLAY_HODO] = hodoComp;
+
+ // inset composite
Composite insetComp = new Composite(rightTopGp, SWT.NONE);
- GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- //insetGd.heightHint = 1;
+ GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ // insetGd.heightHint = 1;
insetComp.setLayoutData(insetGd);
GridLayout insetLayout = new GridLayout(1, true);
insetLayout.marginHeight = 0;
insetLayout.marginWidth = 0;
- insetComp.setLayout(insetLayout);
- nsharpComp[DISPLAY_INSET] = insetComp;
-
- botGp = new Group(baseComposite, SWT.NONE);
- botGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ insetComp.setLayout(insetLayout);
+ nsharpComp[DISPLAY_INSET] = insetComp;
+
+ botGp = new Group(baseComposite, SWT.NONE);
+ botGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
botGp.setLayoutData(botGpGd);
GridLayout botGpLayout = new GridLayout(2, true);
botGpLayout.marginWidth = 0;
botGpLayout.marginHeight = 0;
botGpLayout.verticalSpacing = 0;
botGp.setLayout(botGpLayout);
- //data composite
+ // data composite
Composite dataComp = new Composite(botGp, SWT.NONE);
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);
dataComp.setLayoutData(dataGd);
GridLayout dataLayout = new GridLayout(1, true);
dataLayout.marginHeight = 0;
- dataLayout.marginWidth=0;
+ dataLayout.marginWidth = 0;
dataComp.setLayout(dataLayout);
- nsharpComp[DISPLAY_DATA] = dataComp;
- //spc composite
+ nsharpComp[DISPLAY_DATA] = dataComp;
+ // spc composite
Composite spcComp = new Composite(botGp, SWT.NONE);
- GridData spcGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
+ GridData spcGd = new GridData(SWT.FILL, SWT.FILL, true, false);
spcComp.setLayoutData(spcGd);
GridLayout spcLayout = new GridLayout(1, true);
spcLayout.marginHeight = 0;
- spcLayout.marginWidth=0;
+ spcLayout.marginWidth = 0;
spcComp.setLayout(spcLayout);
- nsharpComp[DISPLAY_SPC_GRAPHS] = spcComp;
+ nsharpComp[DISPLAY_SPC_GRAPHS] = spcComp;
}
- private void createSimpleD2DConfig(Composite comp) {
- topGp = new Group(baseComposite, SWT.NONE);
- topGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+
+ private void createSimpleD2DConfig(Composite comp) {
+ topGp = new Group(baseComposite, SWT.NONE);
+ topGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
topGp.setLayoutData(topGpGd);
GridLayout topGpLayout = new GridLayout(2, false);
topGpLayout.marginWidth = 0;
topGpLayout.marginHeight = 0;
topGpLayout.verticalSpacing = 0;
topGp.setLayout(topGpLayout);
-
+
// skewt composite
Composite skewtComp = new Composite(topGp, SWT.NONE);
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
skewtComp.setLayoutData(skewtGd);
GridLayout skewtLayout = new GridLayout(1, true);
skewtLayout.marginWidth = 0;
@@ -440,100 +537,158 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
skewtLayout.verticalSpacing = 0;
skewtComp.setLayout(skewtLayout);
nsharpComp[DISPLAY_SKEWT] = skewtComp;
-
- // right-top group : right part of top group
+
+ // right-top group : right part of top group
rightTopGp = new Group(topGp, SWT.NONE);
- rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
rightTopGp.setLayoutData(rightTopGpGd);
GridLayout rightTopGpLayout = new GridLayout(1, true);
rightTopGpLayout.marginWidth = 0;
rightTopGpLayout.marginHeight = 0;
- rightTopGpLayout.verticalSpacing=0;
+ rightTopGpLayout.verticalSpacing = 0;
rightTopGp.setLayout(rightTopGpLayout);
-
- //time-stn composite
+
+ // time-stn composite
Composite timeStnComp = new Composite(rightTopGp, SWT.NONE);
- GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true, true);
timeStnComp.setLayoutData(timeStnGd);
GridLayout timeStnLayout = new GridLayout(1, true);
- timeStnLayout.marginHeight =0;
- timeStnLayout.marginWidth=0;
- timeStnLayout.verticalSpacing=0;
+ timeStnLayout.marginHeight = 0;
+ timeStnLayout.marginWidth = 0;
+ timeStnLayout.verticalSpacing = 0;
timeStnComp.setLayout(timeStnLayout);
- nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
-
- //future composite
+ nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
+
+ // future composite
Composite futureComp = new Composite(rightTopGp, SWT.NONE);
- GridData fuGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData fuGd = new GridData(SWT.FILL, SWT.FILL, true, true);
futureComp.setLayoutData(fuGd);
GridLayout futureLayout = new GridLayout(1, true);
futureLayout.marginHeight = 0;
- futureLayout.marginWidth=0;
+ futureLayout.marginWidth = 0;
futureComp.setLayout(futureLayout);
- nsharpComp[DISPLAY_FUTURE] = futureComp;
-
+ nsharpComp[DISPLAY_FUTURE] = futureComp;
+
botGp = new Group(baseComposite, SWT.NONE);
- botGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ botGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
botGp.setLayoutData(botGpGd);
GridLayout botGpLayout = new GridLayout(2, false);
botGpLayout.marginWidth = 0;
botGpLayout.marginHeight = 0;
botGpLayout.verticalSpacing = 0;
botGp.setLayout(botGpLayout);
-
- //hodo composite
+
+ // hodo composite
Composite hodoComp = new Composite(botGp, SWT.NONE);
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, false);
hodoComp.setLayoutData(hodoGd);
GridLayout hodoLayout = new GridLayout(1, true);
- hodoLayout.marginHeight =0;
- hodoLayout.marginWidth=0;
- hodoLayout.verticalSpacing=0;
+ hodoLayout.marginHeight = 0;
+ hodoLayout.marginWidth = 0;
+ hodoLayout.verticalSpacing = 0;
hodoComp.setLayout(hodoLayout);
- nsharpComp[DISPLAY_HODO] = hodoComp;
-
- //data composite
+ nsharpComp[DISPLAY_HODO] = hodoComp;
+
+ // data composite
Composite dataComp = new Composite(botGp, SWT.NONE);
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);
dataComp.setLayoutData(dataGd);
GridLayout dataLayout = new GridLayout(1, true);
dataLayout.marginHeight = 0;
- dataLayout.marginWidth=0;
+ dataLayout.marginWidth = 0;
dataComp.setLayout(dataLayout);
- nsharpComp[DISPLAY_DATA] = dataComp;
+ nsharpComp[DISPLAY_DATA] = dataComp;
}
- private void createDefConfig2(Composite comp) {
+
+ private void createLiteD2DConfig(Composite comp) {
+ topGp = new Group(baseComposite, SWT.NONE);
+ topGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ topGp.setLayoutData(topGpGd);
+ GridLayout topGpLayout = new GridLayout(2, false);
+ topGpLayout.marginWidth = 0;
+ topGpLayout.marginHeight = 0;
+ topGpLayout.verticalSpacing = 0;
+ topGp.setLayout(topGpLayout);
+ if (rscHandler.getCurrentGraphMode() != NsharpConstants.GRAPH_HODO) {
+ // skewt composite
+ Composite skewtComp = new Composite(topGp, SWT.NONE);
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ skewtComp.setLayoutData(skewtGd);
+ GridLayout skewtLayout = new GridLayout(1, true);
+ skewtLayout.marginWidth = 0;
+ skewtLayout.marginHeight = 0;
+ skewtLayout.verticalSpacing = 0;
+ skewtComp.setLayout(skewtLayout);
+ nsharpComp[DISPLAY_SKEWT] = skewtComp;
+ } else {
+ // hodo composite
+ Composite hodoComp = new Composite(topGp, SWT.NONE);
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ hodoComp.setLayoutData(hodoGd);
+ GridLayout hodoLayout = new GridLayout(1, true);
+ hodoLayout.marginHeight = 0;
+ hodoLayout.marginWidth = 0;
+ hodoLayout.verticalSpacing = 0;
+ hodoComp.setLayout(hodoLayout);
+ nsharpComp[DISPLAY_HODO] = hodoComp;
+ }
+
+ // only has right group
+ rightTopGp = new Group(topGp, SWT.NONE);
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rightTopGp.setLayoutData(rightTopGpGd);
+ GridLayout rightTopGpLayout = new GridLayout(1, true);
+ rightTopGpLayout.marginWidth = 0;
+ rightTopGpLayout.marginHeight = 0;
+ rightTopGpLayout.verticalSpacing = 0;
+ rightTopGp.setLayout(rightTopGpLayout);
+
+ // time-stn composite
+ Composite timeStnComp = new Composite(rightTopGp, SWT.NONE);
+ GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ timeStnComp.setLayoutData(timeStnGd);
+ GridLayout timeStnLayout = new GridLayout(1, true);
+ timeStnLayout.marginHeight = 0;
+ timeStnLayout.marginWidth = 0;
+ timeStnLayout.verticalSpacing = 0;
+ timeStnComp.setLayout(timeStnLayout);
+ nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
+
+ // data composite
+ Composite dataComp = new Composite(rightTopGp, SWT.NONE);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ dataComp.setLayoutData(dataGd);
+ GridLayout dataLayout = new GridLayout(1, true);
+ dataLayout.marginHeight = 0;
+ dataLayout.marginWidth = 0;
+ dataComp.setLayout(dataLayout);
+ nsharpComp[DISPLAY_DATA] = dataComp;
+
+ }
+
+ private void createDefConfig2(Composite comp) {
leftGp = new Group(baseComposite, SWT.NONE);
- leftGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ leftGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
leftGp.setLayoutData(leftGpGd);
GridLayout leftGpLayout = new GridLayout(1, true);
leftGpLayout.marginWidth = 0;
leftGpLayout.marginHeight = 0;
leftGpLayout.verticalSpacing = 0;
leftGp.setLayout(leftGpLayout);
-
- //left-top group : upper part of left group
+
+ // left-top group : upper part of left group
leftTopGp = new Group(leftGp, SWT.NONE);
- leftTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ leftTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
leftTopGp.setLayoutData(leftTopGpGd);
GridLayout leftTopGpLayout = new GridLayout(2, false);
leftTopGpLayout.marginWidth = 0;
leftTopGpLayout.marginHeight = 0;
- leftTopGpLayout.verticalSpacing=0;
+ leftTopGpLayout.verticalSpacing = 0;
leftTopGp.setLayout(leftTopGpLayout);
-
+
// skewt composite
Composite skewtComp = new Composite(leftTopGp, SWT.NONE);
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
skewtComp.setLayoutData(skewtGd);
GridLayout skewtLayout = new GridLayout(1, true);
skewtLayout.marginWidth = 0;
@@ -543,8 +698,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
nsharpComp[DISPLAY_SKEWT] = skewtComp;
// wito composite
Composite witoComp = new Composite(leftTopGp, SWT.NONE);
- GridData witoGd = new GridData(SWT.END, SWT.FILL, false,
- true);
+ GridData witoGd = new GridData(SWT.END, SWT.FILL, false, true);
witoComp.setLayoutData(witoGd);
GridLayout witoLayout = new GridLayout(1, true);
witoLayout.marginWidth = 0;
@@ -552,98 +706,90 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
witoLayout.verticalSpacing = 0;
witoComp.setLayout(witoLayout);
nsharpComp[DISPLAY_WITO] = witoComp;
- //inset composite
+ // inset composite
Composite insetComp = new Composite(leftGp, SWT.NONE);
- GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
- //insetGd.heightHint = 1;
+ GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ // insetGd.heightHint = 1;
insetComp.setLayoutData(insetGd);
GridLayout insetLayout = new GridLayout(1, true);
insetLayout.marginHeight = 0;
insetLayout.marginWidth = 0;
- insetComp.setLayout(insetLayout);
- nsharpComp[DISPLAY_INSET] = insetComp;
- //right group
+ insetComp.setLayout(insetLayout);
+ nsharpComp[DISPLAY_INSET] = insetComp;
+ // right group
rightGp = new Group(baseComposite, SWT.NONE);
- rightGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ rightGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
rightGp.setLayoutData(rightGpGd);
GridLayout rightGpLayout = new GridLayout(1, true);
rightGpLayout.marginWidth = 0;
rightGpLayout.marginHeight = 0;
- rightGpLayout.verticalSpacing=0;
+ rightGpLayout.verticalSpacing = 0;
rightGp.setLayout(rightGpLayout);
-
- //right-top group : upper part of right group
+
+ // right-top group : upper part of right group
rightTopGp = new Group(rightGp, SWT.NONE);
- rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
rightTopGp.setLayoutData(rightTopGpGd);
GridLayout rightTopGpLayout = new GridLayout(2, false);
rightTopGpLayout.marginWidth = 0;
rightTopGpLayout.marginHeight = 0;
- rightTopGpLayout.verticalSpacing=0;
+ rightTopGpLayout.verticalSpacing = 0;
rightTopGp.setLayout(rightTopGpLayout);
- //hodo composite
+ // hodo composite
Composite hodoComp = new Composite(rightTopGp, SWT.NONE);
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
hodoComp.setLayoutData(hodoGd);
GridLayout hodoLayout = new GridLayout(1, true);
- hodoLayout.marginHeight =0;
- hodoLayout.marginWidth=0;
- hodoLayout.verticalSpacing=0;
+ hodoLayout.marginHeight = 0;
+ hodoLayout.marginWidth = 0;
+ hodoLayout.verticalSpacing = 0;
hodoComp.setLayout(hodoLayout);
- nsharpComp[DISPLAY_HODO] = hodoComp;
- //time-stn composite
+ nsharpComp[DISPLAY_HODO] = hodoComp;
+ // time-stn composite
Composite timeStnComp = new Composite(rightTopGp, SWT.NONE);
- GridData timeStnGd = new GridData(SWT.END, SWT.FILL, false,
- true);
+ GridData timeStnGd = new GridData(SWT.END, SWT.FILL, false, true);
timeStnComp.setLayoutData(timeStnGd);
GridLayout timeStnLayout = new GridLayout(1, true);
- timeStnLayout.marginHeight =0;
- timeStnLayout.marginWidth=0;
- timeStnLayout.verticalSpacing=0;
+ timeStnLayout.marginHeight = 0;
+ timeStnLayout.marginWidth = 0;
+ timeStnLayout.verticalSpacing = 0;
timeStnComp.setLayout(timeStnLayout);
- nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
- //data composite
+ nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
+ // data composite
Composite dataComp = new Composite(rightGp, SWT.NONE);
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);
dataComp.setLayoutData(dataGd);
GridLayout dataLayout = new GridLayout(1, true);
dataLayout.marginHeight = 0;
- dataLayout.marginWidth=0;
+ dataLayout.marginWidth = 0;
dataComp.setLayout(dataLayout);
- nsharpComp[DISPLAY_DATA] = dataComp;
+ nsharpComp[DISPLAY_DATA] = dataComp;
}
+
private void createDefConfig1(Composite comp) {
leftGp = new Group(baseComposite, SWT.NONE);
- leftGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
-
+ leftGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+
leftGp.setLayoutData(leftGpGd);
GridLayout leftGpLayout = new GridLayout(1, true);
leftGpLayout.marginWidth = 0;
leftGpLayout.marginHeight = 0;
leftGpLayout.verticalSpacing = 0;
leftGp.setLayout(leftGpLayout);
-
- //left-top group : upper part of left group
+
+ // left-top group : upper part of left group
leftTopGp = new Group(leftGp, SWT.NONE);
- leftTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ leftTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
leftTopGp.setLayoutData(leftTopGpGd);
GridLayout leftTopGpLayout = new GridLayout(2, false);
leftTopGpLayout.marginWidth = 0;
leftTopGpLayout.marginHeight = 0;
- leftTopGpLayout.verticalSpacing=0;
+ leftTopGpLayout.verticalSpacing = 0;
leftTopGp.setLayout(leftTopGpLayout);
-
+
// skewt composite
Composite skewtComp = new Composite(leftTopGp, SWT.NONE);
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
skewtComp.setLayoutData(skewtGd);
GridLayout skewtLayout = new GridLayout(1, true);
skewtLayout.marginWidth = 0;
@@ -653,8 +799,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
nsharpComp[DISPLAY_SKEWT] = skewtComp;
// wito composite
Composite witoComp = new Composite(leftTopGp, SWT.NONE);
- GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
witoComp.setLayoutData(witoGd);
GridLayout witoLayout = new GridLayout(1, true);
witoLayout.marginWidth = 0;
@@ -662,239 +807,247 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
witoLayout.verticalSpacing = 0;
witoComp.setLayout(witoLayout);
nsharpComp[DISPLAY_WITO] = witoComp;
- //left-bottom group
+ // left-bottom group
leftBotGp = new Group(leftGp, SWT.NONE);
- leftBotGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ leftBotGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
leftBotGp.setLayoutData(leftBotGpGd);
GridLayout leftBotGpLayout = new GridLayout(2, true);
leftBotGpLayout.marginWidth = 0;
leftBotGpLayout.marginHeight = 0;
- leftBotGpLayout.verticalSpacing=0;
+ leftBotGpLayout.verticalSpacing = 0;
leftBotGp.setLayout(leftBotGpLayout);
- //time-stn composite
+ // time-stn composite
Composite timeStnComp = new Composite(leftBotGp, SWT.NONE);
- GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true, true);
timeStnComp.setLayoutData(timeStnGd);
GridLayout timeStnLayout = new GridLayout(1, true);
- timeStnLayout.marginHeight =0;
- timeStnLayout.marginWidth=0;
- timeStnLayout.verticalSpacing=0;
+ timeStnLayout.marginHeight = 0;
+ timeStnLayout.marginWidth = 0;
+ timeStnLayout.verticalSpacing = 0;
timeStnComp.setLayout(timeStnLayout);
- nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
- //inset composite
+ nsharpComp[DISPLAY_TIMESTN] = timeStnComp;
+ // inset composite
Composite insetComp = new Composite(leftBotGp, SWT.NONE);
- GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- //insetGd.heightHint = 1;
+ GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ // insetGd.heightHint = 1;
insetComp.setLayoutData(insetGd);
GridLayout insetLayout = new GridLayout(1, true);
insetLayout.marginHeight = 0;
insetLayout.marginWidth = 0;
- insetComp.setLayout(insetLayout);
- nsharpComp[DISPLAY_INSET] = insetComp;
- //right group
+ insetComp.setLayout(insetLayout);
+ nsharpComp[DISPLAY_INSET] = insetComp;
+ // right group
rightGp = new Group(baseComposite, SWT.NONE);
- rightGpGd = new GridData(SWT.END, SWT.FILL, true,
- true);
-
+ rightGpGd = new GridData(SWT.END, SWT.FILL, true, true);
+
rightGp.setLayoutData(rightGpGd);
GridLayout rightGpLayout = new GridLayout(1, true);
rightGpLayout.marginWidth = 0;
rightGpLayout.marginHeight = 0;
- rightGpLayout.verticalSpacing=0;
+ rightGpLayout.verticalSpacing = 0;
rightGp.setLayout(rightGpLayout);
-
- //hodo composite
+
+ // hodo composite
Composite hodoComp = new Composite(rightGp, SWT.NONE);
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
hodoComp.setLayoutData(hodoGd);
GridLayout hodoLayout = new GridLayout(1, true);
- hodoLayout.marginHeight =0;
- hodoLayout.marginWidth=0;
- hodoLayout.verticalSpacing=0;
+ hodoLayout.marginHeight = 0;
+ hodoLayout.marginWidth = 0;
+ hodoLayout.verticalSpacing = 0;
hodoComp.setLayout(hodoLayout);
- nsharpComp[DISPLAY_HODO] = hodoComp;
- //data composite
+ nsharpComp[DISPLAY_HODO] = hodoComp;
+ // data composite
Composite dataComp = new Composite(rightGp, SWT.NONE);
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, true);
dataComp.setLayoutData(dataGd);
GridLayout dataLayout = new GridLayout(1, true);
dataLayout.marginHeight = 1;
- dataLayout.marginWidth=0;
+ dataLayout.marginWidth = 0;
dataComp.setLayout(dataLayout);
- nsharpComp[DISPLAY_DATA] = dataComp;
+ nsharpComp[DISPLAY_DATA] = dataComp;
}
protected void registerHandlers() {
- for(int i=0; i < displayPane.length; i++){
- if(displayPane[i]!=null){
- IDisplayPane pane = displayPane[i];
- InputHandlerDefaultImpl mouseHandler=null;
- InputManager inputMgr;
- // Enable the mouse inspect adapter
- if(i == DISPLAY_SKEWT){
- skewtPaneMouseHandler = new NsharpSkewTPaneMouseHandler(this, pane);
- mouseHandler = skewtPaneMouseHandler;
- inputMgr = skewtInputManager;
- }
- else if(i == DISPLAY_HODO) {
+ for (int i = 0; i < displayPane.length; i++) {
+ if (displayPane[i] != null) {
+ IDisplayPane pane = displayPane[i];
+ InputHandlerDefaultImpl mouseHandler = null;
+ InputManager inputMgr;
+ // Enable the mouse inspect adapter
+ if (i == DISPLAY_SKEWT) {
+ skewtPaneMouseHandler = new NsharpSkewTPaneMouseHandler(
+ this, pane);
+ mouseHandler = skewtPaneMouseHandler;
+ inputMgr = skewtInputManager;
+ } else if (i == DISPLAY_HODO) {
+ hodoInputManager = new InputManager(this);
+ hodoPaneMouseHandler = new NsharpHodoPaneMouseHandler(this,
+ pane);
+ mouseHandler = hodoPaneMouseHandler;
+ inputMgr = hodoInputManager;
+ } else if (i == DISPLAY_TIMESTN) {
+ timeStnPaneMouseHandler = new NsharpTimeStnPaneMouseHandler(
+ this, pane);
+ mouseHandler = timeStnPaneMouseHandler;
+ inputMgr = timeStnInputManager;
+ } else if (i == DISPLAY_INSET) {
+ insetPaneMouseHandler = new NsharpAbstractMouseHandler(
+ this, pane);
+ mouseHandler = insetPaneMouseHandler;
+ inputMgr = insetInputManager;
+ } else if (i == DISPLAY_SPC_GRAPHS) {
+ spcGraphsPaneMouseHandler = new NsharpAbstractMouseHandler(
+ this, pane);
+ mouseHandler = spcGraphsPaneMouseHandler;
+ inputMgr = spcGraphsInputManager;
+ } else if (i == DISPLAY_DATA) {
+ dataPaneMouseHandler = new NsharpDataPaneMouseHandler(this,
+ pane);
+ mouseHandler = dataPaneMouseHandler;
+ inputMgr = dataInputManager;
+ } else
+ continue;
- hodoPaneMouseHandler = new NsharpHodoPaneMouseHandler(this,pane);
- mouseHandler =hodoPaneMouseHandler;
- inputMgr =hodoInputManager;
- }
- else if(i== DISPLAY_TIMESTN) {
- timeStnPaneMouseHandler = new NsharpTimeStnPaneMouseHandler(this,pane);
- mouseHandler =timeStnPaneMouseHandler;
- inputMgr =timeStnInputManager;
- }
- else if(i== DISPLAY_INSET) {
- insetPaneMouseHandler = new NsharpAbstractMouseHandler(this,pane);
- mouseHandler =insetPaneMouseHandler;
- inputMgr =insetInputManager;
- }
- else if(i== DISPLAY_SPC_GRAPHS) {
- spcGraphsPaneMouseHandler = new NsharpAbstractMouseHandler(this,pane);
- mouseHandler =spcGraphsPaneMouseHandler;
- inputMgr =spcGraphsInputManager;
- }
- else if(i== DISPLAY_DATA){
- dataPaneMouseHandler = new NsharpDataPaneMouseHandler(this,pane);
- mouseHandler =dataPaneMouseHandler;
- inputMgr =dataInputManager;
- }
- else
- continue;
+ inputMgr.registerMouseHandler(mouseHandler);
- inputMgr.registerMouseHandler(mouseHandler);
-
- pane.addListener(SWT.MouseUp, inputMgr);
- pane.addListener(SWT.MouseDown, inputMgr);
- pane.addListener(SWT.MouseMove, inputMgr);
- pane.addListener(SWT.MouseWheel, inputMgr);
- pane.addListener(SWT.MouseHover, inputMgr);
- pane.addListener(SWT.MouseEnter, inputMgr);
- pane.addListener(SWT.MouseExit, inputMgr);
- pane.addListener(SWT.MenuDetect, inputMgr);
- pane.addListener(SWT.KeyUp, inputMgr);
- pane.addListener(SWT.KeyDown, inputMgr);
- }
- }
+ pane.addListener(SWT.MouseUp, inputMgr);
+ pane.addListener(SWT.MouseDown, inputMgr);
+ pane.addListener(SWT.MouseMove, inputMgr);
+ pane.addListener(SWT.MouseWheel, inputMgr);
+ pane.addListener(SWT.MouseHover, inputMgr);
+ pane.addListener(SWT.MouseEnter, inputMgr);
+ pane.addListener(SWT.MouseExit, inputMgr);
+ pane.addListener(SWT.MenuDetect, inputMgr);
+ pane.addListener(SWT.KeyUp, inputMgr);
+ pane.addListener(SWT.KeyDown, inputMgr);
+ }
+ }
}
-
@Override
public void init(IEditorSite site, IEditorInput editorInput)
throws PartInitException {
- //System.out.println("NsharpEditor init!! " + this.toString() );
- NsharpConfigManager configMgr = NsharpConfigManager.getInstance();
- NsharpConfigStore configStore = configMgr.retrieveNsharpConfigStoreFromFs();
- NsharpGraphProperty graphConfigProperty = configStore.getGraphProperty();
- paneConfigurationName = graphConfigProperty.getPaneConfigurationName();
- if(!paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR) && !paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR))
- paneConfigurationName = NsharpConstants.PANE_SIMPLE_D2D_CFG_STR;
- initDisplayPublicParms();
- createRenderableDisplayArray();
- /*
- * Chin note: we ignore "Renderable displays" sent with "editorInput" parameter here, as in D2D
- * application the "Renderable displays" only contains skewTPaneDisplay.
- * We recreate displayArray and reset them to EditorInput here based on current "paneConfigurationName"
- *
- */
-
- EditorInput edInput = (EditorInput)editorInput;
+ // System.out.println("NsharpEditor init!! " + this.toString() );
+ NsharpConfigManager configMgr = NsharpConfigManager.getInstance();
+ NsharpConfigStore configStore = configMgr
+ .retrieveNsharpConfigStoreFromFs();
+ NsharpGraphProperty graphConfigProperty = configStore
+ .getGraphProperty();
+ paneConfigurationName = graphConfigProperty.getPaneConfigurationName();
+ if (!paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)
+ && !paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)
+ && !paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) // d2dlite
+ paneConfigurationName = NsharpConstants.PANE_SIMPLE_D2D_CFG_STR;
+ initDisplayPublicParms();
+ createRenderableDisplayArray();
+ /*
+ * Chin note: we ignore "Renderable displays" sent with "editorInput"
+ * parameter here, as in D2D application the "Renderable displays" only
+ * contains skewTPaneDisplay. We recreate displayArray and reset them to
+ * EditorInput here based on current "paneConfigurationName"
+ */
+
+ EditorInput edInput = (EditorInput) editorInput;
boolean getRscHandlerDone = false;
- // bsteffen: reuse any displays that already exist in the current editorInput
- for(IRenderableDisplay display : edInput.getRenderableDisplays()){
+ // bsteffen: reuse any displays that already exist in the current
+ // editorInput
+ for (IRenderableDisplay display : edInput.getRenderableDisplays()) {
int index = -1;
- if(display instanceof NsharpSkewTPaneDisplay ){
+ if (display instanceof NsharpSkewTPaneDisplay) {
index = DISPLAY_SKEWT;
- }else if(display instanceof NsharpWitoPaneDisplay ){
+ } else if (display instanceof NsharpWitoPaneDisplay) {
index = DISPLAY_WITO;
- }else if(display instanceof NsharpInsetPaneDisplay ){
+ } else if (display instanceof NsharpInsetPaneDisplay) {
index = DISPLAY_INSET;
- }else if(display instanceof NsharpHodoPaneDisplay ){
+ } else if (display instanceof NsharpHodoPaneDisplay) {
index = DISPLAY_HODO;
- }else if(display instanceof NsharpTimeStnPaneDisplay ){
+ } else if (display instanceof NsharpTimeStnPaneDisplay) {
index = DISPLAY_TIMESTN;
- }else if(display instanceof NsharpDataPaneDisplay ){
+ } else if (display instanceof NsharpDataPaneDisplay) {
index = DISPLAY_DATA;
- }else if(display instanceof NsharpSpcGraphsPaneDisplay ){
+ } else if (display instanceof NsharpSpcGraphsPaneDisplay) {
index = DISPLAY_SPC_GRAPHS;
- }else if(display instanceof NsharpAbstractPaneDisplay ){
+ } else if (display instanceof NsharpAbstractPaneDisplay) {
index = DISPLAY_FUTURE;
}
- if(index >= 0){
- //System.out.println("displayArray["+index+"] was "+ displayArray[index]+" set to "+display.toString());
- displayArray[index].dispose();
+ if (index >= 0) {
+ // System.out.println("displayArray["+index+"] was "+
+ // displayArray[index]+" set to "+display.toString());
+ displayArray[index].dispose();
displayArray[index] = display;
- //Chin: only do this once
- if(!getRscHandlerDone){
-
- // attempt to find and reuse rscHandler if possible
- List paneRscs = display.getDescriptor()
- .getResourceList().getResourcesByTypeAsType(
- NsharpAbstractPaneResource.class);
- for (NsharpAbstractPaneResource paneRsc : paneRscs) {
- NsharpResourceHandler handler = paneRsc.getRscHandler();
- if (handler != null) {
- rscHandler = handler;
- getRscHandlerDone = true;
-
- }
- }
- // bsteffen: not sure if this is necessary, getPaneNumber is never used
-// IDescriptor descriptor = display.getDescriptor();
-// if(descriptor instanceof NsharpAbstractPaneDescriptor){
-// ((NsharpAbstractPaneDescriptor) descriptor).setPaneNumber(index);
-// }
+ // Chin: only do this once
+ if (!getRscHandlerDone) {
+
+ // attempt to find and reuse rscHandler if possible
+ List paneRscs = display
+ .getDescriptor()
+ .getResourceList()
+ .getResourcesByTypeAsType(
+ NsharpAbstractPaneResource.class);
+ for (NsharpAbstractPaneResource paneRsc : paneRscs) {
+ NsharpResourceHandler handler = paneRsc.getRscHandler();
+ if (handler != null) {
+ rscHandler = handler;
+ getRscHandlerDone = true;
+
+ }
+ }
+ // bsteffen: not sure if this is necessary, getPaneNumber is
+ // never used
+ // IDescriptor descriptor = display.getDescriptor();
+ // if(descriptor instanceof NsharpAbstractPaneDescriptor){
+ // ((NsharpAbstractPaneDescriptor)
+ // descriptor).setPaneNumber(index);
+ // }
}
}
}
-
- edInput.setRenderableDisplays(displayArray);
- super.init(site, edInput);
+ edInput.setRenderableDisplays(displayArray);
+
+ super.init(site, edInput);
+
+ // if (editorNum == 0 ){
+ // editorNum = EditorManager.getEditorNumber();
+ //
+ // }
+ // // a new instance, do the registration
+ // EditorManager.registerEditorNumber(editorNum);
+ this.setTabTitle(/* editorNum+ */"NsharpEditor");
+
+ // Note: NsharpResourceHandler should be created after editor is
+ // created, so all display pane properties and
+ // pane resource are also constructed
+ // bsteffen: only create rscHandler if it doesn't exist already
+ if (rscHandler == null) {
+ rscHandler = new NsharpResourceHandler(displayArray, this);
+ } else {
+ rscHandler.updateDisplay(displayArray, paneConfigurationName);
+
+ }
+ NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
+ if (paletteWin != null) {
+ paletteWin.restorePaletteWindow(paneConfigurationName,
+ rscHandler.getCurrentGraphMode(),
+ rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
+ rscHandler.isCompareStnIsOn(),
+ rscHandler.isCompareTmIsOn(), rscHandler.isEditGraphOn(),
+ rscHandler.isCompareSndIsOn());
+ }
+ createPaneResource();
+
+ rscHandler.resetData();
+ // listen for changes to renderable displays
+ addRenderableDisplayChangedListener(this);
+ // add a new part listener if not added yet
+ NsharpPartListener.addPartListener();
-// if (editorNum == 0 ){
-// editorNum = EditorManager.getEditorNumber();
-//
-// }
-// // a new instance, do the registration
-// EditorManager.registerEditorNumber(editorNum);
- this.setTabTitle(/*editorNum+*/"NsharpEditor");
-
- //Note: NsharpResourceHandler should be created after editor is created, so all display pane properties and
- // pane resource are also constructed
- // bsteffen: only create rscHandler if it doesn't exist already
- if(rscHandler == null){
- rscHandler = new NsharpResourceHandler(displayArray,this);
- }else{
- rscHandler.updateDisplay(displayArray, paneConfigurationName);
-
- }
- NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
- if(paletteWin!=null){
- paletteWin.restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
- rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
- rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn(), rscHandler.isCompareSndIsOn());
- }
- createPaneResource();
-
- rscHandler.resetData();
- // listen for changes to renderable displays
- addRenderableDisplayChangedListener(this);
- //add a new part listener if not added yet
- NsharpPartListener.addPartListener();
-
}
-
/*
* (non-Javadoc)
*
@@ -902,8 +1055,8 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
*/
@Override
public void setFocus() {
- if(selectedPane!= null)
- selectedPane.setFocus();
+ if (selectedPane != null)
+ selectedPane.setFocus();
}
/*
@@ -913,149 +1066,163 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
*/
@Override
public void dispose() {
- //System.out.println("NsharpEditor disposed!! " );
-// if (EditorManager.unregisterEditorNumber(editorNum) ==0 ){
- super.dispose();
- synchronized (this) {
- if (skewtPaneMouseHandler != null && skewtInputManager != null) {
- skewtPaneMouseHandler.setEditor(null);
- skewtPaneMouseHandler.disposeCursor();
- skewtInputManager.unregisterMouseHandler(skewtPaneMouseHandler);
- skewtPaneMouseHandler = null;
- skewtInputManager = null;
- }
- if (hodoPaneMouseHandler != null && hodoInputManager != null) {
- hodoPaneMouseHandler.setEditor(null);
- hodoInputManager.unregisterMouseHandler(hodoPaneMouseHandler);
- hodoPaneMouseHandler = null;
- hodoInputManager = null;
- }
- if (dataPaneMouseHandler != null && dataInputManager != null) {
- dataPaneMouseHandler.setEditor(null);
- dataInputManager.unregisterMouseHandler(dataPaneMouseHandler);
- dataPaneMouseHandler = null;
- dataInputManager = null;
- }
- if (insetPaneMouseHandler != null && insetInputManager != null) {
- insetPaneMouseHandler.setEditor(null);
- insetInputManager.unregisterMouseHandler(insetPaneMouseHandler);
- insetPaneMouseHandler = null;
- insetInputManager = null;
- }
- if (spcGraphsPaneMouseHandler != null && spcGraphsInputManager != null) {
- spcGraphsPaneMouseHandler.setEditor(null);
- spcGraphsInputManager.unregisterMouseHandler(spcGraphsPaneMouseHandler);
- spcGraphsPaneMouseHandler = null;
- spcGraphsInputManager = null;
- }
- if (timeStnPaneMouseHandler != null && timeStnInputManager != null) {
- timeStnPaneMouseHandler.setEditor(null);
- timeStnInputManager.unregisterMouseHandler(timeStnPaneMouseHandler);
- timeStnPaneMouseHandler = null;
- timeStnInputManager = null;
- }
+ // System.out.println("NsharpEditor disposed!! " );
+ // if (EditorManager.unregisterEditorNumber(editorNum) ==0 ){
+ super.dispose();
+ synchronized (this) {
+ if (skewtPaneMouseHandler != null && skewtInputManager != null) {
+ skewtPaneMouseHandler.setEditor(null);
+ skewtPaneMouseHandler.disposeCursor();
+ skewtInputManager.unregisterMouseHandler(skewtPaneMouseHandler);
+ skewtPaneMouseHandler = null;
+ skewtInputManager = null;
+ }
+ if (hodoPaneMouseHandler != null && hodoInputManager != null) {
+ hodoPaneMouseHandler.setEditor(null);
+ hodoInputManager.unregisterMouseHandler(hodoPaneMouseHandler);
+ hodoPaneMouseHandler = null;
+ hodoInputManager = null;
+ }
+ if (dataPaneMouseHandler != null && dataInputManager != null) {
+ dataPaneMouseHandler.setEditor(null);
+ dataInputManager.unregisterMouseHandler(dataPaneMouseHandler);
+ dataPaneMouseHandler = null;
+ dataInputManager = null;
+ }
+ if (insetPaneMouseHandler != null && insetInputManager != null) {
+ insetPaneMouseHandler.setEditor(null);
+ insetInputManager.unregisterMouseHandler(insetPaneMouseHandler);
+ insetPaneMouseHandler = null;
+ insetInputManager = null;
+ }
+ if (spcGraphsPaneMouseHandler != null
+ && spcGraphsInputManager != null) {
+ spcGraphsPaneMouseHandler.setEditor(null);
+ spcGraphsInputManager
+ .unregisterMouseHandler(spcGraphsPaneMouseHandler);
+ spcGraphsPaneMouseHandler = null;
+ spcGraphsInputManager = null;
+ }
+ if (timeStnPaneMouseHandler != null && timeStnInputManager != null) {
+ timeStnPaneMouseHandler.setEditor(null);
+ timeStnInputManager
+ .unregisterMouseHandler(timeStnPaneMouseHandler);
+ timeStnPaneMouseHandler = null;
+ timeStnInputManager = null;
+ }
+
+ // editorNum=0;
+ // bsteffen only dispose the rscHandler if not swapping.
+ // d2dlite if (!displayArray[DISPLAY_SKEWT].isSwapping()) {
+ if (!displayArray[DISPLAY_Head].isSwapping()) {
+ if (rscHandler != null) {
+ rscHandler.disposeInternal();
+ }
+ }
+ rscHandler = null;
+ }
+ // }
+ try {
+ IWorkbenchPage wpage = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ IViewPart vpart = wpage
+ .findView("gov.noaa.nws.ncep.ui.nsharp.defaultview1");
+ wpage.hideView(vpart);
+ } catch (Exception e) {
+
+ }
-// editorNum=0;
- // bsteffen only dispose the rscHandler if not swapping.
- if(!displayArray[DISPLAY_SKEWT].isSwapping()){
- if(rscHandler!=null){
- rscHandler.disposeInternal();
- }
- }
- rscHandler = null;
- }
-// }
- try{
- IWorkbenchPage wpage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IViewPart vpart = wpage.findView( "gov.noaa.nws.ncep.ui.nsharp.defaultview1" );
- wpage.hideView(vpart);
- }
- catch(Exception e){
-
- }
-
-
}
public void restartEditor(String paneConfigurationName) {
- //System.out.println("reStartEditor! " );
- this.paneConfigurationName = paneConfigurationName ;
- if (skewtPaneMouseHandler != null && skewtInputManager != null) {
- skewtPaneMouseHandler.setEditor(null);
- skewtInputManager.unregisterMouseHandler(skewtPaneMouseHandler);
- skewtPaneMouseHandler = null;
- skewtInputManager = null;
- }
- if (hodoPaneMouseHandler != null && hodoInputManager != null) {
- hodoPaneMouseHandler.setEditor(null);
- hodoInputManager.unregisterMouseHandler(hodoPaneMouseHandler);
- hodoPaneMouseHandler = null;
- hodoInputManager = null;
- }
- if (dataPaneMouseHandler != null && dataInputManager != null) {
- dataPaneMouseHandler.setEditor(null);
- dataInputManager.unregisterMouseHandler(dataPaneMouseHandler);
- dataPaneMouseHandler = null;
- dataInputManager = null;
- }
- if (insetPaneMouseHandler != null && insetInputManager != null) {
- insetPaneMouseHandler.setEditor(null);
- insetInputManager.unregisterMouseHandler(insetPaneMouseHandler);
- insetPaneMouseHandler = null;
- insetInputManager = null;
- }
- if (spcGraphsPaneMouseHandler != null && spcGraphsInputManager != null) {
- spcGraphsPaneMouseHandler.setEditor(null);
- spcGraphsInputManager.unregisterMouseHandler(spcGraphsPaneMouseHandler);
- spcGraphsPaneMouseHandler = null;
- spcGraphsInputManager = null;
- }
- if (timeStnPaneMouseHandler != null && timeStnInputManager != null) {
- timeStnPaneMouseHandler.setEditor(null);
- timeStnInputManager.unregisterMouseHandler(timeStnPaneMouseHandler);
- timeStnPaneMouseHandler = null;
- timeStnInputManager = null;
- }
- baseComposite.removeListener(SWT.Resize, resizeLsner);
- displayArray = null;
- nsharpComp=null;
- if(displayPane!=null){
- for (VizDisplayPane pane: displayPane){
- if(pane!=null)
- pane.dispose();
- }
- }
- displayPane = null;
- rightTopGp= leftTopGp= leftBotGp= leftGp= rightGp= topGp= botGp=null;
- //createOrUpdateEditor(true);
- updateEditor();
- restarting = true;
- createPartControl(parantComp);
- editorInput.setRenderableDisplays(getRenderableDisplays());
- //Chin: note: after reset all resource in editor, editor displays an empty screen. Refresh() does not work.
- //Therefore, play the following trick. I.e. bring map editor to top and then this editor to top. After this trick,
- // editor displays normally.
- parantComp.layout(); // from ben
- //NsharpMapResource.bringMapEditorToTop();
- //bringEditorToTop();
- NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
- if(paletteWin!=null){
- paletteWin.updateSpcGraphBtn(paneConfigurationName);
- }
+ // System.out.println("reStartEditor! " );
+ if (rscHandler != null
+ && !this.paneConfigurationName.equals(paneConfigurationName)) {
+ rscHandler.setPaneConfigurationName(paneConfigurationName);
+ }
+ this.paneConfigurationName = paneConfigurationName;
+
+ if (skewtPaneMouseHandler != null && skewtInputManager != null) {
+ skewtPaneMouseHandler.setEditor(null);
+ skewtInputManager.unregisterMouseHandler(skewtPaneMouseHandler);
+ skewtPaneMouseHandler = null;
+ skewtInputManager = null;
+ }
+ if (hodoPaneMouseHandler != null && hodoInputManager != null) {
+ hodoPaneMouseHandler.setEditor(null);
+ hodoInputManager.unregisterMouseHandler(hodoPaneMouseHandler);
+ hodoPaneMouseHandler = null;
+ hodoInputManager = null;
+ }
+ if (dataPaneMouseHandler != null && dataInputManager != null) {
+ dataPaneMouseHandler.setEditor(null);
+ dataInputManager.unregisterMouseHandler(dataPaneMouseHandler);
+ dataPaneMouseHandler = null;
+ dataInputManager = null;
+ }
+ if (insetPaneMouseHandler != null && insetInputManager != null) {
+ insetPaneMouseHandler.setEditor(null);
+ insetInputManager.unregisterMouseHandler(insetPaneMouseHandler);
+ insetPaneMouseHandler = null;
+ insetInputManager = null;
+ }
+ if (spcGraphsPaneMouseHandler != null && spcGraphsInputManager != null) {
+ spcGraphsPaneMouseHandler.setEditor(null);
+ spcGraphsInputManager
+ .unregisterMouseHandler(spcGraphsPaneMouseHandler);
+ spcGraphsPaneMouseHandler = null;
+ spcGraphsInputManager = null;
+ }
+ if (timeStnPaneMouseHandler != null && timeStnInputManager != null) {
+ timeStnPaneMouseHandler.setEditor(null);
+ timeStnInputManager.unregisterMouseHandler(timeStnPaneMouseHandler);
+ timeStnPaneMouseHandler = null;
+ timeStnInputManager = null;
+ }
+ baseComposite.removeListener(SWT.Resize, resizeLsner);
+ displayArray = null;
+ nsharpComp = null;
+ if (displayPane != null) {
+ for (VizDisplayPane pane : displayPane) {
+ if (pane != null)
+ pane.dispose();
+ }
+ }
+ displayPane = null;
+ rightTopGp = leftTopGp = leftBotGp = leftGp = rightGp = topGp = botGp = null;
+ // createOrUpdateEditor(true);
+ updateEditor();
+ restarting = true;
+ createPartControl(parantComp);
+ editorInput.setRenderableDisplays(getRenderableDisplays());
+ // Chin: note: after reset all resource in editor, editor displays an
+ // empty screen. Refresh() does not work.
+ // Therefore, play the following trick. I.e. bring map editor to top and
+ // then this editor to top. After this trick,
+ // editor displays normally.
+ parantComp.layout(); // from ben
+ // NsharpMapResource.bringMapEditorToTop();
+ // bringEditorToTop();
+ NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
+ if (paletteWin != null) {
+ paletteWin.updateSpecialGraphBtn(paneConfigurationName);
+ }
}
+
/**
* Perform a refresh asynchronously
*
*/
@Override
public void refresh() {
- if(displayPane!= null)
- for (IDisplayPane pane : displayPane) {
- if(pane!=null)
- pane.refresh();
- }
- //System.out.println("NsharpEditor refresh called");
+ if (displayPane != null)
+ for (IDisplayPane pane : displayPane) {
+ if (pane != null)
+ pane.refresh();
+ }
+ // System.out.println("NsharpEditor refresh called");
}
+
@Override
public Coordinate translateClick(double x, double y) {
double[] grid = getActiveDisplayPane().screenToGrid(x, y, 0);
@@ -1063,7 +1230,7 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
return new Coordinate(grid[0], grid[1], grid[2]);
}
- @Override
+ @Override
public double[] translateInverseClick(Coordinate c) {
if (Double.isNaN(c.z)) {
@@ -1073,26 +1240,28 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
new double[] { c.x, c.y, c.z });
}
- public void resetGraph(){
- for(int i=0; i < DISPLAY_TOTAL; i++){
- if(displayPane[i]!=null){
- displayPane[i].getRenderableDisplay().getExtent().reset();
- displayPane[i].getRenderableDisplay().zoom(1.0);
- displayPane[i].getRenderableDisplay().refresh();
- }
- }
- if(rscHandler!=null) {
- if(rscHandler.getWitoPaneRsc()!=null){
- rscHandler.getWitoPaneRsc().createAllWireFrameShapes();
- }
- //rscHandler.getSkewtPaneRsc().handleZooming();
- }
+ public void resetGraph() {
+ for (int i = 0; i < DISPLAY_TOTAL; i++) {
+ if (displayPane[i] != null) {
+ displayPane[i].getRenderableDisplay().getExtent().reset();
+ displayPane[i].getRenderableDisplay().zoom(1.0);
+ displayPane[i].getRenderableDisplay().refresh();
+ }
+ }
+ if (rscHandler != null) {
+ if (rscHandler.getWitoPaneRsc() != null) {
+ rscHandler.getWitoPaneRsc().createAllWireFrameShapes();
+ }
+ // rscHandler.getSkewtPaneRsc().handleZooming();
+ }
}
- public void registerMouseHandler(IInputHandler handler, IInputHandler.InputPriority priority) {
- if(skewtInputManager!=null)
- skewtInputManager.registerMouseHandler(handler, priority);
+
+ public void registerMouseHandler(IInputHandler handler,
+ IInputHandler.InputPriority priority) {
+ if (skewtInputManager != null)
+ skewtInputManager.registerMouseHandler(handler, priority);
}
-
+
/**
* Register a mouse handler to a map
*
@@ -1101,8 +1270,8 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
*/
@Override
public void registerMouseHandler(IInputHandler handler) {
- if(skewtInputManager != null)
- skewtInputManager.registerMouseHandler(handler);
+ if (skewtInputManager != null)
+ skewtInputManager.registerMouseHandler(handler);
}
/**
@@ -1118,37 +1287,41 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
skewtInputManager.unregisterMouseHandler(handler);
}
}
+
@Override
public IDisplayPane[] getDisplayPanes() {
- //System.out.println("SkewtEditor getDisplayPanes called");
- //return getDisplayPaneArray();//this.displayPane;
- // changed for D2D
- if(displayPane.length <=0)
- try {
- throw new VizException("Display pane is not available!");
- } catch (VizException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- IDisplayPane[] pan = { displayPane[DISPLAY_SKEWT]};
- return pan;
-
-
+ // System.out.println("SkewtEditor getDisplayPanes called");
+ // return getDisplayPaneArray();//this.displayPane;
+ // changed for D2D
+ if (displayPane.length <= 0)
+ try {
+ throw new VizException("Display pane is not available!");
+ } catch (VizException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ IDisplayPane[] pan = { displayPane[DISPLAY_Head] };// d2dlite
+ // DISPLAY_SKEWT] };
+ return pan;
+
}
+
public IRenderableDisplay[] getRenderableDisplays() {
IRenderableDisplay[] displays = new IRenderableDisplay[displayPane.length];
int i = 0;
for (IDisplayPane pane : displayPane) {
- displays[i++] = pane.getRenderableDisplay();
+ if (pane != null)
+ displays[i++] = pane.getRenderableDisplay();
}
return displays;
}
-
+
@Override
public IEditorInput getEditorInput() {
- // editorInput.setRenderableDisplays(getRenderableDisplays());
+ // editorInput.setRenderableDisplays(getRenderableDisplays());
return editorInput;
}
+
/**
* Returns the mouse manager
*
@@ -1165,219 +1338,341 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
*/
@Override
public IDisplayPane getActiveDisplayPane() {
- return selectedPane;
- //return this.displayPane[0];
+ return selectedPane;
+ // return this.displayPane[0];
}
-
+
@Override
- public NCLoopProperties getLoopProperties(){
- // bsteffen added check for type and force it to NCLoopProperties
+ public NCLoopProperties getLoopProperties() {
+ // bsteffen added check for type and force it to NCLoopProperties
LoopProperties loopProperties = this.editorInput.getLoopProperties();
- if(!(loopProperties instanceof NCLoopProperties)) {
+ if (!(loopProperties instanceof NCLoopProperties)) {
this.editorInput.setLoopProperties(new NCLoopProperties());
}
- return (NCLoopProperties)this.editorInput.getLoopProperties();
+ return (NCLoopProperties) this.editorInput.getLoopProperties();
}
- @Override
- protected PaneManager getNewPaneManager() {
- //return new PaneManager();
- return null;
- }
- private void initDisplayPublicParms(){
- if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
- //DISPLAY_SKEWT = 0;
- DISPLAY_WITO= DISPLAY_SKEWT+1;
- DISPLAY_INSET= DISPLAY_WITO+1;
- DISPLAY_HODO= DISPLAY_INSET+1;
- DISPLAY_DATA= DISPLAY_HODO+1;
- DISPLAY_SPC_GRAPHS= DISPLAY_DATA+1;
- DISPLAY_TOTAL= DISPLAY_SPC_GRAPHS+1;
- DISPLAY_FUTURE = -1;
- DISPLAY_TIMESTN = -1;
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- //DISPLAY_SKEWT = 0;
- DISPLAY_TIMESTN= DISPLAY_SKEWT+1;
- DISPLAY_HODO= DISPLAY_TIMESTN+1;
- DISPLAY_DATA=DISPLAY_HODO+1;
- DISPLAY_FUTURE= DISPLAY_DATA+1;
- DISPLAY_TOTAL= DISPLAY_FUTURE+1;
- DISPLAY_WITO= -1;
- DISPLAY_INSET= -1;
- DISPLAY_SPC_GRAPHS = -1;
- }
- else { // case of default1 and default 2 pane configurations
- //DISPLAY_SKEWT = 0;
- DISPLAY_WITO= DISPLAY_SKEWT+1;
- DISPLAY_INSET= DISPLAY_WITO+1;
- DISPLAY_HODO= DISPLAY_INSET+1;
- DISPLAY_TIMESTN= DISPLAY_HODO+1;
- DISPLAY_DATA=DISPLAY_TIMESTN+1;
- DISPLAY_TOTAL= DISPLAY_DATA+1;
- DISPLAY_FUTURE = -1;
- DISPLAY_SPC_GRAPHS = -1;
- }
- nsharpComp = new Composite[DISPLAY_TOTAL];
- displayPane = new VizDisplayPane[DISPLAY_TOTAL];
- displayArray = new IRenderableDisplay[DISPLAY_TOTAL];
- }
- /*
- * Note: initDisplayPublicParms() should be called before calling this function
- */
- private IRenderableDisplay[] createRenderableDisplayArray(){
- if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
-
- displayArray[DISPLAY_SKEWT]= new NsharpSkewTPaneDisplay(new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),DISPLAY_SKEWT);
- displayArray[DISPLAY_WITO]= new NsharpWitoPaneDisplay(new PixelExtent(NsharpConstants.WITO_DISPLAY_REC),DISPLAY_WITO);
- displayArray[DISPLAY_HODO]= new NsharpHodoPaneDisplay(new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),DISPLAY_HODO);
- displayArray[DISPLAY_DATA]= new NsharpDataPaneDisplay(new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),DISPLAY_DATA);
- displayArray[DISPLAY_INSET]= new NsharpInsetPaneDisplay(new PixelExtent(NsharpConstants.INSET_DISPLAY_REC),DISPLAY_INSET);
- displayArray[DISPLAY_SPC_GRAPHS]= new NsharpSpcGraphsPaneDisplay(new PixelExtent(NsharpConstants.SPC_GRAPH_DISPLAY_REC),DISPLAY_SPC_GRAPHS);
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- displayArray[DISPLAY_SKEWT]= new NsharpSkewTPaneDisplay(new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),DISPLAY_SKEWT);
- displayArray[DISPLAY_HODO]= new NsharpHodoPaneDisplay(new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),DISPLAY_HODO);
- displayArray[DISPLAY_DATA]= new NsharpDataPaneDisplay(new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),DISPLAY_DATA);
- displayArray[DISPLAY_TIMESTN]= new NsharpTimeStnPaneDisplay(new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),DISPLAY_TIMESTN);
- displayArray[DISPLAY_FUTURE]= new NsharpAbstractPaneDisplay(new PixelExtent(NsharpConstants.FUTURE_DISPLAY_REC),DISPLAY_FUTURE);
- }
- else { // case of default1 and default 2 pane configurations
- displayArray[DISPLAY_SKEWT]= new NsharpSkewTPaneDisplay(new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),DISPLAY_SKEWT);
- displayArray[DISPLAY_WITO]= new NsharpWitoPaneDisplay(new PixelExtent(NsharpConstants.WITO_DISPLAY_REC),DISPLAY_WITO);
- displayArray[DISPLAY_HODO]= new NsharpHodoPaneDisplay(new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),DISPLAY_HODO);
- displayArray[DISPLAY_DATA]= new NsharpDataPaneDisplay(new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),DISPLAY_DATA);
- displayArray[DISPLAY_INSET]= new NsharpInsetPaneDisplay(new PixelExtent(NsharpConstants.INSET_DISPLAY_REC),DISPLAY_INSET);
- displayArray[DISPLAY_TIMESTN]= new NsharpTimeStnPaneDisplay(new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),DISPLAY_TIMESTN);
- }
- return displayArray;
- }
- /*
- * Note: initDisplayPublicParms() and createRenderableDisplayArray() should be called before calling this function
- */
- private void createPaneResource(){
-
- ResourcePair skewtRscPair = displayArray[DISPLAY_SKEWT].getDescriptor().getResourceList().get(0);
- NsharpSkewTPaneResource skewtPaneRsc=null;
- if (skewtRscPair.getResource() instanceof NsharpSkewTPaneResource){
- skewtPaneRsc = (NsharpSkewTPaneResource)skewtRscPair.getResource() ;
- skewtPaneRsc.setRscHandler(rscHandler);
- }
- ResourcePair dataRscPair = displayArray[DISPLAY_DATA].getDescriptor().getResourceList().get(0);
- if (dataRscPair.getResource() instanceof NsharpDataPaneResource){
- NsharpDataPaneResource dataPaneRsc = (NsharpDataPaneResource)dataRscPair.getResource() ;
- dataPaneRsc.setRscHandler(rscHandler);
- }
+ @Override
+ protected PaneManager getNewPaneManager() {
+ // return new PaneManager();
+ return null;
+ }
- ResourcePair hodoRscPair = displayArray[DISPLAY_HODO].getDescriptor().getResourceList().get(0);
- if (hodoRscPair.getResource() instanceof NsharpHodoPaneResource){
- NsharpHodoPaneResource hodoPaneRsc = (NsharpHodoPaneResource)hodoRscPair.getResource() ;
- hodoPaneRsc.setRscHandler(rscHandler);
- }
+ private void initDisplayPublicParms() {
+ if (paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ DISPLAY_SKEWT = 0;
+ DISPLAY_WITO = DISPLAY_SKEWT + 1;
+ DISPLAY_INSET = DISPLAY_WITO + 1;
+ DISPLAY_HODO = DISPLAY_INSET + 1;
+ DISPLAY_DATA = DISPLAY_HODO + 1;
+ DISPLAY_SPC_GRAPHS = DISPLAY_DATA + 1;
+ DISPLAY_TOTAL = DISPLAY_SPC_GRAPHS + 1;
+ DISPLAY_FUTURE = -1;
+ DISPLAY_TIMESTN = -1;
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ DISPLAY_SKEWT = 0;
+ DISPLAY_TIMESTN = DISPLAY_SKEWT + 1;
+ DISPLAY_HODO = DISPLAY_TIMESTN + 1;
+ DISPLAY_DATA = DISPLAY_HODO + 1;
+ DISPLAY_FUTURE = DISPLAY_DATA + 1;
+ DISPLAY_TOTAL = DISPLAY_FUTURE + 1;
+ DISPLAY_WITO = -1;
+ DISPLAY_INSET = -1;
+ DISPLAY_SPC_GRAPHS = -1;
+ } else if (paneConfigurationName // d2dlite start
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ if (rscHandler != null
+ && rscHandler.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) {
+ DISPLAY_HODO = 0;
+ DISPLAY_TIMESTN = DISPLAY_HODO + 1;
+ DISPLAY_SKEWT = -1;
+ } else {
+ DISPLAY_SKEWT = 0;
+ DISPLAY_TIMESTN = DISPLAY_SKEWT + 1;
+ DISPLAY_HODO = -1;
+ }
+ DISPLAY_DATA = DISPLAY_TIMESTN + 1;
+ DISPLAY_TOTAL = DISPLAY_DATA + 1;
+ DISPLAY_FUTURE = -1;
+ DISPLAY_WITO = -1;
+ DISPLAY_INSET = -1;
+ DISPLAY_SPC_GRAPHS = -1; // d2dlite end
+ } else { // case of default1 and default 2 pane configurations
+ DISPLAY_SKEWT = 0;
+ DISPLAY_WITO = DISPLAY_SKEWT + 1;
+ DISPLAY_INSET = DISPLAY_WITO + 1;
+ DISPLAY_HODO = DISPLAY_INSET + 1;
+ DISPLAY_TIMESTN = DISPLAY_HODO + 1;
+ DISPLAY_DATA = DISPLAY_TIMESTN + 1;
+ DISPLAY_TOTAL = DISPLAY_DATA + 1;
+ DISPLAY_FUTURE = -1;
+ DISPLAY_SPC_GRAPHS = -1;
+ }
+ nsharpComp = new Composite[DISPLAY_TOTAL];
+ displayPane = new VizDisplayPane[DISPLAY_TOTAL];
+ displayArray = new IRenderableDisplay[DISPLAY_TOTAL];
+ }
- if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)||
- paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)||
- paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
- ResourcePair witoRscPair = displayArray[DISPLAY_WITO].getDescriptor().getResourceList().get(0);
- if (witoRscPair.getResource() instanceof NsharpWitoPaneResource){
- NsharpWitoPaneResource witoPaneRsc = (NsharpWitoPaneResource)witoRscPair.getResource() ;
- witoPaneRsc.setRscHandler(rscHandler);
- }
+ /*
+ * Note: initDisplayPublicParms() should be called before calling this
+ * function
+ */
+ private IRenderableDisplay[] createRenderableDisplayArray() {
+ if (paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ displayArray[DISPLAY_SKEWT] = new NsharpSkewTPaneDisplay(
+ new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),
+ DISPLAY_SKEWT);
+ displayArray[DISPLAY_WITO] = new NsharpWitoPaneDisplay(
+ new PixelExtent(NsharpConstants.WITO_DISPLAY_REC),
+ DISPLAY_WITO);
+ displayArray[DISPLAY_HODO] = new NsharpHodoPaneDisplay(
+ new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),
+ DISPLAY_HODO);
+ displayArray[DISPLAY_DATA] = new NsharpDataPaneDisplay(
+ new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),
+ DISPLAY_DATA);
+ displayArray[DISPLAY_INSET] = new NsharpInsetPaneDisplay(
+ new PixelExtent(NsharpConstants.INSET_DISPLAY_REC),
+ DISPLAY_INSET);
+ displayArray[DISPLAY_SPC_GRAPHS] = new NsharpSpcGraphsPaneDisplay(
+ new PixelExtent(NsharpConstants.SPC_GRAPH_DISPLAY_REC),
+ DISPLAY_SPC_GRAPHS);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ displayArray[DISPLAY_SKEWT] = new NsharpSkewTPaneDisplay(
+ new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),
+ DISPLAY_SKEWT);
+ displayArray[DISPLAY_HODO] = new NsharpHodoPaneDisplay(
+ new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),
+ DISPLAY_HODO);
+ displayArray[DISPLAY_DATA] = new NsharpDataPaneDisplay(
+ new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),
+ DISPLAY_DATA);
+ displayArray[DISPLAY_TIMESTN] = new NsharpTimeStnPaneDisplay(
+ new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),
+ DISPLAY_TIMESTN);
+ displayArray[DISPLAY_FUTURE] = new NsharpAbstractPaneDisplay(
+ new PixelExtent(NsharpConstants.FUTURE_DISPLAY_REC),
+ DISPLAY_FUTURE);
+ // d2dlite start
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ if (rscHandler != null
+ && rscHandler.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) {
+ displayArray[DISPLAY_HODO] = new NsharpHodoPaneDisplay(
+ new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),
+ DISPLAY_HODO);
+ } else {
+ displayArray[DISPLAY_SKEWT] = new NsharpSkewTPaneDisplay(
+ new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),
+ DISPLAY_SKEWT);
+ }
+ displayArray[DISPLAY_TIMESTN] = new NsharpTimeStnPaneDisplay(
+ new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),
+ DISPLAY_TIMESTN);
+ displayArray[DISPLAY_DATA] = new NsharpDataPaneDisplay(
+ new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),
+ DISPLAY_DATA);
- ResourcePair insetRscPair = displayArray[DISPLAY_INSET].getDescriptor().getResourceList().get(0);
- if (insetRscPair.getResource() instanceof NsharpInsetPaneResource){
- NsharpInsetPaneResource insetPaneRsc = (NsharpInsetPaneResource)insetRscPair.getResource() ;
- insetPaneRsc.setRscHandler(rscHandler);
- }
- }
- if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
- ResourcePair spcGraphRscPair = displayArray[DISPLAY_SPC_GRAPHS].getDescriptor().getResourceList().get(0);
- if (spcGraphRscPair.getResource() instanceof NsharpSpcGraphsPaneResource){
- NsharpSpcGraphsPaneResource spcPaneRsc = (NsharpSpcGraphsPaneResource)spcGraphRscPair.getResource() ;
- spcPaneRsc.setRscHandler(rscHandler);
- }
- }
- if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- ResourcePair futureRscPair = displayArray[DISPLAY_FUTURE].getDescriptor().getResourceList().get(0);
- if (futureRscPair.getResource() instanceof NsharpAbstractPaneResource){
- NsharpAbstractPaneResource futurePaneRsc = (NsharpAbstractPaneResource)futureRscPair.getResource() ;
- futurePaneRsc.setRscHandler(rscHandler);
- }
- }
- if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)||
- paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)||
- paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
- ResourcePair timeStnRscPair = displayArray[DISPLAY_TIMESTN].getDescriptor().getResourceList().get(0);
- if (timeStnRscPair.getResource() instanceof NsharpTimeStnPaneResource){
- NsharpTimeStnPaneResource timeStnPaneRsc = (NsharpTimeStnPaneResource)timeStnRscPair.getResource() ;
- timeStnPaneRsc.setRscHandler(rscHandler);
- }
- }
- if(skewtPaneRsc!=null){
- skewtPaneRsc.setCurrentGraphMode(rscHandler.getCurrentGraphMode());
- //skewtPaneRsc.handleResize();
- }
- }
-
- private void updateEditor() {
- initDisplayPublicParms();
- createRenderableDisplayArray();
- nsharpComp = new Composite[DISPLAY_TOTAL];
- displayPane = new VizDisplayPane[DISPLAY_TOTAL];
-
- EditorInput edInput = new EditorInput(new NCLoopProperties(),
- displayArray);
+ // d2dlite end
+ } else { // case of default1 and default 2 pane configurations
+ displayArray[DISPLAY_SKEWT] = new NsharpSkewTPaneDisplay(
+ new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),
+ DISPLAY_SKEWT);
+ displayArray[DISPLAY_WITO] = new NsharpWitoPaneDisplay(
+ new PixelExtent(NsharpConstants.WITO_DISPLAY_REC),
+ DISPLAY_WITO);
+ displayArray[DISPLAY_HODO] = new NsharpHodoPaneDisplay(
+ new PixelExtent(NsharpConstants.HODO_DISPLAY_REC),
+ DISPLAY_HODO);
+ displayArray[DISPLAY_DATA] = new NsharpDataPaneDisplay(
+ new PixelExtent(NsharpConstants.DATA_DISPLAY_REC),
+ DISPLAY_DATA);
+ displayArray[DISPLAY_INSET] = new NsharpInsetPaneDisplay(
+ new PixelExtent(NsharpConstants.INSET_DISPLAY_REC),
+ DISPLAY_INSET);
+ displayArray[DISPLAY_TIMESTN] = new NsharpTimeStnPaneDisplay(
+ new PixelExtent(NsharpConstants.TIMESTN_DISPLAY_REC),
+ DISPLAY_TIMESTN);
+ }
+ return displayArray;
+ }
- this.setInput(edInput);
- this.displaysToLoad = displayArray;
- for (IRenderableDisplay display : displayArray) {
- if (display != null) {
- this.initDisplay(display);
- }
- }
- rscHandler.updateDisplay(displayArray,paneConfigurationName);
- rscHandler.resetRscSoundingData();
+ /*
+ * Note: initDisplayPublicParms() and createRenderableDisplayArray() should
+ * be called before calling this function
+ */
+ private void createPaneResource() {
+ NsharpSkewTPaneResource skewtPaneRsc = null;
+ if ((!paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR))
+ || (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR) && rscHandler
+ .getCurrentGraphMode() != NsharpConstants.GRAPH_HODO)) { // d2dlite
+ ResourcePair skewtRscPair = displayArray[DISPLAY_SKEWT]
+ .getDescriptor().getResourceList().get(0);
- createPaneResource();
-
- }
- public static NsharpEditor createOrOpenEditor( ) {
- NsharpEditor editor = getActiveNsharpEditor();
- if (editor != null) {
- //System.out.println("createOrOpenSkewTEditor return existing editor "+ editor.toString());
- return editor;
- } else {
- try {
- /*
- * Chin note: all initialization logics now are done in init() method to support standard eclipse
- * Editor open procedure.
- * At init(), display array and EditorInput will be created based on user configured pane configuration.
- * Therefore, we just create a dummy EditorInput here.
- * The following IWorkbenchPage.openEditor() will eventually invoke init() method.
- */
- IRenderableDisplay[] tempDisp = new IRenderableDisplay[1];
- tempDisp[0] = new NsharpSkewTPaneDisplay(new PixelExtent(NsharpConstants.SKEWT_DISPLAY_REC),0);
- EditorInput edInput = new EditorInput(new NCLoopProperties(),
- tempDisp);
- editor = (NsharpEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(edInput, EDITOR_ID);
-
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- //System.out.println("createOrOpenSkewTEditor return new editor "+ editor.toString());
- return editor;
- }
- }
- public static void bringEditorToTop( ) {
- NsharpEditor editor = getActiveNsharpEditor();
+ if (skewtRscPair.getResource() instanceof NsharpSkewTPaneResource) {
+ skewtPaneRsc = (NsharpSkewTPaneResource) skewtRscPair
+ .getResource();
+ skewtPaneRsc.setRscHandler(rscHandler);
+ }
+
+ }
+ ResourcePair dataRscPair = displayArray[DISPLAY_DATA].getDescriptor()
+ .getResourceList().get(0);
+ if (dataRscPair.getResource() instanceof NsharpDataPaneResource) {
+ NsharpDataPaneResource dataPaneRsc = (NsharpDataPaneResource) dataRscPair
+ .getResource();
+ dataPaneRsc.setRscHandler(rscHandler);
+ }
+ if ((!paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR))
+ || (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR) && rscHandler
+ .getCurrentGraphMode() == NsharpConstants.GRAPH_HODO)) { // d2dlite
+ ResourcePair hodoRscPair = displayArray[DISPLAY_HODO]
+ .getDescriptor().getResourceList().get(0);
+ if (hodoRscPair.getResource() instanceof NsharpHodoPaneResource) {
+ NsharpHodoPaneResource hodoPaneRsc = (NsharpHodoPaneResource) hodoRscPair
+ .getResource();
+ hodoPaneRsc.setRscHandler(rscHandler);
+ }
+ } // d2dlite
+
+ if (paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_2_STR)) {
+ ResourcePair witoRscPair = displayArray[DISPLAY_WITO]
+ .getDescriptor().getResourceList().get(0);
+ if (witoRscPair.getResource() instanceof NsharpWitoPaneResource) {
+ NsharpWitoPaneResource witoPaneRsc = (NsharpWitoPaneResource) witoRscPair
+ .getResource();
+ witoPaneRsc.setRscHandler(rscHandler);
+ }
+
+ ResourcePair insetRscPair = displayArray[DISPLAY_INSET]
+ .getDescriptor().getResourceList().get(0);
+ if (insetRscPair.getResource() instanceof NsharpInsetPaneResource) {
+ NsharpInsetPaneResource insetPaneRsc = (NsharpInsetPaneResource) insetRscPair
+ .getResource();
+ insetPaneRsc.setRscHandler(rscHandler);
+ }
+ }
+ if (paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ ResourcePair spcGraphRscPair = displayArray[DISPLAY_SPC_GRAPHS]
+ .getDescriptor().getResourceList().get(0);
+ if (spcGraphRscPair.getResource() instanceof NsharpSpcGraphsPaneResource) {
+ NsharpSpcGraphsPaneResource spcPaneRsc = (NsharpSpcGraphsPaneResource) spcGraphRscPair
+ .getResource();
+ spcPaneRsc.setRscHandler(rscHandler);
+ }
+ }
+ if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ ResourcePair futureRscPair = displayArray[DISPLAY_FUTURE]
+ .getDescriptor().getResourceList().get(0);
+ if (futureRscPair.getResource() instanceof NsharpAbstractPaneResource) {
+ NsharpAbstractPaneResource futurePaneRsc = (NsharpAbstractPaneResource) futureRscPair
+ .getResource();
+ futurePaneRsc.setRscHandler(rscHandler);
+ }
+ }
+ if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR) // d2dlite
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_2_STR)) {
+ ResourcePair timeStnRscPair = displayArray[DISPLAY_TIMESTN]
+ .getDescriptor().getResourceList().get(0);
+ if (timeStnRscPair.getResource() instanceof NsharpTimeStnPaneResource) {
+ NsharpTimeStnPaneResource timeStnPaneRsc = (NsharpTimeStnPaneResource) timeStnRscPair
+ .getResource();
+ timeStnPaneRsc.setRscHandler(rscHandler);
+ }
+ }
+ if (skewtPaneRsc != null) {
+ skewtPaneRsc.setCurrentGraphMode(rscHandler.getCurrentGraphMode());
+ // skewtPaneRsc.handleResize();
+ }
+ }
+
+ private void updateEditor() {
+ initDisplayPublicParms();
+ createRenderableDisplayArray();
+ nsharpComp = new Composite[DISPLAY_TOTAL];
+ displayPane = new VizDisplayPane[DISPLAY_TOTAL];
+
+ EditorInput edInput = new EditorInput(new NCLoopProperties(),
+ displayArray);
+
+ this.setInput(edInput);
+ this.displaysToLoad = displayArray;
+ for (IRenderableDisplay display : displayArray) {
+ if (display != null) {
+ this.initDisplay(display);
+ }
+ }
+ rscHandler.updateDisplay(displayArray, paneConfigurationName);
+ rscHandler.resetRscSoundingData();
+
+ createPaneResource();
+
+ }
+
+ public static NsharpEditor createOrOpenEditor() {
+ NsharpEditor editor = getActiveNsharpEditor();
+ if (editor != null) {
+ // System.out.println("createOrOpenSkewTEditor return existing editor "+
+ // editor.toString());
+ return editor;
+ } else {
+ try {
+ /*
+ * Chin note: all initialization logics now are done in init()
+ * method to support standard eclipse Editor open procedure. At
+ * init(), display array and EditorInput will be created based
+ * on user configured pane configuration. Therefore, we just
+ * create a dummy EditorInput here. The following
+ * IWorkbenchPage.openEditor() will eventually invoke init()
+ * method.
+ */
+ IRenderableDisplay[] tempDisp = new IRenderableDisplay[1];
+ tempDisp[0] = new NsharpSkewTPaneDisplay(new PixelExtent(
+ NsharpConstants.SKEWT_DISPLAY_REC), 0);
+ EditorInput edInput = new EditorInput(new NCLoopProperties(),
+ tempDisp);
+ editor = (NsharpEditor) PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .openEditor(edInput, EDITOR_ID);
+
+ } catch (PartInitException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ // System.out.println("createOrOpenSkewTEditor return new editor "+
+ // editor.toString());
+ return editor;
+ }
+ }
+
+ public static void bringEditorToTop() {
+ NsharpEditor editor = getActiveNsharpEditor();
if (editor != null) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().bringToTop(editor);
-
- }
- }
- public void refreshGUIElements() {
+
+ }
+ }
+
+ public void refreshGUIElements() {
ICommandService service = (ICommandService) getSite().getService(
ICommandService.class);
String[] guiUpdateElementCommands = {
@@ -1397,291 +1692,325 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
}
- public VizDisplayPane getSelectedPane() {
- return selectedPane;
- }
- public void setSelectedPane(VizDisplayPane selectedPane) {
- this.selectedPane = selectedPane;
- }
-
- public int getBaseWidth() {
- return baseWidth;
- }
- public int getBaseHeight() {
- return baseHeight;
- }
-
- class PaneMouseListener implements Listener {
- private int paneIndex;
-
- public PaneMouseListener(int index) {
- super();
- this.paneIndex = index;
- }
+ public VizDisplayPane getSelectedPane() {
+ return selectedPane;
+ }
- @Override
- public void handleEvent(Event e) {
- if ( e.button==0 ) {
- selectedPane = displayPane[paneIndex];
- }
- }
- }
+ public void setSelectedPane(VizDisplayPane selectedPane) {
+ this.selectedPane = selectedPane;
+ }
- class ResizeListener implements Listener {
- private String paneConfigurationName="";
-
-
- public ResizeListener(String name) {
- super();
- this.paneConfigurationName = name;
- }
+ public int getBaseWidth() {
+ return baseWidth;
+ }
+ public int getBaseHeight() {
+ return baseHeight;
+ }
- @Override
+ class PaneMouseListener implements Listener {
+ private int paneIndex;
+
+ public PaneMouseListener(int index) {
+ super();
+ this.paneIndex = index;
+ }
+
+ @Override
+ public void handleEvent(Event e) {
+ if (e.button == 0) {
+ selectedPane = displayPane[paneIndex];
+ }
+ }
+ }
+
+ class ResizeListener implements Listener {
+ private String paneConfigurationName = "";
+
+ public ResizeListener(String name) {
+ super();
+ this.paneConfigurationName = name;
+ }
+
+ @Override
public void handleEvent(Event event) {
- baseHeight = baseComposite.getSize().y;
- baseWidth = baseComposite.getSize().x;
- //System.out.println("ResizeListener resizing...nsharp base w= " + baseWidth + " h= "+ baseHeight);
- if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)){
- skewTHeightHint = (int) (baseHeight * skewTHeightHintRatio);
- skewTWidthHint = (int) (baseWidth*leftGroupWidthRatio *skewTWidthHintRatio);
- witoHeightHint = (int) (baseHeight * witoHeightHintRatio);
- witoWidthHint = (int) (baseWidth*leftGroupWidthRatio *witoWidthHintRatio);
- hodoHeightHint = (int) (baseHeight * hodoHeightHintRatio);
- hodoWidthHint = (int) (baseWidth*(1-leftGroupWidthRatio) *hodoWidthHintRatio);
- insetHeightHint = (int) (baseHeight * insetHeightHintRatio);
- insetWidthHint = (int) (baseWidth*(leftGroupWidthRatio) *insetWidthHintRatio);
- timeStnHeightHint = (int) (baseHeight * timeStnHeightHintRatio);
- timeStnWidthHint = (int) (baseWidth*(1-leftGroupWidthRatio) *timeStnWidthHintRatio);
- dataHeightHint = (int) (baseHeight * dataHeightHintRatio);
- dataWidthHint = (int) (baseWidth*(1-leftGroupWidthRatio) *dataWidthHintRatio);
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)){
- skewTHeightHint = (int) (baseHeight * skewTHeightHintRatio);
- skewTWidthHint = (int) (baseWidth*leftGroupWidthRatio *skewTWidthHintRatio);
- witoHeightHint = (int) (baseHeight * witoHeightHintRatio);
- witoWidthHint = (int) (baseWidth*leftGroupWidthRatio *witoWidthHintRatio);
- hodoHeightHint = (int) (baseHeight * hodoHeightHintRatio);
- hodoWidthHint = (int) (baseWidth*(1-leftGroupWidthRatio) *hodoWidthHintRatio);
- insetHeightHint = (int) (baseHeight * insetHeightHintRatio);
- insetWidthHint = (int) (baseWidth*(leftGroupWidthRatio) *insetWidthHintRatio);
- timeStnHeightHint = (int) (baseHeight * timeStnHeightHintRatio);
- timeStnWidthHint = (int) (baseWidth*(leftGroupWidthRatio) *timeStnWidthHintRatio);
- dataHeightHint = (int) (baseHeight * dataHeightHintRatio);
- dataWidthHint = (int) (baseWidth*(1-leftGroupWidthRatio) *dataWidthHintRatio);
- }
- else if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
- skewTHeightHint = (int) (baseHeight * topGroupHeightRatio* skewTHeightHintRatio);
- skewTWidthHint = (int) (baseWidth*skewTWidthHintRatio);
- witoHeightHint = (int) (baseHeight * topGroupHeightRatio * witoHeightHintRatio);
- witoWidthHint = (int) (baseWidth*witoWidthHintRatio);
- hodoHeightHint = (int) (baseHeight *topGroupHeightRatio* hodoHeightHintRatio);
- hodoWidthHint = (int) (baseWidth*hodoWidthHintRatio);
- insetHeightHint = (int) (baseHeight * topGroupHeightRatio* insetHeightHintRatio);
- insetWidthHint = (int) (baseWidth*insetWidthHintRatio);
- dataHeightHint = (int) (baseHeight * botGroupHeightRatio*dataHeightHintRatio);
- dataWidthHint = (int) (baseWidth*dataWidthHintRatio);
- spcHeightHint = (int) (baseHeight * botGroupHeightRatio*dataHeightHintRatio);
- spcWidthHint = (int) (baseWidth*dataWidthHintRatio);
- }
- else if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- skewTHeightHint = (int) (baseHeight * topGroupHeightRatio* skewTHeightHintRatio);
- skewTWidthHint = (int) (baseWidth*skewTWidthHintRatio);
- timeStnHeightHint = (int) (baseHeight * topGroupHeightRatio* timeStnHeightHintRatio);
- timeStnWidthHint = (int) (baseWidth* timeStnWidthHintRatio);
- futureHeightHint = (int) (baseHeight * topGroupHeightRatio* (1-timeStnHeightHintRatio));
- futureWidthHint = timeStnWidthHint;
- dataHeightHint = (int) (baseHeight * botGroupHeightRatio*dataHeightHintRatio);
- dataWidthHint = (int) (baseWidth* dataWidthHintRatio);
- hodoHeightHint = (int) (baseHeight *botGroupHeightRatio* hodoHeightHintRatio);
- hodoWidthHint = (int) (baseWidth*hodoWidthHintRatio);
- }
-
- if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR) || paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)){
- leftGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- leftGpGd.widthHint = (int) (baseWidth*leftGroupWidthRatio);
- leftGp.setLayoutData(leftGpGd);
+ baseHeight = baseComposite.getSize().y;
+ baseWidth = baseComposite.getSize().x;
+ // System.out.println("ResizeListener resizing...nsharp base w= " +
+ // baseWidth + " h= "+ baseHeight);
+ if (paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_2_STR)) {
+ skewTHeightHint = (int) (baseHeight * skewTHeightHintRatio);
+ skewTWidthHint = (int) (baseWidth * leftGroupWidthRatio * skewTWidthHintRatio);
+ witoHeightHint = (int) (baseHeight * witoHeightHintRatio);
+ witoWidthHint = (int) (baseWidth * leftGroupWidthRatio * witoWidthHintRatio);
+ hodoHeightHint = (int) (baseHeight * hodoHeightHintRatio);
+ hodoWidthHint = (int) (baseWidth * (1 - leftGroupWidthRatio) * hodoWidthHintRatio);
+ insetHeightHint = (int) (baseHeight * insetHeightHintRatio);
+ insetWidthHint = (int) (baseWidth * (leftGroupWidthRatio) * insetWidthHintRatio);
+ timeStnHeightHint = (int) (baseHeight * timeStnHeightHintRatio);
+ timeStnWidthHint = (int) (baseWidth * (1 - leftGroupWidthRatio) * timeStnWidthHintRatio);
+ dataHeightHint = (int) (baseHeight * dataHeightHintRatio);
+ dataWidthHint = (int) (baseWidth * (1 - leftGroupWidthRatio) * dataWidthHintRatio);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)) {
+ skewTHeightHint = (int) (baseHeight * skewTHeightHintRatio);
+ skewTWidthHint = (int) (baseWidth * leftGroupWidthRatio * skewTWidthHintRatio);
+ witoHeightHint = (int) (baseHeight * witoHeightHintRatio);
+ witoWidthHint = (int) (baseWidth * leftGroupWidthRatio * witoWidthHintRatio);
+ hodoHeightHint = (int) (baseHeight * hodoHeightHintRatio);
+ hodoWidthHint = (int) (baseWidth * (1 - leftGroupWidthRatio) * hodoWidthHintRatio);
+ insetHeightHint = (int) (baseHeight * insetHeightHintRatio);
+ insetWidthHint = (int) (baseWidth * (leftGroupWidthRatio) * insetWidthHintRatio);
+ timeStnHeightHint = (int) (baseHeight * timeStnHeightHintRatio);
+ timeStnWidthHint = (int) (baseWidth * (leftGroupWidthRatio) * timeStnWidthHintRatio);
+ dataHeightHint = (int) (baseHeight * dataHeightHintRatio);
+ dataWidthHint = (int) (baseWidth * (1 - leftGroupWidthRatio) * dataWidthHintRatio);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ skewTHeightHint = (int) (baseHeight * topGroupHeightRatio * skewTHeightHintRatio);
+ skewTWidthHint = (int) (baseWidth * skewTWidthHintRatio);
+ witoHeightHint = (int) (baseHeight * topGroupHeightRatio * witoHeightHintRatio);
+ witoWidthHint = (int) (baseWidth * witoWidthHintRatio);
+ hodoHeightHint = (int) (baseHeight * topGroupHeightRatio * hodoHeightHintRatio);
+ hodoWidthHint = (int) (baseWidth * hodoWidthHintRatio);
+ insetHeightHint = (int) (baseHeight * topGroupHeightRatio * insetHeightHintRatio);
+ insetWidthHint = (int) (baseWidth * insetWidthHintRatio);
+ dataHeightHint = (int) (baseHeight * botGroupHeightRatio * dataHeightHintRatio);
+ dataWidthHint = (int) (baseWidth * dataWidthHintRatio);
+ spcHeightHint = (int) (baseHeight * botGroupHeightRatio * dataHeightHintRatio);
+ spcWidthHint = (int) (baseWidth * dataWidthHintRatio);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ skewTHeightHint = (int) (baseHeight * topGroupHeightRatio * skewTHeightHintRatio);
+ skewTWidthHint = (int) (baseWidth * skewTWidthHintRatio);
+ timeStnHeightHint = (int) (baseHeight * topGroupHeightRatio * timeStnHeightHintRatio);
+ timeStnWidthHint = (int) (baseWidth * timeStnWidthHintRatio);
+ futureHeightHint = (int) (baseHeight * topGroupHeightRatio * (1 - timeStnHeightHintRatio));
+ futureWidthHint = timeStnWidthHint;
+ dataHeightHint = (int) (baseHeight * botGroupHeightRatio * dataHeightHintRatio);
+ dataWidthHint = (int) (baseWidth * dataWidthHintRatio);
+ hodoHeightHint = (int) (baseHeight * botGroupHeightRatio * hodoHeightHintRatio);
+ hodoWidthHint = (int) (baseWidth * hodoWidthHintRatio);
+ }
+ // d2dlite start
+ else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ skewTHeightHint = (int) (baseHeight * topGroupHeightRatio * skewTHeightHintRatio);
+ skewTWidthHint = (int) (baseWidth * skewTWidthHintRatio);
+ // skewt and hodo share same pane real estate
+ hodoHeightHint = (int) (baseHeight * topGroupHeightRatio * skewTHeightHintRatio);
+ hodoWidthHint = (int) (baseWidth * skewTWidthHintRatio);
+ timeStnHeightHint = (int) (baseHeight * topGroupHeightRatio * timeStnHeightHintRatio);
+ timeStnWidthHint = (int) (baseWidth * timeStnWidthHintRatio);
+ dataHeightHint = (int) (baseHeight * topGroupHeightRatio * (1 - timeStnHeightHintRatio));
+ dataWidthHint = timeStnWidthHint;
+ } // d2dlite end
- rightGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- rightGpGd.widthHint = (int) (baseWidth*(1-leftGroupWidthRatio));
- rightGp.setLayoutData(rightGpGd);
+ if (paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_2_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)) {
+ leftGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ leftGpGd.widthHint = (int) (baseWidth * leftGroupWidthRatio);
+ leftGp.setLayoutData(leftGpGd);
- leftTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- leftTopGpGd.heightHint = (int) (baseHeight *leftTopGroupHeightRatio);
- leftTopGp.setLayoutData(leftTopGpGd);
- if(leftBotGp!=null){
- leftBotGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- leftBotGpGd.heightHint = (int) (baseHeight *(1-leftTopGroupHeightRatio));
- leftBotGp.setLayoutData(leftBotGpGd);
- }
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_SKEWT];
- skewtGd.heightHint = skewTHeightHint;
- skewtGd.widthHint = skewTWidthHint;
- nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
- GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_WITO];
- witoGd.heightHint = witoHeightHint;
- witoGd.widthHint = witoWidthHint;
- nsharpComp[DISPLAY_WITO].setLayoutData(witoGd);
+ rightGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rightGpGd.widthHint = (int) (baseWidth * (1 - leftGroupWidthRatio));
+ rightGp.setLayoutData(rightGpGd);
- GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_TIMESTN];
- timeStnGd.heightHint = timeStnHeightHint;
- timeStnGd.widthHint = timeStnWidthHint;
- nsharpComp[DISPLAY_TIMESTN].setLayoutData(timeStnGd);
- GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_INSET];
- insetGd.heightHint = insetHeightHint;
- insetGd.widthHint = insetWidthHint;
- nsharpComp[DISPLAY_INSET].setLayoutData(insetGd);
+ leftTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ leftTopGpGd.heightHint = (int) (baseHeight * leftTopGroupHeightRatio);
+ leftTopGp.setLayoutData(leftTopGpGd);
+ if (leftBotGp != null) {
+ leftBotGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ leftBotGpGd.heightHint = (int) (baseHeight * (1 - leftTopGroupHeightRatio));
+ leftBotGp.setLayoutData(leftBotGpGd);
+ }
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);// gridDataArray[DISPLAY_SKEWT];
+ skewtGd.heightHint = skewTHeightHint;
+ skewtGd.widthHint = skewTWidthHint;
+ nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
+ GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true, true);// gridDataArray[DISPLAY_WITO];
+ witoGd.heightHint = witoHeightHint;
+ witoGd.widthHint = witoWidthHint;
+ nsharpComp[DISPLAY_WITO].setLayoutData(witoGd);
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_HODO];
- hodoGd.heightHint = hodoHeightHint;
- hodoGd.widthHint = hodoWidthHint;
- nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
+ GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
+ true);// gridDataArray[DISPLAY_TIMESTN];
+ timeStnGd.heightHint = timeStnHeightHint;
+ timeStnGd.widthHint = timeStnWidthHint;
+ nsharpComp[DISPLAY_TIMESTN].setLayoutData(timeStnGd);
+ GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true, true);// gridDataArray[DISPLAY_INSET];
+ insetGd.heightHint = insetHeightHint;
+ insetGd.widthHint = insetWidthHint;
+ nsharpComp[DISPLAY_INSET].setLayoutData(insetGd);
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_DATA];
- dataGd.heightHint = dataHeightHint;
- dataGd.widthHint = dataWidthHint;
- nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, true);// gridDataArray[DISPLAY_HODO];
+ hodoGd.heightHint = hodoHeightHint;
+ hodoGd.widthHint = hodoWidthHint;
+ nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
- }else if(paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR)){
- topGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- topGpGd.heightHint = (int) (baseHeight * topGroupHeightRatio);
- topGp.setLayoutData(topGpGd);
-
- // skewt composite
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- skewtGd.heightHint = skewTHeightHint;
- skewtGd.widthHint = skewTWidthHint;
- nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
-
-
- // wito composite
- GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- witoGd.heightHint = witoHeightHint;
- witoGd.widthHint = witoWidthHint;
- nsharpComp[DISPLAY_WITO].setLayoutData(witoGd);
-
- // right-top group : right part of top group
- rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- rightTopGpGd.widthHint = (int) (baseWidth*hodoWidthHintRatio);
- rightTopGp.setLayoutData(rightTopGpGd);
-
- //hodo composite
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- hodoGd.heightHint = hodoHeightHint;
- hodoGd.widthHint = hodoWidthHint;
- nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
-
-
- //inset composite
- GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- insetGd.heightHint = insetHeightHint;
- insetGd.widthHint = insetWidthHint;
- nsharpComp[DISPLAY_INSET].setLayoutData(insetGd);
- /*
- //time-stn composite
- Composite timeStnComp = new Composite(rightTopGp, SWT.NONE);
- GridData timeStnGd = new GridData(SWT.END, SWT.FILL, false,
- true);
- timeStnComp.setLayoutData(timeStnGd);
- */
-
- botGpGd = new GridData(SWT.FILL, SWT.END, true,
- true);
- botGpGd.heightHint = (int) (baseHeight * botGroupHeightRatio);
- botGp.setLayoutData(botGpGd);
- //data composite
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
- dataGd.heightHint = dataHeightHint;
- dataGd.widthHint = dataWidthHint;
- nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
- //spc composite
- GridData spcGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
- spcGd.heightHint = spcHeightHint;
- spcGd.widthHint = spcWidthHint;
- nsharpComp[DISPLAY_SPC_GRAPHS].setLayoutData(spcGd);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, true);// gridDataArray[DISPLAY_DATA];
+ dataGd.heightHint = dataHeightHint;
+ dataGd.widthHint = dataWidthHint;
+ nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- topGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- topGpGd.heightHint = skewTHeightHint;
- topGp.setLayoutData(topGpGd);
-
- // skewt composite
- GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- skewtGd.heightHint = skewTHeightHint;
- skewtGd.widthHint = skewTWidthHint;
- nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
-
- // right-top group : right part of top group
- rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- rightTopGpGd.widthHint = timeStnWidthHint;
- rightTopGp.setLayoutData(rightTopGpGd);
-
- GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);//gridDataArray[DISPLAY_TIMESTN];
- timeStnGd.heightHint = timeStnHeightHint;
- timeStnGd.widthHint = timeStnWidthHint;
- nsharpComp[DISPLAY_TIMESTN].setLayoutData(timeStnGd);
-
- //future composite
- GridData futureGd = new GridData(SWT.FILL, SWT.FILL, true,
- true);
- futureGd.heightHint = futureHeightHint;
- futureGd.widthHint = futureWidthHint;
- nsharpComp[DISPLAY_FUTURE].setLayoutData(futureGd);
-
- botGpGd = new GridData(SWT.FILL, SWT.END, true,
- true);
- botGpGd.heightHint = (int) (baseHeight * botGroupHeightRatio);
- botGp.setLayoutData(botGpGd);
- //hodo composite
- GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);
- hodoGd.heightHint = hodoHeightHint;
- hodoGd.widthHint = hodoWidthHint;
- nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
- GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true,
- false);//gridDataArray[DISPLAY_DATA];
- dataGd.heightHint = dataHeightHint;
- dataGd.widthHint = dataWidthHint;
- nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
- }
- //System.out.println("After resizing...nsharpComp[0] w= " + nsharpComp[0].getBounds().width + " h= "+ nsharpComp[0].getBounds().height);
- //System.out.println("After resizing...nsharpComp[1] w= " + nsharpComp[1].getBounds().width + " h= "+ nsharpComp[1].getBounds().height);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ topGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ topGpGd.heightHint = (int) (baseHeight * topGroupHeightRatio);
+ topGp.setLayoutData(topGpGd);
- for(int i=0; i< DISPLAY_TOTAL; i++){
- if(displayArray[i]!=null && displayArray[i].getDescriptor().getResourceList().isEmpty()== false){
- ResourcePair rscPair = displayArray[i].getDescriptor().getResourceList().get(0);
- if (rscPair.getResource() instanceof NsharpAbstractPaneResource){
- NsharpAbstractPaneResource paneRsc = (NsharpAbstractPaneResource)rscPair.getResource() ;
- paneRsc.setResize(true);
- }
- }
- }
+ // skewt composite
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ skewtGd.heightHint = skewTHeightHint;
+ skewtGd.widthHint = skewTWidthHint;
+ nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
- }
-
- }
- @Override
+ // wito composite
+ GridData witoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ witoGd.heightHint = witoHeightHint;
+ witoGd.widthHint = witoWidthHint;
+ nsharpComp[DISPLAY_WITO].setLayoutData(witoGd);
+
+ // right-top group : right part of top group
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rightTopGpGd.widthHint = (int) (baseWidth * hodoWidthHintRatio);
+ rightTopGp.setLayoutData(rightTopGpGd);
+
+ // hodo composite
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ hodoGd.heightHint = hodoHeightHint;
+ hodoGd.widthHint = hodoWidthHint;
+ nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
+
+ // inset composite
+ GridData insetGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ insetGd.heightHint = insetHeightHint;
+ insetGd.widthHint = insetWidthHint;
+ nsharpComp[DISPLAY_INSET].setLayoutData(insetGd);
+ /*
+ * //time-stn composite Composite timeStnComp = new
+ * Composite(rightTopGp, SWT.NONE); GridData timeStnGd = new
+ * GridData(SWT.END, SWT.FILL, false, true);
+ * timeStnComp.setLayoutData(timeStnGd);
+ */
+
+ botGpGd = new GridData(SWT.FILL, SWT.END, true, true);
+ botGpGd.heightHint = (int) (baseHeight * botGroupHeightRatio);
+ botGp.setLayoutData(botGpGd);
+ // data composite
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ dataGd.heightHint = dataHeightHint;
+ dataGd.widthHint = dataWidthHint;
+ nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
+ // spc composite
+ GridData spcGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ spcGd.heightHint = spcHeightHint;
+ spcGd.widthHint = spcWidthHint;
+ nsharpComp[DISPLAY_SPC_GRAPHS].setLayoutData(spcGd);
+
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ topGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ topGpGd.heightHint = skewTHeightHint;
+ topGp.setLayoutData(topGpGd);
+
+ // skewt composite
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ skewtGd.heightHint = skewTHeightHint;
+ skewtGd.widthHint = skewTWidthHint;
+ nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
+
+ // right-top group : right part of top group
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rightTopGpGd.widthHint = timeStnWidthHint;
+ rightTopGp.setLayoutData(rightTopGpGd);
+
+ GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
+ true);// gridDataArray[DISPLAY_TIMESTN];
+ timeStnGd.heightHint = timeStnHeightHint;
+ timeStnGd.widthHint = timeStnWidthHint;
+ nsharpComp[DISPLAY_TIMESTN].setLayoutData(timeStnGd);
+
+ // future composite
+ GridData futureGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ futureGd.heightHint = futureHeightHint;
+ futureGd.widthHint = futureWidthHint;
+ nsharpComp[DISPLAY_FUTURE].setLayoutData(futureGd);
+
+ botGpGd = new GridData(SWT.FILL, SWT.END, true, true);
+ botGpGd.heightHint = (int) (baseHeight * botGroupHeightRatio);
+ botGp.setLayoutData(botGpGd);
+ // hodo composite
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ hodoGd.heightHint = hodoHeightHint;
+ hodoGd.widthHint = hodoWidthHint;
+ nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);// gridDataArray[DISPLAY_DATA];
+ dataGd.heightHint = dataHeightHint;
+ dataGd.widthHint = dataWidthHint;
+ nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
+ }
+ // d2dlite start
+ else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ topGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ topGpGd.heightHint = skewTHeightHint;
+ topGp.setLayoutData(topGpGd);
+
+ if (rscHandler.getCurrentGraphMode() != NsharpConstants.GRAPH_HODO) {
+ // skewt composite
+ GridData skewtGd = new GridData(SWT.FILL, SWT.FILL, true,
+ true);
+ skewtGd.heightHint = skewTHeightHint;
+ skewtGd.widthHint = skewTWidthHint;
+ nsharpComp[DISPLAY_SKEWT].setLayoutData(skewtGd);
+ } else {
+ // hodo composite
+ GridData hodoGd = new GridData(SWT.FILL, SWT.FILL, true,
+ false);
+ hodoGd.heightHint = hodoHeightHint;
+ hodoGd.widthHint = hodoWidthHint;
+ nsharpComp[DISPLAY_HODO].setLayoutData(hodoGd);
+ }
+
+ // right-top group : right part of top group
+ rightTopGpGd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rightTopGpGd.widthHint = timeStnWidthHint;
+ rightTopGp.setLayoutData(rightTopGpGd);
+
+ GridData timeStnGd = new GridData(SWT.FILL, SWT.FILL, true,
+ true);
+ timeStnGd.heightHint = timeStnHeightHint;
+ timeStnGd.widthHint = timeStnWidthHint;
+ nsharpComp[DISPLAY_TIMESTN].setLayoutData(timeStnGd);
+
+ GridData dataGd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ dataGd.heightHint = dataHeightHint;
+ dataGd.widthHint = dataWidthHint;
+ nsharpComp[DISPLAY_DATA].setLayoutData(dataGd);
+ } // d2dlite end
+ for (int i = 0; i < DISPLAY_TOTAL; i++) {
+ if (displayArray[i] != null
+ && displayArray[i].getDescriptor().getResourceList()
+ .isEmpty() == false) {
+ ResourcePair rscPair = displayArray[i].getDescriptor()
+ .getResourceList().get(0);
+ if (rscPair.getResource() instanceof NsharpAbstractPaneResource) {
+ NsharpAbstractPaneResource paneRsc = (NsharpAbstractPaneResource) rscPair
+ .getResource();
+ paneRsc.setResize(true);
+ }
+ }
+ }
+
+ }
+
+ }
+
+ @Override
public boolean isDirty() {
if (!isCloseable()) {
return true;
@@ -1689,83 +2018,116 @@ public class NsharpEditor extends AbstractEditor implements IRenderableDisplayC
return false;
}
}
- @Override
+
+ @Override
protected void setInput(IEditorInput input) {
super.setInput(input);
- this.editorInput = (EditorInput)input;
+ this.editorInput = (EditorInput) input;
}
- @Override
+
+ @Override
public void renderableDisplayChanged(IDisplayPane pane,
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
-
- if(type == DisplayChangeType.ADD){
- //System.out.println("Editor="+this.toString()+" renderableDisplayChanged ADD called, pane = " + pane.toString()+" newRenderableDisplay="+newRenderableDisplay.toString());
- boolean swapping = false;
- for(int i = 0 ; i < displayPane.length ; i+= 1){
- if(displayPane[i] == pane){
- //displayArray[i] = newRenderableDisplay;
- //System.out.println( "swapping pane, current handler "+rscHandler.toString()+"#############################");
- /*
- * Chin Note: For the scenarios of 2 instance of Nsharps. One in Main and one in side pane.
- * In order to handle pane swapping in D2D. When this renderableDisplayChanged event happened with
- * change type of ADD.
- * It indicates that current nsharp in main pane is about to be swapped with Nsharp in side pane.
- * Current D2D architecture will not dispose this NsharpEditor (in main pane) but will reuse it for the
- * existing Nsharp coming from side pane.
- * In other words, we only swap "NsharpResourceHandler" and keep editor.
- * Therefore, rscHandler (at this moment) is about to be moved out. Before it is moved out,
- * we raise "justMoveToSidePane" flag to be used by skewTPaneRsc at side pane.
+
+ if (type == DisplayChangeType.ADD) {
+ // System.out.println("Editor="+this.toString()+" renderableDisplayChanged ADD called, pane = "
+ // +
+ // pane.toString()+" newRenderableDisplay="+newRenderableDisplay.toString());
+ boolean swapping = false;
+ for (int i = 0; i < displayPane.length; i += 1) {
+ if (displayPane[i] == pane) {
+ // displayArray[i] = newRenderableDisplay;
+ // System.out.println(
+ // "swapping pane, current handler "+rscHandler.toString()+"#############################");
+ /*
+ * Chin Note: For the scenarios of 2 instance of Nsharps.
+ * One in Main and one in side pane. In order to handle pane
+ * swapping in D2D. When this renderableDisplayChanged event
+ * happened with change type of ADD. It indicates that
+ * current nsharp in main pane is about to be swapped with
+ * Nsharp in side pane. Current D2D architecture will not
+ * dispose this NsharpEditor (in main pane) but will reuse
+ * it for the existing Nsharp coming from side pane. In
+ * other words, we only swap "NsharpResourceHandler" and
+ * keep editor. Therefore, rscHandler (at this moment) is
+ * about to be moved out. Before it is moved out, we raise
+ * "justMoveToSidePane" flag to be used by skewTPaneRsc at
+ * side pane.
*/
- if(rscHandler.getSkewtPaneRsc()!=null)
- rscHandler.getSkewtPaneRsc().setJustMoveToSidePane(true);
- if(rscHandler.getWitoPaneRsc() !=null)
- rscHandler.getWitoPaneRsc().setInSidePane(true);
- swapping= true;
+ if (rscHandler.getSkewtPaneRsc() != null)
+ rscHandler.getSkewtPaneRsc()
+ .setJustMoveToSidePane(true);
+ if (rscHandler.getWitoPaneRsc() != null)
+ rscHandler.getWitoPaneRsc().setInSidePane(true);
+ // FixMark:sidePaneLooping d2dlite
+ if (rscHandler.getDataPaneRsc() != null)
+ rscHandler.getDataPaneRsc().setSidePaneMode(true);
+ swapping = true;
}
-
+
}
/*
- * Chin Note: We only have to handle the following procedures once, either during swapping or NshaepEditor is created.
- * Since, in any case, we will have NsharpSkewTPane, therefore we are checking NsharpSkewTPaneDescriptor
- * to avoid multiple access of the following code.
+ * Chin Note: We only have to handle the following procedures once,
+ * either during swapping or NshaepEditor is created. Since, in any
+ * case, we will have NsharpSkewTPane, therefore we are checking
+ * NsharpSkewTPaneDescriptor to avoid multiple access of the
+ * following code.
*/
- if(newRenderableDisplay.getDescriptor() instanceof NsharpSkewTPaneDescriptor){
- NsharpAbstractPaneDescriptor desc = (NsharpAbstractPaneDescriptor) newRenderableDisplay.getDescriptor();
+ if (newRenderableDisplay.getDescriptor() instanceof NsharpSkewTPaneDescriptor) {
+ NsharpAbstractPaneDescriptor desc = (NsharpAbstractPaneDescriptor) newRenderableDisplay
+ .getDescriptor();
NsharpResourceHandler handler = desc.getRscHandler();
if (handler != null) {
- //System.out.println("renderableDisplayChanged current handler=" + rscHandler.toString() + " set new Handler=" + handler.toString() + " editor "+ this.toString());
- rscHandler = handler;
- if(swapping){
- /*
- * Chin Note: If swapping happened, rscHandler is the newly swapping nsharp's.
- * We will have to restart editor to construct all graphs and displays for this nsharp instance.
- * We also have to re-store nsharp to its previous status (when it was in main pane).
- */
- restartEditor( paneConfigurationName);
- /*rscHandler.resetRsc();
- NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
- if(paletteWin!=null){
- paletteWin.restorePaletteWindow(paneConfigurationName, rscHandler.getCurrentGraphMode(),
- rscHandler.isInterpolateIsOn(), rscHandler.isOverlayIsOn(),
- rscHandler.isCompareStnIsOn(),rscHandler.isCompareTmIsOn(),rscHandler.isEditGraphOn());
- }*/
- if(rscHandler.getSkewtPaneRsc()!=null)
- rscHandler.getSkewtPaneRsc().setJustBackToMainPane(true);
- if(rscHandler.getWitoPaneRsc() !=null)
- rscHandler.getWitoPaneRsc().setInSidePane(false);
-
- }
- else{
- // Chin Note: This is when NsharpEditor is created case.
- // Note that, in D2D when only one Nsharp instance is in side pane, then when it
- // is swapped back to main pane, NsharpEditor also is created.
- //System.out.println("Editor="+this.toString()+" renderableDisplayChanged ADD but not swapping"+" newRenderableDisplay="+newRenderableDisplay.toString());
+ // System.out.println("renderableDisplayChanged current handler="
+ // + rscHandler.toString() + " set new Handler=" +
+ // handler.toString() + " editor "+ this.toString());
+ rscHandler = handler;
+ if (swapping) {
+ /*
+ * Chin Note: If swapping happened, rscHandler is the
+ * newly swapping nsharp's. We will have to restart
+ * editor to construct all graphs and displays for this
+ * nsharp instance. We also have to re-store nsharp to
+ * its previous status (when it was in main pane).
+ */
+ restartEditor(paneConfigurationName);
+ /*
+ * rscHandler.resetRsc(); NsharpPaletteWindow paletteWin
+ * = NsharpPaletteWindow.getInstance();
+ * if(paletteWin!=null){
+ * paletteWin.restorePaletteWindow(
+ * paneConfigurationName,
+ * rscHandler.getCurrentGraphMode(),
+ * rscHandler.isInterpolateIsOn(),
+ * rscHandler.isOverlayIsOn(),
+ * rscHandler.isCompareStnIsOn
+ * (),rscHandler.isCompareTmIsOn
+ * (),rscHandler.isEditGraphOn()); }
+ */
+ if (rscHandler.getSkewtPaneRsc() != null)
+ rscHandler.getSkewtPaneRsc().setJustBackToMainPane(
+ true);
+ if (rscHandler.getWitoPaneRsc() != null)
+ rscHandler.getWitoPaneRsc().setInSidePane(false);
+ // FixMark:sidePaneLooping
+ if (rscHandler.getDataPaneRsc() != null)
+ rscHandler.getDataPaneRsc().setSidePaneMode(false);
+
+ } else {
+ // Chin Note: This is when NsharpEditor is created case.
+ // Note that, in D2D when only one Nsharp instance is in
+ // side pane, then when it
+ // is swapped back to main pane, NsharpEditor also is
+ // created.
+ // System.out.println("Editor="+this.toString()+" renderableDisplayChanged ADD but not swapping"+" newRenderableDisplay="+newRenderableDisplay.toString());
}
return;
}
- }
+ }
}
- // else
- // System.out.println("Editor="+this.toString()+" renderableDisplayChanged REMOVE called, pane = " + pane.toString()+" newRenderableDisplay="+newRenderableDisplay.toString());
+ // else
+ // System.out.println("Editor="+this.toString()+" renderableDisplayChanged REMOVE called, pane = "
+ // +
+ // pane.toString()+" newRenderableDisplay="+newRenderableDisplay.toString());
}
}
\ No newline at end of file
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpGpdSoundingQuery.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpGpdSoundingQuery.java
new file mode 100644
index 0000000000..27eed35adb
--- /dev/null
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpGpdSoundingQuery.java
@@ -0,0 +1,158 @@
+package gov.noaa.nws.ncep.ui.nsharp.display.map;
+
+import gov.noaa.nws.ncep.common.dataplugin.gpd.GenericPointDataConstants;
+import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataLevel;
+import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataParameter;
+import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataStationProduct;
+import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
+import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+// import gov.noaa.nws.ncep.viz.rsc.gpd.query.GpdQuery;
+/*
+ * Chin Note; User only be able to pick one station from Nsharp map at a time, however, the picked station may have several time lines
+ * associated with it. stnPtDataLineLst contains a list of same stations but with different time lines (if provided)
+ */
+public class NsharpGpdSoundingQuery {
+ public static void getGpdPfcSndData(
+ List stnPtDataLineLst,
+ Map> soundingLysLstMap,
+ String prodName) {
+ for (NsharpStationInfo StnPt : stnPtDataLineLst) {
+ // one StnPt represent one reference time line
+ // with one reference time, there may be many forecast time / range
+ // start time
+ List rangeTimeList = new ArrayList();
+ for (NsharpStationInfo.timeLineSpecific tmlinSpc : StnPt
+ .getTimeLineSpList()) {
+ rangeTimeList.add(tmlinSpc.getTiemLine());
+ }
+ List stnPList = null;
+ // TBDGPD List stnPList =
+ // GpdQuery.getGpdStationModelSoundingProductList(prodName,GenericPointDataQueryKey.BY_SLAT_SLON,
+ // null,(float)stnPtDataLineLst.get(0).getLatitude(),(float)stnPtDataLineLst.get(0).getLongitude(),
+ // rangeTimeList,false,0,StnPt.getReftime());
+ if (stnPList != null && stnPList.size() > 0) {
+ for (GenericPointDataStationProduct stnProd : stnPList) {
+ List levelList = stnProd
+ .getLevelLst();
+ List sndLayerList = new ArrayList();
+ for (GenericPointDataLevel gpdl : levelList) {
+ List gpdParmList = gpdl
+ .getGpdParameters();
+ NcSoundingLayer sndLyer = new NcSoundingLayer();
+ for (GenericPointDataParameter gpdParm : gpdParmList) {
+ if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_PRESSURE)) {
+ sndLyer.setPressure(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_HEIGHT)) {
+ sndLyer.setGeoHeight(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_TEMP)) {
+ sndLyer.setTemperature(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_DEWPT)) {
+ sndLyer.setDewpoint(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_WIND_DIR)) {
+ sndLyer.setWindDirection(gpdParm.getValue());
+ } else if (gpdParm
+ .getName()
+ .equals(GenericPointDataConstants.GEMPAK_WIND_SPEED)) {
+ sndLyer.setWindSpeed(gpdParm.getValue());
+ }
+ }
+ sndLayerList.add(sndLyer);
+ }
+ String dispInfo = "";
+ for (NsharpStationInfo.timeLineSpecific tmlinSpc : StnPt
+ .getTimeLineSpList()) {
+ if (tmlinSpc.getTiemLine().getTime() == (stnProd
+ .getForecastTime() * 1000 + stnProd
+ .getRefTime().getTime())) {
+ dispInfo = tmlinSpc.getDisplayInfo();
+ soundingLysLstMap.put(dispInfo, sndLayerList);
+ break;
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ public static void getGpdObsSndData(
+ List stnPtDataLineLst,
+ Map> soundingLysLstMap,
+ String prodName) {
+ List refTimeList = new ArrayList();
+ for (NsharpStationInfo StnPt : stnPtDataLineLst) {
+ // one StnPt represent one data time line
+ Date refTime = new Date();
+ refTime.setTime(StnPt.getReftime().getTime());
+ refTimeList.add(refTime);
+ }
+ // System.out.println("stn lat =" +
+ // stnPtDataLineLst.get(0).getLatitude()
+ // + " lon=" + stnPtDataLineLst.get(0).getLongitude());
+ List stnPList = null;
+ // TBDGPD List stnPList =
+ // GpdQuery.getGpdStationProductList(prodName,GenericPointDataQueryKey.BY_SLAT_SLON,
+ // null,(float)stnPtDataLineLst.get(0).getLatitude(),(float)stnPtDataLineLst.get(0).getLongitude(),
+ // refTimeList,false,0);
+ if (stnPList != null && stnPList.size() > 0) {
+ for (GenericPointDataStationProduct stnProd : stnPList) {
+ List levelList = stnProd.getLevelLst();
+ List sndLayerList = new ArrayList();
+ for (GenericPointDataLevel gpdl : levelList) {
+ List gpdParmList = gpdl
+ .getGpdParameters();
+ NcSoundingLayer sndLyer = new NcSoundingLayer();
+ for (GenericPointDataParameter gpdParm : gpdParmList) {
+ if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_PRESSURE)) {
+ sndLyer.setPressure(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_HEIGHT)) { // NcSoundingProfile
+ // sndPf=
+ // PfcSoundingQuery.getPfcSndData(StnPt.getDatauri(),(float)StnPt.getLatitude(),
+ // (float)StnPt.getLongitude(),
+ // StnPt.getReftime(),
+ // StnPt.getRangestarttime(),
+ // PfcSoundingQuery.PfcSndType.NAMSND);
+
+ sndLyer.setGeoHeight(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_TEMP)) {
+ sndLyer.setTemperature(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_DEWPT)) {
+ sndLyer.setDewpoint(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_WIND_DIR)) {
+ sndLyer.setWindDirection(gpdParm.getValue());
+ } else if (gpdParm.getName().equals(
+ GenericPointDataConstants.GEMPAK_WIND_SPEED)) {
+ sndLyer.setWindSpeed(gpdParm.getValue());
+ }
+ }
+ sndLayerList.add(sndLyer);
+ }
+ String dispInfo = "";
+ for (NsharpStationInfo StnPt : stnPtDataLineLst) {
+ if (StnPt.getReftime().getTime() == stnProd.getRefTime()
+ .getTime()) {
+ dispInfo = StnPt.getStnDisplayInfo();
+ soundingLysLstMap.put(dispInfo, sndLayerList);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapMouseHandler.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapMouseHandler.java
index 0a721cc461..3a2555f89b 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapMouseHandler.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapMouseHandler.java
@@ -25,8 +25,8 @@ import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.SurfaceStationPointData;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler;
-import gov.noaa.nws.ncep.ui.nsharp.view.ModelSoundingDialogContents;
import gov.noaa.nws.ncep.ui.nsharp.view.NsharpLoadDialog;
+import gov.noaa.nws.ncep.ui.nsharp.view.NsharpModelSoundingDialogContents;
import gov.noaa.nws.ncep.ui.pgen.tools.InputHandlerDefaultImpl;
import gov.noaa.nws.ncep.viz.ui.display.NatlCntrsEditor;
@@ -51,44 +51,44 @@ import com.vividsolutions.jts.geom.Coordinate;
//@SuppressWarnings("unchecked")
public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
-
- public NsharpMapMouseHandler() {
- instance = this;
- }
+
+ public NsharpMapMouseHandler() {
+ instance = this;
+ }
// private NsharpSkewTDisplay renderableDisplay=null;
-
- private static final double NctextuiPointMinDistance = 45000;
+
+ private static final double NctextuiPointMinDistance = 45000;
// private int prevMouseX, prevMouseY;
- private static NsharpMapMouseHandler instance;
-
- private double lat, lon;
-
- public double getLat() {
- return lat;
- }
+ private static NsharpMapMouseHandler instance;
+
+ private double lat, lon;
+
+ public double getLat() {
+ return lat;
+ }
+
+ public double getLon() {
+ return lon;
+ }
- public double getLon() {
- return lon;
- }
-
public static NsharpMapMouseHandler getAccess() {
- return instance;
- }
-
+ return instance;
+ }
+
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int, int,
* int)
*/
- @Override
- public boolean handleMouseDown(int x, int y, int button) {
+ @Override
+ public boolean handleMouseDown(int x, int y, int button) {
// System.out.println("nsharp map mouse down");
// prevMouseX = x;
// prevMouseY = y;
- return false;
+ return false;
}
/*
@@ -100,21 +100,21 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
*/
@Override
public boolean handleMouseDownMove(int x, int y, int button) {
- return false;
-
+ return false;
+
}
@Override
- public boolean handleMouseMove(int x, int y) {
- // TODO Auto-generated method stub
- return false;
- }
+ public boolean handleMouseMove(int x, int y) {
+ // TODO Auto-generated method stub
+ return false;
+ }
- /*
+ /*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
- * handle right button, so user be able to pick stn and print text report
+ * handle right button, so user be able to pick stn and print text report
*/
@Override
public boolean handleMouseUp(int x, int y, int button) {
@@ -123,26 +123,26 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
// if ( !NsharpMapResource.getOrCreateNsharpMapResource().isEditable())
// return false;
// System.out.println("NsharpMapMouseHandler handleMouseUp called");
- // button 1 is left mouse button
+ // button 1 is left mouse button
if (button == 1) {
- NatlCntrsEditor mapEditor = NsharpMapResource.getMapEditor();
+ NatlCntrsEditor mapEditor = NsharpMapResource.getMapEditor();
if (mapEditor != null) {
// for(int i=0; i<
// mapEditor.getDescriptor().getResourceList().size(); i++)
// System.out.println(
// "C resourcename="+mapEditor.getDescriptor().getResourceList().get(i).getResource().getName());
- // Check if mouse is in geographic extent
- Coordinate loc = mapEditor.translateClick(x, y);
+ // Check if mouse is in geographic extent
+ Coordinate loc = mapEditor.translateClick(x, y);
if (loc == null)
- return false;
- NsharpLoadDialog loadDia = NsharpLoadDialog.getAccess();
+ return false;
+ NsharpLoadDialog loadDia = NsharpLoadDialog.getAccess();
if (loadDia != null) {
if (loadDia.getActiveLoadSoundingType() == NsharpLoadDialog.MODEL_SND
&& loadDia.getMdlDialog() != null
&& loadDia.getMdlDialog().getLocationText() != null) {
- if (loadDia.getMdlDialog().getCurrentLocType() == ModelSoundingDialogContents.LocationType.STATION) {
+ if (loadDia.getMdlDialog().getCurrentLocType() == NsharpModelSoundingDialogContents.LocationType.STATION) {
// System.out.println("mouse up 1 loc.x "+ loc.x+
// " loc.y="+ loc.y);
String stnName = SurfaceStationPointData
@@ -151,7 +151,7 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
// " loc.y="+ loc.y);
// System.out.println("stn name = "+ stnName);
if (stnName == null)
- stnName = "";
+ stnName = "";
loadDia.getMdlDialog().getLocationText()
.setText(stnName);
} else {
@@ -170,10 +170,10 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
List points = NsharpMapResource
.getOrCreateNsharpMapResource().getPoints();// loadDia.getNsharpMapResource().getPoints();
if (points.isEmpty() == false) {
- // create an editor NsharpEditor
+ // create an editor NsharpEditor
// NsharpEditor skewtEdt =
// NsharpEditor.createOrOpenEditor();
-
+
// get the stn close to loc "enough" and retrieve
// report for it
// Note::One stn may have more than one dataLine, if
@@ -184,27 +184,50 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
&& stnPtDataLineLst.size() > 0) {
// System.out.println("MapMouseHandler creating NsharpSkewTDisplay");
// hash map, use stn display info as key
- Map> soundingLysLstMap = new HashMap>();
-
+ Map> soundingLysLstMap = new HashMap>();
+ long t01 = System.currentTimeMillis();
// String soundingType;
if (activeLoadType == NsharpLoadDialog.OBSER_SND) {
- NsharpMapResource.startWaitCursor();
+ NsharpMapResource.startWaitCursor();
NsharpObservedSoundingQuery
.getObservedSndData(
stnPtDataLineLst, loadDia
.getObsDialog()
.isRawData(),
soundingLysLstMap);
- NsharpMapResource.stopWaitCursor();
+ NsharpMapResource.stopWaitCursor();
} else if (activeLoadType == NsharpLoadDialog.PFC_SND) {
- NsharpMapResource.startWaitCursor();
+ NsharpMapResource.startWaitCursor();
+
NsharpPfcSoundingQuery
.getPfcSndDataBySndTmRange(
stnPtDataLineLst,
soundingLysLstMap);
- NsharpMapResource.stopWaitCursor();
- } else
- return false;
+ NsharpMapResource.stopWaitCursor();
+ }
+ /*
+ * TBDGPD else if(activeLoadType ==
+ * NsharpLoadDialog.GPD_OBS_SND){
+ * NsharpMapResource.startWaitCursor();
+ * NsharpGpdSoundingQuery
+ * .getGpdObsSndData(stnPtDataLineLst,
+ * soundingLysLstMap,
+ * loadDia.getActiveGpdProdName());
+ * NsharpMapResource.stopWaitCursor(); } else
+ * if(activeLoadType ==
+ * NsharpLoadDialog.GPD_PFC_SND){
+ * NsharpMapResource.startWaitCursor();
+ * NsharpGpdSoundingQuery
+ * .getGpdPfcSndData(stnPtDataLineLst,
+ * soundingLysLstMap,
+ * loadDia.getActiveGpdProdName());
+ * NsharpMapResource.stopWaitCursor(); }
+ */
+ else
+ return false;
+ long t02 = System.currentTimeMillis();
+ // System.out.println("Nsharp spent " +
+ // (t02-t01)+ " ms to query data");
// System.out.println("MAP size/"
// +soundingLysLstMap.size());
if (soundingLysLstMap.size() <= 0) {
@@ -214,40 +237,40 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
.getShell();
MessageBox mb = new MessageBox(shell,
SWT.ICON_WARNING | SWT.OK);
- mb.setMessage("Invalid sounding data returned from DB for this station!!");
- mb.open();
- loadDia.closeDiaOnly();
- return false;
- }
- loadDia.closeDiaOnly();
-
+ mb.setMessage("Invalid sounding data returned from DB for this station!!");
+ mb.open();
+ loadDia.closeDiaOnly();
+ return false;
+ }
+ loadDia.closeDiaOnly();
+
// NsharpResourceHandler skewRsc =
// skewtEdt.getRscHandler();
// skewRsc.addRsc(soundingLysLstMap,
// stnPtDataLineLst.get(0));
loadDataToNsharpResources(soundingLysLstMap,
stnPtDataLineLst.get(0));
- mapEditor = NsharpMapResource.getMapEditor();
- if (mapEditor != null) {
- mapEditor.refresh();
- }
- bringSkewTEdToTop();
+ mapEditor = NsharpMapResource.getMapEditor();
+ if (mapEditor != null) {
+ mapEditor.refresh();
+ }
+ bringSkewTEdToTop();
} else {
// System.out.println("Mouse point too far from stn");
- }
+ }
} else { // debug
// System.out.println("points is null");
- }
- }
- }
- }
-
+ }
+ }
+ }
+ }
+
} else if (button == 3) {
// NsharpEditor.bringSkewTEditorToTop();
- bringSkewTEdToTop();
- }
-
- return false;
+ bringSkewTEdToTop();
+ }
+
+ return false;
}
/*
@@ -260,18 +283,18 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
private void bringSkewTEdToTop() {
Job uijob = new UIJob("clear source selection") { //$NON-NLS-1$
public IStatus runInUIThread(IProgressMonitor monitor) {
- NsharpEditor.bringEditorToTop();
- return Status.OK_STATUS;
- }
+ NsharpEditor.bringEditorToTop();
+ return Status.OK_STATUS;
+ }
- };
- uijob.setSystem(true);
- uijob.schedule();
+ };
+ uijob.setSystem(true);
+ uijob.schedule();
}
- /*
- * Same reason to use UIJob as bringSkewTEdToTop()
- */
+ /*
+ * Same reason to use UIJob as bringSkewTEdToTop()
+ */
private void loadDataToNsharpResources(
final Map> soundMap,
final NsharpStationInfo stnInfo) {
@@ -279,16 +302,16 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
public IStatus runInUIThread(IProgressMonitor monitor) {
NsharpResourceHandler rscHdr = NsharpEditor
.createOrOpenEditor().getRscHandler();
- rscHdr.addRsc(soundMap, stnInfo);
- return Status.OK_STATUS;
- }
+ rscHdr.addRsc(soundMap, stnInfo);
+ return Status.OK_STATUS;
+ }
- };
- uijob.setSystem(true);
- uijob.schedule();
+ };
+ uijob.setSystem(true);
+ uijob.schedule();
}
- /**
+ /**
* Gets the nearest point of an selected element to the input point
*
* @param el
@@ -300,40 +323,40 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
private List getPtWithinMinDist(
List points, Coordinate pt) {
- NsharpStationInfo thePoint = null;
- double minDistance = NctextuiPointMinDistance;
- GeodeticCalculator gc;
- List thePoints = new ArrayList();
- // TODO : can't assume this is a map Editor/MapDescriptor
- NatlCntrsEditor mapEditor = NsharpMapResource.getMapEditor();
+ NsharpStationInfo thePoint = null;
+ double minDistance = NctextuiPointMinDistance;
+ GeodeticCalculator gc;
+ List thePoints = new ArrayList();
+ // TODO : can't assume this is a map Editor/MapDescriptor
+ NatlCntrsEditor mapEditor = NsharpMapResource.getMapEditor();
if (mapEditor != null) {
IMapDescriptor desc = (IMapDescriptor) mapEditor
.getActiveDisplayPane().getRenderableDisplay()
.getDescriptor();
- gc = new GeodeticCalculator(desc.getCRS());
- gc.setStartingGeographicPoint(pt.x, pt.y);
+ gc = new GeodeticCalculator(desc.getCRS());
+ gc.setStartingGeographicPoint(pt.x, pt.y);
// int textDispIndex = 1;//debug
for (NsharpStationInfo point : points) {
gc.setDestinationGeographicPoint(point.getLongitude(),
point.getLatitude());
- double dist;
+ double dist;
try {
- dist = gc.getOrthodromicDistance();
+ dist = gc.getOrthodromicDistance();
// System.out.println("dist to point " + textDispIndex++ +
// " is " + dist);
if (dist < minDistance) {
- minDistance = dist;
- thePoint = point;
- }
+ minDistance = dist;
+ thePoint = point;
+ }
} catch (Exception e) {
// e.printStackTrace();
// System.out.println("getOrthodromicDistance exception happened!");
- }
+ }
- }
+ }
// Chin, there may be more than one point for a selected stn. As
// user may selected more than one data time,
// For same stn, each data time will have one point to represent it.
@@ -342,18 +365,18 @@ public class NsharpMapMouseHandler extends InputHandlerDefaultImpl {
for (NsharpStationInfo point : points) {
if ((thePoint.getLatitude() == point.getLatitude())
&& (thePoint.getLongitude() == point.getLongitude())) {
- thePoints.add(point);
- }
- }
-
+ thePoints.add(point);
+ }
+ }
+
// marked X on selected point
NsharpMapResource.getOrCreateNsharpMapResource()
.setPickedPoint(thePoint);
-
- }
- }
- return thePoints;
+ }
+
+ }
+ return thePoints;
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResource.java
index 2c34c45ff8..398e18168d 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResource.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResource.java
@@ -73,11 +73,11 @@ public class NsharpMapResource extends
private static NatlCntrsEditor mapEditor = null;
- private static NsharpMapMouseHandler mouseHandler;
+ private static NsharpMapMouseHandler mouseHandler;
private static Cursor waitCursor = null;
- private static Control cursorControl;
+ private static Control cursorControl;
private static boolean mouseHandlerRegistered = false;
@@ -90,110 +90,110 @@ public class NsharpMapResource extends
.getActivePage() != null) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().bringToTop(mapEditor);
- mapEditor.refresh();
- }
+ mapEditor.refresh();
+ }
} catch (Exception e) {
- }
-
- }
+ }
- public static NatlCntrsEditor getMapEditor() {
- return mapEditor;
- }
+ }
- public static NsharpMapResource getMapRsc() {
- return mapRsc;
- }
+ public static NatlCntrsEditor getMapEditor() {
+ return mapEditor;
+ }
- private NsharpMapResourceData nsharpMapResourceData;
+ public static NsharpMapResource getMapRsc() {
+ return mapRsc;
+ }
- /** The set of symbols with similar attributes across many locations */
- private SymbolLocationSet symbolSet = null;
+ private NsharpMapResourceData nsharpMapResourceData;
- private SymbolLocationSet symbolToMark = null;
+ /** The set of symbols with similar attributes across many locations */
+ private SymbolLocationSet symbolSet = null;
- private List points = new ArrayList();
+ private SymbolLocationSet symbolToMark = null;
- private List pickedPoint = new ArrayList();
+ private List points = new ArrayList();
- public void setPickedPoint(NsharpStationInfo point) {
- this.pickedPoint.add(point);
- }
-
- public List getPoints() {
- return points;
- }
+ private List pickedPoint = new ArrayList();
- public void setPoints(List points) {
+ public void setPickedPoint(NsharpStationInfo point) {
+ this.pickedPoint.add(point);
+ }
+
+ public List getPoints() {
+ return points;
+ }
+
+ public void setPoints(List points) {
if (points == null) {
- this.pickedPoint.clear();
+ this.pickedPoint.clear();
symbolToMark = null;
symbolSet = null;
- this.points.clear();
+ this.points.clear();
} else {
- this.points = points;
- }
- }
+ this.points = points;
+ }
+ }
- public void addPoint(NsharpStationInfo point) {
- points.add(point);
- }
+ public void addPoint(NsharpStationInfo point) {
+ points.add(point);
+ }
+
+ /**
+ * Default constructor
+ */
+ protected NsharpMapResource(NsharpMapResourceData resourceData,
+ LoadProperties loadProperties) {
+ super(resourceData, loadProperties);
- /**
- * Default constructor
- */
- protected NsharpMapResource(NsharpMapResourceData resourceData,
- LoadProperties loadProperties) {
- super(resourceData, loadProperties);
-
// set the editable capability
getCapability(EditableCapability.class).setEditable(true);
- this.nsharpMapResourceData = resourceData;
+ this.nsharpMapResourceData = resourceData;
// System.out.println("NsharpMapResource constructed");
-
- }
+
+ }
public static void startWaitCursor() {
waitCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);
- cursorControl = Display.getCurrent().getCursorControl();
+ cursorControl = Display.getCurrent().getCursorControl();
if (cursorControl != null && waitCursor != null)
- cursorControl.setCursor(waitCursor);
- }
+ cursorControl.setCursor(waitCursor);
+ }
public static void stopWaitCursor() {
if (cursorControl != null && waitCursor != null) {
- cursorControl.setCursor(null);
- }
+ cursorControl.setCursor(null);
+ }
if (waitCursor != null) {
- waitCursor.dispose();
+ waitCursor.dispose();
waitCursor = null;
- }
- }
+ }
+ }
private static void createMapEditor() {
- // create an editor MapEditor
- try {
- AbstractEditor ed = NcDisplayMngr.getActiveNatlCntrsEditor();
-
- // Is this called in D2D. Should we only check for NcMapEditors.
+ // create an editor MapEditor
+ try {
+ AbstractEditor ed = NcDisplayMngr.getActiveNatlCntrsEditor();
+
+ // Is this called in D2D. Should we only check for NcMapEditors.
// If this isn't a NatlCntrsEditor should we look for one or just
// create a new one.
- //
+ //
if (NcEditorUtil.getNcDisplayType(ed) == NcDisplayType.NMAP_DISPLAY) {
mapEditor = (NatlCntrsEditor) ed;
} else {
mapEditor = (NatlCntrsEditor) NcDisplayMngr
.createNatlCntrsEditor(NcDisplayType.NMAP_DISPLAY,
"Select NSharp Source");
- }
-
+ }
+
// for(int i=0; i<
// mapEditor.getDescriptor().getResourceList().size(); i++)
// System.out.println(
// "A resourcename="+mapEditor.getDescriptor().getResourceList().get(i).getResource().getName());
-
- ResourceBndlLoader rbdLoader = new ResourceBndlLoader("DefaultMap");
+
+ ResourceBndlLoader rbdLoader = new ResourceBndlLoader("DefaultMap");
rbdLoader.addDefaultRBD(NcDisplayType.NMAP_DISPLAY, mapEditor);
VizApp.runSync(rbdLoader);
// System.out.println("NsharpMapResource create editor "+
@@ -207,9 +207,9 @@ public class NsharpMapResource extends
System.out
.println("NsharpMapResource Could not load initial editor: "
+ ve.getMessage());
- ve.printStackTrace();
- }
- }
+ ve.printStackTrace();
+ }
+ }
// private static void createMapEditorTest(){
// // create an editor MapEditor
@@ -245,26 +245,26 @@ public class NsharpMapResource extends
// }
public static void registerMouseHandler() {
if (mouseHandlerRegistered)
- return;
-
- mouseHandler = getMouseHandler();
+ return;
+
+ mouseHandler = getMouseHandler();
if (mapEditor != null && mouseHandler != null) {
mapEditor.registerMouseHandler((IInputHandler) mouseHandler);
- mouseHandlerRegistered = true;
- }
- }
+ mouseHandlerRegistered = true;
+ }
+ }
public static void unregisterMouseHandler() {
if (!mouseHandlerRegistered)
- return;
- mouseHandler = getMouseHandler();
+ return;
+ mouseHandler = getMouseHandler();
if (mapEditor != null && mouseHandler != null) {
mapEditor.unregisterMouseHandler((IInputHandler) mouseHandler);
mouseHandlerRegistered = false;
- }
- }
+ }
+ }
- /**
+ /**
* Create a new MapResource and add it to the current editor.
*
* @return the MapResource
@@ -273,54 +273,54 @@ public class NsharpMapResource extends
if (mapRsc == null) {
if (mapEditor == null) {
createMapEditor();// createMapEditor();
-
- }
+
+ }
if (mapEditor != null) {
IMapDescriptor desc = (IMapDescriptor) mapEditor
.getActiveDisplayPane().getRenderableDisplay()
.getDescriptor();
- try {
+ try {
if (mapRscData == null)
mapRscData = new NsharpMapResourceData();
mapRsc = mapRscData.construct(new LoadProperties(), desc);
desc.getResourceList().add(mapRsc);
mapRsc.init(mapEditor.getActiveDisplayPane().getTarget());
-
+
// register mouse handler
- mouseHandler = getMouseHandler();
+ mouseHandler = getMouseHandler();
mapEditor
.registerMouseHandler((IInputHandler) mouseHandler);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
return mapRsc;
}
public static void deleteNsharpMapResource() {
// System.out.println("NsharpMapResource:deleteNsharpMapResource ");
if (mapRsc != null) {
- mapRsc.dispose();
- mapRsc = null;
- }
+ mapRsc.dispose();
+ mapRsc = null;
+ }
}
- /**
- * Called when resource is disposed
+ /**
+ * Called when resource is disposed
*
- * @see com.raytheon.viz.core.rsc.IVizResource#dispose()
- */
- @Override
- public void disposeInternal() {
+ * @see com.raytheon.viz.core.rsc.IVizResource#dispose()
+ */
+ @Override
+ public void disposeInternal() {
// System.out.println("NsharpMapResource:disposeInternal "+
// this.toString());
-
+
if (mapEditor != null) {
mapEditor.unregisterMouseHandler(mouseHandler);
- mouseHandler = null;
+ mouseHandler = null;
// close editor
/*
* if((PlatformUI.getWorkbench()!=
@@ -331,65 +331,65 @@ public class NsharpMapResource extends
* PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage
* ().closeEditor(mapEditor, false);
*/
- mapEditor = null;
-
+ mapEditor = null;
+
}
- pickedPoint = null;
- points = null;
- symbolSet = null;
- symbolToMark = null;
- mapRsc = null;
+ pickedPoint = null;
+ points = null;
+ symbolSet = null;
+ symbolToMark = null;
+ mapRsc = null;
mapRscData = null;
if (waitCursor != null)
- waitCursor.dispose();
+ waitCursor.dispose();
waitCursor = null;
mouseHandlerRegistered = false;
- }
+ }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.core.rsc.IVizResource#getCoordinateReferenceSystem()
- */
- public CoordinateReferenceSystem getCoordinateReferenceSystem() {
+ */
+ public CoordinateReferenceSystem getCoordinateReferenceSystem() {
- if (descriptor == null)
- return null;
+ if (descriptor == null)
+ return null;
- return descriptor.getCRS();
+ return descriptor.getCRS();
- }
+ }
/*
* (non-Javadoc)
*
- * @see com.raytheon.viz.core.rsc.IVizResource#getName()
- */
- @Override
- public String getName() {
+ * @see com.raytheon.viz.core.rsc.IVizResource#getName()
+ */
+ @Override
+ public String getName() {
- return "NSHARP Resource";
+ return "NSHARP Resource";
- }
+ }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core.
* IGraphicsTarget)
- */
- @Override
- public void initInternal(IGraphicsTarget target) throws VizException {
+ */
+ @Override
+ public void initInternal(IGraphicsTarget target) throws VizException {
// System.out.println("NsharpMapResource:initInternal called");
// mapfont = target.initializeFont("Monospace",
// (float) (12 *
// nsharpMapResourceData.getMarkerTextSize().getSoftwareSize()), null);
-
+
// make the nsharp map resource editable
EditableManager.makeEditable(this,
getCapability(EditableCapability.class).isEditable());
- }
+ }
/*
* (non-Javadoc)
@@ -397,65 +397,65 @@ public class NsharpMapResource extends
* @see
* com.raytheon.viz.core.rsc.IVizResource#isApplicable(com.raytheon.viz.
* core.PixelExtent)
- */
- public boolean isApplicable(PixelExtent extent) {
+ */
+ public boolean isApplicable(PixelExtent extent) {
- return true;
+ return true;
- }
+ }
private void generateSymbolForDrawing() {
- String type;
- float lineWidth = nsharpMapResourceData.getMarkerWidth();
+ String type;
+ float lineWidth = nsharpMapResourceData.getMarkerWidth();
Boolean clear = false;
- String category = new String("Marker");
- double sizeScale = nsharpMapResourceData.getMarkerSize();
+ String category = new String("Marker");
+ double sizeScale = nsharpMapResourceData.getMarkerSize();
- if (points.isEmpty() == true) {
- symbolSet = null;
+ if (points.isEmpty() == true) {
+ symbolSet = null;
} else {
// SymbolLocationSet constructor requires a positive-length array of
// Coordinate
- Coordinate[] locations = new Coordinate[points.size()];
+ Coordinate[] locations = new Coordinate[points.size()];
Color[] colors = new Color[] { new Color(
NsharpConstants.color_green.red,
- NsharpConstants.color_green.green,
+ NsharpConstants.color_green.green,
NsharpConstants.color_green.blue) };
// System.out.println( "generateSymbolSet: size ="+ points.size());
- int i = 0;
- for (NsharpStationInfo p : points) {
- double lon, lat;
- lon = p.getLongitude();
- lat = p.getLatitude();
+ int i = 0;
+ for (NsharpStationInfo p : points) {
+ double lon, lat;
+ lon = p.getLongitude();
+ lat = p.getLatitude();
locations[i++] = new Coordinate(lon, lat);
- }
- type = nsharpMapResourceData.getMarkerType().toString();
+ }
+ type = nsharpMapResourceData.getMarkerType().toString();
// System.out.println( "generateSymbolSet done size ="+ i);
symbolSet = new SymbolLocationSet(null, colors, lineWidth,
sizeScale, clear, locations, category, type);
- }
+ }
// generate symbol for picked stn to mark X
if (pickedPoint != null && pickedPoint.size() > 0) {
- Coordinate[] locations = new Coordinate[pickedPoint.size()];
- int i = 0;
- for (NsharpStationInfo p : pickedPoint) {
- double lon, lat;
- lon = p.getLongitude();
- lat = p.getLatitude();
+ Coordinate[] locations = new Coordinate[pickedPoint.size()];
+ int i = 0;
+ for (NsharpStationInfo p : pickedPoint) {
+ double lon, lat;
+ lon = p.getLongitude();
+ lat = p.getLatitude();
locations[i++] = new Coordinate(lon, lat);
- }
- type = nsharpMapResourceData.getStnMarkerType().toString();
+ }
+ type = nsharpMapResourceData.getStnMarkerType().toString();
Color[] colors = new Color[] { new Color(
NsharpConstants.color_red.red,
- NsharpConstants.color_red.green,
+ NsharpConstants.color_red.green,
NsharpConstants.color_red.blue) };
symbolToMark = new SymbolLocationSet(null, colors, lineWidth,
sizeScale * 2, clear, locations, category, type);
} else
symbolToMark = null;
- }
+ }
/*
* (non-Javadoc)
@@ -463,46 +463,46 @@ public class NsharpMapResource extends
* @see
* com.raytheon.viz.core.drawables.IRenderable#paint(com.raytheon.viz.core
* .IGraphicsTarget, com.raytheon.viz.core.drawables.PaintProperties)
- */
- @Override
- public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
- throws VizException {
+ */
+ @Override
+ public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
+ throws VizException {
// System.out.println("paintInternal called!");
// IFont font = target.initializeFont("Monospace",
// (float) (12 *
// nsharpMapResourceData.getMarkerTextSize().getSoftwareSize()), null);
-
- generateSymbolForDrawing();
+
+ generateSymbolForDrawing();
DisplayElementFactory df = new DisplayElementFactory(target,
this.descriptor);
if (symbolSet != null) {
ArrayList elements = df.createDisplayElements(
symbolSet, paintProps);
for (IDisplayable each : elements) {
- try {
- each.draw(target, paintProps);
- each.dispose();
+ try {
+ each.draw(target, paintProps);
+ each.dispose();
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
// System.out.println("paintInternal caught draw exception!");
- }
- }
- }
+ }
+ }
+ }
if (symbolToMark != null) {
ArrayList elements = df.createDisplayElements(
symbolToMark, paintProps);
for (IDisplayable each : elements) {
- try {
- each.draw(target, paintProps);
- each.dispose();
+ try {
+ each.draw(target, paintProps);
+ each.dispose();
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
// System.out.println("paintInternal caught draw exception!");
- }
- }
- }
+ }
+ }
+ }
// font.dispose();
- }
+ }
/*
* (non-Javadoc)
@@ -510,12 +510,12 @@ public class NsharpMapResource extends
* @see
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#isProjectable
* (org.opengis.referencing.crs.CoordinateReferenceSystem)
- */
- public boolean isProjectable(CoordinateReferenceSystem mapData) {
+ */
+ public boolean isProjectable(CoordinateReferenceSystem mapData) {
- return true;
+ return true;
- }
+ }
/*
* (non-Javadoc)
@@ -523,94 +523,94 @@ public class NsharpMapResource extends
* @see
* com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org
* .opengis.referencing.crs.CoordinateReferenceSystem)
- */
- @Override
- public void project(CoordinateReferenceSystem mapData) throws VizException {
+ */
+ @Override
+ public void project(CoordinateReferenceSystem mapData) throws VizException {
// System.out.println("NctextuiResource: project ");
- }
-
+ }
+
/**
* Returns the current mouse handler.
*
* @return
- */
- private static NsharpMapMouseHandler getMouseHandler() {
-
+ */
+ private static NsharpMapMouseHandler getMouseHandler() {
+
if (mouseHandler == null) {
-
- mouseHandler = new NsharpMapMouseHandler();
-
+
+ mouseHandler = new NsharpMapMouseHandler();
+
}
return mouseHandler;
-
+
}
-
+
@Override
- public boolean okToUnload() {
- /*
- * DisAllow unloading of Resource
- */
-
- return false;
-
- }
+ public boolean okToUnload() {
+ /*
+ * DisAllow unloading of Resource
+ */
- @Override
- public void notifyRemove(ResourcePair rp) throws VizException {
- // TODO Auto-generated method stub
-
- }
+ return false;
- @Override
- public void propertiesChanged(ResourceProperties updatedProps) {
+ }
+
+ @Override
+ public void notifyRemove(ResourcePair rp) throws VizException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void propertiesChanged(ResourceProperties updatedProps) {
if (updatedProps.isVisible()) {
reopenTextView();
} else {
hideTextView();
- }
+ }
}
-
+
private void hideTextView() {
IWorkbenchPage wpage = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
-
+
IViewPart vpart = wpage.findView("gov.noaa.nws.ncep.ui.nsharp");
if (wpage.isPartVisible(vpart)) {
- NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
+ NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
if (paletteWin != null) {
- paletteWin.setEditorVisible(false);
- wpage.hideView(vpart);
- }
+ paletteWin.setEditorVisible(false);
+ wpage.hideView(vpart);
+ }
}
- }
-
+ }
+
private void reopenTextView() {
IWorkbenchPage wpage = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
-
+
IViewPart vpart = wpage.findView("gov.noaa.nws.ncep.ui.nsharp");
if (!wpage.isPartVisible(vpart)) {
- NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
+ NsharpPaletteWindow paletteWin = NsharpPaletteWindow.getInstance();
if (paletteWin != null) {
- paletteWin.setEditorVisible(true);
- try {
+ paletteWin.setEditorVisible(true);
+ try {
vpart = wpage.showView("gov.noaa.nws.ncep.ui.nsharp");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
- }
+ }
- /**
- * Check if the resource is currently editable
- *
- * @return editable
- */
- public boolean isEditable() {
- return getCapability(EditableCapability.class).isEditable();
- }
+ /**
+ * Check if the resource is currently editable
+ *
+ * @return editable
+ */
+ public boolean isEditable() {
+ return getCapability(EditableCapability.class).isEditable();
+ }
public void setEditable(boolean enable) {
getCapability(EditableCapability.class).setEditable(enable);
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResourceData.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResourceData.java
index b809b59028..735fcaac4e 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResourceData.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpMapResourceData.java
@@ -30,28 +30,28 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
public class NsharpMapResourceData extends AbstractResourceData {
- private MarkerState markerState = MarkerState.MARKER_ONLY;
+ private MarkerState markerState = MarkerState.MARKER_ONLY;
- private MarkerType markerType = MarkerType.DIAMOND;
+ private MarkerType markerType = MarkerType.DIAMOND;
- private Float markerSize = 1f;
+ private Float markerSize = 1f;
- private Integer markerWidth = 2;
+ private Integer markerWidth = 2;
- private MarkerTextSize markerTextSize = MarkerTextSize.MEDIUM;
+ private MarkerTextSize markerTextSize = MarkerTextSize.MEDIUM;
- private String mapName = "NSHARP";
+ private String mapName = "NSHARP";
- private MarkerType stnMarkerType = MarkerType.LARGE_X;
-
- public MarkerType getStnMarkerType() {
- return stnMarkerType;
- }
+ private MarkerType stnMarkerType = MarkerType.LARGE_X;
+
+ public MarkerType getStnMarkerType() {
+ return stnMarkerType;
+ }
+
+ public NsharpMapResourceData() {
+ super();
+ }
- public NsharpMapResourceData() {
- super();
- }
-
/*
* (non-Javadoc)
*
@@ -59,13 +59,13 @@ public class NsharpMapResourceData extends AbstractResourceData {
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon
* .uf.viz.core.comm.LoadProperties,
* com.raytheon.uf.viz.core.drawables.IDescriptor)
- */
- @Override
- public NsharpMapResource construct(LoadProperties loadProperties,
- IDescriptor descriptor) throws VizException {
- // TODO Auto-generated method stub
- return new NsharpMapResource(this, loadProperties);
- }
+ */
+ @Override
+ public NsharpMapResource construct(LoadProperties loadProperties,
+ IDescriptor descriptor) throws VizException {
+ // TODO Auto-generated method stub
+ return new NsharpMapResource(this, loadProperties);
+ }
/*
* (non-Javadoc)
@@ -73,15 +73,15 @@ public class NsharpMapResourceData extends AbstractResourceData {
* @see
* com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object
* )
- */
- @Override
- public void update(Object updateData) {
- // TODO Auto-generated method stub
+ */
+ @Override
+ public void update(Object updateData) {
+ // TODO Auto-generated method stub
- }
+ }
- @Override
- public boolean equals(Object obj) {
+ @Override
+ public boolean equals(Object obj) {
if (obj == null || !(obj instanceof NsharpMapResourceData))
return false;
NsharpMapResourceData rdata = (NsharpMapResourceData) obj;
@@ -93,54 +93,54 @@ public class NsharpMapResourceData extends AbstractResourceData {
&& this.stnMarkerType.equals(rdata.getStnMarkerType()))
return true;
- return false;
- }
-
- public MarkerState getMarkerState() {
- return markerState;
- }
+ return false;
+ }
- public void setMarkerState(MarkerState markerState) {
- this.markerState = markerState;
- }
+ public MarkerState getMarkerState() {
+ return markerState;
+ }
- public MarkerType getMarkerType() {
- return markerType;
- }
+ public void setMarkerState(MarkerState markerState) {
+ this.markerState = markerState;
+ }
- public void setMarkerType(MarkerType markerType) {
- this.markerType = markerType;
- }
+ public MarkerType getMarkerType() {
+ return markerType;
+ }
- public Float getMarkerSize() {
- return markerSize;
- }
+ public void setMarkerType(MarkerType markerType) {
+ this.markerType = markerType;
+ }
- public void setMarkerSize(Float markerSize) {
- this.markerSize = markerSize;
- }
+ public Float getMarkerSize() {
+ return markerSize;
+ }
- public Integer getMarkerWidth() {
- return markerWidth;
- }
+ public void setMarkerSize(Float markerSize) {
+ this.markerSize = markerSize;
+ }
- public void setMarkerWidth(Integer markerWidth) {
- this.markerWidth = markerWidth;
- }
+ public Integer getMarkerWidth() {
+ return markerWidth;
+ }
- public MarkerTextSize getMarkerTextSize() {
- return markerTextSize;
- }
+ public void setMarkerWidth(Integer markerWidth) {
+ this.markerWidth = markerWidth;
+ }
- public void setMarkerTextSize(MarkerTextSize markerTextSize) {
- this.markerTextSize = markerTextSize;
- }
+ public MarkerTextSize getMarkerTextSize() {
+ return markerTextSize;
+ }
- public String getMapName() {
- return mapName;
- }
+ public void setMarkerTextSize(MarkerTextSize markerTextSize) {
+ this.markerTextSize = markerTextSize;
+ }
- public void setMapName(String mapName) {
- this.mapName = mapName;
- }
+ public String getMapName() {
+ return mapName;
+ }
+
+ public void setMapName(String mapName) {
+ this.mapName = mapName;
+ }
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpObservedSoundingQuery.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpObservedSoundingQuery.java
index 11c5d22f96..53493d91f4 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpObservedSoundingQuery.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/map/NsharpObservedSoundingQuery.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp.display.map;
+
/**
*
* gov.noaa.nws.ncep.ui.nsharp.display.map.NsharpObservedSoundingQuery
@@ -30,92 +31,113 @@ import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-//Chin-T import com.raytheon.uf.common.sounding.SoundingLayer;
import com.vividsolutions.jts.geom.Coordinate;
+//Chin-T import com.raytheon.uf.common.sounding.SoundingLayer;
public class NsharpObservedSoundingQuery {
-
- //Chin-T public static void getObservedSndData(List stnPtDataLineLst, Map> soundingLysLstMap) {
- //Chin: note that Nsharp currently GUI only allow user pick one stn at one time, but could be many refTimes.
- public static void getObservedSndData(List stnPtDataLineLst, boolean rawData, Map> soundingLysLstMap) {
- //String pickedStnInfo = "";
- List coords= new ArrayList();
- List refTimeLst = new ArrayList();
- //create refTime array and lat/lon array
- for(NsharpStationInfo StnPt : stnPtDataLineLst){
- //one StnPt represent one data time line
- //List Ids = StnPt.getDbId();
- System.out.println("stn lat ="+StnPt.getLatitude()+ " lon="+StnPt.getLongitude());
- boolean exist = false;
- for(Coordinate c: coords){
- if(c.x == StnPt.getLongitude() && c.y == StnPt.getLatitude()){
- exist= true;
- break;
- }
- }
- if(exist==false) {
- Coordinate coord = new Coordinate(StnPt.getLongitude(),StnPt.getLatitude());
- coords.add(coord);
- }
- exist = false;
- for(long t: refTimeLst){
- if(t == StnPt.getReftime().getTime()){
- exist= true;
- break;
- }
- }
- if(exist==false) {
- refTimeLst.add(StnPt.getReftime().getTime());
- }
-
-
- }
- double[][] latLon = new double[coords.size()][2];
- for (int i=0; i< coords.size(); i++){
- latLon[i][0]= coords.get(i).y; //lat
- latLon[i][1]= coords.get(i).x; //lon
- }
- NcSoundingCube cube = NcSoundingQuery.uaGenericSoundingQuery(refTimeLst.toArray(new Long[0]), latLon, stnPtDataLineLst.get(0).getSndType(),
- NcSoundingLayer.DataType.ALLDATA, !rawData, "-1");
- //NcSoundingCube cube = NcSoundingQuery.soundingQueryByLatLon(stnPtDataLineLst.get(0).getReftime().getTime(), coords, stnPtDataLineLst.get(0).getSndType(),
- // NcSoundingLayer.DataType.ALLDATA, !rawData, "-1");
- if(cube != null && cube.getSoundingProfileList().size()>0 && cube.getRtnStatus()==NcSoundingCube.QueryStatus.OK){
- for(NcSoundingProfile sndPf : cube.getSoundingProfileList()){
- List rtnSndLst = sndPf.getSoundingLyLst();
- //if(rtnSndLst != null && rtnSndLst.size() > 0){
- //NcSoundingProfile sndPf = cube.getSoundingProfileList().get(0);
- //System.out.println("size of profile = "+ cube.getSoundingProfileList().size());
- //debug
- //for(NcSoundingProfile pf: cube.getSoundingProfileList()){
- // System.out.println("sounding profile: lat="+pf.getStationLatitude()+" lon="+pf.getStationLongitude()+ " stnId="+ pf.getStationId() );
- //}
- //List rtnSndLst = sndPf.getSoundingLyLst();
- // Chin-T List sndLyList = NsharpSoundingQueryCommon.convertToSoundingLayerList(rtnSndLst);
- if(rtnSndLst != null && rtnSndLst.size() > 0){
- //update sounding data so they can be used by Skewt Resource and PalletWindow
- if(rawData)
- rtnSndLst = NsharpDataHandling.sortObsSoundingDataForShow(rtnSndLst, sndPf.getStationElevation());
- else
- rtnSndLst = NsharpDataHandling.organizeSoundingDataForShow(rtnSndLst, sndPf.getStationElevation());
- //minimum rtnSndList size will be 2 (50 & 75 mb layers), but that is not enough
- // We need at least 2 regular layers for plotting
- if(rtnSndLst != null && rtnSndLst.size() > 4){
- String dispInfo="";
- for(NsharpStationInfo StnPt : stnPtDataLineLst){
- if(StnPt.getReftime().getTime() == sndPf.getFcsTime()){
- dispInfo = StnPt.getStnDisplayInfo();
- break;
- }
- }
- soundingLysLstMap.put(dispInfo, rtnSndLst);
- }
- }
- }
- //}
- }
-
- }
-
+ // Chin-T public static void getObservedSndData(List
+ // stnPtDataLineLst, Map> soundingLysLstMap) {
+ // Chin: note that Nsharp currently GUI only allow user pick one stn at one
+ // time, but could be many refTimes.
+ public static void getObservedSndData(
+ List stnPtDataLineLst, boolean rawData,
+ Map> soundingLysLstMap) {
+ // String pickedStnInfo = "";
+ List coords = new ArrayList();
+ List refTimeLst = new ArrayList();
+ // create refTime array and lat/lon array
+ for (NsharpStationInfo StnPt : stnPtDataLineLst) {
+ // one StnPt represent one data time line
+ // List Ids = StnPt.getDbId();
+ // System.out.println("stn lat ="+StnPt.getLatitude()+
+ // " lon="+StnPt.getLongitude());
+ boolean exist = false;
+ for (Coordinate c : coords) {
+ if (c.x == StnPt.getLongitude() && c.y == StnPt.getLatitude()) {
+ exist = true;
+ break;
+ }
+ }
+ if (exist == false) {
+ Coordinate coord = new Coordinate(StnPt.getLongitude(),
+ StnPt.getLatitude());
+ coords.add(coord);
+ }
+ exist = false;
+ for (long t : refTimeLst) {
+ if (t == StnPt.getReftime().getTime()) {
+ exist = true;
+ break;
+ }
+ }
+ if (exist == false) {
+ refTimeLst.add(StnPt.getReftime().getTime());
+ }
+
+ }
+ double[][] latLon = new double[coords.size()][2];
+ for (int i = 0; i < coords.size(); i++) {
+ latLon[i][0] = coords.get(i).y; // lat
+ latLon[i][1] = coords.get(i).x; // lon
+ }
+ NcSoundingCube cube = NcSoundingQuery
+ .uaGenericSoundingQuery(refTimeLst.toArray(new Long[0]),
+ latLon, stnPtDataLineLst.get(0).getSndType(),
+ NcSoundingLayer.DataType.ALLDATA, !rawData, "-1");
+ // NcSoundingCube cube =
+ // NcSoundingQuery.soundingQueryByLatLon(stnPtDataLineLst.get(0).getReftime().getTime(),
+ // coords, stnPtDataLineLst.get(0).getSndType(),
+ // NcSoundingLayer.DataType.ALLDATA, !rawData, "-1");
+ if (cube != null && cube.getSoundingProfileList().size() > 0
+ && cube.getRtnStatus() == NcSoundingCube.QueryStatus.OK) {
+ for (NcSoundingProfile sndPf : cube.getSoundingProfileList()) {
+ List rtnSndLst = sndPf.getSoundingLyLst();
+ // if(rtnSndLst != null && rtnSndLst.size() > 0){
+
+ // NcSoundingProfile sndPf =
+ // cube.getSoundingProfileList().get(0);
+ // System.out.println("size of profile = "+
+ // cube.getSoundingProfileList().size());
+ // debug
+ // for(NcSoundingProfile pf: cube.getSoundingProfileList()){
+ // System.out.println("sounding profile: lat="+pf.getStationLatitude()+" lon="+pf.getStationLongitude()+
+ // " stnId="+ pf.getStationId() );
+ // }
+ // List rtnSndLst = sndPf.getSoundingLyLst();
+ // Chin-T List sndLyList =
+ // NsharpSoundingQueryCommon.convertToSoundingLayerList(rtnSndLst);
+ if (rtnSndLst != null && rtnSndLst.size() > 0) {
+ // update sounding data so they can be used by Skewt
+ // Resource and PalletWindow
+ if (rawData)
+ rtnSndLst = NsharpDataHandling
+ .sortObsSoundingDataForShow(rtnSndLst,
+ sndPf.getStationElevation());
+ else
+ rtnSndLst = NsharpDataHandling
+ .organizeSoundingDataForShow(rtnSndLst,
+ sndPf.getStationElevation());
+ // minimum rtnSndList size will be 2 (50 & 75 mb layers),
+ // but that is not enough
+ // We need at least 2 regular layers for plotting
+ if (rtnSndLst != null && rtnSndLst.size() > 4) {
+ String dispInfo = "";
+ for (NsharpStationInfo StnPt : stnPtDataLineLst) {
+ if (StnPt.getReftime().getTime() == sndPf
+ .getFcsTime()) {
+ dispInfo = StnPt.getStnDisplayInfo();
+ break;
+ }
+ }
+ soundingLysLstMap.put(dispInfo, rtnSndLst);
+ }
+ }
+ }
+ // }
+ }
+
+ }
+
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpAbstractPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpAbstractPaneResource.java
index f1fb1f4e9d..f4930ca4f2 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpAbstractPaneResource.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpAbstractPaneResource.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
+
/**
*
*
@@ -53,273 +54,404 @@ import com.raytheon.viz.core.ColorUtil;
import com.raytheon.viz.core.graphing.WGraphics;
import com.vividsolutions.jts.geom.Coordinate;
-public class NsharpAbstractPaneResource extends AbstractVizResource{
- NsharpNative nsharpNative=null;
- protected IGraphicsTarget target=null;
- protected Rectangle rectangle;
- protected WGraphics world;
- protected PixelExtent pe;
- protected static final UnitConverter celciusToFahrenheit = SI.CELSIUS.getConverterTo(NonSI.FAHRENHEIT);
- protected static final UnitConverter celciusToKelvin = SI.CELSIUS.getConverterTo(SI.KELVIN);
- protected List soundingLys = null;
- protected List previousSoundingLys = null;
- protected NsharpResourceHandler rscHandler=null;
- protected NsharpGraphProperty graphConfigProperty=null;
- protected HashMap linePropertyMap=null;
- protected int currentSoundingLayerIndex =0;
- protected IFont font9=null;
- protected IFont font10=null;
- protected IFont font11=null;
- protected IFont font12=null;
- protected float currentFont10Size=10;
+public class NsharpAbstractPaneResource extends
+ AbstractVizResource {
+ NsharpNative nsharpNative = null;
+
+ protected IGraphicsTarget target = null;
+
+ protected Rectangle rectangle;
+
+ protected WGraphics world;
+
+ protected PixelExtent pe;
+
+ protected static final UnitConverter celciusToFahrenheit = SI.CELSIUS
+ .getConverterTo(NonSI.FAHRENHEIT);
+
+ protected static final UnitConverter celciusToKelvin = SI.CELSIUS
+ .getConverterTo(SI.KELVIN);
+
+ protected List soundingLys = null;
+
+ protected List previousSoundingLys = null;
+
+ protected NsharpResourceHandler rscHandler = null;
+
+ protected NsharpGraphProperty graphConfigProperty = null;
+
+ protected HashMap linePropertyMap = null;
+
+ protected int currentSoundingLayerIndex = 0;
+
+ protected IFont font9 = null;
+
+ protected IFont font10 = null;
+
+ protected IFont font11 = null;
+
+ protected IFont font12 = null;
+
+ protected IFont font20 = null; // d2dlite
+
+ protected float currentFont10Size = 10;
+
protected int commonLinewidth;
+
protected LineStyle commonLineStyle;
+
protected Coordinate interactiveTempPointCoordinate;
- protected Float currentZoomLevel=1f;
- protected float currentCanvasBoundWidth;//= NsharpConstants.DEFAULT_CANVAS_WIDTH;
- protected float currentCanvasBoundHeight; //= NsharpConstants.DEFAULT_CANVAS_HEIGHT;
- protected float myDefaultCanvasHeight;// = NsharpConstants.DEFAULT_CANVAS_HEIGHT*4/5;
- protected float myDefaultCanvasWidth;//= NsharpConstants.DEFAULT_CANVAS_WIDTH/2;
- //protected Float zoomLevel;
- protected boolean resize=false;
- protected String paneConfigurationName;
+
+ protected Float currentZoomLevel = 1f;
+
+ protected float currentCanvasBoundWidth;// =
+ // NsharpConstants.DEFAULT_CANVAS_WIDTH;
+
+ protected float currentCanvasBoundHeight; // =
+ // NsharpConstants.DEFAULT_CANVAS_HEIGHT;
+
+ protected float myDefaultCanvasHeight;// =
+ // NsharpConstants.DEFAULT_CANVAS_HEIGHT*4/5;
+
+ protected float myDefaultCanvasWidth;// =
+ // NsharpConstants.DEFAULT_CANVAS_WIDTH/2;
+
+ // protected Float zoomLevel;
+ protected boolean resize = false;
+
+ protected String paneConfigurationName;
+
public static final float INVALID_DATA = NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA;
- protected Coordinate cursorCor;
- protected int charHeight = NsharpConstants.CHAR_HEIGHT_;
- protected double charWidth;
+
+ protected Coordinate cursorCor;
+
+ protected double charHeight = NsharpConstants.CHAR_HEIGHT_; // d2dlite
+
+ protected double charWidth;
+
+ // d2dlite
+ protected double lineHeight = charHeight * 1.2;
+
protected PaintProperties paintProps;
-
- public NsharpAbstractPaneResource(AbstractResourceData resourceData,
- LoadProperties loadProperties, NsharpAbstractPaneDescriptor desc) {
- super(resourceData, loadProperties);
- descriptor = desc;
- this.dataTimes = new ArrayList();
-
- }
- @Override
- protected void disposeInternal() {
- if(font9!=null){
- font9.dispose();
- font9=null;
- }
- if(font10!=null){
- font10.dispose();
- font10=null;
- }
- if(font11!=null){
- font11.dispose();
- font11=null;
- }
- if(font12!=null){
- font12.dispose();
- font12=null;
- }
- this.target.dispose();
- target = null;
- }
+ protected boolean sidePaneMode = false; // FixMark:sidePaneLooping d2dlite
+ public NsharpAbstractPaneResource(AbstractResourceData resourceData,
+ LoadProperties loadProperties, NsharpAbstractPaneDescriptor desc) {
+ super(resourceData, loadProperties);
+ descriptor = desc;
+ this.dataTimes = new ArrayList();
- @Override
- protected void paintInternal(IGraphicsTarget target,
- PaintProperties paintProps) throws VizException {
- this.paintProps = paintProps;
- this.target = target;
- if(rscHandler== null || rscHandler.getSoundingLys()==null)
- return;
- float zoomLevel = paintProps.getZoomLevel();
- /*if( currentCanvasBoundWidth!= paintProps.getCanvasBounds().width || currentCanvasBoundHeight!=paintProps.getCanvasBounds().height){
+ }
- currentCanvasBoundWidth= paintProps.getCanvasBounds().width;
- currentCanvasBoundHeight=paintProps.getCanvasBounds().height;
- adjustFontSize(currentCanvasBoundWidth,currentCanvasBoundHeight);
- }
- */
- //System.out.println("currentZoomLevel="+currentZoomLevel+" paintProps's zoomLevel="+zoomLevel);
- if(zoomLevel > 1.0f)
- zoomLevel = 1.0f;
- if((zoomLevel != currentZoomLevel) ){
- currentZoomLevel = zoomLevel;
- handleZooming();
-
- }
- if(this.resize==true ){
- handleResize();
- }
- }
+ @Override
+ protected void disposeInternal() {
+ if (font9 != null) {
+ font9.dispose();
+ font9 = null;
+ }
+ if (font10 != null) {
+ font10.dispose();
+ font10 = null;
+ }
+ if (font11 != null) {
+ font11.dispose();
+ font11 = null;
+ }
+ if (font12 != null) {
+ font12.dispose();
+ font12 = null;
+ }
+ if (font20 != null) { // d2dlite
+ font20.dispose();
+ font20 = null;
+ }
+ this.target.dispose();
+ target = null;
+ }
- @Override
- protected void initInternal(IGraphicsTarget target) throws VizException {
- this.target = target;
- this.font9 = target.initializeFont("Monospace", 9, null);
- this.font10 = target.initializeFont("Monospace", 10, null);
- this.font11 = target.initializeFont("Monospace", 11, null);
- IFont.Style[] style = {IFont.Style.BOLD};
- this.font12 = target.initializeFont("Monospace", 12, style);
- this.font9.setSmoothing(false);
- this.font9.setScaleFont(false);
- this.font10.setSmoothing(false);
- this.font10.setScaleFont(false);
- this.font11.setSmoothing(false);
- this.font11.setScaleFont(false);
- this.font12.setSmoothing(false);
- this.font12.setScaleFont(false);
- commonLinewidth = getCapability(OutlineCapability.class).getOutlineWidth();
- commonLineStyle = getCapability(OutlineCapability.class)
- .getLineStyle();
- this.resize=true ;
- //nsharpNative = new NsharpNative();
- //System.out.println("NsharpDefaultPaneResource ::: initInternal with native "+ nsharpNative.toString());
- }
-
- @SuppressWarnings("deprecation")
- public void resetData(List soundingLys, List prevsoundingLys){
- this.soundingLys = soundingLys;
- this.previousSoundingLys = prevsoundingLys;
- descriptor.setFrame(0);
- }
+ @Override
+ protected void paintInternal(IGraphicsTarget target,
+ PaintProperties paintProps) throws VizException {
+ this.paintProps = paintProps;
+ this.target = target;
+ if (rscHandler == null || rscHandler.getSoundingLys() == null)
+ return;
+ float zoomLevel = paintProps.getZoomLevel();
+ /*
+ * if( currentCanvasBoundWidth!= paintProps.getCanvasBounds().width ||
+ * currentCanvasBoundHeight!=paintProps.getCanvasBounds().height){
+ *
+ * currentCanvasBoundWidth= paintProps.getCanvasBounds().width;
+ * currentCanvasBoundHeight=paintProps.getCanvasBounds().height;
+ * adjustFontSize(currentCanvasBoundWidth,currentCanvasBoundHeight); }
+ */
+ // System.out.println("currentZoomLevel="+currentZoomLevel+" paintProps's zoomLevel="+zoomLevel);
+ if (zoomLevel > 1.0f)
+ zoomLevel = 1.0f;
+ if ((zoomLevel != currentZoomLevel)) {
+ currentZoomLevel = zoomLevel;
+ handleZooming();
- public WGraphics getWorld() {
- return world;
- }
-
-
- protected void adjustFontSize(float canvasW, float canvasH ) {
- float font9Size,font10Size,font11Size,font12Size;
-
- float fontAdjusted=0;
- float fontBaseH=90f; //Chin: why 70 & 100? After many "try and error" experiments...
- float fontBaseW=120f;
- if(canvasH < myDefaultCanvasHeight && canvasW< myDefaultCanvasWidth){
- //both width and height are smaller than default
- float wAdjust = (float)(myDefaultCanvasWidth-canvasW)/fontBaseW;
- float hAdjust = (float)(myDefaultCanvasHeight-canvasH)/fontBaseH;
- fontAdjusted = Math.max(wAdjust,hAdjust);
- }
- else if(canvasW< myDefaultCanvasWidth){
- // only width smaller than default
- fontAdjusted = (float)(myDefaultCanvasWidth-canvasW)/fontBaseW;
- }
- else if(canvasH < myDefaultCanvasHeight ){
- // only height smaller than default
- fontAdjusted = (float)(myDefaultCanvasHeight-canvasH)/fontBaseH;
- }
- //Chin: Can not bigger than 9, otherwise, fint9 size willbe negative.
- //Why 8.8 ? After many "try and error" experiments...
- if(fontAdjusted > 8.8)
- fontAdjusted=8.8f;
-
- font9Size = 9-fontAdjusted;
- font10Size = 10-fontAdjusted;
- font11Size =11-fontAdjusted;
- font12Size = 12-fontAdjusted;
+ }
+ if (this.resize == true) {
+ handleResize();
+ }
+ }
- if(font9!=null){
- font9.dispose();
- }
- font9 = target.initializeFont("Monospace", font9Size, null);
-
- if(font10!=null){
- font10.dispose();
- }
- font10 = target.initializeFont("Monospace", font10Size, null);
- if(font11!=null){
- font11.dispose();
- }
- font11 = target.initializeFont("Monospace", font11Size, null);
- if(font12!=null){
- font12.dispose();
- }
- IFont.Style[] style = {IFont.Style.BOLD};
- font12 = target.initializeFont("Monospace", font12Size, style);
- currentFont10Size = font10Size;
- //System.out.println(descriptor.getPaneNumber()+": adjusted font10 size ="+currentFont10Size);
- }
- protected void magnifyFont(double zoomLevel) {
- float magFactor = 1.0f / (float)zoomLevel;
- font9.setMagnification(magFactor);
- font10.setMagnification(magFactor);
- font11.setMagnification(magFactor);
- font12.setMagnification(magFactor);
- }
- @Override
+ @Override
+ protected void initInternal(IGraphicsTarget target) throws VizException {
+ this.target = target;
+ this.font9 = target.initializeFont("Monospace", 9, null);
+ this.font10 = target.initializeFont("Monospace", 10, null);
+ this.font11 = target.initializeFont("Monospace", 11, null);
+ IFont.Style[] style = { IFont.Style.BOLD };
+ this.font12 = target.initializeFont("Monospace", 12, style);
+ this.font20 = target.initializeFont("Monospace", 20, null); // d2dlite
+ this.font9.setSmoothing(false);
+ this.font9.setScaleFont(false);
+ this.font10.setSmoothing(false);
+ this.font10.setScaleFont(false);
+ this.font11.setSmoothing(false);
+ this.font11.setScaleFont(false);
+ this.font12.setSmoothing(false);
+ this.font12.setScaleFont(false);
+ this.font20.setSmoothing(false); // d2dlite
+ this.font20.setScaleFont(false);
+ commonLinewidth = getCapability(OutlineCapability.class)
+ .getOutlineWidth();
+ commonLineStyle = getCapability(OutlineCapability.class).getLineStyle();
+ this.resize = true;
+ // nsharpNative = new NsharpNative();
+ // System.out.println("NsharpDefaultPaneResource ::: initInternal with native "+
+ // nsharpNative.toString());
+ }
+
+ @SuppressWarnings("deprecation")
+ public void resetData(List soundingLys,
+ List prevsoundingLys) {
+ this.soundingLys = soundingLys;
+ this.previousSoundingLys = prevsoundingLys;
+ descriptor.setFrame(0);
+ }
+
+ public WGraphics getWorld() {
+ return world;
+ }
+
+ protected void adjustFontSize(float canvasW, float canvasH) {
+ float font9Size, font10Size, font11Size, font12Size, font20Size; // d2dlite
+
+ float fontAdjusted = 0;
+ float fontBaseH = 90f; // Chin: why 70 & 100? After many "try and error"
+ // experiments...
+ float fontBaseW = 120f;
+ if (canvasH < myDefaultCanvasHeight && canvasW < myDefaultCanvasWidth) {
+ // both width and height are smaller than default
+ float wAdjust = (float) (myDefaultCanvasWidth - canvasW)
+ / fontBaseW;
+ float hAdjust = (float) (myDefaultCanvasHeight - canvasH)
+ / fontBaseH;
+ fontAdjusted = Math.max(wAdjust, hAdjust);
+ } else if (canvasW < myDefaultCanvasWidth) {
+ // only width smaller than default
+ fontAdjusted = (float) (myDefaultCanvasWidth - canvasW) / fontBaseW;
+ } else if (canvasH < myDefaultCanvasHeight) {
+ // only height smaller than default
+ fontAdjusted = (float) (myDefaultCanvasHeight - canvasH)
+ / fontBaseH;
+ }
+ // Chin: Can not bigger than 9, otherwise, fint9 size willbe negative.
+ // Why 8.8 ? After many "try and error" experiments...
+ if (fontAdjusted > 8.8)
+ fontAdjusted = 8.8f;
+
+ font9Size = 9 - fontAdjusted;
+ font10Size = 10 - fontAdjusted;
+ font11Size = 11 - fontAdjusted;
+ font12Size = 12 - fontAdjusted;
+ font20Size = 20 - fontAdjusted; // d2dlite
+
+ if (font9 != null) {
+ font9.dispose();
+ }
+ font9 = target.initializeFont("Monospace", font9Size, null);
+
+ if (font10 != null) {
+ font10.dispose();
+ }
+ font10 = target.initializeFont("Monospace", font10Size, null);
+ if (font11 != null) {
+ font11.dispose();
+ }
+ font11 = target.initializeFont("Monospace", font11Size, null);
+ if (font12 != null) {
+ font12.dispose();
+ }
+ IFont.Style[] style = { IFont.Style.BOLD };
+ font12 = target.initializeFont("Monospace", font12Size, style);
+ // d2dlite
+ if (font20 != null) {
+ font20.dispose();
+ }
+ font20 = target.initializeFont("Monospace", font20Size, style);
+ currentFont10Size = font10Size;
+ // System.out.println(descriptor.getPaneNumber()+": adjusted font10 size ="+currentFont10Size);
+ }
+
+ protected void magnifyFont(double zoomLevel) {
+ float magFactor = 1.0f / (float) zoomLevel;
+ font9.setMagnification(magFactor);
+ font10.setMagnification(magFactor);
+ font11.setMagnification(magFactor);
+ font12.setMagnification(magFactor);
+ font20.setMagnification(magFactor); // d2dlite
+ }
+
+ @Override
public void setDescriptor(NsharpAbstractPaneDescriptor descriptor) {
super.setDescriptor(descriptor);
RGB rgb = ColorUtil.getNewColor(descriptor);
getCapability(ColorableCapability.class).setColor(rgb);
- //System.out.println("screwT Rsc setDescriptor called");
+ // System.out.println("screwT Rsc setDescriptor called");
}
- public void setSoundingLys(List soundingLys) {
- this.soundingLys = soundingLys;
- }
+ public void setSoundingLys(List soundingLys) {
+ this.soundingLys = soundingLys;
+ }
- public HashMap getLinePropertyMap() {
- return linePropertyMap;
- }
+ public HashMap getLinePropertyMap() {
+ return linePropertyMap;
+ }
- public void setLinePropertyMap(
- HashMap linePropertyMap) {
- this.linePropertyMap = linePropertyMap;
-
- }
+ public void setLinePropertyMap(
+ HashMap linePropertyMap) {
+ this.linePropertyMap = linePropertyMap;
- public NsharpGraphProperty getGraphConfigProperty() {
- return graphConfigProperty;
- }
+ }
- public void setGraphConfigProperty(NsharpGraphProperty graphConfigProperty) {
- this.graphConfigProperty = graphConfigProperty;
- paneConfigurationName = this.graphConfigProperty.getPaneConfigurationName();
-
- }
+ public NsharpGraphProperty getGraphConfigProperty() {
+ return graphConfigProperty;
+ }
- public NsharpResourceHandler getRscHandler() {
- return rscHandler;
- }
+ public void setGraphConfigProperty(NsharpGraphProperty graphConfigProperty) {
+ this.graphConfigProperty = graphConfigProperty;
+ paneConfigurationName = this.graphConfigProperty
+ .getPaneConfigurationName();
- public int getCurrentSoundingLayerIndex() {
- return currentSoundingLayerIndex;
- }
+ }
- public void setRscHandler(NsharpResourceHandler rscHandler) {
- this.rscHandler = rscHandler;
- if(descriptor != null)
- descriptor.setRscHandler(rscHandler);
- }
+ public NsharpResourceHandler getRscHandler() {
+ return rscHandler;
+ }
+
+ public int getCurrentSoundingLayerIndex() {
+ return currentSoundingLayerIndex;
+ }
+
+ public void setRscHandler(NsharpResourceHandler rscHandler) {
+ this.rscHandler = rscHandler;
+ if (descriptor != null)
+ descriptor.setRscHandler(rscHandler);
+ }
+
+ public void setNsharpNative(NsharpNative nsharpNative) {
+ this.nsharpNative = nsharpNative;
+ }
+
+ public void handleResize() {
+ this.resize = false;
+ // double vertRatio = paintProps.getView().getExtent().getHeight() /
+ // paintProps.getCanvasBounds().height;
+ // double hRatio = paintProps.getView().getExtent().getWidth() /
+ // paintProps.getCanvasBounds().width;
+ // System.out.println(descriptor.getPaneNumber()+"viewWidth="+paintProps.getView().getExtent().getWidth()+" viewHeight="+paintProps.getView().getExtent().getHeight()
+ // );
+ // System.out.println(descriptor.getPaneNumber()+"canvWidth="+paintProps.getCanvasBounds().width+" canvHeight="+paintProps.getCanvasBounds().height
+ // );
+ // System.out.println(descriptor.getPaneNumber()+": vertRatio="+vertRatio
+ // + " hRatio="+hRatio);
+ if (paintProps != null
+ && (currentCanvasBoundWidth != paintProps.getCanvasBounds().width || currentCanvasBoundHeight != paintProps
+ .getCanvasBounds().height)) {
+ currentCanvasBoundWidth = paintProps.getCanvasBounds().width;
+ currentCanvasBoundHeight = paintProps.getCanvasBounds().height;
+ adjustFontSize(currentCanvasBoundWidth, currentCanvasBoundHeight);
+ }
+
+ }
+
+ public void setResize(boolean resize) {
+ this.resize = resize;
+ }
+
+ public void handleZooming() {
+
+ }
+
+ // FixMark:sidePaneLooping
+ public boolean isSidePaneMode() {
+ return sidePaneMode;
+ }
+
+ // FixMark:sidePaneLooping
+ public void setSidePaneMode(boolean sidePaneMode) {
+ this.sidePaneMode = sidePaneMode;
+ }
+
+ protected void defineCharHeight(IFont font) {
+ if (paintProps == null)
+ return;
+ DrawableString str = new DrawableString("CHINCHEN",
+ NsharpConstants.color_black);
+ str.font = font;
+ double vertRatio = paintProps.getView().getExtent().getHeight()
+ / paintProps.getCanvasBounds().height;
+ double horizRatio = paintProps.getView().getExtent().getWidth()
+ / paintProps.getCanvasBounds().width;
+ charHeight = target.getStringsBounds(str).getHeight() * vertRatio; // d2dlite
+ lineHeight = charHeight * 1.2; // d2dlite
+ charWidth = target.getStringsBounds(str).getWidth() * horizRatio / 8;
+
+ }
+
+ // d2dlite start
+ protected String timeDescriptionToDisplayStr(String timeDescription) {
+ /*
+ * As of 2014 April 9, current time description string is defined as
+ * "YYMMDD/HH(DOW)" or "YYMMDD/HH(DOW)Vxxx". Convert them to
+ * "DD.HH(DOW)" or "DD.HHVxxx(DOW)" for GUI display.
+ */
+ String rtnStr = timeDescription.substring(4); // get rid of YYMM
+ if (rtnStr.contains("V")) {
+ String[] s1Str = rtnStr.split("V"); // split DD/HH(DOW)Vxxx to
+ // "DD/HH(DOW)" and "xxx"
+ String[] s2Str = s1Str[0].split("\\("); // split "DD/HH(DOW)" to
+ // "DD/HH" and "DOW)"
+ rtnStr = s2Str[0] + "V" + s1Str[1] + "(" + s2Str[1]; // put together
+ // to
+ // "DD/HHVxxx(DOW)"
+ }
+ rtnStr = rtnStr.replace("/", "."); // replace "/" with "."
+ return rtnStr;
+ }
+
+ protected String pickedStnInfoStrToDisplayStr(String pickedStnInfoStr) {
+ /*
+ * As of 2014 April 9, current pickedStnInfoStr string is defined as
+ * "stnId YYMMDD/HH(DOW)Vxxx sndType". This function is to convert it to
+ * "stnId DD.HHVxxx(DOW) sndType" for GUI display. for example,
+ * "ATLH 101209/03(Thu)V003 GFS230" converts to
+ * "ATLH 09.03V003(Thu) GFS230"
+ */
+ String[] s1Str = pickedStnInfoStr.split(" ");
+ if (s1Str.length == 3) {
+ String rtnStr = timeDescriptionToDisplayStr(s1Str[1]);
+ rtnStr = s1Str[0] + " " + rtnStr + " " + s1Str[2];
+ return rtnStr;
+ } else
+ return pickedStnInfoStr; // not a good input, just return it
+ }
+ // d2dlite end
- public void setNsharpNative(NsharpNative nsharpNative) {
- this.nsharpNative = nsharpNative;
- }
- public void handleResize(){
- this.resize=false;
- //double vertRatio = paintProps.getView().getExtent().getHeight() / paintProps.getCanvasBounds().height;
- //double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
- //System.out.println(descriptor.getPaneNumber()+"viewWidth="+paintProps.getView().getExtent().getWidth()+" viewHeight="+paintProps.getView().getExtent().getHeight() );
- //System.out.println(descriptor.getPaneNumber()+"canvWidth="+paintProps.getCanvasBounds().width+" canvHeight="+paintProps.getCanvasBounds().height );
- //System.out.println(descriptor.getPaneNumber()+": vertRatio="+vertRatio + " hRatio="+hRatio);
- if(paintProps!=null && (currentCanvasBoundWidth!= paintProps.getCanvasBounds().width || currentCanvasBoundHeight!=paintProps.getCanvasBounds().height)){
- currentCanvasBoundWidth= paintProps.getCanvasBounds().width;
- currentCanvasBoundHeight=paintProps.getCanvasBounds().height;
- adjustFontSize(currentCanvasBoundWidth,currentCanvasBoundHeight);
- }
-
- }
- public void setResize(boolean resize) {
- this.resize = resize;
- }
- public void handleZooming(){
-
- }
- protected void defineCharHeight(IFont font){
- if(paintProps == null)
- return;
- DrawableString str =new DrawableString("CHINCHEN",NsharpConstants.color_black);
- str.font = font;
- double vertRatio = paintProps.getView().getExtent().getHeight() / paintProps.getCanvasBounds().height;
- double horizRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
- charHeight = (int) (target.getStringsBounds(str).getHeight() * vertRatio);
- charWidth = target.getStringsBounds(str).getWidth() * horizRatio /8;
- //System.out.println(descriptor.getPaneNumber()+": font10 char height ="+charHeight+ " vertRatio="+vertRatio);
- }
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java
index cc97b6713f..ffbd9e4af9 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java
@@ -1,4 +1,5 @@
package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
+
/**
*
*
@@ -10,6 +11,7 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 04/23/2012 229 Chin Chen Initial coding
+ * 04/23/2014 Chin Chen Add d2d lite page
*
*
*
@@ -48,3338 +50,4351 @@ import com.raytheon.viz.core.graphing.WindBarbFactory;
import com.sun.jna.ptr.FloatByReference;
import com.vividsolutions.jts.geom.Coordinate;
-public class NsharpDataPaneResource extends NsharpAbstractPaneResource{
- private int currentTextChapter= 1;
- private int[] pageDisplayOrderNumberArray; //index is the real page defined in NsharpConstants to be shown, value is the order number of this page. index 0 point to a dummy.
- private static final String NO_DATA = "NO VALID DATA AVAILABLE";
- //private double charHeight = NsharpConstants.CHAR_HEIGHT_;
- private double curY;
- private double parcelLineYStart, parcelLineYEnd;
- private double firstToken, secondToken, thirdToken, forthToken, fifthToken, sixthToken;
- private FloatByReference fValue= new FloatByReference(0);
- private FloatByReference fValue1= new FloatByReference(0);
- private FloatByReference fValue2= new FloatByReference(0);
- private FloatByReference fValue3= new FloatByReference(0);
- private FloatByReference fValue4= new FloatByReference(0);
- private FloatByReference fValue5= new FloatByReference(0);
- private FloatByReference fValue6= new FloatByReference(0);
- private FloatByReference fValue7= new FloatByReference(0);
- private FloatByReference fValue8= new FloatByReference(0);
- private PixelExtent extent;
- // physical number of panel in editor display
- // total software defined panels to be displayed
- private Rectangle[] panelRectArray= new Rectangle[NsharpConstants.dsiplayPanelSize] ;
- private int numberPagePerDisplay = 1;
- private NsharpGenericPaneBackground dataPanel1Background;
- private NsharpGenericPaneBackground dataPanel2Background;
- private int dataPaneWidth= NsharpConstants.DATA_PANE_REC_WIDTH;
- private int dataPaneHeight= NsharpConstants.DATA_PANE_REC_HEIGHT;
- //private int dataWidth = NsharpConstants.DATAPANEL1_WIDTH;
- //private int dataHeight = NsharpConstants.DATAPANEL1_HEIGHT;
- private int dp1XOrig = NsharpConstants.DATAPANEL1_X_ORIG;
- private int dp1YOrig = NsharpConstants.DATAPANEL1_Y_ORIG;
- private int dp2XOrig = NsharpConstants.DATAPANEL2_X_ORIG;
- private int dp2YOrig = NsharpConstants.DATAPANEL2_Y_ORIG;
- private float xRatio=1;
- private float yRatio=1;
- private IFont myfont=font10;
- private boolean initDone=false;
- private short currentParcel= NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;;
- //private int parcelLinesInPhysicalPanelNumber;
- private boolean sumP1Visible = false;
- public NsharpDataPaneResource(AbstractResourceData resourceData,
- LoadProperties loadProperties, NsharpAbstractPaneDescriptor desc) {
- super(resourceData, loadProperties, desc);
- dataPanel1Background = new NsharpGenericPaneBackground(new Rectangle(NsharpConstants.DATAPANEL1_X_ORIG,NsharpConstants.DATAPANEL1_Y_ORIG,
- NsharpConstants.DATAPANEL1_WIDTH,NsharpConstants.DATAPANEL1_HEIGHT));
- dataPanel2Background = new NsharpGenericPaneBackground(new Rectangle(NsharpConstants.DATAPANEL2_X_ORIG,NsharpConstants.DATAPANEL2_Y_ORIG,
- NsharpConstants.DATAPANEL2_WIDTH,NsharpConstants.DATAPANEL2_HEIGHT));
- }
+public class NsharpDataPaneResource extends NsharpAbstractPaneResource {
+ private int currentTextChapter = 1;
+ private int[] pageDisplayOrderNumberArray; // index is the real page defined
+ // in NsharpConstants to be
+ // shown, value is the order
+ // number of this page. index 0
+ // point to a dummy.
- @Override
- protected void paintInternal(IGraphicsTarget target,
- PaintProperties paintProps) throws VizException {
- super.paintInternal(target, paintProps);
- dataPanel1Background.paint(target, paintProps);
- if(!paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- dataPanel2Background.paint(target, paintProps);
- }
- if(rscHandler== null)
- return;
-
- if((soundingLys != null) && (soundingLys.size()>= 4))
- {
- this.myfont.setSmoothing(false);
- this.myfont.setScaleFont(false);
- // write to panels
- //Chin: Note:
- // Current display algorithm is: One chapter = 2 pages. show 2 pages at one time.
- // i.e. show current page and its next page with 2 physical panels.
- // currently, we have total of 10 "pages" to display on 2 "physical
- // display panels per design.
- sumP1Visible = false;
- currentTextChapter = rscHandler.getCurrentTextChapter();
- if(numberPagePerDisplay==1)
- drawPanel(target,currentTextChapter,1);
- else if (numberPagePerDisplay==2){
- for (int i = currentTextChapter*numberPagePerDisplay -1, physicalPanelNum = 1; i <= currentTextChapter*numberPagePerDisplay; i++, physicalPanelNum++){
- int pageNum = i%10;
- if (pageNum==0)
- pageNum=10;
+ private static final String NO_DATA = "NO VALID DATA AVAILABLE";
- drawPanel(target,pageNum,physicalPanelNum);
- //System.out.println("current chapter="+currentTextChapter+" page num="+pageNum+ " disPanel="+physicalPanelNum);
- }
- }
- }
- }
- @Override
- protected void initInternal(IGraphicsTarget target) throws VizException {
- super.initInternal(target);
- //currentCanvasBoundWidth = NsharpConstants.DATA_PANE_REC_WIDTH;
- //currentCanvasBoundHeight = NsharpConstants.DATA_PANE_REC_HEIGHT;
- if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)||
- paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR )||
- paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- myDefaultCanvasWidth = (int) (NsharpConstants.DISPLAY_WIDTH * (1-NsharpConstants.PANE_DEF_CFG_2_LEFT_GP_WIDTH_RATIO)* NsharpConstants.PANE_DEF_CFG_2_DATA_WIDTH_RATIO);
- myDefaultCanvasHeight = (int) (NsharpConstants.DISPLAY_HEIGHT*NsharpConstants.PANE_DEF_CFG_2_DATA_HEIGHT_RATIO);
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)){
- myDefaultCanvasWidth = (int) (NsharpConstants.DISPLAY_WIDTH * (1-NsharpConstants.PANE_DEF_CFG_1_LEFT_GP_WIDTH_RATIO)* NsharpConstants.PANE_DEF_CFG_1_DATA_WIDTH_RATIO);
- myDefaultCanvasHeight = (int) (NsharpConstants.DISPLAY_HEIGHT*NsharpConstants.PANE_DEF_CFG_1_DATA_HEIGHT_RATIO);
- }
- //System.out.println("data pane default canv W="+myDefaultCanvasWidth+" h="+myDefaultCanvasHeight);
- panelRectArray[0] = dataPanel1Background.getRectangle();
- panelRectArray[1] = dataPanel2Background.getRectangle();
- dataPanel1Background.initInternal(target);
- dataPanel2Background.initInternal(target);
- if(numberPagePerDisplay == 1)
- myfont = font12;
- else
- myfont = font10;
- handleResize();
- initDone = true;
- }
-
- public void setCurrentParcel(short currentParcel) {
- this.currentParcel = currentParcel;
- }
+ // private double charHeight = NsharpConstants.CHAR_HEIGHT_;
+ private double curY;
- public short getCurrentParcel() {
- return currentParcel;
- }
- public void resetCurrentParcel() {
- currentParcel= NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- }
+ private double parcelLineYStart, parcelLineYEnd;
- @Override
- public void resetData(List soundingLys,
- List prevsoundingLys) {
-
- super.resetData(soundingLys, prevsoundingLys);
- currentParcel= NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- }
+ private double firstToken, secondToken, thirdToken, forthToken, fifthToken,
+ sixthToken;
+ private FloatByReference fValue = new FloatByReference(0);
- private void drawPanel(IGraphicsTarget target, int pageOrderNumber, int dsiplayPanelNumber
- ) throws VizException {
- if(pageOrderNumber > NsharpConstants.PAGE_MAX_NUMBER || dsiplayPanelNumber > numberPagePerDisplay)// NsharpConstants.dsiplayPanelSize)
- return;
- int physicalPanelNumber = dsiplayPanelNumber -1;
- int displayPageNumber=0;
- // find a page with its order number equal to pageOrderNumber
- for(int i=1; i <= NsharpConstants.PAGE_MAX_NUMBER; i++){
- if(pageDisplayOrderNumberArray[i]==pageOrderNumber)
- displayPageNumber =i; // array index is the page number and value is the order number
- }
- switch(displayPageNumber){
- case NsharpConstants.PAGE_SUMMARY1:
- drawPanel1(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_SUMMARY2:
- drawPanel2(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_PARCEL_DATA:
- drawPanel3(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_THERMODYNAMIC_DATA:
- drawPanel4(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_OPC_DATA:
- drawPanel5(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_MIXING_HEIGHT:
- drawPanel6(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_STORM_RELATIVE:
- drawPanel7(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_MEAN_WIND:
- drawPanel8(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_CONVECTIVE_INITIATION:
- drawPanel9(target, panelRectArray[physicalPanelNumber]);
- break;
- case NsharpConstants.PAGE_SEVERE_POTENTIAL:
- drawPanel10(target, panelRectArray[physicalPanelNumber]);
- break;
- default:
- break;
- }
- }
- public void setUserPickedParcelLine(Coordinate c) {
- //make sure is in virtualPanel 1 as Parcel Line is defined in it.
- if(rscHandler != null){
- if(!sumP1Visible)
- return;
- }
- else
- return;
- //System.out.println("setUserPickedParcelLine c.y="+ c.y+ " parcelLineYStart="+ parcelLineYStart+" parcelLineYEnd="+parcelLineYEnd);
- //make sure within parcel line area
- if(c.y >= parcelLineYStart && c.y <=parcelLineYEnd){
- int index =((int)(c.y - parcelLineYStart))/ (int)charHeight;
- if( index < NsharpNativeConstants.PARCEL_MAX){
- currentParcel = (short) (index + 1);
- //System.out.println("setUserPickedParcelLine at "+ currentParcel);
- //notify skewtRsc
- rscHandler.updateParcelFromPanel(currentParcel);
- }
- }
- }
- @SuppressWarnings("deprecation")
- private void drawPanel1(IGraphicsTarget target, Rectangle rect
- ) throws VizException {
- sumP1Visible =true;
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
-
- /*
- * Chin's NOTE::::
- * This pages based on newer version nsharp from SPC. We dont have source code as of 7/8/2010.
- * Therefore, coding is purly based on a captured screen shot given by SPC's John Hart.
- * This function is coded based on native nsharp codes which can be found
- * in other pages's show functions.
- *
- *
- */
- //if we can not Interpolates a temp with 700 mb pressure, then we dont have enough raw data
- if ((nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0))
- {
- target.drawString(myfont, " " +NO_DATA, rect.x, rect.y, 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- return;
- }
-
- //call get_topBotPres to set p_top and p_bot
- FloatByReference topPF= new FloatByReference(0);
- FloatByReference botPF= new FloatByReference(0);
- nsharpNative.nsharpLib.get_effectLayertopBotPres(topPF, botPF);
-
- String textStr, CAPE3Str="", NCAPEStr="";
- curY=rect.y;
-
- //
- // Start with Parcel Data
- //
- Rectangle2D strBD = target.getStringBounds(myfont, NsharpNativeConstants.PAGE1TEXT1_FCST_STR+"XX");
- double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
- double startX = rect.x + 0.5*charWidth;
- double widthGap = (rect.width-strBD.getWidth()*hRatio*xRatio)/6;//was -100*xRatio)/6;
- firstToken=rect.x+strBD.getWidth()*hRatio*xRatio;//was +100.0*xRatio;
- secondToken=firstToken+widthGap;
- thirdToken=secondToken+widthGap;
- forthToken=thirdToken+widthGap;
- fifthToken = forthToken+widthGap;
- sixthToken = fifthToken+widthGap;
- target.drawString(myfont, "Sum1", startX, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "CAPE", firstToken, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "CINH", secondToken, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "LCL", thirdToken, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "LI", forthToken, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "LFC", fifthToken, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "EL", sixthToken, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY+charHeight;
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
- parcelLineYStart = curY;
- float layerPressure = 0;
-
- //get user selected parcel type
- _lplvalues lpvls;
- _parcel pcl;
- //curY = curY+ (double)charHeight * 0.5;
- for (short parcelNumber=1; parcelNumber <= NsharpNativeConstants.PARCEL_MAX ; parcelNumber++){
- if(parcelNumber == currentParcel ){
- PixelExtent pixExt = new PixelExtent(rect.x, rect.x+ rect.width,curY, curY+charHeight);
- //target.setupClippingPlane(pixExt);
- target.drawRect(pixExt, NsharpConstants.color_gold, 1.0f, 1.0f);
- }
- //call native define_parcel() with parcel type and user defined pressure (if user defined it)
- textStr = NsharpNativeConstants.parcelToTypeStrMap.get(parcelNumber);
- target.drawString(myfont, textStr, startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- float layerPressure1 = NsharpNativeConstants.parcelToLayerMap.get(parcelNumber);
- if(parcelNumber == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
- //get user selected parcel type, if available
- layerPressure1 = NsharpParcelDialog.getUserDefdParcelMb();
- }
- //System.out.println("drawPanel1-1 called define_parcel pType="+parcelNumber+" pre="+ layerPressure1);
+ private FloatByReference fValue1 = new FloatByReference(0);
- nsharpNative.nsharpLib.define_parcel(parcelNumber,layerPressure1);
+ private FloatByReference fValue2 = new FloatByReference(0);
- lpvls = new _lplvalues();
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ private FloatByReference fValue3 = new FloatByReference(0);
- float sfctemp, sfcdwpt, sfcpres;
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- // get parcel data by calling native nsharp parcel() API. value is returned in pcl
- pcl = new _parcel();
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- //draw parcel name
- //draw CAPE
- if(pcl.bplus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- target.drawString(myfont, String.format( "%.0f", pcl.bplus), firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- else
- target.drawString(myfont, "M", firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- //draw CINH
- if(pcl.bminus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- target.drawString(myfont, String.format("%.0f", pcl.bminus), secondToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- else
- target.drawString(myfont, "M", secondToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- //draw LCL
- float lcl = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lclpres ));
- if(lcl != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- target.drawString(myfont, String.format("%.0fm", lcl), thirdToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
+ private FloatByReference fValue4 = new FloatByReference(0);
- else
- target.drawString(myfont, "M", thirdToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- //draw LI
- if(pcl.li5 != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- target.drawString(myfont, String.format("%5.0f", pcl.li5), forthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- else
- target.drawString(myfont, "M", forthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- //draw LFC
- float lfc = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres ));
- if(lfc != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- target.drawString(myfont, String.format("%.0fm", lfc), fifthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- else
- target.drawString(myfont, "M", fifthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- // draw EL
- float el = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.elpres ));
- if(el != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- target.drawString(myfont, String.format("%.0f'", NsharpConstants.metersToFeet.convert(el)), sixthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- else
- target.drawString(myfont, "M", sixthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
+ private FloatByReference fValue5 = new FloatByReference(0);
- curY = curY+charHeight;
- //get 3CAPE value for later to use
- if(parcelNumber == NsharpNativeConstants.PARCELTYPE_MEAN_MIXING){
- if(nsharpNative.nsharpLib.qc(pcl.cape3km)==1) {
- CAPE3Str = String.format("%.0fJ/kg", pcl.cape3km);
- }
- else {
- CAPE3Str = " M";
- }
- }//get NCAPE value for later to use
- else if(parcelNumber == NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE){
- float j1 = pcl.bplus;
- float j2 = nsharpNative.nsharpLib.ihght(pcl.elpres) - nsharpNative.nsharpLib.ihght(pcl.lfcpres);
- if(nsharpNative.nsharpLib.qc(j1/j2)==1) {
- NCAPEStr = String.format("%.2f",j1/j2);
- }
- else {
- NCAPEStr = "NCAPE= M";
- }
- }
- }
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
- parcelLineYEnd= curY;
- if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
- layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
- }
- else
- layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
- //System.out.println("drawPanel1-2 called define_parcel pType="+currentParcel+" pre="+ layerPressure);
+ private FloatByReference fValue6 = new FloatByReference(0);
- //reset and define current parcel
- nsharpNative.nsharpLib.define_parcel(currentParcel,layerPressure);
- lpvls = new _lplvalues();
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ private FloatByReference fValue7 = new FloatByReference(0);
- float sfctemp, sfcdwpt, sfcpres;
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- // get parcel data by calling native nsharp parcel() API. value is returned in pcl
- pcl = new _parcel();
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- //
- // THERMO DYNAMIC DATA
- //
- firstToken = rect.x + rect.width/48*12*xRatio;
- secondToken = rect.x + rect.width/48*27*xRatio;
- thirdToken = rect.x + rect.width/48*38*xRatio;
- //curY = curY+ (double)charHeight * 0.5;
- DrawableString str = new DrawableString("ABCDE=", NsharpConstants.color_white);
- str.font = myfont;
- double equalSignPos=(startX+target.getStringsBounds(str).getWidth())*hRatio*xRatio;
- fValue.setValue(0);
- nsharpNative.nsharpLib.precip_water(fValue, -1.0F, -1.0F);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = String.format("%.2f in", fValue.getValue());
- }
- else {
- textStr = " M";
- }
- str.setCoordinates(startX, curY);
- str.horizontalAlignment = HorizontalAlignment.LEFT;
- str.verticallAlignment = VerticalAlignment.TOP;
- str.font = myfont;
- str.setText("PW=", NsharpConstants.color_white);
- DrawableString str1 =new DrawableString(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- str1.horizontalAlignment = HorizontalAlignment.LEFT;
- str1.verticallAlignment = VerticalAlignment.TOP;
- str1.font = myfont;
- target.drawStrings(str, str1);
-
- //3CAPE...value was retrieved earlier
- str.setText("3CAPE=", NsharpConstants.color_white);
- str.setCoordinates(firstToken, curY);
- str1.setText(CAPE3Str,NsharpConstants.color_white);
- str1.setCoordinates(firstToken+equalSignPos, curY);
- target.drawStrings(str, str1);
-
- fValue.setValue(0);
- float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.wb_lvl( 0, fValue ))));
- if(nsharpNative.nsharpLib.qc(wbzft)==1) {
- textStr = String.format("%.0f'",wbzft);
- }
- else {
- textStr = " M";
- }
- str.setText("WBZ=", NsharpConstants.color_white);
- str.setCoordinates(secondToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(secondToken+equalSignPos, curY);
- target.drawStrings(str, str1);
-
-
- //WNDG
- float wndg = nsharpNative.nsharpLib.damaging_wind();
- if(nsharpNative.nsharpLib.qc(wndg)==1) {
- textStr = String.format("%.2f",wndg);
- }
- else {
- textStr = " M";
- }
- str.setText("WNDG=", NsharpConstants.color_white);
- str.setCoordinates(thirdToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(thirdToken+equalSignPos, curY);
- target.drawStrings(str, str1);
-
- curY = curY+charHeight; //move to new line
+ private FloatByReference fValue8 = new FloatByReference(0);
- fValue.setValue(0);
- nsharpNative.nsharpLib.k_index(fValue);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = String.format("%.0f",fValue.getValue());
- }
- else {
- textStr = " M";
- }
- str.setText("K=", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- //DCAPE
- //fValue1 will be used for DownT to use
- float dcape= nsharpNative.nsharpLib.dcape(fValue, fValue1);
- float downT = fValue1.getValue();
- if(nsharpNative.nsharpLib.qc(dcape)==1) {
- textStr = String.format("%.0fJ/kg",dcape);
- }
- else {
- textStr = " M";
- }
- str.setText("DCAPE=", NsharpConstants.color_white);
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(firstToken+equalSignPos, curY);
- target.drawStrings(str, str1);
+ private PixelExtent extent;
- //FZL
- fValue.setValue(0);
- float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.temp_lvl( 0, fValue ))));
- if(nsharpNative.nsharpLib.qc(fgzft)==1) {
- textStr = String.format("%.0f'",fgzft);
- }
- else {
- textStr = " M";
- }
- str.setText("FZL=", NsharpConstants.color_white);
- str.setCoordinates(secondToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(secondToken+equalSignPos, curY);
- target.drawStrings(str, str1);
- //ESP
- float esp= nsharpNative.nsharpLib.esp();
- if(nsharpNative.nsharpLib.qc(esp)==1) {
- textStr = String.format("%.2f",esp);
- }
- else {
- textStr = " M";
- }
- str.setText("ESP=", NsharpConstants.color_white);
- str.setCoordinates(thirdToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(thirdToken+equalSignPos, curY);
- target.drawStrings(str, str1);
-
- curY = curY+charHeight; //move to new line
-
- fValue.setValue(0);
- //MidRH
- nsharpNative.nsharpLib.get_surface(fValue1, fValue2, fValue3); //fValue 2 and fValue3 are not of concern here
- nsharpNative.nsharpLib.mean_relhum( fValue, fValue1.getValue() - 150, fValue1.getValue() - 350 );
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = String.format("%.0f%c",fValue.getValue(),NsharpConstants.PERCENT_SYMBOL);
- }
- else {
- textStr = " M";
- }
- str.setText("MidRH=", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- //DownT
- downT = nsharpNative.nsharpLib.ctof(downT) ; //convert to F
- if(nsharpNative.nsharpLib.qc( downT)==1) {
- textStr = String.format("%.0fF",downT);
- }
- else {
- textStr = " M";
- }
- str.setText("DownT=", NsharpConstants.color_white);
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(firstToken+equalSignPos, curY);
- target.drawStrings(str, str1);
- //ConvT
- fValue.setValue(0);
- float conTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib.cnvtv_temp( fValue, -1));
-
- if(nsharpNative.nsharpLib.qc( conTempF )==1) {
- textStr = String.format("%.0fF",conTempF);
- }
- else {
- textStr = " M";
- }
- str.setText("ConvT=", NsharpConstants.color_white);
- str.setCoordinates(secondToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(secondToken+equalSignPos, curY);
- target.drawStrings(str, str1);
+ // physical number of panel in editor display
+ // total software defined panels to be displayed
+ private Rectangle[] panelRectArray = new Rectangle[NsharpConstants.dsiplayPanelSize];
- //MMP: Coniglio MCS Maintenance Parameter
- float mmp = nsharpNative.nsharpLib.coniglio1();
- if(nsharpNative.nsharpLib.qc( mmp )==1) {
- textStr = String.format("%.2f",mmp);
- }
- else {
- textStr = " M";
- }
- str.setText("MMP=", NsharpConstants.color_white);
- str.setCoordinates(thirdToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(thirdToken+equalSignPos, curY);
- target.drawStrings(str, str1);
-
- curY = curY+charHeight; //move to new line
+ private int numberPagePerDisplay = 1;
- fValue.setValue(0);
- fValue1.setValue(0);
- // get surface pressure (fValue1) before getting mean LRH value
- nsharpNative.nsharpLib.get_surface(fValue1, fValue2, fValue3); //fValue 2 and fValue3 are not of concern here
- nsharpNative.nsharpLib.mean_relhum( fValue, -1.0F, fValue1.getValue() - 150 );
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- //textStr = NsharpNativeConstants.THERMO_MEANLRH_LINE;
- textStr = String.format("%.0f%c",fValue.getValue(),NsharpConstants.PERCENT_SYMBOL);
- }
- else {
- textStr = " M";
- }
- str.setText("LowRH=", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.mean_mixratio(fValue, -1.0F, -1.0F);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = String.format("%.1fg/kg",fValue.getValue());
- }
- else {
- textStr = " M";
- }
- str.setText("MeanW=", NsharpConstants.color_white);
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(firstToken+equalSignPos, curY);
- target.drawStrings(str, str1);
+ private NsharpGenericPaneBackground dataPanel1Background;
- fValue.setValue(0);
- float maxT= nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib.max_temp( fValue, -1));
- if(nsharpNative.nsharpLib.qc(maxT)==1) {
- textStr = String.format("%.0fF",maxT);
- }
- else {
- textStr = " M";
- }
- str.setText("MaxT=", NsharpConstants.color_white);
- str.setCoordinates(secondToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(secondToken+equalSignPos, curY);
- target.drawStrings(str, str1);
+ private NsharpGenericPaneBackground dataPanel2Background;
- //NCAPE
- str.setText("NCAPE=", NsharpConstants.color_white);
- str.setCoordinates(thirdToken, curY);
- str1.setText(NCAPEStr,NsharpConstants.color_white);
- str1.setCoordinates(thirdToken+equalSignPos, curY);
- target.drawStrings(str, str1);
+ private int dataPaneWidth = NsharpConstants.DATA_PANE_REC_WIDTH;
- curY = curY+charHeight; //move to new line
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
-
- //draw a vertical line from 2/3 of x axis
- str.setText("sfc-3km AglLapseRate=xxC/x.xC/kmX",NsharpConstants.color_black);
- str.font = myfont;
- double lineXPos = target.getStringsBounds(str).getWidth()*hRatio*xRatio;
- if(lineXPos < rect.width *2/3)
- lineXPos = rect.width *2/3;
- firstToken=rect.x+lineXPos;
- target.drawLine(firstToken, curY, 0.0, firstToken, rect.y+rect.height, 0.0, NsharpConstants.color_white, 1);
- //curY = curY+ (double)charHeight * 0.5;
- firstToken = firstToken + 0.5*charWidth;
-
- // more thermodynamic data
- // the following follow show_parcel_new() at xwvid.c of bigNsharp implementation
- // sfc-3km Lapse rate
- //
- float htsfc =0;
- float tDelta = nsharpNative.nsharpLib.aglT(0, 3000);
- fValue.setValue(0);
- // get surface pressure (fValue)
- nsharpNative.nsharpLib.get_surface(fValue, fValue1, fValue2);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- htsfc = nsharpNative.nsharpLib.ihght(fValue.getValue());
- // get sfc to (sfc+ 3 km) pressure (fValue)
- float threekmPre = nsharpNative.nsharpLib.ipres(htsfc+3000);
- fValue1.setValue(0);
- nsharpNative.nsharpLib.lapse_rate( fValue1, fValue.getValue(), threekmPre );
- if(nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- //textStr = String.format("sfc-3km AglLapseRate=%.0fC/%.1fC/km", tDelta, fValue1.getValue());
- textStr = String.format("%.0fC/%.1fC/km", tDelta, fValue1.getValue());
- }
- else {
- textStr = " M";// "sfc-3km AglLapseRate= M";
- }
- }
- else {
- textStr = " M";//"sfc-3km AglLapseRate= M";
- }
- str.setText("sfc-3km Agl LapseRate= ", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- equalSignPos=rect.x+target.getStringsBounds(str).getWidth()*hRatio*xRatio;
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
-
- /*target.drawString(myfont, textStr, startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
-
-
- //"Supercell"
- float smdir = rscHandler.getSmWindDir();//bkRsc.getSmDir(); #10438
- float smspd = rscHandler.getSmWindSpd();//bkRsc.getSmSpd();
- float superCell = nsharpNative.nsharpLib.scp(smdir, smspd);
- if(nsharpNative.nsharpLib.qc(superCell)==1) {
- textStr = String.format("%.1f",superCell);
- }
- else {
- textStr = " M";
- }
- str.setText("Supercell= ", NsharpConstants.color_yellow);
- double equalSignPos1=firstToken+target.getStringsBounds(str).getWidth()*hRatio*xRatio;
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_yellow);
- str1.setCoordinates(equalSignPos1, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
-
- curY = curY+charHeight; //move to new line
-
- // 3km-6km Lapse rate
- fValue.setValue(0);
- fValue1.setValue(0);
- tDelta = nsharpNative.nsharpLib.aglT(3000, 6000);
- // get 3 and 6km pressure (fValue)
- float threekmPre = nsharpNative.nsharpLib.ipres(htsfc+3000);
- float sixkmPre = nsharpNative.nsharpLib.ipres(htsfc+6000);
- fValue1.setValue(0);
- nsharpNative.nsharpLib.lapse_rate( fValue1, threekmPre,sixkmPre );
- if(nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- textStr = String.format("%.0fC/%.1fC/km", tDelta, fValue1.getValue());
+ private int dataPaneHeight = NsharpConstants.DATA_PANE_REC_HEIGHT;
- }
- else {
- textStr = " M";
- }
- str.setText("3-6km Agl LapseRate=", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
- // "STP (CIN)"
- float cin = nsharpNative.nsharpLib.sigtorn_cin(smdir, smspd);
- if(nsharpNative.nsharpLib.qc(cin)==1) {
- textStr = String.format("%.1f",cin);
- }
- else {
- textStr = " M";
- }
- str.setText("STP(CIN)=", NsharpConstants.color_white);
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos1, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
+ // private int dataWidth = NsharpConstants.DATAPANEL1_WIDTH;
+ // private int dataHeight = NsharpConstants.DATAPANEL1_HEIGHT;
+ private int dp1XOrig = NsharpConstants.DATAPANEL1_X_ORIG;
- curY = curY+charHeight; //move to new line
+ private int dp1YOrig = NsharpConstants.DATAPANEL1_Y_ORIG;
+ private int dp2XOrig = NsharpConstants.DATAPANEL2_X_ORIG;
- fValue.setValue(0);
- fValue1.setValue(0);
- //nsharpNative.nsharpLib.vert_tot(fValue);
- float delta= nsharpNative.nsharpLib.itemp(850) - nsharpNative.nsharpLib.itemp(500);
- nsharpNative.nsharpLib.lapse_rate( fValue1, 850.0F, 500.0F );
- if(nsharpNative.nsharpLib.qc(delta)==1 && nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- textStr = String.format("%.0fC/%.1fC/km",delta, fValue1.getValue());
- }
- else {
- textStr = " M";
- }
- str.setText("850-500mb LapseRate=", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
- // "STP(fixed)"
- float fixedStp = nsharpNative.nsharpLib.sigtorn_fixed(smdir, smspd);
- if(nsharpNative.nsharpLib.qc(fixedStp)==1) {
- textStr = String.format("%.1f",fixedStp);
- }
- else {
- textStr = " M";
- }
- str.setText("STP(fixed)=", NsharpConstants.color_white);
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos1, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
+ private int dp2YOrig = NsharpConstants.DATAPANEL2_Y_ORIG;
- curY = curY+charHeight; //move to new line
+ private float xRatio = 1;
- fValue.setValue(0);
- fValue1.setValue(0);
- //nsharpNative.nsharpLib.delta_t(fValue);
- nsharpNative.nsharpLib.lapse_rate( fValue1, 700.0F, 500.0F );
- delta= nsharpNative.nsharpLib.itemp(700) - nsharpNative.nsharpLib.itemp(500);
- if(nsharpNative.nsharpLib.qc(/*fValue.getValue())*/delta)==1 && nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- textStr = String.format("%.0fC/%.1fC/km",delta/*fValue.getValue()*/, fValue1.getValue());
- }
- else {
- textStr = " M";
- }
- str.setText("700-500mb LapseRate=", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
- // "SHIP"
- float ship = nsharpNative.nsharpLib.cave_ship();
- if(nsharpNative.nsharpLib.qc(ship)==1) {
- textStr = String.format("%.1f",ship);
- }
- else
- textStr = " M";
- str.setText("SHIP=", NsharpConstants.color_red);
- str.setCoordinates(firstToken, curY);
- str1.setText(textStr,NsharpConstants.color_red);
- str1.setCoordinates(equalSignPos1, curY);
- target.drawStrings(str, str1);
- /*target.drawString(myfont, textStr, firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_red, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);*/
- //System.out.println("shop="+ship);
- //myfont.dispose();
+ private float yRatio = 1;
+
+ private IFont defaultFont = font10;
+
+ private boolean initDone = false;
+
+ private boolean resizedone = false; // d2dlite
+
+ private short currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;;
+
+ // private int parcelLinesInPhysicalPanelNumber;
+ private boolean sumP1Visible = false;
+
+ public NsharpDataPaneResource(AbstractResourceData resourceData,
+ LoadProperties loadProperties, NsharpAbstractPaneDescriptor desc) {
+ super(resourceData, loadProperties, desc);
+ dataPanel1Background = new NsharpGenericPaneBackground(new Rectangle(
+ NsharpConstants.DATAPANEL1_X_ORIG,
+ NsharpConstants.DATAPANEL1_Y_ORIG,
+ NsharpConstants.DATAPANEL1_WIDTH,
+ NsharpConstants.DATAPANEL1_HEIGHT));
+ dataPanel2Background = new NsharpGenericPaneBackground(new Rectangle(
+ NsharpConstants.DATAPANEL2_X_ORIG,
+ NsharpConstants.DATAPANEL2_Y_ORIG,
+ NsharpConstants.DATAPANEL2_WIDTH,
+ NsharpConstants.DATAPANEL2_HEIGHT));
}
- @SuppressWarnings("deprecation")
- private void drawPanel2(IGraphicsTarget target, Rectangle rect) throws VizException
- {
- /*
- * Chin's NOTE::::
- * This pages based on BigNsharp
- * show_shear_new() at xwvid3.c
- *
- */
-
- extent = new PixelExtent(rect);
+
+ @Override
+ protected void paintInternal(IGraphicsTarget target,
+ PaintProperties paintProps) throws VizException {
+ super.paintInternal(target, paintProps);
+ dataPanel1Background.paint(target, paintProps);
+ if (numberPagePerDisplay == 2) {
+ dataPanel2Background.paint(target, paintProps);
+ }
+ if (rscHandler == null)
+ return;
+
+ if (!resizedone) {
+ resizedone = true;
+ handleResize();
+ }
+
+ if ((soundingLys != null) && (soundingLys.size() >= 4)) {
+ this.defaultFont.setSmoothing(false);
+ this.defaultFont.setScaleFont(false);
+ // write to panels
+ // Chin: Note:
+ // Current display algorithm is: One chapter = 2 pages. show 2 pages
+ // at one time.
+ // i.e. show current page and its next page with 2 physical panels.
+ // currently, we have total of 11 "pages" to display on 2 "physical
+ // display panels per design.
+ sumP1Visible = false;
+ currentTextChapter = rscHandler.getCurrentTextChapter();
+ if (numberPagePerDisplay == 1)
+ drawPanel(target, currentTextChapter, 1);
+ else if (numberPagePerDisplay == 2) {
+ for (int i = currentTextChapter * numberPagePerDisplay - 1, physicalPanelNum = 1; i <= currentTextChapter
+ * numberPagePerDisplay; i++, physicalPanelNum++) {
+ int pageNum = i % NsharpConstants.PAGE_MAX_NUMBER; // d2dlite
+ if (pageNum == 0)
+ pageNum = NsharpConstants.PAGE_MAX_NUMBER; // d2dlite
+
+ drawPanel(target, pageNum, physicalPanelNum);
+ // System.out.println("current chapter="+currentTextChapter+" page num="+pageNum+
+ // " disPanel="+physicalPanelNum);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void initInternal(IGraphicsTarget target) throws VizException {
+ super.initInternal(target);
+ if (paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)) {
+ myDefaultCanvasWidth = (int) (NsharpConstants.DISPLAY_WIDTH
+ * (1 - NsharpConstants.PANE_DEF_CFG_2_LEFT_GP_WIDTH_RATIO) * NsharpConstants.PANE_DEF_CFG_2_DATA_WIDTH_RATIO);
+ myDefaultCanvasHeight = (int) (NsharpConstants.DISPLAY_HEIGHT * NsharpConstants.PANE_DEF_CFG_2_DATA_HEIGHT_RATIO);
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)) {
+ myDefaultCanvasWidth = (int) (NsharpConstants.DISPLAY_WIDTH
+ * (1 - NsharpConstants.PANE_DEF_CFG_1_LEFT_GP_WIDTH_RATIO) * NsharpConstants.PANE_DEF_CFG_1_DATA_WIDTH_RATIO);
+ myDefaultCanvasHeight = (int) (NsharpConstants.DISPLAY_HEIGHT * NsharpConstants.PANE_DEF_CFG_1_DATA_HEIGHT_RATIO);
+ }
+ // System.out.println("data pane default canv W="+myDefaultCanvasWidth+" h="+myDefaultCanvasHeight);
+ panelRectArray[0] = dataPanel1Background.getRectangle();
+ panelRectArray[1] = dataPanel2Background.getRectangle();
+ dataPanel1Background.initInternal(target);
+ dataPanel2Background.initInternal(target);
+ if (numberPagePerDisplay == 1)
+ defaultFont = font12;
+ else
+ defaultFont = font10;
+ handleResize();
+ initDone = true;
+ // System.out.println(": font char height =" + charHeight);
+ }
+
+ public void setCurrentParcel(short currentParcel) {
+ this.currentParcel = currentParcel;
+ }
+
+ public short getCurrentParcel() {
+ return currentParcel;
+ }
+
+ public void resetCurrentParcel() {
+ currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
+ }
+
+ @Override
+ public void resetData(List soundingLys,
+ List prevsoundingLys) {
+
+ super.resetData(soundingLys, prevsoundingLys);
+ currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
+ }
+
+ private void drawPanel(IGraphicsTarget target, int pageOrderNumber,
+ int dsiplayPanelNumber) throws VizException {
+ if (pageOrderNumber > NsharpConstants.PAGE_MAX_NUMBER
+ || dsiplayPanelNumber > numberPagePerDisplay)// NsharpConstants.dsiplayPanelSize)
+ return;
+ int physicalPanelNumber = dsiplayPanelNumber - 1;
+ int displayPageNumber = 0;
+ // find a page with its order number equal to pageOrderNumber
+ for (int i = 1; i <= NsharpConstants.PAGE_MAX_NUMBER; i++) {
+ if (pageDisplayOrderNumberArray[i] == pageOrderNumber)
+ displayPageNumber = i; // array index is the page number and
+ // value is the order number
+ }
+ switch (displayPageNumber) {
+ case NsharpConstants.PAGE_SUMMARY1:
+ drawPanel1(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_SUMMARY2:
+ drawPanel2(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_PARCEL_DATA:
+ drawPanel3(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_THERMODYNAMIC_DATA:
+ drawPanel4(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_OPC_DATA:
+ drawPanel5(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_MIXING_HEIGHT:
+ drawPanel6(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_STORM_RELATIVE:
+ drawPanel7(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_MEAN_WIND:
+ drawPanel8(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_CONVECTIVE_INITIATION:
+ drawPanel9(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_SEVERE_POTENTIAL:
+ drawPanel10(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_D2DLITE: // d2dlite
+ drawPanel11(target, panelRectArray[physicalPanelNumber]);
+ break;
+ case NsharpConstants.PAGE_FUTURE: // d2dlite
+ drawPanel12(target, panelRectArray[physicalPanelNumber]);
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void setUserPickedParcelLine(Coordinate c) {
+ // make sure is in virtualPanel 1 as Parcel Line is defined in it.
+ if (rscHandler != null) {
+ if (!sumP1Visible)
+ return;
+ } else
+ return;
+ // System.out.println("setUserPickedParcelLine c.y="+ c.y+
+ // " parcelLineYStart="+
+ // parcelLineYStart+" parcelLineYEnd="+parcelLineYEnd);
+ // make sure within parcel line area
+ if (c.y >= parcelLineYStart && c.y <= parcelLineYEnd) {
+ int index = ((int) (c.y - parcelLineYStart)) / (int) charHeight;
+ if (index < NsharpNativeConstants.PARCEL_MAX) {
+ currentParcel = (short) (index + 1);
+ // System.out.println("setUserPickedParcelLine at "+
+ // currentParcel);
+ // notify skewtRsc
+ rscHandler.updateParcelFromPanel(currentParcel);
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel1(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ if (paneConfigurationName.equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ myfont = font9;
+ } else {
+ myfont = defaultFont;
+ }
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ sumP1Visible = true;
+ extent = new PixelExtent(rect);
target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, 10, null);
- curY= rect.y;
- String textStr;
-
- //if we can not Interpolates a temp with 700 mb pressure, then we dont have enough raw data
- if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0)
- {
- target.drawString(myfont, " " +NO_DATA, rect.x, rect.y, 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- return;
- }
- //
- // Start with Header SRH(m%c/s%c) Shear(kt) MnWind SRW
- //
- double startX = rect.x + 0.5*charWidth;
- double widthGap = (rect.width)/5;
- firstToken=rect.x+widthGap;
- secondToken=firstToken+widthGap;
- thirdToken=secondToken+widthGap;
- forthToken=thirdToken+widthGap;
- target.drawString(myfont, "Sum2", startX, rect.y , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
+ /*
+ * Chin's NOTE:::: This pages based on newer version nsharp from SPC. We
+ * dont have source code as of 7/8/2010. Therefore, coding is purly
+ * based on a captured screen shot given by SPC's John Hart. This
+ * function is coded based on native nsharp codes which can be found in
+ * other pages's show functions.
+ */
+ // if we can not Interpolates a temp with 700 mb pressure, then we dont
+ // have enough raw data
+ if ((nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0)) {
+ target.drawString(myfont, " " + NO_DATA, rect.x,
+ rect.y, 0.0, TextStyle.NORMAL, NsharpConstants.color_cyan,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ return;
+ }
- textStr = String.format("SRH(m%c/s%c)",NsharpConstants.SQUARE_SYMBOL, NsharpConstants.SQUARE_SYMBOL);
- target.drawString(myfont, textStr, firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "Shear(kt)", secondToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- target.drawString(myfont, "MnWind", thirdToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ // call get_topBotPres to set p_top and p_bot
+ FloatByReference topPF = new FloatByReference(0);
+ FloatByReference botPF = new FloatByReference(0);
+ nsharpNative.nsharpLib.get_effectLayertopBotPres(topPF, botPF);
+
+ String textStr, CAPE3Str = "", NCAPEStr = "";
+ curY = rect.y;
+
+ //
+ // Start with Parcel Data
+ //
+ Rectangle2D strBD = target.getStringBounds(myfont,
+ NsharpNativeConstants.PAGE1TEXT1_FCST_STR + "XX");
+ double hRatio = paintProps.getView().getExtent().getWidth()
+ / paintProps.getCanvasBounds().width;
+ double startX = rect.x + 0.5 * charWidth;
+ double widthGap = (rect.width - strBD.getWidth() * hRatio * xRatio) / 6;// was
+ // -100*xRatio)/6;
+ firstToken = rect.x + strBD.getWidth() * hRatio * xRatio;// was
+ // +100.0*xRatio;
+ secondToken = firstToken + widthGap;
+ thirdToken = secondToken + widthGap;
+ forthToken = thirdToken + widthGap;
+ fifthToken = forthToken + widthGap;
+ sixthToken = fifthToken + widthGap;
+ target.drawString(myfont, "Sum1", startX, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "CAPE", firstToken, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "CINH", secondToken, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "LCL", thirdToken, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "LI", forthToken, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "LFC", fifthToken, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "EL", sixthToken, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+ parcelLineYStart = curY;
+ float layerPressure = 0;
+
+ // get user selected parcel type
+ _lplvalues lpvls;
+ _parcel pcl;
+ // curY = curY+ (double)charHeight * 0.5;
+ for (short parcelNumber = 1; parcelNumber <= NsharpNativeConstants.PARCEL_MAX; parcelNumber++) {
+ if (parcelNumber == currentParcel) {
+ PixelExtent pixExt = new PixelExtent(rect.x, rect.x
+ + rect.width, curY, curY + charHeight);
+ // target.setupClippingPlane(pixExt);
+ target.drawRect(pixExt, NsharpConstants.color_gold, 1.0f, 1.0f);
+ }
+ // call native define_parcel() with parcel type and user defined
+ // pressure (if user defined it)
+ textStr = NsharpNativeConstants.parcelToTypeStrMap
+ .get(parcelNumber);
+ target.drawString(myfont, textStr, startX, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ float layerPressure1 = NsharpNativeConstants.parcelToLayerMap
+ .get(parcelNumber);
+ if (parcelNumber == NsharpNativeConstants.PARCELTYPE_USER_DEFINED) {
+ // get user selected parcel type, if available
+ layerPressure1 = NsharpParcelDialog.getUserDefdParcelMb();
+ }
+ // System.out.println("drawPanel1-1 called define_parcel pType="+parcelNumber+" pre="+
+ // layerPressure1);
+
+ nsharpNative.nsharpLib.define_parcel(parcelNumber, layerPressure1);
+
+ lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ pcl = new _parcel();
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp,
+ sfcdwpt, pcl);
+ // draw parcel name
+ // draw CAPE
+ if (pcl.bplus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ target.drawString(myfont, String.format("%.0f", pcl.bplus),
+ firstToken, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ else
+ target.drawString(myfont, "M", firstToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ // draw CINH
+ if (pcl.bminus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ target.drawString(myfont, String.format("%.0f", pcl.bminus),
+ secondToken, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ else
+ target.drawString(myfont, "M", secondToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ // draw LCL
+ float lcl = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres));
+ if (lcl != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ target.drawString(myfont, String.format("%.0fm", lcl),
+ thirdToken, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- target.drawString(myfont, "SRW", forthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY+charHeight; //move to new line
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
- //curY = curY+ (double)charHeight * 0.5;
- FloatByReference smdir=new FloatByReference(0), smspd = new FloatByReference(0);
- nsharpNative.nsharpLib.get_storm(smspd, smdir);
- FloatByReference topPF= new FloatByReference(0);
- FloatByReference botPF= new FloatByReference(0);
- nsharpNative.nsharpLib.get_effectLayertopBotPres(topPF, botPF);
- //System.out.println("top="+topPF.getValue()+" bot="+botPF.getValue());
- for (int i =0; i< NsharpNativeConstants.STORM_MOTION_TYPE_STR1.length; i++){
- float h1, h2;
- if(NsharpNativeConstants.STORM_MOTION_TYPE_STR1[i].equals("Eff Inflow Layer")){
- if(botPF.getValue()>0){
- h1 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(botPF.getValue()));
- h2 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(topPF.getValue()));
- }
- else{
- h1=-999;
- h2=-999;
- }
- }
- else {
- h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][0];
- h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][1];
- }
- //h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][0];
- //h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][1];
- if(h1!=-999&& h2!=-999){
- //SRH
- //calculate helicity
+ else
+ target.drawString(myfont, "M", thirdToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ // draw LI
+ if (pcl.li5 != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ target.drawString(myfont, String.format("%5.0f", pcl.li5),
+ forthToken, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ else
+ target.drawString(myfont, "M", forthToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ // draw LFC
+ float lfc = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres));
+ if (lfc != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ target.drawString(myfont, String.format("%.0fm", lfc),
+ fifthToken, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ else
+ target.drawString(myfont, "M", fifthToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ // draw EL
+ float el = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.elpres));
+ if (el != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ target.drawString(
+ myfont,
+ String.format("%.0f'",
+ NsharpConstants.metersToFeet.convert(el)),
+ sixthToken, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ else
+ target.drawString(myfont, "M", sixthToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
- float totHeli = nsharpNative.nsharpLib.helicity( h1,
- h2, smdir.getValue(), smspd.getValue(), fValue, fValue1);
- target.drawString(myfont, NsharpNativeConstants.STORM_MOTION_TYPE_STR1[i], startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //gc.drawText(NsharpNativeConstants.STORM_MOTION_TYPE_STR[i],0, textLineNumber*textHeight + graphLineNumber);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1&&nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- //textStr = NsharpNativeConstants.STORM_MOTION_TYPE_STR[i]+" %.0f";
- textStr = String.format("%.0f", totHeli);
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, firstToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //Calculate wind shear
- //Note: -1 as first parameter indicating bottom layer is surface layer, see wind.c for wind_shear() source code
- nsharpNative.nsharpLib.wind_shear( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)),
- fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue3.getValue())==1) {
- textStr = String.format("%.0f",fValue3.getValue());
-
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, secondToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //Calculate mean wind
- nsharpNative.nsharpLib.mean_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)), fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue2.getValue())==1&&nsharpNative.nsharpLib.qc(fValue3.getValue())==1) {
- textStr = String.format("%.0f/%.0f",fValue2.getValue(), fValue3.getValue());
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, thirdToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //calculate pressure-weighted SR mean wind
- nsharpNative.nsharpLib.sr_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)),
- nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)), smdir.getValue(), smspd.getValue(),
- fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue2.getValue())==1) {
- textStr = String.format("%.0f/%.0f",fValue2.getValue(), fValue3.getValue());
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, forthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- if(NsharpNativeConstants.STORM_MOTION_TYPE_STR1[i].equals("Eff Inflow Layer")){
- //draw bax around it
- Rectangle rectangle = new Rectangle(rect.x,(int)curY,rect.width,(int)charHeight);
- //System.out.println("rect.x="+ rectangle.x+ " y="+ rectangle.y+" w="+rectangle.width+ " h="+rectangle.height);
- PixelExtent pixExt = new PixelExtent(rectangle);
- target.drawRect(pixExt,NsharpConstants.color_gold, 1.0f, 1.0f);
- }
- }
- curY = curY+charHeight; //move to new line
-
- }
- float pres=0;
- short oldlplchoice=3;
- float sfctemp, sfcdwpt, sfcpres;
- _lplvalues lpvls;
- _parcel pcl;
- lpvls = new _lplvalues();
- //nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
- //sfctemp = lpvls.temp;
- //sfcdwpt = lpvls.dwpt;
- //sfcpres = lpvls.pres;
- // get parcel data by calling native nsharp parcel() API. value is returned in pcl
- pcl = new _parcel();
- for (int i =0; i< NsharpNativeConstants.STORM_MOTION_TYPE_STR2.length; i++){
- float h1, h2;
-
- h1=-999;
- h2=-999;
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
- if(NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i].equals("LCL-EL(Cloud Layer)")){
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- if (pcl.bplus > 0)
- {
- h1 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lclpres));
- h2 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.elpres));
- }
- }
- else if (NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i].equals("Lower Half Storm Depth")){
- oldlplchoice = lpvls.flag;
- nsharpNative.nsharpLib.define_parcel(NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE, NsharpNativeConstants.MU_LAYER);
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);//regain lpvls value after defined parcel
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- float el = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.elpres));
- if (pcl.bplus >= 100.0)
- {
-
- float base = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(botPF.getValue()));
- float depth = (el - base);
- h1 = base;
- h2 = base + (depth * 0.5f);
-
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
- }
-
- //System.out.println("drawPanel2-2 called define_parcel pType="+oldlplchoice+" pre="+ pres);
- try{
- if(oldlplchoice == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){
- pres = NsharpParcelDialog.getUserDefdParcelMb();
- }
- else
- pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice);
-
- //reset and define oldchoice parcel
- nsharpNative.nsharpLib.define_parcel(oldlplchoice,pres);
- }
- catch (NullPointerException e) {
- // when in changing pane configuration situation, an odd scenario may happened that
- // "oldlplchoice" may be a null, and parcelToLayerMap.get(oldlplchoice); throws a
- // NullPointerException. In that case, we do not re-define_parcel and continue on
- e.printStackTrace();
- }
-
- }
- else {
- h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT2[i][0];
- h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT2[i][1];
- }
- if(h1!=-999&& h2!=-999){
- //SRH
- //calculate helicity
- float totHeli = nsharpNative.nsharpLib.helicity( h1,
- h2, smdir.getValue(), smspd.getValue(), fValue, fValue1);
- target.drawString(myfont, NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i], startX, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //gc.drawText(NsharpNativeConstants.STORM_MOTION_TYPE_STR[i],0, textLineNumber*textHeight + graphLineNumber);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1&&nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- //textStr = NsharpNativeConstants.STORM_MOTION_TYPE_STR[i]+" %.0f";
- textStr = String.format("%.0f", totHeli);
- }
- else {
- textStr = "M";
- }
- // SR Helicity is not shown for these 4 storm motions, see oroginal BigNsharp show_shear_new()
- //target.drawString(myfont, textStr, firstToken, curY , 0.0,
- // TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- // VerticalAlignment.TOP, null);
-
- //Calculate wind shear
- //Note: -1 as first parameter indicating bottom layer is surface layer, see wind.c for wind_shear() source code
- nsharpNative.nsharpLib.wind_shear( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)),
- fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue3.getValue())==1) {
- textStr = String.format("%.0f",fValue3.getValue());
-
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, secondToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //Calculate mean wind
- nsharpNative.nsharpLib.mean_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)), fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue2.getValue())==1&&nsharpNative.nsharpLib.qc(fValue3.getValue())==1) {
- textStr = String.format("%.0f/%.0f",fValue2.getValue(), fValue3.getValue());
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, thirdToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //calculate pressure-weighted SR mean wind
- nsharpNative.nsharpLib.sr_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)),
- nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)), smdir.getValue(), smspd.getValue(),
- fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue2.getValue())==1) {
- textStr = String.format("%.0f/%.0f",fValue2.getValue(), fValue3.getValue());
- }
- else {
- textStr = "M";
- }
- target.drawString(myfont, textStr, forthToken, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- if (NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i].equals("Lower Half Storm Depth")){
- //draw bax around it
- Rectangle rectangle = new Rectangle(rect.x,(int)curY,rect.width,(int)charHeight);
- //System.out.println("rect.x="+ rectangle.x+ " y="+ rectangle.y+" w="+rectangle.width+ " h="+rectangle.height);
- PixelExtent pixExt = new PixelExtent(rectangle);
- target.drawRect(pixExt,NsharpConstants.color_gold, 1.0f, 1.0f);
- }
- }
- curY = curY+charHeight; //move to new line
-
-
- }
- //align all following parameters output with "Corfidi Downshear"
- double hRatio = paintProps.getView().getExtent().getWidth() / paintProps.getCanvasBounds().width;
- DrawableString str = new DrawableString("Corfidi Downshear = ", NsharpConstants.color_white);
- double equalSignPos= secondToken;//rect.x+target.getStringsBounds(str).getWidth()*hRatio*xRatio;
-
- //BRN Shear
- // get parcel data by calling native nsharp parcel() API. value is returned in pcl
- // current parcel is reset earlief already we dont have to call define_parcel() again.
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
-
- nsharpNative.nsharpLib.cave_bulk_rich2( fValue );
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1)
- textStr = String.format("%.0f m%c/s%c",fValue.getValue(),NsharpConstants.SQUARE_SYMBOL, NsharpConstants.SQUARE_SYMBOL);
- else
- textStr = " M";
- str.setCoordinates(startX, curY);
- str.horizontalAlignment = HorizontalAlignment.LEFT;
- str.verticallAlignment = VerticalAlignment.TOP;
- str.font = myfont;
- str.setText("BRN Shear = ", NsharpConstants.color_white);
- DrawableString str1 =new DrawableString(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- str1.horizontalAlignment = HorizontalAlignment.LEFT;
- str1.verticallAlignment = VerticalAlignment.TOP;
- str1.font = myfont;
- target.drawStrings(str, str1);
-
- curY = curY+charHeight; //move to new line
- //4-6km srw
- nsharpNative.nsharpLib.sr_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(4000)),
- nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)), smdir.getValue(), smspd.getValue(),
- fValue, fValue1,fValue2, fValue3);
- if(nsharpNative.nsharpLib.qc(fValue2.getValue())==1) {
- textStr = String.format("%.0f/%.0f kt",fValue2.getValue(), fValue3.getValue());
- }
- else {
- textStr = " M";
- }
- str.setText("4-6km SR Wind =", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
-
- curY = curY+charHeight; //move to new line
-
- //Corfidi Downshear, we use fValue3, fValue4 only by calling corfidi_MCS_motion
- nsharpNative.nsharpLib.corfidi_MCS_motion(fValue1, fValue2, fValue3, fValue4, fValue5, fValue6, fValue7, fValue8);
- textStr = String.format("%.0f/%.0f kt",fValue3.getValue(), fValue4.getValue());
- str.setText("Corfidi Downshear =", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- curY = curY+charHeight; //move to new line
-
- //Corfidi Upshear, we use fValue7, fValue8 only by calling corfidi_MCS_motion
- textStr = String.format("%.0f/%.0f kt",fValue7.getValue(), fValue8.getValue());
- str.setText("Corfidi Upshear =", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- curY = curY+charHeight; //move to new line
-
- //Bunkers Right
- nsharpNative.nsharpLib.bunkers_storm_motion(fValue1, fValue2, fValue3, fValue4);
- textStr = String.format("%.0f/%.0f kt",fValue3.getValue(), fValue4.getValue());
- str.setText("Bunkers Right =", NsharpConstants.color_red);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_red);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
-
-
- curY = curY+charHeight; //move to new line
- //Bunkers Left
- nsharpNative.nsharpLib.bunkers_left_motion(fValue1, fValue2, fValue3, fValue4);
- textStr = String.format("%.0f/%.0f kt",fValue3.getValue(), fValue4.getValue());
- str.setText("Bunkers Left =", NsharpConstants.color_cyan);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_cyan);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
- curY = curY+charHeight; //move to new line
-
- // STPC(test) - test STP using cape6km
- //Chin Note: BigNsharp sigtorn_test always return -9999..a bug
- float stpTest = nsharpNative.nsharpLib.sigtorn_test(smdir.getValue(), smspd.getValue());
- //System.out.println("smdir="+smdir.getValue()+"smspd="+ smspd.getValue()+"stpTest="+stpTest+
- // "p_bot="+botPF.getValue()+"p_top="+topPF.getValue());
- if(nsharpNative.nsharpLib.qc(stpTest)==1)
- textStr = String.format("%.1f", stpTest);
- else
- textStr = " M";
- str.setText("STPC(test) =", NsharpConstants.color_white);
- str.setCoordinates(startX, curY);
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(equalSignPos, curY);
- target.drawStrings(str, str1);
-
- //wind barb labels
- str1.setText("12345SPACE",NsharpConstants.color_red); // rest str1 to get a right x position
- //firstToken = equalSignPos+ (target.getStringsBounds(str1).getMaxX())*hRatio*xRatio;
- textStr = "1km";
- str.setText(textStr, NsharpConstants.color_red);
- str.setCoordinates(thirdToken, curY);
- textStr = " & ";
- str1.setText(textStr,NsharpConstants.color_white);
- str1.setCoordinates(thirdToken + target.getStringsBounds(str).getWidth()*hRatio*xRatio, curY);
- textStr = "6km";
- DrawableString str2 =new DrawableString(textStr,NsharpConstants.color_cyan);
- str2.horizontalAlignment = HorizontalAlignment.LEFT;
- str2.verticallAlignment = VerticalAlignment.TOP;
- str2.font = myfont;
- str2.setCoordinates(thirdToken+ (target.getStringsBounds(str).getWidth()+target.getStringsBounds(str1).getWidth())*hRatio*xRatio, curY);
- textStr = " AGL Wind Barb";
- DrawableString str3 =new DrawableString(textStr,NsharpConstants.color_white);
- str3.horizontalAlignment = HorizontalAlignment.LEFT;
- str3.verticallAlignment = VerticalAlignment.TOP;
- str3.font = myfont;
- str3.setCoordinates(thirdToken + (target.getStringsBounds(str).getWidth()+target.getStringsBounds(str1).getWidth()+target.getStringsBounds(str2).getWidth())*hRatio*xRatio, curY);
- target.drawStrings(str, str1, str2, str3);
-
- //1 km wind barb
- double wbToken= (thirdToken+forthToken)/2 ;
- str1.setText("1234/56 ktSPACESPACESPACE",NsharpConstants.color_red); // rest str1 to get a right x position
- //firstToken = equalSignPos+ (target.getStringsBounds(str1).getMaxX())*hRatio*xRatio;
- double yOri = curY- 3* charHeight;
- double barbScaleF= charHeight;//12;
- List barb = WindBarbFactory.getWindGraphics(
- (double)nsharpNative.nsharpLib.iwspd(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(1000))),
- (double)nsharpNative.nsharpLib.iwdir(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(1000))));
- if (barb != null) {
- WindBarbFactory.scaleBarb(barb, barbScaleF);
-
- double cur0X=wbToken, cur0Y=yOri, cur1X=wbToken, cur1Y=yOri,newY=0;
- WindBarbFactory.translateBarb(barb,cur0X ,yOri );
-
- for (LineStroke stroke : barb) {
- Coordinate point = stroke.getPoint();
- // Chin NOte; when using WindBarbFactory.getWindGraphics() to create barb, the Y axis is growing
- // upwards. However, on this canvas, Y axis is growing downwards. Therefore, the following Y coordinate
- // adjustment is necessary.
- //
- newY = yOri - (point.y - yOri );
- // Note: stroke.render(gc, relativeX, relativeY) is not working here. Therefore, need to
- // draw wind barb ourself.
- if(stroke.getType() == "M"){
- cur0X = point.x;
- cur0Y = newY;
- }
- else if(stroke.getType() == "D"){
- cur1X = point.x;
- cur1Y = newY;
- target.drawLine(cur0X,cur0Y, 0.0, cur1X, cur1Y,0.0, NsharpConstants.color_red, 1);
- // bsteffen added these two lines to fix 50 kts wind barbs
- cur0X = cur1X;
- cur0Y = cur1Y;
- }
+ curY = curY + charHeight;
+ // get 3CAPE value for later to use
+ if (parcelNumber == NsharpNativeConstants.PARCELTYPE_MEAN_MIXING) {
+ if (nsharpNative.nsharpLib.qc(pcl.cape3km) == 1) {
+ CAPE3Str = String.format("%.0fJ/kg", pcl.cape3km);
+ } else {
+ CAPE3Str = " M";
+ }
+ }// get NCAPE value for later to use
+ else if (parcelNumber == NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE) {
+ float j1 = pcl.bplus;
+ float j2 = nsharpNative.nsharpLib.ihght(pcl.elpres)
+ - nsharpNative.nsharpLib.ihght(pcl.lfcpres);
+ if (nsharpNative.nsharpLib.qc(j1 / j2) == 1) {
+ NCAPEStr = String.format("%.2f", j1 / j2);
+ } else {
+ NCAPEStr = "NCAPE= M";
+ }
}
}
- //6 km wind barb
- barb.clear();
- barb = WindBarbFactory.getWindGraphics(
- (double)nsharpNative.nsharpLib.iwspd(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000))),
- (double)nsharpNative.nsharpLib.iwdir(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000))));
- if (barb != null) {
- WindBarbFactory.scaleBarb(barb, barbScaleF);
-
- double cur0X=wbToken, cur0Y=yOri, cur1X=wbToken, cur1Y=yOri,newY=0;
- WindBarbFactory.translateBarb(barb,cur0X ,yOri );
-
- for (LineStroke stroke : barb) {
- Coordinate point = stroke.getPoint();
- // Chin NOte; when using WindBarbFactory.getWindGraphics() to create barb, the Y axis is growing
- // upwards. However, on this canvas, Y axis is growing downwards. Therefore, the following Y coordinate
- // adjustment is necessary.
- newY = yOri - (point.y - yOri );
- //
- // Note: stroke.render(gc, relativeX, relativeY) is not working here. Therefore, need to
- // draw wind barb ourself.
- if(stroke.getType() == "M"){
- cur0X = point.x;
- cur0Y = newY;
- }
- else if(stroke.getType() == "D"){
- cur1X = point.x;
- cur1Y = newY;
- target.drawLine(cur0X,cur0Y, 0.0, cur1X, cur1Y,0.0, NsharpConstants.color_cyan, 1);
- // bsteffen added these two lines to fix 50 kts wind barbs
- cur0X = cur1X;
- cur0Y = cur1Y;
- }
- }
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+ parcelLineYEnd = curY;
+ if (currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED) {
+ layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
+ } else
+ layerPressure = NsharpNativeConstants.parcelToLayerMap
+ .get(currentParcel);
+ // System.out.println("drawPanel1-2 called define_parcel pType="+currentParcel+" pre="+
+ // layerPressure);
+
+ // reset and define current parcel
+ nsharpNative.nsharpLib.define_parcel(currentParcel, layerPressure);
+ lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ pcl = new _parcel();
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+ //
+ // THERMO DYNAMIC DATA
+ //
+ firstToken = rect.x + rect.width / 48 * 12 * xRatio;
+ secondToken = rect.x + rect.width / 48 * 27 * xRatio;
+ thirdToken = rect.x + rect.width / 48 * 38 * xRatio;
+ // curY = curY+ (double)charHeight * 0.5;
+ DrawableString str = new DrawableString("ABCDE=",
+ NsharpConstants.color_white);
+ str.font = myfont;
+ double equalSignPos = (startX + target.getStringsBounds(str).getWidth())
+ * hRatio * xRatio;
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.precip_water(fValue, -1.0F, -1.0F);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = String.format("%.2f in", fValue.getValue());
+ } else {
+ textStr = " M";
}
- //myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel3(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
+ str.setCoordinates(startX, curY);
+ str.horizontalAlignment = HorizontalAlignment.LEFT;
+ str.verticallAlignment = VerticalAlignment.TOP;
+ str.font = myfont;
+ str.setText("PW=", NsharpConstants.color_white);
+ DrawableString str1 = new DrawableString(textStr,
+ NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ str1.horizontalAlignment = HorizontalAlignment.LEFT;
+ str1.verticallAlignment = VerticalAlignment.TOP;
+ str1.font = myfont;
+ target.drawStrings(str, str1);
+
+ // 3CAPE...value was retrieved earlier
+ str.setText("3CAPE=", NsharpConstants.color_white);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(CAPE3Str, NsharpConstants.color_white);
+ str1.setCoordinates(firstToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ fValue.setValue(0);
+ float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .wb_lvl(0, fValue))));
+ if (nsharpNative.nsharpLib.qc(wbzft) == 1) {
+ textStr = String.format("%.0f'", wbzft);
+ } else {
+ textStr = " M";
+ }
+ str.setText("WBZ=", NsharpConstants.color_white);
+ str.setCoordinates(secondToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(secondToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ // WNDG
+ float wndg = nsharpNative.nsharpLib.damaging_wind();
+ if (nsharpNative.nsharpLib.qc(wndg) == 1) {
+ textStr = String.format("%.2f", wndg);
+ } else {
+ textStr = " M";
+ }
+ str.setText("WNDG=", NsharpConstants.color_white);
+ str.setCoordinates(thirdToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(thirdToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.k_index(fValue);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = String.format("%.0f", fValue.getValue());
+ } else {
+ textStr = " M";
+ }
+ str.setText("K=", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ // DCAPE
+ // fValue1 will be used for DownT to use
+ float dcape = nsharpNative.nsharpLib.dcape(fValue, fValue1);
+ float downT = fValue1.getValue();
+ if (nsharpNative.nsharpLib.qc(dcape) == 1) {
+ textStr = String.format("%.0fJ/kg", dcape);
+ } else {
+ textStr = " M";
+ }
+ str.setText("DCAPE=", NsharpConstants.color_white);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(firstToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ // FZL
+ fValue.setValue(0);
+ float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .temp_lvl(0, fValue))));
+ if (nsharpNative.nsharpLib.qc(fgzft) == 1) {
+ textStr = String.format("%.0f'", fgzft);
+ } else {
+ textStr = " M";
+ }
+ str.setText("FZL=", NsharpConstants.color_white);
+ str.setCoordinates(secondToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(secondToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+ // ESP
+ float esp = nsharpNative.nsharpLib.esp();
+ if (nsharpNative.nsharpLib.qc(esp) == 1) {
+ textStr = String.format("%.2f", esp);
+ } else {
+ textStr = " M";
+ }
+ str.setText("ESP=", NsharpConstants.color_white);
+ str.setCoordinates(thirdToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(thirdToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+
+ fValue.setValue(0);
+ // MidRH
+ nsharpNative.nsharpLib.get_surface(fValue1, fValue2, fValue3); // fValue
+ // 2 and
+ // fValue3
+ // are
+ // not of
+ // concern
+ // here
+ nsharpNative.nsharpLib.mean_relhum(fValue, fValue1.getValue() - 150,
+ fValue1.getValue() - 350);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = String.format("%.0f%c", fValue.getValue(),
+ NsharpConstants.PERCENT_SYMBOL);
+ } else {
+ textStr = " M";
+ }
+ str.setText("MidRH=", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ // DownT
+ downT = nsharpNative.nsharpLib.ctof(downT); // convert to F
+ if (nsharpNative.nsharpLib.qc(downT) == 1) {
+ textStr = String.format("%.0fF", downT);
+ } else {
+ textStr = " M";
+ }
+ str.setText("DownT=", NsharpConstants.color_white);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(firstToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+ // ConvT
+ fValue.setValue(0);
+ float conTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib
+ .cnvtv_temp(fValue, -1));
+
+ if (nsharpNative.nsharpLib.qc(conTempF) == 1) {
+ textStr = String.format("%.0fF", conTempF);
+ } else {
+ textStr = " M";
+ }
+ str.setText("ConvT=", NsharpConstants.color_white);
+ str.setCoordinates(secondToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(secondToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ // MMP: Coniglio MCS Maintenance Parameter
+ float mmp = nsharpNative.nsharpLib.coniglio1();
+ if (nsharpNative.nsharpLib.qc(mmp) == 1) {
+ textStr = String.format("%.2f", mmp);
+ } else {
+ textStr = " M";
+ }
+ str.setText("MMP=", NsharpConstants.color_white);
+ str.setCoordinates(thirdToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(thirdToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+
+ fValue.setValue(0);
+ fValue1.setValue(0);
+ // get surface pressure (fValue1) before getting mean LRH value
+ nsharpNative.nsharpLib.get_surface(fValue1, fValue2, fValue3); // fValue
+ // 2 and
+ // fValue3
+ // are
+ // not of
+ // concern
+ // here
+ nsharpNative.nsharpLib.mean_relhum(fValue, -1.0F,
+ fValue1.getValue() - 150);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ // textStr = NsharpNativeConstants.THERMO_MEANLRH_LINE;
+ textStr = String.format("%.0f%c", fValue.getValue(),
+ NsharpConstants.PERCENT_SYMBOL);
+ } else {
+ textStr = " M";
+ }
+ str.setText("LowRH=", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.mean_mixratio(fValue, -1.0F, -1.0F);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = String.format("%.1fg/kg", fValue.getValue());
+ } else {
+ textStr = " M";
+ }
+ str.setText("MeanW=", NsharpConstants.color_white);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(firstToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ fValue.setValue(0);
+ float maxT = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib
+ .max_temp(fValue, -1));
+ if (nsharpNative.nsharpLib.qc(maxT) == 1) {
+ textStr = String.format("%.0fF", maxT);
+ } else {
+ textStr = " M";
+ }
+ str.setText("MaxT=", NsharpConstants.color_white);
+ str.setCoordinates(secondToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(secondToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ // NCAPE
+ str.setText("NCAPE=", NsharpConstants.color_white);
+ str.setCoordinates(thirdToken, curY);
+ str1.setText(NCAPEStr, NsharpConstants.color_white);
+ str1.setCoordinates(thirdToken + equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+
+ // draw a vertical line from 2/3 of x axis
+ str.setText("sfc-3km AglLapseRate=xxC/x.xC/kmX",
+ NsharpConstants.color_black);
+ str.font = myfont;
+ double lineXPos = target.getStringsBounds(str).getWidth() * hRatio
+ * xRatio;
+ if (lineXPos < rect.width * 2 / 3)
+ lineXPos = rect.width * 2 / 3;
+ firstToken = rect.x + lineXPos;
+ target.drawLine(firstToken, curY, 0.0, firstToken,
+ rect.y + rect.height, 0.0, NsharpConstants.color_white, 1);
+ // curY = curY+ (double)charHeight * 0.5;
+ firstToken = firstToken + 0.5 * charWidth;
+
+ // more thermodynamic data
+ // the following follow show_parcel_new() at xwvid.c of bigNsharp
+ // implementation
+ // sfc-3km Lapse rate
+ //
+ float htsfc = 0;
+ float tDelta = nsharpNative.nsharpLib.aglT(0, 3000);
+ fValue.setValue(0);
+ // get surface pressure (fValue)
+ nsharpNative.nsharpLib.get_surface(fValue, fValue1, fValue2);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ htsfc = nsharpNative.nsharpLib.ihght(fValue.getValue());
+ // get sfc to (sfc+ 3 km) pressure (fValue)
+ float threekmPre = nsharpNative.nsharpLib.ipres(htsfc + 3000);
+ fValue1.setValue(0);
+ nsharpNative.nsharpLib.lapse_rate(fValue1, fValue.getValue(),
+ threekmPre);
+ if (nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ // textStr =
+ // String.format("sfc-3km AglLapseRate=%.0fC/%.1fC/km", tDelta,
+ // fValue1.getValue());
+ textStr = String.format("%.0fC/%.1fC/km", tDelta,
+ fValue1.getValue());
+ } else {
+ textStr = " M";// "sfc-3km AglLapseRate= M";
+ }
+ } else {
+ textStr = " M";// "sfc-3km AglLapseRate= M";
+ }
+ str.setText("sfc-3km Agl LapseRate= ", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ equalSignPos = rect.x + target.getStringsBounds(str).getWidth()
+ * hRatio * xRatio;
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ /*
+ * target.drawString(myfont, textStr, startX, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_white,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+
+ // "Supercell"
+ float smdir = rscHandler.getSmWindDir();// bkRsc.getSmDir(); #10438
+ float smspd = rscHandler.getSmWindSpd();// bkRsc.getSmSpd();
+ float superCell = nsharpNative.nsharpLib.scp(smdir, smspd);
+ if (nsharpNative.nsharpLib.qc(superCell) == 1) {
+ textStr = String.format("%.1f", superCell);
+ } else {
+ textStr = " M";
+ }
+ str.setText("Supercell= ", NsharpConstants.color_yellow);
+ double equalSignPos1 = firstToken
+ + target.getStringsBounds(str).getWidth() * hRatio * xRatio;
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_yellow);
+ str1.setCoordinates(equalSignPos1, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, firstToken, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_yellow,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+
+ curY = curY + charHeight; // move to new line
+
+ // 3km-6km Lapse rate
+ fValue.setValue(0);
+ fValue1.setValue(0);
+ tDelta = nsharpNative.nsharpLib.aglT(3000, 6000);
+ // get 3 and 6km pressure (fValue)
+ float threekmPre = nsharpNative.nsharpLib.ipres(htsfc + 3000);
+ float sixkmPre = nsharpNative.nsharpLib.ipres(htsfc + 6000);
+ fValue1.setValue(0);
+ nsharpNative.nsharpLib.lapse_rate(fValue1, threekmPre, sixkmPre);
+ if (nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = String.format("%.0fC/%.1fC/km", tDelta,
+ fValue1.getValue());
+
+ } else {
+ textStr = " M";
+ }
+ str.setText("3-6km Agl LapseRate=", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, startX, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_white,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+ // "STP (CIN)"
+ float cin = nsharpNative.nsharpLib.sigtorn_cin(smdir, smspd);
+ if (nsharpNative.nsharpLib.qc(cin) == 1) {
+ textStr = String.format("%.1f", cin);
+ } else {
+ textStr = " M";
+ }
+ str.setText("STP(CIN)=", NsharpConstants.color_white);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos1, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, firstToken, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_white,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+
+ curY = curY + charHeight; // move to new line
+
+ fValue.setValue(0);
+ fValue1.setValue(0);
+ // nsharpNative.nsharpLib.vert_tot(fValue);
+ float delta = nsharpNative.nsharpLib.itemp(850)
+ - nsharpNative.nsharpLib.itemp(500);
+ nsharpNative.nsharpLib.lapse_rate(fValue1, 850.0F, 500.0F);
+ if (nsharpNative.nsharpLib.qc(delta) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = String
+ .format("%.0fC/%.1fC/km", delta, fValue1.getValue());
+ } else {
+ textStr = " M";
+ }
+ str.setText("850-500mb LapseRate=", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, startX, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_white,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+ // "STP(fixed)"
+ float fixedStp = nsharpNative.nsharpLib.sigtorn_fixed(smdir, smspd);
+ if (nsharpNative.nsharpLib.qc(fixedStp) == 1) {
+ textStr = String.format("%.1f", fixedStp);
+ } else {
+ textStr = " M";
+ }
+ str.setText("STP(fixed)=", NsharpConstants.color_white);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos1, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, firstToken, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_white,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+
+ curY = curY + charHeight; // move to new line
+
+ fValue.setValue(0);
+ fValue1.setValue(0);
+ // nsharpNative.nsharpLib.delta_t(fValue);
+ nsharpNative.nsharpLib.lapse_rate(fValue1, 700.0F, 500.0F);
+ delta = nsharpNative.nsharpLib.itemp(700)
+ - nsharpNative.nsharpLib.itemp(500);
+ if (nsharpNative.nsharpLib.qc(/* fValue.getValue()) */delta) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = String.format("%.0fC/%.1fC/km",
+ delta/* fValue.getValue() */, fValue1.getValue());
+ } else {
+ textStr = " M";
+ }
+ str.setText("700-500mb LapseRate=", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, startX, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_white,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+ // "SHIP"
+ float ship = nsharpNative.nsharpLib.cave_ship();
+ if (nsharpNative.nsharpLib.qc(ship) == 1) {
+ textStr = String.format("%.1f", ship);
+ } else
+ textStr = " M";
+ str.setText("SHIP=", NsharpConstants.color_red);
+ str.setCoordinates(firstToken, curY);
+ str1.setText(textStr, NsharpConstants.color_red);
+ str1.setCoordinates(equalSignPos1, curY);
+ target.drawStrings(str, str1);
+ /*
+ * target.drawString(myfont, textStr, firstToken, curY , 0.0,
+ * TextStyle.NORMAL, NsharpConstants.color_red,
+ * HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ */
+ // System.out.println("shop="+ship);
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel2(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ if (paneConfigurationName.equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ myfont = font10;
+ } else {
+ myfont = defaultFont;
+ }
+ /*
+ * Chin's NOTE:::: This pages based on BigNsharp show_shear_new() at
+ * xwvid3.c
+ */
+
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
+ // myfont = target.initializeFont(fontName, 10, null);
+ curY = rect.y;
+ String textStr;
+
+ // if we can not Interpolates a temp with 700 mb pressure, then we dont
+ // have enough raw data
+ if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0) {
+ target.drawString(myfont, " " + NO_DATA, rect.x,
+ rect.y, 0.0, TextStyle.NORMAL, NsharpConstants.color_cyan,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ return;
+ }
+
+ //
+ // Start with Header SRH(m%c/s%c) Shear(kt) MnWind SRW
+ //
+ double startX = rect.x + 0.5 * charWidth;
+ double widthGap = (rect.width) / 5;
+ firstToken = rect.x + widthGap;
+ secondToken = firstToken + widthGap;
+ thirdToken = secondToken + widthGap;
+ forthToken = thirdToken + widthGap;
+ target.drawString(myfont, "Sum2", startX, rect.y, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ textStr = String.format("SRH(m%c/s%c)", NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ target.drawString(myfont, textStr, firstToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "Shear(kt)", secondToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "MnWind", thirdToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ target.drawString(myfont, "SRW", forthToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight; // move to new line
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+ // curY = curY+ (double)charHeight * 0.5;
+ FloatByReference smdir = new FloatByReference(0), smspd = new FloatByReference(
+ 0);
+ nsharpNative.nsharpLib.get_storm(smspd, smdir);
+ FloatByReference topPF = new FloatByReference(0);
+ FloatByReference botPF = new FloatByReference(0);
+ nsharpNative.nsharpLib.get_effectLayertopBotPres(topPF, botPF);
+ // System.out.println("top="+topPF.getValue()+" bot="+botPF.getValue());
+ for (int i = 0; i < NsharpNativeConstants.STORM_MOTION_TYPE_STR1.length; i++) {
+ float h1, h2;
+ if (NsharpNativeConstants.STORM_MOTION_TYPE_STR1[i]
+ .equals("Eff Inflow Layer")) {
+
+ if (botPF.getValue() > 0) {
+ h1 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(botPF.getValue()));
+ h2 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(topPF.getValue()));
+ } else {
+ h1 = -999;
+ h2 = -999;
+ }
+ } else {
+ h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][0];
+ h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][1];
+ }
+ // h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][0];
+ // h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT1[i][1];
+ if (h1 != -999 && h2 != -999) {
+ // SRH
+ // calculate helicity
+
+ float totHeli = nsharpNative.nsharpLib.helicity(h1, h2,
+ smdir.getValue(), smspd.getValue(), fValue, fValue1);
+ target.drawString(myfont,
+ NsharpNativeConstants.STORM_MOTION_TYPE_STR1[i],
+ startX, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+
+ // gc.drawText(NsharpNativeConstants.STORM_MOTION_TYPE_STR[i],0,
+ // textLineNumber*textHeight + graphLineNumber);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ // textStr =
+ // NsharpNativeConstants.STORM_MOTION_TYPE_STR[i]+" %.0f";
+ textStr = String.format("%.0f", totHeli);
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, firstToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ // Calculate wind shear
+ // Note: -1 as first parameter indicating bottom layer is
+ // surface layer, see wind.c for wind_shear() source code
+ nsharpNative.nsharpLib.wind_shear(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(h2)), fValue, fValue1, fValue2, fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue3.getValue()) == 1) {
+ textStr = String.format("%.0f", fValue3.getValue());
+
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, secondToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ // Calculate mean wind
+ nsharpNative.nsharpLib.mean_wind(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(h2)), fValue, fValue1, fValue2, fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue2.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue3.getValue()) == 1) {
+ textStr = String.format("%.0f/%.0f", fValue2.getValue(),
+ fValue3.getValue());
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, thirdToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ // calculate pressure-weighted SR mean wind
+ nsharpNative.nsharpLib.sr_wind(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(h2)), smdir.getValue(), smspd.getValue(),
+ fValue, fValue1, fValue2, fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue2.getValue()) == 1) {
+ textStr = String.format("%.0f/%.0f", fValue2.getValue(),
+ fValue3.getValue());
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, forthToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ if (NsharpNativeConstants.STORM_MOTION_TYPE_STR1[i]
+ .equals("Eff Inflow Layer")) {
+ // draw bax around it
+ Rectangle rectangle = new Rectangle(rect.x, (int) curY,
+ rect.width, (int) charHeight);
+ // System.out.println("rect.x="+ rectangle.x+ " y="+
+ // rectangle.y+" w="+rectangle.width+
+ // " h="+rectangle.height);
+ PixelExtent pixExt = new PixelExtent(rectangle);
+ target.drawRect(pixExt, NsharpConstants.color_gold, 1.0f,
+ 1.0f);
+ }
+ }
+ curY = curY + charHeight; // move to new line
+
+ }
+ float pres = 0;
+ short oldlplchoice = 3;
+ float sfctemp, sfcdwpt, sfcpres;
+ _lplvalues lpvls;
+ _parcel pcl;
+ lpvls = new _lplvalues();
+ // nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ // sfctemp = lpvls.temp;
+ // sfcdwpt = lpvls.dwpt;
+ // sfcpres = lpvls.pres;
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ pcl = new _parcel();
+ for (int i = 0; i < NsharpNativeConstants.STORM_MOTION_TYPE_STR2.length; i++) {
+ float h1, h2;
+
+ h1 = -999;
+ h2 = -999;
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ if (NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i]
+ .equals("LCL-EL(Cloud Layer)")) {
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp,
+ sfcdwpt, pcl);
+ if (pcl.bplus > 0) {
+ h1 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres));
+ h2 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.elpres));
+ }
+ } else if (NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i]
+ .equals("Lower Half Storm Depth")) {
+ oldlplchoice = lpvls.flag;
+ nsharpNative.nsharpLib.define_parcel(
+ NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE,
+ NsharpNativeConstants.MU_LAYER);
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);// regain lpvls
+ // value after
+ // defined parcel
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp,
+ sfcdwpt, pcl);
+ float el = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.elpres));
+ if (pcl.bplus >= 100.0) {
+
+ float base = nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(botPF.getValue()));
+ float depth = (el - base);
+ h1 = base;
+ h2 = base + (depth * 0.5f);
+
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ }
+
+ // System.out.println("drawPanel2-2 called define_parcel pType="+oldlplchoice+" pre="+
+ // pres);
+ try {
+ if (oldlplchoice == NsharpNativeConstants.PARCELTYPE_USER_DEFINED) {
+ pres = NsharpParcelDialog.getUserDefdParcelMb();
+ } else
+ pres = NsharpNativeConstants.parcelToLayerMap
+ .get(oldlplchoice);
+
+ // reset and define oldchoice parcel
+ nsharpNative.nsharpLib.define_parcel(oldlplchoice, pres);
+ } catch (NullPointerException e) {
+ // when in changing pane configuration situation, an odd
+ // scenario may happened that
+ // "oldlplchoice" may be a null, and
+ // parcelToLayerMap.get(oldlplchoice); throws a
+ // NullPointerException. In that case, we do not
+ // re-define_parcel and continue on
+ e.printStackTrace();
+ }
+
+ } else {
+ h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT2[i][0];
+ h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT2[i][1];
+ }
+ if (h1 != -999 && h2 != -999) {
+ // SRH
+ // calculate helicity
+ float totHeli = nsharpNative.nsharpLib.helicity(h1, h2,
+ smdir.getValue(), smspd.getValue(), fValue, fValue1);
+ target.drawString(myfont,
+ NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i],
+ startX, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+
+ // gc.drawText(NsharpNativeConstants.STORM_MOTION_TYPE_STR[i],0,
+ // textLineNumber*textHeight + graphLineNumber);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ // textStr =
+ // NsharpNativeConstants.STORM_MOTION_TYPE_STR[i]+" %.0f";
+ textStr = String.format("%.0f", totHeli);
+ } else {
+ textStr = "M";
+ }
+ // SR Helicity is not shown for these 4 storm motions, see
+ // oroginal BigNsharp show_shear_new()
+ // target.drawString(myfont, textStr, firstToken, curY , 0.0,
+ // TextStyle.NORMAL, NsharpConstants.color_white,
+ // HorizontalAlignment.LEFT,
+ // VerticalAlignment.TOP, null);
+
+ // Calculate wind shear
+ // Note: -1 as first parameter indicating bottom layer is
+ // surface layer, see wind.c for wind_shear() source code
+ nsharpNative.nsharpLib.wind_shear(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(h2)), fValue, fValue1, fValue2, fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue3.getValue()) == 1) {
+ textStr = String.format("%.0f", fValue3.getValue());
+
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, secondToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ // Calculate mean wind
+ nsharpNative.nsharpLib.mean_wind(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(h2)), fValue, fValue1, fValue2, fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue2.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue3.getValue()) == 1) {
+ textStr = String.format("%.0f/%.0f", fValue2.getValue(),
+ fValue3.getValue());
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, thirdToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+
+ // calculate pressure-weighted SR mean wind
+ nsharpNative.nsharpLib.sr_wind(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(h2)), smdir.getValue(), smspd.getValue(),
+ fValue, fValue1, fValue2, fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue2.getValue()) == 1) {
+ textStr = String.format("%.0f/%.0f", fValue2.getValue(),
+ fValue3.getValue());
+ } else {
+ textStr = "M";
+ }
+ target.drawString(myfont, textStr, forthToken, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ if (NsharpNativeConstants.STORM_MOTION_TYPE_STR2[i]
+ .equals("Lower Half Storm Depth")) {
+ // draw bax around it
+ Rectangle rectangle = new Rectangle(rect.x, (int) curY,
+ rect.width, (int) charHeight);
+ // System.out.println("rect.x="+ rectangle.x+ " y="+
+ // rectangle.y+" w="+rectangle.width+
+ // " h="+rectangle.height);
+ PixelExtent pixExt = new PixelExtent(rectangle);
+ target.drawRect(pixExt, NsharpConstants.color_gold, 1.0f,
+ 1.0f);
+ }
+ }
+ curY = curY + charHeight; // move to new line
+
+ }
+ // align all following parameters output with "Corfidi Downshear"
+ double hRatio = paintProps.getView().getExtent().getWidth()
+ / paintProps.getCanvasBounds().width;
+ DrawableString str = new DrawableString("Corfidi Downshear = ",
+ NsharpConstants.color_white);
+ double equalSignPos = secondToken;// rect.x+target.getStringsBounds(str).getWidth()*hRatio*xRatio;
+
+ // BRN Shear
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ // current parcel is reset earlief already we dont have to call
+ // define_parcel() again.
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+
+ nsharpNative.nsharpLib.cave_bulk_rich2(fValue);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1)
+ textStr = String.format("%.0f m%c/s%c", fValue.getValue(),
+ NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ else
+ textStr = " M";
+ str.setCoordinates(startX, curY);
+ str.horizontalAlignment = HorizontalAlignment.LEFT;
+ str.verticallAlignment = VerticalAlignment.TOP;
+ str.font = myfont;
+ str.setText("BRN Shear = ", NsharpConstants.color_white);
+ DrawableString str1 = new DrawableString(textStr,
+ NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ str1.horizontalAlignment = HorizontalAlignment.LEFT;
+ str1.verticallAlignment = VerticalAlignment.TOP;
+ str1.font = myfont;
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+ // 4-6km srw
+ nsharpNative.nsharpLib.sr_wind(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(4000)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)),
+ smdir.getValue(), smspd.getValue(), fValue, fValue1, fValue2,
+ fValue3);
+ if (nsharpNative.nsharpLib.qc(fValue2.getValue()) == 1) {
+ textStr = String.format("%.0f/%.0f kt", fValue2.getValue(),
+ fValue3.getValue());
+ } else {
+ textStr = " M";
+ }
+ str.setText("4-6km SR Wind =", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+
+ // Corfidi Downshear, we use fValue3, fValue4 only by calling
+ // corfidi_MCS_motion
+ nsharpNative.nsharpLib.corfidi_MCS_motion(fValue1, fValue2, fValue3,
+ fValue4, fValue5, fValue6, fValue7, fValue8);
+ textStr = String.format("%.0f/%.0f kt", fValue3.getValue(),
+ fValue4.getValue());
+ str.setText("Corfidi Downshear =", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ curY = curY + charHeight; // move to new line
+
+ // Corfidi Upshear, we use fValue7, fValue8 only by calling
+ // corfidi_MCS_motion
+ textStr = String.format("%.0f/%.0f kt", fValue7.getValue(),
+ fValue8.getValue());
+ str.setText("Corfidi Upshear =", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ curY = curY + charHeight; // move to new line
+
+ // Bunkers Right
+ nsharpNative.nsharpLib.bunkers_storm_motion(fValue1, fValue2, fValue3,
+ fValue4);
+ textStr = String.format("%.0f/%.0f kt", fValue3.getValue(),
+ fValue4.getValue());
+ str.setText("Bunkers Right =", NsharpConstants.color_red);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_red);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ curY = curY + charHeight; // move to new line
+ // Bunkers Left
+ nsharpNative.nsharpLib.bunkers_left_motion(fValue1, fValue2, fValue3,
+ fValue4);
+ textStr = String.format("%.0f/%.0f kt", fValue3.getValue(),
+ fValue4.getValue());
+ str.setText("Bunkers Left =", NsharpConstants.color_cyan);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_cyan);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+ curY = curY + charHeight; // move to new line
+
+ // STPC(test) - test STP using cape6km
+ // Chin Note: BigNsharp sigtorn_test always return -9999..a bug
+ float stpTest = nsharpNative.nsharpLib.sigtorn_test(smdir.getValue(),
+ smspd.getValue());
+ // System.out.println("smdir="+smdir.getValue()+"smspd="+
+ // smspd.getValue()+"stpTest="+stpTest+
+ // "p_bot="+botPF.getValue()+"p_top="+topPF.getValue());
+ if (nsharpNative.nsharpLib.qc(stpTest) == 1)
+ textStr = String.format("%.1f", stpTest);
+ else
+ textStr = " M";
+ str.setText("STPC(test) =", NsharpConstants.color_white);
+ str.setCoordinates(startX, curY);
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(equalSignPos, curY);
+ target.drawStrings(str, str1);
+
+ // wind barb labels
+ str1.setText("12345SPACE", NsharpConstants.color_red); // rest str1 to
+ // get a right x
+ // position
+ // firstToken = equalSignPos+
+ // (target.getStringsBounds(str1).getMaxX())*hRatio*xRatio;
+ textStr = "1km";
+ str.setText(textStr, NsharpConstants.color_red);
+ str.setCoordinates(thirdToken, curY);
+ textStr = " & ";
+ str1.setText(textStr, NsharpConstants.color_white);
+ str1.setCoordinates(thirdToken
+ + target.getStringsBounds(str).getWidth() * hRatio * xRatio,
+ curY);
+ textStr = "6km";
+ DrawableString str2 = new DrawableString(textStr,
+ NsharpConstants.color_cyan);
+ str2.horizontalAlignment = HorizontalAlignment.LEFT;
+ str2.verticallAlignment = VerticalAlignment.TOP;
+ str2.font = myfont;
+ str2.setCoordinates(thirdToken
+ + (target.getStringsBounds(str).getWidth() + target
+ .getStringsBounds(str1).getWidth()) * hRatio * xRatio,
+ curY);
+ textStr = " AGL Wind Barb";
+ DrawableString str3 = new DrawableString(textStr,
+ NsharpConstants.color_white);
+ str3.horizontalAlignment = HorizontalAlignment.LEFT;
+ str3.verticallAlignment = VerticalAlignment.TOP;
+ str3.font = myfont;
+ str3.setCoordinates(thirdToken
+ + (target.getStringsBounds(str).getWidth()
+ + target.getStringsBounds(str1).getWidth() + target
+ .getStringsBounds(str2).getWidth()) * hRatio * xRatio,
+ curY);
+ target.drawStrings(str, str1, str2, str3);
+
+ // 1 km wind barb
+ double wbToken = (thirdToken + forthToken) / 2;
+ str1.setText("1234/56 ktSPACESPACESPACE", NsharpConstants.color_red); // rest
+ // str1
+ // to
+ // get
+ // a
+ // right
+ // x
+ // position
+ // firstToken = equalSignPos+
+ // (target.getStringsBounds(str1).getMaxX())*hRatio*xRatio;
+ double yOri = curY - 3 * charHeight;
+ double barbScaleF = charHeight;// 12;
+ List barb = WindBarbFactory.getWindGraphics(
+ (double) nsharpNative.nsharpLib.iwspd(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(1000))),
+ (double) nsharpNative.nsharpLib.iwdir(nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(1000))));
+ if (barb != null) {
+ WindBarbFactory.scaleBarb(barb, barbScaleF);
+
+ double cur0X = wbToken, cur0Y = yOri, cur1X = wbToken, cur1Y = yOri, newY = 0;
+ WindBarbFactory.translateBarb(barb, cur0X, yOri);
+
+ for (LineStroke stroke : barb) {
+ Coordinate point = stroke.getPoint();
+ // Chin NOte; when using WindBarbFactory.getWindGraphics() to
+ // create barb, the Y axis is growing
+ // upwards. However, on this canvas, Y axis is growing
+ // downwards. Therefore, the following Y coordinate
+ // adjustment is necessary.
+ //
+ newY = yOri - (point.y - yOri);
+ // Note: stroke.render(gc, relativeX, relativeY) is not working
+ // here. Therefore, need to
+ // draw wind barb ourself.
+ if (stroke.getType() == "M") {
+ cur0X = point.x;
+ cur0Y = newY;
+ } else if (stroke.getType() == "D") {
+ cur1X = point.x;
+ cur1Y = newY;
+ target.drawLine(cur0X, cur0Y, 0.0, cur1X, cur1Y, 0.0,
+ NsharpConstants.color_red, 1);
+ // bsteffen added these two lines to fix 50 kts wind barbs
+ cur0X = cur1X;
+ cur0Y = cur1Y;
+ }
+ }
+ }
+ // 6 km wind barb
+ barb.clear();
+ barb = WindBarbFactory.getWindGraphics((double) nsharpNative.nsharpLib
+ .iwspd(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(6000))), (double) nsharpNative.nsharpLib
+ .iwdir(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(6000))));
+ if (barb != null) {
+ WindBarbFactory.scaleBarb(barb, barbScaleF);
+
+ double cur0X = wbToken, cur0Y = yOri, cur1X = wbToken, cur1Y = yOri, newY = 0;
+ WindBarbFactory.translateBarb(barb, cur0X, yOri);
+
+ for (LineStroke stroke : barb) {
+ Coordinate point = stroke.getPoint();
+ // Chin NOte; when using WindBarbFactory.getWindGraphics() to
+ // create barb, the Y axis is growing
+ // upwards. However, on this canvas, Y axis is growing
+ // downwards. Therefore, the following Y coordinate
+ // adjustment is necessary.
+ newY = yOri - (point.y - yOri);
+ //
+ // Note: stroke.render(gc, relativeX, relativeY) is not working
+ // here. Therefore, need to
+ // draw wind barb ourself.
+ if (stroke.getType() == "M") {
+ cur0X = point.x;
+ cur0Y = newY;
+ } else if (stroke.getType() == "D") {
+ cur1X = point.x;
+ cur1Y = newY;
+ target.drawLine(cur0X, cur0Y, 0.0, cur1X, cur1Y, 0.0,
+ NsharpConstants.color_cyan, 1);
+ // bsteffen added these two lines to fix 50 kts wind barbs
+ cur0X = cur1X;
+ cur0Y = cur1Y;
+ }
+ }
+ }
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel3(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
String splitedStr[];
String textStr;
curY = rect.y;
- //Chin's NOTE::::this function is coded based on native nsharp show_parcel() in xwvid3.c
+ // Chin's NOTE::::this function is coded based on native nsharp
+ // show_parcel() in xwvid3.c
// moved from NsharpPaletteWindow.showParcelData()
-
- //if we can not Interpolates a temp with 700 mb pressure, then we dont have enough raw data
- if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0)
- return;
- String title = NsharpNativeConstants.PARCEL_DATA_STR;
-
- target.drawString(myfont, title, rect.x + rect.width /3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
-
- String hdrStr;
- //short currentParcel;
- float layerPressure = 0;;
- //get user selected parcel type
- hdrStr = NsharpNativeConstants.parcelToHdrStrMap.get(currentParcel);
- layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
- if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED ){
- layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
- hdrStr = String.format(hdrStr, layerPressure);
- }
- curY = curY + charHeight;
- target.drawString(myfont, hdrStr, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
+ // if we can not Interpolates a temp with 700 mb pressure, then we dont
+ // have enough raw data
+ if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0)
+ return;
+ String title = NsharpNativeConstants.PARCEL_DATA_STR;
- //call native define_parcel() with parcel type and user defined pressure (if user defined it)
- nsharpNative.nsharpLib.define_parcel(currentParcel,layerPressure);
+ target.drawString(myfont, title, rect.x + rect.width / 3, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_cyan,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
- _lplvalues lpvls = new _lplvalues();
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ String hdrStr;
+ // short currentParcel;
+ float layerPressure = 0;
+ ;
+ // get user selected parcel type
+ hdrStr = NsharpNativeConstants.parcelToHdrStrMap.get(currentParcel);
+ layerPressure = NsharpNativeConstants.parcelToLayerMap
+ .get(currentParcel);
+ if (currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED) {
+ layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
+ hdrStr = String.format(hdrStr, layerPressure);
+ }
+ curY = curY + charHeight;
+ target.drawString(myfont, hdrStr, rect.x + rect.width / 4, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_yellow,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
- float sfctemp, sfcdwpt, sfcpres;
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
-
- // get parcel data by calling native nsharp parcel() API. value is returned in pcl
- _parcel pcl = new _parcel();
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- textStr = NsharpNativeConstants.PARCEL_LPL_LINE_;
- textStr = String.format(textStr, (int)pcl.lplpres,(int)pcl.lpltemp,(int)pcl.lpldwpt,
- (int)nsharpNative.nsharpLib.ctof(pcl.lpltemp),(int)nsharpNative.nsharpLib.ctof(pcl.lpldwpt));
- // Chin: note: target.drawString does NOT handle formatted string. For example, "ABC\tabc" will be printed
- // as "ABCabc" So, we have to add '_' to separate each value when formatting String.
- // Then, use String.split() to have each value in a sub-string.
-
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- curY = curY + 2*charHeight;
+ // call native define_parcel() with parcel type and user defined
+ // pressure (if user defined it)
+ nsharpNative.nsharpLib.define_parcel(currentParcel, layerPressure);
- if(nsharpNative.nsharpLib.qc(pcl.bplus)==1){
- textStr = NsharpNativeConstants.PARCEL_CAPE_LINE;
- textStr = String.format(textStr,pcl.bplus);
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_CAPE_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ _lplvalues lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ _parcel pcl = new _parcel();
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+ textStr = NsharpNativeConstants.PARCEL_LPL_LINE_;
+ textStr = String.format(textStr, (int) pcl.lplpres, (int) pcl.lpltemp,
+ (int) pcl.lpldwpt,
+ (int) nsharpNative.nsharpLib.ctof(pcl.lpltemp),
+ (int) nsharpNative.nsharpLib.ctof(pcl.lpldwpt));
+ // Chin: note: target.drawString does NOT handle formatted string. For
+ // example, "ABC\tabc" will be printed
+ // as "ABCabc" So, we have to add '_' to separate each value when
+ // formatting String.
+ // Then, use String.split() to have each value in a sub-string.
+
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ curY = curY + 2 * charHeight;
+
+ if (nsharpNative.nsharpLib.qc(pcl.bplus) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_CAPE_LINE;
+ textStr = String.format(textStr, pcl.bplus);
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_CAPE_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- if(nsharpNative.nsharpLib.qc(pcl.li5)==1){
- textStr = NsharpNativeConstants.PARCEL_LI_LINE;
- textStr = String.format(textStr,pcl.li5);
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_LI_MISSING;
- }
- target.drawString(myfont, textStr, rect.x+rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ if (nsharpNative.nsharpLib.qc(pcl.li5) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_LI_LINE;
+ textStr = String.format(textStr, pcl.li5);
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_LI_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ if (nsharpNative.nsharpLib.qc(pcl.bfzl) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_BFZL_LINE;
+ textStr = String.format(textStr, pcl.bfzl);
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_BFZL_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- if(nsharpNative.nsharpLib.qc(pcl.bfzl)==1){
- textStr = NsharpNativeConstants.PARCEL_BFZL_LINE;
- textStr = String.format(textStr,pcl.bfzl);
- }
- else{
- textStr = NsharpNativeConstants.PARCEL_BFZL_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- if(nsharpNative.nsharpLib.qc(pcl.limax)==1){
- textStr = NsharpNativeConstants.PARCEL_LIMIN_LINE;
- textStr = String.format(textStr,pcl.limax,pcl.limaxpres);
- }
- else{
- textStr = NsharpNativeConstants.PARCEL_LIMIN_MISSING;
- }
- target.drawString(myfont, textStr, rect.x+rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- if(nsharpNative.nsharpLib.qc(pcl.bminus)==1){
- textStr = NsharpNativeConstants.PARCEL_CINH_LINE;
- textStr = String.format(textStr,pcl.bminus);
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_CINH_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ if (nsharpNative.nsharpLib.qc(pcl.limax) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_LIMIN_LINE;
+ textStr = String.format(textStr, pcl.limax, pcl.limaxpres);
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_LIMIN_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ if (nsharpNative.nsharpLib.qc(pcl.bminus) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_CINH_LINE;
+ textStr = String.format(textStr, pcl.bminus);
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_CINH_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- if(nsharpNative.nsharpLib.qc(pcl.cap)==1){
- textStr = NsharpNativeConstants.PARCEL_CAP_LINE;
- textStr = String.format(textStr, pcl.cap, pcl.cappres);
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_CAP_MISSING;
- }
- target.drawString(myfont, textStr, rect.x+rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + 2* charHeight;
-
+ if (nsharpNative.nsharpLib.qc(pcl.cap) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_CAP_LINE;
+ textStr = String.format(textStr, pcl.cap, pcl.cappres);
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_CAP_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + 2 * charHeight;
- textStr = NsharpNativeConstants.PARCEL_LEVEL_LINE_;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
-
- if(nsharpNative.nsharpLib.qc(pcl.lclpres)==1&&
- nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lclpres ))))==1 )
- {
- textStr = NsharpNativeConstants.PARCEL_LCL_LINE_;
- textStr = String.format(textStr,pcl.lclpres, nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lclpres ))));
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_LCL_MISSING_;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
+ textStr = NsharpNativeConstants.PARCEL_LEVEL_LINE_;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
- if(nsharpNative.nsharpLib.qc(pcl.lfcpres)==1 &&
- nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres ))))==1 &&
- nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(pcl.lfcpres ))==1)
- {
- textStr = NsharpNativeConstants.PARCEL_LFC_LINE_;
- textStr = String.format(textStr,pcl.lfcpres, nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres ))),
- nsharpNative.nsharpLib.itemp(pcl.lfcpres ));
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_LFC_MISSING_;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
+ if (nsharpNative.nsharpLib.qc(pcl.lclpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres)))) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_LCL_LINE_;
+ textStr = String.format(textStr, pcl.lclpres,
+ nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(pcl.lclpres))));
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_LCL_MISSING_;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
- if(nsharpNative.nsharpLib.qc(pcl.elpres) ==1&&
- nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.elpres )))) ==1&&
- nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(pcl.elpres ))==1)
- {
- textStr = NsharpNativeConstants.PARCEL_EL_LINE_;
- textStr = String.format(textStr,pcl.elpres, nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.elpres ))),
- nsharpNative.nsharpLib.itemp(pcl.elpres ));
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_EL_MISSING_;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
+ if (nsharpNative.nsharpLib.qc(pcl.lfcpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres)))) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .itemp(pcl.lfcpres)) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_LFC_LINE_;
+ textStr = String.format(textStr, pcl.lfcpres,
+ nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres))),
+ nsharpNative.nsharpLib.itemp(pcl.lfcpres));
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_LFC_MISSING_;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
- if(nsharpNative.nsharpLib.qc(pcl.mplpres)==1 &&
- nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.mplpres ))))==1 )
- {
- textStr = NsharpNativeConstants.PARCEL_MPL_LINE_;
- textStr = String.format(textStr,pcl.mplpres, nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.mplpres ))));
- }
- else {
- textStr = NsharpNativeConstants.PARCEL_MPL_MISSING_;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- //myfont.dispose();
+ if (nsharpNative.nsharpLib.qc(pcl.elpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.elpres)))) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .itemp(pcl.elpres)) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_EL_LINE_;
+ textStr = String.format(textStr, pcl.elpres, nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.elpres))), nsharpNative.nsharpLib
+ .itemp(pcl.elpres));
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_EL_MISSING_;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(pcl.mplpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.mplpres)))) == 1) {
+ textStr = NsharpNativeConstants.PARCEL_MPL_LINE_;
+ textStr = String.format(textStr, pcl.mplpres,
+ nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(pcl.mplpres))));
+ } else {
+ textStr = NsharpNativeConstants.PARCEL_MPL_MISSING_;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ // myfont.dispose();
}
- @SuppressWarnings("deprecation")
- private void drawPanel4(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String textStr;
- curY = rect.y;
- /*
- * Chin's NOTE::::this function is coded based on legacy native nsharp software show_thermoparms(),
- * show_moisture(),show_instability() in xwvid3.c
- *
- * Moved from NsharpPaletteWindow.showThermoparms()
- */
-
- target.drawString(myfont, NsharpNativeConstants.THERMO_DATA_STR, rect.x + rect.width /3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- target.drawString(myfont, NsharpNativeConstants.THERMO_MOISTURE_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.precip_water(fValue, -1.0F, -1.0F);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_PWATER_LINE;
- textStr = String.format(textStr,fValue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_PWATER_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.mean_relhum(fValue, -1.0F, -1.0F);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_MEANRH_LINE;
- textStr = String.format(textStr,fValue.getValue(),NsharpConstants.PERCENT_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_MEANRH_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.mean_mixratio(fValue, -1.0F, -1.0F);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_MEANW_LINE;
- textStr = String.format(textStr,fValue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_MEANW_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- fValue.setValue(0);
- fValue1.setValue(0);
- // get surface pressure (fValue1) before getting mean LRH value
- nsharpNative.nsharpLib.get_surface(fValue1, fValue2, fValue3); //fValue 2 and fValue3 are not of concern here
- nsharpNative.nsharpLib.mean_relhum( fValue, -1.0F, fValue1.getValue() - 150 );
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_MEANLRH_LINE;
- textStr = String.format(textStr,fValue.getValue(),NsharpConstants.PERCENT_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_MEANLRH_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.top_moistlyr(fValue);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_TOP_LINE;
- textStr = String.format(textStr,fValue.getValue(),nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(fValue.getValue()))));
- }
- else {
- textStr = NsharpNativeConstants.THERMO_TOP_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- //instability data--------------//
- //yellow and bold for parcel header
- target.drawString(myfont, NsharpNativeConstants.THERMO_INSTABILITY_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- fValue1.setValue(0);
-
- nsharpNative.nsharpLib.delta_t(fValue);
- nsharpNative.nsharpLib.lapse_rate( fValue1, 700.0F, 500.0F );
-
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1 && nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_700500mb_LINE;
- textStr = String.format(textStr,fValue.getValue(), fValue1.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_700500mb_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- fValue1.setValue(0);
-
- nsharpNative.nsharpLib.vert_tot(fValue);
- nsharpNative.nsharpLib.lapse_rate( fValue1, 850.0F, 500.0F );
-
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1 && nsharpNative.nsharpLib.qc(fValue1.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_850500mb_LINE;
- textStr = String.format(textStr,fValue.getValue(), fValue1.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_850500mb_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- //misc parameters data--------------//
- target.drawString(myfont, NsharpNativeConstants.THERMO_MISC_PARMS_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- fValue.setValue(0);
- fValue1.setValue(0);
- fValue2.setValue(0);
- nsharpNative.nsharpLib.t_totals(fValue, fValue1, fValue2);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_TOTAL_LINE;
- textStr = String.format(textStr,fValue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_TOTAL_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.k_index(fValue);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_KINDEX_LINE;
- textStr = String.format(textStr,fValue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_KINDEX_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- nsharpNative.nsharpLib.sweat_index(fValue);
- if(nsharpNative.nsharpLib.qc(fValue.getValue())==1) {
- textStr = NsharpNativeConstants.THERMO_SWEAT_LINE;
- textStr = String.format(textStr,fValue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.THERMO_SWEAT_MISSING;
- }
-
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- fValue.setValue(0);
- float maxTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib.max_temp( fValue, -1));
- if(nsharpNative.nsharpLib.qc(maxTempF)==1) {
- textStr = NsharpNativeConstants.THERMO_MAXT_LINE;
- textStr = String.format(textStr,maxTempF);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_MAXT_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- fValue.setValue(0);
- float theDiff = nsharpNative.nsharpLib.ThetaE_diff( fValue);
- if(nsharpNative.nsharpLib.qc(theDiff)==1) {
- textStr = NsharpNativeConstants.THERMO_THETAE_LINE;
- textStr = String.format(textStr,theDiff);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_THETAE_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- fValue.setValue(0);
- float conTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib.cnvtv_temp( fValue, -1));
- if(nsharpNative.nsharpLib.qc(conTempF)==1) {
- textStr = NsharpNativeConstants.THERMO_CONVT_LINE;
- textStr = String.format(textStr,conTempF);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_CONVT_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- fValue.setValue(0);
- float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.wb_lvl( 0, fValue ))));
- if(nsharpNative.nsharpLib.qc(wbzft)==1) {
- textStr = NsharpNativeConstants.THERMO_WBZ_LINE;
- textStr = String.format(textStr,wbzft);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_WBZ_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- fValue.setValue(0);
- float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.temp_lvl( 0, fValue ))));
- if(nsharpNative.nsharpLib.qc(fgzft)==1) {
- textStr = NsharpNativeConstants.THERMO_FGZ_LINE;
- textStr = String.format(textStr,fgzft);
- }
- else {
- textStr = NsharpNativeConstants.THERMO_FGZ_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- //myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel5(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
+ @SuppressWarnings("deprecation")
+ private void drawPanel4(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String splitedStr[];
+ // myfont = target.initializeFont(fontName, fontSize, null);
String textStr;
curY = rect.y;
-
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_gradient()
- * in xwvid3.c
- */
- FloatByReference Surfpressure= new FloatByReference(0);
- FloatByReference surfTemp= new FloatByReference(0);
- FloatByReference surfDewpt= new FloatByReference(0);
- target.drawString(myfont, NsharpNativeConstants.OPC_LOW_LEVEL_STR, rect.x + rect.width /3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- target.drawString(myfont, NsharpNativeConstants.OPC_SURFACE975_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- textStr = NsharpNativeConstants.OPC_LEVEL_LINE_;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
-
- float ht = nsharpNative.nsharpLib.ihght(975);
- if(ht == NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
- textStr = NsharpNativeConstants.OPC_975_LINE_MISSING_;
- else{
- textStr = NsharpNativeConstants.OPC_975_LINE_;
- textStr = String.format(textStr, nsharpNative.nsharpLib.ihght(975), nsharpNative.nsharpLib.itemp(975));
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- ht=0;
- // get surface pressure (fValue1), Surface_temp (fValue2)
- nsharpNative.nsharpLib.get_surface(Surfpressure, surfTemp, surfDewpt);
- if(nsharpNative.nsharpLib.qc(Surfpressure.getValue())==1)
- ht = nsharpNative.nsharpLib.ihght( Surfpressure.getValue() );
- if(nsharpNative.nsharpLib.qc(Surfpressure.getValue())==1 && nsharpNative.nsharpLib.qc(surfTemp.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_SURFACE_LINE_;
- textStr = String.format(textStr,Surfpressure.getValue(), ht,surfTemp.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_SURFACE_MISSING_;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy native nsharp
+ * software show_thermoparms(), show_moisture(),show_instability() in
+ * xwvid3.c
+ *
+ * Moved from NsharpPaletteWindow.showThermoparms()
+ */
- /* ----- Sfc-975 Grad ----- */
- /* make sure both 975mb layer and surface layer temperatures are available */
- if(nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(975))==1 && nsharpNative.nsharpLib.qc(surfTemp.getValue())==1){
- textStr = NsharpNativeConstants.OPC_975_SURFACE_LINE;
- textStr = String.format(textStr,nsharpNative.nsharpLib.itemp(975)-surfTemp.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_975_SURFACE_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ target.drawString(myfont, NsharpNativeConstants.THERMO_DATA_STR, rect.x
+ + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_inversion()
- * in xwvid3.c
- *
- * inv_mb - Pressure of inversion level (mb)
- * inv_dC - Change in temperature (C)
- *
- */
- FloatByReference inv_mb= new FloatByReference(0);
- FloatByReference inv_dC= new FloatByReference(0);
- ;
- //yellow and bold for parcel header
- target.drawString(myfont, NsharpNativeConstants.OPC_LOWEST_INV_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + 2* charHeight;
- nsharpNative.nsharpLib.low_inv(inv_mb, inv_dC);
- if(nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.ihght(inv_mb.getValue()))==1) {
- textStr = NsharpNativeConstants.OPC_BASEHEIGHT_LINE;
- textStr = String.format(textStr,nsharpNative.nsharpLib.ihght(inv_mb.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.OPC_BASEHEIGHT_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ curY = curY + charHeight;
+ target.drawString(myfont, NsharpNativeConstants.THERMO_MOISTURE_STR,
+ rect.x + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- curY = curY + charHeight;
+ curY = curY + charHeight;
- if(nsharpNative.nsharpLib.qc(inv_mb.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_BASEPRESSURE_LINE;
- textStr = String.format(textStr,inv_mb.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_BASEPRESSURE_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(inv_dC.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_CHANGE_IN_TEMP_LINE;
- textStr = String.format(textStr,inv_dC.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_CHANGE_IN_TEMP_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
-
- //myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel6(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String splitedStr[];
- String textStr;
- curY = rect.y;
-
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_mixheight()
- * in xwvid3.c
- * Calculates the mixing height using legacy mix_height()
- *
- * void mix_height ( float *mh_mb, float *mh_drct, float *mh_sped,
- * float *mh_dC, float *mh_lr, float *mh_drct_max,
- * float *mh_sped_max, short flag )
- *
- * Where:
- * flag = 0 Surface-based lapse rate
- * flag = 1 Layer-based lapse rate
- *
- * mh_mb - Pressure at mixing height (mb)
- * mh_drct - Wind direction at mixing height (deg)
- * mh_sped - Wind speed at mixing height (kt)
- * mh_dC - Layer change in temperature (C)
- * mh_lr - Layer lapse rate (C/km)
- * mh_drct_max - Layer maximum wind direction (deg)
- * mh_sped_max - Layer maximum wind speed (kt)
- */
- FloatByReference mh_mb= new FloatByReference(0);
- FloatByReference mh_drct= new FloatByReference(0);
- FloatByReference mh_sped= new FloatByReference(0);
- FloatByReference mh_dC= new FloatByReference(0);
- FloatByReference mh_lr= new FloatByReference(0);
- FloatByReference mh_drct_max= new FloatByReference(0);
- FloatByReference mh_sped_max= new FloatByReference(0);
- short flag;
-
- //yellow and bold for parcel header
- target.drawString(myfont, NsharpNativeConstants.OPC_MIXING_HGT_STR, rect.x + rect.width /10, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- textStr = NsharpNativeConstants.OPC_DRY_AD_LINE;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- textStr = NsharpNativeConstants.OPC_THRESH_LAPSE_LINE;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- // Cyan color for Layer Based string
- target.drawString(myfont, NsharpNativeConstants.OPC_LAYER_BASED_STR, rect.x + rect.width /3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- // calculate Layer-based lapse rate data
- flag = 1;
- nsharpNative.nsharpLib.mix_height(mh_mb,mh_drct,mh_sped,mh_dC,mh_lr,mh_drct_max,mh_sped_max,flag);
-
- if(nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.ihght(mh_mb.getValue()))==1) {
- textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_LINE;
- textStr = String.format(textStr,nsharpNative.nsharpLib.ihght(mh_mb.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_mb.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_LINE;
- textStr = String.format(textStr,mh_mb.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_drct.getValue())==1 && nsharpNative.nsharpLib.qc(mh_sped.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_LINE;
- //System.out.println("speed = " + mh_sped.getValue());
- textStr = String.format(textStr,(int)mh_drct.getValue(),NsharpConstants.DEGREE_SYMBOL,(int)(mh_sped.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_drct_max.getValue()) ==1 && nsharpNative.nsharpLib.qc(mh_sped_max.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_LINE;
- textStr = String.format(textStr,(int)mh_drct_max.getValue(),NsharpConstants.DEGREE_SYMBOL,(int)mh_sped_max.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_dC.getValue()) ==1 && nsharpNative.nsharpLib.qc(mh_lr.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_LINE;
- textStr = String.format(textStr,mh_dC.getValue(),mh_lr.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
-
- // Purple color for Layer Based string
- target.drawString(myfont, NsharpNativeConstants.OPC_SURFACE_BASED_STR, rect.x + rect.width /3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_violet, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- // calculate Surface-based lapse rate data
- flag = 0;
- mh_mb.setValue(0);
- mh_drct.setValue(0);
- mh_sped.setValue(0);
- mh_dC.setValue(0);
- mh_lr.setValue(0);
- mh_drct_max.setValue(0);
- mh_sped_max.setValue(0);;
- nsharpNative.nsharpLib.mix_height(mh_mb,mh_drct,mh_sped,mh_dC,mh_lr,mh_drct_max,mh_sped_max,flag);
-
- //white color for text
- if(nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.ihght(mh_mb.getValue()))==1) {
- textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_LINE;
- textStr = String.format(textStr,nsharpNative.nsharpLib.ihght(mh_mb.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_mb.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_LINE;
- textStr = String.format(textStr,mh_mb.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_drct.getValue()) == 1 && nsharpNative.nsharpLib.qc(mh_sped.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_LINE;
- textStr = String.format(textStr,(int)mh_drct.getValue(),NsharpConstants.DEGREE_SYMBOL,(int)mh_sped.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_drct_max.getValue()) ==1 && nsharpNative.nsharpLib.qc(mh_sped_max.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_LINE;
- textStr = String.format(textStr,(int)mh_drct_max.getValue(),NsharpConstants.DEGREE_SYMBOL,(int)mh_sped_max.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- if(nsharpNative.nsharpLib.qc(mh_dC.getValue())==1 && nsharpNative.nsharpLib.qc(mh_lr.getValue())==1) {
- textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_LINE;
- textStr = String.format(textStr,mh_dC.getValue(),mh_lr.getValue());
- }
- else {
- textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- //myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel7(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String splitedStr[];
- String textStr;
- curY = rect.y;
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_srdata() in xwvid3.c.
- * Hard coded numerical numbers are directly copied from it.
- *
- * float helicity ( float lower, float upper, float sdir, float sspd,
- * float *phel, float *nhel )
- * Calculates the storm-relative helicity (m2/s2) of a
- * layer from LOWER(m, agl) to UPPER(m, agl). Uses the
- * storm motion vector (sdir, sspd).
- *
- * lower - Bottom level of layer (m, AGL)[-1=LPL]
- * upper - Top level of layer (m, AGL) [-1=LFC]
- * sdir - Storm motion direction (degrees)
- * sspd - Storm motion speed (kt)
- * phel - Positive helicity in layer (m2/s2)
- * nhel - Negative helicity in layer (m2/s2)
- * RETURN VALUE - Total helicity (m2/s2)
- *
- * void sr_wind ( float pbot, float ptop, float sdir, float sspd,
- * float *mnu, float *mnv, float *wdir, float *wspd )
- * Calculates a pressure-weighted SR mean wind thru the
- * layer (pbot-ptop). Default layer is LFC-EL.
- * pbot - Bottom level of layer (mb)
- * ptop - Top level of layer (mb)
- * sdir - Storm motion dirction (deg)
- * sspd - Storm motion speed (kt)
- * mnu - U-Component of mean wind (kt)
- * mnv - V-Component of mean wind (kt) /
- */
-
- //FloatByReference sspd= new FloatByReference(0);
- //FloatByReference sdir= new FloatByReference(0);
- FloatByReference phel= new FloatByReference(0);
- FloatByReference nhel= new FloatByReference(0);
- FloatByReference mnu= new FloatByReference(0);
- FloatByReference mnv= new FloatByReference(0);
- FloatByReference smdir= new FloatByReference(0);
- FloatByReference smspd= new FloatByReference(0);
- FloatByReference wdir= new FloatByReference(0);
- FloatByReference wspd= new FloatByReference(0);
- float totHeli;
-
- target.drawString(myfont, NsharpNativeConstants.STORM_RELATIVE_STR, rect.x + rect.width /3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- nsharpNative.nsharpLib.get_storm(smspd, smdir);
-
- if(nsharpNative.nsharpLib.qc(smspd.getValue()) == 1 && nsharpNative.nsharpLib.qc(smdir.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_MOTION_LINE;
- textStr = String.format(textStr,smdir.getValue(),NsharpConstants.DEGREE_SYMBOL,
- smspd.getValue(), nsharpNative.nsharpLib.kt_to_mps(smspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.STORM_MOTION_MISSING;
- }
- target.drawString(myfont, textStr, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //yellow and bold for parcel header
- target.drawString(myfont, NsharpNativeConstants.STORM_HELICITY_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- textStr = NsharpNativeConstants.STORM_LAYER_POS_STR;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
-
- //calculate helicity for sfc-2 km
- totHeli = nsharpNative.nsharpLib.helicity( (float)0, (float)2000, smdir.getValue(), smspd.getValue(), phel, nhel);
- if(nsharpNative.nsharpLib.qc(phel.getValue()) ==1 && nsharpNative.nsharpLib.qc(nhel.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_SFC2KM_LINE;
- textStr = String.format(textStr,phel.getValue(), nhel.getValue(), totHeli,
- NsharpConstants.SQUARE_SYMBOL, NsharpConstants.SQUARE_SYMBOL);
-
- }
- else {
- textStr = NsharpNativeConstants.STORM_SFC2KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- //calculate helicity for sfc-3 km
- totHeli = nsharpNative.nsharpLib.helicity( (float)0, (float)3000, smdir.getValue(), smspd.getValue(), phel, nhel);
- if(nsharpNative.nsharpLib.qc(phel.getValue()) == 1 && nsharpNative.nsharpLib.qc(nhel.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_SFC3KM_LINE;
- textStr = String.format(textStr,phel.getValue(), nhel.getValue(), totHeli,
- NsharpConstants.SQUARE_SYMBOL, NsharpConstants.SQUARE_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.STORM_SFC3KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- //calculate helicity for LPL - LFC
- totHeli = nsharpNative.nsharpLib.helicity( (float)-1, (float)-1, smdir.getValue(), smspd.getValue(), phel, nhel);
- if(nsharpNative.nsharpLib.qc(phel.getValue())==1 && nsharpNative.nsharpLib.qc(nhel.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_LPL_LFC_LINE;
- textStr = String.format(textStr,phel.getValue(), nhel.getValue(), totHeli,
- NsharpConstants.SQUARE_SYMBOL, NsharpConstants.SQUARE_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.STORM_LPL_LFC_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- //yellow and bold for header
- target.drawString(myfont, NsharpNativeConstants.STORM_WIND_STR, rect.x + rect.width /4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + 2* charHeight;
- textStr = NsharpNativeConstants.STORM_LAYER_VECTOR_STR;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
-
- //calculate pressure-weighted SR mean wind at sfc-2 km
- nsharpNative.nsharpLib.sr_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)),
- nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(2000)), smdir.getValue(), smspd.getValue(),
- mnu, mnv, wdir, wspd);
- if(nsharpNative.nsharpLib.qc(wdir.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_SFC2KM_VECT_LINE;
- textStr = String.format(textStr,wdir.getValue(), wspd.getValue(), nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.STORM_SFC2KM_VECT_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //calculate pressure-weighted SR mean wind at 4-6 km
- //System.out.println("msl(4000))="+ nsharpNative.nsharpLib.msl(4000) + "i_pres(msl(4000))" + nsharpNative.nsharpLib.i_pres(nsharpNative.nsharpLib.msl(4000)));
- //System.out.println("msl(6000))="+ nsharpNative.nsharpLib.msl(6000) + "i_pres(msl(6000))" + nsharpNative.nsharpLib.i_pres(nsharpNative.nsharpLib.msl(6000)));
- //System.out.println("dir "+ smdir.getValue()+ " spd " + smspd.getValue());
- nsharpNative.nsharpLib.sr_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(4000)),
- nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)), smdir.getValue(), smspd.getValue(),
- mnu, mnv, wdir, wspd);
- if(nsharpNative.nsharpLib.qc(wdir.getValue()) == 1) {
- textStr = NsharpNativeConstants.STORM_4_6KM_VECT_LINE;
- //System.out.println("wdir "+ wdir.getValue() + " widSp " + wspd.getValue());
- textStr = String.format(textStr,wdir.getValue(), wspd.getValue(), nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.STORM_4_6KM_VECT_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //calculate pressure-weighted SR mean wind at 9-11 km
- nsharpNative.nsharpLib.sr_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(9000)),
- nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(11000)), smdir.getValue(), smspd.getValue(),
- mnu, mnv, wdir, wspd);
- if(nsharpNative.nsharpLib.qc(wdir.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_9_11KM_VECT_LINE;
- textStr = String.format(textStr,wdir.getValue(), wspd.getValue(), nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.STORM_9_11KM_VECT_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel8(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String splitedStr[];
- String textStr;
- curY = rect.y;
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_meanwind()
- * in xwvid3.c
- *
- * void mean_wind ( float pbot, float ptop, float *mnu, float *mnv,
- * float *wdir, float *wspd )
- * Calculates a pressure-weighted mean wind thru the
- * layer (pbot-ptop). Default layer is LFC-EL.
- *
- * pbot - Bottom level of layer (mb)
- * ptop - Top level of layer (mb)
- * mnu - U-Component of mean wind (kt)
- * mnv - V-Component of mean wind (kt)
- */
- FloatByReference mnu= new FloatByReference(0);
- FloatByReference mnv= new FloatByReference(0);
- FloatByReference wdir= new FloatByReference(0);
- FloatByReference wspd= new FloatByReference(0);
- target.drawString(myfont, NsharpNativeConstants.MEAN_WIND_STR, rect.x + rect.width*0.4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //fix TT 549890
- //Calculate mean wind at 0-6 km, following the same algorithm used in drawPanel2() at BigNsharp page 2.
- //Like this : mean_wind(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)))
- nsharpNative.nsharpLib.mean_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)), mnu, mnv, wdir, wspd);
- //this line was nsharpNative.nsharpLib.mean_wind( -1, nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.agl(6000)), mnu, mnv, wdir, wspd);
- //System.out.println("wsp ="+ wspd.getValue()+ " wdir "+ wdir.getValue() + " agl(6000)="+nsharpNative.nsharpLib.agl(6000)+ " preAt6000="+nsharpNative.nsharpLib.i_pres(nsharpNative.nsharpLib.agl(6000)));
- if(nsharpNative.nsharpLib.qc(wdir.getValue()) == 1 && nsharpNative.nsharpLib.qc(wspd.getValue())== 1) {
- textStr = NsharpNativeConstants.MEANWIND_SFC6KM_LINE;
- textStr = String.format(textStr,(wdir.getValue()), wspd.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.MEANWIND_SFC6KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
-
-
- //fix TT 549890
- //Calculate mean wind at LFC-EL, following the same algorithm used in drawPanel2() for LCL_EL for BigNsharp pag
- // Replacing LCL with LFC
- _lplvalues lpvls;
- _parcel pcl;
- lpvls = new _lplvalues();
- pcl = new _parcel();
- float h1, h2;
- h1=-1;
- h2=-1;
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
-
- float sfctemp = lpvls.temp;
- float sfcdwpt = lpvls.dwpt;
- float sfcpres = lpvls.pres;
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- if (pcl.bplus > 0)
- {
- h1 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres));
- h2 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.elpres));
- }
-
- //Calculate mean wind at LFC-EL
- nsharpNative.nsharpLib.mean_wind( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)), mnu, mnv, wdir, wspd);
- if(nsharpNative.nsharpLib.qc(wdir.getValue())==1 && nsharpNative.nsharpLib.qc(wspd.getValue())==1) {
- textStr = NsharpNativeConstants.MEANWIND_LFC_EL_LINE;
- textStr = String.format(textStr,wdir.getValue(), wspd.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.MEANWIND_LFC_EL_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- //Calculate mean wind at 850-200 mb
- nsharpNative.nsharpLib.mean_wind( 850,200, mnu, mnv, wdir, wspd);
- if(nsharpNative.nsharpLib.qc(wdir.getValue()) ==1 && nsharpNative.nsharpLib.qc(wspd.getValue())==1) {
- textStr = NsharpNativeConstants.MEANWIND_850_200MB_LINE;
- textStr = String.format(textStr,wdir.getValue(), wspd.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.MEANWIND_850_200MB_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_shear()
- * in xwvid3.c
- *
- * void wind_shear ( float pbot, float ptop, float *shu, float *shv,
- * float *sdir, float *smag )
- *
- * Calculates the shear between the wind at (pbot) and
- * (ptop). Default lower wind is a 1km mean wind, while
- * the default upper layer is 3km.
- *
- * pbot - Bottom level of layer (mb)
- * ptop - Top level of layer (mb)
- * shu - U-Component of shear (m/s)
- * shv - V-Component of shear (m/s)
- * sdir - Direction of shear vector (degrees)
- * smag - Magnitude of shear vector (m/s)
- */
- FloatByReference shu= new FloatByReference(0);
- FloatByReference shv= new FloatByReference(0);
- FloatByReference sdir= new FloatByReference(0);
- FloatByReference smag= new FloatByReference(0);
- target.drawString(myfont, NsharpNativeConstants.ENVIRONMENTAL_SHEAR_STR, rect.x + rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
-
- textStr = NsharpNativeConstants.SHEAR_LAYER_DELTA_STR;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
- target.drawLine(rect.x, curY, 0.0, rect.x+rect.width, curY, 0.0, NsharpConstants.color_white, 1);
-
- //Calculate wind shear at Low - 3 km
- nsharpNative.nsharpLib.wind_shear( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(3000)),
- shu,shv,sdir,smag);
- if(nsharpNative.nsharpLib.qc(smag.getValue())==1) {
- textStr = NsharpNativeConstants.SHEAR_LOW_3KM_LINE;
- textStr = String.format(textStr,smag.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue())/.3F);
- //System.out.println("from cave "+smag.getValue() + " kt, " + nsharpNative.nsharpLib.kt_to_mps(smag.getValue())+ " m/s, Tot="+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue())/.3F);
- }
- else {
- textStr = NsharpNativeConstants.SHEAR_LOW_3KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //Calculate wind shear at Sfc - 2 km
- nsharpNative.nsharpLib.wind_shear( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(2000)),
- shu,shv,sdir,smag);
- if(nsharpNative.nsharpLib.qc(smag.getValue())==1) {
- textStr = NsharpNativeConstants.SHEAR_SFC_2KM_LINE;
- textStr = String.format(textStr,smag.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue())/.2F);
- }
- else {
- textStr = NsharpNativeConstants.SHEAR_SFC_2KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //Calculate wind shear at Sfc - 6 km
- nsharpNative.nsharpLib.wind_shear( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)),
- shu,shv,sdir,smag);
- if(nsharpNative.nsharpLib.qc(smag.getValue())==1) {
- textStr = NsharpNativeConstants.SHEAR_SFC_6KM_LINE;
- textStr = String.format(textStr,smag.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue())/.6F);
- }
- else {
- textStr = NsharpNativeConstants.SHEAR_SFC_6KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //Calculate wind shear at Sfc - 12 km
- nsharpNative.nsharpLib.wind_shear( nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)), nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(12000)),
- shu,shv,sdir,smag);
- if(nsharpNative.nsharpLib.qc(smag.getValue())==1) {
- textStr = NsharpNativeConstants.SHEAR_SFC_12KM_LINE;
- textStr = String.format(textStr,smag.getValue(),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
- nsharpNative.nsharpLib.kt_to_mps(smag.getValue())/1.2F);
- }
- else {
- textStr = NsharpNativeConstants.SHEAR_SFC_12KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- //myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel9(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String splitedStr[];
- String textStr;
- curY = rect.y;
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_initiation(): Displays thunderstorm initiation parameters,
- * show_heavypcpn(), show_preciptype() and show_stormtype()
- * in xwvid3.c
- *
- */
- FloatByReference fvalue2= new FloatByReference(0);
- FloatByReference fvalue3= new FloatByReference(0);
- FloatByReference wdir= new FloatByReference(0);
- FloatByReference wspd= new FloatByReference(0);
- FloatByReference fvalue= new FloatByReference(0);
- FloatByReference fvalue1= new FloatByReference(0);
- // get parcel data by calling native nsharp parcel() API. value is returned in pcl
- // current parcel is already decided when page 1 is displyed. Note that page 1 is always
- // displayed before this page (page 4). Therefore, we dont have to call define_parcel() again.
- // set default
- //short currentParcel;
- float layerPressure;
- if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED ){
- layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
- }
- else
- layerPressure = NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
- nsharpNative.nsharpLib.define_parcel(currentParcel,layerPressure);
-
-
- _parcel pcl = new _parcel();;
- _lplvalues lpvls = new _lplvalues();
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
- float sfctemp, sfcdwpt, sfcpres;
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- //_parcel.ByValue pcl_byvalue = new _parcel.ByValue();
- //nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl_byvalue);
-
-
- //CONVECTIVE_INITIATION
- target.drawString(myfont, NsharpNativeConstants.CONVECTIVE_INITIATION_STR, rect.x + rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- //CINH
- if(nsharpNative.nsharpLib.qc(pcl.bminus)==1) {
- textStr = NsharpNativeConstants.CONVECTIVE_CINH_LINE;
- textStr = String.format(textStr,pcl.bminus);
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_CINH_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //cap
- if(nsharpNative.nsharpLib.qc(pcl.cap)==1 && nsharpNative.nsharpLib.qc(pcl.cappres)==1) {
- textStr = NsharpNativeConstants.CONVECTIVE_CAP_LINE;
- textStr = String.format(textStr,pcl.cap, pcl.cappres);
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_CAP_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //K-index
- nsharpNative.nsharpLib.k_index(fvalue);
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- textStr = NsharpNativeConstants.CONVECTIVE_KINDEX_LINE;
- textStr = String.format(textStr,fvalue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_KINDEX_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //Mean RH
- nsharpNative.nsharpLib.mean_relhum(fvalue, -1, -1);
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- textStr = NsharpNativeConstants.CONVECTIVE_MEANRH_LINE;
- textStr = String.format(textStr,fvalue.getValue(), NsharpConstants.PERCENT_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_MEANRH_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + 2*charHeight;
-
- //Top of M layer
- nsharpNative.nsharpLib.top_moistlyr(fvalue);
- //System.out.println("top_moistlyr=" + fvalue.getValue() );
-
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- float ht =
- nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(fvalue.getValue())));
- if(nsharpNative.nsharpLib.qc(ht)==1){
- textStr = NsharpNativeConstants.CONVECTIVE_TOP_LINE;
- textStr = String.format(textStr,fvalue.getValue(),ht);
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_TOP_MISSING;
- }
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_TOP_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- //LFC height
- if(nsharpNative.nsharpLib.qc(pcl.lfcpres)==1) {
- float ht =
- nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres)));
- if(nsharpNative.nsharpLib.qc(ht)==1){
- textStr = NsharpNativeConstants.CONVECTIVE_LFC_LINE;
- textStr = String.format(textStr,pcl.lfcpres,ht);
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_LFC_MISSING;
- }
- }
- else {
- textStr = NsharpNativeConstants.CONVECTIVE_LFC_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //STORM TYPE
- target.drawString(myfont, NsharpNativeConstants.STORM_TYPE_STR, rect.x + rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //CAPE
- if(nsharpNative.nsharpLib.qc(pcl.bplus)==1) {
- textStr = NsharpNativeConstants.STORM_TYPE_CAPE_LINE;
- textStr = String.format(textStr,pcl.bplus);
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_CAPE_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //EFF. SREH
- float hel=0;
- nsharpNative.nsharpLib.get_storm(wspd,wdir);
- if(nsharpNative.nsharpLib.qc(wdir.getValue()) ==1 && nsharpNative.nsharpLib.qc(wspd.getValue())==1) {
- hel =
- nsharpNative.nsharpLib.helicity( -1.0F, -1.0F, wdir.getValue(), wspd.getValue(), fvalue, fvalue1);
- if(nsharpNative.nsharpLib.qc(hel)==1){
- textStr = NsharpNativeConstants.STORM_TYPE_EFF_LINE;
- textStr = String.format(textStr,hel,NsharpConstants.SQUARE_SYMBOL,NsharpConstants.SQUARE_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_EFF_MISSING;
- }
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_EFF_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //EHI
- if(nsharpNative.nsharpLib.qc(pcl.bplus)==1) {
- float ehi =
- nsharpNative.nsharpLib.ehi( pcl.bplus, hel);
- if(nsharpNative.nsharpLib.qc(ehi)==1){
- textStr = NsharpNativeConstants.STORM_TYPE_EHI_LINE;
- textStr = String.format(textStr,ehi);
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_EHI_MISSING;
- }
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_EHI_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //3km Shear
- nsharpNative.nsharpLib.wind_shear( -1, -1, fvalue, fvalue1,fvalue2,fvalue3);
- if(nsharpNative.nsharpLib.qc(fvalue3.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_TYPE_3KM_LINE;
- textStr = String.format(textStr,nsharpNative.nsharpLib.kt_to_mps(fvalue3.getValue()));
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_3KM_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //BRN
- if(nsharpNative.nsharpLib.qc(pcl.brn)==1) {
- textStr = NsharpNativeConstants.STORM_TYPE_BRN_LINE;
- textStr = String.format(textStr,pcl.brn);
- }
- else {
- textStr = NsharpNativeConstants.STORM_TYPE_BRN_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //BRN Shear
- //nsharpNative.nsharpLib.cave_bulk_rich(pcl.lplpres, pcl.bplus, fvalue );
- //System.out.println("bulk_rich fvalue = "+ fvalue.getValue());
- nsharpNative.nsharpLib.cave_bulk_rich2(fvalue );
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- textStr = NsharpNativeConstants.STORM_TYPE_BRNSHEAR_LINE;
- textStr = String.format(textStr,fvalue.getValue(),NsharpConstants.SQUARE_SYMBOL, NsharpConstants.SQUARE_SYMBOL);
- }
- else
- textStr = NsharpNativeConstants.STORM_TYPE_BRNSHEAR_MISSING;
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //PRECIPITATION_TYPE
- target.drawString(myfont, NsharpNativeConstants.PRECIPITATION_TYPE_STR, rect.x + rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //Melting Level
- float web = nsharpNative.nsharpLib.wb_lvl( 0, fvalue );
- if(nsharpNative.nsharpLib.qc(web)==1) {
-
- float aglft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(web)));
- if(nsharpNative.nsharpLib.qc(aglft)==1){
- textStr = NsharpNativeConstants.PRECIPITATION_MELTING_LINE;
- textStr = String.format(textStr,aglft, web);
- }
- else
- textStr = NsharpNativeConstants.PRECIPITATION_MELTING_MISSING;
- }
- else {
- textStr = NsharpNativeConstants.PRECIPITATION_MELTING_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- //HEAVY_RAINFAL
- target.drawString(myfont, NsharpNativeConstants.HEAVY_RAINFALL_STR, rect.x + rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //Rogash_QPF, Chin: note: BigNsharp has different implementation of Rogash_QPF()
- // We are using bigNsharp now.
- nsharpNative.nsharpLib.Rogash_QPF(fvalue);
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- textStr = NsharpNativeConstants.HEAVY_ROGASH_LINE;
- textStr = String.format(textStr,fvalue.getValue());
- }
- else {
- textStr = NsharpNativeConstants.HEAVY_ROGASH_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- // myfont.dispose();
- }
- @SuppressWarnings("deprecation")
- private void drawPanel10(IGraphicsTarget target,Rectangle rect)
- throws VizException {
- extent = new PixelExtent(rect);
- target.setupClippingPlane(extent);
- //myfont = target.initializeFont(fontName, fontSize, null);
- String splitedStr[];
- String textStr;
- curY = rect.y;
- /*
- * Chin's NOTE::::this function is coded based on legacy nsharp software
- * show_hailpot(), show_torpot()
- * in xwvid3.c
- *
- */
- FloatByReference fvalue2= new FloatByReference(0);
- FloatByReference fvalue3= new FloatByReference(0);
- FloatByReference wdir= new FloatByReference(0);
- FloatByReference wspd= new FloatByReference(0);
- FloatByReference fvalue= new FloatByReference(0);
- FloatByReference fvalue1= new FloatByReference(0);
-
- target.drawString(myfont, NsharpNativeConstants.SEVERE_POTENTIAL_STR, rect.x + rect.width/3, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- target.drawString(myfont, NsharpNativeConstants.SEVERE_HAIL_POTENTIAL_STR, rect.x + rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- _parcel pcl = new _parcel();;
- _lplvalues lpvls = new _lplvalues();
- nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
- float sfctemp, sfcdwpt, sfcpres;
- sfctemp = lpvls.temp;
- sfcdwpt = lpvls.dwpt;
- sfcpres = lpvls.pres;
- nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl);
- //CAPE
- if(nsharpNative.nsharpLib.qc(pcl.bplus)==1) {
- textStr = NsharpNativeConstants.SEVERE_CAPE_LINE;
- textStr = String.format(textStr,pcl.bplus);
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_CAPE_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- // WBZ level
- float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.wb_lvl( 0, fvalue ))));
- if(nsharpNative.nsharpLib.qc(wbzft)==1) {
- textStr = NsharpNativeConstants.SEVERE_WBZ_LINE;
- textStr = String.format(textStr,wbzft);
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_WBZ_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //Mid Level RH
- nsharpNative.nsharpLib.mean_relhum( fvalue, 700, 500);
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_MIDRH_LINE;
- textStr = String.format(textStr,fvalue.getValue(),NsharpConstants.PERCENT_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_MIDSRW_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //FZG level
- float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.temp_lvl( 0, fvalue ))));
- if(nsharpNative.nsharpLib.qc(fgzft)==1) {
- textStr = NsharpNativeConstants.SEVERE_FGZ_LINE;
- textStr = String.format(textStr,fgzft);
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_FGZ_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //EL Storm
- nsharpNative.nsharpLib.get_storm(wspd,wdir);
- nsharpNative.nsharpLib.sr_wind( pcl.elpres+25, pcl.elpres-25,wdir.getValue(), wspd.getValue(), fvalue,fvalue1,fvalue2,fvalue3);
- if(nsharpNative.nsharpLib.qc(fvalue3.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_ELSTORM_LINE;
- textStr = String.format(textStr,fvalue3.getValue());
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_ELSTORM_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
- // CHI1
- //_parcel.ByValue pcl_byvalue = new _parcel.ByValue();
- // pr = nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt, pcl_byvalue);
- //Assigne values that needed for bulk_rich()
- //pcl_byvalue.lplpres = sfcpres;
- //pcl_byvalue.bplus = pcl.bplus;
- nsharpNative.nsharpLib.cave_bulk_rich2( fvalue );
- float rtn = (pcl.bplus * fvalue.getValue()) / nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib.wb_lvl( 0, fvalue1 )));
- if(nsharpNative.nsharpLib.qc(rtn)==1) {
- textStr = NsharpNativeConstants.SEVERE_CHI1_LINE;
- textStr = String.format(textStr,rtn);
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_CHI1_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- //CHI2
- nsharpNative.nsharpLib.Mean_WBtemp( fvalue2, -1, -1);
- if(nsharpNative.nsharpLib.qc(rtn/fvalue2.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_CHI2_LINE;
- textStr = String.format(textStr,rtn/fvalue2.getValue());
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_CHI2_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + rect.width/2+ i*rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- //Avg BL
- nsharpNative.nsharpLib.Mean_WBtemp( fvalue, -1, -1);
- if(nsharpNative.nsharpLib.qc(fvalue.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_AVGBL_LINE;
- textStr = String.format(textStr,fvalue.getValue(),NsharpConstants.DEGREE_SYMBOL);
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_AVGBL_MISSING;
- }
- target.drawString(myfont, textStr, rect.x, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //TORNADO_POTENTIAL
- target.drawString(myfont, NsharpNativeConstants.SEVERE_TORNADO_POTENTIAL_STR, rect.x + rect.width/4, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- curY = curY + charHeight;
-
- //Low SRW Sfc
- float blyr = nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0));
- float tlyr = pcl.lfcpres;
- if(tlyr > 0){
- nsharpNative.nsharpLib.sr_wind( blyr, tlyr, wdir.getValue(), wspd.getValue(), fvalue,fvalue1,fvalue2,fvalue3);
- if(nsharpNative.nsharpLib.qc(fvalue3.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_LOWSRWSFC_LINE;
- textStr = String.format(textStr,fvalue3.getValue());
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_LOWSRWSFC_MISSING;
- }
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_LOWSRWSFC_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- blyr = pcl.lfcpres;
- tlyr = nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.ihght(pcl.lfcpres) + 4000);
- if((tlyr > 0)&&(blyr > 0)) {
- nsharpNative.nsharpLib.sr_wind( blyr, tlyr, wdir.getValue(), wspd.getValue(), fvalue,fvalue1,fvalue2,fvalue3);
- if(nsharpNative.nsharpLib.qc(fvalue3.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_MIDSRW_LINE;
- textStr = String.format(textStr,fvalue3.getValue());
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_MIDSRW_MISSING;
- }
-
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.precip_water(fValue, -1.0F, -1.0F);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_PWATER_LINE;
+ textStr = String.format(textStr, fValue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_PWATER_MISSING;
}
- else {
- textStr = NsharpNativeConstants.SEVERE_MIDSRW_MISSING;
- }
- splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
- }
- curY = curY + charHeight;
-
- blyr = nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.ihght(pcl.elpres) - 4000);
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.mean_relhum(fValue, -1.0F, -1.0F);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_MEANRH_LINE;
+ textStr = String.format(textStr, fValue.getValue(),
+ NsharpConstants.PERCENT_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_MEANRH_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.mean_mixratio(fValue, -1.0F, -1.0F);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_MEANW_LINE;
+ textStr = String.format(textStr, fValue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_MEANW_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ fValue.setValue(0);
+ fValue1.setValue(0);
+ // get surface pressure (fValue1) before getting mean LRH value
+ nsharpNative.nsharpLib.get_surface(fValue1, fValue2, fValue3); // fValue
+ // 2 and
+ // fValue3
+ // are
+ // not of
+ // concern
+ // here
+ nsharpNative.nsharpLib.mean_relhum(fValue, -1.0F,
+ fValue1.getValue() - 150);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_MEANLRH_LINE;
+ textStr = String.format(textStr, fValue.getValue(),
+ NsharpConstants.PERCENT_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_MEANLRH_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.top_moistlyr(fValue);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_TOP_LINE;
+ textStr = String
+ .format(textStr, fValue.getValue(), nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(fValue
+ .getValue()))));
+ } else {
+ textStr = NsharpNativeConstants.THERMO_TOP_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // instability data--------------//
+ // yellow and bold for parcel header
+ target.drawString(myfont, NsharpNativeConstants.THERMO_INSTABILITY_STR,
+ rect.x + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ fValue1.setValue(0);
+
+ nsharpNative.nsharpLib.delta_t(fValue);
+ nsharpNative.nsharpLib.lapse_rate(fValue1, 700.0F, 500.0F);
+
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_700500mb_LINE;
+ textStr = String.format(textStr, fValue.getValue(),
+ fValue1.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_700500mb_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ fValue1.setValue(0);
+
+ nsharpNative.nsharpLib.vert_tot(fValue);
+ nsharpNative.nsharpLib.lapse_rate(fValue1, 850.0F, 500.0F);
+
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_850500mb_LINE;
+ textStr = String.format(textStr, fValue.getValue(),
+ fValue1.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_850500mb_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // misc parameters data--------------//
+ target.drawString(myfont, NsharpNativeConstants.THERMO_MISC_PARMS_STR,
+ rect.x + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ fValue1.setValue(0);
+ fValue2.setValue(0);
+ nsharpNative.nsharpLib.t_totals(fValue, fValue1, fValue2);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_TOTAL_LINE;
+ textStr = String.format(textStr, fValue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_TOTAL_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.k_index(fValue);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_KINDEX_LINE;
+ textStr = String.format(textStr, fValue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_KINDEX_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.sweat_index(fValue);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.THERMO_SWEAT_LINE;
+ textStr = String.format(textStr, fValue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.THERMO_SWEAT_MISSING;
+ }
+
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+
+ fValue.setValue(0);
+ float maxTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib
+ .max_temp(fValue, -1));
+ if (nsharpNative.nsharpLib.qc(maxTempF) == 1) {
+ textStr = NsharpNativeConstants.THERMO_MAXT_LINE;
+ textStr = String.format(textStr, maxTempF);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_MAXT_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ float theDiff = nsharpNative.nsharpLib.ThetaE_diff(fValue);
+ if (nsharpNative.nsharpLib.qc(theDiff) == 1) {
+ textStr = NsharpNativeConstants.THERMO_THETAE_LINE;
+ textStr = String.format(textStr, theDiff);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_THETAE_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ fValue.setValue(0);
+ float conTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib
+ .cnvtv_temp(fValue, -1));
+ if (nsharpNative.nsharpLib.qc(conTempF) == 1) {
+ textStr = NsharpNativeConstants.THERMO_CONVT_LINE;
+ textStr = String.format(textStr, conTempF);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_CONVT_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ fValue.setValue(0);
+ float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .wb_lvl(0, fValue))));
+ if (nsharpNative.nsharpLib.qc(wbzft) == 1) {
+ textStr = NsharpNativeConstants.THERMO_WBZ_LINE;
+ textStr = String.format(textStr, wbzft);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_WBZ_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ fValue.setValue(0);
+ float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .temp_lvl(0, fValue))));
+ if (nsharpNative.nsharpLib.qc(fgzft) == 1) {
+ textStr = NsharpNativeConstants.THERMO_FGZ_LINE;
+ textStr = String.format(textStr, fgzft);
+ } else {
+ textStr = NsharpNativeConstants.THERMO_FGZ_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 2, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel5(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
+ String splitedStr[];
+ String textStr;
+ curY = rect.y;
+
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_gradient() in xwvid3.c
+ */
+ FloatByReference Surfpressure = new FloatByReference(0);
+ FloatByReference surfTemp = new FloatByReference(0);
+ FloatByReference surfDewpt = new FloatByReference(0);
+ target.drawString(myfont, NsharpNativeConstants.OPC_LOW_LEVEL_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ target.drawString(myfont, NsharpNativeConstants.OPC_SURFACE975_STR,
+ rect.x + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ textStr = NsharpNativeConstants.OPC_LEVEL_LINE_;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+
+ float ht = nsharpNative.nsharpLib.ihght(975);
+ if (ht == NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ textStr = NsharpNativeConstants.OPC_975_LINE_MISSING_;
+ else {
+ textStr = NsharpNativeConstants.OPC_975_LINE_;
+ textStr = String.format(textStr, nsharpNative.nsharpLib.ihght(975),
+ nsharpNative.nsharpLib.itemp(975));
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ ht = 0;
+ // get surface pressure (fValue1), Surface_temp (fValue2)
+ nsharpNative.nsharpLib.get_surface(Surfpressure, surfTemp, surfDewpt);
+ if (nsharpNative.nsharpLib.qc(Surfpressure.getValue()) == 1)
+ ht = nsharpNative.nsharpLib.ihght(Surfpressure.getValue());
+ if (nsharpNative.nsharpLib.qc(Surfpressure.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(surfTemp.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_SURFACE_LINE_;
+ textStr = String.format(textStr, Surfpressure.getValue(), ht,
+ surfTemp.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_SURFACE_MISSING_;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ /* ----- Sfc-975 Grad ----- */
+ /*
+ * make sure both 975mb layer and surface layer temperatures are
+ * available
+ */
+ if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(975)) == 1
+ && nsharpNative.nsharpLib.qc(surfTemp.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_975_SURFACE_LINE;
+ textStr = String.format(textStr, nsharpNative.nsharpLib.itemp(975)
+ - surfTemp.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_975_SURFACE_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_inversion() in xwvid3.c
+ *
+ * inv_mb - Pressure of inversion level (mb) inv_dC - Change in
+ * temperature (C)
+ */
+ FloatByReference inv_mb = new FloatByReference(0);
+ FloatByReference inv_dC = new FloatByReference(0);
+ ;
+ // yellow and bold for parcel header
+ target.drawString(myfont, NsharpNativeConstants.OPC_LOWEST_INV_STR,
+ rect.x + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + 2 * charHeight;
+ nsharpNative.nsharpLib.low_inv(inv_mb, inv_dC);
+ if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.ihght(inv_mb
+ .getValue())) == 1) {
+ textStr = NsharpNativeConstants.OPC_BASEHEIGHT_LINE;
+ textStr = String.format(textStr,
+ nsharpNative.nsharpLib.ihght(inv_mb.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.OPC_BASEHEIGHT_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(inv_mb.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_BASEPRESSURE_LINE;
+ textStr = String.format(textStr, inv_mb.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_BASEPRESSURE_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(inv_dC.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_CHANGE_IN_TEMP_LINE;
+ textStr = String.format(textStr, inv_dC.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_CHANGE_IN_TEMP_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel6(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
+ String splitedStr[];
+ String textStr;
+ curY = rect.y;
+
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_mixheight() in xwvid3.c Calculates the mixing height using
+ * legacy mix_height()
+ *
+ * void mix_height ( float *mh_mb, float *mh_drct, float *mh_sped, float
+ * *mh_dC, float *mh_lr, float *mh_drct_max, float *mh_sped_max, short
+ * flag )
+ *
+ * Where: flag = 0 Surface-based lapse rate flag = 1 Layer-based lapse
+ * rate
+ *
+ * mh_mb - Pressure at mixing height (mb) mh_drct - Wind direction at
+ * mixing height (deg) mh_sped - Wind speed at mixing height (kt) mh_dC
+ * - Layer change in temperature (C) mh_lr - Layer lapse rate (C/km)
+ * mh_drct_max - Layer maximum wind direction (deg) mh_sped_max - Layer
+ * maximum wind speed (kt)
+ */
+ FloatByReference mh_mb = new FloatByReference(0);
+ FloatByReference mh_drct = new FloatByReference(0);
+ FloatByReference mh_sped = new FloatByReference(0);
+ FloatByReference mh_dC = new FloatByReference(0);
+ FloatByReference mh_lr = new FloatByReference(0);
+ FloatByReference mh_drct_max = new FloatByReference(0);
+ FloatByReference mh_sped_max = new FloatByReference(0);
+ short flag;
+
+ // yellow and bold for parcel header
+ target.drawString(myfont, NsharpNativeConstants.OPC_MIXING_HGT_STR,
+ rect.x + rect.width / 10, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ textStr = NsharpNativeConstants.OPC_DRY_AD_LINE;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ textStr = NsharpNativeConstants.OPC_THRESH_LAPSE_LINE;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Cyan color for Layer Based string
+ target.drawString(myfont, NsharpNativeConstants.OPC_LAYER_BASED_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ // calculate Layer-based lapse rate data
+ flag = 1;
+ nsharpNative.nsharpLib.mix_height(mh_mb, mh_drct, mh_sped, mh_dC,
+ mh_lr, mh_drct_max, mh_sped_max, flag);
+
+ if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.ihght(mh_mb
+ .getValue())) == 1) {
+ textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_LINE;
+ textStr = String.format(textStr,
+ nsharpNative.nsharpLib.ihght(mh_mb.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_mb.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_LINE;
+ textStr = String.format(textStr, mh_mb.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_drct.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(mh_sped.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_LINE;
+ // System.out.println("speed = " + mh_sped.getValue());
+ textStr = String.format(textStr, (int) mh_drct.getValue(),
+ NsharpConstants.DEGREE_SYMBOL, (int) (mh_sped.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_drct_max.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(mh_sped_max.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_LINE;
+ textStr = String
+ .format(textStr, (int) mh_drct_max.getValue(),
+ NsharpConstants.DEGREE_SYMBOL,
+ (int) mh_sped_max.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_dC.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(mh_lr.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_LINE;
+ textStr = String
+ .format(textStr, mh_dC.getValue(), mh_lr.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Purple color for Layer Based string
+ target.drawString(myfont, NsharpNativeConstants.OPC_SURFACE_BASED_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_violet, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ // calculate Surface-based lapse rate data
+ flag = 0;
+ mh_mb.setValue(0);
+ mh_drct.setValue(0);
+ mh_sped.setValue(0);
+ mh_dC.setValue(0);
+ mh_lr.setValue(0);
+ mh_drct_max.setValue(0);
+ mh_sped_max.setValue(0);
+ ;
+ nsharpNative.nsharpLib.mix_height(mh_mb, mh_drct, mh_sped, mh_dC,
+ mh_lr, mh_drct_max, mh_sped_max, flag);
+
+ // white color for text
+ if (nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.ihght(mh_mb
+ .getValue())) == 1) {
+ textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_LINE;
+ textStr = String.format(textStr,
+ nsharpNative.nsharpLib.ihght(mh_mb.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.OPC_MIXINGHEIGHT_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_mb.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_LINE;
+ textStr = String.format(textStr, mh_mb.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_MIXINGPRESSURE_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_drct.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(mh_sped.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_LINE;
+ textStr = String.format(textStr, (int) mh_drct.getValue(),
+ NsharpConstants.DEGREE_SYMBOL, (int) mh_sped.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_TOPMIXLAYER_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_drct_max.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(mh_sped_max.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_LINE;
+ textStr = String
+ .format(textStr, (int) mh_drct_max.getValue(),
+ NsharpConstants.DEGREE_SYMBOL,
+ (int) mh_sped_max.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_MIXLAYERMAX_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ if (nsharpNative.nsharpLib.qc(mh_dC.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(mh_lr.getValue()) == 1) {
+ textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_LINE;
+ textStr = String
+ .format(textStr, mh_dC.getValue(), mh_lr.getValue());
+ } else {
+ textStr = NsharpNativeConstants.OPC_LAYER_LAPSE_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel7(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
+ String splitedStr[];
+ String textStr;
+ curY = rect.y;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_srdata() in xwvid3.c. Hard coded numerical numbers are directly
+ * copied from it.
+ *
+ * float helicity ( float lower, float upper, float sdir, float sspd,
+ * float *phel, float *nhel ) Calculates the storm-relative helicity
+ * (m2/s2) of a layer from LOWER(m, agl) to UPPER(m, agl). Uses the
+ * storm motion vector (sdir, sspd).
+ *
+ * lower - Bottom level of layer (m, AGL)[-1=LPL] upper - Top level of
+ * layer (m, AGL) [-1=LFC] sdir - Storm motion direction (degrees) sspd
+ * - Storm motion speed (kt) phel - Positive helicity in layer (m2/s2)
+ * nhel - Negative helicity in layer (m2/s2) RETURN VALUE - Total
+ * helicity (m2/s2)
+ *
+ * void sr_wind ( float pbot, float ptop, float sdir, float sspd, float
+ * *mnu, float *mnv, float *wdir, float *wspd ) Calculates a
+ * pressure-weighted SR mean wind thru the layer (pbot-ptop). Default
+ * layer is LFC-EL. pbot - Bottom level of layer (mb) ptop - Top level
+ * of layer (mb) sdir - Storm motion dirction (deg) sspd - Storm motion
+ * speed (kt) mnu - U-Component of mean wind (kt) mnv - V-Component of
+ * mean wind (kt) /
+ */
+
+ // FloatByReference sspd= new FloatByReference(0);
+ // FloatByReference sdir= new FloatByReference(0);
+ FloatByReference phel = new FloatByReference(0);
+ FloatByReference nhel = new FloatByReference(0);
+ FloatByReference mnu = new FloatByReference(0);
+ FloatByReference mnv = new FloatByReference(0);
+ FloatByReference smdir = new FloatByReference(0);
+ FloatByReference smspd = new FloatByReference(0);
+ FloatByReference wdir = new FloatByReference(0);
+ FloatByReference wspd = new FloatByReference(0);
+ float totHeli;
+
+ target.drawString(myfont, NsharpNativeConstants.STORM_RELATIVE_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ nsharpNative.nsharpLib.get_storm(smspd, smdir);
+
+ if (nsharpNative.nsharpLib.qc(smspd.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(smdir.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_MOTION_LINE;
+ textStr = String.format(textStr, smdir.getValue(),
+ NsharpConstants.DEGREE_SYMBOL, smspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(smspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.STORM_MOTION_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x + rect.width / 4, curY, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_white,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // yellow and bold for parcel header
+ target.drawString(myfont, NsharpNativeConstants.STORM_HELICITY_STR,
+ rect.x + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ textStr = NsharpNativeConstants.STORM_LAYER_POS_STR;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+
+ // calculate helicity for sfc-2 km
+ totHeli = nsharpNative.nsharpLib.helicity((float) 0, (float) 2000,
+ smdir.getValue(), smspd.getValue(), phel, nhel);
+ if (nsharpNative.nsharpLib.qc(phel.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(nhel.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_SFC2KM_LINE;
+ textStr = String.format(textStr, phel.getValue(), nhel.getValue(),
+ totHeli, NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+
+ } else {
+ textStr = NsharpNativeConstants.STORM_SFC2KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ // calculate helicity for sfc-3 km
+ totHeli = nsharpNative.nsharpLib.helicity((float) 0, (float) 3000,
+ smdir.getValue(), smspd.getValue(), phel, nhel);
+ if (nsharpNative.nsharpLib.qc(phel.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(nhel.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_SFC3KM_LINE;
+ textStr = String.format(textStr, phel.getValue(), nhel.getValue(),
+ totHeli, NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.STORM_SFC3KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ // calculate helicity for LPL - LFC
+ totHeli = nsharpNative.nsharpLib.helicity((float) -1, (float) -1,
+ smdir.getValue(), smspd.getValue(), phel, nhel);
+ if (nsharpNative.nsharpLib.qc(phel.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(nhel.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_LPL_LFC_LINE;
+ textStr = String.format(textStr, phel.getValue(), nhel.getValue(),
+ totHeli, NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.STORM_LPL_LFC_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ // yellow and bold for header
+ target.drawString(myfont, NsharpNativeConstants.STORM_WIND_STR, rect.x
+ + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + 2 * charHeight;
+ textStr = NsharpNativeConstants.STORM_LAYER_VECTOR_STR;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+
+ // calculate pressure-weighted SR mean wind at sfc-2 km
+ nsharpNative.nsharpLib.sr_wind(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(2000)),
+ smdir.getValue(), smspd.getValue(), mnu, mnv, wdir, wspd);
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_SFC2KM_VECT_LINE;
+ textStr = String.format(textStr, wdir.getValue(), wspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.STORM_SFC2KM_VECT_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // calculate pressure-weighted SR mean wind at 4-6 km
+ // System.out.println("msl(4000))="+ nsharpNative.nsharpLib.msl(4000) +
+ // "i_pres(msl(4000))" +
+ // nsharpNative.nsharpLib.i_pres(nsharpNative.nsharpLib.msl(4000)));
+ // System.out.println("msl(6000))="+ nsharpNative.nsharpLib.msl(6000) +
+ // "i_pres(msl(6000))" +
+ // nsharpNative.nsharpLib.i_pres(nsharpNative.nsharpLib.msl(6000)));
+ // System.out.println("dir "+ smdir.getValue()+ " spd " +
+ // smspd.getValue());
+ nsharpNative.nsharpLib.sr_wind(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(4000)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)),
+ smdir.getValue(), smspd.getValue(), mnu, mnv, wdir, wspd);
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_4_6KM_VECT_LINE;
+ // System.out.println("wdir "+ wdir.getValue() + " widSp " +
+ // wspd.getValue());
+ textStr = String.format(textStr, wdir.getValue(), wspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.STORM_4_6KM_VECT_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // calculate pressure-weighted SR mean wind at 9-11 km
+ nsharpNative.nsharpLib
+ .sr_wind(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(9000)), nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(11000)), smdir
+ .getValue(), smspd.getValue(), mnu, mnv, wdir, wspd);
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_9_11KM_VECT_LINE;
+ textStr = String.format(textStr, wdir.getValue(), wspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.STORM_9_11KM_VECT_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel8(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
+ String splitedStr[];
+ String textStr;
+ curY = rect.y;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_meanwind() in xwvid3.c
+ *
+ * void mean_wind ( float pbot, float ptop, float *mnu, float *mnv,
+ * float *wdir, float *wspd ) Calculates a pressure-weighted mean wind
+ * thru the layer (pbot-ptop). Default layer is LFC-EL.
+ *
+ * pbot - Bottom level of layer (mb) ptop - Top level of layer (mb) mnu
+ * - U-Component of mean wind (kt) mnv - V-Component of mean wind (kt)
+ */
+ FloatByReference mnu = new FloatByReference(0);
+ FloatByReference mnv = new FloatByReference(0);
+ FloatByReference wdir = new FloatByReference(0);
+ FloatByReference wspd = new FloatByReference(0);
+ target.drawString(myfont, NsharpNativeConstants.MEAN_WIND_STR, rect.x
+ + rect.width * 0.4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // fix TT 549890
+ // Calculate mean wind at 0-6 km, following the same algorithm used in
+ // drawPanel2() at BigNsharp page 2.
+ // Like this :
+ // mean_wind(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)),
+ // nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)))
+ nsharpNative.nsharpLib.mean_wind(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)),
+ mnu, mnv, wdir, wspd);
+ // this line was nsharpNative.nsharpLib.mean_wind( -1,
+ // nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.agl(6000)), mnu,
+ // mnv, wdir, wspd);
+ // System.out.println("wsp ="+ wspd.getValue()+ " wdir "+
+ // wdir.getValue() + " agl(6000)="+nsharpNative.nsharpLib.agl(6000)+
+ // " preAt6000="+nsharpNative.nsharpLib.i_pres(nsharpNative.nsharpLib.agl(6000)));
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(wspd.getValue()) == 1) {
+ textStr = NsharpNativeConstants.MEANWIND_SFC6KM_LINE;
+ textStr = String.format(textStr, (wdir.getValue()),
+ wspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.MEANWIND_SFC6KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // fix TT 549890
+ // Calculate mean wind at LFC-EL, following the same algorithm used in
+ // drawPanel2() for LCL_EL for BigNsharp pag
+ // Replacing LCL with LFC
+ _lplvalues lpvls;
+ _parcel pcl;
+ lpvls = new _lplvalues();
+ pcl = new _parcel();
+ float h1, h2;
+ h1 = -1;
+ h2 = -1;
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp = lpvls.temp;
+ float sfcdwpt = lpvls.dwpt;
+ float sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+ if (pcl.bplus > 0) {
+ h1 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres));
+ h2 = nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(pcl.elpres));
+ }
+
+ // Calculate mean wind at LFC-EL
+ nsharpNative.nsharpLib.mean_wind(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h1)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(h2)),
+ mnu, mnv, wdir, wspd);
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(wspd.getValue()) == 1) {
+ textStr = NsharpNativeConstants.MEANWIND_LFC_EL_LINE;
+ textStr = String.format(textStr, wdir.getValue(), wspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.MEANWIND_LFC_EL_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ // Calculate mean wind at 850-200 mb
+ nsharpNative.nsharpLib.mean_wind(850, 200, mnu, mnv, wdir, wspd);
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(wspd.getValue()) == 1) {
+ textStr = NsharpNativeConstants.MEANWIND_850_200MB_LINE;
+ textStr = String.format(textStr, wdir.getValue(), wspd.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(wspd.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.MEANWIND_850_200MB_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_shear() in xwvid3.c
+ *
+ * void wind_shear ( float pbot, float ptop, float *shu, float *shv,
+ * float *sdir, float *smag )
+ *
+ * Calculates the shear between the wind at (pbot) and (ptop). Default
+ * lower wind is a 1km mean wind, while the default upper layer is 3km.
+ *
+ * pbot - Bottom level of layer (mb) ptop - Top level of layer (mb) shu
+ * - U-Component of shear (m/s) shv - V-Component of shear (m/s) sdir -
+ * Direction of shear vector (degrees) smag - Magnitude of shear vector
+ * (m/s)
+ */
+ FloatByReference shu = new FloatByReference(0);
+ FloatByReference shv = new FloatByReference(0);
+ FloatByReference sdir = new FloatByReference(0);
+ FloatByReference smag = new FloatByReference(0);
+ target.drawString(myfont,
+ NsharpNativeConstants.ENVIRONMENTAL_SHEAR_STR, rect.x
+ + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ textStr = NsharpNativeConstants.SHEAR_LAYER_DELTA_STR;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+
+ // Calculate wind shear at Low - 3 km
+ nsharpNative.nsharpLib.wind_shear(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(3000)),
+ shu, shv, sdir, smag);
+ if (nsharpNative.nsharpLib.qc(smag.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SHEAR_LOW_3KM_LINE;
+ textStr = String.format(textStr, smag.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()) / .3F);
+ // System.out.println("from cave "+smag.getValue() + " kt, " +
+ // nsharpNative.nsharpLib.kt_to_mps(smag.getValue())+ " m/s, Tot="+
+ // nsharpNative.nsharpLib.kt_to_mps(smag.getValue())/.3F);
+ } else {
+ textStr = NsharpNativeConstants.SHEAR_LOW_3KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Calculate wind shear at Sfc - 2 km
+ nsharpNative.nsharpLib.wind_shear(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(2000)),
+ shu, shv, sdir, smag);
+ if (nsharpNative.nsharpLib.qc(smag.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SHEAR_SFC_2KM_LINE;
+ textStr = String.format(textStr, smag.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()) / .2F);
+ } else {
+ textStr = NsharpNativeConstants.SHEAR_SFC_2KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Calculate wind shear at Sfc - 6 km
+ nsharpNative.nsharpLib.wind_shear(
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(0)),
+ nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib.msl(6000)),
+ shu, shv, sdir, smag);
+ if (nsharpNative.nsharpLib.qc(smag.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SHEAR_SFC_6KM_LINE;
+ textStr = String.format(textStr, smag.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()) / .6F);
+ } else {
+ textStr = NsharpNativeConstants.SHEAR_SFC_6KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Calculate wind shear at Sfc - 12 km
+ nsharpNative.nsharpLib
+ .wind_shear(nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .msl(0)), nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(12000)), shu, shv,
+ sdir, smag);
+ if (nsharpNative.nsharpLib.qc(smag.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SHEAR_SFC_12KM_LINE;
+ textStr = String.format(textStr, smag.getValue(),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()),
+ nsharpNative.nsharpLib.kt_to_mps(smag.getValue()) / 1.2F);
+ } else {
+ textStr = NsharpNativeConstants.SHEAR_SFC_12KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel9(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ if (paneConfigurationName.equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ myfont = font11;
+ } else {
+ myfont = defaultFont;
+ }
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
+ String splitedStr[];
+ String textStr;
+ curY = rect.y;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_initiation(): Displays thunderstorm initiation parameters,
+ * show_heavypcpn(), show_preciptype() and show_stormtype() in xwvid3.c
+ */
+ FloatByReference fvalue2 = new FloatByReference(0);
+ FloatByReference fvalue3 = new FloatByReference(0);
+ FloatByReference wdir = new FloatByReference(0);
+ FloatByReference wspd = new FloatByReference(0);
+ FloatByReference fvalue = new FloatByReference(0);
+ FloatByReference fvalue1 = new FloatByReference(0);
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ // current parcel is already decided when page 1 is displyed. Note that
+ // page 1 is always
+ // displayed before this page (page 4). Therefore, we dont have to call
+ // define_parcel() again.
+ // set default
+ // short currentParcel;
+ float layerPressure;
+ if (currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED) {
+ layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
+ } else
+ layerPressure = NsharpNativeConstants.parcelToLayerMap
+ .get(currentParcel);
+ nsharpNative.nsharpLib.define_parcel(currentParcel, layerPressure);
+
+ _parcel pcl = new _parcel();
+ ;
+ _lplvalues lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+ // _parcel.ByValue pcl_byvalue = new _parcel.ByValue();
+ // nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp,
+ // sfcdwpt, pcl_byvalue);
+
+ // CONVECTIVE_INITIATION
+ target.drawString(myfont,
+ NsharpNativeConstants.CONVECTIVE_INITIATION_STR, rect.x
+ + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ // CINH
+ if (nsharpNative.nsharpLib.qc(pcl.bminus) == 1) {
+ textStr = NsharpNativeConstants.CONVECTIVE_CINH_LINE;
+ textStr = String.format(textStr, pcl.bminus);
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_CINH_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // cap
+ if (nsharpNative.nsharpLib.qc(pcl.cap) == 1
+ && nsharpNative.nsharpLib.qc(pcl.cappres) == 1) {
+ textStr = NsharpNativeConstants.CONVECTIVE_CAP_LINE;
+ textStr = String.format(textStr, pcl.cap, pcl.cappres);
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_CAP_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // K-index
+ nsharpNative.nsharpLib.k_index(fvalue);
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.CONVECTIVE_KINDEX_LINE;
+ textStr = String.format(textStr, fvalue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_KINDEX_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // Mean RH
+ nsharpNative.nsharpLib.mean_relhum(fvalue, -1, -1);
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.CONVECTIVE_MEANRH_LINE;
+ textStr = String.format(textStr, fvalue.getValue(),
+ NsharpConstants.PERCENT_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_MEANRH_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + 2 * charHeight;
+
+ // Top of M layer
+ nsharpNative.nsharpLib.top_moistlyr(fvalue);
+ // System.out.println("top_moistlyr=" + fvalue.getValue() );
+
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ float ht = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(fvalue.getValue())));
+ if (nsharpNative.nsharpLib.qc(ht) == 1) {
+ textStr = NsharpNativeConstants.CONVECTIVE_TOP_LINE;
+ textStr = String.format(textStr, fvalue.getValue(), ht);
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_TOP_MISSING;
+ }
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_TOP_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ // LFC height
+ if (nsharpNative.nsharpLib.qc(pcl.lfcpres) == 1) {
+ float ht = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(pcl.lfcpres)));
+ if (nsharpNative.nsharpLib.qc(ht) == 1) {
+ textStr = NsharpNativeConstants.CONVECTIVE_LFC_LINE;
+ textStr = String.format(textStr, pcl.lfcpres, ht);
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_LFC_MISSING;
+ }
+ } else {
+ textStr = NsharpNativeConstants.CONVECTIVE_LFC_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // STORM TYPE
+ target.drawString(myfont, NsharpNativeConstants.STORM_TYPE_STR, rect.x
+ + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // CAPE
+ if (nsharpNative.nsharpLib.qc(pcl.bplus) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_CAPE_LINE;
+ textStr = String.format(textStr, pcl.bplus);
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_CAPE_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // EFF. SREH
+ float hel = 0;
+ nsharpNative.nsharpLib.get_storm(wspd, wdir);
+ if (nsharpNative.nsharpLib.qc(wdir.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(wspd.getValue()) == 1) {
+ hel = nsharpNative.nsharpLib.helicity(-1.0F, -1.0F,
+ wdir.getValue(), wspd.getValue(), fvalue, fvalue1);
+ if (nsharpNative.nsharpLib.qc(hel) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_EFF_LINE;
+ textStr = String.format(textStr, hel,
+ NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_EFF_MISSING;
+ }
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_EFF_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // EHI
+ if (nsharpNative.nsharpLib.qc(pcl.bplus) == 1) {
+ float ehi = nsharpNative.nsharpLib.ehi(pcl.bplus, hel);
+ if (nsharpNative.nsharpLib.qc(ehi) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_EHI_LINE;
+ textStr = String.format(textStr, ehi);
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_EHI_MISSING;
+ }
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_EHI_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // 3km Shear
+ nsharpNative.nsharpLib.wind_shear(-1, -1, fvalue, fvalue1, fvalue2,
+ fvalue3);
+ if (nsharpNative.nsharpLib.qc(fvalue3.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_3KM_LINE;
+ textStr = String.format(textStr,
+ nsharpNative.nsharpLib.kt_to_mps(fvalue3.getValue()));
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_3KM_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // BRN
+ if (nsharpNative.nsharpLib.qc(pcl.brn) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_BRN_LINE;
+ textStr = String.format(textStr, pcl.brn);
+ } else {
+ textStr = NsharpNativeConstants.STORM_TYPE_BRN_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // BRN Shear
+ // nsharpNative.nsharpLib.cave_bulk_rich(pcl.lplpres, pcl.bplus, fvalue
+ // );
+ // System.out.println("bulk_rich fvalue = "+ fvalue.getValue());
+ nsharpNative.nsharpLib.cave_bulk_rich2(fvalue);
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_BRNSHEAR_LINE;
+ textStr = String.format(textStr, fvalue.getValue(),
+ NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ } else
+ textStr = NsharpNativeConstants.STORM_TYPE_BRNSHEAR_MISSING;
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // PRECIPITATION_TYPE
+ target.drawString(myfont, NsharpNativeConstants.PRECIPITATION_TYPE_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // Melting Level
+ float web = nsharpNative.nsharpLib.wb_lvl(0, fvalue);
+ if (nsharpNative.nsharpLib.qc(web) == 1) {
+
+ float aglft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(web)));
+ if (nsharpNative.nsharpLib.qc(aglft) == 1) {
+ textStr = NsharpNativeConstants.PRECIPITATION_MELTING_LINE;
+ textStr = String.format(textStr, aglft, web);
+ } else
+ textStr = NsharpNativeConstants.PRECIPITATION_MELTING_MISSING;
+ } else {
+ textStr = NsharpNativeConstants.PRECIPITATION_MELTING_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ // HEAVY_RAINFAL
+ target.drawString(myfont, NsharpNativeConstants.HEAVY_RAINFALL_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // Rogash_QPF, Chin: note: BigNsharp has different implementation of
+ // Rogash_QPF()
+ // We are using bigNsharp now.
+ nsharpNative.nsharpLib.Rogash_QPF(fvalue);
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.HEAVY_ROGASH_LINE;
+ textStr = String.format(textStr, fvalue.getValue());
+ } else {
+ textStr = NsharpNativeConstants.HEAVY_ROGASH_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ // myfont.dispose();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void drawPanel10(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ if (paneConfigurationName.equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ myfont = font11;
+ } else {
+ myfont = defaultFont;
+ }
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // myfont = target.initializeFont(fontName, fontSize, null);
+ String splitedStr[];
+ String textStr;
+ curY = rect.y;
+ /*
+ * Chin's NOTE::::this function is coded based on legacy nsharp software
+ * show_hailpot(), show_torpot() in xwvid3.c
+ */
+ FloatByReference fvalue2 = new FloatByReference(0);
+ FloatByReference fvalue3 = new FloatByReference(0);
+ FloatByReference wdir = new FloatByReference(0);
+ FloatByReference wspd = new FloatByReference(0);
+ FloatByReference fvalue = new FloatByReference(0);
+ FloatByReference fvalue1 = new FloatByReference(0);
+
+ target.drawString(myfont, NsharpNativeConstants.SEVERE_POTENTIAL_STR,
+ rect.x + rect.width / 3, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_cyan, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ target.drawString(myfont,
+ NsharpNativeConstants.SEVERE_HAIL_POTENTIAL_STR, rect.x
+ + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ _parcel pcl = new _parcel();
+ ;
+ _lplvalues lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+ // CAPE
+ if (nsharpNative.nsharpLib.qc(pcl.bplus) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_CAPE_LINE;
+ textStr = String.format(textStr, pcl.bplus);
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_CAPE_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // WBZ level
+ float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .wb_lvl(0, fvalue))));
+ if (nsharpNative.nsharpLib.qc(wbzft) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_WBZ_LINE;
+ textStr = String.format(textStr, wbzft);
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_WBZ_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Mid Level RH
+ nsharpNative.nsharpLib.mean_relhum(fvalue, 700, 500);
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_MIDRH_LINE;
+ textStr = String.format(textStr, fvalue.getValue(),
+ NsharpConstants.PERCENT_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_MIDSRW_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+
+ // FZG level
+ float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .temp_lvl(0, fvalue))));
+ if (nsharpNative.nsharpLib.qc(fgzft) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_FGZ_LINE;
+ textStr = String.format(textStr, fgzft);
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_FGZ_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // EL Storm
+ nsharpNative.nsharpLib.get_storm(wspd, wdir);
+ nsharpNative.nsharpLib.sr_wind(pcl.elpres + 25, pcl.elpres - 25,
+ wdir.getValue(), wspd.getValue(), fvalue, fvalue1, fvalue2,
+ fvalue3);
+ if (nsharpNative.nsharpLib.qc(fvalue3.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_ELSTORM_LINE;
+ textStr = String.format(textStr, fvalue3.getValue());
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_ELSTORM_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+ // CHI1
+ // _parcel.ByValue pcl_byvalue = new _parcel.ByValue();
+ // pr = nsharpNative.nsharpLib.parcel( -1.0F, -1.0F, sfcpres, sfctemp,
+ // sfcdwpt, pcl_byvalue);
+ // Assigne values that needed for bulk_rich()
+ // pcl_byvalue.lplpres = sfcpres;
+ // pcl_byvalue.bplus = pcl.bplus;
+ nsharpNative.nsharpLib.cave_bulk_rich2(fvalue);
+ float rtn = (pcl.bplus * fvalue.getValue())
+ / nsharpNative.nsharpLib.agl(nsharpNative.nsharpLib
+ .ihght(nsharpNative.nsharpLib.wb_lvl(0, fvalue1)));
+ if (nsharpNative.nsharpLib.qc(rtn) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_CHI1_LINE;
+ textStr = String.format(textStr, rtn);
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_CHI1_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ // CHI2
+ nsharpNative.nsharpLib.Mean_WBtemp(fvalue2, -1, -1);
+ if (nsharpNative.nsharpLib.qc(rtn / fvalue2.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_CHI2_LINE;
+ textStr = String.format(textStr, rtn / fvalue2.getValue());
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_CHI2_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + rect.width / 2
+ + i * rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ // Avg BL
+ nsharpNative.nsharpLib.Mean_WBtemp(fvalue, -1, -1);
+ if (nsharpNative.nsharpLib.qc(fvalue.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_AVGBL_LINE;
+ textStr = String.format(textStr, fvalue.getValue(),
+ NsharpConstants.DEGREE_SYMBOL);
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_AVGBL_MISSING;
+ }
+ target.drawString(myfont, textStr, rect.x, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // TORNADO_POTENTIAL
+ target.drawString(myfont,
+ NsharpNativeConstants.SEVERE_TORNADO_POTENTIAL_STR, rect.x
+ + rect.width / 4, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_yellow, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ curY = curY + charHeight;
+
+ // Low SRW Sfc
+ float blyr = nsharpNative.nsharpLib
+ .ipres(nsharpNative.nsharpLib.msl(0));
+ float tlyr = pcl.lfcpres;
+ if (tlyr > 0) {
+ nsharpNative.nsharpLib.sr_wind(blyr, tlyr, wdir.getValue(),
+ wspd.getValue(), fvalue, fvalue1, fvalue2, fvalue3);
+ if (nsharpNative.nsharpLib.qc(fvalue3.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_LOWSRWSFC_LINE;
+ textStr = String.format(textStr, fvalue3.getValue());
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_LOWSRWSFC_MISSING;
+ }
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_LOWSRWSFC_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ blyr = pcl.lfcpres;
+ tlyr = nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres) + 4000);
+ if ((tlyr > 0) && (blyr > 0)) {
+ nsharpNative.nsharpLib.sr_wind(blyr, tlyr, wdir.getValue(),
+ wspd.getValue(), fvalue, fvalue1, fvalue2, fvalue3);
+ if (nsharpNative.nsharpLib.qc(fvalue3.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_MIDSRW_LINE;
+ textStr = String.format(textStr, fvalue3.getValue());
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_MIDSRW_MISSING;
+ }
+
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_MIDSRW_MISSING;
+ }
+ splitedStr = textStr.split("_", -1);
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ curY = curY + charHeight;
+
+ blyr = nsharpNative.nsharpLib.ipres(nsharpNative.nsharpLib
+ .ihght(pcl.elpres) - 4000);
tlyr = pcl.elpres;
- if((tlyr > 0)&&(blyr > 0)) {
- nsharpNative.nsharpLib.sr_wind( blyr, tlyr, wdir.getValue(), wspd.getValue(), fvalue,fvalue1,fvalue2,fvalue3);
- if(nsharpNative.nsharpLib.qc(fvalue3.getValue())==1) {
- textStr = NsharpNativeConstants.SEVERE_LOWSRWEL_LINE;
- textStr = String.format(textStr,fvalue3.getValue());
- }
- else {
- textStr = NsharpNativeConstants.SEVERE_LOWSRWEL_MISSING;
- }
-
+ if ((tlyr > 0) && (blyr > 0)) {
+ nsharpNative.nsharpLib.sr_wind(blyr, tlyr, wdir.getValue(),
+ wspd.getValue(), fvalue, fvalue1, fvalue2, fvalue3);
+ if (nsharpNative.nsharpLib.qc(fvalue3.getValue()) == 1) {
+ textStr = NsharpNativeConstants.SEVERE_LOWSRWEL_LINE;
+ textStr = String.format(textStr, fvalue3.getValue());
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_LOWSRWEL_MISSING;
+ }
+
+ } else {
+ textStr = NsharpNativeConstants.SEVERE_LOWSRWEL_MISSING;
}
- else {
- textStr = NsharpNativeConstants.SEVERE_LOWSRWEL_MISSING;
- }
splitedStr = textStr.split("_", -1);
- for (int i =0; i < splitedStr.length; i++){
- target.drawString(myfont, splitedStr[i], rect.x + i*rect.width/2, curY , 0.0,
- TextStyle.NORMAL, NsharpConstants.color_white, HorizontalAlignment.LEFT,
- VerticalAlignment.TOP, null);
- }
-
- //myfont.dispose();
- }
+ for (int i = 0; i < splitedStr.length; i++) {
+ target.drawString(myfont, splitedStr[i], rect.x + i * rect.width
+ / 2, curY, 0.0, TextStyle.NORMAL,
+ NsharpConstants.color_white, HorizontalAlignment.LEFT,
+ VerticalAlignment.TOP, null);
+ }
+ // myfont.dispose();
+ }
- public boolean isSumP1Visible() {
- return sumP1Visible;
- }
+ // Surface based CAPE -p1
+ // Forecast parcel CAPE - p1
+ // Most unstable CAPE -p1
+ // LCL (shown as both mb andft) - p1(m) p3(mb)
+ // LFC (shown as both mb and ft) - p1(m)p3(mb)
+ // CIN - p1 CINH
+ // Convective Temp (maybe) - p1/p4
+ // Precipitable Water - p1/p4
+ // Freezing Level - p1 FZL (FGZ level)
+ // Wet Bulb Zero - p1 WBZ
+ // 0-1 km Helicity - p2 SFC-1km SRH
+ // 0-3 km Helicity - p2 SFC-3km SRH
+ // BRN Shear - p2 BRN Shear, This is true for Surface-based,
+ // Forecast, and Mixed-length Parcels. For Most-unstable and User-defined
+ // parcels, The bottom level could be at 500m below the parcel level, not at
+ // the surface. The depth in computing bulk shear is always 6km.
+ // Bunkers RM Storm - p2 Bunkers Right Motion
+ // Bulk Richardson Number -p9 BRN
+ // start d2dlite
+ @SuppressWarnings("deprecation")
+ private void drawPanel11(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ myfont = font11;
+ } else {
+ myfont = defaultFont;
+ }
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // if we can not Interpolates a temp with 700 mb pressure, then we dont
+ // have enough raw data
+ if ((nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib.itemp(700.0F)) == 0)) {
+ target.drawString(myfont, " " + NO_DATA, rect.x,
+ rect.y, 0.0, TextStyle.NORMAL, NsharpConstants.color_cyan,
+ HorizontalAlignment.LEFT, VerticalAlignment.TOP, null);
+ return;
+ }
- public NsharpGenericPaneBackground getDataPanel1Background() {
- return dataPanel1Background;
- }
+ // call get_topBotPres to set p_top and p_bot
+ FloatByReference topPF = new FloatByReference(0);
+ FloatByReference botPF = new FloatByReference(0);
+ nsharpNative.nsharpLib.get_effectLayertopBotPres(topPF, botPF);
+ String textStr;
+ curY = rect.y;
- public NsharpGenericPaneBackground getDataPanel2Background() {
- return dataPanel2Background;
- }
-
- public void setPageDisplayOrderNumberArray(int[] pageDisplayOrderNumberArray, int numberPagePerDisplay) {
- this.pageDisplayOrderNumberArray = pageDisplayOrderNumberArray;
- if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR))
- //This configuration always show 2 pages layout vertically
- this.numberPagePerDisplay = 2;
- else
- this.numberPagePerDisplay = numberPagePerDisplay;
- if(initDone){
- if(this.numberPagePerDisplay == 1)
- myfont = font12;
- else
- myfont = font10;
- handleResize();
- }
-
- }
- @Override
- protected void adjustFontSize(float canvasW, float canvasH ) {
- /*
- if(canvasH < myDefaultCanvasHeight/3 || canvasW< myDefaultCanvasWidth/3){
- if(myfont!=null){
- myfont.dispose();
- }
- myfont = target.initializeFont("Monospace", 8, null);
- } else if(canvasH < myDefaultCanvasHeight/2 || canvasW< myDefaultCanvasWidth/2){
- if(myfont!=null){
- myfont.dispose();
- }
- myfont = target.initializeFont("Monospace", 8, null);
- }*/
- }
- @Override
- public void handleResize(){
- super.handleResize();
- //Chin Note; ext size is its view size Not canvas size
- IExtent ext = getDescriptor().getRenderableDisplay().getExtent();
- ext.reset();
- this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(),
- (int) ext.getWidth(), (int) ext.getHeight());
- pe = new PixelExtent(this.rectangle);
- getDescriptor().setNewPe(pe);
- defineCharHeight(myfont);
- float prevHeight = dataPaneHeight;
- float prevWidth = dataPaneWidth;
- dp1XOrig = (int) (ext.getMinX());
- dp1YOrig = (int) (ext.getMinY());
- if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR) ||
- paneConfigurationName.equals(NsharpConstants.PANE_SPCWS_CFG_STR) ||
- paneConfigurationName.equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)){
- if(numberPagePerDisplay == 2){
- //these 2 configurations lay 2 data panels side by side
- dataPaneWidth= (int) (ext.getWidth()/2);
- dataPaneHeight= (int) ext.getHeight();
- dp2XOrig = dp1XOrig+ dataPaneWidth;
- dp2YOrig = dp1YOrig;
- }
- else {
- dataPaneWidth= (int) ext.getWidth();
- dataPaneHeight= (int) ext.getHeight();
- dp2XOrig = dp1XOrig;
- dp2YOrig = dp1YOrig;
- }
- } else if(paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR)){
- //this configuration lays 2 data panels top/down
- // always display 2 pages
- dataPaneWidth= (int) ext.getWidth();
- dataPaneHeight= (int) ext.getHeight()/2;
- dp2XOrig = dp1XOrig;
- dp2YOrig = dp1YOrig+dataPaneHeight;
- }
-
- xRatio = xRatio* dataPaneWidth/prevWidth;
- xRatio=1; //turn off
- yRatio = yRatio* dataPaneHeight/prevHeight;
- yRatio=1;//turn off
- charHeight = (int) (charHeight * yRatio);
-
- Rectangle rectangle = new Rectangle(dp1XOrig, dp1YOrig,dataPaneWidth,dataPaneHeight);
- dataPanel1Background.handleResize(rectangle);
- rectangle = new Rectangle(dp2XOrig, dp2YOrig,dataPaneWidth,dataPaneHeight);
- dataPanel2Background.handleResize(rectangle);
- panelRectArray[0] = dataPanel1Background.getRectangle();
- panelRectArray[1] = dataPanel2Background.getRectangle();
- //System.out.println("Data: handle resize w="+dataPaneWidth+ " h="+ dataPaneHeight);
+ //
+ // Start with Parcel Data
+ //
+ float layerPressure = 0;
- }
- @Override
- public void handleZooming(){
- magnifyFont(currentZoomLevel);
- }
+ // get user selected parcel type
+ _lplvalues lpvls;
+ _parcel pcl;
+ DrawableString str1 = new DrawableString(
+ NsharpNativeConstants.PAGE1TEXT1_FCST_STR + "XX",
+ NsharpConstants.color_white);
+ str1.font = myfont;
+ double hRatio = paintProps.getView().getExtent().getWidth()
+ / paintProps.getCanvasBounds().width;
+ double startX = rect.x + 0.5 * charWidth;
+ double widthGap = rect.width / 4;
+ str1.setText("12345ft", NsharpConstants.color_red);
+ double aglWidth = target.getStringsBounds(str1).getWidth() * hRatio
+ * xRatio;
+ str1.setText("D2D Lite Page", NsharpConstants.color_red);
+ str1.setCoordinates(startX, curY);
+ str1.horizontalAlignment = HorizontalAlignment.LEFT;
+ str1.verticallAlignment = VerticalAlignment.TOP;
+ DrawableString str2 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str2.setCoordinates(startX, curY);
+ str2.horizontalAlignment = HorizontalAlignment.LEFT;
+ str2.verticallAlignment = VerticalAlignment.TOP;
+ str2.font = myfont;
+ DrawableString str3 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str3.setCoordinates(firstToken, curY);
+ str3.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str3.verticallAlignment = VerticalAlignment.TOP;
+ str3.font = myfont;
+ DrawableString str4 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str4.setCoordinates(secondToken, curY);
+ str4.horizontalAlignment = HorizontalAlignment.LEFT;
+ str4.verticallAlignment = VerticalAlignment.TOP;
+ str4.font = myfont;
+ DrawableString str5 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str5.setCoordinates(thirdToken, curY);
+ str5.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str5.verticallAlignment = VerticalAlignment.TOP;
+ str5.font = myfont;
+ DrawableString str6 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str6.setCoordinates(startX, curY);
+ str6.horizontalAlignment = HorizontalAlignment.LEFT;
+ str6.verticallAlignment = VerticalAlignment.TOP;
+ str6.font = myfont;
+ DrawableString str7 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str7.setCoordinates(firstToken, curY);
+ str7.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str7.verticallAlignment = VerticalAlignment.TOP;
+ str7.font = myfont;
+ DrawableString str8 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str8.setCoordinates(secondToken, curY);
+ str8.horizontalAlignment = HorizontalAlignment.LEFT;
+ str8.verticallAlignment = VerticalAlignment.TOP;
+ str8.font = myfont;
+ DrawableString str9 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str9.setCoordinates(thirdToken, curY);
+ str9.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str9.verticallAlignment = VerticalAlignment.TOP;
+ str9.font = myfont;
+ DrawableString str10 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str10.setCoordinates(startX, curY);
+ str10.horizontalAlignment = HorizontalAlignment.LEFT;
+ str10.verticallAlignment = VerticalAlignment.TOP;
+ str10.font = myfont;
+ DrawableString str11 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str11.setCoordinates(firstToken, curY);
+ str11.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str11.verticallAlignment = VerticalAlignment.TOP;
+ str11.font = myfont;
+ DrawableString str12 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str12.setCoordinates(secondToken, curY);
+ str12.horizontalAlignment = HorizontalAlignment.LEFT;
+ str12.verticallAlignment = VerticalAlignment.TOP;
+ str12.font = myfont;
+ DrawableString str13 = new DrawableString("",
+ NsharpConstants.color_white);
+ // str13.setCoordinates(thirdToken, curY);
+ str13.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str13.verticallAlignment = VerticalAlignment.TOP;
+ str13.font = myfont;
+
+ target.drawStrings(str1);
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+
+ if (paneConfigurationName.equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ firstToken = rect.x + widthGap + aglWidth;
+ secondToken = rect.x + 2 * widthGap - charWidth;
+ thirdToken = rect.x + 3 * widthGap + aglWidth;
+
+ // thirdToken = thirdToken - aglWidth / 2;
+ // forthToken = forthToken - aglWidth / 2;
+ // fifthToken = fifthToken - aglWidth / 2;
+ // sixthToken = sixthToken - aglWidth / 2;
+ for (short parcelNumber = 1; parcelNumber <= NsharpNativeConstants.PARCEL_D2DLITE_MAX; parcelNumber++) {
+ // call native define_parcel() with parcel type and user defined
+ // pressure (if user defined it)
+ textStr = NsharpNativeConstants.parcelToTypeStrMap
+ .get(parcelNumber);
+ str1.setText(textStr, NsharpConstants.color_gold);
+
+ str1.setCoordinates(startX, curY);
+ float layerPressure1 = NsharpNativeConstants.parcelToLayerMap
+ .get(parcelNumber);
+ nsharpNative.nsharpLib.define_parcel(parcelNumber,
+ layerPressure1);
+
+ lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ // get parcel data by calling native nsharp parcel() API. value
+ // is
+ // returned in pcl
+ pcl = new _parcel();
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp,
+ sfcdwpt, pcl);
+ curY = curY + charHeight;
+ // draw CAPE
+ str2.setText("CAPE=", NsharpConstants.color_white);
+ str2.setCoordinates(startX, curY);
+ if (pcl.bplus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ str3.setText(String.format("%.0f", pcl.bplus),
+ NsharpConstants.color_white);
+ else
+ str3.setText("M", NsharpConstants.color_white);
+ str3.setCoordinates(firstToken, curY);
+
+ // draw CINH
+ str4.setText("CINH=", NsharpConstants.color_white);
+ str4.setCoordinates(secondToken, curY);
+
+ if (pcl.bminus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ str5.setText(String.format("%.0f", pcl.bminus),
+ NsharpConstants.color_white);
+ else
+ str5.setText("M", NsharpConstants.color_white);
+ str5.setCoordinates(thirdToken, curY);
+ curY = curY + charHeight;
+ // draw LCL
+ str6.setText("LCL(Pres)=", NsharpConstants.color_white);
+ str6.setCoordinates(startX, curY);
+ str8.setText("LCL(AGL)=", NsharpConstants.color_white);
+ str8.setCoordinates(secondToken, curY);
+ if (nsharpNative.nsharpLib.qc(pcl.lclpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres)))) == 1) {
+ float lcl = nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres)));
+
+ str7.setText(String.format("%5.0fmb", pcl.lclpres),
+ NsharpConstants.color_white);
+ str9.setText(String.format("%7.0fft", lcl),
+ NsharpConstants.color_white);
+ } else {
+ str7.setText("M", NsharpConstants.color_white);
+ str9.setText("M", NsharpConstants.color_white);
+ }
+ str7.setCoordinates(firstToken, curY);
+ str9.setCoordinates(thirdToken, curY);
+ curY = curY + charHeight;
+ // draw LFC
+ str10.setText("LFC(Pres)=", NsharpConstants.color_white);
+ str10.setCoordinates(startX, curY);
+ str12.setText("LFC(AGL)=", NsharpConstants.color_white);
+ str12.setCoordinates(secondToken, curY);
+ if (nsharpNative.nsharpLib.qc(pcl.lfcpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres)))) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .itemp(pcl.lfcpres)) == 1) {
+ float lfc = nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres)));
+ str11.setText(String.format("%5.0fmb", pcl.lfcpres),
+ NsharpConstants.color_white);
+ str13.setText(String.format("%7.0fft", lfc),
+ NsharpConstants.color_white);
+ } else {
+ str11.setText("M", NsharpConstants.color_white);
+ str13.setText("M", NsharpConstants.color_white);
+ }
+ str11.setCoordinates(firstToken, curY);
+ str13.setCoordinates(thirdToken, curY);
+ target.drawStrings(str1, str2, str3, str4, str5, str6, str7,
+ str8, str9, str10, str11, str12, str13);
+ curY = curY + charHeight;
+ }
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)) {
+ widthGap = rect.width / 3;
+ firstToken = rect.x + widthGap * 0.8;
+ secondToken = rect.x + widthGap;
+ thirdToken = secondToken + widthGap * 0.8;
+ forthToken = rect.x + 2 * widthGap;
+ fifthToken = forthToken + widthGap * 0.8;
+ for (short parcelNumber = 1; parcelNumber <= NsharpNativeConstants.PARCEL_D2DLITE_MAX; parcelNumber++) {
+ // call native define_parcel() with parcel type and user defined
+ // pressure (if user defined it)
+ textStr = NsharpNativeConstants.parcelToTypeStrMap
+ .get(parcelNumber);
+ str1.setText(textStr, NsharpConstants.color_gold);
+
+ str1.setCoordinates(startX, curY);
+ float layerPressure1 = NsharpNativeConstants.parcelToLayerMap
+ .get(parcelNumber);
+ nsharpNative.nsharpLib.define_parcel(parcelNumber,
+ layerPressure1);
+
+ lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ // get parcel data by calling native nsharp parcel() API. value
+ // is
+ // returned in pcl
+ pcl = new _parcel();
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp,
+ sfcdwpt, pcl);
+ curY = curY + charHeight;
+ // draw CAPE
+ str2.setText("CAPE=", NsharpConstants.color_white);
+ str2.setCoordinates(startX, curY);
+ if (pcl.bplus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ str3.setText(String.format("%.0f", pcl.bplus),
+ NsharpConstants.color_white);
+ else
+ str3.setText("M", NsharpConstants.color_white);
+ str3.setCoordinates(firstToken, curY);
+
+ // draw LCL
+ str4.setText("LCL(mb)=", NsharpConstants.color_white);
+ str4.setCoordinates(secondToken, curY);
+ str6.setText("LCL(ft)=", NsharpConstants.color_white);
+ str6.setCoordinates(forthToken, curY);
+ if (nsharpNative.nsharpLib.qc(pcl.lclpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres)))) == 1) {
+ float lcl = nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lclpres)));
+
+ str5.setText(String.format("%5.0f", pcl.lclpres),
+ NsharpConstants.color_white);
+ str7.setText(String.format("%7.0f", lcl),
+ NsharpConstants.color_white);
+ } else {
+ str5.setText("M", NsharpConstants.color_white);
+ str7.setText("M", NsharpConstants.color_white);
+ }
+ str5.setCoordinates(thirdToken, curY);
+ str7.setCoordinates(fifthToken, curY);
+ curY = curY + charHeight;
+ // draw CINH
+ str8.setText("CINH=", NsharpConstants.color_white);
+ str8.setCoordinates(startX, curY);
+
+ if (pcl.bminus != NsharpNativeConstants.NSHARP_LEGACY_LIB_INVALID_DATA)
+ str9.setText(String.format("%.0f", pcl.bminus),
+ NsharpConstants.color_white);
+ else
+ str9.setText("M", NsharpConstants.color_white);
+ str9.setCoordinates(firstToken, curY);
+
+ // draw LFC
+ str10.setText("LFC(mb)=", NsharpConstants.color_white);
+ str10.setCoordinates(secondToken, curY);
+ str12.setText("LFC(ft)=", NsharpConstants.color_white);
+ str12.setCoordinates(forthToken, curY);
+ if (nsharpNative.nsharpLib.qc(pcl.lfcpres) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres)))) == 1
+ && nsharpNative.nsharpLib.qc(nsharpNative.nsharpLib
+ .itemp(pcl.lfcpres)) == 1) {
+ float lfc = nsharpNative.nsharpLib
+ .mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib
+ .ihght(pcl.lfcpres)));
+ str11.setText(String.format("%5.0f", pcl.lfcpres),
+ NsharpConstants.color_white);
+ str13.setText(String.format("%7.0f", lfc),
+ NsharpConstants.color_white);
+ } else {
+ str11.setText("M", NsharpConstants.color_white);
+ str13.setText("M", NsharpConstants.color_white);
+ }
+ str11.setCoordinates(thirdToken, curY);
+ str13.setCoordinates(fifthToken, curY);
+ target.drawStrings(str1, str2, str3, str4, str5, str6, str7,
+ str8, str9, str10, str11, str12, str13);
+ curY = curY + charHeight;
+ }
+ }
+ // widthGap = rect.width / 4;
+ // firstToken = rect.x + widthGap + aglWidth;
+ // secondToken = rect.x + 2 * widthGap;
+ // thirdToken = rect.x + 3 * widthGap + aglWidth;
+
+ if (currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED) {
+ layerPressure = NsharpParcelDialog.getUserDefdParcelMb();
+ } else
+ layerPressure = NsharpNativeConstants.parcelToLayerMap
+ .get(currentParcel);
+
+ // reset and define current parcel
+ nsharpNative.nsharpLib.define_parcel(currentParcel, layerPressure);
+ lpvls = new _lplvalues();
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+
+ float sfctemp, sfcdwpt, sfcpres;
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ // get parcel data by calling native nsharp parcel() API. value is
+ // returned in pcl
+ pcl = new _parcel();
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+
+ str2.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str3.horizontalAlignment = HorizontalAlignment.LEFT;
+ str4.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str5.horizontalAlignment = HorizontalAlignment.LEFT;
+ str6.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str7.horizontalAlignment = HorizontalAlignment.LEFT;
+ str8.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str9.horizontalAlignment = HorizontalAlignment.LEFT;
+ str10.horizontalAlignment = HorizontalAlignment.RIGHT;
+ str11.horizontalAlignment = HorizontalAlignment.LEFT;
+ str12.horizontalAlignment = HorizontalAlignment.RIGHT;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+ str1.setText("PW =", NsharpConstants.color_white);
+ str1.setCoordinates(startX, curY);
+ fValue.setValue(0);
+ nsharpNative.nsharpLib.precip_water(fValue, -1.0F, -1.0F);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1) {
+ textStr = String.format("%.2fin", fValue.getValue());
+ } else {
+ textStr = "M";
+ }
+ str2.setText(textStr, NsharpConstants.color_white);
+ str2.setCoordinates(firstToken, curY);
+ str3.setText("ConvT =", NsharpConstants.color_white);
+ str3.setCoordinates(secondToken, curY);
+ fValue.setValue(0);
+ float conTempF = nsharpNative.nsharpLib.ctof(nsharpNative.nsharpLib
+ .cnvtv_temp(fValue, -1));
+
+ if (nsharpNative.nsharpLib.qc(conTempF) == 1) {
+ textStr = String.format("%.0fF", conTempF);
+ } else {
+ textStr = "M";
+ }
+ str4.setText(textStr, NsharpConstants.color_white);
+ str4.setCoordinates(thirdToken, curY);
+ curY = curY + charHeight;
+ str5.setText("WBZ =", NsharpConstants.color_white);
+ str5.setCoordinates(startX, curY);
+ fValue.setValue(0);
+ float wbzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .wb_lvl(0, fValue))));
+ if (nsharpNative.nsharpLib.qc(wbzft) == 1) {
+ textStr = String.format("%.0fft", wbzft);
+ } else {
+ textStr = "M";
+ }
+ str6.setText(textStr, NsharpConstants.color_white);
+ str6.setCoordinates(firstToken, curY);
+ str7.setText("FGZ =", NsharpConstants.color_white);
+ str7.setCoordinates(secondToken, curY);
+ fValue.setValue(0);
+ float fgzft = nsharpNative.nsharpLib.mtof(nsharpNative.nsharpLib
+ .agl(nsharpNative.nsharpLib.ihght(nsharpNative.nsharpLib
+ .temp_lvl(0, fValue))));
+ if (nsharpNative.nsharpLib.qc(fgzft) == 1) {
+ textStr = String.format("%.0fft", fgzft);
+ } else {
+ textStr = "M";
+ }
+ str8.setText(textStr, NsharpConstants.color_white);
+ str8.setCoordinates(thirdToken, curY);
+
+ target.drawStrings(str1, str2, str3, str4, str5, str6, str7, str8);
+ curY = curY + charHeight;
+ str1.setText("BRN =", NsharpConstants.color_white);
+ str1.setCoordinates(startX, curY);
+ if (nsharpNative.nsharpLib.qc(pcl.brn) == 1) {
+ textStr = NsharpNativeConstants.STORM_TYPE_BRN_LINE;
+ textStr = String.format("%6.0f", pcl.brn);
+ } else {
+ textStr = "M";
+ }
+ str2.setText(textStr, NsharpConstants.color_white);
+ str2.setCoordinates(firstToken, curY);
+ str3.setText("BRN Shr=", NsharpConstants.color_white);
+ str3.setCoordinates(secondToken, curY);
+ nsharpNative.nsharpLib.get_lpvaluesData(lpvls);
+ sfctemp = lpvls.temp;
+ sfcdwpt = lpvls.dwpt;
+ sfcpres = lpvls.pres;
+ nsharpNative.nsharpLib.parcel(-1.0F, -1.0F, sfcpres, sfctemp, sfcdwpt,
+ pcl);
+ nsharpNative.nsharpLib.cave_bulk_rich2(fValue);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1)
+ textStr = String.format("%.0f m%c/s%c", fValue.getValue(),
+ NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ else
+ textStr = "M";
+ str4.setText(textStr, NsharpConstants.color_white);
+ str4.setCoordinates(thirdToken, curY);
+ curY = curY + charHeight;
+ target.drawLine(rect.x, curY, 0.0, rect.x + rect.width, curY, 0.0,
+ NsharpConstants.color_white, 1);
+ str5.setText("Bunkers Right=", NsharpConstants.color_white);
+ str5.setCoordinates(startX, curY);
+ nsharpNative.nsharpLib.bunkers_storm_motion(fValue1, fValue2, fValue3,
+ fValue4);
+ textStr = String.format("%.0f/%.0f kt", fValue3.getValue(),
+ fValue4.getValue());
+
+ str6.setText(textStr, NsharpConstants.color_white);
+ str6.setCoordinates(thirdToken, curY);
+ curY = curY + charHeight;
+
+ target.drawStrings(str1, str2, str3, str4, str5, str6);
+
+ str1.setText("0-1km Helicity=", NsharpConstants.color_white);
+ str1.setCoordinates(startX, curY);
+ FloatByReference smdir = new FloatByReference(0), smspd = new FloatByReference(
+ 0);
+ nsharpNative.nsharpLib.get_storm(smspd, smdir);
+ float totHeli = nsharpNative.nsharpLib.helicity(0, 1000,
+ smdir.getValue(), smspd.getValue(), fValue, fValue1);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = String.format("%.0f m%c/s%c", totHeli,
+ NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ } else {
+ textStr = "M";
+ }
+ str2.setText(textStr, NsharpConstants.color_white);
+ str2.setCoordinates(thirdToken, curY);
+ curY = curY + charHeight;
+ str3.setText("0-3km Helicity=", NsharpConstants.color_white);
+ str3.setCoordinates(startX, curY);
+ totHeli = nsharpNative.nsharpLib.helicity(0, 3000, smdir.getValue(),
+ smspd.getValue(), fValue, fValue1);
+ if (nsharpNative.nsharpLib.qc(fValue.getValue()) == 1
+ && nsharpNative.nsharpLib.qc(fValue1.getValue()) == 1) {
+ textStr = String.format("%.0f m%c/s%c", totHeli,
+ NsharpConstants.SQUARE_SYMBOL,
+ NsharpConstants.SQUARE_SYMBOL);
+ } else {
+ textStr = "M";
+ }
+ str4.setText(textStr, NsharpConstants.color_white);
+ str4.setCoordinates(thirdToken, curY);
+ target.drawStrings(str1, str2, str3, str4);
+ }
+
+ @SuppressWarnings("deprecation")
+ // future (dummy) page
+ private void drawPanel12(IGraphicsTarget target, Rectangle rect)
+ throws VizException {
+ IFont myfont;
+ myfont = defaultFont;
+ defineCharHeight(myfont);
+ myfont.setSmoothing(false);
+ myfont.setScaleFont(false);
+ extent = new PixelExtent(rect);
+ target.setupClippingPlane(extent);
+ // if we can not Interpolates a temp with 700 mb pressure, then we dont
+ // have enough raw data
+ target.drawString(myfont, " FUTURE PAGE", rect.x
+ + rect.width / 2, rect.y + rect.height / 2, 0.0,
+ TextStyle.NORMAL, NsharpConstants.color_cyan,
+ HorizontalAlignment.RIGHT, VerticalAlignment.TOP, null);
+ return;
+ }
+
+ // end d2dlite
+
+ public boolean isSumP1Visible() {
+ return sumP1Visible;
+ }
+
+ public NsharpGenericPaneBackground getDataPanel1Background() {
+ return dataPanel1Background;
+ }
+
+ public NsharpGenericPaneBackground getDataPanel2Background() {
+ return dataPanel2Background;
+ }
+
+ public void setPageDisplayOrderNumberArray(
+ int[] pageDisplayOrderNumberArray, int numberPagePerDisplay) {
+ this.pageDisplayOrderNumberArray = pageDisplayOrderNumberArray;
+ if (paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_1_STR))
+ // This configuration always show 2 pages layout vertically
+ this.numberPagePerDisplay = 2;
+ else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) // d2dlite
+ this.numberPagePerDisplay = 1;
+ else
+ this.numberPagePerDisplay = numberPagePerDisplay;
+ if (initDone) {
+ if (this.numberPagePerDisplay == 1)
+ defaultFont = font12;
+ else
+ defaultFont = font10;
+ handleResize();
+ }
+
+ }
+
+ @Override
+ protected void adjustFontSize(float canvasW, float canvasH) {
+ /*
+ * if(canvasH < myDefaultCanvasHeight/3 || canvasW<
+ * myDefaultCanvasWidth/3){ if(myfont!=null){ myfont.dispose(); } myfont
+ * = target.initializeFont("Monospace", 8, null); } else if(canvasH <
+ * myDefaultCanvasHeight/2 || canvasW< myDefaultCanvasWidth/2){
+ * if(myfont!=null){ myfont.dispose(); } myfont =
+ * target.initializeFont("Monospace", 8, null); }
+ */
+ }
+
+ @Override
+ public void handleResize() {
+ super.handleResize();
+ // Chin Note; ext size is its view size Not canvas size
+ IExtent ext = getDescriptor().getRenderableDisplay().getExtent();
+ ext.reset();
+ this.rectangle = new Rectangle((int) ext.getMinX(),
+ (int) ext.getMinY(), (int) ext.getWidth(),
+ (int) ext.getHeight());
+ pe = new PixelExtent(this.rectangle);
+ getDescriptor().setNewPe(pe);
+ defineCharHeight(defaultFont);
+ float prevHeight = dataPaneHeight;
+ float prevWidth = dataPaneWidth;
+ dp1XOrig = (int) (ext.getMinX());
+ dp1YOrig = (int) (ext.getMinY());
+ if (paneConfigurationName.equals(NsharpConstants.PANE_DEF_CFG_2_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_SPCWS_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_SIMPLE_D2D_CFG_STR)
+ || paneConfigurationName
+ .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) {
+ if (numberPagePerDisplay == 2) {
+ // these 2 configurations lay 2 data panels side by side
+ dataPaneWidth = (int) (ext.getWidth() / 2);
+ dataPaneHeight = (int) ext.getHeight();
+ dp2XOrig = dp1XOrig + dataPaneWidth;
+ dp2YOrig = dp1YOrig;
+ } else {
+ dataPaneWidth = (int) ext.getWidth();
+ dataPaneHeight = (int) ext.getHeight();
+ dp2XOrig = dp1XOrig;
+ dp2YOrig = dp1YOrig;
+ }
+ } else if (paneConfigurationName
+ .equals(NsharpConstants.PANE_DEF_CFG_1_STR)) {
+ // this configuration lays 2 data panels top/down
+ // always display 2 pages
+ dataPaneWidth = (int) ext.getWidth();
+ dataPaneHeight = (int) ext.getHeight() / 2;
+ dp2XOrig = dp1XOrig;
+ dp2YOrig = dp1YOrig + dataPaneHeight;
+ }
+
+ xRatio = xRatio * dataPaneWidth / prevWidth;
+ xRatio = 1; // turn off
+ yRatio = yRatio * dataPaneHeight / prevHeight;
+ yRatio = 1;// turn off
+ charHeight = (int) (charHeight * yRatio);
+
+ Rectangle rectangle = new Rectangle(dp1XOrig, dp1YOrig, dataPaneWidth,
+ dataPaneHeight);
+ dataPanel1Background.handleResize(rectangle);
+ rectangle = new Rectangle(dp2XOrig, dp2YOrig, dataPaneWidth,
+ dataPaneHeight);
+ dataPanel2Background.handleResize(rectangle);
+ panelRectArray[0] = dataPanel1Background.getRectangle();
+ panelRectArray[1] = dataPanel2Background.getRectangle();
+ // System.out.println("Data: handle resize w="+dataPaneWidth+ " h="+
+ // dataPaneHeight);
+
+ }
+
+ @Override
+ public void handleZooming() {
+ magnifyFont(currentZoomLevel);
+ }
}
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpHodoPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpHodoPaneResource.java
index cf0ff9ed27..3a32bf087d 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpHodoPaneResource.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpHodoPaneResource.java
@@ -213,6 +213,20 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
}
}
else if(compareSndIsOn && currentStnListIndex >=0 && currentTimeListIndex >=0){
+ //start FixMark:nearByStnCompSnd
+ List sndCompElementList = rscHandler.getCompSndSelectedElemList();
+ for(NsharpResourceHandler.CompSndSelectedElem compElem: sndCompElementList){
+ NsharpSoundingElementStateProperty elemProp = stnTimeSndTable.get(compElem.getStnIndex()).get(compElem.getTimeIndex()).get(compElem.getSndIndex());
+ if(sndElemList.get(compElem.getSndIndex()).getActionState()== NsharpConstants.ActState.ACTIVE &&
+ elemProp!=null){
+ List soundingLayeys = elemProp.getSndLyLst();
+ int colorIndex = elemProp.getCompColorIndex();
+ RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
+ createRscHodoWindShape(world, soundingLayeys, color);
+ }
+ }
+
+ /* origonal code
for(NsharpOperationElement elm: sndElemList) {
if(elm.getActionState() == NsharpConstants.ActState.ACTIVE &&
stnTimeSndTable.get(currentStnListIndex).get(currentTimeListIndex).get(sndElemList.indexOf(elm))!=null){
@@ -221,7 +235,8 @@ public class NsharpHodoPaneResource extends NsharpAbstractPaneResource{
RGB color = linePropertyMap.get(NsharpConstants.lineNameArray[colorIndex]).getLineColor();
createRscHodoWindShape(world, soundingLayeys, color);
}
- }
+ }*/
+ //end FixMark:nearByStnCompSnd
}
else if(overlayIsOn == true ){
previousSoundingLys = rscHandler.getPreviousSoundingLys();
diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java
index 6632978f23..e459a29819 100644
--- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java
+++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java
@@ -61,6 +61,8 @@ import java.util.StringTokenizer;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.RGB;
+import org.geotools.referencing.GeodeticCalculator;
+import org.geotools.referencing.datum.DefaultEllipsoid;
import com.raytheon.uf.common.sounding.WxMath;
import com.raytheon.uf.common.time.DataTime;
@@ -75,3591 +77,4327 @@ import com.raytheon.viz.core.graphing.WGraphics;
import com.raytheon.viz.core.graphing.WindBarbFactory;
import com.sun.jna.ptr.FloatByReference;
import com.vividsolutions.jts.geom.Coordinate;
+
@SuppressWarnings("deprecation")
public class NsharpResourceHandler {
- private IRenderableDisplay[] displayArray=null;
- private NsharpPartListener.PartEvent editorPartStatus =NsharpPartListener.PartEvent.partClosed;
- private NsharpSkewTPaneResource skewtPaneRsc;
- private NsharpWitoPaneResource witoPaneRsc;
- private NsharpHodoPaneResource hodoPaneRsc;
- private NsharpTimeStnPaneResource timeStnPaneRsc;
- private NsharpInsetPaneResource insetPaneRsc;
- private NsharpDataPaneResource dataPaneRsc;
- private NsharpSpcGraphsPaneResource spcGraphsPaneRsc;
- private NsharpAbstractPaneResource futurePaneRsc;
- private String[] defaultDays;
- NsharpNative nsharpNative=null;
- private int displayDataPageMax;
- private static final int INSETPAGEMAX =2;
- private int currentTextChapter= 1;
- private int currentInsetPage= 1;
- private int cnYOrig = NsharpConstants.COLOR_NOTATION_Y_ORIG;
- private int dtNextPageEnd = NsharpConstants.DATA_TIMELINE_NEXT_PAGE_END_;
- private int charHeight = NsharpConstants.CHAR_HEIGHT_;
- private int dtXOrig = NsharpConstants.DATA_TIMELINE_X_ORIG;
- private int dtYOrig = NsharpConstants.DATA_TIMELINE_Y_ORIG;
- private int dtWidth = NsharpConstants.DATA_TIMELINE_WIDTH;
- private String paneConfigurationName;
- private int numTimeLinePerPage=1;
- /* Hodograph Modes - definition is based on definitions in globals_xw.h of BigNsharp */
- private static final int HODO_NORMAL = 0;
- //private static int HODO_EFFECTIVE= 1; not used in BigNsharp source code
- private static final int HODO_STORMRELATIVE= 2;
- @SuppressWarnings("unused")
- private static final int HODO_BNDRY= 3;
- private static final int HODO_MEANWIND= 4;
- @SuppressWarnings("unused")
- private int currentHodoWindMode = HODO_MEANWIND;
- private NsharpConfigManager configMgr;
- private NsharpConfigStore configStore;
- private NsharpGraphProperty graphConfigProperty;
- private HashMap linePropertyMap;
- private NsharpDataPageProperty dataPageProperty;
- private int[] pageDisplayOrderNumberArray = new int[NsharpConstants.PAGE_MAX_NUMBER+1]; //index is the real page defined in NsharpConstants to be shown, value is the order number of this page. index 0 point to a dummy.
- private boolean overlayIsOn = false;
- private boolean interpolateIsOn = false;
- private boolean compareSndIsOn = false;
- private boolean compareStnIsOn = false;
- private boolean compareTmIsOn = false;
- private boolean editGraphOn=false;
- private boolean getTimeMatcher=false;
- public int TEMP_TYPE = 1;
- public int DEWPOINT_TYPE = 2;
- private int currentTempCurveType;
- private int currentSoundingLayerIndex =0;
- private int hodoEditingSoundingLayerIndex =0;
- private boolean plotInteractiveTemp= false;
- private Coordinate interactiveTempPointCoordinate;
- public static final float INVALID_DATA = NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA;
- protected static final double BARB_LENGTH = 3.5;
- private String soundingType= null;
-
- protected DataTime displayedSounding;
-
- private int currentGraphMode= NsharpConstants.GRAPH_SKEWT;
-
- protected ListenerList listenerList = new ListenerList();
-
- //current active sounding layer list
- private List soundingLys = null;
- private List previousSoundingLys = null;
- private String pickedStnInfoStr; // current picked stn info with time line, e.g. "ATLH 101209/03(Thu)V003"
- private NsharpStationInfo pickedStnInfo = null;
- private IFrameCoordinator.FrameChangeOperation currentOpDirection = IFrameCoordinator.FrameChangeOperation.NEXT; // next =forward
- private HashMap stormSlinkyColorMap = new HashMap();
-
- private List>>stnTimeSndTable = new ArrayList< List>>();
- // stnTimeSndTable:
- // Store all sounding profiles property for GUI display control
- // 1st index refer to stnId, 2nd index refer to time line and 3rd point to sndType.
- // It is same as [][][] 3d array.
- // We dynamically expand this 3D array based on newly added stnid/timeline/sndType When a new sounding data is loaded,
- // All unloaded element is null. Only when user load new sounding with this stnId/this time line/this sndType, then
- // the element allocated.
- //
- // stn3-> T1--->T2--->T3->...
- // ^
- // /
- // stn2-> T1--->T2--->T3->...
- // ^
- // /
- //stn1-> T1--->T2--->T3->...
- // | | |
- // V V V
- // snd1 snd1 snd1
- // | | |
- // V V V
- // snd2 snd2 snd2
- // | | |
- // V V V
- // stnTimeSndTable first dimension (station id) should be in sync with stnElementList,
- // 2nd dimension (time line) should be in sync with timeElementList, and
- // 3rd dimension (sounding type) should be in sync with sndTypeElementList
- // NULL element in stnTimeSndTable indicates that sounding data is not loaded yet.
-
- private List stnElementList = new ArrayList();
- private List timeElementList = new ArrayList();
- private List sndElementList = new ArrayList();
- private NsharpSoundingElementStateProperty curSndProfileProp = null;
- private NsharpSoundingElementStateProperty preSndProfileProp = null;
- private int curTimeLinePage=1;
- private int totalTimeLinePage=1;
- private int curStnIdPage=1;
- private int totalStnIdPage=1;
- private int curSndPage=1;
- private int totalSndPage=1;
- private int previousTimeLineStateListIndex;
-
- private int currentStnElementListIndex=-1; //index to first dim of stnTimeSndTable and index to stnElementList
- private int currentTimeElementListIndex=-1;//index to 2nd dim of stnTimeSndTable and index to timeElementList
- private int currentSndElementListIndex=-1;//index to 3rd dim of stnTimeSndTable and index to sndElementList
-
- //use element state, NsharpConstants.LoadState or NsharpConstants.ActState, as key to set color for drawing
- private HashMap elementColorMap = new HashMap();
- private short currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- private float currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
- private float smWindDir, smWindSpd;
-
- public List>> getStnTimeSndTable() {
- return stnTimeSndTable;
- }
- public List getAllLoadedSndDesciptionList(){
- List strLst = new ArrayList();
- for(List> tlListList: stnTimeSndTable){
- // add a new element for the new sndType to each existing sndlist of each existing time of each existing stnId
- for(List sndtyList: tlListList){
- for (NsharpSoundingElementStateProperty elem: sndtyList){
- if(elem!=null)
- strLst.add(elem.getElementDescription());
- }
- }
- }
- return strLst;
- }
-
- public List getStnElementList() {
- return stnElementList;
- }
-
-
- public List getTimeElementList() {
- return timeElementList;
- }
-
-
- public List getSndElementList() {
- return sndElementList;
- }
-
-
- public int getCurrentStnElementListIndex() {
- return currentStnElementListIndex;
- }
-
-
- public int getCurrentTimeElementListIndex() {
- return currentTimeElementListIndex;
- }
-
- public int getTimeElementListSize(){
- return timeElementList.size();
- }
-
- public int getCurrentSndElementListIndex() {
- return currentSndElementListIndex;
- }
-
-
- //shape and color storage
- public class ShapeAndLineProperty {
- IWireframeShape shape;
- NsharpLineProperty lp;
- public ShapeAndLineProperty() {
- super();
- lp = new NsharpLineProperty();
- }
-
- }
- public HashMap getLinePropertyMap() {
- return linePropertyMap;
- }
-
-
-
- public boolean isCompareStnIsOn() {
- return compareStnIsOn;
- }
- public boolean isCompareTmIsOn() {
- return compareTmIsOn;
- }
-
- public boolean isCompareSndIsOn() {
- return compareSndIsOn;
- }
-
-
- public boolean isOverlayIsOn() {
- return overlayIsOn;
- }
-
-
- public NsharpNative getNsharpNative() {
- return nsharpNative;
- }
-
-
-
- public void setNextTextChapter(){
- if(currentTextChapter == displayDataPageMax){
- currentTextChapter = 1;
- }
- else
- currentTextChapter++;
- }
- public void setNextInsetPage(){
- if(currentInsetPage == INSETPAGEMAX){
- currentInsetPage = 1;
- }
- else
- currentInsetPage++;
- }
-
-
- public void setOverlayIsOn(boolean overlay) {
- previousSoundingLys=null;
- previousTimeLineStateListIndex=-1;
- preSndProfileProp = null;
- this.overlayIsOn = overlay;
-
- if(hodoPaneRsc!=null)
- hodoPaneRsc.createRscHodoWindShapeAll();
- if(skewtPaneRsc!=null)
- skewtPaneRsc.handleResize();
- }
-
- public boolean isInterpolateIsOn() {
- return interpolateIsOn;
- }
-
- /*
- * When compareStnIsOn is changed,
- */
- public void setCompareStnIsOn(boolean compareIsOn) {
- this.compareStnIsOn = compareIsOn;
-
- //This is the case when sounding data is not available at currentTimeElementListIndex/currentSndElementListIndex/currentStnElementListIndex and user set
- // compare stn on.
- if(compareStnIsOn){
- if(soundingLys==null && currentTimeElementListIndex>=0 && currentSndElementListIndex>=0){
- //find a new available stn for current time and sndType
- boolean found = false;
- for(int i =0; i< stnElementList.size(); i++){
- if(stnElementList.get(i).getActionState() == NsharpConstants.ActState.ACTIVE
- && stnTimeSndTable.get(i).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- found = true;
- currentStnElementListIndex = i;
- }
-
- if(found)
- break;
- }
- if(!found)
- return;
- }
-
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: stnElementList) {
- int stnIndex = stnElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(stnIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- //if(colorIndex > NsharpConstants.LINE_COMP10)
- // colorIndex = NsharpConstants.LINE_COMP1;
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- }
-
- public void setCompareSndIsOn(boolean compareSndIsOn) {
- this.compareSndIsOn = compareSndIsOn;
- //This is the case when sounding data is not available at currentTimeElementListIndex/currentSndElementListIndex/currentStnElementListIndex and user set
- // compSnd on
- if(compareSndIsOn){
- if(soundingLys==null && currentStnElementListIndex >=0 && currentTimeElementListIndex >=0){
- //find a new available snd type for current time and stn
- boolean found = false;
- for(int i =0; i< sndElementList.size(); i++){
- if(sndElementList.get(i).getActionState() == NsharpConstants.ActState.ACTIVE
- && stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(i)!=null){
- found = true;
- currentSndElementListIndex = i;
- }
- if(found)
- break;
- }
- if(!found)
- return;
- }
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: sndElementList) {
- int sndIndex = sndElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(sndIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- //if(colorIndex > NsharpConstants.LINE_COMP10)
- // colorIndex = NsharpConstants.LINE_COMP1;
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
-
- }
-
-
- public void setCompareTmIsOn(boolean compareIsOn) {
- this.compareTmIsOn = compareIsOn;
- //This is the case when sounding data is not available at currentTimeElementListIndex/currentSndElementListIndex/currentStnElementListIndex and user set
- // compTm on
- if(compareIsOn){
- if(soundingLys==null && currentStnElementListIndex >=0 && currentSndElementListIndex >=0){
- //find a new available time line for current snd type and stn
- boolean found = false;
- for(int i =0; i< timeElementList.size(); i++){
- if(timeElementList.get(i).getActionState() == NsharpConstants.ActState.ACTIVE
- && stnTimeSndTable.get(currentStnElementListIndex).get(i).get(currentSndElementListIndex)!=null){
- found = true;
- currentTimeElementListIndex = i;
- }
- if(found)
- break;
- }
- if(!found)
- return;
- }
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: timeElementList) {
- int tmIndex = timeElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(tmIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- //if(colorIndex > NsharpConstants.LINE_COMP10)
- // colorIndex = NsharpConstants.LINE_COMP1;
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- }
-
- public void setEditGraphOn(boolean editGraphOn) {
- this.editGraphOn = editGraphOn;
- }
-
- public boolean isEditGraphOn() {
- return editGraphOn;
- }
-
-
- public int getCurrentGraphMode() {
- return currentGraphMode;
- }
-
- public void setCurrentGraphMode(int currentGraphMode) {
- this.currentGraphMode = currentGraphMode;
- if(skewtPaneRsc!=null)
- skewtPaneRsc.setCurrentGraphMode(currentGraphMode);
- refreshPane();
- }
-
-
- public short getCurrentParcel() {
- return currentParcel;
- }
-
- //native nsharp c/fortran lib
- //NsharpNative is native nsharp lib awips/lib/libnsharp.so wrapper class
-
- public float getSmWindDir() {
- return smWindDir;
- }
- public float getSmWindSpd() {
- return smWindSpd;
- }
-
- public void setCurrentHodoWindMode(int cursorPositionIndex) {
- switch(cursorPositionIndex){
- case 0:
- this.currentHodoWindMode = HODO_NORMAL;
- break;
- case 1:
- this.currentHodoWindMode = HODO_STORMRELATIVE;
- break;
- case 2:
- default:
- this.currentHodoWindMode = HODO_MEANWIND;
- break;
- }
- }
-
- public NsharpStationInfo getPickedStnInfo() {
- return pickedStnInfo;
- }
- public String getSoundingType() {
- return soundingType;
- }
-
-
- public void setSoundingType(String soundingType) {
- this.soundingType = soundingType;
- }
-
- public void setCurrentParcel(short currentParcel) {
- this.currentParcel = currentParcel;
- currentParcelLayerPressure=NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
- //inform data/skewT panel as well
- if(dataPaneRsc!=null){
- dataPaneRsc.setCurrentParcel(currentParcel);
- }
- if(skewtPaneRsc!=null){
- if(currentParcel == NsharpNativeConstants.PARCELTYPE_USER_DEFINED)
- currentParcelLayerPressure = NsharpParcelDialog.getUserDefdParcelMb();
- skewtPaneRsc.createRscParcelTraceShapes(currentParcel,currentParcelLayerPressure);
- skewtPaneRsc.createRscParcelRtTraceShapesList(currentParcel,currentParcelLayerPressure);
- skewtPaneRsc.createLCLEtcLinesShape();
- }
- }
-
- public void updateParcelFromPanel(short currentParcel){
- this.currentParcel = currentParcel;
- currentParcelLayerPressure=NsharpNativeConstants.parcelToLayerMap.get(currentParcel);
- if(skewtPaneRsc!=null){
- skewtPaneRsc.createRscParcelTraceShapes(currentParcel,currentParcelLayerPressure);
- skewtPaneRsc.createRscParcelRtTraceShapesList(currentParcel,currentParcelLayerPressure);
- skewtPaneRsc.createLCLEtcLinesShape();
- }
- }
-
- public void setHodoStmCenter(Coordinate hodoHouseC) {
- if(hodoPaneRsc==null)
- return;
- //hodoPaneRsc.setHodoHouseC(hodoHouseC);
- Coordinate c = hodoPaneRsc.getHodoBackground().getWorld().unMap(hodoHouseC.x, hodoHouseC.y);
- c = WxMath.speedDir((float) c.x, (float) c.y);
- smWindDir = (float) c.y;
- smWindSpd = (float)c.x;
- nsharpNative.nsharpLib.set_storm(smWindSpd, smWindDir);
- if(insetPaneRsc!=null){
- WGraphics WGc = insetPaneRsc.getPsblWatchTypeBackground().getWorld();
- insetPaneRsc.createBkgPsblWatchShape(WGc);
-
- //Sr wind vs Height graph shape need to recreate
- WGc= insetPaneRsc.getSrWindsBackground().getWorld();
- insetPaneRsc.createRscSrWindShape(WGc);
- }
- if(skewtPaneRsc!=null){
- skewtPaneRsc.createEffectiveLayerLinesShape();
- skewtPaneRsc.updatePsblWatchColor();
- }
- }
-
- //This function is called only when interpolation "on/off" is changed by user
- public void resetInfoOnInterpolate(boolean interpolateIsOn) throws CloneNotSupportedException{
- //We dont want to assume previous interpolation on/off state. So, reset soundingLys any how.
- this.interpolateIsOn = interpolateIsOn;
- NsharpSoundingElementStateProperty elem = getCurSoundingElementStateProperty();
- if(elem!=null){
- if(interpolateIsOn==false){
- soundingLys = elem.getSndLyLst();
-
- }
- else{
- /*
- //TTR829
- //interpolation is on
- //we dont want to change original raw data, so use a deep copy
- List intpSndLst = new ArrayList();
- for(NcSoundingLayer layer: elem.getSndLyLst() ) {
- intpSndLst.add((NcSoundingLayer) layer.clone());
- }
-
- // interpolation
- intpSndLst = performInterpolation(intpSndLst);
-
- soundingLys = intpSndLst;*/
- //end TTR829
- soundingLys = performInterpolation(soundingLys);
- }
-
-
- nsharpNative.populateSndgData(soundingLys);
- if(skewtPaneRsc!=null)
- skewtPaneRsc.resetData(soundingLys,previousSoundingLys);
- if(hodoPaneRsc!=null)
- hodoPaneRsc.resetData(soundingLys,previousSoundingLys);
- if(witoPaneRsc!=null)
- witoPaneRsc.resetData(soundingLys, previousSoundingLys);
- if(dataPaneRsc!=null)
- dataPaneRsc.resetData(soundingLys, previousSoundingLys);
- if(insetPaneRsc!=null)
- insetPaneRsc.resetData(soundingLys, previousSoundingLys);
-
- //re-create shape
- if(skewtPaneRsc!=null)
- skewtPaneRsc.handleResize();
- if(hodoPaneRsc!=null)
- hodoPaneRsc.createRscHodoWindShapeAll();
- if(insetPaneRsc!=null)
- insetPaneRsc.createInsetWireFrameShapes();
- if(witoPaneRsc!=null)
- witoPaneRsc.createRscWireFrameShapes();
-
- }
-
- }
-
-
- public void handleNsharpEditorPartEvent(NsharpPartListener.PartEvent pStatus){
- switch(pStatus){
- case partActivated:
- if(editorPartStatus != NsharpPartListener.PartEvent.partDeactivated){
- //repopulateSndgData();
- //resetRsc();
- resetData();
- }
-
- break;
- default:
- break;
- }
- editorPartStatus = pStatus;
- }
- public void resetRsc() {
- restoreAllSoundingData();
- NsharpSoundingElementStateProperty elem = getCurSoundingElementStateProperty();
- if(elem!=null){
- this.soundingLys = elem.getSndLyLst();
- //Set default parcel trace data
- currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
- setSoundingInfo(this.soundingLys);
- currentTextChapter = 1;
- overlayIsOn = false;
- interpolateIsOn = false;
- compareStnIsOn = false;
- compareSndIsOn = false;
- compareTmIsOn = false;
- editGraphOn = false;
- if(skewtPaneRsc!=null)
- skewtPaneRsc.setCurrentSkewTEditMode(NsharpConstants.SKEWT_EDIT_MODE_EDITPOINT);
- resetData();
- }
-
- }
- public synchronized void resetData(){
- //System.out.println("resetData called, rscHdr="+this.toString() + " pickedStnInfoStr="+pickedStnInfoStr+ " nsharpNative="+nsharpNative.toString());
-
- //update active sounding layer and picked stn info
- //re-populate snd data to nsharp native code lib for later calculating
- nsharpNative.populateSndgData(soundingLys);
- if(skewtPaneRsc!=null)
- skewtPaneRsc.resetData(soundingLys,previousSoundingLys);
- if(hodoPaneRsc!=null)
- hodoPaneRsc.resetData(soundingLys,previousSoundingLys);
- if(insetPaneRsc!=null)
- insetPaneRsc.resetData(soundingLys, previousSoundingLys);
- if(dataPaneRsc!=null)
- dataPaneRsc.resetData(soundingLys, previousSoundingLys);
- if(witoPaneRsc!=null)
- witoPaneRsc.resetData(soundingLys, previousSoundingLys);
-
- NsharpShowTextDialog textarea = NsharpShowTextDialog.getAccess();
- if(textarea != null){
- textarea.refreshTextData();
- }
- //if soundingLys is null, then we stop here, after reset data.
- if(soundingLys == null)
- return;
- if(soundingLys.size() >0){
- //set initial hodohouseC
-
- // ----- set hodo circle at Bunkers Right, Chin according to TTR6065 or RaytheonTicket#10438
- FloatByReference dummy1= new FloatByReference(-999);
- FloatByReference dummy2= new FloatByReference(-999);
- FloatByReference bwdir= new FloatByReference(-999);
- FloatByReference bwspd= new FloatByReference(-999);
- nsharpNative.nsharpLib.bunkers_storm_motion(dummy1, dummy2, bwdir, bwspd);
- //System.out.println("resetData windspd="+ bwspd.getValue()+ " dir="+bwdir.getValue());
- smWindSpd = bwspd.getValue();
- smWindDir = bwdir.getValue();
- nsharpNative.nsharpLib.set_storm(smWindSpd, smWindDir);
-
- //reset parcel
- currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
- //reset parcel dialog as well
- if(NsharpParcelDialog.getAccess()!=null){
- NsharpParcelDialog.getAccess().resetUserDefParcel();
- }
- /* Chin:::
- * This api is called in many scenarios.
- * User may want to keep his previous picked parcel type.
- * Therefore, thdataPaneRsc.resetCurrentParcel should be called from
- * other area that really meant to reset parcel type.
- */
- }
- //Chin: TBD remove handle resize here to fix sizing issue when swapped nsharp from side pane back to main pane
- // but, may cause other problem?
- //if(skewtPaneRsc!=null)
- //skewtPaneRsc.handleResize();
- if(skewtPaneRsc!=null)
- skewtPaneRsc.createRscWireFrameShapes();
- if(hodoPaneRsc!=null)
- hodoPaneRsc.createRscHodoWindShapeAll();
- if(insetPaneRsc!=null)
- insetPaneRsc.createInsetWireFrameShapes();
- if(witoPaneRsc!=null)
- witoPaneRsc.createAllWireFrameShapes();
- }
- private class NsharpOperationElementComparator implements Comparator{
- @Override
- public int compare(NsharpOperationElement o1, NsharpOperationElement o2) {
-
- String s1tok1="";//, s1tok2="";
- String s2tok1="";//, s2tok2="";
- StringTokenizer st1 = new StringTokenizer(o1.getElementDescription());
- int tkCount1 = st1.countTokens();
- //System.out.println("ElementComparatorTimeLine o1="+o1.elementDescription+"c1 = "+tkCount1);
- if(tkCount1 >= 1)
- {
- s1tok1 = st1.nextToken();
- }
- else{
- return 0;
-
- }
- //System.out.println("t1="+s1tok1+" t2="+s2tok1);
- StringTokenizer st2 = new StringTokenizer(o2.getElementDescription());
- int tkCount2 = st2.countTokens();
- //System.out.println("ElementComparatorTimeLine o2="+o2.elementDescription+"c2 = "+tkCount2);
- if(tkCount2 >= 1)
- {
- s2tok1 = st2.nextToken();
- }
- else{
- return 0;
-
- }
- //System.out.println("t1="+s2tok1+" t2="+s2tok2);
- if(s1tok1.compareTo(s2tok1) == 0){
- return 0;
- }else if (s1tok1.compareTo(s2tok1) < 0){
- return 1;
- } else if (s1tok1.compareTo(s2tok1) > 0) {
- return -1;
- }
- return 0;
- }
- }
-
- private int getIndexFromElementList(String targetDescription, List elemLst){
- for(NsharpOperationElement sndProp: elemLst){
- if(sndProp.getElementDescription().equals(targetDescription) )
- return elemLst.indexOf(sndProp);
-
- }
- return -1;
- }
-
- private void restoreAllSoundingData(){
- for(List> tlListList: stnTimeSndTable){
- // add a new element for the new sndType to each existing sndlist of each existing time of each existing stnId
- for(List sndtyList: tlListList){
- for (NsharpSoundingElementStateProperty elem: sndtyList){
- if(elem!=null)
- elem.restoreSndLyLstFromBackup();
- }
- }
- }
- }
- private int addElemToElemList(String elemDesc,List elemList){
- NsharpOperationElement elem = new NsharpOperationElement(elemDesc,NsharpConstants.ActState.ACTIVE);
- elemList.add(elem);
- Collections.sort(elemList, new NsharpOperationElementComparator());
- return elemList.indexOf(elem);
- }
- private void addNewSndToStnTimeSndTable(int sndIndex){
- for(List> tlListList: stnTimeSndTable){
- // add a new element for the new sndType to each existing sndlist of each existing time of each existing stnId
- for(List sndtyList: tlListList){
- sndtyList.add(sndIndex,null);
- }
- }
- }
- private void addNewStnToStnTimeSndTable(int stnIndex){
- // Add new stnid to outer list of stnTimeSndTable
- List> listListForNewStn = new ArrayList>();
- // based on new stn id, add list for each existing time line
- for(int i=0; i sndListForTm = new ArrayList();
- for(int j=0; j< sndElementList.size(); j++ ){
- sndListForTm.add(null);
- }
- listListForNewStn.add(sndListForTm);
- }
- stnTimeSndTable.add(stnIndex, listListForNewStn);
- }
- private void addNewTimeToStnTimeSndTable(int timeIndex){
- for(List> tlListList: stnTimeSndTable){
- // based on sndTypeElementList
- //create sndlist for the new time line for each existing stnid
- List newSndList = new ArrayList();
- for(int i=0; i< sndElementList.size();i++ ){
- newSndList.add(null);
- }
- //add sndlist for the new time line to stn list
- tlListList.add(timeIndex,newSndList);
- }
- }
- private void addElementToTableAndLists(String stnId_timeLine_sndType,String stnId, String tmLine, String sndType, NsharpStationInfo stnInfo, List sndLyLst){
- //System.out.println("stn to be added "+ stnId + " timeline "+tmLine);
- NsharpSoundingElementStateProperty newSndPropElem=null;
- int tmIndex = getIndexFromElementList(tmLine, timeElementList);
- int stnIndex = getIndexFromElementList(stnId, stnElementList);
- int sndTpyeIndex = getIndexFromElementList(sndType, sndElementList);
- currentTimeElementListIndex = tmIndex;
- currentStnElementListIndex = stnIndex;
- currentSndElementListIndex = sndTpyeIndex;
- //based on these 3 indexes, we have 8 cases to handle.
- if(tmIndex>=0 && stnIndex>=0 && sndTpyeIndex>=0){
- //CASE1: All 3 index are good (>=0)
- if(stnTimeSndTable.get(stnIndex).get(tmIndex).get(sndTpyeIndex) != null)
- // this sounding element is already loaded
- return;
- else {
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType,stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(stnIndex).get(tmIndex).set(sndTpyeIndex, newSndPropElem);
- }
- }
- else if (tmIndex >=0 ){
- if(stnIndex >=0 ){
- //CASE2 : tmIndex/stnIndex are good (>=0), sndTpyeIndex is bad (<0), a new snd type
- //add new sndType to sndTypeElementList
- currentSndElementListIndex = addElemToElemList(sndType,sndElementList );
- //Add new snd type to each snd type list of stnTimeSndTable
- addNewSndToStnTimeSndTable(currentSndElementListIndex);
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).set(currentSndElementListIndex, newSndPropElem);
- }
- else{
- if(sndTpyeIndex >=0){
- //CASE3 : tmIndex/sndTpyeIndex are good, stnIndex is bad (<0), a new stnId
- //add new stn to stnElementList
- currentStnElementListIndex = addElemToElemList(stnId,stnElementList );
- // Add new stnid to outer list of stnTimeSndTable
- addNewStnToStnTimeSndTable(currentStnElementListIndex);
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).set(currentSndElementListIndex, newSndPropElem);
-
- }
- else{
- //CASE4 : tmIndex is good, stnIndex/sndTpyeIndex are bad (<0), new stnId and new snd type
- //add new stn to stnElementList
- currentStnElementListIndex = addElemToElemList(stnId,stnElementList );
- //add new sndType to sndTypeElementList
- currentSndElementListIndex = addElemToElemList(sndType,sndElementList );
- //Add new snd type to each snd type list of stnTimeSndTable
- addNewSndToStnTimeSndTable(currentSndElementListIndex);
- // Add new stnid to outer list of stnTimeSndTable
- addNewStnToStnTimeSndTable(currentStnElementListIndex);
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).set(currentSndElementListIndex, newSndPropElem);
-
- }
- }
- }
- else{
- if(stnIndex >=0 ){
- if(sndTpyeIndex >=0){
- //CASE5 : stnIndex/sndTpyeIndex are good, tmIndex is bad (<0)
- //add new time line to timeElementList
- currentTimeElementListIndex = addElemToElemList(tmLine,timeElementList );
- //add new time line to StnTimeSndTable
- addNewTimeToStnTimeSndTable(currentTimeElementListIndex);
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).set(currentSndElementListIndex, newSndPropElem);
-
- }
- else{
- //CASE6 : stnIndex is good, tmIndex/sndTpyeIndex are bad (<0)
- //add new time line to timeElementList
- currentTimeElementListIndex = addElemToElemList(tmLine,timeElementList );
- //add new sndType to sndTypeElementList
- currentSndElementListIndex = addElemToElemList(sndType,sndElementList );
- //Add new snd type to each snd type list of stnTimeSndTable
- addNewSndToStnTimeSndTable(currentSndElementListIndex);
- //add new time line to StnTimeSndTable
- addNewTimeToStnTimeSndTable(currentTimeElementListIndex);
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).set(currentSndElementListIndex, newSndPropElem);
-
- }
-
- }
- else{
- if(sndTpyeIndex >=0){
- //CASE7 : sndTpyeIndex is good, tmIndex/stnIndex are bad (<0)
- //add new time line to timeElementList
- currentTimeElementListIndex = addElemToElemList(tmLine,timeElementList );
- //add new stn to stnElementList
- currentStnElementListIndex = addElemToElemList(stnId,stnElementList );
- //add new time line to StnTimeSndTable
- addNewTimeToStnTimeSndTable(currentTimeElementListIndex);
- // Add new stnid to outer list of stnTimeSndTable
- addNewStnToStnTimeSndTable(currentStnElementListIndex);
- //replace previously added "null" object with real NsharpSoundingElementStateProperty object
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).set(currentSndElementListIndex, newSndPropElem);
-
- }
- else{
- //CASE8 : All are bad (<0)
- // an element with new time line, new stnId and new sndType
- //add new time line to timeElementList
- currentTimeElementListIndex = addElemToElemList(tmLine,timeElementList );
- //add new stn to stnElementList
- currentStnElementListIndex = addElemToElemList(stnId,stnElementList );
- //add new sndType to sndTypeElementList
- currentSndElementListIndex = addElemToElemList(sndType,sndElementList );
-
- //Construct stnTimeSndTable
- if(stnTimeSndTable.size()>0){
- List> listListForNewStn = new ArrayList>();
- // based on new stn id, add list for each existing time line
- for(NsharpOperationElement tmElem: timeElementList){
- // based on each time line, add element for each existing sndType
- List sndlistForTm = new ArrayList();
- for(NsharpOperationElement sndElem: sndElementList ){
- if(tmLine.equals(tmElem.getElementDescription()) && sndType.equals(sndElem.getElementDescription()) ){
- //only one case falls in this route as only one new loaded sounding data
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine, stnInfo, sndLyLst);
-
- sndlistForTm.add(newSndPropElem);
- }
- else{
- //create for not avail sounding profiles
- sndlistForTm.add(null);
- }
- }
- listListForNewStn.add(sndlistForTm);
- }
-
- //Now update stnTimeSndTable by adding "dummy" NsharpSoundingElementStateProperty to all exiting stn listList and time list
- //Note that we have NOT added "listListForNewStn" to stnTimeSndTable yet.
- //we have to update current table now
- for(List> tlListList: stnTimeSndTable){
- // add a new element for the new sndType to each existing sndlist of each existing time of each existing stnId
- for(List sndtyList: tlListList){
- sndtyList.add(currentSndElementListIndex,null);
- }
- // based on sndTypeElementList
- //add a new sndlist for the new time line for each existing stnid
- List newSndList = new ArrayList();
- for(int i=0;i< sndElementList.size();i++ ){
- {
- newSndList.add(null);
- }
- }
- tlListList.add(currentTimeElementListIndex,newSndList);
- }
- //finally, add this new stn list to table
- stnTimeSndTable.add(currentStnElementListIndex, listListForNewStn);
- }
- else{
- //this is the case, we are adding first element to stnTimeSndTable
- // need a new stn time line list to stnTimeSndTable
- List newList = new ArrayList();
- List> newListList = new ArrayList>();
-
- newSndPropElem =
- new NsharpSoundingElementStateProperty(stnId_timeLine_sndType, stnId, tmLine,stnInfo, sndLyLst);
- newList.add(newSndPropElem);
- newListList.add(newList);
- stnTimeSndTable.add(newListList);
- curSndProfileProp=newSndPropElem;
- return;
- }
-
- }
- }
- }
- setCurSndProfileProp();
-
- }
- private void setCurSndProfileProp() {
- if(currentTimeElementListIndex <0 || currentTimeElementListIndex >= timeElementList.size()||
- currentStnElementListIndex < 0 || currentStnElementListIndex >= stnElementList.size()
- || currentSndElementListIndex<0 || currentSndElementListIndex>= sndElementList.size()){
- curSndProfileProp = null;
- preSndProfileProp = null;
- }
- else {
- preSndProfileProp = curSndProfileProp;
- curSndProfileProp = stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex);
- }
- }
- private void cleanUpStnTimeSndTable(int stni, int tmi, int sndi){
- boolean found = false;
- //find if this station is no longer in use
- List> tlListList = stnTimeSndTable.get(stni);
- for(List sndtyList: tlListList){
- for (NsharpSoundingElementStateProperty elem: sndtyList){
- if(elem!=null) {
- found = true;
- break;
- }
- }
- if(found)
- break;
- }
- if(!found){
- //This stn is no longer in use...delete it from stnTimeSndTable and stnElementList
- stnElementList.remove(stni);
- tlListList= stnTimeSndTable.remove(stni);
- tlListList.clear();
- }
- //find if this time line is no longer in use
- found = false;
- for (List> tmListListForStn: stnTimeSndTable){
- List sndtyListForTm = tmListListForStn.get(tmi);
- for (NsharpSoundingElementStateProperty elem: sndtyListForTm){
- if(elem!=null) {
- found = true;
- break;
- }
- }
- if(found)
- break;
- }
- if(!found){
- //This time line is no longer in use...delete it from stnTimeSndTable and timeElementList
- timeElementList.remove(tmi);
- for (List> tmListListForStn: stnTimeSndTable){
- List sndtyListForTm = tmListListForStn.remove(tmi);
- sndtyListForTm.clear();
- }
- }
- //find if this sounding type is no longer in use
- found = false;
- for (List> tmListListForStn: stnTimeSndTable){
- for(List sndtyListForTm : tmListListForStn){
- NsharpSoundingElementStateProperty elem= sndtyListForTm.get(sndi);
- if(elem!=null) {
- found = true;
- break;
- }
- }
- if(found)
- break;
- }
- if(!found){
- //This sounding type is no longer in use...delete it from stnTimeSndTable and sndElementList
- sndElementList.remove(sndi);
- for (List> tmListListForStn: stnTimeSndTable){
- for(List sndtyListForTm : tmListListForStn){
- sndtyListForTm.remove(sndi);
- }
- }
- }
-
- }
- public boolean deleteRsc(List deletingDataTimeList){
- boolean curSndDeleted = false;
- for(String dataTmLine: deletingDataTimeList){
- if(curSndProfileProp!=null && curSndProfileProp.getElementDescription().equals(dataTmLine)){
- curSndDeleted = true;
- }
- //find deleting element from stnTimeSndTable and null it
- boolean setdone = false;
- for(List> tlListList: stnTimeSndTable){
- for(List sndtyList: tlListList){
- for (NsharpSoundingElementStateProperty elem: sndtyList){
- if(elem!=null && dataTmLine.equals(elem.getElementDescription())){
- int sndi = sndtyList.indexOf(elem);
- int tmi = tlListList.indexOf(sndtyList);
- int stni = stnTimeSndTable.indexOf(tlListList);
- sndtyList.set(sndtyList.indexOf(elem),null);
- setdone = true;
- // clean up stnTimeSndTable if a stn/timeline/snd is no longer in use
- cleanUpStnTimeSndTable(stni,tmi,sndi);
- break;
- }
- }
- if(setdone)
- break;
- }
- if(setdone)
- break;
- }
- }
-
- if(curSndDeleted || soundingLys == null){
- //this is the case that we are deleting current snd, so, a new current snd should be selected
- curSndProfileProp = null;
- //find CurrentElementIndexes After Delete current snding
- boolean found = false;
- int stni=0;
- for(List> tlListList: stnTimeSndTable){
- int timei=0;
- for(List sndtyList: tlListList){
- int sndi=0;
- for (NsharpSoundingElementStateProperty elem: sndtyList){
- if(elem!=null && stnElementList.get(stni).getActionState()== NsharpConstants.ActState.ACTIVE &&
- timeElementList.get(timei).getActionState()== NsharpConstants.ActState.ACTIVE &&
- sndElementList.get(sndi).getActionState()== NsharpConstants.ActState.ACTIVE){
- currentStnElementListIndex = stni;
- currentSndElementListIndex = sndi;
- currentTimeElementListIndex = timei;
- found = true;
- break;
- }
- sndi++;
- }
- if(found)
- break;
- timei++;
- }
- if(found)
- break;
- stni++;
- }
- if(!found){
- currentStnElementListIndex = -1;
- currentSndElementListIndex = -1;
- currentTimeElementListIndex = -1;
- }
- setCurSndProfileProp();
- }
- else{
- // currentStnElementListIndex, currentSndElementListIndex and currentTimeElementListIndex may not point to right element
- //after some elements are deleted.
- currentStnElementListIndex = -1;
- currentTimeElementListIndex = -1;
- currentSndElementListIndex = -1;
- if(curSndProfileProp!= null){
- boolean found = false;
- for (List> tmListListForStn: stnTimeSndTable){
- for(List sndtyListForTm : tmListListForStn){
- for (NsharpSoundingElementStateProperty elem: sndtyListForTm){
- if(elem!=null && curSndProfileProp.getElementDescription().equals(elem.getElementDescription())){
- currentSndElementListIndex = sndtyListForTm.indexOf(elem);
- currentTimeElementListIndex = tmListListForStn.indexOf(sndtyListForTm);
- currentStnElementListIndex = stnTimeSndTable.indexOf(tmListListForStn);
- found= true;
- break;
- }
- }
- if(found)
- break;
- }
- if(found)
- break;
- }
- }
- }
- setCurrentSoundingLayerInfo();
- resetData();
- System.out.println("num="+getFrameCount());
- return curSndDeleted;
- // anything more to do?
- }
- public void deleteRscAll(){
- NsharpMapResource nsharpMapResource = NsharpMapResource.getOrCreateNsharpMapResource();
- nsharpMapResource.setPoints(null);
- if(soundingLys!=null){
- soundingLys.clear();
- soundingLys=null;
- }
- if(previousSoundingLys!=null){
- previousSoundingLys.clear();
- previousSoundingLys = null;
- }
- if(stnTimeSndTable != null){
- for(List> stnListList: stnTimeSndTable){
- for(List timeList: stnListList){
- timeList.clear();
- }
- stnListList.clear();
- }
- stnTimeSndTable.clear();
- }
- if(timeElementList != null)
- timeElementList.clear();
- if(stnElementList != null)
- stnElementList.clear();
- if(sndElementList != null)
- sndElementList.clear();
- curSndProfileProp = null;
- preSndProfileProp = null;
- currentTextChapter = 1;
- currentInsetPage = 1;
- currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
- currentTimeElementListIndex = -1;
- currentStnElementListIndex = -1;
- currentSndElementListIndex = -1;
- resetData();
- }
-
-
- private NsharpSoundingElementStateProperty getCurSoundingElementStateProperty(){
- if(currentTimeElementListIndex >=0 && currentStnElementListIndex>=0 && currentSndElementListIndex>=0 &&
- stnTimeSndTable.get( currentStnElementListIndex).get( currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- return stnTimeSndTable.get( currentStnElementListIndex).get( currentTimeElementListIndex).get(currentSndElementListIndex);
- }
- return null;
- }
- private void setCurrentSoundingLayerInfo() {
- NsharpSoundingElementStateProperty elem = getCurSoundingElementStateProperty();
- if(elem!=null){
- pickedStnInfoStr = elem.getElementDescription();
- pickedStnInfo = elem.getStnInfo();
-
- if(overlayIsOn){
- previousSoundingLys = soundingLys;
- }
- else {
- previousSoundingLys = null;
- }
-
- if(interpolateIsOn == true){
- /* TTR829
- * deep copy is not necessary as performInterpolation() will re-allocate new layer for each
- * layer
- //we dont want to change original raw data, so use a new copy
- NcSoundingLayer newLayer;
- List mySndLst = new ArrayList();
- for(NcSoundingLayer layer:elem.getSndLyLst()){
- newLayer = new NcSoundingLayer();
- try {
- newLayer = (NcSoundingLayer) layer.clone();
-
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- } //here a shallowCopy is enough
- mySndLst.add(newLayer);
- }
- // interpolation
- mySndLst = performInterpolation(mySndLst);
-
- soundingLys = mySndLst; */
-
- soundingLys = performInterpolation(elem.getSndLyLst());
- }
- else {
- soundingLys = elem.getSndLyLst();
- }
- }
- else{
- previousSoundingLys = null;
- soundingLys = null;
- }
-
- }
- public void addRsc(Map> soundMap, NsharpStationInfo stnInfo, boolean fromNCP){
- if(fromNCP){
- //this is from NCP do nothing now
- this.addRsc(true, soundMap, stnInfo);
- //NCP case:
- //Key String format will be like this for NCUAIR
- // KGRI 100616/03(Wed)-NCUAIR
- // and for PFC/Grid sounding will be like this
- //KGRI 100616/03(Wed)V001-GFSSND
- }
- else{
- //D2D case::::
- //this is from D2D, edit display and time line string to add short day-of-week and
- //also add sounding type to string to solve an issue that data with same stn, same time line but different
- //sounding type will not be loaded.
- //D2D's key string is like this: "KGRI 2010-06-16 03:00:00"
- // will change it to "KGRI 100616/03(Wed)-GFSSND"
- Set dataTimelineSet = soundMap.keySet();
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //DateFormatSymbols dfs= new DateFormatSymbols();
- //String[] defaultDays = dfs.getShortWeekdays();
- Calendar cal =Calendar.getInstance();
- Date date;
- Map> newmap = new HashMap> ();
- String sndType = stnInfo.getSndType();
- for(String timeline: dataTimelineSet){
- System.out.println("D2D sending timeline Str:"+ timeline);
- String dateStr = timeline.substring(timeline.indexOf(' ')+1);
- String stnId= timeline.substring(0, timeline.indexOf(' '));
- try {
- date = df.parse(dateStr);
- cal.setTime(date);
- String dayOfWeek = defaultDays[cal.get(Calendar.DAY_OF_WEEK)];
- //dateStr = timeline.substring(0, timeline.indexOf(':'))+dayOfWeek+stnInfo.getSndType();
- //System.out.println("New Str:"+ dateStr);
- String finalTimeStr = String.format("%4$s %1$ty%1$tm%1$td/%1$tH(%2$s) %3$s", cal, dayOfWeek,sndType,stnId);
- System.out.println("D2D (modified) timeline Str:"+ finalTimeStr);
- //put newTimeStr to new map with original value
- newmap.put(finalTimeStr, soundMap.get(timeline));
- } catch (ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- continue;
- }
- }
- //this is from D2D, and it does not want to display new data right away.
- this.addRsc(false, newmap, stnInfo);
- }
- }
- /*
- public void loadSoundingData( boolean displayNewData, List soundDataLst, String stnId, String sndType,
- Timestamp rangeStartTime,double latitude,double longitude){
- //* testing code
- //stnInfo.setStnId("KFSD");
- {
- Set keyset= new HashSet(soundMap.keySet());
- for(String key: keyset) {
- List sndLy = soundMap.remove(key);
- String newkey= key.replace("NAMS", "yahoo");
- //String newkey= key.replace("GFSS", "NAMS");
- //newkey = newkey.replace("KSLN", "KFSD");
- soundMap.put(newkey, sndLy);
- }
- stnInfo.setSndType(stnInfo.getSndType().replace("NAMS", "yahoo"));
- //stnInfo.setSndType(stnInfo.getSndType().replace("GFSS", "NAMS"));
- }//
-
- //need to format reftime to GMT time string. Timestamp.toString produce a local time Not GMT time
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- cal.setTimeInMillis(rangeStartTime.getTime());
- String dayOfWeek = defaultDays[cal.get(Calendar.DAY_OF_WEEK)];
- String timeLine = String.format("%1$ty%1$tm%1$td/%1$tH(%2$s)", cal, dayOfWeek);
- if(stnId.indexOf(" ")>=0){
- //take care stnId with SPACE case.
- stnId = stnId.replace(" ", "_");
- }
- if(timeElementList.isEmpty() || stnElementList.isEmpty() ||
- currentSndElementListIndex < 0 ||sndElementList.isEmpty() ||
- currentTimeElementListIndex < 0 || currentStnElementListIndex < 0){
- //if no data was loaded since, then display this data any way
- displayNewData = true;
- }
- //save current timeline and stn state properties if we are NOT loading new data
- NsharpOperationElement currentTL=null;
- NsharpOperationElement currentStn=null;
- NsharpOperationElement currentSnd=null;
- NsharpSoundingElementStateProperty currentPreSndProfileProp=null;
- if(!displayNewData){
- currentTL = timeElementList.get(currentTimeElementListIndex);
- currentStn = stnElementList.get(currentStnElementListIndex);
- currentSnd = sndElementList.get(currentSndElementListIndex);
- currentPreSndProfileProp = preSndProfileProp;
- }
- //add new data to table
- //add time line to stnTimeTable and set its index
- addElementToTableAndLists((stnId+" "+timeLine+" "+sndType),stnId,timeLine,sndType,stnInfo, soundDataLst);
-
- if(displayNewData){
- //Set default parcel trace data
- currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
- setCurrentSoundingLayerInfo();
- resetData();
- }
- else {
- //Not display new data. Reset current "parameter"s after adding data to map/lists
- currentStnElementListIndex= stnElementList.indexOf(currentStn);
- currentTimeElementListIndex = timeElementList.indexOf(currentTL);
- currentSndElementListIndex = sndElementList.indexOf(currentSnd);
- preSndProfileProp = currentPreSndProfileProp;
- curSndProfileProp = stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex);
- }
-
- //set total time line group and stn id list page number
- calculateTimeStnBoxData();
-
- //set data time to descriptor
- //this is necessary for looping
- // starting 13.2.1, this line is changed by Raytheon
- if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) {
- //was this line before 13.2.1 if (( skewtPaneRsc.getDescriptor().getTimeMatcher() == null || skewtPaneRsc.getDescriptor().getTimeMatcher().getTimeMatchBasis() == null)&& !getTimeMatcher) {
- //DataTime[] dataTimes = new DataTime[dataTimelineList.size()];
- //Chin Note: we just have to do this once and set dataTimes size bigger than 1.
- //Nsharp handles changing frame itself. It just need system to send change frame notice.
- //That is happened at NsharpSkewTDescriptor.checkDrawTime().
- DataTime[] dataTimes = new DataTime[2];
- Date now = new Date();
- for(int k =0; k < 2 ; k++){
- dataTimes[k]= new DataTime(now, k);
- }
- //no need to get a descriptor from a renderableDispaly since we have a descriptor
- skewtPaneRsc.getDescriptor().setDataTimes(dataTimes);
- getTimeMatcher=true;
+ private IRenderableDisplay[] displayArray = null;
+
+ private NsharpPartListener.PartEvent editorPartStatus = NsharpPartListener.PartEvent.partClosed;
+
+ private NsharpSkewTPaneResource skewtPaneRsc;
+
+ private NsharpWitoPaneResource witoPaneRsc;
+
+ private NsharpHodoPaneResource hodoPaneRsc;
+
+ private NsharpTimeStnPaneResource timeStnPaneRsc;
+
+ private NsharpInsetPaneResource insetPaneRsc;
+
+ private NsharpDataPaneResource dataPaneRsc;
+
+ private NsharpSpcGraphsPaneResource spcGraphsPaneRsc;
+
+ private NsharpAbstractPaneResource futurePaneRsc;
+
+ private String[] defaultDays;
+
+ NsharpNative nsharpNative = null;
+
+ private int displayDataPageMax;
+
+ private static final int INSETPAGEMAX = 2;
+
+ private int currentTextChapter = 1;
+
+ private int currentInsetPage = 1;
+
+ private int cnYOrig = NsharpConstants.COLOR_NOTATION_Y_ORIG;
+
+ private int dtNextPageEnd = NsharpConstants.DATA_TIMELINE_NEXT_PAGE_END_;
+
+ private double charHeight = NsharpConstants.CHAR_HEIGHT_;
+
+ // d2dlite
+ private double lineHeight = charHeight;
+
+ private int dtXOrig = NsharpConstants.DATA_TIMELINE_X_ORIG;
+
+ private int dtYOrig = NsharpConstants.DATA_TIMELINE_Y_ORIG;
+
+ private int dtWidth = NsharpConstants.DATA_TIMELINE_WIDTH;
+
+ private String paneConfigurationName;
+
+ private int numTimeLinePerPage = 1;
+
+ /*
+ * Hodograph Modes - definition is based on definitions in globals_xw.h of
+ * BigNsharp
+ */
+ private static final int HODO_NORMAL = 0;
+
+ // private static int HODO_EFFECTIVE= 1; not used in BigNsharp source code
+ private static final int HODO_STORMRELATIVE = 2;
+
+ @SuppressWarnings("unused")
+ private static final int HODO_BNDRY = 3;
+
+ private static final int HODO_MEANWIND = 4;
+
+ @SuppressWarnings("unused")
+ private int currentHodoWindMode = HODO_MEANWIND;
+
+ private NsharpConfigManager configMgr;
+
+ private NsharpConfigStore configStore;
+
+ private NsharpGraphProperty graphConfigProperty;
+
+ private HashMap linePropertyMap;
+
+ private NsharpDataPageProperty dataPageProperty;
+
+ private int[] pageDisplayOrderNumberArray = new int[NsharpConstants.PAGE_MAX_NUMBER + 1];
+
+ // index is the real page defined in NsharpConstants to be shown, value is
+ // the order number of this page.
+ // index 0 point to a dummy.
+
+ private boolean overlayIsOn = false;
+
+ private boolean interpolateIsOn = false;
+
+ private boolean compareSndIsOn = false;
+
+ private boolean compareStnIsOn = false;
+
+ private boolean compareTmIsOn = false;
+
+ private boolean editGraphOn = false;
+
+ private boolean getTimeMatcher = false;
+
+ public int TEMP_TYPE = 1;
+
+ public int DEWPOINT_TYPE = 2;
+
+ private int currentTempCurveType;
+
+ private int currentSoundingLayerIndex = 0;
+
+ private int hodoEditingSoundingLayerIndex = 0;
+
+ private boolean plotInteractiveTemp = false;
+
+ private Coordinate interactiveTempPointCoordinate;
+
+ public static final float INVALID_DATA = NsharpNativeConstants.NSHARP_NATIVE_INVALID_DATA;
+
+ protected static final double BARB_LENGTH = 3.5;
+
+ private String soundingType = null;
+
+ protected DataTime displayedSounding;
+
+ private int currentGraphMode = NsharpConstants.GRAPH_SKEWT;
+
+ protected ListenerList listenerList = new ListenerList();
+
+ // current active sounding layer list
+ private List soundingLys = null;
+
+ private List previousSoundingLys = null;
+
+ private String pickedStnInfoStr; // current picked stn info with time line
+ // and sounding source,
+ // e.g. "ATLH 101209/03(Thu)V003 GFS230"
+
+ private NsharpStationInfo pickedStnInfo = null;
+
+ private IFrameCoordinator.FrameChangeOperation currentOpDirection = IFrameCoordinator.FrameChangeOperation.NEXT; // next
+ // =forward
+
+ private HashMap stormSlinkyColorMap = new HashMap();
+
+ private List>> stnTimeSndTable = new ArrayList>>();
+
+ // stnTimeSndTable:
+ // Store all sounding profiles property for GUI display control
+ // 1st index refer to stnId, 2nd index refer to time line and 3rd point to
+ // sndType.
+ // It is same as [][][] 3d array.
+ // We dynamically expand this 3D array based on newly added
+ // stnid/timeline/sndType When a new sounding data is loaded,
+ // All unloaded element is null. Only when user load new sounding with this
+ // stnId/this time line/this sndType, then
+ // the element allocated.
+ //
+ // stn3-> T1--->T2--->T3->...
+ // ^
+ // /
+ // stn2-> T1--->T2--->T3->...
+ // ^
+ // /
+ // stn1-> T1--->T2--->T3->...
+ // | | |
+ // V V V
+ // snd1 snd1 snd1
+ // | | |
+ // V V V
+ // snd2 snd2 snd2
+ // | | |
+ // V V V
+ // stnTimeSndTable first dimension (station id) should be in sync with
+ // stnElementList,
+ // 2nd dimension (time line) should be in sync with timeElementList, and
+ // 3rd dimension (sounding type) should be in sync with sndTypeElementList
+ // NULL element in stnTimeSndTable indicates that sounding data is not
+ // loaded yet.
+
+ private List stnElementList = new ArrayList();
+
+ private List timeElementList = new ArrayList();
+
+ private List sndElementList = new ArrayList();
+
+ private NsharpSoundingElementStateProperty curSndProfileProp = null;
+
+ private NsharpSoundingElementStateProperty preSndProfileProp = null;
+
+ private int curTimeLinePage = 1;
+
+ private int totalTimeLinePage = 1;
+
+ private int curStnIdPage = 1;
+
+ private int totalStnIdPage = 1;
+
+ private int curSndPage = 1;
+
+ private int totalSndPage = 1;
+
+ private int previousTimeLineStateListIndex;
+
+ private int currentStnElementListIndex = -1; // index to first dim of
+ // stnTimeSndTable and index to
+ // stnElementList
+
+ private int currentTimeElementListIndex = -1;// index to 2nd dim of
+ // stnTimeSndTable and index to
+ // timeElementList
+
+ private int currentSndElementListIndex = -1;// index to 3rd dim of
+ // stnTimeSndTable and index to
+ // sndElementList
+
+ // use element state, NsharpConstants.LoadState or NsharpConstants.ActState,
+ // as key to set color for drawing
+ private HashMap elementColorMap = new HashMap();
+
+ private short currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
+
+ private float currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
+
+ private float smWindDir, smWindSpd;
+
+ // start FixMark:nearByStnCompSnd
+ public class CompSndSelectedElem {
+ private int stnIndex;
+
+ private int timeIndex;
+
+ private int sndIndex;
+
+ public CompSndSelectedElem(int stnIndex, int timeIndex, int sndIndex) {
+ super();
+ this.stnIndex = stnIndex;
+ this.timeIndex = timeIndex;
+ this.sndIndex = sndIndex;
}
- NsharpShowTextDialog textarea = NsharpShowTextDialog.getAccess();
- if(textarea != null){
- textarea.refreshTextData();
- }
- NsharpPaletteWindow win = NsharpPaletteWindow.getInstance() ;
- if(win!=null)
- currentGraphMode=win.getCurrentGraphMode();
-
- refreshPane();
-
- }
- */
-
- private void addRsc( boolean displayNewData,Map> soundMap, NsharpStationInfo stnInfo){
- /* testing code
- stnInfo.setStnId("KUKI");
- {
- Set keyset= new HashSet(soundMap.keySet());
- for(String key: keyset) {
- List sndLy = soundMap.remove(key);
- //String newkey= key.replace("NCUAIR", "gpduair");
- String newkey= key.replace("NAMS","GFSS");
- newkey = newkey.replace("AJO", "KUKI");
- soundMap.put(newkey, sndLy);
- }
- //stnInfo.setSndType(stnInfo.getSndType().replace("NCUAIR", "gpduair"));
- stnInfo.setSndType(stnInfo.getSndType().replace( "NAMS","GFSS"));
- }//*/
-
-
- if(stnInfo.getStnId() != null && stnInfo.getStnId().indexOf(" ")>=0){
- //take care stnId with SPACE case.
- String stnId= stnInfo.getStnId();
- String newStnId = stnId.replace(" ", "_");
- stnInfo.setStnId(newStnId);
- String dspInfo= stnInfo.getStnDisplayInfo();
- stnInfo.setStnDisplayInfo(dspInfo.replace(stnId, newStnId));
- Set keyset= new HashSet(soundMap.keySet());
- for(String key: keyset) {
- List sndLy = soundMap.remove(key);
- String newkey= key.replace(stnId, newStnId);
- soundMap.put(newkey, sndLy);
- }
-
- }
-
- if(soundMap.size() <=0 || (skewtPaneRsc==null)){
- return;
- }
- if(timeElementList.isEmpty() || stnElementList.isEmpty() ||
- currentSndElementListIndex < 0 ||sndElementList.isEmpty() ||
- currentTimeElementListIndex < 0 || currentStnElementListIndex < 0){
- //if no data was loaded since, then display this data any way
- displayNewData = true;
- }
- //save current timeline and stn state properties if we are NOT loading new data
- NsharpOperationElement currentTL=null;
- NsharpOperationElement currentStn=null;
- NsharpOperationElement currentSnd=null;
- NsharpSoundingElementStateProperty currentPreSndProfileProp=null;
- if(!displayNewData){
- currentTL = timeElementList.get(currentTimeElementListIndex);
- currentStn = stnElementList.get(currentStnElementListIndex);
- currentSnd = sndElementList.get(currentSndElementListIndex);
- currentPreSndProfileProp = preSndProfileProp;
- }
- //add new data to table
- Set dataTimelineSet = soundMap.keySet();
- String[] tempTimeLineArr = dataTimelineSet.toArray(new String[dataTimelineSet.size()]);
- Arrays.sort(tempTimeLineArr);
- for (int i=0; i< tempTimeLineArr.length; i++){
- // based on this KEY string format "KGRI 100616/03(Wed) GFSSND"
- String stnId_timeLine_sndType = tempTimeLineArr[i].toString();
- String stnId = stnId_timeLine_sndType.substring(0,stnId_timeLine_sndType.indexOf(" "));
- String timeLine_sndType= stnId_timeLine_sndType.substring(stnId_timeLine_sndType.indexOf(" ")+1);
- String timeLine= timeLine_sndType.substring(0,timeLine_sndType.indexOf(" "));
- String sndType= timeLine_sndType.substring(timeLine_sndType.indexOf(" ")+1);
- //No more needed? timeLine = timeLine.replace(" ", "-"); //fixed DR15325 - sorting time line issue in D2D
- //add time line to stnTimeTable and set its index
- addElementToTableAndLists(stnId_timeLine_sndType,stnId,timeLine,sndType,stnInfo, soundMap.get(stnId_timeLine_sndType));
- }
- if(displayNewData){
- //Set default parcel trace data
- currentParcel = NsharpNativeConstants.PARCELTYPE_MOST_UNSTABLE;
- currentParcelLayerPressure = NsharpNativeConstants.MU_LAYER;
- setCurrentSoundingLayerInfo();
- resetData();
- }
- else {
- //Not display new data. Reset current "parameter"s after adding data to map/lists
- currentStnElementListIndex= stnElementList.indexOf(currentStn);
- currentTimeElementListIndex = timeElementList.indexOf(currentTL);
- currentSndElementListIndex = sndElementList.indexOf(currentSnd);
- preSndProfileProp = currentPreSndProfileProp;
- curSndProfileProp = stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex);
- }
-
- //set total time line group and stn id list page number
- calculateTimeStnBoxData();
-
- //set data time to descriptor
- //this is necessary for looping
- // starting 13.2.1, this line is changed by Raytheon
- if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) {
- //was this line before 13.2.1 if (( skewtPaneRsc.getDescriptor().getTimeMatcher() == null || skewtPaneRsc.getDescriptor().getTimeMatcher().getTimeMatchBasis() == null)&& !getTimeMatcher) {
- //DataTime[] dataTimes = new DataTime[dataTimelineList.size()];
- //Chin Note: we just have to do this once and set dataTimes size bigger than 1.
- //Nsharp handles changing frame itself. It just need system to send change frame notice.
- //That is happened at NsharpSkewTDescriptor.checkDrawTime().
- DataTime[] dataTimes = new DataTime[2/*stnTimeTable.size()*/];
- Date now = new Date();
- for(int k =0; k < 2/*stnTimeTable.size()*/ ; k++){
- dataTimes[k]= new DataTime(now, k);
- }
- //no need to get a descriptor from a renderableDispaly since we have a descriptor
- skewtPaneRsc.getDescriptor().setDataTimes(dataTimes);
- getTimeMatcher=true;
- }
-
- NsharpShowTextDialog textarea = NsharpShowTextDialog.getAccess();
- if(textarea != null){
- textarea.refreshTextData();
- }
- NsharpPaletteWindow win = NsharpPaletteWindow.getInstance() ;
- if(win!=null)
- currentGraphMode=win.getCurrentGraphMode();
-
- refreshPane();
-
- }
-
- public void addRsc(Map> soundMap, NsharpStationInfo stnInfo){
- //by default, display new data
- //NCP always call from this route.
- this.addRsc(true, soundMap, stnInfo);
- return;
- }
- public String getPickedStnInfoStr() {
- return pickedStnInfoStr;
- }
- //start FixMark:clickOnTimeStnPane
- private void handleUserPickNewStationId(int index){
- currentStnElementListIndex = index;
- if(compareTmIsOn){
- boolean found = false;
- if( currentTimeElementListIndex>=0 && currentSndElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- // use currentTimeLineStateListIndex
- found = true;
- }
- else {
- //find an active and available timeline for this stn and set is as current
- for (int i=0; i < timeElementList.size(); i++){
- if(timeElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(i).get(currentSndElementListIndex)!=null){
- currentTimeElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentTimeElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: timeElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int tmIndex = timeElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(tmIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
-
- }
- }
- }
- else if(compareSndIsOn){
- boolean found = false;
- if( currentTimeElementListIndex>=0 && currentSndElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else {
- //find an active and available snd for this stn and set is as current
- for (int i=0; i < sndElementList.size(); i++){
- if(sndElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(i)!=null){
- currentSndElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentSndElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: sndElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int sndIndex = sndElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(sndIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- }
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- refreshPane();
- } // end FixMark:clickOnTimeStnPane
- public void handleUserClickOnStationId(Coordinate c,boolean shiftDown) {
- //first to find if it is for change to next page, or change sorting
- //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
- int index =((int)(c.y - dtYOrig))/ charHeight;
-
- if(index == 0 ){
- //change to next/previous page
- if( totalStnIdPage == 1 )
- return;
- if((c.x - (dtXOrig+dtWidth)) < (dtWidth/2)){
- curStnIdPage++;
- if(curStnIdPage>totalStnIdPage)
- curStnIdPage=1;
- } else {
- curStnIdPage--;
- if(curStnIdPage <=0)
- curStnIdPage = totalStnIdPage;
- }
- return;
- }
- // recalculate index for time line
- index =((int)(c.y - dtNextPageEnd))/ charHeight +
- (curStnIdPage-1)* numTimeLinePerPage ;
-
- if( index < this.stnElementList.size() ){
- // FixMark:clickOnTimeStnPane start
- NsharpConstants.ActState actState = stnElementList.get(index).getActionState();
- if(!shiftDown ){
- if( actState == NsharpConstants.ActState.ACTIVE)
- handleUserPickNewStationId(index);
- }
- else { // End FixMark:clickOnTimeStnPane
-
- switch(actState){
-
- case INACTIVE:
- stnElementList.get(index).setActionState( NsharpConstants.ActState.ACTIVE);
- break;
- case ACTIVE:
- //do not allow deactivate current stn
- if(index == currentStnElementListIndex)
- return;
- stnElementList.get(index).setActionState( NsharpConstants.ActState.INACTIVE);
- break;
- default:
- return;
- }
- if(skewtPaneRsc!=null)
- skewtPaneRsc.createRscWireFrameShapes();
- if(hodoPaneRsc!=null)
- hodoPaneRsc.createRscHodoWindShapeAll();
- }
- }
- }
- // start FixMark:clickOnTimeStnPane
- private void handleUserPickNewTimeLine(int index){
- previousTimeLineStateListIndex = currentTimeElementListIndex;
- currentTimeElementListIndex = index;
- if(compareStnIsOn){
- boolean found = false;
- if(currentStnElementListIndex >=0 && currentSndElementListIndex >=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(index).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else{
- //find an active and available stn for this timeline and set is as current
- for (int i=0; i < stnElementList.size(); i++){
- if(stnElementList.get(i).getActionState()==NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(i).get(index).get(currentSndElementListIndex) !=null){
- currentStnElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentStnElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: stnElementList) {
- int stnIndex = stnElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(stnIndex).get(index).get(currentSndElementListIndex);
- if(stnTmElm != null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- }
- else if(compareSndIsOn){
- boolean found = false;
- if(currentStnElementListIndex >=0 && currentSndElementListIndex >=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(index).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else {
- //find an active and available snd for this stn and set is as current
- for (int i=0; i < sndElementList.size(); i++){
- if(sndElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(index).get(i)!=null){
- currentSndElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentSndElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: sndElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int sndIndex = sndElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(index).get(sndIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- }
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- refreshPane();
- } // end FixMark:clickOnTimeStnPane
- public void handleUserClickOnTimeLine(Coordinate c, boolean shiftDown) {
-
- //first to find if it is for change to next/prev page
- //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
- int index =((int)(c.y - dtYOrig))/ charHeight;
- if(index == 0 ){
- //change to next/previous page
- if( totalTimeLinePage == 1)
- return;
- if((c.x - dtXOrig) < (dtWidth /2)){
- curTimeLinePage++;
- if(curTimeLinePage>totalTimeLinePage)
- curTimeLinePage=1;
- } else {
- curTimeLinePage--;
- if(curTimeLinePage <=0)
- curTimeLinePage = totalTimeLinePage;
- }
- return;
- }
- // recalculate index for time line
- index =((int)(c.y - dtNextPageEnd))/ charHeight +
- (curTimeLinePage-1)* numTimeLinePerPage ;
-
- if( index < timeElementList.size() && index >=0 ){
- // FixMark:clickOnTimeStnPane start
- NsharpConstants.ActState actState = timeElementList.get(index).getActionState();
- if(!shiftDown ){
- if( actState == NsharpConstants.ActState.ACTIVE)
- handleUserPickNewTimeLine(index);
- }
- else {
- switch(actState){// End FixMark:clickOnTimeStnPane
- case INACTIVE:
- timeElementList.get(index).setActionState( NsharpConstants.ActState.ACTIVE);
- break;
- case ACTIVE:
- if(index == currentTimeElementListIndex)
- //dont allow to deactive current time line
- return;
- timeElementList.get(index).setActionState( NsharpConstants.ActState.INACTIVE);
- break;
-
- default:
- return;
-
- }
- if(skewtPaneRsc!=null)
- skewtPaneRsc.createRscWireFrameShapes();
- if(hodoPaneRsc!=null)
- hodoPaneRsc.createRscHodoWindShapeAll();
- }
- }
- }
- // start FixMark:clickOnTimeStnPane
- private void handleUserPickNewSndLine(int index){
- currentSndElementListIndex = index;
- if(compareTmIsOn){
- boolean found = false;
- if(currentTimeElementListIndex>=0 && currentStnElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- // use currentTimeLineStateListIndex
- found = true;
- }
- else {
- //find an active and available timeline for this stn and set is as current
- for (int i=0; i < timeElementList.size(); i++){
- if(timeElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(i).get(currentSndElementListIndex)!=null){
- currentTimeElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentTimeElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: timeElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int tmIndex = timeElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(tmIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- }
- else if(compareStnIsOn){
- boolean found = false;
- //find an active and available stn for this timeline and set is as current
- if(currentTimeElementListIndex>=0 && currentStnElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else {
- for (int i=0; i < stnElementList.size(); i++){
- if(stnElementList.get(i).getActionState()==NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(i).get(currentTimeElementListIndex).get(currentSndElementListIndex) !=null){
- currentStnElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentStnElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: stnElementList) {
- int stnIndex = stnElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(stnIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
-
- }
- }
- }
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- refreshPane();
- }
- //end FixMark:clickOnTimeStnPane
- public void handleUserClickOnSndLine(Coordinate c, boolean shiftDown) {
-
- //first to find if it is for change to next/prev page
- //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
- int index =((int)(c.y - dtYOrig))/ charHeight;
- if(index == 0 ){
- //change to next/previous page
- if( totalSndPage == 1)
- return;
- if((c.x - dtXOrig) < (dtWidth/2)){
- curSndPage++;
- if(curSndPage>totalSndPage)
- curSndPage=1;
- } else {
- curSndPage--;
- if(curSndPage <=0)
- curSndPage = totalSndPage;
- }
- return;
- }
- // recalculate index for time line
- index =((int)(c.y - dtNextPageEnd))/ charHeight +
- (curSndPage-1)* numTimeLinePerPage ;
-
- if( index < sndElementList.size() && index >=0 ){
- // FixMark:clickOnTimeStnPane start
- NsharpConstants.ActState actState = sndElementList.get(index).getActionState();
- if(!shiftDown ){
- if( actState == NsharpConstants.ActState.ACTIVE)
- handleUserPickNewSndLine(index);
- }
- else {
- switch(actState){// End FixMark:clickOnTimeStnPane
- case INACTIVE:
- sndElementList.get(index).setActionState( NsharpConstants.ActState.ACTIVE);
- break;
- case ACTIVE:
- if(index == currentSndElementListIndex)
- //dont allow to deactive current time line
- return;
- sndElementList.get(index).setActionState( NsharpConstants.ActState.INACTIVE);
- break;
-
- default:
- return;
-
- }
- if(skewtPaneRsc!=null)
- skewtPaneRsc.createRscWireFrameShapes();
- if(hodoPaneRsc!=null)
- hodoPaneRsc.createRscHodoWindShapeAll();
-
- }
- }
- }
-
- private void moveTimeLineIndexBackward(){
- previousTimeLineStateListIndex = currentTimeElementListIndex;
- int counter=0;
- while(true){
- currentTimeElementListIndex++;
- currentTimeElementListIndex = currentTimeElementListIndex % this.timeElementList.size();
- counter++;
- if(counter > timeElementList.size())
- break;
- if( timeElementList.get(currentTimeElementListIndex).getActionState() == NsharpConstants.ActState.ACTIVE
- && stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- break;//out of while loop
- }
-
- }
- }
- private void moveTimeLineIndexForward (){
- previousTimeLineStateListIndex = currentTimeElementListIndex;
- int counter=0;
- while(true){
- currentTimeElementListIndex= currentTimeElementListIndex + this.timeElementList.size();// so, we wont get a negative number
- currentTimeElementListIndex--;
- currentTimeElementListIndex = currentTimeElementListIndex % this.timeElementList.size();
- counter++;
- if(counter > timeElementList.size())
- break;
- if( timeElementList.get(currentTimeElementListIndex).getActionState() == NsharpConstants.ActState.ACTIVE
- && stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- break;//out of while loop
- }
- }
- //System.out.println("timeline="+timeLineStateList.get(pickedTimeGroupIndex).getElementDescription());
- }
- private void moveTimeLineIndexCycle (){
- previousTimeLineStateListIndex = currentTimeElementListIndex;
- //Note: direction should only be NEXT or PREVIOUS
- int counter=0;
- while(true){
- counter++;
- if(counter > timeElementList.size()){
- currentTimeElementListIndex = previousTimeLineStateListIndex;
- break;
- }
- if(currentOpDirection == IFrameCoordinator.FrameChangeOperation.NEXT ){
- currentTimeElementListIndex--;
- if(currentTimeElementListIndex <= 0){
- //the end of forward direction, change direction to backward
- currentOpDirection = IFrameCoordinator.FrameChangeOperation.PREVIOUS;
- currentTimeElementListIndex=0;
- }
-
- }
- else{ // direction is FrameChangeOperation.PREVIOUS
- currentTimeElementListIndex++;
- if(currentTimeElementListIndex >= timeElementList.size()-1){
- //the end of backward direction, change direction to forward
- currentOpDirection = IFrameCoordinator.FrameChangeOperation.NEXT;
- currentTimeElementListIndex = timeElementList.size()-1;
- }
- }
- if( timeElementList.get(currentTimeElementListIndex).getActionState() == NsharpConstants.ActState.ACTIVE
- && stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- break;//out of while loop
- }
- }
-
- }
- /*
- * Note: looping only apply to curAggregateTimeLineList NOT stationIdList
- */
- public void setLoopingDataTimeLine(LoopProperties loopProperties) {
- //System.out.println("setLoopingDataTimeLine loopmode ="+loopProperties.getMode().toString());
- if( this.timeElementList.size()>0) {
- switch(loopProperties.getMode()){
- case Forward:
- moveTimeLineIndexForward();
- break;
- case Backward:
- moveTimeLineIndexBackward();
- break;
- case Cycle:
- moveTimeLineIndexCycle();
-
- break;
- }
-
- curTimeLinePage = currentTimeElementListIndex/numTimeLinePerPage + 1;
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- refreshPane();
- }
-
- }
- public enum LoopMode {
- Forward, Backward, Cycle
- };
-
-
- private int getElemlistActiveNumber(List elemlist){
- int n=0;
- for (NsharpOperationElement elem: elemlist){
- if(elem.getActionState() == NsharpConstants.ActState.ACTIVE){
- n++;
- }
- }
- return n;
- }
-
- public void setSteppingTimeLine(IFrameCoordinator.FrameChangeOperation operation, IFrameCoordinator.FrameChangeMode mode) {
- if( this.timeElementList.size() > 0 && getElemlistActiveNumber(timeElementList)>1/* && getAvailTimeLineNumber(currentStnStateListIndex)>1*/) {
- int targetIndex = currentTimeElementListIndex;
- //previousTimeLineStateListIndex = currentTimeLineStateListIndex;
- //preset index for LAST and FIRST operation
- switch(operation){
- case LAST: //the future-est time, at top of time line shown. set to -1, so in while loop, it starts from 0
- targetIndex=-1;//
- break;
- case FIRST: //the oldest time, set to dataTimelineList.length, so in while loop, it starts from dataTimelineList.length-1
- targetIndex = timeElementList.size();
- break;
- default:
- break;
-
- }
-
- int counter=0;
- while(true){
- switch(operation){
- case LAST: //the future-est time, at top of time line shown
- targetIndex++;
- break;
- case FIRST: //the oldest time
- targetIndex--;
- break;
- case PREVIOUS:
- targetIndex++;
- targetIndex = targetIndex % this.timeElementList.size();
- break;
- case NEXT:
- // so, we wont get a negative number
- targetIndex= targetIndex + this.timeElementList.size();
- targetIndex--;
- targetIndex = targetIndex % this.timeElementList.size();
- break;
- default:
- break;
- }
- counter++;
- if(counter >= timeElementList.size())
- return; // looped through whole list already, and index back to original
-
- if(timeElementList.get(targetIndex).getActionState() == NsharpConstants.ActState.ACTIVE){
- if(compareTmIsOn && currentStnElementListIndex >=0 && currentSndElementListIndex >=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(targetIndex).get(currentSndElementListIndex)== null){
- continue;
- }
- else if(compareStnIsOn){
- boolean found = false;
- if(currentStnElementListIndex >=0 && currentSndElementListIndex >=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(targetIndex).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else{
- //find an active and available stn for this timeline and set is as current
- for (int i=0; i < stnElementList.size(); i++){
- if(stnElementList.get(i).getActionState()==NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(i).get(targetIndex).get(currentSndElementListIndex) !=null){
- currentStnElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentStnElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: stnElementList) {
- int stnIndex = stnElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(stnIndex).get(targetIndex).get(currentSndElementListIndex);
- if(stnTmElm != null){
- stnTmElm.setCompColorIndex(colorIndex);
- //if(colorIndex > NsharpConstants.LINE_COMP10)
- // colorIndex = NsharpConstants.LINE_COMP1;
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- //no matter we find current stn or not
- //we should get out of here
- break;
- }
- else if(compareSndIsOn){
- boolean found = false;
- if(currentStnElementListIndex >=0 && currentSndElementListIndex >=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(targetIndex).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else {
- //find an active and available snd for this stn and set is as current
- for (int i=0; i < sndElementList.size(); i++){
- if(sndElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(targetIndex).get(i)!=null){
- currentSndElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentSndElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: sndElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int sndIndex = sndElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(targetIndex).get(sndIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- //no matter we find current snd type for this stn or not
- //we should get out of here
- break;
- }
- else{
- break;
- }
- }
- }
- previousTimeLineStateListIndex = currentTimeElementListIndex;
- currentTimeElementListIndex = targetIndex;
- curTimeLinePage = currentTimeElementListIndex/numTimeLinePerPage + 1;
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
- refreshPane();
- }
- }
-
- /*
- * Stn index stepping is only controlled by up/down arrow keys, down key = PREVIOUS operation, up key = NEXT operation
- */
- public void setSteppingStnIdList(IFrameCoordinator.FrameChangeOperation operation) {
- if( this.stnElementList.size() > 0 && getElemlistActiveNumber(stnElementList)>1){
-
- int counter=0;
- while(true){
- switch(operation){
- case NEXT:
- currentStnElementListIndex= currentStnElementListIndex + this.stnElementList.size();
- currentStnElementListIndex--;
- currentStnElementListIndex = currentStnElementListIndex % this.stnElementList.size();
- break;
- case PREVIOUS:
- // so, we wont get a negative number
- currentStnElementListIndex++;
- currentStnElementListIndex = currentStnElementListIndex % this.stnElementList.size();
- break;
- default:
- break;
-
- }
- counter++;
- //System.out.println("counter = "+ counter);
- if(counter >= stnElementList.size())
- return; // looped through whole list already, and index back to original
- if(stnElementList.get(currentStnElementListIndex).getActionState() == NsharpConstants.ActState.ACTIVE){
- if (compareStnIsOn && currentTimeElementListIndex>=0 && currentSndElementListIndex>=0
- && stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)== null){//.getElementState() == NsharpConstants.LoadState.NOTAVAIL){
- continue;
- }
- else if(compareTmIsOn){
- boolean found = false;
- if( currentTimeElementListIndex>=0 && currentSndElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- // use currentTimeLineStateListIndex
- found = true;
- }
- else {
- //find an active and available timeline for this stn and set is as current
- for (int i=0; i < timeElementList.size(); i++){
- if(timeElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(i).get(currentSndElementListIndex)!=null){
- currentTimeElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentTimeElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: timeElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int tmIndex = timeElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(tmIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
-
- }
- }
- //no matter we find current time line for this stn or not
- //we should get out of here
- break;
- }
- else if(compareSndIsOn){
- boolean found = false;
- if( currentTimeElementListIndex>=0 && currentSndElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else {
- //find an active and available snd for this stn and set is as current
- for (int i=0; i < sndElementList.size(); i++){
- if(sndElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(i)!=null){
- currentSndElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentSndElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: sndElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int sndIndex = sndElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(sndIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- //no matter we find current snd type for this stn or not
- //we should get out of here
- break;
- }
- else
- break;
- }
- }
- curStnIdPage = currentStnElementListIndex/numTimeLinePerPage + 1;
-
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
-
- refreshPane();
- }
-
- }
- /*
- * Snd Type index stepping is only controlled by shift + up/down arrow keys, shift+down key = PREVIOUS operation, shift+up key = NEXT operation
- */
- public void setSteppingSndTypeList(IFrameCoordinator.FrameChangeOperation operation) {
- if( this.sndElementList.size() > 0 && getElemlistActiveNumber(sndElementList)>1){
-
- int counter=0;
- while(true){
- switch(operation){
- case NEXT:
- currentSndElementListIndex= currentSndElementListIndex + this.sndElementList.size();
- currentSndElementListIndex--;
- currentSndElementListIndex = currentSndElementListIndex % this.sndElementList.size();
- break;
- case PREVIOUS:
- // so, we wont get a negative number
- currentSndElementListIndex++;
- currentSndElementListIndex = currentSndElementListIndex % this.sndElementList.size();
- break;
- default:
- break;
-
- }
- counter++;
- //System.out.println("counter = "+ counter);
- if(counter >= sndElementList.size())
- return; // looped through whole list already, and index back to original
- if(sndElementList.get(currentSndElementListIndex).getActionState() == NsharpConstants.ActState.ACTIVE){
- if (compareSndIsOn && currentTimeElementListIndex>=0 && currentStnElementListIndex>=0
- && stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)== null){
- continue;
- }
- else if(compareTmIsOn){
- boolean found = false;
- if(currentTimeElementListIndex>=0 && currentStnElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- // use currentTimeLineStateListIndex
- found = true;
- }
- else {
- //find an active and available timeline for this stn and set is as current
- for (int i=0; i < timeElementList.size(); i++){
- if(timeElementList.get(i).getActionState()== NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(currentStnElementListIndex).get(i).get(currentSndElementListIndex)!=null){
- currentTimeElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentTimeElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: timeElementList) {
- if(elm.getActionState() == NsharpConstants.ActState.INACTIVE)
- continue;
- int tmIndex = timeElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(currentStnElementListIndex).get(tmIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
- }
- }
- //no matter we find current time line for this stn or not
- //we should get out of here
- break;
- }
- else if(compareStnIsOn){
- boolean found = false;
- //find an active and available stn for this timeline and set is as current
- if(currentTimeElementListIndex>=0 && currentStnElementListIndex>=0 &&
- stnTimeSndTable.get(currentStnElementListIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex)!=null){
- found = true;
- }
- else {
- for (int i=0; i < stnElementList.size(); i++){
- if(stnElementList.get(i).getActionState()==NsharpConstants.ActState.ACTIVE &&
- stnTimeSndTable.get(i).get(currentTimeElementListIndex).get(currentSndElementListIndex) !=null){
- currentStnElementListIndex = i;
- found = true;
- break;
- }
- }
- }
- if(!found){
- currentStnElementListIndex = -1;
- }
- else{
- int colorIndex = NsharpConstants.LINE_COMP1;
- for(NsharpOperationElement elm: stnElementList) {
- int stnIndex = stnElementList.indexOf(elm);
- NsharpSoundingElementStateProperty stnTmElm = stnTimeSndTable.get(stnIndex).get(currentTimeElementListIndex).get(currentSndElementListIndex);
- if(stnTmElm!=null){
- stnTmElm.setCompColorIndex(colorIndex);
- }
- colorIndex++;
- if(colorIndex > NsharpConstants.LINE_COMP10)
- colorIndex = NsharpConstants.LINE_COMP1;
-
- }
- }
- //no matter we find current stn or not
- //we should get out of here
- break;
- }
- else
- break;
- }
- }
- curStnIdPage = currentSndElementListIndex/numTimeLinePerPage + 1;
-
- setCurSndProfileProp();
- setCurrentSoundingLayerInfo();
- resetData();
-
- refreshPane();
- }
-
- }
- //used for sorting
- public class tempPoint implements Comparable{
- double diff;
- double temp;
- double pressure;
- int type; //1= temp, 2 = dewpoint
- tempPoint(double diff,double temp,double pressure, int type){
- this.diff = diff;
- this.temp = temp;
- this.pressure = pressure;
- this.type = type;
- }
-
- @Override
- public int compareTo(tempPoint o) {
- if(this.diff >= o.diff)
- return 1;
- else
- return 0;
- }
- }
- /*
- * Return the closest point to the input point on Hodo graph
- *
- */
- public Coordinate getClosestHodoPoint(Coordinate inputC){
- //System.out.println("picked pt CX "+ inputC.x + " CY "+ inputC.y);
- Coordinate closeptC = new Coordinate(0,0);
- if(hodoPaneRsc==null)
- return closeptC;
-
- double curSmallestDist=10000; // picked a impossible big number to start with
- double distance;
- boolean ptFound = false;
- NcSoundingLayer layer;
- //
- // Note: soundingLys list sorted with highest pressure as first element
- //
- for (int i=0; i< this.soundingLys.size(); i++) {
- layer = this.soundingLys.get(i);
- double curS, curD;
- curS = layer.getWindSpeed();
- curD = layer.getWindDirection();
- closeptC = WxMath.uvComp((float)curS, (float)curD);
- closeptC = hodoPaneRsc.getHodoBackground().getWorld().map(closeptC);
- //System.out.println("closeptCx " + closeptC.x+ " closeptCy "+ closeptC.y);
- distance = inputC.distance(closeptC);
- //System.out.println("closeptCx " + closeptC.x+ " closeptCy "+ closeptC.y+" distance "+ distance + " curSmallestDist " +curSmallestDist);
- if(distance < curSmallestDist){
- curSmallestDist = distance;
- hodoEditingSoundingLayerIndex = i;
- ptFound = true;
- }
- }
- if(ptFound == false){
- closeptC.x=closeptC.y=0;
- } else{
- layer = this.soundingLys.get(hodoEditingSoundingLayerIndex);
- closeptC = WxMath.uvComp((float)layer.getWindSpeed(), (float)layer.getWindDirection());
- closeptC = hodoPaneRsc.getHodoBackground().getWorld().map(closeptC);
- }
-
- //System.out.println("picked closeptCx " + closeptC.x+ " closeptCy "+ closeptC.y);
- return closeptC;
- }
-
- public List getSoundingLys() {
- return soundingLys;
- }
-
- public List getPreviousSoundingLys() {
- return previousSoundingLys;
- }
-
-
- /*
- * This interpolation is to smooth data out with a pressure gap of 25 mb per layer and also keep
- * original lowest and highest layers.
- */
- private List performInterpolation(List