Issue #1869 Fix plot sampling.
Change-Id: I4c2087057a939d3a148f1635b999fe53b735258b Former-commit-id: 42b779a7695635414764b3c491ba24c0d70983b5
This commit is contained in:
parent
744eb64856
commit
8c14a34f46
5 changed files with 54 additions and 27 deletions
|
@ -29,7 +29,8 @@ import com.raytheon.uf.viz.core.drawables.IImage;
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Sep 16, 2009 mschenke Initial creation
|
* Sep 16, 2009 mschenke Initial creation
|
||||||
|
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -42,5 +43,5 @@ public interface IPlotModelGeneratorCaller {
|
||||||
|
|
||||||
public void clearImages();
|
public void clearImages();
|
||||||
|
|
||||||
public void messageGenerated(String dataURI, String message);
|
public void messageGenerated(PlotInfo[] key, String message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
@ -94,6 +93,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* May 14, 2013 1869 bsteffen Get plots working without dataURI
|
* May 14, 2013 1869 bsteffen Get plots working without dataURI
|
||||||
* Jun 06, 2013 2072 bsteffen Fix concurrency problems when init is
|
* Jun 06, 2013 2072 bsteffen Fix concurrency problems when init is
|
||||||
* called before time matching is done.
|
* called before time matching is done.
|
||||||
|
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -125,8 +125,6 @@ public class PlotResource2 extends
|
||||||
private JobPool frameRetrievalPool = new JobPool("Retrieving plot frame",
|
private JobPool frameRetrievalPool = new JobPool("Retrieving plot frame",
|
||||||
8, true);
|
8, true);
|
||||||
|
|
||||||
private TreeMap<String, String> rawMessageMap = new TreeMap<String, String>();
|
|
||||||
|
|
||||||
private class FrameRetriever implements Runnable {
|
private class FrameRetriever implements Runnable {
|
||||||
|
|
||||||
private DataTime dataTime;
|
private DataTime dataTime;
|
||||||
|
@ -144,13 +142,36 @@ public class PlotResource2 extends
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A station represents all the data for a single location(station) for a
|
||||||
|
* single frame
|
||||||
|
*
|
||||||
|
*/
|
||||||
public static class Station {
|
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;
|
public PlotInfo[] info;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The image to display for this plot
|
||||||
|
*/
|
||||||
public PointImage plotImage;
|
public PointImage plotImage;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sampling text for this plot
|
||||||
|
*/
|
||||||
|
public String rawMessage;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Information used be the progressive disclosure algorithm
|
||||||
|
*/
|
||||||
public Object progDiscInfo;
|
public Object progDiscInfo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Location of the plot in descriptor grid space.
|
||||||
|
*/
|
||||||
public Coordinate pixelLocation;
|
public Coordinate pixelLocation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -504,32 +525,25 @@ public class PlotResource2 extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotInfo[] inspectPlot = null;
|
Station inspectPlot = null;
|
||||||
if (availableStations.size() == 1) {
|
if (availableStations.size() == 1) {
|
||||||
inspectPlot = availableStations.get(0).info;
|
inspectPlot = availableStations.get(0);
|
||||||
} else if (availableStations.size() > 1) {
|
} else if (availableStations.size() > 1) {
|
||||||
int index = findClosestPlot(latlon, availableStations);
|
int index = findClosestPlot(latlon, availableStations);
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
inspectPlot = availableStations.get(index).info;
|
inspectPlot = availableStations.get(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inspectPlot != null) {
|
if (inspectPlot != null) {
|
||||||
String dataURI = inspectPlot[0].dataURI;
|
message = inspectPlot.rawMessage;
|
||||||
if (rawMessageMap.containsKey(dataURI)) {
|
if (message == null) {
|
||||||
if (rawMessageMap.get(dataURI) != null) {
|
|
||||||
message = rawMessageMap.get(dataURI);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
message = "Generating...";
|
message = "Generating...";
|
||||||
synchronized (rawMessageMap) {
|
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>(1);
|
||||||
rawMessageMap.put(dataURI, message);
|
list.add(inspectPlot.info);
|
||||||
}
|
|
||||||
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>();
|
|
||||||
list.add(inspectPlot);
|
|
||||||
Params params = Params.PLOT_AND_SAMPLE;
|
Params params = Params.PLOT_AND_SAMPLE;
|
||||||
if (inspectPlot[0].pdv != null) {
|
if (inspectPlot.info[0].pdv != null) {
|
||||||
params = Params.SAMPLE_ONLY;
|
params = Params.SAMPLE_ONLY;
|
||||||
}
|
}
|
||||||
GetDataTask task = new GetDataTask(list, params);
|
GetDataTask task = new GetDataTask(list, params);
|
||||||
|
@ -725,11 +739,20 @@ public class PlotResource2 extends
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageGenerated(String dataURI, String message) {
|
public void messageGenerated(PlotInfo[] key, String message) {
|
||||||
synchronized (rawMessageMap) {
|
// Key will be the same PlotInfo[] provided to the generator(which will
|
||||||
rawMessageMap.put(dataURI, message);
|
// 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
issueRefresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jul 13, 2011 njensen Initial creation
|
* Jul 13, 2011 njensen Initial creation
|
||||||
|
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -82,7 +83,7 @@ public class PlotSampleGeneratorJob extends Job {
|
||||||
String message = plotFactory.getStationMessage(infos[0].pdv,
|
String message = plotFactory.getStationMessage(infos[0].pdv,
|
||||||
infos[0].dataURI);
|
infos[0].dataURI);
|
||||||
|
|
||||||
caller.messageGenerated(infos[0].dataURI, message);
|
caller.messageGenerated(infos, message);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler.error("Error creating plot", e);
|
statusHandler.error("Error creating plot", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ import static java.lang.System.out;
|
||||||
* (this fixes the issue of slow performance when zooming all the way in, when Data Area is set)
|
* (this fixes the issue of slow performance when zooming all the way in, when Data Area is set)
|
||||||
* 10/18/2012 896 sgurung Refactored PlotResource2 to use new generator class: NcPlotDataThreadPool. Added FrameLoaderJob to populate all frames.
|
* 10/18/2012 896 sgurung Refactored PlotResource2 to use new generator class: NcPlotDataThreadPool. Added FrameLoaderJob to populate all frames.
|
||||||
* Added code to plot stations within 25% of the area outside of the current display area.
|
* Added code to plot stations within 25% of the area outside of the current display area.
|
||||||
|
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author brockwoo
|
* @author brockwoo
|
||||||
|
@ -1232,7 +1233,7 @@ public class NcPlotResource2 extends AbstractNatlCntrsResource<PlotResourceData,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageGenerated(String dataURI, String message) {
|
public void messageGenerated(PlotInfo[] key, String message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a string used as the key for the StationMap
|
// generate a string used as the key for the StationMap
|
||||||
|
|
|
@ -117,6 +117,7 @@ import static java.lang.System.out;
|
||||||
* 08/22/2012 #809 sgurung For bgGenerator thread, add stations to queue only when zoomLevel > 0.10
|
* 08/22/2012 #809 sgurung For bgGenerator thread, add stations to queue only when zoomLevel > 0.10
|
||||||
* (this fixes the issue of slow performance when zooming all the way in, when Data Area is set)
|
* (this fixes the issue of slow performance when zooming all the way in, when Data Area is set)
|
||||||
* 11/04/2012 #944 ghull add query for Fcst Plot resources
|
* 11/04/2012 #944 ghull add query for Fcst Plot resources
|
||||||
|
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author brockwoo
|
* @author brockwoo
|
||||||
|
@ -1084,7 +1085,7 @@ public class PlotResource2 extends AbstractNatlCntrsResource<PlotResourceData, N
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageGenerated(String dataURI, String message) {
|
public void messageGenerated(PlotInfo[] key, String message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a string used as the key for the StationMap
|
// generate a string used as the key for the StationMap
|
||||||
|
|
Loading…
Add table
Reference in a new issue