diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java index df709b5a4b..20503d6a74 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java @@ -64,7 +64,7 @@ import com.raytheon.viz.gfe.rsc.GFEResource; * Nov 14, 2012 mschenke Initial creation * Feb 26, 2013 1708 randerso Fixed double notification for time change * Jan 23, 2014 2703 bsteffen Add JAXB Annotations, fix iscMode. - * + * Apr 02, 2014 2961 randerso Code cleanup (Ben already fixed issue under #2703) * * * @@ -151,10 +151,6 @@ public class GFETimeMatcher extends AbstractTimeMatcher { parms.add(iscParm); } tmbResources.add(rsc); - DataManager dataManager = parm.getDataManager(); - if (dataManager.getParmManager().iscMode()) { - parms.add(dataManager.getIscDataAccess().getISCParm(parm)); - } } } @@ -164,8 +160,8 @@ public class GFETimeMatcher extends AbstractTimeMatcher { dateSet.add(new DataTime(stepTime)); } - if (currTime != null && selectedDate == null - && dateSet.contains(currTime) == false) { + if ((currTime != null) && (selectedDate == null) + && (dateSet.contains(currTime) == false)) { selectedDate = currTime.getRefTime(); } @@ -285,7 +281,7 @@ public class GFETimeMatcher extends AbstractTimeMatcher { * @param parms * @return */ - public static List calcTimeSteps(List parms) { + private static List calcTimeSteps(List parms) { SortedSet dateSet = new TreeSet(); for (Parm pi : parms) { IGridData[] inv = pi.getGridInventory(); @@ -294,9 +290,9 @@ public class GFETimeMatcher extends AbstractTimeMatcher { if (!dateSet.contains(grid.getGridTime().getEnd())) { for (Parm pk : parms) { - if (pi != pk - && pk.overlappingGrid(grid.getGridTime() - .getEnd()) != null) { + if ((pi != pk) + && (pk.overlappingGrid(grid.getGridTime() + .getEnd()) != null)) { dateSet.add(grid.getGridTime().getEnd()); break; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFESpatialDisplayManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFESpatialDisplayManager.java index 8f725b3865..b020c7f0ad 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFESpatialDisplayManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/internal/GFESpatialDisplayManager.java @@ -32,6 +32,8 @@ import org.opengis.geometry.Envelope; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; import com.raytheon.uf.common.geospatial.MapUtil; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.drawables.IDescriptor; @@ -52,6 +54,9 @@ import com.raytheon.viz.gfe.core.ISampleSetManager; import com.raytheon.viz.gfe.core.msgs.IDisplayedParmListChangedListener; import com.raytheon.viz.gfe.core.msgs.ISampleSetChangedListener; import com.raytheon.viz.gfe.core.msgs.ISpatialEditorTimeChangedListener; +import com.raytheon.viz.gfe.core.msgs.Message; +import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient; +import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg; import com.raytheon.viz.gfe.core.parm.Parm; import com.raytheon.viz.gfe.rsc.GFEReferenceSetResource; import com.raytheon.viz.gfe.rsc.GFEResource; @@ -72,7 +77,9 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * 10/06/2008 1433 chammack Removed log listener * 12/02/2008 1450 randerso Moved getEditors method into UiUtil for general use * 04/09/2009 1288 rjpeter Add sample set listener,ensure remove called for listeners - * 08/20/2009 2310 njensen Separated most logic out into AbstractSpatialDisplayManager + * 08/20/2009 2310 njensen Separated most logic out into AbstractSpatialDisplayManager + * 04/02/2014 2961 randerso Added a listener to redo time matching when ISC mode changes + * * * * @author chammack @@ -80,14 +87,8 @@ import com.raytheon.viz.ui.editor.AbstractEditor; */ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager - implements IDisplayedParmListChangedListener, IFrameChangedListener { - - private final ISampleSetChangedListener sampleSetListener = new ISampleSetChangedListener() { - @Override - public void sampleSetChanged(ISampleSetManager sampleSetMgr) { - GFESpatialDisplayManager.this.refresh(); - } - }; + implements IDisplayedParmListChangedListener, IFrameChangedListener, + ISampleSetChangedListener, IMessageClient { private boolean isRegistered; @@ -120,6 +121,9 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager } } } + + Message.registerInterest(this, ShowISCGridsMsg.class); + setShowDescription(wxd_val); } @@ -148,7 +152,7 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager this.dataManager.getParmManager() .addDisplayedParmListChangedListener(this); this.dataManager.getSampleSetManager() - .addSampleSetChangedListener(sampleSetListener); + .addSampleSetChangedListener(this); isRegistered = true; } @@ -168,8 +172,8 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager GridLocation gloc = parmManager.compositeGridLocation(); GridGeometry2D gridGeometry = MapUtil.getGridGeometry(gloc); Envelope envelope = gridGeometry.getEnvelope(); - double colorBarHeight = GFEColorbarResource.HEIGHT - * envelope.getSpan(1) / pane.getBounds().height; + double colorBarHeight = (GFEColorbarResource.HEIGHT * envelope + .getSpan(1)) / pane.getBounds().height; PythonPreferenceStore prefs = Activator.getDefault() .getPreferenceStore(); @@ -191,10 +195,10 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager expandBottom = prefs.getDouble("OfficeDomain_expandBottom"); } - double dxLeft = (envelope.getSpan(0) * expandLeft / 100.0); - double dxRight = (envelope.getSpan(0) * expandRight / 100.0); - double dyTop = (envelope.getSpan(1) * expandTop / 100.0); - double dyBottom = (envelope.getSpan(1) * expandBottom / 100.0); + double dxLeft = ((envelope.getSpan(0) * expandLeft) / 100.0); + double dxRight = ((envelope.getSpan(0) * expandRight) / 100.0); + double dyTop = ((envelope.getSpan(1) * expandTop) / 100.0); + double dyBottom = ((envelope.getSpan(1) * expandBottom) / 100.0); GeneralEnvelope newEnvelope = new GeneralEnvelope( envelope.getCoordinateReferenceSystem()); @@ -318,15 +322,17 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager * * @throws VizException */ + @SuppressWarnings("unchecked") public void dispose() throws VizException { synchronized (this) { if (isRegistered) { this.dataManager.getSampleSetManager() - .removeSampleSetChangedListener(sampleSetListener); + .removeSampleSetChangedListener(this); this.dataManager.getParmManager() .removeDisplayedParmListChangedListener(this); isRegistered = false; } + Message.unregisterInterest(this, ShowISCGridsMsg.class); } } @@ -363,6 +369,33 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager } } + @Override + public void sampleSetChanged(ISampleSetManager sampleSetMgr) { + refresh(); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.gfe.core.msgs.Message.IMessageClient#receiveMessage( + * com.raytheon.viz.gfe.core.msgs.Message) + */ + @Override + public void receiveMessage(Message message) { + if (message instanceof ShowISCGridsMsg) { + for (IDescriptor descriptor : getDescriptors()) { + try { + // ISC mode affects GFE time matching + descriptor.redoTimeMatching(); + } catch (VizException e) { + UFStatus.getHandler().handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } + } + } + } + /* * (non-Javadoc) * @@ -375,7 +408,7 @@ public class GFESpatialDisplayManager extends AbstractSpatialDisplayManager @Override public void frameChanged(IDescriptor descriptor, DataTime oldTime, DataTime newTime) { - if (newTime != null && oldTime != null && seTime != null + if ((newTime != null) && (oldTime != null) && (seTime != null) && oldTime.getRefTime().equals(seTime)) { // time was set to seTime, frame changed, set seTime to null setSpatialEditorTime(null);