Merge "Issue #1869 Fix plot sampling. Change-Id: I4c2087057a939d3a148f1635b999fe53b735258b" into omaha_13.5.1

Former-commit-id: e3886246fd [formerly 3a3dc3d208] [formerly e3886246fd [formerly 3a3dc3d208] [formerly 67d052307c [formerly 253e29abe56da5790c3a44ac7039426b068d6f12]]]
Former-commit-id: 67d052307c
Former-commit-id: 1b00dd48ec [formerly 208b01a167]
Former-commit-id: 575405b14e
This commit is contained in:
Richard Peter 2013-06-26 13:25:39 -05:00 committed by Gerrit Code Review
commit 2952f2b56d
5 changed files with 54 additions and 27 deletions

View file

@ -29,7 +29,8 @@ import com.raytheon.uf.viz.core.drawables.IImage;
* SOFTWARE HISTORY
* 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>
*
@ -42,5 +43,5 @@ public interface IPlotModelGeneratorCaller {
public void clearImages();
public void messageGenerated(String dataURI, String message);
public void messageGenerated(PlotInfo[] key, String message);
}

View file

@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
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
* 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.
*
* </pre>
*
@ -125,8 +125,6 @@ public class PlotResource2 extends
private JobPool frameRetrievalPool = new JobPool("Retrieving plot frame",
8, true);
private TreeMap<String, String> rawMessageMap = new TreeMap<String, String>();
private class FrameRetriever implements Runnable {
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 {
/*
* 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;
}
@ -504,32 +525,25 @@ public class PlotResource2 extends
}
}
PlotInfo[] inspectPlot = null;
Station inspectPlot = null;
if (availableStations.size() == 1) {
inspectPlot = availableStations.get(0).info;
inspectPlot = availableStations.get(0);
} else if (availableStations.size() > 1) {
int index = findClosestPlot(latlon, availableStations);
if (index != -1) {
inspectPlot = availableStations.get(index).info;
inspectPlot = availableStations.get(index);
}
}
if (inspectPlot != null) {
String dataURI = inspectPlot[0].dataURI;
if (rawMessageMap.containsKey(dataURI)) {
if (rawMessageMap.get(dataURI) != null) {
message = rawMessageMap.get(dataURI);
}
} else {
message = inspectPlot.rawMessage;
if (message == null) {
message = "Generating...";
synchronized (rawMessageMap) {
rawMessageMap.put(dataURI, message);
}
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>();
list.add(inspectPlot);
List<PlotInfo[]> list = new ArrayList<PlotInfo[]>(1);
list.add(inspectPlot.info);
Params params = Params.PLOT_AND_SAMPLE;
if (inspectPlot[0].pdv != null) {
if (inspectPlot.info[0].pdv != null) {
params = Params.SAMPLE_ONLY;
}
GetDataTask task = new GetDataTask(list, params);
@ -725,11 +739,20 @@ public class PlotResource2 extends
}
@Override
public void messageGenerated(String dataURI, String message) {
synchronized (rawMessageMap) {
rawMessageMap.put(dataURI, message);
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();
}
}
issueRefresh();
}
}

View file

@ -43,6 +43,7 @@ import com.raytheon.viz.pointdata.PlotModelFactory2;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 13, 2011 njensen Initial creation
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
*
* </pre>
*
@ -82,7 +83,7 @@ public class PlotSampleGeneratorJob extends Job {
String message = plotFactory.getStationMessage(infos[0].pdv,
infos[0].dataURI);
caller.messageGenerated(infos[0].dataURI, message);
caller.messageGenerated(infos, message);
} catch (Exception e) {
statusHandler.error("Error creating plot", e);
}

View file

@ -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)
* 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.
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
* </pre>
*
* @author brockwoo
@ -1232,7 +1233,7 @@ public class NcPlotResource2 extends AbstractNatlCntrsResource<PlotResourceData,
}
@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

View file

@ -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
* (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
* Jun 25, 2013 1869 bsteffen Fix plot sampling.
* </pre>
*
* @author brockwoo
@ -1084,7 +1085,7 @@ public class PlotResource2 extends AbstractNatlCntrsResource<PlotResourceData, N
}
@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