Merge "Omaha #2061 Delete PlotResource, rename PlotResource2." into omaha_14.4.1
Former-commit-id: b0903898a40916383f88b920e87dfc072d9cafa9
This commit is contained in:
commit
6890ee0920
26 changed files with 1554 additions and 4153 deletions
|
@ -55,9 +55,7 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
|||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||
import com.raytheon.uf.viz.vaa.util.CommonUtil;
|
||||
import com.raytheon.viz.pointdata.Activator;
|
||||
import com.raytheon.viz.pointdata.util.SymbolLoader;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
@ -70,9 +68,10 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 23, 2009 3268 jsanchez Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Nov 23, 2009 3268 jsanchez Initial creation
|
||||
* Jun 06, 2014 2061 bsteffen Remove unneccessary imports
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -2,44 +2,39 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Pointdata Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.viz.pointdata;singleton:=true
|
||||
Bundle-Version: 1.14.0.qualifier
|
||||
Bundle-Activator: com.raytheon.viz.pointdata.Activator
|
||||
Bundle-Version: 1.14.1.qualifier
|
||||
Bundle-Vendor: Raytheon
|
||||
Eclipse-RegisterBuddy: com.raytheon.viz.core, com.raytheon.uf.viz.core
|
||||
Require-Bundle: org.apache.batik,
|
||||
org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.viz.core,
|
||||
com.raytheon.uf.viz.core,
|
||||
com.raytheon.viz.ui,
|
||||
org.apache.commons.lang,
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.apache.batik;bundle-version="1.6",
|
||||
org.eclipse.ui;bundle-version="3.8",
|
||||
org.eclipse.core.runtime;bundle-version="3.8",
|
||||
com.raytheon.uf.viz.core;bundle-version="1.14.3",
|
||||
com.raytheon.viz.ui;bundle-version="1.14.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
javax.measure,
|
||||
com.raytheon.uf.viz.localization;bundle-version="1.12.1174",
|
||||
org.jep;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.python;bundle-version="1.12.1161",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.localization,
|
||||
org.jep;bundle-version="2.3.0",
|
||||
com.raytheon.uf.common.python,
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.13.0",
|
||||
com.raytheon.uf.common.dataplugin.level;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.colormap,
|
||||
com.raytheon.uf.common.wxmath,
|
||||
com.raytheon.uf.common.python.concurrent,
|
||||
com.raytheon.uf.common.derivparam;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.datacube;bundle-version="1.14.0"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
com.raytheon.uf.viz.datacube;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.inventory;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.datastorage;bundle-version="1.14.0",
|
||||
com.raytheon.uf.common.time,
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.14.1",
|
||||
com.raytheon.uf.common.dataplugin,
|
||||
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.13.0",
|
||||
com.raytheon.uf.common.message;bundle-version="1.14.0",
|
||||
com.raytheon.uf.viz.productbrowser;bundle-version="1.14.0",
|
||||
com.raytheon.viz.alerts,
|
||||
com.raytheon.uf.common.comm
|
||||
Export-Package: com.raytheon.viz.pointdata,
|
||||
com.raytheon.viz.pointdata.drawables,
|
||||
com.raytheon.viz.pointdata.rsc,
|
||||
com.raytheon.viz.pointdata.rsc.retrieve,
|
||||
com.raytheon.viz.pointdata.util
|
||||
Import-Package: com.raytheon.uf.common.comm,
|
||||
com.raytheon.uf.common.inventory.data,
|
||||
com.raytheon.uf.common.inventory.exception,
|
||||
com.raytheon.uf.common.inventory,
|
||||
com.raytheon.uf.common.inventory.tree,
|
||||
com.raytheon.uf.common.dataplugin.grid,
|
||||
com.raytheon.uf.common.message.response,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.pointdata.accumulate,
|
||||
com.raytheon.uf.viz.productbrowser,
|
||||
com.raytheon.viz.alerts,
|
||||
com.raytheon.viz.alerts.observers
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
|
|
|
@ -56,10 +56,12 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
|
|||
]]>
|
||||
</style>
|
||||
<symbol overflow="visible" id="plotData" class="info">
|
||||
<text id="altitudeText" plotMode="text" plotParam="altitude" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: start;" x="10px" y="-10px">75</text>
|
||||
<text id="tempText" plotMode="text" plotParam="T" plotUnit="°C" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
|
||||
<text id="dewPtText" plotMode="text" plotParam="DpT" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="10px">75</text>
|
||||
<g id="windVaneText" plotMode="barb" required="true" plotParam="WS,WD" plotUnit="kts" x="0" y="0" transform="rotate(0,0,0)">
|
||||
<text id="sample1" plotMode="sample" class="text" plotParam="tailNumber">0</text>
|
||||
<text id="sample2" plotMode="sample" class="text" plotParam="timeObs" plotFormat="time:dd/HHmm">0</text>
|
||||
<text id="altitudeText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: start;" x="10px" y="-10px">75</text>
|
||||
<text id="tempText" plotMode="text" plotParam="temp" plotUnit="°C" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
|
||||
<text id="dewPtText" plotMode="text" plotParam="dwpt" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="10px">75</text>
|
||||
<g id="windVaneText" plotMode="barb" required="true" plotParam="windSpeed,windDirection" plotUnit="kts" x="0" y="0" transform="rotate(0,0,0)">
|
||||
<text id="windVaneText" class="arrow" x="0" y="0">0</text>
|
||||
<text id="windArrowText" class="barb" x="0" y="0">arrow</text>
|
||||
</g>
|
||||
|
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.7 KiB |
|
@ -42,12 +42,6 @@
|
|||
renderingOrderId="PLOT"
|
||||
resourceType="PLAN_VIEW">
|
||||
</resource>
|
||||
<resource
|
||||
class="com.raytheon.viz.pointdata.rsc.PlotResource2"
|
||||
name="Point Data2"
|
||||
renderingOrderId="PLOT"
|
||||
resourceType="PLAN_VIEW">
|
||||
</resource>
|
||||
<resource
|
||||
class="com.raytheon.viz.pointdata.rsc.PlotBlendedResource"
|
||||
name="Blended Plot Data"
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
/**
|
||||
* 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.viz.pointdata;
|
||||
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* The activator class controls the plug-in life cycle
|
||||
*/
|
||||
public class Activator extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "com.raytheon.viz.pointdata";
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
public Activator() {
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/**
|
||||
* 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.viz.pointdata;
|
||||
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Record implementation for metar plugin
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ---------- ---------- ----------- --------------------------
|
||||
* 20090513 2338 jsanchez Initial creation.
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
* @version 1
|
||||
*/
|
||||
public class ParamLookup {
|
||||
private static TreeMap<Float, String> PRECIP_MAP = new TreeMap<Float, String>();
|
||||
private static TreeMap<Float, String> VIS_MAP = new TreeMap<Float, String>();
|
||||
static {
|
||||
VIS_MAP.put(0.0000f,"0");
|
||||
VIS_MAP.put(0.03125f,"0");
|
||||
VIS_MAP.put(0.09375f,"1/16");
|
||||
VIS_MAP.put(0.15625f,"1/8");
|
||||
VIS_MAP.put(0.21875f,"3/16");
|
||||
VIS_MAP.put(0.28125f,"1/4");
|
||||
VIS_MAP.put(0.34375f,"5/16");
|
||||
VIS_MAP.put(0.40625f,"3/8");
|
||||
VIS_MAP.put(0.46875f,"7/16");
|
||||
VIS_MAP.put(0.53125f,"1/2");
|
||||
VIS_MAP.put(0.59375f,"9/16");
|
||||
VIS_MAP.put(0.65625f,"5/8");
|
||||
VIS_MAP.put(0.71875f,"11/16");
|
||||
VIS_MAP.put(0.78125f,"3/4");
|
||||
VIS_MAP.put(0.84375f,"13/16");
|
||||
VIS_MAP.put(0.90625f,"7/8");
|
||||
VIS_MAP.put(0.96875f,"15/16");
|
||||
VIS_MAP.put(1.03125f,"1");
|
||||
VIS_MAP.put(1.09375f,"1~1/16");
|
||||
VIS_MAP.put(1.15625f,"1~1/8");
|
||||
VIS_MAP.put(1.21875f,"1~3/16");
|
||||
VIS_MAP.put(1.28125f,"1~1/4");
|
||||
VIS_MAP.put(1.34375f,"1~5/16");
|
||||
VIS_MAP.put(1.40625f,"1~3/8");
|
||||
VIS_MAP.put(1.46875f,"1~7/16");
|
||||
VIS_MAP.put(1.53125f,"1~1/2");
|
||||
VIS_MAP.put(1.59375f,"1~9/16");
|
||||
VIS_MAP.put(1.65625f,"1~5/8");
|
||||
VIS_MAP.put(1.71875f,"1~11/16");
|
||||
VIS_MAP.put(1.78125f,"1~3/4");
|
||||
VIS_MAP.put(1.84375f,"1~13/16");
|
||||
VIS_MAP.put(1.90625f,"1~7/8");
|
||||
VIS_MAP.put(1.96875f,"1~15/16");
|
||||
VIS_MAP.put(2.0625f,"2");
|
||||
VIS_MAP.put(2.1875f,"2~1/8");
|
||||
VIS_MAP.put(2.3125f,"2~1/4");
|
||||
VIS_MAP.put(2.4375f,"2~3/8");
|
||||
VIS_MAP.put(2.5625f,"2~1/2");
|
||||
VIS_MAP.put(2.6875f,"2~5/8");
|
||||
VIS_MAP.put(2.8125f,"2~3/4");
|
||||
VIS_MAP.put(2.9375f,"2~7/8");
|
||||
VIS_MAP.put(3.0625f,"3");
|
||||
VIS_MAP.put(3.1875f,"3~1/8");
|
||||
VIS_MAP.put(3.3125f,"3~1/4");
|
||||
VIS_MAP.put(3.4375f,"3~3/8");
|
||||
VIS_MAP.put(3.5625f,"3~1/2");
|
||||
VIS_MAP.put(3.6875f,"3~5/8");
|
||||
VIS_MAP.put(3.8125f,"3~3/4");
|
||||
VIS_MAP.put(3.9375f,"3~7/8");
|
||||
VIS_MAP.put(4.125f,"4");
|
||||
VIS_MAP.put(4.375f,"4~1/4");
|
||||
VIS_MAP.put(4.625f,"4~1/2");
|
||||
VIS_MAP.put(4.875f,"4~3/4");
|
||||
VIS_MAP.put(5.125f,"5");
|
||||
VIS_MAP.put(5.375f,"5~1/4");
|
||||
VIS_MAP.put(5.625f,"5~1/2");
|
||||
VIS_MAP.put(5.875f,"5~3/4");
|
||||
VIS_MAP.put( 6.5f,"6");
|
||||
VIS_MAP.put(.5f,"7");
|
||||
VIS_MAP.put(8.5f,"8");
|
||||
VIS_MAP.put(9.5f,"9");
|
||||
VIS_MAP.put(0.5f,"10");
|
||||
VIS_MAP.put(11.5f,"11");
|
||||
VIS_MAP.put(12.5f,"12");
|
||||
VIS_MAP.put(13.5f,"13");
|
||||
VIS_MAP.put(14.5f,"14");
|
||||
VIS_MAP.put(15.5f,"15");
|
||||
VIS_MAP.put(16.5f,"16");
|
||||
VIS_MAP.put(17.5f,"17");
|
||||
VIS_MAP.put(18.5f,"18");
|
||||
VIS_MAP.put(19.5f,"19");
|
||||
VIS_MAP.put(22.5f,"20");
|
||||
VIS_MAP.put(27.5f,"25");
|
||||
VIS_MAP.put(32.5f,"30");
|
||||
VIS_MAP.put(37.5f,"35");
|
||||
VIS_MAP.put(42.5f,"40");
|
||||
VIS_MAP.put(47.5f,"45");
|
||||
VIS_MAP.put(52.5f,"50");
|
||||
VIS_MAP.put(57.5f,"55");
|
||||
VIS_MAP.put(62.5f,"60");
|
||||
VIS_MAP.put(67.5f,"65");
|
||||
VIS_MAP.put(72.5f,"70");
|
||||
VIS_MAP.put(77.5f,"75");
|
||||
VIS_MAP.put(82.5f,"80");
|
||||
VIS_MAP.put(87.5f,"85");
|
||||
VIS_MAP.put(92.5f,"90");
|
||||
VIS_MAP.put(97.5f,"95");
|
||||
VIS_MAP.put(110f,"100");
|
||||
|
||||
PRECIP_MAP.put(-0.005f,"T");
|
||||
PRECIP_MAP.put(0.005f,"T");
|
||||
PRECIP_MAP.put(0.015f,".01");
|
||||
PRECIP_MAP.put(0.025f,".02");
|
||||
PRECIP_MAP.put(0.035f,".03");
|
||||
PRECIP_MAP.put(0.045f,".04");
|
||||
PRECIP_MAP.put(0.055f,".05");
|
||||
PRECIP_MAP.put(0.065f,".06");
|
||||
PRECIP_MAP.put(0.075f,".07");
|
||||
PRECIP_MAP.put(0.085f,".08");
|
||||
PRECIP_MAP.put(0.095f,".09");
|
||||
}
|
||||
|
||||
private static String getVisibiiltyFormat(float vis) {
|
||||
String retVal = "";
|
||||
if (vis < 97.5) {
|
||||
retVal = VIS_MAP.ceilingEntry(vis).getValue();
|
||||
} else if (vis <= 110) {
|
||||
retVal = VIS_MAP.floorEntry(vis).getValue();
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private static String getPrecipFormat(double precip) {
|
||||
String retVal = "";
|
||||
if (precip < 0.085) {
|
||||
retVal = PRECIP_MAP.ceilingEntry((float) precip).getValue();
|
||||
} else if (precip < 0.095) {
|
||||
retVal = PRECIP_MAP.floorEntry((float) precip).getValue();
|
||||
} else {
|
||||
DecimalFormat p = new DecimalFormat("####.00");
|
||||
retVal = p.format(precip);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static String get(String param, String value) {
|
||||
String retVal = value;
|
||||
|
||||
if (param.matches("VIS")) {
|
||||
retVal = getVisibiiltyFormat(Float.parseFloat(value));
|
||||
} else if (param.startsWith("PR")) {
|
||||
retVal = getPrecipFormat(Double.parseDouble(value));
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,393 +0,0 @@
|
|||
/**
|
||||
* 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.viz.pointdata;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
|
||||
import com.raytheon.uf.viz.core.comm.Connector;
|
||||
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* A Eclipse Job thread that will listen for new stations on a queue and request
|
||||
* the data to create the plots.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 11/20/2006 brockwoo Initial creation
|
||||
* 12/06/2006 brockwoo Implemented code review changes
|
||||
* 05/11/2007 #273 brockwoo Implemented JavaScript obs request
|
||||
* 04/16/2008 njensen createActionASCII uses ScriptCreator
|
||||
* </pre>
|
||||
*
|
||||
* @author brockwoo
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PlotModelGenerator extends Job {
|
||||
|
||||
private final ConcurrentLinkedQueue<String> stationQueue;
|
||||
|
||||
private String inspectUri = null;
|
||||
|
||||
// private boolean isRunning = true;
|
||||
private final Connector asciiConnection;
|
||||
|
||||
private final ConcurrentHashMap<String, ImageContainer> icaoImageMap;
|
||||
|
||||
private final ConcurrentHashMap<String, IImage> icaoImages;
|
||||
|
||||
private boolean looping;
|
||||
|
||||
private final PlotModelFactory plotCreator;
|
||||
|
||||
private final IGraphicsTarget target;
|
||||
|
||||
private final String plugin;
|
||||
|
||||
private class ImageContainer {
|
||||
public PluginDataObject record = null;
|
||||
|
||||
public boolean queued = false;
|
||||
|
||||
public boolean available = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the thread with the station's reference time and the target
|
||||
* to create textures for.
|
||||
*
|
||||
* @param refTime
|
||||
* A string with the reference time needed to get the station out
|
||||
* of Lucene
|
||||
* @param target
|
||||
* The graphic target to create the tiles for
|
||||
* @throws VizException
|
||||
*/
|
||||
public PlotModelGenerator(IGraphicsTarget aTarget,
|
||||
IMapDescriptor mapDescriptor, String plotModelFile, String plugin)
|
||||
throws VizException {
|
||||
super("Creating Plots...");
|
||||
stationQueue = new ConcurrentLinkedQueue<String>();
|
||||
asciiConnection = Connector.getInstance();
|
||||
icaoImageMap = new ConcurrentHashMap<String, ImageContainer>();
|
||||
this.icaoImages = new ConcurrentHashMap<String, IImage>();
|
||||
plotCreator = new PlotModelFactory(mapDescriptor, plotModelFile);
|
||||
this.target = aTarget;
|
||||
this.plugin = plugin;
|
||||
this.looping = false;
|
||||
}
|
||||
|
||||
public int getPlotModelWidth() {
|
||||
return this.plotCreator.getDefinedPlotModelWidth();
|
||||
}
|
||||
|
||||
public void setPlotModelSize(long width) {
|
||||
this.plotCreator.setPlotDimensions(width, width);
|
||||
this.cleanImages();
|
||||
}
|
||||
|
||||
public void setPlotModelColor(RGB color) {
|
||||
this.plotCreator.setColor(color);
|
||||
this.cleanImages();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// while (isRunning) {
|
||||
while (stationQueue.size() > 0 || inspectUri != null) {
|
||||
IImage image = null;
|
||||
ArrayList<String> queuePurgeList = new ArrayList<String>();
|
||||
ArrayList<String> stationQuery = new ArrayList<String>();
|
||||
|
||||
synchronized (this) {
|
||||
if (inspectUri != null) {
|
||||
if (!icaoImageMap.containsKey(inspectUri)) {
|
||||
ImageContainer newPlot = new ImageContainer();
|
||||
newPlot.queued = true;
|
||||
icaoImageMap.put(inspectUri, newPlot);
|
||||
this.stationQueue.add(inspectUri);
|
||||
} else {
|
||||
if (!this.icaoImageMap.get(inspectUri).queued) {
|
||||
this.icaoImageMap.get(inspectUri).queued = true;
|
||||
this.stationQueue.add(inspectUri);
|
||||
}
|
||||
}
|
||||
if (icaoImageMap.get(inspectUri).record == null) {
|
||||
stationQuery.add(inspectUri);
|
||||
}
|
||||
inspectUri = null;
|
||||
} else {
|
||||
String[] stationList = stationQueue
|
||||
.toArray(new String[stationQueue.size()]);
|
||||
int stationCounter;
|
||||
for (stationCounter = 0; stationCounter < stationList.length; stationCounter++) {
|
||||
queuePurgeList.add(stationList[stationCounter]);
|
||||
if (this.icaoImageMap.get(stationList[stationCounter]).record == null) {
|
||||
stationQuery.add(stationList[stationCounter]);
|
||||
}
|
||||
if (stationCounter == 74) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stationQuery.size() > 0) {
|
||||
try {
|
||||
PluginDataObject[] obs = requestPluginDataObjects(stationQuery
|
||||
.toArray(new String[0]));
|
||||
for (PluginDataObject ob : obs) {
|
||||
ImageContainer ic = icaoImageMap.get(ob.getDataURI());
|
||||
if (ic != null) {
|
||||
ic.record = ob;
|
||||
} else {
|
||||
System.out.println("Missing: " + ob.getDataURI());
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
int counter = 0;
|
||||
for (int uriCounter = 0; uriCounter < queuePurgeList.size(); uriCounter++) {
|
||||
try {
|
||||
String dataUri = queuePurgeList.get(uriCounter);
|
||||
PluginDataObject ob = this.icaoImageMap.get(dataUri).record;
|
||||
if (ob != null && !this.icaoImageMap.get(dataUri).available) {
|
||||
image = target.initializeRaster(new IODataPreparer(
|
||||
plotCreator.getStationPlot(ob),
|
||||
ob.getDataURI(), 0), null);
|
||||
icaoImages.put(ob.getDataURI(), image);
|
||||
icaoImageMap.get(ob.getDataURI()).available = true;
|
||||
icaoImageMap.get(ob.getDataURI()).queued = false;
|
||||
} else { // For what ever reason, the datauri did not
|
||||
// return a PluginDataObject
|
||||
// System.out.println(dataUri);
|
||||
BufferedImage bufferedImage = new BufferedImage(10, 10,
|
||||
BufferedImage.TYPE_BYTE_INDEXED);
|
||||
image = target.initializeRaster(new IODataPreparer(
|
||||
bufferedImage, dataUri, 0), null);
|
||||
icaoImages.put(dataUri, image);
|
||||
icaoImageMap.get(dataUri).available = true;
|
||||
icaoImageMap.get(dataUri).queued = false;
|
||||
}
|
||||
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
if (queuePurgeList.size() > 0) {
|
||||
stationQueue.removeAll(queuePurgeList);
|
||||
queuePurgeList.clear();
|
||||
if (!this.looping) {
|
||||
target.setNeedsRefresh(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* try { Thread.sleep(5); } catch (InterruptedException e) { }
|
||||
*/
|
||||
// this.schedule(5);
|
||||
// }
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a station to the queue
|
||||
*
|
||||
* @param station
|
||||
* A string for a valid station within Lucene
|
||||
* @return If the station was added to the queue properly
|
||||
*/
|
||||
public void queueStations(ArrayList<String> stationList, boolean looping) {
|
||||
for (String dataUri : stationList) {
|
||||
if (!icaoImageMap.containsKey(dataUri)) {
|
||||
ImageContainer newPlot = new ImageContainer();
|
||||
newPlot.queued = true;
|
||||
icaoImageMap.put(dataUri, newPlot);
|
||||
this.stationQueue.add(dataUri);
|
||||
} else {
|
||||
if (!this.icaoImageMap.get(dataUri).queued) {
|
||||
this.icaoImageMap.get(dataUri).queued = true;
|
||||
this.stationQueue.add(dataUri);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(this.getState() == Job.RUNNING)) {
|
||||
this.schedule();
|
||||
}
|
||||
this.looping = looping;
|
||||
}
|
||||
|
||||
public void setStation(String dataUri) {
|
||||
icaoImageMap.put(dataUri, new ImageContainer());
|
||||
}
|
||||
|
||||
public void setStation(PluginDataObject pdo) {
|
||||
ImageContainer newDataUri = new ImageContainer();
|
||||
newDataUri.record = pdo;
|
||||
this.icaoImageMap.put(pdo.getDataURI(), newDataUri);
|
||||
}
|
||||
|
||||
public String getStationMessage(String dataUri) {
|
||||
|
||||
String message = null;
|
||||
if (icaoImageMap.get(dataUri) != null
|
||||
&& icaoImageMap.get(dataUri).record != null) {
|
||||
message = (String) icaoImageMap.get(dataUri).record
|
||||
.getMessageData();
|
||||
} else {
|
||||
message = "Generating...";
|
||||
synchronized (this) {
|
||||
if (dataUri != null && !dataUri.equals(inspectUri)) {
|
||||
inspectUri = dataUri;
|
||||
if (!(this.getState() == Job.RUNNING)) {
|
||||
this.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public PluginDataObject getStationObject(String dataUri) {
|
||||
if (!this.icaoImageMap.containsKey(dataUri)) {
|
||||
return null;
|
||||
} else {
|
||||
return this.icaoImageMap.get(dataUri).record;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the texture for a station.
|
||||
*
|
||||
* @param station
|
||||
* The station to get the texture for
|
||||
* @return The texture
|
||||
*/
|
||||
public IImage getStation(String dataUri) {
|
||||
return icaoImages.get(dataUri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the station is in the queue. This can be called to make
|
||||
* sure that a station is not added twice to be created.
|
||||
*
|
||||
* @param station
|
||||
* The station to check for
|
||||
* @return A boolean indicating if the station is already set to be
|
||||
* processed
|
||||
*/
|
||||
public boolean isQueued(String dataUri) {
|
||||
if (!this.icaoImageMap.containsKey(dataUri)) {
|
||||
return false;
|
||||
}
|
||||
return icaoImageMap.get(dataUri).queued;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will check to see if the station already has a texture available.
|
||||
*
|
||||
* @param station
|
||||
* The station to check for
|
||||
* @return A boolean indicating the texture status
|
||||
*/
|
||||
public boolean hasImage(String dataUri) {
|
||||
if (!this.icaoImageMap.containsKey(dataUri)) {
|
||||
return false;
|
||||
}
|
||||
return icaoImageMap.get(dataUri).available;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kills the thread.
|
||||
*
|
||||
*/
|
||||
public void shutdown() {
|
||||
this.cancel();
|
||||
cleanImages();
|
||||
}
|
||||
|
||||
public void cleanImages() {
|
||||
// Clean up images
|
||||
Set<String> imageDataUris = icaoImages.keySet();
|
||||
for (String imageDataUri : imageDataUris) {
|
||||
icaoImages.get(imageDataUri).dispose();
|
||||
icaoImages.remove(imageDataUri);
|
||||
this.icaoImageMap.get(imageDataUri).available = false;
|
||||
this.icaoImageMap.get(imageDataUri).queued = false;
|
||||
}
|
||||
}
|
||||
|
||||
private PluginDataObject[] requestPluginDataObjects(String[] uris)
|
||||
throws VizException {
|
||||
DbQueryRequest request = new DbQueryRequest();
|
||||
request.addConstraint("pluginName", new RequestConstraint(plugin));
|
||||
RequestConstraint ids = new RequestConstraint();
|
||||
ids.setConstraintType(ConstraintType.IN);
|
||||
ids.setConstraintValueList(uris);
|
||||
request.addConstraint("dataURI", ids);
|
||||
request.setLimit(uris.length);
|
||||
|
||||
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||
.sendRequest(request);
|
||||
return response.getEntityObjects(PluginDataObject.class);
|
||||
}
|
||||
|
||||
public void setPlotModelLineStyle(LineStyle lineStyle) {
|
||||
plotCreator.setLineStyle(lineStyle);
|
||||
cleanImages();
|
||||
}
|
||||
|
||||
public void setPlotModelLineWidth(int outlineWidth) {
|
||||
plotCreator.setLineWidth(outlineWidth);
|
||||
cleanImages();
|
||||
}
|
||||
|
||||
}
|
|
@ -44,7 +44,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2.PlotModelElement;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory.PlotModelElement;
|
||||
import com.raytheon.viz.pointdata.util.PointDataInventory;
|
||||
|
||||
/**
|
||||
|
@ -54,9 +54,10 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 18, 2013 2391 mpduff Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 18, 2013 2391 mpduff Initial creation
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -137,7 +138,7 @@ public class PlotModels {
|
|||
try {
|
||||
if (!models.containsKey(fileName)) {
|
||||
List<String> params = new ArrayList<String>();
|
||||
List<PlotModelElement> fields = new PlotModelFactory2(
|
||||
List<PlotModelElement> fields = new PlotModelFactory(
|
||||
fakeDescriptor, fileName).getPlotFields();
|
||||
for (PlotModelElement p : fields) {
|
||||
if (!p.parameter.equals("")
|
||||
|
|
|
@ -1,388 +0,0 @@
|
|||
/**
|
||||
* 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.viz.pointdata;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
|
||||
public class StringLookup {
|
||||
|
||||
private static final String plotmodelDir = "plotModels";
|
||||
|
||||
private final String filename;
|
||||
|
||||
private final HashMap<String, String> lookup;
|
||||
|
||||
private final TreeMap<Float, String> rangeLookup;
|
||||
|
||||
private float firstValue = -9999;
|
||||
|
||||
private float secondValue = -9999;
|
||||
|
||||
private String defLookup;
|
||||
|
||||
private String splitValue;
|
||||
|
||||
private int splitValueIndex = -1;
|
||||
|
||||
protected StringLookup(String filename) {
|
||||
this.filename = filename;
|
||||
this.lookup = new HashMap<String, String>();
|
||||
this.rangeLookup = new TreeMap<Float, String>();
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return this.filename;
|
||||
}
|
||||
|
||||
public String recursiveTranslation(String field) {
|
||||
/*
|
||||
* if(splitValue != null && field != null){ String[] tempFields =
|
||||
* field.split(splitValue); if(tempFields.length == 2){ field =
|
||||
* tempFields[this.splitValueIndex]; } }
|
||||
* if(this.lookup.containsKey(field)){ return this.lookup.get(field); }
|
||||
* else if(this.defLookup != null){ return this.defLookup; } else{
|
||||
* return null; }
|
||||
*/
|
||||
|
||||
// Initialize.
|
||||
int j, k, c, n, m;
|
||||
// int pos;
|
||||
String txtstr;
|
||||
// char cp = 0;
|
||||
// char cp0;
|
||||
|
||||
// Empty input, empty output.
|
||||
if (field == null || field.length() == 0 || field.equals("-9999")) {
|
||||
if (this.defLookup != null) {
|
||||
return this.defLookup;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Simple case of being able to translate the whole string.
|
||||
if (this.lookup.containsKey(field)) {
|
||||
return this.lookup.get(field);
|
||||
}
|
||||
|
||||
// If required, perform an edit operation where we replace everthing
|
||||
// from the substring _left to the beginning of the string with the
|
||||
// string _leftTrans.
|
||||
n = field.length();
|
||||
if (splitValue != null && field != null) {
|
||||
String[] tempFields = field.split(splitValue);
|
||||
if (tempFields.length == 2) {
|
||||
field = tempFields[this.splitValueIndex];
|
||||
n = field.length();
|
||||
}
|
||||
}
|
||||
|
||||
// Try to translate the whole thing again.
|
||||
if (this.lookup.containsKey(field)) {
|
||||
return this.lookup.get(field);
|
||||
}
|
||||
|
||||
// Initialize the output with an invisible string the same length as
|
||||
// the input, loop through each possible substring size.
|
||||
int nLeft = n; // number of untranslated characters
|
||||
boolean none = true; // true if nothing has been translated.
|
||||
String output = this.invisibleString(n);
|
||||
for (m = n - 1; m >= 1; m--) {
|
||||
|
||||
// If we have enough untranslated characters to translate a
|
||||
// substring
|
||||
// of this size, loop through each possible substring.
|
||||
if (nLeft < m || m > n - 1)
|
||||
continue;
|
||||
for (c = 0; c <= n - m; c++) {
|
||||
|
||||
// If a translation for this substring is not found, go on.
|
||||
if (!this.lookup.containsKey(this.mid(field, c, m))) {
|
||||
continue;
|
||||
} else {
|
||||
txtstr = this.lookup.get(this.mid(field, c, m));
|
||||
}
|
||||
|
||||
// Replace input substring with unprintable characters, put
|
||||
// the translation in the output string.
|
||||
j = txtstr.length();
|
||||
k = n - (c + m);
|
||||
field = this.left(field, c) + this.invisibleString(j)
|
||||
+ this.right(field, k);
|
||||
output = this.left(output, c) + txtstr + this.right(output, k);
|
||||
|
||||
// Update next substring position, number untranslated and total
|
||||
// string length.
|
||||
c += j - 1;
|
||||
nLeft -= m;
|
||||
none = false;
|
||||
n = field.length();
|
||||
if (nLeft < m)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Make anything that is all unprintable an empty string.
|
||||
if (nLeft == 0)
|
||||
field = "";
|
||||
else if (none)
|
||||
return defLookup;
|
||||
return output;
|
||||
}
|
||||
|
||||
public String determineRange(String field) {
|
||||
String retVal = field;
|
||||
|
||||
if (retVal != null) {
|
||||
try {
|
||||
float value = Float.parseFloat(field);
|
||||
if (value < this.firstValue) {
|
||||
retVal = rangeLookup.ceilingEntry(value).getValue();
|
||||
} else if (value <= this.secondValue) {
|
||||
retVal = rangeLookup.ceilingEntry(value).getValue();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// use default value
|
||||
if (this.defLookup != null) {
|
||||
retVal = this.defLookup;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (retVal == null) {
|
||||
if (this.defLookup != null) {
|
||||
retVal = this.defLookup;
|
||||
} else {
|
||||
retVal = " ";
|
||||
}
|
||||
}
|
||||
if (retVal.contains("~")) {
|
||||
retVal = retVal.replace('~', ' ');
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private String mid(String stringToParse, int start, int length) {
|
||||
int lStart = start;
|
||||
int lLength = length;
|
||||
if (lStart >= stringToParse.length()) {
|
||||
lStart = stringToParse.length();
|
||||
}
|
||||
lLength = Math.min(stringToParse.length() - lStart, lLength);
|
||||
String returnString = null;
|
||||
try {
|
||||
returnString = stringToParse.substring(lStart, lStart + lLength);
|
||||
} catch (Exception e) {
|
||||
System.out.println(start + " " + lStart + " " + length + " "
|
||||
+ lLength + " " + stringToParse);
|
||||
}
|
||||
return returnString;
|
||||
|
||||
}
|
||||
|
||||
private String left(String stringToParse, int length) {
|
||||
if (length >= stringToParse.length()) {
|
||||
return stringToParse;
|
||||
} else {
|
||||
return stringToParse.substring(0, length);
|
||||
}
|
||||
}
|
||||
|
||||
private String right(String stringToParse, int length) {
|
||||
if (length >= stringToParse.length()) {
|
||||
return stringToParse;
|
||||
} else {
|
||||
return stringToParse.substring(stringToParse.length() - length,
|
||||
stringToParse.length());
|
||||
}
|
||||
}
|
||||
|
||||
public void setLookupEntry(String field, String value) {
|
||||
this.lookup.put(field, value);
|
||||
}
|
||||
|
||||
public void setRangeEntry(float field, String value) {
|
||||
this.rangeLookup.put(field, value);
|
||||
}
|
||||
|
||||
public void setDefaultValue(String value) {
|
||||
this.defLookup = value;
|
||||
}
|
||||
|
||||
public void setSplitValueIndex(int value) {
|
||||
this.splitValueIndex = value;
|
||||
}
|
||||
|
||||
public void setSplitValue(String value) {
|
||||
this.splitValue = value;
|
||||
}
|
||||
|
||||
public static StringLookup readS2SFile(String s2nFilename) {
|
||||
BufferedReader input = null;
|
||||
StringLookup lookup = new StringLookup(s2nFilename);
|
||||
File s2nFile = PathManagerFactory.getPathManager().getStaticFile(
|
||||
StringLookup.plotmodelDir + IPathManager.SEPARATOR
|
||||
+ s2nFilename);
|
||||
try {
|
||||
input = new BufferedReader(new FileReader(s2nFile));
|
||||
String line = null;
|
||||
while ((line = input.readLine()) != null) {
|
||||
if (line.matches("s2s")) {
|
||||
continue;
|
||||
} else if (line.contains("left") || line.contains("right")) {
|
||||
if (line.contains("left")) {
|
||||
lookup.setSplitValueIndex(1);
|
||||
} else if (line.contains("right")) {
|
||||
lookup.setSplitValueIndex(0);
|
||||
}
|
||||
String[] splitValue = line.split("\\s");
|
||||
lookup.setSplitValue("\\s*" + splitValue[1] + "\\s*");
|
||||
continue;
|
||||
}
|
||||
String[] lookupValues = null;
|
||||
if (line.contains(":")) {
|
||||
lookupValues = line.split("\\s*:\\s*");
|
||||
} else {
|
||||
lookupValues = line.split("\\s");
|
||||
}
|
||||
if (lookupValues != null && lookupValues.length == 2) {
|
||||
if (lookupValues[0].matches("default")) {
|
||||
lookup.setDefaultValue(lookupValues[1]);
|
||||
} else {
|
||||
lookup.setLookupEntry(lookupValues[0], lookupValues[1]);
|
||||
}
|
||||
} else if (lookupValues != null && lookupValues.length == 1) {
|
||||
if (lookupValues[0].matches("default")) {
|
||||
lookup.setDefaultValue(" ");
|
||||
} else {
|
||||
lookup.setLookupEntry(lookupValues[0], " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
input.close();
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return lookup;
|
||||
}
|
||||
|
||||
public static StringLookup readR2SFile(String r2nFilename) {
|
||||
BufferedReader input = null;
|
||||
StringLookup lookup = new StringLookup(r2nFilename);
|
||||
File r2nFile = PathManagerFactory.getPathManager().getStaticFile(
|
||||
StringLookup.plotmodelDir + IPathManager.SEPARATOR
|
||||
+ r2nFilename);
|
||||
try {
|
||||
input = new BufferedReader(new FileReader(r2nFile));
|
||||
String line = null;
|
||||
ArrayList<String> tempLookupValues;
|
||||
boolean firstEntry = true;
|
||||
float first = -9999;
|
||||
float second = -9999;
|
||||
while ((line = input.readLine()) != null) {
|
||||
if (line.matches("r2s") || line.startsWith("#")) {
|
||||
continue;
|
||||
}
|
||||
String[] lookupValues = null;
|
||||
if (line.contains(" ")) {
|
||||
lookupValues = line.split(" ");
|
||||
}
|
||||
|
||||
if (lookupValues != null) {
|
||||
tempLookupValues = new ArrayList<String>();
|
||||
for (int i = 0; i < lookupValues.length; i++) {
|
||||
if (!lookupValues[i].equals(" ")
|
||||
&& !lookupValues[i].equals("")) {
|
||||
tempLookupValues.add(lookupValues[i]);
|
||||
}
|
||||
}
|
||||
lookupValues = tempLookupValues
|
||||
.toArray(new String[tempLookupValues.size()]);
|
||||
if (lookupValues.length == 2
|
||||
&& lookupValues[0].matches("default")) {
|
||||
lookup.setDefaultValue(lookupValues[1]);
|
||||
} else if (lookupValues.length == 3) {
|
||||
try {
|
||||
|
||||
if (firstEntry) {
|
||||
firstEntry = false;
|
||||
second = Float.parseFloat(lookupValues[1]);
|
||||
lookup.setRangeEntry(
|
||||
Float.parseFloat(lookupValues[0]),
|
||||
lookupValues[2]);
|
||||
lookup.setRangeEntry(
|
||||
Float.parseFloat(lookupValues[1]),
|
||||
lookupValues[2]);
|
||||
|
||||
} else {
|
||||
first = second;
|
||||
second = Float.parseFloat(lookupValues[1]);
|
||||
lookup.setRangeEntry(
|
||||
Float.parseFloat(lookupValues[1]),
|
||||
lookupValues[2]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lookup.setFirstValue(first);
|
||||
lookup.setSecondValue(second);
|
||||
input.close();
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return lookup;
|
||||
}
|
||||
|
||||
private String invisibleString(int length) {
|
||||
char character = ' ';
|
||||
char[] toReturn = new char[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
toReturn[i] = character;
|
||||
}
|
||||
return new String(toReturn);
|
||||
}
|
||||
|
||||
private void setFirstValue(float firstValue) {
|
||||
this.firstValue = firstValue;
|
||||
}
|
||||
|
||||
private void setSecondValue(float secondValue) {
|
||||
this.secondValue = secondValue;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* 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.
|
||||
**/
|
||||
/**
|
||||
* Provides support for point data
|
||||
*/
|
||||
package com.raytheon.viz.pointdata;
|
|
@ -28,7 +28,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
|||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.python.concurrent.AbstractPythonScriptFactory;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory;
|
||||
|
||||
/**
|
||||
* Builds a plot delegate python script based on the script text extracted from
|
||||
|
@ -40,9 +40,10 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 14, 2014 2868 njensen Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Mar 14, 2014 2868 njensen Initial creation
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,7 +88,7 @@ public class PlotPythonScriptFactory extends
|
|||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationFile[] files = pm.listFiles(pm
|
||||
.getLocalSearchHierarchy(LocalizationType.CAVE_STATIC),
|
||||
PlotModelFactory2.PLOT_MODEL_DIR, null, false, false);
|
||||
PlotModelFactory.PLOT_MODEL_DIR, null, false, false);
|
||||
StringBuilder includeBuilder = new StringBuilder();
|
||||
for (LocalizationFile lf : files) {
|
||||
if (lf.exists() && lf.isDirectory()) {
|
||||
|
@ -103,7 +104,7 @@ public class PlotPythonScriptFactory extends
|
|||
if (baseFilePath == null) {
|
||||
File baseFile = PathManagerFactory.getPathManager()
|
||||
.getStaticFile(
|
||||
PlotModelFactory2.PLOT_MODEL_DIR
|
||||
PlotModelFactory.PLOT_MODEL_DIR
|
||||
+ IPathManager.SEPARATOR
|
||||
+ "PlotModelInterface.py");
|
||||
baseFilePath = baseFile.getAbsolutePath();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,786 +0,0 @@
|
|||
/**
|
||||
* 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.viz.pointdata.rsc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.opengis.coverage.grid.GridEnvelope;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||
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.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.jobs.JobPool;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||
import com.raytheon.viz.pointdata.IPlotModelGeneratorCaller;
|
||||
import com.raytheon.viz.pointdata.PlotAlertParser;
|
||||
import com.raytheon.viz.pointdata.PlotInfo;
|
||||
import com.raytheon.viz.pointdata.drawables.IPointImageExtension;
|
||||
import com.raytheon.viz.pointdata.drawables.IPointImageExtension.PointImage;
|
||||
import com.raytheon.viz.pointdata.rsc.progdisc.AbstractProgDisclosure;
|
||||
import com.raytheon.viz.pointdata.rsc.progdisc.AbstractProgDisclosure.IProgDiscListener;
|
||||
import com.raytheon.viz.pointdata.rsc.progdisc.DynamicProgDisclosure;
|
||||
import com.raytheon.viz.pointdata.rsc.progdisc.SpiProgDisclosure;
|
||||
import com.raytheon.viz.pointdata.thread.GetDataTask;
|
||||
import com.raytheon.viz.pointdata.thread.GetDataTask.Params;
|
||||
import com.raytheon.viz.pointdata.thread.PlotThreadOverseer;
|
||||
import com.raytheon.viz.pointdata.units.PlotUnits;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* Provides a resource that will display plot data for a given reference time.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 20, 2006 brockwoo Initial creation.
|
||||
* Feb 17, 2009 njensen Refactored to new rsc architecture.
|
||||
* Mar 17, 2009 2105 jsanchez Plot goessounding/poessounding
|
||||
* availability.
|
||||
* Mar 30, 2009 2169 jsanchez Updated initNewFrame.
|
||||
* Apr 09, 2009 952 jsanchez Plot acars.
|
||||
* Apr 13, 2009 2251 jsanchez Plot profilers.
|
||||
* Apr 21, 2009 chammack Refactor to common pointData model
|
||||
* Feb 01, 2013 1567 njensen Refactor handling of updates
|
||||
* May 14, 2013 1869 bsteffen Get plots working without dataURI
|
||||
* May 23, 2013 14996 snaples Updated processUpdatedPlot to handle AWOS
|
||||
* stations updates properly
|
||||
* Jun 06, 2013 2072 bsteffen Fix concurrency problems when init is
|
||||
* called before time matching is done.
|
||||
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||
* Sep 04, 2013 16519 kshresth Fix Metar Display Problem
|
||||
* Dec 02, 2013 2473 njensen Prog Disclose paint frames at high priority
|
||||
* Mar 21, 2014 2868 njensen Use PlotThreadOverseer for increased efficiency
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author brockwoo
|
||||
* @version 1.0
|
||||
*/
|
||||
public class PlotResource2 extends
|
||||
AbstractVizResource<PlotResourceData, MapDescriptor> implements
|
||||
IResourceDataChanged, IPlotModelGeneratorCaller, IProgDiscListener {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PlotResource2.class);
|
||||
|
||||
private static final double MAX_SAMPLE_DISANCE = 2;
|
||||
|
||||
public static final String NO_DATA = "NO DATA";
|
||||
|
||||
private AbstractProgDisclosure progressiveDisclosure;
|
||||
|
||||
private PlotThreadOverseer generator;
|
||||
|
||||
private double plotWidth;
|
||||
|
||||
private final Map<DataTime, FrameInformation> frameMap;
|
||||
|
||||
private DataTime displayedTime;
|
||||
|
||||
private RGB imageColor = null;
|
||||
|
||||
private JobPool frameRetrievalPool = new JobPool("Retrieving plot frame",
|
||||
8, true);
|
||||
|
||||
private class FrameRetriever implements Runnable {
|
||||
|
||||
private DataTime dataTime;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
initNewFrame(dataTime);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error retrieving frame information for time: "
|
||||
+ dataTime, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A station represents all the data for a single location(station) for a
|
||||
* single frame
|
||||
*
|
||||
*/
|
||||
public static class Station {
|
||||
/*
|
||||
* Contains all PlotInfo objects for the same stationId with the same
|
||||
* normalized time(real time will be different)
|
||||
*/
|
||||
public PlotInfo[] info;
|
||||
|
||||
/*
|
||||
* The image to display for this plot
|
||||
*/
|
||||
public PointImage plotImage;
|
||||
|
||||
/*
|
||||
* Sampling text for this plot
|
||||
*/
|
||||
public String rawMessage;
|
||||
|
||||
/*
|
||||
* Information used be the progressive disclosure algorithm
|
||||
*/
|
||||
public Object progDiscInfo;
|
||||
|
||||
/*
|
||||
* Location of the plot in descriptor grid space.
|
||||
*/
|
||||
public Coordinate pixelLocation;
|
||||
|
||||
}
|
||||
|
||||
public class FrameInformation {
|
||||
Map<String, Station> stationMap = new ConcurrentHashMap<String, Station>();
|
||||
|
||||
List<Station> lastComputed = Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a surface plot resource.
|
||||
*
|
||||
* @param target
|
||||
* The graphic target to draw to
|
||||
* @param refTime
|
||||
* The reference time to request data against
|
||||
* @throws VizException
|
||||
*/
|
||||
public PlotResource2(PlotResourceData data, LoadProperties props) {
|
||||
super(data, props);
|
||||
if (data.getAlertParser() == null) {
|
||||
data.setAlertParser(new PlotAlertParser());
|
||||
}
|
||||
this.dataTimes = new ArrayList<DataTime>();
|
||||
this.frameMap = new ConcurrentHashMap<DataTime, FrameInformation>();
|
||||
data.addChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.resourceData.getPlotSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget aTarget,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
DataTime curTime = paintProps.getDataTime();
|
||||
if (curTime == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
FrameInformation curFrame = frameMap.get(curTime);
|
||||
if (curFrame == null) {
|
||||
curFrame = startFrameInit(curTime);
|
||||
}
|
||||
|
||||
if (progressiveDisclosure.updateProperties(paintProps)
|
||||
|| !curTime.equals(displayedTime)) {
|
||||
displayedTime = paintProps.getDataTime();
|
||||
progressiveDisclosure.update(curFrame.stationMap.values(),
|
||||
displayedTime, true);
|
||||
resourceData.getPlotInfoRetriever().updateActiveFrame(
|
||||
paintProps.getDataTime(),
|
||||
descriptor.pixelToWorld(paintProps.getView().getExtent(),
|
||||
descriptor.getCRS()), descriptor.getCRS());
|
||||
}
|
||||
|
||||
if (!progressiveDisclosure.isDone() || !generator.isDone()
|
||||
|| frameRetrievalPool.isActive()) {
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
List<Station> stationList = curFrame.lastComputed;
|
||||
|
||||
if (stationList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<PointImage> images = new ArrayList<PointImage>(stationList.size());
|
||||
for (Station station : stationList) {
|
||||
if (station.plotImage == null) {
|
||||
continue;
|
||||
}
|
||||
// set image color so shader can draw in appropriate color
|
||||
((ISingleColorImage) station.plotImage.getImage())
|
||||
.setColor(imageColor);
|
||||
images.add(station.plotImage);
|
||||
}
|
||||
|
||||
aTarget.getExtension(IPointImageExtension.class).drawPointImages(
|
||||
paintProps, images);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget aTarget) throws VizException {
|
||||
Map<String, RequestConstraint> request = resourceData.getMetadataMap();
|
||||
RequestConstraint plugin = request.get("pluginName");
|
||||
PlotUnits.register();
|
||||
generator = new PlotThreadOverseer(aTarget, descriptor,
|
||||
this.resourceData.getPlotModelFile(),
|
||||
this.resourceData.getLevelKey(), plugin.getConstraintValue(),
|
||||
this.resourceData.getMetadataMap(), this);
|
||||
this.generator.setPlotModelColor(getCapability(
|
||||
ColorableCapability.class).getColor());
|
||||
this.imageColor = getCapability(ColorableCapability.class).getColor();
|
||||
this.generator.setPlotModelLineStyle(getCapability(
|
||||
OutlineCapability.class).getLineStyle());
|
||||
this.generator.setPlotModelLineWidth(getCapability(
|
||||
OutlineCapability.class).getOutlineWidth());
|
||||
this.generator.setPlotMissingData(resourceData.isPlotMissingData());
|
||||
this.generator.setLowerLimit(resourceData.getLowerLimit());
|
||||
this.generator.setUpperLimit(resourceData.getUpperLimit());
|
||||
this.plotWidth = generator.getOriginalPlotModelWidth();
|
||||
this.plotWidth *= getCapability(MagnificationCapability.class)
|
||||
.getMagnification();
|
||||
generator.setPlotModelSize(Math.round(plotWidth));
|
||||
|
||||
// TODO this should be in a factory or something
|
||||
if (resourceData.getSpiFile() != null) {
|
||||
progressiveDisclosure = new SpiProgDisclosure(this, descriptor,
|
||||
resourceData.getSpiFile());
|
||||
} else {
|
||||
progressiveDisclosure = new DynamicProgDisclosure(this, descriptor);
|
||||
}
|
||||
progressiveDisclosure.setMagnification(this.getCapability(
|
||||
MagnificationCapability.class).getMagnification());
|
||||
progressiveDisclosure.setDensity(this.getCapability(
|
||||
DensityCapability.class).getDensity());
|
||||
progressiveDisclosure.setPixelSizeHint(resourceData.getPixelSizeHint());
|
||||
progressiveDisclosure.setPlotWidth(plotWidth);
|
||||
|
||||
DataTime[] dts = this.descriptor.getFramesInfo().getTimeMap().get(this);
|
||||
// if this is null then the time matcher has not yet had time to time
|
||||
// match this, in which case frames will have to load when they are
|
||||
// first painted.
|
||||
if (dts != null) {
|
||||
// init backwards
|
||||
for (int i = dts.length - 1; i > -1; i--) {
|
||||
DataTime time = dts[i];
|
||||
if (time != null) {
|
||||
FrameInformation curFrame = frameMap.get(time);
|
||||
if (curFrame == null) {
|
||||
curFrame = startFrameInit(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized FrameInformation startFrameInit(DataTime time) {
|
||||
FrameInformation frame = new FrameInformation();
|
||||
dataTimes.add(time);
|
||||
frameMap.put(time, frame);
|
||||
FrameRetriever retriever = new FrameRetriever();
|
||||
retriever.dataTime = time;
|
||||
frameRetrievalPool.schedule(retriever);
|
||||
return frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the plots to ensure they are displayable, ie a frame exists that
|
||||
* matches their time and they are within the descriptor's world extent. If
|
||||
* so, schedules them for disclosure. Also checks if a plot already exists
|
||||
* and this is an update, and if so, updates the plot.
|
||||
*
|
||||
* @param stationsToParse
|
||||
* stations to potentially process and display
|
||||
* @throws VizException
|
||||
*/
|
||||
protected void updateRecords(PlotInfo[] stationsToParse)
|
||||
throws VizException {
|
||||
Validate.notNull(stationsToParse);
|
||||
Map<DataTime, List<PlotInfo>> plots = new HashMap<DataTime, List<PlotInfo>>();
|
||||
// Sort plots into normalized datatimes that should match frames
|
||||
for (PlotInfo info : stationsToParse) {
|
||||
DataTime normTime = getNormalizedTime(info.dataTime);
|
||||
if (frameMap.containsKey(normTime)) {
|
||||
List<PlotInfo> list = plots.get(normTime);
|
||||
if (list == null) {
|
||||
list = new ArrayList<PlotInfo>();
|
||||
plots.put(normTime, list);
|
||||
}
|
||||
list.add(info);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GridEnvelope range = descriptor.getGridGeometry().getGridRange();
|
||||
PixelExtent worldExtent = new PixelExtent(range.getLow(0),
|
||||
range.getHigh(0), range.getLow(1), range.getHigh(1));
|
||||
|
||||
for (Entry<DataTime, List<PlotInfo>> entry : plots.entrySet()) {
|
||||
DataTime time = entry.getKey();
|
||||
List<PlotInfo> info = entry.getValue();
|
||||
FrameInformation frameInfo = frameMap.get(time);
|
||||
|
||||
// Sort this data in "backwards" so that the most recent observation
|
||||
// for a particular station display correctly
|
||||
if (info.size() > 1) {
|
||||
Collections.sort(info, new Comparator<PlotInfo>() {
|
||||
|
||||
@Override
|
||||
public int compare(PlotInfo o1, PlotInfo o2) {
|
||||
return o2.dataTime.compareTo(o1.dataTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (frameInfo != null) {
|
||||
Map<String, Station> stationMap = frameInfo.stationMap;
|
||||
for (PlotInfo plot : info) {
|
||||
if (plot.stationId == null) {
|
||||
plot.stationId = plot.latitude + "#" + plot.longitude;
|
||||
}
|
||||
synchronized (stationMap) {
|
||||
if (stationMap.containsKey(plot.stationId)) {
|
||||
processUpdatedPlot(stationMap.get(plot.stationId),
|
||||
plot);
|
||||
} else {
|
||||
double[] thisLocationPixel = descriptor
|
||||
.worldToPixel(new double[] {
|
||||
plot.longitude, plot.latitude });
|
||||
if ((thisLocationPixel != null)
|
||||
&& worldExtent.contains(
|
||||
thisLocationPixel[0],
|
||||
thisLocationPixel[1])) {
|
||||
Station station = new Station();
|
||||
station.info = new PlotInfo[] { plot };
|
||||
station.pixelLocation = new Coordinate(
|
||||
thisLocationPixel[0],
|
||||
thisLocationPixel[1]);
|
||||
stationMap.put(plot.stationId, station);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
progressiveDisclosure.update(stationMap.values(), time);
|
||||
}
|
||||
}
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing station with a new plot.
|
||||
*
|
||||
* @param existingStation
|
||||
* the existing station
|
||||
* @param plot
|
||||
* the newly received plot
|
||||
*/
|
||||
protected void processUpdatedPlot(Station existingStation, PlotInfo plot) {
|
||||
if (existingStation.plotImage != null) {
|
||||
existingStation.plotImage.getImage().dispose();
|
||||
existingStation.plotImage = null;
|
||||
// DR14966
|
||||
existingStation.rawMessage = null;
|
||||
PlotInfo[] samplePlot = new PlotInfo[1];
|
||||
samplePlot[0] = new PlotInfo();
|
||||
samplePlot[0] = plot;
|
||||
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>();
|
||||
list.add(samplePlot);
|
||||
Params params = Params.PLOT_AND_SAMPLE;
|
||||
GetDataTask task = new GetDataTask(list, params);
|
||||
generator.enqueueDataRetrieval(task);
|
||||
// End DR14996
|
||||
}
|
||||
boolean dup = false;
|
||||
for (PlotInfo element : existingStation.info) {
|
||||
String curUri = element.dataURI;
|
||||
String newUri = plot.dataURI;
|
||||
if ((curUri == null) || curUri.equals(newUri)) {
|
||||
dup = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dup) {
|
||||
// Added for DR14996
|
||||
existingStation.info = Arrays.copyOf(existingStation.info, 1);
|
||||
existingStation.info[0] = plot;
|
||||
Arrays.sort(existingStation.info, new Comparator<PlotInfo>() {
|
||||
@Override
|
||||
public int compare(PlotInfo o1, PlotInfo o2) {
|
||||
return o1.dataTime.compareTo(o2.dataTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private DataTime getNormalizedTime(DataTime time) {
|
||||
if (this.resourceData.getBinOffset() != null) {
|
||||
return this.resourceData.getBinOffset().getNormalizedTime(time);
|
||||
} else {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
resourceData.getPlotInfoRetriever().cancel();
|
||||
progressiveDisclosure.shutdown();
|
||||
if (generator != null) {
|
||||
generator.shutdown();
|
||||
}
|
||||
clearImages();
|
||||
}
|
||||
|
||||
private void initNewFrame(DataTime thisFrameTime) throws VizException {
|
||||
RequestConstraint time = new RequestConstraint();
|
||||
|
||||
BinOffset tmpBinOffset = this.resourceData.getBinOffset();
|
||||
if (tmpBinOffset == null) {
|
||||
// do not set the bin offset in the resource data, it is probably
|
||||
// null for a reason. non-null binOffset can cause problems with
|
||||
// time matching for some products.
|
||||
tmpBinOffset = new BinOffset();
|
||||
}
|
||||
TimeRange tr = null;
|
||||
|
||||
if (this.resourceData.isTopOfTheHour()) {
|
||||
long offset = tmpBinOffset.getNegOffset() * 1000l;
|
||||
long frameInMillis = thisFrameTime.getValidTime().getTimeInMillis();
|
||||
tr = new TimeRange(frameInMillis - offset, frameInMillis);
|
||||
} else if (this.resourceData.getDefaultPeriod() != null) {
|
||||
tr = this.resourceData.getDefaultPeriod().getTimeRange(
|
||||
thisFrameTime);
|
||||
} else {
|
||||
tr = tmpBinOffset.getTimeRange(thisFrameTime);
|
||||
}
|
||||
if (tr.getDuration() > 0) {
|
||||
// handle binning
|
||||
DataTime start = new DataTime(tr.getStart());
|
||||
DataTime end = new DataTime(tr.getEnd());
|
||||
String[] constraintList = { start.toString(), end.toString() };
|
||||
time.setBetweenValueList(constraintList);
|
||||
time.setConstraintType(RequestConstraint.ConstraintType.BETWEEN);
|
||||
|
||||
} else {
|
||||
// handle exact times
|
||||
time.setConstraintValue(thisFrameTime.toString());
|
||||
}
|
||||
|
||||
HashMap<String, RequestConstraint> metadataMap = new HashMap<String, RequestConstraint>(
|
||||
resourceData.getMetadataMap());
|
||||
metadataMap.put("dataTime", time);
|
||||
|
||||
// results will be sent to resourceChanged(DATA_UPDATE) on current
|
||||
// thread
|
||||
resourceData.getPlotInfoRetriever().getStations(this, thisFrameTime,
|
||||
metadataMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String inspect(ReferencedCoordinate coord) throws VizException {
|
||||
String message = NO_DATA;
|
||||
if (displayedTime != null) {
|
||||
if (!this.frameMap.containsKey(displayedTime)) {
|
||||
return message;
|
||||
}
|
||||
Map<String, Station> stationMap = this.frameMap.get(displayedTime).stationMap;
|
||||
Coordinate latlon = null;
|
||||
try {
|
||||
latlon = coord.asLatLon();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error transforming coordinate", e);
|
||||
}
|
||||
|
||||
double[] ml = { latlon.x, latlon.y };
|
||||
double[] pml = descriptor.worldToPixel(ml);
|
||||
Coordinate mouseLocation = new Coordinate(pml[0], pml[1]);
|
||||
double screenToWorldRatio = progressiveDisclosure
|
||||
.getScreenToWorldRatio();
|
||||
List<Station> availableStations = new ArrayList<Station>();
|
||||
for (Station station : stationMap.values()) {
|
||||
if (station != null) {
|
||||
Coordinate pixelLocation = station.pixelLocation;
|
||||
if (distanceBetween(pixelLocation, mouseLocation) <= (this
|
||||
.getResourceData().getPixelSampleDistance() / screenToWorldRatio)) {
|
||||
|
||||
availableStations.add(station);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Station inspectPlot = null;
|
||||
if (availableStations.size() == 1) {
|
||||
inspectPlot = availableStations.get(0);
|
||||
} else if (availableStations.size() > 1) {
|
||||
int index = findClosestPlot(latlon, availableStations);
|
||||
|
||||
if (index != -1) {
|
||||
inspectPlot = availableStations.get(index);
|
||||
}
|
||||
}
|
||||
|
||||
if (inspectPlot != null) {
|
||||
message = inspectPlot.rawMessage;
|
||||
if (message == null) {
|
||||
message = "Generating...";
|
||||
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>(1);
|
||||
list.add(inspectPlot.info);
|
||||
Params params = Params.PLOT_AND_SAMPLE;
|
||||
if (inspectPlot.info[0].pdv != null) {
|
||||
params = Params.SAMPLE_ONLY;
|
||||
}
|
||||
GetDataTask task = new GetDataTask(list, params);
|
||||
generator.enqueueDataRetrieval(task);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
private double distanceBetween(Coordinate c1, Coordinate c2) {
|
||||
|
||||
double xComponent = (c1.x - c2.x) * (c1.x - c2.x);
|
||||
double yComponent = (c1.y - c2.y) * (c1.y - c2.y);
|
||||
double rval = Math.sqrt(xComponent + yComponent);
|
||||
return rval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type.equals(ChangeType.DATA_UPDATE)) {
|
||||
try {
|
||||
updateRecords((PlotInfo[]) object);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error updating plot resource", e);
|
||||
}
|
||||
|
||||
} else if (type.equals(ChangeType.CAPABILITY)) {
|
||||
if (object instanceof ColorableCapability) {
|
||||
if (generator != null) {
|
||||
generator.setPlotModelColor(((ColorableCapability) object)
|
||||
.getColor());
|
||||
this.imageColor = ((ColorableCapability) object).getColor();
|
||||
}
|
||||
} else if (object instanceof DensityCapability) {
|
||||
if (progressiveDisclosure != null) {
|
||||
progressiveDisclosure.setDensity(getCapability(
|
||||
DensityCapability.class).getDensity());
|
||||
issueRefresh();
|
||||
}
|
||||
} else if (object instanceof MagnificationCapability) {
|
||||
if (generator != null) {
|
||||
this.plotWidth = generator.getOriginalPlotModelWidth();
|
||||
this.plotWidth *= getCapability(
|
||||
MagnificationCapability.class).getMagnification();
|
||||
generator.setPlotModelSize(Math.round(plotWidth));
|
||||
|
||||
}
|
||||
if (progressiveDisclosure != null) {
|
||||
progressiveDisclosure.setMagnification(getCapability(
|
||||
MagnificationCapability.class).getMagnification());
|
||||
progressiveDisclosure.setPlotWidth(plotWidth);
|
||||
}
|
||||
clearImages();
|
||||
} else if (object instanceof OutlineCapability) {
|
||||
if (generator != null) {
|
||||
OutlineCapability cap = (OutlineCapability) object;
|
||||
generator.setPlotModelLineStyle(cap.getLineStyle());
|
||||
generator.setPlotModelLineWidth(cap.getOutlineWidth());
|
||||
clearImages();
|
||||
}
|
||||
}
|
||||
}
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the closest available plot in the same area as the
|
||||
* sampling position.
|
||||
*
|
||||
* @param latlon
|
||||
* The coordinate of the sampling position.
|
||||
* @param availableStations
|
||||
* List of available plots in the same area as latlon.
|
||||
* @return The index of the plot closest to latlon.
|
||||
*/
|
||||
private int findClosestPlot(Coordinate latlon,
|
||||
List<Station> availableStations) {
|
||||
double x1 = latlon.x;
|
||||
double y1 = latlon.y;
|
||||
double minDistance = MAX_SAMPLE_DISANCE;
|
||||
int minIndex = -1;
|
||||
|
||||
for (int i = 0; i < availableStations.size(); i++) {
|
||||
PlotInfo info = availableStations.get(i).info[0];
|
||||
double x2 = info.longitude;
|
||||
double y2 = info.latitude;
|
||||
double d = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
|
||||
|
||||
if (d < minDistance) {
|
||||
minDistance = d;
|
||||
minIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
return minIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearImages() {
|
||||
for (Entry<DataTime, FrameInformation> entry : this.frameMap.entrySet()) {
|
||||
FrameInformation frameInfo = entry.getValue();
|
||||
for (Station station : frameInfo.stationMap.values()) {
|
||||
if (station.plotImage != null) {
|
||||
station.plotImage.getImage().dispose();
|
||||
station.plotImage = null;
|
||||
|
||||
if (station.info != null) {
|
||||
for (PlotInfo info : station.info) {
|
||||
info.plotQueued = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modelGenerated(PlotInfo[] key, IImage image) {
|
||||
DataTime normTime = getNormalizedTime(key[0].dataTime);
|
||||
FrameInformation frameInfo = this.frameMap.get(normTime);
|
||||
if (frameInfo != null) {
|
||||
Station s = frameInfo.stationMap.get(key[0].stationId);
|
||||
if (s != null) {
|
||||
if (image != null) {
|
||||
ISingleColorImage si = (ISingleColorImage) image;
|
||||
s.plotImage = new PointImage(si, s.pixelLocation);
|
||||
s.plotImage.setSiteId(s.info[0].stationId);
|
||||
si.setColor(imageColor);
|
||||
} else {
|
||||
frameInfo.stationMap.remove(key[0].stationId);
|
||||
progressiveDisclosure.update(frameInfo.stationMap.values(),
|
||||
normTime);
|
||||
}
|
||||
issueRefresh();
|
||||
} else if (image != null) {
|
||||
image.dispose();
|
||||
}
|
||||
} else if (image != null) {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(DataTime dataTime) {
|
||||
super.remove(dataTime);
|
||||
FrameInformation frameInfo = this.frameMap.remove(dataTime);
|
||||
if (frameInfo != null) {
|
||||
for (Station s : frameInfo.stationMap.values()) {
|
||||
if ((s != null) && (s.plotImage != null)) {
|
||||
s.plotImage.getImage().dispose();
|
||||
s.plotImage = null;
|
||||
}
|
||||
}
|
||||
frameInfo.stationMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem crs) throws VizException {
|
||||
clearImages();
|
||||
frameRetrievalPool.cancel();
|
||||
frameRetrievalPool = new JobPool("Retrieving plot frame", 8, true);
|
||||
frameMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void disclosureComplete(DataTime time,
|
||||
List<Station> disclosed) {
|
||||
FrameInformation frame = frameMap.get(time);
|
||||
if (frame != null) {
|
||||
frame.lastComputed = disclosed;
|
||||
issueRefresh();
|
||||
Map<String, Station> stationMap = frame.stationMap;
|
||||
List<PlotInfo[]> toQueue = new ArrayList<PlotInfo[]>(200);
|
||||
for (Station station : disclosed) {
|
||||
if ((station.plotImage == null)
|
||||
&& stationMap.containsKey(station.info[0].stationId)) {
|
||||
toQueue.add(station.info);
|
||||
}
|
||||
}
|
||||
if (toQueue.size() > 0) {
|
||||
GetDataTask task = new GetDataTask(toQueue, Params.PLOT_ONLY);
|
||||
generator.enqueueDataRetrieval(task);
|
||||
}
|
||||
} else {
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageGenerated(PlotInfo[] key, String message) {
|
||||
// Key will be the same PlotInfo[] provided to the generator(which will
|
||||
// be all the PlotInfo[] from a single station) and message will be the
|
||||
// sample text.
|
||||
DataTime normTime = getNormalizedTime(key[0].dataTime);
|
||||
FrameInformation frameInfo = this.frameMap.get(normTime);
|
||||
if (frameInfo != null) {
|
||||
Station s = frameInfo.stationMap.get(key[0].stationId);
|
||||
if (s != null) {
|
||||
s.rawMessage = message;
|
||||
issueRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -59,7 +59,7 @@ import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever;
|
|||
* Aug 09, 2013 2033 mschenke Switched File.separator to
|
||||
* IPathManager.SEPARATOR
|
||||
* Sep 05, 2013 2316 bsteffen Unify pirep and ncpirep.
|
||||
*
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -74,13 +74,6 @@ public class PlotResourceData extends AbstractRequestableResourceData {
|
|||
|
||||
public static class PluginPlotProperties {
|
||||
|
||||
/**
|
||||
* Plugins that use the point data api will be instantiated using
|
||||
* PlotResource2, otherwise PlotResource will be used which requires
|
||||
* that the PDO of the plugin implement IDecoderGettable
|
||||
*/
|
||||
public final boolean usesPointDataApi;
|
||||
|
||||
/**
|
||||
* When this is true all plots will be correlated based on the
|
||||
* stationId, otherwise each dataURI is mapped to a specific set of
|
||||
|
@ -88,19 +81,16 @@ public class PlotResourceData extends AbstractRequestableResourceData {
|
|||
*/
|
||||
public final boolean hasDistinctStationId;
|
||||
|
||||
public PluginPlotProperties(boolean usesPointDataApi,
|
||||
boolean hasDistinctStationId) {
|
||||
this.usesPointDataApi = usesPointDataApi;
|
||||
public PluginPlotProperties(boolean hasDistinctStationId) {
|
||||
this.hasDistinctStationId = hasDistinctStationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the goal for all plugins, they should use the new api and
|
||||
* they should have distinct stationIds.
|
||||
* This is the goal for all plugins, they should have distinct
|
||||
* stationIds.
|
||||
*/
|
||||
public PluginPlotProperties() {
|
||||
this.usesPointDataApi = true;
|
||||
this.hasDistinctStationId = true;
|
||||
this(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -147,24 +137,20 @@ public class PlotResourceData extends AbstractRequestableResourceData {
|
|||
private static final Map<String, PluginPlotProperties> pluginProps = new HashMap<String, PluginPlotProperties>();
|
||||
|
||||
static {
|
||||
/*
|
||||
* These use the original PlotResource, whoever can convert these gets
|
||||
* to delete thousands of lines of code, it will be amazing.
|
||||
*/
|
||||
pluginProps.put("acars", new PluginPlotProperties(false, false));
|
||||
|
||||
/*
|
||||
* These have a dependency on dataURI because they don't set stationId,
|
||||
* In the future if stationId can be set to anything that is even a
|
||||
* little unique we can get rid of this
|
||||
*/
|
||||
pluginProps.put("bufrquikscat", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("radar", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("lsr", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("tcg", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("svrwx", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("ldadhydro", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("textPoints", new PluginPlotProperties(true, false));
|
||||
pluginProps.put("bufrquikscat", new PluginPlotProperties(false));
|
||||
pluginProps.put("radar", new PluginPlotProperties(false));
|
||||
pluginProps.put("lsr", new PluginPlotProperties(false));
|
||||
pluginProps.put("tcg", new PluginPlotProperties(false));
|
||||
pluginProps.put("svrwx", new PluginPlotProperties(false));
|
||||
pluginProps.put("ldadhydro", new PluginPlotProperties(false));
|
||||
pluginProps.put("textPoints", new PluginPlotProperties(false));
|
||||
pluginProps.put("acars", new PluginPlotProperties(false));
|
||||
|
||||
/*
|
||||
* The good ones, these don't even need to be here because this is the
|
||||
* default behavior, but for now they are included so we have a
|
||||
|
@ -215,11 +201,6 @@ public class PlotResourceData extends AbstractRequestableResourceData {
|
|||
@Override
|
||||
protected AbstractVizResource<?, ?> constructResource(
|
||||
LoadProperties loadProperties, PluginDataObject[] objects) {
|
||||
|
||||
if (getPluginProperties().usesPointDataApi) {
|
||||
return new PlotResource2(this, loadProperties);
|
||||
}
|
||||
|
||||
return new PlotResource(this, loadProperties);
|
||||
}
|
||||
|
||||
|
@ -384,7 +365,6 @@ public class PlotResourceData extends AbstractRequestableResourceData {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
// TODO Auto-generated method stub
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource2.Station;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource.Station;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -26,11 +26,12 @@ import com.raytheon.viz.pointdata.rsc.PlotResource2.Station;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 12, 2011 bsteffen Initial creation
|
||||
* Jul 01, 2011 njensen Added queuing
|
||||
* Dec 02, 2013 2573 njensen Smarter queuing
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 12, 2011 bsteffen Initial creation
|
||||
* Jul 01, 2011 njensen Added queuing
|
||||
* Dec 02, 2013 2573 njensen Smarter queuing
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -9,20 +9,23 @@ import org.opengis.referencing.operation.MathTransform;
|
|||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource2.Station;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource.Station;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Add Description
|
||||
* Progressive disclosure for plots with no predetermined ordering. Points to
|
||||
* disclose are chosen arbitrarily.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 12, 2011 bsteffen Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 12, 2011 bsteffen Initial creation
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -8,20 +8,22 @@ import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
|||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.viz.pointdata.StaticPlotInfoPV;
|
||||
import com.raytheon.viz.pointdata.StaticPlotInfoPV.SPIEntry;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource2.Station;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource.Station;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Add Description
|
||||
* Progressive disclosure algorithm that uses information form an spi file to
|
||||
* determine which stations to display.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 12, 2011 bsteffen Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 12, 2011 bsteffen Initial creation
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -28,12 +28,12 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.viz.pointdata.PlotInfo;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource2;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResource;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
||||
/**
|
||||
* Base class for all objects which can retrieve {@link PlotInfo} objects for
|
||||
* use in {@link PlotResource2}. For most applications the
|
||||
* use in {@link PlotResource}. For most applications the
|
||||
* {@link PointDataPlotInfoRetriever} should be used however other instances can
|
||||
* provide more advanced features such as incremental loading or retrieving
|
||||
* additional data.
|
||||
|
@ -45,6 +45,7 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Oct 23, 2013 2491 bsteffen Remove ISerializableObject
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -28,9 +28,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -40,7 +40,7 @@ import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
|||
import com.raytheon.viz.pointdata.IPlotModelGeneratorCaller;
|
||||
import com.raytheon.viz.pointdata.PlotData;
|
||||
import com.raytheon.viz.pointdata.PlotInfo;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2.PlotModelElement;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory.PlotModelElement;
|
||||
import com.raytheon.viz.pointdata.PointDataRequest;
|
||||
import com.raytheon.viz.pointdata.rsc.PlotResourceData;
|
||||
|
||||
|
@ -52,11 +52,12 @@ import com.raytheon.viz.pointdata.rsc.PlotResourceData;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 22, 2011 njensen Initial creation
|
||||
* May 14, 2013 1869 bsteffen Get plots working without dataURI
|
||||
* Mar 21, 2014 2868 njensen Major refactor
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Apr 22, 2011 njensen Initial creation
|
||||
* May 14, 2013 1869 bsteffen Get plots working without dataURI
|
||||
* Mar 21, 2014 2868 njensen Major refactor
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.pointdata.IPlotModelGeneratorCaller;
|
||||
import com.raytheon.viz.pointdata.PlotInfo;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory;
|
||||
|
||||
/**
|
||||
* Job that generates plot images using a PlotModelFactory2.
|
||||
|
@ -44,10 +44,12 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 22, 2011 njensen Initial creation
|
||||
* Mar 21, 2014 2868 njensen Major refactor
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Apr 22, 2011 njensen Initial creation
|
||||
* Mar 21, 2014 2868 njensen Major refactor
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,7 +59,7 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
|
|||
|
||||
public class PlotModelGeneratorJob extends AbstractPlotCreationJob {
|
||||
|
||||
private PlotModelFactory2 plotCreator;
|
||||
private PlotModelFactory plotCreator;
|
||||
|
||||
private IGraphicsTarget target;
|
||||
|
||||
|
@ -65,7 +67,7 @@ public class PlotModelGeneratorJob extends AbstractPlotCreationJob {
|
|||
private Map<BufferedImage, IImage> imageCache = new LRUMap(1000);
|
||||
|
||||
protected PlotModelGeneratorJob(PlotThreadOverseer parent,
|
||||
IPlotModelGeneratorCaller caller, PlotModelFactory2 plotCreator,
|
||||
IPlotModelGeneratorCaller caller, PlotModelFactory plotCreator,
|
||||
IGraphicsTarget target) {
|
||||
super("Creating plots", parent, caller);
|
||||
this.plotCreator = plotCreator;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.core.runtime.Status;
|
|||
|
||||
import com.raytheon.viz.pointdata.IPlotModelGeneratorCaller;
|
||||
import com.raytheon.viz.pointdata.PlotInfo;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory;
|
||||
|
||||
/**
|
||||
* Job that uses the provided plot model factory to generate a sampling message
|
||||
|
@ -35,11 +35,12 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 13, 2011 njensen Initial creation
|
||||
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||
* Mar 21, 2014 2868 njensen Major refactor
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jul 13, 2011 njensen Initial creation
|
||||
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||
* Mar 21, 2014 2868 njensen Major refactor
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -49,10 +50,10 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
|
|||
|
||||
public class PlotSampleGeneratorJob extends AbstractPlotCreationJob {
|
||||
|
||||
private PlotModelFactory2 plotFactory;
|
||||
private PlotModelFactory plotFactory;
|
||||
|
||||
public PlotSampleGeneratorJob(PlotThreadOverseer parent,
|
||||
IPlotModelGeneratorCaller caller, PlotModelFactory2 factory) {
|
||||
IPlotModelGeneratorCaller caller, PlotModelFactory factory) {
|
||||
super("Generating samples", parent, caller);
|
||||
this.plotFactory = factory;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.viz.pointdata.IPlotModelGeneratorCaller;
|
||||
import com.raytheon.viz.pointdata.PlotInfo;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2.PlotModelElement;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory.PlotModelElement;
|
||||
|
||||
/**
|
||||
* Oversees a variety of threads used to concurrently and quickly get plots on
|
||||
|
@ -50,9 +50,10 @@ import com.raytheon.viz.pointdata.PlotModelFactory2.PlotModelElement;
|
|||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 21, 2014 2868 njensen Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Mar 21, 2014 2868 njensen Initial creation
|
||||
* Jun 06, 2014 2061 bsteffen Remove old PlotResource
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -78,7 +79,7 @@ public class PlotThreadOverseer {
|
|||
protected List<PlotModelGeneratorJob> imageCreationJobList = new ArrayList<PlotModelGeneratorJob>(
|
||||
IMAGE_THREADS);
|
||||
|
||||
protected List<PlotModelFactory2> plotCreatorList = new ArrayList<PlotModelFactory2>(
|
||||
protected List<PlotModelFactory> plotCreatorList = new ArrayList<PlotModelFactory>(
|
||||
IMAGE_THREADS);
|
||||
|
||||
protected ConcurrentLinkedQueue<PlotInfo[]> sampleTextQueue = new ConcurrentLinkedQueue<PlotInfo[]>();
|
||||
|
@ -113,7 +114,7 @@ public class PlotThreadOverseer {
|
|||
List<PlotModelElement> plotFields = null;
|
||||
List<PlotModelElement> sampleFields = null;
|
||||
for (int i = 0; i < IMAGE_THREADS; i++) {
|
||||
PlotModelFactory2 plotModelFactory = new PlotModelFactory2(
|
||||
PlotModelFactory plotModelFactory = new PlotModelFactory(
|
||||
mapDescriptor, plotModelFile);
|
||||
plotCreatorList.add(plotModelFactory);
|
||||
imageCreationJobList.add(new PlotModelGeneratorJob(this, caller,
|
||||
|
@ -147,7 +148,7 @@ public class PlotThreadOverseer {
|
|||
* TODO do we care?
|
||||
*/
|
||||
for (int i = 0; i < SAMPLE_THREADS; i++) {
|
||||
PlotModelFactory2 plotModelFactory = new PlotModelFactory2(
|
||||
PlotModelFactory plotModelFactory = new PlotModelFactory(
|
||||
mapDescriptor, plotModelFile);
|
||||
sampleTextJobList.add(new PlotSampleGeneratorJob(this, caller,
|
||||
plotModelFactory));
|
||||
|
@ -242,14 +243,14 @@ public class PlotThreadOverseer {
|
|||
}
|
||||
|
||||
public void setPlotModelColor(RGB color) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setColor(color);
|
||||
}
|
||||
// don't clear the image cache, it's magic
|
||||
}
|
||||
|
||||
public void setPlotModelLineStyle(LineStyle lineStyle) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setLineStyle(lineStyle);
|
||||
}
|
||||
for (PlotModelGeneratorJob job : imageCreationJobList) {
|
||||
|
@ -258,7 +259,7 @@ public class PlotThreadOverseer {
|
|||
}
|
||||
|
||||
public void setPlotModelLineWidth(int outlineWidth) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setLineWidth(outlineWidth);
|
||||
}
|
||||
for (PlotModelGeneratorJob job : imageCreationJobList) {
|
||||
|
@ -267,19 +268,19 @@ public class PlotThreadOverseer {
|
|||
}
|
||||
|
||||
public void setPlotMissingData(boolean plotMissingData) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setPlotMissingData(plotMissingData);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLowerLimit(double lowerLimit) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setLowerLimit(lowerLimit);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUpperLimit(double upperLimit) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setUpperLimit(upperLimit);
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +290,7 @@ public class PlotThreadOverseer {
|
|||
}
|
||||
|
||||
public void setPlotModelSize(long round) {
|
||||
for (PlotModelFactory2 pmf : plotCreatorList) {
|
||||
for (PlotModelFactory pmf : plotCreatorList) {
|
||||
pmf.setPlotDimensions(round, round);
|
||||
}
|
||||
for (PlotModelGeneratorJob job : imageCreationJobList) {
|
||||
|
|
|
@ -70,7 +70,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
|||
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.viz.pointdata.PlotData;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory2;
|
||||
import com.raytheon.viz.pointdata.PlotModelFactory;
|
||||
import com.raytheon.viz.redbook.Activator;
|
||||
import com.raytheon.viz.redbook.RedbookWMOMap;
|
||||
import com.raytheon.viz.redbookua.RedbookUpperAirDecoder;
|
||||
|
@ -108,7 +108,7 @@ public class RedbookUpperAirResource extends
|
|||
|
||||
private String humanReadableName;
|
||||
|
||||
private PlotModelFactory2 plotModelFactory;
|
||||
private PlotModelFactory plotModelFactory;
|
||||
|
||||
private IGraphicsTarget graphicsTarget;
|
||||
|
||||
|
@ -244,9 +244,9 @@ public class RedbookUpperAirResource extends
|
|||
this.graphicsTarget = target;
|
||||
}
|
||||
|
||||
protected PlotModelFactory2 getPlotModelFactory() {
|
||||
protected PlotModelFactory getPlotModelFactory() {
|
||||
if (plotModelFactory == null) {
|
||||
plotModelFactory = new PlotModelFactory2(getDescriptor(),
|
||||
plotModelFactory = new PlotModelFactory(getDescriptor(),
|
||||
"redbookuaDesign.svg");
|
||||
plotModelFactory.setColor(getCapability(ColorableCapability.class)
|
||||
.getColor());
|
||||
|
@ -378,7 +378,7 @@ public class RedbookUpperAirResource extends
|
|||
if (pointData == null)
|
||||
retrieveAndDecodeData();
|
||||
|
||||
PlotModelFactory2 pmf;
|
||||
PlotModelFactory pmf;
|
||||
|
||||
synchronized (job) {
|
||||
plotSettingsChanged = false;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<parameter name="latitude" queryName="location.latitude" type="FLOAT" unit="°" />
|
||||
<parameter name="longitude" queryName="location.longitude" type="FLOAT" unit="°" />
|
||||
<parameter name="stationId" queryName="location.stationId" type="STRING" />
|
||||
<parameter name="flightLevel" queryName="location.flightLevel" type="INT" />
|
||||
<parameter name="flightLevel" queryName="location.flightLevel" type="INT" unit="m" />
|
||||
<parameter name="timeObs" queryName="timeObs" numDims="1" type="LONG" unit="ms" />
|
||||
<parameter name="wmoHeader" queryName="wmoHeader" type="STRING" />
|
||||
<parameter name="tailNumber" queryName="tailNumber" type="STRING" />
|
||||
|
|
Loading…
Add table
Reference in a new issue