diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/AbstractTimeMatcher.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/AbstractTimeMatcher.java index 7e987eff18..f39c47d58b 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/AbstractTimeMatcher.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/AbstractTimeMatcher.java @@ -21,6 +21,10 @@ package com.raytheon.uf.viz.core; import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.IDescriptor; @@ -30,7 +34,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; /** - * TODO Add Description + * Abstract time matching object, by default does nothing * *
* @@ -44,8 +48,8 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; * @author chammack * @version 1.0 */ - -public abstract class AbstractTimeMatcher { +@XmlAccessorType(XmlAccessType.NONE) +public abstract class AbstractTimeMatcher implements ISerializableObject { /** * Trigger the time matcher to update time information on this resource the @@ -77,21 +81,6 @@ public abstract class AbstractTimeMatcher { public abstract void handleRemove(AbstractVizResource, ?> resource, IDescriptor descriptor); - /** - * Change time match basis - * - * @param resource - * @param descriptor - */ - public abstract void changeTimeMatchBasis(AbstractVizResource, ?> resource); - - /** - * Get the time match basis - * - * @return - */ - public abstract AbstractVizResource, ?> getTimeMatchBasis(); - /** * Perform an initial load of PluginDataObjects utilizing the time matcher * diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractDescriptor.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractDescriptor.java index 412d77f7cc..d9dfaff23d 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractDescriptor.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractDescriptor.java @@ -179,28 +179,17 @@ public abstract class AbstractDescriptor extends ResourceGroup implements @Override public void notifyRemove(ResourcePair rp) throws VizException { - AbstractTimeMatcher tm = getTimeMatcher(); - AbstractVizResource, ?> basis = null; - if (tm != null) { - basis = tm.getTimeMatchBasis(); - } - postRemoveListener(rp.getResource()); - AbstractVizResource, ?> newBasis = null; - if (tm != null) { - newBasis = tm.getTimeMatchBasis(); - } - - if (basis != newBasis) { - TimeMatchingJob.scheduleTimeMatch(AbstractDescriptor.this); - if (renderableDisplay != null - && renderableDisplay.getContainer() != null) { - IDisplayPaneContainer container = renderableDisplay.getContainer(); - for (IDisplayPane pane : container.getDisplayPanes()) { - if (pane.getDescriptor() != AbstractDescriptor.this) { - TimeMatchingJob.scheduleTimeMatch(pane.getDescriptor()); - } + TimeMatchingJob.scheduleTimeMatch(AbstractDescriptor.this); + if (renderableDisplay != null + && renderableDisplay.getContainer() != null) { + IDisplayPaneContainer container = renderableDisplay + .getContainer(); + for (IDisplayPane pane : container.getDisplayPanes()) { + if (pane.getDescriptor() != AbstractDescriptor.this) { + TimeMatchingJob.scheduleTimeMatch(pane + .getDescriptor()); } } } @@ -208,7 +197,6 @@ public abstract class AbstractDescriptor extends ResourceGroup implements }); } - protected void postAddListener(ResourcePair rp) { if (rp.getResource() != null && getTimeMatcher() != null) { // We need to run time matching immediately beacuse order @@ -361,14 +349,6 @@ public abstract class AbstractDescriptor extends ResourceGroup implements @Override public void setNumberOfFrames(int frameCount) { timeManager.numberOfFrames = frameCount; - // This will clear out the times for the basis which should redo time - // matching for all resource next time redo is called for this - // descriptor - if (getTimeMatcher() != null - && getTimeMatcher().getTimeMatchBasis() != null) { - getTimeMatcher().redoTimeMatching( - getTimeMatcher().getTimeMatchBasis()); - } } @Override @@ -381,15 +361,6 @@ public abstract class AbstractDescriptor extends ResourceGroup implements restoredTime = frames[frameIndex]; } limitedNumberOfFrames = frameCount; - // This will clear out the times for the basis which should redo - // time - // matching for all resource next time redo is called for this - // descriptor - if (getTimeMatcher() != null - && getTimeMatcher().getTimeMatchBasis() != null) { - getTimeMatcher().redoTimeMatching( - getTimeMatcher().getTimeMatchBasis()); - } return true; } return false; @@ -405,15 +376,6 @@ public abstract class AbstractDescriptor extends ResourceGroup implements restoredTime = frames[frameIndex]; } limitedNumberOfFrames = Integer.MAX_VALUE; - // This will clear out the times for the basis which should redo - // time - // matching for all resource next time redo is called for this - // descriptor - if (getTimeMatcher() != null - && getTimeMatcher().getTimeMatchBasis() != null) { - getTimeMatcher().redoTimeMatching( - getTimeMatcher().getTimeMatchBasis()); - } return true; } limitedNumberOfFrames = Integer.MAX_VALUE; @@ -497,6 +459,18 @@ public abstract class AbstractDescriptor extends ResourceGroup implements this.timeManager.timeMatcher = timeMatcher; } + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.drawables.IDescriptor#redoTimeMatching() + */ + @Override + public void redoTimeMatching() throws VizException { + if (timeManager.timeMatcher != null) { + timeManager.timeMatcher.redoTimeMatching(this); + } + } + @Override public DataTime getTimeForResource(AbstractVizResource, ?> rsc) { FramesInfo currInfo = getFramesInfo(); diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/FrameCoordinator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/FrameCoordinator.java index 571d1dfc26..24db6e6f4e 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/FrameCoordinator.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/FrameCoordinator.java @@ -19,6 +19,9 @@ **/ package com.raytheon.uf.viz.core.drawables; +import java.util.Arrays; +import java.util.Date; + import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; @@ -105,6 +108,36 @@ public class FrameCoordinator implements IFrameCoordinator { } } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.drawables.IFrameCoordinator#changeFrame(java + * .util.Date) + */ + @Override + public void changeFrame(Date frameTime) { + changeFrame(new DataTime(frameTime)); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.drawables.IFrameCoordinator#changeFrame(com. + * raytheon.uf.common.time.DataTime) + */ + @Override + public void changeFrame(DataTime frameTime) { + // Default behavior for now + FramesInfo info = descriptor.getFramesInfo(); + DataTime[] currTimes = info.getFrameTimes(); + int idx = Arrays.binarySearch(currTimes, frameTime); + // Force within range + idx = Math.min(currTimes.length - 1, Math.max(0, idx)); + descriptor.setFramesInfo(new FramesInfo(idx)); + } + @Override public void changeFrame(FrameChangeOperation operation, FrameChangeMode mode) { // Grab the current frame information diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IDescriptor.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IDescriptor.java index 88bbfd79b2..9d12d2b2cc 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IDescriptor.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IDescriptor.java @@ -143,15 +143,23 @@ public interface IDescriptor extends IResourceGroup { public DataTime getTimeForResource(AbstractVizResource, ?> rsc, int idx) { DataTime[] dt = timeMap.get(rsc); - if (dt == null - || dt.length <= idx + return getFrame(dt, idx); + } + + public DataTime getCurrentFrame() { + return getFrame(frameTimes, frameIndex); + } + + private DataTime getFrame(DataTime[] frames, int idx) { + if (frames == null + || frames.length <= idx || idx < 0 || (frameTimes != null && frameTimes.length > idx && frameTimes[idx] != null && !frameTimes[idx] .isVisible())) { return null; } - return dt[idx]; + return frames[idx]; } } @@ -377,6 +385,13 @@ public interface IDescriptor extends IResourceGroup { */ public void setTimeMatcher(AbstractTimeMatcher timeMatcher); + /** + * Re-does time matching for the descriptor + * + * @throws VizException + */ + public void redoTimeMatching() throws VizException; + /** * Synchronize time matching with the other descriptor * diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IFrameCoordinator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IFrameCoordinator.java index 127e13793f..263c5f9a03 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IFrameCoordinator.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/IFrameCoordinator.java @@ -19,6 +19,9 @@ **/ package com.raytheon.uf.viz.core.drawables; +import java.util.Date; + +import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.datastructure.LoopProperties; /** @@ -87,6 +90,20 @@ public interface IFrameCoordinator { */ public void changeFrame(FrameChangeOperation operation, FrameChangeMode mode); + /** + * Tell the coordinator to change the frame given the desired time + * + * @param frameTime + */ + public void changeFrame(Date frameTime); + + /** + * Tell the coordinator to change the frame given the desired time + * + * @param frameTime + */ + public void changeFrame(DataTime frameTime); + /** * Get the coordinators current animation mode * diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/jobs/StatsJob.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/jobs/StatsJob.java index a54c7a0142..7f5ac6d7f5 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/jobs/StatsJob.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/jobs/StatsJob.java @@ -74,32 +74,41 @@ public class StatsJob extends Job { runningThread = Thread.currentThread(); run = true; while (run) { - System.out.println(); NetworkTraffic total = stats.getTotalTrafficStats(); long sentInLastMinute = total.getBytesSent() - lastSent; long receivedInLastMinute = total.getBytesReceived() - lastReceived; long requestCountInLastMinute = total.getRequestCount() - lastRequestCount; - System.out.println("Last minute sent " + requestCountInLastMinute - + " messages for a total of " - + NetworkStatistics.toString(sentInLastMinute) - + " sent and " - + NetworkStatistics.toString(receivedInLastMinute) - + " received"); + boolean printed = false; + if (sentInLastMinute != 0.0 || receivedInLastMinute != 0.0 + || requestCountInLastMinute != 0.0) { + printed = true; + System.out.println(); + System.out.println("Last minute sent " + + requestCountInLastMinute + + " messages for a total of " + + NetworkStatistics.toString(sentInLastMinute) + + " sent and " + + NetworkStatistics.toString(receivedInLastMinute) + + " received"); + } lastSent = total.getBytesSent(); lastReceived = total.getBytesReceived(); lastRequestCount = total.getRequestCount(); - System.out.println("Total sent " + total.getRequestCount() - + " messages for a total of " - + NetworkStatistics.toString(lastSent) + " sent and " - + NetworkStatistics.toString(lastReceived) + " received"); - NetworkTraffic[] mapped = stats.getMappedTrafficStats(); - for (NetworkTraffic nt : mapped) { - System.out.println(nt); - } + if (printed) { + System.out.println("Total sent " + total.getRequestCount() + + " messages for a total of " + + NetworkStatistics.toString(lastSent) + " sent and " + + NetworkStatistics.toString(lastReceived) + + " received"); + NetworkTraffic[] mapped = stats.getMappedTrafficStats(); + for (NetworkTraffic nt : mapped) { + System.out.println(nt); + } - System.out.println(); + System.out.println(); + } try { Thread.sleep(60 * 1000); diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationManager.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationManager.java index a4520a3e5e..11d2356b4e 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationManager.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationManager.java @@ -626,7 +626,8 @@ public class LocalizationManager implements IPropertyChangeListener { // Clean up any stale files that don't exist anymore for (File check : toCheck) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); - if (available.contains(check) == false) { + // hidden files are not returned from server so ignore those + if (check.isHidden() == false && available.contains(check) == false) { String name = check.getName(); // Make sure python object files don't get removed when // .py file is still available diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractVizResource.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractVizResource.java index 7f49b0cf36..1d953662f9 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractVizResource.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractVizResource.java @@ -44,7 +44,6 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder; import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability; import com.raytheon.uf.viz.core.rsc.capabilities.Capabilities; -import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability; /** * Provides a base implementation for creating visualizations that participate @@ -330,10 +329,6 @@ public abstract class AbstractVizResource* @@ -35,7 +34,7 @@ package com.raytheon.uf.viz.core.rsc.capabilities; * @author mschenke * @version 1.0 */ - +@Deprecated public class TimeMatchBasisCapability extends AbstractCapability { /* diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/time/TimeMatchingJob.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/time/TimeMatchingJob.java index fec658cd9b..a5af323e6d 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/time/TimeMatchingJob.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/time/TimeMatchingJob.java @@ -120,23 +120,28 @@ public class TimeMatchingJob extends Job { try { long t0 = System.currentTimeMillis(); request.getTimeMatcher().redoTimeMatching(request); - System.out.println("time matching took: " - + (System.currentTimeMillis() - t0)); + long time = (System.currentTimeMillis() - t0); + if (time > 0) { + System.out.println("time matching took: " + time + "ms"); + } if (!this.keepAround) { map.remove(request); } else { this.keepAround = false; } - request.getRenderableDisplay().refresh(); - if (request.getRenderableDisplay().getContainer() instanceof IEditorPart) { - VizApp.runAsync(new Runnable() { - @Override - public void run() { - VizGlobalsManager.getCurrentInstance().updateUI( - request.getRenderableDisplay().getContainer(), - request.getRenderableDisplay()); - } - }); + if (request.getRenderableDisplay() != null) { + request.getRenderableDisplay().refresh(); + if (request.getRenderableDisplay().getContainer() instanceof IEditorPart) { + VizApp.runAsync(new Runnable() { + @Override + public void run() { + VizGlobalsManager.getCurrentInstance().updateUI( + request.getRenderableDisplay() + .getContainer(), + request.getRenderableDisplay()); + } + }); + } } } catch (Throwable e) { statusHandler.handle(Priority.CRITICAL, diff --git a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/D2DLegendResource.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/D2DLegendResource.java index 993f7daa2d..6b95b144bd 100644 --- a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/D2DLegendResource.java +++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/D2DLegendResource.java @@ -49,9 +49,9 @@ import com.raytheon.uf.viz.core.rsc.capabilities.GroupNamingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.legend.AbstractLegendResource; +import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.viz.core.rsc.BestResResource; import com.raytheon.viz.ui.actions.DummyAction; -import com.raytheon.viz.ui.cmenu.SetTimeMatchBasisAction; /** * Legend decorator for d2d. Responsible for drawing and handling mouse input @@ -361,8 +361,11 @@ public class D2DLegendResource extends AbstractDescriptor desc = (AbstractDescriptor) descriptor; if (!fromResourceGroup - && resource == desc.getTimeMatcher().getTimeMatchBasis()) { - name = "* " + name; + && desc.getTimeMatcher() instanceof D2DTimeMatcher) { + if (resource == ((D2DTimeMatcher) desc.getTimeMatcher()) + .getTimeMatchBasis()) { + name = "* " + name; + } } if (this.mode == LegendMode.SHORT_PRODUCT && !fromResourceGroup @@ -387,8 +390,12 @@ public class D2DLegendResource extends ResourceList list = ((IResourceGroup) rscGroup.getResourceData()) .getResourceList(); boolean tmb = false; - AbstractVizResource, ?> basis = ((AbstractDescriptor) descriptor) - .getTimeMatcher().getTimeMatchBasis(); + AbstractVizResource, ?> basis = null; + AbstractDescriptor desc = (AbstractDescriptor) descriptor; + if (desc.getTimeMatcher() instanceof D2DTimeMatcher) { + basis = ((D2DTimeMatcher) desc.getTimeMatcher()) + .getTimeMatchBasis(); + } DataTime timeToUse = null; if (rscGroup.hasCapability(GroupNamingCapability.class) == false || groupName == null) { diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/SetTimeMatchBasisAction.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/SetTimeMatchBasisAction.java similarity index 82% rename from cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/SetTimeMatchBasisAction.java rename to cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/SetTimeMatchBasisAction.java index b3ede91239..06ae518e89 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/SetTimeMatchBasisAction.java +++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/legend/SetTimeMatchBasisAction.java @@ -17,13 +17,14 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.ui.cmenu; +package com.raytheon.uf.viz.d2d.core.legend; import org.eclipse.jface.action.IAction; 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.viz.core.AbstractTimeMatcher; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.drawables.AbstractDescriptor; import com.raytheon.uf.viz.core.drawables.ResourcePair; @@ -32,7 +33,8 @@ import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.uf.viz.core.rsc.capabilities.BlendableCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability; +import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; +import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; /** * Time match basis action, sets the selected resource as the time match basis @@ -90,8 +92,10 @@ public class SetTimeMatchBasisAction extends AbstractRightClickAction { try { AbstractDescriptor descriptor = (AbstractDescriptor) rsc .getDescriptor(); - descriptor.getTimeMatcher().changeTimeMatchBasis(rsc); - descriptor.getTimeMatcher().redoTimeMatching(descriptor); + D2DTimeMatcher tm = (D2DTimeMatcher) descriptor + .getTimeMatcher(); + tm.changeTimeMatchBasis(rsc); + tm.redoTimeMatching(descriptor); for (IDisplayPane pane : container.getDisplayPanes()) { if (pane.getDescriptor() != descriptor) { @@ -115,8 +119,8 @@ public class SetTimeMatchBasisAction extends AbstractRightClickAction { public boolean isChecked() { boolean tmb = false; AbstractVizResource, ?> rsc = getTopMostSelectedResource(); - AbstractVizResource, ?> basis = rsc.getDescriptor().getTimeMatcher() - .getTimeMatchBasis(); + AbstractVizResource, ?> basis = ((D2DTimeMatcher) rsc.getDescriptor() + .getTimeMatcher()).getTimeMatchBasis(); if (basis == rsc) { tmb = true; @@ -142,21 +146,12 @@ public class SetTimeMatchBasisAction extends AbstractRightClickAction { @Override public boolean isHidden() { AbstractVizResource, ?> rsc = getTopMostSelectedResource(); - if (rsc.hasCapability(TimeMatchBasisCapability.class) == false) { - if (rsc.hasCapability(BlendableCapability.class)) { - ResourceList list = rsc - .getCapability(BlendableCapability.class) - .getResourceList(); - for (ResourcePair rp : list) { - if (rp.getResource().hasCapability( - TimeMatchBasisCapability.class)) { - return false; - } - } - } - return true; + AbstractTimeMatcher tm = rsc.getDescriptor().getTimeMatcher(); + if (tm instanceof D2DTimeMatcher) { + // If on D2DTimeMatcher, hide only if time agnostic resource + return rsc.isTimeAgnostic(); } - return false; + return true; } } diff --git a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java index d9b61c719c..1048c12fc6 100644 --- a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java +++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java @@ -35,7 +35,6 @@ import javax.xml.bind.annotation.XmlAttribute; import org.apache.commons.lang.Validate; import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -80,8 +79,7 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties; * @version 1.0 */ @XmlAccessorType(XmlAccessType.NONE) -public class D2DTimeMatcher extends AbstractTimeMatcher implements - ISerializableObject { +public class D2DTimeMatcher extends AbstractTimeMatcher { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(D2DTimeMatcher.class); @@ -409,10 +407,12 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements TimeMatchingConfiguration config = getConfiguration(timeMatchBasis .getLoadProperties()); DataTime[] times = config.getLastFrameTimes(); - if (times == null || config.getLastBaseTimes() != null) { + if (times == null || config.getLastBaseTimes() != null + || config.getLastFrameCount() != numberOfFrames) { times = makeEmptyLoadList(numberOfFrames, timeMatchBasis); config.setLastFrameTimes(times); config.setLastBaseTimes(null); + config.setLastFrameCount(numberOfFrames); } if (times != null) { return times; @@ -781,15 +781,12 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements return dataTimesToLoad; } - /* - * (non-Javadoc) + /** + * Changes the time match basis for the time matcher to be the specified + * resource * - * @see - * com.raytheon.uf.viz.core.AbstractTimeMatcher#changeTimeMatchBasis(com - * .raytheon.uf.viz.core.rsc.AbstractVizResource, - * com.raytheon.uf.viz.core.drawables.IDescriptor) + * @param resource */ - @Override public void changeTimeMatchBasis(AbstractVizResource, ?> resource) { if (timeMatchBasis != resource) { if (timeMatchBasis != null) { @@ -814,7 +811,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements } } - @Override + /** + * Returns the time match basis for the D2DTimeMatcher + * + * @return + */ public AbstractVizResource, ?> getTimeMatchBasis() { return timeMatchBasis; } diff --git a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/TimeMatchingConfiguration.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/TimeMatchingConfiguration.java index c8ac0366a5..6b5d184b11 100644 --- a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/TimeMatchingConfiguration.java +++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/TimeMatchingConfiguration.java @@ -67,6 +67,9 @@ public class TimeMatchingConfiguration { // The result of the last time matching. private DataTime[] lastFrameTimes; + // The number of frames time matched against + private int lastFrameCount; + /** * Default Constructor */ @@ -230,4 +233,12 @@ public class TimeMatchingConfiguration { this.lastFrameTimes = lastFrameTimes; } + public void setLastFrameCount(int lastFrameCount) { + this.lastFrameCount = lastFrameCount; + } + + public int getLastFrameCount() { + return lastFrameCount; + } + } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeBasisHandler.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeBasisHandler.java index 1e407de81c..5cb728d45a 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeBasisHandler.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeBasisHandler.java @@ -23,6 +23,7 @@ import com.raytheon.uf.viz.core.AbstractTimeMatcher; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.viz.ui.EditorUtil; /** @@ -68,11 +69,11 @@ public class LoadModeBasisHandler extends LoadModeHandler { return; } AbstractTimeMatcher timeMatcher = descriptor.getTimeMatcher(); - if (timeMatcher == null) { + if (timeMatcher instanceof D2DTimeMatcher == false) { setBaseEnabled(false); return; } - if (timeMatcher.getTimeMatchBasis() != null) { + if (((D2DTimeMatcher) timeMatcher).getTimeMatchBasis() != null) { setBaseEnabled(false); return; } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeOverlayHandler.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeOverlayHandler.java index 5f18fa7e51..b3aae15fcd 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeOverlayHandler.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/LoadModeOverlayHandler.java @@ -23,6 +23,7 @@ import com.raytheon.uf.viz.core.AbstractTimeMatcher; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.viz.ui.EditorUtil; /** @@ -67,11 +68,11 @@ public class LoadModeOverlayHandler extends LoadModeHandler { return; } AbstractTimeMatcher timeMatcher = descriptor.getTimeMatcher(); - if (timeMatcher == null) { + if (timeMatcher instanceof D2DTimeMatcher == false) { setBaseEnabled(false); return; } - if (timeMatcher.getTimeMatchBasis() == null) { + if (((D2DTimeMatcher) timeMatcher).getTimeMatchBasis() == null) { setBaseEnabled(false); return; } diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java index a08f5278f8..e8b5df40c3 100644 --- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java +++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/HydroDisplayManager.java @@ -299,12 +299,14 @@ public class HydroDisplayManager { // Get the Grib data Map reqMap = new HashMap (); - reqMap.put(GridConstants.PLUGIN_NAME, new RequestConstraint(GridConstants.GRID)); + reqMap.put(GridConstants.PLUGIN_NAME, new RequestConstraint( + GridConstants.GRID)); reqMap.put(GridConstants.PARAMETER_ABBREVIATION, new RequestConstraint(paramAbr)); reqMap.put("dataTime.refTime", new RequestConstraint(sdf.format(date))); - reqMap.put(GridConstants.DATASET_ID, new RequestConstraint("FFG-" + rfc)); + reqMap.put(GridConstants.DATASET_ID, new RequestConstraint("FFG-" + + rfc)); try { LayerProperty lp = new LayerProperty(); @@ -465,12 +467,14 @@ public class HydroDisplayManager { // Get the Grib data Map reqMap = new HashMap (); - reqMap.put(GridConstants.PLUGIN_NAME, new RequestConstraint(GridConstants.GRID)); + reqMap.put(GridConstants.PLUGIN_NAME, new RequestConstraint( + GridConstants.GRID)); reqMap.put(GridConstants.PARAMETER_ABBREVIATION, new RequestConstraint(paramAbr)); reqMap.put("dataTime.refTime", new RequestConstraint(sdf.format(date))); - reqMap.put(GridConstants.DATASET_ID, new RequestConstraint("FFG-" + rfc)); + reqMap.put(GridConstants.DATASET_ID, new RequestConstraint("FFG-" + + rfc)); try { LayerProperty lp = new LayerProperty(); @@ -725,9 +729,8 @@ public class HydroDisplayManager { loopProps.setFwdFrameTime(frameRate); loopProps.setLooping(true); - md.getTimeMatcher().changeTimeMatchBasis(timeLapseRsc); try { - md.getTimeMatcher().redoTimeMatching(md); + md.redoTimeMatching(); } catch (VizException e) { e.printStackTrace(); } diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java index 7c51dc064c..58d0a88c98 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java @@ -416,7 +416,7 @@ public class MPEDisplayManager { .getInstance().getCurrentWindow() .getService(ICommandService.class)) .getCommand("com.raytheon.viz.mpe.ui.actions.toggleGageColor"); -// dataSaved = true; + // dataSaved = true; currentDate = MPEDataManager.getInstance().getLatestDate(); displayFieldType = DisplayFieldData.mMosaic; displayMode = EnumSet.noneOf(DisplayMode.class); @@ -523,7 +523,8 @@ public class MPEDisplayManager { return; } } else { - // if saved, then reset to false since it isn't saved for the next time + // if saved, then reset to false since it isn't saved for the next + // time setDataSaved(false); } @@ -666,7 +667,7 @@ public class MPEDisplayManager { List pColorSet = GetColorValues.get_colorvalues(user_id, app_name, displayFieldType.getCv_use(), accum_interval * 60 * 60, "E", pColorSetGroup); -// displayFieldType.getCv_duration(), "E", pColorSetGroup); + // displayFieldType.getCv_duration(), "E", pColorSetGroup); switch (displayFieldType) { case rMosaic: @@ -758,11 +759,10 @@ public class MPEDisplayManager { descriptor.setNumberOfFrames(getTimeLapseHours()); MPEDisplayManager.getCurrent().setDisplayedResource(timeLapseRsc); - descriptor.getTimeMatcher().changeTimeMatchBasis(timeLapseRsc); try { descriptor .setFramesInfo(new FramesInfo(timeLapseRsc.getDataTimes())); - descriptor.getTimeMatcher().redoTimeMatching(descriptor); + descriptor.redoTimeMatching(); } catch (VizException e) { statusHandler.error("Error while redoing Time Matching ", e); } @@ -813,7 +813,7 @@ public class MPEDisplayManager { } } displayedResource = null; -// dataSaved = true; + // dataSaved = true; } /** @@ -1287,13 +1287,13 @@ public class MPEDisplayManager { private void save_merged_RFCW(String fileName, String processFlag) { XmrgFile xmrg = ((XmrgResource) displayedResource).getXmrgFile(); if (xmrg == null) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - MessageBox box = new MessageBox(shell, SWT.ERROR); - box.setText("Cannot Save"); - box.setMessage("No Data Available, cannot save"); - box.open(); - return; + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + MessageBox box = new MessageBox(shell, SWT.ERROR); + box.setText("Cannot Save"); + box.setMessage("No Data Available, cannot save"); + box.open(); + return; } xmrg.setData(((XmrgResource) displayedResource).getData()); short[] data = xmrg.getData(); diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGSMResource.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGSMResource.java index a785d6d5cd..7fceda18e3 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGSMResource.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGSMResource.java @@ -39,7 +39,6 @@ import com.raytheon.uf.viz.core.exception.VizException; 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.ImagingCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability; import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability; import com.raytheon.viz.radar.RadarHelper; import com.raytheon.viz.radar.interrogators.IRadarInterrogator; @@ -80,7 +79,6 @@ public class RadarGSMResource extends AbstractRadarResource { // remove the uneeded capabilities getCapabilities().removeCapability(ImagingCapability.class); getCapabilities().removeCapability(RangeRingsOverlayCapability.class); - getCapabilities().removeCapability(TimeMatchBasisCapability.class); color = getCapability(ColorableCapability.class).getColor(); } diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGraphResource.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGraphResource.java index 9e7cbc5707..6793727e88 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGraphResource.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarGraphResource.java @@ -48,7 +48,6 @@ 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.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.xy.map.rsc.IInsetMapResource; import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability; @@ -100,7 +99,6 @@ public class RadarGraphResource extends getCapabilities().removeCapability(ImagingCapability.class); getCapabilities().removeCapability(RangeRingsOverlayCapability.class); - getCapabilities().removeCapability(TimeMatchBasisCapability.class); this.dataTimes = new ArrayList (); this.allDataGraphSets = new HashMap >(); @@ -428,7 +426,8 @@ public class RadarGraphResource extends private CellTrendDataPacket getNearestCell(String point, Map symbologyData) { - Coordinate pointCoord = PointsDataManager.getInstance().getCoordinate(point); + Coordinate pointCoord = PointsDataManager.getInstance().getCoordinate( + point); CellTrendDataPacket nearestCell = null; CellTrendDataPacket currCell = null; diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarXYResource.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarXYResource.java index c41016fd04..8474fd0911 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarXYResource.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/xy/RadarXYResource.java @@ -58,7 +58,6 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability; import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability; import com.raytheon.viz.core.contours.util.VectorGraphicsRenderable; import com.raytheon.viz.radar.RadarHelper; @@ -114,7 +113,6 @@ public class RadarXYResource extends RadarImageResource { getCapabilities().removeCapability(ImagingCapability.class); getCapabilities().removeCapability(RangeRingsOverlayCapability.class); - getCapabilities().removeCapability(TimeMatchBasisCapability.class); this.dataTimes = new ArrayList (); } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/MenuLoader.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/MenuLoader.java index 4e331cffea..4c6f180cd4 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/MenuLoader.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/MenuLoader.java @@ -36,6 +36,7 @@ import com.raytheon.uf.viz.core.AbstractTimeMatcher; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; @@ -94,9 +95,10 @@ public class MenuLoader extends Job { /** * Update the frame count based on what has been listed in the - * bundle if we don't have a time match basis already + * bundle if we don't have times already loaded */ - if (existingDescriptor.getTimeMatcher().getTimeMatchBasis() == null) { + FramesInfo info = existingDescriptor.getFramesInfo(); + if (info.getFrameCount() == 0) { existingDescriptor.setNumberOfFrames(loadFrom.getDescriptor() .getNumberOfFrames()); } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java index c04a0f8c48..811fcf2a0b 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java @@ -1597,7 +1597,7 @@ public class NsharpResourceHandler { }*/ //set data time to descriptor //this is necessary for looping - if (( skewtPaneRsc.getDescriptor().getTimeMatcher() == null || skewtPaneRsc.getDescriptor().getTimeMatcher().getTimeMatchBasis() == null)&& !getTimeMatcher) { + if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) { //DataTime[] dataTimes = new DataTime[dataTimelineList.size()]; //Chin Note: we just have to do this once and set dataTimes size bigger than 1. //Nsharp handles changing frame itself. It just need system to send change frame notice. diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/skewt/rsc/NsharpSkewTResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/skewt/rsc/NsharpSkewTResource.java index e8cdd81032..88b11ed1e4 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/skewt/rsc/NsharpSkewTResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/skewt/rsc/NsharpSkewTResource.java @@ -1670,7 +1670,7 @@ public class NsharpSkewTResource extends AbstractVizResource resource, - // IDescriptor descriptor) { - public void changeTimeMatchBasis(AbstractVizResource, ?> resource) { - if (resource != null) { - this.dominantRscData = (AbstractNatlCntrsRequestableResourceData) resource - .getResourceData(); - dominantResourceName = dominantRscData.getResourceName(); - } - } - // This is called by raytheon's NcAutoUpdater // Assume that the frameTimes have been changed. We will need to update the @@ -739,9 +727,4 @@ public class NCTimeMatcher extends AbstractTimeMatcher implements return frameTimes.toArray(new DataTime[0]); } - @Override - public AbstractVizResource, ?> getTimeMatchBasis() { - return null; - } - } \ No newline at end of file