Merge "Issue #704 add INCOMPLETE PaintStatus to indicate a frame will require more painting later" into development
Former-commit-id:121d68b8c4
[formerly121d68b8c4
[formerly 5e8d1cbc132dbd69b86342234631f3d11e3bdb3d]] Former-commit-id:133cd9994e
Former-commit-id:f4db55cd46
This commit is contained in:
commit
082fbf8f1a
12 changed files with 116 additions and 10 deletions
|
@ -26,6 +26,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
|||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintStatus;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
|
@ -164,7 +165,10 @@ public class MapResourceGroup extends
|
|||
paintProps.setAlpha(resource.getCapability(
|
||||
ImagingCapability.class).getAlpha());
|
||||
}
|
||||
resource.paint(target, newProps);
|
||||
PaintStatus paintStatus = resource.paint(target, newProps);
|
||||
if (paintStatus != PaintStatus.PAINTED) {
|
||||
updatePaintStatus(paintStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,5 +37,31 @@ package com.raytheon.uf.viz.core.drawables;
|
|||
*/
|
||||
|
||||
public enum PaintStatus {
|
||||
PAINTED, REPAINT, ERROR;
|
||||
/**
|
||||
* indicates that a resource or renderable has successfully painted all
|
||||
* available data.
|
||||
*/
|
||||
PAINTED,
|
||||
|
||||
/**
|
||||
* indicates that a resource is currently in the act of painting
|
||||
*/
|
||||
PAINTING,
|
||||
|
||||
/**
|
||||
* indicates that less than all the data has painted and more data will be
|
||||
* arriving asynchronously, when that data arrives the PaintStatus will
|
||||
* become REPAINT.
|
||||
*/
|
||||
INCOMPLETE,
|
||||
|
||||
/**
|
||||
* indicates a resource has new data that needs to be painted
|
||||
*/
|
||||
REPAINT,
|
||||
|
||||
/**
|
||||
* an uncaught error occured during the last paint event.
|
||||
*/
|
||||
ERROR;
|
||||
}
|
||||
|
|
|
@ -125,6 +125,36 @@ public class JobPool {
|
|||
return workQueue.remove(runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* A JobPool is considered active if any of the jobs it contains are running
|
||||
* or waiting to be run. When all scheduled work is run
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isActive() {
|
||||
if (!workQueue.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
for (Job job : jobList) {
|
||||
int state = job.getState();
|
||||
if (state == Job.RUNNING || state == Job.WAITING) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the number of tasks(Runnables) that are waiting to be run. This does
|
||||
* not include tasks that are currently running so even if there are no
|
||||
* waiting tasks the pool may still be active.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getWorkRemaining() {
|
||||
return workQueue.size();
|
||||
}
|
||||
|
||||
protected class PooledJob extends Job {
|
||||
|
||||
public PooledJob(String name) {
|
||||
|
|
|
@ -337,6 +337,7 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
for (IInitListener listener : initListeners) {
|
||||
listener.inited(this);
|
||||
}
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,7 +442,7 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
initJob = new InitJob(target);
|
||||
initJob.schedule();
|
||||
}
|
||||
issueRefresh();
|
||||
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||
break;
|
||||
}
|
||||
case LOADING: {
|
||||
|
@ -453,19 +454,21 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
initJob = null;
|
||||
throw e;
|
||||
}
|
||||
issueRefresh();
|
||||
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||
break;
|
||||
}
|
||||
case INITIALIZED: {
|
||||
// We have initialized successfully, now time to paint
|
||||
try {
|
||||
paintStatus = PaintStatus.PAINTED;
|
||||
updatePaintStatus(PaintStatus.PAINTING);
|
||||
paintInternal(target, paintProps);
|
||||
} catch (VizException e) {
|
||||
paintStatus = PaintStatus.ERROR;
|
||||
updatePaintStatus(PaintStatus.ERROR);
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (paintStatus == PaintStatus.PAINTING) {
|
||||
updatePaintStatus(PaintStatus.PAINTED);
|
||||
}
|
||||
for (IPaintListener listener : paintListeners) {
|
||||
listener.painted(this);
|
||||
}
|
||||
|
@ -712,6 +715,10 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
}
|
||||
}
|
||||
|
||||
public PaintStatus getPaintStatus() {
|
||||
return paintStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recycle a resource to be used again, will call dispose on the resource if
|
||||
* it is in the INITIALIZED state, otherwise sets status to NEW which will
|
||||
|
|
|
@ -69,6 +69,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
|
||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintStatus;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
|
@ -934,6 +935,8 @@ public abstract class AbstractMapVectorResource extends
|
|||
if (combineOperation != CombineOperation.NONE) {
|
||||
contourGroup.paint(target, paintProps);
|
||||
}
|
||||
} else {
|
||||
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||
}
|
||||
} else {
|
||||
AbstractGriddedDisplay<?> display = this.gdManagerJob
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
|
|||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintStatus;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
|
@ -413,6 +414,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
|
||||
GeneralGridData data = requestData(time);
|
||||
if (data == null) {
|
||||
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -421,6 +423,8 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
if (renderable != null) {
|
||||
renderables.put(time, renderable);
|
||||
renderable.paint(target, paintProps);
|
||||
} else {
|
||||
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,15 @@ public class PlotDataThreadPool {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
for (PlotModelDataRequestJob job : jobList) {
|
||||
if (!job.isDone()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
stationQueue.clear();
|
||||
for (PlotModelDataRequestJob job : jobList) {
|
||||
|
|
|
@ -186,8 +186,8 @@ public class PlotModelDataRequestJob extends Job {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!params.contains("dataURI")){
|
||||
|
||||
if (!params.contains("dataURI")) {
|
||||
params.add("dataURI");
|
||||
}
|
||||
|
||||
|
@ -334,6 +334,11 @@ public class PlotModelDataRequestJob extends Job {
|
|||
this.plotCreator.setPlotMissingData(b);
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return getState() != Job.RUNNING && getState() != Job.WAITING
|
||||
&& generatorJob.isDone();
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
this.cancel();
|
||||
this.generatorJob.shutdown();
|
||||
|
|
|
@ -145,6 +145,10 @@ public class PlotModelGeneratorJob extends Job {
|
|||
imageCache.clear();
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return getState() != Job.RUNNING && getState() != Job.WAITING;
|
||||
}
|
||||
|
||||
protected void shutdown() {
|
||||
cancel();
|
||||
taskQueue.clear();
|
||||
|
|
|
@ -48,6 +48,7 @@ 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.PaintStatus;
|
||||
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;
|
||||
|
@ -208,6 +209,11 @@ public class PlotResource2 extends
|
|||
descriptor.getCRS()), descriptor.getCRS());
|
||||
}
|
||||
|
||||
if (!progressiveDisclosure.isDone() || !generator.isDone()
|
||||
|| frameRetrievalPool.isActive()) {
|
||||
updatePaintStatus(PaintStatus.INCOMPLETE);
|
||||
}
|
||||
|
||||
this.updateRecords();
|
||||
|
||||
List<Station> stationList = curFrame.lastComputed;
|
||||
|
|
|
@ -188,6 +188,10 @@ public abstract class AbstractProgDisclosure extends Job {
|
|||
return nextTask.canvasWidth / nextTask.extent.getWidth();
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return getState() != Job.RUNNING && getState() != Job.WAITING;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
this.cancel();
|
||||
nextTask = new Task();
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintStatus;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -190,7 +191,10 @@ public class SatBlendedResource extends
|
|||
paintProps);
|
||||
rscProps.setDataTime(timeForRsc);
|
||||
rscProps.setAlpha(1.0f);
|
||||
rsc.paint(target, rscProps);
|
||||
PaintStatus paintStatus = rsc.paint(target, rscProps);
|
||||
if (paintStatus != PaintStatus.PAINTED) {
|
||||
updatePaintStatus(paintStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue